Archive for the ‘Programming’ Category

Why is Business Objects Code So Slow?

Thursday, August 27th, 2009

It is damn frustrating to use the code below to get to the label name of a specific Universe object. It just loops over and over again looking for a specific object id in a specific class. The object id is unique across all classes. So, the class part is redundant. There is inexplicably no function to obtain the object by giving the unique id. So, we loop and hope the desired object id is near the top.

Set oDesignerClass = m_oUniverse.Classes.FindClass(sClassName)
For nIndex = 1 To oDesignerClass.Objects.Count
Set oDesignerObject = oDesignerClass.Objects(nIndex)
If oDesignerObject.id = nBIObjectID Then
sLabel = m_oUniverse.Classes.FindClass(sClassName).Objects.Item(nIndex).Name
Exit For
End If
Next

When we know everything about the object that we want and could just get it with one line of code that doesn’t need to execute uselessly and repeatedly.

m_oUniverse.Classes.FindClass(sClassName).Objects.(Name).Name = sLabel

Or better yet, by ObjectID (SHOCK!!! I know)

m_oUniverse.(nBIObjectID).Name = sLabel

If someone knows who the idiots are that thought this was a good idea let me know their address. I would have no problems sending the team a book from Amazon on the binary search algorithm were learned in Computer Science 101.

More Google Map Links

Thursday, February 19th, 2009

Plot Multiple Points from a Google Spreadsheet
Ex. http://gmaps-samples.googlecode.com/svn/trunk/spreadsheetsmapwizard/makecustommap.htm
Creating a Blog from withing Google Maps
Ex. http://ouseful.open.ac.uk/blogarchive/012936.html
Google Calender on a Google Map
Ex. http://blog.wired.com/monkeybites/2008/01/killer-mashup-p.html
Data Scraping Wikipedia with Google Spreadsheets
Ex. http://ouseful.wordpress.com/2008/10/14/data-scraping-wikipedia-with-google-spreadsheets/
Interactive Election Map
Ex. http://mapmash.googlepages.com/election_map.html
Video in the Google Map pop up
Ex. http://5tvs.com//internet-tv-maps/news/
BBC News Stories by map
Ex. http://dev.benedictoneill.com/bbc/
Doctor Who Locations
Ex. http://www.doctorwholocations.org.uk/
Flat World Map view
Earthquakes This Week
Ex. http://earthquakes.tafoni.net/
EPA Pollution Data
Ex. http://findpollution.org/
Complex Info Pop Up
World Bank + Google Map Mashup
Ex. http://geo.worldbank.org/

_GET['cat'] Doesn’t Work With Permalinks

Saturday, January 3rd, 2009

My sidebar shows different content based upon the category that you are viewing at the time. There are so many links that I want access to that I had to break out the big categories like bicycle and garden into their own subpages.

The other day I switched to using permalinks for the URL. This replaces the URLs like this:
WordPressSS/?post_id=763
With URLs that look like this:
WordPressSS/2008/12/22/penny-stove/

This caused a big problem with showing different sidebar content based on the category. The category used to be passed in through the query string and you get it with _GET['cat']. Permalinks don’t use query strings.

To restore functionality, you need to replace “current_cat = $_GET['cat'];” with
$category = get_the_category();
$current_cat = $category[0]->cat_ID;

It would seem the permalinks can handle multiple categories, because get_the_category() returns an array. This might be useful for some feature I can’t image. Perhaps a sidebar for a tab to show Programming+Computers+Technology content.

Changes to the Bike Log

Wednesday, December 31st, 2008

Years ago when I was on the Atkins diet and exercising every day I had a little log book. This is a surprisingly simple and cheap motivation. It sucks to look back and see missing entries, I don’t feel guilty at the time, and I like recording big numbers. So, when I started training last summer I did the same thing on the blog. Later, this turned into an exercise log.

Keeping this on the blog is pretty kludgy. I have to copy and paste the last line then edit it. Changes to the table structure like adding new columns or colorization takes a massive amount of effort. It’s good for one thing, adding one line at a time.

I hoped to fix this with some WordPress plugins like WP_Tables, but these are almost as kludgy and are not easy to add one new row. If there’s one thing WordPress does exceptionally bad it’s table data. You can’t just paste in cells from an Excel spreadsheet or quickly mock up a 3 X 4 simple table. This is really too bad as spreadsheets are one of the little known foundations of the digital age.

The Recent Book list is nearly as bad. It’s not a table, but has many common elements and new books are added the same way as the Bike Log. A while ago I added book covers to the mouse hover event. This took a couple of hours.

For some reason, I got the idea on Sunday of writing a Windows app to manage the data and spit out a formatted HTML table that I could just paste into the blog. It took about 6 hours to put together a basic app that would read existing data, write it to a new file format, and spit out an HTML table for the blog. Editing, adding, and removing entries were still done by editing the text file, but that was about the same as the blog anyway. The table got an immediate improvement in appearance that was worth the trouble. Over the past few days I’ve added other basic features along with a few more columns.

I would like to add a bit of analyzation too; things like weekly, monthly, yearly mileage, comparison to past performance in events, and fancier HTML. And to address the other annoyance of the Book List. It would be nice if this were in WordPress as a plugin. My interest can wane overnight and it’s better to have a process that works at the end of each improvement session. PHP, MySQL, WordPress development on a remote box would take too long.

On DOS Age Game Interfaces

Sunday, December 21st, 2008

Lately, I’ve been exploring the crusty old world of DOS gaming. This weekend I got enthralled by one of my favorites; Master of Orion (MOO) and Master of Orion 2 (MOO2). Especially, MOO2 is just as good then as today. There was a MOO3 in 2003, but somehow it wasn’t very good. Not nearly as interesting as MOO2.

MOO was released for DOS in 1993. You start with a planet whose control has been reduced down to how much $$ to spend on Production (Ships), Defense, Industry(Growth), Environment, and Technology. There is one planet or less per Sun and the goal is to colonize the galaxy. Technology improvements help population growth, ship speed, weapons, etc. Each race has unique qualities such as cyborg, silicon, high tech, militaristic, etc. There are a limited number of ship designs, but they are completely customizable and the combat portion is playable, as opposed to a roll of the dice. As with most games of the time, given the limited graphics and CPU power available, everything is turn based.

MOO2 was released for DOS and Windows 95 in 1996. It is drastically improved in all aspects. The engine is more complex. Graphics are twice as detailed. There is much more control over planets, ships, and races. The core of the original game is there. It just has more of everything. They added a limited number of hero characters, which was the style of the time as in Master of Magic (MOM). Suns have multiple planets of more types. More types of ships with more kinds of weapons. The combat engine, in some ways the heart of the game, is much improved. Also, a high tech enemy was added, the Antareans, which comes and wipes out the colonies of all those with inferior defense tech.

As I played, I began to notice certain oddnesses. Little things that I realized I had accepted as normal at the time. It comes down to the interface. Windows has won and we all use the mouse, no matter what program, basically like we are in Windows. Drag and Drop for various activities based off the programs and files, Right Click for a Context Menu, Single Click to select an item, plus Shift or Ctrl to select a list of items, Double Click to fire off the default action, Enter acts like a Double Click, Cancel with the Escape key, Print Screen takes a screenshot, etc.

In 1993, Windows was not quite a competitive Graphical User Interface (GUI). And later in 1996 as Windows 95 it was not the winner and most games still ran in DOS mode for performance reasons. DOS was a command line interface for running other programs. Many of these did use the mouse. DOS did not and there was no one standard program everyone used. WordPerfect and Word were still fighting it out. Windows existed, but not everyone could or did run it and it had competition from OS2 and Apple. In this Wild West of GUIs the mouse could be used anyway that seemed best for the particular program.

That’s exactly what these games show. This is how most things work. Single click performs an action, there is no double click, drag an drop works on certain icons, right click pops up a set of help messages for all the displays and buttons, and Enter is just a keyboard key. Scroll wheels hadn’t been invented so to zoom in on the map you click a button, which highlights a box the size of the new map window and you drag that box over the part of the map you want to see and right click again. Lists don’t respond to the scroll wheel, which feels really weird.

Except for the scroll wheel and lists I like this interface better than most. It’s simple, relatively flat, and most information is quickly available. Right clicking to get context menus and selecting an action is a horrible crutch. This is the kind of game that would work pretty well with the single button Mac mouse. It feels solid. Not like you could accidentally click the wrong things or drag a game piece over something to create a disaster.

Looking back one thing that has hurt games that try to replicate the success and feel of MOO2 is the use of 3D space. MOO and MOO2 are flat 2D games. It’s easy on a 2D monitor to move game pieces around the board. To jump to 3D you have to constantly fiddle with the map to shift around the Z angle. Since Real Time Strategy (RTS) has apparently one the style of combat in games you have two actions to perform; stop the clock and move the camera. This just gets in the way.

These games are fun and quite innovative without being the enormous and addictive time sinks that current games are. I’ve been playing MOO2 for a couple of months now and a I can walk up and play for a few hours without and then leave it for a week without thinking about it once. This is rare for me. So, this slids right into a sweet spot.

The Creed of a Programmer‏

Sunday, December 21st, 2008

This is my debugger. There are many like it, but this one is mine.

My debugger is my best friend. It is my life. I must master it as I must master my life.

My debugger, without me, is useless. Without my debugger, I am useless. I must fire my debugger true. I must shoot straighter than my defect who is trying to kill me. I must shoot him before he shoots me. I WILL…

My debugger and myself know that what counts in this war is not the defects we resolve, the noise of our bug bashes, nor the smoke we make. We know that it is the hits that count. WE WILL HIT…

My debugger is human, even as I, because it is my life. Thus, I will learn it as a brother. I will learn its weaknesses, its strength, its parts, its accessories, its watches and its breakpoints. I will ever guard it against the ravages of patches and upgrades as I will ever guard my legs, my arms, my eyes and my heart against damage. I will keep my debugger clean and ready. We will become part of each other. WE WILL…

Before God, I swear this creed. My debugger and myself are the defenders of my country. We are the masters of our enemy. WE ARE THE SAVIORS OF MY LIFE.

Business Objects QaaS Utility Part 1

Sunday, October 19th, 2008

Recently, I got the chance to break some new ground. Very exciting since I used to do this weekly and now it’s more like annually. Business Objects has the ability to provide web services to report data. With Xcelcius to create the pretty bar graphs and pie charts this results in simple dashboard like summary of data that just about anyone can understand. Data like what are the most likely body parts injured, how much do those injuries costs, and what are the most expensive claims on those injuries.

The design flaw in Business Objects toolset for making these web services is flexibility in copy a query from one database, called a Universe (someone’s got a big head), to another database. Each customer is in their own database. So, we want to copy a standard set of queries from the Demo database to the Client’s database. The Business Objects tool makes you rewrite the web service when you move it from between databases.

This can be a time consuming process. Let’s say you have a dozen queries for a client. It takes 5 minutes for each query. And you sign up 50 clients. 12 X 50 X 5 = 60 hours. This is Development’s time and excludes errors, which would take hours more. So, nice feature, but not production ready.

Let’s say you could copy a query from one database to another in 5 seconds and use a tool that anyone can manipulate. Now, it takes 60 minutes of a Business Admin’s, Project Management’s, Customer Service implementor’s,.. time.

That’s the tool. How to copy a Business Objects Web Service query from one Universe to another.

Stack Overflow

Friday, September 19th, 2008

StackOverflow is a new Q & A programming site. Something to check out. I’ve been listening to the podcast about it.

Key Property on Common Controls Tab 6 Doesn’t Work With Numeric Values

Wednesday, June 25th, 2008

I’ve discovered a recent defect in the MS Common Controls Tab and it seems to be undocumented. So, I’ll document it here for the next poor sap. This applies to Visual Basic 6 and Microsoft Common Controls 6.1, MSCOMCTL.OCX 6.1.97.82 February 23, 2004. Perhaps it was fixed in and earlier or later version. If so, it would be nice if that fix was easy to find on the ‘net.

If you put a string that that only contains valid number characters into a tab’s Key property and error results. If you are suppressing errors in this section of code, like we are, then you won’t notice until you pull the Key property and a blank string comes back.


Dim tabPage As MSComctlLib.Tab
If (m_col.Count = 0) Then
Set tabPage = m_TabStrip.Tabs(1)
Else
Set tabPage = m_TabStrip.Tabs.Add
End If

tabPage.Caption = sName
tabPage.Key = sName

The solution sucks. Basically, the Key property is unuseable, but lots of code is already depending on it. So, if sName is numeric I can prefix/suffix an obviously non-numeric character and then go fix all the code to look for this character. Or I can do this on ALL strings put into the Key property.

RealBasic Links

Tuesday, June 3rd, 2008

http://www.rbdeveloper.com/

http://rb.thevbzone.com/l_intro.htm

http://realbasic-programming.blogspot.com/

http://rbnation.com/blog/

http://www.hitmill.com/programming/realb/rbtutorial.htm

http://www.monkeybreadsoftware.de/Freeware/

http://www.mactech.com/articles/mactech/Vol.21/21.01/AppsInREALBasic/index.html

http://www.json.org/

Garden WebSite Update

Thursday, May 29th, 2008

My vision for the garden website is continuing to evolve as I moderate what I want, need, and will update. Right now, I’m investigating using RealBasic to write a program that records various aspects of the garden and can output them to a website. Notes for personal observations, database for plant file info, the ability to store photos of a plant as it grows, disease progression, etc., calendar of when I have done things, the ability to search various specific websites on the internet for specific plant info. Notes can dump into posts on WordPress. The plant file database dumps into pages.

This would go much easier, if RB wasn’t a little bitch about not allowing databases on the $100 version. No way am I spending $500 on this highly experimental project just to get db access. However, RB kicks VB6 down flat and it has the ability to compile to Windows and Mac.

I’ve worked through this design process before at work. If something comes out the other end, it’s almost always rock sold and a very useful tool. A quick Google search showed that there are now gardening applications. A good personalizeable plant file db might be good enough to sell the whole thing. Then the blog connectivity. Then the notes. There is plenty of room to grow.

We’ll see.

Porting VB Applications to Linux and Mac OS X

How To Read a Text File

RealBasic TV

Electric Pi RealBasic

CH: Behold WordPress, Destroyer of CPUs

Wednesday, April 23rd, 2008

Jeff Atwood has a post about making WordPress faster. This is a big concern for my blog, which several degrades at times, but for which I can get no performance data for the machine. He is hosting a new blog locally and measuring the CPU under Win2K8.



For a bare-bones blog which is doing approximately nothing, this is a completely unacceptable result. It’s appalling.

As evidence of what a systemic problem this is, there’s an entire cottage industry built around shoehorning better caching behavior into WordPress. Take your pick: WP-Cache, WP-Super-Cache, or Bad Behavior. The caching add-ins don’t work very well under IIS because they assume they’re running on a *NIX platform, but they can be coerced into working.

Does it work? Does it ever. Here’s what CPU usage looks like with basic WP-Cache type functionality enabled:

CH: Setting up Subversion on Windows

Monday, April 7th, 2008

Setting up Subversion on Windows

Allow me to illustrate how straightforward it is to get a small Subversion server and client going on Windows. It’ll take all of 30 minutes, tops, I promise. And that’s assuming you read slowly.

JOS: Martian Headsets

Wednesday, March 19th, 2008

Great post from JOS about the coming war over Internet Explorer 8, web standards, and general design principles of multi-version products. Even if you don’t get programming stuff, this is really good. Should be very understandable.


You’re about to see the mother of all flamewars on internet groups where web developers hang out. It’ll make the Battle of Stalingrad look like that time your sister-in-law stormed out of afternoon tea at your grandmother’s and wrapped the Mustang around a tree.

This upcoming battle will be presided over by Dean Hachamovitch, the Microsoft veteran currently running the team that’s going to bring you the next version of Internet Explorer, 8.0. The IE 8 team is in the process of making a decision that lies perfectly, exactly, precisely on the fault line smack in the middle of two different ways of looking at the world. It’s the difference between conservatives and liberals, it’s the difference between “idealists” and “realists,” it’s a huge global jihad dividing members of the same family, engineers against computer scientists, and Lexuses vs. olive trees.


Martian Headsets

Incremental or In-Line Search

Tuesday, February 26th, 2008

I recently discovered Incremental Search on VS2005 and it turns out I already knew it. You might too. Delimited or “regular” searching is the Microsoft default. I use it most in Internet Explorer to see if the page contains a secondary search term. It goes like this. Click Edit\Find. Type in a box. Click Find. It does or does not find the term. IE might find part of the term. Notepad is the absolute worst. All of the term matches or none does.

Firefox uses Incremental search. This is how it goes. Click Edit\Find. A bar appears across the bottom. Start typing, the window will jump around as your typing matches various words on the web page. If nothing matches, the background of the text field becomes light red. If more than one thing matches, click Find Next to go to the next one.

When I discovered this feature dissimilarity 4 years ago I freaked. It’s so much better in FF that it was half the reason for leaving IE. At this point it’s probably one third the reason. That’s a lot for one feature. It’s very frustrating to use other programs that don’t have this. I use Notepad++, because Notepad’s Find feature is so worthless. MS doesn’t seem to have updated Notepad in a decade and it was one of my most used programs.

Search: If It Isn’t Incremental, It’s Excremental
Visual Studio 2008 How to: Search a Document Incrementally