Geolocation over WiFi

Wednesday, April 22, 2009

I was playing with my iPod Touch today, skimming throught Google maps, when I accidentaly hit the Show current location button. I knew that my iPod doesn’t have a GPS so I never really expected it to work. I was really stunned when after 3 seconds it showed me a map of Uppsala, with a circle around a place that actually was my location.

My first reaction was: what?! And I immediately went to check if my iPod really does not have a GPS. It didn’t. So I started googling and after a few links I finally knew what was going on: iPod uses WiFi to provide geolocation.

Still, this was not an answer for me. WiFi access points usually don’t report their own GPS coordinates. That would make them too expensive with very little benefit to the user. Something different had to be behind this.

A few more minutes after that I found the answer: there is a company that runs cars with a GPS and WiFi on board, that scan MAC addresses of WiFi access points and stores them together with their positions. When a device like my iPod Touch needs to find out it’s location, it sends a list of all access points around it to a web service of this company. If you are lucky, the MAC addresses are already in their database and using triangulation, they can find your location with precision of ~100 meters.

That’s pretty impressive for a device with no real geolocation hardware.

Topics: Uncategorized | Comments Off

GDB and QEMU on Windows

Tuesday, April 21, 2009

A few weeks ago I started to work on a small operating system for a MIPS-based development motherboard. When thinking about a development toolchain, I immediately looked at one of my favorite emulators – QEMU.

QEMU has a few nice features that make development of operating systems easier than ever. One of these features is the -kernel command line parameter that loads a custom operating system kernel right into memory without the need to write a custom boot loader. Another useful command line option is -s which starts a GDB server inside QEMU so you can connect to it with GDB (with the command target remote :port_number) and debug your loaded kernel with full symbols.

At first, this didn’t work for me. GDB refused to connect to the server for no apparent reason (No connection could be made because the target machine actively refused it.). It took me almost half an hour to figure out where the problem was: QEMU was opening an IPv6-only port and GDB was using IPv4. Quick fix: open up gdbstub.c in QEMU sources, locate the line where the connection string is being created (in QEMU 0.10.2 it’s the line 2300; there is a string that says: tcp::%d,nowait,nodelay,server) and fix the connection string to look like this: tcp::%d,nowait,nodelay,server,ipv4.

Topics: Uncategorized | Comments Off

Compiling GDB under Windows

Wednesday, April 15, 2009

Just a quick post to make things simpler for everyone who is googling for help when compiling GDB debugger under Windows.

There are two small oddities that require edits in the source code when compiling GDB 6.8 using MingW with MSYS.

After you change this, just “configure” and “make” and you are good to go.

And if you want the TUI (textmode GUI interface), install PDCurses to your MSYS directory (and create a link from MSYS\lib\libpdcurses.a to MSYS\lib\libcurses.a; not sure it’s neccessary, but that’s what I did) before running the configure script.

Topics: Uncategorized | Comments Off

Summer at Microsoft

Tuesday, September 30, 2008

As you probably all know from my last blog post, I spent this summer interning at Microsoft in Redmond. I was hoping to keep this blog updated with all my experiences and news, but being the lazy person I am… I did not write a single line.

This is a condensed version of what happened with me during my 12 weeks in Redmond.

All in all, it was a great summer. Microsoft gave me an offer for another internship the next summer, which I accepted. If you are still a student, give it a try and we might see each other in June 2009 :).

Topics: Personal | Comments Off

Interviewing with Microsoft

Wednesday, April 16, 2008

A few months ago I found an offer for a summer internship at Microsoft headquarters in Redmond. After all I have heard about working at Microsoft, it sounded like a perfect summer opportunity for me. I wasn’t very optimistic about my chances, but I would probably regret it later if I didn’t apply. So I sent them in my CV.

After a few weeks of waiting I got a call from the Czech Microsoft office saying that they like my CV and they are sending it to Redmond for further evaluation. I was happy, but still – had no reason for celebrations :). A few weeks passed until I received an e-mail from Redmond asking me several questions about my background (my motivation, programming proficiency, how much code did I write within the last year and stuff like that). I sent them all my answers and waited impatiently for a reply.

The phone interview

After a week or so, I received an e-mail with a telephone interview arrangement. Now it all started getting serious. I searched the whole internet for any hints on telephone interviews, prepared a sheet of paper with all possible questions, printed out my CV and even started brushing up my english a bit.

To my surprise, the interview went quite well. Again, there were some questions about my background and motivation and a simple problem-solving question. No “real” technical questions at all. Still, I had a pretty bad feeling about it. My answers could definitely be better and I felt that I didn’t say anything that would distinguish me from the other candidates.

In-person interview

A few weeks of radio silence followed. I started to be a bit worried that after the disastrous phone interview I am not even worth to get an e-mail telling me that I didn’t meet their expectations. Then I received an e-mail with subject “Microsoft Internship Interview Preparation – Warsaw”.

It was an invitation for an in-person interview with people from Redmond on their International Recruiting Trip in Warsaw, Poland!

The in-person interview was challenging. The interview took place in the Warsaw Microsoft office, which is a nice building about 10 kilometers from the city centre. I met 6 other internship candidates, 2 from Czech Republic, 2 from Romania and 2 from Bulgaria. I was the only one from Slovakia (the interviews were scheduled for two days and if I remember well, about 40 candidates were invited to Warsaw altogether).

I interviewed with 3 people – Holly (technical recruiter), Phil (manager from the Speech Recognition team) and Tom (developer from the “Clouds” team).

During the interview I had to write code on paper, explain my approach, design several tests and even solve puzzles (variations on the Pigeonhole principle). Even thought one interview took only 20 minutes (so 3*20 minutes together), it was exhausting.

The rest of my trip to Warsaw was fun, too. I had time for some explorations of the city and I took many pictures. The best thing about it – Microsoft paid all the hotel and travel expenses :).

Interview results

The results of my interview came in about two weeks later. I was really anxious about opening the e-mail. I really wished to get there. So I opened with jittering hands just to find out I received an offer! An offer for a SDET position at the Windows Serviceability team! Probably the best place I could get!

If everything goes well, I will start in the middle of june. So – see you in Redmond :)!

Topics: Personal | Comments Off

Singularity source code released

Wednesday, March 5, 2008

Microsoft has finally made the source code of it’s research OS called “Singularity” available to general public.

Singularity is a prototype operating system coded almost entirely in managed code. It’s written using Sing#, a language derived from Spec#, which itself has roots in C#. Spec# adds Eiffel-like contracts (loop invariants, preconditions, postconditions, etc.) to C#. Sing# extends Spec# with low-level constructs required for operating system development and channels required for communication within Singularity’s microkernel.

Okay, now what does this mean?

Other projects attempting to create a CLI-based operating systems are SharpOS (which unfortunatelly uses the aggressive GPLv3 license) and Cosmos (released under a BSD license).

EDIT: I almost forgot the download link for Singularity; you can get it from Codeplex.

Topics: .NET | Comments Off

Virtual machines performance comparison

Wednesday, October 24, 2007

I have always been a big fan of virtualization. I started using virtualization with a demo of Virtual PC in 2001 as a testing platform while developing a Windows tweaker called SysTuner. After Microsoft bought Virtual PC from Connectix in 2003 and released Virtual PC and Virtual Server for free, I was really happy that I finally had a great testing platform for all my operating system experiments.

Today, there are many free virtualization programs. Even though I am a (mostly) happy user of Microsoft’s Virtual PC 2007, I started to have concerns about it’s performance. To find out which virtualization program would fit my needs better, I made a little performance comparison.

Testing environment

For the test I used a physical system with Intel Core 2 Duo processor @ 2.4 GHz with 2 GB of RAM. The host operating system was Windows XP Professional. The guest systems were configured to use 256 MB of RAM and only one processor core. Operating system used was again Windows XP Professional.
The test was done with Virtual PC 2007, VMWare Server 1.0.3 and VirtualBox 1.5.0. I also wanted to test VMWare Player, but it showed up that I am not allowed to install VMWare Server and Player on the same computer (and I need the Server version for some work related stuff).

The test

I used two synthetic benchmarks to test the virtual machine performance: SiSoftware Sandra Lite 2008.1.12.34 and Super PI 1.1.

Following results were obtained without virtual machine additions installed (virtual machine additions are a set of drivers providing optimized communication between guest operating systems and virtualization software):

  VMWare Virtual PC VirtualBox
Processor Arithmetic
MIPS 12254 10121 33534
MFLOPS 8587 6766 22411
Processor Multi-Media
Multi-Media Int x4 iSSE N/A 26972 iit/s 89424 iit/s
Multi-Media Float x4 iSSE2 N/A 33096 fit/s 109290 iit/s
Physical Disks
Drive index 40 MB/s 44 MB/s 424 MB/s
Random Access 8 ms 10 ms 7 ms
Memory Bandwidth
Int Buff’d iSSE2 Memory Bandwidth 6307 MB/s 1402 MB/s 30709 MB/s
Float Buff’d iSSE2 Memory Bandwidth 6319 MB/s 1325 MB/s 35093 MB/s
Memory Latency
Memory (Random Access) Latency 105 ns N/A 33 ns
Speed Factor 85 N/A 82.6

The VirtualBox results are the best in every category. But as you can notice, the numbers are really strange (the Drive index of 424 MB/s is even better than the drive index of the host computer!). My theory is that VirtualBox has some serious problems with hardware clock emulation and this makes the results incomparable. To make some use of the data I collected, I made also a second test with virtual machine additions installed. I think it’s safe to compare the numbers obtained with and without additions on each product.

  VMWare Virtual PC VirtualBox
Processor Arithmetic
MIPS 13990 10489 55000
MFLOPS 9669 6973 36674
Processor Multi-Media
Multi-Media Int x4 iSSE 83863 iit/s 27971 iit/s 137573 iit/s
Multi-Media Float x4 iSSE2 45656 fit/s 34202 fit/s 180852 iit/s
Physical Disks
Drive index 40 MB/s 44 MB/s 498 MB/s
Random Access 9 ms 10 ms 8 ms
Memory Bandwidth
Int Buff’d iSSE2 Memory Bandwidth 7717 MB/s 4002 MB/s 43293 MB/s
Float Buff’d iSSE2 Memory Bandwidth 7675 MB/s 4073 MB/s 40207 MB/s
Memory Latency
Memory (Random Access) Latency 94 ns N/A 20 ns
Speed Factor 84.4 N/A 71

The performance gain is visible in almost every area. It gives us a really good reason not to forget to install the virtual machine additions.

I was somehow disappointed with the results I got. I wanted to see the performance differences between virtualization software but the only thing I got was a bunch of numbers with no possibility of objective comparison between categories. I had to do a second test, which would allow me to do a somehow more objective comparison. So I made several runs of Super PI test:

  VMWare Virtual PC VirtualBox
Super PI
Super PI 4 MB 2:00 2:02 1:59

I also used a physical stopwatch to ensure that the time is measured properly. The results were quite surprising. I did not expect any time differences at all because user-level code should run at native speed on any virtualization software. The three-second interval was probably a product of context switching and scheduling in the kernel mode. I finally got the numbers I was looking for.

The results seen here are the results of synthetic benchmarks. Real-world results may be completely different.

Topics: Performance | 2 Comments »

.NET framework libraries source code to be released

Thursday, October 4, 2007

According to Scott Guthrie’s blog, Microsoft will release the source code of .NET framework libraries together with .NET 3.5 and Visual Studio 2008 release later this year.

Nice. This means no more uncommented disassemblies of extended .NET classes from Lutz Roeder’s .NET Reflector (even though it’s a wonderful tool when you don’t have the source code, having the source code is better).

Topics: .NET | Comments Off

Latest development

Monday, September 17, 2007

It has been quite a long time since I have posted anything to this site. A month, to be exact. After a pretty harsh first half of my summer holidays, I have been busy catching up with some summer pleasures in it’s second half.

With my parents and my brother, I spent a week at our cottage in Low Tatras. I finally got the chance to charge my internal batteries.

After returning from the mountains a friend asked me if I would join him on his trip to Prague. He has never been there before and I just could not say no. The trip was perfect and I’ve got some nice pictures, so maybe I’ll post them somewhere.

Anyway – I promise, I will write more content for this blog now and I will also try keeping it less personal and more technical. I’ve got some fun things on the burner, so stay tuned.

Topics: Personal | Comments Off

Don’t fool your users

Saturday, August 11, 2007

Today, I finally got into reading the series on anticracking I mentioned in my previous post. In one of the articles, I found this suggestion on what to do if you detect that your program is being cracked†:

Instead of crashing the program, you should wait several days and then change the way the program reacts. For example, in a graphical program when the user of illegal version picks green colour, the program will draw with blue colour.

The intention of this is clear: discrediting the cracker. If he doesn’t notice this additional protection layer and ships his (unfinished) crack, his credit among the cracker community will be degraded.

In reality, though, the one with degraded credit will be you. “Do not use the X program. It’s full of bugs and works in an unpredictable way.”

People do not usually associate bugs in programs with unfinished cracks. If a program works just fine after it was cracked, people tend to forget that the program was ever cracked. All errors that show up after a certain period of time will be automatically associated with you.

If you want to include delayed checks in your protection, make sure they behave in a direct way. You detected that your program is partially cracked? Show a message box‡. Display a message on the application title bar. Inform your users. Do not let them make false assumptions about your program.

† There are many ways how to detect this – a checksum doesn’t match, the registration verification procedure returned true even though the code supplyed was intentionally not valid, etc.

‡ Of course, do not forget to hide the message in the code appropriately. You don’t want to bring the attention to this code, do you?

Topics: Security | Comments Off

« Previous Entries Next Entries »

Featured project