Archive

Archive for the ‘code’ Category

IMG and DIV

December 5th, 2003 osterday 3 comments

I guess I’m still doing something wrong. My new design looks great in IE, but my “currently reading” section and “quote” divs seem to be screwed up in Firebird. I’ve tried a bunch of different things, but no luck yet. I thought “float” my be the problem, but my “quote” div doesn’t have float! Strange.

Categories: code Tags:

XML in Mozilla

November 9th, 2003 osterday Comments off

As I stated in my previous post, I found out that Mozilla does support some of the cool IE XML features. The “official” docs are at the XML Extras site at mozilla.org. If I get some time tonight, I might test some of the API. It’d be really great to see it work. As much as I like to bash Microsoft, the XML support in IE is really incredible and makes it nice to develop for. If I can do a few mods to make it work in Firebird, that’d be sweet!

Categories: code Tags:

Burning the midnight oil…

November 6th, 2003 osterday Comments off

Sometimes you do what you have to do. No posts for a little while because a project came up that was due yesterday so I had to hunker down and get it done. I’m getting too old for the all night coding sessions, but did stay up until 3am a few nights. (Sorry Jen, but you know I gotta pay the mortgage somehow!)

On the plus side, I was able to use a bunch of cool technologies to design this particular site. Since I didn’t have direct access to a database and had to use ASP, I used an XML file as the database and XSL to format the site from the database. Since I’ve been doing mostly backend work in the last few years, I also got a real crash course in CSS and DHTML.

I must say that the site looks really nice in IE and Firebird.

Also, the admin site was some really cool code – I know HTML forms are not the best way to capture data, but the browser is really great in some cases. I can be a perfectionist when it comes to layout and I took a lot of time getting my text boxes to look cool. Since I could dictate IE5+ for the admin site, I used MSXML extensivly. It’s really incredible what you can do. I love being able to capture data in an XML object on the client and pull down an XSL fill from the server and then transform it and pop the HTML into a div! And posting XML to the server is so much nicer than HTTP POST variables, etc. – I love not having to refresh a page or use hidden frames, etc., etc…

Since a file upload was involved, I decided to even post that as part of the XML data sent to the server, instead of two posts, one for the XML and one for the file. I found an article at 15 Seconds that laid out the basics of using ADO and the MSXML binary data types to create a base64 nodes from an ADO stream from the filesystem. Of course since ADO is accessing the local file system, the admin page has to be put into the “Trusted Site” in IE.

Also, besides learning a lot more MSXML, CSS, XSL, DHTML and XHTML. I found out the Mozilla (and I’m assuming Firebird, too) has something called “XMLHttpRequest()” which acts similar to MSXML, supposedly using the same API function calls. I found a few links, that I’d like to explore since I really like Firebird would love to support it more. (XUL Planet, Jibbering, and isolani’s Atom blog)

Once the site is made live, maybe I’ll put up links and post screen shots of the admin part. Anyway, now to step back, breath and catch up on life…

Categories: code Tags:

MSXML and Outlook XP

October 1st, 2003 osterday Comments off

Ever export emails from Outlook? Sucks, right? I mean why not have the date sent there? Date is pretty useful to me! Anyway, I’d rather have the output in XML over TXT or CSV. Since we needed it for an quick hack, I thought of throwing a bit of code together since I’ve worked with the Outlook object model on another project.

Before I began coding, I did a quick google and got some great resources back. This user contribution at TopXML was great! The macro was already written! Just give a filename and choose a folder and bam! You’ve got your emails in XML.

Pretty cool, I think. Also works for contacts, appointments and notes.

Note: Don’t forget to add a reference to “Microsoft XML, v4.0″ – look in Tools, References in the VB script editor.

In case that link dies, I’ve archived it here.

Categories: code Tags:

MSXML and Excel XP

October 1st, 2003 osterday Comments off

I know people complain – even myself – about Microsoft. OSes plagued with security flaws; products with tons of bugs… But MS does have some good technologies in my opinion.

MSXML is one of them. Very easy to work with in IE, VB and the Office XP products.

For example, in 10 – 15 lines of code (and a XSL file), I created an Excel macro to post data to our WebService servlet. (I can’t post the XSL file yet since our API isn’t public yet – still working out the details.)

The basic code is something like this:

Sub XMLtest()

Dim sourcexml As New MSXML.DOMDocument
Dim sourcexsl As New MSXML.DOMDocument
Dim transformxml As New MSXML.DOMDocument

Set sourcexml = New MSXML.DOMDocument
Set sourcexsl = New MSXML.DOMDocument
Set transformxml = New MSXML.DOMDocument

sourcexml.async = False
sourcexsl.async = False

sourcexml.loadXML ActiveSheet.Range(”A1:D1″).Value(xlRangeValueXMLSpreadsheet)

sourcexsl.Load “[local xsl file]”
transformxml.loadXML (sourcexml.transformNode(sourcexsl))

Dim xmlhttp As MSXML.XMLHTTPRequest
Set xmlhttp = New MSXML.XMLHTTPRequest
xmlhttp.Open “POST”, “[WebServiceURL]“, False
xmlhttp.send transformxml.XML
MsgBox xmlhttp.responseBody

End Sub

Categories: code Tags:

Displaying code…

September 30th, 2003 osterday Comments off

This is a cool little bookmarklet for escaping html/xml code to post. For now I just needed a quick and dirty hack, which it provides. I might get better results using Macros as recommened on the MT forums. Any other suggestions?

Categories: code Tags:

mt.setPostCategories

September 30th, 2003 osterday Comments off

I was having some problems the other day using mt.setPostCategories to set the category on my first test post using the XML-RPC API that MovableType provides. I found some info over at d2r, the code for mt.setPostCategories is just wrong – not even valid xml – and that ID in <name>categoryID</name> should be Id (arg!). So, I decided to learn more about XML-RPC and dug out some books and poked and proded until setting my category occurred without fault.

I still think that adding the primary category as part of the metaWeblog.newPost struct would be cool. It’s kinda crazy to post, set categories, republish. I’ve got a post in over at the MT forums asking this.

So now my little VB app works – just sends the XML-RPC raw – now to get into more of the XML document creation. (Why am I doing this? Just cuz I think XML is cool and have being playing around with the MSXML control a lot.)

Here’s the proper XML-RPC code for mt.setPostCategories: (I replaced tabs with spaces to make it look a little nicer on the web.)

<?xml version="1.0"?>
<methodCall>
<!-- The name of the method to call. -->
<methodName>mt.setPostCategories</methodName>
<params>
<param>
<value>
<!-- Entry ID. -->
<string>[MT ID of Entry]</string>
</value>
</param>
<param>
<value>
<!-- The username to post this entry under. -->
<string>[username]</string>
</value>
</param>
<param>
<value>
<!-- The password for the username supplied above. -->
<string>[password]</string>
</value>
</param>
<param>
<value>
<array>
<data>
<struct>
<member>
<name>categoryId</name>
<value>
<string>[MT ID of category]</string>
</value>
</member>
<member>
<name>isPrimary</name>
<value>
<boolean>true</boolean>
</value>
</member>
</struct>
</data>
</array>
</value>
</param>
</params>
</methodCall>
Categories: code Tags:

ebay api…

September 27th, 2003 osterday Comments off

for a project i’m working on, i’ve been doing some research on the ebay api. several months ago they only had one license for like $1000 per year. now you can sign up for four types of licenses, including an individual (and free) one! needless to say, i signed up – hey, another xml interface, sweet!

i’ve hacked together a simple vb app and java app to access the api site. the vb app is cool since it can just display the resulting xml in an ie browser control.

i actually was made aware of the new licenses browsing the ebay hacks book. it’s got a chapter on the api. (linux server hacks is good too.)
cover

Categories: code Tags:

my brain’s not all that rusty…

December 17th, 2002 osterday 2 comments

it’s been a while since writing any visual basic code, but i fired up vb6 to code a little activex control. i needed the http put method implemented in the browser, but the browsers don’t directly support put. activex is the simplest way to add on this type of functionality. (i actually like activex technology – the security model is what microsoft f*cked up.) yeah, i could’ve written it in java, but we’ve already got a code signing certificate for activex. the wininet api makes it a piece of cake! i had a few minor problems, but all in all pretty painless. i’ve still only got the code in a vb app, but converting it is a no brainer. so now i can just drag and drop file uploads. well, not to mention that http post file uploads can be a killer hit on performance! now i got a pretty progress bar, cancel button, can check the file size before the upload… and it’s just cool.

side note: the .net stuff looks cool and i assume i could do a control with vb.net, but i don’t know how long it’ll take for the “.net framework” to be installed on enough client machines. wonder if flash mx could do “put”. i’d love a cross platform solution… at one time i thought java might be it, but who know how long java on windows will work? and i’ve only seen one signed applet in my life… not too promising…

Categories: code Tags: