How to Fail at almost Everything & Still Win Big

How to Fail at almost Everything but still Win Big by Scott Adams (affiliate link) comes up on Hackers’ News a lot. Finally, I had a chance to read it. This is a little different kind of book compared to my regular reads about ultra-successful business titans. I had no idea who Scott Adams was until I heard about this book. He created Dilbert comic. He gave very down to earth perspective on how he achieved success in this book.

Published on


Magento – Get All Products with Categories in a Flat View

SELECT w1.website_id, w1.name as website_name, s1.store_id, s1.name as store_name, p1.entity_id as product_id, p1.sku, pname.value as product_name, url.value as url_path, small_image.value as small_image, msrp.value as msrp_price, price.value as price, p1.created_at as product_created_at, p1.updated_at as product_updated_at, visibility.value as visibility, pstatus.value as status, case when (pstatus.value = 1 and visibility.value > 1 ) then 1 else 0 end as enable_flag, c1.entity_id as category_id, cname.value as category_name, c1.parent_id, c1.created_at as category_created_at, c1.updated_at as category_updated_at FROM catalog_product_entity p1 inner join eav_attribute p_attr ON p1.

Published on


OpenShift Error: Layer 7 Wrong Status, Invalid Response

I have been playing with OpenShift for past several hours. It looks great. But a while back I started to get 503 Internal Server error. When I checked logs using rhc tail , I saw this error: Layer 7 Wrong Status, Invalid Response 404. I spent an hour or so troubleshooting. Turns out the issue was Netbeans had added src/main/web/app/WEB-INF/jboss-web.xml when I ran the application locally on my machine. I committed this file, thinking I might need it.

Published on


How to Tell if a Number Is Whole in Php

if ($num == (int) $num) { // It's whole } else { // It's not }

Published on


Filter Some Keys in Multi Dimensional Arrays in Php

/** * Cleans up multi-dimensional arrays. * 1st dimension is a simple index * 2nd dimension includes the desired keys * * @param mixed $array * @param mixed $keysToInclude */ public function cleanUpArray($array, $keysToInclude) { $returnArray = array(); $i = 0; foreach($array as $item){ foreach($keysToInclude as $key){ $returnArray[$i][$key] = $item[$key]; } $i++; } return $returnArray; }

Published on


4 Hour Body by Tim Ferris

Slow Motion Workout The technical term is 5/5 Cadence (5 seconds up, 5 seconds down). I tried this for the first time on Sunday, it is really intense. Momentum is not there to help you. You will feel every part of your muscle throughout the motion. Weights Tim Ferris showed a simple formula to figure out what should be the starting weight to workout with. Simply do regular sets. If you can do 5 rep, wait a minute & then increase the weight by 10 lb or 10%.

Published on


MySQL Update If Exist Else Insert Procedure

Are you tired of checking data in your code before inserting? Well MySQL procedures are here to rescue. This simple procedure shows how you can do that: CREATE PROCEDURE ` update_insert_user ` ( IN uid2 int ) BEGIN DECLARE last_login2 DATETIME; SELECT ` last_login ` INTO last_login2 FROM ` user ` WHERE ` uid ` = uid2 LIMIT 1 ; IF last_login2 IS NULL THEN INSERT INTO ` user ` ( ` uid ` , ` last_login ` ) values (uid2, now()); ELSE UPDATE ` user ` SET ` last_login ` = now() WHERE ` uid ` = uid2 LIMIT 1 ; END IF ; END

Published on


Codeigniter Creates a New Session With Each Page Load

Just spent 3 hours debugging a session bug in my webapp. CodeIginter was creating a brand new session with each page load. The issue was a misconfiguration with my config file. Fix was simple, in /application/config/config.php, make sure correct domain is set for $config['cookie_domain'].

Published on


Codeigniter Out of Memory Error

Query Saving is a feature of CI’s database class that stores the results of every query in memory until the controller is finished executing. As it turns out, in version 1.6.0, the ability to turn this off was added. The addition of the save_queries variable is listed in the Change Log, but as of the latest release of 2.0.0 last week, it still hasn’t made the documentation. $this->db->save_queries = FALSE; via Undocumented CodeIgniter | Green Egg Media.

Published on


ssh_exchange_identification: Connection closed by remote host

I tried to login to my server tonight but kept getting following error message: ssh_exchange_identification: Connection closed by remote host The fix was simple, at least if you have access to server via cPanel. Just restart sshd service via cPanel/WHM.

Published on


Prev Next