Pages

Showing posts with label Bug. Show all posts
Showing posts with label Bug. Show all posts

Run System File Scan on Windows 10

My new Windows10 Dell laptop start having some trouble calculating the battery life when it's on battery mode while I was working in Starbucks. It clearly shows my laptop will only last for 1 minute while it still has 43% battery power left.

I tweeted about it and got a reply from Microsoft Support Team asking me to run system check.

CodeIgniter image_lib bug in the image process loop

This bug has me scratch my head for hours and finally found the solutions to fix it.

In CodeIgniter, you can upload multiple images and do resize, crop and watermark stuff. It's cool that you can use one library to do many awesome stuff. However there is problem when using image_lib in the loop.

Problem:

I upload few image and want to loop through each one of them and resize them differently based on their original size. So I put the resize function in the loop. However, the dimension is based on the previous image.

For example. the first image is resized to 100x200. The second image should be resize to 50x100, but is resized to 100x200. The third one should be resized to 400x300, but is resized to 100x75.

In other words, the second image was resized using the dimension from the previous resized image based on the second image's longer side (W or H). The first image was resized to 100x200, so the second image was resized to 100x200 because the original dimension of the second image was 50x100 (Height is larger than width). So it take the first image's height to resize the second images. Crap!


Solutions:
In the image_lib in CodeIgniter, there is a function to clean the setting ($config). However, there is missing parameters in the function.

So I add two lines in the function clear().

$this->width = '';
$this->height = '';
Add the above two lines before closing the function.

Problem solved!

Annoying bug in MYSQL 5.0.51b

Just realized that in MYSQL 5.0.51b, sorting data from INNODB on primary key with where clause will NOT work.

See other bug report at http://bugs.mysql.com/bug.php?id=31001

Basically, if you use where clause in the query like this. The primary won't sort.

SELECT * FROM (`store`) WHERE `publisher_id` = 1006 ORDER BY `store_id` desc
In the query, store_id is the primary key in the innodb.

If you remove the where clause, it will sort correctly.

WTF! This is a critical bug. How come MySQL don't catch that at first place. This bug seem to be there for a long time.