Showing posts with label software. Show all posts
Showing posts with label software. Show all posts

Tuesday, June 12, 2012

Cross Compile PHP for Arm

I just want to share some techniques to cross compile PHP for Arm using CodeSourcery Toolchain. Most of the resources I found out there do not show me how to include mysql client library as well as SimpleXML parser. These two libraries are needed for my case. Following are the how to Download PHP Source Code

I am using PHP 5.4.2. You can download it from php site.

Download libxml

I am using libxml2-2.8. TOOLCHAIN_DIR is the directory pointing to your toolchain library, in my case, it's /opt/toolchain/arm-2009q3/arm-none-linux-gnueabi/libc.

./configure --host=arm-linux-gnu --target=arm-linux CC=arm-none-linux-gnueabi-gcc
AR=arm-none-linux-gnueabi-ar LD=arm-none-linux-gnueabi-ld RANLIB=arm-none-linux-gnueabi-ranlib --prefix=[TOOLCHAIN_DIR]

Then issue

make install

Configure mysql config file

When compiling with MySQL support, I kept encountered following error:

mysqlnd/mysqlnd_portability.h:40:36: error: ./php_mysqlnd_config.h: No such file or directory

I got help from this site. Following is what you need to do to fix the missing file problem:
  1. Goto your php source folder, and navigate to ext/mysqlnd
  2. Then issue 
mv config9.m4 config.m4
sed -ie "s{ext/mysqlnd/php_mysqlnd_config.h{config.h{" mysqlnd_portability.h
phpize

Build PHP

Please note that I need to specify explicit location to libxml directory in order to compile successfully, please change the path to the location of your libxml library.

export CC=arm-none-linux-gnueabi-gcc
./configure --host=arm-linux --without-pear  --enable-libxml --with-libxml-dir=/opt/toolchain/arm-2009q3/arm-none-linux-gnueabi/libc --enable-simplexml --enable-mbregex --enable-sockets  --enable-soap --enable-pdo --with-pdo-sqlite --with-sqlite3 --with-openssl --enable-calendar --enable-mysqlnd --with-mysql=mysqlnd --with-pdo-mysql=mysqlnd --with-mysqli=mysqlnd --disable-all
make -j 12

Afterward, you can find the binary, php-cgi, inside sapi/cgi folder. Hope this tip could be useful.

Wednesday, May 23, 2012

GSOAP Unicode


It has been a while since my last post. I have been busy doing low level C stuff related to Bluetooth and WiFi in the last two years. There are couple of findings that I want to share during these years. I hope they could be useful to others as well.

Let's get down to the topic. We have been using GSOAP C++ to handle our web service call. We could tweak GSOAP to support unicode on Windows by modifying the typemap.dat file:

xsd__string   = | wchar_t* | wchar_t*

(note: some might wonder why we don't use std:string or std:wstring, one of the requirement given to us was to use primitive data type, so we don't really have choices here)

In Windows. char is 8 bits only and wchar_t is 16 bits. Things are good, we used wchar_t* to store all our strings. Then, we migrated to Linux. In Linux, we are using char, because it is already capable of supporting UTF-8 unicode (i.e. datatype char in Linux is 16 bits).

Under Linux, GSOAP doesn't support unicode if char is used. We found it too troublesome to change all our string datatype to to wchar_t*. 

I finally come up with the idea to hack header file generated by GSOAP wsdl2h. I modified certain strings that needs to be in unicode to wchar_t*. So, only certain string variables are in wchar_t*, not all.

Next, I encounter problem trying to convert wchar_t* to char*. Using wcstombs doesn't help. I have UTF-32 stored in wchar_t* from GSOAP, and I am trying to convert it to UTF-8 stored in char*.

I finally find handy help from code project. It pointed me to unicode.org library file; however, it's a broken link. I manage to find it hosted somewhere in Googlecode site. The code project help and unicode.org library help me to convert wchar_t* to char* (UTF-32 to UTF-8) successfully. It's a big relief.

That's it for now.

Wednesday, May 26, 2010

ADB Driver for HTC Evo 4G

I just came back from Google IO 2010. It is awesome developer conference. Each attendee was given Nexus One , HTC Evo 4G, and of course Google TV Socks :) HTC Evo 4G is amazing device.

HTC Evo 4G

I got home, hooked the Evo to my PC and found that my Windows machine did not recognize it. I managed to find the solution in Android Developer Google Groups, you can read it here. We basically need to modify the entry in android_winusb.inf to add the VID and PID of HTC Evo. You can download the modified android_winusb.inf from here (right click on the link and select save as).

Monday, December 14, 2009

IEC Christmas 2009 / Projector Calibration

We just finished with our church Christmas Celebration, it was tiring, but it was worth it. We had wonderful team working together to serve God in this event. Great job guys and gals!


GII Christmas 2009 Crew

I would like to share one challenge we encounter in the visual presentation team. The challenge actually starts last December, but I just write about it now. Last December, we are asked to utilize projector for helping audience to virtualize settings in the drama, since we do not have any physical stage decorations. So far so good, we just create the contents and display them using appropriate program. Ideally, we will have something like the following.


Ideal Projector Placement (credit to Martin for the illustration)

However, we could not implement the ideal projector placement. We have problem hanging the projector, as we do not have skill to build custom mounting bracket that could be hang on the curtain's rod (i.e. we rent the building, so we could not mount anything on the wall). Ehm...trouble, fortunately, I found an idea that we could use. If I could put the projector on the side and adjust the perspective, I could achieve larger projection size without obstructing drama/choir people and I do not have to hang the projector at the top center. In short, the program development is started right away and the first version is used last December, unfortunately, with a lot of bugs :(


Implemented Projector Placement (credit to Martin for the illustration)

In the initial release, the ideal perspective could not be achieved, because I only consider translation, scaling, and skewing. I miss rotation. Hence, on last December event, half of the projection image looks ok, the other half looks stretched :( Moreover, there are heavy memory leak on the program at that time as well, so video playing is pretty bad.


Image on the left side is ok, but it is stretched on the right side

Time passed, the program is still used on Easter, but this time we avoid placing projector at extreme angle to avoid rotation problem I mentioned above. We are ok this time since the building we rent has enough space that allow us to do rear projection, and we also put another projector on the balcony. In total, we used three projectors: two projectors for rear projection to form 2048x768 resolution, and one projector on the balcony, mainly used for subtitle and video (i.e. projector calibration is disabled on this projector).


GII Easter 2009 Celebration

This year, we are renting the same building as last year. Ehm...I am pretty scared when hearing about this. I suggest to the stage coordinator (ko Hendri) to find a way to mount the projector on top at the center of the stage.

In the mean time, I try to go through my program's code to perform various improvements, I also added rotation as one of the variable when adjusting the perspective. I fix most of memory leak, but I am sure there are still some that still exist. I do not have enough time to dig into this. However, we are able to handle video playing at 1024x768 without any problems.

So I notify ko Hendry and do demo to show that the program could be used again this time. He agreed and then we proceed with it. We do however need to rent a projector with 4000 ANSI Lumens, since our projector could not handle it (ie. 2500 ANSI Lumes).


2009 GII Christmas Celebration (Image Courtesy of pak Felix Teja)

That's it, I forgot to mention that everything is done in Flash, which could easily top up CPU usage. Machine on the left (gray machine) is used as controller for both audio and video. Machine on the right is running the projector calibration program only. It is being controlled via socket by the gray machine. I used my Android G1 to remote control the audio and WiiMote to remote control the projector calibration program. It is possible to control everything just with mouse and keyboard, but I am more comfortable with this setup.


The Machines

For the next version, I am planning to bring everthing to OPENGL, GPU could give better horse power especially when we want to play HD video.

That's it for now.

Tuesday, October 27, 2009

Android 2.0 aka Eclair is Here

Waow, Android 2.0 SDK is just released. It now supports RFCOMM Bluetooth, which is great for peer to peer communication. WIFI is great but it does not work when you want to establish communication with other devices in WIFI-less environment. I also could not depend too much on 3G, in some areas, it is very slow and sometimes it does not even exist.

Monday, October 5, 2009

Automating inDesign for Repeating Content and QR Code

Our church is going to hold Bible Camp this coming week. We are all getting busy preparing for this event. I am responsible for creating publication materials, such as event booklet, brochure, name tag, etc.

Creating name tag might sound easy, but how about creating name tags for 50 persons. It will be painful to do it manually, copy and paste the layout plus typing names fifty times. So, I did some reading on Adobe inDesign documentation and found out that it's possible to create placeholders for repeating content using XML. Here is the article that I used. I just need to design the name tag, generate XML data for all attendees using Perl script, import XML to inDesign, and inDesign will do the rest of the work.

Generated Output by inDesign

Notice above figure, there is small box on the right of each name. It is QR Code containing information for each person. I was thinking that since I am going to automate the name tag creation process, why not adding some extra information. I decided to add QR Code and our team decided to add color coded group information (i.e. person with the same color belong to the same group).

Bible Camp GII 2009 Name Tag

I wrote a PERL script for grabbing contact information of each Bible Camp 2009 attendees from our church database and use GD-Barcode module to generate the QR Code associated to each individual.

Most people nowadays have phone with built-in camera, and most of them can decode QR Code. So, I think this as a good way for letting people to exchange their information with each other easily during our Bible Camp event. That's it for now. Following QR Code contains our church contact information.



Decoded Message on Android

Tuesday, September 29, 2009

Alkitab for Android Phone

Holy Bible in Indonesian is called "Alkitab". I am currently using Android Developer Phone 1 as my main phone, and I cannot find any "Alkitab" app yet on the market. I knew that Alkitab app exists for iPhone and J2ME platforms. Hence, I decided to develop one myself. Please keep in mind that the content of "Alkitab" is copyrighted by Lembaga Alkitab Indonesia (LAI).




You can download the apk file from here. For instruction on how to install .apk file into your Android phone, please go to this link. I am using Apps Installer from Android Market to install apk file from sdcard.

After application installation is done, please go here to download the database. You need the database to run the application. After you obtained "alkitab_db.zip", perform following steps:
  1. Connect your phone to your PC using USB cable and mount the sdcard
  2. Extract "alkitab_db.zip" to root folder of your sdcard. After extraction is done, you should see folder "alkitab_db" at your sdcard root folder
  3. Unmount your sdcard by clicking "Turn Off USB Storage" on your phone
  4. Start the application.
I will explain features available in this initial version.

Text Filter (on Android device with physical keyboard)

Type in the text using keyboard and the list will be filtered accordingly.



Gesture Motion

When you are in chapter or verse screen, you can swipe you finger on the screen to move between books/chapters. Swipe to left will bring you to the next book/chapter, swipe to the right will bring you to the previous book/chapter.


Search for Chapters/Verses

Clicking menu button will allow user to select this feature. This feature is used to search for chapters or versions in the bible, following are accepted input patterns:
  • [book] [chapter], Mazmur 3
  • [book] [chapter]:[verse], Matius 3:15
  • [book] [chapter]:[start_verse]-[end_verse], Kisah Para Rasul 1:3-5
  • [book] [start_chapter]:[start_verse]-[end_chapter]:[end_verse], Yohanes 10:5-11:3
  • [book] [start_chapter]-[end_chapter], Lukas 5-10
  • [book] [start_chapter]-[end_chapter]:[end_verse], Roma 3-5:13



Search For Word

If the search input does not match any of Search for Chapters/Verses patterns, the input will be used as keyword to search for match words in the bible. Searching using keyword feature will require the phone to send request to remote server instead of searching through local database. Local database is flat file database and it will take long time to find the match keyword. If you do not want the phone to connect to Internet, do not use the search for word feature.




That's it and I hope the app can be useful for everyone. Email me closari[at]gmail if you encounter bugs or have suggestions for improvement.

Android 1.6 Image for Android Developer Phone

HTC finally released Android 1.6 image for Android Developer Phone, available here.

I have upgraded my phone and now it's running Donut.


I haven't check all the features yet. One thing I noticed is that the camera/camcorder app has new user interface and it's faster compare to previous versions.


I also noticed in Settings, Speech Synthesis is added as part of the Settings items. However, it lacks of Indonesian language. So far I have been using Eyes-Free for performing TTS on my application. Their packs include Indonesian as one of the available languages. I am not sure why Google did not include Indonesian in 1.6, since the TTS service in 1.6 is basically derived from Eyes-Free project.

That's it, I will start playing with new gesture recognition feature added in 1.6.

Saturday, September 19, 2009

Android Developer

I found this in goodies section at android.com. It's pretty cool. It's almost one year now since I started writing applications for Android.

Tuesday, August 19, 2008

Can't Connect to MySQL Server: error 10061

I encounter this problem when trying to connect from my development machine to Coniques database server, which is hosted on different machine. I have setup all user permission to make sure that user can connect from remote host.

The database server is running Ubuntu Server Edition using MySQL as the database engine. The development machine is running Windows XP Pro and I utilize MySQL Connector/ODBC 3.51 to connect. I get following error message when trying to connect:
[MySQL][ODBC 3.51 Driver]Can't connect to MySQL server on 'server_name' [10061]
I then try to connect using command line:
mysql -h server_name -u root -p
and get following error:
ERROR 2003 (HY00): Can't connect to MySQL server on 'server_name' (1111)
This must be some kind of stupid configuration error that I do not know about. I spend some time googling around and manage to find the solution:
  1. Edit the configuration file located at /etc/mysql/my.cnf
  2. Find the line bind-address = 127.0.0.1. The default value 127.0.0.1 means that it will only accept connection from local machine. I change the value to 0.0.0.0 and save it
  3. Restart MySQL by issuing /etc/init.d/mysql restart
Now, I can establish connection from the remote machine.

Monday, July 28, 2008

Cool 3D Desktop Effects in Ubuntu

Yesterday, I spent some time playing with my newly installed Ubuntu machine. It is running Hardy Heron, 8.04. I read somewhere on the web that it includes a lot of cool 3D features. I have seen some of the effects before but I never thought it will be included in Ubuntu distro. Some of the effects I like the most are the transparent window, wobbly window, animation and 3D Cube. It's amazing to see that the videos are still playing smoothly while the effects are in action.

Workspaces in 3D Cube

Transparent Windows

I will share the instruction on how to enable it.
  1. Goto System > Preferences > Appearance


  2. Click the Visual Effects tab and select Extra. You could now see wobbly window when you trying to move any active windows. We will go beyond these effects by installing additional components.


  3. Goto Applications > Add/Remove. Choose All on the left frame select "All available applications" from Show combo box. Then type "csm" on the search box. Check "Advanded Desktop Effects Setting" and click "Apply Changes" button to install this new module.



  4. Now the module has been installed, goto System > Preferences > Advanced Desktop Effect Settings. The control panel will show up and have fun with all the cool 3D effects.

I did encounter one minor problem when trying to enable extra visual effects under the appearance window. I am using Dell Inspiron 6400 with ATI X1400 graphics card. The pop up window with message "Desktop effects could not be enabled" showed up when trying to enable extra visual effects.

After doing some Google search, I found that my Ubuntu was not using the proprietary ATI drivers; hence, the 3D effects could not be used. To make Ubuntu use the ATI driver, goto System > Administration > Hardware Drivers, then enable the driver. After doing this, I could enable Extras visual effects with no problems.


That's it for now. Hope the instruction will help.

Monday, June 2, 2008

Adobe Air - Keyboard Event in Fullscreen Mode

Recently, I get error when launching my custom movie browser. It says:
“This application requires a version of the Adobe Integrated Runtime (AIR) which is no longer supported. Please contact the application author”
I go to Adobe site to download the latest AIR and also the latest AIR SDK for Flash. After I install everything, I open Flash and start generating the new AIR installer for my application.

I get error message when trying to install the application. The error says:
"The application could not be installed because the AIR file is damaged. Try obtaining a new AIR file from the publisher."
Ehm ... very weird, I am the publisher and I just generate the installer file. I try generating new installer several times but no luck. I uninstall AIR and reinstall it again, and it works !!! Weird ...

Next problem I encounter is that my program does not allow me to trigger KeyboardEvent while I am in fullscreen mode. The KeyboardEvent is working fine if I am not in fullscreen mode. This reminds me of restriction I encountered in Flash AS 3.0. It is very confusing, it still worked the last time I make changes to my application, which is about two months ago.

Then, after googling around, I find that Adobe changes the AIR API, I need to set display state to FULL_SCREEN_INTERACTIVE instead of FULL_SCREEN only to allow KeyboardEvent in fullscreen mode.
stage.displayState = StageDisplayState.FULL_SCREEN_INTERACTIVE;
Two hours wasted trying to solve this problem :)

Hard Drive Failed

This last weekend was a bit crazy. I woke up Saturday finding that one of our server drive failed. This drive contained all photos and various Coniques projects, and I haven't had chance to perform backup in the last 6 months. It seems that there is power spiked the night before that caused the break power circuitry in the USB external enclosure.

I tried to read the drive by connecting it to my workstation through SATA cable. No luck. Windows still did not assign any drive letter to the drive. I opened Disk Management console from Control Panel and found that Windows successfully detected the hard drive. The drive status is healthy and online as well. However, I still have no luck accessing it. It seems that there is something wrong with the drive partition.

I then started googling around to find way for recovering partition and found a program by EaseUS, Data Recovery Wizard. I used it to perform search for lost data in the drive, the search took about 8 hours. The program successfully found all the files and we have to buy additional drive to dump all of the recovered data which took additional 20 hours.

Recovering Process

Now, the drive is back online, and I start to perform backup right away. I will consider adding redundant drive that will mirror the main drive in the future.

Thursday, December 6, 2007

Featured in News

Just got a call from my coworker and he said that our company product is featured on the business section of Vancouver Sun news paper. I am pretty proud about it, because I have been working single handedly on the software of this product for a while now.

Vancouver Sun cover page, business section

I did encounter tons of problem during development time, but I also gained a lot of experience when trying to solve those problems. We are still developing and improving the system as time goes. We'll see where it leads to.

Monday, November 5, 2007

Software and Software

In the last two months, I have been speding a long of time performing my personal research in remote control area. I managed to develop several Java MIDLET application during the research. They are mostly application that allow me to interface my phone with PC as well as to control appliances at home.

The next step is to add some intelligence to the system. My house is gonna be an experiment subject for my project :) With this limited amount of knowledge, I need to start reading some book in AI area, such as machine vision and machine learning. Hopefully, I can understand what the books are talking about.

I also should start revision control software to manage all my application. Number of personal software that I developed in the last two year has greatly increased. I am currently looking at Subversion, which is also the one used at my work place. It's easy to use and free :)

Thursday, September 20, 2007

Back to Work

I have been away most of the time during month of August, just went back to my country for my engagement ceremony. Now, I am back at work.

Recently, I am really into things related to "Remote Control". I have been searching Win32 Library in order to find code that can help me to control other Windows Application. I finally found two function that will help me fore sure: FindWindows and SendMessage. Later on, I am gonna integrate it with my phone Bluetooth for controlling my custom made Home Entertainment System. I know I can just use my phone's HID service for remote control purpose or I can just buy Apple TV or similar devices; however, I am the kind of person who will learn by doing it. So, this is one thing I'll do in my "spare time" to enhance my skills.

Monday, March 26, 2007

Switching

I finally had a chance to install Linux on my laptop. Now, my laptop is fully running on Linux; distribution I used is Ubuntu. The installation wizard has improved a lot since 5-6 years ago. Amazingly, it also recognized all hardware in my system. In the past, I remembered trying to go through x86 config file to setup my vga card, installing sound card driver manually, etc.


So far, my experience is pretty good. I have setup all developments tools that I normally used: Java and Netbeans, PHP, Apache, MySQL, GCC. Other than development tools, I do install mplayer to watch movies before sleeping :)

However, I still need Windows to run some tasks. For example, Matlab ( I am still using it eventhough Linux has octave), Adobe Suites ( I am not used to GIMP), and .Net Development Tools (Visual Studio is the IDE that I like the most).

The last one month has been a blast for me. Some cool projects are coming; it's challenging but I do gained a lot of new skills.

Thursday, January 4, 2007

Tambahan Kerjaan

Kerjaan di kantor bertambah lagi. Saya harus design dan implement custom software buat file sinkronisasi dan security software buat prevent orang untuk mencuri software kita, something similar to MS Windows or Adobe software activation tools. Semuanya saya targetkan untuk selesai dalam waktu satu bulan. Semoga bisa terpenuhi :)