General Crap

05 Jun 2005

Mac-mini adventures

I spent a few hours this weekend setting up a new mac-Mini in the bedroom. In general, the whole experience was pretty smooth, and I have considerably more faith that this computer will not become a maintainence nightmare, like the house's last remaining Windows box. The mini scores a few points on linux, for plugging in camera's and setting up sound etc. (but I expect it looses sorely in ability to compile stuff, given the literny of problems I've seen on mailing lists over the last year.)

One thing that did not impress me was Quicktime, while it cutely played movie trailers, It had quite a few problems with avi files.

a) came up with a message about unreadable format, and redirected me to a page listing 3rd party add-ons (without specifying which one I might need)
b) refused to go fullscreen..

Given the overal quality of the rest of OSX, these where rather disappointing. A quick SMS to a friend indicated that VLC was a better bet for AVI's... - he did suggest MS's media player, but keeping anything from MS, as far away as possible from this box, is the general plan..

A few other things installed very easily
  • NeoOffice/J (Open office for osx)
  • Firefox - Safari is cute, but not quite as polished as firefox.
The other bit that confused me totally was that it had no root account by default, you have to go through various steps to enable it.. - so now we have apt-get working, although what looks like a rather limited choice of applications..

Now to get ssh working so I can do compile tests with some of the php libraries..
Posted by Alan Knowles in General Crap | Add / View Comments()

05 Jan 2005

aspx, C#, mono and First Impressions

First Impressions matter, and today, I started with a blank piece of paper, and tried to port a very simple piece of code from PHP to aspx.

While you cant judge a book by it's cover, from today's experience, even reading the first few pages, was enough to make me wonder what all the fuss is with C# and ASPX, it appeared to be a poor joke in comparison to PHP.

I've hacked at C# projects before, having looked very heavily at mcs, and phpLex (a modification of csLex to generate php code). But I'd never really had any need to look at aspx. Today was a little different, a prototype I had thrown together for a project began being rebuilt in C# (dont ask why...)

The first part of the project was to get aspx + mono up and going on the debian box I was using. In general this was a matter of firing up synaptic, searching for asp.net and selecting install, and apply. There was a small issue that the default debian packages do not create a /var/www/.{cant remember the name} directory, and give it write permissions. I eventually spotted an error by starting xsp.exe manually with the verbose flag. (It would be better if xsp.exe install on debian defaulted to logging verbosely to /var/log/xsp.log)

Some of the impressions I got where from things that mono could improve on, others were a little more fundimental in terms of what at present appears to be questionable philosphy in C#, and maybe a lack of experience with aspx.

Having solved the missing directory issue, I went on to try out all the demo's that came with it, alot of these demostrate the web controls, but in general are good enough for a quick feel for the language.

I was a little perturbed by the examples of web controls, the first thing that came to mind was the template files which include <asp:input name="...."> tags would never render on a browser. It would be near impossible to send a file over to a designer and let them focus on the layout. I did like the way that the controls where available as objects (almost like DOM) to the page controller class, but there was a sense that the the base html template had to be altered far too much to enable this interaction with aspx. Ontop of this, although I'm sure it possible to avoid, I got the sense that you where running a HTML page, rather than an application that happened to render HTML. (most PHP I've done in the last year treats the HTML as a skin available to the application, and is nowhere near the page starting/running process). The example also showed only crude examples of including other files, so I'm left pondering if something as simple as a conditional include is even feasible.

But as I got my head around the task at hand, I began to see the other unusual decissions that appear to hamper productivity while developing in the language.

Class's for everything, looks like an ideal for OOP purists, but in reality, it turns simple tasks into a challenge of huge proportions, locating methods of unknown objects. The first task I set myself was sending a P3P header. Which I rather detoured into testing out sending a location header. A little googling / digging on the MSDN pages, and I discovered Response.sendHeaders(key,value). I tested this out on the page with the key=location, and tried to redirect to google.. - nothing happened.. (the browser go the header, but never redirected to anything).. A little further hunting revealed a Response.redirect() method. There was just something smelly about the idea that what should be simple, was made complex by an attempt to make it simple.

The next issue was dealing with cookies, It goes without saying that you need to know two things in PHP to deal with cookies - $_COOKIE (reading) and setcookie() (writing), in C#/aspx I had to deal with creating 2 objects to retrieve a potential cookie, I had to check it was not null, rather than just see if it was false (no native casting of null => false - eg. if (!mycookie) { .... }). and having begain to understand that I needed to use Request.cookies, I made a simple mistake of trying to use Request.cookies to save my new cookie. Again, the complexity of having Response and Request (which when skimming documentation, the difference is easily overlooked), appeared to be another case of trying to make something too simple, and yet adding complexity.

The one that really finished of the effort was looking at md5() - a nice PHP function that returns a string md5 representation of another string. While C# obviously has this, the amount of work required to do what should be a simple task appeared painful at best. Two different classes where needed , one to convert the string to a format that the md5() understood, the md5 one, then a foreach loop to read the bytes returned and convert them back to a nice string.

Along the way I also noticed a few other counter intuative behaviours, (along with one or two slightly cuter features).
  • Page exceptions without clear backtracing, and code reveal. (I think) when you try to assign values to asp form elements, that are not strings - I only got a exception, with little explaination..
  • Full Page Code reveals for some exceptions, with highlighting of the offending code. (something PHP turned off by default about 2 years ago due to security concerns). - Although it help alot to have it, I'd consider it a bigger problem in the wider picture.
  • Vague and often meaningless error messages. I decided to write a small function/method to do the md5 stuff, and defined the method
    public String qmd5(String in) {.....}
    I kept getting compile errors on the constructor so assumed it was something to do with String using the wrong case. - I eventually guessed that in might be a reserved word or something, and changed it to inStr and solved it..
The sense I walked away with today was that given this small taster, if scaled up to a larger application would mean that I would end up typing numerous variable types, and be using long object.method names for simple tasks continually, (or constantly writing simple methods to do obvious tasks. ). Constantly be fixing exceptions on typos, and trying to second guess the compiler. Probably taking up 3-4 times as much code, and not gaining any clarity of purpose in the code, compared to a project done in PHP..
Posted by Alan Knowles in General Crap | Add / View Comments()

03 Jan 2004

Happy New Year

Well, a belated New Year update to the blog, So it's more a summary of latest goings on.

Duncan & our Mono chat.

Duncan Mak, a good friend who works alot on Mono, came back to HK for his Christmas break, We had a good chat, given the fact I had to look after my two little monsters at the same time. Mono seems to be moving on really well, I did get a chance to discuss why I think Sterling and Thies idea of targeting Parrot was probably more sensible than .NET. - Basically for all the arguments about stack/register, the real problem comes down to the fact that when writing a opcode compiled language, it is essential to have the knowledge that you have some chance of adding Opcodes (as the ZE2 is now designed to do). The problem which is rather difficult to solve, is the fact that .NET has a specification, and at least 3 implementations. which makes adding opcodes, or native types very difficult. Where as although still complex, it is a matter of persuasion and tact, when you consider this for Parrot.

Marching for Democracy

If no-one noticed (like it was all over google news), Hong Kong had another huge March for Democracy on Jan 1st, I went down, and did the 2 hour walk. Although I failed to persuade my better half to join me 'Why should I sacrifice my holiday for this?', which is pretty fair considering how hard she has to work, just so we can survive. But I guess is also indicative of alot of people. The cause is good, they may agree with the motives, but when you get so little free time, it's a hard sell to get involved in improving Hong Kong (or just getting rid of incompetent rulers)

Looking after Kids.

Our helper went away for the holidays, leaving me to look after the kids, while it wasnt too bad, they are normally very helpfull around the house. (considering that they think doing the washing up is fun...). It was pretty devistating to any work that I needed to do. I just scraped enough time to finish the slides for the php cruise in march. But got well behind on email.
Posted by Alan Knowles in General Crap | Add / View Comments()

08 Nov 2003

Flying

Finally touched down back home after giving my talks in Frankfurt, which was a good conference, although not as busy as I would have liked. They perhaps need to promote the 'training aspect' more than the 'conference' to get more paying customers.

I gave my two talks ,one a bit too technical perhaps on compiler design, the other (was I think was well recieved) was as a step by step tutorial on Glade & PHP, and how to build quick GTK applications with only a few lines of code..

But whats a good blog without pointing out some of the odder parts of traveling around the world..

Frankfurt Airport

A reasonably OK airport, although a little oddly layed out for arrivals (eg. you wander through the departure area/ticketing area to get to baggage reclaim..).

But one absurdity really stuck out.. - kind of "do these guys have half a brain" questions, was Wireless Lan in the airport - there are nice dangling signs saying 'Wireless Zone'.. but there are two fundimental Problems.

a) There is no instructions on how to connect to it anywhere.. (do you need to sign up to something..)

b) There are no power sockets.. - If you have ever traveled with a portable, you know that only the new ones have batteries that last more than an hour, the rest of the human race has portables that need juice! - So the Wireless zone at frankfurt airport had no power sockets (and no users!!!)

I guess they didnt bother spending the huge amount of money on Customer research that Hong Kong Airport does (as I had 4 hong kong tourist/researchers come up and ask if I was a tourist and would answer some questions..).. I guess it's like an addiction, Hong Kong knows they have idiots' incharge of airports, so they are trying to cure it, buy employing people to spot the bleeding obvious (which will probably be ignored anyway). where as Frankfurt hasnt quite got that far yet..

Luhthansa Airlines

Last year I flew Emarites from Hong Kong to Frankfurt, it was pretty nasty due to the extra 3-4 hour stopover in Dubai, which basically meant I was travelling for 20 hours, including hanging around the departure halls. This year I got a bit smarter and managed to get a direct flight with Luhthansa.

While 12 hours is a bit more survivable, Luthansa is a bit of an antique airline when it comes to TransContinental Flying.. - No 'Personal Entertainment system'. Christ, Virgin Airlines did this 10 years ago, I was amazed that they hadn't caught on..

They have to realize that squeezing human beings into a space designed for sardines has very little in the way of pleasure (and their chairs are hard and pretty unbearable for a 12 hour flight). So In-flight Personal TV screens are there to make that slightly less painfull.

Oh well back in one piece, and looking ahead to my fight against Hong Kongs new smart ID card..



Posted by Alan Knowles in General Crap | Add / View Comments()
« prev page    (Page 2 of 2, totalling 14 entries)   

Follow us on