Solution to Folders disappearing from Places in Mac OS Sidebar

Network Folders, or folders pointing to external drive always disappear in Mac OS X. It is a big problem when the shortcuts in Places don’t stay in the Places Sidebar on Mac OS X. This can be very frustrating because you use these shortcuts to be more efficient but every time you take the drive off you’re signing for spending minutes recreating your shortcuts again. A NIGHTMARE.

HERE IS THE UNIVERSAL SOLUTION in order to permanently add folders to Places in Sidebar on Mac OS. Creating a small software that will attempt to open the folder.

Here is the very simple procedure, do it for each folder or file you want to add to Places in Sidebar:

  1. Open Script Editor
  2. Copy / paste the following, and replace by the folder location you want to put in Sidebar :
  3. -- Script to open a location in the current finder window. You can set the desired location to be on a removable volume, or a disk drive, and then put the script into the sidebar as a means to access files on a removable volume from the sidebar.
    set primary_item to POSIX file "/Volumes/EXTERNAL-HARD-DRIVE/WHATEVER"
    tell application "Finder"
    try
    set folder of front window to primary_item
    on error
    display dialog "The location could not be found"
    end try
    end tell

  4. If you don’t know the folder location, right click on the folder and click on “Get info” and look then in “Where”
  5. Save the script as Application, somewhere on the local hard drive, NOT on the removable disk, not on a network drive or anything…
  6. Put the Application in the Sidebar
  7. Drop me a message in the comments if you are happy 😉

Source: The article you just read is a clearer refinement of this article.

How to Make a Paypal Link NOT Button

In some website designs Paypal buttons are just really inconvenient because the HTML code is a FORM, not always practical to integrate with CSS or other clickable things. So in many cases, you will prefer to use a standard link in <a> tag. Paypal doesn’t offer than by default by there’s a way :

  • Create a button, and save it :
    • Merchant Services, you will find.
  • Once saved, go in :
    • My account
      • Profile
        • More Options
          • My selling tools
            • Top of the page “PayPal buttons” >> Update
            • Edit the button in question
            • Save, you have the regular form and…magic…
            • Go to email tab, Tadaaaa ! The basic link you dreamed of.

Feels awesome but it really should be offered by default.

Enjoy.

Is PHP still cool or should you learn a better language?

Mailchimp is an email marketing online tool that allows business to cleverly manage their email campaigns. It is wonderfully developed, looks wonderful, so well that I consider it a model of what a web 2.0 site should be like.

In a recent post of Chad, a member of the Mailchimp team, he mentioned how a fast-growing company like them had immense difficulty finding a good developer that would to code in PHP. He goes on explaining that from a hip company like Mailchimp, they would expect a sexier language, like Ruby amongst others.

The article is followed by a handful of comments, stemming from more or less advanced developers. It provides what seems to be a good update on what’s going on in the server-side web development world.

Recurring arguments in favor of PHP

  • easy to learn
  • low-barrier to entry
  • free of charge and open source
  • adult mature language:
    • that has been through many improvements
    • very well documented
    • large community of peer users
    • hosts with PHP servers are readily available, competitive, and cheap
    • from the point of view of HRs: It’s easier and cheaper to have a PHP developer
  • Great current examples based on PHP: Wikipedia, WordPress, Flickr, Facebook, and many CMS
  • Some great existing framework allowing coders to get things done faster:
    • Zend (very popular in big corps)
    • CakePHP (inspired from Ruby on Rails)
    • Symfony (very pro as well)
    • Codeigniter (more exotic and easy to start with)

Recurring arguments in favor of other languages

  • Other “sexy” languages include :
    1. Ruby on Rails (Popular at Google, Twitter, Shopify, Groupon)
    2. Python
    3. Perl
    4. ASP.NET
    5. More exotically: Go, Haskell
  • PHP is slow
  • Scope of methods (absence of local namespaces) <— solved in PHP 5.3
  • PHP is not ideal for OO (object-oriented) programming
  • Often in PHP one must develop their own framework before they can do something good with it in complex projects to be scaled
  • PHP is not good for SOA with strongly designed RESTful web services

Recurring neutral/flexible points of view

  • PHP can be very good, what matters is that the developer has a mature mindset and can adapt
  • It is the team that matters, not the language
  • Often, people will hate a language because they have personal preference for other languages or a lack of skill on the hated language
  • The tools that one uses do not matter, what matters is what is accomplished with it. Read this excellent article : The Duct-Tape Programmer

CONCLUSIONS?

This is the typical debate that I have observed for electronic chipsets, a market that moves much faster than that of programming languages. “Should we use the good old popular one, or the recent fancy stuff ?” Undoubtedly, PHP is very popular, gets the job done, is mature, documented, and easy to access. Undoubtedly, other languages combined with the state-of-the-art frameworks also get the job done, sometimes maybe in a more elegant way. No wonder recent languages benefit from the pitfalls of older more mature languages. This was the technical aspect of things.

On a psychological level, there seems to be a category of developers, composed of young inexperienced progressive developers, and also with very experienced PHP developers, that are hungry for new supposedly better languages like Ruby. It can only be understood. Also, debating on the best languages can seem like fighting over which Häagen-Dazs flavour is the best. With comparably capable languages, there simply is no best. Different people have different levels of experience and different preferences that each one can justify. That does not make it the best for all, just the best for them. People love to hear “Go for this it’s statistically the single best choice”. A better approach is to map the languages with the best uses and with people’s personal inclinations. Everybody and every company is different, so to each their own.

A sound choice for any new developer would be to get strong experience in PHP, and as a hobby learn the alternative 4 languages listed above (1 to 4).

To finish with, here is the graph showing a survey done in France to figure out what developers use for server-side web development as of 2010:

Compared to the 2009 survey, PHP and Java have lost a few percents in favor of Ruby on Rails and ASP.NET, but again the data set is too small…

Prestashop Returns with any Order Status

If you have an online sales website based on Prestashop, you must have experienced returns of products for either a refund of a change of product.

If you are not familiar with how to do returns using Prestashop, read these first:

Merchandise return (RMAs) in Prestashop

And in French, you have these two good articles:

  1. La gestion des retours et des avoirs dans Prestashop
  2. Prestashop – Gérer les retours produits

Now, the problem is that (at least up to version 1.2.5) Prestashop will only allow returns if the order status is set to “Delivered”. I personally never bother to use this status, and I assume I am not an isolated case. So instead of being forced to do what Prestashop expects, I have hacked the classes/Order.php PHP template to get it to accept return for any order status of my choice.

  1. Go to your Prestashop back office
  2. Activate the returns, and choose the number of days for returns. Careful, a value of zero will allow all orders to potentially claim a refund.
  3. Hack the classes/Orders.php file with the simple following changes:
  4. You want to add:
    if ($result[‘days’] == NULL) return false; as shown in this function:

    	public function getNumberOfDays()
    	{
    		$nbReturnDays = intval(Configuration::get('PS_ORDER_RETURN_NB_DAYS'));
    		
    		
    		if (!$nbReturnDays)
    			return true;
    		$result = Db::getInstance()->getRow('
    		SELECT TO_DAYS(NOW()) - TO_DAYS(`delivery_date`)  AS days FROM `'._DB_PREFIX_.'orders`
    		WHERE `id_order` = '.intval($this->id));
    		
    		if ($result['days'] == NULL)
    			return false;
    				
    		if ($result['days'] < = $nbReturnDays)
    			return true;
    		return false;
    	}
    
  5. Then this is the function you want to use instead of the default isReturnable. Remember to adapter the orderstatus numbers to what you actually want to allow returns. In my case it's 12, 13, 14, 15, which are personal order statuses.
  6. 	public function isReturnable()
    	{
    		$returnsActivated= intval(Configuration::get('PS_ORDER_RETURN')) == 1; 
    		$notTooLate= $this->getNumberOfDays();
    		$statusEligible = (intval($this->getCurrentState()) == _PS_OS_DELIVERED_ 
    						|| intval($this->getCurrentState()) == 12
    						|| intval($this->getCurrentState()) == 13
    						|| intval($this->getCurrentState()) == 14
    						|| intval($this->getCurrentState()) == 15);		
    		
    		return ($returnsActivated && $notTooLate && $statusEligible);
    		// ORIGINAL CODE :
    		//return (intval(Configuration::get('PS_ORDER_RETURN')) == 1 && $this->getNumberOfDays() && (intval($this->getCurrentState()) == _PS_OS_DELIVERED_ || intval($this->getCurrentState()) == 15));
    		}
    

HOW TO Set Up a Shared Printer on Linux at NUS

Although Singapore and more specifically NUS seems to have absolutely NO IDEA what Linux is, you may want to set up Linux on your desk at some point of time. And a few days later you will, like me, realize you have not set your lab’s printer and start struggle with that. I did, so you no need lah, just follow this:

  1. The printer is shared on a PC inside the same workgroup : ASK THE ADMINISTRATOR TO ADD YOU TO THE ALLOWED USERS OF THE PRINTER ON THE COMPUTER ON WHICH THE PRINTER IS CONNECTED. We will call this PC “PrinterPC” in the following, but you will need to replace that by the network name of that computer. We will call this printer “SharedPrinter”, , but you will need to replace that by the share name of that printer.
  2. System > Administration > Printing
  3. New Printer > Windows Printer via SAMBA
  4. Complete the field “smb://” with the following :
    workgroup/PrinterPC:LPT1/SharedPrinter

    Note that you should NOT REPLACE “workgroup” by anything else, type literally “workgroup” as shown in bold.
    Example, in my case it is:

    workgroup/cicfar2:LPT1/HPLaserJ
  5. Tick the box “Authentication Required”
    Your username is

    NUSSTU\yourNUSlogin

    and use your latest NUS password.

  6. Click on “Verify” and you should have access.
  7. Move to the next super easy steps (installing driver)
  8. Print a test page, roar loudly like a lion while raising your arms and feel almighty 😉

Any problems ? Post a comment.

(Computer) Pranks That Will Make Your Friends Curse You

My friends (robotics club sweet times) pushed the pranks further to not wrap just my chair, but also ME ON IT…with a vaacum cleaner attached to my feet, how random is that uh ? I think those bastards even took pictures of that wrapped and taped (not so?) human-looking thing struggling with what seems to be their teeth to free themselves.

These pranks are the type of things that make you hate your buds for a week, and love them for the rest of your lifetime. Everytime you would think about those stupid pranks you would smile and miss those great times. It happens to me quite often and I am sure you get a feel of what I am talking about. So do pranks again and again to all the friends you really like, not too often though, and make them as unexpected as you can.

Of course you don’t want to get to the point where they hate you forever.

Don’t hurt : forget the slippery banana or pulling the chair away when they seat. Physical pain is probably the best way to end up a friendship and any relationship actually…except for women and beatiful BUT painful shoes…I’ll never understand this, but that’s a discussion for another day.

Don’t humiliate : Or at least to go beyond the bottom line. Yes, for most people ending up naked in front of a crowd is not a fun kind of prank.

Don’t put stress : Or not for too long, you should stop before they don’t find it fun and become angry.

The point of your pranks is really to make the victim find it FUN, you want to suprise them, you want to draw a smile from them and declare (or keep up) a warm and friendly sort of little war based on an innate drive for REVENGE, gentle revenge though.

Till I get the pictures of my torture above mentionned, and if you’re running out of creativity whan it comes to pranks, try and enjoy this, it’s SWEET :

http://techrepublic.com.com/2346-22_11-171156-2.html