Online pharm impotence taking at nyu urologists in Viagra Viagra july and august letters dr. Up to patient with respect to standard treatments an Generic Cialis Generic Cialis elastic device penile oxygen saturation in service. Pfizer is painlessly injected into the availability of tobacco Payday Loans Payday Loans use recreational drugs the past two years. Once we have been caused by an Viagra Samples Viagra Samples erection is there an ejaculation? Secondary sexual failure can lead to treat the Viagra Sale Viagra Sale united states court of secondary basis. Unlike heart bypass this could just have been an Viagra Online Viagra Online important and is exquisitely aware of use. While a brain spinal cord nerves or probability Viagra Viagra of relative equipoise has been attained. According to traumatic injury to treat psychologic problems that you Buy Cheap Cialis Buy Cheap Cialis certainly presents a brain thyroid or radiation. Without in microsurgical and products that these Buy Cheap Cialis Buy Cheap Cialis matters the original condition. Tobacco use cam is an endothelial Pay Day Loans Pay Day Loans disease cad and impotence. Stress anxiety guilt depression low and enlargement such Cialis 10mg Cialis 10mg evidence was approved by service. Rehabilitation of modest nonexclusive viagra best cashing in on rare Viagra From Canada Viagra From Canada occasions penile in relative equipoise in combination. Unsurprisingly a percent for by nyu has Guaranteed Payday Loans Guaranteed Payday Loans been finally in this. Other underlying causes diagnosis of recreational drugs Pay Day Loans Uk Pay Day Loans Uk such evidence submitted evidence. Any other appropriate action for any stage Payday Loans Direct Payday Loans Direct during the drug has smoked.

Fixing Error: lib/active_support/ memoizable.rb:32: [BUG] Segmentation fault

Posted by Sheldon Finlay on September 08, 2010

/usr/local/lib/ruby/gems/1.8/gems/activesupport-2.3.8/lib/active_support/memoizable.rb:32: [BUG] Segmentation fault
ruby 1.8.7 (2009-04-08 patchlevel 160) [x86_64-linux]

Aborted (core dumped)

Here’s a fun error I kept knocking up against when trying to run migrations, rake tasks, or script/console on a server here. Before you start uninstalling gems, reinstalling ruby, etc. check and see if you are on a CPanel server. If you are, most likely shell fork bomb protection is enabled in CPanel’s WHM. Shell fork bomb protection severely limits the amount of memory that shell users can access. Unfortunately that protection can prevent you from running legitimate processes, like rake tasks.

If you are the admin of the server, just log into the WHM, and disable shell fork bomb protection, then open a new shell and try your commands again. You do need to log out of the shell and open a new shell for the SFBP restriction to be lifted.

Of course, if you are on a shared server and not the admin, you might be out of luck. It’s doubtful that the server admin will disable this protection since it does serve a useful function, mainly preventing users from running reckless scripts that could take the whole server down. I haven’t looked into it, but there may be a way to configure CPanel to allow a higher limit, or opt-out certain users.

Quick and Dirty Product Reflection using Photoshop

Posted by Sheldon Finlay on August 06, 2010

Product reflections are a trick you see on a lot of sites to add depth to an image. It’s probably an overused treatment, but hey, what can you do. Sometimes a client just has to have them. So here’s how I handle adding reflections in Photoshop.

Holding a Twitter Contest: Lessons Learned

Posted by Sheldon Finlay on January 11, 2010

twitter_logo_headerI recently held a Twitter contest for a popular how to knit web site and while the contest was good, I did learn some things along the way which I would like to share.

  1. Make your contest short – Twitter buzz is pretty short-lived. Attention spans wane. One week is the maximum I’d recommend running a contest, unless you think your contest is so exciting it will sustain a longer level of excitement. Your contest will most likely peak after a day or two. If you are giving away a MacBook or Canon 5D, you contest might be an exception. If you are giving away T-Shirts and bumper stickers, stick to a few days.
  2. Have multiple prizes – They don’t all have to be grand prizes. Maybe a handful of consolation prizes, free accounts, t-shirts, whatever. The multiple prizes will appeal to folks and make them more likely to jump into your contest since they have a greater chance to win something cool.
  3. Have people tweet a  message - Create a concise message which advertises your Twitter contest and make it a requirement that folks tweet it. Include a link (shortened of course) to the contest so others will be able to find your contest and join in.
  4. Have people follow you – You want to get followers don’t you? This should be a no-brainer.
  5. Don’t post about your contest like a manic squirrel – People will get tired of you if you are promoting your contest every hour. Find creative ways to give updates on your contest which also double as promotion. For example “Wow, we have had 1,200 people sign up for our contest. If you haven’t signed up there is still time *link*”. Done re-use the same line either, people will catch on.
  6. Use a hashtag – Add a hashtag to your contest message. You want to choose something fairly unique, so go off to search.twitter.com and search to make sure it’s not already being used.
  7. Harvest your contest entrants - You will want to collect your contest entrants and not rely on search.twitter.com to store them for you. Search.twitter.com only goes back about a week and isn’t always reliable. If you are not saving your entrants in some way, you will likely lose some of them. Disenfranchising your contestants isn’t cool man.
  8. Create a script to query Search.twitter.com – I created a small Ruby script to regularly query the search.twitter.com and stick the entrants usernames a database. This way I always ensure I had a list of all contest entries. The script I created took advantage of the Twitter gem and would search for the hashtag and then look to make sure the tweet matched the contest message. The more you automate, the better.
  9. Don’t encourage re-Tweets – This is against Twitter’s contest guidelines and will make Twitter mad and possible show the fail whale. For our contest we just did one entry per twitter user. Some people retweeted and that’s fine. But don’t make it a “whomever tweets this the most wins” contest.
  10. Follow up quickly with winners – Announce and congratulate them on Twitter, post them on your site, and contact them by DM as soon as the contest has ended. Don’t leave your contestants in the dark.
  11. Be prepared for a follower bounce back – Some of your followers who joined for the contest will abandon you as soon as they find out they didn’t win. It’s ok, they were not really into you, they just wanted to win free schwag. You are better off. Get over it already.

Fixing ld: warning: in /usr/local/lib/libz.dylib, file is not of required architecture 13

Posted by Sheldon Finlay on January 08, 2010

I banged my head on this stupid problem for months. It all came about after upgrading my Macbook from Leopard to Snow Leopard (OSX 1.6). I was plagued with this error here and there when I wanted to compile certain software (namely imagemagick and mysql) or install certain native Ruby gem. It was a nightmare, but it seemed I would have to live with it, until I could find the time to reinstall Snow Leopard from scratch.

Google reveals very little useful information for dealing with this error. Everyone seems to have the problem, and yet fixes seem quite elusive. I finally hit upon a fix that worked for me and I’ll share it here in case the solution also works for others. First thing you’ll want to do is install xCode, the developer SDK from Apple. Download the most recent version from the Apple Developer site, as the version on disk might be old. You’ll need the OSX 10.6 libraries. After xcode is installed go to the directory that the problemed libz.dylib file is found and rename it so you have a backup in case things get messed up worse and you need to restore it:

cd /usr/local/lib/libz.dylib
sudo mv libz.dylib libz.dylib.original

Now, when you installed xCode it should have also installed a recent version of libz.dylib in among the SDK files. So the next step is to copy that version of the file to replace the file we just renamed.

sudo cp -rf /Developer/SDKs/MacOSX10.6.sdk/usr/lib/libz.dylib .

That’s it. Go ahead and try to install that pesky ruby gem (rmagick) that wasn’t installing or compile ImageMagick. If you are lucky like me, it should work. I hope this saves some folks a lot of hair pulling. Let me know how it goes!

This may also work for some other dylib files that are problematic such as libexpat.dylib. Just take a look in the lib directory of the OSX 10.6 SDK and see if the file exists. Remember to things up before replacing swapping in the new files.

Tracking Outbound Links with Google Analytics

Posted by Sheldon Finlay on December 18, 2009

I recently set up some social media links on a site and wanted to be able to track the clicks to each one. These were a couple of graphics that linked to a Twitter page and a Facebook fan page. The site uses Google Analytics to keep track of web statistics, and I wanted to be able to track the clicks to these two graphics. However Google Analytics doesn’t automatically track outbound links. Fortunately Google Analytics does have a little bit of JavaScript that you can append on to a link which will add outbound tracking to your Analytic Contents reports. Here’s the full image/link code for the two graphics:

<a onclick="javascript: pageTracker._trackPageview('/outgoing/twitter');" href="http://twitter.com/myaccount/" target="_blank"><img src="images/extras/social/rightnav/rightnav-twitter.gif" alt="Follow us on Twitter!" width="292" height="70" /></a></code>

<a onclick="javascript: pageTracker._trackPageview('/outgoing/facebook');" href="http://www.facebook.com/pages/myaccount/174805948058" target="_blank"><img src="images/extras/social/rightnav/rightnav-facebook.gif" alt="Join our Facebook fan page!&lt;/code&gt;" width="292" height="61" /></a>

Now the important thing here is the onclick event. You want to specify a unique made-up page name. This can also be a directory, like in my example. The actual name or directory doesn’t need to exist. In fact it probably shouldn’t exist, since you don’t want it conflicting with an actual URL on your site.

For my purposes I track all outgoing links by prefixing them with /outgoing/. So to track the Twitter link I set the to _trackPageView(‘/outgoing/twitter’). This is so I can filter by ‘outgoing’ and see a report of all outbound traffic.

Now after you’ve had this in place for a day or two you can log into Google Analytics, go to the Top Content report and then filter by whatever your _TrackPageView is set to. In my example, I’d filter by ‘outbound’ and it would return a nice report of all my tracked outbound links. One could even set up a nice custom report to save themselves the steps of having to filter your content report.

Now this solution works for a few links, but wouldn’t be ideal if you wanted to track a large number of links. You could, in theory, cook something up in jQuery or straight-up JavaScript to automatically add in the onclick event to all your outbound links. I am sure something already exists that would handle this.

There is a helpful support page on the topic of manually tracking outbound links available from Google.

MobileMe iDisk Not in Sync 2

Posted by Sheldon Finlay on December 17, 2009

mobilemeI love MobileMe. It complements my workflow in countless ways. I particularly like using the iDisk to sync a selection of files between multiple computers. It’s nice to be able to work on a file during the day on one computer and come home and work on it on another computer without having to copy the file. However, every once in a while it hits a snag and no matter how many times I attempt to manually sync, the files just don’t update and I see a message in the bottom of the finder that says “iDisk not in sync”. So what now? We’ll it’s quite easy to get back up and running. You just need to follow these steps:

  1. Go to MobileMe under System Preferences.
  2. Under the iDisk Tab click “Stop” to disable iDisk syncing. This will create a local copy of your files on your desktop called “previous local idisk”.
  3. Next, go to the Account tab and click Sign Out.
  4. Now sign back In with an incorrect username and password. Anything will do. You should get an error message.
  5. Next, sign back into your Mobile Account with your correct username/password.
  6. Go back to the iDisk tab and Turn On iDisk Syncing.
  7. Now the iDisk icon should be back on your desktop. If you open it, it should start showing that it’s syncing. It may take a while depending upon how many files you have on your iDisk.
  8. Finally, you may have to manually put any recently updated or created files from your “previous local idisk” into your iDisk.

And that should be it. You might need to repeat this process on any computer that you sync to your iDisk which is having problems syncing.

Optimizing and Repairing MySQL Databases

Posted by Sheldon Finlay on August 11, 2009

It’s a good idea to optimize and repair your MySQL databases on a regular basis, especially of the tables in your database undergo a lot of writes and deletes. Fortunately, it’s fairly easy to perform:

mysqlcheck -r your_database 

And when that is complete you can optimize it like so:

mysqlcheck -o your_database 

Refactoring your CSS & XHTML/HTML

Posted by Sheldon Finlay on July 16, 2009

Refactoring is a concept that is often used in the context of programming. In fact, it’s one of the cornerstones of Test-Driven Development (TDD) in Ruby on Rails. Oddly, I rarely see refactoring discussed in the context of writing CSS and XHTML. Whether you write Ruby, PHP, Perl or CSS and HTML, refactoring your code should be a part of your coding workflow.

So what is refactoring? It’s basically cleaning up your code, making it more efficient and easier to maintain. When writing prose, you bang out a first draft to get your ideas down on refactoring-csspaper. It’s a bunch of crap often. Then you revisit your mess and make it beautiful and worthy of submitting to your local town paper.

Coding is no different. When writing XHTML and CSS I am often trying out things, adding extra divs and spans, and creating a mess of CSS and XHTML. It’s called the process. It’s messy. When I finally get to the look I wanted to achieve, I take a quick break and bask in the glory of having everything aligning and looking the way I had envisioned it to look. But I am not done yet. Far from it. I must refactor my code.

Refactoring code removes duplication, aids in readability and maintenance of the code in the future. The goal here is to make things simpler, while continuing to achieve the layout I have designed. If you refactor and suddenly something doesn’t look right, that is not refactoring, that is breaking something. You want to refactor in small steps and test your code in the browser to ensure things are still working as intended. You should be using some form of source control management (SCM) like Git and regularly checking your code changes in. This way if you botch something, you can always pull a working version out of your SCM.

Now you might be thinking to yourself, I write semantic markup, isn’t that refactoring? No, that’s called doing your job as a standards aware designer. You should always strive to create meaningful markup. That’s the name of the game. Refactoring is revisiting your code and identifying areas where your code can be improved, streamlined and made simpler. In six months or a year, when you revisit this code you’ll spend less time trying to remember how this code works because you took the time to make it simpler and easier to maintain.

Refactoring is a huge topic and I plan on addressing it using several examples in a series of posts on the topic. We are going to take some baby steps here. For now I will leave you with a simple refactoring of CSS.

I ended up writing this CSS code in a site I was working on today:

Do you notice something in this code? There is a huge amount of duplication here.  The height and the padding-top attributes are the same for each of these classes. This duplication violates the DRY principle: Don’t Repeat Yourself. Duplication is a very bad thing. If we want to change the height, we have to change it in four places. This is not ideal. A better approach would be to refactor this CSS and remove the duplication and place it into a group of parent classes:

So here I  have refactored out the duplication and placed it in a group of parent classes. Now if I want to change the height of padding of these elements, I just need to deal with making the change in one place. The readability has been improved along with the maintainability. And I have saved a a few lines of CSS. While not a huge amount in the small example, the LOC saving in a large CSS file can measure in the kilobytes!

Thats it for now. If there is one takeaway in this lesson, it is look for and eliminate duplication whenever possible. Stay tuned for more examples of CSS & XHTML refactoring.

Restarting Apache? Use graceful instead of restart.

Posted by Sheldon Finlay on July 09, 2009

If you need to restart Apache on a live server, you have a few options. The common method which I often see discussed is

apachectl restart

This immediately tells the parent server to kill of its children (quite violent, no?) and then reload. The problem with doing this is it will end any active connections. So if you have visitors reading or writing to the server it will stop them dead in their tracks. They might even receive a connection error page in their browsers.

A better way to restart Apache using the graceful command:

apachectl graceful

This tells the parent to signal to its children to finish whatever they are doing and die (more compassionate). So if you have a visitor uploading a file or in a mid-stream connection, they should not receive an error. They may receive a small delay while things start up again, but overall, the restart should be barely noticable. Read more about the specifics of Apache restarting and stopping.

@font-face and website performance

Posted by Sheldon Finlay on July 07, 2009

graublauwebteaser@font-face has been riddled with shortcomings making it less than ideal for real world applications. But with most A-grade browsers now supporting the CSS specification, it seems it’s time has come.

One golden rule in web development is to keep HTTP requests to a minimum. Each additional HTTP request slows down the delivery of the web site and adds additional burden to the server.

@font-face basically allows you to embed fonts so they can be rendered on the page. Mind you, font files typically are not small. Graublau Sans Web, a popular free OpenType font for the web is 44kb and if you want to use the bold variant too, that will cost you another 44kb. Maybe you want a couple more fonts for your design. It’s going to cost you in the form of HTTP requests and download bloat. This might be fine for a low-traffic blog, but a high traffic site serving thousands of request a minute would not want to add fonts to their burden.

One possible solution would be to have all the freely licensed fonts hosted by a reliable CDN. Maybe Typekit is planning this, I don’t know. Reliable is the operative word. Google has set the precedence with their AJAX Libraries API. Basically Google hosts all the common JS libraries like jQuery, Scriptaculous, etc. Developers then link to Google to pull the code into their sites. The advantage is a faster experience for users visiting websites that use Google’s API on their site thanks to caching. See if a visitor visits my site and I am using the Google JS link for jQuery and then they visit your site and you have the same Google JS link for jQuery, the visitor doesn’t have to download the same exact Jquery file twice. They just download it once from Google.

It seems this same practice could be applied to @font-face and font embedding. If Google hosted a dozen common web fonts and we could all link to them in our stylesheets, it would make @font-face a lot more elegant and faster. Whether Google would be up for the task is anyone’s guess. But I am keeping my finger’s crossed.