Official ObjectGraph Blog

Saturday, April 28, 2007

Creating ISO on Mac OSX

I use a Thinkpad X60s that does not have a CD Drive and occasionally need to install software (This time i was trying out Dragon Naturally Speaking 9 which comes in 2 CD's). I also have a Mac Mini and i use it to create the iso images that could be later mounted on my PC using daemon tools.

Here are the steps

First find out what is your CD Drive

df -h

Filesystem                Size   Used  Avail Capacity  Mounted on
/dev/disk0s2               74G    62G    12G    83%    /
devfs                      97K    97K     0B   100%    /dev
fdesc                     1.0K   1.0K     0B   100%    /dev
                   512K   512K     0B   100%    /.vol
automount -nsl [207]        0B     0B     0B   100%    /Network
automount -fstab [235]      0B     0B     0B   100%    /automount/Servers
automount -static [235]     0B     0B     0B   100%    /automount/static
/dev/disk1s0              624M   624M     0B   100%    /Volumes/DNS9_CD1

- After inserting a CD Mac OS X automatically mounts it. Unmount it using


diskutil unmountDisk /dev/disk1s0

Then run the command

dd if=/dev/disk1s0 of=disk1.iso bs=2048

Test the ISO image by mounting it using Finder.

Labels: , ,


posted by gavi at 12:52 PM |

DIY: Building your own live camera with Macmini

OK, I have huge headache today, and this happens to me every year when the season is changing. I took a day-off and I woke up late around noon, then I just decided to have some fun.

What you need:

  1. Macam driver (if your web camera is not supported)
  2. VideoScript - Automate capture images
  3. JDK - Any version to compile applet


Installing Driver:

I got a nice & small Logitech Web Cameralogitech_camera.jpg yesterday, and I just wanted to use this for my Skype which is installed on my macmini in living room. I mounted this on my Sony's LCD, and launched Skype but nothing showed up. According to Logitech's website, the driver for MacOSX is not supported yet. So I found a opensource driver it's called Macam. I downloaded, and the installation was easy (don't forget to install the component in order to use from other applications). Now Skype shows me configuration for the video, and I could see my face. Then I remember that I used to broadcast my living room. OK, let's do it again.


Building Applet:

Since my Hello World experience was in Java, I spend some time with Applet in long time ago. An applet program to stream from jpg file might be nice. This is the program:

import java.awt.*; 
import java.applet.Applet; 

public class WebCamClient extends Applet { 
 private Image mImg;
 private int mIsStarted = 1;
 private int mInterval = 10000; // in millisec
 private String mFile = "webcam.jpg";

 public void start() { 
  mIsStarted = 1; 
 } 

 public void stop() { 
  mIsStarted = 0; 
 } 

 public void paint ( Graphics g ) { 
  mImg = getImage( getDocumentBase(),mFile); 
  MediaTracker mt = new MediaTracker(this); 
  mImg = getImage( getDocumentBase(),mFile); 
  mt.addImage(mImg,0); 
  try { 
   showStatus("loading ..."); 
   mt.waitForAll(); 
  } 
  catch (InterruptedException e){ 
   System.err.println("ERROR: "+e); 
  } 
  g.drawImage( mImg,0,0,this); 
  mImg.flush(); 

  showStatus("Showing every "+mInterval+" milliseconds"); 

  if ( mIsStarted == 1 ) {    
   repaint();
   //repaint(mInterval); // this does not guarantee delay

   // Wait for next cycle
   try {
    Thread.sleep(mInterval);
   }
   catch (InterruptedException e){ 
    System.err.println("ERROR: "+e); 
   }
  } 
 } 

 public void update(Graphics g) { 
  paint(g); 
 } 
}


Good, this program grab webcam.jpg in the same directory and just show it in every 10 seconds. I stored this file in

/Users/kiichi/work/java/webcam/WebCamClient.java

and just compile like:

javac WebCamClient.java



Writting HTML Files:

All you have to do is write am index.html to load this applet in your browser:

index.html

Let's prepare for html refresh version too:

index2.html

Automating Video Capture:

I spend a little bit time for researching automating video capturing and I found VideoScript. This script does a lot of jobs; however, I would like to use the simplest feature to capture the image. When you download the package, it comes with a small editor so that you can run&check your script. This is how it looks like:

set vs to videosource;
repeat 4 times every 1 seconds // min is 4 sec
set f to frame of vs; 
set file "/Users/kiichi/work/java/webcam/webcam.jpg" to f;


In the beginning, I just had a black screen. I tested a sample script to generate QuickTime movie, and it works fine, so what's wrong with the still image? The forum told me the reason because the camera takes a couple of seconds to calibrate the exposure. That's why I inserted the second line to wait 4 seconds. I saved it as update.vs and just run like:

videoscript -f update.vs

This gave me a clear image!

I think, it's ready to go. I had two choices to broadcast my living room. 1. Upload this picture to remote. 2. Open port 80 and let other people look at my Macmini. For today. I decided #1 so that I don't overwhelm my connection speed.



Scheduling FTP upload:

Mac OSX is just another UNIX system, so it might have cron to schedule my jobs. I found crontab under /etc/crontab (or /private/etc/crontab). I did

sudo gvim

to edit crontab. What I added is this line

* * * * * kiichi sh /Users/kiichi/work/java/webcam/update.sh

this means, run update.sh for every minutes.

This is inside update.sh

#!/bin/bash
videoscript -f /Users/kiichi/work/java/webcam/update.vs

FTPSERVER='your ftp url goes here'
FTPUSER='username'
FTPPASS='password'
SOURCE='/Users/kiichi/work/java/webcam/webcam.jpg'
DEST='.'
TARGET='webcam.jpg'

ftp -ni $FTPSERVER <<EOF
user $FTPUSER $FTPPASS
cd $DEST
binary
put $SOURCE $TARGET
quit
EOF
exit 0


It's all set. cron suppose to pickup this script, and this script takes care of generating image and upload on ftp. If you access my streaming web page, the applet automatically refreshes those images. Since this script does not hold the device, when you have Skype call, it will sends a black image that says "Web camera is used by another program" for my ftp.

In the future, this is the todo list:

  • Archiving images
  • Streaming from the local machine - you can write a VideoScript to hold the device, and dump image for every second within the for-loop.
  • Add date and time stamp
  • Motion Detection

Download Source Code:

webcam_sample.zip

Labels:


posted by Kiichi Takeuchi at 1:59 AM | 1 comments |

Monday, April 09, 2007

Guide to use screencasting to save time of programmers for free

You might think, "I'm coding guy, not movie guy", but I know what you hate if you are a programmer: Documentation and Training. I was impressed by some OSS communities, Like Ruby On Rails guys, because they demonstrated the power of screencast in their movies. After I start using screencast softwares, it released me from tons of burdens to explain how-to-use-it for my end users. I save time for training, and user's undersdanding level increases.

Wink

Wink is a completed package in order to publish your movie tutorial. This is basic steps:

  1. Create a New Project
  2. Select capture area. At this point, you are able to choose rectangle area or each window. This window selection is very neat because it allows me to choose inside tab of my browser.
  3. Hit Shift-Pause to start. Do the same thing to stop.
  4. Edit the movie if you need. You are able to add speech bubbles, rounded rectangle, arrows, and so on.
  5. Render and publish. You might save this project as *.wnk file.


I had some problems to capture my secondaly monitor, but it works pretty well if you use it in regular way. A lot of features are included in this software, but it's designed to use in minimal steps.

DebugMode



wink.png


CamStudio

CamStudio.org

I had some problems to play video on FireFox 2.0, however it's quick and easy. Recording steps are minimized.

  1. Hit the record button
  2. Select the capture area and go. It will start recording right after you release button from the rectangle area.
  3. When you stopp it, it will ask you where to save.

After finding Wink, I just use this when I need to dump my screen cast into avi, but it still useful and extream minimized steps to use.


cam.png


posted by Kiichi Takeuchi at 9:22 AM | 2 comments |