Why everyone should experience Arch Linux at least once
I don't necessarily feel as if this needs to be stated, since, as with many things, it is completely a personal preference for which linux distribution one uses, but nonetheless I present an argument.
I have been using linux for roughly five years, with very heavy and widespread usage these past two years do to a new job as well as pure personal interest. For a while I was in the try-every-distro-because-you-can phase. I would look on distrowatch.com for a linux distro with certain strengths depending on my mood for the day, torrent it, and either try the live cd or install if no such cd existed.
I have tried the RPM-based systems such as Red Hat and CentOS, all the Debian derivatives and the raw-but-not-so-practical, Slackware. Throughout my trying/testing/experimenting phase, I found myself always coming back to the "more popular" flavors as ranked by DistroWatch. Why did this happen?
Two distinctive reasons come to mind (which is why i believe most people inadvertently stick to these select distros). Ease-of-use or setup and community support. The Ubuntu team, in particular, has an enormous following and has hit the jackpot when universities and grade schools began installing their distro. I respect that and the amount of work they have clearly done in order to make the distro what it is today. I must admit, I have at least played with every Ubuntu release since Warty Warthog. I feel like they take the most risk in releasing new features not because they are nightlies, necessarily, but because they have such a large user base. The risk of somebody having an issue is always there. My last two experiences with Ubuntu (9.10 and 9.04) have not been a blast simply because my computer would lock up at very random times (thread here).
Ok enough babbling...
So to address the title of this post... I came across Arch Linux in early 2007 after becoming tired of the DistroWatch top 5 list and their heavy installations usually including many packages that I never use. I love the fact that the "core" image for Arch is roughly 300 MB and you end up in a console once installed and rebooted. There are no assumptions made of what desktop environment or window manager one would like to use, no 40 graphic drivers (no X windows for that matter), no unnecessary services running, etc. This truly is a thing of beauty. Not only can the user completely customize there system to their needs and hardware specs (yes Gentoo, I know you do this too), but the user can learn the fundamentals of setting up and managing a linux distro. TechieMoe sums it up nicely in this frivolous post. Although mot Arch users would take offense to his ranting, I take his points to heart as to why the distro is so good. But there are a few things I would like to clarify regarding his rant:
It assumes a lot of Linux knowledge that immediately disqualifies anyone with less than six months to a year of Linux usage
I disagree with this. There is absolutely nothing during the installation process that you don't come across with any other distro.. it is simply just not wrapped up in a LiveCD pretty GUI. Plus there is this. You should give this a go next time, Moe. I will be looking forward to your sequel.
Ever compiled your own kernel?
Hmm, which step was that again? Did I miss that? Well I guess you can skip that part.
I have no idea what all this means but I'm pretty sure it had something to do with sending launch codes to an obscure, long-forgotten nuclear bunker in the outskirts of former Soviet Russia.
Oh right.. here is where the kernel is built for you.
Even Slackware (which also targets advanced Linux users) offers some automation of the mundane tasks.
I am flattered.
Aside from this banter, Arch is a great experience for not only learning the steps for setting up a system from scratch (more or less), but it has become an extension of me personally more so than any other OS or distro has before. It feels more like my distro and my setup.. well, because it is. A greater appreciation for linux comes with this, aside from the "I hate windows" movement and the look-at-me-I-use-linux-so-that-makes-me-a-hacker group.
Bottom line, give Arch a try.
created 7 months, 3 weeks ago
// updated 7 months, 3 weeks ago
// arch, linux, rant
Quote of the Day in RE: Parsing HTML with Regexes
"Every time you attempt to parse HTML with regular expressions, the unholy child weeps the blood of virgins, and Russian hackers pwn your webapp. Parsing HTML with regex summons tainted souls into the realm of the living. HTML and regex go together like love, marriage, and ritual infanticide." - bobince
created 8 months, 2 weeks ago
// updated 8 months, 2 weeks ago
// html, quote, regex
Google Ads + Stallman
I am going get me one of these.
created 10 months ago
// updated 10 months ago
// google, humor, stallman
Django: BooleanField
When constructing a QuerySet, always use foo=True or foo__exact=True, but never foo__iexact=True. The latter will be explicitly cast the WHERE clause argument as text which will throw an error since the field you are testing is a boolean. Just an FYI, within the django shell, a QuerySet constructed using the latter example will simply return an empty QuerySet rather than throwing an error. So if you are confused by this, output the raw SQL and take a look for yourself.
print some_queryset.query.as_sql()
created 10 months, 2 weeks ago
// updated 10 months, 2 weeks ago
// boolean, django, error, queryset, sql
Letting Loose
This weekend was great. It was the first time in a long time (and I mean a long time) that I really enjoyed myself when letting loose a bit. I wanted to give shout out to my two friends Becky and Chris for getting married this Saturday and having a great reception =) Surrounded by great friends and my wonderful girlfriend I didn't think or care about anything in those few hours of enjoyment. Nothing bogged me down and I now realize that it is so necessary to do this once in a while.
Between my last year of school and working hard at my internship (soon to be full-time) I made work my priority (not a bad thing) and my "escape" for enjoyment (not a great thing). Now don't get me wrong, I am very passionate about the work I do and the continuous logical mindset necessary for consistent and production coding, but this can easily lead to fogged and bloated minds without proper release. A person must do other things that require a different mindset/environment/skill set to flush the buffer and allow you to start with a fresh mind.
That is my two cents.
created 1 year, 1 month ago
// updated 1 year, 1 month ago
// enjoyment, environment, mind, zen
Python: "is" vs. "=="
So it took me a while, not necessarily to understand why this is or how it works, but to put it in practice and to be consistent about it took a bit longer than expected. Let me elaborate on this incoherent mess of words.
Python has a reserved work is which many people confuse as a more readable == (which is not more readable from a logical view in my opinion). From a strict definition this is absolutely not true, they are not the same at all.
What "is" is
Let's start by describing what is is not. It is not a test for equality, such that this test:
>>> foo = 'baz'
>>> bar = 'baz'
>>> foo == bar
True
is not the same as this test:
>>> foo = 'baz'
>>> bar = 'baz'
>>> foo is bar
True
Sure the result is the same in both cases, but what is really happening underneath the hood? The equality test == is testing for the equality of the byte representation between variables, in this case... yes in fact both variables represent the string 'baz'. is on the other hand, tests for object equality per the allocated memory. The question that is asks is, "is foo pointing to the same thing bar is?" The string 'baz' is small, therefore it is allocated once in memory and all new objects initialized that reference the string 'baz' will point to that single memory location. This is an efficiency in Python. To make clear what I mean, let's look at an example when is and == don't result in the same way:
>>> foo = 3623828327
>>> bar = 3623828327
>>> foo == bar
True
>>> foo is bar
False
>>> bar = foo
>>> foo is bar
True
In the first test we tested for equality using ==. The second test used the is test which failed. Why? Because the integer that each variable is referencing is big and requires more memory allocation, therefore for each new variable referencing 3623828327, new memory is allocation. To prove that is refers to the memory location, the third test above sets bar to reference foo (points to the same memory location) and the test passes.
created 1 year, 1 month ago
// updated 1 year, 1 month ago
// equality, is, python
iPhone Update Server Fail
It was bound to happen and expected. I guess I won't get my update for a couple days...
created 1 year, 1 month ago
// updated 1 year, 1 month ago
// apple, fail, iphone
created 1 year, 1 month ago
// updated 1 year, 1 month ago
// movement, oss, sourcecode
"This solution in my opinion is not so DRY"
In response to:
Django Quick Tip: ModelAdmin Limit FK Queryset
The bad news is that it won't be applied anywhere else... like in a Study change_form view. This really annoyed me because I would expect that defining a queryset within a ModelAdminshould propagate as the queryset for the admin site. But this is not how it works, so we have to resort to changing the queryset for Investigator within the StudyModelAdmin.
<break>
Although this solution in my opinion is not so DRY, it works.. and that made me happy.
After sleeping on my quick-to-judge statement in my previous post, I have come to understand why it is the way it is. The ModelAdmin.queryset method is used within the scope of it's own representation, and shouldn't necessarily assume that it is applicable to models that have a relationship with it.
A simple use case (and I actually require this, hence my realization) that within the change_form view of the Study model, we can allow all Invstigators to be added to the Study instance, but as far as editing/deleting permissions, logged-in users can only see their ownInvestigators in the change_list view. This limits the logged-in users to managing their own Investigators, but gives them the ability to add anyInvestigator to a particular Study.
There are many other reasons why there is a cross-relation separation here. My more intuitive approach (in my opinion) would make the ModelAdmin.querysetthe default queryset within the AdminSite object and if you have these edge cases as stated above, then I can override formfield_for_foreignkey to implement the new queryset.
created 1 year, 1 month ago
// updated 1 year, 1 month ago
// dry, modeladmin, response
Tribes are important, become a leader, change the world
created 1 year, 1 month ago
// updated 1 year, 1 month ago
// leadership, statusquo, ted, tribes
Communicate and collaborate, egos not welcome
created 1 year, 1 month ago
// updated 1 year, 1 month ago
// genius, google, io, programmer
Django Quick Tip: ModelAdmin Limit FK Queryset
Something that I was banging my head against the floor for a while today... my goal was to customize a custom admin interface and limit the certain change_list views and fk/m2m relationships between models. A set of models:
class Investigator(models.Model):
creator = models.ForeignKey(User)
name = models.CharField(max_length=40)
class Study(models.Model):
title = models.CharField(max_length=100)
investigator = models.ForeignKey(Investigator)
Very standard Foreign Key relationship. A ModelAdmin for Investigator which limits the change_list view:
class InvestigatorAdmin(admin.ModelAdmin):
...
def queryset(self, queryset):
return Investigator._default_manager.filter(user=request.user)
The good news up to this point is that redefining ModelAdmin.queryset is simple and will be implemented during the change_list view for the Investigator model. The bad news is that it won't be applied anywhere else... like in a Study change_form view. This really annoyed me because I would expect that defining a queryset within a ModelAdmin should propagate as the queryset for the admin site. But this is not how it works, so we have to resort to changing the queryset for Investigator within the StudyModelAdmin.
As you can see here, there is a single condition looking for investigator which alters the queryset to an arbitrary one. Now, the investigator field will be represented with a limited queryset. Although this solution in my opinion is not so DRY, it works.. and that made me happy. Please note that formfield_for_foreignkey is bleeding edge at the time of writing this.
And for those who were like me and tried to create a ModelForm with a modified ModelChoiceField.queryset and tried applying that to the ModelAdmin... no luck if you want to all users to still "add-another" in the admin interface. Relational fields in the admin have a custom widget wrapper that is undocumented and not very (if at all) usable outside of the BaseModelAdmin class. Creating a ModelForm will overwrite that wrapper, thus leaving you "add-another"-less. Not cool
created 1 year, 1 month ago
// updated 1 year, 1 month ago
// admin, django, foreignkey, modeladmin
I try to find problems
It occurred to me in conversation with my one friend tonight that I try to find problems with stuff. I am a problem solver and I need problems to solve... which I guess means that if their aren't problems to solve, then I have to create them, right? Or at least the idea of them?
created 1 year, 2 months ago
// updated 1 year, 2 months ago
// life, logic
Django Quick Tip: Form M2M and Select
I came across the need to utilize forms.ModelMultipleChoiceField, but with a forms.Select widget for a simple 'Add New Whatever' form. I wanted to initially limit the choices so that the primary choice could be captured. Anyway... trying this combination of field and widget will always return to you a form validation error of "Enter a list of values." (which is quite uninformative and ambiguous from a UI standpoint). This is because the value that is returned is a single object as suppose to the list that is returned when the default forms.SelectMultiple widget is used. To easily get around this for this special case:
def my_view(request):
...
if request.method == 'POST':
post_data = request.POST.copy()
post_data['the_field'] = list(post_data['the_field'])
form = form_class(post_data)
if form.is_valid():
...
You simply make a copy of the post_data (request.POST is immutable) and then pass that as your data to your form_class.
created 1 year, 2 months ago
// updated 1 year, 2 months ago
// django, form, tip, validation, widget
OS X Permissions
Having weird permission problems or startup process issues?
Run Disk Utility in /Applications/Utilities/. Click on your root drive, named Macintosh HD by default. Under the First Aid tab, click Repair Disk Permissions.
What motivated this seemingly simple tip was due to the fact that I spent the last hour trying to figure out why my local instances of MySQL and PostgreSQL couldn't read their unix sockets in /tmp. Rather than banging your head and possibly screwing up permissions more by editing them manually, stay clean and let permissions be resolved by the OS X permission database.
created 1 year, 3 months ago
// updated 1 year, 3 months ago
// diskutility, osx, permissions, tips
Memcache Galore
Simply because I believe a good thing should not only be stated once nor in a somewhat discrete way, I am going reiterate how to setup cmemcache, the Python extension (written in C) for memcached, the C API to memcache.
The cmemcache library depends on libmemcache 1.4.0.rc2, but requires a patch for it to work. The patch that is supplied by the maintainers of cmemcache doesn't work oddly enough. Another patch, after googling a bit, ended up working (i.e. I could import cmemcache from the python interpreter), but the test provided with cmemcache fails.
Now the confusing part. On the cmemcache site, it mentions how the python-libmemcache library is interchangeable with the cmemcache library. The package provided is named python-libmemcached which is identical to a different python extension that depends on libmemcached (notice the trailing d). Here is the latter python library. Anyway, lets begin.
cmemcache + libmemcache
Download both libmemcache 1.4.0.rc2 and cmemcache 0.95 from here as well as the working patch to be applied to libmemcache. Here is the original post where I read about this patch.
$ tar jxf libmemcache-1.4.0.rc2.tar.bz2
$ cd libmemcache-1.4.0.rc2
$ wget http://svn.pardus.org.tr/pardus/tags/2008.1/programming/libs/libmemcache/files/libmemcache.patch
$ patch -p1 < libmemcache.patch
$ ./configure && make
$ sudo make install
Assuming no errors, now install cmemcache.
$ cd ../
$ tar jxf cmemcache-0.95.tar.bz2
$ cd cmemcache-0.95
$ sudo python setup.py install
Test to make sure it works.
$ python
>>> import cmemcache
This should give you no errors. Now to finish up, download memcached and install using the standard method.
$ tar zxf memcached-1.2.8.tar.gz
$ cd memcache-1.2.8
$ ./configure && make
$ sudo make install
Just remember that memcached does not depend on the former packages we just installed, those are merely client libraries to interact with memcached. There are a whole slew of client libraries available for multiple languages. Have fun and happy caching!
created 1 year, 3 months ago
// updated 11 months ago
// cmemcache, django, libmemcache, memcached, python
Click download (you can submit the form without entering anything).
Just remember that /usr/local/bin must take precedence on your $PATH variable in order for the new commands to work, otherwise the default subversion commands (version 1.4 on Leopard) will be invoked.
export PATH="/usr/local/bin:$PATH"
You can check where the command is being invoked from using:
$ type svn
svn is hashed (/usr/local/bin/svn)
created 1 year, 3 months ago
// updated 1 year, 3 months ago
// osx, subversion, unix
Being great at being good
So over the past 5 years or so I have contemplated and tried to reason with myself that I have not worked hard enough at anything.. meaning, really any one thing. I have tried many things whether they be sports, musical instruments, design, engineering, programming, etc. and I have always criticized myself for this even though no one else around me has.
People go through this everyday it seems, but rather than doing something about it, the outcry comes during some sort of social event which is then ignored due to alcohol or other neurological stimulants. This isn't a criticism to others since that would be hypocritical, but I do know that I take on this challenge in a different way. I have recently (past few years) found a true passion of mine... programming, but not necessarily in the sense that I like to sit down and hack or even in the sense that I actually like writing code. The wonderful thing about programming is that fact that anything in this day and age can be improved via programming -- anything. But that is all I am going to say about that, since this entry is not about programming.
Abstracting out the concepts of programming that I have learned over the years, I have applied them to my overall mental proliferation while learning other arts such as philosophy, psychology, engineering and even better understanding my social status. Though it sounds like a cliche in the programming community I know I have personally been affected by the UNIX philosophy of "Do one thing and do it well." This sounds like common sense and even mediocre, but in practice can make a whole world of difference. Maintaining that mindset throughout everything you do will greatly benefit and simplify the way your mind interprets the world around you.
And with that, I have realized that the goal is not necessarily about striving to be the best of something. Don't get me wrong, I want to be the best, but in what really? How can I predetermine that? There are reasons why you (and I) have followed the paths we have chosen to take. The real goal in my opinion is always trying to maintain a passion for whatever it is you are doing. Living a colorful life, day after day without ever thinking, "I wish I could do something else in my life." And even if that does occur, the followup and change of setting is a must and is necessary for happiness.
Though this unpoetic, mashup of thoughts really doesn't apply to most, I personally wish it could be. Persevere and make things happen.
created 1 year, 3 months ago
// updated 1 year, 3 months ago
// abstract, life, perseverance
More of us need to be like this guy
No excuses, just a desire to create something. And done.
created 1 year, 4 months ago
// updated 1 year, 4 months ago
// inspiring, ted, windwill
Simple Tool, Unexpected Impact
"Do one thing and do it well" -- UNIX philosophy
created 1 year, 4 months ago
// updated 1 year, 4 months ago
// ted, twitter
Delicious Use Case
So I am going to write a short use case for how I personally utilize del.icio.us. For one, I am a geek, so every time I decide to reformat the ol' hard drives and reinstall all my OSs, I usually overlook the fact that my bookmarks/favorites aren't going to save themselves. Unfortunately I realize that right as I hit the format button.. I then spend countless (well maybe 2 or 3) hours finding all the lost bookmarks, to only save and lose them again in another month or two.
Delicious is not only a useful tool for keeping all of my bookmarks in a single place (and maintaining their integrity), but due to the tagging system I can easily categorize them for each purpose they serve. For me though, I really find the usefulness when seeing how many of people have also tagged the same bookmark as you. I have created a rating system in my head for different types of bookmarks.
Tutorials: do they suck? are they worth reading? are their better ones out there?
References: does this person(s) know what they are talking about? is it from a legit source?
News Articles: is the article bogus? are other people keeping up on the news I find interesting?
Coding: what are other people reading? am I keeping up on the times?
Software: what programs are people running? are their programs better suited for my purposes?
Etc..
Since delicious.com is referred to as "social bookmarking," I find it most useful when seeing what other people are looking at, that way I can reassess what I am spending my time looking at on the web.
A few other notable features is the tag search capability so I can find other bookmarks that are new and relevant to my interests. As I was about to type the fact that you can't not share bookmarks I just rechecked if I could that and I can... therefore all my desires are now fulfilled for the social bookmarking tool.
created 1 year, 4 months ago
// updated 1 year, 1 month ago
// bookmarking, delicious, social
About Codeomics
What's with the name?
Pronounced co·de·omics, it is a representation of the work that I am passionate about. I am a coder in a clinical research setting, specifically dealing with creating solutions for physicians and researchers to make their lives easier and their jobs more efficient. This overall benefits the client -- the patient. Since we are at the crossroads between the information age and the genomic age, I felt it was an appropriate name for joining the two disciplines.
The work I do
In a basic sense, I find the opportunity (or the opportunity comes to me) to improve upon a process that is currently used. Many times in healthcare since things have to get done, messy conglomerations of tools are used which do talk to each other. By talking, of course I mean there is a distinct lack of functionality to have one system's output be another's input. There are many levels in which new solutions can be created or messed together, but determining the path to take is really where the theory and science gets involved.
Translational informatics
So translational informatics, as the name suggests, is the bridge between clinical and research informatics (pertaining to healthcare of course). They need to somehow talk to each other in order for greater progress to occur since clinical diagnostics and genetics are very different practices. This in conjunction with population genetics, societal informatics and aggregate data collection among healthcare and research establishments make up the bulk of the current state of what the healthcare industry is.
In order for any of these disciplines to talk to each other, you need coders, database admins, sys admins, physicians, researchers, etc. Solutions can be built on top of existing solutions or if the need is there, new group-up solutions can also be created.
created 1 year, 4 months ago
// updated 1 year, 4 months ago
// healthcare, informatics, *omics