Popular Posts

Sunday, December 22, 2019

Some Sundays are Fundays.......


Eiffel Master Plan
 Eiffel Tower In progress

Eiffel Tower Puzzle
Mocked Eiffel Tower

Monday, February 20, 2017

Introduction to Voice Over Internet Protocol (VOIP)


What is VOIP:


VOIP stands for Voice Over Internet Protocol. It’s a great new way from to use the power of internet to make and receive phone calls. If you have a high speed internet connection then you can use VOIP and begin making phone calls using your regular touch tone phone. Just like sending an e-mail through the internet VOIP service provider does the same thing with voice and the best part is that you will be able to call anywhere at anytime and save money too. VOIP is also called broadband phone as it uses high speed internet connection which is also called broadband connection.

History:

The concept of VOIP comes from the concept of text chatting. In earlier days when internet was invented there was big problem for the general users that how they can get access to it because to get an access to internet there is need for a physical connection between the user and the internet. It is not possible to cover million and billions of users around the world through means of physical connection. But there exists a physical connection around the world that is already in use by billions of people to connect anywhere in is world with their friends and relatives and that physical connection is our local phone cable. By using this cable they can overcome the physical connection problem but then another comes up and that is local phone signals are analog and the computer sends and receive digital signals from the internet. They over come this problem by inventing modem whose function is to convert digital signals into analog and analog signals into digital. So users are connected to internet and using it for different purposes including chatting. Most of the users around the world were using internet because of chatting. They progress further in increasing the speed of internet and then were able to transfer voice over internet which was popular all around the world as voice chatting and is still in use as VOIP service is not that much cheaper for every user. From voice chatting they get this concept of making and receiving phone calls by means of internet as they are already using the resources of the telephone. Now a day we are still connecting to the internet by means of telephone cable but there is tremendous improvement in its speed and its facilities. VOIP is one of the most important facilities of the internet.

Requirements for VOIP:

In order to get a VOIP connection following are the requirements:
                 
  • Broadband Internet connection (DSL or Cable).
  • A regular touch tone telephone.
  • A VOIP phone adapter.
  • A VOIP service provider account.

How VOIP works:

You connect your telephone to your high-speed Internet connection using the VOIP phone adapter. Pick up the phone, and use it just like you do today. When you pick up the phone, the VOIP phone adapter converts your voice into data and sends it through the Internet like an email. The VOIP service provider’s network sends the call where you want it and translates it back into voice. When the person you're calling picks up the phone, it sounds just the same as any other call. When someone calls you, they dial your number, your phone rings, and all you have to do is pick up and answer it. Once you connected a VOIP adapter with your cable or DSL modem then your phone calls are routing through the internet. Below is a diagram that how its works and general procedure:

http://wakasmalik.blogspot.com/2017/02/introduction-to-voice-over-internet.html
VOIP Setup

  • VOIP adapter sends your phone call across the Internet.
  • Your calls go through your modem.
  • Your VOIP phone adaptor splits your high-speed broadband Internet connection.
  • Your Internet connection should work as it did before you installed the VOIP phone adaptor sending emails and other web data to your personal computer.
  • Your phone calls are sent through your VOIP phone adaptor to your regular or cordless phone.


Advantages of VOIP Service:



·         First and one of the important advantages is that it will lower your phone bills and especially if you have an international connection or you are using calling cards.

·         Secondly wherever you live in this world you can get a local telephone number of your choice of country regardless of the geographical difference of both the countries. Let’s take an example if you live here in USA but still you can own a UK number. In this way you and your UK friends save a lot of money on phone calls as both you have the same area code that’s possible now with the power of internet and VOIP service.

·         You can get all great features like Caller ID with Name, Call Waiting Voicemail and Conference Calling included at no additional cost.

·         There are number of additional features that you can get like: 911 Dialing Call transfer, In-Network calls, area code selection, Click 2 Call, Call Return, Caller ID block, International Call Block and Ring List.

·         Soft Phone: Whether you're traveling across the globe or just into the next room, carrying on a conversation doesn't have to mean carrying extra equipment. Download Soft Phone software and you can turn any PC or laptop into a full-functioning telephone. Soft Phone is a screen-based interface that works just like your telephone keypad. You can make a call, receive a call, and pick up your voicemails too.


Disadvantages of VOIP Connection:
  • One major disadvantage of VOIP is the quality of the sound which can be uneven, and phone calls often have lot of delay with lot of echo. It makes conversation difficult .To get lower bandwidth, the voice compression algorithms and echo cancellation requires additional processing power that makes digital phones more expensive than analog phones.
  • If your cable, DSL or electric power goes out so does your phone line. 
  • No emergency reliability. Maybe you will never need it but if you have to use 911 you have to give exact address and name, they have a hard time tracking where you are and this could cost you valuable seconds.


Please comment if you have any questions or concerns.

Thursday, February 16, 2017

Calculate Time Difference Between Two Clocks in String Format

The other day I was looking for calculating the time difference between two clocks in String format. I could find a better solution, so I wrote a custom one. Take a look at the Java Code below:

   1:  public static String calTimeDifference(String startHour, 
       String startMin, String endHour, String endMin){
   2:   
   3:  String total = "0";     
   4:   
   5:  if (!StringUtils.isEmpty(startHour) && 
       !StringUtils.isEmpty(startMin) && 
       !StringUtils.isEmpty(endHour) && 
       !StringUtils.isEmpty(endMin){
   6:   
   7:   int stHr = Integer.parseInt(startHour) * 60 ;
   8:   
   9:   int stMn = Integer.parseInt(startMin);
  10:   
  11:   int enHr = Integer.parseInt(endHour) * 60 ;
  12:   
  13:   int enMn = Integer.parseInt(endMin);
  14:   
  15:   int startTime = stHr + stMn;
  16:   
  17:   int endTime = enHr + enMn;
  18:   
  19:    if (endTime > startTime){
  20:   
  21:     int durationHr = (endTime - startTime)/60;
  22:   
  23:     int durationMn = (endTime - startTime)%60;
  24:   
  25:     total = Integer.toString(durationHr) + " Hr and "
         + Integer.toString(durationMn) + " Min" ;
  26:   
  27:      }
  28:   
  29:     else{
  30:   
  31:      total = "Ending Time cannot be before Starting Time";
  32:   
  33:      }
  34:   
  35:    }       
  36:   
  37:   return total;
  38:   
  39:  }


The above code should work as long as you keep in mind the pre and post conditions.

Pre-Condition:
This function assumes that all four parameters are present so if even one of them is missing it will return zero.

Post-Condition:
This function will also make sure that the ending time cannot be before the starting time if it is it will return the error message.

Thursday, March 3, 2016

Disabling Default Spring File Extension Response Mapper


The other day I was trying to implement a file download functionality, which takes the filename as a path variable and returns you the uploaded file metadata. In my case file extension was not matching the response type and Spring was throwing this exception below:

 org.springframework.web.HttpMediaTypeNotAcceptableException: Could not find acceptable representation  

The problem was that Spring treats the part after the dot in the url as a file extension and was trying to determine the matching response type and didn't find any matching converter, which result in throwing the above exception.

To solve we can simply disabled the default suffix-based content negotiation and can use the produce annotation to tell Spring what response type should be used.

Code:

1:  @Configuration  
2:  public class ContentNegotiationConfig extends WebMvcConfigurerAdapter {  
3:    @Override  
4:    public void configureContentNegotiation(final ContentNegotiationConfigurer configurer) {  
5:      // Turn off suffix-based content negotiation  
6:      configurer.favorPathExtension(false);  
7:    }  
8:  }  

Note: It is important to use the configuration annotation so this property can be set before starting the spring container.

Saturday, February 6, 2016

Unauthorized Entry Point with Spring Security


Let's say you already have secured your app with spring security but now every time a request comes in and you are not able to authenticate the user and the web server returns a 403 Forbidden exception instead of 401 Unauthorized exception, weird right! Well that's the default behaviour which is not correct logically because:

HTTP 401 Unauthorized Exception is for authentication, means the user is not authenticated by the app, the app doesn't know who the user is, it might be because of bad/missing credentials or wrong username or whatever else but in short the user is not authenticated, so please try again.

HTTP 403 Forbidden Exception is for the protected resource, means the user is authenticated user but he doesn't have the right privileges to access the resource so either ask your administrator to give you the privileges or forget about it simple.

Summarizing above, a 401 Unauthorized response should be used for missing or bad authentication, and a 403 Forbidden response should be used after authenticating the user, so the user is authenticated but isn’t authorized to perform the requested operation on a given resource.

Code:

1:  public class UnauthorizedEntryPoint implements AuthenticationEntryPoint {  
2:    
3:    @Override  
4:    public void commence(HttpServletRequest request, HttpServletResponse response, AuthenticationException authException) throws IOException, ServletException {  
5:    
6:      //log statement if you want to log it to server logs.  
7:      response.sendError(HttpServletResponse.SC_UNAUTHORIZED, "User Authentication cannot be verified, Please log in again with your credentials");  
8:    
9:    }  
10:  }  

Now you need to register this entry point in your spring security web configurer class, like this :

1:  http.exceptionHandling().authenticationEntryPoint(new UnauthorizedEntryPoint());  

Please comment, if you have any questions or concerns.

Monday, January 18, 2016

Rendering View in JavaServer Faces (JSF)


Those who works with JavaServer Faces will agree with me that it's quite a difficult job to clear out the current view if the current view is stuck in validation phase. I came across a scenario in which I need to display errors to client and move forward only with his request if the client has fixed all errors, normal flow, right? But what if the client wants to cancel the first step and wants to forward to the next step without fixing errors. So then in this scenario instead of clearing the errors one by one JSF allows you to create a whole new view by replacing the current view and allows the request to proceed further.

If you need to clear the current view, take a look at this clear function below:

1:   public void createCurrentView()   
2:   {  
3:     FacesContext context = FacesContext.getCurrentInstance();  
4:     Application application = context.getApplication();  
5:     ViewHandler viewHandler = application.getViewHandler();  
6:     UIViewRoot viewRoot =   
7:            viewHandler.createView(context, context.getViewRoot().getViewId());

8:     context.setViewRoot(viewRoot);  
9:     context.renderResponse();  
10:   }  

The above function will try to get the current view from the context, creates a new view and replace the current with the new one in the context.

You should only clear the whole current view in rare cases as creating view again and again might impact your performance and it is also not recommended by industry experts to use it for frequent web flows.

Please share, How it goes!

Wednesday, December 30, 2015

Changing Data Types with Liquibase


The other day I was changing some data types in our schema script and thought of sharing it as it might becomes trickier for some us. I use Liquibase for managing our database schema in groovy format, which is much easier as compared to XML, JSON and YAML formats and Liquibase just recently announced to adopt groovy format as well for writing schema scripts. So let's get started, let's consider this table schema in Liquibase script:

1:  changeSet(id: '1451109624', author: 'wakasmalik') {  
2:      createTable(tableName: 'LiquibaseExample) {  
3:        column(name: 'ID, type: 'NUMBER(19, 0)') {  
4:          constraints(nullable: false)  
5:        }  
6:        column(name: 'ABC', type: 'VARCHAR2(255 CHAR)')  
7:        column(name: 'DEF', type: 'VARCHAR2(255 CHAR)')  
8:        column(name: 'DATE_SAVED', type: 'TIMESTAMP')  
9:        column(name: 'DATE_CREATED', type: 'TIMESTAMP') {  
10:          constraints(nullable: false)  
11:        }  
12:        column(name: 'CREATED_BY', type: 'NUMBER(19, 0)') {  
13:          constraints(nullable: false)  
14:        }  
15:        column(name: 'MODIFIED_BY', type: 'NUMBER(19, 0)') {  
16:          constraints(nullable: false)  
17:        }  
18:      }  
19:    }  
20:    changeSet(id: '14511096241', author: 'wakasmalik') {  
21:      addPrimaryKey(columnNames: 'ID', constraintName: 'primaryKey', tableName: 'LiquibaseExample')  
22:    }  

Every change in Liquibase is added into a changeset. The id of the changeset has to be unique across all the changeset and most importantly it can be run only once on a database. Now let's say we want to change Data Types for these two columns:

  • Column ABC from String to Numeric without any NULL constraint.
  • Column Created_By from Numeric to String along with maintaining the NULL constraint.

Here is the changeset that will performs the above operations:

1:  changeSet(id: '1451273089', author: 'wakasmalik') {  
2:      modifyDataType(tableName: "LiquibaseExample", columnName: "ABC", newDataType: "NUMBER(19, 0)")  
3:      modifyDataType(tableName: "LiquibaseExample", columnName: "CREATED_BY", newDataType: "VARCHAR2(255 CHAR)")  
4:    }  


The above changeset will work fine as long as we don't have data in those two columns or we are fine losing data during conversion process and also the NULL constraint cannot be set on a empty column. These are typical scenarios for development machines and would rarely exists for a testing or production environments. So let's consider not modifying the Data Types instead drop the columns, add the columns, set column default values and then add NULL Constraint in the end.


1:  changeSet(id: '1451365535', author: 'wakasmalik') {  
2:      dropColumn(columnName: 'ABC', tableName: 'LiquibaseExample')  
3:      dropColumn(columnName: 'CREATED_BY', tableName: 'LiquibaseExample')  
4:      addColumn(tableName: 'LiquibaseExample') {  
5:        column(name: 'ABC', type: 'NUMBER(19, 0)')  
6:        column(name: 'CREATED_BY', type: 'VARCHAR2(255 CHAR)')  
7:      }  
8:      sql("UPDATE LiquibaseExample SET ABC = 11111")  
9:      sql("UPDATE LiquibaseExample SET CREATED_BY = '11111'")  
10:     addNotNullConstraint(columnName: 'CREATED_BY', tableName: 'LiquibaseExample')  
11:    }  


You can also use the "defaultValue" attribute to set the default values for a column instead of writing the sql query.
For a complete list of Liquibase supported attributes and examples in different formats, you can visit the Liquibase Documentation Page.

Leave a comment below if you like, dislike or need any help.

Sunday, September 27, 2015

Default Logout with Spring Security

The other day I was trying to implement "logout" functionality for one of my POC using spring security. I couldn't find a better and simple solution for "logout" in spring security as they have it for "login". As we know spring security by default have "formLogin()" built in which will display the login form to the user but it doesn't have anything for logout. So here what I comes up with:

1:  @Configuration  
2:  public class SecurityConfigurerAdapter extends WebSecurityConfigurerAdapter {  
3:       @Override  
4:       protected void configure(HttpSecurity http) throws Exception {  
5:            http  
6:                      .csrf()  
7:                      .disable()  
8:                      .and()  
9:                      .authorizeRequests()  
10:                    .anyRequest()  
11:                    .authenticated()  
12:                    .and()  
13:                    .formLogin()  
14:                    .permitAll()  
15:                    .and()  
16:                    .logout()  
17:                    .deleteCookies("remove")  
18:                    .invalidateHttpSession(false)  
19:                    .logoutRequestMatcher(new AntPathRequestMatcher("/logout"))  
20:                    .logoutSuccessUrl("/login");  
21:       }  

How this works:

Just type "logout" in header address bar and it will delete any user session cookies that spring security creates it by default, invalidates the user session and takes the user back to the default login page. Actually in the backend spring will look for any logout requests made and map it to the default login page after logging out the user. Isn't this simple and cool?

Please comment if you need any help implementing this functionality.

Monday, March 9, 2015

Flappy Andy

If I remember correctly at the time of Android Lollipop release, I read somewhere that Google had contacted the Flappy Bird game developer, may be to buy out Flappy Bird or may be something else who knows. It's a Google product so it was kept secret but not anymore as I found this easter egg the other day. 


http://wakasmalik.blogspot.com/2015/03/flappy-andy.html
Flappy Andy

   It is a flappy bird style game integrated into the new Android Lollipop version but hold on it is hidden, follow these steps on your android device for playing:

  1. Go to your phone settings tab.
  2. Select "About Phone" option.
  3. Scroll down to "Android version" and make sure you have 5.0.1 (Lollipop).
  4. Keep on tapping "Android version" until you see a lollipop appearing on your screen. 
  5. If it is small lollipop tap on it once more to make it bigger with lollipop written in it otherwise you can skip this step.
  6. At this point by every tap this lollipop is going to change its color. 
  7. Now watch this lollipop carefully and notice a smaller circle within the top left corner.
  8. Finally tap and hold into this circle until you see flappy andy game starting up.

It is pretty much similar to flappy bird but much harder, try your luck and don't forget to share your score below in the comments section.


Tuesday, February 17, 2015

Largest Product of Four Numbers in Grid

The other day I came across Project Euler and find it interesting especially it's Problem 11

Problem Statement:

In the 20×20 grid below, four numbers along a diagonal line have been marked in red.

08 02 22 97 38 15 00 40 00 75 04 05 07 78 52 12 50 77 91 08
49 49 99 40 17 81 18 57 60 87 17 40 98 43 69 48 04 56 62 00
81 49 31 73 55 79 14 29 93 71 40 67 53 88 30 03 49 13 36 65
52 70 95 23 04 60 11 42 69 24 68 56 01 32 56 71 37 02 36 91
22 31 16 71 51 67 63 89 41 92 36 54 22 40 40 28 66 33 13 80
24 47 32 60 99 03 45 02 44 75 33 53 78 36 84 20 35 17 12 50
32 98 81 28 64 23 67 10 26 38 40 67 59 54 70 66 18 38 64 70
67 26 20 68 02 62 12 20 95 63 94 39 63 08 40 91 66 49 94 21
24 55 58 05 66 73 99 26 97 17 78 78 96 83 14 88 34 89 63 72
21 36 23 09 75 00 76 44 20 45 35 14 00 61 33 97 34 31 33 95
78 17 53 28 22 75 31 67 15 94 03 80 04 62 16 14 09 53 56 92
16 39 05 42 96 35 31 47 55 58 88 24 00 17 54 24 36 29 85 57
86 56 00 48 35 71 89 07 05 44 44 37 44 60 21 58 51 54 17 58
19 80 81 68 05 94 47 69 28 73 92 13 86 52 17 77 04 89 55 40
04 52 08 83 97 35 99 16 07 97 57 32 16 26 26 79 33 27 98 66
88 36 68 87 57 62 20 72 03 46 33 67 46 55 12 32 63 93 53 69
04 42 16 73 38 25 39 11 24 94 72 18 08 46 29 32 40 62 76 36
20 69 36 41 72 30 23 88 34 62 99 69 82 67 59 85 74 04 36 16
20 73 35 29 78 31 90 01 74 31 49 71 48 86 81 16 23 57 05 54
01 70 54 71 83 51 54 69 16 92 33 48 61 43 52 01 89 19 67 48

The product of these numbers is 26 × 63 × 78 × 14 = 1788696.

What is the greatest product of four adjacent numbers in the same direction (up, down, left, right, or diagonally) in the 20×20 grid?

Solution:

Here is what I come up in two hours , this definitely can be improved more but I am now done, you are welcomed to improve it :-0)

1:  /**  
2:   * Created by Waqas on 1/14/2015.  
3:   */  
4:  public class Problem_Eleven {  
5:    
6:    public static void main(String [] args){  
7:    
8:      int numbersArray [][] = readNumberArray();  
9:      int largestProductOfFourAdjNumbers = 0;  
10:      int actualNumbers[] = new int[4];  
11:      boolean isDiagonal = false;  
12:    
13:      for(int i = 0; i < 20; i++){  
14:        for(int j = 0; j < 17; j++){  
15:          int product = getProductOfFourNumbers(numbersArray[i][j], numbersArray[i][j + 1], numbersArray[i][j + 2], numbersArray[i][j + 3]);  
16:    
17:          if(largestProduct(product, largestProductOfFourAdjNumbers))  
18:          {  
19:            largestProductOfFourAdjNumbers = product;  
20:    
21:            actualNumbers[0] = numbersArray[i][j];  
22:            actualNumbers[1] = numbersArray[i][j + 1];  
23:            actualNumbers[2] = numbersArray[i][j + 2];  
24:            actualNumbers[3] = numbersArray[i][j + 3];  
25:    
26:            isDiagonal = false;  
27:          }  
28:        }  
29:      }  
30:    
31:      for(int i = 0; i < 17; i ++){  
32:        for(int j = 0; j < 20; j++){  
33:          int product = getProductOfFourNumbers(numbersArray[i][j], numbersArray[i + 1][j], numbersArray[i + 2][j], numbersArray[i + 3][j]);  
34:    
35:          if(largestProduct(product, largestProductOfFourAdjNumbers))  
36:          {  
37:            largestProductOfFourAdjNumbers = product;  
38:    
39:            actualNumbers[0] = numbersArray[i][j];  
40:            actualNumbers[1] = numbersArray[i + 1][j];  
41:            actualNumbers[2] = numbersArray[i + 2][j];  
42:            actualNumbers[3] = numbersArray[i + 3][j];  
43:    
44:            isDiagonal = false;  
45:          }  
46:        }  
47:      }  
48:    
49:      for(int i = 0; i < 17; i++){  
50:        for(int j = 0; j < 17; j++){  
51:          int product = getProductOfFourNumbers(numbersArray[i][j],numbersArray[i + 1][j + 1],numbersArray[i + 2][j + 2], numbersArray[i + 3][i + 3]);  
52:    
53:          if(largestProduct(product, largestProductOfFourAdjNumbers))  
54:          {  
55:            largestProductOfFourAdjNumbers = product;  
56:    
57:            actualNumbers[0] = numbersArray[i][j];  
58:            actualNumbers[1] = numbersArray[i + 1][j + 1];  
59:            actualNumbers[2] = numbersArray[i + 2][j + 2];  
60:            actualNumbers[3] = numbersArray[i + 3][i + 3];  
61:    
62:            isDiagonal = true;  
63:          }  
64:        }  
65:      }  
66:    
67:      for(int i = 0; i < 17; i ++){  
68:        for(int j = 3; j < 20; j ++){  
69:          int product = getProductOfFourNumbers(numbersArray[i][j],numbersArray[i + 1][j - 1],numbersArray[i + 2][j - 2],numbersArray[i + 3][j - 3]);  
70:    
71:          if(largestProduct(product, largestProductOfFourAdjNumbers))  
72:          {  
73:            largestProductOfFourAdjNumbers = product;  
74:    
75:            actualNumbers[0] = numbersArray[i][j];  
76:            actualNumbers[1] = numbersArray[i + 1][j - 1];  
77:            actualNumbers[2] = numbersArray[i + 2][j - 2];  
78:            actualNumbers[3] = numbersArray[i + 3][j - 3];  
79:    
80:            isDiagonal = true;  
81:          }  
82:        }  
83:      }  
84:    
85:      System.out.format("Max Product of these %d * %d * %d * %d four Numbers = %d",actualNumbers[0],actualNumbers[1],actualNumbers[2],actualNumbers[3],largestProductOfFourAdjNumbers);  
86:    
87:      if (isDiagonal) {  
88:        System.out.print(". And these numbers are diagonal to each other");  
89:      } else {  
90:        System.out.print(". And these numbers are adjacent to each other");  
91:      }  
92:    }  
93:    
94:    private static int getProductOfFourNumbers(int one, int two, int three, int four){  
95:      return one * two * three * four;  
96:    }  
97:    
98:    private static boolean largestProduct(int product, int largestNumberProduct){  
99:      if(product > largestNumberProduct)  
100:        return true;  
101:      else  
102:        return false;  
103:    }  
104:    
105:    private static int[][] readNumberArray()  
106:    {  
107:      return new int [][] {  
108:          {8,02,22,97,38,15,00,40,00,75,04,05,07,78,52,12,50,77,91,8},  
109:          {49,49,99,40,17,81,18,57,60,87,17,40,98,43,69,48,04,56,62,00},  
110:          {81,49,31,73,55,79,14,29,93,71,40,67,53,88,30,03,49,13,36,65},  
111:          {52,70,95,23,04,60,11,42,69,24,68,56,01,32,56,71,37,02,36,91},  
112:          {22,31,16,71,51,67,63,89,41,92,36,54,22,40,40,28,66,33,13,80},  
113:          {24,47,32,60,99,03,45,02,44,75,33,53,78,36,84,20,35,17,12,50},  
114:          {32,98,81,28,64,23,67,10,26,38,40,67,59,54,70,66,18,38,64,70},  
115:          {67,26,20,68,02,62,12,20,95,63,94,39,63,8,40,91,66,49,94,21},  
116:          {24,55,58,05,66,73,99,26,97,17,78,78,96,83,14,88,34,89,63,72},  
117:          {21,36,23,9,75,00,76,44,20,45,35,14,00,61,33,97,34,31,33,95},  
118:          {78,17,53,28,22,75,31,67,15,94,03,80,04,62,16,14,9,53,56,92},  
119:          {16,39,05,42,96,35,31,47,55,58,88,24,00,17,54,24,36,29,85,57},  
120:          {86,56,00,48,35,71,89,07,05,44,44,37,44,60,21,58,51,54,17,58},  
121:          {19,80,81,68,05,94,47,69,28,73,92,13,86,52,17,77,04,89,55,40},  
122:          {04,52,8,83,97,35,99,16,07,97,57,32,16,26,26,79,33,27,98,66},  
123:          {88,36,68,87,57,62,20,72,03,46,33,67,46,55,12,32,63,93,53,69},  
124:          {04,42,16,73,38,25,39,11,24,94,72,18,8,46,29,32,40,62,76,36},  
125:          {20,69,36,41,72,30,23,88,34,62,99,69,82,67,59,85,74,04,36,16},  
126:          {20,73,35,29,78,31,90,01,74,31,49,71,48,86,81,16,23,57,05,54},  
127:          {01,70,54,71,83,51,54,69,16,92,33,48,61,43,52,01,89,19,67,48}  
128:      };  
129:    
130:    }  
131:  }  
132:    


Any Suggestion, Comments?

Sunday, February 8, 2015

Why is 'x' the unknown?

Since my childhood I was always wondering when, how and why only this x is unknown. Why we always to have to find its value every time ? Why not y, z or any other alphabets? If you are confused to then watch this video may be it will help you also to clear your thoughts as well.

 

 Any thoughts, Comments or Questions?

Monday, April 9, 2012

The 10/20/30 Rule


Guy Kawasaki is a Venture Capitalist from California who survived the dotcom bubble bursting and has been very successful.  He says that a good presentation should:
          Have 10 slides
          Last no more then 20 minutes
          Contain no font smaller then 30 point
He also said that big concerns to Venture Capitalists are the market, the problem and solution, and the underlying magic.  In other words, VC’s don’t understand or want to know every detail.

Sunday, January 29, 2012

How to remove Google Redirect Virus (GRV)?

Just a few days back I saw a weird problem in my computer, whenever I googled something and try to click any search link it always redirects me to a different page. For sure, that’s a virus but now how to remove as search result links takes me somewhere else. Even Bing or Yahoo doesn’t come to rescue. Hmm, that’s Google Redirect Virus (GRV).

Symptoms:

The main symptom of the GRV is that clicking on a Google search result link will take you to another unrelated website. It doesn’t matter which search link you click and it doesn’t matter which browser you use for searching. How can you get it? Unfortunately, it’s not very difficult. If you accidentally (or even purposely) visit a malicious or infected website, and if you don’t have the necessary anti-virus protection on your computer, you can get it.

But unlike most cases of malware, this virus embeds itself deeper into your system and requires more than a simple malware scan.

How to remove it?

Did a lot of research and believe me there were so many solutions available (some say malware byte, some say TDSSKiller) will remove but none of them work. Hmm, finally found fixTDSS.exe

Simply download fixTDSS.exe and run it. After the program initializes, click on the Proceed button to start the scan. The program will look for potential problems and fix them if necessary. A reboot may be required.

Is fixTDSS.exe Safe?

It’s written by Symantec, the makers of Norton antivirus and also the above downloadable link will download the file from Symantec’s website directly.

Important Warning

fixTDSS.exe has some conflicts with windows 7 so you have to reinstall or recover your operating system from the recovery disk. Restoring it to an earlier point or reinstalling windows from one of the images stored on your local hard disk is not going to work, so make sure you have the recovery disk for your operating system.

Any comments or suggestions are always welcomed.

Sunday, February 27, 2011

AJAX Introduction

AJAX allows every element within a Web interface to be individually and quickly updated without affecting the rest of the interface. This, of course, is not what most Web users are accustomed to. Initiating an action within most Web sites triggers the inevitable blank screen and page loading process. Though not very responsive, the full-page update makes it very clear to users that their action has resulted in a reaction and that a response will be available as soon as the page is refreshed. Because AJAX-based updates are very fast and incremental (often affecting only a small portion of the UI), users may not notice them -especially when they are used to seeing full-page rewrites.

ajaxEngine

Sunday, October 10, 2010

ATM Flowchart

One of the basic step before coding is creating the flowchart. A flowchart is a type of diagram, that represents an algorithm or process, showing the steps as boxes of various kinds, and their order by connecting these with arrows. A flowchart will give you a step-by-step solution to a given problem. So lets consider an ATM transaction today.

Scenario: The customer goes to a ATM machine and insert his ATM/Debit, enters his pin number, do his transaction, which can be withdrawal, deposit or just a simple balance check query, get his card back and left.

ATM’s Perspective: ATM/Debit card is inserted, the ATM validates the validity of the account associated and pin with the card, once the account is validated the ATM receives the account information, and then processes the customer’s request, if that’s valid again. At the end if there is no more requests coming from customer, returns the card.

Lets put these word in a Flowchart now as we have already analyzed the whole scenario:

ATMFlowChart

Any comments or suggestions are most welcome.

Monday, September 6, 2010

Tips for Improving Wireless Network

If Windows ever notifies you about a weak signal, it probably means your connection isn't as fast or as reliable as it could be. Worse, you might lose your connection entirely in some parts of your home. If you're looking to improve the signal for your wireless network, try some of these tips for extending your wireless range and improving your wireless network performance.

  1. Position your wireless router (or wireless access point) in a central location. router placement

    If your wireless router is against an outside wall of your home, the signal will be weak on the other side of your home. Don't worry if you can't move your wireless router, because there are many other ways to improve your connection.

  2. Move the router off the floor and away from walls and metal objects (such as metal file cabinets).

    Metal, walls, and floors will interfere with your router's wireless signals. The closer your router is to these obstructions, the more severe the interference, and the weaker your connection will be.

  3. Replace your router's antenna.

    The antennas supplied with your router are designed to be Omni-directional, meaning they broadcast in all directions around the router. If your router is near an outside wall, half of the wireless signals will be sent outsidantenna e your home, and much of your router's power will be wasted. Most routers don't allow you to increase the power output, but you can make better use of the power. Upgrade to a hi-gain antenna that focuses the wireless signals only one direction. You can aim the signal in the direction you need it most.

  4. Replace your computer's wireless network adapter.

    Wireless network signals must be sent both to and from your computer. Sometimes, your router can broadcast strongly enough to reach your computer, but your computer can't send signals back to your router. To improve this, replace your laptop's PC card-based wireless network adapter with a USB network adapter that uses an external antenna. In particular, consider the Hawking Hi-Gain Wireless USB network adapter, which adds an external, hi-gain antenna to your computer and can significantly improve your range. Laptops with built-in wireless typically have excellent antennas and don't need to have their network adapters upgraded.

  5. Add a wireless repeater.

    Wireless repeaters extend your wirelesswireless repeater network range without requiring you to add any wiring. Just place the wireless repeater halfway between your wireless access point and your computer, and you'll get an instant boost to your wireless signal strength. Check out the wireless repeaters from View Sonic, D-Link, Linksys, and Buffalo Technology.

  6. Change your wireless channel.

    Wireless routers can broadcast on several different channels, similar to the way radio stations use different channels. In the United States and Canada, these channels are 1, 6, and 11. Just like you'll sometimes hear interference on one radio station while another is perfectly clear, sometimes one wireless channel is clearer than others. Try changing your wireless router's channel through your router's configuration page to see if your signal strength improves. You don't need to change your computer's configuration, because it'll automatically detect the new channel.

  7. Reduce wireless interference.

    If you have cordless phones or other wireless electronics in your home, your computer might not be able to "hear" your router over the noise from the other wireless devices. To quiet the noise, avoid wireless electronics that use the 2.4GHz frequency. Instead, look for cordless phones that use the 5.8GHz or 900MHz frequencies.

  8. Update your firmware or your network adapter driver.

    Router manufacturers regularly make free improvements to their routers. Sometimes, these improvements increase performance. To get the latest firmware updates for your router, visit your router manufacturer's website. Similarly, network adapter vendors occasionally update the software that Windows uses to communicate with your network adapter, known as the driver. These updates typically improve performance and reliability. To get the driver updates, do the following:

    • Windows 7 and Windows Vista: Click Start menu, click All Programs, and then click Windows Update. In the left pane, click Check for updates, and then wait while Windows Vista looks for the latest updates for your computer and install any updates relating to your wireless network adapter.

    • Windows XP: Visit Microsoft Update, click Custom, and then wait while Windows XP looks for the latest updates for your computer and install any updates relating to your wireless adapter.

  9. Pick equipment from a single vendor.

    While a Linksys router will work with a D-Link network adapter, you often get better performance if you pick a router and network adapter from the same vendor. Some vendors offer a performance boost of up to twice the performance when you choose their hardware: Linksys has the Speed Booster technology, and D-Link has the 108G enhancement.

  10. Upgrade 802.11b devices to 802.11g.

    802.11b is the most common type of wireless network, but 802.11g is about five times faster. 802.11g is backward-compatible with 802.11b, so you can still use any 802.11b equipment that you have. If you're using 802.11b and you're unhappy with the performance, consider replacing your router and network adapters with 802.11g-compatible equipment. If you're buying new equipment, definitely choose 802.11g. Wireless networks never reach the theoretical bandwidth limits. 802.11b networks typically get 2-5Mbps. 802.11g is usually in the 13-23Mbps range. Belkin's Pre-N equipment has been measured at 37-42Mbps.

Thanks for sharing this info with me.

Sunday, May 16, 2010

Revising C++

I happened to explore the NIST's SAMATE database for insecure code over this weekend. The NIST SAMATE project is collecting examples of vulnerable code. It is designed to be used to "provide users, researchers, and software security assurance tool developers with a set of known security flaws.

Here is what I picked up:

1.    int main(int argc, char *argv[])
2.    {
3.      int loop_counter;
4.      char buf[10];
5.      for(loop_counter = 0; ; loop_counter++)
6.      {
7.        if (loop_counter > 4105) break;
8.        /*  BAD  */
9.        buf[4105] = 'A';
10.      }    
11.      return 0;
16.    }

So let’s start with problems in this code first.

Problems:

1. The first one is the breaking condition is placed in the middle of the loop although this will not create any runtime or compile time error but still it is not considered a good programming practice.

2. Terminating loop with break.

3. Assigning the value ‘A’ to a memory location outside the initialized space, which could result in a unexpected behavior of the program.

Solutions:

1. We can store the value ‘A’ on the buf’s reserved memory location (like from buf[0] to buf[9]) then we are able to see a defined behavior of this code. So if we replace the line buf[4105] = ‘A’; with buf[9] = ‘A’ then this code should run fine without any unexpected output, but it could substantially change the meaning of the code.

2. Another possible solution would be to increase the size of the char buf to a value bigger than 4105. This change would likely have been closest to the programmers original intention.

Are there anymore problems or solutions? Please share with me.

Sunday, March 21, 2010

Detailed Block Diagram-24 Hour Clock

I need 15 flip flops to divide the clock crystal frequency to make it a 1 and then it will go to the input of the first decade counter which will count up to 9 and it will reset itself after 9 and when it is resetting itself that input will go to next counter of the minutes part which will count up to 6 and that will be the input for the next counter which is the first one in the hour part this counter will count up to 3 and resets itself at 4 which will become the input for the next and last counter which count up to 2 as this circuit is for the 24 hour clock.

24 Hour Clock Block Diagram

 

Sunday, January 24, 2010

Arithmetic Logic Unit (ALU)

An arithmetic logic unit is a combinational logic circuit used to perform arithmetic and logic operations. The ALU has a number of selection lines to determine the operations to be performed. These selection lines are decoded within the ALU circuitry so that ‘N’ selection lines can select up to 2(power N) operations. Most common operations of ALU are addition, subtraction and comparison of bits.

Finally, I have completed its design architecture.

 ALU

Detailed Block Diagram of the ALU.

Monday, January 4, 2010

Mason Recognized in Top 100 of Academic Ranking of World Universities

By Catherine Ferraro

For the second year in a row, Mason was ranked as one of the top 100 North and Latin American universities by the Academic Ranking of World Universities. The analysis is conducted annually by Shanghai Jiao Tong University’s Institute of Higher Education.

Results can be found on the institute’s web site.

Universities are ranked by several indicators of academic or research performance. These include the number of alumni and staff members who have won Nobel Prizes or Fields Medals; the prevalence of highly cited researchers; the number of faculty articles published in the journals Nature and Science; and the frequency with which articles are indexed in major citations indices. The per capita academic performance of an institution is also considered.

“Mason is honored to be recognized for a second year in a row by Shanghai Jiao Tong University’s Academic Ranking of World Universities,” says Mason Provost Peter Stearns.

“This is an illustration of how committed Mason is to strengthening its relationships and boosting its global reputation with universities in the United States and abroad.”

As an institution that has made global education a priority, Mason offers a wide range of academic programs, from undergraduate degrees in global affairs and global and environmental change to doctoral programs in climate dynamics and other fields that foster global understanding. Several programs also require global residencies in which students learn how to live and work in a global society.

The university has also established research and educational collaborations abroad that provide opportunities for students and faculty members to work outside of the United States, participate in international research initiatives and address social issues around the world.

For example, the Sino-America 1+2+1 dual degree program, which Mason joined in 2004, is an international education initiative that brings American and Chinese universities together to offer dual degrees to Chinese undergraduate students.

In the program, students spend their freshman year at a Chinese university, their sophomore and junior years at an American university and their senior year back at their original university in China. After completing the program, students receive baccalaureate degrees from both schools.

The first 15 graduates of Mason’s 1+2+1 program received undergraduate degrees at a graduation ceremony in China in summer 2008, followed by 25 more students in summer 2009. Currently, there are approximately 90 students in the program in their second and third years of study.

Mason also provides its students opportunities to study almost anywhere in the world through its Center for Global Education. The center offers short-term, semester and yearlong honors study abroad; international internships; and intensive language programs in Asia, Africa, Europe, the Middle East, South America and the South Pacific.

Through Mason’s numerous centers and institutes, faculty members and students are working on some of the most pressing issues around the globe, including conflict analysis and resolution, Earth observing and space research, health policy research and international education.

Article Link : http://news.gmu.edu/articles/1173

Academic Ranking of World Universities – 2009 List : http://www.arwu.org/Americas2009.jsp