Creating Apps In Kivy: The Book

I apologize for my near-silence over the past few months. I’ve packed house and moved twice in that time, started a new job, and, relevant to this post, written a book.

My Creating an application in Kivy blog series has been by far the most popular set of posts on this blog. It garners about 200 views per day, and has been doing so for nearly a year. This taught me a very important lesson: posts with controversial titles, (notably this one, but basically anything that has hit hacker news) are much less valuable than posts with meaningful long-term content. Getting a few thousand hits in one day is pretty satisfying, but when most of your “readers” simply comment on the post without having read the article, that hit-count becomes meaningless.

“Creating an application in Kivy”, on the other hand, has had sixteen thousand visits to part 1, and nearly three thousand of those have made their way all the way to part 9. I could definitely achieve more hits per day by writing a new minimum-content controversial article every day, but these visitors keep coming with no effort on my part. This is lucky, as the focus on writing solid content for my book has taken time away from writing solid content for this blog.

And with that, I’d like to announce that Creating Apps In Kivy is now available. This project started when the aforementioned tutorial caught the eye of an O’Reilly editor. They helped me put together a great book that I am proud of and confident you will enjoy.

Creating Apps in Kivy covers many of the topics discussed in my tutorial, but in more depth and with much more polish. Like the tutorial, it takes you from “new to Kivy” to creating and deploying a complete application to your Android or iOS device. It’s a fun, short read and I’m proud to present it to you today. If you liked the tutorial, buying my book would be a great way to support my work!




Have you ever been afraid to get out of bed?

In my past writings about mental health, I’ve mostly discussed depression and suicide. I’ve been meaning to add ‘anxiety’ to that list of topics, but have been waiting until I could write about it from the first person. One of the peculiar things about my personal struggles with mental illness is that when I’m feeling well, it’s really hard to remember what it’s like to be feeling poorly. The inverse is also true, which is why it’s possible to feel suicidal after just a few hours of depression; I can’t imagine what it felt like yesterday when I’d been feeling fine for months on end.

I’ve got a great handle on what I need to do in my life to deal with, prevent, and accommodate for my depressive, suicidal, and bipolar tendencies. I’ve also made great strides in reducing anxiety levels, but, for me, anxiety is a more difficult beast to tame. The following was written a few days ago when I was in the middle of a high-anxiety experience (not an anxiety attack). I’ve edited it a bit for grammar (typing on a phone is a horrible experience), but it’s mostly straight from the heart. I hope it illustrates what anxiety feels like to those who have not experienced it, so you can support those in your life who are suffering. I would also like it to demonstrate to those who may not be aware that they are dealing with anxiety that their symptoms are treatable, and perhaps you will seek further help. And, as always, I want those of you who deal with anxiety on a regular basis to remember that you are not alone.

From Inside Anxiety

Let me tell you what anxiety feels like. It feels like being on a small rock amidst a boiling vat of lava. I have to type this on a phone because the laptop in the other room is no less inaccessible than if I had to jump a giant ravine. Anxiety is fear, pure simple fear. But it’s not normal fear; anxiety is fear of the normal.

Have you ever experienced an adrenaline rush? Some threatening situation: the grill of an oncoming bus, falling down the stairs, being approached by a thug with knife in hand, slipping on ice, a shove from behind, a car accident?

Anxiety is that same feeling, but all the time. Every step is a slip, every car is going to hit you, all your friends and co-workers are thugs with knives. The worst part is that the brain can see that these sensations are not true. I’m not imagining real lava around the bed. I can see the perfectly safe carpet. But my legs feel like numb jello and I cannot step onto it. I’m not hallucinating that all the people outside my street want to kill me. I’m afraid of them even though I know they have no interest in me at all. I know in my mind that my office is full of people I can trust and rely on, yet my body is reacting as though I will be entering a war zone, every sense alert, every muscle tensed against the next attack.

Once upon a time, I lived the majority of my life’s moments in such a constant state of heightened awareness. Fear. It was exhausting. I am lucky that days like this are now rare. I am lucky that today, my anxiety is not accompanied by depression (it’s hard to feel worthy when you spend all your time hiding in bed.).
Some people look for adrenaline rushes outside their normal state of being. They sky dive, they become immersed in video games or movie thrillers, they join extreme sports. While they do this, I look for quiet rooms, I meditate, I practice yoga. Anything to calm the blood down. I will experience the same thrill climbing into the shower this morning that you feel jumping out of that plane. I will feel the same fear walking into my office today that you feel as you step onto a public stage.

And here’s the kicker: nobody thinks I’m brave. My walk to work today will mirror an Indian Jones escape sequence or Aladdin’s carpet ride out of the Cave Of Wonders. I’ll walk into my office and be surrounded by people who do that kind of thing every day. Anxiety is living your life inside a thriller movie. The music is always loud, rushing your heart beat. Something awful is always going to happen around the next corner. This movie doesn’t end and you can’t walk out of the theater.

The world is going to end if I don’t get out of bed and into the shower. How much is a world worth?

Dealing With Anxiety

I have had less success in defeating anxiety than I have had with depression. There are a few types of treatments to deal with it, and you should consult with a medical professional to work out what the best one is for you. The two things that have had the greatest success in taming (if not controlling, yet) my anxiety have been yoga/meditation, and exposure therapy. The latter isn’t as bad as it sounds, although like many cures, it’s not always pleasant. The heart of exposure therapy is, as you can expect from the name, placing yourself in situations that cause anxiety. However, there are a few caveats. You have to place yourself in such situations until you become comfortable with them. If you exit an anxiety-inducing situation while you still feel afraid, you will have reinforced that this is a fearful situation, and that “fight or flight” is an appropriate response.

Instead, you need to pick situations that only cause a small amount of anxiety. A good way to do this is to make a list of as many situations as you can think of that cause anxiety, and then rank them in order of how frightening they are. Over the course of a year or so, put yourself into the easiest situations and work your way up the chain. It’s slow progress, but it’s measurable, and the feedback you give yourself from one encounter can help you refine your technique in a later one.

I’ve been utilizing this technique for three years. As illustrated above, I still have days with a lot of anxiety. However, I lead a functional life, now. I used to work from home, I now work for a high-profile company and I’m doing well at it. I used to avoid all social situations, I now regularly go out with friends or even strangers and generally have a good time. I used to be especially afraid to interact with single women; I’m now in a stable, loving relationship. There are still a few things on my list, such as presenting at conferences and dealing better with conflict, but for the most part my coping skills are better than many people who are considered not to have psychological disorders. It wasn’t easy, but it was worth it.




Firefox Beta och Australis

Vid nästa släpp utav Firefox kommer Australis. Jag tänker att det kommer att ta ett tag att vänja sig, vilket resulterade i att jag laddade ner Firefox Beta för en stund sedan. Classic theme restorer är ett tillägg jag _verkligen_ rekommenderar alla att installera. Jag vet inte vad jag skulle gjort utan det, faktiskt. Firefox såg inte alls vackert ut utan det. Läs på bloggen efter tidigare tips, de går fortfarande att applicera på Australis. Stilmallen och alla tillägg funkar fortfarande.

 




Gör att Firefox blir mer som Safari

Här kommer ett kort tips på hur man går tillväga för att få Mozilla Firefox att bli mer som Safari – en webbläsare jag faktiskt gillar. Förutom det faktum att det är proprietär programvara. Jag gillar dock designen mycket och har ägnat lite tid för att få det att se ut som Safari.

Först, skriv about:support i Firefox, sedan väljer du att öppna i Finder (bredvid Profilmapp). Sedan går du in i din profilmapp och skapar mappen chrome om den inte finns. Väl där skapar du textfilen UserChrome.css och öppnar den. Vad du sedan ska göra är att klistra in följande:
#personal-bookmarks .toolbarbutton-icon {
display: none !important;
}
.tabbrowser-tab[fadein]:not([pinned]) {
max-width: 1000px !important;
min-width: 26px !important;
}
.tabbrowser-tab[fadein][selected]:not([pinned]) {
min-width: 88px !important;
}
#tabbrowser-tabs ~ #alltabs-button {
visibility: visible !important;
}
/* Tabs: no icons */
.tabbrowser-tabs .tab-icon-image { display: none !important; }
/* Move the close button to the left and hide it until the tab is hovered over */

tab .tab-close-button {
-moz-box-ordinal-group: 1 !important;
display: -moz-box !important;
visibility: hidden !important;

}

tab .tab-text { -moz-box-ordinal-group: 2 !important; }
tab:hover .tab-close-button { visibility: visible !important; }
tab[selected="true"][first-tab][last-tab] .tab-close-button { visibility: hidden !important; }

Vad detta gör är att se till att flikarna blir längre, samt att favicons försvinner. Modifiera hur du vill, jag uppskattar minimalism och kommer därför ha det så här – målet är trots allt att det ska efterlikna Safari så gott det går.

Sedan ska vi installera ett par tillägg.
Det första vi ska installera är Omnibar. Gå in i inställningarna och välj att dölja sökmotorns favicon.
Vi ska också installera Status-4-Evar. Gå in i inställningarna och ha denna bild vid “Förlopp”

Det var det, tror jag. Förhoppningsvis har jag inte glömt någonting.

 

Update!
Ha stängknappen till vänster med den uppdaterande CSS-koden.




Vila i frid

Fan. Fick för inte alls länge sedan reda på att en kamrat lämnat oss. Hur vet jag inte, och jag bryr mig inte. Han är borta. Det känns overkligt på många plan. Det är min andra vän som har gått bort på kort tid.

 

Han var en väldigt, väldigt solidarisk människa. Han sa inte bara nej till orättvisor utan agerade faktiskt, något inte många gör idag. Han kämpade, väldigt hårt. Han och jag har kämpat vid barrikaderna för en bättre värld för några år sedan, så jag vet vilken kämpe han var. Nu har jag inte lust att skriva så mycket mer, jag ville främst få ur mig lite utav min sorg. Ett längre inlägg om både två kommer senare. Men de var båda kämpar för en bättre värld.

Vila i frid T och T.




N900 -> N9 -> Jolla

Jag har haft ett mobilintresse i väldigt många år, och har haft mängder med olika modeller. Allt från en av de första med mp3-spelare (även om det var ett annat filformat som användes) i form utav en Nokia 5510. Jag har också haft en utav de första med färgdisplay, Sony Ericsson T300. Två Nokia N-gage och en N-gage QD har jag också haft i mina dagar, bland annat.

Jag skaffade mig en Nokia N900, med operativsystemet Maemo 5, en Linuxdistribution baserat på Debian med mitt första abonnemang. Denna telefon hade jag i nästan två år innan jag förlängde och skaffade mig en Samsung Galaxy Note. Denna hade jag ett tag innan jag sålde den och köpte en ny N900 – jag hade sålt min gamla till en vän. Min N900 hade jag ett tag innan jag köpte storebrodern Nokia N9, som använder Meego. Denna hade jag i ungefär 7 månader innan jag köpte den jag nu har, nämligen en Jolla-telefon. Denna använder operativsystemet Sailfish OS, som precis kommit ut i skarp version, och snart ska kunna gå att installera på utvalda Androidtelefoner, det går redan nu men det ska bli enklare. Dessutom är det betydligt roligare att installera något som inte är i beta-stadiet. Kan jag tro, i alla fall.




Firefox, framtiden och nuet

Varför installera ett tillägg till Firefox när lite CSS kan fixa biffen?

#personal-bookmarks .toolbarbutton-icon {
display: none !important;
}
För Windows:
Skriv %appdata% under Kör (Windowsknappen och r, om det inte har förändrats sedan jag övergav Windows) ->leta efter Mozilla-mappen -> hitta <något>.default -> skapa mappen chrome -> skapa filen UserChrome.css. Se till så inte .txt blir filändelsen bara, Windows gillar nog att skapa den. ;) Eller så installerar ni bara tillägget Stylish, då skapar ni en ny style och klistrar in stilmallen ovan.

För Linux:
~/.mozilla/<user>.default -> chrome -> userChrome.css

För Mac:
~/Library/Application Support/

Detta tar bort favicons vid bokmärkesraden. Något som gör Firefox lite finare, enligt mig. Firefox kommer vid version 28 eller 29 använda sig utav “Australis”, nya designen för Firefox. Dessvärre ser det inget vidare ut utan påminner om Chrome för mycket. Dessutom tar nya designen sönder alla teman till Firefox (förutom så kallade Personas), och möjligheterna att skapa teman för den nya designen är svår. Tragiskt, när det finns fina teman till Firefox.

Jag har testat Safari lite på min Mac, och den minimalistiska designen är underbar. ^ är inspiration från Safari, detta och att välja små ikoner gör Firefox något mer likt Safari. Att gå in i about:config och välja browser.snapshots.limit 5 (eller något annat än 0) gör att effekterna när man går bakåt eller framåt med touchpaden är densamma mellan dessa webbläsare. Just det, browser.tabs.onTop ska vara false också.

Ytterligare en sak, installera Omnibar till Firefox, då blir det ännu mer likt Safari.

Jag vet inte riktigt vad jag kommer att göra när den nya designen kommer. Eventuellt kommer jag att stanna kvar, eller börja användare Safari, eller helt enkelt acceptera att läget är som det är. På mina Linuxdatorer kommer jag att acceptera läget, skulle jag tro.




Linux på högskolenivå och lite annat

Det var ett tag sedan jag skrev något här. Anledningen till det är att jag dels har flyttat, börjat studera, och sen att jag inte har mått jättebra.

Jag bor inte längre på fastlandet utan bor på en ö, vilken det kan tänkas vara får ni ta en funderare på. ;) Det gäller enbart under studietiden, sedan kanske det blir flytt tillbaka till min gamla hemstad. Vi får se vart det bär av, jag kommer dock inte att vara här längre än till juni i vart fall.

Jag har alltså börjat studera. Det är en ganska liten kurs, 7.5 högskolepoäng och ska mig veterligen vara under två perioder. I den takt uppgifterna ska vara inne kan man undra om det verkligen är så. Det har dock gått bra än så länge. Kursen heter Introduktionskurs till Linux och små nätverk. Vi har inte kommit långt ännu, utan vi har skrivit hur vi gick tillväga för att installera Debian, och sedan skulle vi skapa ett skript vilket skapar textfiler och mappar (och ett annat skript). Mer om det kommer kanske när kursen är färdig.

Angående mitt mående, jag tänker inte gå in på det här. :) Det är ingen större fara. Är mest trött på mig själv.

 

Over and out.




egtk, tap och lite annat

Denna post var först tänkt att publiceras på min Facebook, men jag ångrade mig och klistra in texten här istället. Ganska basic grejer tas upp, så för den erfarna kommer inget direkt nytt upp.

 

Använder du GNU/Linux och använder tillägget Stylish till Firefox? Det finaste temat till GNU/Linux är elementary, som tillsammans med sitt ikontema ligger till grund för ett helt eget operativsystem (elementary OS). Ett OS jag kan rekommendera nybörjare som vill ha det vackert men ändå komma åt en massa fina program, då det är baserat på Ubuntu.

Använder du Debian, som använder äldre programvara för att det är stabilt och så vidare, ladda bara ner elementarytemat från deviantart eller från Launchpad. Använder du ett operativsystem som använder nyare programvara, ladda då ner version 4.x som stödjer senare versioner utav GTK. Installara bzr om du inte redan har det installerat och kör följande kommando:
bzr branch lp:egtk
Flytta sedan innehållet till /home/användarnamn/.themes eller /usr/share/themes om alla ska få ta del av temat.

Det finns ett fint tema till Firefox också.
Och för att återgå till Stylish, vill du istället använda standardtemat till Firefox och använda lite CSS, använd då denna.
Men strunta i flikarna på toppen. In in about:config och ändra browser.tabs.onTop till false.

Snygga ikoner är viktigt också, använder du elementary OS kan du enkelt installera ett tema som heter Tap. Du hittar det om du lägger till elementaryupdates egna förråd. Använder du ett annat OS, se till att ha elementarys ikoner, sedan laddar du ner Tap. Sedan laddar du ner följande.
Ladda ner och klistra in in tapmappen. Det är fint om du använder en dock (docky eller helst plank) och har de program Tap för tillfället har stöd för där.

Använder du Greasemonkey till Firefox så kan jag rekommendera följande skript. Användbart om du som mig brukar ha Facebook som “fäst flik”.




Två nya program

Jag testade idag att installera ett program jag gillade mycket när jag använde Windows. Det är foobar2000. Det funkade väldigt bra över wine, faktiskt. Då jag använder MATE kan jag använda gamla skripts till Caja. Jag tänkte dela med mig utav ett guldkorn här. Det är proprietär programvara, vilket jag i vanliga fall försöker hålla mig borta ifrån. Men jag kommer ge det en chans.

Installera först wine, sedan laddar du ner foobar2000 och installerar det. Efter det går du in i /home/USERNAME/.config/caja/scripts och skapar en fil, i mitt fall heter filen Add to foobar. Ha följande innehåll i den nyskapande filen:
#!/bin/bash
#
# Enqueue in Foobar
wine /home/USERNAME/.wine/drive_c/Program\ Files\ \(x86\)/foobar2000/foobar2000.exe /add “$@”

Ersätt USERNAME med ditt användarnamn.Se till att du kan köra skriptet också. Testad på 64bit, i annat fall får du själv modifiera. Men du förstår principen.
Det andra program jag testade var Firefox Nightly. Det var inte jättelätt att få det att funka på Fedora då det mig veterligen inte finns någon som bistår med ett förråd över programmet. Jag tänkte inte skriva hur man går tillväga för att få det installerat, men om någon frågar efter hur man gör kan jag dela med mig. Annars finns det på Google. Här finns en bild på programmen.

 

God jul!




Debian och plank

Här kommer ett kort tips hur du kan få plank att fungera med Debian utan att behöva kompilera från källkoden.

Öppna upp /etc/apt/sources.list med utökade rättigheter.
Skriv in deb http://people.ubuntu.com/~ricotz/debian-plank wheezy main
Sedan installerar du plank apt-get install plank




Elementary Dark och Firefox

Här kommer ett litet tips på hur man kan ladda Firefox med ett annat gtk-tema än det man vanligtvis använder. Problemet med Firefox och Linux är att en del element blir mörka och andra ljusa. Jag kan exempelvis inte se texten när jag skriver i textfält för att det är vitt.

Öppna /usr/share/applications/firefox.desktop med valfritt program med utökade rättigheter.

Leta upp Exec= och modifiera till följande:
Exec=bash -c ‘GTK2_RC_FILES=/usr/share/themes/Clearlooks/gtk-2.0/gtkrc firefox %u’ eller till valfritt tema. Starta om Firefox och du kan se texten igen. HÄR kan ni se att jag använder ett annat tema.

 

 




OpenBSD

I had a new experience last week: I installed OpenBSD. And wow, what an experience it was!

As a fan of trying new operating systems, I’ve been wanting to “learn BSD” for many years now. I had decided a while back to try out FreeBSD because it has the largest user base, and assumed it would be the “best BSD experience” for me. Well, my experience with FreeBSD was that documentation was sorely lacking (despite hearing the contrary) and the things I was most interested in seemed to be in a state of flux, namely package management and compilers. That and the fact that there doesn’t seem to be “one right way” to do almost anything in FreeBSD caused me to never really understand what I was doing, no matter how hard I tried. Or maybe I’m just an idiot. I don’t know.

Well, OpenBSD 5.4 just came out, and after reading a comment on OSNews from a fan absolutely gushing over it, I became really excited to try it out.

Now, I only knew a few things about OpenBSD:

  • It’s secure. Like, VERY secure.
  • The documentation is vast and superb.
  • It’s not very popular, even in the list of not-very-popular operating systems.
  • The mascot is cute.

I downloaded the latest release and read a bit of the installation guide. I was very impressed with the documentation, but not nearly as impressed as I was going to be after installing everything. One thing in particular stood out to me in the installation guide: the advice to install OpenBSD on an empty hard drive if it’s your first time. Pshhh, I’ve installed a million operating systems. How hard could it be?

Well, it wasn’t hard, but it was very different from what I was used to. At one point near the end of the installation after configuring the partitions, I had no idea whether or not all my personal files were still on my hard drive. After wiping my sweaty palms together and rebooting my computer, it turns out I’d done everything correctly and didn’t erase anything. Well, I guess I should say OpenBSD did everything correctly. For all the power it provides, the installer really is pretty automatic and smart. Anyway, as a responsible computer user I of course have a recent backup too, but it’s still nice to not have to need it.

Success!

Success!

And it’s at this point that the documentation really impressed me. I finish the installation and reboot. I login and it tells me I have a new email that I can read with the “mail” command. The email gives a welcome and a ton of information, including the suggestion to read “man afterboot”. That man page gives even more instructions on how to do things people often want to do after an installation. Every command has a manual. Ever configuration file has a manual. The documentation just kept going and going! And it’s all both high quality and current.

I installed a few applications with ease using the built in package manager. Although the X server is not “part of” the operating system, it was included in the install and was automatically configured.

I started X and had to laugh. OpenBSD is very much UNIX, and if ever I saw a GUI that screamed “UNIX” it’s the default in OpenBSD.

I can almost TASTE the 1970s.

I can almost TASTE the 1970s.

I decided to keep it, just because it makes me feel all hardcore UNIXy.

Also, OpenBSD feels fast. I don’t know if it’s just in my head or what, but the Internet connection in particular just feels so smooth compared to Arch Linux.

And that was pretty much it. The Internet, video (including 3D Radeon drivers), and audio were all configured automatically. I’m incredibly impressed with what I’ve seen. I haven’t decided where to go with OpenBSD from here, besides just “learn it more”, which I look forward to doing.

…posted from OpenBSD!




I’m Not Selling Out The Gittip Dream

A couple weeks ago, I signed a contract with O’Reilly to publish a book inspired by my extremely popular Creating An Application In Kivy blog series. On Monday, I start work at Facebook, a full-time salaried position that includes a substantial raise over my last position.

Signing these two contracts, two very traditional ways of obtaining money in exchange for services, is in stark contrast to the excitement I have held for the Gittip project. I marketed (some might say ‘begged’) for Gittip contributions in return for the service I performed in writing the Kivy articles. Gittip provided; I really didn’t expect to make more than a couple dollars per week, but my current income from Gittip is over $11 per week. I’m touched and grateful for these donations, and I don’t feel I deserve them at all, considering that I’ll be spending most of my time on my new book and job for the next few months.

It would be easy to argue that Gittip has failed. If I had somehow made more money off Gittip, I might have chosen to publish a book under a creative commons license or through other platforms, rather than signing a traditional book contract. If I was making so much money off Gittip that I could have laughed off Facebook’s salary and stayed out of the horrifically over-priced silicon valley, the open source world (and Facebook’s competitors!) would certainly have benefited.

However, there is a better way to look at this. I have committed (to myself) to contribute a substantial portion of the royalties from my new book back to the Kivy team. I will naturally use Gittip to distribute these funds. I am also planning to increase my funding of other projects out of my Facebook salary, and I’ll be using Gittip to fund the Arch Linux development team (if they ever set one up on Gittip) out of the income I already make from Arch Linux Schwag.

I believe one of the biggest problems Gittip has to solve is not increasing it’s member base, but increasing the amount of money being injected into the system. If small tips are just moving from one open source developer to another and back again (I’ve gotten into the unfortunate habit of regifting everything I make plus a few dollars), the money really has no value. It is a small gesture, but it’s not something that can be turned into food on the table if everyone just turns around and gives it away. I would definitely like to live a life, someday, where my writing and coding activities are exciting enough to the world that my entire salary comes from Gittip. However, I think the best thing I can do for the tool right now is to put money in, rather than take it out.

So no, Gittip has not failed me. It is succeeding in a different way from what I originally anticipated. Nor am I selling out. I am excited and passionate about my current and future prospects. Gittip was designed to allow content creators to pursue their passions. I’m able to do that within the traditional framework. I’m very lucky to be able to express my gratitude for my current life in the form of microdonations to other developers.




A postgres backup script for a snapshot environment


#!/bin/bash

# Backup
# Usage: backup-pg.sh
#

# If you have another method for obtaining your filer's ip
# use that instead to assign this variable
FILERIP=`mount | grep db01 | cut -d':' -f1`

# username associated with the key used
UN="snappy"
# location of the ssh key used for above user
SNAPKEY=/opt/bbcollab/voice/postgres.stuff/snapkey

# If you have another method for obtaining the volume name or archive
# Edit the two lower variables; your ARCHIVE name should have a grepable line
VOLUME=`mount | grep db01 | cut -d':' -f2 | sed 's#/vol/##g' | sed 's#/db01.*##g'`
COMNAME="backup_pgdata"
ARCHIVE="${COMNAME}-${HOST}-${TODAY}"

# location of the .snapshot directory
SSDIR=/var/voice/postgres/.snapshot

# retention in snapshot count
RETEN=4

function get_oldest_snapshot_by_filesystem
{
ss=`ls -lct $SSDIR | grep -v "total" | head -1 | awk '{print $9}'`
echo $ss
}

function get_oldest_snapshot_by_netapp
{
# looking for archives with ${COMNAME}
cur_ss=`ssh -i ${SNAPKEY} -o StrictHostKeyChecking=no ${UN}@${FILERIP} "snap list ${VOLUME}" | grep "${COMNAME}" | awk '{print $10}' | grep -v "^$" | tail -1`
echo $cur_ss
}

function remove_oldest
{
ssh -i ${SNAPKEY} -o StrictHostKeyChecking=no ${UN}@${FILERIP} "snap list ${VOLUME}" | grep "${COMNAME}" > /var/tmp/ss.lst
ss_count=`wc -l /var/tmp/ss.lst | awk '{print $1}'`
if [[ "$ss_count" -gt $RETEN ]]
then
obf=`get_oldest_snapshot_by_filesystem`
obn=`get_oldest_snapshot_by_netapp`
if [[ "$obf" == "$obn" ]]
then
ssh -i ${SNAPKEY} -o StrictHostKeyChecking=no ${UN}@${FILERIP} "snap delete ${VOLUME} $obf"
fi
else
echo "none to remove"
fi
}

function usage
{
echo ""
echo "### $0 Usage ###"
echo ""
echo "Call script like:"
echo ""
echo " $0 ()"
echo " (cron uses -a)"
echo ""
echo "Options:"
echo " -a #### Create a new snapshot and delete the oldest"
echo " -c #### Only create a new snapshot"
echo " -l #### List the current snapshots"
echo " -d Delete snapshot (regardless of age or retention)"
echo " -q #### Delete the oldest snapshot (will not delete if you have fewer snapshots than $RETEN)"
echo ""
}

if [[ $# > 0 ]]
then
case $1 in
-a) psql -U postgres -h localhost -c "SELECT pg_start_backup('${ARCHIVE}');" template1
ssh -i ${SNAPKEY} -o StrictHostKeyChecking=no ${UN}@${FILERIP} "snap create ${VOLUME} ${ARCHIVE}"
psql -U postgres -h localhost -c "SELECT pg_stop_backup();" template1
remove_oldest
exit
;;
-c) psql -U postgres -h localhost -c "SELECT pg_start_backup('${ARCHIVE}');" template1
ssh -i ${SNAPKEY} -o StrictHostKeyChecking=no ${UN}@${FILERIP} "snap create ${VOLUME} ${ARCHIVE}"
psql -U postgres -h localhost -c "SELECT pg_stop_backup();" template1
exit
;;
-l) ssh -i ${SNAPKEY} -o StrictHostKeyChecking=no ${UN}@${FILERIP} "snap list ${VOLUME}"
exit
;;
-d) ssh -i ${SNAPKEY} -o StrictHostKeyChecking=no ${UN}@${FILERIP} "snap delete ${VOLUME} $2"
exit
;;
-q) remove_oldest
exit
;;
*) usage
exit
;;
esac
else
usage
exit
fi




http://usalug.com/phpBB3//viewtopic.php?f=15&t=8086


#!/bin/bash
# Author: Josh Bailey
# Email: jbsnake gmail.com
# A function/subroutine library
# A lot of these functions and subroutines I use
# in all my scripts, some I have only used once.
# This is a lot of hard work right here, so please
# don't get tempted by saying you did it yourself :)
# If you use something here (which you ofcourse are free to do)
# Please atleast give a link to www.usalug.org or www.bashscripts.org
# You don't have to mention me, just mention where you found such awesome code ;)

function notAForwardSlash
{
if [[ ${1} != '/' ]]
then
return 0
else
return 1
fi
}

function notADot
{
if [[ ${1} != '.' ]]
then
return 0
else
return 1
fi
}

function getFileName
{

# call this function like
# filename_variable=`getFileName /some/path/with/a/file.name`

local STRING=$1
local LENGTH=${#STRING}
local n=0
local FileName=""
for ((n=0;n <= $LENGTH; n++))
do
local CHAR=${STRING:$n:1}
if notAForwardSlash $CHAR
then
FileName=$FileName$CHAR
else
FileName=""
fi
done
echo "FileName"
}

function getExtension
{

# call this like
# extension_variable=`getExtension /path/to/some/file.txt`
# extension_variable would be "txt" for that example
# you can also just pass it a filename
# extension_variable=`getExtension somefile.lst`
# extention_variable would be "lst" for that example
# but if you pass it a filename or path without a .
# it will return exactly what you pass it
# extension_variable=`getExtension /path/to/my/script`
# extension_variable would be "/path/to/my/script"

local STRING="${1}"
local LENGTH="${#STRING}"
local n=0
local Extension=""

for ((n=0; n <= $LENGTH; n++))
do
local CHAR=${STRING:$n:1}
if notADot $CHAR
then
Extension=$Extension$CHAR
else
Extension=""
fi
done
echo "$Extension"
}

function getPath
{

# call this like
# chop_path=`getPath /path/to/something.file`
# chop_path would be populated with "/path/to/"

# function to get only the path from a path/filename combo
# first get the filename from $1 which is a path/filename combo
local just_filename=`getFileName "$1"`

# set the variable containing the path
local newPath=${1:0:(${#1}-${#just_filename})}
echo "$newPath"
}

function inStr
{

# call this function like
# instr_variable=`inStr "=" "1=2"`
# since the position of = is 1 (i.e. 0 1 2 )
# instr_variable would equal 1

local searchFor="$1";
local lenOf=${#searchFor};
local searchIn="$2";
for (( i=0; i /dev/null< /dev/null
if [[ $? -eq 1 ]]
then
return 1
else
touch ${1}/bob.yea\ do0d 2> /dev/null
if [[ $? -eq 1 ]]
then
rm ${1}/bob.yea\ do0d 2> /dev/null
return 1
else
rm ${1}/bob.yea\do0d 2> /dev/null
return 0
fi

fi
}

function trimspaces
{

# call this like
# new_string=`trimspaces "some random text" " "`
# new_string variable would be "somerandomtext"
# new_string=`trimspaces "some_random_text" "_"`
# new_string variable would be "somerandomtest"
# new_string=`trimspaces "some random_text"
# new_string variable would be "somerandom_text" (default, if nothing is passed, to remove are spaces)

local NewString=""
local STRING="$1"
local rmChar="$2"
local CHAR=""
local NewString=""

if [[ $rmChar = "" ]]
then
rmChar=' '
fi
for ((i=0; i<${#STRING}; i++))
do
CHAR=${STRING:$i:1}
if [[ $CHAR != $rmChar ]]
then
NewString=$NewString$CHAR
fi
done
echo "${NewString}"
}

function fileExist
{

# call this like
# if [[ fileExist "/path/to/some/file.name" ]]
# then
# yes it does
# else
# no it doesn't
# fi

if [[ -a "$1" ]]
then
return 0
else
return 1
fi
}

function isNumeric
{

# call this like
# if [[ isNumeric ]]
# then
# yes it is
# else
# no it's not
# fi

local Numeric='y'
local len=`echo ${#1}`
local val=""
local retval=""

for ((i=0; i /dev/null
retval=$?
if [[ $retval -eq 1 ]]
then
if [[ $i -eq 0 && $val = '-' ]]
then
num="negative"
else
Numeric='n'
break
fi
fi
done
if [[ $Numeric = 'y' ]]
then
return 0
else
return 1
fi
}

function isAlpha
{

# call this like
# if [[ isAlpha ]]
# then
# yes it is
# else
# no it's not
# fi

local Alpha='y'
local len=`echo ${#1}`
local val=""
local retval=""

for ((i=0; i /dev/null
retval=$?
if [[ $retval -eq 1 ]]
then
Alpha='n'
break
fi
done
if [[ $Alpha = 'y' ]]
then
return 0
else
return 1
fi
}

function isAlphaNum
{

# call this like
# if [[ isAlphNum ]]
# then
# yes it is
# else
# no it's not
# fi

local AlphaNum='y'
local len=`echo ${#1}`
local val=""
local retval=""

for ((i=0; i /dev/null
retval=$?
if [[ $retval -eq 1 ]]
then
echo $val | grep ^[0-9] > /dev/null
retval=$?
if [[ $retval -eq 1 ]]
then
AlphaNum='n'
break
fi
fi
done
if [[ $AlphaNum = 'y' ]]
then
return 0
else
return 1
fi
}

function initialCaps()
{

# call this like
# new_string=`initialCaps "john doe"`
# new_string variable would be "John Doe"

local Cap=""
local Info=""
local Word=""
local string="${1}"
local cut=""

while [ ${#1} != 0 ]
do
Cap=`echo ${string:0:1} | tr [:lower:] [:upper:]`
Info=`echo -n $Cap; echo ${string:1:${#string}} | tr [:upper:] [:lower:]`
Info=${Info}" "
Word=${Word}${Info}
shift 1
done
cut=${#Word}-1
Word="${Word:0:${cut}}"
echo "${Word}"
}

######## Music file format stuff #################################

function get_ogg_info
{

# call this like
# ogg_info_string=`get_ogg_info "/path/to/file.ogg"`
# ofcourse the string would have to be parsed
# it is pipe | delimited
# in order artist, title, album, genre, date, and track number
# inStr function needed; vorbiscomment (comes with oggenc)
local turn=""
local index=0
local item=""
local cartist=""
local ctitle=""
local calbum=""
local cgenre=""
local cdate=""
local ctracknumber=""

vorbiscomment -l "$1" > info.lst
for turn in artist title album genre date tracknumber
do
tmp_comment=`grep -i "$turn" info.lst`
item=`inStr "=" "$tmp_comment"`
comment=${tmp_comment:${item}+1}
((index++))
case $index in
1) cartist="$comment";
;;
2) ctitle="$comment";
;;
3) calbum="$comment";
;;
4) cgenre="$comment";
;;
5) cdate="$comment";
;;
6) ctracknumber="$comment";
;;
esac
done
info="${cartist}|${ctitle}|${calbum}|${cgenre}|${cdate}|${ctracknumber}"
echo "${info}"
rm -f info.lst
}

function encode_flac2mp3
{

# call this like
# encode_flac2mp3 /path/to/source/file.flac /path/to/destination
# needs: getFileName function; flac encoder/decoder; lame

local old_file="${1}"
local new_dir="${2}"
local short_filename=`getFileName "${old_file}"`
local new_file="${short_filename:0:${#short_filename}-5}.mp3"

flac -d -o - "${old_file}" | lame -b 320 -h - > "${new_dir}/${new_file}"
}

function encode_flac2ogg
{

# call this like
# encode_flac2ogg /path/to/source/file.flac /path/to/destination
# needs: getFileName function; flac encoder/decoder; oggenc

local old_file="${1}"
local new_dir="${2}"
local short_filename=`getFileName "${old_file}"`
local new_file="${short_filename:0:${#short_filename}-5}.ogg"
###### get artist and album before release #########
# flac -d -o - "${old_file}" | oggenc -a "$artist" -l "$album" -t "${title}" - -o "${new_dir}/${new_file}"
####################################################
local title="${short_filename:0:${#short_filename}-4}"

flac -d -o - "${old_file}" | oggenc -t "${title}" - -o "${new_dir}/${new_file}"
}

function encode_ogg2mp3
{

# call this like
# encode_ogg2mp3 /path/to/source/file.flac /path/to/destination
# needs: getFileName function; oggdec; lame

local old_file="${1}"
local new_dir="${2}"
local short_filename=`getFileName "${old_file}"`
local new_file="${short_filename:0:${#short_filename}-4}.mp3"
local info_string=`get_ogg_info "$old_file"`
local cartist=`cut -d| -f1 ${info_string}`
local ctitle=`cut -d| -f2 ${info_string}`
local calbum=`cut -d| -f3 ${info_string}`
local cgenre=`cut -d| -f4 ${info_string}`
local cdate=`cut -d| -f5 ${info_string}`
local ctracknumber=`cut -d| -f6 ${info_string}`

oggdec "${old_file}" -o - | lame -b 320 --tt "$ctitle" --ta "$cartist" --tl "$calbum" --ty $cdate --tn $ctracknumber --tg "$cgenre" -h - > "${new_dir}/${new_file}"
sleep .5
}

####################################################################################

############################ gpg stuff #############################################

function list_private_keys
{

# call this like
# list_private_keys
# it just clears the screen then
# pipes the private items on your keyring to less

clear;
echo ":: Listing private keys";
gpg --list-secret-keys | less;
echo ":: Done";
}

function list_public_keys
{

# call this like
# list_public_keys
# it just clears the screen then
# pipes the public imported keys on
# your keyring to less

clear;
echo ":: Listing public keys";
gpg --list-keys | less;
echo ":: Done";
}

function decrypt_any_file
{

# call this like
# decrypt_any_file /path/to/some/encrypted/file.asc
# it clears the screen then prompts you for your passphrase
# then decrypts the encrypted file into another file

local filename="$1";
local person=`whoami`;
clear;
if [[ ${filename:${#filename}-11:11} -eq "-encrypted" ]]
then
local newfilename="${filename:0:${#filename}-${#person}-12}";
gpg -d --output "$newfilename" "$filename";
echo ":: Decrypted $filename";
echo ":: Saved as $newfilename";
else
gpg -d --output "$filename.decrypted" "$filename";
echo ":: Decrypted $filename";
echo ":: Saved as $filename.decrypted";
fi
}

function encrypt_any_file
{

# call this like
# encrypt_any_file /path/to/file/to/encrypt.asc "who it's encrypted for"
# it clears the screen then encrypts the file you specified
# saving the encrypted file to have the persons name and "-encrypted" at the end

local filename="$1";
local person="$2";
clear;
gpg -sea --output "$filename"."$person"-encrypted --recipient "$person";
echo ":: File $filename encrypted";
echo ":: Encrypted file saved as $filename.$person-encrypted";
}

function export_public_key
{

# call this like
# export_public_key "Key Identifier"
# generates a key pair and saves the public key as "Key Identifier.pub"

local ID="$1";
gpg -ao $ID.pub --export $ID;
echo ":: Public Key for $ID has been generated"
echo ":: File is saved as $ID.pub"
}

function import_public_directory
{

# call this like
# import_public_directory /path/to/directory/full/of/public/keys
# changes directory to the public key directory and imports every file there
# then goes back to the directory you started in

local DIR=$1;
cd "$DIR";
for filename in *
do
gpg --import "$filename";
done;
cd ~-;
}

function create_encrypted_ascii_file
{

# call this like
# create_encrypted_ascii_file /path/to/location/for/future/message.asc "Who to encrypt for"
# opens a vi session (note you can make the editor whatever you want by changing the variable)
# once you close the editor, the file you just edited is encrypted
# then it's echo'd to the console for easy copy and pasting

local editor="vi"
local file="${1}";
local person="${2}";
${editor} "${file}";
gpg -sea --output "${file}.${person}-encrypted" --recipient "${person}" "${file}";
clear;
echo ":: Encrypted file created";
echo ":: File saved as ${file}.${person}-encrypted";
echo ":: Contents of file shown below";
echo -e "\n\n";
cat "${file}.${person}-encrypted"
}

function import_public_key
{

# call this like
# import_public_key
# it prompts you for the key-file you wish to import

read -p "Please type the path of the public key you wish to import: " file
if [[ -e "$file" ]]
then
gpg --import "$file"
else
echo "${file}: doesn't exist, or you typed the wrong path!"
exit
fi
}

function create_user_list
{

# call this like
# create_user_list
# makes a list of users on the system
# it grabs the contents of /etc/passwd
# then removes the entry for root
# and saves the list as users.list

cat /etc/passwd | cut -d: -f1 > pre.list;
cat pre.list | grep -v "root" > users.list;
rm pre.list;
}
#####################################################################################3

function app_up
{

# call this like
# app_up /path/to/file/append.from /path/to/file/append.to
# puts data from a file at the top of another file instead of the bottom

if [[ ! -e ${2} ]]
then
touch ${2}
fi

${1} > temp
cat ${2} >> temp
rm -f ${2}
mv temp ${2}
}

function createROMISO
{

# call this like
# createROMISO /dev/cdrom /path/to/new/rom.iso

# the command that makes an ISO from a cd/dvd
# $1 should be the device path (/dev/cdrom)
# $2 should be the iso path and filename
dd if=$1 of=$2 bs=32k
}

function createDIRISO
{

# call this like
# createDIRISO /path/to/new/rom.iso /path/to/directory/you/want/to/backup

# the command that makes an ISO from a directory
# $1 should be the iso path and filename
# $2 should be the directory to backup
mkisofs -o $1 $2
}

function msg
{

# call this like
# msg "Title of Message Box"
# or
# msg "Title of Message Box" $height $width

# function for making a messagebox
# if it has less than two arguments
if [[ $# < 2 ]]
then
# use auto-size for the messagebox
dialog --msgbox "$1" 0 0
else
# use specified height and width
dialog --msgbox "$1" $2 $3
fi
clear
}




Shooting An Iceray

So I am working on learning a few things, all at the same time. The coolest thing is Go, the “programming environment that makes it easy to build simple, reliable, and efficient software” from Google. But I’m also playing with GitHub, as the whole environment can be tightly integrated with it. And so, by extension, I’m playing with Git. More on all of those at a later, probably over on my Daemon Dancing In The Dark more generalized Linux blog.

Anyway, I’m working on a program I call Iceray. It is a command line application that will send MP3 files to an Icecast / Shoutcast server, like my Vehement Flame radio station. I wanted something I could run that would just feed the server without me handholding it.

So I went to work on packaging it up and finally got a PKGBUILD to work. I spent way too much time working on it, especially when it turned out the Go Packing Guidelines wiki page is pretty good. The sample PKGBUILDs should have worked better for me, but I got a few of my streams crossed which took me out of my game for a bit.

The first thing was actually in my Go program. I changed all the package declarations to be ‘package iceray’, not realizing that if it isn’t ‘package main’ it will build a library and not an application. And I also had the _gourl in my PKGBUILD wrong, in that I originally created it as a Git package, so I had the git: protocol in there.

And the page is still a little confusing, in that I needed to use a combination of the sample PKGBUILDs. While iceray in the end boils down to an application, I still found it necessary to use ‘go get‘ in the build() routine, because I don’t think ‘go build‘ pulls in the necessary remote libraries (I use go-libshout, gcfg, and go-id3). And the application ones use the path “$srcdir/$pkgname-$pkgdir”, but “$srcdir” worked just fine for me. So here’s the final PKGBUILD:

# Contributor: Jonathan Arnold <jdarnold@buddydog.org>

pkgname=iceray
pkgver=0.2
pkgrel=2
pkgdesc="Icecast/Shoutcast commandline client"
arch=('i686' 'x86_64')
url="https://github.com/jdarnold/iceray"
license=('MIT')
depends=('libshout')
makedepends=('go')
conflicts=('iceray')
provides=('iceray')
options=('!strip' '!emptydirs')
_gourl="github.com/jdarnold/iceray"
install=${pkgname}.install

build() {
    cd "$srcdir"
    GOPATH="$srcdir" go get -v -x ${_gourl}/...
}

package() {
    install -Dm755 "$srcdir/bin/$pkgname" "$pkgdir/usr/bin/$pkgname"
    install -Dm644 "$srcdir/src/$_gourl/iceray.gcfg.sample" "$pkgdir/usr/share/$pkgname/iceray.gcfg.sample"
    #install -D -m644 iceray.1 $(DESTDIR)$(MANPREFIX)/man1/iceray.1
}

So, in the end, the PKGBUILD was pretty simple, despite my flailing about. Hope this helps someone else!

AUR (en) – iceray.




Arch Linux Schwag site is back up (a comment on privacy)

Hey all,

http://schwag.archlinux.ca has been down for at least a week. I’m really sorry about that. I’ve been working on transferring to a new web host and they were having trouble getting all the Python dependencies I needed.

My old host was based in the United States, and while they provided exceptionally good service for the price, I have become uncomfortable with storing any data in the US. The websites are not private, of course. However I am also hosting e-mail on these domains. As a Canadian citizen, I am not covered by the NSA’s (possibly false) claim that they do not spy on US citizens, so I felt that I should store it in my own country.

I don’t do anything that is currently illegal, but I don’t know that these arrogant governments aren’t going to change their laws to restrict my freedoms. I may not be a person of interest today, but I am outspoken about freedom, privacy, and transparency. This is currently legal and acceptable, but that may not always be the case and I want to be proactive about keeping my private data out of the hands of those who would use it against me.




Jolla Mobile

I freaking love my mobile phone.

It was one year ago on 28 Aug 2012 that I bought my first smart phone, a used Nokia N900. I’ve read about different phones and I knew exactly what I wanted. The N900 came out in late 2009. It’s pretty old, but there’s no other phone like it.

It’s pretty much a mobile Linux computer with a pretty and simple phone interface slapped on top of it. Since Linux is all I use at home it’s a perfect match for me. It’s all the power and all the tools that I use on my desktop computer in a form that can fit in my pocket.

"Hello? Oh, hey! Yeah, I got my new Linux phone! It's JUST LIKE a computer?"

“Hello? Oh, hey! Yeah, I got my new Linux phone! It’s JUST LIKE a computer?”

It took me a while to really realize what made the N900 special. After all, Android is “Linux” too. The N900 is different in that it’s Linux like every other Linux operating system. It has GNU. It (mostly) follows things like the Linux Standard Base and Filesystem Hierarchy Standard. The package manager is “apt” from Debian. It’s Linux, just like I like it.

It’s also very different from the iPhone in that all N900 phones are unlocked, and anyone can become root and get full access to the device from the day they get it. That means I’m in control of my phone and everything on it. I can install anything I want, even older versions of software. I can develop software for it from any computer, including making software FOR the phone ON the phone. I wouldn’t want to, but the point is that I can.

The N900 had one successor, the Nokia N9, before Nokia moved all of their smart phones to the Windows Phone operating system. The people that worked on my phone left Nokia and started their own company called Jolla. And if you’re a rabid Linux nerd like me then you’ll be excited about the mobile phone they’re developing.

What makes the Jolla Mobile phone special? It’s open source Linux underneath with a shiny new easy-to-use user interface. It’s made by the same people that made the N900 and the N9. It runs Android applications (if you can’t live without some). And it comes out by the end of 2013. Yay!

…but sadly I probably won’t be able to get one when they do come out. (Boo!) It appears that all the pre-orders have been booked, and there might be some time before they are sold in the US.

It’s for the best I suppose. I need to save up money for it (unless Santa really loves me).

Until then, I’ve got pictures of the Jolla Mobile phone as my wallpaper on my N900. I installed all the ringtones and SMS tones from Jolla (they’re pretty cool). So until I get one, I can dream…

my-jolla




The importance of “One Obvious Way”

In the face of ambiguity, refuse the temptation to guess.
There should be one– and preferably only one –obvious way to do it.
Although that way may not be obvious at first unless you’re Dutch.

— Tim Peters, The Zen of Python
>>> import this

While Python has numerous advantages over other languages that make me reach for it first when starting a new project, I feel the two most important are its emphasis on readability and the community belief in Tim’s words above, “there should be one– and preferably only one –obvious way to do it.” While it’s rare to stumble upon a Python coder that doesn’t implicitly “get” this principle, I find that is frequently misinterpreted when I try to explain Python’s charm to outsiders.

This may be because I often misquote the principle as “the one best way” principle. Many languages have a “one best way” principle. Java, for example, insists that the best way to solve any problem is object oriented programming. Similarly, prolog insists that logic programming is the best way, and Haskell programmers suggests that functional is always the way to go.

Python is not like this at all. Python is pragmatically multi-paradigm. Python has a long history of stealing great ideas from other languages (and, given Guido’s genius, making them better). Python does the very opposite of insisting that there is a best way to do everything.

Orthogonally, I have often had my defense of this principle misinterpreted as having said, “Python is always the best solution to any problem.” This makes me sound arrogant and misinformed, and is patently false. I am keenly aware of Python’s shortcomings. My day job has me pushing Python’s limits on a regular basis, and often, it fails me.

No, Python is not always the best way. The “one obvious way” principle refers to something quite different. It’s not about the language or its libraries at all, it’s more about the programmer’s mindset. Given any specific problem, there are invariably multiple ways to solve it. A Python developer will start out by assuming that one of those assorted solutions is the best solution. The goal of both the Python language and the libraries developed by the community is to make that best solution the obvious one to implement.

This is a form of consistency. Just as pep-8 strongly encourages us to be consistent with all other Python developers in our coding style, the “one obvious way” principle encourages us to be consistent in our choices of algorithms, data structures, and design patterns. In an ideal world, this means that any two Python programmers, given the same problem, would write virtually the same solution. Further, the solution that they proposed would be the best possible solution for the given problem, and all other pythonistas would find it elegantly readable.

This never happens. However, I believe that Python programs are closer to this ideal than many (if not most) other languages. This cohesion means that Python code is often more maintainable, not just by the original developer, but by all members of the Python community.

Some might suggest that strict adherence to the “one obvious way” principle is narrow-minded and restricts experimentation. I heartily disagree. There is clearly not one best web framework in Python. There are numerous web engines available, some more suitable to specific purposes than other. And more are being written every day. I think this is because nobody strictly believes that the most obvious implementation has been found, yet. The poem says there should be one obvious way. It doesn’t say that there always is one. The Python community as a whole is working together to find these best solutions and make them into the obvious solution. A few problems are solved. If you need an iterator, Python’s got you covered. Others are still up in the air, as evidenced by the collection of web frameworks or packaging tools or xml parsers on pypi. Some have only been recently solved; the Requests library is a terrific example. And still more are completely unsolved. The most obvious way I’ve found to handle concurrency and parallelism in Python is: Use Golang. Kivy is a terrific library, but the obvious way to do Android development is still (currently) Java.

In summary, while the ideal of “obviousness” is far, far away, I believe that it is a worthy goal to pursue. I think the mindset attracts a certain kind of programmer, and that those programmers are all as delighted when they discover Python as I was almost a decade ago. I don’t think Python is the best tool for all jobs, nor do I think it is the most enjoyable tool for all programmers. However, for those coders who like a certain kind of obvious, readable, elegance, Python is the language of choice.




Get Blog Updates Delivered to your Inbox!
Enter your email address:

Delivered by FeedBurner

Add to Google Reader or Homepage

Subscribe in NewsGator Online

Add to My AOL

Add to netvibes

Add to Excite MIX