Posts tagged ‘programming’

2009-07-18

Open-Source Calculus

I’m (re(re))taking the second course on calculus during the summer at the university. It’s going much better this time around, which is a good thing.

I did have problems with one problem (har), and I couldn’t make sense of it on my messy notebook, and I didn’t feel like doing the entire problem over again. The only thing wrong with my solution is that the answers in the back of the book said term1 – term2, while I kept getting term2 – term1 in my notebook, so I wasn’t too far off but still couldn’t get it right — couldn’t find the erring minus sign. All I really felt like was doing some programming, which I enjoy, but what would I code if I have no software needs?

Then I thought: I need to get a more structured view of this problem. Why not write it up in LaTeX and make it into a nice, good-enough-to-print, PDF solution. That way, I will get some practice writing LaTeX documents (it’s been a few months, sadly), and writing LaTeX is pretty much programming in a way, so I get to practice LaTeX, scratch my coding itch, and maybe find out where that offending minus sign went.

Sure enough, it worked pretty well.

Solution to problem 6.2.9 in Calculus, A Complete Course (Sixth Edition).

I want to point out that this PDF was produced entirely using Free and Open-Source Software (FOSS):

  • texlive LaTeX distribution (tex->PDF compiler: pdflatex/pdftex)
  • GNU Emacs as the LaTeXt editor
  • Ubuntu Linux to run Emacs and tex compiler
  • Totem to play music while writing up the solution
  • Grip + oggenc to rip CDs to Ogg Vorbis
  • Ogg Vorbis media container format
  • libVorbis 1.2.0 used by oggenc (darn you Ubuntu for not updating libVorbis since 2007)
  • and so forth.

It works, folks!

2009-03-23

Bloat Warning

On my system, iTunes and QuickTime take up a combined space of over 180 MiB. That. Is. Crazy.

For a piece of software that I use for nothing else than transferring my songs from one place to another, 180 MiB is an astronomical length. iTunes takes up 106 MiB. The rest is accredited to QuickTime. I don’t even use QuickTime! But iTunes refuses to start without it! I use other free and open-source software to play media than iTunes:

On Ubuntu/Linux:

  • Rhythmbox
  • MPlayer
  • Totem

On Windows XP:

  • Winamp
  • VLC
  • XBMC

That covers all of my media-playing needs. Combined, these players, on each system respectively, play just about every format in existence. And MPlayer, VLC and XBMC are available for multiple platforms, it’s just that they run smoother/more gracefully in my experience on the respective platforms mentioned above that I use.

Back to the matter at hand: As I mentioned, I use iTunes for one reason and only one reason — to transfer songs to my iPod. That task does include fetching album cover art, but I count those two as one task. I don’t play any media in iTunes; no music, no podcasts, no videos or movies, nothing! If I have that kind of setup and needs, why shouldn’t I be able to uninstall the unnecessary modules of the software and save some space? I mean I can understand iTunes. It has quite a lot of features, and I assume that all drivers for every single product that iTunes supports comes with the installation of iTunes, but it doesn’t have to be that way!

Alternative #1

Imagine that you just bought a device from Apple. Let’s say it’s a new iPhone.

As soon as you plug in the iPhone for the first time after installing iTunes, iTunes recognizes that you have a new device and suggests to download the necessary drivers, or whatever it needs, to be able to work with your iPhone. Perhaps installing them as plugins, or integrating it with the software in some other way. BRILLIANT. Now, for any other features I like to use in iTunes, enabling them as I go.

Alternative #2

You just bought a new iPod Nano 16 GB (like I have), for example, and you go to the download page for iTunes to download and install the necessary software.

Upon installing iTunes, you are given — oh, I don’t know — OPTIONS REGARDING WHAT YOU WANT TO ACTUALLY INSTALL, as so many other installers do for other software. Then in those options it might say something like “I would like to be able to play music and video”, perhaps separating music and video into two options, and selecting those options would install QuickTime as well (although it’s ~75 MiB is inexplicable to me).

Alternative #3

Release the module that transfers content between hard disk drive and device as a stand-alone application! I understand that you need some type of technology to recognize which types of media can be transferred and played on the actual device, but that doesn’t imply that you also need the technology to play the media before you transfer it to where you actually want to play it.

That was a little messy, so let’s illustrate with a helpful and suitable analogy: You don’t need to take a bite out of the apple to realize it’s an apple! Otherwise I assume people would look at you strangely whenever you go to the grocery store for example. Sampling all the apples before you pick them up.

At the very least, iTunes should include some install-time options. I’m not really sure, but as far as I can remember, I couldn’t even select where I wanted to install it.

2009-03-23

The Horror of YouTube

If you’ve watched a video on YouTube in the last few months, you must have noticed the new advertising system they integrated into their Flash-based player a while ago.

My guess is that the advertisement isn’t added to videos that were uploaded before it was enabled. So if you watch a fairly new video you’ll see it. For your convenience, here’s a picture of what it looks like.

YouTube advertisement.

YouTube advertisement.

See that? That thing slides up from the lower edge of the video – not immediately after you start the video, no no, but after a few seconds, right when you’ve let go of the mouse and started to sit back and relax as you watch the video. That’s when it comes up. And sometimes it covers a lot of what you’re trying to watch, for example if the video has captions or subtitles. So not only does it catch you off guard, but it makes you rewind videos! WHAT A STUPID THING.

I loved Google Video when it came out, and I love it today because the player and the whole thing is just a lot cleaner, and the player itself works better, than YouTube. Then YouTube was acquired by Google. Things started to change, and YouTube got a lot of enhancements, not only the obvious changes to the player in terms of style, buttons and recently the different choices of quality of the videos, but also more subtle things like (dis)agreeing with text comments by giving it a thumbs up or down, and other things that make the loading of content in general run smoother than before.

At that point, I really started to think about whether I actually favoured YouTube over Google Video… But, no. Forget that. Never. The player is still junk (seeking is HORRIBLE among other things, not to mention the ads), the pages are waaaay to over-loaded with moving images and content with different styles and colors, and there’s no intuitive way to download the videos to your own hard disk drive to view later or to put on your portable player for instance. And what are those stupid, annoying annotations anyway? Just put it in the description box, will you? If I’m not interested in reading your “LOL”s and your “LMAO”s inside the video, I shouldn’t have to! “But you can turn off the annotations by just by cli…” I KNOW THAT, but it’s ENABLED BY DEFAULT. And if you reload the page, IT COMES BACK ON. AND SOMETIMES YOUTUBE’S PAGE RELOADS AT RANDOM.

Google Video’s player, however, seeks beautifully, the pages are clean and contain barely anything but the video in a large window and the comments and other things to the right of the video neatly ordered in tabs, and you can download the videos. Even to iPod formats, so you won’t have to convert them yourself! Yet there are more features(!), such as choosing any size of the video by resizing the browser window itself, with the lower limit of the original size of the video. You can choose Original Size, Double Size, Fit to Window and Full Screen. There’s even a “Smooth Video” option if the quality of the video is too poor for the size at which it is being displayed! The latter in my opinion is a much better solution to the quality problem than “HQ” (High Quality) and “HD” (High Definition) options at YouTube.

And now I hear that Google Video is about to stop accepting new videos and Google is focusing all of its video efforts on YouTube. What a waste!

There are still great options for people who want to upload content to Google, and we invite them to explore YouTube’s dynamic global community or Picasa Web Albums.

HAHAHA.

We’re confident this decision is the right one for our users,

Not for me.

and we’re looking forward to making Google Video an even better place for you to search and find videos from all over the web.

Yeah maybe, if I could watch them using the Google Video player, that’d be AWESOME. Then I’d have all the videos from YouTube but in the format of Google Video’s player.

A man can dream.

Thank God for brilliant software solutions such as the YouTube plugin for Totem (the video player of GNOME).

2009-03-9

Project Euler

I’ve become an active member of Project Euler (PE) again. Project Euler (www.projecteuler.net) is a collection of (around 300 or so) mathematical and programmatical problems. I’m not sure when I started the first time, but it’s been a couple of years, I think. Now I’m back again with a bit more knowledge and feeling a bit more comfortable with programming, several programming and math courses later.

When I first joined, I was mostly only comfortable with Java as my programming language of choice, but I’m very interested in learning to program comfortably in C for a few reasons:

  • It is the traditional language in Unix/Linux applications.
  • I like GNU/Linux and Free and Open-Source Software.
  • It is a lot faster than Java… but still has very similar syntax!
  • I like handling pointers for some reason. I feel like I’m much more in contact with the data as I have full control of everything. It’s just so gratifying to get Segmentation Fault after Segmentation Fault and then, after some debugging and messing around with my pointers, finally getting the sought output from the program.

I don’t believe it’s mandatory to join Project Euler to take part in the problems, but I recommend you sign up for an account, because if you do:

  • you can provide answers to the problems and Project Euler will keep track of the problems you’ve solved.
  • you may participate in the forum thread for a particular problem upon solving it, allowing you to discuss your solution with fellow members. (It’s incredible to find solutions written in the J and K programming languages, which afford extremely concise programming.) Note that only relatively recent forum threads are open to new posts, but all threads are open to read (upon solving the corresponding problem, as I already mentioned).

Project Euler is a very fine tool to learn a programming language. If you’re not a programmer by profession and you don’t really have any software needs that aren’t fulfilled, Project Euler provides you with a great environment to experiment with a programming language’s syntax and libraries with problems and tasks to solve and complete.

My goal right now is to solve as many problems as I can using only the standard libraries in the GNU Library (glibc), namely stdlib, stdio and occasionally string (so far I’ve used string only for the strlen function, which I felt was unnecessary to write myself). It’s going pretty well, and it’s kind of fun to have to figure out solutions on your own instead of relying on already-written functions to do the job for you.

Some of the problems at PE can be solved only with the help of pen and paper, but most of them require up to thousands of iterations to find the solution and isn’t feasible without some computational aid. However, according to the site’s FAQ section, which they call “About”, all the problems are designed in a way that a well-constructed algorithm should take no more than 1 minute to output the solution to the problem. I’m very proud of C. Most problems finish in milliseconds, even on the super-slow laptop I use sometimes.

2009-02-25

Thank you Microsoft

Microsoft has done it again! I continue to be safe from something that wasn’t a threat in the first place. (Or was it?)

Windows terminated an application to protect my computer. However, an interesting question is: Which application?

irony

My version of Windows XP is Swedish, so I will translate:

Titlebar: Data execution protection [I guess]
In bold: This application was terminated to protect the computer.
Name: [The] Explorer
Publisher: Microsoft Corporation
Button: Close the message
Below horizontal line: Data execution protection helps protect against harm from viruses and other threats.
Link: What should I do?

Apparently Windows thought Explorer was a threat and terminated it accordingly. Explorer shut down after giving me a message that it had terminated in an “unexpected” way, but of course, Explorer being Explorer, it started right back up again. But Windows was not complaining this time.

And all I wanted to do was to shut down the computer. Do you think you can handle that, Windows?

2009-01-28

It feels good to be a winner

Yesterday was this year’s Uniaden. A fair held in and closely around the Universum building at Umeå University. The fair has booth spots for many companies that come and talk students who attend the fair to find out where they might end up working one day. It’s a mutual opportunity for both the companies and the students because the companies can make themselves known and attract talented people to work for them, and the students (well at least some) might create connections with the job market and maybe even get job offers.

Just prior to this year’s fair, Ardendo, which I think is a sub branch of Vizrt sent out an e-mail to most of the computing engineers at the university with a challenge and a chance to win a 320 GB hard disk drive.

The entire challenge was contained in a single source code file written in C++. It was a program that would output an image file, if all the bugs in the program were sorted out. I’m not extremely used to C, and I’ve never used C++, but this code was fairly similar to C, so I wasn’t too lost. I managed to at least fix all bugs that I could see, and I got an image file which had an inscribed time stamp and symbol. All participants were to write down this secret time stamp and symbol along with their name and e-mail on a piece of paper and hand it to the folks at the Ardendo booth.

On the day of the fair, I went there, handed in my contribution and had a good chat with the folks there. For the record, Ardendo seems to be a nice place of work. They do some interesting things (create software solutions for professional television broadcasting stations), and they seemed to think that I’d be a good candidate to work there once I’ve finished my education and given my interests and current knowledge.

When the time came to draw the winner of the competition, they took all the pieces of paper, which were different in size, shape and color because everybody wrote it down on their own piece of paper, and indexed them with numbers. The numbers were then mirrored on a different set of indentical pieces of paper, and the winner was drawn from that set. There were about 6 or 7 people who entered the competition.

It turns out I won!

I couldn’t believe it. And it turns out the drive was 400 GB, and one of those smaller, sleek ones that only need enough power to be powered from the USB cable alone, which is brilliant. It was a happy day.

I should mention I didn’t solve the bugs the way it was probably meant, because if I had, I would appparently have seen yet another hidden “easter-egg” message from the creator of the challenge. If I had solved it correctly, I would also have had a chance in an extra lottery where the prize was a beige cardigan with, I think, the Ardendo logo on it.

I’m glad I won the first lottery.