MacBook, defective by design banner

title:
Put the knife down and take a green herb, dude.


descrip:

One feller's views on the state of everyday computer science & its application (and now, OTHER STUFF) who isn't rich enough to shell out for www.myfreakinfirst-andlast-name.com

Using 89% of the same design the blog had in 2001.

FOR ENTERTAINMENT PURPOSES ONLY!!!
Back-up your data and, when you bike, always wear white.
x

MarkUpDown is the best Markdown editor for professionals on Windows 10.

It includes two-pane live preview, in-app uploads to imgur for image hosting, and MultiMarkdown table support.

Features you won't find anywhere else include...

You've wasted more than $15 of your time looking for a great Markdown editor.

Stop looking. MarkUpDown is the app you're looking for.

Learn more or head over to the 'Store now!

Wednesday, February 29, 2012

from here:


Well done.

Labels:


posted by ruffin at 2/29/2012 06:11:00 PM
0 comments

Targeting WebKit is not like targeting IE6 :: Encosia:

Chrome may lack features, but it doesn’t poop on my code.


Classic enough quote that it deserves to be shared.

posted by ruffin at 2/29/2012 05:59:00 PM
0 comments

Predictably Meta:
Slides and code from “Build Your Own Programming Language with JavaScript”


Hilarious. But so serious. And funny. I downloaded 'em to look at later.

This is one of the guys responsible for JSONLint, the JSON validator.

Labels: ,


posted by ruffin at 2/29/2012 10:32:00 AM
0 comments
Tuesday, February 28, 2012

So I joined the Science Fiction Book Club (SFBC). I honestly can't remember why I went to their site. I was eyeballing the price of buying a just-released fantasy novel (currently only available as a hardback or hardback-priced eBook; it's the only series I buy at release right now), and ended up checking them out. I usually buy used online, but I've got a number of current books I'd like to read, and their offerings mesh up very well. (Admittedly, if I had it to do over again, I'd swap Terry Brooks for the new Umberto Eco.)

As a quick search of the Internet reveals, SFBC printings are strange beasts. Their printing of the same book you'd buy elsewhere will be slightly smaller than what you'd find in Barnes and Noble (or your local, independent book store). The paper is slick, and feels somewhere between "Bible paper" and what you're used to at retail. For some reason, the SFBC versions have been deemed uncollectable, though I've no idea why. Seems rarity and condition would be the only characteristics that matter, but there are a number of guides online to help identify these "worthless" SFBC duplicates.

And they are different books, I think, though their ISBNs match! Here are the reported dimensions for the same book from the SFBC listing and Amazon.


Same number of pages, so I'm guessing it's just scaled down and printed on thinner paper (though thickness is only listed on Amazon's, I know the pages are pretty thin). Seems to be smaller and lighter, certainly, which has obvious advantages for items mailed directly to their consumers.

They also are well-known for "omnibus editions", where they package two or more books from a series that's usually long since gone to paperback, making some hardback omnibus collections almost as cheap as buying the separate books used from Amazon or BetterWorldBooks.com or what-have-you. I've got a SFBC Asimov omnibus I bought used from Amazon to save on postage over buying the three books separately, and it's a decent reading copy.

When it comes to SFBC entering the publishing game, it's difficult to guess the how and why. Is it really cheaper for the SFBC to pay for the right to print the books and ship rather than just drop ship or take ownership of the ones printed by the conventional publisher? Is there a sweet spot for book size that makes postage that much cheaper? And if it is cheaper to print the books this way, why doesn't Barnes and Noble (or, better yet, Wal-Mart with paperbacks) make a similar deal? B&N does print out of copyright classics; why not first run books? Or if it is printing plus postage, wouldn't Amazon print its own books? Certainly they have a better bargaining position with publishers than the SFBC, right? Would the SFBC be able to pull this off today if it hadn't been around apparently since 1926 republishing books in fancy leather versions so that folks could have literary props to display in their house?

The deal the SFBC has reminds me a good deal of Amazon and B&N with eBooks. There, both places buy the rights to "print" in formats that don't look much of anything like the hardbacks. I know my phone makes books look just a touch different from what I normally read. SFBC just takes the eBook paradigm and applies it to, um, paper.

In any event, since it's so danged hard to Google up anything about the SFBC (other than what I've already summarized and the random stuff they have on their YouTube channel), I figure I'll post about my experiences here. I'll put in a fancy topic tag of SFBC so you can see it all in one place. Maybe someone like me will Google it up and figure out all the things I wish I could've found out but couldn't before signing up.

So far, the most important lesson is that, though it's not listed on their site anywhere that I can find, the danged books take up to 4 weeks to arrive after they're ordered (but see update, below), something I only found out after emailing customer service (which is surprisingly quick to reply; great job there). I've quickly gone from ordering four, maybe five books I really want to read (two of the five from my intro offer were on my next-to-read list, and two more I wanted to read soon), to having the books I want most to read held hostage by the mail and wondering what I could read for the next few weeks while I'm waiting. /sigh I mean, I knew that by the time I was done buying my required books that I'd've likely overpaid by $10-15 over getting the 5 intro books plus 4 required purchases used, but to compound that with the slow boat delivery is painful.

UPDATE: Of course two days after I start complaining, BAM, the books are at my door. I'm surprised they would tell me I'm going to have to wait up to 3 weeks if it's going to pop up that quickly. So exactly a week after I order, here they are. Very nice.

Still, I haven't been this excited about getting books, strangely, for quite some time. Probably because I'm "treating" myself to newly released books instead of my normal frugal used. That's how they get ya!

Next time: How much did that introductory offer "save" me, really?

Labels: ,


posted by ruffin at 2/28/2012 08:54:00 PM
0 comments

I should probably use QuickSilver to switch to apps too far down the Command-Tab line, but I don't. I Command-Tab 12 times like an idiot instead. We'll see if this cuts down on Command-Tabbing a little.

Keyboard shortcut to Launchpad on OS X Lion|Imagineric:

Launchpad is great for finding an application when I forget it’s name or isn’t properly indexed by Alfred yet.

[To set up a keyboard shortcut for Launchpad, which doesn't have one by default...] Go to System Preferences > Keyboard > Keyboard Shortcuts. Click on Launchpad & Dock. You’ll see that Show Launchpad is selected but there is no shortcut associated with it. In a fit of usability awkwardness (very un-Apple), it’s not clear how to set the shortcut. Double-click to the right of the row below the dock hiding shortcut, and an input field will appear. Perform your shortcut input there (I chose to use CMD-OPT-L). It’s set and will trigger now.

Labels:


posted by ruffin at 2/28/2012 01:08:00 PM
0 comments
Monday, February 27, 2012

version control - Git: how is a branch I'm not committing to ahead of origin/master - Stack Overflow:

To see the commits you have in HEAD that are not in origin/master:

git log origin/master..

To blow them away and make your HEAD the same as origin/master:

git reset --hard origin/master


I'm not sure that's ever The Right Way to use git -- or to program so badly that you'd rather blow it all up. But it could be useful if you've changed too much and need to build now. Interesting to know, though.

Labels:


posted by ruffin at 2/27/2012 11:11:00 AM
0 comments
Wednesday, February 22, 2012

select object_name
from dba_objects
where object_type = 'TRIGGER'
and status = 'INVALID';

Labels: ,


posted by ruffin at 2/22/2012 11:25:00 AM
0 comments

Aka, "Where did all my changes go, and why does this trigger's creation only work in sqlplus?"

Roland Bouman's blog: Oracle SQL Developer 1.1 Supports MySQL:
Sorry, that was a PEBKAC (Problem Exists Between User And Chair)

All I needed to do was turn on "auto commit" in SQL Developer.
Tools -> Preferences
Click next to Database,
Select Worksheet Parameters
Click checkbox to mark "Autocommit in SQL Worksheet"
Close SQL Developer and re-launch.

Problem solved.


More on how autocommit works in Oracle from an Ask Tom segment here (from 2000! though last updated this month).

I've always used SQuirreL-SQL when using Oracle to this point, and this hasn't been an issue. Very non-SQL Query Analyzer. Old habits die hardest, I guess.

Labels: , ,


posted by ruffin at 2/22/2012 11:09:00 AM
0 comments
Friday, February 17, 2012

How can I use Oracle SQL developer to run stored procedures? - Stack Overflow:

I highlight it in the SQL*Developer Object Navigator, invoke the right-click menu and chose Run. (I could use ctrl F11.) This spawns a pop-up window with a test harness. (Note: If the stored procedure lives in a package, you'll need to right-click the package, not the icon below the package containing the procedure's name; you will then select the sproc from the package's "Target" list when the test harness appears.)


Man, that's more difficult than T-SQL. I was supposed to be able to figure that out without help? Hello, non-intuitive. Why I can't just call or exec sprocName(param1, param2) and have it display results (even if via an outCursor) in the results window, I have no idea. Over 24k views for that thread, and it's only a year old.

Aside: Hard to believe Joel Spolsky is responsible for this thing, not because he doesn't often have good ideas, but because he seems to almost have too many. StackOverflow is awesomez. Why Fog Creek doesn't have some mainstream software everyone uses quickly becomes the more interesting question. Is Spolsky just a programmer who is good at managing programmers writing software for programmers, but that's it?

Labels:


posted by ruffin at 2/17/2012 12:07:00 PM
0 comments

oracle - Problem with execute procedure in PL/SQL Developer - Stack Overflow:

Calling stored procedures using execute as above is specific to SQL*Plus. In fact, SQL*Plus converts execute some_proc() into BEGIN some_proc(); END;...

Labels:


posted by ruffin at 2/17/2012 11:34:00 AM
0 comments

select * from ALL_CONSTRAINTS where constraint_name = 'YoConstraint'

Had one that wouldn't drop when the table was dropped (with CASCADE CONSTRAINTS;), and had to go search to see where the constraint with the same name as the one I was re-building lived. Voila.

(No, my constraint in production was not called 'YoConstrait'. That's yo' constraint name, not mine, okay?)

Labels: ,


posted by ruffin at 2/17/2012 08:57:00 AM
0 comments
Thursday, February 16, 2012

Type this exactly, though you'll see something slightly different...

:1,$ s/Ctrl-QCtrl-M/\r/g

It'll look like...

:1,$ s/^M/\r/g

... which is what we wanted, right?

Labels: , ,


posted by ruffin at 2/16/2012 10:03:00 AM
0 comments
Wednesday, February 15, 2012

Gruber at Daring Fireball does a heck of a job correcting the impression Walter Isaacson gives of Steve Jobs's philosophy of design:

What Schiller is telling Isaacson is that prior to Jobs’s return to Apple, design was what happened at the end of the engineering process. Post-Jobs, engineering became a component of the design process. This shift made all the difference in the world.

Isaacson does not understand this, and his telling of the Antennagate saga illustrates this perfectly. Again, the aforequoted bit from Chapter 26:

On occasion this could backfire, such as when Jobs and Ive insisted on using a solid piece of brushed aluminum for the edge of the iPhone 4 even when the engineers worried that it would compromise the antenna.


The edge of the iPhone 4 (and now 4S) is the antenna. And it’s not made of brushed aluminum — it’s bead-blasted stainless steel. ... The trade-off was that moving the antennas to the outside left more room on the inside — room for a bigger battery, other components, and allowed for the device to be thinner. Isaacson paints Jobs and Ive as being concerned only with how it looked and felt, with engineers left to worry about how it worked. The truth is that the design was how it worked.


It's a well-nuanced piece -- one of Gruber's best, and that's saying something -- explaining Apple's success in becoming what Gruber calls not a software or hardware but an "experience company" . Awfully insightful, and worth reading.

posted by ruffin at 2/15/2012 07:26:00 AM
0 comments
Tuesday, February 14, 2012

There's just enough here that I'd like to be able to come back and not once again reinvent the wheel. The locking in particular is something I often overlook when I re-roll app logging. I made a couple of edits from my "real" code to this generic code, so I'll have to test and come back if there are issues.

private static object _LogLock = 0;     // needs to be at the containing object's level
// so, in this case, static object global

// Convenience function to log jive.
public static void logStuff(string strToLog)
{
// obviously C:\temp must exist
string strLogFile = "C:\\temp\\appLog.log";
string strDateFormat = "MM/dd/yyyy hh:mm:ss.fff tt";

try
{
// When you have multiple AJAX (because, duh, asynchronous)
// calls going at once which, each of which might be calling
// parts of your .NET website that log stuff, you're likely to
// eventually run into concurrent logStuff calls. And since
// one "logStuff" might have your log file locked when the
// second comes along and also wants to log some stuff, you're
// going to want to lock the process so that you don't throw
// exceptions. Now, the second logStuff call will wait
// patiently until the lock on _LogLock is released.

// More information here:
// http://stackoverflow.com/questions/7419172/streamwriter-lock-not-working
// http://msdn.microsoft.com/en-us/library/c5kehkcz(v=vs.71).aspx
lock (_LogLock)
{
if (!File.Exists(strLogFile))
{
// Create a file to write to.
using (StreamWriter sw = File.CreateText(strLogFile))
{
sw.WriteLine("Our application's log file.");
sw.WriteLine("Created "
+ DateTime.Now.ToString(strDateFormat));
sw.Close();
}
}

// This text is always added, making the file longer over time
// if it is not deleted or cleaned up.
using (StreamWriter sw = File.AppendText(strLogFile))
{
sw.WriteLine(DateTime.Now.ToString(strDateFormat) + ":");
sw.WriteLine("\t" + strToLog.Replace("\n", "\n\t"));
sw.Close();
}
}
}
catch (Exception e)
{
// probably b/c C:\temp\ doesn't exist or isn't accessible.
System.Diagnostics.Debugger.Break();

// insure that's the problem.
// In production, if you forget to remove this exception handler
// or to move log location to something valid on the server/box,
// it'll quietly fail.
}

}

Labels: , ,


posted by ruffin at 2/14/2012 12:52:00 PM
0 comments

Enumerable.ToDictionary(TSource, TKey) Method (IEnumerable(TSource), Func(TSource, TKey)) (System.Linq):

class Package
{
public string Company { get; set; }
public double Weight { get; set; }
public long TrackingNumber { get; set; }
}

//...

// Create a Dictionary of Package objects,
// using TrackingNumber as the key.
Dictionary dictionary =
packages.ToDictionary(p => p.TrackingNumber);


Oh, good heavens. Really? Lambda expressions? Obfuscationing weirds language.

(In retrospect, that last sentence would potentially make for a better blog name.)

Labels: ,


posted by ruffin at 2/14/2012 10:10:00 AM
0 comments
Saturday, February 11, 2012

Just watched the trailer for the new Spider-Man. Looks a lot more like what I enjoy about the comic than the Toby Maguire version. Lots of bullet dodging, and maybe a little more non-supervillain head-knocking. I didn't see much of the Peter Parker self-deprecating humor, but I did see a lot of who I assume is Gwen Stacy, who everyone with any sense has always thought was, ultimately, a better match for Puny Parker than MJ. She really was wasted in the last version; hopefully the rebooted Gwen will be much more interesting. (Though having an actress known for having red hair and who, honestly, has a face that looks a ton like MJ did in the early comics play Gwen Stacy is ironic at best.)


But what's best to see? The web-shooters are back! Like the canary in the coal mine, seeing a Spidey with some strange genetic mutation that makes webs come out of his wrists "naturally" always seemed wrong, even in light of the newer plot in the comic that Peter has more innate powers than we suspected (another shark jumping, honestly, if they don't handle it right).

Still, having real web-shooters instead of compromising the working myth to be all timely and snizznet makes me feel the 'slinger is in better hands this time.

Labels: ,


posted by ruffin at 2/11/2012 12:37:00 PM
0 comments
Friday, February 10, 2012

Amitava's Technical Diary: Nesting ExtJS 2.0 TreePanel inside Accordian:

Nesting ExtJS 2.0 TreePanel inside Accordian
The Accordian panel in ExtJS 2.0 javascript framework, will error out if an item (Ext.Component) does not possess a header. The easiest way to create an header is to set the title property.


Was having some trouble getting a TreePanel to render as a child in another Panel in ExtJS 2.2. Bizzarre. It'd render if I'd put it directly into a DIV (renderTo set for the TreePanel) and the other Panel into another, but if I removed renderTo from the TreePanel and stuffed it into that other Panel, BLAMMO. ct is null. Enjoy.

Lots of weird stuff in ExtJS. I've seen it act unhappy if you don't have an id set for an object. Now, maybe a header is occasionally assumed as well? /sigh Neat overall, but a little rough around the edges.

Labels: ,


posted by ruffin at 2/10/2012 04:46:00 PM
0 comments
Thursday, February 09, 2012

Datatypes In SQLite Version 3:

Note that a declared type of "FLOATING POINT" would give INTEGER affinity, not REAL affinity, due to the "INT" at the end of "POINT".


Oh, well, sure. Wait... what?

posted by ruffin at 2/09/2012 11:00:00 PM
0 comments

SELECT * FROM all_tab_columns

Enjoy.

Labels: ,


posted by ruffin at 2/09/2012 10:31:00 AM
0 comments
Wednesday, February 08, 2012

CreativeTechs Tips: Can't Eject a Disk? Find Which Files are Open.:

Put this all together, and you get this:
lsof | grep /Volumes/Workspace

In English: Get a list of all the open files, and show me a list of those results that are on this particular volume.

posted by ruffin at 2/08/2012 10:44:00 AM
0 comments

Determining if an object property exists | NCZOnline:
//doesn't accurately test for existence
if (person.name){
//yay! property exists!
}

At first glance, this seems okay. However, understanding how JavaScript works reveals some problems with this approach. First, this will only succeed if the value of person.name is truthy, meaning it’s an object, a non-empty string, a non-zero number that’s not NaN, true, and not null or undefined. That means if person.name is the empty string (“”), this check will fail. Failing, in this case, doesn’t mean that the property doesn’t exist. In fact, the property does exist and contains a value, but the value is falsy and so doesn’t pass this test. [emph mine -mfn]


In retrospect, he's only going Colbert on us twice, but it made me chuckle anyhow. I'd seen the truthy phrase before, but not used with quite so much unselfconscious aplomb.

And I wondered about that shortcut check for existence. It looks like what I want is, indeed, if ('propertyName' in object), though hasOwnProperty() comes up again as well if you want an object-specific check.

In other news, I'm over 2000 posts -- blogger says 2007. I've almost blogged my year. Sorta. Which answers the question: If over two thousand blog posts fall in the woods...

Labels: ,


posted by ruffin at 2/08/2012 09:30:00 AM
0 comments
Friday, February 03, 2012

array.contains(obj) in JavaScript - Stack Overflow:

As others have said, the iteration through the array is probably the best way, but it has been proven that a decreasing while loop is the fastest way to iterate in JavaScript. So you may want to rewrite your code as follows:

function contains(a, obj) {
var i = a.length;
while (i--) {
if (a[i] === obj) {
return true;
}
}
return false;
}


Speed savings because you're not checking i against a value. i against a.length requires a lookup each time. i against len, where len is precached with len=a.length still looks up len. This simply evaluates i.

posted by ruffin at 2/03/2012 11:49:00 AM
0 comments

Unfortunately I'm stuck on ExtJS 2.2 in a current project, so I'm not sure how well this carries over, but I've done a crudload of work looking though the code, extending Store, GridPanel, and JsonReader and creating a custom ColumnModel etc etc. And this is where I think I am with mapping the Store.load() to GridPanel lifecycle, pulled from some code comments:

   1 //==============================================
   2 // Use the reader to create the data store
   3 //==============================================
   4 // note that I've subclassed Store (as MyQueryDataStore) here. 
   5 // No operational difference in this code, however.
   6 var myStore = new MyQueryDataStore({
   7         url: './json/gridValues.json',
   8         reader: myReaderTest
   9 });
  10 
  11 // How to iterate the data once it's returned, remembering that we're
  12 // dealing with an asynchronous paradigm here.
  13 myStore.on("load", function(s,rs) {
  14         console.log("and we're back");
  15         this.each(function(record) {
  16             //var strFieldName = this.fields.get(3).name;
  17             //console.log('record data from callback: ' + record.get(strFieldName));
  18         });
  19 });
  20 myStore.load(); // AJAX call to get the data happens now.
  21 // the Store is going to call the load method of its local
  22 // HttpProxy...
  23 // this.proxy.load(p, this.reader, this.loadRecords, this, options);
  24 // ... the request sent to the server has a callback referenced to
  25 // the store's loadRepsonse method, which includes a call to read
  26 // the response with the referenced DataReader.
  27 //
  28 // Afterwards, the proxy calls the Store's loadRecords method.
  29 // The already Read response is passed with that call as [o] in
  30 // loadRecords' first parameter.
  31 //      loadRecords : function(o, options, success){
  32 //          ...
  33 //          var r = o.records, t = o.totalRecords || r.length;
  34 //
  35 // And voila.  That's the life of a JSON return to DataStore request.

That's close, anyway. I'll clean up the custom objects at some point and post a tutorial, just to add to my other obsolete technology intros, like the Atari 2600 programming on an OS 9- Mac pages.

One quick editorial comment: The "debug" version of ExtJS, at least at version 2.2, shows a programmer more interested in showing off than creating self-commenting code (though don't miss caveats one and two). If you're not going to comment your code, there's no reason to also obfuscate by hand and tell others (like at least one unhelpful dude employed by Sencha won't stop doing on their forums) that the answers to all your questions will be revealed not by asking for help when you're mentally exhausted (okay, some questions are horrible, but still...), but by forensic examination of ext-all-debug.js. This hand-obfuscation is exactly what you find in ExtJS. The best example I've found so far, unless I've missed something, is in JsonReader.

From my flowerbox:
 * In Ext.data.JsonReader, for some reason, the equivalent variable in readRecords
 * for [fieldManager] (in that case, named [f]) was used to perform the tasks of both
 * [fldColumnArchetype] and [fieldCurrent] variables here.  I think it's just an
 * obfuscation technique (like the reused [v] throughout), as the use here seems
 * to have no relationship with the original fieldManager declaration.  That is,
 * you could have used [foo] in either spot if you'd wanted, but they strangely
 * and unintuitively recycled instead. (Or I've missed something important!) The
 * kingdom for a strongly typed language...
 *
 * There were other occurrences of poorly scoped variables and var choices, like...
 *  var s = this.meta;    // This var only made things *less* self-commenting.  Gone.
 * ... that have been removed from the JsonReader codebase.  It's like the code
 * had been minimally minimized and purposely obfuscated, but only partially so --
 * and that obfuscation done by hand.

And let's just say that variables named r,f,fi,fl,v,g are bad enough before they're reused without even a passing regard for typing.

/end rant

Labels: , , ,


posted by ruffin at 2/03/2012 09:10:00 AM
0 comments
Wednesday, February 01, 2012

Finally bothered to figure out what call() does, precisely, and why it needs 'this' passed in as an "extra" parameter.

Great explanation here, in odetocode.com:

var x = 10;
var o = { x: 15 };
function f(message)
{
alert(message);
alert(this.x);
}

f("invoking f");
f.call(o, "invoking f via call");


So the deal is that "this" becomes the "new" "this" within the function, making it approximate a real object oriented overload. So if you're, say, extending some ExtJS objects in ExtJS 2, this is how you'd call the superclass' functions from the class' extension.

So in Sencha's tutorial, you're first, very smartly, making a trivial extension of an existing object with code like this...

    initComponent:function() {
// call parent initComponent
Ext.ux.IconCombo.superclass.initComponent.call(this);
} // end of function initComponent


So initComponent will do the same that it's always done, but will pull in the extended (though, for now, only trivially extended with no new functionality) object's methods, props, etc. when "this" is called.

The whole Javascript revolution still seems like a giant kludge, but that obviously doesn't make it evil. It's a good hack, but takes a little head rethreading.

Labels: , ,


posted by ruffin at 2/01/2012 10:03:00 AM
0 comments

Support freedom
All posts can be accessed here:


Just the last year o' posts:

URLs I want to remember:
* Atari 2600 programming on your Mac
* joel on software (tip pt)
* Professional links: resume, github, paltry StackOverflow * Regular Expression Introduction (copy)
* The hex editor whose name I forget
* JSONLint to pretty-ify JSON
* Using CommonDialog in VB 6 * Free zip utils
* git repo mapped drive setup * Regex Tester
* Read the bits about the zone * Find column in sql server db by name
* Giant ASCII Textifier in Stick Figures (in Ivrit) * Quick intro to Javascript
* Don't [over-]sweat "micro-optimization" * Parsing str's in VB6
* .ToString("yyyy-MM-dd HH:mm:ss.fff", CultureInfo.InvariantCulture); (src) * Break on a Lenovo T430: Fn+Alt+B
email if ya gotta, RSS if ya wanna RSS, (?_?), ¢, & ? if you're keypadless


Powered by Blogger etree.org Curmudgeon Gamer badge
The postings on this site are [usually] my own and do not necessarily reflect the views of any employer, past or present, or other entity.