Saturday, August 1, 2009

firefox, the sneaky culprit

i started writing some code using C# and the ASP.NET framework a little while ago and noticed that running my scripts locally was painfully slow, so after Googling the problem for 5 minutes, i discovered that the issue was firefox-related and not .NET-related.

http://weblogs.asp.net/dwahlin/archive/2007/06/17/fixing-firefox-slowness-with-localhost-on-vista.aspx

Tuesday, June 2, 2009

finis

my indie music event search app- http://www.ohfancyclaps.com/

Sunday, May 17, 2009

google maps api for flash

The last major component I needed to implement for my project involved adding dynamically generated & interactive Google Maps to my application. For this, I read up on most of the documentation available here: Google Maps API for Flash Developer Guide. The main steps were:


  1. Obtain an API key;

  2. Install the Google Maps SDK (which was a single file) to a directory accessible by FlexBuilder;

  3. Follow the tutorial here: FlexBuilder Tutorial;

  4. Read documentation on the API.

Eventually, I was able to get my application to pinpoint locations on a Google Map based on dynamic data produced from my XML (from MySQL via PHP!)

So now, all I have to concentrate on is cleaning up my application's functionality and the interface before starting the testing phase of my project. Almost there...

flex and php

After building the user interface in MXML for my search application, I needed to go to my database and somehow retrieve records to display in the presentation tier. After reading this article, Exchanging Data, I adopted the approach demonstrated in the tutorial and understood how to apply this to my application.



Basically, I needed to trigger my application to call a PHP script that communicated with my MySQL database and returned this data back to my Flex application in XML format.

Here's part of the script I wrote in PHP that formats data from my query into XML:


echo "<events>";
while($row = mysql_fetch_array($qEvents)) {
echo "<event id=\"{$row['event_id']}\">";
echo "<name>{$row['event_name']}</name>";
echo "<description>".str_replace("&", "&", $row['event_description'])."</description>";
echo "<price>{$row['event_price']}</price>";
echo "<venue>{$row['venue_name']}</venue>";
echo "<address>{$row['address_line_1']} {$row['address_line_2']} {$row['city']} {$row['state']}</address>";
echo "<startdate>".date("m/d/Y",$row['dtm_start'])."</startdate>";
echo "<starttime>".date("g:i A",$row['dtm_start'])."</starttime>";
echo "<enddate>".date("m/d/Y",$row['dtm_end'])."</enddate>";
echo "<endtime>".date("g:i A",$row['dtm_end'])."</endtime>";
echo "<weblink>{$row['url_info']}</weblink>";
echo "<ticketlink>{$row['url_tickets']}</ticketlink>";
echo "</event>";
}
echo "</events>";

To view the XML result, click here.

links in flex

Unfortunately, the chaos of my job in addition to the amount of work I have to do for this assignment has prevented me from blogging anything at all. But now that I've come to a logical break point, it's probably a good time to note some of the issues I've been having with my final project...

Last weekend, I spent half a day trying to add external links to my Flex application! It was so frustrating because something that ordinarily takes me a second in HTML was causing me so much grief in ActionScript/MXML. I eventually came across this article on the Web, Listening for the link event in a Flex Label control, but even so, I felt that this method was overkill for something so simple. According to this code, I would have to create individual functions to handle each link in my application. NOT HAPPY JAN. So I went through the Flex documentation from Adobe more thoroughly until I discovered navigateToURL(). This allowed me to generate my links dynamically and pass them into this method for a more elegant way to launch external links. Easy!

Below is the way I've implemented this in my application:


<mx:LinkButton label="Buy Tickets" click="navigateToURL(new URLRequest(eventDataGrid.selectedItem.ticketlink));"/>

Monday, May 4, 2009

javascript

Last week, for work, I had to design an online form for an invitation to a seminar. One of the requirements of the form was that it had to have a drop-down box with several selections for dietary requirements, but if a user's selection wasn't offered, he or she could select "Other", upon which another form element (text field) magically appeared beside it to allow the user to enter in their custom dietary requirement.

To do this, I used JavaScript as demonstrated below:

<script language="JavaScript">
<!--//
function checkDietRequrements(req) {
if (req == "other") {
document.getElementById('dietReqs').value = '';
document.getElementById('dietReqs').style.display = 'block';
} else {
document.getElementById('dietReqs').value = req;
document.getElementById('dietReqs').style.display = 'none';
}
}
//-->
</script>

<form>
<table>
<tr>
<th>Dietary Requirements:</th>
<td>
<select name="diet_requirements" onchange="javascript:checkDietRequrements(this.value);">
<option value="" selected="selected">---</option>
<option value="ceoliac">Ceoliac</option>
<option value="kosher">Kosher</option>
<option value="lowfat">Low Fat</option>
<option value="vegan">Vegan</option>
<option value="vegetarian">Vegetarian</option>
<option value="other">Other, please specify</option>
</select>
</td>
<td><input id="dietReqs" name="diet_requirements" type="text" style="display:none;" /></td>
</tr>
</table>
</form>

Please view the working example here and remember to select "Other" from the the drop-down menu.

getting there

My application is starting to take some shape which is encouraging. And while I'm quite happy with the Administration section of my web site, I have to admit that the Flex side of things is slightly daunting because I'm not altogether sure if I've left myself enough time to complete all the features I initially wanted, but I'm half way there.

As for my System Plan, that's underway and available here: System Plan Draft.

  © 2009. Template by Ourblogtemplates.com.