it’s a hunk of javascript that lives inside a link. in order to “install” it, you drag this link (BlogThis!) to your links bar, and when you click the link, it launches a popup with a mini-blogger post editor, prefilled with an html link pointing to the page you were at.
but BlogThis! does three things i don’t like:
the link text is always set to the title of the webpage (Boing Boing: A Directory of Wonderful Things)
if any text is selected on the webpage when clicking “blogthis”, it gets inserted after the link (Liberal MPs on the take from copyright industries)
the selected blog (justinsomnia) appears to be the blog that was most recently updated, but that’s not the one i want by default
instead, i’d like for the link text to be the selected text (unless no text is selected–then the title is ok) and i want to specify in advance which blog to post to. for grins and giggles, i want to change the size of the popup window, so that it’s wider and shorter (a size more befitting of a link).
turns out the original javascript was pretty hackable (it just had to be reformatted to be understood):
all the junk above the last line is trying to get at what text you’ve selected when the BlogThis! link was clicked and setting that to the variable “Q”.
the magic happens in that last line, where the query string (the part after the “?”) determines how blogger presents the BlogThis! popup. the query string can be modified to set the link text “n” to the selected text “Q” and if no text is selected, then set the link text to the “document.title”.
changing the size is easy. just modify the width and height values. i like width=800 and height=200.
making BlogThis! default to a specified blog required digging through the BlogThis! source and a little luck. every blog has a blogID which you see in the URL when you select that blog from the dashboard (http://www.blogger.com/app/blog.pyra?blogID=4126639). so i added “blogID” to the query string with the blogID number i wanted and it worked!
this is cool if you only use BlogThis! for one blog among many (like me), but i can imagine creating several custom BlogThis! links for all of your frequently updated blogs.
here’s the simplified scenario: i’ve got a publication table and a publication_status table. when creating a new publication, a record needs to be inserted into both tables. when updating the status of an existing publication, a record only needs to be inserted into the publication_status table. thus, there is a one to many relationship between publication and publication_status.
what if during the process of creating a new publication, inserting a record into the publication_status unexpectedly fails. i want the database to automatically rollback the inserted publication record.
here’s the pseudo-code outline:
begin transaction
insert publication record
get new publication_id
insert publication_status record
if fails, rollback transaction
if succeeds, commit transaction
here’s the problem: when you query the database for the max publication_id (which is bad in practice i know) you get the max id prior to the beginning of the transaction. agh!
so how do you get the id for the recently inserted record in microsoft access? apparently you query the table for @@IDENTITY. uhh…ok.
here’s what the actual vba code looks like:
' begin transaction
ws.BeginTrans
' insert publication record
db.Execute ("INSERT INTO publication (publication_number) VALUES (" & Me.txt_publication_number & ")")
' get new publication_id
Set rst = db.OpenRecordset("SELECT @@IDENTITY AS insert_id FROM publication")
int_publication_id = rst.Fields("insert_id")
' create publication_status
db.Execute ("INSERT INTO publication_status (publication_id, publication_status_type_id) VALUES (" & int_publication_id & "," & int_publication_status_type_id & ")")
' rollback transaction if there was a problem, else commit
If db.RecordsAffected <> 1 Then
MsgBox "Error adding publication status"
ws.Rollback
Else
ws.CommitTrans
End If
in dublin core, every metadata element (like “creator” or “description”) can be used zero, one, or many times to describe a resource. eli naeher designed the template above using javascript and DOM so that any end user could modify the template itself in the browser. which makes dom especially important for accessing and modifying the elements in web user-interfaces.
in web database applications (such as my masters project), there are many places where an information object (such as an expense) needs to be described in terms of one or more instances of another class of information objects (such as activities). the problem from a UI design perspective is that there may be no maximum number of objects allowed to describe an object.
so using some modifications on the code from nc echo, I created the following functional UI mock-up, essentially a structured spreadsheet that allows dynamically growing or shrinking sets of select and text fields for reviewing and editing the many-to-many relationships between objects.
update: i’ve added an operational version below. here’s the code.
One person can be in one or many photos and one photo can contain zero, one, or many people. List all the people who are in photos along with the filename and the description of the photo(s) they are in. People and photos may be listed multiple times, but a person will never be in the same photo twice (assuming the photos haven’t been doctored).
Microsoft Access Query by Example (QBE)
SQL generated by Microsoft Access
SELECT [tblPeople].[LastName], [tblPeople].[FirstName], [tblPhotos].[Filename], [tblPhotos].[Description] FROM (tblPeople INNER JOIN tblPeopleInPhoto ON [tblPeople].[PeopleID] = [tblPeopleInPhoto].[PeopleID]) INNER JOIN tblPhotos ON [tblPeopleInPhoto].[PhotoID] = [tblPhotos].[PhotoID] WHERE ((([tblPeople].[LastName]) Is Not Null) And (([tblPeople].[FirstName]) Is Not Null));
SQL cleaned up for readability
SELECT tblPeople.LastName,
tblPeople.FirstName,
tblPhotos.Filename,
tblPhotos.Description
FROM (tblPeople INNER JOIN tblPeopleInPhoto ON tblPeople.PeopleID = tblPeopleInPhoto.PeopleID)
INNER JOIN tblPhotos ON tblPeopleInPhoto.PhotoID = tblPhotos.PhotoID
WHERE (tblPeople.LastName Is Not Null)AND(tblPeople.FirstName Is Not Null);
some discussion of this came up after a question about trusted computing/palladium following cory’s talk about the eff. he described having to lie to his dumb bank to convince them that his browser of choice (ostensibly mozilla, safari, or opera) was in fact internet explorer so it would let him through to do his business.
well my browser of choice is mozilla (currently using 1.6, the latest stable version), and when i tried to make a payment using checkfree for my wachovia-branded MBNA credit card, i got this insanely stupid message:
Browser Upgrade Required We have detected that your browser is an older version of Netscape. You must upgrade to Netscape Navigator 6.2 or later.
so i had to lie to my bank by downloading the very cool User Agent Switcher to pretend to be internet explorer to get through their DUMB browser detection script to pay my credit card bill. sheesh!
in other frustrated computer user news, my beloved laptop has developed a problem: when i plug it in, it appears to short itself out and shut off. so i’m sending it in to have the system board replaced (again)—at possibly the WORST time ever to be without my laptop. suffice it to say i’m backing up the hard drive and burning a cd of all master’s paper relevant documents. *sniff sniff* word up though: ibm thinkpad support rulez. box arrived at 10am today after calling last night after 6pm and they promise a max 5 day turn-around.