Monday, October 18, 2010

make auto play dvd (pictures and movies) for windows in linux

Ah, every time I have to use windows, my head starts hurting just with the thought of it...
But when you have friends/relatives who don't know/want to use real computers, what can you do.

I burned a dvd with an Autorun.inf file (to auto play in windows) that runs a batch file to:
  1. View all pictures in the disk
  2. Play all the movies in the disk
In linux,
 find . -name "*jpg" -print0 | xargs -0 xzgv ; find . -name "*avi" -print0 | xargs -0 mplayer -fs
would have been pretty much all what I'd need.
Yeah, I know, blaming windows for not having a pipe (or a decent set of commands...) wouldn't be too fair, being that only unix type operating systems do and all... But you can guess how annoying it is when you are used to something this simple.

Anyway, this is what I did:
  1. Output all the picture files (including subdirectories) in a file, and change the "/"s to "\"s so windows can read it...
     find * -name "*JPG" -o -name "*jpg"|sed 's/\//\\/g' > pics_list.txt
  2. Do the same with the video files (3g2 is a cell phone format... apparently not many windows players can play it, so I ended up using linux's mplayer program's windows' version)
    find * -name "*3[Gg]2"|sed 's/\//\\/g' > vids_list.txt
  3. Got IrfanView (a picture/video viewer), because it can accept input from a file (step 1 can be used as a list for the files to view).
    You'll have to do this in windows... zip the IrfanView's directory and use ftp or something to get it into your linux computer.

    IrfanView can also be used to create a binary (a program) of a slideshow of all the pictures you choose in case you want a simple way. However doing this won't allow you to rotate/zoom the picture, etc.

  4. Got SMplayer (a video player---this has to be done in windows too...) but didn't work, so I ended up using the binaries of mplayer that came with that annoying GUI, and using it just like in linux. As above, put it in the directory you are creating the disk.

  5. With all this done I can write the batch file:
    set FILES=%CD%\pics_list.txt
    IrfanView\i_view32.exe /filelist=%FILES%
    mplayer\mplayer.exe -fs -vf scale=320:240 -playlist vids_list.txt
  6. Then make an icon file (optional). Use Gimp to resize any picture to 16x16 pixels, and save it as png.
    Use pngtopnm to change the file's format png->ppm.
    Use ppmtowinicon to make the .ico file.
     pngtopnm file.png > file.ppm
    ppmtowinicon file.ppm >file.ico
    #rm file.png file.ppm
  7. Write the Autorun.inf file with the name of the batch file to run, and the icon file as icon. This file has to be at the top of burned DVD's directory tree.
     [autorun]
    open=playme.bat
    icon=icon.ico
  8. Change all the text files written in windows to a DOS format. If you don't understand why, read here.
     #in the directory where all the text files are
    #Autorun.inf =auto play file
    # playme.bat =the file containing the viewer to view pictures and the player to play the movies.
    # pics_list.txt =list of pictures made by linux' find and sed
    # vids_list.txt =list of vids made by same as above
    for FILE in Autorun.inf pics_list.txt vids_list.txt playme.bat ; do unix2dos $FILE; done
  9. Burn the disk with your favorite program. growisofs example:
     #in the wanted to be top of the dvd's tree structure (where Autorun.inf is)
    growisofs -Z /dev/scd0 -R -J -V "pics2010" .
I did change the scale in order to be able to view some vids with very small screens, but that's about it.
The directory tree would result something like:
  • Autorun.inf
  • pics_list.txt
  • vids_list.txt
  • icon.ico
  • playme.bat
  • IrfanView #the directory containing IrfanView (viewer program)
  • mplayer #the directory containing windows version of mplayer (vid player)
  • pics #the directory containing the pictures
  • vids #the directory containing the vids
At least, after doing all this, there's like no way the person you want the contents to see is not going to be able to!
I think you can just let the OS to kinda guess the dvd's contents, and choose a program to read it. But having strange formats (like 3G2, I don't know if it's a world-wide thing, but in Japan all cell phones use this annoying format, and having so much of them using mencoder to change them to avi wasn't a good option) putting a player in the same dvd needs to be done.

Tuesday, October 5, 2010

Rakuten's initiation ceremony

I went to the Rakuten's initiation ceremony the other day.
There were a bit over 500 people including the staff and TV cameras taking the event.
I was a bit nervous. Especially since, even though the ceremony itself was in English, it was a Japanese style one! So, like, you have to image the army, because it's something like that. In the first five minutes nobody did anything but stay quiet looking straight ahead; that's right, five hundred people in the same room, and nobody was speaking...
Well, I'm actually quite accustomed to that kind of ceremony so it wasn't that hard for me, but since Rakuten is even doing the ceremony in English and all, I thought a more "American-like" ceremony would have been more welcome.
In Japanese ceremonies, you have to respond in a loud voice, and then go to the front of everyone. In this ceremony you had to do that too, however in English, and you had to say like "here" and then go forward, which I found rather unnatural.

But still, it was a great ceremony.
Except maybe for a chinese guy who did a brief speech. I don't get why chinese people can't get well-fitted size suits. Or stand up straight... or don't behave like assholes when on ceremonies... but I guess they're just not to good with formalities...

Anyway, the best part was after the ceremony, when we got a team get together kinda meeting. All the new guys (obviously including me) were there. And I just gotta tell you, nowhere in Japan have I seen such beautiful Japanese girls. They are all extremely beautiful, cute, and they're like from the Universities of Japan!! The best of the best if you ask me.
Obviously I was a bit shy because of that and couldn't speak very much, but knowing that I'm gonna work with such beautiful ladies just really makes me want to work as soon as possible!!^^
Hooah for Japanese women!!!

Sunday, October 3, 2010

installing apk files to your android phone from linux

This was done in the IS01 (a Japanese android). And my debian GNU/Linux machine.



Obviously the first step is to get the application (apk) file.
In this example I'm using "Piano_Play_7.0.apk", a crappy piano application.

In your android:
Go to Settings -> Application Settings, and "check" Unknown Sources.
Then, in Settings -> Applications Settings -> Development, check USB debug.

With this done, all you need to is get the android's SDK (linux doesn't need any extra divers). It's very small, and brings mostly binary (doesn't need to install!!) so it's pretty straight forward.
You'll get a file like: android-sdk_r07-linux_x86.tgz.tar
So put that in some rational directory, untar it
tar xvf android-sdk_r07-linux_x86.tgz.tar
and
cd android-sdk-linux_x86/tools

From this point you'll have to become root
su
adb kill-server #in case you tried without being root
sudo adb start-server
adb install /home/myusername/Piano_Play_7.0.apk
# to install all the apk Apps in /home/myusername for example
#(using bash) for FILE in /home/myusername/*apk ; do ./adb install $FILE ; done
If you mounted your device remember to unmount it first.
And then remove the usb cable, and give your new application a try!