Planet ArchLinux.me

Crouse – UID ZeroTest post after indexpage update

Just a test please ignore.

killerturtleSharing files in your home network with Samba

I’ve got an old Dell laptop, which runs Arch, an Imac 20 inch and a LG DP1W mediaplayer and streamer. Now would it not be great if I could share file across all three machines? I’m gonna start with SAMBA and see how well this works. NFS will come later…

Ok, here we go.

Step 1. First thing to do is install the Samba client and server software on Arch.

# sudo pacman -S smbclient samba gamin

Gamin is a file and directory monitoring system defined to be a subset of the FAM (File Alteration Monitor) system. It is a service provided by a library which allows for the detection of modification to a file or directory. Gamin re-implements the FAM specification with inotify. It is newer and more actively maintained than FAM, maintains compatibility with FAM and can replace it in almost every case. It is a GNOME project, but does not have GNOME dependencies.

Step 2. Configure samba. As root, copy the default Samba configuration file to /etc/samba/smb.conf:

# cp /etc/samba/smb.conf.default /etc/samba/smb.conf

Then configure this file to your needs. By default the HOME user directories are shared.

Step 3. Add a user. To log into a Samba share you’ll need to add a user:

# smbpasswd -a <user>

Note that the user you add should be an existing user on the server side of Samba.

Step 4. Make Samba load at boot. Add the following to /etc/rc.conf to access the shares at boot:

# sudo nano /etc/rc.conf

Find the section that looks like and add smbnetfs and samba:

DAEMONS=(... smbnetfs samba ) 

That’s it! You should now be able to access your home folder from a another machine.

Good luck!

ArChatterAUR – bootchart

Now this looks like a pretty cool package. Set bootchart up in your boot process and it tracks everything that happens. After you’ve logged in, you can run a utility that will generate a nice little chart, showing what and when for your boot up. There’s a very nice ArchWiki page for it (natch).

One caveat is that the project itself (bootchart.org) hasn’t been updated in like 5 years. But I guess if it works, it works. I’ll give it a try and post my picture here. Maybe I can then figure out why some daemons fail at startup…

AUR (en) – bootchart.

ArChatterlogger

nice hint from the Season 3, episode 1 Tuxradar podcast – logger. You can add notes to the system log, even as a user. So:

$ logger added a new kernel
$ sudo tail /var/log/messages.log
Feb 24 21:45:41 localhost kernel: usb 3-2.1: new full speed USB device using uhci_hcd and address 46
Feb 24 21:45:41 localhost kernel: hub 3-2.1:1.0: USB hub found
Feb 24 21:45:41 localhost kernel: hub 3-2.1:1.0: 4 ports detected
Feb 24 21:45:42 localhost kernel: usb 3-2.1.1: new full speed USB device using uhci_hcd and address 47
Feb 24 21:55:20 localhost -- MARK --
Feb 24 22:06:12 localhost jdarnold: added a new kernel

That’s pretty cool. As I showed, I just added a note that I have a new kernel now, so if there’s any question about compatibility, I’ll know!

UNIX man pages : logger (1).

ArChatterArchMap

If you’re an Arch user, be sure to add yourself to the Google Earth ArchMap list! 2 easy steps:

  1. Find your address in Google Maps and right click on it. Select the “What’s Here” option and, in the address bar for Google Maps, you’ll see your decimal coordinates. Copy these.
  2. Edit the ArchMap/List wiki page and add those coordinates at the bottom. That’s it!

ArchMap

anikom15How Binaries Work

ArChatterPlanet ArchLinux.me

Because I had way too much else I was supposed to do, I decided to do none of it, and look into a way of aggregating all the blogs found here on ArchLinux.me into a “planet”-type page. On this page I wanted to show the latest posts from all the blogs here on ArchLinux.me.

Searching the AUR on “rss” lead me to rawdog. A little long in the tooth, but there were a couple of options in the config that led me to believe it should work. But alas, the two “planet” options didn’t seem to do anything.

So I just happened to notice today that there is already a Planet Arch – did you know there was one? There’s a link on the right sidebar of the Arch Linux homepage for it. A little uneccessary spelunking (as there’s a Colophon section) by looking at the source code led me to the Planet Venus code. Actually, the Colophon is wrong, because Planet Arch doesn’t use the Planet Planet aggregator. The Planet Venus aggregator is a fork of the Planet 2.0 code. So I think I’m glad I just looked at the code for the page and found this at the top of the html:

<meta name="generator" content="http://intertwingly.net/code/venus/" />

So here’s the result: Planet ArchLinux.Me

There’s very little tweaking of the asf theme, but hey, it’s a start. I sent along a note to Crouse to see if maybe he can run this off of the ArchLinux.me server, but in the meantime, I’ll just update the above page by hand for now.

Hey, you other ArchLinux.me bloggers – get busy already!

ArChatterLast Week in Arch

My latest post in the Rolling Release wiki is up, wherein I list some “interesting” things going on in the Arch Linux world:

Last Week in Arch – Feb. 20, 2011.

ArChattermimeo

Mime handling is always confusing, esp. in regards to file associations. I currently have a couple broken ones, like the fact that launchy opens all my desktop shortcuts in emacs :( If I click on them in my file manager (Thunar), they open fine.

Anyway, the prolific Xyne has a new package called ‘mimeo’ that offers to help. I’m going to give it a try.

mimeo

drcouzelisIcons

I’m very unhappy with the situation of icons in Linux.

When I started using Linux around ten years ago, it seemed like every application had it’s own way of adding an application icon. Nowadays, it seems like most applications use the standard FreeDesktop.org method, but a few don’t, or something. I don’t know. All I know is, I always end up with a few applications that have icons that either look horribly out of place or simply just don’t exist.

Haiku is another open source operating system. It has beautiful icons compared to any other operating system, and I think there are a few reasons for that:

  1. The one and only Haiku API encourages software developers to use the official method of adding an application icon.
  2. All of the other icons in Haiku look so nice that, if you don’t make a beautiful icon for your application, it will stick out like an ugly application icon.
  3. There’s hardly any software for Haiku at the moment.

Anyway, I recently started using the Fluxbox window manager. I chose it because it has a clean and simple user interface, and I can disable all application icons.

ArChatterYapan – Yet Another Package mAnager Notifier

I installed Yapan the other day and have been really happy with it. It sits in the notifier area of my tint2 window in my Openbox window manager and periodically checks to see if any packages have been updated. I’m pretty good about running my update once a day, but this is kind of fun too.

I set it up to use my package manager of choice, bauerbill, thusly:

Synchonize: sudo bauerbill -Sy
Packages to update: bauerbill -Qu
Update: sudo bauerbill -Su

Because bauerbill is a command-compatible with pacman, it works like a charm and includes checking the AUR for updates too.

otsug / Yapan / wiki / Home – Bitbucket.

ArChatterYet Another Blog

I couldn’t resist. Thanks to crouse I have stated another blog. My love of writing combines with my Arch Linux fanboi tendencies to make having an archlinux.me blog too irresistable.

I’m not really sure what I’m going to do here. It will certainly be Arch Linux focused, but I’m not exactly sure how it will differ from my other blogs. I already have a “technical” blog (Daemon Dancing In The Dark) which I don’t update nearly enough. I have a Linux Tumblr (JD’s Linux Love) where I post little web snippets, because Tumblr’s bookmarklet is really powerful. I’ll probably at least funnel those posts to here.

Otherwise, I’ll keep it Arch focused here. Maybe I’ll post links to interesting forum topics, wiki pages, new software, announcements and the like. Consider it my Arch Linux messy drawer. You know, that drawer in your kitchen that seems to attract all manner of junk, that you keep meaning to clean out, yet always seems to have what you are looking for.

Dusty's Diverse DomainNew Arch Linux Laptop Bags

My supplier for the Arch Linux Laptop Bags product line has updated her offerings. We have four new laptop bags available, and some of the older models have been dropped or reduced in price. Check out Arch Linux Schwag to review the offerings.

In addition, I’ve reduced the price on Arch Linux pens to below cost, in an effort to liquidate some stagnant inventory.

As always, thanks for supporting Arch Linux!

drcouzelisThe return of malloc

Should you always check the return value of malloc? There’s a heated debate over the answer.

One group insists that, in good software development, you always check the return value of a function, including malloc. It appears that most software developers are in this group.

The other group thinks otherwise. I’m in this group. Here’s why.

I was taught, like many programmers, to always check the return value of malloc. This thread made me think otherwise: Always check malloc’ed memory? The asker raises many interesting points.

When thinking about checking the return value of malloc, it’s important to consider the operating system, hardware, and type of software that you are working on. Linux may behave differently from FreeBSD, a desktop computer may behave differently from a mobile phone, and a GUI application may need different considerations than a shared library. Also remember that it may not even be your application that is causing malloc to fail.

I’m primarily concerned with the case of a GUI application running on Linux on a desktop computer, because that’s what I work on. Even so, it’ll be fun to think of the other cases.

Failure Response

So, let’s say you check the return value every time you use malloc. What do you when a return from malloc fails? You could simply quit your application immediately. You could try to quit your application gracefully. You could cancel the command that caused the fail and display an error message. You could loop until either malloc returned a valid result or the computer catches on fire.

Can You Respond?

Let’s pretend that malloc failed. Imaging the state that the computer is in that caused it to fail. Would it still be able to do any processing at all? I agree that it is extremely important for an application to never lose the user’s data, but would the computer even still be able to recover anything at that point?

Does malloc Fail?

In Linux, malloc may never even fail. On the malloc man page under “Bugs”, it states that just because malloc didn’t fail doesn’t mean it has enough memory.

The Trial

So, I wrote some code to try and make malloc fail. When it does, it tries to recover and quit gracefully.

#include <malloc.h>
#include <stdio.h>
#include <stdlib.h>

typedef struct NODE
{
  int data[40000000];
  struct NODE* next;
} NODE;

int
main(void)
{
  NODE* node;
  NODE* first;
  NODE* last;
  int stop;
  int count;

  first = NULL;
  stop = 0;
  count = 0;

  while (!stop) {

    node = (NODE*)malloc(sizeof(NODE));
    count++;

    if (node == NULL) {
      printf("FAILED! %d \n", count);
      stop = 1;
    } else {
      if (first == NULL) {
        first = node;
        last = node;
      } else {
        last->next = node;
        last = last->next;
      }
    }
  }

  count = 0;
  node = first;

  while (node != NULL) {
    last = node;
    node = node->next;
    free(last);
    count++;
  }

  printf("FREED %d \n", count);

  exit(0);
}

The Results

Here are the results when running it on three different operating systems.

Arch Linux: After 55 seconds, the message “Killed” was displayed. This was a message from the operating system, not my code. My program never had the opportunity to see a failure from malloc nor try to cleanup after it.

Haiku: Almost immediately the program stopped. The output was “FAILED 10, FREED 9″. That means that after trying to allocate about half a gigabyte of memory, it failed to allocate anymore and was able to clean up the stuff it had.

Windows XP: The results were similar to Haiku: Almost immediately the program stopped. The output was “FAILED 12, FREED 11″.

Conclusion

By using this simple test, it appears that checking the result of malloc can be a worthwhile task. My conclusion is contrary to my feelings from the beginning of this post. I think I just might have to change my programming habits.

kaptenenError 15

De senaste dagarna har varit ytterst spännande med flertalet händelser, det är dock bara en av dem som jag kommer att ta upp här. Då jag är väldigt seriös vad gäller Facebook tänkte jag byta namn på ett album jag har skapat innehållande två st pandor till /boot/kernel26.img för att visa min uppskattning gentemot mina vänner i nöd. Jag tänkte i samband med detta att det kunde vara bra att faktiskt titta in i /boot för att se om allting stämde, döm till min förvåning när mappen var tom. Det fanns ingenting under /boot. Direkt började jag fundera kring vad jag kan ha gjort för att åstadkomma detta elände. Tankarna kom direkt till ett skript jag testade som skulle ta en backup på bland annat /home, men varför skulle en mapp med innehåll försvinna och andra mappar vara kvar? Skumt. Jag visste hursomhelst att jag inte skulle kunna starta om datorn med det resultat jag är van vid. Jag började därför att kopiera systemfiler som jag fint hade konfigurerat samt /home till en av mina externa hårddiskar. Sedan samlade jag mod och startade om datorn. Error 15 kom som förväntat upp då ingen menu.lst eller allt annat viktigt som ska finnas i /boot faktiskt inte fanns där.

Efter denna händelse började jag fundera kring nästa steg. Skulle jag sätta in archskivan jag har och installera om GRUB och eventuellt kärnan, eller starta en ren installation? Jag bestämde mig för det sistnämnda, jag har tidigare dualbootat med Windows men väldigt sällan använt Windows och tänkte därför att det var dags att bli av med skiten. Jag hade säkerligen mycket skit under Arch också och med min backup till hands skulle jag kunna återskapa det mesta, förutom all skit jag har samlat på mig.


:(

kaptenenSVT Play – Utan flash

Alla som använder Linux vet att Adobe Flash inte är något vidare, dessutom är alla svenskar väl medvetna om att SVT använder sig utav Flash på sin annars intressanta innehållsmässiga hemsida. Många som använder sig utav Linux installerar någon dist och kör sedan vidare, utan att kolla efter tips och trix på saker som de stör sig på. Jag är inte en av dem. Jag har sedan länge använt mig utav lite halvtaskiga och tråkiga skript som gör att mplayer spelar upp de klipp SVT Play har att erbjuda. Jag ansåg att jag behövde kolla vidare efter bättre skripts (som andra har gjort, såklart). Nedan kommer två st, den ena streamar via mplayer medan det andra laddar ner videos. Riktigt bra! Som tidigare har nämnts så är det smidigt om följande finns i .bashrc eller vilket shell som nu används: export PATH=”${PATH}:${HOME}/bin” där du senare placerar följande om de verkar vara av värde för dig.

Streamning:
svtplay.pl – Ett tips är att kolla vad det är för pearlmoduler som du behöver och om du har dem. Även rtmpdump och mplayer behövs.

Ladda ner videos:
Skriptet kommer ursprungligen från ett svensk forum. Jag tänker inte ta äran för de fåtal ändringar som jag har gjort vilka är följande;
1. Tog bort delen där skriptet ville installera beroenden som saknades (dessa var för ämnade för Ubuntu).
2. Tog bort delar som är relaterade till zenity. Jag hade inte programmet installerat och ville inte ha det bara för skriptet. Istället la jag till notify-send vilket de flesta redan har installerat. Smidigt? Ja.
I alla fall, här kommer det:


#! /bin/bash
#
TITLE="Hämta hem fil från SVT-Play"
LINK=$(yad --center --entry --width=800 --title "$TITLE" --text "Högerklicka och klistra in länken till filmen" 2>>/dev/null)
if [[ $LINK != "" ]]; then
DATE=$(echo $LINK | awk -F \/ '{ print $7 }')
if [[ $DATE != "" ]]; then
FILM=$(basename $LINK | awk -F \- '{ print $4 }')
if [[ $FILM != "" ]]; then
TYPE=$(basename $LINK | awk -F \. '{ print $2 }')
if [[ $TYPE != "" ]]; then
OUTFILE="$FILM-$DATE.$TYPE"
rtmpdump -r $LINK -o $OUTFILE 2>&1 | yad --center --title "Hämtar $OUTFILE" --no-buttons --tail --text-info --width 600 --height 20
IRET=$?
if [[ $IRET != 0 && $IRET != 252 ]]; then
notify-send "Hämtning av film misslyckades ($IRET)!"
exit
fi
else
notify-send "Kunde inte finna någon implicit filmtyp i angiven webbadress!"
exit
fi
else
notify-send "Kunde inte finna något implicit namn i angiven webbadress!"
exit
fi
else
notify-send "Kunde inte finna något implicit datum i angiven webbadress!"
exit
fi
else
exit
fi

Herrå!

Dusty's Diverse DomainPrickle v0.4: CouchDB to MongoDB

I took some free time to port Prickle, my stay out of your way time tracking tool, from CouchDB to MongoDB. I originally wrote it to use Pylons and Couchdb specifically because I felt like studying a couple of technologies I hadn’t tried before. I found CouchDB to be a bit unwieldy to code with, and it didn’t take long for it to get slow on my Prickle datasets. Rather than figure out how to optimize CouchDB, I decided to port it to MongoDB.

The port was relatively straightforward. I was able to use pretty much the same model layout (Prickle has a very simple data layer). I tightened it up a bit to use actual references between models instead of implicit foreign keys by ids.

I chose to use MongoEngine for the database layer. I started with pymongo, but decided that a more abstract object-document-manager would be more useful.

I found querying in MongoEngine to be much simpler than the map-reduce queries in CouchDB. It is very similar to the Django ORM with which I am very familiar. Document creation and mapping is also familiar. Overall, I think Prickle will be a lot easier to maintain and extend using MongoDB than it was with CouchDB.

Prickle v0.4 does not contain any new features over 0.3. It also contains one bugfix to the date validation, submitted by Shelby Munsch.

killerturtleEnable auto login into SLIM

One of the things that annoyed me was having to enter my login and password at every boot. I use SLIM. Fortunately SLIM is very easy to setup to autologin a specific user.

Here’s how… :

To make SLiM automatically login as a specified user (without having to type a password) the following lines in /etc/slim.conf should be changed.

# default_user        simone

Uncomment this line, and change “simone” to the user to be logged into automatically.

# auto_login          no

Uncomment this line and change the ‘no’ to ‘yes’. This enables the auto login feature.

Good luck!

Source: Arch Wiki pages

ArchLinux.meImport blogs into Archlinux.me

If you have posts or comments in another system, ArchLinux.me can import those into this site.

        Blogger     Import posts, comments, and users from a Blogger blog.
        Blogroll     Import links in OPML format.
        Categories and Tags Converter     Convert existing categories to tags or tags to categories, selectively.
        LiveJournal     Import posts from LiveJournal using their API.
        Movable Type and TypePad     Import posts and comments from a Movable Type or TypePad blog.
        RSS     Import posts from an RSS feed.
        WordPress     Import posts, pages, comments, custom fields, categories, and tags from a WordPress export file.

Admin Console > Tools > Import
Happy Blogging :)

Crouse – UID ZeroTIP: Ever get those strange characters in your console ?

Ever get those strange looking little buggers in your console after installing Arch and firing up the terminal ?
Something like this –
[crouse@archie ~]$ pstree
init─┬─6*[agetty]
├─crond
├─httpd───11*[httpd]
├─mysqld_safe───mysqld───9*[{mysqld}]
├─sshd─┬─sshd───sshd───bash───su───bash
│ └─sshd───sshd───bash───pstree
├─syslog-ng───syslog-ng
├─udevd───udevd
└─vmtoolsd

Simply add the following to your .bashrc and close your terminal window and open it up again, or source the .bashrc file again.
export LC_ALL=C

[crouse@archie ~]$ pstree
init-+-6*[agetty]
|-crond
|-httpd---11*[httpd]
|-mysqld_safe---mysqld---9*[{mysqld}]
|-sshd-+-sshd---sshd---bash---su---bash
| `-sshd---sshd---bash---pstree
|-syslog-ng---syslog-ng
|-udevd---udevd
`-vmtoolsd
[crouse@archie ~]$

killerturtleHow to setup OpenSSH on Arch Linux

I thought it would be nice if I could connect to Arch Linux through my Imac. Well OpenSSH is the way to do this fairy easy.
Here’s what I did to make the magic happen:

1. Install OpenSSH
sudo pacman -S openssh

2. To let other people ssh to your machine you need to adjust /etc/hosts.allow, add the following:
# let everyone connect to you (this is what I use, it maybe a security risk when one is a lot on a public internet connection)
sshd: ALL

# OR you can restrict it to a certain ip
# sshd: 192.168.0.1

# OR restrict for an IP range
# sshd: 10.0.0.0/255.255.255.0

# OR restrict for an IP match
# sshd: 192.168.1.

3. Optional, add sshd to the “DAEMONS” section of your /etc/rc.conf: DAEMONS=(... ... sshd ... ...) 4.Dont forget to restart the daemon (as root):

# /etc/rc.d/sshd restart

That’s it! Now you should be possible to SSH into your Arch box through a client with the following commond (On OS X that is…)
ssh -l [username] [ip-adress]

Good Luck!!!

Source: Arch Linux ArchWiki pages: https://wiki.archlinux.org/index.php/SSH

Crouse – UID ZeroGetting a listing of blogs on Archlinux.me

An easy way to get a listing of all the current blogs in the system.

[crouse@archie ~]$ cat archme.sh
#!/bin/bash
dbase=`mysql -u USERNAME -pPASSWORD -e"use wordpress; select path from wp_blogs;"`
for data in $dbase ;
do
echo "http://archlinux.me${data}"
done
[crouse@archie ~]$ ./archme.sh  | grep -v http://archlinux.mepath | sort
http://archlinux.me/
http://archlinux.me/anikom15/
http://archlinux.me/anubis2591/
http://archlinux.me/aymara/
http://archlinux.me/bionicapple/
http://archlinux.me/brain0/
http://archlinux.me/crouse/
http://archlinux.me/cyrusm/
http://archlinux.me/dickturpin/
http://archlinux.me/drcouzelis/
http://archlinux.me/dusty/
http://archlinux.me/edgar/
http://archlinux.me/emallson/
http://archlinux.me/fallenwizard/
http://archlinux.me/gnuisancev3/
http://archlinux.me/hatten/
http://archlinux.me/heleos/
http://archlinux.me/itsbrad212/
http://archlinux.me/jada/
http://archlinux.me/jbsnake/
http://archlinux.me/jdarnold/
http://archlinux.me/jimi/
http://archlinux.me/jp/
http://archlinux.me/kaptenen/
http://archlinux.me/kcirick/
http://archlinux.me/killerturtle/
http://archlinux.me/kittykatt/
http://archlinux.me/lordmetroid/
http://archlinux.me/msx/
http://archlinux.me/nblock/
http://archlinux.me/neonskull/
http://archlinux.me/panuh/
http://archlinux.me/peasantoid/
http://archlinux.me/platinummonkey/
http://archlinux.me/procyon/
http://archlinux.me/requiem/
http://archlinux.me/ronald/
http://archlinux.me/shadowtracer/
http://archlinux.me/shemz/
http://archlinux.me/staerseus/
http://archlinux.me/sudobash/
http://archlinux.me/tajidinabd/
http://archlinux.me/theisz/
http://archlinux.me/theringmaster/
http://archlinux.me/usedtire/
http://archlinux.me/wonder/

msxHello world!

Welcome to Arch Linux Blog. This is your first post. Edit or delete it, then start blogging!

Yeah, this is my first post so the first thing I want to say is: Thank you Crouse, you rulez!! =)

killerturtleArch Newbie sharing experiences as time goes on

Well, be gentile here with me please…This is my first post ever on a blog :)

I recently started out using Arch Linux.  Coming from Ubuntu I have some experience with the CLS but not that much. Reasons for using Arch for me are speed, flexibility, VERY well documented, good forums, and it runs very smooth on my old Dell C640 laptop.

I’ll be sharing my experiences here, as I hope to make some progress during my time using Arch.

Specs of the machinery are…:

Dell C640

Pentium IV 2.0 Mhz (wooohooo!)

512 MB RAM DDRI

1024 * 768 screen

1 USB I port

Crouse – UID ZeroCompleted the Server Move

Finally completed the server move.

All blogs have been moved that were in use.
Now everything is running on wordpress 3.x multisite enabled.

ArchLinux.meServer Move Completed !

After several hours of work, the server move is complete.

All the blogs were moved successfully, at least the ones that had content ;) I haven’t added everyone back into the new system yet, only those that had actually used their blog.

Everyone probably received an email with a new login password, you will need to use that to login to your blog, the old password will not work now.

If you wanted a blog, and yours didn’t get moved, let me know.
Post in this thread on the archlinux forums:

Title: ArchLinux Blogs
Get a better browser!

Happy Blogging

nblockHello world!

Welcome to Arch Linux Blog. This is your first post. Edit or delete it, then start blogging!

gnuisancev3Hello world!

Welcome to Arch Linux Blog. This is your first post. Edit or delete it, then start blogging!

jadaHello world!

Welcome to Arch Linux Blog. This is your first post. Edit or delete it, then start blogging!

anikom15GNOME 3 Gets Too Close for Comfort

The first thing the GNOME 3 website tells me is

made of easy

O SquirrelFish! Not only does it make no sense gramatically, it’s also in lowercase! The next thing I see is: SIMPLY BEAUTIFUL. What? This is a computer program, not a woman! Then I see “We have provided several fast and convenient ways to access the activities view, including the activities keyboard key (often known as the Windows key) and the activities hot corner.” Why are we rebranding the Windows key? It’s the Windows key, Microsoft invented it so they’re entitled to call it what they want and we shan’t call it anything else. Hell, I never use it and it’s not on all keyboards so why are we utilizing it all of sudden? Lastly there’s my favorite line of the whole website, “You’ll love this feature if you’re a user who likes things to happen fast.” Right, because lots of pointless animations will really speed things up. By the way GNOME developers (a.k.a. cultists), every user likes things to happen fast. That’s why they pay for broadband.

What the website fails to tell me is how they actually made GNOME any better. From what I see, they just copied Snapple and made it more bloated. The only thing that looked interesting was “REDESIGNED SYSTEM SETTINGS” which, if we’re lucky, means no more GConf, but it probably means “We put even more ‘advanced settings’ in GConf.”

Okay kids, so I haven’t actually used the software, but I don’t care because their website is ugly. Last I checked this thing is due in March (but is alpha still … skipping QA for a DE, great idea!). That means I have less than 2 months to either

  • get a new computer
  • go MacGyver and use twm or something  minimal
  • send DDOS attacks to the GNOME developers (a.k.a. cultists)

I think I’ll go with the latter.

In all seriousness, if I can’t get GNOME 3 to work at all, I’ll start a fork.

I hate you, GNOME 3. Go die in a hole.

ArchLinux.meCurrently working on new Archlinux.me site

Work is in progress, please be patient :)

#!/bin/bash
echo "This is a code tag test

# Check if requirements are installed.
clear
if [[ -z $( type -p sqlite3 ) ]]; then echo -e "REQUIRED: sqlite3 -- NOT INSTALLED !";exit ;fi

Created with

#!/bin/bash
echo "This is a code tag test

# Check if requirements are installed.
clear
if [[ -z $( type -p sqlite3 ) ]]; then echo -e "REQUIRED: sqlite3 -- NOT INSTALLED !";exit ;fi

drcouzelisWhat I do in Haiku

This is a growing list of things I do in the Haiku operating system. The purpose of this list is to have an easy reference when people ask, “So, what can you do in Haiku?”.

Also, this is not a list of possible examples of what I could do in Haiku. Instead, it’s specific things I’ve done while sitting down and working with my computer.

  • Update my tech blog. (WordPress, the one you’re currently reading)
  • Browse the Internet with WebPositive.
  • Use Gmail.
  • Use Facebook.
  • Chat with friends on Google Chat, Facebook Chat, and MSN with Caya.
  • Type in Japanese.
  • Download and watch a video using the Transmission bittorrent client.
  • Erase a CD-RW.
  • Download the latest nightly image of Haiku and burn it to a CD.
  • Watch and listen to the lecture video (M4V) from my graduate course.
  • Use SSH to login to my school to work on a graduate lab.
  • Read and write files to my Linux EXT3 drive.
  • Listen to a playlist of my MP3 music files.
  • Video game development using the PE “Programmer’s Editor”, GCC, and the Allegro Game Library.
  • Version control for my software using SourceForge and git.
  • Enjoy the screensavers. This may seem like a small thing, but I believe it’s important. Haiki has at least two screensavers that I think are really nice, namely “Butterfly” and “Icons”.
  • Use multiple desktops to make my workflow easier.
  • Take a screenshot using the Print Screen key and the Screenshot application.
  • Edit an image in WonderBrush.
  • View PDF files using BePDF.

Screenshots

Desktop 1: Programming (PE, Terminal); Desktop 2: Internet (WebPositive, Caya); Desktop 3: Music (MediaPlayer); Desktop 4: Document (StyledEdit)

<todo>

kcirickMacbook Fn hotkeys with DWM

Every since I started using DWM (I suspect I will post about this later), I’ve been looking for ways to minimize dependence on external programs, such as dmenu or conky. Getting rid of pommed is another thing, because I don’t need many of the functionalities that pommed have. All I need is to map a couple of function keys to useful applications. Here I will just give an example on how to map the previous, next, and play/pause button on macbooks (F7, F9, and F8 respectively). To do this in DWM, you need to edit config.h as such:

#include &lt;X11/XF86keysym.h&gt;
 
static const char *mpdprev[] = {"ncmpcpp", "prev", NULL };
static const char *mpdtoggle[] = {"ncmpcpp", "toggle", NULL };
static const char *mpdnext[] = {"ncmpcpp", "next", NULL };
 
static Key keys[] = {
   ...
   { 0,     XF86XK_AudioPrev,          spawn, {.v = mpdprev } },
   { 0,     XF86XK_AudioPlay,          spawn, {.v = mpdtoggle } },
   { 0,     XF86XK_AudioNext,          spawn, {.v = mpdnext } },
}

Using this method, I can now use function keys to brighten/darken LCD screen, control MPD, turn volume up/down, and eject cd’s!

staerseusLast.fm vs. Time synchronization

Yesterday I got to a strange situation with Last.fm. Marking songs as loved worked well, scrobbling not. Firstly I thought that I need to install some package, but it didn’t help. So I deleted .kde4/share/apps/amarok, but nothing changed.

Today I turned on the official Last.fm client for GNU/Linux which finally told me where the problem lays – time synchronization. I had a wrong date setup in my computer. OMG… Nor Amarok, nor VLC player told me…

I will probably write a feature suggestion to the devs. And I will mention it in Archlinux wiki.

kaptenenFirefox del 2

Det har hänt mycket på webbläsarfronten under det senaste året. Jag har testat uzbl, surf och jumanji, bristen med de tre nämnda är att de alla är webkitbaserade vilket resulterar i att de kan ha samma brister, som att spara lösenord. Jag har dock kvar jumanji som används ibland (när jag vill kolla på streamad hockey samtidigt som jag surfar med Firefox exempelvis). Jag har dessutom börjat använda Firefox-pgo-beta vilket känns stabilt. Nåväl, här kommer en liten uppdatering vad gäller Fx, de tillägg som används är följande:

Adblock plus
Adblock plus Element Hiding Helper
BetterPrivacy
Ghostery
Greasemonkey nightly
Noscript
Pentadactyl hg

Tillägg för Pentadactyl:
buftabs.js – Hanterar flikar på ett mer minimalistiskt sätt.
delicious.js – För att lägga till bokmärken smidigt.
flashblock.js – Ersätter tillägget till Firefox
tinymenu.js – Ersätter tillägget till Firefox

Userscripts:
Autopagerize – Laddar nästa sida, dessvärre det enda som funkar till betan av de jag använder.

Värt att notera är att en del kommandon kan behöva ändras vad gäller tinymenu och delicious, men det blir man medveten om när man startar Firefox. Tillägget Stylish har jag tagit bort, istället använder jag mig utav Pentadactyl för att hantera CSS samt userChrome.css.

Dusty's Diverse DomainPrivacy vs Freedom of Speech: Wikileaks

The Pirate Party of Canada has asked it’s members to vote on its stance towards the Wikileaks discussion. In most cases, the PPoC requests its members to have their own opinion, and, if ever elected, to represent their constituents before representing the party. The PPoC only has a unified stance on matters of copyright law, privacy, and free speech. The Wikileaks issue definitely falls under this category, and the party therefore needs to make a collective decision. Here, I am publishing my personal stance on the issue, regardless of the decision they make.

Every human being should have a right to privacy. If we wish to keep any detail about ourselves secret, we should have the right to do so. Legal or illegal, moral or immoral, if we don’t want some piece of data to be public knowledge, the right to privacy is paramount.

We wave this right as soon as we tell anyone our secret. Whether it is a family member, a close friend, a stranger, or everyone on Facebook, the secret is no longer ours to keep. By telling the person that secret, we have given them the right to maintain the secret, or to pass it on or publish it however they deem fit. We can request that they keep the secret, but we cannot demand it. However, that person still has the same right to privacy that we originally had. If only two of us know the secret, we both have the right to protect that secret. No-one should be able to forcibly take that secret from us without our consent.

Once a sufficient number of people knows the secret, the probability that their collective privacy will be greater than the right to gossip approaches zero. “Private knowledge” vs “public knowledge” is not a binary distinction. One person knowing our secret does not make the secret “public.” However, it means that we no longer have the soul ability to keep it private.

The other side of the coin is the responsibility to protect individual privacy. Many professional and government organizations have access to individual data about us that we may want to keep secret. Our doctors, nurses, and medical staff, our accountants and lawyers, our banks, tax agencies, and passport authorities, our driver’s license, health care, and motor vehicle registries all have access to data that they require, but we have the right to protect. They are responsible for protecting that individual data on our behalf. If they fail, data becomes public that should not be public.

So far, I’ve been talking about individual privacy. Privacy does not apply to corporations or governments. They should be held accountable to the individuals in the world, they should be required to operate transparently and openly. They are responsible to maintain the privacy of their employees, members, clients, and customers, but have no right to privacy as a single corporate entity.

Once data is made public, the right to publish that data trumps the right to privacy. This is freedom of speech. Any individual or organization who has access to data has the right to publish the data. The right to free speech does not trump the right to privacy, however, once privacy has been given up, the right to free speech is stronger.

The Wikileaks fiasco violates all of these principles. The private data of individuals was compromised. Government organizations were not operating transparently. Government organizations failed in their responsibility to protect the private data of individuals in their care. Freedom of speech was violated when both governments and corporate entities that should have been completely disinterested oppressed the publisher of the data.

I’d like to emphasize this point: Government organizations failed in their responsibility to protect the private data of individuals in their care. The failure rests squarely on the shoulders of the governments in question. Rather than attacking one (of many) publisher of the information, the governing body is obligated to fix their internal processes. Further, the corporate entities that are attacking Wikileaks should be focusing on this real culprit, not the publisher.

One less relevant note: it is true that the right to freedom of speech can be applied immorally. Consider the celebrity publications of today: the paparazzi are, by most accounts, disgustingly immoral. They violate the right to individual privacy (such violation should be illegal), but have the right to publish information once obtained. Wikileaks may (arguably) be immoral, but they are not so immoral as the paparrazzi that killed and photographed Princess Diana. Why is Wikileaks being persecuted while celebrity gossip rags are running free?

sudobashPerl > Useful one-liners

Remove string from file

perl -ni -e 'print unless /pattern/' /path/to/filename

Replace string with string

perl -p -i -e 's/PATTERN/NEW_ENTRY/g' /path/to/filename

Insert string where delimeter is found
This will replace the original delimiter with the new entry and then add the delimiter so you can use it again in the future.

perl -p -i -e 's/DELIMETER/NEW_ENTRY\n\nDELIMETER/g' /path/to/filename

Dusty's Diverse DomainDjango: don’t use distinct and order_by across relations

I needed to get a list of project objects that had Time objects attached to them that had been updated by a specific user. I wanted the list to be ordered by the most recently updated Time object, and importantly, I wanted the list of project objects to be distinct (since there are multiple time objects attached to any one project).

I was trying to make the following query work in django:

Project.objects.filter(time__user=user).distinct().order_by('-time__date')

As the note here describes, this particular combination (distinct and order_by on a related field) doesn’t work so well. The related table (Time, in this case) columns are being added to the query’s SELECT clause, giving me multiple copies of projects that I wanted to be distinct.

There is a Django feature request to support named fields in the call to distinct, but it is not incorporated into trunk yet, mostly due to database backend support.

After some searching and pondering, I was able to get the same list of projects using aggregates instead:

Project.objects.filter(time__user=user).annotate(
                models.Max("time__date")).order_by('-time__date__max')

This solution to the problem doesn’t seem to be suggested often, so I thought I’d take the time to mention it.

kaptenenJätteavancerat bashskript

Jag har inte riktigt haft något större behov utav att sitta mig framför Vim och göra ett skript tidigare, men då jag egentligen måste plugga och alltid har stört mig på en sak med Awesome och dess meny (som fungerar som en sådan Fluxbox,bblean, openbox etc använder sig utav) tänkte jag att det nu var ett gyllene tillfälle att fixa det, problemet har varit att få Spotify (som nästan aldrig använts, men ändå) att funka. Miranda IM har jag aldrig haft problem med att få in i menyn men desto svårare har det alltså varit med Spotify. Tills nu. Titta och lär för 1337 kaptenen har varit i farten:

>>> cat bin/pspotify [~]
#! /bin/bash

wine ~/.wine/dosdevices/c:/Program\ Files/Spotify/spotify.exe

Sist men inte minst, följande i rc.lua:
{ “Spotify”, “pspotify” },

Nej, jag var inte seriöst med att det var avancerat. Däremot så löste sig problemet.

sudobashBASH > 'date' command

Get a date in the past:

date +'%Y-%m-%d' -d  "1 day ago"
2010-11-30

Dick TurbinThe partys over

arch-demiseYep the party’s over for archlinux.org.uk we tried we really did but the interest was not there. I think there was a number of reasons obviously the main one being that there is already an English speaking location www.archlinux.org it was a nice idea to have a UK based home but as I say why bother when you can join the main site? Its a different matter if you’re French or German although most Europeans can speak English to be fair.

We did manage to get into double figures for membership and had something like 30 odd posts but it was just not enough. The site was very kindly hosted by my friend Dave in the United States he has some hardware plans and asked me if I wanted to continue with the site which is totally my responsibility but  I made the decision to pull the plug there is a cost element to the site hosting and given the almost stagnant state of the forum I could not let good money run after bad.

I’d like to thank everyone who signed up and gave some contributions also thanks to Dave for hosting it and putting up with my requests for housekeeping tasks that was required now and again. The domain is not dead and I/We may well do something with it next year, there is still the IRC channel Freenode #archlinux.org.uk but only myself and a couple of others ever seem to turn up in there.

Anyway it was a good learning experience and I enjoyed the last 12 Months so once again “So long and thanks for all the fish”.

Dusty's Diverse DomainRendering Django models to JSON

I recently discussed a simple template tag that allows rendering “raw” jquery templates inside a Django template, even though the syntax overlaps. A commenter asked for a Pypi package. It was such a simple template tag that I didn’t want to maintain a separate package for it, but it turns out, this tag fits in very well with the next step in the project. The short story is that the tag is now available on Pypi.

The tag is distributed with a project I called Djason (named for Django, JSON, and former Arch Linux Developer, Jason Chu, and because djson was already taken). Djason’s primary purpose is to serialize Django models to a json client format that is friendly to client libraries, especially to jquery-tmpl. It is essentially just a fork of Django Full Serializers with a patch applied, and some minor edits to simplify the output json. I install it as a Django serializer in settings.py using:

SERIALIZATION_MODULES = {
    'djason': 'djason.json'
}

And in my code:

from django.core.serializers import serialize

    content = serialize("djason", project,
            relations=["location_set", "company", "project_type"])
    return HttpResponse(content)

I’ll probably be adding some additional code to this package to fit in with my still cloudy ideas about the proper separation between client and server code. I’ll also likely be rewriting portions of the forked project to appease my personal sense of style.

cyrusmRobot update

I finally have my final pcb design ready for prototyping. I haven’t had too much free time to work on this project as I’ve been busy with work and school. The solution to the power problem I had discussed previously turned out to be caused by my lack of including decoupling capacitors at the outputs of the motor driver, which was causing a temporary loss of voltage to the micro controller. The circuit seems to run great off of 4xAA batteries without any problems. In my redesign, I’ve had to make a couple of sacrifices as I couldn’t find a good way to break out 2 of the io ports on the uC, but I figure I probably won’t need those anyway, and I’ve made up for it by including breakout ports for all of the pins on the xbee module that I will eventually be installing. So for my final design, I have the ATMega328 micro driving 2 motors through a SN754410 dual H-bridge motor controller, serial communication over RS-232 with a max232 chip handling all of the voltage levels, and an Xbee wireless module to provide wireless serial communication and about a million other features. I was able to break out 14 I/O pins, so I should be able to rapidly prototype added functionality at a later date such as sensors and other outputs. When it’s all said and done, I will have spent about $102US on this project including shipping costs, making this my most complex, expensive and fulfilling project to date.

Dusty's Diverse DomainDjango and jquery.tmpl

Lately, I’ve been finding Django increasingly inappropriate for the web applications I develop. I have several complaints: the forms library doesn’t extend well to ajax requests, any extensive customization to the admin requires obtuse inspection of the admin source code, many admin customizations simply aren’t possible, the “reusable apps” philosophy has added a layer of complexity to a lot of things that really should not be there, there are no obvious best practices for ajax support.

In spite of all this Django is still better than other frameworks (Python or not) that I have investigated or tested. I’ve considered writing my own web framework, but I wouldn’t maintain interest in it long enough to get it off the ground. So I’m letting my complaints bounce around in the back of my mind with the hopes that I can improve Django so that it continues to work for me as a platform.

I’m currently trying to come up with a better system for ajax requests. I have nothing concrete in mind, but I’ve started with the premise that ajax requests should never return rendered html, but should return only json (hence my issue with the django forms library). With that in mind, I need a templating library for json data. JQuery is a must, and the officially supported JQuery templating library is jquery.tmpl http://api.jquery.com/category/plugins/templates/

The problem with jquery.tmpl is that it uses django-like syntax. The following is a valid block that may be rendered in a jquery.tmpl page:

<script id="project_tmpl" type="text/x-jquery-tmpl">
    {{each projects}}<li>${$value}</li>{{/each}}
</script>

If you try to include this in a django template, the {{ and }} tags will be replaced with (probably) empty variables. Django has {% templatetag %} to render these individual items, but what we really need is a way to tell the django templating system to leave complete sections of code alone. So I wrote the jqtmpl template tag. It allows us to wrap code in a block that tells Django not to render that block as template code. So the above would show up in a Django template as follows:

<script id="project_tmpl" type="text/x-jquery-tmpl">
{% jqtmpl %}
    {{each projects}}<li>${$value}</li>{{/each}}
{% endjqtmpl %}
</script>

Here’s the template tag:

from django.template import Library, TextNode, TOKEN_BLOCK, TOKEN_VAR
 
register = Library()
 
@register.tag
def jqtmpl(parser, token):
    nodes = []
    t = parser.next_token()
    while not (t.token_type == TOKEN_BLOCK and t.contents == "endjqtmpl"):
        if t.token_type == TOKEN_BLOCK:
            nodes.extend(["{%", t.contents, "%}"])
        elif t.token_type == TOKEN_VAR:
            nodes.extend(["{{", t.contents, "}}"])
        else:
            nodes.append(t.contents)
 
        t = parser.next_token()
 
    return TextNode(''.join(nodes))

This doesn’t handle Django’s {# comments #}, as token.contents doesn’t return a valid value for comment items. As far as I know, you wouldn’t use the comment construct inside a jquery.tmpl template anyway, so it’s still functional.

Next on my list is a better forms validation library to suit my theory that validation should be done client side. I’ve got a server-side system in mind that returns json responses, and does not return user-facing error messages, since those should have been caught client side. With these tools, and hopes for Grappelli to eventually create a decent admin, Django may continue to serve me.

sudobashBASH > 'sed' command examples.

Another list that will grow as I need it…

Remove blank lines from output

sed '/^$/d'

Replace data with new data

sed 's/DATA/NEWDATA/g'

drcouzelisMy new love: Python + wxPython

I have a new love. It’s Python with wxWidgets. Add xwGlade, and I think I’ve found programming nirvana.

I’ve been programming in Python for a couple of weeks now. I find it very easy to learn, writing code is super fast, I don’t have to waste my time writing things that the language already understands, it’s well documented, and it’s pretty to look at and read. That also happens to be pretty much everything I’d read about Python. As an interpreted language, I’d also heard that Python is slower that C, but I certainly haven’t noticed it being slow.

I also started using wxPython about two weeks ago. It was easy to learn and make a GUI with, and the GUI I made looks great on both Linux and Windows.

wxGlade was dead simple to learn. I was able to throw together a GUI really quickly and start adding functionality to it.

Here are some of my favorite sites for learning wxPython:

I have very little time to work on personal programming projects, but working with Python + wxPython + wxGlade has been extremely fast and fun.

sudobashBASH > 'find' examples

This will be a growing list as I find commands I need…

Find files of .ext that are 0 bytes and rm them.

find . -name "*.ext" -size 0 -exec rm {} \;

Crouse – UID ZeroVI RULES

First off……. thank god for this guy…….

http://www.ozerov.de/bigdump.php

That led me to use this line on the sql dumped file opened up in VI.

:%s/INSERT INTO/INSERT IGNORE INTO/g

–on a 4.4 million line file — vi rules

sudobashBASH > Variable checking

Check the variable is a whole number

if [ $VARIABLE -eq $VARIABLE 2> /dev/null ]; then
echo $VARIABLE is a number
else
echo $VARIABLE is not a number
fi

Check the variable is not empty

if [ $VARIABLE != "" ] ; then
 <code_to_execute>
else
 echo "Error: VARIABLE is empty"
fi

or as provided by solstice:

if [ -z "$VARIABLE" ] ; then
 echo “VARIABLE is empty”
else
 echo “VARIABLE is not empty”
fi

or -n to test if it”s not null

if [ -n "$VARIABLE" ] ; then
 echo “VARIABLE is not empty”
else
 echo “VARIABLE is empty”
fi

Check the variable is alpha only

if [[ "$VARIABLE" =~ ^[a-zA-Z]+$ ]] ; then
echo "Variable contains letters only"
else
echo "Error"
fi

sudobashosTicket > Send reply to alternate/additional email address(es).

I’m setting up another install of osTickets for another department (that needs a whole other server). In the process it was requested that they be able to change who the response address is incase they need to send it along to someone else or in order to include multiple addresses. The following is a simple MOD I came up with that seems to work as desired. As always please let me know if you have any questions or notice any problems.
This was setup on 1.6RC5 but I believe it should work for 1.6ST also – please let me know otherwise.

include/class.ticket.php
Inside the postResponse function, just before the $sql variable add the following:

$send_to = $_POST['send_to'];
$SENT = "Sent to: $send_to\n\n";
$response = "$SENT$response";

Now find the following (still inside postResponse):

$body = str_replace('%response',$response,$body);

And below that line add the following line:

$body = str_replace("$SENT",'',$body);

At the bottom of the postResponse function. Find the following code and remove it:

$email->send($this->getEmail(),$subj,$body,$file);

Now replace it with:

if($email && $email->getId()) {
// Just in case they wiped out the send address we still need to make sure it gets somewhere.
if($_POST['send_to']){
$email->send($_POST['send_to'],$subj,$body,$file);
}else{
$email->send($this->getEmail(),$subj,$body,$file);
}

Ok, thats the functionality behind it all, now we just need to add the ability to use it…

include/staff/viewticket.inc.php
Search for the following:

<input type="hidden" name="a" value="reply">

Now just below that line add the following code:

Send to:<input type="text" name="send_to" value="<?=$ticket->getEmail()?>">

The following picture shows the “Send To:” box that allows for changing or adding to the email address to send to. This is automatically filled in with the original email address of the ticket submitter. You can send to multiple email addresses by separating the emails with a comma (bob@example.com, bob2@example.com). Its also user proof… if someone wipes out the email address and doesn’t enter in anything then it will default to the original email address.

Well thats very nice but if we don’t note who we sent it to then we could be getting very confused. Please let us know where we sent what responses to. This note is added to the response database entry but is stripped before emailing the response to the customer.

Dusty's Diverse DomainAnother release of Prickle, the stay out of your way time tracker

I just released version 0.3 of Prickle, a time tracking tool I’ve mentioned before. Prickle is a simple stay-out-of-your-way time tracking program that I find very useful for my day-to-day work as a consultant. In originally developing it, I modeled it after Freckle. With version 0.3, I consider Prickle to be more usable and more powerful than Freckle for my specific purposes. It may be useful for you as well.

The major improvement in this release is the ability to have multiple types of work for a given project. Each type is represented in the invoice by a different line-item, and can optionally have a different rate. So if you bill admin work at a different rate than development, prickle can handle it on one invoice. This required adding one more field to the log it form, which means one extra keypress for logging line items, but the new field is perfectly comfortable staying blank. It also autocompletes the types for a given project, so it is still stay-out-of-your way convenient.

The other major change is the ability to edit timesheet rows. I find this useful when I occasionally bill a timesheet for the wrong date or project. This is done using inline editing and is very ajaxy. At a user request, I’ve also changed the timesheet view to use hours and minutes rather than decimal representation.

Prickle is now working pretty much as I want it. I may add some reportlab pdf generation at some point so I can automatically e-mail pdf invoices, and a little extra customizability may be in order. The entire interface really wants some design love, but I am really hoping another user will jump up and do that. I’m not what you’d call a design guru. But overall, I think the current feature set is what I need, and I believe it may be useful for a few other people in the consulting field as well.

kaptenenI-landsproblem, eller?

Det funkar inte längre. Att jag befinner mig i den situation som jag gör har två förklarliga anledningar, dels de studier som visar att deprimerande har svårare att koncentrera sig på skolan och får ångest över den och att jag egentligen måste ha glasögon. När jag var mindre så använde jag ofta glasögon, något jag senare alltså slutade med. Den främst anledningen var nog att jag såg otroligt ful ut i dem. Jag ska snarast gå och titta till min syn och beroende på vad som då kommer fram eventuellt skaffa linser. Jag klarar inte av den ständigt påtagliga huvudverken då den gör att jag inte orkar skriva uppsatser eller kunna koncentrera mig på att läsa studielitteratur eller faktaböcker eller whatever. Att jag har svårt att koncentrera mig på studierna gör i sin tur att ångesten ökar, en dålig spiral som jag nu måste bryta, för min egen skull.

Så, en uppdatering till bloggen dessutom. Jag har nog en del intressanta saker att framföra här, många inlägg sitter och väntar på att bli publicerade men först måste orken komma.

cyrusmquick robot update

just ran my first series of tests on the control unit and motors. Learned a lot!!! the 2 motors together running at full speed with no load draw a current of over 780 mA.
this means that at no load, I’m using 3.9W of power. (this also lead to my discovery of NEVER touch the LM7805 voltage regulator, and that I need to invest in a heat sink)
I also learned that a 9V battery does not provide nearly enough current, even for bread boarding purposes, and running the motor controller IC off of one powersupply did not give the desired results, it seems the motor controller wasn’t getting the power it needed to drive the motors and the uC. I breadboarded it up with the 2 voltage sources (one for the uC, one for the motors) as the datasheet for the SN754410 suggested (datasheets don’t lie!) and things worked out magnificently. I’ve still got to do some speed tests on each motor so I can nail down the rate and timing to get accurate turns, but I’ve made definite progress. I’m still working to figure out my battery issue before I can finally finalize a design. right now it’s looking like this project is going to work best with the two power supply system I described above, but I’m going to do some research and see if I can come up with something a little better…

I should have video of some more of my tests coming tommorow.

cyrusmSetting up Breadboard and Initial tests for robot.

Here’s my current progress on the robot project. First of all, I managed to get the chassis, gear box, and tank tread assembly put together correctly on my first try. This took a little bit of guess work as the directions for assembly are primarily in Japanese. I soldered on some really long leads to each motor for testing purposes(so they can reach the bread board).
Chassis
Chassis2

I’ve breadboarded the important parts of the main control board. I’ve got the ATMega328P at the middle clocked to 16MHz, with a motor control subcircuit using the SN754410 motor controller as an H-Bridge voltage controlled current source for the motors. and a MAX232 subcircuit for serial communication with the computer
(very handy for debugging and issuing test commands to the uC)

here’s a link to the Schematic
This schematic is a working rough draft, I’m still refining it, but it gives a general idea of what I’m working with at least.

BreadBoard

This weekend I will have some code written up so i can perform a series of tests on the circuitry, mostly what I’m concerned with is the current draw from each of the motors. This is important because I still haven’t picked a battery configuration for the final unit, but I’m thinking 4AA batteries would be the best balance of voltage, current, and size/weight. I also plan on getting more data on motor speed in the forward and reverse directions so that I can make some calculations for the software in regards to turning the unit.

All in all, I’ve made good progress over the last day or so.

sudobashWindows > Move your offscreen windows back on screen

This morning I was majorly annoyed when a Gimp window was offscreen and there was not a damn thing I could figure out to do to finally be able to move it. The standard way to move a window back on screen is to right click on the taskbar item and select move and then use the arrows to move it back. However, since Gimp has these annoying ass multi-windows that wouldn’t work as all it wanted to move was the main window. After some frustrations and googling I finally found the following to work for me.

The window that was off screen was the “Toolbox” window. The top of it was completely off screen so there was no hope of right clicking it and getting into the menu to select move. Well fortunately some of the most annoying things have the simplest answer. All I needed to do was click on the toolbox anywhere so it was the window selected and then hit

Alt-Spacebar

From there I was in the menu and could mouse/arrow down to “move” and then use my arrows as normal to get the bastard back.

sudobashBASH > Connect to another user's console terminal using 'screen'

Recently, I was helping another Admin and I wanted to be able to share our screens but our IS department won’t allow for it. Being that we were working in a terminal session I decided to go this route instead.

Needed:
- Screen
- Local account on host computer/server for remote user

Install screen

sudo apt-get install screen

Set the screen binary (/usr/bin/screen) setuid root. By default, screen is installed with the setuid bit turned off, as this is a potential security hole.

sudo chmod +s /usr/bin/screen
sudo chmod 755 /var/run/screen

The host starts screen in a local xterm, using the command screen -S SessionName. The -S switch gives the session a name, which makes multiple screen sessions easier to manage.

screen -S screen-test

The remote user (remote_user) uses SSH to connect to the host computer (host_user).

ssh remote_user@server

The host (host_user) then has to allow multiuser access in the screen session via the command ^A :multiuser on (all ‘screen’ commands start with the screen escape sequence, ^A).

^A
:multiuser on

The host (host_user) must grant permission to the remote user (remote_user) to access the screen session using the command ^A :acladd user_name where user_name is the remote user’s login ID (remote_user).

^A
:acladd remote_user

The remote user can now connect to the hosts ‘screen’ session. The syntax to connect to another user’s screen session is screen -x host_user/sessionname.

screen -x host_user/screen-test

cyrusmScrew LED Matrices (for now), It's time to talk ROBOTS

So as I’m sure you’ve probably noticed by my previous entries on my blog, I am easily distracted by new fun things, and I’m heavily limited by my hobby budget (about $50/mo and it’s the first thing to get cut when my family needs money).  It’s been said before that time is money. For me, money is time!  I have plenty of time to invest in playing with all of the toys I buy, but since money is tight I sometimes have to make careful consideration in what toys I invest my money in.

So I was thinking. led matrixes are cool and all, but do I really want to invest my money in a new circuit that is only KIND OF COOL?  Heck no.  Thus I have back-burnered my blinky lights in lieu of something way more awesome.  A robot.

My plan with this robot is to focus on simplicity and flexibility in design.  Stage one is going to be building the wheels, transmission, and chassis since these are the base of the robot and probably the most significant parts.  For this I’ve chosen the following components from sparkfun.com

I went with Tamiya parts due to their flexible configuration and simple design.  I decided to go with the tank treads for several reasons including
  • increased surface area contact means more torque transfered to linear power.
  • duh, tank treads are super cool.

Here’s an example of what the chassis, wheels, and motor assembly should look like when completely assembled.

treads chassis and motor example

treads chassis and motor example

For the time being, I’m anxiously clicking the FedEx tracking link. but I should have more to post on this by this weekend when I get the parts.

For phase 2, I’m designing an all purpose control board for the robot. I’m going to put quite a bit of work and research into designing the control board before I get a prototype made because I really only want to do this once.  At the center of the control board will be the ATmega328P microcontroller (my favorite for innumerable reasons) clocked externally at 16MHz via a crystal oscillator and programmable via a 10 pin ICSP.  The board will also contain the power subsystem, which will provide busses at 5V and 3.3V (common power supply for most IC’s), An RS-232 UART subcircuit for debugging and communication with the PC, a breakout for an XBee wireless module(future planned addition), a buzzer, and breakout ports for all of the remaining usable pins.  You might notice that the control board contains no permanent I/O as far as sensors and displays are concerned.  I am trying to keep the main board as simple as possible, but with the ability to add on or remove additional devices as I see fit by designing them externally and interfacing them with the broken out pins on the micro.  This way I can easily add or change any peripherals and continuously learn new things using my robot as a base platform.

Crouse – UID Zerotest

ignore :)

sudobashMySQL > Epoch to Unix timestamp

SELECT from_unixtime(epochEntry) FROM table

sudobashBASH > Replace multiple spaces with single space

sed 's/\s+/ /g'

Footnotes