Thursday, September 29, 2011

Use of If Condition in Select Query

Use like this:

SELECT Name_Of_Head,Name_Of_Father, iif(tot_score>13,'APL','BPL') as Class
FROM FAMILY;


SELECT Name_Of_Head,Name_Of_Father,iif(Social_Group=1,'A',iif(Social_Group=2,'B',iif(Social_Group=3,'C',iif(Social_Group=4,'D','')))) as Caste
FROM FAMILY;

Wednesday, September 28, 2011

Good Web Design Property


1) http://omniinfo.in/ :- In this site, All menus tab are link to same page. i.e, In only one page, all information are showing. Very efficiently moving to one detail to another details in same page after clicking menu tab. Check it, you will amazed.

Thursday, September 22, 2011

Computer Tricks

How to change password of computer with dos without knowing old one

If u wanna change password of any computer with dos without knowing old one.

Then follow the steps-

1)Open dos prompt by writing cmd in run.
2)Type NET USER then after space type user_name of that computer then ur new password.
3)Press Enter and u have done.
Restart ur computer n enjoy with new password.

For Example-NET USER nishant 12345

What ever u type ur computer will speak

here is a trick to convert ur
TEXT to VOICE without any
software.

steps are
>go to run
>type
Control speech
>write any text
it will be converted to voice

CHECK UR Computer's performance

Do u want to Monitor ur Computer's performance?

Go to:

>run
>Type: perfmon.msc
>Enter

CLOSE ALL APPLICATIONS IN ONE CLICK

You are doing some work on your office or home PC having 10-20 windows open
& You are called for an emergency… What to do now??
how will you close all the windows open

Goto start>>Run>>type CloseAll.
it is a tiny tool that helps you to close all running applications with one click.
It does not use system resources because it only flashes a “close” signal to all open windows on the desktop and then ceases. Just place a shortcut to the tool in the Start Menu, Quick Launch or elsewhere wherever you want

USE UR NOTEPAD AS DIARY

Ever wanted to maintain a diary on your PC ?
Now, you can do it without the use of a software !

USE NOTEPAD !

Do The Following :
1. Open Notepad
2. Type : .LOG
3. Save it with any name say 'Diary'
4. Open Diary.txt again

Wow you see today's date and time, so start writing your Diary !


BLOCK USB DRIVES

a simple registry TRICK TO BLOCK USB drives (do it with care)

1. Go to Start –> Run, type Regedit.
2. Go to HKEY_LOCAL_MACHINE\System\CurrentControlset\Servic es\USBStor
3. In the right pane, look for value Start and have value as 0000000(3)
4. Double click on that and change that value to 4.

You might be required to restart the PC, and then you are done with it, USB is now blocked.

In case if you want to get the USB unblocked, just change the value again to 3

Folder hiding

If u wanna hide any folder from ur friend then follow the steps...

1) right click on that folder>>properties>>customize>>change icon.

2)select a blank icon for ur folder.

Now ur folder is hide but its name is still visible. so to hide the name also..follow  the steps.

3)'ON'  ur num lock

4)select ur folder and press f2.

5)rename the folder by alt+0160.

then ur name will also hide.
so ur folder's icon and name both hide and u have done.

warning-press 0160 from num pad only,while renaming the folder.


Shutdown Your Computer much faster


You can simply create a instant shutdown shortcut on your desktop.
1. Right click on your desktop and select New >> Shortcut
2. copy the following command: %windir%\System32\shutdown.exe -s -f -t 00
3. Name your shortcut as instant shutdown
4. You can use this created shortcut for fast shutdown.
This will forcibly end all running tasks and shutdown instantly.

Wednesday, September 21, 2011

Aaj ka Education

Aaj ka education aap dekheige to paayege ki education ka bajarikaran ho gaya hai. Aaj uchchh skhisha prapt karna yani ki jyada paise kamana, Jindgi me sukh shuvidha ka aana hi tak samjha jaata hai. Aaj ki shiksha ka dristikaun samaj ke kalyan hetu kaam karna nahi rah gaya. Aaj ki shiksha kitabi shiksha rah gayi jisme logo ka charitra chitran nahi hota unhe ye shikhaya di jaati hai ki wo exam me jyada se jyada number kaise laaye. Aaj ki shiksha dene ki paddhati duty matra rah gayi hai ki shikshak ko bas apna course khatm karna hai unhe is baat ki bilkul chinta nahi hai ki bachchhe sikh rahe hai ki nahi.Aaj ki shiksha prapt karne ka dristikaun bilkul badal gaya hai. Aaj log exam pas kar kisi company me placement to le lete hai par unme khhud ko duniya ke samne sabit karne ki ichchhasakti nahi hoti.Unko bachpan se shikhaya jaata hai ki exam pas karna yani ki gyan arjit hona. Me exam pas karne ke pratipaksh me nahi huin mera kahna hai ki exam surprise hone chahiye jisse pata chale ki bachchhe ne kitna sikha hai eisa nahi ki wo ek din me chhijo ko rat ke aaye aur use exam ke din udel diye. Shiksha ka ye katai matlab nahi hona chahiye ki aapko number kitne aaye, aap kis company me kaam karte ho, aap ki pad pe ho. Shiksha ka ye matlab hona chahiye ki aapke andar kisi kaam ko karne ki kitni tatparta hai, aap apne kahe huye kathno ko kitna charitarth me batalte ho, aapme me chunotiya sahne ki kitni kshamta hai, aapke jivan ka uddeshy kya hai,aap apne se chhoto ko, bado ko, sahpathi ko, junior ko, senior se kis prakar ka sambandh rakhte hai. Eesi hi bahut si baate hai jo shiksha ki pahchan hoti hai. Shiksha ki sirf ye pahchan nahi hoti ki aapko kitni badi badi baate karni aati hai, shikash ki pahchan ye hai un badi badi baato ko aap kitna apne jivan me daalte hai aur dusro ko iske prati kitna prerit kar paate hai. To bahut jaruri hai shiksha ke maayne badalne ki.
                                                            Aaj me dekhta huin ki jyadadar logo ka lakshya jivan me settled hona hai. Koi sarkari naukri mil jaaye ya wo nahi to private hi sahi. Naukri pake wo nishchint ho jaate hai. Unki nind tab tutti hai jab upar se koi kaam ka dabab aata hai otherwise wo nishchint hoke soye rahte hai. Apne dimag se wo kaam nahi karte hai. Balki upar se diye gaye kaam ka execution karte hai. Kahne ka matlab logo ko ek dayere me baandh jaate hai aur wo usi ke charo aur chakkar lagate rahte hai. Jabki unme ye ikchchhasakti honi chahiye ki koi bhi kaam me kuchh naya karna aur use aur bhi behtar aur prabhavi banana.


Aaj mukh rup se do taraha ke log hote hai: pahla jo paise ke liye kaam karte hai aur dusra jinki prathmikta pahle kaam hoti hai fir paisa hota hai. To jaruri hai dono tarah ke logo ko dhyan me rakhte huye jimmedaariya sopni chahiye. Jaise ki long term kaam ke liye dusre tarah ka aadmi sahi hai aur short term kaam ke liye pahle tarah ka aadmi sahi hai. 

Saturday, September 17, 2011

What is the right education? or How to reach to right education?

Ye Post me ye dhyan me rakh kar likh raha huin ki kaise kisi bachche ko education diya jaaye jisse wo apne life ko successful kah sake aur dusre log bhi maane ki usne achchha kaam kiya hai? Yani ki usne bhi samaj me parivartan me apna yogdan diya ho.
                      Ab Sawal uthta hai kaisi shiksha bachcho ko di jaaye? Aaj ki shiksha pranali me kya sudhar karne ki aawaksakta hai? Kaisa education system banaya jaaye jisse har bachchha sona ho? kahne ka matlab ki wo skillful ho, jisme hunar ho kuchh kar dikhane ki.
                      Aaj ki shiksha pranali me mai dekhta huin ki lakho log graduation karne ke baad bhi berojgar hai, unki degree unhe kaam nahi dila pa rahi hai.Unki 21 saal ki journey unhe itna bhi shikshit nahi kar saki jisse unhe koi kaam mil sake.Wo kaam ki khoj me apne pariwar se dur ek jagah se dusre jagah bhatak rahe hai. Kaam mil jaane ke baad bhi kai jagah par wo shoshit ho rahe hai. Aur kai jagah pe sahi wetan milne par bhi khush nahi hai. Kai log Apna kaam imandaari se nahi kar rahe hai. Logo ki soch apne pariwaar tak hi simit rah gayi hai. kyu chuninda log hi (jaise Abdul kalam, Ambani, Arvind Kejriwal, Sachin Tendulkar, Amir khan) apne kaam ke prati samarpit hote hai?
                      In sabhi ka ek hi karan hai ki sahi shiksha nahi milna. To Question uttha hai Sahi Shikah hai kya?
                      Koi bhi vyakti shiksha kitab padh kar hasil nahi karta. Use shiksha milti hai uske aas pas ke logo se. Wo sabse jyada shiksha grahit karta hai dekh ke aur sun kar. Uske dimag ka vikas uske aas pas ke paryawaran par nirbhar karta hai ki uske aas pas kaise log hai. Kinke nirakshan me, Kis prakar ke logo ke bich wo hai. Kahne ka matlab hai yadi bachchho ko shuru ke samay me (lagbhag 0 se 10 saal ke umra tak) unka margdarshan kiya jaaye to aage chalkar kam dhyan dene par bhi wo apne jivan me safal hoinge.Ye aapne suna hoga ki 'kuchh bhi sikhne ki koi umra nahi hoti' lakin yadi sahi samay pe shikha jaaye to shikhna asan aur samay ki bahut bachat hoti hai. Kahne ka matlab hai yadi aap 40 saal ke vyakti ke haath me pahli baar computer pakda deinge aur yadi aap 12 saal ke bachche ke haath me de deinge to kaun jaldi sikhega. To bahut jaruri hai ki koi bhi kaam sahi samay pe kiya jaaye. Bachchho ke dimag ka vikas shuru ke samay me bahut hi tivra gati se hota hai, us samay uski yaad karne ki kshamta bahut achchhi hoti hai, usi samay ki shikhi hui chije hi uske jivan ka margdarshan karti hai, to jaruri hai ki us samay unhe sahi siksha dena jisse aage chalkar wo apne jivan me sahi faisla kar sake. Ek question yaha uthta hai ki 0 se 10 saal me shikhi gayi shiksha kaise uska margdarshan karti hai?
                      10 saal ke baad uski itni buddhi ka vikas ho jaata hai jisse wo apna decision lene lagta hai. Use kya karna hai kya nahi karna hai decision wo lene lagta hai. To jaruri hai ki yadi bachchho par shuru me dhyan diya jaaye, jisse uske dimag ka sahi vikas ho. Jisse wo aane wale samyo ka sahi mulyakan kar sakega aur aapko aage chal kal apne bachchhe ke future ke prati jyada pareshani nahi uthani padegi. To ab question uthta hai ki kin bato par dhyan diya jaaye?
                      Jaise bhachchho ko khel ke prati prem hota hai usi tarah unme Math, English, Hindi, GK, Computer ke prati prem jagana hai. Unke andar sikhne ki lalak paida karni hai. Unke andar ye aatmvishwas jagana hai ki wo koi bhi kaam kar sakte hai bas uske liye mehnat aur sahi path pe chalne ki aawaksakta hai (ye unke samne sabit karke bhi dikhana hoga jisse wo is baat ki gambhirta ko samajh sake.). Kahne ka mera abhipray hai ki bachchho me jaruri hai ki, kisi bhi chij ke prati ruchi paida karna na ki us par bojh dalna. Ab question uthta hai ki kaise ruchi paida ki jaaye?

Copy Directory from one location to another

Use below code to copy directory to another location:

        // Copy directory structure recursively

        public static void copyDirectory(string Src,string Dst){
            String[] Files;

            if(Dst[Dst.Length-1]!=Path.DirectorySeparatorChar) 
                Dst+=Path.DirectorySeparatorChar;
            if(!Directory.Exists(Dst)) Directory.CreateDirectory(Dst);
            Files=Directory.GetFileSystemEntries(Src);
            foreach(string Element in Files){
                // Sub directories

                if(Directory.Exists(Element)) 
                    copyDirectory(Element,Dst+Path.GetFileName(Element));
                // Files in directory

                else 
                    File.Copy(Element,Dst+Path.GetFileName(Element),true);
            }
        }
 
The function takes two absolute paths (source directory and destination directory)
as parameters and returns a boolean equal to true when the copy succeeds. 
Please note that this function automatically overwrites a destination file with 
the same name. Of course all subdirectories are also copied recursively.  

XCOPY command


Xcopy

Copies files and directories, including subdirectories.

Syntax

xcopy Source Destination /d /s /e /y

/d[:mm-dd-yyyy] : Copies source files changed on or after the specified date only. If you do not include a mm-dd-yyyy value, xcopy copies all Source files that are newer than existing Destination files. This command-line option allows you to update files that have changed.

/y : Suppresses prompting to confirm that you want to overwrite an existing destination file.

/s : Copies directories and subdirectories, unless they are empty. If you omit /s, xcopy works within a single directory.

/e : Copies all subdirectories, even if they are empty.


To obtain a list of the files to be copied by the previous command (that is, without actually copying the files): 
          xcopy Source Destination /d /s /e /y /l > xcopy.out

Above command tells only which files will be copied after executing this command  xcopy Source Destination /d /s /e /y.

Help Taken from http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/xcopy.mspx?mfr=true

Thursday, September 15, 2011

Write Query in MS Access 2003

Follow these steps:
i)  First open your database
ii) Click on 'Queries' tab from left panel
iii) Click on  'Create query in Design view'
iv) Add tables on which you are going to execute query
v) Now you can see on the second-top left corner(below menu bar), there is a option where you find out 'SQL View' after clicking downward arrow. Click on SQL View.
vi) Query1 Panel opens. Here you can write Select Query,  Update Query, Delete Query etc And then execute the query by clicking on exclamatory sign (!) from the second-top bar.
vii) Result will show in same window (Query1 Panel). If you want to write another query then click on 'SQL View' as mention above and repeat the procedures.

Problem List


1) Suppose you have two columns in Excel and one record where one column has value but another column has nothing. Now you are going to paste this record into a Access database table where also has two columns. Now you want to delete this record by SQL statement. How you do it? Condition is you also supply the value of Second column in where condition of Delete statement.


Ans:  Wrong Answer: delete <tablename> where Column1='<value>' and Column2='';
                                  delete <tablename> where Column1='<value>' and Column2=null;

          Right Answer:  delete <tablename> where Column1='<value>' and Column2 is null;

Sunday, September 11, 2011

Difficult Puzzle


1) There is a truth teller (always tells the truth), a liar (always lies), and one that sometimes answers truthfully and sometimes lies. Each man knows who is who. You may ask three yes or no questions to determine who is who. Each time you ask a question, it must only be directed to one of the men (of your choice). You may ask the same question more than once, but of course it will count towards your total. What are your questions and to whom will you ask them?

Ans: There are 6 possible states for the order of the men: TRL, TLR, LTR, LRT, RTL, RLT

There are 8 possible combinations of anwers for questions: TTT, TTL, TLT, TLL, LTT, LTL, LLT, LLL.

Theoretically it's possbile if you could figure out a way to get any of the 8 combinations of answers assigned to the states, but with the unreliability of Random's answers, I thought it was impossible. There is always a possiblity in any solution where Random will exactly mirror T or L for answers. He could always lie or always tell the truth and you can never tell when he is lying or telling the truth. This being given, I thought you can NEVER separate 6 distinct answers to apply to the 6 states, and therefore can never be sure who is who.

After a minute though, I saw through my own error in logic. I was always dealing with questions where T and L would give the same answer regardless of the order of the men. I saw that if you can get T and L to give a Yes/NO answer, then you can figure out where R's worthless answers are. The only way I saw to do this is to ask about the order of the men themselves.

So:
Ask #1 if L is standing on R's right arm (our left if they are facing us).
The answer gives you a split in the order they are standing:
If YES, then it has to be T telling the truth, L telling a lie, or one of R's worthless answers, so: TLR, LTR, or RTL, RLT.
If NO, then it has to be T telling the truth, L telling a lie, or R and his worthless answers, so: TRL, LRT, or RTL, RLT.

Now we know, based on the answer to #1 where to avoid R's worthless answers. We now ask T or L "Is T in the lineup?" If answer 1 was Yes, we ask person 2, if it was no we ask person 3.

The answer now will give us some more info. If it's Yes, it's T answering the truth, if it's no, it's L answering a lie. So based on who we asked, we now know:

Yes, Yes: Has to be LTR, or RTL
Yes, No: TLR, RLT
No, Yes: LRT, RLT
No, No: TRL, RTL

Now any question separating the two possiblities works - just make sure you are avoiding R's worthless answers.

For example:
Yes, Yes - ask #2 if #1 is L. (We know #2 is T and will tell the truth) - Yes = LTR, No = RTL
Yes, No, - ask #2 if #1 is T. ( We know #2 is L and will tell a lie) - Yes = RLT, No = TLR
No, Yes - ask # 3 if #1 is L. (We know #3 is T and will tell the truth) - Yes = LRT, No = RLT
No, No, - ask #3 if #1 is T. (We know #3 is L and will tell a lie) - Yes = RTL, No = TRL

So we have the order and know who is who.

Puzzles


1) What is the question you can ask all day, and no matter what the answers are, they would still be valid questions and correct?

Ans: What time is it?

2) Which part of London in France?

Ans: -N-

3)  There are three switches downstairs. Each corresponds to one of the three light bulbs in the attic. You can turn the switches on and off and leave them in any position. How would you identify which switch corresponds to which light bulb, if you are only allowed one trip upstairs?

Ans: Keep the first bulb switched on for a few minutes. It gets warm, right? So all you have to do then is ... switch it off, switch another one on, walk into the room with bulbs, touch them and tell which one was switched on as the first one (the warm one) and the others can be easily identified .

4) A man who lives on the tenth floor takes the elevator down to the first floor every morning and goes to work. In the evening, when he comes back, he goes to the seventh floor and walks up three flights of stairs to his apartment. But on a rainy day, or if there are other people in the elevator, he goes to his floor directly. Can you explain why?

Ans: The man is a of short stature. He can't reach the upper elevator buttons, but he can ask people to push them for him. He can also push them with his umbrella.

 5) How can you throw a ball as hard as you can and have it come back to you, even if it doesn't bounce off anything? There is nothing attached to it, and no one else catches or throws it back to you.

Ans: Throw the ball straight up in the air.

6) You are in a room with no metal objects except for two iron rods. Only one of them is a magnet.
How can you identify which one is a magnet?

Ans: Break one or both rods and the one who's pieces attract or repel eachother is your magnet.

7)  Having 2 sand-glasses: one 7-minute and the second one 4-minute, how can you correctly time 9 minutes?

Ans:  Turn both sand-glasses. After 4 minutes turn upside down the 4-min sand-glass. When the 7-min sand-glass spills the last grain, turn the 7-min upside down. Then you have 1 minute in the 4-min sand-glass left and after spilling everything, in the 7-min sand-glass there will be 1 minute of sand down (already spilt). Turn the 7-min sand-glass upside down and let the 1 minute go back. And that's it.
4 (4-min) + 3 (7-min) + 1 (4-min) + 1 (7-min) = 9

8) Given 27 table tennis balls, one is heavier than the others.What is the minimum number of weighings (using a two-pan balance scale) needed to guarantee identifying the heavy one? Of course, the other 26 balls weight the same.

Ans: It is enough to use a pair of scales 3 times.
Divide the 27 balls to 3 groups, 9 balls in each. Compare 2 groups – the heavier one contains the ball. If there is equilibrium, then the ball is in the third group. Thus we know the 9 suspicious balls.
Divide the 9 balls to 3 groups of 3. Compare 2 groups, and as mentioned above, identify the group of 3 suspicious balls.
Compare 2 balls (of the 3 possibly heavier ones) and you know everything.
So we used a pair of scales 3 times to identify the heavier ball.

9) What mathematical symbol can be placed between 5 and 9, to get a number greater than 5 and smaller than 9?


Ans: decimal point –> 5.9 or 5+(root of 9)=5+3=8

10) Two fathers and two sons sat down to eat eggs for breakfast. They ate exatly three eggs, each person had an egg. The riddle is fdor you to explain how?

Ans: one of the 'fathers' is also a grandfather. Therefore the other father is both a son and a father to the grandson. In other words, the one father is both a son and a father.

11) What digit is the most frequent between the numbers 1 and 1,000 (inclusive)? and What digit is the least frequent between the numbers 1 and 1,000(inclusive)?

Ans: The most common digit is '1'. and '0' is the least common digit even though 1,000 has three zero's !

Explanations for both riddles:
The digits 0 through 9 all follow the same pattern there is exactly 1 occurance of each digit for every ten numbers.
  • For instance the digit 2 appears once between 10 and 19, at 12. And 2 appears once between, 30 and 39 at 32.
  • However, each of the digits 1 through 9 also appear in other numbers in the tens and hundres place
    Again, let's look at 2 which appears in 20,21,22, 23, etc.. as well as 200,201, 202,203..
  • So to figure out how to answer the first riddle you had to see what distinguishes the number 1? Only that we are including 1,000 which would be the first '1' in a new series of ten! In other words, the digit 1 only has a single extra occurance (301 occurences) compared to 2 or 3 or 9 which each have exactly 300 occurences.
The reason that zero has the least (BY FAR at only 192 occurences) is because zero does not have any equivelents to 22, 33, 44, 222, 3333 etc.

12) Three lawyers rent a hotel room for the night. When they get to the hotel they pay the $30 fee, then go up to their room. Soon the bellhop brings up their bags and gives the lawysers back $5 because the hotel was having a special discount that weekend. So the three lawyers decide to each keep one of the $5 dollars and to give the bellhop a $2 tip. However, when they sat down to tally up their expenses for the weekend the could not explain the following details:
Each one of them had originally paid $10 (towards the initial $30), then each got back $1 which meant that they each paid $9. Then they gave the bellhop a $2 tip. HOWEVER, 3 • $9 + $2 = $29
    The lawyers couldn't figure out what happened to the other dollar. After all, the three paid out $30 but could only account for $29.
Can you determine what happened?

Ans:  There are many ways of explaining/thinking bout this truly brain bending riddle! It all boils down to the fact that the lawyers's math is incorrect. They did NOT spend $9 • 3 + $2.
They spent exactly $27 dollars. $25 for the room and $2 for the tip. Remember they got exactly $3, in total back.
Another way to think about the answer to this riddle is to just pretend that the bellhop refunded $3 to the lawyers (rather than giving them $5 and recieving $2 back). If the lawyers get $3 back and each takes $1. They they spent exactly $27 dollars.

13) Your job is to measure 45 minutes, if you have only two cords and matches to light the cords.Each cord burns from end to end in exactly one hour.

Ans: Start fire on both ends of one igniter cord and on one end of the second igniter cord. The very moment the first cord (where both ends burn) stops burning (that is after 30 minutes), start fire on the other end of the second cord (otherwise it would burn another 30 minutes). Thus the second igniter cord burns just 15 minutes from then. And that is all together 45 minutes.


14) You are one of 20 prisoners on death row with the execution date set for tomorrow. Your king is a ruthless man who likes to toy with his people's miseries. He comes to your cell today and tells you:
“I’m gonna give you prisoners a chance to go free tomorrow. You will all stand in a row (queue) before the executioner and we will put a hat on your head, either a red or a black one. Of course you will not be able to see the color of your own hat; you will only be able to see the prisoners in front of you with their hats on; you will not be allowed to look back or communicate together in any way (talking, touching.....).

The prisoner in the back will be able to see the 19 prisoners in front of him. The one in front of him will be able to see 18…

Starting with the last person in the row, the one who can see everybody in front of him, he will be asked a simple question: WHAT IS THE COLOR OF YOUR HAT?

He will be only allowed to answer “BLACK” or “RED”. If he says anything else you will ALL be executed immediately.

If he guesses the right color of the hat on his head he is set free, otherwise he is put to death. And we move on to the one in front of him and ask him the same question and so on…

Well, good luck tomorrow, HA HA HA HA HA HA!”

Now since you all can communicate freely during the night, can you find a way to guarantee the freedom of some prisoners tomorrow? How many?

Ans: First guy is a coin toss - let's wish him good luck.
His job is to establish the parity of black hats visible to him.
He says "Black" if he sees an odd number of black hats; "Red" otherwise.
By paying attention to what has been said, each prisoner will know his hat's color.

Example:
Second to speak hears "Black" and sees an even number of black hats.
He knows his hat is black [odd changed to even - must be his is black] and says "black".

Third guy has heard "black" and "black" and sees an even number of black hats.
He knows his hat is red [even stayed even - his hat can't be black] and says "red".

And so on, to the front of the line.

15) Three goddesses were sitting in an old Indian temple. Their names were Truth (always telling the truth), Lie (always lying) and Wisdom (sometimes lying). A visitor asked the one on the left: "Who is sitting next to you?"
"Truth," she answered.
Then he asked the one in the middle: "Who are you?"
"Wisdom."
Lastly, he asked the one on the right: "Who is your neighbor?"
"Lie," she replied.
And then it became clear who is who.

Ans: Let’s assign a letter to each goddess. We get these sentences.
1. A says: B is Truth.
2. B says: I am Wisdom.
3. C says: B is Lie.
First sentence hints that A is not Truth. Second sentence is not said by Truth either, so C is Truth. Thus the third sentence is true. B is Lie and A is Wisdom.

16) Teanchi and Beanchi are a married couple. They have two kids, one of them is a girl, what is the probability that the other kid is also a girl.


Ans: 1/3

This is a famous question in understanding conditional probability, which simply means that given some information you might be able to get a better estimate.

The following are possible combinations of two children that form a sample space in any earthly family:
Girl - Girl
Girl - Boy
Boy - Girl
Boy - Boy

Since we know one of the children is a girl, we will drop the Boy-Boy possibility from the sample space.
This leaves only three possibilities, one of which is two girls. Hence the probability is 1/3
 

17) Three boxes are all labeled incorrectly, and you must get the labels right. The labels on the boxes read as follows:

[box 1] nails
[box 2] screws
[box 3] nails and screws

To gain the information you need to move the labels to the correct boxes, you may remove a single item from one of the boxes. You may not look into the boxes, nor pick them up and shake them, etc.

Can this be done? If so, how? If not, why not?

Ans: Remove an item from box 3.
The item tells you what label to put on box 3.
Move the nails and screws label to the box labeled with the other item, and its label to the remaining box.

Example: you remove a nail from box 3.
Move the label nails from box 1 to box 3.
You can't move the nails and screws label to box 1: that would be a swap, and all three labels must be corrected.
Move it instead to box 2, and the screws label to box 1.

[box 1] screws
[box 2] nails and screws
[box 3] nails



Good Puzzles Collection:
http://brainden.com

Saturday, September 10, 2011

Image Capturing from webcam in C#

You can show video from webcam in your window application and capture the image. http://sites.google.com/site/webcamlibrarydotnet/winfrom-and-csharp-sample-code-and-download is a link where you can find out WinFormCharpWebCam zip file which contains source code via this you can able to do above scenario. In this code its using System.Linq library. This library you doesn't find in VS 2005. For this you have to add LinqBridge.dll reference from this link http://code.google.com/p/linqbridge/downloads/list. There is a file LinqBridge-1.2-Debug.zip, you need to download and add into as a reference in your above downloaded project (WinFormCharpWebCam).


How to relate . NET Framework, CLR and Visual Studio

 

Visual Studio(Version)                        CLR           .NET Framework
----------------------------------------------------------------------------------------
Visual Studio .NET (7)                        1.0.3705      1.0
Visual Studio 2003 (7)                        1.1.4322      1.1
Visual Studio 2005 (8)                        2.0.50727     2.0
Visual Studio 2005 with .NET 3.0 Extensions   2.0.50727     2.0, 3.0
Visual Studio 2008 (9)                        2.0.50727     2.0 SP1, 3.0 SP1, 3.5
Visual Studio 2008 SP1                        2.0.50727     2.0 SP2, 3.0 SP2, 3.5 SP1
Visual Studio 2010 (10)                       4.0.30319     4.0



Note that while 3.0 bascially only added new assemblies (same CLR), 3.5 added new assemblies, new compiler, and updated the CLR to SP1 level.
Framework 4.0 will be a whole new CLR (4.0, no CLR 3.x) which will run side-by-side with CLRs 1.1 and 2.0. It will also have all-new assemblies versioned 4.0 instead of using the 2.0 assemblies.
 
 
 
Framework  CLR and Assemblies            Visual Studio
----------------------------------------------------------
1.0 RTM    1.0.3705.0                    Visual Studio .NET (aka VS.NET 2002)
1.0 SP1    1.0.3705.209
1.0 SP2    1.0.3705.288
1.0 SP3    1.0.3705.6018

1.1 RTM    1.1.4322.573                  VS.NET 2003
1.1 SP1    1.1.4322.2032
1.1 SP1    1.1.4322.2300                 Windows Server 2003

2.0 RTM    2.0.50727.42                  VS2005 RTM
2.0 RTM    2.0.50727.312                 Windows Vista
2.0 SP1    2.0.50727.1433                VS2008 RTM and .Net 3.5 RTM
2.0 SP2    2.0.50727.3053                VS2008 SP1 and .Net 3.5 SP1
2.0 SP2    2.0.50727.4016                Windows Vista SP2 and Windows Server 2008 SP2
2.0 SP2    2.0.50727.4927                Windows 7

Framework  CLR           New assemblies
----------------------------------------------------------
3.0 RTM    2.0 RTM       3.0.4506.30     The only "out-of-band" non-SP framework release
3.0 SP1    2.0 SP1       3.0.4506.648    VS2008 RTM and .Net 3.5 RTM
3.0 SP2    2.0 SP2       3.0.4506.2123   VS2008 SP1 and .Net 3.5 SP1

3.5 RTM    2.0 SP1       3.5.21022.8     VS2008 RTM and .Net 3.5 RTM
3.5 SP1    2.0 SP2       3.5.30729.01    VS2008 SP1 and .Net 3.5 SP1
3.5 SP1    2.0 SP2       3.5.30729.4926  Windows 7

Framework  CLR and Assemblies            Visual Studio
----------------------------------------------------------
4.0 RTM    4.0.30319.1                   VS2010
 
 

Copy from Wikipedia:-

.NET Framework 3.0

.NET Framework 3.0 consists of four major new components: 

  • Windows Presentation Foundation (WPF), formerly code-named Avalon; a new user interface subsystem and API based on XML and vector graphics, which uses 3D computer graphics hardware and Direct3D technologies.
  • Windows Communication Foundation (WCF), formerly code-named Indigo; a service-oriented messaging system which allows programs to interoperate locally or remotely similar to web services.
  • Windows Workflow Foundation (WF) allows for building of task automation and integrated transactions using workflows.
  • Windows CardSpace, formerly code-named InfoCard; a software component which securely stores a person's digital identities and provides a unified interface for choosing the identity for a particular transaction, such as logging in to a website.
.NET Framework 3.0 uses the Common Language Runtime of .NET Framework 2.0

.NET Framework 3.5

version 3.5 features such as Language Integrated Query (LINQ, provide support for additional features on Windows Mobile and Windows Embedded CE devices, adds new functionality and provides performance improvements under certain conditions, especially with WPF where 20-45% improvements are expected. Two new data service components have been added, the ADO.NET Entity Framework and ADO.NET Data Services. Two new assemblies for web development, System.Web.Abstraction and System.Web.Routing, have been added; these are used in the ASP.NET MVC Framework and, reportedly, will be utilized in the future release of ASP.NET Forms applications.

.NET Framework 4

Key focuses for this release are:
  • Parallel Extensions to improve support for parallel computing, which target multi-core or distributed systems.To this end, technologies like PLINQ (Parallel LINQ), a parallel implementation of the LINQ engine, and Task Parallel Library, which exposes parallel constructs via method calls., are included.
  • New Visual Basic .NET and C# language features, such as implicit line continuations, dynamic dispatch, named parameters, and optional parameters.
  • Support for Code Contracts.
  • Inclusion of new types to work with arbitrary-precision arithmetic (System.Numerics.BigInteger) and complex numbers (System.Numerics.Complex).

 


Wednesday, September 7, 2011

URL Character Coding


Visit this Site: http://www.w3schools.com/tags/ref_urlencode.asp
 
Character       Escape Code
SPACE %20
< %3C
> %3E
# %23
% %25
{ %7B
} %7D
| %7C
\ %5C
^ %5E
~ %7E
                                               
[ %5B
] %5D
` %60
; %3B
/ %2F
? %3F
: %3A
@ %40
= %3D
& %26
$ %24

Tuesday, September 6, 2011

Table Name Exist or not in Database


This function can use to check TableName exist or not in Database:-
if return value of function is 1 that means table exist in database.
public int TableExist(String TableName)
        {
            DataTable dt = new DataTable();
            try
            {
                DB.Open();
                String[] restriction=new String[3];
                restriction[2] = TableName;
                dt = DB.GetSchema("Tables", restriction);
                if (dt.Rows.Count == 0)
                {
                    DB.Close();
                    return 0;
                }
                else
                {
                    DB.Close();
                    return 1;
                }
               
            }
            catch (Exception e1)
            {
                MessageBox.Show(e1.ToString());
                DB.Close();
            }
            return 0;
        }

Thursday, September 1, 2011

DataSet and DataTable


Here we discuss about DataSet properties and its function:

1) Adding Column and Row in DataSet

DataSet ds=new DataSet();
ds.Tables[0].Columns.Add(new DataColumn("SLNO",typeof(int)));
DataRow newrow=ds.Tables[0].NewRow();
ds.Tables[0].Rows.Add(newRow);
ds.Table[0].Rows[0]["SlNO"]=1;



2) Adding one Dataset into another Dataset

DestinationDataset.Tables[0].Merge(SouceDataset.Tables[0]);



3) Use Group by in DataTable and Sort

public DataTable GroupBy(string GroupByColumn, string AggregateColumn, System.Data.DataTable SourceTable)
        {
            DataView dv = new DataView(SourceTable);
           
          
  //getting distinct values for group column
            System.Data.DataTable dtGroup = dv.ToTable(true, new string[] { GroupByColumn });
            //adding column for the row count
            dtGroup.Columns.Add("Voters", typeof(int));

            //looping thru distinct values for the group, counting
            foreach (DataRow dr in dtGroup.Rows)
            {
               
                dr["Voters"] = SourceTable.Compute("Sum(" + AggregateColumn + ")", GroupByColumn + " = '" + dr[GroupByColumn] + "'");
            }
          
           //Sort
            dv=new DataView(dtGroup);
            dv.Sort = "Voters DESC";
            dtGroup= dv.ToTable();

            //returning grouped/counted result
            return dtGroup;
        }
















Round function in SQL or Rounding upto 2 decimal in SQL

Like this we can use round function in SQL:

select Product_Name,Rate,Quantity,Round(Rate*Quantity,2) from ProductEntry


Inner Join in Update Statement in MS Access

 Like this we can use inner join in update statement:
update table1 inner join teble2 on table1.SLNO = table2 .SLNO set table1.VOTER_IDNo = table2.VOTER_IDNo where table2.STATUSTYPE='M'