Wednesday, January 14, 2015

HD Accessory Promo Codes January 2015

Save your money with HD Accessory coupon codes and promo codes in January 2015.

HD Accessory Take up to 20% off

runs out 1/5/11. Take 20% off

finishes 1/5/11. Coupon Code: HDYE2

HD Accessory Pick up 15% away $30+. Get 15% off of on orders $30 or even more.. Coupon Code: AUGBACK

HD Accessory Get up to 20% away from. Special Offer! 20% OFF. Coupon Code: SPFEVS

HD Accessory Save up to 20% off $25+. Take up to 20% away from on purchase $25+ runs out on 2/14/2011. Coupon Code: VVS214

HD Accessory Save up to 15% off. Pick up 15% off of coupom. Coupon Code: 541729

HD Accessory Get 15% Off. Get 15% Off. Coupon Code: SCHOOL

HD Accessory Cost-free Monitor Protector for Galaxy S4 with $10+ Get. Free of charge display guard for Galaxy S4 with any buying $10 or higher. Coupon Code: SPSGS4

HD Accessory Save up to 20% Away Memorial Day Purchase. Get 20% away from buy memorial day time transaction. Not including transaction and promotional gifts. Finishes 05/31/14. Coupon Code: MEM2014

HD Accessory Take 20% Off of $50+. Help save 20% on Any $50 Online Buy for a small time. Coupon Code: HD20

HD Accessory Free Display screen Protector for Galaxy Note 2 with $10+ Purchase. Cost-free monitor guard for Galaxy Take note 2 with any purchase of $10 or more. Coupon Code: SPSGN2

HD Accessory Free of charge Display Guard for Galaxy S3 with $10+ Buy. Free monitor guard for Galaxy S3 with any buying $10 or higher. Coupon Code: SPSGS3

HD Accessory Totally free Display Guard for Iphone 4 4S with $10+ Order. Totally free screen guard for IPhone 4S with any purchase of $10 or maybe more. Coupon Code: SPAP4S

HD Accessory Special Offer! 25% Away from Your Obtain. Get 25% Away from Your Obtain. Coupon Code: BUNNY25

HD Accessory Take 15% Off $35+. Preserve 15% on Any On the internet Buying of $35 or even more. Coupon Code: HD15

HD Accessory Take 10% Away from $25+. Help save 10% on Any On the internet Buying $25 or higher. Coupon Code: HD10

HD Accessory transaction $4. Purchase $4. Coupon Code: sale

HD Accessory Pick up 20% off of. Save up to 20% off. Coupon Code: JULY4TH

HD Accessory Save 20% Away your requests. Get 20% Away your orders placed. 7th Anniversary Purchase. Comes to an end on 03/31/2014.. Coupon Code: 7THSALE

HD Accessory preserve 20% on any $50 on-line buy. Conserve 20% on any $50 on-line acquire. Coupon Code: hd20

HD Accessory Up to 25% off of. Get 25% Off of. Coupon Code: ANN25

Sunday, October 26, 2014

C# - List all the links in a website.

using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Net;
using System.Text.RegularExpressions;

namespace ProgrammingDotNet
{
    class Program
    {
        public static void Main(string[] args)
        {
            StreamReader reader = null;
            try
            {
                WebRequest request = WebRequest.Create("http://www.techexams.net/");
                WebResponse response = request.GetResponse();
                reader = new StreamReader(response.GetResponseStream());
                string content = reader.ReadToEnd();

                Regex regex = new Regex("href\\s*=\\s*\"([^\"]*)\"", RegexOptions.IgnoreCase);

                MatchCollection matches = regex.Matches(content);
                foreach (Match match in matches)
                {
                    Console.WriteLine(match.Groups[1]);
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }
            finally
            {
                if (reader != null)
                {
                    reader.Close();
                }
            }
            Console.ReadLine();
        }
    }
}

C# - Simple program that dumps text files to the windows console.

using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;


namespace ProgrammingDotNet
{
    class Program
    {
        public static void Main(string[] args)
        {
            String filename = "C:\\Users\\Isuru\\Desktop\\google_5000000.txt";
            StreamReader reader = new StreamReader(filename);
            for (String line = reader.ReadLine(); line != null; line = reader.ReadLine())
            {
                Console.WriteLine(line);
            }
            reader.Close();
            Console.ReadLine();
        }
    }
}

Tuesday, April 29, 2014

Unable to get system library for project

You may not able to build your android project because android adt cannot find the system library for project.

And following compile errors may occur due to that problem.

The type java.lang.Object cannot be resolved.

To solve the problem open build path for the project, and in Android tab select different project build target.


Thursday, April 24, 2014

SQLite For Android Source Codes

public class SQLiteHelper extends SQLiteOpenHelper {
 private static final String DATABASE_NAME = "my_database.db";
 // TOGGLE THIS NUMBER FOR UPDATING TABLES AND DATABASE

 private static final int DATABASE_VERSION = 1;
 // NAME OF TABLE YOU WISH TO CREATE
 public static final String TABLE_NAME = "my_table";
 // SOME SAMPLE FIELDS
 public static final String UID = "_id";
 public static final String NAME = "name";
 
 SQLiteHelper(Context context) {
  super(context, DATABASE_NAME, null, DATABASE_VERSION);
 }
 @Override
 public void onCreate(SQLiteDatabase db) {
  db.execSQL("CREATE TABLE " + TABLE_NAME + " (" + UID + "
  INTEGER PRIMARY KEY AUTOINCREMENT," + NAME
  + " VARCHAR(255));");
 }
 @Override
 public void onUpgrade(SQLiteDatabase db, int oldVersion,
   int newVersion) {
  Log.w("LOG_TAG", "Upgrading database from version " +
   oldVersion + " to " + newVersion + ", which will destroy all old data");
  // KILL PREVIOUS TABLE IF UPGRADED
  db.execSQL("DROP TABLE IF EXISTS " + TABLE_NAME);
  // CREATE NEW INSTANCE OF TABLE
  onCreate(db);
 }
}


Implementing the database helper class.

public class SQLiteExample extends Activity {
 @Override
 protected void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  setContentView(R.layout.main);
  // INIT OUR SQLITE HELPER
  SQLiteHelper sqh = new SQLiteHelper(this);
  // RETRIEVE A READABLE AND WRITEABLE DATABASE
  SQLiteDatabase sqdb = sqh.getWritableDatabase();
  
  
  // METHOD #1: INSERT USING CONTENTVALUE CLASS
  ContentValues cv = new ContentValues();
  cv.put(SQLiteHelper.NAME, "jason wei");
  // CALL INSERT METHOD
  sqdb.insert(SQLiteHelper.TABLE_NAME, SQLiteHelper.NAME, cv);
  
  
  // METHOD #2: INSERT USING SQL QUERY
  String insertQuery = "INSERT INTO " +
  SQLiteHelper.TABLE_NAME + " (" + SQLiteHelper.NAME + ") VALUES ('jwei')";
  sqdb.execSQL(insertQuery);

  // METHOD #1: QUERY USING WRAPPER METHOD
  Cursor c = sqdb.query(SQLiteHelper.TABLE_NAME,
   new String[] { SQLiteHelper.UID, SQLiteHelper.NAME },
    null, null, null, null, null);
  while (c.moveToNext()) {
  // GET COLUMN INDICES + VALUES OF THOSE COLUMNS
  int id = c.getInt(c.getColumnIndex(SQLiteHelper.UID));
  String name = c.getString(c.getColumnIndex(SQLiteHelper.NAME));
  Log.i("LOG_TAG", "ROW " + id + " HAS NAME " + name);
  }
  c.close();

  // METHOD #2: QUERY USING SQL SELECT QUERY
  String query = "SELECT " + SQLiteHelper.UID + ", " +
   SQLiteHelper.NAME + " FROM " + SQLiteHelper.TABLE_NAME;
  Cursor c2 = sqdb.rawQuery(query, null);
  while (c2.moveToNext()) {
  int id = c2.getInt(c2.getColumnIndex(SQLiteHelper.UID));
  String name = c2.getString(c2.getColumnIndex(SQLiteHelper.NAME));
  Log.i("LOG_TAG", "ROW " + id + " HAS NAME " + name);
  }
  c2.close();
  
  // CLOSE DATABASE CONNECTIONS
  sqdb.close();
  sqh.close();
 }
}

Monday, February 17, 2014

[Android] Make android button transparent.

You can make android button transparent by inserting following code in layout xml file.

android:background="@android:color/transparent"

For example, I used it in one of my button as following.

<Button
        android:id="@+id/button1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_alignParentRight="true"
        android:layout_alignParentTop="true"
        android:text="Who is computer Geek?"
        android:background="@android:color/transparent" />

Sunday, February 16, 2014

CSS Basics

Making bold the whole paragraph.

<p style="font-weight: bold;">This is a bold paragraph.</p>

Making a word italic.

This is the <span style="font-style:italic;">greatest</span> web page I’ve made yet.

Using an internal style sheet.

<!doctype html>
<html>
<head>
<title>Using an internal style sheet.</title>
<style type=”text/css”>
div {
      font-weight: bold;
}
span {
      font-style: italic;
}
</style>
</head>
<body>

            <div>This is my web page.</div>
</body>
</html>

Using an external style sheet.

<link rel="stylesheet" type="text/css" href="path_to_style_sheet/style.css">