Skip to content

Instantly share code, notes, and snippets.

@oguya
oguya / build.gradle
Created January 29, 2014 16:38
Spring gradle configs
dependencies {
compile 'org.springframework.android:spring-android-rest-template:1.0.1.RELEASE'
compile 'org.springframework.android:spring-android-auth:1.0.1.RELEASE'
compile 'org.springframework.android:spring-android-core:1.0.1.RELEASE'
}
@oguya
oguya / fontSetter.java
Created January 30, 2014 08:51
set custom fonts in java
public class MyApplication extends Application {
private Typeface normalFont;
private Typeface boldFont;
//FontSetter fontSetter = (FontSetter) getApplication();
//TextView myTextView = (TextView) findViewById(R.id.my_textview);
//application.setTypeface(myTextView);
@oguya
oguya / ScreenLayoutSize.java
Created February 9, 2014 08:10
load different layouts depending on screensize
if((getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_LARGE) == Configuration.SCREENLAYOUT_SIZE_LARGE){
//load a large screen layout
}else{
//load a default screen layout
}
public class saveAsParcel implements Parcelable {
private String myStringValue;
public PassableObject() {}
public PassableObject(Parcel inParcel) {
myStringValue = inParcel.readString();
}
@Override
@oguya
oguya / edtiTextDrawable.xml
Created February 15, 2014 03:08
add drawables in editText
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="250dp"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:gravity="center"
android:orientation="vertical"
android:layout_marginTop="16dp"
>
<EditText
@oguya
oguya / Foursquare stackTrace
Created May 20, 2014 06:48
foursquare crash stacktrace
E/AndroidRuntime( 2118): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.joelapenna.foursquared/com.joelapenna.foursquared.app.FragmentShellActivity}: android.support.v4.app.Fragment$InstantiationException: Unable to instantiate fragment com.joelapenna.foursquared.fragments.photos.o: make sure class name exists, is public, and has an empty constructor that is public
E/AndroidRuntime( 2118): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2306)
E/AndroidRuntime( 2118): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2358)
E/AndroidRuntime( 2118): at android.app.ActivityThread.access$600(ActivityThread.java:156)
E/AndroidRuntime( 2118): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1340)
E/AndroidRuntime( 2118): at android.os.Handler.dispatchMessage(Handler.java:99)
E/AndroidRuntime( 2118): at android.os.Looper.loop(Looper.java:153)
E/AndroidRuntime( 2118): at android.app.Ac
public class MainActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.layoutfab);
//Outline
int size = getResources().getDimensionPixelSize(R.dimen.fab_size);
Outline outline = new Outline();

RAM Info

  • RAM upgrade on glusterfs wingu nodes
  • There might be inconsistencies in Max RAM values provided by either dmi

Wingu0

  • model: X9DRL-3F/iF (Quad-Core Intel(R) Xeon(R) E5-2643 0 @ 3.30GHz)
  • Max RAM: 96GB *
  • No. of slots/banks: 8
  • Current RAM: 16GB
  • Quad Rank with 32GB: 96GB÷32GB = 3 banks
@oguya
oguya / !request_user_id.py
Created December 5, 2013 12:25
get userid without using request object
from django.contrib.auth.models import User
User.objects.get(username=the_username).pk
@oguya
oguya / imageLoader.java
Created January 6, 2014 07:45
Load image from URL to an ImageView
//ImageLoader lib => http://search.maven.org/remotecontent?filepath=com/novoda/imageloader/imageloader-core/1.5.8/imageloader-core-1.5.8.jar
String image_url = "http://mycodeandlife.files.wordpress.com/2013/01/384088_2317070728022_2086719259_n.jpg";
ImageView image = (ImageView) findViewById(R.id.imageView1);
// Get singletone instance of ImageLoader
ImageLoader imageLoader = ImageLoader.getInstance();
// Initialize ImageLoader with configuration. Do it once.
imageLoader.init(ImageLoaderConfiguration.createDefault(this));
// Load and display image asynchronously
DisplayImageOptions options = new DisplayImageOptions.Builder()