Archive for the ‘Hacking’ Tag
Tomboy Hackfest Tonight at the Novell OSTC
Well be hacking it up tonight at 6:00PM MST at the Novell Open Source Technology Center. The rough TODO for the night seems to be Tags, Tasks and maybe even a backend to query Beagle.
Anyways, if your in the greater Salt Lake City area, come on down! If your a little further away but want to join in anyways, join in on #tomboy!
See you tonight!
How Much I Rely on Class Libraries
Ok, so I was stamping out a recent (quite simple) assignment for a class. The assignment required the separation of each place value in an integer. Since the information came into the program as a string, I stamped out a simple solution using some easy loops and handy methods available in the String class (of the .Net 2.0 class libraries). However, a quick skim over the rubric included 5% for correctly using div and mod to parse out the integer values. I immediately flipped back into my program, then froze for a second..
then another…
then 2 more…
I was completely blanking. I know its a simple task, its just I have become so accustomed to the incredible abundance and availability of a dozen methods for every little task that I blanked for a good minute, just stonewalled. I knew I had written this code before, everyone has done it at least once in some ‘Intro to Programming Theory’ class, and the concept was easy enough, but it just wouldn’t come. Cursing the professor for such a trivial demand, I went and got a cup of coffee.
Upon returning I realized how stupid and petty I was being. While I do often rely on cool class libraries and the methods they provide, I really just have to stop being so self-righteous and realize how likely it was that much of the class would be completely stuck on such a task. We spend so much time today learning about existing technologies and API’s that we forget the core of programming: Problem Solving.
I quickly slapped together the following C# method:
static int[] toIntArray(string input)
{
int i = 0;
int digit;
List<int> ints = new List<int>();
for (int numdigits = input.Length; numdigits > 0; numdigits–)
{digit = Convert.ToInt32(input) / (int)Math.Pow(10.0, (double)(numdigits – 1));
digit = digit % 10;
ints.Add(digit);
i++;
}
return ints.ToArray();
}
In retrospect, its quite simple, I just hope that this was my ‘moment of realization’ and I don’t get so inundated again as to the point where I can’t do the simple stuff on my own anymore.
SqlLite Linq Provider
Ok, so as many of you may have noticed in my last post I’ve taken a real interest in C# 3.0 and its new nifty features. Now, I’m mostly just excited for the simple collection manipulations, but the whole Linq to SQL thing is nagging in the back of my mind. Now while complete CRUD will no doubt take some serious code, simple query support is not that difficult to implement. After following mattwar’s blog series on a generic DB provider for Linq, I decided that I wanted that awesome glory against a lean and mean sqlite db.
So, about an hour or so of messing and meddling I have a few samples working. (The attached zip) Its a Visual Studio 2008 Beta 2 project (I’ll be writing autotools magic for mono later this week) so sorry for that, the code can still be imported into Monodevelop, just the solution/project files won’t work. Anyways, I have tested a smattering of JOIN’s and all sorts of simple selects without issue. However, the elements of sqlite that behave differently tend to do so silently and without complaint, making it harder to be certain that everything is working. However, I’m planning on fleshing out a set of test queries, however, for now I could really just use the help with testing/checking the SQL (as I’m no sqlite Guru).
Known Issues
- DataType sloppyness – I hope to handle this better (storing a DateTime string in TEXT would extract to DateTime successfully) right now you need to pretty much just use strings or numeric values.
- Inefficient Queries – Not being a Sql master, I can’t say that much of whats generated is the best way to do things, please, if you know then share!
- OrderBy issues – Its just hard as heck to get working, it seems to work fine sometimes, but no promises.
Anyways, play around, have fun, and note that you need the Sqlite provider for ADO.Net (duh).
I’m looking at db_linq, which is a full (bi-directional, change tracking, general awesome crazyness) solution, this is really just a way to query sqlite db. I might try to add a sqlite provider to db_linq at some point, its just that their system is very different from my implementation, so there wouldn’t be too much shared code.
The Changing Face of High-Level Programming
Ok, so I’m sure most MS .Net dev’s have already seen these posts far too many times, for the Mono users out there, I have a little treat. While Moonlight and WPF get tons of hype, I think the biggest and most exciting change coming soon to a C# compiler near you is support for lambda expressions, anonymous types, and extension methods.
Now on the whole this doesn’t sound all that exciting, I mean, before a few months ago, I had never really used lambda expressions to accomplish much beyond pass that unit in an intro to CS class. Individually, there’s nothing to jump for joy about, but when used in conjunction, we can produce startlingly clean and readable code.
To demonstrate this I’ve whipped up two examples that I was fiddling with as I read a million tutorials. They aren’t fancy XML or Database providers, just some simple (and quite common in my experience) text parsing tasks that have disproportionately complex code. We will use some of the new C# 3.0 features to make far cleaner and more readable code.
The first example is an exclusion string, or a set of characters that are not allowed in another.
var illegalchars = "abcdefg";
string testString1 = "Kevin";
string testString2 = "hijkmlppp";
The ‘old’ way of checking both strings for one of the illegal chars:
foreach (char c in illegalchars) {
if (testString1.Contains(c) || testString2.Contains(c))
Console.WriteLine("illegal char!");
}
Using awesome new stuff:
if (testString1.Intersect(illegalchars).Any()
|| testString2.Intersect(illegalchars).Any())Console.WriteLine("Linq found it too");
Our next example is ‘exploding’ or splitting a series of values out of a string (CSV and PSV are common examples of this) into an array:
string pipeDelined = "Kevin | McCool | Kubasik";
An old solution might have been (I know we could optimize this, or clean it up, just making a point
):
List<string> names = new List<string>();
foreach (string s in pipeDelined.Split('|')) {
var ts = s.Trim();if (ts == "") continue;names.Add(ts);
}
var allNames = names.ToArray();
Using our cool new C# 3.0 tools, we can change this to the super-sexy:
var allLinqNames = pipeDelined.Split('|')
.Select(s => s.Trim()).Where(s => s != "").ToArray();
While a hardened child of OOP (via C# and Java) might baulk at the new syntax, I think that it can quickly start to grow on a developer. Moreover, it has the distinct advantage of being unambiguous, and makes reading someone else’s dense code much more fluid.
I really can’t wait for C# 3.0, and not for those flashy API’s, just the simple syntactical sugar that is already making me lazier by the minute.
Relationships in the Desktop – Relational Desktop Search and Beagle
I’ve been working on and off on a writeup concerning the use of Beagle to build an intelligent ‘rank’ for desktop entities. Or, in short, a Ranking system (not unlike Page Rank or the like) to organize desktop search results by far more than just keyword/date. I know the writing sucks, and its not 100% complete yet. In addition, I don’t have much in terms of code to share (yet).
To summarize (for those lazybones out there) I’m thinking of utilizing fairly universal and constant relationships (Creator, Creation Date, Modification Date(s), Parent/Source, and maybe others) to recurse deep into desktop relationships. By adding relevancy to the root hit for every child it has (logarithmically decreased by recurse iteration) we can have far more accurate desktop search results when querying a simple keyword/phrase. In addition, the children of a hit could often be considered hits themselves, if found in enough ‘root’ hits.
Its a loose and patchy idea, and miles from a realistic implementation, however, thanks to the awesomeness of Lucene, comparing 2 in-index documents for textual relevancy (based on Term Frequency) is not impossible. (I have not considered the performance elements of these comparisons yet, they may be too slow to be realistic without serious optimization)
Anyways, I’m working on it in Google Docs, so you can check out the full document here. I’ll post once I’ve finished my research/planning etc.
Please, share your thoughts! This is in the ‘major brainfart’ stage, so its open to whatever from anyone, I want to hear ideas!
Technorati Tags: beagle, desktop search, lucene, search rank, gnome, mono
Powered by ScribeFire.
Port of Mirage to Windows
So, while I’m at work, I tend to have some sort of music going on in the background, since I don’t have my whole personal library available (at least, not yet), I’ve become a member of the streaming radio revolution. The obvious choices (for personalized stations, and music you actually want to listen too) are Pandora and Last.fm. I’ve really grown to like both services (although I have a slight preference for last.fm at the moment) the main issue for me is that I have 5,000 songs sitting on my hard drive, all artists I like, so why can’t I get the same awesome intelligent matching among those tracks?
Mirage is an implementation of a Masters thesis on music analysis, the proof of concept code was written in C# (under mono) and targeted at Linux, specifically the Banshee music player. When at home, I love Banshee, I’ve done my fair share of development work on it, and always have a fresh svn checkout of it to see whats new. However, work is on a Windows machine, and I want this cool nifty awesomeness their as well. As a result, I have embarked upon a port of the Mirage library, as well as the creation of an iTunes plugin to make this code useful
Since I figured some other people might be interested in this I made a project at Google Code. There’s not much their yet, just some clumsy stabs at working with Visual Studio (I’m using the 2008 Beta 2… its ‘free’ as in Beer). Anyways, I’ve jotted down some erratic thoughts as to possible goals/design choices.
The current installer should run fine if you have iTunes installed, and parse mp3 and aac files fine. (sorry 32 bit only at the moment) However, I really need to do some more investigation before I’ll know if I’m passing the right data into the library.
Anyways, its cool and all kinds of fun to start using COM
If anyone has experience with windows ports and wants to lend a hand or some advice, its all more than welcome.
Technorati Tags: c#, music analysis, smart playlist, iTunes, last.fm , pandora, mono, mirage
Powered by ScribeFire.
Real Beryl
I know that the Beryl Project is fading from existence, but I still couldn’tTestimonials for penis enlargement pill . help myself when I saw this enormous chunk of it at the Smithsonian.
Beagle Search Support in GtkFileChooser!
Finally! Perhaps one of the last major features that Beagle needs to match Spotlight and Windows Live Search. Integration into every file choice made in the Gnome environment has long been a dream of mine, and a little less than a year ago, this bug was filed with hopes of making that dream a reality. After lots of hard work, a rough cut of the patch has been committed to the gtk+ trunk, with plans to add missing features in time.
While it will still be some time before this code reaches a Gtk+ release (development releases for the next major series start in late April) its great to feel some awesome love from our friends over at Gtk, a special thanks to Federico Mena Quintero for really being the driving force that finally got this done. What great is that plans for using Beagle’s index to help GtkFileChooser already seem underway.
For any budding Gtk+/Gnome/Beagle hackers out their, this feature still needs a lot of love. A list of bugs/todos exists here, and if someone were to get the ball rolling on anything on that list, it would be a huge help!
And last, the obligatory (if unexciting) Screenshots:
Here were searching for a Mail Attachment in Evolution.
And here we search for a file to upload in Epiphany:
A Call for Help
Ok, since my recent post on Dashboard there has been scattered interest in helping revive/work on Dashboard, so I wanted to post a list of things Dashboard needs before we can really look at making it usable at all.
- libdashboard
- Or as its better known, a C library that generates valid, parseable clues. This is not only critical since most plugin authors aren’t going to want to spend the time validating that mono can deserialize all their XML. But because we can generate bindings for most every other language once we have them in C.
- This is a huge one, Dashboard is still pre-alpha, and mostly proof of concept. While the code base could be brought up to production level, it needs tons of cleanup. This is where an army of open source dev’s can help the most, compile and install dashboard from SVN, then just play with it, and every time it crashes, track down why, and try to make it sane. This is long, slow, tedious, and thankless work, but it is an absolute necessity if people want to start using dashboard, as even simple race cases will crash dashboard most of the time.
- You have to be a little more familiar with the Beagle/Dashboard code base to help out with this, but we need them for a huge spread of plugins, and almost everything beagle can generate.
Just a note, I posted this list on the Dashboard Wiki.
Technorati Tags: linux, gnome, dashboard, mono, beagle, search
Powered by ScribeFire.
Applying for Ubuntu Membership
As I find myself getting more involved with the Ubuntu community and specifically the packaging of Beagle, I decided that it might be about time to apply for official Ubuntu Membership. I always feel a little odd in these situations, much the same as when I applied for membership to the Gnome Foundation. It feels weird trying to itemize and quantify my contributions, and moreover, I’m not a very good bragger when it comes to computers.
While the application process isn’t my favorite, once I commit to it, I find that there are plenty of tools that simplify the process, my blog not being the least of these, as its a nice reminder of what I have worked on. The harder part is deciding when its appropriate to apply, most guidelines on such topics are pretty vague, and to compound things, the most visible members tend to be hacker rockstars that are so above and beyond the accepted norm for membership that intimidation is almost impossible to avoid. I don’t mean any of this as a critique or attack, just my personal feelings and observations as someone slowly getting more involved in the community.
But I digress, The purpose of this post was to ask for anyone who was willing to give a quick glance over my wiki page at Ubuntu (its more or less your resume near as I can tell) to do so, and if willing, share their feedback. The next Community Council meeting isn’t until April 17th, so theres plenty of time. I would appreciate any of the following:
- Feedback on if I am applying too early (ie. not enough Ubuntu experience)
- Feedback on wiki page (formatting flukes, missed information, broken links etc)
- Anything I might have worked with you on, but forgot to include
- General Comments on life and/or its meaning
So yeah, I appreciate any feedback I can get!
Technorati Tags: gnome, ubuntu, linux, membership, gnome foundation,
Powered by ScribeFire.
More Cool Dashboard Stuff
Alright, before I get to the cool stuff, first things first, with current metadata system thriving, and at Beagle’s current speed, if someone really wants to start to stabilize up the Dashboard API a little more, and start to make this something less abstract, IM,Call, Mail (either one), or even just show up in Cleveland, and I’d be more than willing to help get Dashboard moving again.
Anyways, now that I’ve had another 2 minute excursion into the realm of getting Dashboard and its Banshee plugin building/working again, I have a quick 10 second screencast of dashboard being awesome.
http://qub333.googlepages.com/dashboard-banshee-plugin.ogg
The other cool technology that I really want to get integrated with Dashboard (or even Beagle) is the Open Natural Language Parser. In all honesty, there’s no way to describe how awesome it is until you see it in action.
http://qub333.googlepages.com/opennlp-sharp.ogg
Sorry I’m too lazy to convert and all that jazz, this is an impulse post that’s preventing work from getting done, so if someone wants to convert them, just let me know, I’ll host if you need.
Big Board and Dashboard
So there’s been a lot of talk about a cool concept program coming out of the blur of Mugshot. While the exact goals of the project do seems a little more Web 2.0, the basic UI layout and goals seems to be remote services for something like Dashboard. Dashboard was the precursor to Beagle, (initially designed as an indexing and storage backed for Dashboard) and is basically a meta-clue processing center which brings up information relevant to whatever your are doing. The initial screenshots are extraordinarily old, but last summer during SoC, a complete redesign and recode took place, which is what can currently be found in the Google Code repo. While Dashboard is missing a lot of polish, I would recommend taking a look at its clue processing system, as its really quire ingenious, and the dream of every Beagle developer to eventually have to time to make it a real working solution again.
Anyways, I know its not the exact same, but its probably worth at lest a few minutes of playing time.
Lame Blog Linking Help
Miguel de Icaza has asked for some simple link help in getting Lame Blog some better Google results. I dunno if this helps at all, I don’t have a great Page Rank (I think its a 4 at the moment) so maybe its hurting, but the planets I get syndicated to do way better, so hopefully it helps.
Beagle Shining, The Holidays, and Playlists on My iPod
I just stumbled across a little blog post that made me more than a little happy. Christer Edwards had a short, but flattering post on Planet Ubuntu.
I’ve been so lazy thanks to the holidays that I didn’t even notice how completely disconnected I had been from the greater Gnome community. So, hello everyone, I’m back!
Now I’ve been busy messing around the past few hours with some major bug triaging efforts over on launchpad. It seems that just around the holidays there was an enormous flood of poorly filed bugs in launchpad, so I’m mucking around the beagle section, trying to tidy things up a bit. However, on a more exciting note, I have been working
I’ve also been trying to close the notorious Bug# 321742 which provides synchronizing play list support for Dap devices in Banshee (specifically the iPod
). Thanks to a great hackfest a few weeks ago, the infrastructure we need is in place, now its just the nitty gritty of each device. I seem to have volunteered for the iPod. So, heres the latest patch and all that jazz.
Blogged with Flock
Bleeding Edge Beagle Packages for Ubuntu Edgy
Joe Shaw has issued a Call to Test Beagle CVS due to the overwhelming amount of new features and changes made. We would love to ship a 0.2.14 release of beagle soon, but we can’t do that until were sure that we don’t have any major regressions.
Since most users don’t want to build from CVS, in an attempt to make this testing phase easier, we are asking for packages of the current CVS if at all possible. Doing my part, I have set up a repo for Ubuntu Edgy with the current beagle CVS packaged. Just add
deb http://kubasik.net/packages edgy-kkubasik main to your /etc/apt/sources.list and do the apt-get update && apt-get dist-upgrade dance.
I would like to note that there is also a deb-src component to this repo, but I make no promises about it. Also, as of this moment, the repository is signed, to import my key you should try:
wget http://kubasik.net/packages/43337DF4.gpg -O- | sudo apt-key add -
Please try to contact me about a bug first if it appears to be with the packaging, otherwise Bugzilla.
Comments(1)
Comments(2)
Comments(4)


