Posts Tagged ‘coding’

Script to proxy git and svn protocols via http proxy

Monday, August 31st, 2009

In work I’ve discovered a number of problems when accessing open source code repositories that are using SVN or GIT. Attempts to access a number of repositories just fails with a connection failed message.

After some time of getting these, and finding some repositories working, I noticed that the common attribute for those repo’s that were accessible, was that they were via http. Now that might be fine, but there is a reason for the repositories to have their own protocols, in that they are tuned to be more efficient at transferring the necessary information. In addition not all sites make the repositories available over http in additional to the native format.

Obviously the core problem here is with the corporate firewall blocking outbound requests over certain ports. Perfectly understandable, but sometimes just a little unhelpful when you need to be able to access various upstream repositories when working with open source to check for bug fixes in the code.

After several problems in accessing some git repos that didn’t have http equivalents I did some searching and found the following website http://www.emilsit.net/blog/archives/how-to-use-the-git-protocol-through-a-http-connect-proxy/ which described how you could use socat to create a tunnel that allowed access to git repositories without having to find one that permitted access over http.

(more…)

HTML Templating in PHP

Wednesday, January 9th, 2008

Have been meaning to try this out for a while now, basically because once you get the html code separated out from the PHP it becomes much easier to see what’s going on and change the style and layout of the web pages.

Easier because the PHP scripts basically become shorter, and changing the layout of a few variable place holders in html files is a damn sight easier than moving about chunks of code.

Current template code I’ve been using is from the PEAR project, http://pear.php.net/package/HTML_Template_PHPLIB, which is similar to the PHPLIB implementation. There were a number of other implementations available at the same time, but this appeared to be the easiest to use besides IT, http://pear.php.net/package/HTML_Template_IT, which is in fact broken.

Smarty and Flexy appear to be two other template engines that may prove interesting for use with PHP if I ever work on any other more extensive web development projects.

Buggy Quotes in wine’s CreateProcessW

Sunday, December 2nd, 2007

Well after a great deal of exploration, I isolated a bug in wine’s CreateProcessW function that results in a invalid argv being sent to target programs in certain cases.

This was interesting since it was my first real foray into the wine code base, and showed that printf is still very much the staple of any coders debugging diet :) .

If the wine project is of any interest to you, go ahead and have a look at bug 10618 , it shows that even without a good knowledge of a large projects code base, you can still learn and debug a fairly well hidden bug if you are willing to just follow through.

Next steps are to write some conformance tests to confirm what the correct behaviour on Windows actually is. This appears to be a corner case bug, and it will be interesting to see how Windows decides if it has reached an escaped quote or a quote preceded by a slash. Yes there is a difference :) .

However before I start submitting patches, I need to make sure that my employer signs off on me sending code into this project provided I work on my own time. It’s an important check for anyone to do, otherwise you could find both the project and yourself on the wrong side of a legal suit.

Coding for Wine

Monday, November 26th, 2007

Last week I decided it was time to bite the bullet and try and dig into the code for wine , something I’ve been putting off for a while because I felt I didn’t understand the code well enough to do anything. Well I decided the only way I was ever going to understand it, was to try and fix a bug.

So I tackled my first wine bug :)

Bug 9628 was my first target. If for no other reason except that I’ve prior experience working with msi’s, and I felt at least I had a basic understanding of how the windows installer should work. Even if I don’t quite follow the mountain of code that is behind all of it.

Anyway as luck would have it, it appears that this bug occurred because someone reverted a change that had been made previously to use the standard command line parsing code instead of custom code. The reason? Because going to the standard code broken the Excel Viewer 2003 installer! Hmm, really, that seemed very odd, since it appeared to be parsing the command line of the RPG Maker just fine. A little testing later and I discover that it appears that the command line chunking to deal with the different arguments when Excel Viewer is being installed is an absolute mess, and the reason why? Well the command line arguments get completely messed up in being passed to wine’s msiexec in the first place.

I really had to wonder why this was never looked at closely before? Guess no one really had the time or really cared, but at least it left a nice easy bug for me to start with, or so I thought. Apparently the bug is somewhere between the function call CreateProcessW, which is used to kick off any exe called in wine (well in windows too, since wine is just another implementation of the windows API), and msiexec receiving the command line. Right now this is proving beyond my abilities to debug, basically because I haven’t worked out how the code works, and I know that since this is down in the server part of the code for wine, it tends to be a bit more challenging to grasp due to amount of things going on in one place.

Right now I’ve had to settle for emailing the devel list and hoping someone can help prod me in the right direction. In the mean time I think its time to move on and try the next bug :) . Besides I’ve already given them a decent bit of investigation which should help someone more experienced in that area to fix the bug.

Roll on the next bug, just maybe I’ll be able to actually fix that one…

Wine Is Not an Emulator

Friday, November 16th, 2007

If you’re a linux user, and you still want to use windows software, you will most likely have already come across this piece of software. I’ve been following its progress via the devel mailing list for the last couple of years, although I’ve yet to contribute anything more than the odd bug report or adding entries to its application compatibility database. Still its progress has been very impressive and it is getting to the stage that I almost expect that most windows software I find should have a decent chance of working with it. The exceptions of course being recent games which can just put too much of a strain on system resources to be of any real enjoyment.

That all said, I would like to try and get more involved with the coding, since it would be easy to then fix the bugs that bug me. It’s such a vast project that it seems almost impossible unless you have a great deal of experience to be able to work out what is likely to be a simple bug to get started with.