Monday, 11 October 2010

A Year Later

So after I realised that I have practically no time to work on anything outside of my uni work, I had to leave my music distribution program for the year.
I was planning to get back on it during summer and then it turned out that work took up all of my time instead.
In the time between work and uni I've started working on it again. Hopefully I can carve some time out of the evenings to keep working on it.

I've spent the last two days setting up interfaces through Direct Show, filters as they like to call them. A client is now able to load two different tracks on different sound cards on the server PC. Incidentally last year I didn't even have two sound cards, I got my second sound card just before this summer. Without that I wouldn't have been able to add the functionality.

I came online all excited about putting up a new build but as I started typing I realised, the sound cards used are currently hard coded. In addition the music directory in the build I posted a year ago is hard coded too, so unless you set up the directory structure to match mines, the program wouldn't have done anything useful at all.
As a result I'm going to be spending the next two days setting up the config files to read out properly.
As soon as I've done this the new build will go live!

Friday, 10 September 2010

PicKit 3 + Eclipse

I am quite excited today as I have order my Pickit 3. I was planning on building a programmer myself but there were so many complications. Instead I just decide to just go ahead and order one, unfortunately I accidentally had it delivered to my parents house rather than my own (you get used to eBay knowing where you live). Luckily I was planning on going there this weekend anyway.

I actually ordered the kit a couple days ago so it should hopefully be delivered today. The only remaining complication is that my laptop has some obvious internal problems which I can't fix just by replacing parts and as a result it refuses to run Windows smoothly. Incidentally, Linux seems to run just fine. Naturally the IDE, MPLAB, which comes with the Pickit doesn't run on Linux.

So today I am testing out Eclipse, which I'm actually quite liking. There were many features of Visual Studio that I clearly wasn't using, but it never made me want to use them. In alot of ways I feel like the eclipse interface is alot more cluttered, but at the same time it just made me think that I'm not using my IDE's to their full capabilities so I now I feel like learning the ins and outs of Eclipse to see what I've been missing.
I would use eclipse for a few days and then compare and contrast with Visual Studio but that would be unfair just because I hardly use any of the features of visual studio (mainly because I don't know what they are - I mean I just right clicked on eclipse and have no idea what profiling or refactoring is and those are just the first two things which caught my eye)
Anyway I plan to try and get C30 integrated into eclipse over the weekend and see how things go with the Pic programming.

Friday, 23 April 2010

Sony BPRL

Today marks the first step in my professional career. I've been watching my email closely all week and this morning was happy to see that I have been offered a summer job with Sony Broadcast & Research Labs in Basingstoke.
I will be working on quality assurance for both Sony Ziris software and Sony HDXchange which basically equates to making sure the software works, and then trying to break it.
This will be the first time I've ever done a full time job which at first was a little bit daunting for me but that was when I was considering the idea of doing full time at my current job at showcase cinemas selling refreshments. After 16 hours life begins to feel a little bit sad but I feel working full time with
A) Something I am genuinely interest in
and
B) Something slightly less repetitive than serving food to 50 people an hour
would be quite enjoyable.

I never thought I would say something quite like this but I'm looking forward to working over summer.

Tuesday, 23 March 2010

Text Prediction

Well I've been way too busy with University (work and life) to even consider working on my media share project - which is sad because at the end of the year I won't be in halls any more and will not have much desire to make it a peer to peer system.
Anyway the point of this post is my Text Prediction system which was my final project for my programming module. Technically its very good if I do say so myself - but the write up that goes with it hangs in the balance. Will have to wait to see what mark I get.
Whilst I was working on it people started talking to me about binary trees and searches which I had no clue about. They learnt about them from another module which I am not taking. I considered working them in but I thought that was a bit lame. I wanted to make something more functional.
Several times I considered optimising the code. A binary search would be more efficient than a string search - an array in some places better than a vector, and a linked list better in others. Incidentally my program is composed almost entirely of vectors. The reason for this is that I just wanted to get the method done and not worry about the efficiency of the variables. I was having trouble using STL linked lists and arrays would be too much work with resizing so I used STL vectors instead.
Instead of wasting all my time worrying about efficiency or a certain technique I hadn't been taught which in my honest opinion other people were wasting effort on, I tried (and succeeded) in doing something different (although I clearly wasn't the first to do this by far).

There came a point during the project when every started talking about how many words their program could predict - each successive giving a bigger number because they found a bigger list of words online. I considered this utter rubbish because it doesn't display the predictive power of your program, just which website you went on to get your word list.
I wanted something with a higher predictive power so I started looking at Markov chains. My text prediction system assembles each group of 4 words into a word trigram, transition probability and resulting word set. Each time the same 4 words appear in order the information is added to the system causing transition frequencies to change.
This allows the system to predict entire sentences.
Strictly speaking this would not be considered a proper Markov chain because the probabilities are constantly changing but this is done because of the stochastic nature of the system.
There is no possible way I could assemble all possible trigrams as well as suppling appropriate transition probabilities. In addition this would cost memory with alot being wasted on sets the user never writes. The system is therefore setup so that it is constantly training - adapting to the way the user types.

I can't include the source code for a while but my last build when handing it in is available for download. It should be noted - as I mentioned several times in my write up to avoid losing marks - The interface you see is not the text prediction program. It should be considered a typing program (which was crudely coded in no time at all) + a fully featured text prediction program (or class - which is what this is all about ).

The text prediction code is simply dropped into the typing program which was used as a test program because the text prediction system only takes strings as input. The test program takes data from the text stream and sends it to the text prediction system. The text prediction system then returns the predictions and the test program - or whatever program the system has been dropped into is free to do what it wants with those predictions.

Thursday, 7 January 2010

Header_File_Not_Found.h

Strangely I just discovered that I don't seem to have"tpipv6.h", which apparently I require for IPV6.
The odd thing is that since I installed Windows 7 I've happily been compiling programs which I previously needed the Windows SDK and a very specific version of the DirectX SDK to compile, both of which I forgot to reinstall when I installed Windows 7.
Perhaps I wasn't aware at the time that I didn't need the Windows SDK because I started with an older version of visual studio but in the case of the DirectX SDK I'm at a loss.
Maybe one day someone will develop a Linux style auto resolver which downloads required standard header files. Such an app would have definitely saved this evening in which I am now installing more than 4GB of Windows SDK, or rather waiting for it to download, instead of coding, in order to avoid having this problem in the future.

Saturday, 21 November 2009

Small Fix to my First Build

I've put up a new build for today which includes absolutely nothing I promised in my last post. There was a small problem on the client side which I spent my time last night fixing on the server side but didn't bring over.
Basically the location of the config file was hard coded into the client. The server was setup to load the config file from the same folder as the exe. As far as the client was concerned it was trying to load the config from a certain location on my computer that you are extremely unlikely to have and thus was trying to connect to a blank IP address.
This has been rectified now so feel free to try it out.

Where are we?

Last Nights Build is now available for download. The download contains two folders, one containing the server side and the other the client side exe files. Each also contains a config file. The config files are read in upon starting the program.

Client
The client config folder contains 1 line which directs the program to the server's IP. For testing on a single computer either put in the computer's IP or use the loopback IP 127.0.0.1.

Server
The server config file tells the program what folder music is stored in. Whilst it does currently have the ability to store multiple addresses, it currently can only actually retrieve music from the first folder detailed. The server uses Directshow to play music and thus should be able to play any track that windows media player can play. Networking is done via winsock.

General Use
Set the server's config file to the location of music on your hard drive and run the "Home Control System Server.exe"
Set the IP in the client's config file and run the "Home Control System Client Backend.exe"
The client will automatically connect to the server - it doesn't actually matter whether you run the server or the client first because the client continuously attempts to connect until it is shut down or succeeds.
Once connected a menu will show up on the client side.
1 - Play Track
2 - List Tracks
3 - Rebuild Library

Playing Tracks - Once selected you will be asked to enter the index of the song.
This is the number next to each track when the tracks are listed.
Finally you are asked for the room ID. This is a function related to the programs multi room playing ability. Currently, selecting 1 will cause the song to play. Selecting 11 will also cause the song to play. It is possible to have 2 songs playing at once as the room ID's work as separate channels

Listing Tracks - The server sends a full list of all the tracks available.

Rebuild library - Works the same as List Tracks but causes the server to recheck all the files, adding in any new files.

Known Issues
Major:-
*The server indexes pictures and folders (as opposed to actual tracks). Attempting to load pictures or folders as tracks will cause a crash.

Minor:-
*The menu does not reappear after listing tracks. The options are still valid and entering input will cause the program to continue as normal

*Listing tracks shows all the tracks available in one go. As a result of the program running in command prompt it is only possible to see the last 300 or so. Whilst this is currently a limitation the program is not actually planned to be run in command prompt. Once a GUI is set up this will not be a problem

*The message loop on the server side causes a high amount of CPU usage. May cause a large amount of slow down on single core PC's

What Next
Clearly the program needs to be refined in many ways but the direction of the entire project has now changed. The original idea called for a client server implementation but now it is moving towards a peer to peer implementation. Because the program now needs to be able to view all the computers on the network and interact with them, not just a server, using a client server system does not make sense. As such it is now possible to concentrate development on a single program, rather than needing to develop two at the same time.
A number of major steps will need to be taken before getting something working using the new networking method.
- Firstly I am going to freeze the server. All work will be done on the client side source code from now on.
- The server uses a class called DSMusic which deals with all the music playing capabilities. This needs to be moved onto the client side.
- The networking code needs to be reworked to allow
*-- peer to peer connections
*-- client discovery over a network

The network code as well as DSMusic both need to be reworked to allow the use of streaming media.

Typing alot tires me out so I'm going to get to work ^_^