Welcome to RogerGuess.net Sign in | Join | Help

WatiN does not currently expose the name property of a select list. However, there is still a way to get at it if you have the element that represents it with a reference to Microsoft.mshtml:

foreach (Element element in ie.Elements)

{

string name = (((mshtml.HTMLSelectElementClass) (element.HTMLElement))).IHTMLSelectElement_name;

}



If you have tried to user WatiN tests to set the value of text boxes/fields, you likely have run into a few things.

First, this...
 ie.TextField("ID").Value = "some text";
is much faster than this...
 ie.TextField("ID").TypeText("some text");

Next, if you are using client side validation or any of the MaxkedEdit controls, you probably discovered that it does not play too well. I originally used this just to make it work for me...

TextField textField = ie.TextField(Find.ById(new Regex(controlId)));

textField.Focus();
for (int i = 0; i < value.Length; i++)
{
    textField.KeyPress(char.Parse(value.Substring(i, 1)));
    textField.WaitForComplete();
}

For one, it is pretty slow. Also, it just does not seem to work 100% of the time. WatiN exposes one additional method to make this a lot faster. Eval() will allow you to inject and run javascript in the instance of the browser..

TextField textField = ie.TextField(Find.ById(new Regex(controlId)));
string eval = string.Format("document.getElementById('{0}').value = '{1}'", textField.Id, value);
ie.Eval(eval);

Happy Testing!

   

I am finally uploading that sample app I used for my FWDNUG talk this past Tuesday. Check it out on SilverlightAddict.com

SilverTwitter A Service Enabled Silverlight App

Silverlight Addict

SilverlightAddict.com was launched today. The goal is to become a rich content driven sitcky website for all things Silverlight.

I am playing in the System.Drawing.Imaging namespace, and had an issue trying to draw over the top of bitmaps I had pulled from the web via HttpWebResponse.GetResponseStream.

This Code:

Graphics graph = Graphics.FromImage(bitmap);

Returned this error:

A Graphics object cannot be created from an image that has an indexed pixel format.

The image I was trying to consume had a Image.PixelFormat of Format8bppIndexed. After searching a number of places, I finally found this bug listing. Turns out it’s an old issue that has not been fixed in 2.0. Either way, the fix is pretty simple. The following line of code will change the PixelFormat to Format32bppArgb, and the Graphics.FromImage method takes that format:

bitmap.MakeTransparent(Color.FromArgb(0,0,0));

For me, this was definitely a needle in the preverbal haystack. I think my problem is that I often search on the wrong terms. Google will tell you when you misspell something. I just wish it told me when I search on the wrong keywords for my problem. So I will put those keywords here, so a keyword search might lead you here. Hope it saves you the two hours I lost.

Image.PixelFormat
ImageFormatConverter
System.Drawing.Imaging.Imageformat
System.Windows.Media.Imaging ( yeah, my solution might have been there also, but wasn’t ready to use 3.0 for a Click Once deployment. )

And the error again for good measure...

A Graphics object cannot be created from an image that has an indexed pixel format.

Line Rider Beta 2

Shhh... Listen. The slurping sound you hear is coming from the collective decline in the planetary GDP. This thing is addictive. I will admit to at least a good five hours of playing with this back in beta 1. I think my four year old is nearing the century mark. Beta 2 is a huge improvement. New features:

  • The pencil tool now seems more smooth
  • Each line shows by color what is the front and back of the line
  • A Line tool that now lets you make perfectly straight lines
  • An Eraser! One line at a time.
  • Swatches: Blue for regular, Red for acceleration, and green for decoration only. (They all turn black when playing)
  • Zoom!
  • The Flag. This one is huge. You can save the riders current position during simulation, a flag is placed at that location, and the next 'play' will start the rider at that spot!

The console rights have apparently been aquired by inXile, and they are talking Wii and Nintendo DS launches.

Take a guess what percentage free space would you guess is available on this drive? This is the server of a client of mine.

  • .3%
  • 3%
  • 13%
  • 37%

Ok, here's math: It is a 57gb partition with 21gb free. That's right. You can have a defrag graph like that and have 37% free space available on the drive! Unbelievable. I have tried more options than I care to relate, but here are the major ones:

  1. Removed the page file completely. This box has 4gb memory, so I think it can manage.
  2. Moved the top 25 most fragmented files identified by defrag completely off of the system.
  3. Uncompressed the drive. Yea, I know, never ever use compression. It wasn't me.
  4. Defrag with windows scheduler about 45 times.
  5. Defrag for five days with Diskeeper, both continuous, and the 'comprehensive'. It claimed to have removed over 100k fragments, but I sure don't see any evidence.

There is nothing in the recycle bin, and sql and other major services are stopped. At this point it seems to me the only course is to completely format and rebuild the os (win2k btw..). Any ideas? Please...

Does make you think of Starship Troopers, right?

1 Comments
Filed Under:

WASHINGTON (Bedrock Daily) – The Pentagon today approved a design to produce a hybrid powered EM hardened Humvee to meet special requirements laid out for the current US armed forces operating in the world theatre. The Pengagon is responding in part to increased pressure to make the modern military more 'eco' friendly. The need for a EM hardened ground vehicle comes in the wake of current tensions in the middle east and the need to increase readiness for urban EMP threats. The design has been on the drawing board for over 9 years, but the working prototype presented by researchers at Texas A&M University has pushed the envelope far enough to make this technology viable for production. Texas A&M was awarded a four year, $17 contract to outfit eight surplus and scrapped Humvee’s from the current ars-enal.

Hybrid Humvee

- Fred Flint (original image from CanadianDriver  )

Yahama R1 Motorcycle on Crafts-UnlimitedI was having a chat with a buddy of mine, and he mentioned a bike his friend was about to purchase. An ‘R1’ he said. I am not fluent with motorcycles, so I quickly googled “r1 bike”. I was very surprised, laughed, and showed him what Google listed as  #1 out of 1.9 million results for ‘r1 bike’. A site in the UK called Crafts-Unlimited has a page selling a kit to cross stitch a Yamaha YZF R1. Yes I said ‘cross stitch’. This is a page where you can buy a kit to sew your next family heirloom of a shiny red 8.7” x 6.1” Yamaha motorcycle (no, I don’t get it either).

At first, I thought this has to be an anomaly. At the least, I had to have found some kind of hole in the Google search ranking algorithm. Seriously. A site that sells sewing kits, has one page with a fuzzy picture of a kit for a motorcycle pattern. The search term ‘r1 bike’ gets them the #1 spot. Take a look at the sites that made up the rest of the top ten on that search:

• Popular Mechanics - 2002 Yamaha R1 Motorcycle
• BikePics - Yamaha YZF-R1 Home Page on BikePics.Com
• Yamaha YZF-R1 Accessories, Yamaha YZF-R1 R1 Bike Covers (the Yamaha website !!! )
• An R1 bike rider tapes a Civic crashing into her. (reddit.com)
• eBay: MAISTO 2004 YAMAHA YZF R1 BIKE 1/12 DIECAST RED (item ... (ebay)
• Amazon.com: R1 Bike Covers: Sports & Outdoors (amazon)
• Motorcycle Online: First Ride: Y2K Yamaha R1 (motorcycle.com)

Lets take a look at the page source. My search was “r1 bike” so obviously those are important words for search engines to find in the page. Lets compare #1 Crafts Unlimited to #2 Popular Mechanics.

Here are the headers for this page on Crafts Unlimited:

<head>
<meta name="description" content="yamaha yzf r1 bike Cross Stitch kit">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="keywords" content="yamaha,yzf r1,bikes,cross,stitch,kits,charts,vehicles">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>Yamaha YZF R1 Bike Cross Stitch Kit (No Frames)</title>
</head>

The words “R1” and “bike” are both in the list, and interestingly right next to each other. They kept it simple, and used a short list of keywords.

Here is the header from Popular Mechanics:

<title>Popular Mechanics - 2002 Yamaha R1 Motorcycle</title>
<meta name="site" content="PopularMechanics.com">
<meta name="Description" content="2002 Yamaha R1 Motorcycle">
<meta name="Keywords" content="automotive, new cars, motorcyles, yamaha, R1, 2002 car shows, 2003 car shows, 2004 car shows, auto shows, auto technology, automotive, automotive news, … (truncated)

they misspelled ‘motorcyles’ (oops)

Google Search Results for 'R1 Bike'Note that ‘bike’ is not in the meta keywords for the Popular Mechanics page. However, ‘bike’ shows up 4 times in the text of the article, and another 4 times on other parts of the page. “R1 shows up 8 times. It is interesting that it is also not found in h1,h2,h3,strong, or even in bold on that page. I also noticed that the source for the Crafts Unlimited page did not have one single h1, h2, or h3. However, “<strong></strong>” was used around “Bike Cross Stitch Kit” and “YAMAHA YZF R1”. The word “Bike” only appears one time in the test of the page, as does “R1”. That matches the keywords from the header, and the title of the page.

So I am still a bit confused, as to how this was the number one google search listing for a search that yielded nearly 2 million pages. What is the golden rule of getting into the top ten of search engines? Anyone, anyone (sorry)? I have always thought it was having other highly ranked sites linking you: links, ‘backlinks’, and ‘trackbacks’. I know I have read that somewhere. The keyword relevance is there, but it is it really that much better than the Popular Mechanics page? This one must be about the links. Right? Lets try the google linking search (put “link: ” in front of any url to see who links to that url)

link: www.crafts-unlimited.co.uk    66 results

Again, I am a bit confused. Meta keywords, title of the page, and one instance of each keyword in the body of a page, 166 links to the website. That number of links is nothing to sneeze at, but check out the competition:

link: www.popularmechanics.com   270,000 results
link: www.yamaha-motor.com   37,700
link: www.bikepics.com    59,400
link: cgi.ebay.com     5,540,000
link: www.motorcycle.com    29,300

The confusion continues. We know the meta tags are important. The page for Crafts Unlimited only had 8 keywords, 9 words, and 53 characters. The PM page had 73 words in 34 keywords, for a total of 411 charters. Is PM being penalized for having too many kewords? CU had ‘r1’ in the 2nd keyword, and ‘bikes’ in the 3rd. PM had only ‘R1’ in the 5th keyword. The description content for CU had “r1 bike”, where as PM only had “R1”. The order may matter to some search engines, as well as a combination of the order and the number of words listed for content.

Is that it? Probably not. A solid match on both keywords, and description seems to have won this ranking. I still find it hard to believe that there are not more relevant pages out there based on the meta keywords, descriptions, placement within page title, h1,h2,h3 tags, or even straight occurrences within a page. However, I do not care to analyze the source of all 1.9 million pages found. Sorry, just call me lazy.

ScottW released a sharing module along with his ScottWater.CS.Modules. I had noticed these in the 2.1 beta 1 release, and also the more customized version on one2one.dell.com. I had not yet made the time to do any modules for CS, so this looked like a nice way to get my feet wet. I grabbed the source from ScottW’s module, and made some slight changes. 

Now, you can do all the following with just changes to your communityserver.config: 

  • Update or remove the ‘share it’ message preceding the links
  • Update or remove the separator that goes between the links
  • Each link in the list can be separately configured to show:
    • Text link only
    • Image link only
    • Image and text link

I also updated the classes in the rendered html so you have a tad bit more control via styles.

Downloads:

ShareLinksModule DLL Only
ShareLinksModule Full Source

0 Comments
Filed Under:

I went searching for cs skins. Community Server skins that is. Googling "cs skin" returns 11 million results. Files: Themes and Skins (communityserver.org) is up there at #6. That is pretty impressive considering the competition for the 'cs'. If you Google "cs", you get a sense of the competition for that is out there for the abbreviation "cs":

  • Counter-Strike (#1 now, but for how long?)
  • computer society
  • computer science
  • Photoshop CS
  • CS Lewis
  • CodeSmith.

With all that, these stats for Community Server are even more impressive. Compare the results of these search terms from Google:

Term   Results
cs        407,000,000
counter-strike 27,300,000
counter strike 60,100,000
community server 485,000,000
photoshop 267,000,000

 

Talk about free press! (Yeah, me too, I know...)

http://www.treehugger.com/files/2006/07/worlds_first_aa.php#perma

http://www.sysinternals.com/blog/2006/07/on-my-way-to-microsoft.html

Better download those apps while you can. By the looks of it, everybody else is doing it right this minute ( 3 AM CST for me!). The site seems to be pretty slammed at the moment.

 

I realize this is old news, but have you seen the game play video of SPORE? Wow, and it's 35 minutes long!

http://video.google.com/videoplay?docid=8372603330420559198

And here is a little vid from E3 that reminds me of an intro to some show, but I can't seem to put my thumb on it.

http://www.spore.com/screenshots.php?movieID=sporeE32006&play=hi

 

0 Comments
Filed Under:
More Posts Next page »