Highlight

2013-10-11

US Fusion Energy Lab Achieves Positive Energy Reaction

In late September, American scientists got more energy out of a fusion reaction than the fuel absorbed in igniting it — the first time that’s been achieved by researchers anywhere in the world. The research team that pulled it off is based at the National Ignition Facility (NIF), in Livermore, California. And in a bitter twist, they were furloughed just days afterward by the government shutdown.
http://thinkprogress.org/climate/2013/10/10/2760911/american-researchers-fusion-breakthrough/

Since 1953, when the fusion program started, the total spent on fusion energy in the US, both Magnetic and Inertial is $22.4 billion dollars. Adjusting for inflation, total fusion spending is $29.1 billion. That’s for 57 years of fusion funding. That’s an average of $510 million per year.http://focusfusion.org/index.php/site/reframe/wasteful

The U.S. federal government spent over $15 billion dollars in 2010 on the War on Drugs, at a rate of about $500 per second. State and local governments spent at least another 25 billion dollars.

http://www.drugsense.org/cms/wodclock

2013-10-03

IE8 is Evil.

>>var d = {1:"one", 2:"two",}
  "Expected identifier, string or number"
But that works in IE9's IE8 mode!

Fortunately IE10 does reproduce this bug; too bad IE9 won't upgrade on this Windows 7 machine due to DLL hell. Good thing i have remote desktops:
>>var d = {1:"one", 2:"two"}
undefined
>>d
{...}
That also works in IE8. Bug solved!

But wait, there's more! IE10's IE8 mode happily skips over
var approved_headcount = {
 "ICT": {201301: 1, 201302: 2, 2013.03: 3, 201304: 1, 201305: 2, 201306: 3},
 "Finance": {201301: 1, 201302: 2, 201303: 3, 201304: 1, 201305: 2, 201306: 3},
}
and is thus buggy at being buggy.

I guess they incinerated the IE8 parser as it also returns incorrect line numbers while parsing that code block.

2013-03-05

Digits to Excel column letters

A little tricky, so i'll note it here:

>>> def getLetters(n):
...     o = ""
...     while 1:
...             n, m = divmod(n-1, 26)
...             o = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"[m] + o
...             if n < 1: break
...     return o
...
>>> getLetters(1)
'A'
>>> getLetters(25)
'Y'
>>> getLetters(26)
'Z'
>>> getLetters(27)
'AA'

And i might as well include my old getCol function:

def getCol(s):
 z = 0
 for i in range(1, len(s) + 1):
  c = s[-i]
  z += ("ABCDEFGHIJKLMNOPQRSTUVWXYZ".find(c) + 1) * 26**(i - 1)
 return z

2013-01-09

Repairing slow systems

Recently my old PC became very slow at everything. I looked at the problem areas:

#1. CPU usage

Single-core machines being hogged by rude/buggy software is why i switched to a quadcore i5 for my main machine. CPU usage can be viewed and managed via your Task Manager, accessible on Windows via Ctrl+Alt+Del, Start Task Manager. If you don't want to end a rude process, you can try to lower its priority via the context menu.

If the CPU is automatically underclocked, perhaps dust is blocking airflow that's needed to run at full speed. When cleaning the inside of your PC, always shut off its power and stay grounded by touching the bare metal case to avoid static discharge frying your bits.

#2. RAM usage

When the temporary memory of a PC fills up, operating systems tend to use virtual memory on the hard drive, but the hard drive is orders of magnitude slower than RAM, even an SSD. Besides, writing to an SSD still shortens its lifespan more than writing to magnetic disk. Increase RAM (note the type and size your motherboard supports, and that it will match the slowest chips installed) or decrease program consumption. Note that 32-bit Windows only supports up to 4 GB of RAM and will leave the rest unused.

#3. Storage space

Many programs cache slow data to the hard disk, but when space runs out (Windows warns about this), that becomes impossible, also affecting the virtual memory. Use CCleaner and SpaceSniffer to free up space and consider external drives for archiving. If you're ambitious, perhaps you want to try moving the entire OS to a bigger/faster disk using a boot media with disk imaging/cloning tool.

#4. Storage integrity

Environmental effects like temperature, moisture, and cosmic rays, can corrupt stored data. Modern systems can correct for this, but i've found that can produce terrible lag. Schedule regular (monthly should do) surface sector relocation scans. Ubuntu does this out of the box on startup, but Windows needs a scheduled task that runs a batch file containing
@echo off
echo y|chkdsk c: /r
shutdown -r
as admin. The reboot is required because C: is probably in use.

I solved my old Windows XP system's lag by manually scheduling a sector repair via the C: partition's properties' extra's scan tool in Explorer.

S.M.A.R.T. monitoring tools like SpeedFan and HD Tune can indicate problems with your hard drive.

On a side note: Unlike many tutorials showing only easy Dell installs, i noticed that the Medion MD8818's hard disk drive is fastened by two short screws through the bottom of the tower.

#5. Storage order

Modern (file)systems are less affected by heavy read/write activity, but defragmentation every once in a while can help, except on an SSD (see also #2) as those have neglible seek/read times.

#6. Software updates

Newer software can have bugfixes and improved efficiency. Use your component manufacturer's website (like AMD or NVIDIA for drivers) and/or reputable tool such as FileHippo.com Update Checker (might not check drivers) and Microsoft Update (doesn't check 3rd party software).

#7. Software alternatives

AlternativeTo lists alternatives to many bloated/slow software packages.