Anonymous attacks to government sites

Recently, Anonymous the online activist group had attacked many countries’ government sites because of the censorship move against the internet. United States, Turkish, and Malaysia had been targeted around these days.

The reasons released by Anonymous on Pastebin said why they want to attack Malaysian’s site is because Malaysia Government had blocked some popular file sharing or pirate downloading website which infringed copyrighted law. Around 41 Malaysian Government site had been attacked. It raised a big security concerns to Malaysian Government site.

Is it blocking copyrighted site is a good way? By right, we should respect copyright. But, still few of people love to use pirate software or watch pirate movie because it is cheaper. Government should educate people to respect copyright but not blocking the site, BUT, it is hard to debate actually.

I know the motive of Anonymous is to help protecting basic human rights. There is good and bad of this attack. Hard to debate. But through this attack we can know how secure the website, how many loopholes found in the website, and we are going to enhance or fix it.

Apple iCloud sued by iCloud Communications (VOIP Provider)

Apple had delivered iCloud recently, that served free online space for music, movie storage targeted on Apple devices (iPad, iPhone, iPod Touch). It helped synchronization of music files seamlessly without user knowing what really happened in the background.

But today, Apple had sued by iCloud Communications for Trademark Infringement. According to its website, it is a pioneer of telecommunications industry since 1982. Read more

Ported Akshell iPlace into PHP Quercus runs on Google Appengine

I have ported iplace.akshell.com (server side JS) into PHP (but hosted in Google Appengine using Quercus). I am using Objectify to contact with Google Datastore. The port is easy, akshell code and appengine code is very similar, even with the use of Imgshow API. I am using PHP-styled of Imgshow API calling, but using Imgshow Java implementation. Quercus make PHP and Java worked excellent together. PHP is able to directly call the Java classes and methods, but at the same time it remains the common functions supported by original PHP.

Akshell is very exciting, Quercus does too.

Next step I want to try is researching the automatic registered Second Life Agent with server side script outside. The Agent should be able to register automatically to the server when they online in Second Life. And then the user from the website is able to control the Second Life in-world object to perform some operations for them. For iPlace, the agent may grab the surrounding information such as who (Second Life User) had just passed by the agent.

At the same time, I am developing an iPhone Apps for iPlace Tool but just for experimental purposes. It is a simple apps to display list of checked-in places. It fetched XML from akshell server. I am using ActionScript 3 to do this mobile apps, and had deployed in iPhone. But by right it should be able to run in any other mobile phone such as Android and Blackberry. See what we can do between the integration of these three platforms (Second Life, Akshell / Appengine (Cloud), Mobile).

Last updated June 13, 2011 12:18am.

Labeled break in Java

According to Java Tutorials, the Break Statement, break used in Java has two forms: labeled break and unlabeled break.

Unlabeled break

Normally, we knew unlabeled break used in switch-case statement, to break the following execution in the block.

Example:

int HOUR = 3;
switch(HOUR) {
case 1:
case 2:
case 3:
break;
case 4:
break;
default:
break;
}

Or used in for, while, do-while loop, for example:

for(int i=0; i<10; i++) {
System.out.print(i + " ");
if(i == 3) break;
}

(Which printed: [1 2 3 ])

Labeled break

There is another type of break called labeled break. Besides to use goto statement in Java (you know goto is reserved keyword in Java but it is not supported), we can use labeled break to break the following execution and transfer the flow of control back to the labeled statement immediately.

Example:

int input = 3;
validation: {
System.out.println("start");
if(input == 4) System.out.println("pass");
if(input < 4) break validation;
System.out.println("the input is not equal 4 and not smaller than 4");
if(input > 4) break validation;
System.out.println(“end”);

}
System.out.println("another end");

It should print:
start
another end

The program execution will break from the validation block (declared curly braces) and jump to the end followed by the block.

Another example, if you have a nested loop, and you want to break and returns to the outer loop, you can:


cat: {
for(int i=0; i<3; i++) {
for(int j=0; j<5; j++) {
System.out.println(i + " - " + j);
if(j == 3) break cat;
}
}
}

It should print:
0 – 0
0 – 1
0 – 2
0 – 3

In the example 4, the cat block has curly braces surrounds the inner nested-for loop code. But if, we make something like this:


cat:
for(int i=0; i<3; i++) {
for(int j=0; j<5; j++) {
System.out.println(i + " - " + j);
if(j == 3) break cat;
}
}

In the example 5, the statement followed by label cat is now the nested for-loop without curly brace. Now we said label cat is just for the nested for-loop, if you break or continue in the inner for-loop, it will return the outer for-loop.

The result will be the same as Example 4, but if we change the break into continue, (continue will be valid in this example, but invalid in previous example), it turned into magic, see:


cat:
for(int i=0; i<3; i++) {
for(int j=0; j<5; j++) {
System.out.println(i + " - " + j);
if(j == 3) continue cat;
}
}

The result will be:
0 – 0
0 – 1
0 – 2
0 – 3
1 – 0
1 – 1
1 – 2
1 – 3
2 – 0
2 – 1
2 – 2
2 – 3

Argument

But, this kind of feature is rarely found in most program code. Programmer who worked 16 years experience told us this.

Labeled break provides similar or equivalent feature just like goto do. The goto is considered evil to the program because it makes the code unreadable. That’s why Java is not supported it. But I think there is another reason. But you may see labeled break do just goto do, then why Java supports labeled break but not supports goto. So, there is a reason, they are still different semantically.

Consider:

x : {
int a = 5;
if(a == 3) break x;
if(a == 5) break y;
}

y: {
int b = 3;
if(b == 3) break y;
if(b == 5) break x;
}

In the first X block, if a equal to 5, it will not jump break for Y block, and compiler will also prompt error. Labeled break is not able to break forward, but backward only. That’s mean, if you are inside X block, you only can break from X block or said current block, but not another block. This is the difference between labeled break and goto.

It just provides another flexibility to Java programmer, make code easier in some cases when there is a need to jump out from nested loop, I think this is the most use cases can use labeled break.

Additionally, repeated labeled block with same name is valid. Example:

test : break test;
test : { break test;}
test : {
System.out.print("test");
break test;
}

It prints “test”.

Last

I think it is valuable knowledge to share with you. Wish happy coding in Java.

Related Links:

  1. http://www.java2s.com/Code/Java/Language-Basics/BreakWithLabelDemo.htm
  2. http://www.java2s.com/Code/Java/Language-Basics/Labelledbreaksbreaksoutofseverallevelsofnestedloopsinsideapairofcurlybraces.htm
  3. http://stackoverflow.com/questions/5099628/why-does-java-allow-for-labeled-breaks-on-arbitrary-statements
  4. http://stackoverflow.com/questions/4546925/is-goto-as-bad-as-people-say

Akshell.com Online IDE for Server Side Javascript

Akshell.com is an online IDE for Server Side Javascript, built on Google V8.
Have a try and tell me your experience.

It is awesome stuff, you don’t really need to download anything but you can develop and debug directly in the online IDE. I am able to build imgshow client API using this language and will be open source soon.