Friday, May 17, 2013

Changing the encoding in windows cmd.exe

Today I saw something nice somewhere on the net. To change the codepage of windows cmd you can add a string value registry key to the path:
"HKEY_CURRENT_USER\Software\Microsoft\Command Processor"

Name it "AutoRun" and give it a value of "chcp <codepage>" like ex. chcp 850.

Thursday, May 16, 2013

Eignvalues noch einmal

Today was the last day of mathematical analysis and Linear Algebra with Dan Witzner. Me and Florian did a lot of exercises with eignvalues and vectors. I guess I would take away that the procedure for finding eignenvalues for a 3x3 matrix involves solving a third-degree characteristic polynomial and I did not remember how to do that. My "memory path" for finding eigenvalues and their egenvectors:

1. Ax=λx -> (A-λI)x=0  
2. This means that det(A-λI) must be 0, which leads us to the characteristic polynomium.
3. Solve the polynomium to find λ
4. for each λ find the linear combination that fulfills (A-λI)x=0
5. All linear combinations of the vector(s) found in 4 are eigenvectors belonging to λ.

In general I need to study these topics again before my exam:
SVD, Gram-shmidt, the advanced parts of the calculus corriculum.

Wednesday, May 15, 2013

Last day of mining

Today I was working with Florian and Victor on the last coding day of our datamining project. I learned a few tricks for latex and git (As always when i work with Florian). It's nice to do "git rebase master origin" instead of just git pull. The rebase will lift all my commits, apply commits I am missing and then apply my new commits on top. I also learned of gitk, a nice tool to get a an overview of the branches.

Finally I discussed the meaning of showing a confusion matrix for 10 runs of KNN. I argued that it does not make sense as we are talking about the quality of a specific model, not the general ability of KNN. In real life I guess we would run KNN and test it, and the for the final implication we would train on all data and not leave any for testing. I should ask Julia Trogelius about that.

Tuesday, May 14, 2013

More MKC

Today I spend all day coding on the MKC solution. I went through a lot of painful debugging of my shifts-creator. In the end it turned out I had a special case in a nested loop that would sometimes not reset a counter. I learned that it's a good idea to check that counter resets are handled in one place instead of in each individual nested loops.

Monday, May 13, 2013

Certutil and powershell

Today I learned how to add and remove certificates with "certutil" in powershell. The help is pretty usefull but there where a few things I had to spend time guessing:

There are stores. It's kind of hard to find out what store you are in, but if you use "certuil -viewstore" in powershell the console will show the name of the store it's showing. In my case "CA", you can view another store by using certutil -viewstore "storename".

I also learned that powershell will write "delstore command completed sucessfully" even if provided with names that did not lead to a certificate. So it's important to check if "certutil -delstore" acutally deleted anything in the lines above. You can refer to the certificate by writing its full nickname or title as it appears in the store view that appears using "certutil -viewstore"

certutil -viewstore "storename"
certutil -addstore "storename" "cert. path"
certutil -delstore "storename" "cert. nickname"*

*find the nicenames and store names by calling -viewstore.

Tuesday, May 7, 2013

Index of smallest entry in array

In MKC planner I had to find the index of the array index with the smalles values. I learned how to use Enumerator Aggregator to do this. Even with some random breaking for ties. From memory it went something like:

Random r = new Random();
Enumerator.Range(min,max).OrderBy(i=>r.Next()).Aggregator((a,b)=>array[a]<array[b]? a : b)

I also learned how to install RockBox on an Ipod "Classic" (6th gen) which turns out to be very simple using Emcore.

Monday, May 6, 2013

Database In Depth

Today I was reading some of C.J. Date's book "Database in depth", I learned that mr. Date doesn't not have much love for SQL*. But I also learned a lot about the relational model. To be specific it's worth to remember that the relational model is based on a relation as a heading containing a set of attributes, and a body containing a set of touples conforming to the heading. Because the relations use sets there are no duplicates and no ordering in a relation, unlike SQL-Tables.

I also really liked the part about base and derived relations where Date stresses the fact that the relational model specifies nothing about physical storeage and the thinking that "views are virtual, tables are physical" is wrong. The only true requirement is that there is some mapping between the physical storeage and the base relations, which in turn can be combined to get the derived relations. Everything else is up to the implementation.

"Base relations are no more (and no less!) "physical" than views are, so far as the relational model is concerned" - C.J. Date

*In general I really enjoy the almost palpable but subtle dispise for SQL eminating from this book so far. It feels like SQL is a personal insult to mr. Date and the thought that some people will call SQL a "relational" language will bring him to the barricades at any time, to stand up for what's right. There is a vibe of Luke 23:34 to the whole thing at the same time. Great writer!

Sunday, May 5, 2013

Minimum Spanning Tree

Today I was correcting handins about building MSTs and I re-read some chapters from Sedgewick. A new thing i "learned" or at least that came to my attention is that when we are talking about big-O runtime it really doesn't matter if we are talking O(E log E) or O(E log V) since E <=V^2 -> log(E)<= log(V^2)=2log(V) --> O(log(E)) = O(log(V)).

So jumping lots of hoops to get from E log E to E log V really doesn't do much but allow you to practice building Union-Find datastructures and priority queues.

Friday, May 3, 2013

Self validation

Today I learn about the Validation Application Block. It's nicely described here. But unfortunatly I just could not get it working for the longest time. It turns out Mikael Nygaard had a solution for me. Adding the [HasSelfValidation] tag in the metadata Class instead of the actual Class solved the problem.

Thursday, May 2, 2013

Eigenvalues and SVD

Today I saw Dan Witzner perform more matrix magic. Nothing really new, but this stuff keeps falling right out of my head so I will try to remember this:

If Ax=yx then x is an eignvector af A and y is the corresponding eignvalue. 
If A is invertible then it's non-singular and det(A)=! 0 and vice versa.
If A is not invertible then it's singular and det(A) = 0 and vice versa.