Sunday, August 29, 2004

GMail baby!

Wheepie! A pure soul of Steve Eichert shared a GMail invite with me!

Now I join the ranks of wackos rambling about this nifty thingie. Already setted up a Firefox extension for monitoring the account. Neat.

Wednesday, August 25, 2004

A promissed slowdown

As i've promissed, the posting to the blog has gone down hill. Main reason for this is - I'm back at work. So, less fun, more crap. :) Anyway, I'm still working on the paper that I've promissed (the one about Glade and Mono) and I hope it will be ready in a few days. Btw, if anyone is acutally reading this - does anyone know ANY decent blogger posting tools for *NIX ? Hello?

Tuesday, August 17, 2004

Site Updates

Well, as you can obviously see, the site's template was changed. Why? I dunno, just liked this one better. I've also changed the page's font, which looks much more readable (as far as I can see).

Oh, before I forget: there is one more feature that needs to be added to Shlogger: pre-publish plugin activization. Ahh, I love those long, technical names. Anyway, for plugin like speller, it could be set to check the post before publishing, and for plugin like Smiley , it can parse the text and change all the  ":)" to  and etc. The only problem is - this feature will demand some sort of configuration UI for the plugins, which I tried to avoid. We'll see.

Another Shlogger Plugin

After my victory over file uploading yesterday , today I've finished the oh-so-needed (for me) ImageUpload plugin for Shlogger! It replaces the usual IE 'Add Image Dialog' and allows the following:

  1. Add link to image (with optional thumb image and alt description)
  2. Upload image to ImageArk webhost
  3. Upload image to ImageShack webhost

For the latter two, the thumbnail can be generated and uploaded. Border adding and alignment are supported. All in all I am very pleased

Monday, August 16, 2004

File Uploading

Well, this has to be, by far, the ugliest piece of code I've ever written, but... it works. :)  I've been struggling with file uploading for a while, but now it's done. Here's the function that will upload an image to ImageArk and return result HTML. Have fun.

static string FileUpload(string url, string referer, string filename)

{

Random r = new Random();

string randStr = r.Next().ToString();

string dataBoundary = "--xyz"+ randStr;

HttpWebRequest Req =(HttpWebRequest)WebRequest.Create(url);

Req.UserAgent = "Upload Test";

Req.ContentType = "multipart/form-data; boundary=xyz"+randStr;

Req.Method = "POST";

Req.KeepAlive = true;

byte[] FileData = File.ReadAllBytes(filename);

StringBuilder DataString = new StringBuilder();

StringBuilder DataString2 = new StringBuilder();

DataString.Append(dataBoundary + "\r\n");

DataString.Append("Content-Disposition: form-data; name=\"userfile\"; filename=\"File1.jpg\"\r\n");

DataString.Append("Content-Length: " + FileData.Length.ToString() + "\r\n");

DataString.Append("Content-Type: image/jpeg\r\n\r\n");

byte[] tmpPostdata1 = System.Text.Encoding.Default.GetBytes(DataString.ToString());

DataString2.Append(dataBoundary + "\r\n\r\n");

DataString2.Append("Content-Disposition: form-data; name=\"MAX_FILE_SIZE\"\r\n\r\n512000\r\n\r\n");

DataString2.Append(dataBoundary + "--\r\n");

byte[] tmpPostdata2 = System.Text.Encoding.Default.GetBytes(DataString2.ToString());

byte[] t = new byte[tmpPostdata1.Length + FileData.Length + tmpPostdata2.Length];

tmpPostdata1.CopyTo(t, 0);

FileData.CopyTo(t,tmpPostdata1.Length);

tmpPostdata2.CopyTo(t, tmpPostdata1.Length + FileData.Length);

Req.ContentLength = t.Length;

Req.Referer = referer;

Stream tempStream = Req.GetRequestStream();

tempStream.Write(t,0,t.Length);

tempStream.Close();

HttpWebResponse Resp = (HttpWebResponse)Req.GetResponse();

//Read the raw HTML from the request

StreamReader sr = new StreamReader(Resp.GetResponseStream(),

Encoding.Default);

//Convert the stream to a string

string s = sr.ReadToEnd();

sr.Close();

Resp.Close();

return s;

}

Sunday, August 15, 2004

GladeSync

As I've mentioned in previous post, I've found a nifty Glade util. I had to rewrite it a bit to suit my needs. If anyone interested, here it is (look in the comments)

I'm Stereo (Not MONO)

OK. Apparently I overestimated myself (as usual). There are some things that mortal men cannot archive - for example : writing a full-blown application with MONO and current GUI toolkits for it.  In past two days I've crawled through numerous projects: wx.NET , Gtk# , UIML.Net and even #Fox. The latter two are out of the question because I am just not willing to design a complete application by hand with no GUI Designer at hand. No, thank you . The wx.NET is not appealing for me because of two reasons: 

  1. It's way too much like MFC. It's previous century! Why the heck would anyone want to use MACROS for events? It's 2004 for crying out loud!
  2. The wxDesigner. The most cumbersome GUI editor I've ever seen! Un-bearable! And to top it off, it's also missing a XYSizer, and allows only Grid like form designing, which is not so suitable for most things.

So, what's left? Gtk# . It seems like the most flexible and the most developed out of the bunch. But still, using GLADE to develop a cute looking app is just too overwhelming task for me.

So, dropping the whole cross-platform idea? Yes, and no. I will not rewrite Shlogger for Mono. Not until they come up with System.Windows.Forms support. BUT. What I am planning to do is the following: while I've been cruising the web for Gtk# information I came to a very sad conclusion: there's really little of it! The only thing that can be referenced as a good source is MONO Handbook. It has a lot of examples ready and waiting to be pasted into the code. Another interesting thing I found was this Ray's blog which had some interesting GLADE info. You might want to check it out. So I though - how about giving something back for a change  ? So what I will do is write a complete tutorial on creating a cross platform application using C#, Mono, GTK# and GLADE. The topic for application that I've selected is Comics Fetcher. Yes, I know, VERY original, but what the heck? Anyhow, I will probably be getting back to programing under Linux soon, so the cross-platform thingie will be tested there as well.

OK. Enough rambling for now, let's get back to business!

Friday, August 13, 2004

Updates slowdown

Howdy. Well, the updates on the Shlogger project will get a slowdown in the near future for the following reason - it's done.  It works like I want it to, and has all the needed features. I've made a workspace with all the sources and will probably build a test release, but I doubt that anyone will use it, since it's written in beta c# 2.0 , but what the heck?

Anyhow, there are some changes:

  1. I've added an About Dialog, which can be run from the System Menu (I didn't want to clutter the main interface with such unneeded feature)
  2. The tree view was changed to ListView. The dates of the posts are displayed next to the posts now, which is pretty. This change had opened up quite a few bugs, but all are small and I will squash them soon
  3. Since all the features are complete I'm thinking about something quite different to do with the project - Port It to MONO. This is very ambitious since I haven't written a single app in Gtk, but this could be a nice challenge. Most likely my enthusiasm will die down soon, but it's worth a shot.

Tuesday, August 10, 2004

I've GotDotNet :)

Ok. Due to the request from my anonymous reader I've setted up a GotDotNet workspace today for Shlogger. I'm uploading all the stuff just now. Once again, I do not recomend using this as a working posting app, but more of an educational thingie (if you manage to learn anything from this junk )

The url is: http://workspaces.gotdotnet.com/shlogger

Monday, August 09, 2004

Html Component

Oki doki. I did a big rewrite today, due to the fact that I've got rid of the old HtmlControl that I've used (it was a Microsoft example component). Apparently .NET GOD named Lutz Roeder already made a WAY better component for this! It can be found here. It does all that I've needed (cursor positioning and even notifications) and some more. Plus it has it's own Native wrapper, so I won't have to bundle the Interop DLLs now.

Anyway, I'm pretty pleased with progress today, the Shlogger is getting along quite nicely. What else... Yes, I've submited request to SourceForge to approve the project, so I'll setup the CVS repository tomorrow or so.

Ah, there seems to be some horrid bug in the ToolStrip implementation (except the one that i've mentioned earlier about shortcuts) which is - when the buttons are hidden in the right-hand dropdown and clicked, the ItemClicked event is notfired! wtf x 2!

Sunday, August 08, 2004

RE: ToDo

Ok. The RssBandit plugin works just great! (as you can see below) It was shamelessly ripped from the w:bloggar plugin in the RssBandit destribution. Some other stuff was added: the plugin loading was moved into a separate thread, so the start up time should be faster, added a 'View Blog in browser' feature, and squashed some small bugs.
  • Write a RssBandit plugin 'ShlogThis' similar to w:bloggar

  • Implment a command line options to fascilitate the plugin from previous item

[Via Reflog's Random Thoughts]

ToDo

Here are some thoughts on what to do with Shlogger in next few days:

  • Investigate the issue of ToolStrip shortcuts. Apparently there is NO functionalty for adding shortcuts to buttons or menus in the Strip! wtf?
  • Find out the way to get current position inside the HTML editor. Right now the only way to insert some text to it from the plugin, is only to it's end. Which is rather anoying.
  • Write a RssBandit plugin 'ShlogThis' similar to w:bloggar
  • Implment a command line options to fascilitate the plugin from previous item
  • Think about changing the TreeView on the left to ListView with groups... Maybe it will look nicer. We'll see.

That's it. Run along now

Smileys

Ok. Here's some more progress on the plugins for Shlogger.
Smiley Extension is Implemented!
The plugin reads an XML file which contain the smiles encoded in base64 (for displaying them in the menu) and url of the images (for displaying them in the blog). Now, just simple selection from the menu adds a cute smiley

Here's how the menus look like:


Saturday, August 07, 2004

speller, baby!

Speller plugin for Shlogger implemented:

As I've mentioned previously, I've used NetSpell by Paul Welter which is absolutely great, and very fast. I don't plan to add any configuration for the plugin, just the base functionality.

The next plugin to be implemented is the ImageArk service. The only problem is, I for the world cannot manage to get the HTTP POST functions working in the WebClient!

Friday, August 06, 2004

I'm back!

Howdy! Well, I'm back from my trip - which was absolutely awesome (but way too short), maybe I'll post a pic a too from the 200 pix that I took there ;)
I'll get back to my projects tomorrow (I'll have to read my own blog to remember what was I working on ;) ) Have a blast, cheers