Day today findings in work.
I thought of placing small findings which bugged while working in day to day life. I think it may help me and others in future, so that i don't repeat same mistake again.
- As per Javadoc,
System.lineSeparator()
doesn't exists in java < 7. Use System.getProperty("line.separator") of java <= 6 . - For SOAP request/response to have namespace prefix , WSDL should be designed properly
a) Use elementFormDefault="qualified" in <schema> tag in WSDL
b) Donot use anonymous types in schema definition in
WSDL(avoid-anonymous-types)
c) To make custom prefix: update generated package-info.java
XmlSchema(elementFormDefault=XmlNsForm.QUALIFIED, namespace="http://www.example.com/FOO", xmlns={@XmlNs(prefix="bar", namespaceURI="http://www.example.com/BAR")} )
3. If you want to change Environment variable without admin rights, the use this
command:
rundll32 sysdm.cpl,EditEnvironmentVariables
4. Install python without admin rights : Execute this way:
C:\development\apps>msiexec /a python-2.7.12.msi /qb
TARGETDIR=C:\Development\apps\python_2.7.12
5. Set proxy for npm command: use %40 for @
$ npm config set proxy http://username:password@hostname:port
6. Set proxy for git command:
$ git config --global http.proxy http://proxyuser:proxypwd@proxy.server.com:port
$ git config --global https.proxy https://proxyuser:proxypwd@proxy.server.com:port
7. Remote debug using eclipse Tomcat.
a) create/update file setenv.bat in {TOMCAT_HOME}/bin.
b) add CATALINA_OPTS="-Xdebug - Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=n" in setenv.bat file.
c)save the file and close.
d)run the server from command prompt using this command : catalina.bat jpda start
e.g, : C:\software\apache-tomcat-7.0.53-windows-x64\apache-tomcat-7.0.53\bin>catalina.bat jpda start
e) Go to Eclipse and open debug configuration and create remote java application. use the hostname and port which used in setenv.bat file.
f)click on debug to start in debug mode.
8. Opening windows command prompt from Windows Explorer.
a) Open the Windows explorer with your directory location. Go to address bar and type cmd and hit enter. It will open up the CMD for you.
b) Open the Windows explorer with your directory location. select Shift and right click , select the option 'Open command window here.'. It will open uo the CMD for you.
Using PatriciaTrie
(http://commons.apache.org/proper/commons-collections/apidocs/org/apache/commons/collections4/trie/PatriciaTrie.html)
public static void main(String[]
args) {
Map<String, Student> stdMap = new LinkedHashMap<String, Student>();
/* Load your
regualr map with data */
Student std1 = new Student();
std1.setName("Raj");
std1.setRoll("23");
stdMap.put("Raj ", std1);
Student std2 = new Student();
Std2.setName("Rak");
Std2.setRoll("22");
stdMap.put("Ra ", std2);
Student std3 = new Student();
Std3.setName("Raop");
Std3.setRoll("2");
stdMap.put("Raop", std3);
Student std4 = new Student();
Std4.setName("Pat");
Std4.setRoll("4");
stdMap.put("Pat ", std4);
Student std5 = new Student();
Std5.setName("kalo");
Std5.setRoll("34");
stdMap.put("kalo", std5);
/* PatriciaTrie map*/
PatriciaTrie<Student> stdMapTrie = new PatriciaTrie<Student>(stdMap);
/*SortedMap<String,
Student> entries1 = stdMapTrie.prefixMap("Ra");
System.out.println(entries1);
SortedMap<String, Student>
entries2 = stdMapTrie.headMap("ak");
System.out.println(entries2);
SortedMap<String, Student>
entries3 = stdMapTrie.subMap("", "47");
System.out.println(entries3);
SortedMap<String, Student>
entries4 = stdMapTrie.tailMap("00");
System.out.println(entries4);*/
//Entry<String,
Student> entries5 = stdMapTrie.select("5600");
//System.out.println(entries5.getValue().getSTD());
//
}
https://github.com/sanjar/Day_Today/tree/master/apiinpractice
--> npm install --save @ng-bootstrap/ng-bootstrap
Don't forget to include NgbModule in app.module.ts imports section.
10. To know proxy setting using Chrome:
---> chrome://net-internals/#proxy
11. Setting global proxy in CentOS for YUM downloads:
---> Add following in /etc/yum.conf file
# The proxy server - proxy server:port number
proxy=http://mycache.mydomain.com:3128
# The account details for yum connections
proxy_username=yum-user
proxy_password=qwerty
12. I solved the issue of proxy setting in Windows docker tool box by modifying config.json
C:\Users\<username>\.docker\machine\machines\default\
config.json
Put the proxy setting in HostOptions -> EngineOptions
"Env": [ "HTTP_PROXY=http://APAC\\\\username:password@proxy-url:port/", "HTTPS_PROXY=https://APAC\\\\username:password@proxy-url:port/" ],
Then run this command to get it updated:
docker-machine provision
13. Sparse checkout git.
There are multiple ways to checkout only a portion of repository from git. Here one i find easy one. Run this in git bash.
git init
git remote add origin <url>
git config core.sparsecheckout true
echo "inner_folder/*" >> .git/info/sparse-checkout
git pull --depth=1 origin master
14. In Java , if i do a split on a string using some delimiter then, it does not consider the empty portion at the end after delimiter.
Eg:
String[] s = "hello;world;".split(";");
System.out.println(s);
Developer Expected output: [hello, world, ]
Actual output: [hello, world]
To get the actual developer expected output, split method has to be overloaded.
Eg:
String[] s = "hello;world;".split(";");
System.out.println(s);
Developer Expected output: [hello, world, ]
Actual output: [hello, world]
To get the actual developer expected output, split method has to be overloaded.
String[] s = "hello;world;".split(";",-1);
System.out.println(s);
15. How to know the Browser details using javascript?
Ans: In Javascript there is an object called navigator, which has got some variable which gives information about browser you are in. Keep in mind that every new version of browser may have different pattern of informations.
- navigator.userAgent
- navigator.appVersion
- navigator.appName
- navigator.appCodeName
- navigator.platform
16. In Github, if credential prompt is not coming, run this command in command line in windows.
- git config --system credential.helper store
17. Setting proxy for Pip (python) :
- use --proxy http://<proxy_url>:<port> along with pip install command
- set http_proxy and https_proxy in env or command prompt. Format would be : http://username:password@proxyAddress:port
18. If you want to update/reset your git credentials or any other credentials in windows 10, here is the quick way.
Control Panel --> User Accounts --> Credential Manager --> Windows Credentials.
19. Kill Process associated with a Port No in windows
1. Run this in cmd : netstat -ano | findstr :<PORT_NUMBER> jlkjlk
2. Execute this with your pid which you get from step 1: taskkill /PID <processid> /F ;
19. Kill Process associated with a Port No in windows
1. Run this in cmd : netstat -ano | findstr :<PORT_NUMBER> jlkjlk
2. Execute this with your pid which you get from step 1: taskkill /PID <processid> /F ;
20. Reverting pushed code in git remote repo:
# To revert the changes pushed in remote repo with history
>git reset --hard <commit-id>
>git push -f
# To revert the changes pushed in remote repo keeping the history:
>git revert <commit-id> or git revert -m 1 <commit-id> (if its merge commit)
Good reference:
https://christoph.ruegg.name/blog/git-howto-revert-a-commit-already-pushed-to-a-remote-reposit.html
This comment has been removed by the author.
ReplyDelete
ReplyDeleteHi, Great.. Tutorial is just awesome..It is really helpful for a newbie like me.. I am a regular follower of your blog. Really very informative post you shared here. Kindly keep blogging.
angularjs-Training in velachery
angularjs-Training in annanagar
angularjs Training in chennai
angularjs Training in chennai
Outstanding blog post, I have marked your site so ideally I’ll see much more on this subject in the foreseeable future.
ReplyDeletepython training Course in chennai | python training in Bangalore | Python training institute in kalyan nagar
A universal message I suppose, not giving up is the formula for success I think. Some things take longer than others to accomplish, so people must understand that they should have their eyes on the goal, and that should keep them motivated to see it out til the end.
ReplyDeleteJava training in Chennai | Java training in Bangalore
Java online training | Java training in Pune
I am really impressed with your efforts and really pleased to visit this post.
ReplyDeleteData Science Course in Indira nagar | Data Science Course in Electronic city
Python course in Kalyan nagar | Data Science course in Indira nagar
Data Science Course in Marathahalli | Data Science Course in BTM Layout
I would really like to read some personal experiences like the way, you've explained through the above article. I'm glad for your achievements and would probably like to see much more in the near future. Thanks for share.
ReplyDeletedevops online training
aws online training
data science with python online training
data science online training
rpa online training
Its a wonderful post and very helpful, thanks for all this information. Thanks for your valuable information!!!
ReplyDeleteandroid training in chennai
android online training in chennai
android training in bangalore
android training in hyderabad
android Training in coimbatore
android training
android online training