Monday, May 19, 2008

Fixed SVN + SSH in Red Hat Developer Studio CR1

If you get the following message during an svn+ssh transaction using Subclipse,



The system cannot find the file specified.
svn: Can't create tunnel: The system cannot find the file specified.

You need to specify an ssh executable or equivalent. Modify the Subversion config file. On W!ndoz3 the file can be found in:



C:\Documents and Settings\[user]\Application Data\Subversion\config

In the [tunnels] section, see to it that it is not commented. Add / modify the following line:



ssh = C:/Program Files/TortoiseSVN/bin/TortoisePlink.exe

If you have Pageant running, you need not to specify the ssh key explicitly.

Sunday, May 18, 2008

Nonprimitive Data Types in Java

Nonprimitive data types in Java are reference variables (object references), arrays and enums. All nonprimitive data types are references to memory where the objects live.


[objects]


References provide access to objects. The declaration syntax is just the same as with primitives.



Decryptor decryptor;

The above example shows that we are creating a reference to a Decryptor object. Take note that no real object is created yet.


The object is created through the new operator.



decryptor = new Decryptor();

The reference decryptor now points to a Decryptor object in the heap.


[arrays]


Arrays are objects used to hold a collection of primitive or nonprimitive data of the same type. Take note that even if an array holds primitive data, it is always an object.


Steps for creating an array:


1. Declaration of an array variable (reference)



char[] charArray; //or
char charArray[];

2. Instantiation of an array of a certain size



charArray = new char[8];

3. Initialization of each array element.



charArray[0] = 'k';
charArray[1] = 'a';
charArray[2] = 'r';
charArray[3] = 'e';
charArray[4] = 'n';
charArray[5] = 'e';
charArray[6] = 'v';
charArray[7] = 'e';

Once a size is given to an array, it cannot be changed later.


[enums]


The data type enum is used to store a predetermined set of values or constants. Examples are the months in a year, the days in a week, etc.


Steps for creating an enum:


1. Define the enum type with unique named values



enum ShortWeek {MON, TUE, WED, THU, FRI, SAT, SUN};

2. Assign a reference to the enum type



ShortWeek monday = ShortWeek.MON;

You can only create X instances of an enum type, where X is the number of elements that the enum type holds.

Friday, May 16, 2008

Removing bar311 worm

I got it from my sister’s digicam. Thanks to Leerz for the walkthrough. This worm is really annoying especially if you are more comfortable doing stuffs in the console.


1. Check for any bar311.exe, Autorun.inf, pc-off.bat files in mounted drives.
2. Delete if found.
3. Edit the following entries in the registry.



HKCU\Software\Microsoft\Command Processor\"Autorun"
HKLM\Software\Microsoft\Command Processor\"Autorun"

Alternatively, you can download Noob.Killer, run it, then watch and learn.

Saturday, May 10, 2008

First time in Baguio

Forgetting all queued tasks…
Spending time with family, relatives and special someone…


I bought some sundot kulangot, in chabacano, kuut kugang.


It’s so cold in here. Internet speed is tolerable.

Thursday, May 08, 2008

Default Values of Primitives in Java

Default values apply only to instance variables that are uninitialized. Local variables need to be initialized explicitly before use or else the compiler will yell at you.


boolean - false
byte - 0
short - 0
char - ‘\u0000′
int - 0
long - 0L
float - 0.0F
double - 0.0D

Wednesday, May 07, 2008

The power within

How T.J. Rodgers grew Cypress Semiconductor by incubating innovative ideas - no matter the source.


Click here to read the article.

Tuesday, May 06, 2008

Literals in Java

Literals are values found in the source code and are known at compile time.


[boolean literals]


Each boolean type can only hold a literal true or a literal false. Boolean types can not hold numbers unlike in C/C++.



true
false

[char literals]


A char literal can be represented by a single character enclosed in single quotes.



char netPacket = 'K';

Another valid representation is in the form of a Unicode.



char netPacket = '\uCAFE';

The following are also valid, these are special characters represented by using escape sequences.


new line



'\n'

tab



'\t'

backspace



'\b'

form feed



'\f'

carriage return



'\r'

single quote



'\''

double quote



'\"'

backslash



'\\'

[integral literals]


Integral literals can be represented in 3 ways, octal, decimal, hexadecimal. Octal representations are preceded by a 0. Decimal representations contain no prefixes / suffixes. Hexadecimal representations are prefixed with 0x.


decimal



814

octal



031

hexadecimal



0xCAFEBED

[floating-point literals]


Floating-point literals are represented by floating-point numbers. A floating-point number must have one of the following:


decimal point (.)



8888.8888

scientific notation (e / E)



8.88E+8

suffixes (d / D for double & f / F for float)



8F, 8.8D

Monday, May 05, 2008

Primitive Data Types in Java

Java supports 8 built-in data types.


boolean - This data type is 1 bit in size and is used to represent a binary
condition, true or false.


byte - This data type is an 8-bit signed 2’s complement integer.
It can hold values ranging from -128 to 127.


short - This data type is a 16-bit signed 2’s complement integer.
It can hold values ranging from -32,768 to 32,767.


char - This data type is a 16-bit unsigned integer used to represent unicode characters.
It can hold values ranging from 0 to 65,535.


int - This data type is a 32-bit signed 2’s complement integer.
It can hold values ranging from -2,147,483,648 to 2,147,483,647.


long - This data type is a 64-bit signed 2’s complement integer.
It can hold values raging from -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807.


float - This data type is a 32-bit signed floating-point number.
The range of values it can hold is +/–3.40282347^38.


double - This data type is a 64-bit signed floating-point number.
The range of values it can hold is +/–1.79769313486231570^308.


The syntax for declaring and initializing a primitive is:



<modifier> <type> <variableName> = <initialvalue>

Saturday, May 03, 2008

Variables in Java

There are 2 types of variables in Java, primitive and reference variables. A primitive variable holds the real value of the variable while a reference variable holds the memory address of where the real value of the variable is stored.


Identifiers must be named according to the following rules:
1. The first character of an identifier must be a letter, an (_) underscore or a ($) dollar sign.
2. After rule number 1, the succeeding characters can be digits.
3. Reserved words are not allowed.

Thursday, May 01, 2008

Memory Usage in Java

Memory management in Java is not a thing to worry about, the Java Virtual Machine and the garbage collector handle it. However, when dealing with obfuscated codes, being aware of where things are stored in the memory is an advantage.


There are two logical places in the memory, the stack and the heap. Local variables, local reference variables and method invocations reside in the stack while instance variables, instance reference variables and objects reside in the heap.


Local variables as the name suggests are defined inside a method or as parameters of a method. Local reference variables on the other hand are those that refer to an object. These are defined inside a method or as parameters of a method. Method calls are pushed on to the stack.


Instance variables are primitive variables defined inside a class but outside of any method. Instance reference variables are those that refer to objects and are defined inside a class but outside of any method. Objects are representations of real-world entities that the program is trying to solve.

Restarting blog

Being able to document things is a sign of maturity. So in order to convince my self that I am growing somehow, I will dedicate a fraction of my precious time for documenting the things I burn-in each day as well as those that I have already burned.