Vincent Tsao's Library tagged → View Popular, Search in Google
-
If you want to set up a 1–1 relationship between two models, you’ll need to add belongs_to to one, and has_one to the other. How do you know which is which?
The distinction is in where you place the foreign key (it goes on the table for the class declaring the belongs_to association), but you should give some thought to the actual meaning of the data as well. The has_one relationship says that one of something is yours – that is, that something points back to you. For example, it makes more sense to say that a supplier owns an account than that an account owns a supplier.
-
Score = (P-1) / (T+2)^G where, P = points of an item (and -1 is to negate submitters vote) T = time since submission (in hours) G = Gravity, defaults to 1.8 in news.arc
in list: Andriod
-
From the class that extends WebView:
public void selectAndCopyText() {
try {
Method m = WebView.class.getMethod("emulateShiftHeld", null);
m.invoke(this, null);
} catch (Exception e) {
throw new AssertionError(e);
}
}And then you have to use ClipboardManager to watch for new text.
P.S. Historical note: this hack is based on Android 1.5 WebView implementation.
-
In some cases, you might need a fragment to share events with the activity. A good way to do that is to define a callback interface inside the fragment and require that the host activity implement it. When the activity receives a callback through the interface, it can share the information with other fragments in the layout as necessary.
-
The most significant difference in lifecycle between an activity and a fragment is how one is stored in its respective back stack. An activity is placed into a back stack of activities that's managed by the system when it's stopped, by default (so that the user can navigate back to it with the BACK key, as discussed in Tasks and Back Stack). However, a fragment is placed into a back stack managed by the host activity only when you explicitly request that the instance be saved by calling
addToBackStack()during a transaction that removes the fragment. - 4 more annotation(s)...
-
PhoneGap is an open source development framework for building cross-platform mobile apps. Build apps in HTML and JavaScript and still take advantage of core features in iPhone/iPod touch, iPad, Google Android, Palm, Symbian and Blackberry SDKs.
-
This article describes a technique you can use to find out whether the system contains any application capable of responding to the intent you want to use. The example below shows a helper method that queries the system package manager to determine whether there's an app that can respond to a specified intent. Your application can pass an intent to the method and then, for example, show or hide user options that the user would normally use to trigger the intent.
-
/**
* Indicates whether the specified action can be used as an intent. This
* method queries the package manager for installed packages that can
* respond to an intent with the specified action. If no suitable package is
* found, this method returns false.
*
* @param context The application's environment.
* @param action The Intent action to check for availability.
*
* @return True if an Intent with the specified action can be sent and
* responded to, false otherwise.
*/
public static boolean isIntentAvailable(Context context, String action) {
final PackageManager packageManager = context.getPackageManager();
final Intent intent = new Intent(action);
List<ResolveInfo> list =
packageManager.queryIntentActivities(intent,
PackageManager.MATCH_DEFAULT_ONLY);
return list.size() > 0;
} - 1 more annotation(s)...
-
Pik is a tool to manage multiple versions of ruby on Windows. It can be used from the Windows command line (cmd.exe), Windows PowerShell, or Git Bash. I have yet to test on cygwin.
-
Resque is our Redis-backed library for creating background jobs, placing those jobs on multiple queues, and processing them later.
-
We've used many different background job systems at GitHub. SQS, Starling, ActiveMessaging, BackgroundJob, DelayedJob, and beanstalkd. Each change was out of necessity: we were running into a limitation of the current system and needed to either fix it or move to something designed with that limitation in mind.
- 1 more annotation(s)...
-
- Redis backed retry count/limit.
- Retry on all or specific exceptions.
- Exponential backoff (varying the delay between retrys).
- Multiple failure backend with retry suppression & resque-web tab.
- Small & Extendable - plenty of places to override retry logic/settings.
A Resque plugin. Requires Resque 1.8.0 & resque-scheduler.
resque-retry provides retry, delay and exponential backoff support for resque jobs.
Selected Tags
Related Tags
Top Contributors
Groups interested in tech
-
Tech for Differentiation
Items: 217 | Visits: 229
Created by: Barbara Branch
-
Web 2.0 Educational Tech Options
Some ideas for getting stude...
Items: 18 | Visits: 163
Created by: lstollin
-
Fivesday1
List for interactive tech wo...
Items: 82 | Visits: 143
Created by: Sean Sweeney
Diigo is about better ways to research, share and collaborate on information. Learn more »
Join Diigo
