Be the first to know about special offers and new products for web developers and Internet business owners.
I will never share your email address with the bad boys. Period.
|
Be the first to know about special offers and new products for web developers and Internet business owners. I will never share your email address with the bad boys. Period.
The latest
|
ProgrammingWhen did you learn to program and in which language?Submitted by alexis on Sat, 2008-10-18 17:38.It's Saturday morning and I started the day reading another chapter of Introduction to Algorithms And while I tested some Python code I tried to remember when I started to program and in which language. It was 24 years ago, in 1984, I was twelve and my first computer, a PC XT (Intel 8088, 4.77 MHz) had less than six months at home. The language was Basic, first as BASICA and later as GW-Basic running on DOS 3.2. And you? When did you learn to program and in which language? Quotes causing problem with Python and simplejsonSubmitted by alexis on Fri, 2008-10-17 16:47.
My application will receive a string of JSON and transform it to a dictionary, pretty simple. Let's run a test first, starting with the Python shell, or better yet, iPython, and importing the module:
Now let's define a string using JSON notation and pass it to simplejson:
And we get a ValueError exception. Let's try using simple quotes for enclosing the whole string and double quotes for the JSON keys and values:
And there you go, no error now:
I find a little strange that this problem happens as I've been using either type of quotes for most of my Python coding. Had you noticed this problem? I've checked simplejson's documentation and could not find anything related to this. One last word, the new Python 2.6 includes a json module, which is a refactored simplejson. Neat. Some hints about overriding themes in Drupal 6Submitted by alexis on Thu, 2008-09-25 20:31.There's a lot to read and absorb on the new Drupal 6 but the good news is that if you've spent a while hacking version 5 you will need just a few days to get up to date. One of my favorite changes is on theming. Now every module can provide its own .tpl.php files. To override them you just need to copy them to your theme directory and start hacking around. Why I Decided To Use FSFS Over Berkeley DB With SubversionSubmitted by alexis on Tue, 2007-10-30 23:24.I've had enough dealing with permission errors and corrupted database issues in the Subversion repository I use in one of my development servers. Most problems came from using the default Berkeley database as my repository store so I decided to move to FSFS. Even if the Subversion book has a section explaining how to setup users and permissions and create wrapper scripts to use the correct umask, I didn't feel safe running a repository store that even the Subversion development team perceives as very sensible to interruptions. Some advantages of FSFS over Berkeley database include:
So, I've created a new repository specifying FSFS. You just need to add the --fs-type fsfs parameter, like this: $ svnadmin create --fs-type fsfs /path/to/repos I'd recommend not wasting your time with Berkeley database for your Subversion setup, just go for FSFS and you'll be cool. More about Subversion and how I use it on all my web projects coming soon. Open Source Applications For Database ModellingSubmitted by alexis on Wed, 2007-09-12 17:39.Are there any open source applications to model my database? Many developers have asked me that question quite often lately. When coding Drupal modules having a good picture of the database model can help a lot to write the right queries, well, actually this applies to any programming project that uses a database with more than a few tables. Even if there are many commercial applications, many of them quite stable and complete, I think their prices are way too much for most developers, specially for open source developers like most of us Drupal dudes. Want numbers? I got numbers: CA Erwin Data Modeler costs US$ 3995. With that much dough I'd prefer to complete my list of gadgets I want for 2007 and add another laptop with Linux to my arsenal. So, what are the options to model your database with an open source tool? Some years ago I found DBDesigner 4 and used it in a few projects to model on MySQL, the only RDBMS it handles. I was quite happy to know that MySQL had taken over the product to relaunch it as MySQL Workbench, however, MySQL has focused on other tools and Workbench progress has been slow. I've recently read in their forum that they were almost finished with other tasks and would return to work with MySQL Workbench. Good to know. DBDesigner 4 is still available and is a good choice if all you need is MySQL support. The installation is a little difficult in Ubuntu, although I didn't have any trouble with Fedora.. And what happens if, like me, you also need to model PostgreSQL databases? The only application I found for that some months ago was Mogwai ER-Designer, which works with MySQL, PostgreSQL, Oracle and a few other commercial RDBMS. Mogwai ER-Designer is written in Java, so it runs in most operating systems with a JVM. Unfortunately Mogwai's interface still needs some work and creating models is not too user friendly, even when they correctly use domain dictionaries. I also think development progress is going a little slow. What I'm using now, and recommend, is Power*Architect, which, like Mogwai, is a Java application and works with PostgreSQL, Mysql, Oracle and others. I think Power*Architect has a better interface than Mogwai, creating models and generating SQL is quite easy and takes just a few clicks. Power*Architect has been declared open source just a few months ago, way to go guys!, and there are still many features to add and improve ( So there you have it, there's still hope and we'll be seeing more mature database modelling tools in the open source arena soon. Oh, and if you know of any other let us know. Update September 19: Sean just told me that native types auto_increment in MySQL and serial in PostgreSQL are supported in the latest versions of Power*Architect. Programming Facebook Applications in a DSL Based ServerSubmitted by alexis on Sat, 2007-08-18 06:24.I recently posted a few ideas on the opportunities for web developers in Facebook. I decided to use DynDNS for creating a host name for my local DSL connected Ubuntu box, it's easier editing and making changes that way instead of using the other servers I have in a couple of data centers. I used the hostname as a callback url for a Facebook test application. Facebook saw my host and the application worked as expected. A couple of hours later I disconnected from the Net to take a break, when I got back received a new IP address from my ISP's DHCP server and DynDNS updated my host information to point to the new IP. Unfortunately now Facebook can't find my callback url anymore. I tried editing settings and changed the host name to the new public IP address to discard, still no luck and I'm getting this error: The URL http://xx.xx.xx.xx/facebook/application-name/ did not respond. There are still a few kinks Facebook and the makers of application-name are trying to iron out. We appreciate your patience as we try to fix these issues. Your problem has been logged - if it persists, please come back in a few days. Thanks! Is Facebook caching my older IP address? That was my first thought but even putting the actual public IP of my box in the callback url didn't work. Is this a temporal glitch in the Facebook Platform or am I missing something else? I'll keep testing but if you have any ideas I'd love to know. Fixed: I'm an idiot! I forgot changing the IP address of my database server, also in my local box. Now everything's working again. What A Geek Wears?Submitted by alexis on Mon, 2007-08-13 22:53.I prefer to be as light and comfortable as possible, underwear when the weather allows.
So, what do you use while programming? Tomboy, Notes for Web DevelopersSubmitted by alexis on Fri, 2007-08-03 18:00.Have you seen those persons that stick post-its on the borders of their computer screens? I know this is just too much but you know what they say about images and words. Sometimes they are ocassional users that use their boxes for simple stuff and I guess they find the whole post-it thing normal but, for a web developer managing so many pieces of data everyday, this is just a cause of disorder. Why using paper when there's software for taking notes? During my years as a KDE user I was ok with Knotes, now a component of KDE Kontact, but a few months ago I made the jump from KDE on Fedora to Gnome on Ubuntu. Using a KDE app on Gnome didn't seem right so I moved all my notes to Tomboy and boy it was an excellent choice! Tomboy comes pre-installed with Feisty Fawn and integrates perfectly with your desktop. It's very easy to create notes, link (wiki style) and search them. I use Tomboy all day, everyday, to save pieces of code, SQL queries, simple reminders (for things needing immediate attention, for everything else there's Evolution) or any other thing requiring a paper and a pen, items that I hope to eliminate from home as soon as possible. Thanks to Tomboy my desk is free of papers, just got gadgets on it. Here's a shot of Woodcarver with Tomboy, vim and a cute lady on the background.
Snipplr: A del.icio.us-like Code RepositorySubmitted by alexis on Wed, 2007-08-01 03:14.While searching for ideas to limit how many characters an HTML textarea could accept using Javascript, I found Snipplr, a service that reminds me how easy to use is del.icio.us. By the way, the del.icio.us guys are working on a new platform and trying (is possible?) to improve their UI. Snippler allows you to save, search and tag those small pieces of code that we use so many times in our projects, snippets. I know this may not be the first site doing it but it helped me and possibly would help you. Worth taking a look. Better Control Over Drupal Modules Running OrderSubmitted by alexis on Mon, 2007-06-25 15:51.If you've been a Drupal developer for a while you know that modules run according to the value of the weight field in the system table. You can update this table using an install file so your module runs exactly when you need it. This is what community tags does to run after tagadelic and the method I've used to make sure some form_alter code runs after everything else when I needed to modify event forms. But the change in the module's weight affect all the hooks in it. What happens if you want to control the runnning order in a per hook basis? I needed to do this to run some nodeapi operations in a custom module before event_nodeapi and form_alter stuff, in the same module, after event_form_alter. Believe me, you may need this some time (unless you opt for using before and after modules). This idea inspired me to code a bit and individually override the operations in event_nodeapi with some code in my custom module. It worked nice. Now I can run operations load and view in event_nodeapi and override insert and update with code from my module. The concept is quite simple. I added an event_nodeapi_overriders table with two fields: module and op. My module just needs to use its install file to insert values in this table. If I want mymodule to provide overriders for insert and update operations in event_nodeapi I should add the following module/op pairs to the table: mymodule/insert and mymodule/update. Then I added a few select boxes to show the values from event_nodeapi_overriders table in the event settings page where I can choose which module should override which operation and used some conditions with variable_get() in event_nodeapi and mymodule_nodeapi to decide which code to run. Perhaps the concept could be extended to eventually have a matrix of all hooks in all modules or a hook_weight parameter to allow developers to decide the running order. Or maybe is too much overhead? Anyway, this was some kind of experiment and even if after talking to Gerhard we decided to update the event module to use Form API in the submission process instead, the idea of having better control over hooks running order could deserve some more thinking. |
Want to launch a online store, need a new look for your website, market your services on the Net or build a virtual community? Not a problem, let's talk about it. Where To Host Your Sites? |
Recent comments
4 weeks 4 days ago
4 weeks 4 days ago
4 weeks 6 days ago
4 weeks 6 days ago
4 weeks 6 days ago
4 weeks 6 days ago
4 weeks 6 days ago
5 weeks 2 days ago
5 weeks 3 days ago
5 weeks 3 days ago