Michael's Web Blog

This is my Web Blog, which is a weblog about the web. I talk about XHTML, CSS, scripting, web technologies, and a host of other topics. If you use the options panel, you can visit pages about my writing or programming.

A Bit of Perspective

January 2nd, 2012

And math!

Everyone who sees it loves the iPhone’s Retina Display, but there are new 720p smartphones coming out that are getting some people to gabber joyously.

And so I asked myself the question, “What would the screen size need to be for a 720p Retina Display?”
First, what is Apple’s Retina Display? The screen is 960 x 640, and is 3.5 inches diagonally. As we’ve been taught by Avogadro, the area of the square drawn on the hypotenuse of a right triangle is equal to the sums of the areas of the squares drawn on the other two sides, so we can find out how many pixels there are diagonally.
960 * 960 = 921600
640 * 640 = 409600
The root of 921600+409600 is ~1153.8

So, diagonally, we’re talking about 1153.8 pixels per 3.5 inches, or 329.65 pixels per inch.

Now we work backwards. If a phone had a screen of 1280×720, and had a resolution of 329.65 pixels per inch, what physical size would that be?

Pumped through Avogadro’s law, 1280×720 is 1468.60478 pixels diagonally.
That many pixels at 329.65 pixels per inch is about 4.4 inches diagonally.

SO

A smartphone with a 720p display who wants to say it’s competing with Apple’s display must have a screen size of 4.4 inches or smaller. If a 4.5″ screen is touted the same way, they’re lying.

Writing in the Browser

November 24th, 2011

As a writer, I’ve tried a few different formats. I think it occurred to me, one day, that newer formats won’t work on older systems, and old formats could lose data in the future when programs try converting them to newer formats.

I’ve been writing in plaintext files, which is of course human-readable. The only problem I had is that I can’t italicize or bold, and other formatting options were severely limited.

I tried RTF, but a look at the source made me cringe. It wasn’t even as if they added codes where the formatting was; it was more like every second word was just a slurge of backslashes and random characters. It was not human-readable.

So what’s human-readable and still rich-text? I had the idea to do something with HTML. I created a simple document with a contenteditable attribute set to “true”. I also did a trick to make the style element visible by setting both head and style to display:block.
I was left with a page that I could alter at will, using such built-in short-cuts as bolding and italicization. If you look at the source, there are <b> and <i> elements around certain bits of text in <p> elements, all completely human-readable. I can just save the page back to my drive.

<html contenteditable="true"> <head> <style id="bookStyle"> * {font-size: 30pt;} </style> <style style="display:none;"> head, style, title{ padding:14px; display:block; font-size:14px;} </style> <title>Editable Page</title> </head>
<body> <p>Text here...</p> </body> </html>

I also made an external css sheet specifically for writing books, which I @imported in by throwing it into that editable style tag, and I made some convenience JavaScript which I insert by dynamically creating a script node at the end of my body and inserting it into my head.
I’ll go on about that script some other day, but it basically gives me keyboard shortcuts to insert things like em dashes and horizontal rules, and asks me if I really want to leave if I have unsaved changes.

If I press Ctrl+S, it removes the external script from the document before saving. This way, there’s no whateverpage_files directory taking up space and causing my page to constantly point to an old JS file.

It’s pretty nice! I can easily change the size of the text or the typeface to suit my mood, and there isn’t too much clutter in my actual file. I’ve got my stories in a format that will most likely last longer than any other. It’s kept in an XML format, which means I could very easily make an ePub book out of this when I finish it.
Or I could use some sort of XSL transformation script to output ePub as I’m writing it, if I want to share.

ASUS Eee PC 1015PEM Review

October 14th, 2011

(Specifically, I got the 1015PEM-PU17, but the only difference is the bigger battery.)

So, I just got a new netbook, with the next generation in hardware and thirteen hours of battery life!

It didn’t come with thirteen hours, of course. A lot of people will choose storage space over speed, and so most netbooks these days will come with a slow and power-hungry HDD. I upgraded mine immediately to a 60GB OCZ Agility III, which is supposed to run below 1 watt at idle.
I also upgraded the RAM to 2 GB DDR3.

Most reviews try to tell you everything about a machine, but a good design is supposed to go unnoticed. Instead, I’m going to tell you everything wrong with it.

The keyboard is crappy, at best. The keys come up through a grid of plastic. This plastic sometimes catches on the keys a bit, and makes them hard to press. The chiclet keys are also a bit small because of this, which usually isn’t too detrimental.

One thing I liked about my HP Mini was the small, wide arrow keys. On this Eee, the arrow keys are so narrow I can’t get all three fingers on them side-by-side.

The Shift key is to the left of the Up arrow key, which is completely unintuitive. To the right of the arrow key is an extra Fn key. Because of all the keys right there, the ‘/’ key is very thin.

There are no lock indicator lights, so if you accidentally hit CAPSLOCK you won’t know until you try typing something. There’s a little utility that pops up in your tray to tell you if it’s pressed. I’m not even sure why Caps is needed on today’s systems.

The touchpad is some crappy Elan thing, and tries to do a buggy implementation of multitouch. Gestures tend to jump around a lot. The regular mousing is more or less fine, but a bit gummy — there’s a barely-perceptible lag when moving the cursor. No support for areas or anything, like Synaptics has.
The touchpad is set out as an area somewhere in the vicinity of the clicky buttons and two thin strips to the left and right. If you finger the pad a little, you find out that there’s no response in the first 6mm from the left and a few from the right and bottom.
It’s active right at the top edge, which is incidentally right under the keyboard’s space bar. If you press the spacebar the wrong way, you’ll end up clicking the mouse, and your cursor will go flying about.
I never have problems with my thumbs resting on touchpads, and this isn’t quite the same problem. Most people type with their thumbs mostly horizontal, so when they press this spacebar their thumbs will contact that leading edge of the touchpad.
I might be able to physically move the touch sensor by opening the case, but the only external solution I can think of is to put some sort of tape or other obstacle so that I’m not constantly touching the pad when pressing space.

When I close the lid, the touchpad starts basically going wild across my screen. I was playing a radio show in VLC, and it was jumping all over and changing the volume. It seems the electrical signals from the screen are enough to trigger the touchpad. Changing the sensitivity may help.

The screen is fairly bright at maximum, but it’s also fairly bright at minimum. Considering that when you put it on minimum you want A) a darker screen or B) better battery life, it doesn’t make sense that you can’t turn these down further. Consider also that screens are one of the biggest power-drains on your system.
This one takes between 1.5 and 3.8 watts, depending on the brightness. I could get four extra hours out of this battery by turning the backlight off completely, but it sounds like the only way I can do that is to use some version of Linux. I’ve searched for hour and hours on how to turn the backlight off in any version of Windows, and haven’t found anything.
The screen is semi-transreflective, so angling the sunlight a certain way will light up the screen beautifully. It’s like popping back into the Gameboy days. You just have to have the light coming in 30 degrees or so from the left, with you in front.

This has pretty good wi-fi, but it’s not as strong as my HP netbook.

‘User-Settables’ in general
When it comes to the speakers, the disply, and wi-fi, the users should really be in control. If I want to save power, I’ll turn my speakers low or off, turn my backlight low, turn my CPU down, and tune down or disable my wi-fi. If I’m docked, though, at full power, I’d want my screen to be the brightest possible, and my speakers to be loud, and my wi-fi to reach over great distances. There’s no reason to limit us so much.
ASUS helped a little with their Super Hybrid Engine, which lets you overclock a bit or reduce your CPU multiplier with a couple clicks.

ASUS’s Expressgate: useless
It takes just as long to start up as Windows, doesn’t support any programs, actually uses more battery, and is nearly impossible to set up without crawling through menus for half an hour. All in all, it’s useless in every way.

The netbook opens about 130 degrees, which just isn’t enough for everything. If it’s on a flat table or angled backwards, the screen is fine or you can close it a bit, but if the computer is angled forward, there’s no way to open the lid any more to get a good viewing angle on the screen.

At its thickest point, the netbook is 38mm (1.5″). At its thinnest, it’s about 4mm. There’s a whole lot of wasted space at the front, in the thinnest spots, and the back of the machine contains 50% of the weight. As such, you can’t open it with one hand, because it tips backwards. It’s also hard to set it on a surface while open, because the weight is in a weird spot in relation to its back feet.

The keys all have an open back, so anything spilled on the keyboard will immediately drip inside. There’s a bit of plastic backing, but there’s not much protecting the important bits.
The bottom is covered in holes. There’s a vent immediately over the RAM, and there are slots in the front for the speakers. You don’t want to carry this around in the rain.

Speaking of those speakers, it’s terrible trying to listen to things while it’s on your lap. If anything gets in front, of if you tip it forward a bit, the sound is muffled. I’ve had a few systems with speakers out the front, and I can’t understand the design choice.

I don’t know why the RAM is limited to 2GB. Back in the days of Windows XP netbooks, Microsoft mandated that they could only use that operating system if they had 1GB or less, and had screens of 1024×600 or smaller. These restrictions were eventually loosened, and there’s absolutely no reason why a machine running Windows 7 should have these.
Why won’t a 4GB DIMM fit in here?

USB 3.0
ASUS originally shipped the 1015PEM with two USB 3.0 ports, but they decided a little while later that they would just put USB 2.0 ports from then on. A lot of resellers didn’t pick up on this, and still advertise USB 3.0. Don’t be fooled.
Those two USB ports are on a daughter board that would be easy enough to upgrade if you can find a 3.0 version later.

Specifically good:
The battery life is amazing. It brings you into a completely different mind-set when you look at the indicator and see that you have ten hours remaining.
Throughout the day, I never have to worry about charging.
As I sit here, I’ve got 17.2% battery with about 2 hours remaining. It’s 8:30 PM, and I’ve been sitting here since 12:00 PM. I had the wi-fi on most of the day, too. 10-13 hours is pretty good.

The wi-fi range is pretty good. Not the best.

The screen is nice and bright. The transflectance is a bonus. I’ll have to look at the color gamut, because it seems more vibrant at some points but then red seem darker at others.

The 2.5″ drive bay is wonderful, because I can actually have a real 2.5″ SATA SSD, for the first time. I’ve gotten it down to a 20-second boot.

This model has VGA, so I can finally use external monitors. I was getting tired of my HP’s inability to work with anything more than 1024×600.

And now for some power things.

Due to the nature of new CPUs and C-states, the battery life flickers around dramatically. I find that the entire system tends to run at anywhere from 4.5 W to 7 W at desktop with the screen low. If it’s constantly at 7 W, a restart usually helps it get back down to 5 W.

With a 61.5 Wh (actual capacity) battery, as reported by BatteryBar:
3.5 W – 17.5 h – Screen and wi-fi off, sending music to amp
4.7 W – 13 h – Screen low, wi-fi off, basic text editing
6 W – 10.5 h – Wi-fi on and brightness low
10 W – 6.2 h – Brightness low, wi-fi off, overclocked, running Minecraft.
14 W – 4.4 h – Brightness high, wi-fi on and active, overclocked, running Minecraft.

If you were planning on getting the MU17 with smaller battery, you can take the Wh of that and divide by the W above to get your own hours.

Wish List

December 26th, 2010

What follows is a general list of items I want. My friends and family can use it for birthdays and Christmases.
I’ll keep it up-to-date as I think of new things, or as I get them.

  1. Kingston DataTraveller HyperX 30 or DataTraveller Ultimate 3.0 flash drive. The Ultimate comes in affordable 32GB or 16GB, while the HyperX is big and expensive and really fast. Follow the links to Amazon or NewEgg.
  2. Machine of Death, a fantastic anthology that I’d recommend to anyone. The second book is coming out soon!
  3. Tim Minchin (who just toured with the Heritage Orchestra) is a refreshing mix of comedy, intelligence, emotion, and offensiveness.
  4. I’d really love a 160-lumen 1-watt version of the flashlight I have now, but it seems nearly impossible to find something like that.
  5. Black liquorice! There are so many different kinds.
  6. Instruments, including violin, flute, and theremin. These can all be rather expensive, so I really don’t expect them. I’ve also got a thrifty flute for practicing, so that’s good enough for now.

Object Oriented Programming in JavaScript

December 14th, 2010

(From A Student View)

When an institute is teaching programming to new students, it’s a common theme to play around with Java before going on to other languages. It’s easy to learn, has all the Object-Oriented goodies instructors want, and is fairly ubiquitous.

With the current snafu that is Oracle circling around Java and all the rest of Sun’s old open-source projects, I decided I would try my hand at emulating those same principles using JavaScript; an open, simple, ubiquitous technology.

As it turns out, the resemblances end with those adjectives. JavaScript was never really meant to do the things we’re making it do now. It’s possible to do most things in most languages, but the verbosity of the code needed to perform a specific action tells you what it’s made to do, and what’s been tacked on as an after-thought.

So, from a student’s point of view, how does it matter which language they’re using? Which is easier to learn, or simpler?

Java:

  • Requires each class to be in its own file. It can be tedious, but it can also make it easier to manage.
  • Each file has one class. Each class has a constructor (sometimes overloaded), and zero or more methods. The structure is fairly simple.
  • Besides the keywords, not much is being used. If you don’t import anything, there are very few class names already taken.
  • It’s made to work with the console, or to display a GUI.
  • Inheritance is an important part of Java, and all you need is one keyword and the class name to inherit.

JavaScript:

  • Everything can go everywhere, and the syntax can go different ways. This freedom can be devastating to those who are learning.
  • Objects are functions, and functions can go within functions, and what are closures, anyway? Where and how you create variables influence how you can access that variable later in the program (private, public, hidden, privileged, for either fields or functions).
  • The global scope is chock full of different classes and attributes and functions.
  • It’s not meant to do anything on its own. You have to teach students HTML and DOM manipulation at the same time, and programs have to output in HTML.
  • Inheritance is handled through the prototype chain, which has to be explicitly set after an object function is created. You have to set the prototype of that class to a new instance of the parent class, and then you have to set that prototype’s constructor back to the constructor of the current class (to ward off some edge cases).

I’ve made a sort of console window out of HTML. It overwrites the document.write(), prompt(), and confirm() methods to output to a <pre> element. The latter two also pause execution by opening an invisible modal dialogue that is closed when the Enter key is pressed, which enables synchronous user input.
It’s a cludge, but you can run any JS code in there that acts like a console Java program.
Later: GUIs.

In short, You can do Object-Oriented programming in JavaScript, but it’s not something you should be teaching students in their first semesters, and the complexity and power of it don’t lend well to simple instruction.

I’m going to keep playing around with this, to see if I can get something simpler out of it. I just got the ‘instanceof’ keyword working, so I can start chipping away at what I need to get a ‘true’ out of that.

Browsing

December 3rd, 2010

I use Explorer to browse.

No, I’m not talking about the internet. Explorer.exe is the file browser that comes with Windows, and which manages your taskbar and other windows. If you’re a Windows user, you use it every day whenever you open a folder. Mac and Linux have their own file browsers, as do different operating systems on different CPU architectures.

Anyway, I’ve recently noticed that I browse differently than other people do. I open My Computer (or whichever folder on my desktop), then click through the folders leading to my destination. I know the file structure intimately, and can tell you where certain files are. When I get to the files I want (executables, text, web pages, program code, whatever), I execute them, view them, zip them, or open them in a program. Any time I’m working with files, I’ll be in that directory. Any time I want to move or copy files, I’ll have both directories open.

Lately, I’ve been helping students who focus on the programs themselves and use the ‘Open…’ dialogue to open files. It’s a completely different way of thinking that drives me silly, especially when they eventually need to browse through folders. Especially in crappier (i.e. Java-based) programs with a miserly Open dialogue that doesn’t let you copy or move files, or select more than one file,or right-click on files.

It’s just one of those differences that you never notice until you meet it.

Windows 7

November 3rd, 2010

Windows 7 is fantastic! Colourful glass interfaces slide into position with a sublime beauty that you could not match if you were to pin fresh bacon to a kitten!

But then there’s the actual operating system, and how it runs. I’ve been using Windows 7 over the course of the last half-year, and I’ve been keeping notes of everything that has irked me.

I present to you the following list of Windows 7 Problems:

  • Still too many clicks – To view or change anything, such as current wi-fi connection strength, screen brightness, or to re-scan for hardware (I’ve had to do all three regularly), you have to visit the specific window that handles that stuff. Mind you, XP isn’t exactly better.
  • Too slow – Opening the windows, including the multitude of Control Panel windows that now contain every option, takes several seconds.
  • Pointless clutter – There are multiple options in some menus that all lead to the exact same spot. That makes things very confusing. The only purpose they fill is to describe multiple uses of the same window, which is a huge warning that you’re making it way too complicated.
  • Bugs – These might be ironed out, but there are problems with battery settings and screen mix-ups and stuff like that. In other words, the systems still aren’t reliable, even after all these years of development. On the plus side, the Blue Screen of Death seems to be rather rare since Windows XP.
  • Aggressive alphabetization – Nothing in the entire OS is in its default listed order. Instead, even lists such as {1, 2, 5, 10, 20, 54} are sorted to {1, 10, 2, 20, 5, 54}. The taskbar options are disgustingly confusing because they are in alphabetical order instead of in contextual order.
    In folders, it is impossible to move folders or items around. If you don’t like how Windows has arranged the items (shortcuts mixed with your files), you’re out of luck.
  • No ‘up’ button – Technically not as needed, because the Back button usually does the same thing. Both approaches have their own uses when using shortcuts, though. Work-around: Alt+up
  • All Programs in the Start Menu – It is now no longer possible to surf through all your programs. You need to click on each folder, and opening a large folder might push half your items off the screen. The whole process is slow and painful.
  • Context Menu removals – Across the entire OS, right-clicking sometimes does nothing at all. I know there’s been a big push to support touch computing, but that doesn’t mean you have to neuter keyboard- or mouse-based browsing; only that you have to add more touchable links.
  • Wireless Adapter properties – It isn’t possible to view the properties of your wireless adapter (MAC address, for example) unless you’re connected to a network. The options in that area are woefully bare. It seems the whole networking panel was made expressly for one-touch connection to a wireless internet connection, and nothing more, but they make you use that panel as much as possible.
  • Non-Dynamism – Almost everything is a link to some big, confusing, slow-loading panel full of redundant information. It would be sensible to make some of those links (“Adjust Screen Brightness” for example) transform into sliders or option panes when clicked, so that you can easily change things once Windows knows you want to change them.
    It could slowly learn what actions you perform often, so that those can automatically open.
  • Too much “Help” – Half of all the menu options are links to help. Help is nearly useless, because the topics are too confusing for the computer-illiterate, and contain nothing but “Ask your admin,” for the things the admin needs help with. They usually also require a web connection to work.
    A ‘help’ symbol in the corner of these panes should be enough. There’s no need for a high cognitive load.
  • Status Bar neutered – The status bar in the file explorer doesn’t contain anything, now (except a simple count of selected items). It’s been replaced by a far bigger status pane at the bottom which you can’t get rid of or reduce in size, and which still sometimes doesn’t tell me all I want to know.
  • File-size surfing – Across Windows 7, it’s difficult to work on small drives by deleting big items.
    1. The status bar no longer holds the size of all items in the folder. If you want to find that, you have to manually select all files in the folder and view properties.
    2. Properties in the Recycle Bin don’t show multiple items, so it’s impossible to see how much space those are taking up.
    3. The hover tooltip is slow to appear and sometimes just doesn’t work, but I find myself relying on it.
  • Taskbar item right-click menus – Right-clicking on a taskbar item just gives you a generic list where there’s jumplist stuff, pinning options, and ‘close’. Right-clicking on the application option gives you a couple other options, such as pinning, relaunching, or ‘close’. No more options, such as Chrome’s task manager, or Windows Live Mail’s ‘hide when minimized’. Or even ‘move’, which I’d made use of in the past, when working with multiple monitors.

Verdict: Windows is heading in a direction where the most basic of users can use it more easily, but where power users are all but cut out. There are multiple things you could do in Windows XP that have been stripped out of Windows 7, such as bridging connections or configuring a network other than the default MSHOME.

Overall, I can’t blame them: They’re going where the money is, and their customers don’t use the control panel. I’m still raging against it, though, because ugh.

New Twitter

November 1st, 2010

It turns out more is wrong with the new version of Twitter than I can fit into a tweet or two, so I figured I’ll write a post about my difficulties.

First and most importantly, I expect Twitter to be fast. Due to the nature of tweets, I need to be able to load the page, type in my reply, and then send it off, all within about twenty or thirty seconds. I don’t have time to wait for multiple JS files to load and parse, or all these images to make their way to my screen.

The old Twitter was a single page that was served up almost instantly. The JS was small, and would load very shortly after, and I can work as the images load. The new Twitter seems to hang until after the images are loaded.

The interface also wasn’t doing it for me, because it was cluttered and huge. I work with small screens most of the time, and their enlargening of the site’s format made it even more useless for my purposes. An option or two suddenly wasn’t available (even in the menus), and a tweeter’s face will be multiplied down the page a hundredfold if you visit their stream.

All in all, the new Twitter caters to a very specific user base while cutting out others who don’t use it the same way. It’s not flexible or well-thought-out.

Edit Style

October 5th, 2010

I just created a bookmarklet! Try dragging Edit Styles to your bookmark bar.

This only seems to work in Chrome, Safari, and IE9. If anyone can tell me why appending an element to the DOM in Firefox or Opera creates a blank document, I’d love to know.

You can type any sort of CSS in the box. If there was already some CSS in a <style> element in the head, you can edit that.
Try something like the following:

EA Schedule

September 3rd, 2010

Just in case any Red River College students are reading this, I figured I’ll post my schedule here.

I'm available Monday from 8 to 10; Tuesday at 8 and at 11 and at 14; Wednesday from 9 to 11; Thursday at 8; and Friday at 8.

My email is similar to the other instructors’.