Archive for the ‘Tech’ Category
GPL and the web
A few years ago (two or three), I saw Richard Stallman at FISL where he said that things like Webmail were bad ’cause you don’t have any control over the software it runs in the server. In a way, he is right: How do you have any control over your data if you don’t have any control over your software? How can you be sure that the server isn’t doing something nasty with your information since you have no way to request the source code?
Requesting the source code is one of your rights if you are using a GPL-licensed software. That way, you can be sure that the application is not sending your information to someone else or looking for things it shouldn’t. But the GPL says that distributed software should have its code available; in a web 2.0 world, nobody is distributing any software: it simply is there. Therefore, even if you run a GPL application, do lots of modifications, because you’re not distributing it, you don’t need to make your changes available to the world.
The thing that was bothering me, though, is related to some web apps/websites I used at some point. They had this pretty cool thing and I was wondering “Is that something I know, like WordPress, Drupal, Joomla or whatever?” but, in the end, I couldn’t find anything that would say what they were using in the backend. And, just now, I was wondering how the GPL would apply to such websites.
Besides the GPL, there is another very useful license: The modified BSD license or simply “BSD”. The only rule the BSD license requires (compared to the “5 freedoms” GPL enforces) is that you can’t remove the copyright from the original authors. You may add your name, but the original copyright must appear somewhere. I wondered, then, if the GPL would have such requirement. I’m not a lawyer, but I think this does:
5. Conveying Modified Source Versions.
[...]
b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to “keep intact all notices”.
That, to me, sounds exactly like the BSD. So, if you’re using a GPL software in your webserver, you must point, somewhere, that the engine behind your powerful site is copyright the original authors.
Now you must ask yourself this: How many websites out there are using WordPress with a modified theme that completely removed the “Powered by WordPress”? Or sites that chose (not sure why) the GPL version of the jQuery and didn’t mention that anywhere?
Why Apple.
I know I had some troubles with Apple and OS X since I got my MacBook Pro, but I think that, when someone does something right, you should say it.
So, in the end of 2007, I decided to give myself a MacBook Pro as Christmas gift. I had a computer, but the battery wasn’t that good, and the graphics weren’t that good, and the machine was a bit outdated… And I heard wonders about Apple hardware. So, why not? And, on 23rd of December of 2007, I became the owner of a 15″ MacBook Pro, the aluminum case.
Fast forward about 6 months after that. Apple announced the recall of such models due a problem with the NVidia chipsets. At the time, I did check the serial number and, as such, I had one of the laptops that could be affected by this problem. But, heck, everything was running fine, so I didn’t worry about that.
Fast forward again 7 months, January 2009, one year and about 1 month since I got the laptop. There I was, playing EVE online when something weird pops in the screen. It was some sort of blur, some lines drawing in the wrong place and the game locked. At first, I ignored it, ’cause the Mac version of EVE was kinda bad. Turn off computer, turn it on again and I’m back. I did some coding and decided to play WoW. A few minutes in the game and I get the same wrong drawing and the same locking, which is quite unusual for WoW. Turn of computer, turn on again, and I get a warning saying that I needed to turn of my computer to reboot. I gave the computer a few minutes, turn it on again, talk to some people on IRC and… blur and locking, and the same message after rebooting. But, even after waiting, it still didn’t come back. I kept getting the same wrong display and same warning. And I took pictures of the screen.
Time to use that recall Apple offered. One year after buying the MacBook, I lost the receipt, so I took the computer back to the shop I bought it, “My Mac” in Bondi Junction. I showed the problem, which weirdly worked fine for the first 2 minutes and told the guy that I knew about the NVidia problem and that the serial number was one of the affected one. As it needed some tests to verify that it was a NVidia problem and not something else, the guy asked for about a week. Well, sure, no problem with that.
I got a call about 4 days later. The guy said that, and I quote, “I plugged an external monitor and got the same drawing problem, so it’s a problem with the logical board.” The repair cost: $400 (or so I thought) and it would take another week. One day after that week, I called the shop. The guy told me that there was a change in the price and it would, actually, cost $1700, but because he gave me the price of $1400 before, it would make it for $1400 plus service. Ok, first I must say that I actually have problems hearing people over the phone and the guy had some thick Indian accent. That was too much and I said no. Unfortunately, I had to pay the service of $100.
Why I didn’t replace the logical board, after all? Well, I’m a computer guy and, although I write software and know shit about hardware, I know that if your video card is broken, it doesn’t matter if you change the monitor. It simply doesn’t make sense. So, as any terminal disease a doctor gives to you, I decided to go for a second opinion: Apple itself.
I took the notebook a Saturday morning. I was kinda expecting that I could just drop it there and wait for their tests, as I did in the My Mac. But Apple, being not like others (”Thinking Different”, I think) said that I should book a Genius appointment before dropping it for repairs. So, without a choice, I booked on for the next Monday.
Monday, I explained the same thing I did before to the guy in the Genius Bar. He said it could be a memory problem and, thus, would try changing the memory. At this point, I kinda felt stupid: I was not using Apple official memory, I bought some 4Gbs after a few months. If it was the bad memory…
Anyway, the guy when in the back, and came back a few minutes later. He said that he replaced the memory, got the same problem, so it needed to replace the logical board but, because it was under the warranty (the NVidia warranty), they would replace it for free. The repairs would take 3 days. When I signed the paper confirming the repairs, there was a clause saying that it could occur a fee of $100 due service. Well, I payed $100 already for a service that would charge me $1700, paying $100 for a free new logical board seemed pretty cheaper.
One day after those 3 days I was in the city and decided to check the Apple store. The consegliere told me that, due some backlog, it would take some more time, maybe to the middle of the week. Well, no problem. Monday, 7 days after I took the laptop to repairs, I got a call from Apple saying that the service was complete. I rode all the way to the city to get it back and was greeted with a surprise that even the service was free because of the warranty.
So, there you have it. It doesn’t matter where you buy your Apple stuff but, if you need repairs, better look for the official Apple store.
OSDC, Day 3
The last day of OSDC started with Andrew Tridgell, of Samba and Rsync fame, talking about the fight with Microsoft for the protocol documentation. And, just because I wasn’t paying enough attention, I learned that it was Sun who started the request for protocol documentation, not the Samba team, although, in the end, it was only the Samba team and the FSF Europe in court with Microsoft to get the documentation. In the end, they created a foundation, Protocol Freedom Information Foundation (PFIF) to allow anyone to read those documents, which encompass more than just the SMB/CIFS protocol. Also interesting was the fact that Tridgell heard that some people inside Microsoft really wanted to make those protocols open, to prove that they were really good programmers and did not need to hide behind closed doors. The keynote ended with Tridgell pointing that Microsoft did a public release of their protocol documentation, including more protocols than the ones listed in the PFIF directory. And, because they are public now, you don’t need to be a sub-contractor of the PFIF to get the documents.
After the keynote, I went to see the Python presentations. The first one was “The State of Python” by Anthony Baxter. He spoke about the current changes in Python 3.0, which is at full swing in the news (like Reddit, Ars Technica and such) and I knew most of the changes by going to the SyPy meetings. If you’re not aware, Anthony put a collection of a few links in in a TinyURL link. The things you probably don’t know (and I wasn’t aware till I saw the presentation) is that there will be a 2.7 release in about 8 months to provide further information how to convert your applications to Python 3.0, there should be a 3.0.1 release around 6 months with bug-fixes and a 3.1 in about a year with some better standard modules (and I’m guessing it means that modules will adhere more to the PEP8.) He also mentioned that a “Programming in Python 3.0″ book should be available in the US in about a month.
Still in the Python line, I went to see Michael Hudson talking about “The PyPy Project And You.” PyPy is a very interesting project but something keep me distracted enough to not take enough notes (note to self: do not open IM when in a conference.) What I noted is that they have what they call LOP architecture/problem: A language L, for an output O, for a platform P. Because of the way PyPy is designed, they can take any language L, generate an output O for a platform P in any possible combination (when they have such L, O and P, of course.) They can do what IronPython and Jython do, taking Python as a language and generating an CIL/JVM output (which are basically “platform-less”, since the VM itself doesn’t change in any platform.)
Last Python talk in the conference was Alex Holkner with “Game development with Pyglet 1.2″. My flatmate keeps talking wonders about Pyglet and, after this, I have to agree with him. The API is incredible clean and, as I’m saying recently about my small projects, it’s pretty cute (and Pyglet having way more lines of code than mine, you can be pretty sure it’s as cute as this.)
After the Python sessions, I went to see Stewart Smith talking about “LD_PRELOAD for fun and profit (or evil)”. For those that don’t know, LD_PRELOAD can be used to load libraries before the code execution, so you can, as Smith shown, create a library with redefines fsync() to not do anything. Just as an example, Smith pointed that some tests, which took around 23 minutes to complete, took only 6 with the “hacked” version of fsync(). He also demonstrated how to use LD_PRELOAD to load a library that overwrote open(), close() and the family to get a backtrace.
Jonathan Lange closed the sessions before the lightning talks with “Your code sucks and I hate you! Code review for human beings”. He spoke about the experience of the Bazaar team with code reviews, not only pointing how you could ask for code reviews when sending patches to other projects but also how to answer code sent by other people for reviewing (kinda like an “etiquette of code reviewing”.)
After the lightning talks (which I won’t say what I saw ’cause I’m still ashamed that I didn’t wrote the speakers names again), Adam Kennedy (which, yet again, I didn’t wrote down, but Slashdot saved me) took the stage to talk about “The Sekrit”. He spoke about this story with Perl, his “distribution” (I think I can call it that) “Strawberry Perl” and how he managed to make a distribution of Perl 6, which he gave to Larry Wall. Also, he told us that he was approached by a Microsoft employee asking if he needed any help. If you clicked the link above, you’ll notice that Microsoft is offering free virtual machines with almost every single supported Windows version for free for all CPAN users to test their modules.
The closing keynote was Pia Waugh talking about the OLPC-AU project. The “One Laptop Per Child” is starting its way into Australia, but Pia followed the distribution of the laptops to children around the Pacific and how kids love their laptops. For us, developers, she pointed the OLPC-Friends website, where we can help improve the OLPC “from the inside”.
And that was it for the OSDC 2008.
OSDC 2008, Day 2
The second day of OSDC started with Larry Wall, the creator of Perl. At first I thought he would ignore the elephant in the room, but all his talk was about Perl 6. He shown the parser and the weird new operators (like “»+«” and no, this is not a mistyping) which means I’ll have a harder time trying to understand Perl code. But, on the other hand, their changes on the regular expressions make them a lot easier to use and a lot more logical (well, once you understand the basics of regular expressions.)
After the opening talk, I went to see Joshua May talking about “Going mobile – tips, tricks and tools for building mobile web-apps”. He basically summarized all the things I heard the mobile developers talking in the office: It’s freaking hard to make something that would work on every mobile. WURFL is here to help with descriptions of capabilities on mobiles. Another very interesting point was the Facebook mobile application which have a special “Call” link on it, ’cause it is easier to call someone than leaving a message and he also suggested that, instead of a “Contact us” form, business should have a “Call us for suggestions” or something around those lines, ’cause, again, it’s easier to call someone and tell them about something than typing a message on a phone.
Then it was Ben Balbo with a quick demonstration of how to stream video with a talk about “Streaming the world for free”. Basically, only using free software, you have DVgrab to capture video; FFmpeg, VLC and Mencoder to encode the video; HTTP, RTSP, RTMP as streaming protocol; Darwin Streaming Server, VLC, LScube, Red5 and Helix Server as streaming server and VLC, MPlayer and Helix Player as, well, players. On a quick demonstration, he showed the stack of DVgrab, VLC, HTTP, Darwin and QuickTime Player playing a real time video using his laptop. He also demonstrated Kyte.Tv played a video capture from his mobile phone.
The third talk was Silvia Pfeiffer talking about “An open source ‘YouTube’”. The system they build for the University of Queensland uses the FedoraCommons (not to be confused with the distribution) as the archiver/storage (FedoraCommons can store a lot of stuff, like documents) and they use Fez as a front-end to retrieve that information and display it.
Following her talk, John Ferlito joined Silvia to talk about “MetaVidWiki: When you need a web video solution”, which mixes MediaWiki (Wikipedia) with video playing. They also menioned the failed attempt of the W3 Consortium of making Ogg Theora (the free media codec) the default media format for the new <video> tag in HTML 5. As a solution they presented Mv_Embed, which is a Theora-capable player that can work with MetaVidWiki to stream the videos.
After lunch, I went to see Andrew Bennetts talking about “How to make a FAST command line tool in Python” and his experiences with Bazaar. Just to demonstrate where the basic problem is, he run two commands: time python -c "", which basically runs nothing, taking 0.013ms and time python -S -c "import os; os._exit(0)", which doesn’t load the site module and forces an “unclean” exit, before the garbage collector can do anything, reducing the run time to 0.008ms. So, basically, the big culprits are imports. For that, both Bazaar and Mercurial have a “lazy import”, which is capable of doing the proper imports only when requested. Also, a lot of imports are bad right now, like String module, which imports the regular expression module, which is slow. Also, same goes to urllib, even when you just want to use the encoding stuff there (it loads the socket module, which loads the _ssl modules, which is incredible slow and large to load.) Some suggestions he gave was use PyFlakes to find unused imported modules. Later, in the questions part, I got the sad news that locally importing modules (e.g., doing import inside a function) does not improve the load speed, which means most of my new code in Mitter is bad.
Then I went to see “Managing category structures in relational databases” by Antonie Osanz. He basically explained how to use nested sets in a relational database. I saw nested trees in Uni, but I couldn’t understand how that works properly and it seems I stil can’t. But basically you keep a left and right information pointing where the element belongs in the set. It makes insert and delete slower (’cause there are more records to be updated than just one) but search is way faster (and the query is incredible simple.)
In the same database line, I went to see Jonathan Oxer talking about “Self-Healing Databases: Managing Schema Updates in the field”. His suggestion is basically never run a schema upgrade script, but you code your ORM layer to, in case of error running a query, check for probably upgrades (e.g., table creation script, column creation script), run it and then re-execute the query. Yes, you can have problems of two users trying to access your site just after an upgrade and two scripts running at the same time, but things could probably go fine if you don’t capture the error of the upgrade procedure (I’m not sure about data convertion.)
The last talk in the day was “MySQL Optimisation by design” by Arjen Lentz. He mostly talked about the good practices we usually apply. The good stuff, though, came in the little tips. For example, you can add a small C comment inside your SQL query and that comment will appear in your logs. He also suggested that you should worry about replication and write your code thinking about doing requests in a group of servers and updates in another group, so your application is ready to work in a master-slave environment (updates in the server, requests in the slaves.)
And this day I decided to stay around and see the Lightning talks. Honestly, I have a problem with 30 minutes presentations (it’s too short) and I was kinda worried about presentations in only 5 minutes. But it was, nonetheless (and yes, I love that word.) Unfortunately, I wrote the name of the presentation but forgot to write down the presenter name. Shame on me. So we had:
- Golly, a Corwin’s Game of Life with an impressive size;
- That joke about “if languages where cars”;
- Faster Beer, where the presenter make use of Corepy to speed up his Pythton application (I think it was Michael Hudson, but my memory fails me here);
- “So you’re a kick ass coder”, which pointed how we, as developers, should get more involved in the community;
- “Ladies Get In Free” by Pamela Fox about a suggestion to bring more girls to this kind of conference;
- “SiliconBeachAustralia.org”, a developer community;
- “Freeway 2.0 on Zend Framework”, which I completely lost ’cause I decided to check something different (sorry about that);
- “Counting Your Users Without Download Statistics”, which explains some tactics used to count users using surveys;
- “SQL vs NP”, which was a really crazy talk with SQL, first making a text/ASCII-code fractal and then solving the traveler problem using just SQL and PL/SQL;
- “Geek my ride”, presented by Jonathan Oxer showing how he did add a computer in the trunk of his car, with power source, Wi-Fi and G3;
- “OSDcLang for Mobile Devices”, also by Jonathan Oxer, with a simple, Turin-complete, Brainf**k-like language running on mobile devices — HIS CAR! (see above)
OSDC 2008, day 1
Ok, first “real” day of the conference.
The opening keynote was made by Chris DiBona, Google open source manager and license extraordinarie (or something along those lines.) He made some points about the grown of Summer of Code in Australia (with the sad note that only 7 students registered, even with 68 tutors), the number of licenses used by Google, Google usage and contribution of open source code… And yes, suddenly, it start sounding like “Here, Google is a friend Open Source!” propaganda, but DiBona manage to point that most of what he was talking was to make a point to other companies and how they could make a step into and alongside open source. But, apart from the little propaganda side (I can guess that it was completely unintentional), the graphs he showed, like the number of students and tutors through the years of Summer of Code in Australia and the number of licenses used by Google and other small peals, where really interesting.
The first session I saw after the opening keynote was Michael Neale talking about “Rule based systems – using rules to manage business logic”, mostly because I worked with a system written in C where we had to write all the business rules and such. Well, I surely wasn’t expecting a talk about decision trees, expert systems and logical programming, but it was interesting nonetheless. The interesting bits to me were some talk about logical programming and how rule based systems approach that. Even more interesting was knowing that Clips can generate rules by analyzing other rules.
Then I went to see Nicolas Steenhout talk about “Web accessibility and Content Management Systems”, mostly ’cause I’m terrible annoyed by websites that force me to use the mouse (looong time memories of using Lynx/Links ’cause it was the only thing that run properly on Linux and because I’d like to be a “real nerd”) and ’cause I really dislike the way sites are built these days. He pointed the current state of WCAG (Web Content Accessibility Guidelines): 1.0 is too old and 2.0 is not finished yet. He also mentioned the problem that the Sydney Olympics 2000 website had due not having any accessibility (they were sued about that) and how Target was also sued for not providing accessibility in their website.
Third session was Tennessee Leeuwenburg and “Google AppEngine + ExtJS prototyping demonstration.” That was one presentation that didn’t went well. Because the wireless was down and everyone had no internet at all, there was no prototyping and, obviously, no demonstration. So we saw some nice screenshots about AppEngine and some ExtJS screenshots and… that was it. I’m pretty sure the 30 minute space to talk about a topic was also a problem.
Next was Thomas Lee and “Python Language Internals: From Source to Execution”, which was a pretty good demonstration of the Python code. And by Python code I mean the very core of Python. What he did was, using the trunk code of Python, add a new command, from the parser, to the very end of creating a bytecode for it. Really impressive and, honestly, a big surprise that Python code is clean even when it’s not written in Python (most of the changed code was C code.)
Then Andrew Bennetts and “Python’s Unittest module: an under appreciated gem”. I was expecting a lot of weird tricks with unittest, but it seems that after a whole year using it, there was nothing new I could get from it. On the other hand, I got some pretty good list of extensions for Unittest, which provide a few more things that I may use in the future. The canonical (pun intented, as you’ll see) of such extensions is in Pyunit-Friends project in Launchpad.
“Extending Nagios with Python Plugins” by Maneschi (whose name I managed to completely lose somewhere) was more about Nagios than Python which was completely my fault. Anyway, it was an interesting talk, pointing some code used to collect information to Nagios.
Lastly, I went to “Getting Your Average Joe to use Open Source Software” by Peter Serwylo. Nothing new, I know, but he pointed some “gentler” methods to make people use Open Source (like keeping the user files and such — something that I barely thought after being constantly annoyed by “technical support” calls from my parents.) I think the way he described his methods were more in the way of “show the users what they can do” than “convert them!”, which seems to be the most commom way of making people use free software.
And I completely skipped the Lightning talks, and the Dinner Keynote.
OSDC 2008, Day 0
No, I’m not using a developer’s way of counting (’cause every good language starts counting in 0, anyway — like the GPL v2 had a “rule 0″), but the first day I can’t really call it a “conference”. It was more like “Google Showing You What They Have — And helping you building stuff with that”.
They shown three of their open technologies: OpenSocial, OpenLayers and AppEngine.
OpenSocial is the API for building social network applications, something like the Facebook API for applications. Not hard, just a bunch of JavaScript commands you can use to get the current user, the
user who’s the owner of the profile, the profile information of the user looking at the page and things like that.
OpenLayers should be the API for accessing Google Maps but the really gem in the presentation was Mapstraction, a JavaScript API layer abstraction (what a mouthful) to several map providers, like Google Maps and OpenStreetMap. And, because it’s an abstraction, you can easily switch between providers without having to rewrite your whole application.
AppEngine is the famous web-app development environment that Google provides for free, unless you have a huge userbase and need more space/bandwidth. Honestly, it looks a lot like Django, except that
the configuration files are WAAAAY simpler and the API looks a little bit more logical to me: you have an URL, which points to an object, which should have a get() and a post() methods, which are called depending on the HTTP call the application received. The hard bit is the DataStore object. You create your databases model much like Django models (with a few diffrent properties) but there is no relational
references in that. Google answer is that it’s hard to keep relational data safe when you’re using a cloud and massively distributed databases and, with my experience with a simple MySQL replication I have to agree with that. So, because you don’t have relationships, you need to build things using a flat table all the time (in other words, goodbye database formal norms.) It’s a little bit tricky to get over it, but not impossible.
The coolest thing of that is that, after about 20 to 30 minutes of explanation and some URL pointing, you were given a task to build something using those tools. And you had like one hour to put something together. I failed my OpenSocial application (still want to complete that), my Maps looks a little bit cool (you can see it here) and I had some issues with that flat structure of DataStore, so I couldn’t finish my project (but I still want to complete that and put it online.)
Besides that, nothing else. But, for a “Developers” conference, it was pretty cool.
The best of the Bad Slashdot
As I was expecting, a lot of geek hate on Slashdot article about the new Star Trek trailer. Basically, it’s the same thing I’m saying since the very first real thing. But here, let me show you some of the best or the worst of Slashdot:
As both franchise got similarly raped by dubious quality prequelsI had some hopes for this movie, because I like JJ Abrams. Now that I’ve seen the trailer, I can’t help but agree with you. Holy crap, what is so hard about making good star trek movies? They have so much background to choose from, finding the right story should be easy.
Actually, I know what the problem is. They see the fanbase as a bonus, not as the target demographic. We have these people who are going to see the movie no matter what, so might as well aim for a completely different demographic. This way we get the other people AND the trek nerds!!!
Hmmmmm, Scotty, Kirk, McCoy, Spock, Uhuru, Sulu and Checkov all at the academy at the same time despite the differences in age. Yeah, this is gonna’ suck.Yup, it’s becoming more and more apparent that Abrams has no regard whatsoever for the history of the series. McCoy was older than both Kirk and Spock (so was Scotty, but not by much), and Sulu, Uhura, and especially Chekov were all younger than Kirk… Chekov was a freakin’ ensign, and didn’t even join the series until year two. Now Abrams has them all at the academy at the same time?
This isn’t Star Trek. It’s Starfleet 90210.
I noticed something wrong too: if you watch the trailer closely, you’ll notice that it looks like this movie is shit.
As has already been mentioned this looks more like a Summer Blockbluster then anything else. I was expecting to see Will Smith strut into a scene with a cigar splutting a corney one-liner.ST is old. We have had 18 YEARS of non-stop Trek (TNG aired in 1987, Enterprise ended in 2005) and reusing the same script for many of those shows. We were/are tired of seeing the same thing over and over again. You know what we are not tired of?
Hope, charisma, and a calm assurance of success.
TOS had this in spades, and we responded with resounding joy. The others all took a piece of that formula, but none had it the same.
This movie looks like it has nothing to offer but flash and CGI. The original Kirk could have just as easily been a pirate-ship captain; he was cunning, daring, full of guile, and a swashbuckler. This new Kirk looks like Prep-School prankster.
This reboot looks like it has lost the original intent. That is why it will fail.
My favorite of the TOS movies was 6 because the enemy overestimated Kirk’s racism and underestimated his intelligence and dedication to duty. The turning point was when, instead of starting the war he was expected to start, he said “signal our surrender.” In TOS, Kirk was never a warmonger or really prone to violence at all. Not a hothead. Maybe these people watched the old series and noticed all the fights and shit without noticing that Kirk didn’t start hardly any of it. And when he did start a fight, it was more to prove a point or to keep someone else from having to fight. Kirk doesn’t like losing. Anything. That’s the fundamental truth of Kirk.I don’t expect this movie to show an old, wise, thoughtful Kirk, but let’s not turn him into a stereotypic cocky youth.
The multiple faces of nothing
[... or "C, variants and the NULL"]
In C, you have a way to represent nothing. It’s NULL (all caps). NULL points to nowhere and it’s defined as “0″. Why would someone use it? Well, if you have a list and some of the elements aren’t valid, you make them NULL. Since NULL is not a valid pointer, your application will crash if you try to access it. The whole point of NULL is to provide a way to represent the nothing. There is also a nothing type “void”, which you can define anything statically, but you can make it a point of it. Since all pointers have the same size, a “void pointer” is, basically, a pointer to anything.
Also, C have the idea of “nul-terminated strings” (yes, with just one “l”.) the “nul” character is represented by “\0″, which, in practical terms, is a space of memory with the size of a “char” with the value 0 on it.
When going down to the very bits of NULL and nul, they go almost the same, except for their size.
C++ was build on top of C, but if defined NULL as a pointer pointing to the byte 0. It’s almost the same thing as the C NULL but, because it’s a pointer, it doesn’t need to be converted when you’re using a CPU which have a different size for “int”s and pointers (usually, pointers are “long int”s or even more, if your CPU have more than 64 bits.)
Objective-C is a variant of C adding support for objects in a different way and the biggest “user” of Objective-C is Apple. The Apple version of Objective-C provides some basic types like lists. But, because you can’t leave an empty space in the list (which I think it similar to the way we deal with nul-terminated string), they created a NSNull object, which is a valid object, but it represents the null (which, by the way, are called “nil” in Objective-C.) It’s not an invalid memory address, as it points to a real object. The NSNull object provides just one method, “null” which returns a “nil” pointer (are you confused already?)
Now, the fun part: Most list (dictionaries actually, but the process is almost the same) operations, when you try to access an object that doesn’t exist, returns nil. But remember that the only way to leave an empty spot in a list is adding a NSNull object. So, to be really sure that something is not there, you need to check if the result is “nil” or “not an [NSNull null]“.
That’s too much stuff for nothing…
Web 2.0 is not streamable
This week our connection at home is shaped. This means that, instead of the shinny 1Mbp/s that we usually have, now we have to suffer to see pages with a bandwidth of just 64Kbp/s. But there is one thing that such limited bandwidth made me realize: The next web isn’t streamable.
To get to that conclusion, I hadn’t have to go far: Just opening Google Reader shown that it’s impossible to live with a very limited bandwidth. Right now, I should have something like 1000 unread news in 1 hundred subscriptions, which means Reader have to download a large description file with all that information. Thing is, right now, it doesn’t do anything: It shows the default Google application header, the logo and that’s it. But, knowing how things usually works in this Web 2.0 universe, I know that there is something going on:
Interactive sites, like Google Reader and GMail use AJAX. AJAX relies on XML, which is a structured plain text data (the same can be said for JSON.) XML allows the data to be in any other inside their structure. As an example, imagine a book information list: Inside the “Book” item, you can have a “Title”, which can be in the very beginning or the very end, but the result would be the same. So, any application that uses XML need to first receive the information, then convert it to some internal representation and then it can be used. Google Reader wasn’t “doing nothing”: It was receiving the list of feeds and the initial 100-something feed items which, due the small bandwidth, was taking very long. And, because it needed the whole thing, nothing was being displayed.
Which is a problem I see with many XML/JSON results: You can’t stream them in a way that you can start using the information before having it all. For example, in Mitter, we can’t display tweets before we received the whole message. If XML and JSON weren’t so loosely defined and we had a way to assure that after the element “User” we would have an element “Message”, then we could start displaying tweets before we had all of them (not that the format changes all the time, but since we can’t ensure that ordering, we must be ready for the data appearing in a different order — or with some other data between the ones we need.)
In a way, that’s a complete reverse of roles for AJAX. In the very beginning, AJAX was used to prevent large downloads: If you had a page where it would be useful to display all options to the user to help him/her to find data, you’d have to fill the page with that data (imagine, for example, a page with all your Del.icio.us tags, plus all the possible suggestions for all the other users.) The use of AJAX meant the site could filter results, so you’d have a smaller page, with would do small requests to the webserver, returning small amounts of data. In overall, it meant that the user experience would be faster. Now, we have so much information packed in XML/JSON formats that the user experience is not as responsive as it should.
More fights with Gitweb and Dreamhost
Time to setup gitweb on a Dreamhost hosted domain. Incredible number of headaches:
First, I didn’t had a copy of gitweb on my $HOME there, so I decided to download the latest version and install it, following most of my previous install.
Git worked fine on Dreamhost, so I created the repository directory, initialized the git repo there and tried to push from my local repo to the server repo. That’s when I got my first “couldn’t find libcurl.so.4″. At first, I thought the problem was happening ’cause I was running Git 1.5 on my laptop and 1.6 on Dreamhost, but upgrading my local install didn’t solve the problem. Even, I have “libcurl.so.4″ on my local files directory there. That’s when I found out that .bash_profile is not sourced when using SSH. Copying the contents of .bash_profile to .bashrc made git push happy again.
Just dropping gitweb.cgi on the domain directory didn’t work: I got a “404 – No projects found”. Hunting in the web I found that you need to add a gitweb-config.pl with the gitweb.cgi. The contents should look something like this:
# where's the git binary?
$GIT = "/home/slowsloth/packages/bin/git";
# where's our projects?
$projectroot = "/home/slowsloth/git.deadbraincells.org/";
# what do we call our projects in the ui?
$home_link_str = "home";
# where are the files we need for web display?
@stylesheets = ("/gitweb.css");
$logo = "/git-logo.png";
$favicon = "/favicon.png";
# what do we call this site
$site_name = "DeadBrainCells' Git Repository";
# these variables should be empty
$site_header = "";
$home_text = "";
$site_footer = "";
$projects_list = "";
$export_ok = "";
$strict_export = "";
# some other config variables I found around
$projects_list_description_width = 50;
$project_maxdepth = 10;
Well, thing is, it didn’t work (and I still got “404 – No projects found”. Then I decided to read the gitweb.cgi source and found that the name for the config file is, actually, gitweb_config.perl. Renaming it removed the “404″s, but it won’t display any projects.
After changing a few values with no result, I decided to check the apache error logs to see if there was something there. And there was. Again, the message about not finding the “libcurl.so.4″. I tried to add an .htaccess with SetEnv LD_LIBRARY_PATH "/home/slowsloth/packages/lib", which didn’t work. Then, change the $GIT on the config file to $GIT = "LD_LIBRARY_PATH=/home/slowsloth/packages/lib /home/slowsloth/packages/bin/git", but it also didn’t work (now complaining about not finding the command.) The last resort was create a small wrapper around git, which I called gitwrap.sh:
#!/bin/sh
export LD_LIBRARY_PATH=/home/slowsloth/packages/lib
/home/slowsloth/packages/bin/git $*
The final step was replace the $GIT to call gitwrap.sh instead of git and voilà, gitweb running.
