CoderBlog.NET
Tengiz Tutisani's blog.

 
Useful Links:
 
LanguageBox 
 
Language

 
SearchBox 
 
 
ArchiveBox 
 
Archive
<September 2010>
SuMoTuWeThFrSa
2930311234
567891011
12131415161718
19202122232425
262728293012
3456789
 
CategoriesBox 
 
Categories
  ASP.NET (5)
  Ajax (1)
  C# (7)
  Common (1)
  HTML (3)
  JavaScript (5)
  Products (1)
  SEO (1)
  SQL (1)
  Visual Studio (1)
  Windows (1)
 
FriendSitesBox 
 
Friend Sites
  AdMoney Project
  Cайт о гитаре и музыке!
  Design Studio IMAGINE
 
CustomContentBox [1] 
 



 
 
What is SEO?
For the beginners in web development and SEO
Posted By:   tengo
At:   5/27/2009 9:30:00 AM
 

SEO is the abbreviation of Search Engine Optimization, which means the principles and rules that can be applied to the web site to optimize the way it's accessed by the search engines like Google, Yahoo or MSN.

Why we need it? - The more content from your web site is crawled and indexed by a search engine the more users can find it on the web.

What means crawling and indexing? - To understand this let's speak about search engines and the principles they work.
One can think that Google goes ahead and searches the internet when the user enters keywords she's interested in, but it's not true. Otherwise the searching process would take several hours instead of the resulting second.
Actually Google searches its own database, where the information about the world-wide-web is collected. At this moment you can understand what means indexing - a web site can be said is indexed when the information about it is contained in the search engine database, in this case Google's database.
Now let's talk about crawling. Crawling is the process of getting the content of a website from the internet. As the internet is a very large network that becomes larger day by day, crawling is not easy (actually it's impossible) to be done by hand, that's why this process is done by the computer software called Spider. I'll try to cover the principles of developing spider later.
Some people often make mistake saying that the crawling and indexing is the same process. Actually crawling takes the preceding place. Moreover, if a website has been crawled it isn't the warranty of being indexed. The step that can be taken between crawling and indexing varies from one search engine to another, in most cases it's the administrative and/or security step, such as approving the content to become indexed.

As you understand SEO is useful step that is recommended to be taken as long as you are interested to attract people to your web site.

We have already answered the question in the title of this post. Later I will cover the steps of SEO that you can follow to achieve the success in web publishing and web authoring.


Filed Under:   SEO |
Post Tags:   crawl | engine | google | index | msn | optimization | search | seo | site | web | website | yahoo |
  Comments [0]



 
 
How to dynamically include JavaScript script reference into html
JavaScript’s day
Posted By:   tengo
At:   5/14/2009 5:25:00 PM
 

One of my friends asked me how to dynamically include a reference to the JavaScript file into an html file.
Sincerely to say, I didn't know what to answer. But no additional effort was needed to find the answer, it's easy.
If you are familiar with JavaScript, then you can think of it yourself and you'll find the answer.

I wrote a function in JavaScript which makes all the work: dynamically creates object corresponding to the "<script>" tag, assigns it's "src" property a value of file name, and then adds this object to the current document. Have a look:

<script language="javascript" type="text/javascript">
function IncludeJS(file)
{
var scr = window.document.createElement("script");
scr.src = file;
document.body.appendChild(scr);
}
</script>


All works fine. One more thing I would mention here:
When invoking a method that is contained in dynamically referenced script file, always make a little more coding to ensure that no script errors will be thrown. For this purpose, my test button's "onclick" event checks, if the method that SHOULD be in the included file, exists. Look at this button tag:

<input type="button" value="Invoke Sample Method" onclick="if (window.SampleMethod) SampleMethod()" />

That's all about today's JavaScript.


Filed Under:   JavaScript | HTML |
Post Tags:   dynamically | file | function | html | include | javascript | js | script | src |
  Comments [0]



 
 
HTML Editing
How it works
Posted By:   tengo
At:   5/8/2009 9:55:00 AM
 

Did you know that almost any HTML control can be switched into edit mode? This effect can be achieved easily: just add CONTENTEDITABLE attribute to the component that must be an editor.

Place the following tag into the source of you HTML page and view it in browser:

<div CONTENTEDITABLE>some editable text</div>

As you can see, the text "some editable text" is editable now. In the easiest editing scenario, you can copy-paste the content from Word document to that editable area. For more complicated scenarios you can use document.execCommand method. (For advanced scenarios you can use a free and ready to use HTML editor tinyMCE).
Now let's talk about how you can get the content of that div as HTML. Depending on your needs, you can just get the content and do some operation with it. In my practice I had few situations when I wanted the content to be submitted to the server. As you probably know, only HTML input controls have ability to submit their values to the server. For this purpose, here I consider the code fragment that shows how to move the HTML value of the editable div to a Textarea control that actually can submit its value. The Input-button tag is added to move the content from one control to another.

<div id="text" CONTENTEDITABLE>some editable text</div>
<textarea id="content"></textarea>
<input type="button" value="get HTML content" onclick="content.value=text.innerHTML">

That's all, a little but sometimes very useful thing.
And one more: Button element can be created using not only the standard input tag, but also using a button tag like this:

<button value="some value">some text</button>

Note, that the button has a text "some text" instead of "some value" as you might think at a first look.

Thanks for your time.


Filed Under:   JavaScript | HTML |
Post Tags:   button | contenteditable | div | editor | html | javascript | submit | textarea | value |
  Comments [0]



 
 
How to calculate estimated time left for some operation to complete?
Interesting question
Posted By:   tengo
At:   5/7/2009 10:55:00 AM
 

You might have seen the download dialog of windows, which informs about the download progress as well as the estimated time left to complete the download.
How would you calculate that time?
I would do it like this:

During the download progress, the full size of the file downloaded is known of course. Download is done package by package. Package is a small part of the full file.
So, when the package arrives, we can find out the size of the package. Of course getting the package takes some amount of time, as the download is done through internet network and depends on the speed and other factors.
When starting getting the next package you should somehow save the time when this particular operation started, and when the package is already on our side of the wire, you should check how long have you been waiting for the package to arrive. In other words, using the size of package and the time you can calculate the current download speed (which, in fact, changes during the download).
For example: package size = 4kb, time used = 1 second.
So, the speed is 4 kb per second, or 1 kb per 0.25 seconds.
So, the only thing you must calculate is how much kb-s you have left to download. That means the estimated time will be 0.25 seconds multiplied by the size in kilobytes of the download resource.

If I would have to create a download manager, this information would be a little useful for me.

And, as an answer to the title, I must say, if given the whole amount of operation, and it can be divided approximately in the same size of sub-operations, this way we can calculate the estimated time left for any operation to complete.


Filed Under:   Common |
Post Tags:   complete | download | estimate | manager | operation | resource | time |
  Comments [0]



 
 
ExecuteScalar() result cannot be converted as expected
Strange results
Posted By:   tengo
At:   4/30/2009 9:55:00 AM
 

Colleague wrote a little method in C# code, where he created SqlCommand object and assigned to it's CommandText property as shown:

command1.CommandText = "select dbo.fn_GetValue(‘parameters')";

As you understood he tried to select a result of the database function. The function returns value of type bit. After invoking ExecuteScalar, command returned an object, which could not be converted to the bool type as expected. Strange!
As I saw execution returned value as a string with the exception that added an empty spaces in the end. So, I advise you to avoid using such kind of commands, use execution of stored procedures instead. In that case the result will be as expected.

BTW, I found some not very good solution of this problem also. Just change a command text as followed:

command1.CommandText = "select cast(dbo.fn_GetValue(‘parameters') as bit)";

Everything will work, but again, I would use stored procedure instead, and of course, in case of stored procedures, you must specify the correct CommandType property value of the SqlCommand object. The property value must be System.Data.CommandType.StoredProcedure instead of System.Data.CommandType.Text.

I recommend visiting MSDN library article which explains details of working with the SqlCommand object shipped with Microsoft .NET framework, in particular on how to Set and Get Parameters for Command Objects.

That's all for today.

Don't forget, to have a rest is as important as to make a good job.


Filed Under:   C# | SQL |
Post Tags:   csharp | execute | function | object | procedure | result | scalar | sql |
  Comments [0]



 
 
How to get username in domain
ASP.NET How-To Series continue
Posted By:   tengo
At:   4/29/2009 6:00:00 PM
 

I was asked how to get username in domain using ASP.NET.
My answer was:

string user = Page.User.Identity.Name;

As it didn't work, I tried to change it to the second version:

string user = System.Security.Principal.WindowsIdentity.GetCurrent().Name;

The second version did not work as well. Then I continued seeking for the problem. Finally I found a checkbox in the property pages of the web site that was the project published under. Check box was saying that anonymous access is allowed. Turning off the checkbox made both versions work correctly.
Also have in mind, your web configuration file must contain the following:

<system.web>
<configuration>
<identity impersonate="true" />
</configuration>
</system.web>

That's all.


Filed Under:   ASP.NET | C# |
Post Tags:   aspnet | csharp | domain | identity | page | user | username | windows |
  Comments [2]



 
CustomContentBox [2] 
 
Useful Links:
 
CategoryViewBox 
 
CoderBlog.NET
  Get your own Blog Engine
  SMS Sending Service
  What do you want to see on CoderBlog.NET?
  IMAGINE.GE created a header image for CoderBlog.NET
  CoderBlog.NET offers link exchange
  Quick language selection added
  CoderBlog.NET ‘s what is what
  Welcome to CoderBlog.NET

  Jump to Category...
 
TagsBox 
 
Popular Tags
aspnetblogcsharpdesigndivengineerrorformhtmljavascript
 
AuthorsBox 
 
Authors
  Tengiz Tutisani  (25)
 
SubscriptionsBox 
 
Subscriptions
Your Email:
 
LoginStatusBox 
 
Site Members
Login
 
Copyright © 2009 . CoderBlog.NET