This file contains hidden or 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
# This line goes in /etc/netatalk/afpd.conf | |
- -tcp -noddp -uamlist uams_guest.so,uams_dhx.so,uams_dhx2.so -nosavepassword | |
# The remaining lines go in /etc/netatalk/AppleVolumes.default | |
# The line below sets some DEFAULT, starting with Netatalk 2.1. | |
:DEFAULT: options:upriv,usedots | |
# Regular AFP share | |
/mnt/storage "Storage" cnidscheme:dbd options:usedots,upriv |
This file contains hidden or 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
/** | |
* <p>This method checks an HttpResponse for a Content-Range | |
* header and, if present, attempts to parse the instance-length | |
* from the header value.</p> | |
* <p>{@link http://tools.ietf.org/html/rfc2616#section-14.16}</p> | |
* | |
* @param response | |
* @return the total number of bytes for the instance, or a negative number if unknown. | |
*/ | |
public static long getInstanceLength(HttpResponse response) { |
This file contains hidden or 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
find ~/android-sdk-mac_x86/platforms/ -type f \( -name "ic_menu_crop.png" -o -name "ic_menu_preferences.png" -o -name "ic_menu_share.png" -o -name "ic_menu_delete.png" -o -name "ic_menu_home.png" -o -name "ic_menu_refresh.png" \) | cp `grep -i "7.*ldpi"` . |
This file contains hidden or 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
<!-- Server side code here --> | |
<?php | |
if ($_POST['action'] === 'logout') { | |
logout(); | |
} | |
?> | |
<!-- Client side code here --> | |
<form action="" method="post"> | |
<input type="hidden" name="action" value="logout" /> |
This file contains hidden or 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
// After binding to the tracking service you can | |
// perform a simple POST request using the runAPIRequest | |
// method. | |
// | |
// We'll be updating the SDK to provide simpler runGetRequest | |
// and runPostRequest methods to abstract away some of this | |
// logic. | |
if (mService != null) { | |
LQSession session = mService.getSession(); |
This file contains hidden or 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
if (mService != null) { | |
LQSession session = mService.getSession(); | |
// Build your request | |
try { | |
JSONObject geonote = new JSONObject(); | |
geonote.put("text", "Test!"); | |
geonote.put("latitude", 45.5037078163837); | |
geonote.put("longitude", -122.622699737549); | |
geonote.put("radius", 467); |
This file contains hidden or 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
# Loop over each object and either update or create. | |
try: | |
obj = MyObject.objects.get(pk=id) | |
obj.value1 = 1 | |
obj.value2 = 2 | |
except MyObject.DoesNotExist: | |
obj = MyObject(value1=1, value2=2, ...) | |
# Update the object |
This file contains hidden or 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
time = "10 minutes ago" | |
if ((distance_moved *since* time) < 200): | |
# Possibly return a 420 or 429 response code? Possibly not a 429, | |
# since we might want to use that for actual API request rate limiting. | |
# | |
# http://en.wikipedia.org/wiki/List_of_HTTP_status_codes#420 | |
response = { | |
"error": "back_off", | |
"error_message": "...", | |
"latitude": 125.45, |
This file contains hidden or 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
LQSession session = mService.getSession(); | |
// Get the current user's profile | |
session.runGetRequest("account/profile", new OnRunApiRequestListener() { | |
@Override | |
public void onSuccess(LQSession session, HttpResponse response) { | |
// Consume the response! | |
// ... | |
JSONObject json = new JSONObject(EntityUtils.toString(response.getEntity())); | |
} |
This file contains hidden or 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
public classd MyActivity extends Activity implements OnClickListener { | |
private LQService mService; | |
private boolean mBound; | |
private SampleReceiver mLocationReceiver = new SampleReceiver(); | |
@Override | |
public void onCreate(Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
setContentView(R.layout.main); | |
} |