Wednesday, April 24, 2013

Mencari Pi



Nilai Pi

Mencoba tanpa webworker. Pi dapat dihitung dengan kode berikut

var Pi=0, n=1, c=100000;
for (var i=0;i<=c;i++) {
  Pi=Pi+(4/n)-(4/(n+2));
  n=n+4;
}

perintah dalam tag <script> adalah sebagai berikut

Hello Canvas World

canvas's not supported
Back to first again
Tulisan di atas ditulis dalam canvas seperti kode di bawah. Di sini perintahnya adalah

context.fillText('Hello Canvas World',canvas.width/2-150,canvas.height/2+15);

context adalah '2d' dari canvas, dalam hal ini context kotak yang menyimpan perintah-perintah '2d' canvas seperti contoh diatas, yaitu menulis text.

fillText('tulisan', posisi_x,posisi_y) adalah perintah untuk menampilkan tulisan dengan warna sesuai fillStyle, yaitu 'green'

strokeText('tulisan', posisi_x,posisi_y) adalah perintah untuk menampilkan tulisan dengan warna 'tepi' sesuai strokeStyle yaitu 'red'


var  canvas = document.getElementById('canvasexample'),
 context = canvas.getContext('2d');

context.font = '38pt Arial';
context.fillStyle = 'green';
context.strokeStyle = 'red';

context.fillText('Hello Canvas',canvas.width/2-150,canvas.height/2+15);
context.strokeText('Hello Canvas',canvas.width/2-150,canvas.height/2+15);

Sunday, April 7, 2013

See the Avengers Face on Kebab Store

We knew that Tony Stark is cheeseburger mania. But at the end of Avenger movie, after barely escaped from time-space bridge, he decided to treat other avengers kebab, :)




My Blackberry Experience (part3)

In term of ease of use, I prefer non qwerty phone, thus, I prefer other devices than blackberries (but z10, maybe)

Why I don't like qwerty phone, because I didn't use to it. My first smartphone has candybar form factor, w960i, and I barely use it keyboard because I prefer its handwriting method using stylus.

I still like it and hope iPhone include this feature (unfortunatelly Apple don't bother to include it). I think it's possible cause google applied it in its search engine (work on i Phone too)

I start to used dvorak on my macbook pro in 2009, and since then I "abuse" my home PC, my HP tx2100us, and two server at work keyboards to became dvorak layout. It's simpler and more balance (right and left stroke). Of course blackberry, with its infamous qwerty keyboard, slow me down a bit.

Unfortunately, it applies to iPhone too. Although it allows for changing layout, it don't provide dvorak. Nevertheless, I still prefer iPhone over blackberry because its ability to change its keyboard layout. I'm currently use azerty layout on iPhone.



http://aravir-rose.blogspot.com

Web Worker on HTML 5

I'm planning to write an article or two about this web worker.

The background is our html+javascript behavior; it ran in just single thread (mean single process). With the development of technology, it's become a common that multicore processor installed on a computer or laptop, even in some models of tablets.

The problem is, because single thread nature of html+javascript, it couldn't take advantage of multicore processor. The process itself become inefective if there loop algorithm need to be done and many of that state affecting GUI (the common symptom is freeze web page, not respon to click and even popup that appears and warn us to stop the script)

Web worker solved that by implementing multi thread processes on single page. Web worker thread itself runs in background and independent of GUI so a large loop computation process won't freeze the page.

(to be continued)

http://aravir-rose.blogspot.com

My Blackberry Experience (part 2)

So, how about the Blackberry killer app, Blackberry Messenger?

I personally don't know what's so great about it and what's really different with others messenger apps.

My sister in law tell me that BBM benefit is ability to block people and prevent his/her to contact us. Because BBM connect people through PIN, blocked people won't be able to contact via phone number if didn't know our number or we change our number.

I though of that and feel that it's ridiculous. We know yahoo messenger, google talk, whatsapp and other messenger have blocking feature as well.

Another problem is PIN itself. It's tied to one device. While it comes handy as we don't need to create new account as we have new number, it ties us to just one device. If we get another blackberry device, we have to reinvite our contacts again (or just export it? IDK).

Sure whatsapp or LINE is very vulnerable, anyone had our number is able to contact us but what's so bad about it? They still able to text or call us, don't they? And it have (along yahoo, gtalk and other) great portability; we're free to change device and still use same account, even use it in desktop computer.

Maybe it's just me but I don't want to be tied with one device. (Don't you want to upgrade your blackberry device?)

Blackberry Messenger is still great app though, with million users of course, every blackberry owner use it. But in the end, I still found whatsapp or other traditional instant messenger come handy in term of portability.



http://aravir-rose.blogspot.com

Saturday, April 6, 2013

My Blackberry Experience (part 1)

After trying my sister-in-law's blackberry, I feel the urge to compare it with my 4S. This is the first post about it

Maybe it's not fair to compare that two device, iPhone is touch based device while blackberry is scroll-point-click based device, but I'm curious about why blackberry is so famous and became de-facto in business (at least in the past). Well, here is it...

My reaction the first time I grab the blackberry is, confused.

Maybe I used to touch my iPhone to make it work but the blackberry OS confuse me about almost anything. I don't even know how to unlock its display at first because "mute" button is "play" button, :).

The home screen displays few apps and when I want to open apps that not in home screen I have to scroll it down but wait,... it don't scroll. Apparently I have to click "all" first and then scroll it down. While it may easy but the problem is I have to highlight "all" first to click it. iPhone have fewer step to go to anything.

The first app I want to open is mail, it's app that make blackberry powerfull among businessman anyway and guess what? It is...

The push feature is great, it delivers email as "send" is clicked, and receives email as soon as the email sent by sender (whoever it is) thank to BIS.

Yeah, blackberry mail is ok but I found facebook for bb is terrible (second apps I opened after mail). Try to read a twenty lines comment and you know what I mean, you read several lines and when you scroll to read next lines, it goes to last lines, and few lines before last line, there is no way to read 'middle' line

....

Sure iPhone can't transfer file via bluetooth, or download music (or anything) outside app store, but it worth it, faster, smoother and I'll stick with it.


http://aravir-rose.blogspot.com