I'm saos@ngmo

CLB Webmaster

Get More Backlinks From 200+ Free Blogsites

by saosangmo on Apr.24, 2009, under SEO, Webmaster Tools

This should be usefull here are 250 free blog sites List to build some blogs and get some good links from them.

http://www.blogger.com/

http://www.myspace.com/

http://www.livejournal.com/

http://wordpress.com/

http://geocities.yahoo.com/

http://www.filefront.com/ (continue reading…)

Leave a Comment :, more...

Ý nghĩa màu sắc trong thiết kế

by saosangmo on Apr.07, 2009, under Giao diện - đồ họa web

Không gian sống:

Y nghia mau sac trong thiet ke

Các nhà nghiên cứu khoa học từ lâu đã khẳng định sự tác động không nhỏ của màu sắc lên tâm lý của người sử dụng. Không cảm thấy ngột ngạt với nhịp sống hối hả và khói bụi của thành phố, mà ngược lại, những màu sắc nếu được sử dụng đúng chỗ sẽ làm bạn như đang sống giữa thiên nhiên thuần khiết, hiền hòa… (continue reading…)

Leave a Comment :, more...

37 “mẹo” kéo khách vào web

by saosangmo on Mar.08, 2009, under CLB Webmaster

Cũng như hàng hóa và các phương tiện khác, muốn website của công ty bạn được nhiều người biết đến thì phải tiếp thị, quảng bá nó. Trang web của công ty không những phải chuyên nghiệp về nội dung mà còn phải “nhà nghề” về thiết kế và biết cách lôi kéo khách đến xem. (continue reading…)

Leave a Comment : more...

Những bài viết hay nên đọc về performance tại client

by saosangmo on Mar.07, 2009, under CLB Webmaster, Nice Scripts

Thời gian gần đây, làm cho khách chủ yếu là dùng hosting Việt Nam, tốc độ load về máy rất nhanh nên không thấy đáng bận tâm lắm về vấn đề giao diện, chủ yếu là dùng template có sẵn rồi customize thêm (dành thời gian vào hack code, :) ). Nhưng câu chuyện shared hosting, khi khách hàng của bạn làm ăn phát đạt, nhiều người truy cập, ối giời, băng thông, sức chịu tải và cả kết quả do của hệ thống. Tối ưu hóa thật là 1 câu chuyện nhức đầu. Nhân tìm hiểu và sửa chữa sai lầm, mình tìm được 1 số bài khá hay để giới thiệu với các bạn:
(continue reading…)

Leave a Comment :, , more...

Javascript Expand and Collapse (sử dụng thẻ DIV)

by saosangmo on Mar.04, 2009, under Nice Scripts

This JS code, actually looks for PRE tag and check if has a class name “csharpcode” and do some little work around to add

Anyways, here’s the code … Hope you guys like it

var pres = document.getElementsByTagName('pre'); var plen = pres.length; for(var i = 0; i < plen; i++) { if(pres[i].getAttribute('class') == 'csharpcode') { var tempObj = pres[i].innerHTML; pres[i].innerHTML = ""; var aLinkEC = "<a id='xCode" + i + "' href=\"javascript:doMenu('Code" + i + "')\">[-] Collapse code ...</a>"; var newLineStyle = '<br/>'; var newCode = '<div id=\'Code' + i + '\' >' + tempObj + '</div>'; var build = aLinkEC + newLineStyle + newCode pres[i].innerHTML = build; } }

and here’s a little example of everything

<html> <head> <script type='text/javascript'> function doMenu(item) { obj=document.getElementById(item); col=document.getElementById("x" + item); if (obj.style.display=="none") { obj.style.display="block"; col.innerHTML="[-] Collapse code ..."; } else { obj.style.display="none"; col.innerHTML="[+] Expand code ..."; } } function addExpColelem() { var pres = document.getElementsByTagName('pre'); var plen = pres.length; for(var i = 0; i < plen; i++) { if(pres[i].getAttribute('class') == 'csharpcode') { var tempObj = pres[i].innerHTML; pres[i].innerHTML = ""; var aLinkEC = "<a id='xCode" + i + "' href=\"javascript:doMenu('Code" + i + "')\">[-] Collapse code ...</a>"; var newLineStyle = '<br/>'; var newCode = '<div id=\'Code' + i + '\' >' + tempObj + '</div>'; var build = aLinkEC + newLineStyle + newCode pres[i].innerHTML = build; } } } </script> <style type="text/css"> .csharpcode, .csharpcode pre { font-size: small; color: black; font-family: consolas, "Courier New", courier, monospace; background-color: #ffffff; /*white-space: pre;*/ } .csharpcode pre { margin: 0em; } .csharpcode .rem { color: #008000; } .csharpcode .kwrd { color: #0000ff; } .csharpcode .str { color: #006080; } .csharpcode .op { color: #0000c0; } .csharpcode .preproc { color: #cc6633; } .csharpcode .asp { background-color: #ffff00; } .csharpcode .html { color: #800000; } .csharpcode .attr { color: #ff0000; } .csharpcode .alt { background-color: #f4f4f4; width: 100%; margin: 0em; } .csharpcode .lnum { color: #606060; } </style> </head> <body> <div id="posts"> <strong>Javscript Expand/Collapse Code</strong> <pre class="csharpcode"> <span class="kwrd">function</span> ExpandCollapse(item) { content = document.getElementById(item); ec = document.getElementById(<span class="str">&quot;ec|&quot;</span> + item); <span class="kwrd">if</span> (content.style.display == <span class="str">&quot;none&quot;</span>) { content.style.display = <span class="str">&quot;block&quot;</span>; ec.innerHTML = <span class="str">&quot;[-]&quot;</span>; } <span class="kwrd">else</span> { content.style.display = <span class="str">&quot;none&quot;</span>; ec.innerHTML = <span class="str">&quot;[+]&quot;</span>; } } </pre> <strong>and a little bit of HTML sample</strong> <pre class="csharpcode"><span class="kwrd">&lt;</span><span class="html">a</span> <span class="attr">href</span><span class="kwrd">=&quot;javascript:ExpandCollapse('main');&quot;</span> <span class="attr">id</span><span class="kwrd">=&quot;ec|main&quot;</span><span class="kwrd">&gt;</span>[-]<span class="kwrd">&lt;/</span><span class="html">a</span><span class="kwrd">&gt;</span> Main Item <span class="kwrd">&lt;</span><span class="html">div</span> <span class="attr">id</span>=<span class="attr">main</span> <span class="attr">style</span><span class="kwrd">=&quot;margin-left:1em&quot;</span><span class="kwrd">&gt;</span> <span class="kwrd">&lt;</span><span class="html">a</span> <span class="attr">href</span>=#<span class="kwrd">&gt;</span>Item 1<span class="kwrd">&lt;/</span><span class="html">a</span><span class="kwrd">&gt;&lt;</span><span class="html">br</span><span class="kwrd">&gt;</span> <span class="kwrd">&lt;</span><span class="html">a</span> <span class="attr">href</span>=#<span class="kwrd">&gt;</span>Item 2<span class="kwrd">&lt;/</span><span class="html">a</span><span class="kwrd">&gt;&lt;</span><span class="html">br</span><span class="kwrd">&gt;</span> <span class="kwrd">&lt;</span><span class="html">a</span> <span class="attr">href</span>=#<span class="kwrd">&gt;</span>Item 3<span class="kwrd">&lt;/</span><span class="html">a</span><span class="kwrd">&gt;</span> <span class="kwrd">&lt;/</span><span class="html">div</span><span class="kwrd">&gt;</span> </pre> </div> <script type='text/javascript'>addExpColelem();</script> </body> </html> sưu tầm từ http://heresmycode.blogspot.com/2008/09/javascript-expand-and-collapse-part-2.html
Leave a Comment more...

How To Use Google AdSense Within XML/XHTML

by saosangmo on Mar.02, 2009, under Nice Scripts, SEO

First, How Does AdSense Work?

You set up an account with Google and specify the ads you want. I said “Images if you have them but text if not” and specified some medium and large banners and squares in certain color schemes. Google then generated some small JavaScript blocks for me to place as I want within my pages.

The JavaScript I place within my page is short and simple so that I and my server have little to do.

When you view my page, you direct your browser to retrieve data from a specified URL. My server sends over an XHTML document. If you have JavaScript enabled in your browser, it then executes each JavaScript block on your computer.

The simple JavaScript blocks I added to my pages just set four variables and then it retrieves and executes a program from pagead2.googlesyndication.com. That automatically retrieved JavaScript program does the real work of getting the ad itself.

The ad retrieved is the result of doing something like the reverse of the typical Google search. Instead of answering the question, “What pages related to this search string?” it’s more like “To which search strings or ad descriptions would this page relate?” Put another way, it tries to automatically select ads on topics similar to the topic of the page. One of those four original variables specifies my Google account, so if you happen to retrieve an ad that interests you and you click on it, Google knows whom to credit.

A side effect that I didn’t anticipate is that it shows me what Google thinks my pages are about. It does a good job selecting relevant ads on many of my pages, like TCP/IP, Unix/Linux, some of my information security pages, my attempts to understand Turkish grammar, travel suggestions, and Toilets of the World.

It gets a little confused on many of my information security pages, obsessing on the term “security” appearing in the URL and throughout the page, and frequently offering ads for the vast and largely non-technical physical security industry in the U.S.

It just can’t figure out what some pages are about, like one explaining how to create Cyrillic text in Unicode, the LATEX markup language, and Postcript. If it cannot decide what the page might be about, it tends to offer “public service ads”, generally promotions for charities.

OK, that’s what AdSense is and how it works. Why is this page here?

The Problem and the Solution

Google AdSense ads are based on JavaScript using document.write() calls. However, that doesn’t work within an XML/XHTML document. Here is the workaround!

In more detail, a Google AdSense ad looks like the following within a web page. The first block sets values for four variables, and the second effectively says “Set some variables, and then retrieve a JavaScript program from the following location and execute it.” Google suggests that you simply insert this JavaScript into an HTML file, but that doesn’t necessarily work — hence the reason for this page!

<script type="text/javascript">
    <!--
        google_ad_client = "pub-5845932372655417";
        /* Top Banner */
        google_ad_slot = "1979399418";
        google_ad_width = 728;
        google_ad_height = 90;
    //-->
</script>
<script type="text/javascript"
        src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>

The problem is that the retrieved program show_ads.js contains calls to JavaScript’s document.write() function, and that is not allowed within an XHTML or XML page. Depending on your browser and how strict it is, you might get the ad, or maybe an error message, or maybe nothing at all.

How do I know what’s in the JavaScript program? I wondered why it didn’t work and so I retrieved a copy with wget:

$ wget http://pagead2.googlesyndication.com/pagead/show_ads.js
$ vim show_ads.js

Sure enough, document.write(); plays a crucial role. Some XML/XHTML solution is needed….

Here is the workaround: step by step:

Create a Proper HTML Document Containing the JavaScript

I created the below HTML file as:
/var/www/html/ads/banner-728x90.html
so it could be retrieved as:
http://cromwell-intl.com/ads/banner-728x90.html
It’s just the JavaScript from above as the body of a small HTML file:

<?php header("Content-Type: text/html;charset=utf-8"); ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
    <head>
        <title>Sponsorship</title>
        <style type="text/css">
            body { margin: 0; padding: 0; }
        </style>
    </head>
    <body>
        <script type="text/javascript">
        <!--
            google_ad_client = "pub-5845932372655417";
            /* Top Banner */
            google_ad_slot = "1979399418";
            google_ad_width = 728;
            google_ad_height = 90;
        //-->
        </script>
        <script type="text/javascript"
                src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
        </script>
    </body>
</html>

Create a “Wrapper” to Minimize Code Maintenance

I next created the below HTML file as:
/var/www/html/ads/banner-728x90-wrapper.html
Note that it specifies the width and height of the included HTML object in pixels, and it sets the MIME type of just this encapsulated object as text/html so that document.write(); will work. Without the explicit definition of width and height, the browser will not know in advance how to lay out the page and the result may look very strange.

<div style="width: 728px; height: 90px">
	<object data="/ads/banner-728x90.html"
		type="text/html"
		style="width: 728px; height: 90px">
	</object>
</div>

I can make a number of wrappers to pull in the same file and underlying ad code with different styles. For example, those wrappers could make the ad “float” to the left margin of the page:
<div style="width: 728px; height: 90px; float: left;">
or to the right margin:
<div style="width: 728px; height: 90px; float: right;">

I could have put the six-line block of <div>...<div> directly in an HTML file, but then I have six-line blocks to maintain! The next step makes it much easier.

Include The Ad by Pulling in the Wrapper with PHP

All I have to do now is add one PHP line to a file to include the wrapper and let it pull in the code. This page, for example, literally begins as shown here. See how it pulls in two ads at the very beginning, before the large header “How To Use Google AdSense Within XML/XHTML — a 728×90 banner across the top and a 200×200 box that floats to the right:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
	"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
	<head>
		<title>How To Use Google AdSense Within XML/XHTML</title>
		<meta name="description" content="How to use Google AdSense
			within XML/XHTML pages.
			Google AdSense uses JavaScript document.write();,
			which is not allowed within XML/XHTML.
			Here is a simple solution to the problem." />
		<meta http-equiv="content-type" content="application/xhtml+xml; charset=iso-8859-1" />
		<link rel="stylesheet" type="text/css" href="../css/style.css" media="screen" />
	</head>

	<body style="background: #f4e4b0">

		<?php @ include ('../ads/banner-728x90-wrapper.html'); ?>
		<?php @ include ('../ads/square-200x200-wrapper.html'); ?>

		<h1>How To Use Google AdSense Within XML/XHTML</h1>

The overall result making up the entire page is a valid XML/XHTML document encapsulating a short HTML block of specified size containing nothing but Google’s JavaScript program.

The only remaining annoyance, and it’s fairly minor, is PHP’s inability to easily deal with absolute paths. The include is relative to that page’s location, so I need the ../ shown above.

The supposedly “easy” fix it to instead use all this:

<?php include($_SERVER['DOCUMENT_ROOT'].'/ads/banner-728x90-wrapper.html'); ?>

Ugh. I’ll just keep track of how many instances of ../ are needed….

Leave a Comment :, , more...

10 công cụ bảo mật và Hacking tốt nhất cho Linux

by saosangmo on Mar.01, 2009, under Hosting-Server-Domain

Quản trị mạngLinux chính là hệ điều hành máy tính giấc mơ của các hacker. Nó hỗ trợ rất nhiều các công cụ và tiện ích cho việc bẻ khóa các mật khẩu, quét các lỗ hổng mạng và phát hiện những xâm nhập có thể. Chúng tôi đã sưu tập một bộ khoảng 10 công cụ tốt nhất trong việc hacking và bảo mật cho Linux. Tuy nhiên các bạn cần lưu ý rằng các công cụ này không có nghĩa là đều có hại. (continue reading…)

Leave a Comment :, , more...

Chained Selects – Tạo hộp chọn nhiều cấp

by saosangmo on Feb.26, 2009, under Nice Scripts

Khi customize ứng dụng rao vặt, do khách hàng có quá nhiều danh mục và danh mục con, vì thế, mình phải chia lớp cho các cấp danh mục. Mỗi một cấp danh mục được chọn thì phía dưới chỉ hiện ra các danh mục con tương ứng. Sau khi google 1 ngày, các lựa chọn sau là có vẻ hợp lý nhất: (continue reading…)

Leave a Comment :, more...

10 Easy Ways to Professionalise Your Joomla Site

by saosangmo on Feb.20, 2009, under Giao diện - đồ họa web, Joomla

  1. Create a new favicon.ico. Yes, the default black Joomla logo is pretty, but people bookmarking your site they need to see a icon that identifies your site rather than Joomla or others using Joomla default icon. If you don’t want to design on a 16×16 pixels scale, there are sites that will generate a favicon for you. Then upload it to /template/<your_template_name>/favicon.ico (continue reading…)
Leave a Comment :, more...

Huyền thoại Ruby on Rails đã sụp đổ nhờ PHP

by saosangmo on Feb.18, 2009, under Không phân loại

Cách đây 3 năm Ruby on Rails bắt đầu tấn công vào cộng đồng Java nhờ những lời lẽ khoa trương về sức mạnh của nó. Dereck của CDbaby đã bị xao động và quyết định viết lại website của ông ta dựa trên Rails sau khi tuyển mộ một trong các nhân vật chủ chốt của cộng đồng Rails. Hai năm sau đó Dereck đã thấm đòn: Ruby và Rails không phải là viên đạn bạc cho các ứng dụng web. (continue reading…)

Leave a Comment :, more...

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!