J.me

Pure CSS3 responsive navigation with :target

This is an experiment I tried when working on WPMUDEV mobile navigation a while back, basically to make the navigation work with CSS alone. Using :target pseudo-class, this is possible, but of course it won’t work very well on every navigation.

For the sake of this demonstration, I have made a responsive navigation that will scale between smartphone, tablet and desktop.

Background image on table row

Applying a background image on table row is a classic issue that never get right, at least not in a first few pages on Google search when I looked on a solution. In fact, the only cross browser solution is to apply the background to the table cells instead. But what happen if you want a repeated background across the table row?

The problem

Let’s say you wanted to apply a background to a row that has disabled class.

The CSS:

table tr.disabled {
	background: url('disabled.png') repeat-x;
	color: #aaa;
}

Result:

Ouch! The background is in fact applied to the table cell, not the table row as we intended. It looks ugly as the image start in every cell!

Cleaning MSI GX633 Fan

My current notebook, MSI GX633 turned 2 years old by this March. In past months, the notebook run pretty hot that it’s not even possible to run everything at maximum. A more intense task like video playback would raise the temperature to more than 90 degrees Celcius. I can’t even use the maximum clock (the processor run at 550 Mhz, 1.1 Ghz and 2.2 Ghz), so I’m limiting it to the middle clock, and even so it still heat that much.

I have tried a few solutions to solve this overheating issue, first is undervolting. It’s kind of challenge to find which tools that can undervolt AMD Turion X2 processor, and I found K40Stat worked for me. I was hoping this could solve the overheating, but it’s not. I always get BSOD at the end. The next solution I tried is buying a laptop cooler (opted for Targus model), but it didn’t help much either. In the end, I could only run half the clock of the processor to prevent it from overheat.

In general, overheating is caused by accumulated dust on the air intake and outtake, blocking off the ventilation. Even though the solution is simple, by cleaning the fan and the ventilation, but it require me to open the notebook cover. Since this is my only work computer, I’m always avoiding this but I finally build up the courage to do it as the heat is unbearable anymore. Read on to find out how I clean my fan and solve the overheating issue. 🙂

Server outage, 3 days offline, a month credit

A surprising news came to my inbox 2 days ago from Site5, indicating that the server which my account hosted has been down since the night a day before. As a result, all of my website were all down. I have completely moved all of my domain to Site5, so this is certainly a bad news. Fortunately, I don’t have (yet) any business that rely solely on it, so damage to me is actually minimal.

According to Site5 customer service, hardware issue that the server experienced is extremely rare. They had to restore backup and it was a lengthy process, there is also a network issue that caused the restoration to fail at the first time. The restoration finally done today and server is up again. They are also offering one month credit to my account as an apology. 🙂

To my surprise, Site5 is pretty responding regarding this issue. They update the forum frequently and for users that didn’t bother to check the forum often, they sent an email everyday regarding the status of server, explaining what is happening that day. Despite the outage, I’m actually quite happy with the customer service and Site5 itself for a reliable service so far. Hopefully, this won’t happen again in future. 🙂

Sort by latest post for wp_list_categories

One of my developer friend asked me if we could sort by last post using wp_list_categories function for WordPress. By default, wp_list_categories accept arguments for order by ID, name, slug, count or term_group. Order by latest post is not possible by default, but with a little of tweak using filter hook, we can. 🙂

First, we’ll looking at the function wp_list_categories. This function made call to get_categories to get the list of categories, which made another call to get_terms. Categories in WordPress is basically terms with category taxonomy. Finally, looking on the get_terms function, we will find some delicious filter hook that suitable for our customization.

WordPress Snippets part 1

Well, this will be a short list of WordPress snippets that we could use. This snippets is collected from my daily work on WordPress and should be useful for daily basis.

WordPress mail snippets

WordPress has its own improved function for sending email, it is wp_mail. We should always use this function if we wanted to send email within WordPress. With this function, we don’t need to worry much about the mail header and stuff. More over, there is plenty of filter we can use to customize it.

Customize Custom Post Type Landing Page with Clean URL

WordPress has been long capable on using custom post type. Since WordPress 3.0, we are now easier to create a custom post type. I have blogged some tips about it.

However, many didn’t know that the custom post type already had it’s own landing page, though, you will need to pass the post type variable to the URL. This post will guide you to the step by step on customizing the post type landing page, as well as adding a new rewrite rule for a cleaner URL.

Moneybookers and Paypal Bank Withdrawal Comparison

If you are working with foreign clients, chances are you will need to have accounts on either Paypal, Moneybookers or some other similar services. Paypal is currently accepted almost everywhere, it provides the best features and in my opinion, the Paypal web interface is the cleanest and easiest to use while providing a detailed information for each transaction. Moneybookers on other hand is also a growing alternative to Paypal, it is also widely accepted, but the downside for me is their web interface is somehow lacking and they didn’t provide a detailed information for each transaction like Paypal did.

They are both excellent, quick and cheap service to receive your money. Now I will going to compare the withdrawal process from both service, comparing the fee, rate and the time it needed to arrive to my bank account.

Simple jQuery and CSS3 Slideshow Tabs

A slideshow and tabs is pretty common nowadays in any modern website. There is a ton of way to do this and many free and paid tools available for this feature. This make it very easy to create and it will always amaze people who see it. Basically, we will need at least Javascript to do this, CSS to style the slideshow and tabs as we wanted, and then finally the special HTML markup which make it possible. There is also a slideshow which make use of Flash.

The solution I tried to made right now is a very simple and basic one. It make use of simple jQuery to catch the click event and switching tabs, as well as the slideshow, the CSS to style it as much as we wanted and a simple HTML markup in one unordered list.

The Basics to Write a Secure PHP Web Application

Securing your application is the most important things when building an application. This is the basic that every programmer should follow, it’s a must. However, sometime programmer might forgot the basic, and the more complex your application is, the harder it is to maintain and looking for security holes. While securing your application doesn’t mean that you will be totally safe from a hack, since there is many factor of why a web can be hacked, but reduce the possibility is always a good practice.

This article will give you walkthrough on the basics of creating a secured PHP application. I will give some step by step to filtering input, keep your code up to date and standard. I’ll also give you some good practice I always do.