tonybaldwin | blog

non compos mentis

Posts Tagged ‘tk

eXp0stulate – x-posting blog client

leave a comment »

I’ve decided to take the code from TclTherapy (insanejournal client), and TkLJ (livejournal client), and join them together, adding functionality for DreamWidth, as well.
I have successfully merged the code, and X-posted to all three of the above mentioned blogging services.

I’ll be calling this new bit of hackery
since it x-posts.
I’d like to add wordpress and blogger funcationality (especially since THIS blog is WordPress blog), but I believe that will require my learning to get this thing to write out an xml file and play nice with the xml-rpc protocol, rather than just sending a flat entry via http post.
Not sure…either way, it’s just a matter of time.

I also want to get it to download and edit older posts.

Written by tonybaldwin

March 25, 2010 at 9:29 pm

Python v. Tcl/Tk (denting & tweeting)

leave a comment »

python v. tcl/tkSo.  I have now made two little denter/tweeter programs (to send updates to and, one with Tcl/Tk, the other with Python. I figured a little comparison, perhaps, was in order.

If you look at them, of course, they look, well, just about the same.  Tkinter is, after all, analogous to Tk.
The Tcl/Tk program made it incredibly simple to display the response from the remote server, which I haven’t succeeded in doing with the python script, yet.  Both rely on calling an external program (curl) to send updates, rather than relying on the languages’ built-in tools.  I could probably work out HTTP POST in tcl rather painlessly.  I did try to use python’s urllib to post, unfruitfully, and resorted back to calling curl.
the links: iDenTickles (tcl/tk) / iDenTweetyPie (python)
the code for both programs is available at the above wiki links

The Tcl/Tk program, which has the added feature of displaying the server response, has only 47 lines of code, 245 words, 1844 characters.  It took me less than an hour to write it.

The Python program, however, which does precisely the same exact thing as the tcl/tk program, without displaying the server response, has 104 lines of code, 564 words, and 4073 characters.  It took me the better part of a day to write it. Oh, but the python program does tell you if your post is too long, something I neglect to program into the tcl/tk script. That’s a bonus.
One must ask oneself, of course, is this a testament to the power and simplicity of tcl/tk?  Or, is it simply an indication of my lack of skill with python?
I can’t answer that defnitively, but, to me, it really looks like tcl/tk is a bit more efficient.  Admittedly, I’m not a very skilled programmer at all, in truth.  Timewise, of course, I have been writing tcl/tk for a couple of years, and only just now delving into python. As such, I was able to throw the tcl/tk program together quickly, while, my efforts to “translate” my tcl/tk program into python required a bit of research on the syntax for writing tkinter guis, and other elements.  It just really looks to me as though Python/Tkinter takes a lot more code to do the same thing.  I really have drawn that conclusion.  Especially building a gui, it seems, is more cumbersome with tkinter than with simple, good old tcl/tk.  I know there are other means of building a gui with python (wxwidgets, pygtk, pyqt, etc.), but I wanted to try the one most similar to that with which I am already familiar, and, I believe it is a fairer comparison when using a similar gui ToolKit.
At this juncture, I do have to say, I feel a great loyalty and deep affinity for tcl/tk.  I don’t understand why it isn’t in wider use, frankly.  It is an incredibly powerful language, used for a vast array of purposes, and, in my opinion, is probably the easiest programming language to learn (of course, I haven’t tried them all), especially for a beginning programmer.  One can be up and running, creating useful programs in a relatively short time.  I also feel the need to give kudoz to the tcl/tk community and the wiki, which is replete tons of example code, detailed explanations, and great resources for learning how to program in tcl/tk.  The tcl-ers that hang out at #tcl on, additinoally, are extremely helpful, and patient.  They won’t hold your hand, but they’ll tolerate a newbie, and point them in the right direction, without any snobbishness or derision.
I can’t say the same for my experiences with pythonistas.  Their irc channel was a little less friendly, imho.  Maybe I just caught them on a bad day, or maybe I was having a bad day.  After all, Pythonistas are known for having a sense of humor.  Admittedly, I was frustrated when I finally went to their channel for a bit of support, and frustrated, whiny n00b is no fun to play with, any way.  Moreover, the python community does have a lot of documentation available online. Nonetheless, to me, it seems that it is written for other programmers, not for the uninitiated, so, is not so easily read as much of the tcl/tk resources.  Their sample code is not well explained, where someone new to programming can really make sense of it. This may also be a function of time, since tcl/tk has been around a bit longer than python.
I do want to make it very clear: I’m really not here to pick on python.  I know that it’s a powerful language with a great many uses, and a favorite of a great many real hackers who know a lot more about programming than I do.  I will continue to learn to write it, and believe it will serve me quite well for various purposes, and I believe I will continue to have fun learning it.  But, I think I might continue to point out how tcl/tk is much easier and seemingly efficient, too…

Written by tonybaldwin

March 22, 2010 at 8:28 pm

TransProCalc, Google Code, & Subversion.

with 3 comments

A few days ago, as mentioned, I initiated the process of moving TransProCalc onto google code, feeling that it was time to dust off the project and move forward with it. I had merely signed the project up at that time, so, last night, before my brain turned to complete jello after spending the day slogging through the translation of some pretty heavy Brazilian academic articles, I took some time to configure the google code pages for the project, make a couple of wiki pages, upload the current, stable release, and, upload the existing code for the project.

Now, google code offers two version control systems, Subversion and Mercurial. I’ve never used either one before, but, at least I’ve heard of Subversion, so I chose to go with that one. It is, apparently, the default system, Mercurial offered as an option. I have used CVS before.

So, I aptitude installed subversion (svn) from the debian/lenny repos, and set about trying to import my code for the first time to the project.
The instructions on the google Subversion FAQ for importing your code are rather succint.

Just use the ‘svn import’ command.

Very thorough…
So, the first thing I did was, logically, try to read the man page. Now, people frequently complain that man pages are written for the hopelessly, inhumanly geeky, and not very useful for the rest of us (ok, I do write code, but I am far from being a real hacker, yet), that they are written in some secret language, and that they are generally useless. Of course, those in the know say to read them, and find them rather useful. I confess, I have actually come to the point where I can make sense of some man pages. I’m not even ashamed to admit it. Some of them are insanely usefl (ncftp, for instance, has a very thorough man page). So, I called up “man svn”.
This is what I got:

svn – Subversion command line client tool

svn command [options] [args]

[sarcasm]That certainly cleared everything up for me…[/sarcasm]
How about explaining the options? What args? Hello!
I tried “svn help”, and that gave me a list of commands, as least, but with no explanation of how to implement them, or what they did, what options or arguments could be passed to them… Folks, the Subversion project needs documentation writers. No doubt. So, I did the next natural thing, then, and did some googling.
In defense of subversion, I must say, they have an entire book/manual for Subversion, available to be purchased in print, or read online for free. Perhaps the man page should give the link/location thereof, at least.
Of course, the instructions I found in said book was to import my code to my google code project, were a bunch of cryptic garbledy-gook, and said nothing of importing to a remote repository, only creating a repository on a local machine. I needed to import my code to a remote repository.
I did some ranting on some forums, to no avail of course (ah, but the sweet release of venting…), and did some experimenting.
I ended up resetting the repository a total of about 4 times, before I finally managed to figure out how to a) set up the svn repo at my end, b) import the code to google, and c) check in and check out.
So the code is up there, now.
Now, there do seem to be instructions available for checking out and checking in. That’s not too bad. But considering the complete lack of instruction on how to actually import the code of the first time, I thought I’d share the culmination of my efforts.

:~$ cd /path/to/project/files
:~$ svn import –username yourname

There! Your code is imported to the svn repo… I know; Looks simple, but there was nowhere that I could find an explanation thereof.
(okay, it might as well be martian to some of you, dear readers, but those who write code and participate in open source software projects will understand).
Happy? I am.

So, TransProCalc is now up on google code and ready to start a new life. I actually made a few minor changes to the code already, last night, before loading it up there, but not enough that I would call it a release or new version…just a little clean up, rewrote the install script, and, more than anything, a lot more commenting, since I’m hoping to have collaborators. Commenting your code makes it easier for others to find stuff and figure out what you’re doing.

And, happily, I have a collaborator already! Anindita Basu, who had previously written a manual for TransProCalc, has rejoined the project (it’s been out of development for nearly 2 years, recall).

I have big plans for TransProCalc, many new features to be implemented, including but not limited to incorporation of a providers and client db, more user configurability of project parameters, and a calendar/reminder system to annoy you when invoices are due (either to you, or to your providers).
No time to work on any of that today, though…back to these articles…

Written by tonybaldwin

March 3, 2010 at 8:10 am

Tickle Text 2.1 (full scoop)

leave a comment »

Okay, here’s the skinny on Tickle Text 2.1.

I know…I just did 2.0 last week…

So, let me go over all the new features, since, I have added features I haven’t yet listed here, too.

2.0 added:
fpt tool to upload/download pages/scripts to a webserver
comment/uncomment lines
templates for perl and python scripts
saving user preferences and color theme
some help dialogs

2.1 adds:
updated Tickle Dictionary (last release still had outdated version integrated).
python shell
and, of course, Livejournal posting.

I have updated the tarball at Sourceforge, of course,
and, updated the Tickle Text home page

Tickle Text is still a long way from emacs…and, thank the GODS!
At least my keybindings make sense on a modern keyboard!

I’m pretty proud of myself.
I started learning bash scripting in November, started learning tcl in January, and, yet, I have a pretty useful little editor out there…
I rock!

Written by tonybaldwin

September 14, 2008 at 11:17 am

tclscreenUp, again

leave a comment »

Working on tclscreenUp again…
I have allowed the user to set the image dimensions, and have allowed them to include the browser variable
in their profiles (don’t know why I didn’t do that before).
Oh, yes, and, when the preview comes up before upload, I added a button to open the image in GIMP
for editing.
I’m going to add the same features to TclUP, momentarily, tar ’em both up, and, using TclUP, of course,
upload the tarballs…

Written by tonybaldwin

August 23, 2008 at 7:48 am

Stop! It tickles!

leave a comment »

Just quick.
I added the feature of saving a profile on both TickleScreenUp (takes a screenshot, uploads it to a remote web server and shows your the url for quick posting to LJ, or elsewhere, and allows you to preview the image, both before upload on your machine, and after on the remote host)
and TickleUP (quick-n-dirty ftp up/down loader tool).

It will save your server information (host, path, username, password), so you don’t have to type that in every time.
You can have as many profiles as you want, of course, for different servers, etc., and just choose one to open when
using them. It also offers the choice to NOT save your password with the profile, of course, if you’d rather not have that stored with the profile.

I uploaded two new tarballs (and this time included a readme and the GPL):



Written by tonybaldwin

August 22, 2008 at 11:17 am

Posted in hacking, info technology

Tagged with , ,

TclUP & TclScreen

leave a comment »

I used what I learned today writing TclScreen to write my own little, quick ‘n dirty ftp client uploader & downloader,
Basically, all it does is upload a file to your server, then tell you where it is, and, then let you
open a browser to preview it, on the remote server, or download a file, and tell you where it is on the local machine.
Quite simple.
Here’s a screenshot (taken with TclScreen):

Get the code: TclUP tarball.

I also did some editing to TclScreen (you know I never leave anything alone until I get really bored with it).
I gave the user the option of setting a delay before snapping the shot, so they can, for instance,
minimize the TclScreen window and get it out of the way, etc.
Here’s another shot taken with the new TclScreen:

Get the code: TclScreen tarball.

Written by tonybaldwin

August 22, 2008 at 12:28 am