Saturday, October 31, 2009

Transform any flex component with resizing, dragging with handles

Try it out yourself:



This is called "Flex Object Handles" available from Marc Hughes. This project is available on google code and has excellent tutorials, documentation, forum activity and support. This library supports using a custom container for flex components to enable thme to be resizable, draggable, moveable  and provides handles etc.

Another example:

Wednesday, October 28, 2009

Interesting article on how a plane ticket can be free

In europe there are plane tickets that costs around $20. How is this possible?
The article below explains this.

Awesome cloud formation in the sky

This cloud formation really stuck in my mind invoking some crazy imaginations. What if we had huge tubes like these as conduits to space, or maybe a halo ring/conduit around our planet with a habitats in it. Pretty cool :)



Here's some more cool looking clouds:
* http://www.webdesignerdepot.com/2009/10/the-weirdest-clouds-that-youll-ever-see/
* http://www.wired.com/wiredscience/2009/09/clouds/

Thursday, October 22, 2009

How to trigger some javascript (client-interaction) the very first time the page is requested in an ESRI .NET web ADF based web application?


Since the esri .net web adf is based on asp.net ajax we can leverage the client application and page lifecycle to trigger activities in different phases of the lifecycle. 
The below illustrates what happens during first page load, partial page postback, and browser close/moving away:
 A. During first initial page request: (1st time the page is loaded or refreshed)
APP_init
APP_load
APP_page_Load 

Notes: The init event of the Application instance is raised only one time for the life of the page in the browser. It is not raised for subsequent asynchronous postbacks. During an initial request, no PageRequestManager events are raised.
B. During Asynchronous postback (aka partial page postback, ajax request using asp.net ajax)
PRM_init_request
PRM_begin_request
WRM_invoking_request
WRM_completedRequest
PRM_page_loading
PRM_page_loaded
APP_load
PRM_end_request 

C. During browser close or browsing away from the page:
PRM_init_request
APP_unload

Where
APP = Sys.Application object
PRM = Sys.WebForms.PageRequestmanager
WRM = Sys.Net.WebRequestManager


1)       1) Create a file and place it  as follows: YourWebApp/javascript/ocgis.js
//contents of file
if (typeof myns== 'undefined') { myns = {}; }
myns.didOnce = false
myns.initAppEventHandler = function(sender) {
                myns.loadAppEventHandler();
}

myns.loadAppEventHandler = function(sender) {
    var prm = Sys.WebForms.PageRequestManager.getInstance();
                if (!ocgis.didOnce) {
                    alert("TODO: initiate things and show panel using javascript....");
                    myns.didOnce = true;
                }
} 

2)       In the default.aspx page, Insert the below right before </body> , i.e. end of body tag
<script language="javascript" type="text/javascript" src="javascript/myns.js" ></script>
<script
language="javascript" type="text/javascript">
                Sys.Application.add_init(myns.initAppEventHandler);
                Sys.Application.add_load(myns.loadAppEventHandler);
</script>  


The diagram below does a great job of showing the events from the 3 main objects in a nice sequence diagram:

Tuesday, October 20, 2009

Cool web app client for SVN repository

I've been searching for an easy to use, web client for SVN repositories. I had come across svnwebclient from Polarion, and it seems very promising, useful, with lots of features e.g. compare, diff, changeset, etc., but it requires a Java Container. I'm familiar with Tomcat which is free, so I installed it on it but performance wasn't great and Tomcat was using nearly 40% of CPU on a quad core when it was busy. I didn't venture with Jetty since the docs are horrible. I played with WebLogic a while ago, but purchasing that is not an option now. I looked into glassfish from Sun, downloaded and installed it. The installation was smooth, it even has a very nice web management tool for the server. However, when i deployed svnwebclient it caused the server to be unresponsive and was using 350-450mb of memory, so again performance was bad, so I abandoned that route.
"glassfish v3 preview" docs: http://docs.sun.com/app/docs/doc/820-7689/aboaa?a=view

Screenshots of svnwebclient  from Polarion:
Online Subversion file comparison screenshot
Compare SVN Files

Subversion repository browser screenshot
Subversion repository browser


This made me look at other web clients running on other frameworks, and so I found websvn, which runs on php. I tried installing it on my personal windows vista home premium x64 OS and found it was surprisingly easy to install. However, I was really frustrated with windows vista, absolutely horrible for doing any sys admin type of work, e.g. "run as" context menu has been removed, remote desktop has been removed, all menus, shortcuts, control panels have been re-arranged and so many more issues with it, which is another story.

Here's the installation instructions for websvn on a windows box (in my case IIS 6):

1) Go to http://php.iis.net/ and click on the install to initiate the "Web Platform Installer" program, which will download a ~15mb file to set up php on IIS 6/7. Below is the actual download location:
http://windows.php.net/downloads/releases/php-5.2.11-nts-Win32-VC6-x86.msi 

2) that program should setup the IIS mapping for .php extension. which should be mapped to the fastcgi extension, in my case it was located at c:\program files (x86)\PHP\php-cgi.exe.

3) Now simply copy and paste the contents of the websvn web app into an IIS virtual directory and convert that directory to an IIS app

4) finally, copy the file c:\inetput\wwwroot\websvn\include\distconfig.php and paste it as config.php. Read thru the contents of that file and change the necessary parameters to reference your SVN service

That's it.

Links for PHP on IIS 6 or 7:

Saturday, October 17, 2009

Internet, network, traffic analysis statistics for web apps in html, asp.net, flex, jsf etc.

Often we would like to analyze the flow of traffic to an application we build, so I thought I'd put a small list of tools to use. Most of these tools are fairly easy to setup and there are lots of info on the web, so I won't go into a detailed discussion on how to use them.

The tools are divided into 2 groups:

  1. Traffic analysis online services that require no installation by you. Does require you to embed some javascript code into your application to send signals to the monitoring service. Some services also have flex libraries (google analytics) that can be used directly from actionscript.
  2. Log parsing programs that require installation on your web server which will go through the logs created by IIS, apache, tomcat etc webservers to analyze traffic. Does not require any modification to the individual web apps. Will monitor all level of traffic (pages, resources, web apps, domains etc.) Will only monitor entire traffic to the configured servers.
Some example tools:
  1. Google Analytics : free, easy to setup. Requires js code to be embedded in each of your pages that you want to monitor.
    1. create google account
    2. register to use their service (free)
    3. create a new site profile
      1. can be created for both internet sites or intranet/secure sites as well
    4. add the generated js code to your site (after all page elements have loaded, just before the close of the tag)
    5. it takes up to 24 hours to register and show activation
  2. StatCounter : free easy to use. Requires js code to be embedded in each of your pages that you want to monitor. 
  3. SmarterStats from SmarterTools:
    1. requires installation
    2. commercial product but free for one web app
    3. works by parsing web server logs
    4. no modification to the web app or individual pages required
    5. web based sophisticated GUI for generating reports, charts, maps and advanced analysis
    6. my experience: it is really cool, easy to use, install and configure. but the only pro is that the free version is limited to one web app.
  4. AWStats  - free advanced statistics tool
    1. requires installation
    2. free GNU GPL
    3. for advanced users 
    4. complicated installation (requires perl, command line)
    5. complicated usage, command line (no UI) 
      1. run perl scripts from command line to generate reports/charts/maps etc. in html
    6. log parser

Google search keywords: 
* more like awstatshttp://www.google.com/search?hl=en&q=related:awstats.sourceforge.net/




* more tools like statcounterhttp://www.google.com/search?hl=en&q=related:www.statcounter.com/

  • GoStats.com
  • http://www.sitemeter.com
  • www.freestatscounter.com
  • www.shinystat.com
  • extremetracking.com
  • easycounter.com
  • www.addfreestats.com


Direct Connect to ArcGIS ArcSDE through a firewall

Direct Connect (DC) is now the ESRI recommended connection method to connect to an ArcSDE database running on SQL Server 2000/2005/2008, Oracle etc databases. This is recommended for various reasons concerning efficiency, performance, memory and scalability. As opposed to 'Application connect', direct connect does not spawn a process (giosrvr) on the ArcSDE server and does not require the arcsde (giomgr) services to be listening on designated ports for geodatabases. Not only that, but DC (running on SQL Server) requires only one port to communicate to all geodatabases inside ArcSDE - the sql server port, usually 1433. So if there's a firewall between the ArcSDE server and ArcGIS server/desktop, then opening port 1433 would suffice. One more great reason to use DC.

To add even more, ArcGIS 9.3, 9.3.1 and 9.2 SP5 can backward connect to 9/9.1/9.2 running on most databases.The following rules are used to govern how connections between different versions of ArcGIS clients and geodatabases operate:
  • Current releases of ArcGIS clients can connect to and use previous releases of the geodatabase. For example, an ArcGIS 9.1 client can connect to and use an ArcGIS 9 geodatabase.
You should be aware of the following, though:
    • If the ArcGIS client is using a direct connection to an ArcSDE 9.2 or prior geodatabase, connections cannot be made from the newer client to the older geodatabase. For example, an ArcGIS 9.2 client cannot make a direct connection to an ArcSDE 9.1 geodatabase.
    • Functionality specific to the current release is not available when connecting to a previous release of the geodatabase. For example, if you connect from an ArcGIS 9.1 client to an ArcGIS 9 personal geodatabase, you will only have access to functionality available at ArcGIS 9.
  • Previous releases of ArcGIS clients cannot connect to and use geodatabases created with later versions of ArcGIS. For example, an ArcGIS 9.1 client cannot connect to and use an ArcGIS 9.2 geodatabase.
The exceptions to this rule are as follows:
    • ArcGIS 9.2 Service Pack 5 (SP5) can open and edit a 9.3 geodatabase. Be aware, though, that functionality specific to the current geodatabase release is not available when connecting from a previous release of the client application.
    • ArcGIS 9 can open and edit a 9.1 geodatabase.




Client release
Personal geodatabase release
File geodatabase release
ArcSDE geodatabase using a direct connection
ArcSDE geodatabase using an ArcSDE service connection
8.3
8.3
NA
8.3
8.3
9
9, 9.1
NA
9
9, 9.1
9.1
9, 9.1
NA
9.1
9, 9.1
9.2
9, 9.1, 9.2
9.2
9.2
9, 9.1, 9.2
9.2 SP5
9, 9.1, 9.2, 9.3
9.2, 9.3
9.2, 9.3
9, 9.1, 9.2, 9.3
9.3
9, 9.1, 9.2, 9.3, 9.3.1
9.2, 9.3, 9.3.1
9.3, 9.3.1
If client has pre-9.3 geodatabase direct connect files* installed, can connect to 9, 9.1, and 9.2

9, 9.1, 9.2, 9.3, 9.3.1
9.3.1
9, 9.1, 9.2, 9.3, 9.3.1
9.2, 9.3, 9.3.1
9.3, 9.3.1
If client has pre-9.3 geodatabase direct connect files* installed, can connect to 9, 9.1, and 9.2

9, 9.1, 9.2, 9.3, 9.3.1

Sources:


How to create a floating window (dialog, panel) in the ESRI Sample flexviewer?

How to create a floating window (dialog, panel) in the flexviewer?

There are many scenarios when you'd like to have a new window open from an action triggered from inside a widget or the InfoPopup. This is one way to do it.
1) Create you custom component, e.g. TitleWindow, Panel, or create a draggable panel
2) Add properties/methods to that component
3) Use PopupManager to create/re-use that component to show information from the widget


//Widget Code
private var myPopup:MyCustomComponent=null;

private function onButtonClick(infoData:Object):void {
 if (this.myPopup) {
    PopupManager.centerPopup(myPopup);
    PopupManager.bringToFront(myPopup); 
 } else {
    this.myPopup = new MyCustomComponent();
    PopupManager.addPopup(myPopup, this, false);
    PopupManager.centerPopup(myPopup);
    PopupManager.bringToFront(myPopup); 
 }
 //change properties of myPopup
 myPopup.title = "Details for " + infoData.title;
 myPopup.featureId = infoData.featureId;
 myPopup.fetchFeatureDetails();
}

Sunday, October 11, 2009

How to prevent certain file types from being served by IIS


How to prevent certain types of files from being served by the server (IIS)?


1)       In web.config, under the httpHandlers section (which is under system.web section, add the below:
<add verb="*" path="*.blah" type="System.Web.HttpForbiddenHandler"/>
2)       Using the IIS managment console, add a new application extension mapping for *.blah
a.        Go to IIS control panel
b.       Expand the webiste, go to the desired web app using the IIS mngment console, e.g. it may be located at c:\inetpub\wwwroot\MyWebApp1
c.        Go to the properties of that webiste
d.       Go to the "Directory" tab
e.       Click the "configuration" button, this should open up a new dialog window
f.         Copy the executable path (dll) for the .aspx mapping, usually located at:
c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll
g.        Click on "add" button to add new type of mapping for our file type, e.g. *.blah
h.       Paste the dll location for the aspnet engine(handles aspx pages)
i.         type ".blah" (without the quotes) in the extension text area (this can be replace with any file extension eg: js/html/PDF)
j.         while still in the "add/edit application extension mapping" window click the "limit to" radio button and type "GET,HEAD,POST,DEBUG"
k.        ensure that the "script engine" radio button is selected but not the "verify the file exists" radio button



Test blog by email

Polk Audio Monitor 70 Floor-Standing Speaker for $170 + free shipping

New: Polk Audio Monitor 70 Floor-Standing Speaker for $170 + free shipping

For its newsletter subscribers only, newegg.com offers the Polk Audio Monitor 70 Floor-Standing Loudspeaker in Black for $229.99. Coupon code "EMCMLLX24" cuts it to $169.99. With free shipping, that's $9 under our September mention and the lowest total price we could find by $58. It has two 6-1/2" subwoofers, two 6-1/2" midwoofers, and a 1" tweeter. Deal ends October 15.
Posted 1 hr 13 min ago More Speakers Newegg Coupons

asp.net - How to add an HttpHandler to replace a folder or page

Lets say you wanted to replace the static config.xml file from a certain folder in your web app with some dynamically served data. For example, custom config xml based on the logged in user's role. This could be done easily with asp.net's httphandlers.
Steps:

  1. create a HttpHandler to serve your data based on who is logged in,
    For example you can use:
    Context.User.Identity.IsAuthenticated
    or Membership.GetUser()
  2. Add that httpHandler to the web.config file and specify the


    <add verb="*" path="MyWebApp1/config.xml" type="MyNS.ConfigXmlHandler" />



  3. Modify the IIS settings for your webapp (here it is MyWebApp1), usually your webapp is located in c:\inetpub\wwwroot\MyWebApp1. Using the IIS management console, find the node for MyWebApp1 and modify its properties. Add an application extension mapping for '.xml', so that the asp.net engine processes it. This way the request for xml files will be routed via the aspnet dll.
  4. asdf
  5. Caveat: Step 1 would be same for all IIS versions, but the other steps would be different based on which IIS you use, basically different from IIS5/6 with IIS7. Configure HttpHandlers in IIS,  Difference between IIS 7 integrated and classic mode
Resources:

An Intro to IIS 7 - classic mode and integrated mode