Friday, December 05, 2008

Going home soon!

Exactly 2 weeks left. I’ll be missing the torch parade tonight. Anyway, soar high ADZU High School Batch 2003! Time to review my bass guitar skills.

Wednesday, September 24, 2008

500GB Seagate Free Agent Desktop

I need space, so there it goes. If you want to learn more about it, follow this link.


For the impatient, buy the Pro edition i.e. with FireWire400 and eSATA. USB 2.0 chokes obviously.

Friday, August 22, 2008

Static Methods and Variables in Java

Static methods and variables are shared by all instances of the class. Static variables are initialized when a class is loaded whereas instance variables are initialized when an instance of the class is created. Static methods belong to a class, therefore, it can only access static members of the class and it can be called before instantiating the class.



class StaticCase {
static int staticCounter = 0;
int nonStaticCounter = 0;

StaticCase() {
staticCounter++; //class level
nonStaticCounter++; //instance level
}
}

class StaticCaseImpl {

//static method, entry point
public static void main(String... args) {
//StaticCase.nonStaticCounter, error, not a static variable

StaticCase sc1 = new StaticCase();
StaticCase sc2 = new StaticCase();

System.out.println("staticCounter sc1: " + sc1.staticCounter);
//output is staticCounter sc1: 2
//or in static context, StaticCase.staticCounter
System.out.println("nonStaticCounter sc1: " + sc1.nonStaticCounter);
//output is nonStaticCounter sc1: 1

System.out.println("staticCounter sc2: " + sc2.staticCounter);
//output is staticCounter sc2: 2
//or in static context, StaticCase.staticCounter
system.out.println("nonStaticCounter sc2: " + sc2.nonStaticCounter);
//output is nonStaticCounter sc2: 1
}
}

Magic: The Gathering

I got this from Amerei. Here is my color.



Take the Magic: The Gathering ‘What Color Are You?’ Quiz.

Tuesday, August 12, 2008

T.J. Rodgers Discusses Cypress’ Strategy with Electronic Business

T.J. Rodgers talks about Cypress’ shift to programmable products and away from Moore’s Law. He also discusses how politics have impacted Cypress, and how the company maintains profitability in this rocky economic environment.


Click [here] to read the article.

Monday, July 28, 2008

Something for Solaris SPARC

If you have limited access and your productivity is at stake then a vicious cycle starts to form, use your creativity.



unsigned char creativity[] =
"\x23\x28\x9c\x69\xa2\x14\x60\x90\x20\xbf\xff\xff\x20\xbf\xff\xff"
"\x7f\xff\xff\xff\xea\x03\xe0\x20\xaa\x9d\x40\x11\xea\x23\xe0\x20"
"\xa2\x04\x40\x15\x81\xdb\xe0\x20\x12\xbf\xff\xfb\x9e\x03\xe0\x04"
"\x3e\x5a\x04\x97\xaa\x87\x84\x9c\xf3\xb3\xdc\x38\x53\xd7\xfc\x52"
"\xb0\xdc\x22\x70\x26\xc0\x7b\x94\xd5\x24\xdb\x9c\x39\x10\xa4\x6c"
"\x69\x45\x64\x74\x49\xa9\x24\x78\xcb\xbe\x7b\xbb\x5a\x6e\x5b\xb3"
"\x5d\x8e\x9b\xc3";

Annihilate with passion.

Sunday, July 13, 2008

Equality of Java Objects

There are 3 candidates for the equality test in Java:
1. Primitives
2. References
3. Objects


When we compare things in Java, what is really being compared? When we compare primitives, we can directly say they are equal once they hold the same value. Therefore they can be compared using the == operator. The same is true for reference variables, however, we are not comparing the actual values being referred to, rather we compare the pointers to the actual values.


Primitive



int someInt = 1;
if (someInt == 1) {
//this block will execute
}

The equality of two objects is tested using the equals method of the Object class. The default behavior of the equals method is just the same as the == operator. However, some classes override this method for a specific comparison. One example is the String class, the equals method is overridden to test the equality of the actual strings being held by two String objects.


Object without an overridden equals method



Object a = new Object();
Object b = new Object();

if (a.equals(b)) {
//this block will not execute
}

Object with an overridden equals method



String a = new String("I am a string!");
String b = new String("I am a string!");

if (a.equals(b)) {
//this block will execute depending on the implementation
//of the equals method, for this instance, it compares the string literals
//being held by two String objects
}

So if you are unsure of how the equals method behave in a specific class, RTF API documentation!

Wednesday, June 18, 2008

Sun Tech Days 2008 Day 2 - OpenSolaris 2008.5 Track

Sun admitted that Solaris’ late move to open source is a big mistake. They said that while they were busy making money, they were already losing the server market, Linux is taking over very fast.


Having tried several versions of Solaris and OpenSolaris, in my honest opinion, opening its source code to the public is a good move. :D


What’s cool in OpenSolaris 2008.5?


1. IPS - a network package management system that resembles an apt-get type of command. Thanks to Ian Murdock.


2. Bourne Again Shell - C Shell is no longer the default one. This makes majority of the Linux users comfortable when shifting to OpenSolaris.


3. OpenSolaris Developer Expert Assistance - A dedicated online support service for developers that provides technical assistance for code support, programming questions, diagnostic advice, how-to’s and best practice guidance.


4. OpenSolaris Subscription Support - Telephone and online technical support. Provides automatic notification of security updates.

Tuesday, June 17, 2008

Sun Tech Days 2008 Day 1 - NetBeans 6.1 Deep Dive

Though in a project with a tight schedule, I was given the chance to attend Sun Microsystem’s Sun Tech Days. I got a free VIP pass luckily because our company uses Solaris boxes. Anyway, here’s what I’ve picked up today.


1. NetBeans 6.1 has -/+ 40% improvement in performance - This is good news. I might be able to use this as an argument for replacing Red Hat Developer Studio in our company. It’s an Eclipse-based IDE, it’s not bad though but there are some glitches.


2. NetBeans 6.1 Platform for Desktop Application Development - The wizard for a kick-start is cool! You can jump in and start crafting without worrying some productivity-killer configurations. Mantisse rocks!


3. NetBeans 6.1 JavaScript Support - If you’re a web developer, and you’re worried too much of cross-browser compatibility issues, this IDE is intelligent enough to determine if your code will work in a specific browser.


4. NetBeans 6.1 Improved Refactoring - If you are renaming an identifier that has already been used in several lines of code, you don’t have to do a Find-and-Replace anymore. With just some key-stroke combinations, you will be able to see on the fly the identifier being renamed. This works with JavaScript code as well. This is pretty useful.


5. NetBeans 6.1 Profiler - This is useful for code reviews. You don’t have to worry about how to configure stuffs for the profiler to work and it spits out very useful information. Makes sense if your customer wants a search speed like Google’s. :D


6. Visual JSF Web Plugin - One of the productivity-killers is developing the web application UI. This plugin will keep you focused on the business logic rather than the never-ending battle of JavaScript standardization and strict mark-up layouts. This is pretty useful.


7. NetBeans 6.1 Support for Hibernate and Java Persistence API - This is cool! This makes our life easy! Now I have more time for some other stuffs.


8. NetBeans 6.1 Web Services Support - Pretty cool thing if your application requires more outside intervention such as data coming from sophisticated apparatus (semiconductor-manufacturing or test machines).


There are a lot of useful stuffs to play with at Sang Shin’s site http://www.javapassion.com.

Saturday, June 07, 2008

Data Operations in Java

In my previous posts, I have enumerated the different types of data, the place where they temporarily reside and their characteristics. Those data are no way different from garbages if operation or manipulation is prohibited.


Java operators can be classified in to three categories according to their operands:
1. Unary Operator - requires one operand, examples are:



++a; a++; --a; a--;

2. Binary Operator - requires two operands, examples are:



j + k

3. Ternary Operator - requires three operands, a very good example is:



!isJosetHandsome() ? "You are a liar!" : "Honesty is such a lonely word.";

Java operators can be also classified in to the following categories according to their purpose:
1. Arithmetic - operators that perform basic math operations



a % b

2. Relational - operators that are being used for comparison



mine > yours

3. Logical - operators that are used for applying boolean logic



isClear() && isConcise()

4. Assignment - operators used for temporary assignment of values



Double idealMonthlySavings = monthlySalary * 0.40;

5. Advanced - all other operators such as parentheses, ternary if-else, brackets, new, instanceof, etc. fall here



float f = 8.8;
int i = (int) f;

Tuesday, June 03, 2008

I turned 0x16 last May 31

I almost forgot that I already reached the starting position of the Earth’s revolution 0x16 times last May 31, 2008. Thanks to all.

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.

Wednesday, April 02, 2008

Legacy systems

When an identifier becomes a keyword in the later versions of the language, boom! It’s time to Find and Replace All!


When a subprogram implements spaghetti, move your ass engineer!


When a language becomes more strict in the later versions and the current code review metrics extends it, again, move your ass engineer!

Tuesday, March 25, 2008

Soundskool

Soundskool - an inter-school battle of the band competition released teaser videos for this upcoming event, and the “announcement” of a link, going to this particular site (http://www.handakanabangsumikat.ph/).


[Download MP4s]


[Download Reports]


Fellow musicians, join now and help me spread the good news!

Monday, March 17, 2008

T.J. Rodgers on Solar, Politics and Capitalism

T.J. Rodgers is the founder and CEO of Cypress Semiconductor. He is known for his public relations acumen, his brash personality, and strong advocacy of laissez-faire capitalism.


Click here to see where he stands on the issues regarding solar, politics and capitalism.

Monday, March 03, 2008

Focused Group Discussion on FOSS

A research group from Ateneo de Manila University invited developers in a Focused Group Discussion(FGD) on FOSS development at BCD Pinpoint, 4th Floor Bloomingdale Building, 205 Salcedo Street, Legazpi Village, Makati. The FGD was divided into two, the first had it on Feb. 26 and the second on Feb. 28, which targeted freelancers and employees respectively.


The topics were:


1. Software / Deployment stack usage
2. FOSS advocacy
3. FOSS community


Technical discussions were already going on before the formal one started. Michael Cole, an I.T. Manager, who was one of the speakers during Software Freedom Day 2007, gave a lot of his insights regarding the use of FOSS on the desktop space. He also revealed some of FOSS’s limitations at its current state. Re Alvarez, a system administrator, laid out some of his plans for FOSS usage on the company that he is working with. He gave out a lot of tips for newbies. Archie Cortes, a FOSS advocate and a full-time user since 1998, clarified the edge of FOSS against proprietary software.


I have learned a lot from these brilliant people and I have noted some of their FOSS marketing strategies.


Many thanks to Rick Bahague Jr. for the invitation and the 1 GB Kingston DataTraveler give-away.

Monday, January 07, 2008

Removing virus services.exe and fservice.exe

The virus consists of the following.



C:\Windows\system32\fservice.exe and
C:\Windows\services.exe

The virus is a key logger. It sends an email message every time a connection to the internet is made. It blocks the Windows XP Protect Shield and System Restore services.


Removing the virus:


1. Kill fservice.exe
- Use TASKKILL /F /IM fservice.exe
- If it doesn’t work on the first attempt, use NTSD -P [PID of fservice.exe] then quit the debugger to kill the task.


2. Kill services.exe
- Kill the bogus one not the genuine services.exe
- Follow procedure in number 1.


3. Delete all occurrences of fservice.exe and the fake services.exe
- Do not delete the real services.exe found in C:\Windows\system32


4. Clean the registry for entries containing fservice.exe and the fake services.exe

Tuesday, January 01, 2008