December 2011
2 posts
Silly Python riddle
Here’s a silly Python riddle for you.
Today I opened up a Python 2.7 shell, and ran two commands in it.
>>> f = lambda: g(???)
>>> f()
(Note that these are the only commands that I ran. You’re not allowed to run any other commands before them.)
The riddle: What’s the shortest thing you can put instead of ??? so my second command would not raise an...
The `coverage` module celebrates 10 years today!
Today, December 4th 2011, marks the tenth birthday of the excellent coverage module! Here is the changelog entry showing it was created exactly ten years ago, on December 4th, 2001 by Gareth Rees.
The coverage module is one of the most sturdy and reliable pillars of my development toolset. It’s a hallmark of a great tool that you never have to spend too much with it— When I want to...
October 2011
1 post
Deadline for GarlicSim 0.7 cancelled
Just when I finished one contract job and thought that I finally had time for some serious work on GarlicSim, I got a new contract job.
Since the deadline for the GarlicSim 0.7 release has been postponed so many times, I’m just going to cancel the deadline altogether. Sorry for the disappointment.
I’m angry at myself for not making the deadlines, but on the other hand I’m happy...
September 2011
2 posts
GUIs kick CLIs' asses
Or, “Hey programmers, did you know you can use a GUI with the keyboard?”
This post is part 1 of the Unpopular Opinions series. In this series I will present a few opinions of mine that go against what most other software developers think. If you disagree any of these posts, you know they’re working. Please stay civil in the comments— Criticizing my opinions is encouraged,...
Quick riddle
Here’s a quick riddle:
You owe your friend two Dollars. You have a $5 bill, but your friend has only a $1 coin for change.
What would be a fair way to settle your debt that would not require you to get more change?
Answer: You toss the coin. If you win, you don’t give your friend anything. If your friend wins, you give him the $5 and he gives you back $1, so he gets $4. His...
August 2011
2 posts
A Git user's first (and hopefully last) foray into...
I belong to a rare breed of programmers: I was born and raised on Git. It’s the only version-control system that I’ve ever used. This is my personal story of how I had to use SVN temporarily for a contract project.
Now, I know there are a million of blog posts out there saying “Ooh, look how much better Git is than SVN!” I’m not trying to tell people something they...
Postponing GarlicSim 0.7 yet again
Yeah, the deadline for GarlicSim 0.7 has been an epic fail. A couple of weeks ago I thought I had it under control, but then I got a contract job that’s been taking all my time. Good news for mah bank account, bad news for mah open-source project.
So I’m postponing the 0.7 release to November 1st, 2011. See you then.
July 2011
3 posts
Postponing GarlicSim 0.7 again
I’m postponing the deadline of GarlicSim 0.7 again, this time to August 20th.
This is fucked up and I feel really bad about this. I should have been more realistic about my deadlines, but I’ve let my optimism have the better of me. I’ll try to be more accurate in future deadlines.
Why making a cool project is a good idea for an...
As a software developer, I get to know a lot of other software developers. Many of the software developers I know are either running a startup, working as an early employee for a startup, doing contract jobs for a startup, or dreaming of one day starting a startup. My point is that software developers are very interested in startups, either starting them or working for them.
My advice to anyone...
`SimpackSelectionDialog` almost done
Hey, only a few weeks remain until the release of GarlicSim 0.7. I just wanted to give you a sneak peak of the new SimpackSelectionDialog, incidentally on a Mac:
(Click to enlarge.)
I’m quite pleased with this widget. It’s almost finished, I might put in a few more touches before the release. The above screenshot shows it on a Mac, but as always, it’s completely...
June 2011
2 posts
DreamPie: My favorite Python shell
If you’re not familiar with it, you should really check out DreamPie, which is a graphical Python shell.
It’s a really well-done GUI shell, with great keyboard support to boot. Its most unique feature is the separation of the “history area” from the “current command area”. I think this design makes more sense than the traditional approach of having them...
Why don't people use enum in Python?
A while ago I was introduced to the concept of enum in Java. I never programmed Java, but this looks like the solution for when you want a variable to hold a value from a limited set of possible values. What is usually done in Python is either using a string or an index number, both of which are less elegant solutions in my opinion.
Python doesn’t provide a built-in enum type, but I found a...
May 2011
3 posts
Nullege: Search engine for Python source code
Nullege is a service I’ve been using for a while. It’s a search engine for Python code. I’m quite surprised that I don’t hear much talk about it in Python-related blogs; it’s a pretty useful tool:
It shows you info about the class/function/whatever else you were searching for, and also places where it’s used in various Python projects found on the web.
Check...
Is something blocking you from moving to Python...
I didn’t move to Python 2.7 yet. That is, I don’t consider it my main Python version. My main version is Python 2.6. I consider Python 2.5 the past, Python 2.6 the present, Python 2.7 the future, and Python 3.x the distant future. When I package GarlicSim for end-user distribution I do it with Python 2.6.
Now, I’m a big fan of using the latest version of Python, in order to both...
GarlicSim 0.7 release's scope expanded, deadline...
Yeah, I’m postponing the deadline for GarlicSim 0.7 again. The new deadline for GarlicSim 0.7 is August 1st, 2011. (The old deadline was June 1st, 2011.)
The good news is that I’m adding a few more features besides those I promised in my original plans:
I’m vastly improving the SimpackSelectionDialog widget. This is what I’m trying to do with it:
(Thanks for the...
April 2011
5 posts
GarlicSim continuous-integration website, managed...
Check out the new “GarlicSim status” website:
http://status.garlicsim.org
It’s a Jenkins continuous-integration server which automatically pulls the most recent version of GarlicSim from the GitHub repo, runs the tests, measures line coverage, and displays all the results on the web.
It runs on ShiningPanda, which abstracts away a lot of the technical work involved in running...
New Wing 4 script: `instantiate`
Hey, I made a new script for Wing IDE 4. Users of Wing may want to check it out.
It’s called instantiate.
What it does is simple. Often you want to instantiate an object from a class like this:
cat_nip = CatNip()
The annoying thing about typing this is that you don’t get autocompletion for cat_nip because it doesn’t exist yet. But you do usually get autocompletion for CatNip....
2 out of 3 GitHub forks are completely empty
About 2 years ago I started the GarlicSim project on GitHub. GitHub’s most famous feature is “forking”: When another person forks your code, they create their own copy which they may work on and change the code, and later show you their changes (a.k.a. “pull request”) so you could merge those changes into your own repo. True open-source spirit.
GarlicSim was forked 4...
GarlicSim 0.6.3 released, becomes fully...
I have big news. I’ve decided to release the entire code of GarlicSim as open-source under the LGPL license. Previously, only garlicsim and garlicsim_lib were released under the LGPL, and the garlicsim_wx GUI was closed-source. Now I’ve released garlicsim_wx under the LGPL as well, so the GarlicSim project is completely open source. Yay!
I’ve made a new release, GarlicSim 0.6.3,...
The next revolution after Git
(Note: I talk a lot about Git in this essay, but the same thing can probably be said about Mercurial, Bazaar, et al. I simply use Git because that’s the system that I’m personally familiar with.)
I’ve been a Git user for a few years now. I love it. Being able to branch-n-merge freely is a very powerful tool for anyone who needs to manage a codebase. But I find that there is one...
March 2011
5 posts
Giving a GarlicSim talk in Jerusalem
On April 4th, 2011 I’ll give a talk about GarlicSim in Jerusalem, Israel.
The talk will be held at the computer farm in Shprinzak, classroom number 1, in the Givat Ram campus of the Hebrew University of Jerusalem. (Map.)
The talk will be held as part of the Jerusalem Linux Club. I’d like to thank Guy Sheffer for helping to organize this talk and the Hebrew University and its student...
My hobby: Following up on entrepreneurs
For a few years now I’ve been very interested in technology and entrepreneurship. I often get to speak to like-minded people, who are either undertaking an ambitious project or planning to undertake an ambitious project. Often these people tell me how awesome their project is and how big and successful it’s gonna be. And I’m all in for that kind of talk; I too think that my own...
GarlicSim's documentation is now user-editable
UPDATE: Unfortunately Copypasta died. It was an awesome project but it’s no longer maintained. I removed the “Make a Correction” buttons. It was released as open-source, so I hope someone out there adopts it. This could be a good start-up.
A while ago I stumbled upon a very cool tool by Kurt Mackey called Copypasta. As the website describes it: “Copypasta is a...
Open-source developers, please provide a roadmap!
This is the first part of the FOSS gripes series, in which I’ll talk about a few issues in the open-source world that I find annoying or counter-productive.
Today’s issue is roadmaps. TLDR: Open-source developers, please provide a roadmap!
Present-oriented and future-oriented projects
A roadmap tells you (1) where the project currently is and (2) where it’s going to be in the...
Wing IDE users: I want to see your scripts!
This post goes out to my fellow users of the excellent Python-dedicated Wing IDE.
A few months ago I decided that I want to work in a few extra automizations to my Wing setup. Wing gives you an API for writing scripts, so I wrote 4 scripts that I found useful and that I now use every day: flip-case, comment-braces, comment-hr and arg-to-attr. I open-sourced them and talked about them...
February 2011
4 posts
Nastiest Python list comprehension ever
I just came up with the nastiest Python list comprehension ever.
Here it is in all its glory:
def mystery(n):
a = list(range(n))
return [[i for a[::i] in [a[::i][::-1]]][0] for
i in a[2:] if a[i] == i]
I apologize in advance to anyone who will try to understand what this function does and how it works. Hint: It returns a bunch of numbers which have a certain mathematical...
GarlicSim 0.6.2 released!
I’m pleased to announce the release of GarlicSim 0.6.2! (Installation.)
This is a small release. Changes:
Testing and packaging architecture revamped; much more automatic now. The run_tests.py script runs the tests and the make_distribution.py script creates a distribution.
General improvements, bug-fixes, and test cases.
The garlicsim package is now mature enough to be classified as...
`cute_profile`: Profile your Python code on the...
GarlicSim module of the week
This is the fifth and last post in the GarlicSim module of the week series. This is a series of blog posts in which I explore different modules from the garlicsim.general_misc package. These are modules which are not specific to computer simulations; they can be relevant to any kind of Python program, and you are welcome to import them from garlicsim.general_misc and...
`ContextManager` and the `manage_context` method
GarlicSim module of the week
This is the fourth post in the GarlicSim module of the week series. This is a series of blog posts in which I explore different modules from the garlicsim.general_misc package. These are modules which are not specific to computer simulations; they can be relevant to any kind of Python program, and you are welcome to import them from garlicsim.general_misc and use them...
January 2011
7 posts
`address_tools`: More powerful replacements for...
GarlicSim module of the week
This is the third post in the GarlicSim module of the week series. This is a series of blog posts in which I explore different modules from the garlicsim.general_misc package. These are modules which are not specific to computer simulations; they can be relevant to any kind of Python program, and you are welcome to import them from garlicsim.general_misc and use them...
The miserable programmer paradox
What I call “the miserable programmer paradox” states the following:
“A good programmer will spend most of his time doing work that he hates, using tools and technologies that he also hates.”
This is a paradox in the sense that it’s a counterintuitive result; you’d expect that the bad programmers would spend their time with crappy technologies, while the...
`caching.CachedType`: A metaclass for sharing...
GarlicSim module of the week
This is the second post in the GarlicSim module of the week series. This will be a series of blog posts in which I explore different modules from the garlicsim.general_misc package. These are modules which are not specific to computer simulations; they can be relevant to any kind of Python program, and you are welcome to import them from garlicsim.general_misc and use...
Releasing my Wing IDE scripts
I love Wing IDE. But then again… I’m often annoyed by many of its less-than-brilliant parts; Wing’s shell tool is pretty mediocre, and in general Wing has various annoying bugs, in such areas as workspace management or nose integration, just to name a couple.
But I still love Wing IDE. Wing and me are like an old married couple. Sometimes I take Wing for granted because I’ve...
`caching.cache`: A caching decorator that...
GarlicSim module of the week
This is the first post in the GarlicSim module of the week series. This will be a series of blog posts in which I explore different modules from the garlicsim.general_misc package. These are modules which are not specific to computer simulations; they can be relevant to any kind of Python program, and you are welcome to import them from garlicsim.general_misc and use...
GarlicSim 0.6.1 released with inplace step...
I’m pleased to announce the release of GarlicSim 0.6.1! (Installation.)
This is a small release, but it has a bunch of interesting features:
Inplace step functions have been implemented. (More details about that below.)
A new module garlicsim.general_misc.context_manager has been added. I will blog about it soon.
The GarlicSim GUI now allow to use simpacks that are located anywhere on a...
GarlicSim 0.7 deadline pushed back to June 1st,...
I’m pushing back the release date for GarlicSim 0.7 to June 1st, 2011. Yeah, it sucks.
Good news are that I might do a small release soon, GarlicSim 0.6.1. If you want to speed that up, I’d appreciate comments and critiques on my new context_manager module. Feel free to comment on this module in the blog comments below.
December 2010
2 posts
The crunching widget: Changing world rules on the...
Last week I released GarlicSim 0.6, and one of its big features is the new “Crunching” widget. In this post I’ll explain what the Crunching widget is and what it’s good for.
This is the first mock-up I did for the crunching widget:
I made this mock-up in a notebook while I was hiking in Makhtesh Ramon in April 2010; That was about 8 months ago. And now here’s the...
GarlicSim 0.6 released!
I’m pleased to announce the release of GarlicSim 0.6! (Installation.)
Here’s a screenshot of the GUI: (click to enlarge)
(The GUI is a completely optional part of GarlicSim; You can use GarlicSim as a normal Python package by doing import garlicsim.)
This is the biggest GarlicSim release ever, comprising of around 1,100 commits made over a period of five months. This last month...
November 2010
1 post
Technology principle: The toy will win
In this post I will explain an important principle that I noticed in the technology world. I call this principle: The toy will win.
What does “toy” mean?
Here’s my definition for toy:
Toy [noun]: A technological product which is simple and fun to use, and which may be criticized by some people as being weak and not suitable for serious work.
The iPod is a good example of a...
October 2010
4 posts
GarlicSim 0.7 deadline pushed back to April 1st,...
Unfortunately I have to push back the deadline for version 0.7 of GarlicSim to April 1st, 2011.
Yeah, I know, I’m sorry.
Note that the upcoming release, GarlicSim 0.6, will still ship by January 1st, 2011. (Details about features planned for 0.6.)
(Update: This is an old blog post; Go here to get started with the current version of GarlicSim.)
Thinking of your software as a butler is difficult...
Short version:
The goal of a software product is to serve human beings. A good software product caters to the user’s whims, even if it means doing something hard and technically complicated just to save the user one click while he is watching pictures of lolcats. The way a good software product treats the user is kind of like the way a butler treats his master.
Now, we software developers...
The value of a startup idea, or "Are startup ideas...
Many people speak with me about startup ideas. People who are not startup-savvy often treat startup ideas like they were invaluable business assets. Some memorable phrases from these discussions are “I’ll tell you my idea, but promise you won’t do it yourself” or “If you’ll end up doing this idea, you’ll need to pay me a royalty.”
People with more...
Cool Python module: `uncertainties`
I recently came upon a very cool Python module: uncertainties (PyPI entry.)
What this package does is allow you to speak about numbers while taking into account any possible errors that these numbers contain.
For example, let’s say you are buying a few dozen bottles of beer for a party. You go to the grocery store, where you are happy to see a variety of different beers of different...
September 2010
2 posts
Python idiom for taking the single item from a...
It sometimes happens in code that I have a list, let’s call it stuff, and I know for certain that this list contains exactly one item. And I want to get this item and put it in a variable, call it thing. What’s the best way to do this?
In the past I used to do this:
thing = stuff[0]
But I think that’s not the best idiom. I came up with a better one:
(thing,) =...
I made the 1,500th commit! GarlicSim 0.6 is on the...
Today I made the 1,500th commit on GarlicSim! Here is the lucky commit.
I’m working on GarlicSim 0.6 now: I made big architectural changes to the way crunching works, and the way that step profiles save step arguments. These changes will enable a feature I wanted to add for a long time: The crunching widget. This widget will allow to control the crunching of the simulation, including...
August 2010
2 posts
You know you're a Python programmer when…
A few months ago I had the idea to start a humor page in the style of “You know you’re a Python programmer when…”
I never got around to it until now. I did the first three entries below, if anyone has more ideas please submit them in the comments!
You know you’re a Python programmer when…
…You’re fairly certain that “Removing the GIL” is one of the...
My first cloud bomb
In the last month I’ve been working on a few things for GarlicSim:
PiCloudCruncher: A cruncher that crunches the simulation on the cloud instead of the local computer, using PiCloud.
A “Crunching controls” widget, which will allow to easily change cruncher type and crunching options in the GUI.
Better keyboard shortcuts in the GUI.
The cloud thing is really exciting. Aaron...
July 2010
5 posts
GarlicSim 0.5.1 released!
Today I made a small GarlicSim release: GarlicSim 0.5.1. Download it now!
What’s new in GarlicSim 0.5.1?
The iter_simulate function. This is like list_simulate, except it crunches the states lazily. Check out tutorial-1 for an explanation.
The Project.iter_simulate method; Similar to iter_simulate, except for Projects.
Fixed Project.simulate to work on endable simulations.
Miscellaneous...
Slides and mindmap from GarlicSim talks in Israel
In the last month I’ve given two talks about GarlicSim in two different regions in my home country of Israel. I’d like to thank the Haifux and the TelFOSS clubs for hosting these talks!
The talks went well, and a few people started toying around with GarlicSim as a result; I’m very happy about that.
Here is the slideshow I used in the talks, downloadable as a PDF:
Download...
Will give away firstborn son in exchange for...
I really need to get some feedback from GarlicSim users.
(Okay, I’m not going to trade away any future children for feedback, unless they grow up to be Java programmers.)
I released the first version of GarlicSim, numbered 0.1, about 8 months ago. Since then I’ve made several releases, and today we’re at GarlicSim 0.5. Over the time GarlicSim was available, I could see that it...