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.

As an Amazon Associate, I earn from qualifying purchases. Affiliate links in green.

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!

Monday, May 26, 2008

UPDATE: Okay, marginally I understand what I was doing in the post, below, but I have no idea what problem it fixed. The description is awful. I mean, it must have done something for me, but I now have no idea what. Way to go, self.


So spaces come before letters, either case in our good friend, the American Standard Code for Information Interchange. This is a pain, because it means Java's Collections' binarySearch is going to tell us an entry for "special sauce" should come before "special", which probably isn't what we wanted. So we've got to write our own Comparator to make things pop out the right way.

Here's what I've got so far. Enjoy. Well named, I might add.
(c) 2008 Bailey
package com.rufwork.run;

import java.util.Comparator;

public class JoeComparator implements Comparator {

public int compare(Object arg0, Object arg1) {
int intReturn = 0;
String strFirst = arg0.toString();
String strSecond = arg1.toString();

int intShorter = 0;

if (strFirst.length() < strSecond.length()) {
intShorter = strFirst.length();
} else {
intShorter = strSecond.length();
}

int i = 0;

while (0 == intReturn && i<intShorter) {
int intCharForFirst = strFirst.charAt(i);
int intCharForSecond = strSecond.charAt(i);

// we want "space" to come *after* all chars
// otherwise "special sauce" comes *before*
// "special"
if (32 == intCharForFirst) {
intCharForFirst = 257;
}
if (32 == intCharForSecond) {
intCharForSecond = 257;
}

if (intCharForFirst < intCharForSecond) {
intReturn = -1;
} else if (intCharForFirst > intCharForSecond) {
intReturn = 1;
}

i++;
}

// we only know right now that the strings are the same
// to the length of the shorter string.
if (0 == intReturn) {
if (strFirst.length() < strSecond.length()) {
intReturn = -1; // strFirst comes first
} else if (strFirst.length() > strSecond.length()) {
intReturn = 1;
} // if they are the same length, stay at 0
}


if (false) { // some debugging jive
if (1==intReturn) {
System.out.println(strFirst
+ " is larger than " + strSecond);
} else if (-1==intReturn) {
System.out.println(strSecond
+ " is larger than " + strFirst);
} else if (0 ==intReturn) {
System.out.println("Same strings: "
+ strFirst + " :: " + strSecond);
} else {
System.out.println("Something wack happend: "
+ strFirst + " :: " + strSecond);
}
}

return intReturn;
}

/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub

}

}

Labels: , ,


posted by ruffin at 5/26/2008 11:38:00 PM
Sunday, February 11, 2007

I'm a big fan of text email, both for consistancy of presentation on your reader's platform and to cut down on unneeded bandwidth. I don't care if it takes two and a quarter seconds to load your email, that's too long. If I need to view pictures, include them as attachments.

This trick from the O'Reilly Network seems awfully useful, and I'll be trying it out soon. What it does is makes emails that come in multipart format display as plain text, as long as one of the parts is a plain text format version of the message.

It turns out, though, that you can force nearly all of your inbound messages into plain text mode. Make sure Mail isn't running, then launch the Terminal (in Applications -> Utilities) and type this (hit Return at the end):
defaults write com.apple.mail PreferPlainText -bool true


Now that's useful, imo. Note this isn't about *composition* in plain text, but reading emails in plain text as long as it's possible. Neat-o.

Labels: , ,


posted by ruffin at 2/11/2007 04:00:00 PM

<< Older | Newer >>


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.