Thursday, November 8, 2012

Operating Systems!


This post is intended to serve as an archive for various interesting links/references/sources I come across while doing OS assignments or other stuff. I hope you find these as useful as I do. Most of these were (shamelessly?) copied from the first page of Google search results (as someone said, the best place to hide a dead body is the second page of Google search results).

http://stackoverflow.com/questions/1401359/understanding-linux-proc-id-maps

http://tcpdumper.blogspot.in/2009/05/minor-fault-vs-major-fault.html (Good for VM basics)

http://igor.chudov.com/tmp/LinuxVM/html/understand/node35.html (Good link for page faults, but there seems to be lots of documentation on other aspects as well)

http://condor.depaul.edu/slytinen/373f12/l1.html (Nice notes, I guess)

Note to self: awk '{ print $1 }' - double quotes won't work, printf won't work, add awk to to-learn list.

11/11/12

Just came to know about a tool/lab assignment called Buffer Bomb. It's based on buffer overflow attacks, and apparently, is a standard assignment/activity at many universities. Kind of puts into perspective the number of things IIIT's Operating Systems course is missing.

Useful resources:

https://docs.google.com/viewer?a=v&q=cache:M6bI62pfENkJ:condor.depaul.edu/glancast/373class/docs/lab3.pdf+&hl=en&gl=in&pid=bl&srcid=ADGEESiOjL7s9ZC3Wx_-6ndlBiWvXB9QqWkHMP9qE27Xjirgnl48tHErHkqoX2apzmCejB32039mvDQAZ_T8o26PSVxh8SHe7_VMRHFy8i_3Q4QWazGafmLK9Iw3CT6kO6fiM5Grupj5&sig=AHIEtbQV86i2aX_1ZbcQ68rngusq_kF2TA

http://www.ricera10.com/wordpress/?p=2516

http://conniefan.com/tutorials-labs-from-computer-systems.html

http://www.cs.rochester.edu/u/scott/252/assignments/A3.shtml

 ------------------------------------------------------------------------------------------------------------------------


Monday, June 4, 2012

Tackling Ubuntu installs for dv6 users - part 1

In the last 6 months, I've seen a lot of people buying HP dv6 laptops. HP has had a bad reputation with laptop buyers with all the heating problems and other issues, but it seems to have hit the bulls eye with the newer dv6s. Newer models arrive frequently, and are quite a bit of improvement over the older ones. The dv6 6012tx, for example, made a major leap in sound quality, and I would rate its sound almost as good as the XPS's famed JBL speakers (yep, it's that good). With all the hardware improvements, care packs (extended warranty packs) that cost half as much as Dell's, and a much sleeker profile, the dv6 has emerged as a solid alternative to the XPS.

(PS: I can't vouch for HP's warranty quality, but I know for a fact that Dell's is downright awesome. They are more than happy to change parts, whatever the reason for failure be. However, seeing that I spilled lassi on my lappy's keyboard, causing 4-5 keys to stop functioning, a review on HP's after-sales service will be up shortly). The only thing that disappoints me in the newer dv6 7000 series is the switch from AMD Radeon 6770M in the i7 model to nvidia 630M. Granted, nvidia's switchable graphics implementation (called Optimus) is much better than AMD's. Getting AMD cards to switch smoothly can be a pain in Linux, which is what this post is all about. But the 6770M is a solid mid-end graphics card, ranking 82nd on notebookcheck's mobile graphics rank lists, whereas the 630M is decidedly mainstream at a rank of around 112.

Anyway, if you are a new dv6 user who plans to install Ubuntu, you'll have a fair share of problems, more than XPS users anyway.

First, you'll have to deal with HP's ABSOLUTELY HORRIBLY HORRENDOUSLY (DIE, YOU PARTITION SCHEME DESIGNING BITCH AT HP!!!) CRAPPY partitioning scheme. HP saves the average noob the trouble of evaluating a different OS, because he won't be able to make an informed choice on how to re-partition his system. Here's HP's partitioning scheme found on all dv6s. It consists of four primary partitions (which is the maximum number of primary partitions allowed on a hard drive).

1. (<100 MB) Bootloader partition - This one contains files required by Windows at the time of boot.
2. Windows partition - it contains the Windows install and most of the empty hard disk space.
3. (~14GB) Windows recovery partition - it contains files needed to restore Windows to a factory state in case you've screwed up with your current install. It can also be used to create recovery DVDs (only one set of such DVDs can be made).
4. HP_TOOLS (<100MB) - This partition is required if you need to upgrade the BIOS. If you download and run the BIOS setup from HP website, it places new files in this partition, and these files are detected by the OS on restart.

If you want to install another OS, you need to get rid of one of these partitions, since there is a limit of four primary partitions per hard drive.

In my opinion, the HP_TOOLS is the most expendable since it's easy to restore it in case a newer version of the BIOS with some major feature is released. First, make sure you've installed the latest BIOS available on the website, and then you can remove this drive. Some people prefer to create recovery DVDs and then remove the recovery partition, but I don't trust optical disks. IMO, they're too fragile and prone to environmental factors. Plus, the convenience of having a recovery partition on the hard disk in unmatched. Although, you can not combine the 100MB you gained by removing HP_TOOLS with the space recovered by shrinking the Windows partition. Which means that that 100 MB as good as gone, small price to pay for the freedom to install any OS.

Anyway, you can then shrink the Windows partition by some suitable amount - I prefer about 40GB for Ubuntu. I also suggest that you mount /home and / on separate logical partitions. It comes in handy when you're testing multiple distros. After that, it's quite easy - installing Linux is a breeze once you figure out the partitioning scheme, even if tweaking it to get all hardware working is not.

That's it for this post. In the next post, I'll outline how to switch off that darned discrete GPU by installing the fglrx driver.

Sunday, May 13, 2012

youtube-dl - a CLI script for downloading streaming videos

Yes, I've been lazy and negligent about updating this blog, but then, that's the story of personal blogs worldwide.

Anyway, this one's gonna be short and quick. I just found out a Python-based script youtube-dl to download youtube (and other supported) videos via command line.

You can get it here:

http://rg3.github.com/youtube-dl/

The syntax is pretty simple, once you have added executable permissions to the script (requires Python 2.5 or newer):

./youtube-dl <Web URL here>

Or you can check your official repositories for a package called 'youtube-dl'.

There're a plenty of tools/addons/websites available online, and most of my batchmates have their own versions of youtube downloaders to their credit, so why this post?

1. Apparently, with browser/OS/whatever updates, the older method of copying the streamed video from the file descriptors (/proc/*/fd/*) doesn't work.

2. This thing does not use the 'saving streamed content' concept. It *somehow* obtains a download link by itself. And it's written purely in Python. Understanding how it works could help you in clearing a lot of concepts. (Fair warning though: it's a 4500 line code, and most of the modules used are unheard of, to me. This one's not for the weak at heart.)

3. If you just wanted a method to get it done, and are least interested about the inner workings of such utilities, I'm sorry - you're looking at the wrong blog.

Tuesday, December 6, 2011

Plans and dreams

There was a time when I thought no ordeal could be as taxing as hearing Rebbecca Black singing (Justin Beiber came very close). I was naive.

My college loves its Humanities. The people here believe that making kids go through weird and complex moral science stuff, where most of them are - if not physically - mentally asleep is supposed to help them in later life. And at the end of first sem, you have a hardcore 4 day/36 hours Jeevan Vidya camp which is basically a crash course on the "weird and complex moral science course". One thing's for sure, the topics discussed, their absolute irrelevance, the mental exhaustion that accompanies them, the lack of sufficient time to have fun just after end-sems, seems like the type of thing Kingfisher would sponsor to get students drinking. (Well, you can't find Vijay Mallya for plotting evil schemes to get his babes, he already has a hard time maintaining his planes).

On a more relevant note, I have plans for two projects I hope to execute in near future. A portable USB charger, and a notebook cooler (both DIY, d-uh).

For the uninitiated, DIY means Do it Yourselves. DIYers believe in trying to do their stuff themselves before handing it over to professionals. If you can't figure out what's the fun in that, it's probably not for you.

None of the devices mentioned require any extreme engineering. Equipment, maybe. Lack of which may prevent me from actually implementing them.

The portable USB charger would run of batteries and charge any USB powered device. No biggie - just connect a 9V battery to a 7805 and connect the output to a female USB port. You could add capacitors to both the input and output to handle any spikes that may occur. Problem? A 9V battery can't deliver a lot of current - barely enough to keep the battery level constant. And I have a feeling that it won't be very sufficient - a 500 mAh battery would only charge 1/3rd of my phone and then drain itself. Still a handy accessory, I suppose.

The laptop cooler project is also pretty simple. I've been feeling the need for one when I put my lappy through heavy workload - gaming being one of them. I just need to get 2 fans that run off 5V and join them to an acrylic sheet. The power comes from USB ports.  Lock and load. Problem? I don't have a Dremel. Again, for the noobs, Dremel is the god tool for any kind of DIY/modding. In one line:-

Grinder : Super Food Processor :: Drill : Dremel

It's expensive too. Last time I checked, it started from 4k, and has a lot of accessories available which seriously affect your wallet.

I also learned some things about game ripping from a friend of mine - Nehal. He created a game rip in Class 9! Beyond awesome. Turns out it just involves re-encoding the audio files to ogg and reducing the bit rates and compressing them. You create a batch file that automatically reverses the process which you call your setup file. And it produces pretty awesome compression results too. And I've been told that the difference between sound qualities of the original and compressed audio files is barely audible. Of course, this only works for games which do not use proprietary formats/advanced protection techniques. UHARC is the most popular and a very powerful compression tool. Command line version FTW. You also need to have a good understanding of Windows Command line scripting. I hope to try out a game in a day or two.

Hopefully, by the next, or the next-to-next post I'll have something more concrete than wild theories and plans. See ya around.

PS: Two days to train, and 4 days to home. Hurray!!! Can't wait to drive the PB**AE-5**6 (My Activa). I also plan to buy skates (confused between roller and inline). Any advice? Leave in the comments below.

Wednesday, November 30, 2011

Of tablets and gates

Good Mornin', fine folks. It's 6 am and I'm awake. Wide awake.

I've been seeing a lot of 6 ams lately. Not because I wake up early, but became it's usually the time I sleep. Not today, I have a DLP exam in 3 hours - and I'm hungry as well. One of the bad things about IIIT is the lack of eating options from 2 am to 12 pm, excluding the morning breakfast.

Anyway, since this blog is supposed to be more tech-oriented than a personal diary rant, I'll talk about the Aakash tablet in this post. We had Prof. Vijay from IIT Rajasthan visiting the institute yesterday. He gave a brief introduction of the tablet (which I missed, thanks to me assuming that events in IIIT will be their usual unpunctual self, and reached 30 minutes late). And then there was a hands on demo. I couldn't lay my hands on the device.

I did, however, stay for 30 minutes after I came, and observed. The tablet hardware is nothing to write home about, a 350 Mhz Conexant processor, a 840x400px screen and other standard stuff - nothing amazing. What's amazing is that they managed to produce these devices for ~Rs. 2,000. That's one-fifth the price of the cheapest tablet I know of, the Kindle Fire. The government isn't wrong in prioritizing arming citizens with productive tools over a Super AMOLED+ screen. If you're keen to know - the touch was pretty basic (resistive) and the screen looked somewhat washed out.

From what I saw and heard, the professor who came for the demo wasn't very well-versed with the tablet and it's development. I'd have loved to ask him if the tablet would allow me to play with custom ROMs, but he didn't seem the right kind of guy to ask. Let's hope Koush and other fine folks at xda-developers get interested in this device and at-least, figure out how to unlock the bootloader. I love playing around with my Nexus S - it's currently running on a custom ROM, Cyanogen Mod 7.1 - but for a newb like me, risking a 20k phone is pretty scary.

That reminds me, I'll put up a blog post on rooting my Nexus S sometime soon. I know I promise a lot that I fail to deliver, but my end-semester exams are almost over (the last exam is Computer Programming, and there's not a lot to study in it).

Wish me luck. Good day!

EDIT: I also had some thoughts on startups I want to share - I saw the guys from MyDrona (a IIIT startup) talking to the prof after the interaction. Maybe sometime later. :). This was more of a personal reminder.

PS: Don't count on the specs and stats used in this post to be accurate. This is not a news report. They're approximate enough to convey the feeling/idea.

Sunday, November 6, 2011

The Customary Introductory Post

Hi!

Welcome to Bit Mechanics! Your one-stop blog for err...nothing? Umm, yeah - I'm not exactly sure what I plan to post here. Probably just the regular stuff. Anyway - (I'm the kind that gets pissed off if you use anyways, or wierd or....let's save this for another post.) - here's something about me.

My name's Ankush Jain. I'm a 17 year old guy from Patiala, Punjab, India, a state with the maximum wannabe-hippie/square km ratio. I'm currently studying Computer Science at IIIT, Hyderabad - an institute with a very specific focus on Information Technology.

I love all things tech, and spend a significant percent of free time doing various stuff on my lappy. It's a HP dv6-6165tx with i7-2670QM 2.2GHz processor, Radeon 6770M GPU and 4 gigs of DDR3 RAM. And, it's a huge-huge upgrade from my ex-PC (I loved that box, but it was time to move on) with its AMD Athlon 2400+ processor, onboard graphics, 1 gig of DDR1 RAM, which now lies at my home, hardly unused.

I'm also a movie buff, music buff and food buff. And books buff. That seems like a lot of buffs, but trust me, there's a lot I don't like. Like animals. And insects - especially insects. And sports. It's impossible to suck at sports more than I do. This one year, I was supposed to play volleyball at school for a whole year, and the number of times I managed to contact the ball is limited to three. We actually had a celebration the first time I hit it (my classmates didn't mind me having in a team, except that I was picked last). Not that I mind. Sure, sports gets you a lot of girl(friend)s, and I've been lacking in that department, but all it is is crazy people chasing balls.

I've been called everything from an asshole to a real-life version of Sheldon Cooper to cute [;)], so that's a pretty wide spectrum. I'm sure that this blog's (yet imaginary) readers will figure me out. :)

PS: Wait up for the next post, which will probably be on my lappy - why I bought it, and the challenges I faced (and am facing) while installing Linux on it, and stuff like that. As Barney Stinson would say, it's gonna be LEGEND..... - wait for it - .....DDDDARY!