I’ve been playing around with some basic HTTP programs lately and noticed that Kaspersky flags them as viruses for some reason. I did some investigation and learned why and how to get around those detections.
Latest Entries »
While trying to figure out how to use the ADC on my AVR microcontrollers (not Arduino, raw AVRs!), I kept finding a variety of tutorials with examples that just didn’t work for me. I eventually got it working, so thought I would share, hoping it would help someone else eventually!
I am using an ATmega32U4 (awesome chip!), but these steps should be appropriate for most AVRs. Note that my clock is running at 8 MHz. If you change the clock speed, make sure to change the prescalar value.
ADCSRA |= (1 << ADPS2) | (1 << ADPS1); // prescalar = 64 ADMUX |= (1 << REFS0); // reference voltage from internal source ADMUX |= (1 << ADLAR); // 8 bits, instead of 10 ADCSRA |= (1 << ADATE); // free running ADCSRA |= (1 << ADEN); // enable ADC ADCSRA |= (1 << ADSC); // start A2D conversions
Note that this code works for a continuously running, non-interrupt driven ADC program. If you want to use single shot conversions or interrupt driven ADC, you will need to change these lines appropriately. I might add that as another post eventually.
I’ll preface this post with the fact that it will be fairly technical. I have been trying to write a Windows program which can get the EXE path of a specified process ID (PID). I found a couple different ways, so thought I would go through them here.
Read on for a tale of my initial frustration, ever incresaing despair, and eventual victory in this tale of my configuration of audio devices in a Windows 7 VM guest on top of an Arch Linux host.
I have been playing around with CouchDB lately as a new tecnology. It is a NoSQL database that stores everything as a ‘document’, rather than as a row like a traditional relationship based database, such as MySQL. What is also cool about CouchDB is that it uses a REST API. That is, every request and operation is done through HTTP, so it works with essentially every language. NoSQL is new to me, but I am liking it so far!
I am actually using my CouchDB instance as both my database and webserver. Since CouchDB has a REST API and everything in CouchDB is a document, so there is no reason why you cannot simply ues the browser to send an HTTP request and return HTML pages directly from the database! Pretty neat to eliminate Apache, PHP, and MySQL from the web stack and instead use just CouchDB.
Anyways, I have been chugging along merrily, serving static HTML pages or show functions from my database, until I started to use the list functions that CouchDB offers.
Specifically, I was having trouble getting it to return an HTML header, rather than just plaintext.
To solve this, you must format your list function as:
function(head, req)
{
provides('html', function() {
... The list function ...
send(data);
});
}
This tells the list function to send HTTP headers along with the data, rather than just the data itself.
This took me a while to figure it out, so hopefully it helps you!
Sometimes I read MSDN entries and wonder what the numeric value of a constant, such as GENERIC_READ, is. However, MSDN usually does not list this information, so I am forced to dive into header files.
Well, I got quite sick of doing this, so I whipped up a few Python scripts and made a database of a lot of the Windows constants.
I do not claim that 100% of them are there, but on the initial import, I found over 100,000, so there are quite a few! In the future, I will be adding POSIX and other constants, as well as some of the Windows constants I missed. Parsing all the headers was a pretty interesting task, so I might publish another entry on it here in the future.
I thought this database might be helpful to others, so I am publicly publishing it at www.namethatwindowsconstant.com.
Enjoy
Since I have been home over winter break, I felt like doing a little bit of fun hacking. As a few of my posts have shown, I am fairly interested in hardware oriented projects, so I thought I would try another. I have several AVR chips and support supplies laying around, so I thought I would use them. Recently, I have also been playing around with DJing. It is fairly common to use a controller to control a DJing setup, but they are all fairly expensive. Since they are just a collection of buttons, knows, and faders, I decided it would be interesting to try to make my own.
This post will cover what I did for the various parts as well as some of the interesting bits of code, so that you can make your own!
Lately, I have been doing work with the Pistachio L4 microkernel as part of my research. This requires building various disk images, installing GRUB, and running them inside of a virtual machine. Initially, I was using Linux to do this, since it had all the tools ready to go and was what everyone else was using. However, I have a Mac, so I wanted to be able to use that, rather than SSHing into a server all the time. I didn’t think it would be a big deal, just install the same tools on my Mac, right? Wrong! What follows is the odyssey of what I’ve gone through to do this. Hopefully, it will help anyone else facing a similar circumstance.
One day, I was curious about how the computer system goes from booting to actually loading up an operating system. Obviously, it must retrieve the operating system from disk at some point, so I decided to investigate this. The first step in this process is reading the MBR, or Master Boot Record of the hard drive. The MBR is used to store data about where the OS is stored on the drive.
I figured the MBR would be interesting to learn a little bit more about, so I decided to load it up into IDA Pro, a tool for disassembling programs, and see what I could find out.
I learned a lot and had a lot of fun, so I’m presenting it here to share my results.







