Posts Tagged ‘Fedora’
Building a touch-screen laboratory monitor with PyGTK
So I’m building this application to use in our lab at Clemson to keep tabs on all the sensors around the equipment. I’m not going to copy over the whole post here but for anybody who has an interest in following my coding endeavors can check out my post at http://ionsurfing.wordpress.com/2009/12/30/mockupsunusable-alpha-screenshots-for-tactile/. I’ve got some nice screenshots and explanations of where I’m going with the program. I think the biggest challenge will be finding a good way to deal with human interaction using an old-style touchscreen. Any and all suggestions on libraries to look into or thoughts on UI challenges are welcome. :)
By the way, thanks to Mairin for her Inkscape mockup class at FUDCon… I actually used it!
Reflections on Computers
Sometimes, you just have to sit back and wonder how computers are able to do the things they do. I’m at home in Charleston right now, but I have a Fedora 11 box sitting in my on-campus apartment back in Clemson. Right now, that old Dell Dimension 3000 is:
- Running an X server with at least 20 windows open that I never closed (and don’t feel the need to kill)
- Running an HTTP server
- Running mpd and icecast
- Streaming music via Icecast through an mp3 stream via a second http server through an ssh tunnel to my Arch Linux box here in Charleston
- Letting me control the music with ncmpc that I’m seeing under two layers of sshing
- Running 6 non-stop processor heavy perl scripts at a time for the past few days (this is what really boggles me).
How does a machine manage all this and still perform without noticeable lag?
I know it’s easily explainable if we start at the bottom and work our way up, but it still leaves me in awe occasionally. I mean, come on… there’s an external hard drive under my bed in Clemson. It’s spinning fast enough for some program to read data that can precisely emulate what The Decemberists sound like. All of that data is getting pushed through a USB cable and all of that is being magically mp3′d and pushed through an ethernet cable to a router to another router to another router and then out into the world where it ends up at my router and into my computer; all of that data is in an ssh tunnel, by the way. And even worse is that I’m not the only one using all of those cables and routers; there are millions of other users doing the same thing at the same time.
I don’t get it. I guess I still have a lot to learn.
Good for those engineers, yeah?
Bonjour, Lagrangian
Last year, I learned about the layman’s essence of quantum mechanics, and I wrote a post about it on this blog. This semester, my big topic in physics class has been the Lagrangian and Lagrangian Mechanics. So, like last time, I’m going to write a nice lengthy post about it because:
- It might help someone else who wants a basic introduction, and
- It will definitely help me sort it out in my head, seeing as how my exam is this Tuesday.
Recall: Kinetic and Potential Energy
You might remember in previous physics classes a discussion concerning kinetic and potential energy. Recall that for any conservative force, E = T + U, where E is the total energy of the system, T is the kinetic energy, and U is the potential energy (I’ll use these conventions for the rest of this post).
You also might remember that using conservation of energy made some problems much easier to solve compared to using Newtonian methods. Consider, for example, the point-particle baseball thrown directly up in an air-resistance free world; we can find the maximum height by recongizing that at its maximum height the ball has zero velocity relative to the ground. Thus it has zero kinetic energy (because T=(1/2)mv2) and so its potential energy U=mghmax is equal to the total energy of the system. As a consequence, we can find the ball’s maximum height by setting E = E, or, equivalently, Umax = Tmax.
mghmax = (1/2)mv02
hmax=2v02/g
Where v0 is the initial velocity of the thrown ball. Note that we could also find the initial velocity by knowing the final height….
Principle of Least Action
To derive the basics of Lagrangian mechanics, we need to understand the calculus of variations, which is a topic beyond the scope of a blog post (and certainly beyond the scope of barebones HTML formatting).
En anglais, the principle of least action says this: a body moving from point A to point B will take the path that minimizes required action. Calculus of variations teaches us how to minimize an action integral in the general case. Now we can apply that to physics.
The Lagrangian
The Lagrangian L (usually written as a script L) is defined as:
L = T – U
Aside. I think it’s also valid to define L = U – T since we’ll be setting derivatives of the same function equal to each other so that signs will be irrelevant.
Then we can use the Euler-Lagrange formula (a result of calculus of variations) to say that for each generalized coordinate (xi) in our configuration space:
dL/dxi = d/dt [ dL/dxi' ] (*)
If you have trouble reading that, just look up the Wikipedia article on Euler-Lagrange; I don’t feel like going through the trouble of LaTeX’ing on this not-yet-configured machine just to point out that the partial derivative of the Lagrangian with respect to the generalized coordinate xi equals (under the condition of minimizing the action integral) the time derivative of the partial derivative of the Lagrangian with respect to xi‘ (or xi dot, the derivative of xi with respect to time).
These mysterious generalized coordinates can be whatever you want them to be as long as they can fully describe the system you’re concerned with. With a simple pendulum, you might just have the angular coordinate phi, which can alone describe any state of the pendulum. With a pendulum on a spring, you might have phi and x, the length of the spring. With an Atwood machine, you might just have one coordinate again that describes the length of the rope on one side (which describes the entire system given an ideal rope).
The set of your generalized coordinates forms the basis of a configuration space in which every possible state of the system is in the set spanned by those coordinates… I think. We didn’t really cover that in class too much.
Equations of Motion
So anyway, now we have these equalities as defined by the equation (*), and each equality for some coordinate y should include y” (because we’ve taken a time derivative of y’). Now we can re-arrange these as second order differential equations! Hurray!
fin !
Recapping FUDCon, day -exp(pi*i)
Let’s recap what happened yesterday at FUDCon:
- We assumed spherical ponies of uniform density
- We had healthy lunches
- The sysadmins and developers actually got along at their panel
- <Insert lots of great talks here>
- Transcribed some talks
- The Fearless Leader spoke
- Dave & Busters = Food + Beer + Pool
We’ll have to see how well the hackfests can stand up to that. I’m looking forward to it. I think I’ll be attending the Fedora Insight hackfest at the very least. Still need to check the wiki to find out what else there is.
And if you missed any of yesterday’s talks, be sure to go to the schedule page to find the IRC transcripts. I’ve proudly written the one on education with OSS, the one on Inkscape, and the one on UI design (even though my internet cut out for a bit in the middle of that one).
Also, I’ve recieved a few comments (IRL) about my previously posted “spy” pictures. I want to let everyone know that I am not, in fact, taking casual pictures with my phone and calling them spy pictures because I feel sneaky using that little camera. In reality, I do have spy cameras setup at various strategically chosen locations around the hotel and campus so that I know exactly where everyone and everything is.
Always.
…
Protip: Don’t get black tea at the hotel. They don’t give you boiling water so it comes out poorly; the earl grey just tastes like bergamot oil with no tea.
FUDCon: 1320/Saturday
I attended Bert’s Installing Fedora session in block 1; I think it went pretty well, although I probably would have prefered a less technical and more end-user/hands-on approach, but that’s probably the User-Guide-”Writer” coming out in me.
BarCamp was fun too, and full of ponies…
And what lunch lacks in choice it makes up in the quaint cuteness of brown bags, along with some pretty tasty treats. I’ve arranged them here in golden sprial style.
FUDCon: 0835/Saturday
FUDCon’s here! I’m sitting in the lobby of the Hilton Garden Inn in Vaughn.
The busses come every 30 minutes, Seth tells me; I guess I’ll catch the 8:5x one (?x in {0..9}). I’ve taken some spy pictures with my phone of the lobby and such…
So apparently I need to go buy a bus ticket; will check in again… with more spy pictures.
Communicating with SPCI
Background Story/Flavor Text
So I’m working on getting this ammeter to interface with Linux system for the lab, and it turns out that this thing supports the Standard Commands for Programmable Instruments (SCPI). A few hours, Google searches, and Perl scripts after I started, I’d done what I would call a reasonable job of communicating with this device and pulling data from it.
So what is SPCI, and how does it work?
Connecting the Interface
SPCI is just a standard set of commands, not a defined interface. But it turns out that when you’re communicating with electronics SPCI is often used over serial connections like GPIB or RS-232. In my case, I was forced to use RS-232 because of hardware limitations.
Now, you can just read and write directly with the device handle. In my case using RS-232, I ended up discovering that
/dev/ttyS0
was right for me.
Commands
The entire set of commands is found in this documentation from the IVI foundation site. The commands are organized in a directory like structure. If I want to execute the command to ask how many errors messages are sitting in the buffer, for example, I’ll execute this:
:SYST:ERR:COUNT?
What this effectively seems to do is…
- Go to the “root” directory [:]
- Look in the SYST(em) folder [SYST]
- Look in the ERR(or) folder [:ERR]
- Execute the COUNT command [COUNT]
- Note that this is a query; i.e. returned data is expected [?]
Each command has as:
:SYSTEM:ERROR:COUNT? :System:Err:Count? Syst:ERROR:COUNT?
Note that you can vary capitalization without consequence, you can choose to ignore that prefixed colon, and you can even mix around when you use long and short forms.
Example
I used SCPI to communicate with a Keithley 6485 Picoammeter. I doubt seriously that many people reading this will ever need to repeat this task, but it’s all I have to present some examples.
To turn off the zero check on the picoammeter and take the current reading, we could execute these commands:
Syst:ZCh 0 Read?
Note that I could have used “OFF” in place of “0″; either is a legitimate boolean value for “false”. Meanwhile, a script running in the background that looks something like this:
#!/bin/bash cat /dev/ttyS0 >> datafile
Will magically receive a line of data from the machine that we can interpret with a simple Perl script.
How to: Making Windows Work Like It Should
Two days ago, I was trying to help my friend make his WinXP laptop connect to Clemson’s WPA2 Enterprise network. It knows how to do it (it’s done it many times before), but at that instant the computer just didn’t feel like cooperating. We tried several solutions, including rebooting (twice!) and re-entering all of the wireless settings. No success.

The Axe of Death, threatening to end the IBM Thinkpad if it didn't comply with our network-related requests.
Disgruntled, Mark (my friend) started to verbally assault the computer. Failing, he suggested a new approach: visually letting the computer know how frustrated I was. We opened up mspaint and I started to draw a laptop being hacked by a blood-stained battle axe. As I drew the woosh lines behind my axe – just so it was clear that the computer was about to be slaughtered – the innocent beige bubble popped up letting us know that, out of the blue, despite two minutes of sitting there after giving up trying to get an IP address, we had an excellent connection to tigernet (the wireless network).
We laughed. It was funny. What a coincidence, eh?
The next day (last night) the computer did it again. We opened the same bitmap we drew before… to no avail. This laptop knew what was going on. It knew it couldn’t actually be harmed by a bitmap image.
So I opened a command prompt and ran ‘format C:’. Before I could finish reading the warning line (Are you sure you want to do this? [y/n]), tigernet was connected.

The ultimate threat to the Windows machine, bringing an otherwise unruly computing device to its knees.
I have to commend Microsoft on the incredible user interaction they’ve instilled in their operating systems. Threatening to slaughter and then vaporize someone would probably make them do what you want, so I suppose this is replicating human interaction, right? Man, it’s a shame Fedora won’t respond to threats like that.
In other news, Mark installed Fedora after that incident last night. It connected instantly and hasn’t dropped the connection. No threatening bitmaps necessary.
In other news, my girlfriend tells me that her computer starting running much better in the past week as well. She also happened to be shopping for new netbooks online last weekend. Coincidence??



