Google Maps Android API v2 – Sample Code crashes

Follow the crib sheet very, very carefully: https://docs.google.com/document/pub?id=19nQzvKP-CVLd7_VrpwnHfl-AE9fjbJySowONZZtNHzw In particular, I think you need to: Import the actual source for the “google-play-services_lib” project and link it as an Android library. Do this through Project -> Properties -> Android -> Library, Add -> google-play-services_lib (you can right click on your project and choose Properties, then select … Read more

Sample http range request session

The following exchange is between Chrome and a static web server, retrieving an MP4 video. Initial request – for the video. Note the Accept-Ranges response header to indicate the server has range header support: GET /BigBuckBunny_320x180.mp4 Cache-Control: max-age=0 Connection: keep-alive Accept-Language: en-GB,en-US,en Host: localhost:8080 Range: Accept: text/html,application/xhtml+xml,application/xml,*/* User-Agent: Mozilla/5.0 (Windows NT 5.1) AppleWebKit/535.7 … Accept-Encoding: … Read more

Take random sample by group

This is available as the slice_sample function in dplyr: library(dplyr) new_df <- df %>% group_by(ID) %>% slice_sample(n=500) In older versions of R, the function was called sample_n, which has been deprecated.

Detecting IE11 using CSS Capability/Feature Detection

In the light of the evolving thread, I have updated the below: IE 6 * html .ie6 {property:value;} or .ie6 { _property:value;} IE 7 *+html .ie7 {property:value;} or *:first-child+html .ie7 {property:value;} IE 6 and 7 @media screen\9 { .ie67 {property:value;} } or .ie67 { *property:value;} or .ie67 { #property:value;} IE 6, 7 and 8 @media … Read more

Android sample bluetooth code to send a simple string via bluetooth

private OutputStream outputStream; private InputStream inStream; private void init() throws IOException { BluetoothAdapter blueAdapter = BluetoothAdapter.getDefaultAdapter(); if (blueAdapter != null) { if (blueAdapter.isEnabled()) { Set<BluetoothDevice> bondedDevices = blueAdapter.getBondedDevices(); if(bondedDevices.size() > 0) { Object[] devices = (Object []) bondedDevices.toArray(); BluetoothDevice device = (BluetoothDevice) devices[position]; ParcelUuid[] uuids = device.getUuids(); BluetoothSocket socket = device.createRfcommSocketToServiceRecord(uuids[0].getUuid()); socket.connect(); outputStream = socket.getOutputStream(); … Read more