Week Lessons 3

Mercurial Bookmarks

If one bookmaker is a direct decedent of another bookmaker, it is not possible to use hg merge between the two, since mercurial does not have a fast-forward option like git. The solution is to simply, update. Do note that it seems impossible to update to a bookmark that is half way through the tree. There is great stack overflow question and answer about this.


page gave a 500 error logs said SuspiciousOperation error. access was denied to file

problem was css compressor if more then 1 file was compressed. Reason was a bad media_root setting

Mixed content

iFrame https in a http parent does not qualify but this is good to know - Mozilla blog post

Check in js if in iFrame

Window top === window self

Django timestamp field

See code

Week Lesson 1

Every week there are lot of small things I pick up that I think will be useful to remember, so I decided to start a weekly post with just such things. This is the first entry in the series.

Positioning the jQueryUI Dialog

when opening a jQuery UI dialog the position could be given as specified in the api. The short version is, you can give what part of the dialog is positioned relative to what part of which element. Quite nice and readable. giving the dict as the position entry in the dialog definition call will associate that position dict with the dialog element.

Firefox and css Sprites

Using css sprites relies on the usage of the background-position style property. When properly built, adding hover changes can be achieved by just altering the x or the y axe. I find this to be very elegant. This can be done using the background-position--x and background-position-y properties. Unfortunately, as of today, Firefox does not support x and y background position properties. So its back to x and y for hover effects until mozilla adds it.

MySQL foreign key constrain

When adding a foreign key constrain, it seems that both tables need to have the same engine. I was trying to add a constrain and it kept failing. I had no idea why till I came across a stack overflow question, where the answer specifies the engine should be the same. Mine weren't. Making them the same solved my problems.

jQuery animation problem in ie7

For one of our projects, I was creating a photo bar. When the mouse was over one of the photos it was ment to increase in size and decrease back to original size when the mouse left. Unfortunately the client for which this was developed uses ie7 exclusively. This has brought two problems: 1. ie7 does not support the mouseleave event. I needed to replace it with mouseout event. 2. ie7 does not accept the position property in the jQuery animate function. Giving the position as a parameter will cause an error.

Namespacing and setTimeOut in Javascript

It is good practice to put all of your javascript code in its own namespace. When doing so in combination with setTimeOut timer function it is important to remember that the object evoking the function will be the DOM window and not your namespace object. Therefore it is needed to add the namespace before the name of the function called.

Adventures in Django

For a while my django project was set aside for other things. Last week I got around to continue working on it. I have made a lot of progress and learned quite a lot so I figured it was time for an update post. First and foremost a beta version of the site is already online. I dont know if I wrote about what it actually does so I'll start with that. Its a web application developed for something me and my friends were missing. As a group we go on weekends away quite often. Mostly climbing, mountan biking sonwoboarding or hiking. At the end of every such weekend someone always needs to sit down and calculate exactly how much each person payed and so caulcuate who needs to pay back who. I figured it was time to be away with that, and I made "tripcalc" which is ment to slove that. Everyone who payed something just fill it in and the web app does the math and sends emails to people to let them know who they need to pay to, or who are they getting money from. There were a lot of design desicions I made which I am not sure if they were right or not, but that is for another post. This one is about django, jQuery and deployment. Django has really been a wonderful experience for me. There is rarely a day in which I don't go "Wow that is just great, It can actually do that?!". There are a lot of wonderful things in that framework. So with that say, let me get started.