Posts

Showing posts from July, 2007

WCF Service Debugging with the serviceDebug element.

Learning the "WCF way to do stuff" that you already know how to do is hard enough - but being able to debug boo-boos and fix them along the way can be an important part of your toolset. Since WCF services can return complete exception detail of a fault back over to the client, an easy way to enable this is to add the debug element: <behaviors> <serviceBehaviors> <behavior name="serviceBehavior" > <serviceDebug includeExceptionDetailInFaults="True" httpHelpPageEnabled="True"/> <serviceMetadata httpGetEnabled="true" /> </behavior> </serviceBehaviors> </behaviors> </system.serviceModel> the <serviceDebug element with the includeExceptionDetailInFaults and optional httpHelpPageEnabled attributes turns on this cool stuff for debugging. So if an exception occurs, it gets marshaled back to the client where you can see it. See here for details . Finally, Nicholas Allen has a wonderful dow...

Visual Studio 2008 (Orcas) Beta 2 Installation, Issues, Fixes

"A computer lets you make more mistakes faster than any invention in human history - with the possible exceptions of handguns and tequila." -- Anonymous Well, I downloaded Visual Studio 2008 Beta 2. I mounted the image as a virtual DVD with the free VCDControl Tool on Windows Vista Ultimate, 32-bit. I uninstalled the Orcas BETA 1 from Control Panel "Programs and Features", which does a chain uninstall of all the bits. Now I am ready to install the BETA2. I click on the SETUP.EXE from off the virtual DVD drive and nothing happens. Try several times. OK, that doesn't work. Let's try executing the .msi instead. Uh-Oh. The msi tells me I have to install with Setup.exe, which I already know doesn't work. Reboot, try again, same BS. FIX: Copy everything from the VCD drive onto a folder on your phyiscal hard drive, and run Setup.exe from there. That should fix it. Everything else about my install went perfectly, and I didn't even need to repair Visual Stud...

Cell Phones Making People Sick --Is It All In The Mind?

"With WCF, all messages are SOAP messages" -- Juval Lowy A lot of noise has been made lately about the supposed health dangers of WiFi and other types of wireless communications. -- The media stories about them are generally full of crummy reporting and bad science. The reports usually feature a person who claims to have "electrosensitivity," and that radiation from WiFi or mobile phone networks (or the phones themselves) makes them sick. I have some personal experience with this as my S.O. (Significant Other - who is perfectly normal in all respects) claims she has electrosensitivity and in fact I remember one time when I was sitting in a chair on the other side of the living room, and my cell phone vibrated (no noise at all) because of an incoming voicemail, she suddenly startled and complained of a sharp pain in her leg. Coincidental, yes - but it doesn't prove anything. Despite the claims, these people generally fail double-blind tests to see if they really...

Nasty IM Spam Sites Comin' at ya - UPDATE!

Image
NOTE: It only took the DNS provider an hour or so to shut these bastards down. Good Riddance! I'm leaving the post up for educational purposes. Don't give out your Windows Live ID (Passport) or other credentials to any site unless you absolutely know who they are. In this case, you are getting a message from a trusted friend to go visit this site. That's social engineering. UPDATE 7/28/2007: These guys are back with a new domain and a new provider, and now they have EVEN MORE "FAQ" like stuff to try and convince you that they aren't "Phishing". TRUST ME: THEY ARE: http://www.messenger-tips.com/ Visit this site: http://msnlive.bounceme.net/ (This domain was TURNED OFF by the DNS provider) it tells you who deleted or blocked you from their MSN (Live) Messenger contacts. BUT DO NOT LOG IN! This is one of the best examples of social engineering I've seen in a while. It looks really professional doesn't it. You are going to log in with your Windo...

Google and SEO: Some interesting facts

Google now "sees" underscores in URLS as word-separators(delimiters). Previously, in a URL like http://www.mysite.com/iphone_review.html Googlebot couldn't "see" the words iphone or review. Instead it read iphone_review as one word. Now, it will see iphone and review. Google treats URLs with a query string the same as static URLs. Caveat: as long as there are no more than two or three parameters in the URL, that is! To explain in another way, you won't take a hit in your Google rankings if you have a question mark in your URL; just don't have more than two or three equals signs in the URL. So, if you've been tormented about whether you should implement URLrewriting in your site or blog, don't fret. The number of slashes in your URL (i.e. the number of directories deep your page is) isn't a factor in your Google rankings. Although it doesn't matter for Google, it is rumored to matter for Yahoo and MSN (Live Search). The file extension in ...

Web standards? IE? Firefox? BS!

Image
It's a rare person who wants to hear what he doesn't want to hear. - Dick Cavett I am really getting tired of seeing all these "holier than thou" articles, comments and rants about how Internet Explorer sucks because it doesn't implement "web standards" correctly, and how Firefox "does". Bottom line? A bunch of BS! Neither one does! Here are a few images from the ACID 2 Test which deliberately invokes invalid CSS to see how browsers handle it: IE TEST: FIREFOX TEST: REFERENCE IMAGE: Bottom line? Users need to quit their political, opinionated rants and work to ensure that browser manufacturers all work together so that there is seamless, consistent behavior across browser brands - whether it be rendering, Javascript, CSS, the DOM, or whatever. Standards take time to create, and a lot of thought goes into it. The standards are there for a reason. Let's stop the BS. Browser manufacturers and users all need to stop attacking each other and ...

ASP.NET: Prevent Long-Running Page from timing out

On some occasions you may have a database query or other operation that takes a long time. If it takes long enough, your ASP.NET Page may timeout. Obviously, you want to optimize your SQL or other process, but if you can't you can control the Page Timeout via the httpRuntime element's executionTimeout attribute. You can set the timeout value for a request in web.config. You can even change the timeout for one specific page: <location path="yourpage.aspx"> <system.web> <httpRuntime executionTimeout="180"/> </system.web> </location> The httpRuntime element is not explicitly defined in the Machine.config file or in the root Web.config file. However, the following settings are the default values initialized by the system. If you need to customize this section you must create it in your configuration file and define only those attributes that need customization: <httpruntime enable="true" executiontimeout="110"...

Social Networking Sites and Session Objects

"I had a dream I was stuck in an elevator with Michael Bolton, Kenny G. and Yanni, and I had a gun - with only one bullet." -- Alan Rock (Jazz DJ) One good answer to Alan's quote above would be to get them all to line up, one right behind the other.. but, I digress! I have had a passing interest in the social networking buzz over the last couple of years, and the ones with API's are of course most interesting to me as a developer. Digg is useful, and it has an API, but it really has a more narrow focus based on community ranking of posted "news" (e.g., articles, blog posts and what have you), rather than more of a concept of "communities" comprised of members who share common interests / traits. One that is really starting to stand out is FaceBook , which has a clean, uncluttered look and actually has features that could be considered useful, unlike stuff like MySpace which (to me) is just a cluttered mess of spam and "me too" ism. Of co...

Spam Filters Gone Wild 2007

One of the primary concerns you will have as a blogger or developer of content sites is filtering porn and spam. The approach I've taken with ittyurl.net is basically to have a database table, "BADWORDS". This gets loaded into a string array at startup, and any time somebody wants to add a link, since the application spiders the page anyway to collect tags and metadata, I run it through my IsBadWord method. The process is very fast and it has worked extremely well. Since about January 2007 when I put up the first beta of the site, I've only had to manually remove three or four links out of the several thousand that users have added on the site. Sometimes the sneaky little scumbags have a redirect to their porn / spam sites from a "nice" page and that of course is something you cannot foresee (unless of course, you want to have your WebRequest follow redirects -- it just goes to show you they will stop at nothing in the dirty tricks department!). Other times...

Effectively Promoting your Blog (or WebSite)

Over the last couple of years I've learned a few "tricks" that help to promote blogs and WebSites. Most of the time, the techniques work for both a blog and a WebSite, especially if the site has at least one RSS feed. Blog and site promotion is an ongoing process, it takes time. There is no "Magic Bullet". Use the following steps to start promoting your blog or website: Submit your blog's URL to each major search engine Google, MSN (live.com), AOL, and Yahoo. Also go to http://www.1stopsubmit.com/ http://www.submitexpress.com/ http://siteexplorer.search.yahoo.com/ and submit your URL. The first one will automatically submit your blog URL to over 50 search engines for free. They ask for a reciprocal link, but it is not required. Open http://www.blogmetafinder.com/ (our site) and submit your blog to as many of these blog and RSS feed directories as possible. Use your key phrase in the title and at least once in the description if you are able to enter one. Th...

Who's Winning the Search Engine War?

This will probably not come as a surprise to many, but my statistics show that Google is the clear leader across the board. Recently I checked some statistics on which search engines are sending traffic to my ittyurl.net site, which has really started to take off. The bottom line: 1.google 6,782 2. yahoo 1,666 3. aol 76 4. search 64 5. altavista 24 6. msn 12 MSN is at the very bottom, man! My site has long since been submitted to all these search engines, and it has a standard XML Sitemap for them all to consume. The sitemap is automatically updated at least once a day, and anybody who's got an RPC or other PING mechanism is getting notified of any new content in realtime. Yahoo is making a showing, but the others are so far behind, it's a JOKE! Google is the clear winner, by a long shot. You guys want my business? You need to crawl my site(s) and send traffic. It's a pretty simple equation to me! I'm the web site owner and producer, and I have the original content. Y...

Vista: KB935807 Windows Update Woes - and XML Escape

Windows Update is great -- when it works. There have been a few slip-ups in recent months, and this is another one. What I got is basically the update failed to install. So, I resorted to installing the list of updates one - by - one. All worked except KB935807. FInally I downloaded the .msu from TechNet and installed it by double clicking on the file out of Windows Explorer. That worked, except for one thing - Windows Update keeps showing up in the Notification area, reporting that I need to install - you guessed it - KB935807! There's some "stuff" appearing on the web about this, lots of people are getting it, it's a patch for the firewall, which service I keep disabled since my wireless router -- like most routers -- already has one built in. (Yikes - how many firewalls do we need, folks -- really?). So far, this is the only "Fix" I've seen. I want to caution that I have not used this, nor do I know if it even works: Follow the instructions below 1. O...

ASP.NET : Killer Viewstate Invasion

"They can hold all the peace talks they want, but there will never be peace in the Middle East. Billions of years from now, when Earth is hurtling toward the Sun and there is nothing left alive on the planet except a few microorganisms, the microorganisms living in the Middle East will be bitter enemies." -- Dave Barry Recently I was "trying out" some pages on my latest creation, BlogMetaFinder.com , and I noticed that paging of the Gridview on the main page was slow. Long story short -- View Source and I've got 975,000 bytes (In EditPlus, "Edit / Character Count") mostly all ViewState. "Yikes", I thought, "if I turn this off I'm gonna have to do custom paging with this SQLDataSource and all kinds of extra stuff". The data source is a little less than 2500 rows now, which is kind of "on the edge" of where you might not want to use the default paging in a GridView. Anyway, I turned off ViewState in that Page and a...

Adsense E-Books, SEO, and Private Jets for Climate Change

"Reusability of code may not be one of the three pillars of OOP, but it's one of the most important ones." --Yogi Berra There is no question that Google has totally dominated the context-sensitive advertising space with their Adsense product. It's easy to use, they've tuned it up nicely over the last 3 or so years, and now they have added the product - oriented "pay-per-action" advertising option in addition to the "pay-per-click". Another truism is that anytime you have a product or service that makes a big impact, cottage industries spring up around it. Adsense is no exception, and there are now gazillions of SEO sites, services, forums, and purveyors of tracking products -- and of course, dozens of e-books about Adsense. Most of these e-books are grossly overpriced, contain a lot of "Fluff" around the "good stuff" (if there is much of it) and can be safely ignored. But there is some "good stuff" to be learned. ...

Database-Agnostic or Database-Specific .NET Architecture?

This is one of those flaming debates which really derives from (or perhaps just implements the interface of) the "Stored Procedures Are Evil" debate. I title it thusly because that's the real issue in my mind - not whether one should use stored procs or parameterized textual queries - but whether code should be written using a provider model that allows any RDBMS system to be "plugged in", or whether to exploit all the features of a particular database system and say "be damned" to the provider model. In other words, "this is the app, we take advantage of x, y and z special features of xyz brand database that we wanted to use, and you can't switch databases with this app". So what the hell is wrong with that? For certain apps, that can be a good thing. Here are a few juicy links on the original issue to get your blood boiling, if you haven't seen them already: Bouma Howard Miller DeBetta Attwood Personally, I can and have taken bo...

ASP.NET: Modifying display of DataBound Items based on values of data

"Now you can spend like a drunken liberal on a government grant with our new flat-rate shipping." -- conservative online T-Shirt company A common question you see on forums and newsgroups is "how to I do xyz with a databound repeater field based on the value of the data?" (e.g. show an image, change the display text, etc.). There are several ways to do this, here are some samples from recent newsgroup posts oriented around the Repeater control: 1. Bound expressions: <ItemTemplate> <asp:Label runat="server" ID="Label1" Text='<%# (int) Eval("DataField") > 0 ? "Greater" : "Less or Equal" %>'/> </ItemTemplate> 2. Handling the ItemDataBound event (or RowDataBound for GridView): protected void repeater_ItemDataBound(object sender, RepeaterItemEventArgs e) { RepeaterItem item = e.Item; if (item.ItemType == ListItemType.Item item.ItemType == ListItemType.AlternatingItem) { Label label = (L...

Saving Rendered ASP.NET controls to files

This is a pattern I use frequently -- for example, if I have rendered some RSS format search results to a page, I may want to save this generated HTML of the DataList (or a Gridview, or any other UI display control) to a file, which can easily be read back in later and assigned to an HtmlGeneric Control that is then attached to a placeholder on an ASPX page, kind of like a FileSystem Caching mechanism: this.DataList1.DataBind(); System.IO.StringWriter oStringWriter = new System.IO.StringWriter(); System.Web.UI.HtmlTextWriter oHtmlTextWriter = new System.Web.UI.HtmlTextWriter(oStringWriter); DataList1.RenderControl(oHtmlTextWriter); StreamWriter sr = null; string fullFilePath = Server.MapPath("mySavedDataList1.htm"); try { sr = new StreamWriter(fullFilePath); string oStuff = oStringWriter.ToString(); sr.Write(oStuff) } catch (Exception ex) { // Exception Handler here finally { if (sr != null) { sr.Close(); sr.Dispose(); } } What this does is wrap...

Coder's Block and Braille on Drive-Up ATMs

Q. Why do they have Braille dots on drive-up ATM machines? A. Since the Braille is required on the ones that are installed in walk-up locations, it is cheaper to only make one model. At first the above question seems ridiculous, but once you get into "real world" economics, the true answer seems quite logical, doesn't it? Did you ever get Coder's Block? It's like writer's block - you sit down knowing that you intend to work on something, and, well, for one reason or another, nothing happens. I generally don't ever get this at work -- the pressure of having to produce and being on the time-expense report means that although my performance might go up and down, at least I'm always producing. However, I do get this when I am working on my own projects, and I've got a bit of it now. I'm working on a prototype "Link Purchase" system that includes an affiliate commission program, and I'm at the part where I need to integrate PayPal pay...