| private static String ReplceSpecialChars(String s) { |
Tuesday, May 22, 2012
JAVA regular expression, encode &#[0-9]+ form html
Thursday, May 17, 2012
How to: Get ProcessID of a given application pool on IIS
there are couple ways to get the processed of a given application pool, here is some quick ways to do that.
Using WMIC, this works for IIS6/IIS7
Go command prompt, type “wmic”
put the query like “process where name=”w3wp.exe” get processid, commandline” , you will see the app pool name and the processid.
or just put in one line,
using task manager for windows 7 or 2008,add commandline to the columns
Or run cmd as admin, go to “c:\Windows\System32\inetsrv” run “appcmd.exe list wp”, using the IIS admin tools , this works only for iis 7 and above
or using DebugDiag, this works for all IIS version,
go to the process tab, it has the web application pool name,
Monday, May 14, 2012
Using the async node.js library to get twitter content in a parallel
Quick test: setup the node.js to pull the contents from twitter in a parallel, and parse the json data back,
If search, http://search.twitter.com/search.json?q=lakers&rpp=5&include_entities=true&result_type=mixed, will show lakes news.
Here is one quick code to search 5 NBA teams, and get the text back.
| function getwebPageContents(keyword,callback) async.parallel([ |
you will get some data, like this,
Node.js and Sublime auto completion and Build integration / windows 7
Sublime Text is a Super IDE for developers, if you are looking the same experience for Node.js, there is one plug-in which supports Both. you can check it here, https://github.com/tanepiper/SublimeText-Nodejs
for the installation, if you don’t have any GIT on windows, just go to https://github.com/tanepiper/SublimeText-Nodejs
click the zip to download all the bits,
then unzip the file, to F:\Users\Androidyou\AppData\Roaming\Sublime Text 2\Packages\Nodejs, must be no further subfoder in this directory. otherwise, the build wont work, so the final resutlsl looks like<
once done, restart the sublime, you can see the node.js build /and run profle are there.
Friday, May 11, 2012
Java regular expression to extract Date format like April 12, 2012
| String s = "Department May 89 , 2012 - May 09 , 2011, June 12, 2011"; |
Monday, May 7, 2012
How to: Using R to Analysis IIS Logs
IIS Logs are basically CSV files, except it might have several headers in one file. like the following, R is one open-source powerful analytics language, I will do one quick demo see how we can use the R to do ad-hoc analysis for IIS logs.
the IIS log files looks like the following,
the comments begin with # and the same for headers. R has the built-in data importer for CSV file. and it has a lot options as here,
FOR IIS log file, we only need to uncomment one header file, this will tell R how to parse the correct Log files and using # as the comment.char. so you may just uncomment the 4th lines above by remove the #Fields: in the line beginning.
then open you fav R IDE, I will use RStudio.
load the raw files to one list named IIS. and run names to get the column names, this will make sure it parse the file correctly.
then you can run typeof(iis) to get it’s list object, and nrow and ncol to query the record count, and column count.
Now, let’s do some basic analysis
Q1: grouping the result by response code,And plot it.
Or group by request,
Q2: get the top 5 url by request count,
Q3: Count all the .css request ,get top 10s
Q4: Combine all the logs in one folder, and put all the data together
| basedir="F:/inetpub/logs/LogFiles/W3SVC1/" data=data.frame(); files=list.files(basedir,pattern="*.log") |
Q5: Get the number of request distribution by client, ( identity who request the more)
| reqbyiptop10= head(sort(table(iis$c.ip),decreasing=TRUE),10) ba=barplot(reqbyiptop10,col=rainbow(length(reqbyiptop10)),ylim=c(0,max(reqbyiptop10)*1.2),ylab="req Count") |
get something like this,
Thursday, April 26, 2012
MCPD, 70-515
Just passed the 70-515 Test, with 871/1000. just spent the last 4 days to prepare this certification. here are some useful information,
the test has 60 questions, most of them has a single answer choice. the rest are two choices. need answer 70% of them correctly to pass the test, and you can take up to 140 Minutes to finish the test.
check the skills required, basically write some program and simple verification code to learn those new features,
http://www.microsoft.com/learning/en/us/exam.aspx?ID=70-515&locale=en-us#tab2
and if you have a lot 3.5 experience, just follow this link to refresh the new features offered by asp.net 4.0.
What’s new in asp.net 4.0
what’s New in asp.net MVC 2.0 ( no need to check the 3.0, it’s not covered in the test yet)
that’s it, good luck