Skip to main content

Posts

Showing posts from 2015

Observer Pattern : Real Life Example and Java Code Example

Observer Pattern The observer pattern defines a one to many relation between objects so that when one object changes state, all of its dependent or related objects get notified automatically Real Life Example: Group Chat is a real life example of observer pattern. Whenever someone type some text in text button and hit send button. Every member get notified that someone texted in group. Java Code Example: public interface Subject { void register(Observer observer); void remove(Observer observer); void notifyRespectedObserver(String msg); } public interface Observer { void update(String msg); String write(String msg); String getName(); } public class Console implements Subject { public List memberList; public Console(){ memberList = new LinkedList (); } public void register(Observer observer){ memberList.add(observer); } public void remove(Observer observer){ memberList.remove(observer); } public void notifyRespectedObserver(String msg){ for

Design Pattern : Real Life Example and Java Code Example

                      I n software engineering, a design pattern is a general reusable solution to a commonly occurring problem within a given context in software design. A design pattern is not a finished design that can be transformed directly into the source or machine code. It is a description or template for how to solve a problem that can be used in many different situations. - Wiki To explore the various kind of Design Patterns follow the below links. ----------------------------------------------------------------------------------------------------------------- Observer Pattern ----------------------------------------------------------------------------------------------------------------- Proxy Pattern ----------------------------------------------------------------------------------------------------------------- Builder Pattern ----------------------------------------------------------------------------------------------------------------- Singleton P

How to Restore the Original Storage Capacity of Pen Drive

                      I n the following post we will see how to restore the actual storage capacity of your pen drive. Sometimes it happens that your pen drive show smaller storage capacity than original storage capacity. For example If you have a 8 GB pen drive which has original storage capacity of 7.18 GB but now it is showing total space 4.32 GB. Usually it happens when you make your pen drive bootable for linux or other Operating Systems or your pen drive got older. To get back your pen drive with original storage capacity you need to do following things: 1) Mount your pen drive into windows operating system 2) Open cmd as administrator 3) Execute following command in the cmd C:\\Windows\System32>diskpart your cmd will change C:\\Windows\System32> to DISKPART> Now type the below command: DISKPART>list disk It gives the list of all disk partition and available devices along with index(start with 0) like Disk 0 Online 298

Some Points About C Programming: Every Programmer Should Know

Some important points in C Programming Here I am writing some points about C programming which I acquired during my learning about programming. These points may help you to get more from the C language, and increase the curiosity to explore it wider. 1) You can not use return keyword in ternary operators(?,:) 2) You can't left the bracket empty of while and for loops like while() and for(); 3) if i=5; then i=i+(6,7,8,2,9); will assign i=5+9;Because of ',' operator association. 4) You can only apply the register specifier to local variables and to the formal parameters in a function. 5) If You declared too many register variables then compiler automatically transforms register variables into non register variables when the limit is reached. 6) You can't obtain the address of a register variable by using the & operator. 7) Register variable only for int and char type.It may support other types(not in Dev-C++5.3.0.4) but significa

Error parsing XML, line 653, column 90: The reference to entity "skin" must end with the ';' delimiter.

                      I n the following post we will look up an error, heading of the post. If you are trying to insert some code in a web project,an existing website or blogger template. The following error can occur. "Error parsing XML, line 653, column 90: The reference to entity "skin" must end with the ';' delimiter." If you go to the location in file as mentioned line number and column number(obviously line no. and column no. can be different in each case) in the error string, You will see the html entity. HTML entity is a symbol which you can not use directly but you have to replace the symbol with some formatted text. For example we replace '<' with "&lt;" (without quotes). Here the list of html entities and their equivalent name. Result Description Entity Name Entity Number non-breaking space &nbsp; &#160; < l

Easiest Method to Read and Write into Files Streams in Competitive Programming

                      T his article is about easiest way to perform read and write operation from file. File handling is one of the most important aspect of programming and it becomes more important when we do competitive programming. Here are some context when you need to deal with files in comptetive programming. 1) Some specific programming contests like Google Code Jam and Facebook Hacker Cup they provide a file for input. You have to read input from that file and write answers into a file and upload on server within limited time. 2) If you are trying to code for a problem. Suppose the problem was that a square matrix is given and you have to rotate the matrix by 90 degree clock-wise. First line of input indicate the total no. of test cases and first line before matrix represents size of matrix. Then input would be like this. 3 5 10 23 43 34 21 11 13 43 30 71 10 23 43 24 21 13 53 43 34 21 10 23 43 38 61 3 2 4 5 6 4 1 2 8 9 4 31 20 40 21 77 22 61 10 11 22 33 44 43 88 41

SapientNitro Campus Placement 2014-15 HBTI Kanpur

SapientNitro visited our campus for hiring. I am sharing the details of selection process. CTC 4.5 Lacks Bond of 1.5 years: yes there was a bond of one and half years First of all I want to tell something important about this company. It is very nice company for those who have intention to continue preparation like CAT and others, because they have intensive training program for 6 months.So you can get some leisure and opportunity to learn some good technologies. Selection Procedure: online Test The online test conducted by amcat in HBTI CSE department. It has 4 sections, details of each are following. Quantitative Aptitude Time:30 minutes No. of Question: 25(around) Logical Reasoning Time:30 minutes No. of Question: 25(around) English Time:30 minutes No. of Question: 25(around) Technical Time:30 minutes No. of Question: 25(around) In the technical Paper they included C,C++,DS,Algo and OOPs concept. Note: Each section

Mu Sigma Campus Placement 2014-15 HBTI Kanpur

Mu Sigma Campus Placement Mu Sigma visited our campus to hire for business analyst profile. I am sharing the details of selection process. Package: 18 Lacks for 3 Years They tell about the package that 18 lacks will be for three years. First years they give nearly 3.5 lacks and they will raise after first year and promised to give total in three years. Branch: Open for All Selection Procedure: It was two day process. Day 1: online Test Time: 20 Minute No. of Questions: 15 The test paper contain typical MBA entrance exam questions. Only thing you should care about the negative marking. The negative marking was nearly equal to correct mark like +1 for right and -1 for wrong. Day 2: They short-listed some student on the basis of previous day test. On the 2nd day, there was three process and each was elimination round. Process 1: Case study In this round They took a pen-paper test. There was two questions in Paper. Q1. The fi

Newgen Software Campus Placement(Paper) HBTI Kanpur 2014-15

Newzen Campus Placement In the second week of November 2014 Newgen software visited our campus.There were various rounds in the selection process.I am sharing here all necessary information and details regarding the whole placement procedure. Criteria: 60% 10th,12th and B.Tech CTC: 3.75 LPA Profile: Software Devloper Branch: CS,IT and MCA Selection Procedure Round 1: The first process was written test and it was a pen-paper round. There were tow seprate papers and the details of both papers are below. Paper A (Aptitude,Logical Reasoning,English) In this paper the questions of Aptitude,LR and English were in almost equal proportion and the level of question was not quite easy,So try your hand on some good questions before the test. Paper B (Technical) The second paper was technical.I am giving the Questions and details of that paper. Time: 35 minutes No

Snapdeal Campus Placement 2014-15 HBTI Kanpur

Snapdeal Campus Placement In the 3rd week of May 2015, just after the end semester exams Snapdeal visited our campus.There were multiple online tests and multiple round in f2f interview. The necessary information and details are here. Criteria: No CTC: 6.75 LPA Profile: SDET(Software Development Engineer in Test) Branch: CS,IT Selection Procedure Online Test The first round was online test.They conducted the test online provided by third party website.There was three papers.The description of each paper are below. Paper-1 (Aptitude,Logical Reasoning,English) Time: 12 Minute No. of Questions: 50 You don't need to surpise and there is no typing error. There was 50 questions to solve in just 12 minutes.But you don't need to be panic the questions were quite easy. Paper-2 (Programming) Time: 45 minutes This round was most important because you must have solve at least on of the programm

Some Keyboard Shortcuts for Browsers:Every Developer must Know

Shortcuts Here some Keyboard Shortcuts which can help you to navigate faster through the browsers.So start using these shortcuts and surprise the noobs and make them to ask "How did you do that????". 1.   Ctrl+1(to 8)   Navigate from 1st tab to 8th tab(counting start from left) 2.   Ctrl+9   Navigate Last tab 3.   Ctrl+Tab   Navigate next (just right) tab 4.   Ctrl+Shift+Tab   Navigate previous (just left) tab 5.   Ctrl+W   Close the current tab 6.   Ctrl+T   Open new tab 7.   Ctrl+Shift+T   Open recently closed tab 8.   Ctrl+N   Open New Window 9.   Alt+F4   Close the current window 10.   Alt+Left Arrow   Back (same as Backspace) 11.   Alt+Right Arrow   Forward (same as Shift+Backspace ) 12.   F5   Reload the current tab 13.   Shift+F5   Reload the current tab without fetching from Cache 14.   Esc   Stop loading the current page 15.   Alt+Home   Open Homepage in current tab 16.   Ctrl + '+'(Ctrl and +)   Zoom in 17.  

Puzzles-Most Likely Asked in An Interview (Set-3)

Puzzles 1. Sand timer puzzle You have two sand timers with you. One can measure 7 minutes and the other sand timer can measure 11 minutes. This means that it takes 7 minutes for the sand timer to completely empty the sand from one portion to the other. You have to measure 15 minutes using both the timers. How will you measure it ? Solution: 7 Minutes Sand Timer Finished. Time Remaining in 11 minutes timer - 4 minutes Reversing the 7 minutes timer - 4 minutes will elapse. 3 Minutes will left. Once 11 minutes gets over reverse the 11 minutes timer again to use that 3 minutes. 8 Minutes left. Now Reverse 7 minutes timer to measure 7+8 = 15 minutes. *************************************************************************************************************************************** 2. 17 Horses Puzzle A farmer wants to div

How set up the environment and start MongoDB in Windows 7,8,10

Download the appropriate set up file from mongo db website.You can get it by simply searching on google. There are two method for set up the environments of the mongo db. First we need to click on to set-up file which you got by downloading from the mongo website. It will give some folder name in C:\ Program Files\MongoDB by default. Naive Method (Easy):     step-1  Create two nested folders in C drive like     C:\data\db     step-2 Navigate through C drive and MongoDB folder and open bin folder there must be two .exe       files mongod and mongo     step-3 Click on mongod.exe and it will open a window like cmd keep it opened.It starts the mongo     db server.     step-4 Now click mongo.exe it will also open a window. Now You can start executing your mongo     commands.     ex.   > show dbs; Professional Method: This method is for developer which has a capability to create a log file to keep all records for operations done on the database. step-1 Creat

Puzzles-Most Likely Asked in An Interview (Set-2)

Puzzles 1. King Octopus and Servants King Octopus has servants with six, seven, or eight legs. The servants with seven legs always lie, but the servants with either six or eight legs always say the truth. One day, 4 servants met : The blue one says: Altogether we have 28 legs. The green one says: Altogether we have 27 legs. The yellow one says: Altogether we have 26 legs. The red one says: Altogether we have 25 legs. What is the colour of the servant that says the truth? Solution: The green one is telling the truth. Lets assume that one of them is telling the truth and then try to prove that. Since the four are disagreeing then 3 must be lying. Lets say blue is telling the truth: so the blue one has either 6 or 8 legs. And each of the other octopus is lying hence has 7 legs. So our total legs beco