J.me

Careful with Float data type

Usually, I store number with decimal point in float, but now I run into a problem – the rounding error. This really doesn’t good in financial data like money, for example, in float datatype, when we calculate 10000000-25, it will result in 9.99998e+006, when we convert to decimal (I do it in PHP), it will result in 9999980. Not good!

But that was a big mistake I made, if you just take the data, let’s say

SELECT floatdatafield FROM whatevertable

you will get this 9.99998e+006 value, and no matter what you do in PHP, you won’t be able to get the exact value, 9999975. So for the solution, we need to use the SQL function, ROUND(). So instead of just select everything, we can do this

SELECT ROUND(floatdatafield,2) AS floatdatafield FROM whatevertable

This will round it to have maximum 2 numbers digit after the decimal point and it will return 9999975.00, exactly what we need.

Another solution is to use decimal data type instead, or by defining the number of digits before and after decimal point of the float.

If the WordPress automatic update failed

This problem encountered since I moved my server to IIX, which has less bandwidth for international user, and for that reason too, the downstream is too small to download whole WordPress package that used for updating. That’s why, I always get timeout error. So, I’m simply unable to automatically update my WordPress.

However, the solution is actually simple, by increasing the timeout so the download can be completed. Once it is, the updating will going smoothly. So this is how to do it, in manual way.. πŸ™‚

Wacom Bamboo and Inkscape issue

I recently tried to use Inkscape for drawing some vector based graphics, unfortunately my Wacom Bamboo didn’t work as expected. Whenever I move my pen up and back to the Inkscape window, the cursor stuck. To solve it, I need to move my pen to the area outside Inkscape window, then it works again. Really, not comfortable.

Then again, Google helps me to find the answer. πŸ™‚ This bug has been reported and some workaround has been made. Simply by modifying a DLL will make it works fine. However, I’m not gonna get into this thing, thanks to the ready DLL by Voon, it makes our life easier…

Using Wacom eraser in GIMP

Well, if you have Wacom tablet, you should know that our pen have eraser on the top. This working well in Photoshop, but not in GIMP. Since I’m GIMP user, I would love this eraser working too, but I can’t find the way…

So, I’m searching the web, and get the solution. It is pretty simple actually, all we need to do is…okay, read more to read… πŸ™‚

PHP code, searching combination of T9

T9, which stands for Text on 9 keys, is a patented[1] predictive text technology for mobile phones, originally developed by Tegic Communications, now part of Nuance Communications[2]. Read more on Wikipedia

This is usually used in mobile phones for predictive alphabet input. Each key have associated letters, such as 2 for ABC, 3 for DEF, and so on… This function allow you to search combination from entered number, for example, input 23 will return ad, ae, af, bd, be, bf, cd, ce and cf, in array.

Developing a PictureFLow widget application

Now I can get the PictureFlow source files compiled, I started to create an application based of this widget. The PictureFlow widget is originally created by Ariya Hidayat and ported to our Linux phones by the well known member of MotorolaFans, blackhawk (aka Ketut P. Kumajaya). The project page is in http://code.google.com/p/pictureflow/, also the original thread is inΒ here. Thanks to both of them, know I can create some awesome application with it. For the begining of this project, it will be still image viewer with some more features added. The name of this application will be decided when the beta is ready. πŸ˜‰

Autorun Manager from Revival project

While we doing Revival project a little while ago with arctu, Taurnil, and others, we actually have working hard for some cool application for our E2. This project, unfortunately have been aborted since all of us have no time to continue it. One of the application I made, the Autorun Manager is one of the hardest application I have ever made. This application used PHP as its programming language and use arctu’s show* binaries as the GUI. Since the project stopped, I think I need to release it as standalone application that compatible with most monster pack out here.

Why PHP? Because it is fast, more than Bash. The meaning of the fast, is the speed while processing data and not the GUI speed, since show* binaries is fairly slow. So, with PHP, I can made more data processing while not sacrificing the speed. It is also more flexible.

A little guide of using jQuery

JQuery is Javascript library that can help you write code smaller and easier to take a good care of event handling, animating, AJAX and more. With jQuery, we can make our webpages more beautiful. You can see that I used it for my side menu here. πŸ™‚

This article didn’t intend to teach you how to became the jQuery master and I’m far away from a master. It just for the case you didn’t know about jQuery yet and want to start with it, then this will be a good guide for you. If you want a more complete tutorial, go to the jQuery documentation.