Sunday, August 22, 2010

New Stylesheet for PORDL

So, I spent the whole day Sunday making a new Generic XSL stylesheet for PORDL. I built javascript into the XSL that ticks through the nodes showing only one at a time. I was pleasantly surprised that they worked great out of the box for Picasa and FlickR gallery feeds.

PORDL makes it easy to embed the gallery with just one line of code:

<script type='text/javascript' src='' ></script>

Friday, August 13, 2010

What's the Deal Windows?

For many, many years now, I have been seeing this stupid window, "Please wait while Windows checks for a solution", every time programs crash on my machines. This stupid popup window thing has never, ever worked. It is a total waste of time. I pretty much hit "Cancel", now, whenever I see it. Come on, Microsoft, are you every going to get this thing working?

Wednesday, July 21, 2010

Pass Querystring Parameter to ASP.NET Control

Although this is grade school stuff, when you can't get something working, you need to consult Google for the answer. But, I couldn't find the answer on Google. So, I will be the first, I guess:

I was doing some cross-browser scripting, trying to get the output of a ASP.NET contol to appear on a PHP page on another site. But, your reasons will probably be different. In any manner, if you need to pass variables through the querystring to an ASP.NET page, this info may help:

<asp:myControlName myPropertyName="'<%# Request.QueryString("myURLvariableName")%>' ></asp:mycontrolname>

Wednesday, May 26, 2010

XSL Transform of a Remote XML feed via Javascript - Requires VB.NET

I wanted to use Javascript to display an RSS feed from a remote web server via a client side XSL transform. Javascript has security levels to prevent 'cross browser' scripting attacks, so it won't let you pull in a remote feed. But, I wanted to do it anyway. Call me crazy.

My solution was to get VB.NET to pull in the feed and echo it from my web server, basically acting as a Proxy, and fooling Javascript into thinking the feed is safe.

I created a .ASPX page to pull in the feed, turn it to a string, and output the feed for Javascript to use.

Stupid Firefox wouldn't load an XML transform from a .ASPX page like IE will, so I had I couldn't stream the file dynamically. Instead, I had to write the script to save the stream to a .XML file.

This script needs to write to an .XML file on your server ( called blogger.xml in this example ). You'll need to assign write permission to that file.

<%@Page Language="VB" %>

<%@ Import Namespace="System.IO" %>
<%@ Import Namespace="System.Xml" %>

Third, I created an .xsl stylesheet for the feed and saved it to my server as a .xsl file. The stylesheet I created is for a Blogger Atom Feed:


( comments)

Then I used Javascript to do a XSL transform of the feed: NOTE: I spent a good deal of grief on this until I discovered my script wouldn't work for me in a .js file. I put it in the HEAD of my page and it worked fine.

<head onload="outputFeeds()">

Monday, May 17, 2010

GoDaddy Ruined my Sunday

So, basically, all I wanted to accomplish on Sunday was to connect my Visual Web Developer to a remote SQL Server database hosted by GoDaddy.

This should have been a piece of cake. I should have been able to set up the connection, do a little testing, and be done before breakfast, right? Well, it didn't work out that way. In fact, at 10:30 pm, I was still cussing up a storm. Turns out, GoDaddy doesn't allow remote connections by default.

If you are one of the lucky ones, the GoDaddy Database Manager will ask you if you would like to allow remote connections during the initial setup of the database. Wait an hour for GoDaddy to create the database, and you should be up and running.

I, however, was not one of the lucky ones. GoDaddy's Database Manager never, ever prompted me to allow remote connections. I tried to fight it. I tried to connect with other services, Visual Studio, Expression Web, etc. No avail. I finally decide to try GoDaddy support. Their email tells me I need to delete all my databases from the Database Manager so they can migrate my service to a server that allows remote connections.

I would normally not be angry, not a bit, in fact. I wouldn't care how many hoops I had to jump through so long as I could get this thing working. Problem is, there isn't a single piece of documentation on the web to let me know GoDaddy was blocking remote connections and I would need them to move me to another server. Thanks for ruining my Sunday, GoDaddy!

Wednesday, April 21, 2010

Reducing .NET MasterPage Flicker

Sites built with .master pages have a problem that Microsoft has not yet solved. It is called "page flicker". Flicker is the visual effect that occurs when the content of a page dissappears in the browser and then reaapears. It occurs on .master pages because the .net system completely refreshes the DOM with every page load. It is more a browser issue that a .net issue really.

Some day, I would like to find a way to deliver sites with zero flicker. I don't know that .master pages will ever allow us to do that. In the mean time, however, I have come up with a few methods of reducing Flicker:

  1. Reduce the use of tables in the site structure. Tables take longer for the browser to render

  2. Pull all possible image links from your master page and put them in your .css file

  3. Use AJAX to load only the content sections of the page ( unfortunately, this method would require a great deal of additional ajax programming on every site... so I would not recommend it )

  4. I'd like your opinions on the use of a tiny little meta tag commonly referred to as FAJAX ( Fake AJAX ). There are two versions typically used to reduce flicker. NOTE: these are only supposed to work in IE. FF will probably still flicker:

<meta http-equiv="Page-Enter" content="Alpha(opacity=100)"/>


<meta http-equiv="Page-Enter" content="blendTrans(Duration=0)"/>
<meta http-equiv="Page-Exit" content="blendTrans(Duration=0)"/>

I recommend the first one over the second. It seems to work better.

I would never claim to be an expert on page flicker, so, I'd appreciate you comments, ideas, or other input so we can come to a concensus on the best solutions for our team.

Friday, April 16, 2010

ASP.NET - Pulling strings/variables from the page URL

These two scripts are very useful if you need to test for variables in a URL, pull values from variables in a URL, or pull any substring from the URL using RegEx.

Getting a variable from the URL with VB.NET

Put this in the HEAD of your page:

Put this in the BODY of your page:

<% =GetURLvariable()%>

Test if a URL contains a string/substring with VB.NET

Put this in the HEAD of your page:

Put this in the BODY of your page:

<% =GetFolder()%>

Monday, March 29, 2010

Embed Picasa Web Album with VB.NET and XSL

First, drop this code in the HEAD of your .aspx page:

NOTE: Change the URL on line #8 to match the url to your Picasa RSS Feed

<%@ Import Namespace="System.IO" %>
<%@ Import Namespace="System.Xml" %>
<%@ Import Namespace="System.Xml.Xsl" %>

Drop this in the BODY of your .aspx page:

Finally, create a .xsl file called feed_style.xsl. Save the following in it:

  • Tuesday, March 16, 2010

    My New Syntax Highlighter

    I'd like to thank Jon Williams for his contribution, Blogger Code Syntax Highlighter.

    Finally, I am beyond doing find/replaces to make my blog code readable. Here is a demo:

    • Test

    Monday, March 8, 2010

    Facebook Application AJAX/ PHP form submittal

    How to create a Facebook Application in a Tab on your Facebook Fan Page

    NOTE: Facebook is ever evolving. Check the Facebook Developer's Roadmap for timelines and changes.

    • 1. Create your Facebook profile page.

    • 2. Log in to your profile.

    • 3. Applications will not (currently) work in Tabs on Standard User Profiles. So, you must create a Facebook Fan Page - otherwise known as a business or organization page.

    • 4. Read Get Started

    • 5. Create an App with the Facebook Developer's App

      • Use the following settings:

      • BASIC: Application Name: My Application (or whatever you want)

      • AUTHENTICATION: Installable to: Facebook Pages (IMPORTANT)

      • PROFILES: Tab Name: My App (or whatever you want)

      • PROFILES: Tab URL: MyApp (IMPORTANT:this points to your folder /facebook/myApp/)

      • CANVAS: Canvas Page URL: MyAppPage (or whatever you want)

      • CANVAS: Canvas Callback URL: (IMPORTANT: this points to your /facebook/ folder )

      • CANVAS: Render Method: FBML (IMPORTANT: facebook markup language)

    • 6. Create a folder on your personal web server called /facebook/.

    • 7. Create another folder under /facebook/ called myApp

    • 8. Create two files under /facebook/myApp/ called index.php and test.php.
      NOTE: you can use on a windows server, or some other server-side language if you prefer.... which I do, but am not going to show you for the sake of making this less complicated than it needs to be.

    • 9.

      The Code


    Welcome <fb:name uid="<?=$user_id?>" useyou="true"/>
    <div width='100%' height='150px;'>
    <img style='float:left; margin: 0 25px 0 15px;' src='' />
    <a href='#' onclick='static_link("resultsDiv",0);' >
    List all categories

    <div id="searchDiv">
    <form id='myform' >
    <input type='text' id='keyword' name='keyword' />
    <input type='button' value='Search' onclick='do_ajax("resultsDiv",0);' />

    <div id="resultsDiv">

    <fb:js-string var="loading">Loading....</fb:js-string>
    <fb:js-string var="noresults">Sorry, there were not results!</fb:js-string>
    <fb:js-string var="externalresults"><!--<fb:iframe width="540" height="270" frameborder='0' src='http://your.other.iframe.location' />--></fb:js-string>

    <script type="text/javascript">

    function do_ajax(div,val) {
    var ajax = new Ajax();
    ajax.responseType = Ajax.FBML;
    ajax.ondone = function(data) {
    var params={"adkeyword":document.getElementById('keyword').getValue(),"category":document.getElementById('keyword').getValue()}; //add parameters as comma separated "param":value'<?=$callbackurl?>?ctgry='+val,params); //GET values sended with "val" and POST values sended with "params"

    function static_link(div,val) {
    var ajax = new Ajax();
    ajax.responseType = Ajax.FBML;
    ajax.ondone = function(data) {
    var params={"action":"catlist","adkeyword":"categorylist"}; //add parameters as comma separated "param":value'<?=$callbackurl?>?all='+val,params); //GET values sended with "val" and POST values sended with "params"




    if (isset($_REQUEST['ctgry'])){
    $sourcecode = file_get_contents($url.'?category='.$_REQUEST['category'].'&adkeyword='.$_REQUEST['adkeyword'].'');
    preg_match_all("/\<a href\=\".*\<\/a\>/iU", $sourcecode, $temparray);
    foreach( $temparray as $key => $item) // temparray is an array inside of an array, so I did two foreach statements to spit out all the values
    foreach( $item as $i => $itemurl)
    $itemurl = preg_replace('/href\=\"/iU', 'href="'.$url.'', $itemurl);
    echo $itemurl.'<br/>';
    if ($count<1) {
    echo "Sorry, no results found!";

    if (isset($_REQUEST['all'])){
    $fetch_url = "?action=".$_REQUEST['action']."&adkeyword=".$_REQUEST['adkeyword'];
    $sourcecode = file_get_contents($url."".$fetch_url);
    $sourcecode = preg_replace('/href\=\"/iU','onclick="link_clicked(this.getHref);" href="'.$url."",$sourcecode);
    echo $sourcecode;

    Thursday, January 14, 2010

    Still fighting the good fight.

    I had them where I wanted them. Then they decided to shut me out with their dns image url rewriter. Well, I have evolved mjj. So, what are you going to do now?