Posts

Rails 2.3: Immediately redirect before after_filter executes -

This is in Rails 2.3.10 and Ruby 1.8. I have some code that looks almost like this: class redirection controller after_filter: do_something_long ,: only => [: Show] Df show redirect_to "http://www.google.com" end DEF do_something_long sleep 60 logger.debug ("completed some time ago") and end now My problem is that even though I see in the log that the redirection has been executed, it actually waits until the completion of sleep 60 before it is redirected. Is there a way to redo the redirects sent to the browser and then run do_something_long. As a side note, I am trying to avoid delaying something like work or rick. Like a while - this is a long way since the user does not wait to complete it Is designed to start and complete background tasks (and freeze the UI) for how long the work is taking? If it is completed in milliseconds then most people will not even get the notice, but if you get too late then you should be excited when digging. Do you...

jQuery Loading external content in Div, link problem -

I have loaded content from an external site into jQuery in a div, but when I have a link in the loaded content Clicking opens it as your page, is there a way to restrict the link to open the page, it is still contained in the device? The way I think is to set the "href" entry of all the links to "#" The only way to find out the code below. $ ("# div"). ("A"). Attr ("href", "#") Hope this is useful!

ios - Cocos2d sprites not working on device -

My game works well in the simulator but there are problems with sprites on the device, so a line will return an error like this: img = [CCSprite spriteWithSpriteFrameName: @ "img.png"]; then: Failure in - [CCSprite initWithTestructure: rect:], / user / new user / document / uni / lbs / cocos 2d / CCSprist M: 171 Someone suggested that some devices can not handle more than 1024 × 1024 cellsheets, is this true? Because my is 1024x2048, but 2 spritesheets are very hard to make, so I was looking for confirmation of this before? Thank you. old devices from 3GS (iPhone 3G, iPod 1 and 2) are limited to 1024 * 1024 textures new Devices can be used up to 2048 * 2048

ios - How do I import project settings from one Xcode project to another -

I have just upgraded my encoder, and created a blank new project, and found that there are several new settings in it My old Xcode projects are not present Consequently, when I build and run my old projects, I get weird warnings that I did not have before. I think this is the case of having good factory defaults coming up with new projects. There is an easy way to move me into new project settings. Right now, I have to create a new empty project, and (almost one-by-one), all my files have to be moved and more than one group, and everything stitch together again. Use instead of build panel. You can also do it. Some of these have changed into Xcode 4, but most still apply.

python - Use underscore builtin in script -

In an interactive console (in Python) I can do this; k = 5 df generator (I): I + = Generator for J. Generator (J): J Print _ Where _ variables take the latest value. This can be very useful for me, when I want to loop through a generator and print an incorrect statement and raise an exception. However, when you run a script, _ does not appear - E. G. $ python my_script.py . (I tried to use __biltine __._ but it fails.) Whether to reach _ while running a script Any way If not, what are the options that I can take advantage of? _ is a special variable that is present in interactive sessions. However, due to the scrolling rules of Python, the j variable remains in existence when the for loop ends. Therefore, you can simply: Generator (j) in J for : near print j

android - Hide default buttons in DialogPreference -

I currently have a custom dialog class that extends DialogPreference (which is definitely part of a PreferenceScreen). In this dialog there are custom buttons that save and cancel, so I would like to get rid of the standard "positive" and "negative" buttons. AlertDialog tried using the getButton method but no success. in your XML instead of the DialoguePropference: Priority Android: Title = "This works as a button" Android: Key = "Button" Android: Summary = "It can act as a button to create its own dialog" /> Then in Java: preference button = (priority) searchpress ("button"); Button .setOnPreferenceClickListener (new Preference.OnPreferenceClickListener () {@Override Public boolean onPreferenceClick (priority arg0) {showDialog (MY_DIALOG); // Assume MY_DIALOG 'final int MY_DIALOG = 1;' Class false false;} The body}); Then add to your class body: @Override Safe Dialogue onCreateDialog {in...

Entity Framework Code First Saving Multiple Records for the same primary/foreign key -

Text after " The person has two equal tables, the difference is that each person has only one record in the PersonPreference table, but in the PersonRoles table There may be many. Both personality and personality are both primary and foreign key (Person_ID): & lt; Table ("person") & gt; _ Public class person & lt; Key () & gt; _ Public property Person_ID as the name of the public property ObservableCollection (PersonRole) End String as the line of the public overridable property PersonPreference PersonPreference Public, as overridable property PersonRoles, Table ("PersonPreference") & gt ; _ Public class person confirmation & lt; Key () & gt; _ Public property person_id as an integer public property car string public property color as string and class & lt; Table ("Personroll") & gt; _ Public Class Personnel & Lieutenant; Key () & gt; _Public property Person_ID Integer public property role string endi...