Rss

Archives for : May2011

Better security on Windows 7

Continuing my theme of setting up my new laptop that I blogged about the other day, a few thoughts came to mind when thinking of how to best protect it from a security standpoint.

First thing that I thought of is theft. I actually have lost a laptop before (granted, I was a bit careless,) so the thought of been able to track down a missing laptop does sound appealing. The laptop I got supports LoJack for Laptops in the BIOS, and as far as I can see, it is the best solution. Whilst I haven’t got it yet (it’s proving difficult to get in Australia,) I do plan on getting a subscription.

The second thing that I thought of, and is related to the first point, is the security of my data. Whilst I am only a Uni student, I’d still rather people don’t go through my stuff. So, what I eventually decided to do was create a TrueCrypt volume that get’s mounted when I logon, and move my Dropbox to that volume. You need to do a few things to get this to work properly (including make sure Dropbox doesn’t launch before the volume is mounted.) Lifehacker has a nice guide on how to do this.

After I added the encryption, I decided to actually remove my Windows password. Why? Well, I’ve already got one password protecting my data, which is a lot better than Windows password anyway (which can be removed with a bit of know how, so it’s pretty pointless,) and it allows others to use my computer without me been present. Why is this a good thing? Well, if it does get stolen, LoJack relies on it been connected to the Internet to find out where it is, having the encryption password is the best of both worlds: it’s easier for potential thieves to access the Internet (which increases my chances of getting the laptop back,) and it protects my data a million times better than Windows could ever hope for (also important to note: I don’t save passwords, or stay logged in, in my browser, I use KeePass or that, which is encrypted too, so I’m not worried about them getting into m account). So, I’m pretty much keeping my software install to an absolute minimum, just a web browser, Office, and any other small, but useful things that I need to function.

Though this method doesn’t come without problems. The problem that I can see with letting people login is that it’s one less barrier to, say, installing a key logger on my computer and getting my encryption password. (As that’s all the Windows password really is, just another barrier that makes it more annoying, rather than actually secure.) The problem I can see with auto mounting TrueCrypt volume is it will be mounted when you wake your computer up from sleep (not sure about hibernation, but I presume it’s the same, I normally use sleep.) This means that, if your computer is lost whilst it’s sleeping, your data is vulnerable even more, because there’s nothing protecting it. As for a solution to the first issue: only let people you trust use your computer, and regularly scan it for malware. As for the second issue, for now I’m shutting down my computer (a bit inconvenient, but with minimal software installed, it’s not too bad,) and I’m looking into a way to demount it when it sleeps (though I doubt there’s time to run an action when it sleeps: the second best is to run a script when it wakes up, which isn’t as secure, but still better than nothing.)

UNIX Programming in C: Using fork(), exit() and wait()

Today I had a tutorial task due, and part of it involved using the fork() command to create a child process, wait() for it in the parent, and exit() the child process when necessary, and pass a value back to the parent process.

I thought to myself that this would be pretty easy, all I needed to do was pass a pointer to the wait() function, and when exit() is called from the child, the value passed to exit would be passed to the pointer I specified in the wait() function. Turns out I was close, but not quite. Whilst I’m sure it exists, I didn’t find much material online, I actually had to find the answer in my text book (who does THAT these days?)


A sample of what I was trying to do is:

wrong.c

#include
#include
#include


int child();


main()
{
int fork_result , result;

fork_result = fork();

// If this is true, it’s the child process
if ( !fork_result )
exit ( child() );

// If it gets to here, it’s the parent process
// Wait for the child process to end, and put the
// result in the variable result
wait ( &result );

printf ( “Result from the child: %d\n”, result ); // Should be 5
}


int child()
{
// Run the child process here
sleep ( 10 );
return 5;
}

Pretty much, what we want this program to do is wait 10 seconds and then print out:

Result from the child: 5

Unfortunately, that’s not what we get. It does wait 10 seconds, but the result is:

Result from child: 1280

What could it possibly be? At first I thought that it’d be the PID, but it remains consistent. On my computer, that number is always the one that is output. Where does it come from? How can I get the result I expected?

The answers simple, but annoying. The integer contains more than just the result that we wanted to pass back. Let’s have a look at in binary to see if we can see where 5 is.

1280(dec) = 0000010100000000(bin)

This is “supposed” to contain extra information in the first 8 bits (remember, you start counting form the right, so the “first” bit is the far right), apparently it doesn’t in this case though. So, where do the number 5 come in? Well, it starts at the 8th bit from the left. Below I have highlighted the starting position in bold:

1280(dec) = 0000010100000000(bin)

As it would turn out, 101(bin) is 5(dec). So, how do we extract? We could mask the bit’s and use a bitwise AND operator, or we can simply shift the bits 8 to the right. Doing this will shaft the far 8 bits on the right hand side off, and make the 8th bit the 1st bit. It will turn it into

0000000000000101(bin)

Which happens to be 5(dec), which is exactly what we want!

So, how do we do this in C? Just put the following code in before you want to use the result (even better, put it in just after you obtain the result)

result = result >> 8;

(If you want to get other information from result, you may not want to put it back in itself. Make another variable so you can keep result to extract other information later on if needed. If you don’t, then I don’t see any problem doing this)

So, our code will look something like this:

right.c

#include
#include
#include


int child();


main()
{
int fork_result , result;

fork_result = fork();

// If this is true, it’s the child process
if ( !fork_result )
exit ( child() );

// If it gets to here, it’s the parent process
// Wait for the child process to end, and put the
// result in the variable result
wait ( &result );

// Get the result code
result = result >> 8;

printf ( “Result from the child: %d\n”, result ); // Should be 5
}


int child()
{
// Run the child process here
sleep ( 10 );
return 5;
}

What does it output after 10 seconds? You guessed it:

Result from the child: 5

This is what we want.

If you are interested in finding out what the other bits mean (you know, the first 8 bits,) I would highly recommended reading “Understanding Unix/Linux Programing: A Guide to Theory and Practice” by Bruce Molay. One of the best textbooks I’ve used in my course. The specific page with this code on it is 270, though reading the whole chapter to make sense of it all is probably advisable.

IntelliJ IDEA Java IDE: First Impressions

Edit: See the first comment in the comments section. These were first impressions, but as it turns out, they weren’t unique to IntelliJ, so they’re not really fair first impressions. When I’ve re-installed Windows, I’ll give IntelliJ another shot disregarding my first impressions.

Edit 2: I tried IntelliJ again on my desktop, and whilst it does take a little while to get used to the interface, it is actually quite good. I used it to finish off my first Android app, Virgin Mobile Usage Australia (it’s probably what gave me the motivation to finish it off.) I also setup a SVN server and I can say it integrates very well. I think I will buy a license after all.

Edit 3: I’m sick of editing this post with updates, so I wrote a new post (though it’s already got an edit… I love editing posts!). Check out my second impressions.

With a new computer, one of the first things I always do is go ahead and download all the programs that I’d generally need. As I do some Java development, I would normally download Eclipse, though whilst looking around, I stumbled upon IntelliJ IDEA, which some people have seemed to indicate is the absolute best Java IDE, better than Eclipse by a long way.

Now, I’ll start by saying I’m not a fanboy of any Java IDE… I used Eclipse because it was what I knew, and it worked. I am definitely open to changing if it will make my development more efficient.

So, when I finally downloaded it on my throttled connection, I launched it and tried to import a project I had already made. I had just plain java source files in Dropbox, rather than a whole project. Importing it was harder than I expected. Copying it into the source directory is a nice addition that Eclipse doesn’t support, but when I opened IntelliJ, the source files hadn’t appeared. I finally worked out I needed to make the package that these source files were all apart of in order to successfully add them. It would have been nice if it automatically made them, especially since it doesn’t have an import option (which isn’t a problem, if drag and dropping them doesn’t work.)

So, I got that project up in IntelliJ. It took me a little while to get it compiled, as whilst I appreciate that you have heaps more options for compiling, it doesn’t help when you actually don’t know how to use them. So I did work it out, and finally got it compiled. Well, all I can say is, that in IntelliJ, I get an exception that I don’t get in Eclipse. I don’t know what it is, nor have I found a fix for it. I’m still looking.

So, unable to successfully use my current project, I thought I’d make a test project from scratch. It was simply called “TestProject,” I made a package called “main,” and within it made a class called “test.java” with a main() function. When trying to run it, I have to chose a configuration. When choosing a configuration though, I need to chose a “main” class. I selected my test class, but a message comes up saying that “test is not acceptable,” which means I sort of can’t run my application.

So, it would seem, first impressions of IntelliJ are poor. Of course, they could just be me, but I have read through the help documentation to try and understand specific ways I need to do things, and also looked online for understanding IntelliJ for Eclipse users. Whilst I’m still going to try to keep using IntelliJ, as I definitely want to be able to improve my coding efficiency dramatically, if I can’t get it working, I’m not going to go out and buy it then.

Asus U31F Review

Today I took the plunge and bought a new laptop. With limited funds, it really came down to how much benefit would it be verses how much I’m willing to spend. I really wanted an ultra-portable (though not a netbook,) as my old laptop was quite large and weighed 3kg with the power supply, and I also wanted the battery to last (power points at Uni are at a premium.) In the past week or so, I’ve really been noticing the strain in my back of carrying my laptop around in a messenger bag, so I figured for that alone it’s worth getting a laptop that’s over a kilo lighter (it all adds up.)

After looking around online, I finally settled on the ASUS U31F, a 13.3 inch LED screen, supposedly less than an inch thick, only 1.8kg and 10 hours battery (at best.) I have always trusted ASUS when it comes to hardware quality, and when it comes to this laptop, they certainly don’t disappoint.


Hardware



So, firstly, the overall build quality on this laptop is excellent. Definitely the quality that I expected from ASUS. The keyboard feels really nice, the lid is nice and sturdy, and the screen is excellent. Definitely a vast improvement on my previous laptop (though, admittedly, that’s not that hard.)

I think 13.3 inch is the sweet spot between portability and productivity: I could barely do any Uni work on an Eee PC, but a 15 inch or 17 inch is just too big to carry around. It does come at a cost: no optical drive. These days, that is a lot easier to get away with. Most software is been distributed online instead of by disk, and it’s possible to use an optical drive from another computer over the network to install products (and if you don’t have another computer, external drives are relatively cheap, and you can leave it at home when you’re not using it). The only area I can see this been a potential issue is when you want to use the laptop for entertainment, you’re definitely more restricted with what you can do (no DVDs on the go, which can be useful in laptops sometimes.) For me though, if I’m likely to want to watch a DVD, I’ll take a rip of it on my main computer and transfer it over. With a 500GB HDD, it can get away with that.

I’m not as much into audio as some people, so I am cautious when commenting on the speakers. Everything I say here, in your mind append the phrase “for laptop speakers” at the end of everything. For what I’ve used them for (just music so far,) they seem pretty decent when you consider that. They can also get quite loud, which could be handy for small presentations that require video. So to sum it up, out of all my laptops I’ve had (3 laptops,) they are the best I’ve used, but the ones in my other laptops weren’t that great.

As for performance, it’s got an i5 processor with 4 gigs of ram by default, so it can definitely handle all every day tasks without any problems what so ever. It only has Intel graphics, but I also didn’t buy it to play games, so if you’re not planning on playing games, that’s not going to be a problem at all.

Software
Here comes the ugly side. I really wish that hardware vendors would start taking a real interest in the overall use experience of pre-loaded software. Rather what I see is a standard package, and a large standard package at that, of programs that just get dumped on the computer and just left there. Whilst I’m sure they are tested, they don’t seem to get tested very well.

I booted it up at first and it went through the standard setup account in Windows, which was all good, nothing wrong there. It’s when the computer restarted and logged in that it turned sour.

So, to get it started, when I logged in, a popup just above the task bar came up asking me to create a backup disk for Windows. Quite a standard practice these days in laptops, they don’t have to spend money shipping a disk for you. The problem with this is, as mentioned above, the laptop doesn’t come with an optical drive. I thought I’d go through the process to see what it asked me to do. The first thing it asked me to do was to get a blank DVD ready. So I did… not sure what I was to do with it, but I had it ready! Upon clicking next, an error came up promptly reminding me that there’s no optical drive and that it can’t continue. Seriously? Why on earth did this piece of software end up on the computer if it can’t even function in it’s default configuration (and really, whose going to have an external drive plugged in when they first use their computer?) Also, how much do companies really save by not shipping installation disks? 20 cents a disk? The laptop actually did come with a driver disk, why not throw in a Windows disk as well and forget about having to burn it yourself.

So after failing to burn the disk from the lack of optical drive, I proceeded to do the first thing I always do on new computers from a major manufacturer: head to uninstall programs and, well, uninstall pretty much everything that wasn’t a driver or seemed rather important for system functionality. Sadly, it was quite a long list that I removed. About 10 different games from the same company, Trend Micro (I already have a subscription for ESET, and if I didn’t, I’d use Microsoft Security Essentials,) and believe it or not, CyberLink “Power2Go.” I actually wasn’t sure what Power2Go was when I first saw it, so I thought I’d try and launch it before I removed it… it actually didn’t launch, instead came up with a DLL error. I quickly Googled to check out what it was, and turns out it’s burning software. Remember what I said about the lack of optical drive? Again, seriously Asus, why was this even installed?

After removing everything that I didn’t want, I wanted to go and install programs I did want (such as Google Chrome.) Turns out that Chrome was pre-installed, so I thought I’d launch it and update it from within the browser, as it was an old version. Well, I can tell you that it didn’t launch. I tried a few times, and it just didn’t come up. So I downloaded the newest version maually and installed it hoping that it’d over write the old version and update it, but instead I ended up with 2 versions of Chrome installed at once, which isn’t exactly what I want. So I went to uninstall the old version (easily identifiable thanks to the Chrome logo change,) but the uninstaller didn’t launch either. Great, now I need to remove it manually and be left with a computer less than day old already building up stray registry entries.

And now, again a software issue, the function keys don’t work. I don’t think it had anything to do with uninstalling software, as I left all the Asus software in place (I may go and remove some later, but for now I didn’t want to accidentally remove anything important, such as power management software, as that’s what get’s it 10 hours.) And even if I did remove the software for function keys, on most computers, basic ones such as volume, will still work. I’ll look into it further, but I shouldn’t have to: my volume keys should just work.

So, I’ve gone from been prompted to do something that can’t be done with the default configuration of this computer, to 10 pre-loaded junk games, 2 programs that were broken (and one shouldn’t have even been there at all,) to function keys that don’t work. Not really the best user experience possible. I have blogged before about Apple’s marketing, and I can start to see the appeal in Apple products. Whilst I’m not personally likely to buy a Mac for my own use, Apple have complete control over both hardware and software, and actually work hard to make the overall experience a nice one. I wouldn’t have minded paying a little more for this laptop to not have bloatware (which I do realise reduces the price of the computer some what) and having a nice polished operating system when I booted it up. Windows 7 is actually nice and polished to begin with, I would have thought it’d be easier for them to leave it be and only install essential stuff rather than actually make it worse. So, a message to major manufacturers: Step up your game, people are paying a premium for Apple products without all the bloat, no harm upping the price by $50 to not have bloatware on your computers.

Battery Life
I haven’t yet had a chance to fully test the battery life. So far it’s definitely better than what I’m used to, but can it live up to the 10 hours it claims? I’m going to write a program to run on the computer and write to a text file every 10 minutes, leave it in battery saving mode with wireless tuned off (but I’ll leave the screen turned on,) and see how long it can last. In theory, it should last almost 10 hours. When on full charge, with wireless turned on, Windows estimates 7.5 hours. I’ll do a seperate test with wireless as well later.

I haven’t had a chance to do a proper run down test without using it, but really, does that offer good results? I think the best results come from using it, which I have done, and for general usage, you can expect around 7 hours with wireless on.

Overall
Even after an eventful run in with software issues, I’d still recommended this laptop. Software issues can be fixed, possibly with a complete re-install from vanilla Windows (which I’m still debating, as I’ll need to source an external optical drive, and ensure that I install the right utilities to get power management working proper,) but I’m also a the “tech guy” so to speak, so I’m happy to do that. Good thing for Asus that the build quality is good enough that it makes up for a poor user experience on the software front at first.

Additional Notes (Edit)
The exact model that I’m using is the “RX132V” model. This is the one that DSE and JB-Hi Fi sells, and doesn’t come with Bluetooth (and only comes with Windows 7 Home Premium.) There is another model available for sale, the “RX112X” model. As far as I can tell, they are identical except the latter model comes with Bluetooth and Windows 7 Professional. It’s also interesting to note that the DSE website says 6-cell: I bought mine at DSE and it’s an 8 cell battery. That’s not to say that if you order it online it will be 8-cell, but it could possibly be a typo, so check in store.