Monday, August 31, 2015

2nd last of the year 2015....

Less than a week to the 2nd last IT Show for the year 2015. And have you prepared your shopping list...?

Image taken from 'COMEX 2015' website.

By the way, by accessing the official website of 'COMEX 2015', you can
also gain access to information like, 'How to get there', 'The floor plan',
'Contests', etc...

Venue:
  • Date: 3 - 6 Sep 2015
  • Opening Hours: Level 3: 11am to 9pm
                             Level 4 & 6: 12pm to 9pm
  • Location: SUNTEC Singapore Convention & Exhibition Centre

* Click here to find out more about 'COMEX 2015'.
^ Click here for the unofficial 'COMEX 2015' site.
  (You can gain access to all the pricelist of all the Exhibitor @ 'COMEX 2015'.
  Although currently there isn't a lot but the list will gradually increase over
  the next few days.)

Wednesday, June 17, 2015

Android: Handling ByteBuffer

In case you are given a structured byteBuffer and you have to cipher the contents of it, here's a quick start up walk through to it.

 //To get relative positioning variables
 short version = byteBufferData.getShort();
 //Besides for getShort(), there's getInt(), getLong(),
 //getDouble(), getChar(). getFloat()
 
 //Or you can use the following to indicate the 
 //position you want to start to read from
 //short shortVar = byteBufferData.getShort(0);
 //but if you use getShort() without any parameters, 
 //it will increase the current position of the 
 //byteBuffer too. Depending on the function used,
 //the position will be increase differently.
 //E.g. getChar(), getShort(), increases by 2
 //getInt(), getFloat(), increases by 4
 //getDouble, getLong(), increases by 8
 
 
 //But what if there's a String of a certain length?
 //For example, you know that the length of the string
 //will be 5. You would need to create the corresponding
 //byte Array first
 final byte[] bytes = new byte[5];
 //then you will get the byte Array that matches the length
 data.get(bytes);
 //then you can pass the byte Array into a String and Voila!!!
 //there you go, a String pulled out from the ByteBuffer
 String filename = new String(bytes);

 //You can use the same steps in the above to control/store
 //binary data for other types of Object too. :)
* Click here to find about the different functions and properties of the 'ByteBuffer' class in
  'Android'.

Wednesday, March 18, 2015

The first for the year 2015...

Less than 24 hours to the first IT Show for the year 2015. Are you drooling or what... Unlike last year, this year it has moved back to 'SUNTEC Singapore Convention & Exhibition Centre'.

Image taken from 'IT Show 2015' website.

By the way, by accessing the official website of 'IT Show 2015', you can
also gain access to information like, 'How to get there', 'The floor plan',
'Contests', etc...

Venue:
  • Date: 19 - 22 Mar 2015
  • Opening Hours: Level 3: 11am to 9pm
                                Level 4 & 6: 12pm to 9pm
  • Location: SUNTEC Singapore Convention & Exhibition Centre

* Click here to find out more about 'IT Show 2015'.
^ Click here for the unofficial 'IT Show 2015' site.
  (You can gain access to all the pricelist of all the Exhibitor @ 'IT Show 2014'.
  Although currently there isn't a lot but the list will gradually increase over
  the next few days.)

Sunday, March 8, 2015

Javascript: Text file saving workaround for ie8

One might not believe it but according to the statistics on Netmarketshare.com, it shows that Internet Explorer 8 still holds close to 20% of the market share in the browser world. Therefore, you might be coming across tricky situations where there is a need to save some data from the browser into a text file and here's a possible workaround for ie8.


* Click here for the statistics taken from Netmarketshare.com.
^ Click here to access the demo that I have created on 'JSFiddle'.
~ Click here to test your JavaScript, CSS, HTML or CoffeeScript online with JSFiddle code
  editor.

Friday, January 9, 2015

Android: Taking control of the orientation...

It can be pretty irritating when you have a mixture of screens that should be only be appearing in a Potrait or a Landscape orientation only. Therefore here's a quick demo to show you how you can take control of the orientation of your Android App.

Here's the source code of the Main Activity of the Android Application - MainActivity.java
package com.nekyoutoTech.controloverorientation;

import android.app.Activity;
import android.content.Context;
import android.content.pm.ActivityInfo;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.ImageButton;

public class MainActivity extends Activity {
 
 //Dummy Array of Buttons
 private Button[] btns = new Button[5];
 
 //Stores a reference of the Application Context
 private static Context context;

 @Override
 protected void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_main);
  
  //Loop through the buttons and assign the Click Listener to them
  for(int i = 0; i < 5; i ++){
   int resID = getResources().getIdentifier("btn" + i, "id", getPackageName());
   btns[i] = (Button) findViewById(resID);
   btns[i].setOnClickListener(btnClickListener);
  }
  
  context = this.getApplicationContext();
 }

 /**
  * Upon clicking on any of the buttons
  */
 OnClickListener btnClickListener = new OnClickListener(){
  @Override
  public void onClick(View v) {
   //Get the String of the button first
   Button btn = (Button) v;
   String text = (String) btn.getText();
   
   //Depending on the button that was click, let's select the orientation
   //that we would want to set for the app.
   int orientation;
   if (context.getResources().getString(R.string.btn0Str).equals(text)) {
    orientation = ActivityInfo.SCREEN_ORIENTATION_SENSOR;
   } else if (context.getResources().getString(R.string.btn1Str).equals(text)) {
    orientation = ActivityInfo.SCREEN_ORIENTATION_PORTRAIT;
   } else if (context.getResources().getString(R.string.btn2Str).equals(text)) {
    orientation = ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE;
   } else if (context.getResources().getString(R.string.btn3Str).equals(text)) {
    orientation = ActivityInfo.SCREEN_ORIENTATION_REVERSE_PORTRAIT;
   } else if (context.getResources().getString(R.string.btn4Str).equals(text)) {
    orientation = ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE;
   } else {
    orientation = ActivityInfo.SCREEN_ORIENTATION_SENSOR;
   }
   
   //Let's set the orientation of the app now.
         setRequestedOrientation(orientation);
  }
 };
}
* Click here for the source files of the project.

Tuesday, November 25, 2014

Javascript: Cloning an object...

In Case, you need to do a complete clone of an object in Javascript and you want the original to remain unaffected, then you probably can give this method a go. :)


* Click here to access the demo that I have created on 'JSFiddle'.
^ Click here to test your JavaScript, CSS, HTML or CoffeeScript online with JSFiddle code
  editor.

Sunday, November 16, 2014

Towards the end of 2014...

Less than 8 more weeks to the end of 2014. And it's time to start the countdown for the last IT Show for the year 2014...

Image taken from 'SITEX 2014' website.

The venue for the upcoming event is pretty far, but it's
worth travelling all the way down. As compared to the
venue at 'Suntec Convention & Exhibition Centre', I prefer
the huge spacious space at Singapore Expo. Most importantly,
I can roam around the place freely and quickly, whhich is a
very big (+). :)
Venue:
  • Date: 27 - 30 November 2014
  • Opening Hours: 11am to 9pm
  • Venue: Singapore Expo Convention & Exhibition Centre
                 Halls 5 & 6

* Click here to find out more about 'SITEX 2014'.
^ Click here for the Facebook page of 'SITEX 2014' site.
~ Click here for the unofficial 'SITEX 2014' site.
  (You can gain access to all the pricelist of all the Exhibitor @ 'SITEX 2014'.
  Although it isn't available yet but it will be populated with lots of price lists and
  brochure as the 'show' approaches.)