Archive for the ‘Random’ Category

Rtf2Html 1.22

New stuff:

  • UI tweaks
  • Removal of block indent (where every line is indented) from pasted RTF text
  • Tweaks for better HTML output (e.g. no more useless span tags containing only whitespace)
  • Accurate preview using XULRunner (via GeckoFX); no longer using the stupid .NET WebBrowser control
  • New logo/icon (I just really hated the old one I made and it was bugging the hell out of me)

Rtf2Html logo

Download here
(requires .NET Framework 2.0 or higher)

Rtf2Html screenshot

The app was designed around the goal of being able to quickly copy and paste snippets of code from Visual Studio (or Netbeans) and turning it into HTML that I could embed in these blog posts; this update stays true to that, and that’s why this app is still so sparse on features, such as conversion of font size or paragraph alignment attributes.

The block indentation removal that now occurs after text is pasted in may be a bit slow. Text in the RichTextBox is selected and altered within the text box itself (it’ll also freeze the UI – if you understand multithreading and WinForms, you know why it’s not simply a matter of spawning off a thread). The alternative is to deal with an RTF parser and edit the RTF input directly, but that’s way more work than I’d care to devote to this app at the moment.

Old school

Came across this while clearing out some old stuff from my bookshelf,

visual basic 3.0 programmer's guide

Paper Half-Life 2

Incredibly impressive,

Italy from space

A nighttime picture of Italy taken from the Cupola observation deck of the International Space Station:

italy from space

(I modified brightness + contrast, and sharpened a bit)

The haversine formula

I had to do a little research into calculating distances between 2 points on the Earth, as I wanted the latest version of the dotspott webOS app to calculate the distance from your current position to your spotts.

dotspott webOS app 1.4.4

The page at Movable Type on the subject proved to be an amazing resource.

I ended up doing an straightforward implementation of the haversine formula:

R = mean radius of earth = 6,371km Δlat = lat2 - lat1 Δlong = long2 - long1 a = sin²(Δlat/2) + cos(lat1) · cos(lat2) · sin²(Δlong/2) c = 2 · atan2( sqrt(a), sqrt(1-a) ) d = R · c

The Javascript code (HSD.CurrentGlobalPosition.LatLong is a string with the device’s current position as a latitude,longitude pair):

HSD.Math.toRad = function(deg)
{
    
return deg * (Math.PI/180);
}

HSD.CurrentGlobalPosition.calcDistance =
function(_targetLat, _targetLon)
{
    
var latlongParts = HSD.CurrentGlobalPosition.LatLong.split(',');    

    
var lat1 = parseFloat(latlongParts[0]);
    
var lon1 = parseFloat(latlongParts[1]);
    
var lat2 = parseFloat(_targetLat);
    
var lon2 = parseFloat(_targetLon);
    
    
var R = 6371; // km
    
var dLat = HSD.Math.toRad(lat2-lat1);
    
var dLon = HSD.Math.toRad(lon2-lon1);
    
var a = Math.sin(dLat/2) * Math.sin(dLat/2) + Math.cos(HSD.Math.toRad(lat1)) * Math.cos(HSD.Math.toRad(lat2)) * Math.sin(dLon/2) * Math.sin(dLon/2);
    
var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a));
    
var d = R * c;
    
    
return d;

}

The result is the distance to the target in kilometers.

AltaVista

Everyone’s mourning the death (perhaps prematurely) of delicious but it’s worth nothing that the search engine AltaVista is going to be shut down as well; its time has come, but it’s still somewhat sad to see it go.

altavista logo

Steven Vaughan-Nichols @ ZDNet echoed my sentiments perfectly,

“AltaVista was Google before there was Google.”

If you remember web search in the 90s you, of course, remember Yahoo, but Yahoo along with all of its contemporaries snubbed search in favor of navigating and drilling-down into specific categories. If what you were looking for didn’t fit nicely into a category, it was like finding a needle in a haystack, assuming you were able to find the needle at all. Another not-so-fond memory of web search in the 90s is the continual intrusion of more and more invasive ads. Yahoo was cleaner than most, but sites like Excite peppered their sites with popups and banners; I distinctly remember by system freezing simply from going to excite.com.

AltaVista was revolutionary: sleek, minimal design focusing on text input (though, there was categories at a certain point), good results, and no annoying ads.

So, goodbye AltaVista, and thanks for all the fish.

Code at 7th

Snapped someone’s HTML graffiti on this pole at the 7th Avenue subway in Park Slope:

HTML code @ 7th avenue subway

Wordle

Discovered wordle on someone’s twitter feed. I love this thing. Here’s the wordle of my post on Enyo:

wordle on enyo

Square, accept credit card payments anywhere

I don’t really have a use for it, but Square seems pretty damn cool…

Accept card payments with no contract, monthly fees, or hidden costs. Just plug a free card reader into your mobile device and start swiping.

square credit card payment

The transaction fees are reasonable (I think, I’m not really an expert here):

2.75% + 15¢ for swiped transactions

3.5% + 15¢ for keyed-in transactions

There are no activation, gateway, monthly, early termination, or hidden fees.

VirtualBox updates

I love VirtualBox, but come on, implement an automated updater already!

virtualbox update