I’ve got a system setup which uses Firefox on an Ubuntu machine, with the Selenium RC server (remote control). I had a set of scripts which would run automatically every 15 minutes, which would prompt Firefox to open and go to the site and submit certain forms. This stopped working after I ran an update on some packages in my Ubuntu machine (9.04 Jaunty).
After upgrading to Snow Leopard, and trying to run ‘rake db:migrate’, I received this error once. This seems common to others which have upgraded, especially back when Snow Leopard was released in August of 2009:
rake aborted!
uninitialized constant MysqlCompat::MysqlRes
(See full trace by running task with --trace)
I’ve tried to troubleshoot by reinstalling the MySQL gem, and the 64 bit version of the MySQL server. I’m no longer receiving this error above.
When installing the MySQL Gem, I receive a bunch of errors, unless I specify to not install documentation.
$ sudo env ARCHFLAGS="-arch x86_64" gem install mysql -- --with-mysql-config=/opt/local/lib/mysql5/bin/mysql_config
Building native extensions. This could take a while...
Successfully installed mysql-2.8.1
1 gem installed
Installing ri documentation for mysql-2.8.1...
No definition for next_result
No definition for field_name
No definition for field_table
No definition for field_def
No definition for field_type
No definition for field_length
No definition for field_max_length
No definition for field_flags
No definition for field_decimals
No definition for time_inspect
No definition for time_to_s
No definition for time_get_year
No definition for time_get_month
No definition for time_get_day
No definition for time_get_hour
No definition for time_get_minute
No definition for time_get_second
No definition for time_get_neg
No definition for time_get_second_part
No definition for time_set_year
No definition for time_set_month
No definition for time_set_day
No definition for time_set_hour
No definition for time_set_minute
No definition for time_set_second
No definition for time_set_neg
No definition for time_set_second_part
No definition for time_equal
No definition for error_errno
No definition for error_sqlstate
Installing RDoc documentation for mysql-2.8.1...
No definition for next_result
No definition for field_name
No definition for field_table
No definition for field_def
No definition for field_type
No definition for field_length
No definition for field_max_length
No definition for field_flags
No definition for field_decimals
No definition for time_inspect
No definition for time_to_s
No definition for time_get_year
No definition for time_get_month
No definition for time_get_day
No definition for time_get_hour
No definition for time_get_minute
No definition for time_get_second
No definition for time_get_neg
No definition for time_get_second_part
No definition for time_set_year
No definition for time_set_month
No definition for time_set_day
No definition for time_set_hour
No definition for time_set_minute
No definition for time_set_second
No definition for time_set_neg
No definition for time_set_second_part
No definition for time_equal
No definition for error_errno
No definition for error_sqlstate
I’ve realized that these errors don’t occur if you try to install without documentation included.
$ sudo env ARCHFLAGS="-arch x86_64" gem install mysql --no-ri --no-rdoc -- --with-mysql-config=/opt/local/lib/mysql5/bin/mysql_config
Building native extensions. This could take a while...
Successfully installed mysql-2.8.1
1 gem installed
I doubted if this really was a successful installation due to the errors when including the documentation, but this isn’t the case.
You’ll notice that I’m running MySQL from the installation location in /opt/local/lib/mysql5/. This is because I’m using MacPorts, and I definitely do not want to try to run from a mixed environment with some executables and gems being installed under my system folders and library locations, and others under the location of the folders where MacPorts installs these things. Why? Because I read that some people have had problems with 32 bit versions of some libraries and executables still being installed and this causing dependency conflicts. I’m needing certain packages provided by MacPorts, so I’m trying to ensure that my entire environment is based on MacPort packages.
I’ve completely uninstalled all the gems I had installed. I’m only working on one new project, so luckily I have no dependencies on all these old gems. I even removed all the gems which came with the system by default. Now all the gems are installed based on the MacPorts version of Ruby I’m running.
When I run a migration I still received an error. I doubted that the MySQL gem is installed properly, but this I can’t be completely sure of. No one else has reported this error, so I’m really stuck.
$ rake db:migrate
(in /Users/jason/rj4)
rake aborted!
undefined method `ref' for ActiveSupport::Dependencies:Module
(See full trace by running task with --trace)
Finally I realized that this error was the result of some issue with the Devise gem which my co-worker installed for user authentication. I found this Google Groups posting about the same error.
I installed devise version 1.0.8 and this resolved the issue.
$ sudo gem install devise -v=1.0.8
Successfully installed devise-1.0.8
1 gem installed
Installing ri documentation for devise-1.0.8...
Installing RDoc documentation for devise-1.0.8...
$ rake db:migrate
(in /Users/jason/rj4)
rake aborted!
Unknown database 'rj4_development'
(See full trace by running task with --trace)
jason-imac:rj4 jason$ rake db:create
(in /Users/jason/rj4)
jason-imac:rj4 jason$ rake db:migrate
(in /Users/jason/rj4)
== CreateProperties: migrating ===============================================
-- create_table(:properties)
-> 0.0712s
== CreateProperties: migrated (0.0713s) ======================================
== CreateUsers: migrating ====================================================
-- create_table(:users)
-> 0.0967s
== CreateUsers: migrated (0.0969s) ===========================================
4) Once you’ve configured your deploy.rb, run this command to have it setup the directories on the remote server (releases, shared, logs, etc).
cap deploy:setup
5) Next run this command to get the list of other capistrano commands you can run:
cap -T
The output should look like
cap deploy # Deploys your project.
cap deploy:check # Test deployment dependencies.
cap deploy:cleanup # Clean up old releases.
cap deploy:cold # Deploys and starts a `cold' application.
cap deploy:migrate # Run the migrate rake task.
cap deploy:migrations # Deploy and run pending migrations.
cap deploy:pending # Displays the commits since your last deploy.
cap deploy:pending:diff # Displays the `diff' since your last deploy.
cap deploy:restart # Restarting mod_rails with restart.txt
cap deploy:rollback # Rolls back to a previous version and restarts.
cap deploy:rollback:code # Rolls back to the previously deployed version.
cap deploy:setup # Prepares one or more servers for deployment.
cap deploy:start # start task is a no-op with mod_rails
cap deploy:stop # stop task is a no-op with mod_rails
cap deploy:symlink # Updates the symlink to the most recently deployed ...
cap deploy:update # Copies your project and updates the symlink.
cap deploy:update_code # Copies your project to the remote servers.
cap deploy:upload # Copy files to the currently deployed version.
cap deploy:web:disable # Present a maintenance page to visitors.
cap deploy:web:enable # Makes the application web-accessible again.
cap invoke # Invoke a single command on the remote servers.
cap shell # Begin an interactive Capistrano session.
If you’re wanting to know which Rake tasks are available for you to use from the command line, simply use this command:
rake -T
It will output a list of options, here are the first few I was shown:
rake db:abort_if_pending_migrations # Raises an error if there are pending migrations
rake db:charset # Retrieves the charset for the current environment's database
rake db:collation # Retrieves the collation for the current environment's database
rake db:create # Create the database defined in config/database.yml for the current RAILS_ENV
rake db:create:all # Create all the local databases defined in config/database.yml
rake db:drop # Drops the database for the current RAILS_ENV
rake db:drop:all # Drops all the local databases defined in config/database.yml
A really useful one is the ‘routes’ option which outputs a list of the routes configured.
macbook:railsproject jason$ rake routes
(in /Users/jason/railsproject)
/:controller/:action/:id
/:controller/:action/:id(.:format)
I’m setting up a new Ruby on Rails application, and tried to run the first migration for the creation of the new database. This failed because I didn’t have the MySQL gem installed. I’m using a 64 bit processor (Intel Core 2 Duo) so I installed the 64 bit MySQL for 10.5.8 (Leopard, I haven’t upgraded to Snow Leopard yet).
When trying to run the installation command I received an error:
$ sudo gem install mysql
Password:
Building native extensions. This could take a while...
ERROR: Error installing mysql:
ERROR: Failed to build gem native extension.
/opt/local/bin/ruby extconf.rb
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... no
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lmygcc... no
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.
I looked online for a solution to this, and found that you have to point to the directory where MySQL is installed. I tried:
sudo gem install mysql -- --with-mysql-dir=/usr/local/mysql
This resulted in this error instead:
Building native extensions. This could take a while...
ERROR: Error installing mysql:
ERROR: Failed to build gem native extension.
/opt/local/bin/ruby extconf.rb --with-mysql-dir=/usr/local/mysql
checking for mysql_ssl_set()... no
checking for rb_str_set_len()... no
checking for rb_thread_start_timer()... no
checking for mysql.h... no
checking for mysql/mysql.h... 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.
Since the error is reporting that it can’t find mysql.h (header file), I take it that the MySQL installer didn’t include the header files. From the command line if I go to /usr/local/mysql/include I see the mysql.h right in there.
I removed the preference panel option by opening the System Preferences, then holding CTRL and clicking on the MySQL option. This gave me an option to click on to remove it. I then deleted /usr/local/mysql and /usr/local/mysql-5.1.48-osx10.5-x86_64
Someone else mentioned something about using the 32-bit version of MySQL, so I downloaded it and installed it instead (hoping it doesn’t conflict with the processor I’m using). It installed and started up just fine. I ran the command to install the MySQL Gem again:
$ sudo gem install mysql -- --with-mysql-dir=/usr/local/mysql
uilding native extensions. This could take a while...
Successfully installed mysql-2.8.1
1 gem installed
Installing ri documentation for mysql-2.8.1...
No definition for next_result
No definition for field_name
.
.
.
No definition for error_sqlstate
Installing RDoc documentation for mysql-2.8.1...
No definition for next_result
No definition for field_name
.
.
.
No definition for error_sqlstate
A friend of mine posted a link to part 1 of this video (this is part 2), which is an interview with Ayn Rand and Phil Donahue. He asks her if she is an athiest, to which she replied “Yes.”. Phil did a tisk tisk noise, and she responded “I could do the same to you, you know?”, which followed with laugher.
Phil: You don’t approve of religion because?
Ayn: Because it’s mystical, because it’s based on faith. Not on reason and facts.
This made me think…I still to this day, using my own mind, do not hold things to be true based on arbitrary assertion. Typically when someone says they have ‘faith’, they have a belief in an arbitrary assertion. This is dangerous. Very dangerous.
But if a person doesn’t know something to be true, yet has enough experience or knowledge that they can trust that something might be true…this can be called ‘faith’, of which I can say I have regarding there being more to life than…well the pursuit of material gain, or satisfying sexual urges. I have faith that I can somehow attain the same sense of life I once had when I was in my youth. The same feeling of freedom, joy, and interest in the mystery of the world, instead of being a tired old curmudgeon that see’s the world as a big math problem that has been mostly solved, where the honest and humble are trampled and left in the dust of the cut throat.
Note: Something anyone must understand about Ayn Rand is her history. She came from Soviet Russia where the majority supported forced altruism, where you had no choice, the government was going to take your money and everything you owned for the “good of the people” as a whole (collectivism). She is not against private charity, or your personal decision to help those in need. She’s against any sacrifice by force/coercion.
The Mystic
I want to further clarify something I learned from Howdie Mickoski recently. I used to think that mysticism was the result of men trying to explain the universe they did not truly understand, only to create a sense of security for themselves in the universe, or to explain what happens to us after we die (out of fear of an unavoidable non-existence). I myself would rather accept a point of non-existence rather than lie to myself with some story of a “Christian” heaven.
Ancient schools known as ‘mystery schools’ were created to teach the ways of attaining this knowing of that which is beyond our mental reasoning/conceptual capacity. It is not because they wanted to be secretive that they are called ‘mystery’ schools, but because of the nature of what is taught that ‘mystery’ is the word used. “Mystery” is related to the Greek word ‘Myein‘.
"A mystic is one who searches for the answers to such questions as who am I, what am I, what is God, or what is the universe? They seek out these answers through acquired knowledge, personal experience, and altered states of consciousness where they attempt to reach the truths beyond the physical world. The experience of mysticism is beyond words. It can never be explained, but the explanations entice others to follow a similar path and experience similar beauty. Mysticism is not religion, yet at the heart of all religion is mysticism. It is not concerned with beliefs, doctrines or rules, but knowing, love, and the realization of a deeper reality.
A mystic is one who searches for the answers to such questions as who am I, what am I, what is God, or what is the universe? They seek out these answers through acquired knowledge, personal experience, and altered states of consciousness where they attempt to reach the truths beyond the physical world. The experience of mysticism is beyond words. It can never be explained, but the explanations entice others to follow a similar path and experience similar beauty. Mysticism is not religion, yet at the heart of all religion is mysticism. It is not concerned with beliefs, doctrines or rules, but knowing, love, and the realization of a deeper reality."
Okay. I’ve worked on making a WordPress plugin once. It’s pretty easy to make a plugin which replaces a tag such as [another-plugin-tag parameter="value"] with some sort of other HTML code. For instance it’s pretty straight forward to replace [iframe http://www.google.com/ 800 600] with an iframe tag.
Something I’ve found difficult to find however is how you can create custom pages as soon as the plugin is activated, which are accessible using a permalink such as http://www.wordpress-site.com/myplugin/search/ which can submit a form to another URL such as http://www.wordpress-site.com/myplugin/results/ and then provide the results with a URL such as http://www.wordpress-site.com/myplugin/results/id/3/ or anything else pretty like that.
And I’m not talking about searching for posts or pages or anything. I’m talking about extending WordPress to have functionality which is not blog related, while still being a plugin.
I installed the ‘Contact Form 7′ plugin to see how it submitted the form, and then I realized it uses Ajax. Great. I don’t want Ajax.
A Hint of a Solution
I searched online looking for something to explain this, because certainly someone else must have been scratching their head like I have. No guides seemed to explain this to me. I’d search for ‘WordPress plugin permalinks’ and I’d only find plugins that deal with permalinks somehow (not what I was looking for).
And I was ignoring all the documentation on hooks and filters, because I don’t want to filter normal blog content, or hook to some blog content. But I was mistaken. I do want to hook a function to something. It turns out that WordPress has a number of actions which it goes through when loading a normal page, available by name in the Plugin API Action Reference page.
At some point of the page loading the permalink style URL, which is basically made possible by a mod_rewrite rule which says that any address is processed by index.php. The WordPress system determines if the URL relates to a page or post or something, or otherwise provides a 404 style error. Okay, so if I can somehow tell WordPress – “Yes! There is a /myplugin/ page”, or “Yes! There is a /myplugin/results/” page, then I’ll have one step of my solution finished.
After further researching I found that there is an article on how WordPress processes a request, and it even mentions GET and POST submissions. This was also obviously hard because ‘post’ is the term used to refer to the blog post records, so a search on Google for ‘WordPress post request’ didn’t return something relevant.
To Be Continued
I’m going to continue to investigate how to build the type of plugin which provides custom URL’s, without requiring the existence of pages for these URLs, and also somehow block the creation of pages which use the permalink structure used by the plugin.
People warned me to not buy a bicycle from Walmart, but I needed a bike and didn’t have the money for a $300+ bicycle at the time. Shortly after purchasing the bike I had to replace the freewheel after it got locked up. Huffy did ship the replacement freewheel to me at no additional charge because the bike was under warranty, however Walmart isn’t a real bike shop which does adjustments and repairs, so I had to arrange for help in getting the old freewheel off and the new one on.
More recently the chain started to come off, and I’d have to put it back on getting my hand all dirty and greasy, and avoid certain gear combinations so it didn’t continue to happen. I figured it just needed to be adjusted or something, so I took it into a local co-operative bike shop – Missing Link. At first the girl who looked at the bike noticed that the cable for one of the derailers was very loose, and that I’d need to make an appointment for them to check it further. I did this and brought it in the following Thursday. Another guy looked at it more thoroughly to draw up an estimate for me. He pointed out that the chain was coming off because the crankset was bent, and that they could try to bend it back. He also pointed out that the foot pedals were shot, the bearings on the back wheel seem to be going. He estimated between $80 – $120 to get it in better condition. I didn’t want to do this, and then have to shell out more again due to other issues which would crop up after another 2 months of riding.
I decided to go to their retail shop (across the street from their repair shop), and check out my other options. I ended up buying a Marin Larkspur hybrid, as I’m looking for a good street commuter bike to get me around until my Isuzu Rodeo is repaired (after I save up approx. $2000). They recommended that I get something with strong wheels such as this model. I’m a pretty heavy guy, so strong wheels it is.
I ended up paying $460 for the bike, and then re-investing into a new rack for the back, a solid U-Lock (instead of a cable lock), and front and rear lights for night time riding. I would have used the other lights I bought from Walmart, but they broke from the tension I put on them mounting them to the new bike. It doesn’t matter anyway. The new lights mount properly and I can easily take them off when I part the bike somewhere, so they don’t get stolen.
I love my new bike. I like how I can bring it back to the bike shop and they’ll fix it up for the next year. Also I like knowing that the bike shouldn’t have any problems like the Huffy. Over the weekend I used the new bike to go do my laundry.
So anyway, I’ve been taking my new bike into work and parking it next to my old bike. I really need to get rid of the Huffy, but I’m not sure what to do with it. A friend of mine suggested that I take it into Walmart and ask for a refund, store credit, or something. I checked for the Walmart return policy online before I left and went all the way over to the Walmart in Oakland. The policy online, and at the store, does not state that bicycles are an exception. At the store it does cite that there are terms regarding certain electronics/computer items. The lady at the custom service desk told me that they will repair the bike, but do not accept returns if the bike has been used. I asked how I can get it fixed, she said the group of people which can fix the bicycles are not available tonight, but will be available tomorrow (I’m not available tomorrow night). I checked for signs back by the bicycles, and also around the custom service area, but nothing pointed out this exception in writing. I don’t have my receipt with me, so I decided to not try to fight it, because I’m sure they’d call me out on that technicality.
I still don’t want to go all the way back there just to be defeated, so here it is online for everyone to know. Walmart will not take back the low quality bicycle you buy from them. If you’re going to buy a bicycle from them, I hope you consider it expendable. I bought a $70 Roadmaster mountain bike from Walmart back in 2007/2008, and it had issues with the brakes, and other minor things, but it was only $70 so I figured you get what you pay for. I didn’t think that after only 2 months of riding a $150 Huffy that it would come to this. I’m going to just donate the Huffy to an organization or someone in need…. but I know now to tell others that seriously, if you want a bike…wait till you have enough money and buy a good one from a bike shop that will maintain and repair the bike…because a Walmart bike will only end up in the trash.
Just installed Logic Pro and used it for the first time. Garageband of course was kind of like training wheels for the program, but it’s a different beast than Garageband. But that’s a good thing.
Here is the first track I’ve produced.
Audio clip: Adobe Flash Player (version 9 or above) is required to play this audio clip. Download the latest version here. You also need to have JavaScript enabled in your browser.
Audio clip: Adobe Flash Player (version 9 or above) is required to play this audio clip. Download the latest version here. You also need to have JavaScript enabled in your browser.