Blogshares not dead?

Looks like "Seyed":http://www.monkeyx.com/ has "found a buyer":http://www.monkeyx.com/archives/web/for_sale_blogshares_one_careful_owner.html for the domain and source code. I'm sure the next iteration will suck, as Seyed really was the heart and soul of the site. It'll still be interesting to see what happens, tho. *Update:* Looks like Jay Campbell "bought it":http://blogshares.got.net/. Hey, good for him. My prediction still is in the "suck" camp.

BSClient 0.5 source release

Details and download of -my- the BlogShares Client Application. *Update*: "Blogshares":http://blogshares.com/ "bit the dust":http://feralboy.com/log/archives/000709/. Over, done, nada, fini. I've removed the downloads, since nobody should need them anymore.

*Update 2*: Looks like "the site is back":http://feralboy.com/log/archives/000725/, but I don't feel like maintaining the application anymore. The API(Application Programming Interface) "has been disabled":http://blogstreetjournal.com/modules.php?name=News&file=article&sid=33 for the time being, but if/when it returns I have no interest in continuing development. Even if the API doesn't come back, it wouldn't be too hard to change the underlying system calls to use "screen(Screen Scrapes in ASP.NET)":http://www.4guysfromrolla.com/webtech/070601-1.shtml "scraping(Screen Scraping with C# for ASP.NET)":http://www.codeproject.com/aspnet/weather.asp "instead(Screen Scraping in ASP.NET)":http://www.csharpfriends.com/Articles/getTip.aspx?articleID=210. I've posted the "latest version(Download BSClient 0.5 source)":http://feralboy.com/bsclient/BSClient_0.5_src.zip of the source code, so feel free to take a whack at it yourself. This release contains some previously unreleased features, including rudimentary net worth charting (using "ChartFXLite":http://softwarefx.com/SfxNetProducts/CfxLiteforNET/, which I have included in the source package). Please note that this is an unsupported release; heck, they're _all_ unsupported as of now. That means don't send me emails about it, because you'll either get an unhelpful reply, or none at all. Requirements:

* Windows 2000/XP only. * ".NET Framework":http://msdn.microsoft.com/netframework/downloads/howtoget.aspx needs to be installed on your machine. I know it works with 1.0, and I would assume it works with 1.1, as well. If you don't have it, get it through "WindowsUpdate":http://windowsupdate.microsoft.com. * A "BlogShares":http://www.blogshares.com/ account. Duh. * You should probably be a premium member. You will probably hit your trade limit pretty quickly otherwise. I'm considering making the app only work with premium members, as you can get around the 2 searches a day restriction with the app. "Pony up":http://www.blogshares.com/upgrade.html, you cheap bastards!

_Alright, so what does this thing do?_

* Log in and see your portfolio. Sort by all columns (pe/price/etc). * Search and buy ideas! * Perform custom buy/sell actions on selected items in your portfolio. Buy maximum available shares, buy exactly 5 shares, sell 10% of held shares, sell max, etc.) * Perform the same buy/sells on ideas. * Fancy uber-update function that goes through your entire portfolio, buys available shares in any blogs with shares available, and sells all shares in blogs where there are no available shares and it's been 6 hours. * Search function. All standard criteria, and then sort results, and perform custom buy actions on selected results (same as portfolio buy).

_Ok, right now it sucks. What else are you planning on adding/fixing?_

* Ability to save your searches. * Display in the app of current portfolio info (total net worth, etc.). * Some sort of Systray icon, with fun little popup info, like your current worth, etc. * -Sometimes you'll get errors when you use the "select all" checkbox to select items in the portfolio or search results. I know. It seems to happen if you select all, uncheck a few, and then check select all again. Just hold down the "Y" key until it all goes away. (Thanks, JW)- * -I'll be adding support for Ideas. To what degree is yet to be determined.- * -I need to add multi-threading into the app. Right now when you perform a long operation (like downloading your 1000-blog portfolio from the server), the interface will freeze. I'm working on it.- * -I think right now it only finds blogs in your main folder.- * -Right now it calculates the time based on Eastern Standard Time. Tough. When a GetTime() function is added to the "API":http://www.blogshares.com/api/, this will go away. Or when I add some sort of user-configured offset setting, whichever lets me be lazier. If you want to change it now, feel free to tinker with the source code.- * -I'll be adding custom filtering to both portfolio and search results grids, i.e. show me all items in my portfolio with a PE between 40 and 60.- * -Getting the "Last Transaction" column to display the full date/time.-

_Enough warnings already! Gimme!_

No, not quite yet. Time for some disclaimers:

* This is free. I don't give a shit what you do with it, unless you try and sell it for actual money or sex. That money and/or sex should go to me. Otherwise, take the program and go nuts. * I make no claims about the code, other than there's not some nefarious worm or virus in the executable. I'm not responsible for anything this code does to your machine, including causing your computer to burst into flames and spew molten ceramic all over your bedroom. No, I wouldn't trust me, either. Take the source code and compile it yourself, then. _Now includes GPL Minty Freshness!_

Alright, on to the fun.

"-Download the executable-(Download BSClient 0.4)":http://feralboy.com/bsclient/BSClient_0.4.zip Just unzip it into any folder and run. Simple as that.

"Download the source code(Download BSClient 0.4 source)":http://feralboy.com/bsclient/BSClient_0.5_src.zip (for you fancy hax0r types) This includes the visual studio project file, so just open it up and compile. Don't ask how to compile with the command-line compiler (csc.exe), 'cause I don't know.

_I wanna tell you just how much this sucks._

* If you have constructive criticism or ideas for features, the best thing to do would be to add a comment to the bottom of this post. * All messages telling me how I'm ruining BlogShares by letting people buy faster than they should be allowed will be gleefully ignored/deleted.

h5. Version History:

h6. Version 0.4

* Added support for ideas! Now you can search on ideas, select all and purchase with just a few clicks. Also full handling of ideas within your portfolio. * Fixed annoying "select all" bug. * Added filtering by folders, so you don't accidentally sell off stuff in a subfolder. * Start of storing application data. Right now all it does is save your UserId after a sucessful login and populate the box for you next time.

h6. Version 0.3

* Added threading! Now the interface won't hang, and you should be able to overlap actions (i.e. perform a search while you're selling from your portfolio), although that might do weird things to the progress bar. * Removed need for setting timezone. Found "DateTime.UtcNow":http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfSystemDateTimeClassUtcNowTopic.asp function. (slaps self on forehead) I love .Nizzle! * Overhead reduced by using GZip (using "#ZipLib":http://www.icsharpcode.net/OpenSource/SharpZipLib/) compression on responses to lower the amount of bytes transferred. Data is also being cached more on the client side to cut back on trips to the server. * Client now identifies itself with a "custom UserAgent":http://feralboy.com/log/archives/000420/. * Fixed the display of datatypes on the Portfolio grid. Still need to do the same for the search results. * Source code is much nicer now. Grouped most everything by logical functions, and started to split out some common functions into classes. * Added an "About" dialog to show copyrights.

h6. Version 0.2

* Added "GPL license":http://www.gnu.org/licenses/gpl-howto.html. * Cleaned up soucecode slightly. Added comments to headings in most functions. * Added a textbox to add your hours offset from UTC.

h6. Version 0.1

* Initial release.

GZip compression and changing UserAgent

Just in case you ever wanted to use the .NET Zip Library to receive GZip-compressed content from a webserver, as well as sending a custom UserAgent string to identify your app, here's how you do it:

        /// <summary>
        /// Used to send out a custom application UserAgent, and return a string from a GZip-compressed
        /// response.
        /// </summary>
        /// <param name="strUrl">The url you want to retrieve.</param>
        /// <returns></returns>
        public string GetWebRequest(string strUrl)
        {

            StringBuilder mySB = new StringBuilder();

            HttpWebRequest request = (HttpWebRequest)WebRequest.Create(strUrl); 
            // Sends the HttpWebRequest and waits for the response.  
            request.UserAgent = "BSClient 0.3";
            request.Headers.Add("Accept-Encoding", "gzip, deflate");
            HttpWebResponse response = (HttpWebResponse)request.GetResponse(); 
            // Gets the stream associated with the response.
            Stream receiveStream = GetGzipStream(response);

            Encoding encode = System.Text.Encoding.GetEncoding("utf-8");
            // Pipes the stream to a higher level stream reader with the required encoding format. 
            StreamReader readStream = new StreamReader( receiveStream, encode );
            Char[] read = new Char[256];
            // Reads 256 characters at a time.    
            int count = readStream.Read( read, 0, 256 );
            while (count > 0) 
            {
                // Dumps the 256 characters on a string and displays the string to the console.
                String str = new String(read, 0, count);
                mySB.Append(str);
                count = readStream.Read(read, 0, 256);
            }
            // Releases the resources of the response.
            response.Close();
            // Releases the resources of the Stream.
            readStream.Close();

            return mySB.ToString();

        }

        /// <summary>
        /// Used in place of GetResponseStream().  This function will check out your HttpWebResponse's contents,
        /// and return the proper string representation of the HttpWebResponse stream.
        /// </summary>
        /// <param name="response"></param>
        /// <returns>String representation of the HttpWebResponse</returns>
        private Stream GetGzipStream(HttpWebResponse response)
        {
            Stream compressedStream = null;
            if (response.ContentEncoding=="gzip")
            {
                compressedStream =  new GZipInputStream(response.GetResponseStream());
            }
            else if (response.ContentEncoding=="deflate")
            {
                compressedStream = new InflaterInputStream(response.GetResponseStream());
            }

            if (compressedStream != null)
            {
                MemoryStream decompressedStream = new MemoryStream();
                int size = 2048;
                byte[] writeData = new byte[2048];
                while (true)
                {
                    size = compressedStream.Read(writeData, 0, size);
                    if (size > 0)
                    {
                        decompressedStream.Write(writeData,0,size);
                    }
                    else
                    {
                        break;
                    }
                }
                decompressedStream.Seek(0, SeekOrigin.Begin);
                return decompressedStream;
            }
            else
            {
                return response.GetResponseStream();
            }
        }

Matt Comroe, Plutocrat

I've now "hit $1 billion(my BlogShares profile)":http://blogshares.com/user.php?id=3179 on "BlogShares(BlogShares home)":http://blogshares.com/. Woo. A lot of it has to do with tweaking the search I've been using for automated buys with the "early implementation(FeralBlog - BSClient)":http://feralboy.com/log/archives/000396/ of my "BSClient":http://feralboy.com/log/archives/000387/. I hope to be able to do some more work on it tonight, after "climbing(Climbing archives at FeralBlog)":http://feralboy.com/log/archives/climbing/.

BSClient

Got some work done on "the client":http://feralboy.com/log/archives/000387/ over the weekend, as you can see below: "!/images/bsclient/bsclient1_thumb.png (ScreenShot 1)!":http://feralboy.com/images/bsclient/bsclient1.png "!/images/bsclient/bsclient2_thumb.png (ScreenShot 2)!":http://feralboy.com/images/bsclient/bsclient2.png "!/images/bsclient/bsclient3_thumb.png (ScreenShot 3)!":http://feralboy.com/images/bsclient/bsclient3.png

It was very easy to get the basic buy/sell logic implemented (in fact, I did it the same day the API(Application Programming Interface) was released), but getting the interface put together is going to take a bit longer, I think. The main reason for this is that WinForms are teh sux0rs. Working with DataGrids in WinForms is _nothing_ like working with them in Web Forms. You can't access any of the controls in the grid directly; you need to get at the underlying DataTable instead. So, to add a checkbox column, you have to create a new Boolean DataColumn, append it to the end of your XML(eXtensible Markup Language)-based datatable, and then set it as the datasource. Of course, reordering said columns is a tremendous pain in the ass, but that doesn't really matter anyway, because of the the fact that the datatype doesn't get set right just from reading the XML(eXtensible Markup Language), so after I bring it down, I have to create a new DataTable from scratch, set the right column DataTypes, add them to the DataTable in the right order, and then copy data from the XML(eXtensible Markup Language)-produced DataTable to my new one. Once the DataType is set right, there's automatic sorting on columns, without having to write any code, which is cool. It also supports automatic adding/deleting/editing of rows, but that doesn't really help me here, since all actions have to go through the API(Application Programming Interface) anyway, and can't just be done through a merged DataTable.

Things that I know I have left to do, based on "input from other users":http://www.blogshares.com/forum/viewtopic.php?t=2771 and just thinks I know need to be improved:

* "Implement threading":http://www.developer.com/design/article.php/2244501. * Flexible buy/sell options from either the portfolio interface or a search interface. Buy all available shares, sell 1% of total shares, etc. * Add login! Right now my UserID and pwd are hardcoded. Naughty! * Figure out how best to store searches for a user. Local XML file? * Consider pros/cons of making app only for "Premium Members":http://blogshares.com/upgrade.html. The app really is for power traders, and I also don't want to give people the ability to store a whole bunch of searches if they aren't premium, as non-premium members can only store 2 seaches. People need to pony up the $15. * Work on filtering of portfolio. This won't be hard, technically, but I'm bad at WinForms design, as I haven't really done it before. Do I put it all on one page? Have a modal dialog that pops up for entering filter criteria?

BlogShares Developer API

What started off as a fun and interesting time-waster looks like it might turn into a fun little side programming project now. The fine folks at "BlogShares":http://www.blogshares.com/ have released an "XML(eXtensible Markup Language)-based API":http://blogshares.com/api/. What's exciting is that this morning trading functionality "was added":http://blogshares.com/news.php?id=249. This means that by passing the appropriate querystring you can "execute a buy order(Example of a successful buy order)":http://blogshares.com/api/successful_buy.xml without logging into the site. So, since I'm feeling a little stagnant these days, programming-wise, I'm going to work on building a C# Windows Form application to act as a trading proxy... a "bot", if you will. The idea is that I already have a few set "queries(Example query that returns the first 500 blogs that have public shares between 1000 and 5000)":http://www.blogshares.com/api/query.php?publicshares_min=1000&publicshares_max=5000 that I use to accumulate money outside of major actions like "hostile takeovers(My takeover of /.)":http://feralboy.com/log/archives/000346/. It's fairly repetitive; run query, buy 1250 shares of all blogs in that query. Wait 20 minutes. Buy another 1250 shares in the same blogs. Lather/rinse/repeat until I've purchased all available shares, raising the price a few hundred percent in the process. Wait 6 hours, and dump all shares. The way I figure, I can automate the whole thing. Here's my rough idea of how this will work:

# Pull the results of the query into a "DataSet(DataSet class on MSDN)":http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfSystemDataDataSetClassTopic.asp. Initially since I'll only be using this application myself, I'll have my queries hardcoded in, but I'll work on either a) having an interface in the application to be able to dynamically create queries or b) being able to pull stored queries from my BS(BlogShares) account. # Step through dataset and fire off a buy transaction for each record. I'll want this to be threaded (but nicely, so I don't pound the BS(BlogShares) server... maybe only 5 threads at a time), so I'm guessing I can borrow some code from "this article(MSDN - Creating an Online RSS News Aggregator with ASP.NET)":http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnaspp/html/aspnet-createrssw-aspnet.asp on creating an RSS(Rich Site Summary) news aggregator. # Have another process which looks at stocks in my portfolio for blogs that still have public shares available, and I haven't bought in the last 20 minutes (the limit for consecutive purchases of the same blog), and buy available shares of those. # A third process which will sell off any stocks that haven't been bought in the last 6 hours (again, a game limitation) and remove the stocks from my portfolio.

I'm getting excited about the prospect; I think it will be a cool/interesting thing to do, and I'll be posting sourcecode/files along the way, if I think that anything is worth sharing with people. ;-)

Slashdot now being run by Micro$entric non-loser!

That's right... last night I completed my hostile takeover of "Slashdot":http://www.blogshares.com/blogs.php?blog=http%3A%2F%2Fwww.slashdot.org%2F on "BlogShares":http://blogshares.com/. I really grew bored with the game a few months back, but the introduction of the "artifacts":http://blogshares.com/help/question.php?qstId=43 has been an interesting twist. So my plan is to hold onto the shares as long as I can, and then run up the value every 24 hours (when my artifacts refresh), sell off and then quickly re-buy shares. Should get "me":http://blogshares.com/user.php?id=3179 to the $1B mark fairly quickly.

Rich and bored

Due to some fortuitous moves in the BS(BlogShares) funds over the last few days, my net worth is now hovering right around $2 million. Now that funds have been withdrawn, the moves in stocks are too low (or with too few shares available for purchase) to make any sort of large moves, so I have to think about what I want to do. There will be banks opening soon, which could be fun. I could also donate my money for some sort of contest. I could even try and sell my virtual cash for the real thing on ebay.

Guerrilla Marketing

Well, it was bound to happen sooner or later. I got my first BlogShares advertisement last night. Someone gifted me 5 shares of a worthless stock last night, and the accompanying email said "I like the way you do business. South Dakota thanks you." Of course I had to go look and see what sort of porn ad-infested popup hell the site in question was. Strangely enough, it wasn't. I'm not quite sure what the point was (except maybe to drive traffic), but it was an interesting technique, to be sure. In other news, the SLF(Special Lady Friend) and I are going to see A Mighty Wind tonight. I thought Best In Show was one of the better movies I've seen, so I have high expectations for this one.

Ouch.

Three times now, I've bought something in BlogShares to the tune of a couple of thousand dollars, and then the next morning I see it's worthless. Literally worthless. Sucks to have to continually make up that ground. I was up to about $130K yesterday, and now I'm back down to $80K or so. In other news, I had a decent workout at the gym last night, and I'll be heading to the Co-op tonight. I realized that while my 30-mile bike commute is keeping me fit, I'm not nearly as strong as I used to be climbing, so time to fix that. Tonight should be some bouldering, and then a campus session. If everything falls into place (especially with the weather), I'll be able to go bouldering at Cooper's Rock Saturday, and then hit the lead wall at the gym Sunday. Woo!

BlogShares = Holy Crap!

The site just officially went live, and it's crazy! I thought I totally screwed up this morning and bought some available shares of Movable Type because I thought the game had already switched over. But then it hadn't! Ack! Thinking I was going to be stuck with shares that I couldn't unload (and only being left with a pitiful $1k-odd cash balance), I started poking around on the forums. I saw a post there that if there was an outstanding buy order for a stock, you didn't have to wait for the 6 hours! So, I dumped most of everything I had picked up (down to $14k cash from $19k last night, not horrible), and sat tight.

When the site came back up, I saw that I had around $29k cash?!?!? WTF? I guess they sold the stock for me at the going rate when the beta site went down. I tried to grab some of the better-performing (at least, they were in the beta test) stocks out there, and I think I did pretty well. I snagged some slashdot (already up 25%), some Blogdex (flat so far), and the best one, BlogShares itself (already almost doubled).

Various Media

* I ordered tickets for the _Preview_ showing of The Matrix Reloaded, which is happening at 10 p.m. on Wednesday the 14th. With the release date being the 15th, I thought I was going to have to go to a midnight showing on the 14th, but now I can get an early start. Thanks, Fandango! * Watched Scotland, PA last night while in my hazy, NyQuil-addled state. It's a cute, funny movie, with some nice stylistic touches. Everyone drives old Camaros, for example. Not nearly as gorgeous as another Shakespeare "re-imagining", but it was still entertaining. And, of course, Christopher Walken rocks.

* I am officially making a killing on BlogShares. About a week ago the site owner announced that when the site goes live (which should be happening today) all cash you have will be carried over, but your holdings will be gone. To keep the bottom from completely falling out when everyone makes a run for the exit at the same time, he put a large buy order out for every stock. But sometimes after he issued the buy order (say, for $1.50 per share, which is around what the stock is valued at the time he issued the order), if the price _drops_ (say, to like $1 per share), then you can buy a ton of shares for a buck, and turn around 6 hours later and sell them for a tidy 50% profit. I also noticed that when you buy large quantites (say 25% of all outstanding shares), just from the purchase alone you can "move the market" and instantly make your purchase more valuable. Plus, my site is now listed on diveintomark, so hopefully everything will be re-indexed in time for all the new shares to be issued, and watch the price soar!

I'm nearly rich. Plus, more site changes.

As of this moment, my portfolio is worth a whopping $1419.81!!! That's up a staggering _41.981%_ from when I started! It can only get better when Mark starts peddling my ass on the corner. By popular demand, the secondary title of this page is now being randomly pulled from a database. Reload a few times and see what happens. I still need to move the code to get the dynamic title on the archive pages, and I also want to make a public-facing form where people can submit their ideas and I can approve/reject them. Update: To get the ball rolling a bit more, I pulled a few good slogans from the Advertising Slogan Generator. Enjoy.

The newest version of SharpReader is out. I'm glad he fixed the bug that was keeping Windows from shutting down, because that was a little annoying. Other than that, it still continues to be one of the coolest apps I've seen in a long time.

Site Tweaks

Couple of minor changes to the site. * As further proof of my slavish devotion to keeping track of my BlogShares status, I've put a "BlogShares" item in the side navigation, which pulls data from the BlogShares site using David Reynes's nifty MTBlogShares plugin. Right now it's showing my weblog's current value, P/E ratio, and my portfolio value.

* I put the Nice Titles enhancement on my page (in my mind I keep hearing Sean Connery from Celebrity Jeopardy saying "Nice Titties!"), which gives the fancy popup highlight over links with titles if you're using a "good" browser.

* I added a description for the weblog under the title. It's lame. Any suggestions as far as what i should change it to?

Matt sells his virtual soul.

I've been too busy to really be paying a ton of attention to it, but this whole BlogShares thing has taken off faster than an oversized Cheeto. Basically your weblog is valued based on who you link to, who links to you, and how well-linked all _those_ people are. Just for fun I listed my site. Actually, it was already listed; i just had to claim it. You'll notice that because of Tantek's link, and because of my plethora out outgoing links, I've managed to move my stock off the pink sheets. And look! Someone actually bought shares! 3900 of them, to be exact. Foolish Intrepid Italian-speaking investor, I salute thee!

To help out this foolish intrepid investor, I sold a little bit of my self-esteem last night. It was time to admit my stock needed help, and the Gordon Gecko of my dreams came in the form of of bespeckled Mark Pilgrim. His offer to link to your weblog in exchange for 100 shares of said weblog sounded too good to miss. I missed the first cut to get pimped by Mark, but I should be in the next one. I actually gave him 200 shares because I'm just so damn nice.