24 April 2006

vmware, apache, mplayer under kubuntu dapper [beta]

I follow this guide by Stoltenow, and it works for me.

apache2+kubuntu=SUCK!. I expect directory public_html in my home directory will be in apache DocumentRoot [like Suse and FreeBSD], but it not as expected. Have to edit the apache2.conf manually.

No mplayer in kubuntu dapper[beta]! Had uncomment /etc/apt/sources.list for universe and multiverse, but still no mplayer after `sudo apt-get update; sudo apt-get upgrade; apt-cache search --names-only mplayer`. Also had add `deb http://honk.sigxcpu.org/linux-ppc/debian/ mplayer/` in /etc/apt/sources, still no mplayer. I try the hard way, but the video don't want to come out.
VDec: vo config request - 208 x 170 (preferred csp: Planar YV12)
Could not find matching colorspace - retrying with -vf scale...
Opening video filter: [scale]
The selected video_out device is incompatible with this codec.

FATAL: Could not initialize video filters (-vf) or video output (-vo).

Can't restore text mode: Invalid argument

Hey! the mplayer Makefile don't want me to uninstall mplayer.

make uninstall
...
...
/bin/sh: -c: line 6: syntax error: unexpected end of file
make: *** [uninstall] Error 2


Conclusion, my VMware Workstation 5.5.1 build-19175 works! (apache or mplayer)+kubuntu dapper[beta]=SUCK!

Kubuntu? What happen to FreeBSD?
FreeBSD is retired from my harddisk. Sayonara...

18 April 2006

Firefox problem in FreeBSD 6.0 after portupgrade

After portupgrade FreeBSD 6.0 then you got this error when run firefox:

(Gecko:7209): GLib-GObject-WARNING **: cannot register existing type `GConfClient'


Panic, panic. What to do? Google ... :)

I had try several methods, read /usr/port/UPDATING, `portupgrade -varR -PP`, etc. FreeBSD only like the hard way `portupgrade -vaR`. It means when you portupgrade the first time, firefox don't like one of it upgraded version dependency. Which package? argh... I don't know :/ . So, have to do the hard way, ask FreeBSD upgrade the ports by compile it from source, wait it finish compiling, cross your finger hopefully the blue screen that ask package option don't appear, bla bla ... 2 days fighting with this, then my firefox is alive back, YEY!

tips: GConf involved with GNOME. Give `portupgrade -vPP libgnome-2.10.1` a try before `portupgrade -vaR` is a GOOD idea.

While compiling port, the FreeBSD give me this error:
ad0: timeout waiting to issue command
ad0: error issueing READ_DMA command
g_vfs_done():ad0s1f[READ(offset=29776416768, length=12288)]error = 5
vnode_pager_getpages: I/O read error
vm_fault: pager read error, pid 71516 (rtorrent)
ad0: TIMEOUT - READ_DMA retrying (1 retry left) LBA=61351999
ad0: TIMEOUT - WRITE_DMA retrying (1 retry left) LBA=62304671
ad0: TIMEOUT - WRITE_DMA retrying (1 retry left) LBA=62311103


Please don't tell me that you FreeBSD sucker cause my 80G, WD harddisk failed.

OK, stop ranting about FreeBSD.

Hey! Tab Mix Plus is COOL, recommended.

13 April 2006

Why lah UNO hate me?

I HATE this line:
Error (<class conversion.com.sun.star.lang.IllegalArgumentException at 0xb7bc8d1c>) during conversion:URL seems to be an unsupported one.

Because of this line, I'm keep whining for whole day!

I want OpenOffice convert my document to PDF using UNO. Works perfectly in my development box, but when using different box it don't like me. Hate deployment, hate hate ...

I wish that I'm get paid by the line :D , so I can apply this cheat in my code:
If Request.QueryString("source_url") = "" Then
strRedirect = strRedirect & "&verify=1"
If Request.QueryString("process") = "1" Then
strRedirect = strRedirect & "&process=1"
End If
Response.Redirect(strRedirect)
Else
strRedirect = strRedirect & "&verify=1"
If Request.QueryString("process") = "1" Then
strRedirect = strRedirect & "&process=1"
End If
Response.Redirect(strRedirect)
End If

12 February 2006

Why REST?

This is about Representational State Transfer not rest, verb.

Quote from ajaxpatterns:

" Witness the the debacle caused by the Google Accelerator interacting with non-RESTful services in mid-2005. The accelerator jumps ahead of the user and prefetches each link in case they should click on it (a non-Ajaxian example of Predictive Fetch). The problem came when users logged into non-RESTful applications like Backpack. Because Backpack deletes items using GET calls, the accelerator - in its eagerness to activate each GET query - ended up deleting personal data. This could happen with regular search engine crawlers too ... "


REST compared to RPC

08 February 2006

Where should define database schema?

Where should define database schema? in python (hint: django) or DDL.

Jonathan Ellis explain why schema definition belongs in the database. Yes, why reinventing the wheel create another database schema in .py (hint: django). Runtime introspection is good idea (hint: sqlalchemy, pydo).

After read Adrian Holovaty (hint: django) comment "Cache that, man. Cache it." my eyes wink wink ...

p/s: Nesting UnitOfWork in a Database Transaction seems more interesting compared to adodb CompleTrans()

12 January 2006

Short memory problem

My pair programming partner always complaint that I have bad short memory.

Is it because of my foods? :D

After read article, 12 Steps to Better Code, point #8, I guess I found the right answer.

... Productivity depends on being able to juggle a lot of little details in short term memory all at once. Any kind of interruption can cause these details to come crashing down. When you resume work, you can't remember any of the details (like local variable names you were using, or where you were up to in implementing that search algorithm) and you have to keep looking these things up, which slows you down a lot until you get back up to speed.

28 December 2005

Java is portable?

Snippet for a java code:

public static MultipartRequest createMultipartRequest (HttpServletRequest req)
throws IOException
{
[SNIP]

// Create a temp directory for the attachments
Runtime.getRuntime().exec ("mkdir -p " + Constants.UPLOAD_PATH);

File check = new File (Constants.UPLOAD_PATH);

[SNIP]

}


What wrong with this code? The answer is, this code is not portable, i.e. doesn't work on Windows. Nothing wrong with the Java, the problem is the programmer itself. :D

I got this snippet from a discussion in The Daily WTF.

25 December 2005

Mailmerge in openoffice 2

In my head, to do mailmerge we need template and datasource. Place the mail merge field in the template and point the field to appropriate datasource field/column.

I spent this christmas evening with trying a script to mailmerge using pyuno, found in the openoffice forum. What I want to do is, produce a single openoffice file after mailmerge from a datasource(a csv file). I manage to do it after modify the code. Hooray!

I had refer to the api, and read a java code snippet.

What annoying me is when export the merged file to pdf, extra unwanted blank pages will be produced for odd-numbered page. Let say I have 1 page template then want to mailmerge with 3 set of data. The result is 5 pages of pdf. The second and fourth page is fill with unwanted blank page. I had tried using openoffice 2 in my Windowx XP box and FreeBSD 6.0 box, both produce same result. Is it a feature/a bug? What I know, this really annoy me :(

Some of openoffice users also complaints about memory usage for mailmerge.

Actually, I had implemented mailmerge using another approach. Modify the openoffice xml file (to be specific, modify content.xml) using ooopy. Although my script able to do the mailmerge, it really painful to get it work. Manipulate openoffice xml using dom really make me headache. No benchmark for these two approaches, what I want is just to mailmerge. Duhh.

13 December 2005

Merge arrays in php

The short answer is function array_merge from php manual.

Let say I have 2 arrays to merge:

$a1 = array('key1'=>'val1', '33'=>'dummy_value');
$a2 = array('choose_one'=>'');
$result = array_merge($a1, $a2);

What my expected result is:

array('key1'=>'val1', '33'=>'dummy_value', 'choose_one'=>'');

Right? Emm... my expectation is wrong, the actual result is, when print_r($result):

Array
(
[key1] => val1
[0] => dummy_value
[choose_one] =>
)

What's wrong? After re-read the fine manual, the following line interest me:

Don't forget that numeric keys will be renumbered!

What? I put the key as '33' (with quotes), that should be string. Emmmm... no idea. I am suck or php suck?

04 December 2005

Vim in windows

For some reasons, I used Windows XP this whole week. I can't live without vim when doing programming. One of common feature I used is 'visual block' by press 'Ctrl+v', and default configuration for gVim assume 'Ctrl+V' as paste. No idea+lazy to google solution for this, I use vim in cygwin.

From the setup.exe of cygwin, need to check for option vim (unchecked in default setting) to install vim. After set my .vimrc, I can used vim as usual in my Linux/FreeBSD box plus the command-line (bash in cygwin). A bit annoying when copying snippet code from web browser, firefox to the cygwin window. You need to click top-left cygwin window>Edit>Paste :(

21 November 2005

Django down :(

Last time I can't access howtos ruby on rails, and tonight (10:30pm) I can't access django website. See below:


Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator, webmaster@djangoproject.com and inform them of the time the error occurred, and anything you might have done that may have caused the error.

More information about this error may be available in the server error log.



That really frustrated, especially while I'm reading the documentation online. I'm searching something similar to widget idea by TurboGears.

18 November 2005

Attach file ala Gmail

Just publish my rudimentary version of attach file ala Gmail. I'm using behaviour and prototype to manipulate dom and make clean markup.

I had tried another implementation of behaviour, but I guess the function Behavior.apply() is buggy :(. Careful, since behaviour had call the window.onload in their script. hint (prototype: Event.observe(window, 'load', fn, false);). ShrinkSafe from dojo doesn't like the behaviour and the prototype script. ShrinkSafe == Not safe anymore :(


Did I say my script is clean markup? Below is the snippet:

<div id="attaches"></div>
<span class="attach">Add a file</span>
<div>
<br/><input type="submit" value="Send">
</div>

p/s: this is not related to AJAX.

13 November 2005

Architecture Astronauts

Joel make good point, Don't Let Architecture Astronauts Scare You. This make me thinking again when consider Ruby on Rails/Django as my next web application framework.

I found this Architecture Astrounauts from a thread in Turbogears group.

12 November 2005

Format hard drive, circa 1975

Next time, our future kid will laugh at us why we spend 'minutes' of time to format hard drive, or maybe why we need to format our hard drive :). We should appreciate history.

Format 500kb of hard drive on 1975

29 October 2005

Update favorite firefox extensions + form repetition

>>Previous post

1. SessionSaver
2. Aardvrak
3. ScrapBook
4. Tab X
5. Selenium Recorder

Nice script, Form Repetition by ian (like add attachment in Gmail). Don't have time to play with it :(

16 October 2005

mp3 to ogg conversion.

I'm using oggplay, v1.6.5 (since frequency analyzer works for .ogg in this version) as music player for my Nokia 3230. The problem is, how to batch conversion mp3 to ogg. I use Audio Conversion Wizard 1.8 in my Windows box. But it shareware :(, I'm gonna try oggdrogXPd.

I'm prefer command-line. After spend some time googling, I got this command from a website:


helmi > mpg321 un\ de\ vez\ en\ cuando.mp3 -w - | oggenc -o test.ogg -

08 October 2005

Main menu of my Nokia 3230


main
Originally uploaded by Gambar_Helmi.
I just uploaded few screenshots of my new series 60 handset interface. Feel free to visit my photos ;) Check out also my bookmark

07 October 2005

Creating nodes for Javascript DOM

First of all, new FreeBSD website launched. I just like it.

I had created a dynamic select box, [add/remove value from text box] for one of my javascript. It just works perfectly in firefox and the customer happy with it. But it doesn't work in IE (surely I will be blamed since most of the user using IE).

I need to add/remove node in select box. So I just refer to website one of javascript guru. It just using method appendChild and removeChild, duhh. But IE don't like it. I had tried debug using the Internet Explorer Developer Toolbar (doesn't help me, explore DOM in firefox much better). After spent some time googling, I got a nice article. Snippet below solved my problem.

try {
elSel.add(elOptNew, null); // standards compliant; doesn't work in IE
}
catch(ex) {
elSel.add(elOptNew); // IE only
}

28 September 2005

Transfer mp3 from Knoppix to series 60 phone

I'm using Knoppix-4.0.2 to transfer mp3 files to series 60 phone (Nokia 3230).

Connect the bluetooth adapter to pc. Double check by dmesg:

Bluetooth: Core ver 2.7
NET: Registered protocol family 31
Bluetooth: HCI device and connection manager initialized
Bluetooth: HCI socket layer initialized
Bluetooth: HCI USB driver ver 2.8
usbcore: registered new driver hci_usb

Open K Menu > KNOPPIX > Network/Internet > dev/modem connection setup.
Choose bluetooth, then click button OK.
From Konqueror, right click any files that want to transfer into the phone and choose Actions > Send with Bluetooth ...
A new window, Bluetooth OBEX will be show. Choose the correct device and click button Send.

I want try transfer data using my FreeBSD box, but quite scary when read bluetooth chapter in FreeBSD Handbook.

27 September 2005

Playing with Python for Series 60

Playing with Python for Series 60 on my new nokia 3230. Run simple script

import appuifw
appuifw.app.title = u"Hello K and R"
appuifw.note(u"Hello Kernighan and Ritchie!", 'info')


It come with Interactive console, COOL!