Posts

ruby on rails - friendly_id and new records -

I am using friendly_id 4.0.0.beta8 and want to generate url which uses slug, but Still the model is id It seems that friendly_id first generates slugs before_validation However, at this time (before saving) there is definitely no Model ID available and so creates friendly ID without slug. How can I ensure that the new records will be slashed with the ID after initial saving? I'm the author of Frugal ID. tries to solve the problem that exists on the text ID without numeric ID with the Friend ID. So if you're just getting model ID in the lattice, then you probably do not use FriendlyId to avoid that extra complexity and that model; You may only be able to override the toparor: def to_param "# {id} - {title.parameterize}" end

flash - Embed an SWF file in Flex and interact with ExternalInterface functions -

I use a SWF file that exposes functions and events using ExternalInterface. Here is an example of an exposed function: ExternalInterface.addClallback ("myfunction", ExecuteMyFunction); If I embed a file in an HTML page, then I can use those functions using Javascript. Now, I'm dynamically embedting a similar SWF file in Flex using the MX app: SWFLoader component, like something: & lt; Mx: SWFLoader id = "myLoader" source = "http: //localhost/file.swf" autoLoad = "true" /> I am trying to reach those exposed functions and events, but I have not found the way to interact with them with the Flex app. I would like to be able to call functions like javascript, like: myLoader.myFunction (); How can I use a function that is exposed to an external frame inside Flex? Basically you need to do something like this: Var mySubApp: * = (myLoader.content as a SystemManager). Application; MySubApp.myFunction (); There ...

jQuery - Determine user vs programmatic event -

मेरे पास & lt; select & gt; है और मैं change () घटना जब उपयोगकर्ता चुनिंदा विकल्प को बदलता है तो मैं कई कार्यों की एक श्रृंखला करना चाहता हूं। लेकिन, अगर मैं $ (item) .trigger ('change') के माध्यम से बदलाव को ट्रिगर करता हूं तो मैं कार्यवाही की शृंखला को निष्पादित नहीं करना चाहता। मैं एक अधिभार देखता हूं मापदंडों। मुझे यकीन नहीं है कि यह काम करेगा क्योंकि मैंने एक कस्टम इवेंट नहीं लिखा है। तो, उपयोगकर्ता द्वारा निकाल दिया गया घटना और मेरा प्रोग्राममैटिक निकाल दिया गया ईवेंट के बीच अंतर को निर्धारित करने के लिए मुझे क्या करना चाहिए? ऐसा करने का एक त्वरित और गंदे तरीका है: var progChange = false; $ ('चुनें')। परिवर्तन (फ़ंक्शन () {if (! ProgChange) {// उपयोगकर्ता कार्रवाई ...} progChange = false;}); फ़ंक्शन कॉल सेलेक्ट चेंज () {progChange = true; $ ( 'चुनें') को बदलने ()।; } आप इसे अनिवार्यतः उसी तरह से ट्रिगर विधि से कर सकते हैं, और यह वैश्विक को खत्म कर देगा, जो एक अच्छी बात है: $ ('select')। परिवर्तन (फ़ंक्शन (इवेंट, ...

decorator - Python: Overriding a Unknown class -

इस उदाहरण पर विचार करें: x = a.some_class_instance x.foo () मैं x.foo () की तर्ज पर कुछ करना चाहता हूं @ x Foo () def dec () प्रिंट 'डेकोरेटर' x.foo () क्या ऐसा करने के लिए कोई रास्ता है? धन्यवाद:) आसान तरीका यह करना है: X.foo = dec (x.foo) उदाहरण के वर्ग का विस्तार करने का दूसरा तरीका x = a.some_class_instance वर्ग विस्तारित (x .__ class__ ): @ डीईसीटी एफई (...): ... लेकिन मुझे ऐसा करने का कोई अच्छा कारण नहीं देख सकता।

mysql - Join tables only where value not in table B -

I am trying to join 2 tables and are not showing a value that does not exist. Table_Items: item_id, title, etc. Table_History: item_id, history_id, action, date Many possible actions (purchased, added for each disk) , Played, smash, etc.) Each action takes an item_id by link table_new line in history. The query that I'm searching for will return all the disks which are not ripped. My query returns many rows, everything is returned because there is at least one entry in the history table for each item. SELECT items.item_id, items.title AS heading, item. / Creator, history. Skip item from item Join history at item Iitem_id = history.item_id where history. The process 'Arp% No' group item by using the .item_id title I'm using Mysql help would be appreciated! You are welcome. Just add the action filter to include and then empty (anti-joint) in which SELECT items.item_id, items.title AS heading, item. 'Authors / Producers', History Exclude act...

c# - How can I loop through a DataGridView created on the main form in a BackgroundWorker? -

I want to loop through a datagrid view that is mainly exporting data to a CSV file in a background vendor Designed for Backgroundworker has been made on a different form where the progress of exports will be displayed through the progress bar. Here is the export form code, which is called BackgroundWorker: Private Data Grid View Export Grid; Public Zero Export CSG (DataGrid View Main Grid) {this.exportGrid = mainGrid; // Set progress bar maximum progress. Bayer 1 Max = main grid Rows. Calculation; If (backgroundWorker1.IsBusy! = True) {// Start Asynchronous Operation Background Worker 1. RunWorkerAsync (); } // Show this look ShowDialog (); } Private zero background by 1_DoWork (Object Sender, DoWorkEventArgs e) {BackgroundWorker worker = Sender as BackgroundWorker; // Write data rows foreach (DataGridViewRow line in ExportGrid.Rows) {// Check if the background worker has been canceled (worker.CancellationPending == true) {e.Cancel = true; break; } Else {foreach (DataGridViewCel...

asp.net - How to properly configure Spring.NET in a web context -

I have a problem keeping the values ​​from appearing in the scope of all users. I'm not sure what I'm doing wrong, but I'm finally on intelligence. I'm thinking that I have a container object wrong or I'm crossing values ​​with WebContacts. First of all, it is what I am doing in code. It works, but it is showing details for the first user who logs in the site (Note: My pagestore is only a type of type IDictionary which stores values ​​for sharing all user controls on the page ): using (basepage page = (basepage) (spring.web.ui.page) .content.Handler) {if ((Page. Page Story ("Login ID ")! = Null)) {this.Model.LoginId = Convert.ToString (page.PageStore (" L OginID ")); }} Second, I have tried various scopes for my objects but I am coming out here. Here's how my object is currently configured in the container: / P> Snippet of my business category configuration & lt ;! - Transaction Management Strategy - Local Database Tran...