Archive for the ‘Web’ Category

HTML Combobox

Sunday, January 27th, 2008

Can’t understand why none of modern browsers (IE, FF, etc) support the “Combobox” element, so I guess lots of web developers are reinvent the wheels again and again.

I googled and find a bunch of combobox implementations:

[1] http://particletree.com/features/upgrade-your-select-element-to-a-combo-box/  Best of the visual effect, act exactly like a real combobox. Work good on both IE and FF.  This is a ASP.NET server side control, it’s not free. But worth to learn how it looks so good

[2] http://www.digital-web.com/articles/building_accessible_widgets_for_the_web/ Good, however it use its own drop down button (an additional input), I don’t like…

[3] http://www.tgreer.com/comboArticle.html  Good, but contain some code for old IE hack so it’s buggy on IE7, visual effect is not perfect.

[4] http://particletree.com/features/upgrade-your-select-element-to-a-combo-box/ Good, but have some small issue on the styles, buggy in IE 7 and FF. :( 

[5] http://www.xaprb.com/blog/2005/09/29/javascript-combo-box/  I don’t like it, it use Listbox and listen on key events to fake the edit, it works not like a real combobox.

[6] http://www.codeproject.com/KB/custom-controls/combobox.aspx ASP.net server control, like [2] it paint the dropdown button itself, not looks nice enough.

Since none of them are ready to use directly, I created my own…sigh reinvented the wheel again! It’s worth to look at [1] to find out how they handle the visual good.

I think the javascript part is simple, above [2][3][4] explained good enough, the css is the key, here is what I finally get:

CSS

.comboBox {
    position: relative;
}

.combobox div
{
    padding: 0;
    margin: 0;
}
.comboList
{
    margin-top: 1px;  /* FF don’t need this! */
    position: absolute;
    width: 155px;
    height: 19px;
    z-index: 1;
    clip: rect(auto, auto, auto, 136px);   
}

.comboEdit
{
    margin:0;
    width: 137px;
    height: 21px;
}

HTML

<div class=”combobox”>
<select  id=”selCombo” tabindex=”-1″ class=”comboList”>
    <option selected=”selected” value=”"></option>
    <option value=”1″>Item 1</option>

    <option value=”2″>Item 2</option>
    <option value=”3″>Item 3</option>
    <option value=”4″>Item 4</option>

</select>
<input class=”comboEdit” type=”text”  id=”txtCombo” />
</div>

IE and FF have 1 px offset in displaying the select element, so we have to add “margin-top: 1px” in IE. We can handle this automatically in Javascript.

The key part of above is: clip: rect(auto, auto, auto, 136px). I didn’t use this css property before, more detail about it is here: http://www.w3schools.com/css/pr_pos_clip.asp

Popularity: 20% [?]

ASP.NET MVC is out! (though it’s a preview version…)

Monday, December 10th, 2007

It’s here:

http://asp.net/downloads/3.5-extensions/

After a quick try of ASP.NET MVC, I should say it’s awesome!!!

It rescued  me from terrible original ASP.NET’s page centric design… It’s as simple as Ruby On Rails!

Popularity: 10% [?]

Some new sort of spams…really boring

Friday, August 17th, 2007

Some days ago, I found something in Akismet spam lists looks like normal comments by real people and I , but now I found more of those sort of spam.

Obviously this is a new spam program which can take some keywords from your blog post and randomly select from some prepared template, it makes the spam look like someone comment on your posts.

Daniel | k.daniel@msn.com IP: 65.98.35.234

I couldn’t understand some parts of this article s inside X-Forwarded-For and how to handle | Inmates Are Running Asylum, but I guess I just need to check some more resources regarding this, because it sounds interesting.

Daniel | k.daniel@msn.com | IP: 64.22.110.34

I have to say, that I could not agree with you in 100% regarding gle Search box to blog post plugin | Inmates Are Running Asylum, but it’s just my opinion, which could be wrong :)

Fortunately Akismet can catch all those sort spam automatically! That’s nice, but it take me more time to review those spam list to see if I should deleted or save some real comment which was miss judged.

Popularity: 12% [?]

YSlow, web site performance tool

Wednesday, July 25th, 2007

Speed up your web pages with YSlow

YSlow analyzes web pages and tells you why they’re slow based on the rules for high performance web sites. YSlow is a Firefox add-on integrated with the popular Firebug web development tool. YSlow gives you:

  • Performance report card
  • HTTP/HTML summary
  • List of components in the page
  • Tools including JSLint


Install Firebug first!

Visit Yahoo! Exceptional Performance on YDN.

Sounds pretty cool, will try it…

Popularity: 11% [?]

The best analytics plugin I ever seen: Geotrack Plugin (2.0.2)

Monday, July 23rd, 2007

 

Today I found a great wordpress plugin today:

Features:

  • logs every visit on your wordpress blog in your MySQL database
  • automatic cleanup of logs in your MySQL database
  • contains the same information as Apache combined server logs with ip, referrer, method, status, uri, user agent and access time
  • additionally stores geo-ip information with country, ISO country code, city name, latitude and longitude
  • displays a list of current visitors
  • displays a top-10-list of referrers, visited pages, visitors‘ countries and visitors‘ cities
  • has functionality to prevent referrer spamming
  • ip blocking of known referrer spammers
  • contains a set of free (GNU-GPL / Creative Commons) country flags from Wikipedia
  • Google maps integration: shows your visitors‘ locations on world map
  • fast geoip retrieval through local database
  • contains installer and update scripts
  • uses MaxMind GeoLite City
  • see it in action here
  • and of course it’s free to use!

Very cool, very useful and with google maps displaying who si from where…

See it live in my site:

http://dev.robertmao.com/visitors-map/

Download it here!

Popularity: 24% [?]

Web analytics site compare sheet

Saturday, July 21st, 2007

Via: Clicky

 

Clicky.com

 Google Analytics

 SiteMeter

 StatCounter

 Mint

 FeedBurner

Customizable dashboard
Juicy details about each individual visitor
Track custom data for every visitor (usernames, shopping cart ids, etc)
Get your stats via RSS feeds
Track outbound links
Aggregate (multi-day) view for all data
Real Time Stats
Official WordPress plugin for easy integration with your blog
Google Maps integration
Filter visitors based on country, browser, referer, search, etc
Detailed visitor geography
Full dynamic referer tracking
Free service
Affiliate program to earn you cash or free premium service

= Not by default. Requires hack and/or manual HTML editing and/or third party plugin.

Popularity: 8% [?]

IP to country/location libraries

Saturday, July 21st, 2007

Save here for future use.

PHP & Java version

Link: http://firestats.cc/wiki/ip2c

IP2C

IP2C is a small library that provides IP to country resolution using a binary file.
The binary file is compiled f2rom ip-to-country free database and takes only about 500kb (the CSV takes about 3.5mb).

License

IP2C is released under the terms GPL v2.

Supports

  • Command line
  • Java
  • PHP

Performance

All tests done on an Athlon XP 3200+.
PHP:

  • No cache: About 1200 searches in a second.
  • Cache: not implemented (Want to help?)

Java:

  • No cache: About 8000 searches/second.
  • Memory cache: About 180,000 searches/second.

Download

ip2c 1.4.3 (Database version : 2007.3.5)

C# version

http://www.extremeoptimization.com/resources/Concept/

Source download: http://www.codeproject.com/csharp/IPLookupOptimise.asp

Popularity: 19% [?]

Wow, Statcounter was started by a young man when he was 16!

Saturday, July 21st, 2007

Statcounter is one of my favorite web statics site. I like it because:

  1. Almost realtime to display the traffic to the web site; (In Google analytics, you can only see data  24 hours ago)
  2. Very fast to response when install the tracking code, static data is almost immediately appear after the install. (Google analystic will let you wait at least 24 hours and there are several boring “verify” steps to make it work)
  3. Hidden tracker even for free version
  4. Multiple sites tracking in one account
  5. Simple but good enough for personal site

The only thing bad is, free version statcounter only track the latest 500 activities, so all static information are only based on those latest logs. Even a paid version only increase the log size bigger, so it’s not possible to view the whole picture of the web traffic.

What suprised me is a story in BusinessWeek:

The booming Irish Web analytics startup was launched by the top vote-getter in BusinessWeek’s young entrepreneur contest when he was just 16

 In 1999, at the age of 16, Cullen launched Dublin-based StatCounter, an online service that lets clients measure the number of hits they get on their Web sites, plus the geographical location of visitors, the pages people view, and the keywords they use to find a site.

That turned out to be a smart move for the young Irishman, now 24.

Popularity: 6% [?]

Tired with SSI… Isn’t any better SSI replacement?

Tuesday, July 17th, 2007

Tried to use SSI (Server Side Include) to implement a dynamic concat page to  merge CSS, Javascripts files… but failed. Seemed SSI can’t do that?

What I though it could be done:

/concat.shtml?file1=filepath&file2=filepath&…

and in concat.shtml use SSI to access the Query String, and the include each file together.  Unfortunately, in SSI all I can get is a “raw” Query String “file1=filepath&file2=filepath&…”, and I checked all around and seemed no way to extract variables from  that query string.  :( I hope I was wrong…someone tell me.

Of course it can be easily done with a simple PHP, but PHP is too much for what I need(and maybe have unwanted overhead, bring in performance issue), all I need is a simple parse the query string…

Another feature I wish SSI could have is add <!– include remote=”http://blah.blah.com/blah/blah/” –>, yes it could be done together with mod_proxy by <!– include virtual=”/proxy/blah.blah.com/blah/blah/” –>.  But I wish SSI could build in such a simple but really useful feature.

Another thing that I waited for years but still no mature product is “ESI” (Edge Side Include),  I believe it could be valuable for high traffic site to improve cache hit rate.  (maybe apache SSI + mod_proxy + mod_cache can do something like ESI? maybe I can have a try…)

Popularity: 9% [?]

Some XSS Vulnerabilities links

Monday, July 16th, 2007

I spent some time on XSS (Cross Site Scripting) Vulnerabilities  scan and problem solving last month, here is some links when I used, if I have time I will write more on this topic.

A detail presentation on how a google desktop’s security hole was used by XSS to perform a “perfect attack”: http://download.watchfire.com/googledesktopdemo/index.htm

A good slides explain what’s XSS and how it attack in action: http://www.sven.de/xsss/wth_xsss_slides.pdf

XSS explained and free scan service: http://www.acunetix.com/websitesecurity/cross-site-scripting.htm

Scripts for XSS hack (don’t use it do bad things…): http://ha.ckers.org/xss.html

Step by step hack a site with XSS (don’t use it do bad things, again…): http://ha.ckers.org/deathby1000cuts/

A very good article: http://www.milw0rm.com/papers/162

Popularity: 11% [?]

Close
E-mail It
Creative Commons License
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License.