Archive for Programming

Django/Dojo Stammtisch in Berlin

For the second time Django enthusiasts are meeting in Berlin on Wednesday, the 15th April, 2009 at 19:30. Find all the details here. And since I will be in Berlin this time, I just simply redeclare this to “Django/Dojo Stammtisch” instead of just “Django Stammtisch” :-). I hope all the djangoers are ok with that (I requested permission in #django-de). It just makes things easier to also meet some dojo people in Berlin. I will also have some cool new dojango stuff to show off!
So if AJAX, JavaScript and Dojo people are around, it would be cool to meet you there and chat about what’s hot and how the beer is. Please add yourself to the attendees list on doodle. And thanks again to the Berlin djangoers for organizing this, I am looking forward to it.

I cross-posted this from the uxebu blog, please go there to comment on it.

Comments (3)

Learn from the dojo gurus

I am pretty excited, that we at uxebu got it managed to organize a dojo workshop with two of the dojo gurus. Actually it was Dylan’s idea, since he is doing a world trip and he suggested to have a workshop in Munich, since he is staying around for a while. It will be on the 7th and 8th of May 2009, and right after the next dojo.beer will take place, but that will still be announced separatly. First comes the dojo.wine this weekend and then … I am really excited about the next weeks.

So if you want to learn more JavaScript and especially dojo you should really come and join us at the workshop. Get your seat soon to still get one.
uxebu & SitePen - Dojo training in Europe, May 7th/8th

Comments (3)

dojo.wine() - another dojo.beer() just with wine

Together with Mayflower, we from uxebu are organizing the next dojo-event, this time it’s dojo.wine().
This time it will be in the Mayflower office in Würzburg (Germany) and we hope to see all people interested in JavaScript, AJAX and all the modern web stuff there.
As you can see in the following video we were a good number of people and had nice food!

dojo.beer(2) from Tobias von Klipstein on Vimeo.

Comments (2)

JavaScript: Multiline Replace

Actually I just wanted to replace everything before a certain line using regular expressions. I though that was really really simple. Yes it actually is with real regular expressions as python has them or other languages. But the subset that JavaScript provides just doesn’t support the multiline modifier.
I want:
"12
34"

replace everything before “4″ with nothing, including new lines! I finally want to have:
"4"

I tried some stuff, see some playin of mine here and the final result, that does the job.

>>> "12\n34".replace(/.*3/, "")
"12
4"
>>> "12\n34".replace(/.*3/gi, "")
"12
4"
>>> "12\n34".replace(/.*3/gim, "")
"12
4"
>>> "12\n34".replace(/[\r\n]*3/gim, “”)
“124″
>>> “12\n34″.replace(/[\s\S]*3/, “”) // This works!!!
“4″

All this is copied from Firebug, using Firefox 3.0.4.
Let me explain shortly \s is for all newline and whitespace characters and \S is for all non-whitespace chars. Perfect. That works.

Comments (10)

dojo.beer(2)

We from uxebu have organized the second dojo.beer and are happy to have won Mayflower to jump in sponsoring the location here in Munich, Germany. On friday the 5th december we will warm up with some dinner and some beer in some place here in Munich. The real thing will be on the 6th at the Mayflower office, doors will be opened at 12:00 and we are hoping for a lot of talks from various people, to see how the are using dojo and we are also hoping to have interesting talks providing some useful input and may be even new stuff to learn. Bring your laptop and let’s hack away. If you have something special you need to have solved there will be someone who can help, for sure. From beginners to experts everyone is welcome. You don’t know nothing about dojo yet, but are interested you are right at the dojo.beer. You are a long time dojo user and want to dive into the depths of dojo, you are also perfect at the dojo.beer. So let’s have a great time and join us at the dojo.beer().

Some selected topics will (hopefully) be: functional programming with dojo, i18n, dojango, dojo build, dojo+Adobe AIR, deft - the dojo experimental flex technology, dojo and Zend Framework and many more.

Find all the details here dojo.beer.mixxt.de.

Comments (6)

Nobody wants a naked Laptop!

My macbook suddenly feels naked without a dojo sticker. on TwitPic Make sure your Laptop doesn’t feel naked! You want a dojo sticker? Let’s meet at the next dojo.beer() and you will get one for sure! But please, don’t torture your Laptop :-) by not having one.
The picture was taken at lunch at the AIA 2008, which was a great event. We had a lot of fun and besides evangelizing for dojo we from uxebu tried to promote our AJAX+JavaScript services, hopefully successful.

Comments (1)

JavaScript browser war - great!

I love it when technologies evolve that fast, as the browsers in general currently do, it’s just awesome! After just having read about SquirrelFish Extreme and some comparison to the other engines, I am getting really excited about the future and the sure future for us at uxebu where we are working with all the browser technologies and we are glad to be in a field that close to the bleeding edge tech.
It’s not only that the JavaScript engines are competing (and JSON becomes native in IE8 and in Firefox). Also the development tools are coming strong, especially the article about the debugging capabilities of IE8 and the installation of IE8 in my virtual machine, to use the dev tools, really make the future of web development look awesome! The extra efforts that Firebug gains lately are another evidence for the awareness of just about everybody in this sector. Douglas Crockford’s excitment about an Opera option for delayed script execution points to another important topic on that front. Also the merging of WebForms into the HTML5 spec is really a milestone. This will really push the open web (podcast), wow …

(Just an article fill of links, but it is so exciting I have to tell people!)

Comments (48)

Customize admin for User model

Before django 1.0 I don’t remember that there was a way to customize how the admin renders the User overview. Fortunately 1.0 does allow it.
It took me a bit to figure out. After searching the web and the django docs I didn’t find it right away, so I tried the normal fallback: auto-completion (WingIDE does that really good).
Normally if you just define your own UserAdmin class in admin.py, like this:


class UserAdmin(admin.ModelAdmin):
    list_display = ('username', 'email', 'first_name', 'last_name', 'date_joined', 'last_login')
    search_fields = ['username', 'email']
admin.site.register(User, UserAdmin)

You get the following error when starting up the server:


django.contrib.admin.sites.AlreadyRegistered:
    The model User is already registered

Well, as I said, the auto-completion just made me come across it pretty quickly, and it is so logical. Simply unregister the admin class for User before redefining it :-).


class UserAdmin(admin.ModelAdmin):
    list_display = ('username', 'email', 'first_name', 'last_name', 'date_joined', 'last_login')
    search_fields = ['username', 'email']
admin.site.unregister(User)
admin.site.register(User, UserAdmin)

Done. Cool, ha?
Congrats to all the people behind Django 1.0, good stuff!

Comments (6)

Forward thinking, FTPlets

I mean he is one of the leading geeks, the inventor of Seaside, Avi Bryant I expect him to be forward thinking, his idea for FTPlets proves it ones more. I especially like this idea of using FTP for “doing things”, especially given the justification for it:

The idea isn’t to get Squeak to serve out the filesystem, but to have a way to use the FTP protocol as an interface to any data you want, in the same way that dynamic web servers let you use HTTP for applications far beyond serving static HTML files.

Well, it’s true we are actually using HTTP far beyond static file serving. So why not push the limits of FTP too?

Btw listen to the podcast with Avi Bryant, it makes you want to get your hands on seaside. Although it’s almost a year ago I listened to it, I didn’t get to it yet :-(.

Update: LOL, I just saw that this post is from 2005. It’s easy to impress me :-). But still a provoking idea. Let’s see what exists …

Comments

dojo+django = dojango (just released)

Finally we have released dojango. Well, to be honest it’s mostly Tobi’s work that dojango rocks as it does! Big thanks!
So if you are still looking for the right JavaScript toolkit to go with django then you are at the end of your search now. Use dojango! Dojango s

  • a reusable django app that provides dojo
  • easy dojo setup inside django
  • build an optimized dojo
  • some helper functions, i.e. JSON conversion
  • switch easily between different dojo versions.

You find the project homepage right here.

Comments (5)

Installing MySQLdb on Leopard

Thanks to Arne we got it done pretty quickly.

Comments (1)

Adobe Air Tour Europe stopped in Munich

Fortunately Tobias found out one day before that Adobe was touring with Air and coming to Munich. Adobe really had provided everything, from breakfast, drinks, lunch too I guess (we weren’t there) and beer afterwards (that we didn’t miss). It was really impressive. The talks were very Air focused, I liked the first one best, which gave an overview of what Adobe does and plans to do. One of the notable things was to see VoIP running inside a flash client, pretty nice. The Air stuff was just nothing too new and I see the main focus of using Air in running JavaScript+HTML apps inside it, so I was actually more interested in what is different to web apps in this concern. And Dion held a very nice overview talk about his employer’s latest product AppEngine, which was very interesting to see too, since I am a django addict too.
But anyways, besides my personal interests, I think Adobe had arranged a great event and the sessions had been very well received. Congrats Adobe. it was fun.
The best part for me was meeting with Dion Almaer the Ajaxian man, finally getting to know the person behind the voice, since I am an avid podcast listener I have heard all of the ajaxian podcasts too. If you ever have him near go and talk to him, a very nice person!
It was also nice talking to Andreas Ecker project lead of qooxdoo, he showed me what will be coming next in their new version. But you know, I am already married ;-). Even more interesting because we had been colleagues for a while last year.
And Adrian Ludwig from Adobe stopped me when he saw the “dojo” on my shirt and we talked some dojo+Air. Adobe is very interested in staying in touch with the AJAX community. It just simply seems that the Flash guys are coming across Air anyways, but the other potential users are all the AJAX devs. So I hooked him up with Nikolai right away, who I knew had been creating the nice Air demo over at dojocampus.

Comments (1)

The timeline for dojo meetup Berlin

The plan for May 31st, 2008 is

15:00 meet at Weltzeituhr, as mentioned on upcoming, more info and a pic see here. When you are on Alexanderplatz you should find this clock pretty quickly.

19:00 - 22:00 we will be in Las Olas
and afterwards go to some bar, club, whatever we find, if you didn’t make it to join us until 22:00 your chances are only to search all of Berlin’s nightlife. Or catch one of us in the IRC channel #dojo before and get a mobile phone number (our nicks are klipstein, nonken, mccain).

And I will have a couple of T-Shirts with me, so be prepared to get undressed :-)

see you

Comments (3)

Dojo + Zend Framework

Yeah, this is really really good news, for both worlds. I was following Zend Framework loosely but from a lot of friends in this scene I have heard that it is the rising star and quasi industry standard of PHP frameworks. And now the logical next step to join forces with dojo is just right. For those that have doubts, you can use any other JavaScript toolkit with it too, but why would you want :-).
Looking forward into the great future of server and client interaction!

Comments (1)

T-Shirts for dojo.meetup() in Berlin!

dojo shirt (front)If you are around Berlin May 31st 2008 (as already mentioned a couple of times), consider joining us dojo folks form Europe to just informally get together and chat about the latest and greatest while discovering Berlin and it’s nightlife (the upcoming link). And if you want to be well dressed, we can help you too!

dojo shirt (back)
The shirts are available with the Berlin-specific back-side, which says

dojo.meetup(
    "Berlin",
    "May 31, 2008"
);
dojo.beer();


And we have checked it a couple of times, there should be no errors in there :-).

You can buy

The shirts are really good quality as the print is too! They will last for a while, you can be sure.
And don’t forget to be there, in Berlin! We are looking forward to seeing you.
For all those coming to Berlin, I will have a couple with me.

Comments (1)

JavaScript: Sort object by a value

Actually the headline is not really what I want to say :-). But I don’t know any better yet.
I just want to write down how I solved sorting the following:

>>> var maxSpeed = {car:300, bike:60, motorbike:200, airplane:1000,
    helicopter:400, rocket:8*60*60}

This is a list of vehicles with their (approx.) max speeds. And now, I would like a list of the vehicles sorted by their max speed. This looks sooo easy, and actually it is :-). You just have to know how.
Look at this:

>>> var sortable = [];
>>> for (var vehicle in maxSpeed)
      sortable.push([vehicle, maxSpeed[vehicle]])
>>> sortable.sort(function(a, b) {return a[1] - b[1]})
[["bike", 60], ["motorbike", 200], ["car", 300],
["helicopter", 400], ["airplane", 1000], ["rocket", 28800]]

Since the sort function takes an extra argument, that allows to do your custom comparison we simply make sure that the right stuff gets compared, which is our speed. Unfortunately we can not sort the object directly, it has to be an array for doing so. But you can now convert it back, or just extract the vehicles, like so:

>>> dojo.require("dojox.lang.functional")
>>> vehiclesSortedBySpeed =
        dojox.lang.functional.map(sortable, function(i) {return i[0]})
["bike", "motorbike", "car", "helicopter", "airplane", "rocket"]

Didn’t I say it was easy?

Comments (8)

JavaScript: Remove element from Array

[UPDATE] Thanks to Joe and others hinting me to the danger of purely using indexOf() without a check for -1. Added it in the last example.

I mean it’s not the first time I am doing it, but it happens always again that I have to look up how exactly it works. And every time I know it is very easy.
So here is how to remove an element from an array, mainly for my poor brain, so it doesn’t have to remember anymore. Though I know, now that I wrote it down I will never forget it again.

DON’T
Unfortunately the most obvioous solution leaves a “hole” in the array :-(.

>>> var list = [4,5,6];
>>> delete list[1];
true
>>> list
[4, undefined, 6]

Sad, but understandable.

DO
So do it right and use splice().

>>> var list = [4,5,6];
>>> list.splice(1, 1); // Remove one element, returns the removed ones.
[5]
>>> list
[4, 6]

Useful DO
Actually, what I mostly need is: remove a certain value from an array.
I.e. I have some list of visible IDs and I want to remove one because it’s not visible anymore. So just extend the above example a bit.

>>> var visibleIds = [4,5,6];
>>> var idx = visibleIds.indexOf(5); // Find the index
>>> if(idx!=-1) visibleIds.splice(idx, 1); // Remove it if really found!
[5]
>>> visibleIds
[4, 6]

I hope I didn’t bore anyone with that :-)

Comments (58)

Dojo.cast()

Now there is already episode 2 out of the dojo podcast “from the guys” (I like when Pete says that).
There we are trying to discuss common topics, interesting things about and around dojo. If you want to join us, have comments, an interesting story to tell or alikes, just let us know and mail us at wolfram@dojotoolkit.org or contact us in the irc channel #dojo (just ping one of us: phiggins, nonken or mccain).
Have fun listening …

Comments

Using FileMerge.app with Mercurial

I was looking for a nice GUI for Mercurial (and there are some), which I basically want for seeing nicer diffs. After searching a while I did come across something. In the Mercurial wiki I then found Using FileMerge.app/opendiff as the diff program (OS X). Pooh that is much better now :-).

Commiting more often
During the couple hours I was using Mercurial without having a nice diff tool I realized, that the “merge often” strategy also helps a little here. And if I understodd this right, that is the usual way when working with a distributed version control system, which also implies why they have to be faster in doing their operations.
If you just commit much sooner, say after you have finished a bigger train of thought (the drcs-way, if I got that right), instead of after having the entire task done (my usual svn way), then you also don’t need the diff tool that often. I am still used to diffing before every commit and just making sure I left no debug stuff in there and simply to be confident about the checkin. May be this is a bit old-fashioned and I should just really double-check by inspecting the diffs thouroughly when the before mentioned big task is done and I want to push it back to the incoming repositiory or distribute it in some other way.

My way to the distributed version control systems
After having ignored the distributed version control systems for a while I finally started using them, when the number of parallel patches and changes just overwhelmed me. And I realized it to be especially helpful when the revision control system that the client is using is not reachable over the web, just via intranet and you still have to work in some other place and want to checkin at times.
Actually I was interested in this stuff already for a while and first heard about it from Jan in 2006 (he suggested svk, by then I completely rejected the idea, because I didn’t see the necessity I guess) and some time later I got reminded of it again when I saw the much talked about video from Linus Torvald’s talk about git (which in some parts I find a bit too bold).
And finally today when I was listening to Scott Hanselman’s excellent show (excellent as usual, great job Scott, you are so enduring and have always interesting shows, keep it up) Distributed Source Control with Git all barriers finally came down and I have fully fallen for it.

Welcome to the real world

Comments

Dojo summer of code projects

I have just seen that there are some nice things to get tackled in the summer of code, I am really looking forward to the results of what will become some nice extensions.
Especially the drag+drop form editor and the intuitive animations toolkit will be two things that will make dojo even more popular and easier to use.
All the best you guys and have a great summer …

Comments