PowerPython… or PythonPoint… or something

I’ve been meaning to update this for a fair while now as an uncharacteristically large amount of stuff has happened. Since exams finished I’ve managed to get a job at ECS working for two of my lecturers on two separate projects, which is pretty good because it means my work is varied. Both are IC design projects though, so there is a similar vein running through them.

One of my minor duties on this dual-job is to assemble slides from about twelve people into a large presentation, with cover slides for each speaker, every Friday for a progress meeting we all have. Naturally the first Friday I just did it by hand by importing each one in turn into PowerPoint. However it is a fairly tedious job, and to paraphrase a certain member of staff: why do something by hand when I have a powerful computer under the desk?

So I began to investigate automating the process.

Turns out that Python has an IMAP module in its standard library, which isn’t too surprising I suppose as the Python standard library is enormous. After some playing I managed to write a program that logged into my university email account and downloaded the appropriate PowerPoint attachments.

(continue reading…)


Twitter Me Xerces!

Following from the spirit of yesterdays post, little victories…

Yesterday I managed to download the front page of my website using libcurl. As good as that was as a learning experience, it wasn’t interesting or useful in the slightest. Today however, I decided to see if I could fetch my status updates from Twitter and display them in a program. So I had a look at the API documentation and it looks quite easy to use, with the exception of OAuth which I’m yet to get my head around. Thankfully, for now, basic authentication is still supported.

The Twitter API uses the REST (REpresentational State Transfer) paradigm which means there’s no concept of a state on the server; i.e. each transaction is considered separately. It also means that it uses HTTP, which is pretty simple to understand. Basically in a REST protocol the URI’s are objects in the system, and the HTTP verbs are how you interact with them. So a GET on a http://server/article?name=REST object would download an article named REST. Simple eh? Check this article if you’re interested.

Anyway, onto the meat ‘n’ taters. Data in a REST transaction is typically stored as XML or JSON. I considered downloading LibYAML and taking the JSON route but a) I already had Xerces, b) I understand XML more than JSON, and c) I couldn’t be bothered to learn yet another new thing.

(continue reading…)


Bashing Windows

I seem to blog the most about needing to blog more often. Unfortunately for me, interesting things don’t happen often. So instead of waiting for something cool to happen, I’m just going to blog about the little things and hope for the best.

I drafted a post about my adventures with trying to compile some open source software, but it turned out far too long and it didn’t actually concentrate on the point I was trying to make. So instead I’ll jump right to it.

Yesterday I decided, randomly, to have a look at libcurl. It’s a surprisingly powerful library for C that supports a huge amount of internet protocols with only a few function calls. The code examples on the website made it look easy enough to use, so I thought I’d download it and see what I can do with it. Unfortunately compiling it myself turned out to be annoyingly difficult, so I just downloaded the binaries. Naturally these were all in MinGW form and I needed them them to be MSVC compatible.

After some googling I found that MinGW comes with a tool called pexports which dumps all the symbols of a DLL. So using that I wrote a Bash script that does this for all the DLLs in a directory:

for i in $( ls | grep ".*\.dll" | sed "s/.dll//" ); do
    pexports "$i.dll" > "$i.def"
    echo "lib /machine:i386 /def:$i.def" >> makelib.bat
done

This creates a .def file for each DLL which lists all the symbols that must be exported, and adds a line to makelib.bat which will create the MSVC import library. The two pronged approach is unfortunately necessary here because the Microsoft LIB tool won’t run through the Cygwin prompt.

The first line might seem complicated, but it’s not too bad. ls lists all the files in the current directory, grep then singles out all the .dll files, and finally sed removes the trailing .dll. In the loop itself $i will therefore always be of the form “<mydll>” instead of “<mydll>.dll“.

I’m no expert with Bash scripting so there’s probably an easier way to do it.


I’ve written a Shell Extension!

Title pretty much says it all. I’ve written a Shell Extension!

I can’t remember what I was doing now, but for some reason I needed to copy the full path of some file into some program to do some… thing. I was finding it increasingly annoying that I had to copy the path from the Explorer window, then either hand-transcribe (complete with mistakes) or rename, select all, copy the file name.

“Why can’t I just right click and select Copy Filename or something?” I said to myself, “I wonder…”

So I searched CodeProject for some information on how to write my own damn Shell Extension (with Blackjack and Hookers) and stumbled across this fantastic article by Michael Dunn. In the space of an hour I had managed to learn enough to make half of my extension: I added a context menu item to Explorer!

CopyExt working

Now over to MSDN to learn about the Clipboard and history was made. After around an hour and a half I’d gone from knowing nothing about writing Shell Extensions or using the Clipboard to having a working Shell Extension that used the Clipboard. I love the internet.

This is one of the smallest pieces of code I’ve ever written and, ironically, one of the few projects I consider myself to have finished. For more information, including how to download it, go to the CopyExt page.


Holiday!

I’m finally on holiday after having a pretty brutal year at uni!

I’ve bitten off a fair amount of stuff to do over the summer though. I’m currently nursing my interest in web development by helping to make the website for the unofficial ECS TF2 server. It’s quite nostalgic really, I haven’t done any proper web based stuff since school. I’m quite surprised how much things have changed, for the better thankfully.

A mock-up of my design idea can be found here for those that care. Feel free to vote for a banner. The palette is based entirely on one I found at Fabry Design but I got fed up with constantly using the eyedropper tool to find the colour values so I made a HTML version. That and I wanted to show off. (continue reading…)


Term 2 Over

Wow, I’ve really been neglecting my website for a while. I had an amazing 1902 bullshit comments from spam bots or wankers or something. Luckily Wordpress identified all but a hundred or so as completely lacking of any worth and flagged them for manual verification. Fuck that. All 1902 pointless comments deleted by a single click of a button; thank you SQL.

An unfortunate side effect of this atrocity is that you must now register to post comments. Every cloud has a silver lining however: now you shameless, friendless people with an increased sense of self-worth can’t post plugs to your boring blog that would bring a sloth to tears.

End rant, moving on…

Finally, D4 (our big project of the year) is done and dusted! It was a pretty interesting couple of weeks, despite being filled with stress, aggrovation and late nights. We had to design a fire detection system that could accurately measure temperature, detect smoke and the presence of people from up to four sensors and display that information on a web interface. (continue reading…)


Computers! :-D

Who the hell designs all this God-awful software these days? There is more poorly written, unstable, insultingly-hand-holdy but slightly glamorous software in existence today than there are water molecules in, on and around the Earth.

Everything feels the need to hold your hand through every single activity you might want to do and most don’t even offer a way of disabling these pointless features. I probably wouldn’t complain if I could see even a wafer-thin shred of usefulness, but I genuinely can’t. Typical example of this being that immensely annoying protection method of everyone’s favourite IM client: MSN Messenger. Whoever the hell decided that it should decide to block access to some files with certain extensions to “protect your security” should be shot in the leg and thrown to the rapists.

“Protect your security,” what a ridiculous statement. (continue reading…)


LTspice is awesome

Exams are coming up and I’ve been going over some analogue electronics in preparation, just to make sure I actually do understand it. Whilst going over some notes I found some instructions in the lecturers notes that proved to be especially useful: how to use SPICE.

SPICE is a circuit simulator and it’s fairly good. Like all good systems it makes mistakes every now and then but we can overlook that in most cases. So I tried to test my understanding of how a Zener diode works by designing a really simple shunt regulator. It’s not much use in the real world but it can supply 100mA at 5V (well, 4.7V because Zener ratings are strange) to some load.

zenercircuit.jpg

Theory says that the Zener will stop acting like a regulator when no current flows through it, and this happens when the voltage across it fails to exceed its breakdown voltage. As shown in the above circuit diagram, R1 and R2 form a potential divider, hence the voltage across R2 is V1*R2/(R1+R2). The breakdown voltage is roughly 5V as mentioned earlier, therefore the device will stop conducting when R2/(R1+R2) <= 5/12.

Response of Shunt Regulator.

Personally, I think this graph is pretty awesome, even if it is completely unlabelled. Up the left hand side is the output voltage (i.e. the voltage across R2) and along the bottom is the resistance of R2. The curve bends quite sharply at about 50 Ohms which works out to be exactly what we predicted earlier: 50/(70+50)=5/12.

I’m impressed with LTspice. This took like 5 minutes to do. Most of the tools we use are fairly complicated, but this is pretty easy. It draws graphs well and it’s easy to get the plots you actually want rather than plotting everything against time. The only downside is that it doesn’t support parametric sweeps in the GUI so you have to type it in manually, but overall it seems pretty cool.


Long time no post…

Well I intended to make a post every day but that quite evidently has not happened. Not because my life is boring. Oh no, I’m actually fairly busy, but I am pretty lazy too. Whatever, I’m posting now so who cares?

I’ve just finished learning about the Laplace transform which I have decided is a large mathematical bodge. Basically if a linear differential equation is difficult to solve in the time domain, just use Laplace to chuck it in the frequency domain because it’s easier than battling through the classical method. Ah well, I shouldn’t complain really, I do like things simple.

I do think it’s funny that zero can be used to simplify some mathematical problems though. Suppose we need to solve the following integral.

Basic Integral

Now that might take a bit of work because the numerator is not a derivative of the denominator. But we can embrace the power of nothing because 1 – 1 = 0 right? So lets bang that into the integral and see what happens:

'Transformed' Integral

Ah now there we go, two simple things we can solve. This is a pretty poor example because it has nothing to do with the Laplace transform but my point remains. Whatever it was.


At long last…

Well I’ve finally got around to setting up a domain. Go me! I’m very impressed with my host, took about 15 minutes to set up. They said the domain wouldn’t appear for One Working Day but it was up and running about 5 minutes after I confirmed my order. Well impressed.

Shame setting up the actual content isn’t so easy. I tried a few of the PHP based content management systems that they offer and have decided that most systems suck and are incredibly over-complicated. Now I know you’re sitting there reading this and feeling clever because WordPress is clearly a kind of CMS, however I have decided it’s the lesser of the evils I tried out.

I’ve also discovered that:

  • Cool themes really aren’t
  • Most themes are made by people with no idea what clutter means, apparently more shit = better website
  • All CMS’s actually look the same
  • As a result, so do all the themes

With that said, I’ll get back to what’s really important: watching TV/making the rest of this awesome piece of the intarwebs.


Archives

Categories

Recent Comments

Copyright © 2008-2010 Kier Dugan. All rights reserved.
Jarrah theme by Templates Next | Powered by WordPress