15
Nov

I recently purchased a MySQL Amazon RDS Instance and noticed that the default timezone for the database is set to UTC. From the research I did online, I found that the value could be easily changed on a per-connection or session basis (requiring a modification of the client code) but to change it permanentely on the server side was not really possible or had major flaws. I eventually came across this blog post: http://www.parhasard.net/entry/2011/07/06/17:37/ that gives a really simple and elegant server side solution to the problem and I hope it will eventually help someone else too!

You need to create the following stored procedure in your default database named “mysql”, it does not need to be created into subsequent databases:


DELIMITER |
CREATE PROCEDURE mysql.store_time_zone ()
IF NOT (POSITION('rdsadmin@' IN CURRENT_USER()) = 1) THEN
SET SESSION time_zone = 'America/Montreal';
END IF |
DELIMITER ;

The “America/Montreal” can obviously be modified to whichever timezone suits your needs. You then need to customize the parameter group used by your RDS instance so that it executes the previously defined stored procedure on new connections like so (replace “PARAMGROUP” by the name of the param group used by your instance):


$ rds-modify-db-parameter-group PARAMGROUP --parameters "name=init_connect, value='CALL mysql.store_time_zone', method=immediate"

You can then make sure that the changes were applied using (replace “PARAMGROUP” by the name of the param group used by your instance):


$ rds-describe-db-parameters PARAMGROUP --source=User
DBPARAMETER Parameter Name Parameter Value Source Data Type Apply Type Is Modifiable
DBPARAMETER init_connect CALL mysql.store_time_zone user string dynamic true
$

Do not forget to allow whoever will be connecting to the database permission to execute the stored procedure! Forgetting to do so will result in various errors like “MySQL Server has gone away”. You can grant such permission by executing:


GRANT EXECUTE ON PROCEDURE `mysql`.`store_time_zone` TO 'some_user'@'some_host';

This fix is similar to one I have seen online that asks you to put “SET time_zone = ‘America/Montreal’” directly inside the init_connect parameter. That solution was not working well because it caused connections to hang after an instance restart, most likely caused by the fact that the generic “rdsadmin” user is using UTC dates for some reason.

, , , , ,

10
Mar

Came across a very interesting article about building and using Neural Networks in PHP.

The package included in the article also lets you interface with the neural system using an API and a Key to access a specific system that was setup.

The article can be found here.

, , , , , , ,

23
Feb
XKCD - Devotion to duty

XKCD - Devotion to duty

Source: http://xkcd.com/705/

, , , ,

16
Dec

Found an interesting presentation online that talks about Google’s Gmail service quota.

http://www.slideshare.net/kuchmuch/gmails-quota-secrets

Enjoy,

Marc

22
Oct

Hey!

You want to learn to fly an RC helicopter and do all these crazy 3d acrobatics?

Hold right there… you will need time and a lot of concentration before you can even keep your helicopter off the ground without crashing. A lot of people will buy a helicopter, crash it, get discouraged and next thing you know it is in a basement somewhere and chances that it will ever fly again are usually very low.

Over 50% of all single rotor hobby grade RC helicopters sold to and built by first time fliers end up crashing in the first few minutes of their maiden flight.

Here is a very good website that will show you what to buy, where and how to start: http://www.rchelicopterfun.com/how-to-fly-rc-helicopters.html remember to take your time through the exercices, it is possible to learn how to fly these without crashing once. Your main goal should be to bring your helicopter back home in one piece after each session.

Cheers,

Marc

, , , , , , , , ,

18
Oct

Without any warning my computer restarted by itself and upon seeing the Windows XP load screen, I saw a glimpse of a blue screen of death. Right there the boot loop started.

By starting windows in safe mode I determined that the SPTD.SYS driver was the last thing windows was loading before crashing miserably. SPTD.SYS is used by a few softwares like Alcohol 120% and Daemon Tools.

Here is what I did so that I could at least start my computer and start backing up files:

  • I booted the computer using a BartPE boot cd
  • Clicked on “Go” then on “Command Prompt (CMD)”
  • In the black “Command Prompt” type:
    • c: <enter>
    • cd c:\windows\system32\drivers <enter>
    • rename sptd.sys sptd.bak <enter>
    • exit <enter>
  • Then click on “Go” followed by “Shut down” and to finish “Shut down”

Started windows again and the boot process went all the way to a login screen. The problem is not really fixed at this point, what I did was only a patch so that I could start windows again, daemon tools is currently showing an error message upon boot saying that sptd.sys is required to start.

I then tried to install a new version of the sptd.sys driver from http://www.duplexsecure.com/downloads/ however this did not work, upon restarting the maching I was caught in the same error loop as before and had to deactivate sptd.sys again.

Still looking for a permanent solution, note that this problem started occuring “out of nowhere” without any software update or new software installation.

, , , , , , , , ,

13
Oct

Still practicing with my Blueray 450 PE RC Helicopter, working on the hover but things are looking good, will likely start nose in flight sometime soon.

, , , , , , , , , ,

10
Oct

My first CNC project will likely be my nCode logo, I generated the g-code and made a dry run video

, , , , , , , , , , , , ,

10
Oct

First video of the CNC machine in action!
More to come:)

, , , , , , , , , ,

  • Search:
  • Recent Posts

  • Meta

  • Tags