Showing posts with label non-coding. Show all posts
Showing posts with label non-coding. Show all posts

Sunday, 1 June 2014

VirtualBox -- USB not working

Just a snippet today, as much to remember it as anything else:

If you're using VirtualBox on Linux and USB devices aren't working despite the fact you've installed the extension pack, it's because you haven't remembered to add yourself to the vboxusers group.

To do that:

# usermod -a -G vboxusers your-user-name

...and then you'll probably want to log out and log back in so your UI processes pick up the change.

Thursday, 14 June 2012

Cleaning up old Ubuntu kernels from /boot

My Ubuntu system told me today that it was running quite low on room in /boot. I searched around for what to do about that, and found this answer on Ask Ubuntu. It turns out that when kernel updates are applied, old kernels are left lying around in /boot.
So what to do? It's quite simple:

  1. Ensure you don't have a restart pending (Linux can update just about anything without rebooting...except the kernel). If you do, restart.
  2. Check to see what kernel you're using with uname -a:
    $ uname -a
    Linux forge 3.0.0-21-generic #35-Ubuntu SMP Fri May 25 17:57:41 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux
    That's telling me that I'm using kernel 3.0.0-21-generic.
  3. List what kernels you have installed:
    $ sudo dpkg -l linux-image-\* | grep ^ii
    ii  linux-image-3.0.0-16-generic  3.0.0-16.29  Linux kernel image for version 3.0.0 on x86/x86_64
    ii  linux-image-3.0.0-17-generic  3.0.0-17.30  Linux kernel image for version 3.0.0 on x86/x86_64
    ii  linux-image-3.0.0-19-generic  3.0.0-19.33  Linux kernel image for version 3.0.0 on x86/x86_64
    ii  linux-image-3.0.0-20-generic  3.0.0-20.34  Linux kernel image for version 3.0.0 on x86/x86_64
    ii  linux-image-3.0.0-21-generic  3.0.0-21.35  Linux kernel image for version 3.0.0 on x86/x86_64
    ii  linux-image-generic           3.0.0.21.25  Generic Linux kernel image
    
  4. Uninstall the oldest one(s):
    $ sudo apt-get purge linux-image-3.0.0-16-generic
    ...and so on, being sure not to uninstall the one you're using.
Many thanks to Lekensteyn for the answer, and user6722 for the question.

Tuesday, 14 February 2012

Getting rid of "What's Hot"

Google have finally made it possible to get the "What's Hot" rubbish out of your main Google+ stream. Here's how:

  1. Go to Google+.
  2. Click "What's Hot" on the left-hand side.
  3. At the top of the page, there's a subtle little slider (basically an O on a line). Move it all the way to the left.

(If you don't see a slider at the top of your What's Hot page, just wait a day or two for the rollout to come to a server near you.)

That's it, you're done. Yay!

Sunday, 12 June 2011

Google Apps migration and multiple accounts

Non-coding post today. If you use Google Apps for your Domain, you've either been transitioned to the new "full" infrastructure or you soon will be. If like a lot of people you have this crazy idea that your personal and professional lives should be separate, and so you have separate accounts for personal and private stuff, you'll run into the problem that your Google Apps stuff and your Google stuff now share an account cookie, and so trying to (say) view your personal email when you're logged into a Google service with your professional account will fail because you're logged in with your personal account. Sigh. If only there'd been a way to anticipate that this might be a problem and design and implement the solution properly before involuntarily migrating people over.

The good news is that Google now supports multiple account login in many of its services. You lose offline mail and calendar (huh?) and there are some other caveats, and it's still a PITA to use, but when/if you do manage to get signed into your multiple accounts on the services you mostly use, it does sort of work, a bit.

Hopefully as time marches by, the multiple accounts stuff will improve and spread to their other services.

Tuesday, 26 April 2011

A brief, incomplete definition of 'an engineer'

Most of us, much of the time, react to "You're wrong" with "No I'm not! And you can't tell me otherwise!" An engineer's response is "How? Show me."

Saturday, 23 April 2011

Thinking outside the box with the ASP.Net Development Server

A well-known limitation of the ASP.Net Development Server is that it will only bind to the local interface of the development machine, never the LAN interface, and so you can't bring up pages served from the development server from anywhere but on the box itself via the localhost name or 127.0.0.1 address. And fair enough, it's meant to be a debugger aid, not a web server. But there are situations where you want to think outside that box, and fortunately, it's dead easy to do so.

I wanted to do that because I'm working on a project where the server-side code is C# assemblies and the client-side is pure HTML, CSS, and JavaScript (no server controls or other ASP.Net-isms). I wanted to use VS.Net for debugging server-side C# code, and Chrome's Dev Tools or Firebug for debugging the client-side code in the browser. VS.Net makes it remarkably easy to debug server-side code — just mark the "project" with the client code as the startup project, chooose a port if you want, set the virtual path, make sure the server-side assembly projects are in the solution, and hit F5 (or click Run). It fires up the ASP.Net Development Server and you have full debugging of the server-side code (and client-side code as well, if you like, with its integration with IE). Excellent, couldn't be much easier. But for me, this is all happening in a VM (this is for a client, and I keep all my client stuff isolated from my work and each other using VMs) but I'd like to do the client-side debugging with Chrome's Dev Tools on my main machine.

It was only a mild irritation (I can run a browser in the VM happily enough), so I didn't want to spend any time on it, but I figured this has to be one of the simplest examples of the need for port forwarding or proxy serving on the planet (just bridging interfaces), and so I did a quick web search and found this article about using Squid to do it. Now, Squid is a big hammer for this nail, but it's so easy to set up, that it's still reasonable to use it.

That article's good, but I thought a few things weren't as clear as they may have been, so here's my step-by-step:

  1. Tell the ASP.Net Development Server to use a particular port rather than picking one at random:
    1. Click the client code project in your solution
    2. Look at the properties
    3. Make sure that Use dynamic ports is False
    4. Choose your port under Port number (if you just turned off the Use dynamic ports option, you may have to click away from the properties and click back again to unlock the field; minor bug in VS.Net)
    I'll call that the "internal" port (the one that only works within the VM). In my case, I used 80; the VM doesn't serve any other web content.
  2. Be sure your dev machine's firewall allows incoming connections whatever external port you're going to use.
  3. Get and install Squid. The quick-and-easy thing is to get a binary from these nice people who are kind enough to maintain a Windows port built using the Microsoft toolchain: Just scroll down under the features list and click the "Squid download Page" link. Or, of course, you could grab the source and do it yourself (with the MS toolchain, or Cygwin and GCC). I grabbed 2.7.STABLE8 from the the nice people.
  4. Unzip it somewhere handy. The Windows binary assumes C:\Squid, so I went with the path of least resistance and put it there.
  5. Install it as a service:
    1. Open a command prompt (as Administrator, if you're on Windows 7 or similar)
    2. Change to C:\Squid\sbin.
    3. Type squid -i -n Squid
  6. Set up the default config: Using your favorite file browser:
    1. Go to C:\Squid\etc
    2. Copy squid.conf.default as squid.conf
    3. Copy mime.conf.default as mime.conf (we're not going to edit it, but it's required)
  7. Set up the proxying:
    1. Open squid.conf with your favorite text editor
    2. Go to the very end of the file
    3. Paste this in, replacing the bits in curly braces with your own values (without the curly braces) (mind the word-wrapping, Blogger is giving me a hard time yet again; best to copy and paste):
      http_port {EXTERNAL_PORT} accel defaultsite={EXTERNAL_IP_ADDRESS}
      cache_peer localhost parent {INTERNAL_PORT} 0 no-query originserver name=myAccel

      acl our_sites dstdomain {EXTERNAL_IP_ADDRESS}
      http_access allow our_sites
      cache_peer_access myAccel allow our_sites
      cache_peer_access myAccel deny all
      So in my case, since I want both the internal and external ports to be 80 and my VM's external (LAN) IP is 192.168.142.153, it's
      http_port 80 accel defaultsite=192.168.142.153
      cache_peer localhost parent 80 0 no-query originserver name=myAccel
      acl our_sites dstdomain 192.168.142.153
      http_access allow our_sites
      cache_peer_access myAccel allow our_sites
      cache_peer_access myAccel deny all
      ...but if you use different internal and external ports, be sure to set them according to the placeholders in the above.
    4. Save the file
  8. In your (Administrator) command window, tell Squid to validate the config:
    squid -z
    You should see the message Creating Swap Directories and pretty much nothing else.
  9. Start the service:
    net start Squid
  10. You might choose to have Squid start when you boot the machine, via the usual services.msc settings

Sorted!

Tuesday, 5 October 2010

IE6, the Undead Browser

2013/05/16: Ah, what a difference a couple of years makes. :-) Today, this article can be a lot shorter, and could be titled "IE6, the Mostly Dead Browser". Huzzah!

Is IE6 finally dead?

  • In China: No, it's still more than 24% of the browser share there.
  • Everywhere Else: Yes!

I can't give the region-by-region breakdown I could below because Net Applications have started charging (a lot) for that report, but even in places like Mexico and India, which had high IE6 use a couple of years ago, use has plummeted. According to ie6countdown, after China, Taiwan is next at 3.5%, followed by India at 2.8%, and then Japan and Russia tied at 1.7%. The corporate U.S. finally "got" the security risk and has moved on to IE8 or IE9.

The take-away? If you're developing web pages and web apps for China, you must still support and test on IE6. By all means include an educational banner or something advocating change, but you must still support it. Just about anywhere else, fergedabouddit.

And what about IE7? Great new there: Worldwide usage of IE7 is currently just 1.81%. So people leaving IE6 jumped to IE8 (23.08%) or IE9 (18.17%) (and those nearly 20% at one point who were using IE7 have moved on too). We can figure a lot of those IE9 users will soon be on IE10. The IE8 users will be with us for a while, since that's as high as Windows XP goes.

Here's the old article from October 2010 (with updates in November 2010 and March 2011), just for posterity:


2011/03/14: See also Microsoft's new IE6 countdown site

2010/11/18: Updated to also reference StatCounter's figures (for May 2010).

There's a common refrain on sites where people ask for help getting things to work well cross-browser, when someone mentions needing to support IE6:

IE6 is dead. Microsoft officially stopped supporting it. I don't see any reason you should.

— comment from a StackOverflow user

IE6 is dead. don't speak of it.

— another StackOverflow comment

Some people have even held a funeral for it (Microsoft were classy enough to send flowers); others declare it Well and Truly dead.

So is IE6 finally dead?

No.

Far from it, IE6 is still (as of this writing) the third most used browser out there, at 15.55% it's just barely behind Firefox 3.6 at 17.05%, both trailing IE8 at 29.06%. (That link is for September 2010; current stats here.) StatCounter gives a slightly lower figure, making it the fourth most popular browser in the world at 9.75% in May 2010 —which makes sense; StatCounter and Net Applications have different customer bases.

Like most developers who do browser-based applications, I wish IE6 were dead. It certainly should be, and Microsoft are doing everything they can to kill it, but unfortunately it's not quite that simple. IE6 was the de-facto standard browser in large corporate and government environments for the majority of the boom of browser-based applications, and therein lies the problem. Large organizations are very slow to upgrade key bits of software. For example, many of us recently petitioned the UK Government to upgrade all government departments away from IE6. Their response was to say that it's "...not straightforward for HMG departments to upgrade IE versions on their systems...", that testing their web apps for compatibility "...can take months at significant potential cost to the taxpayer..." and that they deal with the security issues with firewalls and malware scanners. Big business is much the same as big government in this regard. You can bet that the majority of users of IE6 are sitting in a cubicle somewhere.

It's also interesting to try to find a statement from Microsoft backing up the assertion from our first commenter above that IE6 is no longer supported by Microsoft. Some point to the Lifecycle Supported Service Packs page saying that it says IE6 support ended on July 13th, 2010, but that page is about service packs, not products, and the July 13th date is only listed next to some of them; others, like the one for IE6 on Windows XP SP3 say that support ends 24 months after the next service pack is released. There hasn't been an SP4 for XP and SP3 is still supported (support for SP2 ended on the aforementioned July 13th), so... Further, that page also (now) says it's "no longer updated and scheduled for retirement," referring people to the Microsoft Product Lifecycle Search page instead. Amusingly (or perhaps I'm just laughing to hide the tears), if you use that page to find lifecycle information for Internet Explorer 6, it doesn't give an end date for extended support; instead, it says "For support dates for specific Internet Explorer 6 and operating system versions and their service packs, visit the Lifecycle Supported Service Packs site at..." Yup, that's right, they then give our first link above, the one that says it's no longer maintained. Rinse, repeat. So has Microsoft ended support for IE6? If so, those pages aren't saying so.

So what does this mean for those of us who develop web sites and applications? Well, your first thought might be that if you're writing a consumer-facing website, you can probably drop support for IE6. And that's probably mostly true, although you have to consider what it could mean to lose people browsing on their lunch break (or any time the boss isn't around) when most sites are scratching for every hit they can get, antiquated insecure non-compliant browser or no. You also have to consider where your visitors are coming from; StatCounter says that IE6 use is half as likely in the U.S., Europe, the UK, Canada, Australia, and New Zealand, where in all of those except Australia they're seeing numbers under 5% and in Australia only just barely over (as compared with 9.75% worldwide). But even StatCounter is seeing IE6 as the second-most popular browser in Asia at 20% and the top browser in Africa at 22%. So the locality (if any) and language of your site play a part.

But even in those ~5% countries, if you're building software that you want corporations to be able to adopt, I'd say that right now, today, you ignore IE6 support at your peril. Unfortunately. Maybe in another year, although with the downturn, IT budgets are pretty tight...it may take even longer than that.

There is good news, though. This time last year (September 2009), IE6 was the number one browser, at 24.42% dominating IE7's 19.39% and IE8's 16.84%. So clearly on the way out. I predict the decline will continue but flatten out as we hit the hard core corporate deployments with strapped IT budgets. (The other good news in comparing last year to this year is how IE7 is being displaced by IE8. Excellent. IE8 is a much, much better browser than either IE6 or IE7...and if people are willing to upgrade, when the time comes maybe they'll keep going to IE9.)

Happy coding.

Sunday, 12 September 2010

Boot, Ubuntu, boot! Good dog!

This isn't about writing software, but it's a snippet, so...

I have a fresh new desktop based on the Intel DH57JG board on which I've happily installed Ubuntu 10.04 LTS desktop. Aside from a video mode detection issue, things are great, but I had an odd symptom: Ubuntu could successfully shut down and power off, but it would crash if I asked it to reboot. Just an annoyance, but surprisingly...annoying.

So naturally I consulted a Major Search Engine(tm)(r), and while I found several threads related to this problem, I never found one where the original questioner actually said their had been solved. I did find one where someone chimed in with "When I had that problem, adding reboot=bios to the kernel options fixed it." So I tried that, but no go. I also found a thread where someone said "I've tried the reboot b, c, and h options but..." So I figured there had to be more options for this reboot thing than just "bios" or none.

Well, it took some digging and installing the linux source (which is nicely packaged, so not like that's hard), and my machine now happily reboots when I ask it to. Because the options for reboot are a bit hard to find, here they are (for the x86 architecture) as of the Linux kernel 2.6.32-24:

warmDon't set the cold reboot flag
coldSet the cold reboot flag
biosReboot by jumping through the BIOS (only for X86_32)
smpReboot by executing reset on BSP or other CPU (only for X86_32)
tripleForce a triple fault (init)
kbdUse the keyboard controller. cold reset (default)
acpiUse the RESET_REG in the FADT
efiUse efi reset_system runtime service
pciUse the so-called "PCI reset register", CF9
forceAvoid anything that could hang.
(If you're curious, the answer in my case was reboot=acpi. At least, that was the first one I tried that worked, so I stuck with that.)

If you need a more up-to-date list, or a list for a different architecture, here's how I got that:
  1. I installed the linux-source package, which dumps a bzip2'd source tarball in /usr/src

  2. Uncompressed and untarred the tarball

  3. Looked at the arch/[architecture]/kernel/reboot.c file. Since I'm on an x86 processor on the 2.6.32 kernel, the full path in my case was /usr/src/linux-source-2.6.32/arch/x86/kernel/reboot.c but of course YMMV.
(Lest you think I was terribly clever finding the options in the source, the first place I looked was in the kernel parameters documentation —/usr/share/doc/linux-doc/kernel-parameters.txt.gz — but all that said was to look in reboot.c. :-) )

I applied the change by editing /etc/default/grub, adding that to the GRUB_CMDLINE_LINUX_DEFAULT variable, running update-grub, and rebooting (er, that is, shutting down and then starting up — rebooting would have crashed, of course).

Hope this saves someone else some time.

(If the title of this post seems oddly familiar but you can't place it, here.)

Thursday, 9 September 2010

Modern Youth

My son has now unequivocally demanded his own proper computer.

My son is not yet three years old.

At this rate, by the time he's six he'll have a better StackOverflow rep than I have.