Skip to content

Instantly share code, notes, and snippets.

<%@page import="java.sql.*, javax.sql.*, javax.naming.*"%>
<%
DataSource ds = null;
Connection conn = null;
ResultSet result = null;
Statement stmt = null;
ResultSetMetaData rsmd = null;
try{
Context context = new InitialContext();
Context envCtx = (Context) context.lookup("java:jboss/datasources");
afterEvaluate { project ->
android.applicationVariants.each { variant ->
variant.javaCompile.dependsOn stripPlayServices
}
}
task stripPlayServices << {
def playServiceRootFolder = new File(rootProject.buildDir, "intermediates/exploded-aar/com.google.android.gms/play-services/")
playServiceRootFolder.list().each { versionName ->
def versionFolder = new File(playServiceRootFolder, versionName)
/*
* Copyright (C) 2014 The Android Open Source Project
*
* 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
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@sabadow
sabadow / gist:2395148dba5abd85da38
Created July 11, 2015 06:46
Ninja Raiden Safari Crash
Process: com.apple.WebKit.WebContent [1251]
Path: /System/Library/Frameworks/WebKit.framework/Versions/A/XPCServices/com.apple.WebKit.WebContent.xpc/Contents/MacOS/com.apple.WebKit.WebContent
Identifier: com.apple.WebKit.WebContent
Version: 10600 (10600.7.12)
Build Info: WebKit2-7600007012000000~2
Code Type: X86-64 (Native)
Parent Process: ??? [1]
Responsible: Safari [1001]
User ID: 501
@sabadow
sabadow / gist:1778654
Created February 9, 2012 09:12
Launch Twitter official client from Android through an Intent
Intent tweetIntent = new Intent(Intent.ACTION_SEND);
tweetIntent.putExtra(Intent.EXTRA_TEXT, "This is a Test.");
tweetIntent.setType("text/plain");
PackageManager packManager = getPackageManager();
List<ResolveInfo> resolvedInfoList = packManager.
queryIntentActivities(tweetIntent, PackageManager.MATCH_DEFAULT_ONLY);
boolean resolved = false;
for(ResolveInfo resolveInfo: resolvedInfoList){
@sabadow
sabadow / gist:1788703
Created February 10, 2012 10:44
Check if Android Intent is available
/**
* Check if an Intent is available to use
* @param intent the Intent to check if is available
* @return true if is available, false otherwise
*/
private boolean isIntentAvailable(Intent intent) {
List<ResolveInfo> list = getPackageManager().queryIntentActivities(intent,
PackageManager.MATCH_DEFAULT_ONLY);
return list.size() > 0;
}
@sabadow
sabadow / gist:3841866
Created October 5, 2012 19:33
Example of rounded image with inline css
<img style="border-radius: 30px;"
src="http://static.myopera.com/community/graphics/speeddials/Opera-Background-Colored-Lights.jpg"/>
@sabadow
sabadow / BitmapHelper.java
Created October 31, 2012 15:24
Android BitmapHelper
import java.io.InputStream;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
public class BitmapHelper {
public static int calculateInSampleSize(BitmapFactory.Options options,int reqWidth, int reqHeight) {
// Raw height and width of image
final int height = options.outHeight;
final int width = options.outWidth;
@sabadow
sabadow / gist:4274923
Created December 13, 2012 08:10
Image with rounded corners by Romain Guy
BitmapShader shader;
shader = new BitmapShader(bitmap, Shader.TileMode.CLAMP, Shader.TileMode.CLAMP);
Paint paint = new Paint();
paint.setAntiAlias(true);
paint.setShader(shader);
RectF rect = new RectF(0.0f, 0.0f, width, height);
// rect contains the bounds of the shape
@sabadow
sabadow / gist:5998086
Last active December 19, 2015 18:19
Create a release (based on robovm project)
  • Create release branch:
git branch rb-<version>
  • Update the master branch to the next -SNAPSHOT version:
mvn -Dtycho.mode=maven org.eclipse.tycho:tycho-versions-plugin:set-version -DnewVersion=-SNAPSHOT