Skip to content

Instantly share code, notes, and snippets.

Intent i = new Intent(getApplicationContext(),
CategoryDetail.class);
String category_id = ((TextView) view
.findViewById(R.id.category_id)).getText()
.toString();
i.putExtra("category_id", category_id);
startActivity(i);
package com.aiman.listviewexample;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.UnsupportedEncodingException;
import java.util.List;
import org.apache.http.HttpEntity;
package com.aiman.listviewexample;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import org.apache.http.NameValuePair;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
package com.aiman.listviewexample;
import java.util.ArrayList;
import java.util.HashMap;
import com.squareup.picasso.Picasso;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
@aemxn
aemxn / gist:8932900
Created February 11, 2014 10:59
GsonRequest (Volley)
/**
* Copyright 2013 Ognyan Bankov
*
* 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
@aemxn
aemxn / gist:74fecc990a8b483c1c13
Last active August 29, 2015 14:05
No search result fix
public static String getSearchResult(String search) {
StringBuilder buf = new StringBuilder();
String searchQuery = "SELECT * FROM data_structure WHERE element_name LIKE '%" + search + "%'";
// String searchQuery = "SELECT * FROM data_structure WHERE data_structure_type LIKE '%" + search + "%' or element_name LIKE '%" + search + "%' or element_description LIKE '%" + search + "%' or rational LIKE '%" + search + "%' or field_namecode LIKE '%" + search + "%' or alias LIKE '%" + search + "%' or field_size LIKE '%" + search + "%' or element_owner LIKE '%" + search + "%'";
try {
currentCon = ConnectionManager.getConnection();
@aemxn
aemxn / DbHandler.php
Created July 5, 2015 00:00
DbHandler
<?php
class DbHandler {
private $conn;
function __construct() {
require_once dirname(__FILE__) . '/DbConnect.php';
// opening db connection
$db = new DbConnect();
@aemxn
aemxn / Utils.php
Created July 5, 2015 00:02
Utils.php
<?php
require '../vendor/autoload.php';
require_once 'Config.php';
if(PHP_DEBUG_MODE){
error_reporting(-1);
ini_set('display_errors', 'On');
}
// authorized user id from db - global var
@aemxn
aemxn / index.php
Created July 5, 2015 00:29
crud-slim-tutorial
<?php
/**
* ROUTES:
* (Authorization header with api key is required for user session)
*
* /register
* method - post
* params - name, email, password
*
@aemxn
aemxn / speedtest-cli.py
Created October 28, 2015 06:52
Internet speed test python cli
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright 2012-2015 Matt Martz
# All Rights Reserved.
#
# 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