Search This Blog

Friday, October 22, 2010

How to override web.config for subfolder?

If you have website and there might be subfolder that also contains website then there might be also web.config.

When you try to run subfolder site it creates problem related connectionstring if connectionstring is with the same name.


So you just have to add tag in both web.config so your both website running well.

Thursday, October 14, 2010

what is Json ?

JSON is a java script Object Notification, is a lightweight Data-interchange format. Its easy for human read and write. Easy for machine to parse and generate. It is free from language but uses conventions that are familiar to programmer of C,C#,Java etc..

Json Built on two structures :

1.  A collection of name/value pairs called object, record, struct, key list, hash table in language terms.
2.  An ordered list of values called array, vector, list in language terms.

These are the universal data structures. Virtually all languages supports these structure in one form to another.

In Json following form is used:

    1. An object is an unordered set of name/value pairs. which starts with { and ends with } and each name is followed by : and the name/value pair is separated by comma.
    2. An array is an ordered set of values, which starts with [ and ends with ] and each value is separated by comma.
    3. A value can be string, int, struct, array, object and these structures can be nested.
    4. A string is a collection of zero or more Unicode characters, wrapped in double quotes, using backslash escapes. A character is represented as a single character string. A string is very much like a C or Java string.

Wednesday, August 25, 2010

Include runtime scripts using jQuery

You can also include scripts runtime using jQuery. It makes it easy to have lazy script loading.

See the example below :

$(function(){
    $("head").append("");

    //Or, loading only when the slow stuff is ready:
    $("img,form").load(function(){
        $("head").append("");
    });
});

Create a 'Back-To-Top' link using jQuery with disappearing effect.

 Use the following script :

$(function(){
/* set variables locally for increased performance */
    var scroll_timer,
        displayed = false,
        $message = $('#message a'),
        $window = $(window),
        top = $(document.body).children(0).position().top;

    /* react to scroll event on window */
    $window.scroll(function () {
        window.clearTimeout(scroll_timer);
        scroll_timer = window.setTimeout(function () { // use a timer for performance
            if($window.scrollTop() <= top) // hide if at the top of the page
            {
                displayed = false;
                $message.fadeOut(500);
            }
            else if(displayed == false) // show if scrolling down
            {
                displayed = true;
                $message.stop(true, true).show().click(function () { $message.fadeOut(500); });
            }
        }, 100);
    });
});

see the example from the below site :

http://briancray.com/2009/10/06/scroll-to-top-link-jquery-css/

Manage Search textbox value with jQuery

How to manage search textbox value when there is some default text in textbox and on focus or blur that text will not appear using jQuery??

See the example :

$(function(){
    //set default value:
    $("#searchbox")
      .val('search?'); // textbox contains default value 'search'
      .focus(function(){this.val('')})
      .blur(function(){
        (this.val() === '')? this.val('search?') : null;
      });
});

How to access iFrame elements using jQuery?

To access the iFrame elements inside the javascript, there is a method contents(), which enables us to access elements of iFrame.

See the example below :

$(function(){
    var iFrameDOM = $("iframe#ID").contents();
    //Now you can use find() to access any element in the iframe:

    iFrameDOM.find(".message").slideUp();
    //Slides up all elements classed 'message' in the iframe
});

Wednesday, August 11, 2010

Rating with jQuery














It is an example of rating control using in asp.net with jQuery and get more functionality of messaging on hover of an image.

See the demo and download source from the following website "

http://www.marcofolio.net/webdesign/jquery_quickie_colourful_rating_system_with_css3.html

Chkeditor with full functionality with jQuery



Above is an example of chkeditor. It includes flash, Images, tables and many functionality at design side.
This editor is also multilingual editor. You can also change the languages and according to that your editor works.

You can download source from the following site :

http://www.queness.com/post/212/10-jquery-and-non-jquery-javascript-rich-text-editors
http://ckeditor.com/demo

Friday, August 6, 2010

How to find nth row or table using jQuery?

Try this :

$(document).ready(function(){

$("table tr:eq(3)).css("background","#000");

}) ;

Thursday, August 5, 2010

How to Search in google?

There are some ways to search in google engine.You googling many ways but with the right commands and shortcuts which will help to you.

  • One powerful way to search is use search prefix like if you want to search for a website then write 'site' and seperate word by colon and write your search words or you can say predefined triggers :
    • for example :  
          • site : asp.net 
          • weather : Ahmedabad
          • images : cartoon
  • You can add suffix also if you know your particular search like you want to search India map then write India Map. Google gives answer immediately.
  • Third powerful thing about google is that it does Math Conversation also like if you type 7+10 in google it gives you answer 17 rather then search other things. You can also calculate square root values also like (5+10) + (sqrt 10) ^15 you get 31622791.6.
  • Fourth one is that Conversations like if you want to 1 $ to Indian rs you can do it very simply by writing 1 dollar in rupees, 20f to c (converts Fahrenheit to Celsius)
  • Now last but not the list, you can search specific files like pdf or doc or others. For this purpose use filetype prefix. 
    • filve point some one filetype : pdf

Monday, July 19, 2010

How to create Rounded border of a div?

Css is as follow :

-moz-border-radius : 10px;

How to prevent Back button in browser?

Write down below lines in script tag in your page.
        function noback() {
            window.history.forward();
        }
        noback();
        window.onload = noback;     
        window.onunload = function() { void (0); }



For example suppose you have one page "Signout.aspx", your write down this code in this page. This page signs out user from the site then redirects to your home page so from the home page user cannot come again to "Signout.aspx" page.

How can we calculate execution time of particular function?

  • Create DateTime dtStart = DateTime.Now;
  • Call the function you want to test.
  • After calling function write DateTime dtEnd = DateTime.Now;
  • Now create TimeSpan object to know the difference between starting time and ending time.
          TimeSpan ts = dtEnd - dtStart;


     Example:

     DateTime dtStart = DateTime.Now;
     functionName(params);
     DateTime dtEnd = DateTime.Now;
     TimeSpan ts = dtEnd - dtStart;

Saturday, July 17, 2010

How to get Event Arguments in code behind?

You can get Event arguments using below syntax :

string mystring = Request["__EVENTARGUMENT"]

New Browser : Epic Nation's First Browser Lunched By Indian for Indians

The first-ever browser of the country has been achieved by Hidden Reflex, a software and web application product startup based in Bangalore.

Epic Browser is a Internet web browser which is built on the Mozilla platform, Epic has certain striking features that make it a unique browser altogether. It's Looks like



Some of its unique features are:
  • An inbuilt anti-virus, powered by ESET, whose NOD 32 product is very  popular the world over.
  • India centric with support for 12 different Indian languages including  Hindi, Gujarati, Marathi, Kannada, Telugu, Bengali, Tamil, Malayalam, Urdu and Punjabi.
  • Indic app allows for typing in these Indian languages.
  • More than 1500 themes ranging from freedom fighters to film stars to represent the unity in diversity of the country.
  • A word processor to create or edit documents.
  • India specific news from popular publications.
  • Social Networking sites like Facebook and Twitter on the sidebar,  apart from YouTube( watchable in a pop-up window), Gmail and Yahoo and live cricket score.
  • Other useful sidebar widgets include Travel, Stocks, Maps, and Jobs.
  • File backup and My Computer utilities.
  • Can add your To Do's and set Timers.

Friday, July 16, 2010

How to AddTo/CopyTo folder on rightclick of folder in Windows Xp/Vista/7?

When you want to move a file but don’t have the other folder open already. You have to open it then copy your this folder. But now no worries when other folder is not open.


Only add registry in your pc and you will get option of Copy To and Move To on right click of the folder.


Download it from below link : 

http://greenhackers.blogspot.com/2010/05/add-copy-tomove-to-on-win-7vistaxp.html#more

Opacity doesnt work in ie?

Opacity attribute does not work in internet explorer?

There is a alternate for it.

Filter : alpha(opacity = 80);

While for firefox its works as opacity = 80.

Thursday, July 15, 2010

How to break the space separated values in SQL Server?

Declare @vTable Table(id int,val varchar(100))
 
Insert into @vTable Values (1,'Jeni Jeni1 Jeni123')
Insert into @vTable Values (2,'Jeni1 Jeni2 jeni3')
 
Now if you want to break the space separated values in the above table as;

ID Val
1 Jeni
1 Jeni1
1 Jeni123
2 Jeni1
2 Jeni2
2 Jeni3

Run following query in Sqlserver and get result.

Declare @vTable Table(id int,val varchar(100))
 
Insert into @vTable Values (1,'Jeni Jeni1 Jeni123')
Insert into @vTable Values (2,'Jeni1 Jeni2 jeni3')


;with wcte (id,val,strpos) as

(
Select id,substring(val,0,case when charindex(' ',val,0) = 0 then Len(val) else charindex(' ',val,0) + 1 end) as val
,charindex(' ',val,0) + 1 strpos from @vTable
Union all
Select b.id,substring(b.val,strpos,case when charindex(' ',b.val,strpos) = 0 then Len(b.val) else charindex(' ',b.val,strpos) - strpos end) as val
,charindex(' ',b.val,strpos) + 1 strpos
from @vTable b
Inner Join wcte on wcte.id = b.ID
and wcte.strpos <> 1
)Select id,Val from wcte order by id

 
  

Firefox 3.6 Features

Awesome Bar

 A quick way to get to the sites you love—even the ones with addresses you only vaguely remember. Type in term into location bar and the autocomplete function includes possible matching sites from your browsing history, as well as sites you’ve bookmarked and tagged in a drop down.

For example, you could enter the tag: “investments” to find “www.fool.com”. The Awesome Bar learns as you use it—over time, it adapts to your preferences and offers better fitting matches. Since its initial release in Firefox 3.0 we’ve tweaked it to give you greater control over the results (including privacy settings) and increased performance so you find what you need even faster.

Tags

For example, you can label the site http://timesofindia.indiatimes.com/ with the “news” tag as well as the “foreign investments” tag, plus give www.nytimes.com the “news” tag, too. When you enter “news” into the location bar, both sites will be shown as results. A single site can have multiple tags, and there’s no limit to the number of tags you can create. You may not remember the exact name of a site, but with a tag, you’ll be able to find it in a way that makes sense to you.

One-Click Bookmarking screenshot

One-Click Bookmarking

Manage your bookmarks a lot or a little. One click on the star icon at the end of the location bar bookmarks a site. Two clicks and you can choose where to save it and whether to tag it. File bookmarked sites in easy-to-access folders and organize according to theme (like “job search” or “favorite shopping”). Find your bookmarked sites in a flash by entering the tag, page or bookmark name into the location bar. The more you use your tags and bookmark names in the location bar, the more the system will adapt to your preferences.
Smart Bookmarks screenshot

Download Manager

A pause and resume feature means there’s no need to wait for a download to finish before you disconnect. So, if you’re halfway through the latest White Stripes album and it’s time to catch the bus, just pause and pick up downloading when you get home. The resume function also works if your system crashes or is forced to restart. The manager shows your download progress and lets you search your files by name or the Web address where the download came from.

Spell Checking

A built-in spell checker lets you enter text directly into Web pages—like blog posts and Web-based email—without worrying about typos and misspellings. Work directly with the Web and save yourself a step.
Spell Checking screenshot

Session Restore

Restart the browser without losing your place after you install an add-on or software update. And, if Firefox or your computer unexpectedly closes, you don’t have to spend time recovering data or retracing your steps through the Web. If you’re in the middle of typing an email, you’ll pick up where you left off, even down to the last word you typed. Session Restore instantly brings back your windows and tabs, restoring text you entered and any in-progress downloads, and we’ve updated it to make sure you get back to what you were doing even more quickly than before.

Full Zoom

Visit your favorite shopping site page and read the caption under the picture—or view the picture itself in a size you can see. An elegant new zoom feature lets you swoop in and see entire web pages. They scale in the way you’d expect them to, with all the elements of a page’s layout expanding equally, so you can zero in on what matters.

Smart Keywords

Search the Web in record time with smart keywords. With a few clicks you can assign keywords to search engines, and then simply enter your key and search words in the location bar. With this feature, typing “book home building” can search Amazon.com, and take you right to books about home building without ever pausing at the homepage.

Improved Text Rendering

Read your language as it’s written—more like real life. With a new graphics engine, Arabic, Persian, Punjabi and other script languages now render in a remarkably seamless way.

Downloadable Fonts

View a wider variety of fonts on Web sites while you surf. Site designers and developers can create custom fonts that will be displayed and rendered properly even if you don’t have the font installed on your computer.



Tuesday, July 6, 2010

Difference between Undefined value and null value.

Undefined states that variable has been declared but not defined yet i.e. not assigned a value yet.

while null is an assignment value. where variable has no value it assigns null to that variable
null is an assignment value. It can be assigned to a variable as a representation of no value.

undefined is a type itself (undefined) while null is an object.
Unassigned variables are initialized by JavaScript with a default value of undefined.
JavaScript never sets a value to null. That must be done programmatically.

How to remove projects in Visual Studio Project list?

Follow  the steps :

1 ) Go to Run.
2) Write regedit.
3) Click to HKEY_CURRENT_USER
4) After click on looking for this path - Software > Microsoft > Visual Studio > 9.0 > ProjectMRUList.
    It shows you all projects shown in visual studio startup screen.
5) Remove Projects which you want.
  

How to search text of Triggers, Store Procedures and Functions?

Run the follow query in SqlServer and get result.

DECLARE @SEARCHSTRING VARCHAR(255)

SELECT @SEARCHSTRING = 'CREATE'

SELECT DISTINCT sysobjects.name AS [Object Name] ,
case when sysobjects.xtype = 'P' then 'Stored Proc'
when sysobjects.xtype = 'TF' then 'Function'
when sysobjects.xtype = 'TR' then 'Trigger'
end as [Object Type]
FROM sysobjects,syscomments
WHERE
sysobjects.id = syscomments.id AND
sysobjects.type in ('P','TF','TR')AND
sysobjects.category = 0
AND CHARINDEX(@SEARCHSTRING,syscomments.text)>0

You can get all textes of store procedures, functions and triggers from the follow query.

SELECT  *  FROM  syscomments

How to find all trigger name in SQL Server

Run the follow Select query to find all triggers in SqlServer and get result.

SELECT T2.[name] TableName, T1.[name] TriggerName,
CASE
WHEN T2.deltrig = T1.id THEN 'Delete'
WHEN T2.instrig = T1.id THEN 'Insert'
WHEN T2.updtrig = T1.id THEN 'Update'
END 'TriggerType'
FROM sysobjects T1 JOIN sysobjects T2
ON T1.parent_obj = T2.[id]
WHERE T1.xtype='TR'
GO

Friday, June 11, 2010

Difference between Callback and Postback in asp.net?

               As with a postback, a callback does not refresh the currently viewed page.If there were two drop down boxes, the second dependant on the value of the first, when a user selects a value of a the first, rather then refreshing the page, doing some server side calculations and returning a new whole page to the client, a callback can enable you to only go fetch the required data. View State is not updated with a callback.

Tips for Writing a Good Store Procedure Part II

WHERE clauses :

  • In a WHERE clause, the various operators used directly affect how fast a query can run. Here are the conditional operators used in the WHERE clause, ordered by their performance. =, >, <, >=, <=, <>, !=, !>, !<.
  •  Avoid necessary where clause and mulitiple "AND" and "OR" clause. For example see below example :
    SELECT name FROM employee WHERE LOWER(name) = 'ab'
    SELECT name FROM employee WHERE name = 'AB' OR name = 'ab'
    Avoid DISTINCT and ORDER BY :
    • If no need then avoid using distinct and orderby clause in your query cause it causes extra load on database engine.
    CAST and CONVERT :
    • Try to use CAST instead of CONVERT. CAST is ANSI-92 standard but CONVERT works in MS SQL server only. Also, Convert may be deprecated in future MS SQL releases.
    • It is better to use CONVERT only when you need to format the DATETIME datatype with the style option. CAST can not do this.

    Avoid using cursors :

    • Try to use temporary table or table variables with identity column and then iterate all the tables using WHILE loop and a looping counter, which will map with the identity column.

Tips for Writing a Good Store Procedure Part I

Dynamic Queries :
  • Do not use dynamic queries as much as possible because it compile the query everytime.
  • If you use the simple sql query then it compiles only once bt dynamic query recompiles everytime.
Procedure Name Fully Qualified :
  • Use the fully qualified name when you are calling stored procedures. This would be the format database_name.schema_name.table_name. For example, use EXEC master.dbo.Your_Proc_name instead of EXEC Your_Proc_name. 
  • Also try to use the schema name when you create a procedure. Like: CREATE PROCEDURE dbo.Your_Proc_name instead of CREATE PROCEDURE Your_Proc_name 
sp_ Prefix :
  • Dont use the "sp_" prefix in store procedure or anywhere cause it is a predefined format reseverd for system procedures.
  • If by mistak name of store procedure will be same then it finds this procedure in system database and also in your database.So your database procedure never will be executed.
sp_executeSQL :
  • It avoids recompilation of store procedure. 
  • If you use dynamic query then it is very useful to you cause it stores procedures with the variable in cache.
  • When you pass parameter you will get result without recompilation of store procedure.
KEEPFIXED PLAN options :

  • It also avoids recompilation of store procedure.
  • Use  this keyword "KEEPFIXED PLAN" for getting result from temporary tables.
  • If your query contains this hint then your store procedure will not be recompiled.
SET NOCOUNT OFF :

  • This returns the message that shows number of rows affected by SQL statement. This can cause extra network traffic and can have some serious impact on performance when the procedure is called frequently. 
SELECT vs SET :
  • A single SELECT statement can assign values to different variables and is much faster than multiple SET statements assigning values to multiple different variables.
    SELECT @Var1 = @Var1 + 1, @Var2 = @Var2 - 1
    instead of

    SET @Var1 = @Var1 + 1
    SET @Var2 = @Var2 - 1
     

Saturday, June 5, 2010

Paging in SqlServer

Paging in SQL Server with ROW_NUMBER()


SELECT  *
FROM     (SELECT  ROW_NUMBER() OVER (ORDER BY iCagegoryID DESC)
             AS Row,sCategoryName, sCategoryType FROM CategoryMaster)
            AS LogWithRowNumbers
WHERE  Row >= 11 AND Row <= 20

See the example above. It tells that on which column you want to do paging, it stores column's index.
In above example "iCategoryID" column's Index store in variavle "Row" and everytime just user has to pass extra 2 variables minvalue and maxvalue through which we can get those much of records displayed in 1 page.

CharIndex in SQL Server

CharIndex in sql server gives you position of particular character.
See Example below :

Declare @test VARCHAR(3)
SET @test = 'abc'
SELECT CharIndex('b',@test) as 'Position'

Wednesday, March 17, 2010

How to generate an exe in asp.net?

First create the window application then add the setup project from add>other project type> setup and deployment > setup project.

Go to setup project > view > file system.
It shows three folder. Choose application folder > Right Click > Add > project output and choose your application.

Build the setup and get exe in your specified folder.

Run the setup.exe and then go to your specified folder where your project exe resides and run it.

Friday, March 5, 2010





Newspaper Search






Powered by ThePaperboy.com