tag: Development

heya-unify: back to JS

-- As programmers we rarely have a luxury to write a project from scratch. Usually we have to retrofit existing projects with all cool things we need. If a new component, or a library we want to use introduces new concepts that bleed outside its boundary, we have a “culture clash”, when old code is unaware about new concepts have to work with it anyhow. Sometimes the clash is so bad that we have to give up on using shiny new things, or have to significantly rework their code, which requires time and efforts we cannot afford.

heya-unify: incomplete objects

-- Incomplete objects allow us to concentrate on important properties of JavaScript objects ignoring the rest: we don’t need to specify every single property, and we can deal with cyclical graphs. Incomplete arrays is a complimentary feature to inspect only the first few array items. Both features are very useful for patterns, and heya-unify provides rich facilities to automate creating incomplete objects: they can be marked up explicitly on per-instance basis, recursively with a special utility, and we can specify how to deal with objects by default during unification.

heya-unify: custom unification

-- Custom unification in heya-unify allows us to deal with our specific objects in JavaScript, create unification helpers, and even custom logical conditions. It is there to bridge unification with our existing projects. Looking at the 1st part and the 2nd part of the series is recommended before diving into details. Custom unification Unification makes comparing simple objects a cinch no matter how complex they are, and we can easily apply it to JSON-like trees as is.

When to unify in JS

5 Jun, 2014 - 10 minutes
-- Unification for JS introduced heya-unify — a practical mini library to leverage unification in JavaScript. This post explains when it makes sense to use unification, and gives practical examples of how to use it. When to unify? Below is my laundry list for unification. As soon as I see a project, which deals with items on the list, I investigate if it makes sense to use heya-unify.

Unification for JS

18 May, 2014 - 15 minutes
-- Unification is a very interesting programming tool. Originated from logical programming (its the foundation of Prolog) and used in functional programming (e.g., Haskell) it helps to compare objects for equality, identify known patterns, and reassemble results differently. Wikipedia gives a somewhat complex definition of unification, but many people see it as an extended equivalence comparison, a pattern matching tool, and some even find parallels with XPath queries, CSS, and even jQuery, all operating on regular objects.

CG: code generation in JavaScript

14 Jul, 2013 - 1 minutes
ClubAjax invited me to speak about technologies behind Heya, specifically about code generative solutions behind heya-pipe. Pipes are built on a firm foundation of functional programming (FP), and it allows us to use a wide range of technologies to optimize their performance including generating code on the fly (code generation AKA CG). As soon as we are talking about CG, the first question to ask is: “How to debug such code?

Slides: optimization of modern web applications

13 Aug, 2012 - 1 minutes
I spoke at ClubAjax about optimization of modern web applications. Usually I speak about theoretical matters, but this time I decided to go practical. This is a huge topic and it was blogged/debated/presented to death, including my Improving performance…. Yet I decided to add to it after realizing that many things have changed in last years, including how we build web applications. I concentrated on technical aspects completely bypassing all other areas (e.

More on 0ms timeouts

28 Jul, 2012 - 4 minutes
Once I wrote a blog post On JavaScript, EDP, and 0ms timeouts, which discussed a "smart" trend to pepper code with timeouts of … 0ms: setTimeout(f, 0). Authors of those "programming pearls" genuinely believed that this code reschedules a function call to the next available time slice after the code that set the timer was executed without introduction of a delay (after all it is 0ms!). In reality a typical delay was 10-20ms.

OOP in JS slides

17 Jul, 2012 - 1 minutes
_Finally: my open source JavaScript project DCL is built on ideas described in this article. Available for node.js and modern browsers, it implements OOP with mixins and AOP at "class" and object level. Read documentation and background articles on www.dcljs.org, clone its code on github.com/uhop/dcl, and follow @dcl_js._ Once again I was invited in ClubAjax to speak about JavaScript. This time I did a presentation based in part on my previous blog post OOP and JS.

OOP and JS

18 Jan, 2012 - 24 minutes
_Finally: my open source JavaScript project DCL is built on ideas described in this article. Available for node.js and modern browsers, it implements OOP with mixins and AOP at "class" and object level. Read documentation and background articles on www.dcljs.org, clone its code on github.com/uhop/dcl, and follow @dcl_js._ Almost any Java programmer, who starts to study JS groking its OOP facilities and a dynamic nature of JS, thinks that they can be greatly improved and starts its own OOP library/helpers.

Using Dojo Rich Editor with Django's Admin

Many years ago I decided to replace plain text areas in Django’s Admin with rich text editor, so I can edit HTML on my blog using WYSIWYG. Six (yes, 6) years ago I looked around and selected TinyMCE. Over time it turned out that I was forced to upgrade TinyMCE and the link script I had because new browsers continue breaking my rich editor editing. Finally it stopped working again in all modern browsers, and I decided that enough is enough.

What happened to Dojo in 2008?

15 Mar, 2010 - 1 minutes
What happened to Dojo in 2008? This question was asked on StackOverflow. This is my personal take on the matter: on Dojo, jQuery, history, mistakes, marketing, social vs. technical, and communities.

Exciting JavaScript Part II

4 Mar, 2010 - 1 minutes
This month I continued my presentation at ClubAJAX. Last time I did a survey of what is available in JavaScript, and concentrated on object-oriented (OOP) and aspect-oriented (AOP) techniques. This time I continued the survey, and talked about functional programming (FP), and domain-specific languages (DSL). And as promised I touched the code generation facilities too. I suggest to read the first part before. Enjoy! Direct link: Exciting JavaScript - Part II.

RAD CRUD

10 Feb, 2010 - 1 minutes
Today at dojo.connect I did a presentation “RAD CRUD”: rapid development of form-based applications. It continues my other presentation “CRUD with Dojo”, but it is more in depth, targets Dojo developers, and contains some advanced material. Direct link: RAD CRUD. View more presentations from Eugene Lazutkin.

Exciting JavaScript Part I

5 Feb, 2010 - 1 minutes
I was asked to talk about advanced JavaScript techniques at the last monthly meeting of ClubAJAX — monthly get-together of Dallas-area JavaScript programmers. Instead I ended up talking about leveraging cool JavaScript features to implement well-known programming techniques and paradigms: OOP, AOP, FP, and so on. Unfortunately I couldn’t finish in time, so I did a tour of some language features, and talked about OOP and AOP. The rest (I plan to do FP, code generation, and DSL) will be covered later.

Dojo Charting demo: tribute to Highcharts

8 Dec, 2009 - 1 minutes
Wolfram Kriesing asked: Somehow I have the feeling that you can bend dojox’s charting module to look and feel like http://highcharts.com/ — will be for free. Yes, it is relatively simple. To prove a point I wrote a quick-and-dirty demo available here: Tribute to Highcharts. Obviously not everything matches 100%. Go and judge for yourself. Update: related post on dojo-dev mailing list, which explains some details of the demo.

CRUD with Dojo

2 Dec, 2009 - 1 minutes
My presentation at ClubAJAX got off to a rocky start: I was let in the building 40 minutes after I was supposed to start the presentation. Everybody waited patiently. Thank you guys! As promised I publish slides along with relevant links (I had to skip most of planned demos). Here is my presentation on SlideShare: CRUD with Dojo. The original presentation can be seen on Google Docs: CRUD with Dojo.

Adding django-shorturls

6 Aug, 2009 - 5 minutes
Time to time I sync my blog software to the Django trunk and introduce small enhancements. Some of them visible to my readers, some of them are just for me. This time after reading Simon Willison’s post on rev=canonical I decided to add short URLs to my blog as well. This is a convention to provide custom short URLs managing the mapping on your own web site. In my opinion the idea is very cool.

JavaScript explained

1 Mar, 2009 - 5 minutes
Explaining some dark corners of JavaScript, browsers, or Dojo for the 100th time I realized that I already did it on numerous occasions, and some of my answers are published on public web sites. So I decided to round up the most general ones I posted on StackOverflow and publish links to them here for a future reference. JavaScript This section is for language-specific topics. They can be equally applied in any environment.

Trying out Google Friend Connect

4 Dec, 2008 - 2 minutes
As you may know today Google released Friend Connect. I decided to give it a try. It took about 20 minutes to set up my blog with 4 gadgets: Members, Sign In, Rate/Review, and Wall/Comments. It took about 30 minutes to separate the skin from all these widgets, and set up the Canvas so users can see gadgets in a separate window, if they want to. Google Friend Connect doesn’t have any server-side components on user’s server — everything is handled by Google.

Using recursion combinators in JavaScript

In the previous post we explored “array extras” and how they can help us to write concise yet performant and clean code. In this post we take a look at generalizing recursive algorithms with recursion combinators — high-level functions that encapsulate all boilerplate code needed to set up the recursion. These functions were added to dojox.lang.functional and will be officially released with Dojo 1.2. In general the recursion is a form of iterative problem solving in the same category as loops.

AOP aspect of JavaScript with Dojo

_Finally: my open source JavaScript project DCL is built on ideas described in this article. Available for node.js and modern browsers, it implements OOP with mixins and AOP at "class" and object level. Read documentation and background articles on www.dcljs.org, clone its code on github.com/uhop/dcl, and follow @dcl_js._ If we look at the history of computer programming languages, we can see that practically all new programming methodologies were about one thing: taming complexity.

Google App Engine: the first look

8 Apr, 2008 - 5 minutes
Yesterday Google announced its new offering: Google App Engine. These are my random notes I did yesterday when I studied the new service. Google didn’t go the same way as Amazon with its AWS. The former offers a form of shared hosting (think “distributed WebFaction”), while the latter offers a virtualized environment (think “distributed SliceHost”). So basically we are talking about more high-level approach to web applications, which is easy even for novices.

Dojo 1.1 is out

30 Mar, 2008 - 2 minutes
As you all know by now Dojo 1.1 was released in the wild. You can get a lot of useful links and info from James Burke’s post on Dojo 1.1, but let me tell you why you should be excited: Dojo 1.1 is the first official release, which contains dojox.lang.functional. It was available in the trunk for awhile, but now you can use it without deploying Dojo courtesy of AOL CDN.

On JavaScript, EDP, and 0ms timeouts

23 Mar, 2008 - 11 minutes
What makes JavaScript so different from other languages? Is it its dynamic nature? Its prototype-based funky inheritance? No. The most unusual thing for newcomers is how JavaScript programs handle the workflow. The program looks like a bowl of spaghetti. There is no start or end of the program. What we have here is a bunch of functions, which are called in response to some external events. In most cases we have no way to predict the order of these events.

Dojo docs: gfx and dnd

15 Mar, 2008 - 1 minutes
I just finished the first cut of the dojo.dnd 1.1 technical documentation. Let me use this post to remind you about the dojox.gfx 1.1 documentation. I hope I satisfied the curiosity of many developers, but the ultimate proof will be the number of simple questions on Dojo Forum. Let’s hope it will go down. And don’t forget that the Dojo Book has a DnD chapter too. Both documents are hosted on Google Docs, and are “live” documents — as soon as I update the document it is updated for you too.

Functional fun in JavaScript with Dojo

Everybody knows that JavaScript is a multi-paradigm language, and it can be used to program functionally. Practically all functional idioms can be used directly: higher-order functions, recursion, closures, and so on. The recent resurgence of Functional Programming (FP) brings functional methodologies in the mainstream. FP fundamentals gave us a lot of powerful idioms: iterative functions, which can replace loops, list processing in general, function manipulations, and many other things, which helps us to keep our code small yet concise, more powerful, and more fun.

PyCon 2007 pictures

24 Feb, 2007 - 1 minutes
I published first day pictures from PyCon 2007. They are raw, unedited, I didn’t put descriptions yet. You can recognize Django guys, people from multiple Python web frameworks, and, of course, the BDFL with OLPC. But why wait for pictures to be prepped? Dig in while they are raw and fresh: Yes, this is Steve Holden sporting a Django t-shirt. Update: I added pictures from the 2nd day. Update #2: I added pictures from the 3rd day.

Improving performance of Dojo-based web applications

Introduction Web 2.0 brought on us an onslaught of new server-side web frameworks, and made it OK to put some code on the client side as well. Yes, I am talking about Ajax. While elements of Ajax were available (and used) for a long time now, 2005 was the crucial year for this relatively old technology fueled by proliferation of modern browsers with proper support of JavaScript and HTML DOM, which, in turn, gave a rise to numerous Ajax toolkits.

Estimating unknown

2 Aug, 2006 - 7 minutes
How long does it take to do a project? Software developers are asked this very question on regular basis. This is how every project begins. Why is it important? Because “time is money” and many software projects are priced mostly by time spent on the project. “We will take your project estimate in hours, multiply them by your rate in $/h, and we have our price.” Ask any consultant or IT staffer about that.

Setting up tools 2

This is the 2nd part of Setting up tools on Windows — notes mostly for myself. (No, I don’t run Django with MSSQL under IronPython. Yet.) In this installment I add more stuff to Eclipse, and set up my apps under FastCGI on Linux-based shared host (I use DreamHost). Eclipse This section was updated on 9/30/2006. I already set it up with PyDev and Subclipse. Now I want to add HTML/CSS editing.

Migration to magic-removal

6 May, 2006 - 2 minutes
Today I converted three web sites to the latest Django’s trunk formerly known as the magic-removal branch. It was a very positive experience in general. New Database API with lazy database queries (courtesy of QuerySet) rocks! Direct interaction with model classes allows doing a lot of things much simpler than it was before. A lot of small improvements, which makes a big difference like explicit template extensions (use whatever is appropriate for your content), more transparent new Admin inner class, natural overriding of model methods (no more _pre_save() and _post_save() hooks!

Google Summer of Code 2006

2 May, 2006 - 2 minutes
Yes, another Google SoC is upon us. I signed up as a mentor with Dojo and Django. Both projects are on the leading edge of new wave of web-based applications doing extremely cool stuff. I anticipate that some smart students will bridge both projects, but individual projects are fine too. What is Google SoC? Read the FAQ. Who can apply? Any student anywhere in the world can apply. You don’t have to be Comp.

JTAG

5 Apr, 2006 - 1 minutes
By popular demands I am publishing pictures of my JTAG, which I made to revive a wireless router some time ago. Just click on the picture below to see it in all ghetto-style glory with some explanations of my "design decisions". You can see that it is very basic. It was made in ~3 minutes and costs ~$6 (the most expensive part was the cable — $3.99). It was assembled according to this diagram.

What programmers do

2 Apr, 2006 - 5 minutes
Let me give you one more definition of what computer programmers do: they design, build, and maintain complex systems. In many cases computer programs are more complex than “Hello, world!” examples. Way more complex. I am talking about the systems that have more branching possibilities than atoms in the universe. that cannot be verified using any formal methods in any practical timeframe. that cannot be tested with 100% code coverage in our lifetime.

GPL violation: Sveasoft

15 Mar, 2006 - 1 minutes
OpenWrt has officially terminated Sveasoft’s license citing blatant violation of the GPL. For more details go to OpenWrt’s forum: Unbelievable. It’s getting quite hilarious. For example you can “learn” that the GPL is derived directly from “the economic and political theories of Karl Marx”. In general it is so sad to see such abuses. It is not hard to comply with the license. If you don’t like it, don’t use the GPL’d software in your product.

Finalizing PyCon 2006 pictures

4 Mar, 2006 - 1 minutes
I found some time to finalize my pictures and notes on PyCon 2006. I tried my best to identify people in my pictures. Now you can see their names and links to their blogs. I added links to official descriptions of their talks, as well as to excellent detailed notes of some talks by Steve Holden. I advise to visit his blog, because he has notes on some talks I didn’t attend.

More PyCon 2006 pictures

26 Feb, 2006 - 1 minutes
I added more pictures from PyCon 2006. Enjoy. Now time for a blog roll of my photo models (far from complete): Adrian Holovatyhttp://www.holovaty.com/Simon Willisonhttp://simon.incutio.com/Jacob Kaplan-Moss   http://www.jacobian.org/Matt Croydonhttp://www.postneo.com/Derek Willishttp://thescoop.org/Ian Bickinghttp://blog.ianbicking.org/Bob Ippolitohttp://bob.pythonmac.org/Guido van Rossumhttp://www.artima.com/weblogs/index.jsp?blogger=guidoIan Maurerhttp://itmaurer.com/blog/Andrew Kuchlinghttp://www.amk.ca/diary/Jeremy Dunckhttp://dunck.us/anabasis/David Ascherhttp://ascher.ca/blog/Jeremy Hyltonhttp://www.python.org/~jeremy/weblog/Jim Huguninhttp://blogs.msdn.com/hugunin/Phillip L. Ebyhttp://dirtsimple.org/Mark Rammhttp://www.compoundthinking.com/blog/Steve Holdenhttp://holdenweb.blogspot.com/Bram Cohenhttp://bramcohen.livejournal.com/Kevin Dangoorhttp://www.blueskyonmars.com/ I know I missed some blogs, please let me know your blog address, and I will add it.

PyCon 2006 pictures

26 Feb, 2006 - 1 minutes
Here in Dallas PyCon 2006 gave us an opportunity to meet many "virtual" people from Python community, and put faces to names. For those who couldn’t attend I am publishing pictures and small notes on Flickr. I will add more pictures tomorrow. If anybody’s name is misspelled, or missing (I didn’t catch all names), or you want me to remove your name or picture, please contact me and I will change notes.

Setting up tools on Windows

Update 9/30/2006: when you finish this article don’t forget to read more about setting up tools in the second part: Setting up tools 2. My goal is to set up working environment for Django development on Windows box. You can find a lot of information on setting up open-source development tools on Linux. Somehow it is assumed that your project should target LAMP (Linux, Apache, MySQL, Python). Windows-bound guys are advised to decorate their platform as ersatz Linux: install Apache, install MySQL, and you have WAMP (Windows, Apache, MySQL, Python).

OpenWrt GUI: new release

15 Feb, 2006 - 1 minutes
It looks like this is the last update before upcoming beta release. Besides some minor bug fixes, it sports improved firewall configuration widget: Compact representation of port ranges. Example: tcp 9000-9100 ⇒ mycomp Port redirection. Example: tcp 8080 ⇒ mycomp:80 While the former improves on existing functionality, the latter implements totally new feature. It allows mapping external ports to different ports of internal computers. Redirection of ranges is supported as well.

Packaging web apps

2 Feb, 2006 - 4 minutes
Have you been frustrated lately by speed of web applications? Typically they have a lot of art, and structured into a nice set of JavaScript and CSS files. They look beautiful, aren’t they? But do you have the patience to wait them load? And proceed from step to step? Of course, it is possible to prepare a web application to high-demand life: merge all stylesheets, and JavaScript files, and compress the result, structure your GUI in such a way that it is possible to combine all small images in one, and so on.

Looking at stats: Google Video

2 Feb, 2006 - 2 minutes
Let’s take a look at Snakes & Rubies stats published on Google Video. But before that take a look at previous stats published on 1/27/2006. New stats include 5 more days covering 18 days of January 2006. Title   Page views   DownloadsSnakes and Rubies (Adrian’s Django presentation)1907Snakes and Rubies (David’s Rails presentation)16919Snakes and Rubies (Q&A session)892Snakes and Rubies (full)14912Totals59740 Lessons: More people read Django Community RSS feed than the news group, which was used for previous announcement.

Python web frameworks

31 Jan, 2006 - 1 minutes
Now after two posts about Guido’s quest for the Right Web Framework (1st, 2nd) I am starting to feel like his relay station. But I want to share his comment made in Matt’s blog post on Python web framework shootout: Why criticize Django for claiming to be the best? Nobody has denied it, and yet it’s criticized as if it were somehow unethical. Frankly, the problem is that there are too many Python web frameworks and wannabees, and if we don’t start some kind of shootout, however subjective, we’ll never get to market dominance of a few good ones.

Guido reports: Django vs. Cheetah 1-0

31 Jan, 2006 - 1 minutes
Finally Guido got some time to play with goods. The verdict is in: Django vs. Cheeta 1-0.

Guido on web frameworks, again

30 Jan, 2006 - 1 minutes
If you liked reading Guido’s previous post on Python web frameworks (Rails was mentioned too) and discussion that followed, you should read his second installment: Web Framework Redux. Don’t forget to voice your opinion in the forum.

Django Dojo

28 Jan, 2006 - 2 minutes
Django-Dojo alliance was finally announced to the world by our very own Jacob Kaplan-Moss: Starting with version 0.92 (which should be out in a few weeks, Murphy willing), Django is going to bundle Dojo with the toolkit. Specifically as part of Django’s admin interface (but available to user apps as well). Read all about it in Jacob’s post. I am overjoyed to see such cool high quality open source projects are working together.

Full Snakes & Rubies video is live

27 Jan, 2006 - 2 minutes
Finally full Snakes & Rubies video went live on Google Video! And it took only 18 days to verify it (19 days, if you count when I started to upload it). Apparently the whole process of verification depends on file size nonlinearly. It cannot depend on content because it is a combination of smaller files: Adrian’s Django presentation, David’s Rails presentation, and Q&A session. Oh, well. And now is time for some stats (1/9/2006–1/27/2006):

OpenWrt QoS

27 Jan, 2006 - 1 minutes
It looks like nbd was able to find the problem, which plagued many people (including me) with QoS. You can find details in this thread on OpenWrt forum. Instructions on how to install QoS package can be found in this FAQ entry. Give it a whirl and don’t forget to thank Felix Fietkau (nbd). QoS was the biggest feature on my "wanted" list. It means now I can produce an OpenWrt GUI (webui) module to deal with it.

My experience with Google Video

15 Jan, 2006 - 3 minutes
Some time ago Jacob Kaplan-Moss released his documentary about Snakes & Rubies event. It is a must see video for all serious programmers working in different fields because it gives you a rare chance to understand the motives of two successful software projects. Pretty soon it became obvious that sending links to hefty files or torrents is not the best way to spread the word — people are lazy and distractible.

Clients: thin vs. thick

15 Jan, 2006 - 5 minutes
Brad Neuberg wrote a good article, which compares two different approaches to AJAX: thick client (e.g., Dojo style) and thin client (e.g., Prototype style). While it does a good job contrasting two approaches, I want to underscore that the underlying problem is a clash of two cultures between "local application" developers, and "web site" developers. There is no doubt that local applications create the most satisfying end-user experience. Their typical weakness is in restriction of underlying data to local installation, which makes any collaboration impossible.

Where do old programmers go?

5 Jan, 2006 - 5 minutes
Nowadays this question is asked frequently. A lot of guys in their 30s realize that they are the oldest guys in their groups. 20+ guys don’t see wise sages around. What is going on? It was debated on /. without any productive outcome (as usual). Let’s take a look at the problem using available statistics. One nice source of data is the National Center for Educational Statistics. I made a chart using Table 280.

Live Filtering

Update on 11/25/2007: today this article presents mostly historical interest. Since Dojo 0.2 a lot of versions were published and many things were changed. At the time of this writing Dojo is at ripe 1.0. I had to disable all Ajax action in examples because I don’t use Dojo 0.2 anymore. What is Filtering? It is a selection of items using some criteria (filter). In this tutorial I am going to filter documents of my blog (made with Django, of course) matching titles against user-specified substring.

TinyMCE 2.0.1

20 Dec, 2005 - 1 minutes
In case you missed it too: TinyMCE 2.0.1 is out. I am getting a feeling that everybody is trying to roll out something for Xmas. Hmm. Maybe I should do it too.

Dojo 0.2.1

20 Dec, 2005 - 1 minutes
Dojo 0.2.1 is out. This is a maintenance release, which doesn’t change API but fixes some pesky bugs. Go and get it.

New releases

17 Dec, 2005 - 1 minutes
Today I saw new search phrase, which brought visitors to my humble blog: rails 1.0 "Lost connection to MySQL server during query". Yes, you guessed it right! Ruby on Rails 1.0 was released 4 days ago. Scrip.aculo.us 1.5 and Prototype 1.4 were released as well. On 15th Dojo 0.2 was released too. It sports many widgets, improved speed, and new BSD license, which was added to AFL. Now you can use it in GPL projects as well as in commercial applications even, if you don’t understand legalese of AFL.

DIY and NIH syndromes

16 Dec, 2005 - 3 minutes
Many programmers have DIY attitude. It is understandable: they want to do new exciting stuff themselves. In some cases it is perfectly reasonable: exotic functionality, special requirements, performance enhancements, and so on. Sometimes incorporating 3rd-party library makes overall API inconsistent, which is bad especially for programming tools, or big projects. There is a fine line between DIY and NIH, when DIY part is used without rational explanations. Of course, in some cases NIH is reasonable too, e.

Snakes, rubies, and some comments

12 Dec, 2005 - 2 minutes
A week ago I posted a link to David’s take on "Snakes and Rubies" event. Of course I am talking about article written by RoR’s creator. It is a great read, but this time I’ve read reader’s comments (or "challenges to the Loud Thinking"). Oh, boy! It gives you insight into Rails, Django, and their perception by developers and users. For example, I am not very familiar with i18n problem, but it looks like a lot of people were quite passionate about it.

Django Ajax Redux

10 Dec, 2005 - 9 minutes
Three weeks ago we had a discussion about Ajax support in Django, which resulted in "Ajax and Django" wiki page. A short recap: it lists a vague goal, some general considerations, and possible strategies; it scratches the surface of existing implementations (mostly RoR), existing third-party toolkits (Mochikit/Dojo), and related RPC-style and REST-style services. No code was produced, no consensus was reached, but now it is a part of Django’s Version One roadmap.

What RoR's creator think about Django

6 Dec, 2005 - 1 minutes
David Heinemeier Hansson (the creator of Ruby on Rails) wrote a little piece on Snakes and Rubies event highlighting differences between Ruby on Rails and Django. Very interesting read!

1st news on Django/Rails bash

3 Dec, 2005 - 1 minutes
Rob Lambert just posted his thoughts on Snakes and Rubies event in Chicago today. I am sure we will have more info later (including promised video) but it is an interesting read anyway. And it is available now. Update: Eric Sinclair posted his notes on the event.

WebUI refresher

3 Dec, 2005 - 1 minutes
I just released a refresher for OpenWrt WebUI alpha package. It fixes a bug, which was reported by several people. Some users had problems with Net configurator applet, if wl0_country_code was unset in NVRAM. While it is extremely easy to set, I suggest reinstalling webui. Please read the original post on how to do it. Thank you guys for your great feedback! Working together we will make webui even better.

Different people, different opinions

30 Nov, 2005 - 2 minutes
It is practically impossible to travel to Muslim countries without hearing some anecdotes about Nasreddin Hodja. Here is one (the source): > Hodja was once a judge. One day a man came to his house to complain about his neighbor. Hodja listened carefully and then said to him, > > — My good man, you are right. > > The man went away happily. In a little while the first man’s neighbor came to see Hodja.

OpenWrt GUI: alpha released!

27 Nov, 2005 - 1 minutes
Finally I released WebUI 0.1 (Homunculus) alpha — AJAX-based web interface for OpenWrt made with Dojo! Highlights of this release: 5 more applets including firewall configurator and more network settings. Now proceed to install the package and to read release notes. The package is here: webui-0.1-alpha.ipk. You can install it using following command in OpenWrt shell: ipkg install http://lazutkin.com/download/webui-0.1-alpha.ipk Release notes: WebUI can be installed side-by side with webif (comes standard with OpenWrt White Russian RC4).

OpenWrt RC4 is out

24 Nov, 2005 - 1 minutes
OpenWrt RC4 is out. Take it while it’s hot! It includes multiple stability updates and webif web-based user interface! Update: OpenWrt GUI alpha is released and tested with RC4.

OpenWrt GUI: alpha delayed

20 Nov, 2005 - 1 minutes
During final tests I found a nasty bug in "Firewall configurator" applet. I decided to postpone the release until I’ll be able fix it. You can see bastard’s picture on Flickr along with some description of it.

London presentation

20 Nov, 2005 - 1 minutes
I found a blog post describing London Web Frameworks Night, which took place on 11/17/2005 at the University of Westminster. Jabbering Giraffe reports on presentation of three web frameworks: Catalyst, Django, And Ruby on Rails. It is an interesting read. Author remarks that Django’s Admin ("with lots of Ajax and JavaScript goodness") was the main object of envy of other frameworks. Another interesting remark was how good Rails people are at marketing.

OpenWrt GUI: alpha is coming

19 Nov, 2005 - 1 minutes
I was able to work more on OpenWrt GUI. Alpha release seems inevitable now. I’ll try to publish it during this weekend. I added back the main applet, which serves as a menu for all other applets. More network configuration-related applets are added. Status applet is cleaned up considerably: all less important information was moved to tooltips. New screenshot is available for your viewing pleasure. Stay tuned for upcoming alpha release!

New RSS framework

12 Nov, 2005 - 1 minutes
As you all know Django has new shiny RSS framework. This change breaks my simple RSS tutorial and I am glad that it happened! To tell you the whole truth, it breaks only "The Simple Way" to do RSS in Django replacing it with even simpler one. "The Smart Way" RSS still works as you can see on my web site. Like I predicted the feedgenerator is still around and it learned some new tricks: it can produce Atom feed now!

Looking at stats

10 Nov, 2005 - 3 minutes
Recently I looked at the stats of my web site. DreamHost provides Analog 6.0. I supplemented it with awstats. Plus there are some other means to analyze the traffic. Let’s put it this way: I know my average reader. I thought I did. Anyway I found a few surprises. The country list includes 77 countries. Out of 193. Not bad for a personal blog. Practically all Eurasian countries, and countries of both Americas are in the list.

Django goes international

4 Nov, 2005 - 2 minutes
As of today i18n branch of Django is merged back to trunk. What is i18n? It is an abbreviation of the big word "internationalization". l10n ("localization") is a sibling of i18n. In practice it means that now you and I can do truly international multi-language web sites without much hassle. While this is more important for big corporations and international organizations, it is a big step for Django’s truly international community.

TinyMCE 2.0RC4 is out

3 Nov, 2005 - 1 minutes
New TinyMCE 2.0RC4 is out. It fixes numerous bugs, which never bit me. Is it going to be the last RC before actual release? Who know. Grab it while it is hot!

OpenWrt GUI: hosts editor

30 Oct, 2005 - 1 minutes
I didn’t have a lot of time this weekend. So I decided to implement the simplest part of upcoming OpenWrt GUI (webui) — hosts editor. It is a perfect candidate to write something in 15 minutes or less — it has almost no "business" logic in it: read/edit/verify/write cycle. The hardest part was to learn how to upload dynamically generated files without writing them to disk first. It turned out to be very simple.

Updated OpenWrt GUI preview

28 Oct, 2005 - 1 minutes
Update: this document is officially obsolete — alpha is released! Please download it again: /webui-0.1-pre-alpha.ipk — two debug files made their ways to the release messing things up. Now it is fixed and I hope it’ll work for you.

OpenWrt GUI: screencast and screenshots

26 Oct, 2005 - 1 minutes
After some requests I’ve updated OpenWrt GUI screenshots.Additionally I’ve recorded a screencast using Wink. Enjoy! Update: new OpenWrt GUI alpha is released!

OpenWrt GUI: preview is released

26 Oct, 2005 - 2 minutes
Update: this document is officially obsolete — alpha is released! Finally I released a preview: /webui-0.1-pre-alpha.ipk! I included two information applets and a simple network configuration applet. I think it would be enough for a proof of concept. I borrowed heavily from nbd’s webif. So if it works for you, it is due to his OpenWrt expertise. If it doesn’t, it is my fault. Both webif and webui can be installed side by side:

OpenWrt GUI: preview is ready, packaging

24 Oct, 2005 - 1 minutes
Finally I found time to finish it up. It is pre-alpha quality now, but shows the direction. The only problem is a packaging. I didn’t mean OpenWrt’s IPKG. I am talking about creating a custom build of Dojo to reduce the foot print. Dojo has a special provision for that but so far I was not able to do it getting some strange errors. I hope I’ll get some help from developers.

Migration to new Django admin

19 Oct, 2005 - 1 minutes
I’ve migrated my sites to new Django admin. It is easy to do but make sure that you followed instructions closely. Small mistakes can cost you a lot of head-scratching time. You can find the instructions at the bottom of Backwards-incompatible changes. New refactoring has totally made sense. Meanwhile Robert Wittams & Co is working on new-admin (note the hyphen). Django’s admin is a very nice app (now it is an app!

DreamHost: Python 2.4.1

14 Oct, 2005 - 1 minutes
DreamHost has installed Python 2.4.1. Somehow I didn’t see it before. Default python goes to Python 2.3.5. Use python2.4 instead.

OpenWrt GUI: it works, kind of

14 Oct, 2005 - 1 minutes
I decided to post some screenshots of OpenWrt GUI running on my browser. I didn’t package it as .ipk yet. Screenshots are hosted on Flickr. If you want to see full-size picture (== undistorted by scaling), go to "different sizes" (it is in "Additional information" on the right side), and select "Large". Please bear in mind that this is the first cut without any niceties. I’ll put some niceties in, but I want to have working functionality first.

OpenWrt: jumpstart with JTAG

9 Oct, 2005 - 2 minutes
As you know I bricked my wireless router. All simple things were tried without any positive effect. Kaloz (of OpenWrt fame) has advised me to try JTAG. It’s a very simple thing: you need a computer, a proper software, and JTAG cable, which can be self-made. Obviously the last part is the crucial one. I made a trip to my friendly neighborhood Altex store and bought all necessary parts: 4 100 Ohm resistors, male & female 14 pin IDC connectors (they didn’t have 12 pin ones, which were modified later using cutters), 25 pin male SUB-D, and 3’ 25 pin male to female cable — I figured I’ll make extremely short JTAG "cable" and attach it to short printer cable.

Ian Maurer: unit testing

9 Oct, 2005 - 1 minutes
In his blog post Ian Maurer shares a very slick way to run unit tests with SQLite’s in-memory database. Check it out: http://itmaurer.com/blog/?p=2 Simple, elegant, practical.

OpenWrt GUI: good, bad news

6 Oct, 2005 - 1 minutes
Today I have good news and bad news. The good news is tonight I was able to work on AJAX OpenWrt GUI a little bit more. It is coming together. I coded my first applet. It shows current stats, nothing fancy. The bad news is I bricked my router apparently by running nvram show repeatedly. I suspect that nvram is corrupted beyond salvation. I have to reset it somehow. I tried simple recipies listed in OpenWrt Wiki but no luck so far.

OpenWrt GUI: development

30 Sep, 2005 - 1 minutes
I was able to spend several hours this week to work on upcoming OpenWrt GUI. I use Dojo as a foundation. At this point I coded a skeleton, which works as a proof of concept. As soon as I finish putting in AJAX guts, I’ll switch to meaty functionality. Add some nice skin to it and we have our homunculus up and running. Huh? AJAX? No, it’s not Ajax the detergent.

TinyMCE 2.0RC3 is out

30 Sep, 2005 - 1 minutes
Once again, let’s grab new version of TinyMCE.

Testing new cache code

26 Sep, 2005 - 1 minutes
I am running new Django cache code now. If you notice any problems with it (e.g., error messages), please drop me a line at once. My email is at the bottom of the page.

New TinyMCE config for Django

25 Sep, 2005 - 1 minutes
For a long time I wanted to have two TinyMCE toolbars for Django Admin: One-line toolbar with the most essential tools, which gives a lot of space for inline editing of text. Full-featured toolbar with all tools for full-screen mode. It finally happened. Spocke (the main developer of TinyMCE) helped me to figure out how to do it. I updated my article in Django Wiki with new config file, and removed my notes about space problem (new config file solves it) and flickering (new TinyMCE 2.

TinyMCE: no flicker!

23 Sep, 2005 - 1 minutes
In my previous post I complained about annoying flickering. Well, I’ve upgraded to TinyMCE 2.0 RC2 and it doesn’t flicker anymore! Run, don’t walk, and upgrade immediatelly!

OpenWrt GUI

23 Sep, 2005 - 1 minutes
Finally I bit the bullet and decided to implement OpenWrt web-based user interface using Felix Fietkau’s code. Well, MIPS processors used by OpenWrt units are not race horses and GUI is slow to my taste. Yes, I know that stock firmware is not faster. "Slow" is absolute category for me. How do we combat latencies and slow network speed? Exactly. We can apply the same for OpenWrt, where "slow network speed" is replaced with "slow processor on local network".

Code: RSS in Django

23 Sep, 2005 - 9 minutes
Update: "The Simple Way" part of this tutorial is obsolete now. I am going to recreate examples using new improved RSS framework. Stay tuned! I was asked several times to explain how I did RSS for my site. Django has RSS framework, which is not documented. Most probably I am not the right guy to explain it but I’ll try. There are three ways to implement RSS with Django:

Code: my categories

After some requests I decided to publish my code for categories. It’s very simple. It was inspired by following articles: A "category" Data Model (note: this article uses old-style model format, it doesn’t work anymore) and Relating an object to itself, many-to-one. from django.core import meta class Category(meta.Model): """ Category defines following fields: name - simple name of category, e.g., 'C++' full_name - full name of category, which includes names of all parents, e.

Django badges!

16 Sep, 2005 - 1 minutes
Finally we have official Django badges. Wilson Miner did a great job putting them together. I decided to use this one: How do you like it? If you are a fan of 80 by 15 pixels badges, don’t fret — Dave Hodder has you covered with his rendition of "Made with Django" theme. Collection of his small badges are attached to ticket #509. Check it out too.

OpenWrt White Russian RC3 is out

15 Sep, 2005 - 1 minutes
Today is the day of new releases: OpenWrt just released new White Russian RC3. BTW, contrary to popular belief, it’s not just for Linksys WRT54G. You can run it too, if you have supported hardware. I run it on Buffalo WBR2-G54.

TinyMCE 2.0RC2 is out

15 Sep, 2005 - 1 minutes
Wow, they move fast! Go and grab Tiny MCE 2.0RC2.

Added RSS

Finally I added RSS 2.0 using Django’s facilities. Default RSS feed is for my blog. Categories have two versions of RSS feed: exclusively for documents of the category, and documents for the category and its children. (I hope it is not news anymore: I have hierarchical categories.)

Running on 'sql:' cache now

Now this blog runs on sql:. I use MySQL as my backend. Before that I tested it locally with SQLite (so easy to install!) and MySQL. I learned today that MySQL, which is provided by my host (DreamHost), uses MyISAM for all tables. MyISAM doesn’t support transactions. AT home I use InnoDB, which supports transactions. However the hope is not lost — DreamHost mulls over InnoDB support. But as far as I know, they don’t have an implementation schedule yet.

Running on 'file:' cache now

11 Sep, 2005 - 1 minutes
This site was running using locmem: caching option, which is fine for small web site. Now it runs using file:. Please let me know, if you spot any issues. I am planning to implement sql: next.

TinyMCE 2.0RC1 is out

10 Sep, 2005 - 1 minutes
TinyMCE 2.0RC1 is out. Take it while it’s hot! I’ve upgraded my admin pages and it looks better than previous one (duh!). Nevertheless I see annoying flickering in FireFox. But it flickers less now.

Something wrong with simple cache

9 Sep, 2005 - 1 minutes
I am not talking about multithreading problems. locmem: doesn’t have them. But it does have problems with gzip. Sometimes I see binary stuff on my screen. It looks like a gzipped web page without proper gzip encoding flag. I don’t do anything related to compression in my cache. Is it a bug in Django’s caching? Hmm… Apparently it works properly with memcache. Can it be some bug in simple: implementation, which was a base for locmem:?

Say no more! Say no more!

8 Sep, 2005 - 1 minutes
Being a little bit frustrated by the lack of caching options for my web site I’ve added locmem: cache to Django. It is fully multithreaded local memory-based cache, which uses reader-writer lock to do its magic. It seems to work well but I need some time to test it more. I think file: is going to be next.

Django on Dreamhost: happy end

7 Sep, 2005 - 1 minutes
It looks like all kinks with Django on Dreamhost were worked out. Of course, I am referring to MySQL problem (see my previous post) and strange stalling of long pages, which I reported to Django’s mailing list. It turned out that other people had these problem too. Jason McBrayer shared his experience. He pointed out to possible flup/fcgi.py problem. I contacted Allan Saddi — the author of flup and other Python libraries and utilities.

Django with MySQL: problem solved?

5 Sep, 2005 - 1 minutes
It looks like the problem is solved. Django creates one (1) connection to database and reuses it to handle requests. Multithreaded FastCGI creates threads to handle requests. These threads make requests to MySQL, which gets confused and loses its cool^H^Honnection. This process is random and compounded with multiple web requests at the same time. For example, if Google Web Accelerator decided to prefetch some pages, your web site would be hosed.

Opera and Dojo

5 Sep, 2005 - 1 minutes
I decided to try how well Opera works with my site. It mostly works. You can go and see stuff but all Dojo-related code doesn’t work. Interesting that Google Maps works properly. When I switched to admin mode to edit this article, it turned out that TinyMCE doesn’t work either. But good news is Dojo and TinyMCE failed gracefully.

More on MySQL and Django problems

5 Sep, 2005 - 1 minutes
I complained about instability of this site in my previous post. Now, after intensive googling, it looks like it may be related to multiple threads or forked processes using the same connection to MySQL. Apparently it can confuse MySQL. Children should create their own connections after spawning. If Django does reuse connections, it may be possible to fix it. Otherwise, CGI is the way to go. The latter solution would be slow.

Django and MySQLdb worries

4 Sep, 2005 - 2 minutes
I am totally at loss. I am getting weird errors like this: OperationalError: (2013, 'Lost connection to MySQL server during query') They are pretty much random but fairly frequent. Apparently it may be caused by different MySQL timeouts, which I cannot control. It seems that in order to combat those you have to call connection.ping() periodically to reconnect. I added them to Django’s MySQL handler and … now I am getting these errors during execution of connection.

Dojo: 1st impression

3 Sep, 2005 - 2 minutes
The best thing about Dojo 0.1: it’s quite easy to create portable widgets. Such widgets work similar to Microsoft IE’s behaviors but they are even more self-contained. Dojo widgets can work with fragments of HTML and CSS, which will be inserted during the object creation. The event system is very elaborate. Of course Dojo is more than a simple widget factory. For example I didn’t try the I/O facility yet.

New Design 0.1 is here!

New design is here. Well, some elements of it. I had bigger ideas, but CSS didn’t work reliably, and JavaScript option was in debugging mode. So I decided to update this site now and add other planned stuff later. One reason I postponed JavaScript thingy is I want to try Dojo. It looks like a good foundation for widgets. I am going to create a couple of them at least. If it works okay, I’ll be using it in other projects as well.

New Design 0.1

29 Aug, 2005 - 1 minutes
New design is coming along nicely. Thank heaven for Photoshop, POV-Ray, and digital cameras! I need to work out a few quirks and I’ll be ready to create Django templates. Additionally I’ll create some custom tags to handle non-traditional formats.

Using TinyMCE with Django's Admin

26 Aug, 2005 - 2 minutes
Update (3/13/2011): this article is obsolete now and preserved here mostly for its historic value. Nowadays I use Dojo’s dijit.Editor as a WYSIWYG HTML editor — it is more functional and much simpler to setup and extend. Read all gory details in Using Dojo Rich Editor with Django’s Admin. I decided to add a WYSIWYG editor to my admin portion of the site. Apparently you can find some nice open source WYSIWYG editors nowadays.

Lorem Ipsum

26 Aug, 2005 - 3 minutes
Everytime I need to test a text layout or text style I am typing something like "qwerty" and duplicate it many times to make a paragraph. Then paragraph got duplicated as well. But I am really bored to see qwerty and usually it doesn’t simulate real text properly. To have something more realistic I go to any news site to "borrow" some text. Unfortunately sometimes I have to hunt for suitable text because the one I found has very short or too long paragraphs.