CSS Rounded Corners Without Images

Friday, February 24, 2006

I found a neat trick the other day at http://www.cssplay.co.uk/boxes/snazzy.html. It's not new, but its CSS2, cross-browser compatable, and uses no scripting.

For those interested, the illusion is accomplished by placing graduated 2px and 1px tall div tags, with specific border attributes, below one another.

<style type="text/css">
#xsnazzy h1, #xsnazzy h2, #xsnazzy p {margin:0 10px; letter-spacing:1px;}
#xsnazzy h1 {font-size:2.5em; color:#fff;}
#xsnazzy h2 {font-size:2em;color:#06a; border:0;}
#xsnazzy p {padding-bottom:0.5em;}
#xsnazzy h2 {padding-top:0.5em;}
#xsnazzy {background: transparent; margin:1em;}

.xtop, .xbottom {display:block; background:transparent; font-size:1px;}

.xb1, .txb2, .txb3, .txb4,
.bxb2, .bxb3, .bxb4 {display:block; overflow:hidden;}

.xb1, .txb2, .txb3,
.bxb2, .bxb3{height:1px;}
.txb2, .txb3, .txb4 {background:#d4d4d4; border-left:1px solid #000000; border-right:1px solid #767676;}
.bxb2, .bxb3, .bxb4 {background:#d4d4d4; border-left:1px solid #000000; border-right:1px solid #767676;}

.xb1 {margin:0 5px; background:#767676;}
.txb2 {margin:0 3px; border-width:0 2px;}
.txb3 {margin:0 2px;}
.txb4 {height:2px; margin:0 1px;}
.bxb2 {margin:0 3px; border-width:0 2px;}
.bxb3 {margin:0 2px;}
.bxb4 {height:2px; margin:0 1px;}

.xboxcontent {display:block; background-color:#d4d4d4; border:0 solid #767676; border-width:0 1px;}
</style>


<!--Somewhere In The Document-->
<div id="xsnazzy" style="width:75px;">
  <div class="xtop">
    <div class="xb1"></div>
    <div class="txb2"></div>
    <div class="txb3"></div>
    <div class="txb4"></div>
  </div>


<div class="xboxcontent" style="height:65px;">
<table cellpadding=0 cellspacing=0 border=0 width="100%" height="100%" valign="center"><tr><td align="center">Test</td></tr></table>
</div>


  <div class="xbottom">
    <div class="bxb4"></div>
    <div class="bxb3"></div>
    <div class="bxb2"></div>
    <div class="xb1"></div>
  </div>
</div>

Word Scrambling Fun

Sunday, February 19, 2006

I am a very briong prseon. To porve to eoyrvene that I sepak the turth I will dcseribe the way I sepnt a few munties of my life Sudnay ngiht.

A wihle back I read an actrile aobut how well popele can dhpcieer smlcbared wrods. It truns out that ppoele can sitll uarsntdend a srmcblaed word as long as you keep the frist and last letetrs the same.
I find this very inseettring from a pocsyholgy pecesrtpive. But, that is nteiher here nor tehre. I diecded I sohuld wirte a pgroram to do it for me. Why would I "watse" my time doing siheotmng so folvroius, uelsess, and "sutpid"? I wtaned to. So I sat down and hrmemaed out the prgroam in C# 2.0. (I cohose C# 2.0 because it was at hand, nhtiong more.) I would conidser it ftfeien munties well spent.


private void replace(ref string s, int startpos,string newvalue)
{
StringBuilder sb = new StringBuilder();
if(startpos > 0) sb.Append(s.Substring(0, startpos));
sb.Append(newvalue);
if (startpos + newvalue.Length < s.Length) sb.Append(s.Substring(startpos + newvalue.Length));
s = sb.ToString();
}

private string scramblestring(string s)
{
if (s.Length > 3)
{
StringBuilder sb = new StringBuilder();
Random r = new Random();
do
{
sb = new StringBuilder();
int val = 0;
List ca = new List(s.ToCharArray(1, s.Length - 2));
sb.Append(s[0]);
while (ca.Count > 0)
{

val = r.Next(0, ca.Count-1);
sb.Append(ca[val]);
ca.RemoveAt(val);
}
sb.Append(s[s.Length-1]);
}while(s.Length > 4 && sb.ToString() == s);
return sb.ToString();
}
else
{
return s;
}
}

private string scramble(string s)
{
Regex r = new Regex(@"\b[^\W\d]{4,}\b");
MatchCollection m = r.Matches(s);
if (m.Count > 0)
{
foreach (Match ma in m)
{
replace(ref s, ma.Index, scramblestring(ma.Value));
}
}
return s;
}

A Revenue Model For A Web Service Economy

Sunday, January 08, 2006

I prefer to consider history as a guide.
The best solution would be a layered model similar to the blender on my kitchen counter. You pay a one time fee for posession of a blender, but you must also pay a monthly service charge for the electricity it uses and any fees associated with the items being "blended".

Here is how I would break it down:
(Using the layer model from Phil Wainewright)
  • APIs: A fee based on usage
  • Aggregation services: A fee based on usage
  • Application services: A one time ownership fee
  • Serviced clients: A one time ownership fee unless included with the application service
Esentially this duplicates what we have now. The real problem is actually getting people to understand why they should pay.

Web n.0!

I have read numerous writers and bloggers claiming the coming of Web 2.0, and even Web 3.0. I don't remember anyone, actually involved in building the "World Wide Web", declaring a version one.
The Internet is about services being served by servers. Whether acting as a remote datastore (html, images, xml, etc.) or providing access to interactive processes via server scripts and cgi, it has always been this way. Maybe I'm just to old to really "get it".

Toby Still Needs Saving?

Tuesday, July 26, 2005

That’s right; Toby from http://www.SaveToby.com is still alive! After missing the $50,000, by June 30th, goal, Toby’s owner decided to secretly change the dead-line to Nov 6th, 2006. I don’t know if this is the first time this has happened. But, I can see how it could have happened numerous times before. I think he should just get out while he is still ahead.

On a more important note, I wonder what it would be like if dolphins had dolphin-made guns. I want this to happen. So, taking a page out of Jared Diamond’s book Guns, Germs, and Steel (http://www.pbs.org/gunsgermssteel/), I would like to propose an idea. We could teach dolphins to farm crops, farm animals, and domesticate animals. We could then sit back, for about 10,000 years, and enjoy the fruits of our labor.


Update (11/11/2005):

You can now donate to hurry Toby's demise at http://www.killtoby.com/.


The Second Rise of Bittorrent

Tuesday, July 19, 2005

The weak point in Bittorrent has always been the centralized tracker. But, with the addition of DHT in most new clients, the classic shift from method to application can now occur.Bittorrent can now be positioned as what it truly is, a high-demand file distribution system. Blah, blah, blah. What I’m trying to say is, Bittorrent style downloading will be built into open-source applications for file and media distribution.

Also, watch for Microsoft to code a working copy of it’s Avalanche system and attempt to sell it to enterprise application developers for mainstream application use. (Possibly writing it in one of it’s .Net languages.) Bram Cohen could cut them off if he changed the bittorrent license to allow for any use or charge a small fee for non-open-source applications. I emphasize the word “small” because Microsoft could easily undercut him, or give Avalanche away to encourage it’s use. (i.e. Netscape Vs. Internet Explorer) Honestly, I can see Microsoft doing both, giving Avalanche away for personal/small use, and selling it for enterprise development.This is neither here, nor there, if Avalanche never gets off the test bed. (I don’t care what anyone has said. I’ve seen the powerpoint. It’s just vapor-ware/research.)

Examples of bittorrent empowered applications: Videora, TV Mistress, SwarmTV, and Podcasting

I have even joined the fervor with my own open-source broadcatching program for windows, based on the official bittorrent core. I honestly don’t understand why this hasn’t been done many, many more times before. It took me just two days to get a working alpha version. (Project 16B)


Update (11/11/2005):
Getright 6.0 Beta has support for bittorrent downloads and mirrors. Allowing for downloading file segments via HTTP, FTP, and Bittorrent simultaneously. (Details)

Gizmondo: Mainstream GPS Gaming

Monday, July 11, 2005

This is a great day. Gizmondo, a new gameboy clone, comes equipped with a GPS receiver for location based games. The park down the street is now, potentially, Evilhorn the Evil’s evil stronghold, dungeon, and online Barnes&Noble. Think one step further and the world is now a one-to-one map of the gaming world. The parking lot you just drove into has seven fully grown razer-tooth drazbacs, which are two levels above you. Looks like you will have to put off grocery shopping until you can grind your way up to level 25.

While the GPS feature is amazing, especially for MMOGs, that is not why this is truly a great day. There is finally a way to lure young, pale, and muscularly underdeveloped people into centralized, unoccupied, and out-of-the-way places, and keep them distracted.

Web Service Based Web Sites

Monday, June 20, 2005

Web Services (ws) and Web Sites have many things in common. So, why not put them together? I gave it the classic "Jared try" to find out if I could. (http://blueblocks.lobberecht.com)

DB <-> Business Logic <-> Web Services <-> Web Browser

First, I had to make some allowances for the Web Browser. No browser, that I know of, will directly communicate with a ws. Browsers were designed to use pure HTTP. My solution was to create a PHP file to act as a ws proxy for the browser.
DB <-> Business Logic <-> Web Services <-> PHP proxy <-> Web Browser
(I used PHP because my host only supports PHP. You could accomplish this in any server-side language, perhaps even a client-side language, that has a ws library. I also used PHP for the SOAP webservices.)

I chose not to output HTML from my ws. HTML was designed to describe the look-and-feel of data, not content. My ws outputs standard XML, conforming to various specifications, based on the content (RSS for the News, etc.), to maintain it's programmatic accessibility and compliance to accepted standards. I still had to contend with the browser, because it is still a web site, so, I used XSLT to transform the XML into XHTML on the client side. The client side XSLT transformation does limit my audience to modern webbrowsers, such as IE6 and Firefox, but I'm not trying to make this site universally compatible. Besides, you should be running a modern browser for security reasons anyway.

Advantages:
None. There are no advantages, in this design, over having an HTML page and a separate XML page, expressing the same content, generated directly from the same datasource. I have, simply, made the conversion process, from data to HTML formatted response, serial. (DB->XML->HTML) Some would also consider this a weak point in the design, because the HTML is dependent on the XML and the DB instead of just the DB.
This might be a good design if the site is intended to be used programmaticly, with a fall-back to HTML for those who wish to use it that way.

Disadvantages:
A little more difficult to code, especially if you are already using a CMS or other HTML based template engines.

Tips:
Anyone returning XML from a Web Service should remember, the XML validator that validates the ws response will strictly validate your returned XML also. Make sure the returned XML is valid, has the <?xml version="1.0"?> tag, and a DOCTYPE or the whole ws response will not validate. You can also use a CDATA tag to enclose the response, but that did not work for me.

GeoURL

Friday, June 17, 2005

Google-depression strikes again!

GeoURL is a location-to-URL reverse directory. This will allow you to find URLs by their proximity to a given location. Find your neighbor's blog, perhaps, or the web page of the restaurants near you. It currently only lists 181,117 sites, but you can add sites for free.

When mobile internet devices incorperate GPS devices, businesses will want this!

Super Future Prediction: This idea will be officially folded into Google Maps. (Unofficially, It has already been done by Leigh Dodds.)

Code Signing on a Shoe-String Budget

Tuesday, June 14, 2005

I don't need a professional Code Signing infrastructure complete with 24/7 Indonesian support and free Hot Pocket delivery within the tri-state area. I just want to make sure people know they have something of mine for less than, or equal to, $0.

Solution 1 of 1:
Free code signing. (I must remind everyone of the lack of official support for what I'm about to describe. If you are running a real business, go pay the money.)

Requirements:
Windows (I'm using XP)
Compiled binary of OpenSSL
GlobalSign's PVK transform utility (Mirror)
Microsoft's code signing stuff (Mirror)

Steps:
Get a free certificate from Ascertia.
Note: The "Name" you enter will be the name seen on the certificate. Don't worry if you can't decide on a good name, you can change it after you register.

Generate and download the certificate using Internet Explorer.
It failed to download the ActiveX file in all the other browsers I tried, including Firefox.

Run certmgr.exe from codesigningx86, select the certificate, and export.
Select the option to export without the private key and in DER encoded binary. I did not test the other encoding methods, but, in theory, they all should work.
This should produce a cer file. I put all my files on the desktop to shorten all the path names. There is nothing worse than typing and searching for errors in long pathnames.

[I had a beautiful tutorial written just before the power went out. For speed, I will just give you the bare bones.]

cert2spc <insert cer file path> <insert new spc file path>

Run certmgr.exe, select the same certificate, and export again.
This time export the private key. Make sure "Include all certificates in the certification if possible" is checked and "Delete the private key if the export is successful" is unchecked.
This will export a pfx file. (Make sure to remember the password you set.)

openssl pkcs12 -in <insert pfx file path> -nocerts -nodes -out <insert new pem file path>

pvk -in <insert pem file path> -topvk -out <insert new pvk file path>

You only need the spc and pvk files, so you can, and should for security reasons, delete the other data files.

signcode -spc "<insert spc file path>" -v "<insert pvk file path>" -a md5 -i "<insert some information, usually your websites url>" -n "<insert short file description>" -t http://timestamp.verisign.com/scripts/timstamp.dll "<insert target file path>"

You don't have to pay Verisign to use their timestamp server. You should, and again you should just pay the money if you are running any form of business, but it works whether you do or not.

That will do it. You can verify the signature by opening the properties of the signed file, and clicking the Digital Signatures tab. If there is no Digital Signatures tab, you failed.

Thanks to Matthew Jones for the help.