Skip to content

Instantly share code, notes, and snippets.

@struts2spring
struts2spring / git_commands.md
Created January 25, 2021 19:51
10 Git Tricks to Save Your Time and Efforts
  1. Checkout a single file from another branch

git checkout some-other-branch -- yarn.lock

  1. View the log without merge commits

git log --oneline --no-merges

  1. Rewrite your last commit message git commit -v --amend
@struts2spring
struts2spring / sublime_shortkey
Created July 15, 2014 15:06
Custom & Eclipse shortcuts key bindings for Sublime Text 2
[
{ "keys": ["f12"], "command": "htmlprettify"},
{ "keys": ["f1"], "command": "fold" },
{ "keys": ["f2"], "command": "unfold" },
{ "keys": ["ctrl+l"], "command": "show_overlay", "args": {"overlay": "goto", "text": "@"} },
{ "keys": ["ctrl+space"], "command": "auto_complete" },
{ "keys": ["ctrl+space"], "command": "replace_completion_with_auto_complete", "context":
[
{ "key": "last_command", "operator": "equal", "operand": "insert_best_completion" },
@struts2spring
struts2spring / tips
Created July 14, 2014 05:07
View Only Headers with Curl
curl -v -s http://awesome-site.com 1> /dev/null
@struts2spring
struts2spring / Spring_Controller_and_ViewResolver.md
Last active August 29, 2015 14:02
Spring Controller and ViewResolver

#Spring Controller and ViewResolver

In This tutorial we look at the Controllers and View Resolvers.

###Controller

The DispatcherServlet receives request and then passes on the request to the appropriate Controller. The base Controller interface receives HttpServletRequest and HttpServletResponse. Controllers are like struts Action. The implementation of Controller should be a thread safe class that can handle multiple Http Requests. The Controller implementations are generally JavaBeans. The Controller returns a ModelAndView instance. Spring comes bundled with Some Controllers that provide basic functionalities.

####AbstractUrlViewController This returns a view name based on the request URL. MultiActionController - Allows multiple request types to be handled by the same class. When the class returns a Map the configured RequestToViewNameTranslator will be used to get the view name. When return type is void the handler method is responsible for writing directly to the response. A string return value indic

@struts2spring
struts2spring / java_interview_question1.md
Last active December 29, 2015 15:59
java interview question One

1. What is immutable object in Java? Can you change values of a immutable object?

A Java object is considered immutable when its state cannot change after it is created. Use of immutable objects is widely accepted as a sound strategy for creating simple, reliable code. Immutable objects are particularly useful in concurrent applications. Since they cannot change state, they cannot be corrupted by thread interference or observed in an inconsistent state. java.lang.String and java.lang.Integer classes are the Examples of immutable objects from the Java Development Kit. Immutable objects simplify your program due to following characteristics :

Immutable objects are simple to use test and construct. Immutable objects are automatically thread-safe. Immutable objects do not require a copy constructor. Immutable objects do not require an implementation of clone. Immutable objects allow hashCode to use lazy initialization, and to cache its return value. Immutable objects do not need to be copied defensively when

@struts2spring
struts2spring / Multi-Threading_interviewQuestion.txt
Created November 28, 2013 05:18
Multithreading or Concurrency is one of the popular topic in java interview questions. Here I am listing down most of the important questions from interview perspective, but you should have good knowledge on java threads to deal with follow up questions.
Java Multi-Threading Interview Questions
What is the difference between Process and Thread?
What are the benefits of multi-threaded programming?
What is difference between user Thread and daemon Thread?
How can we create a Thread in Java?
What are different states in lifecycle of Thread?
Can we call run() method of a Thread class?
How can we pause the execution of a Thread for specific time?
What do you understand about Thread Priority?
@struts2spring
struts2spring / blackjack.py
Created November 24, 2013 13:14
Blackjack is a simple, popular card game that is played in many casinos. Cards in Blackjack have the following values: an ace may be valued as either 1 or 11 (player's choice), face cards (kings, queens and jacks) are valued at 10 and the value of the remaining cards corresponds to their number. During a round of Blackjack, the players plays aga…
#http://www.codeskulptor.org/#user25_DRIZbYlzBq_16.py
# Mini-project #6 - Blackjack
import simplegui
import random
# load card sprite - 949x392 - source: jfitz.com
CARD_SIZE = (73, 98)
CARD_CENTER = (36.5, 49)
card_images = simplegui.load_image("http://commondatastorage.googleapis.com/codeskulptor-assets/cards.jfitz.png")
@struts2spring
struts2spring / 10. RemoteServiceServletextends
Last active July 10, 2019 21:58
GWT interview Questions
public class RemoteServiceServletextends javax.servlet.http.HttpServletimplements SerializationPolicyProvider
The servlet base class for your RPC service implementations that automatically deserializes incoming requests from the client and serializes outgoing responses for client/server RPCs.
@struts2spring
struts2spring / question_1.txt
Created November 20, 2013 03:38
Convert the following English description into code.
Question:
Convert the following English description into code.
1. Initialize n to be 1000. Initialize numbers to be a list of numbers from 2 to n, but not including n.
2. With results starting as the empty list, repeat the following as long as numbers contains any numbers.
2.1. Add the first number in numbers to the end of results.
2.2. Remove every number in numbers that is evenly divisible by (has no remainder when divided by) the number that you had just added to results.
How long is results?
To test your code, when n is instead 100, the length of results is 25.