Skip to content

Instantly share code, notes, and snippets.

View saiprasad1996's full-sized avatar

Sai Prasad saiprasad1996

View GitHub Profile
@saiprasad1996
saiprasad1996 / jdk_installer.sh
Created July 13, 2017 09:06
JDK installation script for ubuntu
#!/bin/sh
tar -xvf jdk-7*
sudo mkdir /usr/lib/jvm
sudo mv ./jdk1.7* /usr/lib/jvm/jdk1.7.0
sudo update-alternatives --install "/usr/bin/java" "java" "/usr/lib/jvm/jdk1.7.0/bin/java" 1
sudo update-alternatives --install "/usr/bin/javac" "javac" "/usr/lib/jvm/jdk1.7.0/bin/javac" 1
sudo update-alternatives --install "/usr/bin/javaws" "javaws" "/usr/lib/jvm/jdk1.7.0/bin/javaws" 1
sudo chmod a+x /usr/bin/java
sudo chmod a+x /usr/bin/javac
@saiprasad1996
saiprasad1996 / gist:bb4d260c3681b829aefb859d13de888a
Created May 26, 2017 06:26 — forked from marty-wang/gist:5a71e9d0a6a2c6d6263c
Compile and deploy React Native Android app of Release version to device.
Disclaimer: The instructions are the collective efforts from a few places online.
Nothing here is my original. But I want to put them together in one place to save people from spending the same time as I did.
First off, bundle.
==================
1. cd to the project directory
2. Start the react-native packager if not started
3. Download the bundle to the asset folder:
curl "http://localhost:8081/index.android.bundle?platform=android" -o "android/app/src/main/assets/index.android.bundle"
package com.collaborizm.app.collaborizm;
import android.content.Intent;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.provider.Settings;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.KeyEvent;
@saiprasad1996
saiprasad1996 / react native error log
Created December 31, 2016 09:18
Error while implementing react native integration
12-31 12:09:15.208 15766-15873/com.collaborizm.app.collaborizm E/AndroidRuntime: FATAL EXCEPTION: AsyncTask #1
Process: com.collaborizm.app.collaborizm, PID: 15766
java.lang.RuntimeException: An error occurred while executing doInBackground()
at android.os.AsyncTask$3.done(AsyncTask.java:309)
at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:354)
at java.util.concurrent.FutureTask.setException(FutureTask.java:223)
at java.util.concurrent.FutureTask.run(FutureTask.java:242)
public class ExportImportDB extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
//creating a new folder for the database to be backuped to
File direct = new File(Environment.getExternalStorageDirectory() + "/Exam Creator");
if(!direct.exists())
{
//Program for array concatination with dynamic memory allocation
#include<stdio.h>
#include<stdlib.h>
int main(){
int *arr1,*arr2;
int n1,n2;
int i,total,counter;
printf("Enter the number of elements to be entered in arr1 and arr2 ");
scanf("%d %d",&n1,&n2); //taking the number of elements for the arrays from the user
arr1=(int *)malloc(n1 * sizeof(int));
//Program for printing a patter as shown in the output below
#include<stdio.h>
int main(){
int step=4,start,i,j; //variable step is for defining number of steps
//start is for the starting number from which the pattern starts
//i and j are the iterators for outer and inner loop
printf("Enter the number to start ");
scanf("%d",&start); //accept the starting number
//This loop is for the upper part
//Progam to remove vowels
#include<stdio.h>
#include<string.h>
int main(){
char *str;
int len,i=0;
printf("Enter a single string ");
scanf("%s",&str);
len=strlen(str);
#include <stdio.h>
int main() {
int *arr;
int n,i,back;
printf("\nEnter the number of elements for the array");
scanf("%d",&n);
back=n-1;
arr=(int*)malloc(n*sizeof(int));
@saiprasad1996
saiprasad1996 / ValidatingEditText.java
Created July 16, 2016 13:51
Validating EditText for emptiness. :p
package tk.saiprasadm.appswallet;
import android.content.Context;
import android.os.Bundle;
import android.support.design.widget.Snackbar;
import android.support.v7.app.AppCompatActivity;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;