Monday, March 19, 2007

Batch jpeg image resize in linux

The (jpeg) photos we take using digital camera are just too large so to save space and bandwidth, it's better to resize them before uploading them to online photo sharing sites like Picasa or Flickr. Here's how i do it in linux..

Basically two commands are used here.
1. djpeg - decompress a JPEG file to an image file
2. cjpeg - compress an image file to a JPEG file

So to resize, i run this script on a folder containing the image files.


mkdir resized
for i in *.JPG
echo 'Resizing image..' $i
djpeg -scale 1/2 $i | cjpeg > resized/$i

After script is done, a folder named 'resized' is created containing the resized images..

Both the program djpeg/cjpeg isn't installed by default, they're part of libjpeg-progs package. Under Ubuntu you can get it by

sudo apt-get install libjpeg-progs

(thanx subir dai for pointing this out)

Is fate written on your palm?

Today we'd a surprise treat from Ashay. He had his birthday yesterday so we all were insisting on him to give us a treat. We weren't expecting, but he agreed!

We went to Jazz-a-bell cafe after the FOSS Essentials. There Ashay revealed one of his talents. He can so elegantly read palm. Especially Kebina n Monika were eager to have their read (Why gals so badly wanna know their future is out of my mind..). Whatsoever, Ashay told a lot of things to Kebina n Monika (about themselves) through their palm.

Whatever happened there is quite irrelevant here, one question always hunts me - Is there anything like fate? What i strongly believe is that the lines in the palm don't determine the fate.. Instead it's the fate which determines the lines. And fate is something you can control. The more harder you work, the better will be your fate and better will be the lines on the palm.

Here're few lines from 'The Matrix' movie, i'm really influenced of..
(Conversation between Morpheus and Neo)

- Do you believe in fate?
- No
- Why?
- Because that's not the way i wanna control my life..

Sunday, March 18, 2007

FOSS Essentials Training - Second day

I'd meeting at some other place in the morning so couldn't reach MPP on time. When i reached there it was already time for lunch. As soon as i reached the hall, i got the food coupon! How embarassing..

But i was full so didn't go for lunch. Instead we jus stayed in the hall and started a movie on the projector. Yesterday we were talkin about movies and we'd also talked about 'The Matrix'. Prasanna had recommended another movie 'V for Vendetta' by the same director. This time he'd brought the DVD. Unfortunately, Ashay was first to grab it. My chance is tomorrow.

Well, we put the movie on, but obviously we didnt have time to watch the full movie, so we just turned it off and went for lunch. Lunch was better than yesterday. And one special thing to mention, this lunch is costing us a lot. We're using Yala Maya Kendra's hall, so we were compelled to order all the food from Dokaima Cafe. But this cafe is kinda 10 star'ed. The simple lunch we're providing to the trainees is costing us Rs. 300 per head! Way too expensive..

But lets not get concerned with food, what concerned me today was Roshendra dai's camera. At first i thought it was a SLR, but later on found out that it wasn't. But still, the camera was 8mp with 8x zoom and the photos were outstanding. Moreover, it looked more like SLR, i totally got stuck with it.. Shot everything that came infront of me..

The program continued. This time i also had a presentation on 'How to start blog'. But mine was scheduled at the last. So i took some time off to go to MPP office and had a look on my presentation. There wasn't anything i could add. My time was limited so the slides were more than enough..

From FOSS Essentials Training 2007

Back to the training hall. Shishir was giving presentation on LTSP. Prasanna's Drupal was next followed by Shankar's presentation on Wiki. Mine was at the end..

Finally the program was over. And the fun parts were just beginning - certificate distribution and photo session. It was real fun (especially the photo session)..

One more thing i need to mention. All the gals got 50% of their training fee waived, courtesy of BellaSAP. Wish guys also had such fortune..

Anyways, FOSS Essentials Training was a gr8 success. Hope the trainees also learned a lot.. The sad part is that i again have to go to MPP tomorrow to rearrange the computers.. ;)

From FOSS Essentials Training 2007

Saturday, March 17, 2007

FOSS Essentials Training - First day

Woke up at 5:30 in the morning and i'd already overslept. I had to reach MPP by 6:30 so i'd to rush. But when i reached there, i was the first. Other guys soon joined. Yesterday the training hall was occupied so we couldn't setup the computer. Now it was time to rush.

We'd quite a taskforce, so it didn't take much to manage the training area. The opening ceremony was scheduled for 9am. Everything was ready by then..

The program started with some speeches n all.. There were two Japanese guys from CICC. I really had problem understanding their english. Then there was a funny speech by Kamal Mani Dixit (the day before there was a disastrous typo on his name on the schedule sheet but was fixed immediately!!!). Similarly there were speeches from NITC Director Subarna Shakya and
CAN President Biplab Man Singh too..

After the training started, we (volunteers) stayed in the hall for a while. The first presentation was by our very own Subir dai about FOSS. It was followed by Hempal sir's presentation on licensing issues. I was really overwhelmed by the number of licenses available. There was a slide where he'd put the logo of all the licenses available. The whole screen was cluttered by the logo. So many licenses, you need to be a lawyer to understand 'em all.. But i love GPL, it's widely used, simple and has full FOSS spirit too..

Lunch break and the training continued with Linux installation. We all volunteers were to assist the trainees so that they wont wipe out the existing data in the computers. I had the responsibility of total four computers in first and second row. There was this didi in the first row named Sushmita whom i thought had seen somewhere else before. Later on we found out that both of us know a same person..

Linux installation was a breeze. But in one of the computer, CDROM wasn't working properly so we had to abandon the installation.

The next session was basic linux commands, so we all volunteers got out for some chit chats. Yesterday Ankur, Prasanna, myself and other guys were planning to have a program on 'how to write code on Open Standards'. So we sat down to talk on it. My plan was to organize a one week long session with one hour each day. Later on we also discussed on how to work on understanding others' code as this is the first step to work on open source collaborations. It was decided we'll take next one week to design the program and the actual program need not be continuously one whole week.

We also talked on starting a project 'JotPad'. Basically this project will be used for OLPC laptop. This would be Nepali Notepad with handwriting recognition. Some kinda ambitious project, but we all are excited and
interested to work.

Besides there were talks on various topics like Google Summer of Code, OLPC and sometimes even on movies. Ujwal is still tryin to make some pace on his project Neprogra. His concept is awesome. Actually he is trying to make an universal microcontroller programmer, with all controllings from computer. I think i'm getting his idea but donno why electonics projects dont perk me much these days..

Finally OLPC laptop, there was a presentation on it by Ankur and Himali dai. This little laptop is really amusing.. The thing that most shocks me is the resolution of the screen. In such a small size, they've managed to squeeze a resolution of 1200x900 pixels. Moreover, it also works with sun's light. These days i'm really getting interested to work on the development stuffs of this 'sano sathi'.

In overall, the day's program was great. Although i didn't spend most of my time inside the training hall, i suppose the program was great from Geshan's blog. Tomorrow we again have the second day of the training. Lets see how it'll be tomorrow. Tomorrow i also have presentation on 'How to start a blog'.

Friday, March 16, 2007

Steps to compile Helloworld for Symbian OS using visual c++ 6 for Nokia 6600

1. the first option is choosing which SDK to use. the lower versions have less documentation and examples but have integration with visual c++ 6. the higher versions ( > 2nd edition) have no integration with visual c++ 6 but have better documentation. so i recommend to install multiple SDKs as long as space is no limit. note that multiple sdks can coexist very easily.

2. first of all install sdk 2nd edition. the only reason to install this is for visual c++ 6 integration. there are two folders inside C:\Symbian\7.0s\Series60_v20\Series60Tools named 'applicationwizard' and 'epoctoolbar'. copy them to some other location. we need this later on..

3. now uninstall the 2nd edition sdk. this sdk has a problem that the gui softwares need exactly 1.3.1 version of java and cant work with higher.. (duh)

4. now install any higher version of sdk (in our case, 2nd ed, fp2). higher versions usually have more examples and better documentations.

5. copy the help and examples from the installation folder.

6. now u may uninstall this sdk. (reason - binaries produced by higher versions maynot work with lower version models)

7. install sdk 2nd edition fp1 (aka 2.1). both '2nd edition' and '2nd edition fp1' support 7.0s Symbian OS, but the later works with any java version higher than 1.3.1 plus it has some more functionalities.

8. install java

9. install activeperl

10. Open My Computer > Properties > Advanced > Environment. Add C:\Program Files\Java\jdk1.5.0_04\bin to the PATH variable. Add .pl to PATHEXT (so that perl scripts dont need trailing .pl ** VERY IMPORTANT!!! **)

11. Perl setup usually associates perl scripts with perl. To check, My Computer > Tools > Folder Option > File Types. Go to pl extension, n check if it is setup. if not, create a new and make it to open with perl.exe

12. now add application wizard and epoctoolbar from 'applicationwizard' and 'epoctoolbar' folders we copied in step 2. instruction on how to install is given in the readme file in the folders.

13.start visual c++ 6.0 and create an application using a wizard. Suppose the application is named Helloworld and is located at c:\HelloWorld. Once the files are created, you can edit it, but lets first compile it as it is..

14. the vc++ toolbar can be used to compile but the command line is more flexible.

15. Run > cmd

16. Go to project's group folder. cd c:\Helloworld\group

17. type -

bldmake bldfiles

This makes abld.bat and some other info files..

18. to compile for emulator type,

abld build wins udeb

abld - build utility command
build - build the program
wins - for emulator
udeb - debug build (u means unicode)

19. now run emulator (debug) from emulator. there is the compiled application at the bottom

20. to compile for cell phone type,

abld build thumb urel
abld build thumb udeb

Meanings same as 18, except that thumb refers to compressed code for armi processor in the cell phone.

21. beore transferring it to phone, we need to make a package.

24. now back to command line, go to install folder n type

makesis helloworld.pkg

25. helloworld.sis is created. transfer this to the mobile phone, install n run..


Me, a blogger?

I'm writing after such a long gap n i'm feelin quite funny about it. This saturday and sunday FOSS Nepal Community is organizing a FOSS Essential Training. The event is supported by Center of the International Cooperation for Computerization (CICC), Singapore, National Information Technology Centre (NITC) and Madan Puraskar Pustakalaya (MPP).

Being a FOSS member i'm obviously into it. In particular i'm in Resource Personal team and Event Management Team. But here are the fun parts..

I missed the first meeting! N i donno if other guys were mad on me or what, they've chosen me to give a presentation on blogging. Their point was that i'm a 'blogger'! Yes i do blog but it's far less than occasional. But still, it was surprising to me that i still got the status of 'blogger' coz other guys present in the team dont blog!

That was it, n i had to prepare a presentation on 'How to start a blog?'. Around 10 minutes long. Wasn't a hard job at all. Even though i'm not a true blogger, i do know how to start one n stuffs related to them.. I use for my blogs, but i also had to try out which i found pretty cool. Quite less messy and easier than But i'll be sticking to for some time.