This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private CharSequence[] items = {"Set as Ringtone", "Set as Alarm"}; | |
AlertDialog.Builder builder = new AlertDialog.Builder(this); | |
builder.setItems(items, new DialogInterface.OnClickListener() { | |
public void onClick(DialogInterface dialog, int item) { | |
if(item == 0) { | |
} else if(item == 1) { | |
} else if(item == 2) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
final WindowManager.LayoutParams params = new WindowManager.LayoutParams( | |
WindowManager.LayoutParams.FLAG_FULLSCREEN, | |
WindowManager.LayoutParams.FLAG_FULLSCREEN, | |
WindowManager.LayoutParams.TYPE_SYSTEM_ALERT, | |
WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN, | |
PixelFormat.TRANSLUCENT); | |
WindowManager wm = (WindowManager) getApplicationContext() | |
.getSystemService(Context.WINDOW_SERVICE); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Use: | |
NSURLSessionConfiguration:backgroundSessionConfiguration: | |
instead of | |
NSURLSessionConfiguration:defaultSessionConfiguration | |
From the NSURLSessionConfiguration:backgroundSessionConfiguration: documentation: | |
Upload and download tasks in background sessions are performed by an external daemon instead of by the app itself. As a result, the transfers continue in the background even if the app is suspended, exits, or crashes. | |
So in your case, change: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
+(NSString *) generateUUID | |
{ | |
CFUUIDRef uuid = CFUUIDCreate(kCFAllocatorDefault); | |
CFStringRef uuidString = CFUUIDCreateString(kCFAllocatorDefault, uuid); | |
CFRelease(uuid); | |
NSString* newUuid = [(NSString *)uuidString copy]; | |
CFRelease(uuidString); | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// NSString+Extension.h | |
@interface NSString (Extension) | |
+ (NSString *) getUUID; | |
+ (NSString *) sha1:(NSString *)input; | |
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FancyHotSpot *hotSpotA; | |
FancyHotSpot *hotSpotB; | |
// notifications from hotSpotA should call hotSpotATouched: | |
[[NSNotificationCenter defaultCenter] addObserver:self | |
selector:@selector(hotSpotATouched:) name:@"HotSpotTouched" | |
object:hotSpotA]; // only notifications from hotSpotA will be received | |
// notifications from hotSpotB should call hotSpotBTouched: | |
[[NSNotificationCenter defaultCenter] addObserver:self |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/sbin/runscript | |
# This script assumes that Riemann has a user and group set up, and that the | |
# service files have been extracted to `/var/lib/riemann/current`. | |
# | |
# Author: Greg Look ([email protected]) | |
extra_started_commands="reload" | |
CFG_DIR=/etc/riemann |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo apt-get install build-essential libsqlite3-dev zlib1g-dev libncurses5-dev libgdbm-dev libbz2-dev libreadline5-dev libssl-dev libdb-dev | |
wget http://www.python.org/ftp/python/2.7.3/Python-2.7.3.tgz --no-check-certificate | |
tar -xzf Python-2.7.3.tgz | |
cd Python-2.7.3 | |
./configure --prefix=/usr --enable-shared | |
make | |
sudo make install | |
cd .. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%% @author Masahito Ikuta <[email protected]> [http://d.hatena.ne.jp/cooldaemon/] | |
%% @copyright Masahito Ikuta 2008 | |
%% @doc UDP Server Behaviour. | |
%% Copyright 2008 Masahito Ikuta | |
%% | |
%% Licensed under the Apache License, Version 2.0 (the "License"); | |
%% you may not use this file except in compliance with the License. | |
%% You may obtain a copy of the License at | |
%% |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<resources> | |
<!-- Style you can use with a container (typically a horizontal | |
LinearLayout) to get the standard "button bar" background and | |
spacing. @hide --> | |
<style name="ButtonBar"> | |
<item name="android:paddingTop">5dip</item> | |
<item name="android:paddingStart">4dip</item> | |
<item name="android:paddingEnd">4dip</item> | |
<item name="android:paddingBottom">1dip</item> | |
<item name="android:background">@android:drawable/bottom_bar</item> |