Recently in Computing Category

Blocking "Domain Smacks" in Apache

| No Comments | No TrackBacks

Recently, some intrepid person decided to buy uwrejects.com and have it show Washington State University’s website. Frankly, I thought it was pretty amusing, but there were a fair number of concern by certain excecutives at the institution. However, it did seem to remind me of the concept, of the “Domain Smack”

Alright, sorry for the ad (I’m not even getting paid for that), but it explains what the hell a domain smack is.

So, what do you do when some jokester decides to domain smack you, and you (or your boss) is really concerned with it? Just a few rules with modrewrite, and you’ll be fine, on Apache at least. IIS and other servers can do this as well, and IIS can even import Apache modrewrite rules easily.

The syntax is fairly straightforward. Turn the RewriteEngine on (if you haven’t used it yet in the .htaccess file), check the Referer header (which is misspelled in the specification) for the smackingdomain, then rewrite ANY URL (the .+) to either return forbidden or redirect back at whomever has decided to make fun of you.

At the end of the day, WSU is seriously considering doing nothing. Which is good, because it’s better to have a sense of humour about such things. However, good mastery of conditional URL Rewriting rules are good to have, and I’ll probably do some more advanced stuff with it later, since the documentation lacks a lot of examples which could be really nice to play with.

Hacking MSTest out of Visual Studio

| No Comments | No TrackBacks

For a while, we’ve been using Hudson as our Continuous Integration server for a while now, but we had a problem where the unit tests we had written were all in MSTest. However, MSTest doesn’t like to be installed without all of Visual Studio. Luckily, Mark Kharitonov at Shunra has figured it out and written up a post about it. I’ll only note two things I had to do to make his solution work:

  1. I had to add the VS2008Stub\Common7\IDE folder to the global PATH so that mstest.exe could be found (and restart Hudson so Hudson would update it’s PATH)
  2. Hack MSTest to allow me to use the /testmetadata and /testlist options.

I had to do #2, because the MSTest plugin for hudson seems to only want a single TRX file, which would have required me writing a bunch of MSBuild stuff I didn’t feel up to writing so that MSTest would run once for the entire build, instead of once per Test DLL file. By using the /testmetadata option, I can set up a vsmdi file and tell it which tests to run, which also provides me the added benefit of disabling certain tests that I might not want to run for some reason or another. In my case, I had a few tests that went against the database that really need to be rebuilt using a Mocking framework. They can’t run on the CI server (the CI server doesn’t have access to the Database), but they have some mild use currently on my local machine, so I don’t want to simply exclude them.

Anyway, MSTest, it turns out, actually checks your Visual Studio license to determine how it should function. Basically, it offers a few more options if you have a Visual Studio license, and a few more options if you have a Team System license. We don’t have Team System (or we’d probably be using Team Build anyway), but we do have Visual Studio licenses. Of course, they don’t tell you that the binary does different things based on a registry key, that’s what my good friend .NET Reflector is for.

Due to the fact that Reflector actually displays disassembled code, code I didn’t write, and I sure don’t have permission to redistribute, I’m going to gloss over what exactly I did to figure out what to do in the next paragraph. I’ll likely put together a new post in the future about hacking .NET using Reflector, but it will be on non-encumbered code.

It turns out there are five special codes that MSTest looks for to enable or disable features, namely the Test List Editor (what I was interested in), Team Developer Tools, Tfs Integration, Remote Execution, and Authoring Non Core Tests. I’m not entirely sure what those last four are (though I plan to investigate), since as I said, I only really need the first one. Interestingly enough, the way they’ve implemented this security, it’s a pretty simple hack to enable the ones that you aren’t licensed to use. Which wouldn’t be the right thing to do, which is why I’m not providing those codes, or even the actual location of the codes you shouldn’t have, to you, my reader. I’m covering my own ass.

Open up Regedit on your development box, and point it to HKLM\SOFTWARE\Microsoft\VisualStudio\9.0\Licenses, and you’ll see a list of keys (probably only one, but it could be more than one). Export the keys you see under this hive, and then import them into your CI server, and it should automagically unlock the features you were missing on CI, check the /help output to be sure. Note: On a 64-bit system, the Hive is HKLM\Software\Wow6432Node\Microsoft\VisualStudio\9.0\Licenses. Just make sure you export and import to and from the correct location, if there is a difference in bit-width between your two boxes.

Now, you should have all the MSTest features you had on your development box on your CI box, and you didn’t have to do a full install of Visual Studio in CI.

Copying Files out of the Windows GAC

| No Comments | No TrackBacks

Sometimes you need to get a file out of the GAC on Windows, either to look at in someting like .NET Reflector, or maybe to copy a DLL (licensed, of course) to a server when you don’t need (or want) all the other cruft that the installer might drop on the box. I’m not going to judge.

GAC View in Windows Explorer

The GAC can be viewed on a Windows box by heading pointing Explorer to %windir%\assembly, but Explorer abstracts that folder away so that you can only do limited things with items in the GAC. They’ve even gone so far as to make it impossible using any of the GUI filesystem tools in Windows to navigate into the subfolder heirarchy. So, when faced with a GUI that just won’t cooperate, I turn to my trusty friend, the command line.

GAC Directory Structure from Command Prompt

Now, I can see the structure of the files that I’m looking for, and if I look back at the Explorer view, it even provides me clues on where to look. For instance, the fifth column, Processor Architecture, tells me which GAC_ folder I need to look in. For me, I’m almost always interested in GACMSIL. Once in that folder, there is a new folder for each unqiue entry in the Assembly Name column for the given Architecture, followed by a group of folders following the naming scheme {Version}_{PublicKeyToken} (that’s two underscores between Version and Public Key Token). Inside of this last folder, is my DLL, which I can copy out to another location.

For instance, System.Core, the core DLL for .NET that everyone has anyway, can be found at: %windir%\assembly\GACMSIL\System.Core\3.5.0.0_b77a5c561934e089\System.Core.dll

GAC Directory Drilldown from Command Prompt

Now that you know how to find the files, it’s trivial to copy them to wherever you need to, for whatever you’re looking to do. Of course, if you use this to break a license or anything else shitty, it’s not my fault.

BackTrack4 SD Card with Asus Eee PC

| No Comments | No TrackBacks

I’ve been watching Hak5 since it hit Revision3 last year, and I’ve generally enjoyed the show. Recently, host Darren Kitchen talked about creating a persistent Backtrack boot-able flash device. Since I’d be using this with my EeePC (or another laptop), I decided that the idea of running an OS off a thumb drive for any period of time was scary, so I decided to go the SD Card route.

Unfortunately, Revision 3 doesn’t provide good show notes for how this was done, Hak5.org is down, and Backtrack’s own page on a persistent USB drive is completely empty. The provided content is taken almost verbatim from Darren’s presentation on the linked video above, and I’ll embed the video after the instructions. I just felt that a write-up would be convenient.

  1. Download the Backtrack4 ISO
  2. Set up bootable media with Backtrack, either burn a CD, or a thumb drive using unetbootin
  3. Boot BT4, put your SD Card in your computer and find out what device it mounted as. Enter dmesg | grep hd.\|sd. at the command prompt, the bottom entries will likely be the correct ones. On my system, it was /dev/sdc so that’s what I use.
  4. Run parted /dev/sdc (I vary from Darren on this)
  5. Type print at the command prompt, odds are you’ll have 1 partition. Delete all the numbered partitions with the rm command.
  6. Create the first filesystem with mkpartfs primary fat32 0 2.5GB This will create a two and a half gigabyte, fat32 partition as your main data store.
  7. Make Partition 1 bootable with set 1 boot on
  8. Create Partition 2 with mkpart primary ext3 2.5GB 100%. This will fill the rest of the device with a empty partition. I used an 8GB drive, but the 100% will fill the rest of the drive.
  9. Exit parted with quit
  10. Run mkfs.ext3 -b 4096 -L casper-rw /dev/sdc to create the persistent area on the storage.
  11. Run mkdir /mnt/sdc1
  12. Run mount /dev/sdc1 /mnt/sdc1 to mount the first partition you created.
  13. Run rsync -r /media/cdrom0/ /mnt/sdc1 to copy all the files from the boot media to the boot partition. This will take some time.
  14. Rum grub-install --no-floppy --root-directory=/dev/sdc1 /dev/sdc to install grub on your sd card.
  15. Edit /mnt/sdc1/boot/grub/menu.lst in your favorite editor
  16. Change the line ‘default 0’ to ‘default 4’ to load in persistent mode by default.
  17. To the end of the kernel line for the Persistent Live CD option, add ‘vga=0x317’
  18. Shutdown and reboot.

EeePC Notes:

  1. My EeePC is an original 8G, meaning that it’s running a Celeron M, not an Atom, and it has the smaller (6”) screen.
  2. To select your boot device from the Eee PC Menu, hit the ESC key when the system starts to boot (these things boot fast, so hit it quick) and choose the ‘USB2.0CardReader’ option to boot from SD. If you’re booting from a thumbdrive and your thumbdrive has a U3 partition, odds are you’ll want the first one on the list. If it refuses to boot it, reboot and try the other.
  3. The system is currently booting into a text console for me, not the GUI. If I want the GUI, I can just type ‘startx’ and it comes right up. I’m trying to solve this issue, and when I do, I’ll update this post.

iPad Thoughts

| No Comments | No TrackBacks

Alright, so I know everyone has heard of the iPad by now, but I thought I’d take a few moments to address the hype.

First off, in the interest of full disclosure, I never had any intention of buying this device, even before the announcement, and I’m much more interested in Android as a platform than iPhone. That said, it’s the reasons I favor Android over iPhone that is behind a fair number of my complaints with the iPad.

At the end of the day, the iPad is nothing more than a giant iPhone. And for a lot of people, that’s all they wanted. Certainly there are experiences that can be realized on the device now that it has the larger display, the e-mail app (at least in landscape mode) was far more interesting. And there are plenty of more apps that will really shine on this display. But, the iPad has some problems that make it not just a non-starter for me, but in my opinion, a completely waste of time for everyone.

  1. First, the lack of Flash support. This even became an issue during the presentation. I’m not a huge fan of Flash, by any means, and I understand why it was left out of the iPhone. But, for a device of this class, it is simply inexcusable. There are thousands of games, videos, and other widgets dependent on Flash, rightly or wrongly. This may well change (I sincerely hope it does), but until then, this is required support. Especially for a device claiming to offer the ultimate browsing experience. At the end of the day, if it can’t run Hulu, it’s a no buy.
  2. Closed app distribution mechanism. Especially since the mechanism that is available is controlled entirely by the whims of one organization, one with a history of poor definition of standards and practices, is inexcusable. Just because Apple doesn’t want it on the iPad, doesn’t mean that I don’t.
  3. Lack of support for development tools. Requiring all developers to be on Mac, specifically one running the latest software, cuts out a huge pool of potential developers.
  4. iPad and iPhone apps are completely separate. Porting an App to iPad isn’t going to require building a completely new application. Yes, the code should port cleanly, but it still leads toward two divergent code bases that is going to require some work to keep in sync, if you intend to continue upgrading the software for both platforms with new functionality. You should simply be able to design new UI, and bind it up. Admittedly, Android can’t do this yet (I don’t think, though Android does have better support for multiple screen sizes).

So, most of those complaints don’t matter to the average user, but they do cement my decision to not be interested in buying this product. It’s unfortunate, because it is nice hardware, but with a device like that, good hardware isn’t enough when there are such fundamental problems with the software.

Chromium OS is not the OS for You and Me

| No Comments | No TrackBacks

Wednesday morning I was looking over my twitter feed and saw a tweet from Scott Hanselman, seeming to complain that Chromium OS was little more than a bootable web browser. Which more than suggested to me that Scott, simply didn’t “get it”.

Chromium OS is being sold to us as nothing more than a bootable browser, because from Google’s perspective, that’s all that most users need. And there is definitely something to that.

I know a lot of users that use their computers as nothing but a gateway to the Internet. They do all their gaming in the browser (usually via something like Facebook), their e-mail is web-based, and they quite literally, have little or no need for anything but a Browser.

Chromium OS is not a geek OS, though. I live in vim, at the command line, and through ssh sessions. For me, Chromium OS is a non-starter, and while I might try it on my Eee PC, possibly contribute, and definitely suggest it for other people, it will never replace Ubuntu for me. And I suspect that Hanselman will never be happy with it either. And that’s fine, Chromium OS wasn’t designed for us.

What Chromium OS does represent is sort of a full-circle attitude toward computing. In the early days, it was all about mainframe computers and dumb terminals. It wasn’t until the late 1970s and early 1980s, when prices on hardware started to drop, and the PC began to enter the home, that people started to question the need for the monolithic computing environments that had persisted until then.

Now, we have the same thing, people want to take their data with them wherever they go, so computing is starting to migrate toward the “cloud”, so that data can always be available. Google does this with any number of services, from GMail to Google Contacts to Picasa and the like. Microsoft is also going down this path of offering monolithic services for users to take advantage of while Microsoft holds their data for them.

More and more, the role of the computer, for many users, is becoming little more than a gateway to the Cloud, and all that sort of user needs is a web browser.

Myself, I don’t believe we’ll ever be completely cloud based, I think it’s more likely that as data density and interfaces get better, we’ll be able to carry all of our data with us, and have it be accessible across everything. But, for this moment, where people are entrusting more and more data to the cloud, Chromium OS is all the OS that a lot of users will need, especially on netbook class devices.

JSON Encoding of .NET Objects

| No Comments | No TrackBacks

For a recent project, it was a user requirement that we be able to save a snapshot of some statistical data on demand. I decided that the best way to do this would be by saving a JSON representation of the data, since I was going to be providing a JavaScript method to render the data, and for comparisons, at a later date. I knew that .NET had a mechanism to convert an object to JSON, because ASP.NET MVC has a JsonResult object that returns data as a JSON string to the client via the browser. However, my Google-Fu failed me, and my searches didn’t return the mechanism to do this.

I’m using .NET 3.5, and I was appalled at the difficulty I was having, especially since ASP.NET AJAX is standard in .NET 3.5. But all I kept finding were items off the list of C# parsers from the json.org. Those libraries and projects are probably fine, but I was trying to avoid adding a new dependency, and again, I knew this had to be possible in core .NET 3.5.

After cracking open the MS-PL source for ASP.NET MVC, I found my answer: The JavaScript Serializer class!

Now, JSON is a data-interchange format that happens to be syntactically compatible for JavaScript, so I think that name sucks, since I’m storing this data as JSON, but fine Microsoft, call it what you will. And using the class is dead simple.

var serializer = new System.Web.Script.Serialization.JavaScriptSerializer();
string json_string = serializer.Serialize(_model.getData());
DataObject obj = serializer.Deserialize<DataObject>(json_string);

I’m not completely happy with this API. My first reaction was that I shouldn’t have to instantiate the JavaScriptSerializer class at all. Apparently this requirement is because I can define a custom JavaScriptTypeResolver to aide the serializer in converting my object to a JSON string, but I would still like to see a Singleton implementation of the JavaScript Serializer that allows me to call the Serialize and Deserialize with the default type resolver, but given that this doesn’t appear to be changing for .NET 4.0, I should probably just get over it.

Apple, AT&T and Platform Control

| No Comments | No TrackBacks

There has been a lot of stink about Apple’s recent decision to deny Google’s official Google Voice app, and the FCC’s subsequent decision to investigate. Apple’s inability to provide consistent guidelines for App approval has been immensely frustrating for both developers and users alike. So much so, that some developer users are simply giving up on the platform altogether.

I’m a firm believer in Open Platforms. It’s why I’m so interested in Android (even though I’m really frustrated with one particular decision from Google regarding the Android Market). However, while I dislike closed platforms, I believe that Apple should be free to create them. Now, Apple’s tendency toward closed platforms in their consumer electronics has turned me off of their computers as well. And I’m not the only one, Cory Doctorow gave an interview to Linux Journal last year where he talked about leaving Apple because of this.

I won’t argue with the fact that the iPhone has a really clean interface, and the user experience model is pretty good. However, I won’t buy one, because Apple maintains such a high level of control. But, since they are controlling the hardware and the software, I don’t have a problem with that. I’m sure they’ll drive their customers to other, more open (though perhaps not quite as good) platforms.

While I don’t begrudge Apple their control, there have been allegations that AT&T was responsible for the app being pulled, and it’s only sensible that AT&T was responsible for the pulling of data tethering apps, which would have allowed you to use iPhone’s data plan from your computer. This, is simply unacceptable to me.

AT&T (of which I am a customer) should not be discriminating. I’ve paid for data? I should be able to do what I want with that data plan, including tethering to my computer, VOIP, or text messages over free services. The telecommunications network is infrastructure, same as electric and water, and it needs to be treated as such. It should be non-discriminatory, and far, far cheaper than it is. To me, this is really the core argument around network neutrality. I believe in network neutrality because I believe that telecommunications has become infrastructure, and it needs to be treated as such, and it’s not.

If the FCC is going to take action against anyone in this mess, I hope they limit it to AT&T, because as the network provider, they’re the ones who’s position is the most far reaching and dangerous. Not to say that Apple shouldn’t be watched. Their position on unlocking is dangerous as well, for all the reasons large portions of the DMCA are frightening.

It’s really unfortunate that the FCC is feeling the need to get involved in this situation, and whatever they do in this situation stands to have far reaching effects. Some outcomes could be good, others, really bad. So, I’m going to be nervously watching this situation.

DRM and eBooks

| No Comments | No TrackBacks

Cory Doctorow (sci-fi author, blogger, and technologist) is a well-known Anti-DRM speaker. He even released a book of his writings on the subject, which is available via a CC-BY-NC-SA download. Now, this book, Content, is one of Doctorow’s that I haven’t bought yet, but that’s largely because I haven’t found it yet (hey, I like to buy books in actual bookstores), but even though I’ve read it, I still plan to buy the book to share, as well as support Mr. Doctorow.

We finally won the DRM war in relation to the Music industry. I can’t think of a single major player in the downloadable music game (except for game-related audio, like Rock Band Downloadable Content) who still uses DRM on any of their downloads. Now, the prices are still high, in my opinion, and the signs are not good in that respect, but the removal of the DRM is a huge win.

But that victory is only one of many that is needed. In the Video industry, you have Hulu trying to stop aggregators like Boxee from replaying their content (which would have still display Hulu ads), you’ve got the BBC using DRM on their iPlayer. But I don’t think that’s the next battle we’re going to win. Video is great, but the people who control the content are, in my opinion, far more stubborn than the Music industry ever was.

Like Doctorow, I believe the next front on this war that’s we’re likely to win is in the Publishing industry. eBooks are starting to become a really big deal. I think a large part of this is due to the fact that for a long time, eBooks simply weren’t convenient. They’re not portable, the displays for reading them were relatively low contrast compared to the printed page, and eyestrain was common. That’s changed in recent years with the advent of the e-ink display which powers (among other things), the Amazon Kindle.

The Kindle is a great piece of technology. Great high-contrast display. It’s light. It’s battery lasts for weeks. And it’s got a built-in cellular modem for over-the-air purchases and updates (all without a monthly fee). However, all these great features are, in my opinion, outshone by one rather ugly feature. It’s DRM. Recently, Amazon disabled the accounts of several users Amazon felt were returning books too often. Not only did this deny the users access to buying new Kindle books, but it also denied them access to already purchased materials that were already on the device. It’s unclear exactly what happened, but it seems likely that these users were downloading content, reading a few pages to decide if they wanted it or not (browsing, essentially) and returning some of it because they decided they weren’t interested at the time.

Now, the returns issue is an interesting one for the digital media world. On the iPhone, it’s almost impossible for a user to ‘return’ an app that they decided they don’t like, while on Android, if I buy an app, I can “return” it to Google within 24 hours. I actually really like how comic publisher iVerse has handled this on Android. Each comic runs about 7-8 MiB, which is a fair amount of the App storage on an Android phone (unfortunately). Due to customer complaints about not being able to have very many comics on their phones (since Apps can’t be stored on the SD Card), iVerse put together an application that allows you to ‘save’ your comics to the SD Card, and read them back using a separate, tiny app.

Of course, with Android’s 24-hour return policy, there was the fear that users would simply download the 99-cent comic, save it to their SD-card and ‘return’ the app, which would not include the content they’d saved out. As a compromise, the iVerse comics disable the save functionality for the first day you purchase them, allowing you to read them to your hearts content, but not letting you save them until you’ve passed your return window. Does this prevent you from reading and returning? No. But it at least prevents on-going access to the media if you do choose to return it. Now, I don’t know how iVerse’s solution to this problem stands up to piracy, and I’ll be investigating that soon, but it shows a reasonable compromise on the part of iVerse.

Back to eBooks, Cory Doctorow recently presented at O’Reilly’s “Tools of Change for Publishing” Conference about why DRM is a bad idea for eBooks. Below, is the embedded video of this presentation.

What I think the takeaway message from Cory’s talk is what he calls Doctorow’s Law:

Anytime someone puts a lock on something you own, against your wishes, and doesn't give you the key; They're not doing it for your benefit.

Ultimately, the DRM companies, who push the idea of piracy are trying really damn hard to lock you, and your customers, into their product. Up until recently, this was my problems with the iPod as a music platform (note: this is stil a problem with the iPod as a video platform). And more and more, the vendors are using this to promote lock-in. I don’t believe Steve Jobs when he says that he never wanted DRM on the iTunes Music Store. iTunes became big because it was easy and provided strong integration with the players, but iTunes was able to stay big because the DRM locked the users into iTunes. And Amazon is today trying to do the same thing with the Kindle. And Audible (an Amazon subsidiary) is doing the same thing with audio books. Don’t fall into this trap.

Doctorow ends his talk reasonably, beseeching the listeners to make sure the choice to use DRM on their content is their choice, and not the vendor they’re working with’s choice. In the end, I think that DRM will always be the wrong decision long term, and the decision to use DRM will always negatively impact my decision to do business with a company. I may still end up doing business with them, but if I can find the same (or at least similar enough) media from a non-DRM provider, I will always go with the non-DRM solution.

Boise Code Camp 2009

| No Comments | No TrackBacks

Boise Code Camp & Tech Fest was this last weekend, and while I didn’t present this year (they had claimed to be full before I put together a presentation), I really enjoyed the presentations, and feel like I was able to contribute, even though I was not a presenter. I attended quite a few sessions, many of which I’ll be talking about in greater detail in the coming weeks here, but I figured I’d give my impression of the event here, before I dive into the technical details.

I’ve only been able to attend three Code Camps in the last few years. Two in Boise, and one is Seattle. Of the two cities, I’ve found that Boise consistently puts on the better events. This isn’t a put-down to Seattle per se. Boise’s event is simply a larger one, and despite it’s size, it’s very well run. However, this year was definitely a shadow of last years event, the economic downturn having (unsurprisingly) significantly reduced the corporate sponsorship of the event.

I attended a variety of sessions on subjects ranging from WPF, to ASP.NET MVC, to Mono, to Map-Reduce, to Android, to Unit Testing. This particular Code Camp is incredibly Microsoft-centric, which is another reason I wish I’d put together a presentation on YUI, git or something similar. Still, I picked up som pretty cool information, which I intend to share here.

We have once again raised the issue of trying to do a Code Camp in Pullman, trying to pull in the Moscow/Pullman crowd, as well as Spokane (which lacks a code-camp of it’s own). It’s an exciting proposition, but we’re unsure how easily we can simply pull the event together. I bring this up here, merely to gauge interest, particularly of those in the Moscow/Pullman/Lewiston/Clarkston/Spokane/Coeur D’Alene areas who would be our primary targets.

Lastly, I just want to congratulate the Boise Code Camp team on an excellent event, and I’m definitely looking forward to next year.

About this Archive

This page is an archive of recent entries in the Computing category.

Business is the previous category.

Food is the next category.

Find recent content on the main index or look in the archives to find all content.

Once You Know, You Newegg

μ-updates

  • No Updates!
OpenID accepted here Learn more about OpenID
Powered by Movable Type 4.21-en