Archive for the 'Open Source' Category
I maintain a reasonably popular app called Asunder. This app has in its preferences a GtkFileChooserButton, and implementation of the (supposedly) interface GtkFileChooser.
I’ve been getting bug reports about the selected directory not being saved when you save the preferences and looked into it again today. I could hardly believe what I found.
If I double-click on the directory I want selected and click “Open”, what I get looks like this:
But gtk_file_chooser_get_filename() returns.. “/home/andrew”. I dug and dug through my code and the GTK reference looking for an explanation, but found none. After experimenting some more I found the problem:
This only happens if I double-click on the directory I want (“temp” in this case). If instead I single-click on the directory I want – I get it. Using other GtkFileChooser getters doesn’t fix anything. So this is not a bug in my code (in fact I don’t think I could hack around this even if I wanted to), this is probably some retard deciding that his 0.001% use case is more important design-wise than everyone else who uses GTK.
I guess that’s just the way things are in a lot of open source. Instead of being brushed aside because you’re not the highest-paying customer your needs are brushed aside because they aren’t matching someone else’s vision.
There’s a chance that this is an honest bug (not a design decision), but how is one to know for sure? I mean look at what they’ve done to KDE4 and Gnome3.. my faith in open source is starting to waver.
I ran into a major issue with LibreOffice today, the version (3.6.22) that comes with LinuxMint14. It will not open the spreadsheet with my grades for last semester! It just hangs there at “Loading document”. Same thing happening on both computers I have that are both running the same Mint.
I hope this is not a sign of things to come.. There is no alternative for linux. I don’t want to be as screwed as the Mac people!
Thankfully the file opened in a Windows vm where I installed 3.6.4
Hey look, it’s 2012/12/12 – cool! But that’s not what this post is about.
It always pissed me off big time that the more popular Linux distros don’t install the development files (like header files) or the documentation for the software that comes with them. Being a developer – this is a big pain in the ass for me. It became a really big pain in the ass when I switched from Slackware to Linux Mint a couple of months ago.
I’m no free software fanatic, but damn, why the hell not include the development tools and documentation with Linux? Not only will that make my life easier, but it may encourage some other people to dabble in programming on Linux. Otherwise, do you know what a serious roadblock it is to get a newbie to figure out that there’s a metapackage called build-essential and a package called libgtk2.0-dev which you have to type in exactly like that, with the lib and the dot and the (wrong) version and the dash and the dev? Hell, it’s easier to set up a development environment in Windows (you should be ashamed, Debian).
Whining about it would have been enough, but I actually needed to solve this problem, so here is the solution, you can use it too. It’s a shell script you can download here or copy paste from here:
#!/bin/sh # # install-all-dev-packages.sh # # Author: Andrew Smith http://littlesvr.ca # Version 1.0 (12 Dec 2012) # # The following script installs all the -dev and -doc packages that should have # been installed with your software but were omitted for some stupid reason. # # Tested on Linux Mint 13 but should work on any Debian/Ubuntu/Mint # or really on any Debian derivative. # # If you get errors like A : Conflicts: B but C is to be installed # then add those packages (all of the A) into the following list: BADPKGLIST="libdb5.1 libglew1.5 libglew1.6 librdf0" # List of all available packages apt-cache pkgnames > /tmp/allpackages NEWPKGLIST="build-essential" echo "Searching for required -dev and -doc packages..." for PKG in `dpkg --get-selections | cut -f 1` do # Make sure it's not in the ignore list echo $BADPKGLIST | grep -q $PKG if [ $? -eq 0 ] then continue fi # See if a -dev package is available grep -qe "^$PKG-dev$" /tmp/allpackages if [ $? -eq 0 ] then NEWPKGLIST=" $NEWPKGLIST $PKG-dev" fi # See if a -doc package is available grep -qe "^$PKG-doc$" /tmp/allpackages if [ $? -eq 0 ] then NEWPKGLIST=" $NEWPKGLIST $PKG-doc" fi done echo "The following packages have been found:" echo echo sudo apt-get install $NEWPKGLIST echo echo -n "Do you want to install them? (y/n) " read YN if [ a$YN = ay ] then sudo apt-get install $NEWPKGLIST --install-suggests fi if [ $? -eq 100 ] then echo echo "If you got apt-get erros such as 'A Conflicts: B but C is to be installed'"\ " then make a change at the top of this script to ignore those packages,"\ " hopefully that will work." fi
There is potential for some typical apt-get quircks with the “bla bla is to be installed screw you haha” messages but that’s solvable, you just need to edit the script and blacklist those packages that are erroring. Presumably the list will be different on different OS versions.
Enjoy, you’re welcome!
I’ve been working on this project part time for a while now, and finally it started bothering me that I couldn’t google the requirements document. That is so because I haven’t publicised it yet, so here you go:
The first step has been to create a requirements document, which I’ve done, on a wiki like real men do. Here it is. It’s complete enough to give you an idea of the scope of the project and some context for some of the posts I will be making.
Progress is pretty good so far. I don’t know if I’ll be putting anything up until there’s at least a playable prototype ready, but maybe. I’ll keep you posted.
New post added to Linux Stuff: Brother HL-2270DW on Slackware.
I had a diploma and degree version of a multimedia course in the summer, where half the course was about HTML5 technologies.
The major assignment was for students to implement a functional animation of a data structure and/or algorithm. There were a few of them to choose from.
It took me a while but finally I managed to compile the best of the assignments into a demoable webpage with all the right copyright text in the code.
Have a look yourself, it’s really good stuff!
SVG has been a nightmare over the last decade. It used to be that every implementation is different, no one software created files compatible with any other software. These days the situation is a lot better, but I’m still suspicious of SVG.
But I’m thinking of using it for a Processing.js project, so how do I test what software will create SVG files that will display in a Processing.js sketch? I build a tester of course. You put in your SVG file and it will do its best to render it into a Processing.js sketch. Then you can compare that with what you expected to see.
I may pull it down though, I’m concerned that it will allow people to upload random files to my server, sort of like the APNG assembler… that’s going on my todo list.
What I found so far: SVG files created in Inkscape don’t show well at all. SVG 1.1 files exported from Illustrator CS5.1 seem to work perfectly, though I haven’t tried anything too advanced.
A bit of background: we are trying to port a game written in Adobe Flash to HTML5 using Processing.js.
An SWF (Flash) file is placed inside a page using HTML <object>/<embed> tags. The size of the SWF as displayed on the user’s computer is dicated by the width/height attribute of the <embed> tag and if that’s a percentage – the size of the parent container.
Because Flash is all vectors (let’s say for simplicity’s sake) – it can be displayed very nicely at any size, and if you specified 100% for width/height then the size of the SWF on the page will be automatically changed when the browser window is resized.
That’s really nice, and makes thinking about differently-sized screens for your application unnecessary – Flash handles it all for you automatically.
Canvas/Processing.js – scaling at all
Not so with Canvas/Processing.js. You specify a desired fixed size and that’s that. No 100%, no auto stretch, nothing. That’s called a problem in search of a solution!
I tried lots of things, but the first thing I got to work was using CSS for the sizing. You can set a width/height CSS property on your canvas and then the CSS renderer will do the scaling, positioning, and the reflow. Unfortunately though this is the simplest form of resize and it looks aweful even if you’re only scaling up a little.
So even though you can do this resize dynamically – it’s pretty useless other than as a reflow reference.
Then I looked some more at the Canvas scale() function, and its equivalent in Processing.js. This one does a rescale of everything, but transparently to the code. So evn if you were drawing a line from 0 to 200 – that instruction would be changed behind the scenes with a scale of 4.0 to 0 to 800, resulting in a properly drawn line:
Much nicer! All the lines in the sketch are drawn using line() and ellipse(), the image on the top is a JPG and the one at the bottom is an SVG. The one thing that makes this tricky is that you need to change the size of the canvas as a separate step from the scale() call and the order of the two calls matters.
Here is a live demo for you to see it yourself.
Canvas/Processing.js – auto scaling & reflow nightmare
I thought – “great, I’m almost done!” but I thought that too soon. The problem is – even though I can do nice resizes, it will not happen automatically. So I’m still a way off from the Flash sample I started this post with.
I tried for a few hours and got it to almost work, but in the end gave up. Even a hacky implementation with my sizing the canvas to the parent element’s size didn’t work very well at all. I won’t go into details, it’s complicated stuff.
So I’ve gone for a compromise. Instead of resizing to any parent element – I assume the Canvas’s parent is the body (with no padding/margin), listen to onresize events for the entire window, and scale the canvas to the size of the window. Not universally useful, but still way better than nothing.
Here’s a demo (resize the popup window to see it).
Probably not for me, not in the near future. It would be great if this problem was solved universally – not only for all use cases but for all browsers. I have other things to do though, so I don’t think it’s going to be me looking into this further.
Wow, Linus himself used ISO Master and mentioned he liked it in a blog post (or whatever that Google+ thing is), I am so flattered!
I would post a thank you response there, but I don’t feel like signing up for an account (yes, I am very happy living without most google services).