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.

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 

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: its time has come.

Posted by Sheldon Finlay on June 24, 2009

typekit-logoBrowsers are continuing to innovate and bring support for new methods which promise to make designer’s lives easier and more flexible. At An Event Apart in Boston this week was a call for designers to embrace the future of web design and start leveraging these emerging browser technologies. It’s time to get over the fact that web sites are going to look different in every browser. That’s the nature of the medium.

One exciting emerging technology is @font-face, a CSS specification which gives web designers the ability to add embedded fonts to the font-stack for use in on a web site. Web design has long suffered from an impoverished offering of web-safe fonts. Nonetheless, we have made a beautiful web with what we have been given, all the while turning a green eye towards print designers and their limitless selection of tidy fonts. The prospect of embedding fonts is exciting no doubt. Designers have wanted this flexibility for years as evidenced by such hacks as sIFR. sIFR works, but it’s imperfect. An interim hack at best until we have better techniques.

The two main road-blocks to using @font-face has been browser support and font licensing. Safari has supported @font-face since version 3.1, IE since version 4, albeit using a proprietary method (big fucking surprise), and Firefox will support @font-face in version 3.5 (released today). So we are getting to a point where browser support is no longer an obstacle. So lets check that item from our lists.

Now there is still the problem of font licensing. Sure, there are a lot of free poorly crafted fonts which have licensing that extend to the web. There might even be some reasonably nice free fonts which we can use. But all the big font foundries have refused to extend licensing to the web, and with good reason. There just hasn’t been a reliable way to embed fonts into a page in a manner which prevents the fonts from being downloaded. Web sites that use @font-face are basically making the fonts they embed available for public download. Not a good deal for the font foundries.

But that is about to change with the advent of Typekit an up and coming service set to launch this summer. Typekit allows web site designers to license fonts from the font foundries in a secure manner which protects the foundries fonts from being publicly downloadable. It’s very exciting. Is it perfect? I don’t think so. I have yet to see the service as it hasn’t launched. But it sounds like the service will somehow tie your web site to the Typekit service. Coupling sites can lead to problems. What will happen if Typekit’s servers go down. Nonetheless, this is progress. A first step. Opening the dialog up with the font foundries is huge. This is an industry that has feared the web for a long time. To bring them to the negotiating table is a momentous thing and the web will benefit from it enormously. I am certain more innovation will be made and we can thank Typekit for getting the ball rolling.

Resources:

  • Typekit (sign-up to be notified when the service goes live).
  • Typekit Blog (while you are waiting for Typekit read about their progress and get involved).

How to uncompress tar.bz2 files in the command line 1

Posted by Sheldon Finlay on May 28, 2009

I confess that I can never remember the syntax for this myself. I know there is a j and an x flag in there somewhere. So I’m adding this for myself as much as for everyone else who can’t keep this syntax straight.

  tar -jxvf filename.tar.bz2

Backing up MySQL Databases

Posted by Sheldon Finlay on April 30, 2009

Most people backup their web site files. But with so many sites being database-driven it is equally important to make regular MySQL database backups. If you are running a blog, a forum or any database-driven web site and your database gets nuked, well there goes all your content. How long will it take to restore it and get your site back online? If you have a backup, the data loss should be minimal and restoration of your backup should take no time at all.  If you don’t have a backup you are probably screwed and all your work has disappeared into the ether.

What options do you have for creating a MySQL database backup? There are plenty and many of them can be automated using shell scripting or cronjobs so you can set them and forget them (until you need them!). Let’s look at a few manual backup methods. In a later post I will talk a little bit about automating backups.

PhpMyAdmin

Most of you are probably familiar with PhpMyAdmin, the PHP web-based administration backend for MySQL. PhpMyAdmin has a tab called export where by you can backup your entire database or just selected tables. The default export settings are usually perfect, although you can tweak them according to your needs, although you should always export as SQL, as that is the format your database will expect if you ever need to restore it. Lastly, you want to save the file to your local computer and to save space and transfer time, compress it in the format of your choice.

mysqldump

mysqldump is a command line utility which pretty much does the same thing as PhpMyAdmin except it’s shell based and not web based. So you will need a shell account on the server where your database resides. The basic syntax for using mysqldump is:

mysqldump -u [user name] -p[password] [database name] > [dump file]

So you will need to provide your database username, database password, database name and finally a filename which will be the schema file containing the entire database structure and data.

If your database is large you might want to compress it to save space and transfer time. You can backup the database and compress the database in one swoop like so:

mysqldump –-user [user name] –-password=[password] [database name] > [dump file] | gzip > [dump file]

Now, to restore a database with mysqldump you would issue do something like this:

mysql -u [username ] -p[password] [database name] < [dump_file]

This same command could also be used for a schema file which you created with PhpMyAdmin. You would of course need to upload the schema file to your account. I find working with schema files through the shell a lot faster than working with PhpMyAdmin. PhpMyAdmin can also choke on your schema, particularly if you are saving binary info to your database.

mysqlhotcopy

mysqlhotcopy is another command line utility for creating MySQL database backups. It has many advantages over mysqldump:

  • It’s very fast. So it’s suitable for large databases which would be both time consuming to backup as well as restore.
  • It makes exact copies of the actual files which make up the database tables.
  • It ensure data integrity by locking and flushing the tables while they are being copied. Other database backup methods can export a backup while a record is being written which can lead to a corruption in the backup.

Now, despite it’s overwhelming positives, mysqlhotcopy comes with one large downfall which makes it not practical for everyone. To restore the files, you need to have access to the actual files which make up your database. If you are on a shared web host or don’t have root access on your database server you won’t be able to restore the files yourself. You might be able to ask the web host to copy the files and flush the database for you. But you should check before you use this method, lest you get stuck with a backup which you can’t restore.

So how do you use mysqlhotcopy? It’s a shell command similar to mysqldump:

mysqlhotcopy -u [username] -p[password] db_name [/path/to/new_directory]

What this will do is lock and flush the tables in your database and make an exact copy of those files to the directory your specified. To restore your database, you simply copy these files into your database directory and flush or restart MySQL. The location on my server would be /var/lib/mysql/table_name/, but yours might be different.

So this covers some manual backup methods. Manual backups are better than nothing, but they still leave something to be desired. It can be time consuming to run backups manually and would be better to have them run automatically at regular intervals. It would also be ideal to have some sort of backup rotation where you could choose between restoring yesterday’s backup,  last week’s backup or anything in between. This is a topic I will try to cover in a future post. But for now, just start backing up your databases.

Passenger Phusion/mod_rails System Tools

Posted by Sheldon Finlay on February 08, 2009

Passenger has really become the gold standard in easy deployment of Ruby on Rails apps. It’s amazing simple to configure and quite efficient. In addition to the installation tool, there are a couple small analysis/maintenance tools that are included for giving you some insight into how Passenger is running on your system. You don’t hear much talk about them and I quickly overlooked them at first.

passenger-memory-stats

This tool allows you to see a display of the real-time memory usage for Passenger and Apache.

passenger-status

This tool shows you what your current passenger stats are and what apps are currently running.

You can read more about both of these in the Passenger documention.

FLV Video Streaming Using Apache

Posted by Sheldon Finlay on February 08, 2009

I do a fair amount of work pseudo-streaming video using the flv_streaming module in Lighttpd. However, it’s a bit of a pain to use Lighttpd for Streaming and apache for content serving. You either have to run the two on separate servers or use a non-standard port for Lighttpd. But that seems to be changing. I have come across a couple pseudo-streaming modules for Apache. One if for streaming FLV and the other is for streaming H264. Here’s some info on using both:

mod_flvx: http://flowplayer.org/forum/5/14679

mod_h264: http://h264.code-shop.com/trac/wiki/Mod-H264-Streaming-Apache-Version2

I have compiled the mod_flvx into Apache, but I have yet to try it out in production. I am excited about the h.264 streaming. My biggest complaint with using FLV files converted with ffmpeg is the low quality compared to vp6 encoded FLV files. ffmpeg doesn’t support vp6 given that it’s a commercial codec. But  h.264 is comparable in quality to vp6, making it an attractive alternative.

Flushing DNS Cache

Posted by Sheldon Finlay on February 04, 2009

If you work with web sites, DNS, etc. and have to make regular DNS changes, it can often take a while for DNS changes to propagate. So you can either wait the 12 – 24 that it takes for your computer to refresh, or you can try and force a refresh by clearing your local DNS cache. It doesn’t always work, mind you.

If you are using Mac OS X, you can try:

dscacheutil -flushcache

Or if you use Windows you can try:

winipcfg /flushdns

You may need to restart your browser or which ever application you are trying to access the site with.

Errors While Installing MySQL Gem 1

Posted by Sheldon Finlay on February 04, 2009

I was installing the MySQL ruby gem this evening and ran into some errors. After some hunting around I found the solution:

gem install mysql -- --with-mysql-config=/usr/lib/mysql/mysql_config

Here’s the errors I was getting hit with. Hope this helps others who might encounter a similar problem.

Building native extensions.  This could take a while...
ERROR:  Error installing mysql:
        ERROR: Failed to build gem native extension.

/opt/ruby-enterprise-1.8.6-20090201/bin/ruby extconf.rb install mysql
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lm... yes
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lz... yes
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lsocket... no
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lnsl... yes
checking for mysql_query() in -lmysqlclient... no
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers.  Check the mkmf.log file for more
details.  You may need configuration options.

Provided configuration options:
        --with-opt-dir
        --without-opt-dir
        --with-opt-include
        --without-opt-include=${opt-dir}/include
        --with-opt-lib
        --without-opt-lib=${opt-dir}/lib
        --with-make-prog
        --without-make-prog
        --srcdir=.
        --curdir
        --ruby=/opt/ruby-enterprise-1.8.6-20090201/bin/ruby
        --with-mysql-config
        --without-mysql-config
        --with-mysql-dir
        --without-mysql-dir
        --with-mysql-include
        --without-mysql-include=${mysql-dir}/include
        --with-mysql-lib
        --without-mysql-lib=${mysql-dir}/lib
        --with-mysqlclientlib
        --without-mysqlclientlib
        --with-mlib
        --without-mlib
        --with-mysqlclientlib
        --without-mysqlclientlib
        --with-zlib
        --without-zlib
        --with-mysqlclientlib
        --without-mysqlclientlib
        --with-socketlib
        --without-socketlib
        --with-mysqlclientlib
        --without-mysqlclientlib
        --with-nsllib
        --without-nsllib
        --with-mysqlclientlib
        --without-mysqlclientlib

Gem files will remain installed in /opt/ruby-enterprise-1.8.6-20090201/lib/ruby/gems/1.8/gems/mysql-2.7 for inspection.
Results logged to /opt/ruby-enterprise-1.8.6-20090201/lib/ruby/gems/1.8/gems/mysql-2.7/gem_make.out