tag:blogger.com,1999:blog-4653070451761456668Fri, 24 May 2013 05:59:26 +0000.net RemotingMOD_JKOracle CoherencepostgresqlAsp.net 4.0Free ToolstutorialSoapUIIPADJava Performance / JMX / JConsoleLucene;solr;WCF/ASMX TESTOpen Source SolutionhadoopNutchUtilitylinux;putty;sshSOAPUI;SOAPBoxwindows ManagementTomcatWindows Phone 7tikaWindbgWCFIIS 7/7.5j233SqlServer 2008 R2GreenPlumStreamInsightvarnishsolr;nutchAndroidSolrJ2EETroubleshotting32/64 Bit ProgrammingSilverlightCassandraWindows 7My Note on Solutions.http://androidyou.blogspot.com/noreply@blogger.com (Ryan DH)Blogger223125tag:blogger.com,1999:blog-4653070451761456668.post-2339444717388015735Thu, 23 May 2013 23:36:00 +00002013-05-23T16:36:28.482-07:00How to: Adb install apk get error, INSTALL_FAILED_ALREADY_EXISTS<p>If you are a developer, and want test your new build and keeping the old settings of your app.here is the quick answer. <br /> <br />TRY install the new apk, you will get [INSTALL_FAILED_ALREADY_EXISTS] failure. <br /> <br /><a href="http://lh5.ggpht.com/-w5qRCQGH7m0/UZ6n9g8sO4I/AAAAAAAABsE/tPx7VrKpDQU/s1600-h/image%25255B4%25255D.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh6.ggpht.com/-nzpvr9q9Y68/UZ6n-J4zRDI/AAAAAAAABsI/JiUONPQIbDM/image_thumb%25255B2%25255D.png?imgmax=800" width="466" height="82" /></a> <br /> <br />here is the trick, add the –r, will keep the old setting while applying the new app. <br /><a href="http://lh4.ggpht.com/-1SsB79JxT-E/UZ6n-hgLAhI/AAAAAAAABsQ/6YJjc7X1T68/s1600-h/image%25255B9%25255D.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh5.ggpht.com/-jOHaquQV02o/UZ6n-9n7vmI/AAAAAAAABsY/4g5B2sv1Ub0/image_thumb%25255B5%25255D.png?imgmax=800" width="498" height="83" /></a></p> http://androidyou.blogspot.com/2013/05/how-to-adb-install-apk-get-error.htmlnoreply@blogger.com (Ryan DH)0tag:blogger.com,1999:blog-4653070451761456668.post-5370074212602453814Fri, 03 May 2013 18:58:00 +00002013-05-03T11:58:01.887-07:00ZeroMq, pub/sub mode tutorial , how-to<p>following the last post, it’s extremely easy to do a pub/sub empowering the zeromq. </p> <p>IN C#, we setup one socket to pub type, and bind to one tcp port. IN the Node.js and Another C# client, we can create a socket with type Sub. then subscript the topics we are interested. <br /> <br />&#160;<a href="http://lh5.ggpht.com/-d7RTR3LNDZM/UYQIqJ6IMRI/AAAAAAAABp0/h4zMstxRUjo/s1600-h/image%25255B4%25255D.png"><img title="image" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px" border="0" alt="image" src="http://lh5.ggpht.com/-0tYs2Ig1iI8/UYQIqZd_dAI/AAAAAAAABp8/OfYUGjDeLAI/image_thumb%25255B2%25255D.png?imgmax=800" width="605" height="313" /></a> <br /> <br />then in the Node.js, create one special socket sub, and remember to call subscribe with the interested topic. <br /> <br /> <br /><a href="http://lh4.ggpht.com/-uJHfLjlhDjA/UYQIq7DAGEI/AAAAAAAABqE/Jjmd16znBvc/s1600-h/image%25255B9%25255D.png"><img title="image" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px" border="0" alt="image" src="http://lh3.ggpht.com/-q70NSjk2WzA/UYQIrYUF-pI/AAAAAAAABqM/RFN-ep2kVoE/image_thumb%25255B5%25255D.png?imgmax=800" width="539" height="209" /></a> <br /> <br />C# subscriber code, <br /><a href="http://lh6.ggpht.com/-P4joyF4wI8Y/UYQIr05WFTI/AAAAAAAABqQ/S6RkehzR3sM/s1600-h/image%25255B14%25255D.png"><img title="image" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px" border="0" alt="image" src="http://lh4.ggpht.com/-mBHaFKQMCBk/UYQIsHlL5iI/AAAAAAAABqY/92-4Hh0yk08/image_thumb%25255B8%25255D.png?imgmax=800" width="835" height="324" /></a></p> <p>Run the app, from c#, we can see message published and received, <br /> <br /><a href="http://lh4.ggpht.com/-lQByNGX03ks/UYQIsyZIOLI/AAAAAAAABqg/w3DqL-nFWWM/s1600-h/image%25255B19%25255D.png"><img title="image" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px" border="0" alt="image" src="http://lh3.ggpht.com/--nBXnNjhxjw/UYQItLq61MI/AAAAAAAABqo/IyIi1wHn1lI/image_thumb%25255B11%25255D.png?imgmax=800" width="413" height="45" /></a> <br /> <br />from node.js client, <br /><a href="http://lh6.ggpht.com/-XVdMELpIiI4/UYQIt3Zi-1I/AAAAAAAABqw/cDrrf7_wFTQ/s1600-h/image%25255B24%25255D.png"><img title="image" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px" border="0" alt="image" src="http://lh6.ggpht.com/-luO6FxsHVVo/UYQIuFFxOvI/AAAAAAAABq4/7x0tiCz4Hfs/image_thumb%25255B14%25255D.png?imgmax=800" width="263" height="31" /></a></p> http://androidyou.blogspot.com/2013/05/zeromq-pubsub-mode-tutorial-how-to.htmlnoreply@blogger.com (Ryan DH)0tag:blogger.com,1999:blog-4653070451761456668.post-7680192993721530604Thu, 02 May 2013 00:49:00 +00002013-05-01T17:49:33.428-07:00Test ZeroMQ in C# tutorial<p>ZeroMQ comes with a lot binding, here is a quick tutorial to pickup the C# one. </p> <p>Create one console application, and search Zeromq in the Nuget package, you will see one for x64 and one for x86. <br /><a href="http://lh5.ggpht.com/-b23xatEvseQ/UYG36v_RPeI/AAAAAAAABn8/UrIcZ6ydgIs/s1600-h/image%25255B3%25255D.png"><img title="image" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px" border="0" alt="image" src="http://lh3.ggpht.com/-Yx4I4Ed-5tE/UYG37Ad9hGI/AAAAAAAABoE/U-y5zc9_Xmw/image_thumb%25255B1%25255D.png?imgmax=800" width="790" height="305" /></a> <br /> <br />then we can create a zemomq server and one client which send message to the server, <br /><a href="http://lh5.ggpht.com/-hhfCYe8vKF8/UYG37mONq7I/AAAAAAAABoM/2J8E80POKYY/s1600-h/image%25255B8%25255D.png"><img title="image" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px" border="0" alt="image" src="http://lh4.ggpht.com/-DuJ5IVhTczA/UYG38I428LI/AAAAAAAABoU/Ih1o_LEgvtA/image_thumb%25255B4%25255D.png?imgmax=800" width="652" height="685" /></a></p> <p>Run the application, <br /><a href="http://lh4.ggpht.com/-u9FJDFR72A4/UYG38twsWbI/AAAAAAAABoc/jnwWKGTokPg/s1600-h/image%25255B13%25255D.png"><img title="image" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px" border="0" alt="image" src="http://lh4.ggpht.com/-bt_TIG29Qfc/UYG39DCGOVI/AAAAAAAABok/4uNUOyRiWy8/image_thumb%25255B7%25255D.png?imgmax=800" width="276" height="44" /></a> <br /> <br />for the Node.js, we can install one module called , zmq which is the zeromq binding for node.js <br /><a href="http://lh6.ggpht.com/-HlkfuU0QtEw/UYG39VInB_I/AAAAAAAABoo/Y3zGYYRmAqY/s1600-h/image%25255B18%25255D.png"><img title="image" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px" border="0" alt="image" src="http://lh6.ggpht.com/-uRVdzZ0pUEE/UYG399MFWhI/AAAAAAAABo0/yCgVNuRadm8/image_thumb%25255B10%25255D.png?imgmax=800" width="372" height="85" /></a> <br /> <br />then create one simple js code and send a message to the 5555 service,( using buffer as the encoder for utf8) <br /><a href="http://lh5.ggpht.com/-eHolKQgT3ro/UYG3-VkiuGI/AAAAAAAABo8/DMh-SVAuyAM/s1600-h/image%25255B23%25255D.png"><img title="image" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px" border="0" alt="image" src="http://lh3.ggpht.com/-D7Z2H0CZrtw/UYG3-jjr-KI/AAAAAAAABpA/vVamCjTKqeQ/image_thumb%25255B13%25255D.png?imgmax=800" width="512" height="268" /></a></p> <p>then run the .js <br /><a href="http://lh4.ggpht.com/-9huwlckJAb0/UYG3-563cUI/AAAAAAAABpI/klvn7zVWteQ/s1600-h/image%25255B28%25255D.png"><img title="image" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px" border="0" alt="image" src="http://lh5.ggpht.com/-q2ZtC_hrsYE/UYG3_ewm6pI/AAAAAAAABpQ/cmgQ_vSWTV4/image_thumb%25255B16%25255D.png?imgmax=800" width="252" height="63" /></a></p> <p>And on the zeromq CLR process,you can see the new message <br /> <br /><a href="http://lh3.ggpht.com/-1NnJpMoZdTE/UYG3_1juCZI/AAAAAAAABpY/kdrQzKdKlnI/s1600-h/image%25255B33%25255D.png"><img title="image" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px" border="0" alt="image" src="http://lh6.ggpht.com/-xDCl8ahhJZg/UYG4HOaY4_I/AAAAAAAABpk/yhuOvUD12ZI/image_thumb%25255B19%25255D.png?imgmax=800" width="285" height="78" /></a></p> http://androidyou.blogspot.com/2013/05/test-zeromq-in-c-tutorial.htmlnoreply@blogger.com (Ryan DH)0tag:blogger.com,1999:blog-4653070451761456668.post-7396451511878190721Sat, 20 Apr 2013 00:31:00 +00002013-05-04T11:35:05.579-07:00Bug: Android google-tv-remote library<p>If you use the android <a href="https://code.google.com/p/google-tv-remote/source/browse/src/com/google/android/apps/tvremote/KeyStoreManager.java?r=868048f1648f3624bc52c60773d7351340137b7b">google-tv-remote library</a>, and your device modal contains some special characters. it might crashed your android application . </p> <p>When you check the code, it generate the x509 name through the following logic, <br /></p> <a href="http://lh5.ggpht.com/-xS-eyT5BVC8/UXHh7MIjwHI/AAAAAAAABnQ/2q89WCFlVrc/s1600-h/image%25255B3%25255D.png"><img title="image" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px" border="0" alt="image" src="http://lh5.ggpht.com/-s3nsNCX_39E/UXHh7eeOJgI/AAAAAAAABnY/NA8mtSyuOj0/image_thumb%25255B1%25255D.png?imgmax=800" width="518" height="128" /></a> <p>So if you are run a new ATT HTC ONE X+ phone, you might get the Name like </p> <p><u>CN=anymote/evitareul/evitareul/HTC One X+/devid <br /></u></p> <p>however, according to the <a href="https://www.openssl.org/docs/apps/x509.html#NAME_OPTIONS">naming conventions</a>, the ``special'' characters required by RFC2253 in a field That is ,+&quot;&lt;&gt;; so if you don’t replace it or encoding it, you will get Exception. If you don’t catch it, it might crash your application. <br /> <br /></p> <a href="http://lh4.ggpht.com/--ZNYCdrHUQ4/UXHh79zTz7I/AAAAAAAABng/JQL_MIDlNZk/s1600-h/image%25255B8%25255D.png"><img title="image" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; display: inline; padding-right: 0px" border="0" alt="image" src="http://lh5.ggpht.com/-Ftea3w5vxxE/UXHh8Cs_zHI/AAAAAAAABno/gH9XkIkhGwg/image_thumb%25255B4%25255D.png?imgmax=800" width="565" height="291" /></a> <p>the code only catch the generalsecurityeception, not the naming exception.</p> <p>so you need to encode or replace the special characters. and catch the exception just in case. </p> http://androidyou.blogspot.com/2013/04/bug-android-google-tv-remote-library.htmlnoreply@blogger.com (Ryan DH)0tag:blogger.com,1999:blog-4653070451761456668.post-3228100882761978167Mon, 15 Apr 2013 18:08:00 +00002013-04-15T11:08:49.553-07:00How to : run python script as a windows service on windows 2008<p>Just setup one django python application, always we run the script Python manage.py start 0.0.0.0:8080 to start a web application, if you want to run this a service. here is a quick tutorial,</p> <p>Download the <a href="http://www.microsoft.com/en-us/download/details.aspx?id=17657">windows resource kit</a> which contains one utility called svcany. basically you can run cmd as a service. most command can run on windows server 2008 all though they are designed for windows server 2003. then install it. <br /> <br />Here is a kb about the svcany. <a title="http://www.microsoft.com/en-us/download/details.aspx?id=17657" href="http://www.microsoft.com/en-us/download/details.aspx?id=17657">http://www.microsoft.com/en-us/download/details.aspx?id=17657</a> <br /> <br />then use the built in command SC to create one windows service. we just point the binPath to the scany.exe location. <br /> <br /> <table cellspacing="0" cellpadding="2" width="471" border="0"><tbody> <tr> <td bgcolor="#84a0cd" valign="top" width="469">SC Create Askbot80 binPath= “d:\windows resource kit\tools\svcany.exe” <br />#remember there must be a space between binpath= and the value. </td> </tr> </tbody></table> <br /> <br />Now when you go to services mmc, you can see the service is there. <br /><a href="http://lh3.ggpht.com/-VNpinj4xEnE/UWxCKzg_znI/AAAAAAAABmo/wDnxxTb2HcI/s1600-h/image%25255B5%25255D.png"><img title="image" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="image" src="http://lh3.ggpht.com/-6HfvYVZt2gY/UWxCLAvSoNI/AAAAAAAABmw/DLA9Ke5fOLY/image_thumb%25255B3%25255D.png?imgmax=800" width="267" height="71" /></a> <br /> <br />then run regedit, to put the python script into the parameters settings. <br /> <br />go to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\, you can see the service we just created is there already. <br /> <br />we just create one new key called Parameters, and under Parameters create one string key named Application , then enter the given python and python script there. <br /><a href="http://lh3.ggpht.com/-Mkrk2j84KDQ/UWxCLh3sNSI/AAAAAAAABm4/-GGpv9RhIXs/s1600-h/image%25255B10%25255D.png"><img title="image" style="border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px" border="0" alt="image" src="http://lh5.ggpht.com/-0ZDTu2tYiIg/UWxCLxh5TDI/AAAAAAAABnA/YXXNPVggxL8/image_thumb%25255B6%25255D.png?imgmax=800" width="450" height="242" /></a> <br /> <br />then you can start the service we just created. </p> http://androidyou.blogspot.com/2013/04/how-to-run-python-script-as-windows.htmlnoreply@blogger.com (Ryan DH)0tag:blogger.com,1999:blog-4653070451761456668.post-6928897236623942399Wed, 03 Apr 2013 17:41:00 +00002013-04-03T10:42:50.896-07:00How to : Test Microsoft Enterprise Library 5.0 tutorial , Basic Logging support.<p>Microsoft enterprise library has been updated with the support for .net framework 4.0 , supporting for the WinRT is coming, you can check the <a href="http://entlib.uservoice.com/forums/89245-enterprise-library-6-0-unity-3-0">uservoice</a> to vote for the features you want. Here is the quick tutoria to get started , we run some basic click and point setup, then do the GUI based config. then same basic coding, <br /> <br />Installation, <br /> <br />you can setup any project and using the NuGet to search enterprise library, then all the available blocks and extensions are there. <br /> <br />Search “Enterprise” in the nuget source, you will see a lot blocks , we pickup the logging block first, <br /><a href="http://lh5.ggpht.com/-B-l59j_0oWw/UVxpoppCruI/AAAAAAAABjE/i-Mn80480oo/s1600-h/image%25255B5%25255D.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh4.ggpht.com/-5mlag8Nf5Nk/UVxpponRsXI/AAAAAAAABjM/CqY8MPPaxqE/image_thumb%25255B3%25255D.png?imgmax=800" width="749" height="584" /></a> <br /> <br />it will show you all the dependencies , here the unity is the IOC Container , common is the shard base library . <br /><a href="http://lh4.ggpht.com/-xfemFDCtZYc/UVxpp_Twf0I/AAAAAAAABjQ/i_UM9YoOLPI/s1600-h/image%25255B9%25255D.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh6.ggpht.com/-Rpj7SeSfIPU/UVxpqYdwsAI/AAAAAAAABjc/g_enh6PmOaY/image_thumb%25255B5%25255D.png?imgmax=800" width="400" height="455" /></a> <br /> <br />Now our project has the required assembilies, Next step, we need one editor to do the configuration. Download and Install this <a href="http://visualstudiogallery.msdn.microsoft.com/029292f0-6e66-424f-8381-3454c8222f9a">Config Editor.</a> and restart the IDE, then you can right click app.config, and see the editor option with along with the WCF configuration <br /><a href="http://lh4.ggpht.com/-7bjVid8Nl_c/UVxpq7MUTEI/AAAAAAAABjg/zo3IWmeQbYQ/s1600-h/image%25255B14%25255D.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh6.ggpht.com/-AfCQ2pkKGEI/UVxpreJE4xI/AAAAAAAABjs/_Jy5ZH0unbw/image_thumb%25255B8%25255D.png?imgmax=800" width="297" height="286" /></a> <br /> <br />Now let’s do some basic configuration to turn on the logging. basically we inject some implementation of the logwriter and it’s dependencies for implementations. <br /> <br />click the blocks menu, you will see all the available blocks we can configure. (once we add more nuget package like cryptography , you will see more options in the menu) <br /><a href="http://lh3.ggpht.com/-5gu0jTH16Go/UVxprhUcGqI/AAAAAAAABj0/w5xqnOccwL8/s1600-h/image%25255B19%25255D.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh3.ggpht.com/-wu_zUBrKi2c/UVxpsE8OI8I/AAAAAAAABj8/Rr_jzbSY9Bk/image_thumb%25255B11%25255D.png?imgmax=800" width="384" height="307" /></a></p> <p>by default,&#160; it pick up one eventlog listener and using the giving format. . we just leave it as it. then save the config <br /><a href="http://lh3.ggpht.com/-XKzfgKTxGgU/UVxpsn8M4FI/AAAAAAAABkE/uYZ481HdSRg/s1600-h/image%25255B27%25255D.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh4.ggpht.com/-BLvBhhyESvE/UVxptg6Jk1I/AAAAAAAABkM/xeRaxsmMDVk/image_thumb%25255B15%25255D.png?imgmax=800" width="786" height="353" /></a> <br /> <br />Now, let’s write a helloword app to write some dummy log. <br /> <br />get a container first, then we can retrieve the logwriter from the contonainer, I will use the unitycontainer. <br /> <table border="0" cellspacing="0" cellpadding="2" width="400"><tbody> <tr> <td valign="top" width="400"> <p>var container = new UnityContainer(); <br />container.AddNewExtension&lt;EnterpriseLibraryCoreExtension&gt;();</p> </td> </tr> </tbody></table> <br />then let’s get the reference to logwriter. then dump some message, <br /><a href="http://lh4.ggpht.com/-DcEsn0PxNcQ/UVxpuLnHb_I/AAAAAAAABkQ/1bU8uPUE_mg/s1600-h/image%25255B32%25255D.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh6.ggpht.com/-HirxeOiS1GA/UVxpuft09BI/AAAAAAAABkY/eAt2POMWfBs/image_thumb%25255B18%25255D.png?imgmax=800" width="460" height="112" /></a> <br /> <br />Run it, we can see the log in the event log there. <br /><a href="http://lh6.ggpht.com/-gCy3b7GHvnY/UVxpvFSZZsI/AAAAAAAABkk/LZKqYJEUGhg/s1600-h/image%25255B37%25255D.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh5.ggpht.com/-uND4msKPEFM/UVxpvg_C-JI/AAAAAAAABks/w6NOSbitlf4/image_thumb%25255B21%25255D.png?imgmax=800" width="763" height="323" /></a> <br /> <br />Now app is there, we can simply change the config file, and change the log to a text file or event a Database table. <br />right click the target listener and add, you can see we have several ones. we just pick up the flat file. <br /><a href="http://lh6.ggpht.com/-u7cSdDK3_Q4/UVxpwbYciPI/AAAAAAAABk0/9dMJklPBqOQ/s1600-h/image%25255B41%25255D.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh6.ggpht.com/-nbJI9iEwAM8/UVxpw1tyZWI/AAAAAAAABk8/ioyrUtZcECs/image_thumb%25255B23%25255D.png?imgmax=800" width="816" height="351" /></a></p> <p><a href="http://lh6.ggpht.com/-O7Uy4UW2O-0/UVxpxUr0DGI/AAAAAAAABlA/wqrHLPWMNnQ/s1600-h/image%25255B45%25255D.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh3.ggpht.com/-HfNR7M8ND50/UVxpxr6IEgI/AAAAAAAABlI/IZhMxWsg8wM/image_thumb%25255B25%25255D.png?imgmax=800" width="254" height="297" /></a></p> <p>and chose the formmater to the default one, which you can config it too, like add more fileds. </p> <p>then assign this listener to the right category. for this demo just assign to the general one. <br /><a href="http://lh4.ggpht.com/-3GBB7daCd5k/UVxpyL8jSOI/AAAAAAAABlU/sODnuZNfYD8/s1600-h/image%25255B50%25255D.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh5.ggpht.com/-9JiNdIz2bIM/UVxpyfu7-GI/AAAAAAAABlc/dc9ZEKzMuFA/image_thumb%25255B28%25255D.png?imgmax=800" width="528" height="185" /></a></p> <p> <br />Save it and run. we can see the log file called trace.log was generated. with the following contents <br /><a href="http://lh4.ggpht.com/-AaexSLD-jnU/UVxpy8DslWI/AAAAAAAABlk/tbQTNNssey8/s1600-h/image%25255B55%25255D.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh3.ggpht.com/-lrY5baOKgek/UVxpzStJU6I/AAAAAAAABls/8xl2NoEcAYE/image_thumb%25255B31%25255D.png?imgmax=800" width="567" height="290" /></a> <br /> <br />if we want to save it to DB, search NUget, and add the logging for db blocks <br /><a href="http://lh5.ggpht.com/-bEE6HtqgEOw/UVxpzzfR9II/AAAAAAAABlw/TUrNUC4NjTE/s1600-h/image%25255B60%25255D.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh6.ggpht.com/-XUzXr6I6lD4/UVxp0BkJYoI/AAAAAAAABl8/i0LsSQmeHdU/image_thumb%25255B34%25255D.png?imgmax=800" width="618" height="121" /></a> <br /> <br />then we you add log listener, you will see a new one.</p> <p><a href="http://lh6.ggpht.com/-yUN-55ht1hc/UVxp0xTil3I/AAAAAAAABmE/QW-S6geTkHg/s1600-h/image%25255B65%25255D.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh4.ggpht.com/-vKg1CP7CjzI/UVxp1SPagCI/AAAAAAAABmM/47MoqV0Uy5U/image_thumb%25255B37%25255D.png?imgmax=800" width="317" height="336" /></a> <br /> <br />for the database listener to work, need run the scripts under the package folder and specify the db connection string. that’s it. </p> http://androidyou.blogspot.com/2013/04/how-to-test-microsoft-enterprise.htmlnoreply@blogger.com (Ryan DH)0tag:blogger.com,1999:blog-4653070451761456668.post-1285363621889599495Fri, 15 Feb 2013 01:57:00 +00002013-02-14T17:57:00.085-08:00Python REST Framework FLASK<p>Flask is a very lightweight REST framework for python, here is a very basic tutorial to get started. <br /> <br />install Flask, <br />pip install flask, <br /><a href="http://lh3.ggpht.com/-fj5k8Wer2MU/UR2VzyHWOHI/AAAAAAAABf4/PsyFjpd-iw8/s1600-h/image%25255B4%25255D.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh6.ggpht.com/-JQwGLfeOWrQ/UR2V0StDQjI/AAAAAAAABgA/nPD7KL726yI/image_thumb%25255B2%25255D.png?imgmax=800" width="787" height="663" /></a> <br />then create one module to test the flask. <br /> <br />hello world test, <br /><a href="http://lh6.ggpht.com/-GpDtkEsiLKo/UR2V01fJW8I/AAAAAAAABgE/hKp8f39WTEg/s1600-h/image%25255B8%25255D.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh5.ggpht.com/-zm9xNabuqAA/UR2V1Y2qLJI/AAAAAAAABgQ/depOMWi1gug/image_thumb%25255B4%25255D.png?imgmax=800" width="291" height="172" /></a> <br />then run the web server, <br /><a href="http://lh6.ggpht.com/-TUYdpkgRpSc/UR2V1hf-PwI/AAAAAAAABgY/8icfAukMgN4/s1600-h/image%25255B13%25255D.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh5.ggpht.com/-b-XQPmCWj3Y/UR2V2Mq_YCI/AAAAAAAABgg/g-jAhMG2sDs/image_thumb%25255B7%25255D.png?imgmax=800" width="356" height="163" /></a> <br />now <a href="http://localhost:8000/">http://localhost:8000/</a>, you will see the hellofalsk page, <br /><a href="http://lh6.ggpht.com/-u2ps1j9d9JU/UR2V2bkHTxI/AAAAAAAABgo/Ia-z1Vz_mic/s1600-h/image%25255B18%25255D.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh4.ggpht.com/-GwE74DwxGyk/UR2V26y_EZI/AAAAAAAABgw/3B-d5RXJh9Q/image_thumb%25255B10%25255D.png?imgmax=800" width="508" height="504" /></a> <br /> <br />test to list folders and return as Json, <br /><a href="http://lh3.ggpht.com/-InGURueFnEI/UR2V3IbZQDI/AAAAAAAABg4/VK4BWGGZ71s/s1600-h/image%25255B23%25255D.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh6.ggpht.com/-56vMRrouP_g/UR2V3vaavRI/AAAAAAAABhA/DxfQxbQVH_E/image_thumb%25255B13%25255D.png?imgmax=800" width="304" height="163" /></a> <br />here we put prefix in the url template. in the method we can assess the url passed from user side. <br /><a href="http://lh6.ggpht.com/-KdTjWJyvBcc/UR2V4bUTgJI/AAAAAAAABhI/ZnVrkFdDO2k/s1600-h/image%25255B28%25255D.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh4.ggpht.com/-a0CLo99HRjo/UR2V49RHLSI/AAAAAAAABhQ/G76aKm-YLh0/image_thumb%25255B16%25255D.png?imgmax=800" width="362" height="150" /></a> <br /> <br />test to get the request information, like the user-agent. just import the global request. <br /><a href="http://lh5.ggpht.com/-CMjs3ImzJjI/UR2V5PCj4RI/AAAAAAAABhY/9twtvosjzpE/s1600-h/image%25255B33%25255D.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh4.ggpht.com/-bmiE4aKGc-0/UR2V569XZ0I/AAAAAAAABhg/q-Iizsj6BZ4/image_thumb%25255B19%25255D.png?imgmax=800" width="498" height="169" /></a> <br /> <br /><a href="http://lh6.ggpht.com/-9WuOYpTL9lU/UR2V6dqLVdI/AAAAAAAABho/6BvXmHP4UJU/s1600-h/image%25255B38%25255D.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh3.ggpht.com/-N8Ppd5ed_Yw/UR2V6kwrQuI/AAAAAAAABhw/0jSjXr9gEq8/image_thumb%25255B22%25255D.png?imgmax=800" width="699" height="164" /></a></p> http://androidyou.blogspot.com/2013/02/python-rest-framework-flask.htmlnoreply@blogger.com (Ryan DH)0tag:blogger.com,1999:blog-4653070451761456668.post-6931504669962915507Fri, 15 Feb 2013 00:14:00 +00002013-02-14T16:14:00.211-08:00Silverlight load 98% on MAC and stuck there.<p>you may get some 98% loading and never ends, </p> <p><a href="http://lh5.ggpht.com/-EFJZIMuTd58/UR19xYViWwI/AAAAAAAABec/OqIeUaobKxc/s1600-h/image%25255B4%25255D.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh3.ggpht.com/-pGS_ZBaKfTM/UR19xgAXImI/AAAAAAAABek/oDr6WHpPHE4/image_thumb%25255B2%25255D.png?imgmax=800" width="346" height="259" /></a></p> <p>basically this means the Silverlight plugin is crashed anyhow. so just remove the plugin and instll it again, to do that, <br /> <br />Open the Finder: <br />HD&gt;LIbrary&gt;Internet Plugins folder: move to the trash <b>Silverlight.plugin</b> <br />HD&gt;Library&gt;Applications Support&gt;Microsoft: move the Silverlight folder to the trash. <br />Also, check in Your User Account&gt;Library&gt;(same end locations as above). <br />then restart Safari.</p> http://androidyou.blogspot.com/2013/02/silverlight-load-98-on-mac-and-stuck.htmlnoreply@blogger.com (Ryan DH)0tag:blogger.com,1999:blog-4653070451761456668.post-3043624715672908354Thu, 14 Feb 2013 18:49:00 +00002013-02-14T10:49:53.973-08:00Testing Python for C# programmers<table border="0" cellspacing="0" cellpadding="2" width="662"><tbody> <tr bgcolor="#f0ffff"> <td valign="top" width="660"> <p>''' <br />Created on Feb 13, 2013</p> <p>@author: Android.Y.You <br />''' <br />&#160;</p> <p>def main(): <br />&#160;&#160;&#160; print &quot;you are in main&quot;</p> <p> <br />#* operator of String <br />print '*'*20</p> <p>&#160; <br />import random</p> <p>#format output <br />print &quot;here is one random number %i &quot; % ( random.randint(5,10))</p> <p>#using type to get type information <br />print type(20) <br />print type(main)</p> <p> <br />#import everything <br />#before</p> <p>import math <br />print math.pi <br />#after <br />from math import * <br />print pi</p> <p>#comment,doc <br />def SayHello(msg): <br />&#160;&#160;&#160; &quot;&quot;&quot;SayeHello Function <br />&#160;&#160;&#160; enter the msg as the input, typically a string <br />&#160;&#160;&#160; &quot;&quot;&quot; <br />&#160;&#160;&#160; print &quot;Hello &quot; + msg</p> <p>SayHello(&quot;ss&quot;)</p> <p>#PrimeNumbers, else with for means no match. <br />def prime(n=100): <br />&#160;&#160;&#160; for i in range(2,n): <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; for j in range(2,i): <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; if (i % j==0): <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; break <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; else: <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; print i <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <br />prime(10)</p> <p> <br />#comprehensive list <br />s=range(1,20) <br />t=[x for x in s if x % 3==0 and x!=3 ] <br />print t</p> <p>#lambda expression <br />def addx(n): <br />&#160;&#160;&#160; return lambda x:x+n <br />add3=addx(3) # add 3 <br />print add3(10) # 13 </p> <p>#keyboard input <br />#get input,using int as the converter, raw_input to get console in <br />id=int( raw_input(&quot;enter a number&quot;)) <br />print id&gt;10</p> <p>#list</p> <p>list=range(1,3) <br />print type(list) <br />for l in list: <br />&#160;&#160;&#160; print l <br />&#160;&#160;&#160; <br />#list a mutable <br />list[0]=100 <br />print list</p> <p>#tuples, tuples are immutable <br />tu=(1,2,3) <br />print tu</p> <p>#dictionary</p> <p>d={&quot;one&quot;:&quot;1&quot;,&quot;two&quot;:&quot;2&quot;} <br />for k,v in d.items(): <br />&#160;&#160;&#160; print k,v <br />&#160;&#160;&#160; <br />&#160;&#160;&#160; <br />#fiel write <br />fout=open(&quot;out.txt&quot;,&quot;w&quot;) #a+ for append <br />fout.writelines(&quot;helloworld&quot;) <br />fout.close()</p> <p>#write a object <br />class Person(object): <br />&#160;&#160;&#160; Name=&quot;yourname&quot; <br />&#160;&#160;&#160; Age=20 <br />&#160;&#160;&#160; def __init__(self,name,age): <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; self.Name=name <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; self.Age=age <br />&#160;&#160;&#160; def __str__(self, *args, **kwargs): #overwrite the java like tostirng <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; return &quot;name:%s,Age:%i&quot; % (self.Name,self.Age) <br />p=Person(&quot;android&quot;,25) <br />print p</p> <p>import pickle <br />print pickle.dumps(p) #object to strings</p> <p>#file path <br />import os <br />print os.getcwd()</p> <p>#walk for files <br />def walk(dirname): <br />&#160;&#160;&#160; for file in os.listdir(dirname): <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; s= os.path.join(dirname,file) <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; if(os.path.isfile(s)): <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; print s <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; else: <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; walk(s) <br />&#160;&#160;&#160; <br />walk(r&quot;C:/temp/&quot;)</p> <p> <br />#gui, tkinter. <br />from Tkinter import * <br />root=Tk() <br />w=Label(root,text=&quot;Helloworld&quot;) <br />w.pack() <br />root.mainloop()</p> <p>&#160;</p> <p>#AOP, using the decroator <br />def logaop(func): <br />&#160;&#160;&#160; print &quot;binded&quot; <br />&#160;&#160;&#160; def ins(*a,**b): <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; print &quot;---before call the method&quot; <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; func(*a,**b) <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; print &quot;---after call the method&quot; <br />&#160;&#160;&#160;&#160;&#160; <br />&#160;&#160;&#160; return ins</p> <p>@logaop <br />def GetInfomrationFromDB(informationkey): <br />&#160;&#160;&#160; print &quot;You get the result for &quot; + informationkey <br />&#160;&#160; </p> <p>&#160;</p> <p>GetInfomrationFromDB(&quot;test&quot;)</p> </td> </tr> </tbody></table> <p> <br />output</p> <table border="0" cellspacing="0" cellpadding="2" width="400"><tbody> <tr bgcolor="#f0ffff"> <td valign="top" width="400"> <p>******************** <br />here is one random number 9 <br />&lt;type 'int'&gt; <br />&lt;type 'function'&gt; <br />3.14159265359 <br />3.14159265359 <br />Hello ss <br />2 <br />3 <br />5 <br />7 <br />[6, 9, 12, 15, 18] <br />13 <br />enter a number10 <br />False <br />&lt;type 'list'&gt; <br />1 <br />2 <br />[100, 2] <br />(1, 2, 3) <br />two 2 <br />one 1 <br />name:android,Age:25 <br />ccopy_reg <br />_reconstructor <br />p0 <br />(c__main__ <br />Person <br />p1 <br />c__builtin__ <br />object <br />p2 <br />Ntp3 <br />Rp4 <br />(dp5 <br />S'Age' <br />p6 <br />I25 <br />sS'Name' <br />p7 <br />S'android' <br />p8 <br />sb. <br />C:\Project\python\wp\FirstHello\src <br />C:/temp/a\New Text Document.txt <br />C:/temp/test.html <br /></p> </td> </tr> </tbody></table> http://androidyou.blogspot.com/2013/02/testing-python-for-c-programmers.htmlnoreply@blogger.com (Ryan DH)0tag:blogger.com,1999:blog-4653070451761456668.post-7089077578763059362Fri, 08 Feb 2013 02:00:00 +00002013-02-07T18:00:19.905-08:00Test Twisted Python on windows<p>Twisted is one popular event-driven network engine writen in python. basically, it can create a web server as the node.js do, and also provide the similar features as socket io like the pub/sub through internet. to test it, we need install python, and load the necessary dependencies. and PIP is one tool to do the package installation for you. here are some basic steps to test twisted. </p> <p>Install python 2.7, just download the installer the run it, then put the path of the installed directory to system path environment. I just installed it under c:\python27. then we can run python to launch the interactive shell. <br /><a href="http://lh4.ggpht.com/-uG5eYmVyL-E/URRcIrYR3JI/AAAAAAAABbw/ohjWzY6aAVM/s1600-h/image%25255B3%25255D.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh3.ggpht.com/-rdMLQ5fykTw/URRcJAn2h0I/AAAAAAAABb4/aeC96KPcxd8/image_thumb%25255B1%25255D.png?imgmax=800" width="670" height="111" /></a> <br /> <br />then install the pip utility. <br />PIP require setuptools utility, <a title="http://pypi.python.org/pypi/setuptools" href="http://pypi.python.org/pypi/setuptools">http://pypi.python.org/pypi/setuptools</a> <br />you can pickup the exe download, or just download the 64 bit setup script. then download the pip package. and extract it to a local folder. <br /><a href="http://lh5.ggpht.com/-YMBAqcffat4/URRcJbSDDuI/AAAAAAAABcA/YCub4JrOp1M/s1600-h/image%25255B8%25255D.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh5.ggpht.com/-LRPbVIklGwc/URRcJ6ex_mI/AAAAAAAABcI/AsF2m7lSUDI/image_thumb%25255B4%25255D.png?imgmax=800" width="473" height="55" /></a> <br />when done, it will create some utility under the python27 scripts folder, like pip.exe. then we can add this folder the system path env as well. <br /><a href="http://lh3.ggpht.com/-RQfH1fL29QU/URRcKR2hRgI/AAAAAAAABcQ/SGiQs7PZ1VY/s1600-h/image%25255B13%25255D.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh5.ggpht.com/-RKnjOk6D7PY/URRcKslWbJI/AAAAAAAABcY/6nTXdbmEeM4/image_thumb%25255B7%25255D.png?imgmax=800" width="508" height="182" /></a> <br /> <br />Install twisted, for the twisted , it require zope.interface. now we have pip, just run pip install zope.interface to install the dependency.</p> <p><a href="http://lh6.ggpht.com/-_YwG5-jdmUo/URRcLOqF1mI/AAAAAAAABcc/0cNIrN4IqAM/s1600-h/image%25255B18%25255D.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh4.ggpht.com/-N7dXbFuinf4/URRcLTmWcAI/AAAAAAAABco/BVeLLuuxu34/image_thumb%25255B10%25255D.png?imgmax=800" width="632" height="170" /></a> <br /></p> <p>Now download the twisted windows installer <a title="http://twistedmatrix.com/trac/" href="http://twistedmatrix.com/trac/">http://twistedmatrix.com/trac/</a>, click and good to go. <br />after all done, we can open the python shell, and list the twisted package.</p> <p>then create one simple web server,and run it, <br /><a href="http://lh5.ggpht.com/-oRjkE9gz2vQ/URRcLqLW1vI/AAAAAAAABcw/jVXkRzmgJf0/s1600-h/image%25255B27%25255D.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh4.ggpht.com/-OsxwkT5nnCI/URRcL8mMjcI/AAAAAAAABc4/643Ea889i1Q/image_thumb%25255B15%25255D.png?imgmax=800" width="631" height="439" /></a></p> <p><a href="http://lh4.ggpht.com/-us-VKOCiYpw/URRcMACzGoI/AAAAAAAABdA/WgagCp4S4RU/s1600-h/image%25255B22%25255D.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh4.ggpht.com/-Di15pvOhKYY/URRcMiJpN0I/AAAAAAAABdI/cX4OUIPV_Eg/image_thumb%25255B12%25255D.png?imgmax=800" width="343" height="166" /></a></p> http://androidyou.blogspot.com/2013/02/test-twisted-python-on-windows.htmlnoreply@blogger.com (Ryan DH)0tag:blogger.com,1999:blog-4653070451761456668.post-4146428268386375879Fri, 01 Feb 2013 01:20:00 +00002013-02-01T16:38:41.481-08:00how to test log4j /SLF4j tutorial<p>Log4j is one very popular logging framework which is widely used by a lot java applications such as hadoop, tomcat. here is quick tutorial for programmers to setup the log4j and write some very basic logging applications. <br /> <br />&#160;&#160; first, create a java application and download reference the log4j jar dependency, if you use maven, just add log4j to the dependency list in your pom.xml.</p> <p>I have the maven eclipse plugin, so I can create one simple maven project. <br /><a href="http://lh5.ggpht.com/-t_j0az6Ool4/UQsXf0ASFSI/AAAAAAAABUY/VMBY_Rw0zE8/s1600-h/image%25255B3%25255D.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh3.ggpht.com/-0HxtdqVBV4c/UQsXgVXuBzI/AAAAAAAABUg/JPmN0d9eEhc/image_thumb%25255B1%25255D.png?imgmax=800" width="538" height="540" /></a> <br />give it a groupid and artifact id</p> <p><a href="http://lh4.ggpht.com/-fRxd7LFGuoU/UQsYFhB2m7I/AAAAAAAABUo/AsABGaQdI1I/s1600-h/image%25255B7%25255D.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh5.ggpht.com/-dY2rWs6ve3Y/UQsYF9gi-tI/AAAAAAAABUw/6FWq6KEsNSQ/image_thumb%25255B3%25255D.png?imgmax=800" width="594" height="482" /></a></p> <p>right click pom.xml, and chose the maven menu, then add dependency, search log4j. and click to add one latest version to the dependency.</p> <p><a href="http://lh6.ggpht.com/-ogD-U9kCX6Q/UQsYGGsCo8I/AAAAAAAABU4/Ub42mv-PCYA/s1600-h/image%25255B11%25255D.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh4.ggpht.com/-mu5MxxYYKqU/UQsYGhJCJzI/AAAAAAAABVA/mJNXpDkU12E/image_thumb%25255B5%25255D.png?imgmax=800" width="597" height="547" /></a></p> <p>then the pom file loos like this</p> <p><a href="http://lh6.ggpht.com/-_hPtZfazAbU/UQsYP05nyoI/AAAAAAAABVE/lX13lvfAXGI/s1600-h/image%25255B15%25255D.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh5.ggpht.com/-K0u64T7GS6s/UQsYQJqxYFI/AAAAAAAABVM/4bXXXgiBwAM/image_thumb%25255B7%25255D.png?imgmax=800" width="495" height="223" /></a></p> <p>now the project has the log4j jar in the maven’s dependencies folder. <br /><a href="http://lh6.ggpht.com/-TW8iYD3rong/UQsYQjF0SRI/AAAAAAAABVU/I8zDegmBkHg/s1600-h/image%25255B20%25255D.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh5.ggpht.com/-gFMiYGNWbqU/UQsYQ3B-uVI/AAAAAAAABVc/rLAUwFJ8znA/image_thumb%25255B10%25255D.png?imgmax=800" width="348" height="233" /></a></p> <p>Now let’s create one simple class with one main method to do the logging. <br />basically, we just create one logger by calling the logmanaager,getlogger. then can log out some message by using different level settings. <br /><a href="http://lh6.ggpht.com/-P8Az8eunhUU/UQsYRLcKzvI/AAAAAAAABVk/IH2lHON9KTg/s1600-h/image%25255B24%25255D.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh4.ggpht.com/-mcLJFHgwTa4/UQsYRVejQII/AAAAAAAABVs/3BA-QG_1bnI/image_thumb%25255B12%25255D.png?imgmax=800" width="647" height="441" /></a> <br /> <br />now we can tell from the error message , there is no logger for com.androidyou. so we need to put some instruction into the log4j.properties , basically tell the runtime which logger I should use and for a giving logger, what’s the logging level. for each given logger, what appender we should use, then the properties for the appenders. <br />put the log4j.debug=true, you will see more verbal messages. it tells us that no resource file found (by default it’s the log4j.properties.)&#160; we can override the resource file to whaterve file we have by passing the locatio to the log4j.configuration property. <br /><a href="http://lh6.ggpht.com/-HRpa04rxMN8/UQsYR4QT55I/AAAAAAAABV0/5wwSX-L07vU/s1600-h/image%25255B28%25255D.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh4.ggpht.com/-7z63vdCw43k/UQsYSZj_hgI/AAAAAAAABV8/xF9MSXJ3Fm0/image_thumb%25255B14%25255D.png?imgmax=800" width="778" height="202" /></a></p> <p>Now we just create a very basic log4j.properties file under any classpath folder, I just put it under src/main/resources folder. <br /> <table border="0" cellspacing="0" cellpadding="2" width="538"><tbody> <tr bgcolor="#f0ffff"> <td valign="top" width="536"> <p>&#160; <br />log4j.logger.com.androidyou=DEBUG <br />log4j.rootLogger=ERROR, console</p> <p># console is set to be a ConsoleAppender. <br />log4j.appender.console=org.apache.log4j.ConsoleAppender <br />&#160; <br /># setup console properties</p> <p>log4j.appender.console.layout=org.apache.log4j.PatternLayout <br />log4j.appender.console.layout.ConversionPattern=%-4r [%t] %-5p %c %x - %m%n <br /></p> </td> </tr> </tbody></table> <br />run again, you can see the loading process, our resource file log4j.properties get picked up, and our logger also identified and level debug is assigned <br /><a href="http://lh5.ggpht.com/-vC-3uuw6bmk/UQsYSqubpTI/AAAAAAAABWE/iboDErJL_ao/s1600-h/image%25255B32%25255D.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh6.ggpht.com/-j5Xdr3CP0a8/UQsYSy4vLaI/AAAAAAAABWM/8u1gX1xoKaI/image_thumb%25255B16%25255D.png?imgmax=800" width="943" height="356" /></a></p> <p>for the logging configuration, there are different levels. here is the list, I checked the code declaration</p> <p><a href="http://lh3.ggpht.com/-yyIulLuQO1Q/UQsYTDyTZ7I/AAAAAAAABWU/3l7bNxUuUWI/s1600-h/image%25255B37%25255D.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh3.ggpht.com/-BWcHxNhtY0M/UQsYT-0crnI/AAAAAAAABWc/NlEBZ-M5NHM/image_thumb%25255B19%25255D.png?imgmax=800" width="510" height="621" /></a> <br /></p> <p>Also there are a lot built-in appenders. <br /><a href="http://lh4.ggpht.com/-B1naYY0MhAQ/UQsYUIEYyNI/AAAAAAAABWk/XD-g-nYcdtM/s1600-h/image%25255B42%25255D.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh6.ggpht.com/-ILncye30Hj8/UQsYUp3ceMI/AAAAAAAABWs/nCjFlYvhMVA/image_thumb%25255B22%25255D.png?imgmax=800" width="564" height="432" /></a> <br /> <br />here is one example that we change the consoleappender to dailyrollingfileappender, which rotate the file by time setting. <br /> <table border="0" cellspacing="0" cellpadding="2" width="542"><tbody> <tr bgcolor="#f0ffff"> <td valign="top" width="540"> <p>log4j.logger.com.androidyou=DEBUG <br />log4j.rootLogger=ERROR, df</p> <p># console is set to be a DailyRollingFileAppender. <br />log4j.appender.df=org.apache.log4j.DailyRollingFileAppender <br />&#160; <br /># setup DailyRollingFileAppender properties</p> <p>log4j.appender.df.DatePattern='.'yyyy-MM-dd-HH <br />log4j.appender.df.File=mmm.txt</p> <p>log4j.appender.df.layout=org.apache.log4j.PatternLayout <br />log4j.appender.df.layout.ConversionPattern=ROOTJJJ-%-4r [%t] %-5p %c %x - %m%n <br /></p> </td> </tr> </tbody></table> </p> <p>Besides the log4j. slf4j is another popular logging framwrok, it’s a façade layer which works as a separate stable interface, slf4j-log4j is a implementation.&#160; so code is almos the same, you only need change the pacakge namer from log4j to slf4j. </p> <p><a href="http://lh6.ggpht.com/-9TLGrGkRtzw/UQsbqinAdII/AAAAAAAABYA/qBuQSATIdhY/s1600-h/image%25255B5%25255D.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh5.ggpht.com/-c8QCswHIBhw/UQsbq5iyf3I/AAAAAAAABYI/Han4FOeeQXQ/image_thumb%25255B2%25255D.png?imgmax=800" width="493" height="429" /></a></p> <p>for the pom, API is the core library, log4j is the implementation. we can simply copy another impementation like no-op to the classpath, then no log will be gerated. </p> <p><a href="http://lh4.ggpht.com/-wOai1nJXxrY/UQsbrvA2ulI/AAAAAAAABYQ/QHi9S-pckwk/s1600-h/image%25255B10%25255D.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh5.ggpht.com/-h8ieTV1uXkM/UQsbr2Ky4AI/AAAAAAAABYY/LvF6IAwYNUw/image_thumb%25255B5%25255D.png?imgmax=800" width="386" height="234" /></a></p> <p><a href="http://lh5.ggpht.com/-Pl1t76wELbw/UQsbsKtdloI/AAAAAAAABYg/YhQK6JJSfZc/s1600-h/image%25255B15%25255D.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh5.ggpht.com/-e64745Hog5s/UQsbssPT_zI/AAAAAAAABYo/uF4d7U0ZP4g/image_thumb%25255B8%25255D.png?imgmax=800" width="259" height="423" /></a></p> <p>Also we can send the messages to the ActiveMQ Topics. <br />Change the log4.properties to add JMSappender. <br /> <table border="0" cellspacing="0" cellpadding="2" width="506"><tbody> <tr bgcolor="#f0ffff"> <td valign="top" width="504"> <p>log4j.rootLogger=ERROR, jms</p> <p>log4j.appender.jms=org.apache.log4j.net.JMSAppender <br />log4j.appender.jms.InitialContextFactoryName=org.apache.activemq.jndi.ActiveMQInitialContextFactory <br />log4j.appender.jms.ProviderURL=tcp://localhost:61616 <br />log4j.appender.jms.TopicBindingName=logTopic <br />log4j.appender.jms.TopicConnectionFactoryBindingName=ConnectionFactory <br /></p> </td> </tr> </tbody></table> <br />then define one jndi.properties file and put it under any classpath folder. <br /><a href="http://lh3.ggpht.com/-qIsfvLGgzIM/UQxgCfrhpMI/AAAAAAAABZ4/O615VddHKLM/s1600-h/image%25255B4%25255D.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh3.ggpht.com/-V-C41AJ-e-Q/UQxgCpGoFzI/AAAAAAAABaA/u_YcWrfbkvs/image_thumb%25255B1%25255D.png?imgmax=800" width="221" height="103" /></a> <br /> <br />then reference all the jars under activemq lib for safe. <br /> <br />then you can see the messages in the topic we created. <br /><a href="http://lh5.ggpht.com/-O1FGMlwvA24/UQxgCy4FZII/AAAAAAAABaI/z2oXEIpJLmI/s1600-h/image%25255B9%25255D.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh3.ggpht.com/-Yffb-Cf2mGM/UQxgDEyuilI/AAAAAAAABaQ/pZ79kbC3Dz0/image_thumb%25255B4%25255D.png?imgmax=800" width="695" height="322" /></a> <br /> <br />under activemq examples, run ant consumer to consumer the topics, <br /><a href="http://lh4.ggpht.com/-mAarCx8ztks/UQxgDS7KlQI/AAAAAAAABaY/lF1skn9H24Y/s1600-h/image%25255B14%25255D.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh4.ggpht.com/-7Q5Rz2A1UoI/UQxgD2tkhlI/AAAAAAAABag/QDhIbjJ1mqc/image_thumb%25255B7%25255D.png?imgmax=800" width="326" height="33" /></a></p> http://androidyou.blogspot.com/2013/01/how-to-test-log4j-tutorial.htmlnoreply@blogger.com (Ryan DH)0tag:blogger.com,1999:blog-4653070451761456668.post-7865044837358892910Fri, 01 Feb 2013 00:42:00 +00002013-01-31T16:42:51.194-08:00log4j dependency error,<p>Just created one simple Maven project to test the log4j, simply add one dependency called log4j.&#160; the run mvn dependency:resolve, get an error that might brings you here. <br /> <br /> <table border="0" cellspacing="0" cellpadding="2" width="660"><tbody> <tr bgcolor="#f0ffff"> <td valign="top" width="658"> <p>[INFO] ------------------------------------------------------------------------ <br />[ERROR] Failed to execute goal on project log4jexample: Could not resolve dependencies for project com.androidyou.test:log4jexample:jar:0.0.1-SNAPSHOT: The <u>following <br />artifacts could not be resolved: javax.jms:jms:jar:1.1, com.sun.jdmk:jmxtools:jar:1.2.1, com.sun.jmx:jmxri:jar:1.2.1: Could not transfer artifact javax.jms:jms:</u> <br />jar:1.1 from/to java.net (<a href="https://maven-repository.dev.java.net/nonav/repository):">https://maven-repository.dev.java.net/nonav/repository):</a> No connector available to access repository java.net (<a href="https://maven-repositor">https://maven-repositor</a> <br />y.dev.java.net/nonav/repository) of type legacy using the available factories WagonRepositoryConnectorFactory -&gt; [Help 1] <br />[ERROR] <br />[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. <br />[ERROR] Re-run Maven using the -X switch to enable full debug logging.</p> </td> </tr> </tbody></table> </p> <p>Pom.xml</p> <p><a href="http://lh6.ggpht.com/-xpVRZSsizy0/UQsPXt7svhI/AAAAAAAABS0/RXnbN8XDvxQ/s1600-h/image%25255B3%25255D.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh3.ggpht.com/-n5ya785WO9c/UQsPX2B0eVI/AAAAAAAABS8/fCTZPVqmaEw/image_thumb%25255B1%25255D.png?imgmax=800" width="320" height="121" /></a></p> <p>And the fix is easy, change the version 1.2.15-&gt;1.2.16 or 17 <br /><a href="http://lh4.ggpht.com/-ICXoMWbC_MA/UQsPYJGIm6I/AAAAAAAABTE/bbXtbVk8VTk/s1600-h/image%25255B7%25255D.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh5.ggpht.com/-9ZR69JbnnGA/UQsPYnJLLxI/AAAAAAAABTM/jGM2HArAuUw/image_thumb%25255B3%25255D.png?imgmax=800" width="705" height="158" /></a></p> http://androidyou.blogspot.com/2013/01/log4j-dependency-error.htmlnoreply@blogger.com (Ryan DH)0tag:blogger.com,1999:blog-4653070451761456668.post-4583762080730553979Wed, 19 Dec 2012 19:36:00 +00002012-12-19T11:36:19.611-08:00Android Project Ant Build, and put the version in the release file<p>When you created one project using the eclipse android project, by default you can only build the project, export as APK through the eclipse menu. </p> <p>Ant is another powerful build tool. you can convert the android project to a ant build target. then just run ant release to build the apk. here is one demo, <br />Give one project called FrameworkDemo <br /><a href="http://lh5.ggpht.com/-U__QGNs3Guo/UNIXGWqlULI/AAAAAAAABP0/fMBtfkA_VEE/s1600-h/image%25255B8%25255D.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh4.ggpht.com/-57zHo_7k1x0/UNIXGqRjXVI/AAAAAAAABP8/WJe-gHeaD6M/image_thumb%25255B4%25255D.png?imgmax=800" width="505" height="312" /></a> <br /> <br />run android update project –p . , it will create one ant build.xml file <br /><a href="http://lh4.ggpht.com/-JVayla9-5Kk/UNIXHLC5j3I/AAAAAAAABQE/UHLgneiVzbE/s1600-h/image%25255B13%25255D.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh4.ggpht.com/-1atmBGYgJew/UNIXHlLf0wI/AAAAAAAABQM/n5wKgAzOh_s/image_thumb%25255B7%25255D.png?imgmax=800" width="562" height="137" /></a> <br /> <br />run ant release, it will create one apk under the bin file, <br /><a href="http://lh3.ggpht.com/-ILmTEG7u6cs/UNIXIFTwKeI/AAAAAAAABQU/yO07VojCPbI/s1600-h/image%25255B17%25255D.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh4.ggpht.com/-koCFqPsjaXI/UNIXIj3LwsI/AAAAAAAABQc/XRXQDmzdcfg/image_thumb%25255B9%25255D.png?imgmax=800" width="844" height="67" /></a> <br /> <br />you can put the key information to the ant. properties, like <br /><a href="http://lh3.ggpht.com/-WqFgsn5-GvU/UNIXIykJioI/AAAAAAAABQk/CXo2j6yS8dY/s1600-h/image%25255B21%25255D.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh3.ggpht.com/-9nDZh6HmUYY/UNIXJ0GlYmI/AAAAAAAABQs/Zj0v2fcwcCE/image_thumb%25255B11%25255D.png?imgmax=800" width="539" height="84" /></a> <br /> <br />how ever, if you want the release file to be called projectname-youversion-release.apk, ( you can get the version from the AndroidManifest.xml <br /> <br />here is one quick fix. change build xml under platform/tools/ant <br />Add a target to extract the version informatino, <br /><a href="http://lh6.ggpht.com/-nQgLAIQhCRY/UNIXKD6T3MI/AAAAAAAABQ0/Z6-9oxWDDxs/s1600-h/image%25255B25%25255D.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh6.ggpht.com/-ChRqgmvZsyk/UNIXKfISWcI/AAAAAAAABQ8/SvlQpOvwVGE/image_thumb%25255B13%25255D.png?imgmax=800" width="796" height="317" /></a> <br />then reference this version <br /><a href="http://lh3.ggpht.com/-Yp4w8QUYmto/UNIXKgaC-vI/AAAAAAAABRE/-RQOhq4WpzE/s1600-h/image%25255B29%25255D.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh3.ggpht.com/-cCBE3k_pkFA/UNIXLaWHzYI/AAAAAAAABRM/LxWxfr8c4CU/image_thumb%25255B15%25255D.png?imgmax=800" width="1059" height="104" /></a> <br />Now build again, <br /><a href="http://lh6.ggpht.com/-Wbo6mfWGhK8/UNIXL_8M0OI/AAAAAAAABRU/hEDxn9M39V4/s1600-h/image%25255B33%25255D.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh6.ggpht.com/-i09ROisw39A/UNIXMP_T0XI/AAAAAAAABRc/G5EYevku8BI/image_thumb%25255B17%25255D.png?imgmax=800" width="547" height="42" /></a> <br />you can see the version in the file name.</p> http://androidyou.blogspot.com/2012/12/android-project-ant-build-and-put.htmlnoreply@blogger.com (Ryan DH)1tag:blogger.com,1999:blog-4653070451761456668.post-6467661217495999098Fri, 14 Dec 2012 23:02:00 +00002012-12-14T15:02:58.812-08:00Insert via batch_mutate using Aquiles, Delete, insert again - result is empty<p>Problem,</p> <blockquote> <p>using C# Cassandra Client Aquiles to insert some data to cassandra, then delete it using the cassandra CLI. after that insert the same data back again, result is empty.</p> <p>C# code, </p> <table border="0" cellspacing="0" cellpadding="2" width="779"><tbody> <tr> <td bgcolor="#f0ffff" valign="top" width="777"> <p>using Apache.Cassandra; <br />using Aquiles.Cassandra10; <br />using Aquiles.Core.Cluster; <br />using Aquiles.Helpers; <br />using Aquiles.Helpers.Encoders; <br />using System; <br />using System.Collections.Generic; <br />using System.Linq; <br />using System.Text; <br />using System.Threading.Tasks; <br />using CassandraClient = Apache.Cassandra.Cassandra.Client;</p> <p>namespace CSharpClient <br />{ <br />&#160;&#160;&#160; class Program <br />&#160;&#160;&#160; { <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; static void Main(string[] args) <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; { <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; new Program().PopulateDataWithBatchMutate(); <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Console.WriteLine(&quot;Finished&quot;);</p> <p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; }</p> <p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; private const string CLUSTERNAME = &quot;Test Cluster&quot;; <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; private const string KEYSPACENAME = &quot;exampleKeyspace&quot;; <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; private const string COLUMNFAMILYNAME = &quot;exampleCF&quot;;</p> <p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; private void PopulateDataWithBatchMutate() <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; { <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Dictionary&lt;byte[], Dictionary&lt;string, List&lt;Mutation&gt;&gt;&gt; mutation_map = new Dictionary&lt;byte[], Dictionary&lt;string, List&lt;Mutation&gt;&gt;&gt;(); <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; for (long i = 0; i &lt; 1; i++) <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; { <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; byte[] key = ByteEncoderHelper.LongEncoder.ToByteArray(i); <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Dictionary&lt;string, List&lt;Mutation&gt;&gt; cfMutation = new Dictionary&lt;string, List&lt;Mutation&gt;&gt;(); <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; List&lt;Mutation&gt; mutationList = new List&lt;Mutation&gt;(); <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; for (long j = 0; j &lt; 2; j++) <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; { <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; string columnName = String.Format(&quot;Data-{0:0000000000}&quot;, j); <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Mutation mutation = new Mutation() <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; { <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Column_or_supercolumn = new ColumnOrSuperColumn() <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; { <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Column = new Column() <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; { <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Name = ByteEncoderHelper.UTF8Encoder.ToByteArray(columnName), <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Timestamp = UnixHelper.UnixTimestamp, <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Value = ByteEncoderHelper.LongEncoder.ToByteArray(j), <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }, <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }, <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }; <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; mutationList.Add(mutation); <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; } <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; cfMutation.Add(COLUMNFAMILYNAME, mutationList); <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; mutation_map.Add(key, cfMutation); <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }</p> <p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; ICluster cluster = AquilesHelper.RetrieveCluster(CLUSTERNAME); <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; cluster.Execute(new ExecutionBlock(delegate(CassandraClient client) <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; { <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; client.batch_mutate(mutation_map, ConsistencyLevel.ONE); <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; return null; <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }), KEYSPACENAME); <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; } <br />&#160;&#160;&#160; } <br />} <br /></p> </td> </tr> </tbody></table> </blockquote> <p>&#160;&#160;&#160;&#160; 1st insert, <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; Data is there, <br /><a href="http://lh6.ggpht.com/-yFaOJ-dgYpc/UMuwFSdpW8I/AAAAAAAABNw/5FP1PFW9_OA/s1600-h/image%25255B4%25255D.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh4.ggpht.com/-klAYfKKtIqk/UMuwFiIey9I/AAAAAAAABN4/RN5IYpXrCwI/image_thumb%25255B2%25255D.png?imgmax=800" width="781" height="129" /></a></p> <p>&#160;&#160;&#160;&#160; then delete this row manually via cli, data is deleted, no problem so far. <br /><a href="http://lh4.ggpht.com/-w7YvAssxil8/UMuwGN_cU2I/AAAAAAAABOA/im0qJ9xszYI/s1600-h/image%25255B9%25255D.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh4.ggpht.com/-lAqtkjb4Ejg/UMuwGuEm4YI/AAAAAAAABOI/926UXLBzobs/image_thumb%25255B5%25255D.png?imgmax=800" width="487" height="151" /></a></p> <p>then run the code again to do another insert for same data.( STILL NO DATA. that’s the problem.) <br /><a href="http://lh4.ggpht.com/-UrdH-55wMeQ/UMuwG-l9aAI/AAAAAAAABOQ/oJLtiefKKMo/s1600-h/image%25255B14%25255D.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh6.ggpht.com/-DvluB5ld1g0/UMuwHcAh2-I/AAAAAAAABOY/jNFVI9VDbjE/image_thumb%25255B8%25255D.png?imgmax=800" width="361" height="104" /></a> <br /> <br />Why? <br />C# get incorrect timestamp, which is always older then the correct cassandra. so older insertion will always be ignored once there is one newer delete. <br /> <br />change the timestamp to the following code, will fix this issue. <br /><a href="http://lh4.ggpht.com/-pwoxfFI8GqA/UMuwH0r1FxI/AAAAAAAABOg/mu6F_pHRL2I/s1600-h/image%25255B19%25255D.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh6.ggpht.com/-2JNJ57SA6RU/UMuwIaa1jXI/AAAAAAAABOo/HWUuM2mGtUU/image_thumb%25255B11%25255D.png?imgmax=800" width="835" height="46" /></a></p> http://androidyou.blogspot.com/2012/12/insert-via-batchmutate-using-aquiles.htmlnoreply@blogger.com (Ryan DH)0tag:blogger.com,1999:blog-4653070451761456668.post-3899056527900455357Wed, 12 Dec 2012 19:26:00 +00002012-12-12T11:26:42.379-08:00How to, installation of Ganglia and setup Hadoop integration<p>Ganglia has three pieces, Gmond/Gmetad/Gweb, as you search ganglia using yum, you may see those 3 components. </p> <p><a href="http://lh6.ggpht.com/-owst-dafjdo/UMjaZKcB-yI/AAAAAAAABLs/vfOKivXMTfs/s1600-h/image%25255B4%25255D.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh5.ggpht.com/-cHq76ugy2mY/UMjaZROLMRI/AAAAAAAABL0/qtDyaURzWxE/image_thumb%25255B2%25255D.png?imgmax=800" width="545" height="237" /></a></p> <p>Gmond is the monitoring Agent, collecting data and persist it (need to be deployed to every server that we monitor.)</p> <p>So yum install ganglia-gmond. <br />&#160; <br /> in the /etc/gmond.conf, you can see the cluster name, change it to your cluster name, I will pickup the sameone like hadoop cluster. </p> <p>also it has some configuration about the multi-cast ( basically, monitoring agent using multi-cast to make the data replicated on each node. so every node&#160; could ansewer all the query request for each server in the same cluseter.) like the typically share-nothing cluster. each node also listens one tcp port. <br /> that’s it. after that we can start the gmond daemon. <br /> <br />run gmond –t (show the current configuration.) <br /> <br />Gmetad daemon aggregates monitroing data from the clusters. and persit the data using the rrdtool.</p> <p> <br />so you may need 1+ nodes to do the HA. yum install ganglia-gmetad <br /> <br />for the gmetad configuration, just add the data_source, point to one of the Gmond node <br />then the config like wheter to store the rrdtool. by default it’s under /var/lib/ganglia/rrds <br />then gmetad will begin collect data. you can check the folder to see wheter data got collected.</p> <p> <br />the last one is the gweb, as the name implies, it’s a web interface for the end user to see the charts. basically it’s a standard PHP application using the php-gd module to generate some dynamic charts. <br /> <br />yum install ganglia-gweb will download all the php files. and it’s under /usr/share/ganglia by default. <br /> <br />chose you fav. application, I will use the httpd, and just copy the files to the html root ,for me will be /var/www/html <br /> <br />you need fix the conf.php mappting to /etc/ganglia/conf.php <br /><a href="http://lh6.ggpht.com/-UpHxRjPxHek/UMjaaD8pL4I/AAAAAAAABL8/eccCR9UEU9A/s1600-h/image%25255B8%25255D.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh4.ggpht.com/-DkoKxgE02Us/UMjaaQli1AI/AAAAAAAABME/KPxUMFplhJY/image_thumb%25255B4%25255D.png?imgmax=800" width="647" height="87" /></a> <br /></p> <p>you need tell the web where is the data located ( the data gmetad aggreateed) then that’s it. <br /> <br />then you can see <a href="http://webserver/ganglia">http://webserver/ganglia</a> to see the charts. <br /> <br />for the hadoop/hbase, just change the&#160; hadoop-metrics.properties under the hadoop conf folder. <br /> <br />point the class to gangliacontext and remember to setup the server to the muliticast ip instead of localhost , anotherwise, no data will be collected if you use the default gmond mulit-cast mode <br /> <br /><a href="http://lh5.ggpht.com/-pcC4y6wztkk/UMjaawfhZdI/AAAAAAAABMM/u-hqSopVZyg/s1600-h/image%25255B13%25255D.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh6.ggpht.com/-NTGMYOd2RMA/UMjabj3jRwI/AAAAAAAABMU/fegvvycn9Y8/image_thumb%25255B7%25255D.png?imgmax=800" width="642" height="529" /></a> <br /> <br />then you can see it in the ganglia console, like the metrics of the hadoop</p> <p><a href="http://lh3.ggpht.com/-3W89wdY7L9c/UMjabz2b3hI/AAAAAAAABMc/9sBPkEcQpjc/s1600-h/image%25255B17%25255D.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh6.ggpht.com/-CtshoEqNfX8/UMjacZrklFI/AAAAAAAABMk/PQJF0LKqxL4/image_thumb%25255B9%25255D.png?imgmax=800" width="868" height="149" /></a></p> http://androidyou.blogspot.com/2012/12/how-to-installation-of-ganglia-and.htmlnoreply@blogger.com (Ryan DH)0tag:blogger.com,1999:blog-4653070451761456668.post-5700774310577241508Thu, 29 Nov 2012 19:21:00 +00002012-11-29T11:21:31.273-08:00How to: invoke C# generic method dynamically<table border="0" cellspacing="0" cellpadding="2" width="780"><tbody> <tr> <td valign="top" width="778">Here is the sample code I figure out, <br /> <p>using System;</p> <p>namespace X <br />{ <br />&#160;&#160;&#160; class Program <br />&#160;&#160;&#160; { <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; static void Main(string[] args) <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; { <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; string byString = &quot;Today&quot;; //or tomorow</p> <p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; var GenericType = Type.GetType(&quot;X.&quot; + byString); <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; var GenericIns = Activator.CreateInstance(GenericType);</p> <p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; var genericMethod = typeof(Program).GetMethod(&quot;GetList&quot;) <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; .MakeGenericMethod(GenericType);</p> <p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; var output = genericMethod.Invoke(null, new object[] { GenericIns });</p> <p> <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; }</p> <p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; public static T GetList&lt;T&gt;(T input) where T : new() <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; { <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Console.WriteLine(&quot;Invoked &quot; + input); <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; return input; <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; } <br />&#160;&#160;&#160; }</p> <p>&#160;&#160;&#160; class Today <br />&#160;&#160;&#160; { <br />&#160;&#160;&#160; }</p> <p>&#160;&#160;&#160; class Tomorrow <br />&#160;&#160;&#160; { <br />&#160;&#160;&#160; } <br />} <br /></p> </td> </tr> </tbody></table> http://androidyou.blogspot.com/2012/11/how-to-invoke-c-generic-method.htmlnoreply@blogger.com (Ryan DH)0tag:blogger.com,1999:blog-4653070451761456668.post-8921641581798711258Wed, 21 Nov 2012 19:47:00 +00002012-11-21T11:47:42.423-08:00asp.net , Request.Url differs between .net versions with Load balancer<p>Got a weird problem, here is the quick story. I have several Web servers with the web app binding to private port 8011. the Load balancer has a Name like LB. when the page display the request Uri. it returns very weird format.&#160; <a href="http://LB:8081">http://LB:8081</a> (so basically, LB name + Private Port) , no body can access this Url. </p> <p>To do the simple test. I setup one test page on IIS with port8011, return the current URL. <br /><a href="http://lh5.ggpht.com/-1I7_lrw1DQY/UK0vtujZSCI/AAAAAAAABI0/iC3-vPohUmM/s1600-h/image%25255B4%25255D.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh3.ggpht.com/-tK6PxJpQLYY/UK0vuBjF8oI/AAAAAAAABI8/e_tJs8uewws/image_thumb%25255B2%25255D.png?imgmax=800" width="713" height="86" /></a></p> <p>then try access using the private url, it’s ok</p> <p><a href="http://lh3.ggpht.com/-xo50cEEmeN4/UK0vucl4PVI/AAAAAAAABJE/cvvJHdZqaFg/s1600-h/image%25255B8%25255D.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh6.ggpht.com/-pELESiYBsQ8/UK0vvvAiwNI/AAAAAAAABJM/PtoB4PhR3CQ/image_thumb%25255B4%25255D.png?imgmax=800" width="834" height="94" /></a></p> <p>However, if I setup one LB with LB_NAME, and LISTEN on Port 8888. then I try access the LB address. get unreachable url. <br /><a href="http://lh4.ggpht.com/-TIjykwWP19g/UK0vv_vnjaI/AAAAAAAABJU/uUDOv63ZDZ8/s1600-h/image%25255B12%25255D.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh4.ggpht.com/-N-JIBPXvT8w/UK0vwvW4dUI/AAAAAAAABJc/_vJE4PfGs1Q/image_thumb%25255B6%25255D.png?imgmax=800" width="831" height="90" /></a></p> <p>then I check the code, for .net 4.0. it has the option to follow the Url&#160; from the user request. add one setting called aspnet:UseHostHeaderForRequestUrl <br /><a href="http://lh4.ggpht.com/-VbU_B8bJViQ/UK0vxIGiFXI/AAAAAAAABJk/pmZZNBLhzT4/s1600-h/image%25255B17%25255D.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh5.ggpht.com/-jmxO7ycT7sE/UK0vxiqdyNI/AAAAAAAABJs/NXVAuK_mknQ/image_thumb%25255B9%25255D.png?imgmax=800" width="545" height="60" /></a> <br /> <br />then we get the url as user sent in the request <br /><a href="http://lh3.ggpht.com/-cAGh2buoPTo/UK0vyhXLWZI/AAAAAAAABJ0/P7pM2If2AvA/s1600-h/image%25255B22%25255D.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh3.ggpht.com/-4WTD3GiWUbI/UK0vzDOJiPI/AAAAAAAABJ8/iytQl0MZX3s/image_thumb%25255B12%25255D.png?imgmax=800" width="818" height="108" /></a></p> <p>If you check the .net 4.0 code, it has the following logic to get URL.</p> <p><a href="http://lh3.ggpht.com/-qNxF9yZ8VdE/UK0vzoSXPDI/AAAAAAAABKE/yih1D3asR9g/s1600-h/image%25255B27%25255D.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh4.ggpht.com/-DNJxyyZho3A/UK0v1FwCEQI/AAAAAAAABKM/_oYjNBK-qho/image_thumb%25255B15%25255D.png?imgmax=800" width="771" height="556" /></a></p> <p>code to get new settings, <br /><a href="http://lh3.ggpht.com/-vGE-X2XRDxI/UK0v2VMg6_I/AAAAAAAABKU/mSzowI7eam8/s1600-h/image%25255B32%25255D.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh6.ggpht.com/-e-qLKpB-d20/UK0v2zhhWcI/AAAAAAAABKc/bosf69fW2g0/image_thumb%25255B18%25255D.png?imgmax=800" width="822" height="469" /></a></p> <p>&#160;</p> <p>But this only applies to .net fx with latest patch. so check the code using reflector in your real case.</p> http://androidyou.blogspot.com/2012/11/aspnet-requesturl-differs-between-net.htmlnoreply@blogger.com (Ryan DH)0tag:blogger.com,1999:blog-4653070451761456668.post-7069720704430247670Wed, 07 Nov 2012 20:03:00 +00002012-11-07T12:03:49.293-08:00Google Tag Manager tutorial.<p>As the name says, it’s a tag manager offered by Google for free. Here is one basically tutorial show you what it can do, what kind of benefit it can bring to your table. </p> <p>Basic Idea, you just Insert one google tag manager script to your website, then From the google tag manager console, you can push to deploy different other scripts. like anlaytics tagging, even a customized html , or javascript, img tag. </p> <p>So first sign up for a account, create one container, get the script you need to inject to your website, try insert the script after &lt;body&gt; tag. if you insert it to blogger, parse the special tags, like &amp; to &amp;amp;</p> <p><a href="http://lh6.ggpht.com/-emVvtmKDF8U/UJq-jixx4zI/AAAAAAAABGw/XIOTxISnlVM/s1600-h/image%25255B4%25255D.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh3.ggpht.com/-4gZpo8Mt220/UJq-kU9zNkI/AAAAAAAABG4/ELIvU07OD5s/image_thumb%25255B2%25255D.png?imgmax=800" width="694" height="436" /></a></p> <p>Then time to create some tags and test to see the tags on your website.&#160; <br />&#160; we create one tag to inject the firstaccess cookie to record the first time user hit the web site,</p> <p><a href="http://lh4.ggpht.com/-I7FMRrrl-Z4/UJq-lRnUjLI/AAAAAAAABHA/Yf_6098QJs8/s1600-h/image%25255B9%25255D.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh4.ggpht.com/-_yY8YV3UK5g/UJq-l45u72I/AAAAAAAABHI/funSerfnLa8/image_thumb%25255B5%25255D.png?imgmax=800" width="680" height="441" /></a></p> <p>for the rules, we applied to all pages. <br /> <br />that’s for tag creating process, now we need to publish this tags. <br />Click the create version button, <br /><a href="http://lh5.ggpht.com/-2Jxc3tVpZn0/UJq-msasnKI/AAAAAAAABHQ/TsZq1gmlT84/s1600-h/image%25255B14%25255D.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh4.ggpht.com/-iTeF5rexC24/UJq-nBARIJI/AAAAAAAABHY/q-sKQ-uXUlk/image_thumb%25255B8%25255D.png?imgmax=800" width="381" height="143" /></a> <br />it will create one new version with all the current tags, <br />in each version , you can click save and publish. or SaveandPreview. <br /> <br />savepreview give us change to make sure tags executed. so we click the save and preview mode. <br />you may see the msg telling you you are in the preview and debug mode. yes, we are!</p> <p>Now go you your website, <br />a window will popoup showing you which tag get executed, for me, the inject cookie one. <br /><a href="http://lh4.ggpht.com/-qEBx5Owphqs/UJq-oKUVBKI/AAAAAAAABHg/qusdGb__W6M/s1600-h/image%25255B19%25255D.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh3.ggpht.com/-I65auKdagbE/UJq-o0aZTKI/AAAAAAAABHo/mbOFO-Fmgtc/image_thumb%25255B11%25255D.png?imgmax=800" width="1031" height="261" /></a></p> <p>once confirmed ok, exit the preview mode and publish it. <br />now, go to my web page, you can see we have the firstaccess cookie is there, we injected successfully. <br />here is the code for your reference, <br /></p> <p> <table border="0" cellspacing="0" cellpadding="2" width="580"><tbody> <tr> <td valign="top" width="578" bgcolor='#987698' > <p>&lt;script&gt; <br />function setCookie(c_name,value,exdays) <br />{ <br />var exdate=new Date(); <br />exdate.setDate(exdate.getDate() + exdays); <br />var c_value=escape(value) + ((exdays==null) ? &quot;&quot; : &quot;; expires=&quot;+exdate.toUTCString()); <br />document.cookie=c_name + &quot;=&quot; + c_value; <br />}</p> <p>function getCookie(c_name) <br />{ <br />var i,x,y,ARRcookies=document.cookie.split(&quot;;&quot;); <br />for (i=0;i&lt;ARRcookies.length;i++) <br />{ <br />&#160; x=ARRcookies[i].substr(0,ARRcookies[i].indexOf(&quot;=&quot;)); <br />&#160; y=ARRcookies[i].substr(ARRcookies[i].indexOf(&quot;=&quot;)+1); <br />&#160; x=x.replace(/^\s+|\s+$/g,&quot;&quot;); <br />&#160; if (x==c_name) <br />&#160;&#160;&#160; { <br />&#160;&#160;&#160; return unescape(y); <br />&#160;&#160;&#160; } <br />&#160; } <br />}</p> <p>if( ! getCookie('firstaccess')) <br />{ <br />setCookie('firstaccess',new Date(),100); <br />}</p> <p>&lt;/script&gt; <br /></p> </td> </tr> </tbody></table></p> http://androidyou.blogspot.com/2012/11/google-tag-manager-tutorial.htmlnoreply@blogger.com (Ryan DH)0tag:blogger.com,1999:blog-4653070451761456668.post-8054615464672152779Fri, 05 Oct 2012 16:11:00 +00002012-10-05T09:11:27.440-07:00Ubuntu /centos virtual machine doesn't have IP address/ can't connect to network?<p>you may turn on the NAT/Bridget/HOST ONly setting for your GUEST OS, but when you run the ifoncfig, there is no IP v4 address associated. <br /><a href="http://lh5.ggpht.com/-Um7k2AWuzS8/UG8Gop_Tb6I/AAAAAAAABFI/yHp693ax3NI/s1600-h/image%25255B4%25255D.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh6.ggpht.com/-nzQTEXwne5Q/UG8GpYKdRXI/AAAAAAAABFQ/bWYzpsr99po/image_thumb%25255B2%25255D.png?imgmax=800" width="624" height="348" /></a></p> <p>Basically, make sure on the HOST machine, the vmware/virtualbox DHCP service are running, <br /><a href="http://lh3.ggpht.com/-oDmjUTCoZCA/UG8GqACLU8I/AAAAAAAABFY/SZ4ad_4FZxI/s1600-h/image%25255B9%25255D.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh6.ggpht.com/-TllkRaXazPY/UG8Gq8kDc3I/AAAAAAAABFg/cR0eRaMNb68/image_thumb%25255B5%25255D.png?imgmax=800" width="719" height="105" /></a> <br />then run dhclient eth0, you should be able to get a IPv4 address. <br /> <br />for the windows host machine, the dhcp range are stored in the registry. so make sure the VMnet NIC ip address match the network address, otherwise, from the host machine, you can’t ping or access the guest OS.</p> <p><a href="http://lh6.ggpht.com/-3c282b8SZGU/UG8GrPeyRoI/AAAAAAAABFo/_G48J23EfQQ/s1600-h/image%25255B14%25255D.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh6.ggpht.com/-D4YqeK3tecY/UG8GrTvVNSI/AAAAAAAABFw/BJTB9Qx5ZC4/image_thumb%25255B8%25255D.png?imgmax=800" width="961" height="364" /></a></p> http://androidyou.blogspot.com/2012/10/ubuntu-centos-virtual-machine-doesn.htmlnoreply@blogger.com (Ryan DH)0tag:blogger.com,1999:blog-4653070451761456668.post-1425193466151288983Thu, 04 Oct 2012 19:04:00 +00002012-10-04T12:13:43.049-07:00asp.net output cache not working? and the same code works on some servers? why<p>Here is one very typical issue that bring you to this blog. <br /><strong><u><font size="3">I</font>ssues</u></strong>, I have one asp.net application with nothing special, for the performance consideration, we turn on the output cache. somehow, the same page never got cached on some servers, and It did cached on most servers. of vice versa. <br /> <br />short answer, It has nothing to be with the IIS Version. It’s All about HTTP Cookies and .net Framework version.&#160; Let’s put a very basic Page. <br /> <br />just turn on the output cache using the most simple way, <br /><a href="http://lh4.ggpht.com/-LOWfxB9fBkw/UG3dfSn1FMI/AAAAAAAABBE/vZLCPuScdXY/s1600-h/image%25255B4%25255D.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh6.ggpht.com/-RpDjwaoqAEE/UG3df4bZ0TI/AAAAAAAABBM/9OWQJxShtPE/image_thumb%25255B2%25255D.png?imgmax=800" width="439" height="65" /></a> <br /> <br />for the code, we just send out some cookie, <br /><a href="http://lh5.ggpht.com/-787ORYt33rQ/UG3f41vcmpI/AAAAAAAABEE/x8m3eyYDCEg/s1600-h/image%25255B5%25255D.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh6.ggpht.com/-bcmib4ABHtM/UG3f5TAfjVI/AAAAAAAABEM/-Rk7k5lJ0fM/image_thumb%25255B2%25255D.png?imgmax=800" width="673" height="328" /></a></p> <p>Let’s start from some server that it works, <br />1st time you hit the url, get a initial access time. </p> <p><a href="http://lh5.ggpht.com/-BVx4g34dExI/UG3diAtbSFI/AAAAAAAABBk/vtF74fAjd8g/s1600-h/image%25255B32%25255D.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh5.ggpht.com/-RfzzUuBN2z8/UG3divv17CI/AAAAAAAABBs/32Fnnkc-Eww/image_thumb%25255B18%25255D.png?imgmax=800" width="195" height="85" /></a> <br /> <br />&#160; and cookie was sent to client from server side, <br /><a href="http://lh5.ggpht.com/-PdYfnwL-axw/UG3di7BoA1I/AAAAAAAABB0/93Es398jJJw/s1600-h/image%25255B37%25255D.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh3.ggpht.com/-SO3wg8XLyq4/UG3djeGAm4I/AAAAAAAABB8/DFwY86TdsQo/image_thumb%25255B21%25255D.png?imgmax=800" width="583" height="214" /></a></p> <p>try again, this page will be cached. you are always see the page, you are 1st time here, <br /><a href="http://lh3.ggpht.com/-g1vHbNznU24/UG3dj89uXvI/AAAAAAAABCE/NSBLvxY64V0/s1600-h/image%25255B42%25255D.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh5.ggpht.com/-JMwRwXC0pKM/UG3dkLKDMzI/AAAAAAAABCM/iDgcZsUZvZw/image_thumb%25255B24%25255D.png?imgmax=800" width="385" height="119" /></a></p> <p>Why? because we setup the page need to be cached for 600 seconds, and cache response vary by any params, if we add something to the url parameter, we wills see refreshed page, <br /><a href="http://lh4.ggpht.com/-72_zVcJhSjI/UG3dkR3J6_I/AAAAAAAABCU/Yi3ni7NXBeY/s1600-h/image%25255B46%25255D.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh3.ggpht.com/-Xfo0QubJxDw/UG3dk7TmvLI/AAAAAAAABCc/vtJwjhsZ2JQ/image_thumb%25255B26%25255D.png?imgmax=800" width="217" height="82" /></a></p> <p>that’s the end of this cache working story, if we deploy the same code to another server, results are totally different. <br />1st time, <br /><a href="http://lh4.ggpht.com/-OIzGcfdeLsg/UG3dlSkxN_I/AAAAAAAABCk/BAbYR6XHCLU/s1600-h/image%25255B62%25255D.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh6.ggpht.com/-vx6WdbECW3E/UG3dl7l9-tI/AAAAAAAABCs/FQmN6dBArms/image_thumb%25255B34%25255D.png?imgmax=800" width="236" height="89" /></a></p> <p>retry, <br /><a href="http://lh4.ggpht.com/-Iq_LsTS-noI/UG3dmGXiV6I/AAAAAAAABC0/NivfML02C7s/s1600-h/image%25255B66%25255D.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh6.ggpht.com/-v_E6CQBwgOQ/UG3dmhv6ahI/AAAAAAAABC8/FmzfRDQ9yO0/image_thumb%25255B36%25255D.png?imgmax=800" width="177" height="82" /></a> <br /> <br />Why? I did a lot check, and find out the reason is simple. IT’S BECAUSE OF THE .NET FRAMEWORK VERSION. <br /> <br />In earlier verison of the FX, if you check the ouputCacheModule , it will cache response without checking the cookie value, that means even response has a server side cookie, it will still cache the response. <br /><a href="http://lh4.ggpht.com/-vivZt18MJ2o/UG3dm73XvbI/AAAAAAAABDE/gjmps-Z2nEI/s1600-h/image%25255B71%25255D.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh4.ggpht.com/-cnTNyXwGy2Y/UG3dnm1wQaI/AAAAAAAABDM/BT4OJELuu_0/image_thumb%25255B39%25255D.png?imgmax=800" width="920" height="333" /></a> <br /> <br />But for newer version, it will simply ignore the cache insert if response has cookie associated. <br />&#160;<a href="http://lh5.ggpht.com/-0cMkIJm9DZ8/UG3doDSjPKI/AAAAAAAABDU/namZrxiWkmI/s1600-h/image%25255B81%25255D.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh5.ggpht.com/-zZjFPX9Tq30/UG3dotiVFbI/AAAAAAAABDc/Ea8GzBlQFZ0/image_thumb%25255B45%25255D.png?imgmax=800" width="865" height="390" /></a> <br /> <br />my old version is, .4209, it never check cookie when cache response. that means you may see other people’s response (like login name?) <br /><a href="http://lh3.ggpht.com/-KWjYHU87Q9c/UG3dpKHB_AI/AAAAAAAABDk/TJDZqIlR5Sg/s1600-h/image%25255B86%25255D.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh6.ggpht.com/-DM7jO0Vs_DQ/UG3dpuUGWKI/AAAAAAAABDs/rh0GVAR4TdE/image_thumb%25255B48%25255D.png?imgmax=800" width="336" height="286" /></a> <br />new version,.5456, it will check cookie which is more safe. <br /><a href="http://lh4.ggpht.com/-AF1wEFDAo6s/UG3dp62ztQI/AAAAAAAABD0/j9hgSocoULU/s1600-h/image%25255B91%25255D.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh5.ggpht.com/-GY-Nxv9f25s/UG3dqX1mFyI/AAAAAAAABD8/5mSWi0dA6Sk/image_thumb%25255B51%25255D.png?imgmax=800" width="374" height="443" /></a> <br /> <br />Hope it helps. </p> http://androidyou.blogspot.com/2012/10/aspnet-output-cache-not-working-and.htmlnoreply@blogger.com (Ryan DH)0tag:blogger.com,1999:blog-4653070451761456668.post-7435969474699989632Wed, 03 Oct 2012 19:02:00 +00002012-10-03T12:02:13.928-07:00How to test RamDisk /Ram disk on centos<p>It turns out super easy to setup one RAM disk on centos, since linux 2.4 and beyond has the built-in support for ramdisk. </p> <p>when you check the /dev/ram*, you may see a lot virtual RAM devices. <br /><a href="http://lh4.ggpht.com/-Z6vSD7aMBEA/UGyLfB6Pb0I/AAAAAAAAA_E/8OMvMy4Vwi8/s1600-h/image%25255B4%25255D.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh5.ggpht.com/-SVqTTN1aCck/UGyLfgJir3I/AAAAAAAAA_M/W6zOe7YVgYI/image_thumb%25255B2%25255D.png?imgmax=800" width="584" height="345" /></a></p> <p>by default the ram device is very small, could be just less than 100Mb, so first step is always incresing the ramdisk size, to do so, append the ramdisk_size=numberofKBs to the boot config /etc/grub.conf <br /> <br /><a href="http://lh4.ggpht.com/-7YgtD5hL1SM/UGyLhcUG6II/AAAAAAAAA_U/bW0cxCnqx_g/s1600-h/image%25255B9%25255D.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh4.ggpht.com/-4xtuc-FhTNk/UGyLh89UpkI/AAAAAAAAA_c/jFHPsxDaInk/image_thumb%25255B5%25255D.png?imgmax=800" width="667" height="197" /></a></p> <p>restart the server to make it refresh the changes. <br />now, let me create one fs first on /dev/ram1, mke2fs –m 0 /dev/ram1</p> <p><a href="http://lh6.ggpht.com/-kNoSoTOD6kc/UGyLjsuHdeI/AAAAAAAAA_k/VNCa7XXIAm0/s1600-h/image%25255B14%25255D.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh4.ggpht.com/--3SuqbCHhJY/UGyLrDIHhyI/AAAAAAAAA_s/vQOH6i8NKVQ/image_thumb%25255B8%25255D.png?imgmax=800" width="608" height="382" /></a></p> <p>then create one folder, and map the disk to this folder, <br /><a href="http://lh3.ggpht.com/-dHpEHalHvTA/UGyLrqUw_AI/AAAAAAAAA_0/WntElS3bAaY/s1600-h/image%25255B19%25255D.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh6.ggpht.com/-cwmzZX2FFRg/UGyLsaRE98I/AAAAAAAAA_8/7jfrvuYHCy0/image_thumb%25255B11%25255D.png?imgmax=800" width="309" height="98" /></a></p> <p>however, the ramdisk and data can’t survive the reboot, so you may put some script under rc.local to load the ramdisk and data. <br /> <br />run some basic testing, <br /><a href="http://lh3.ggpht.com/-GFynupCjI5k/UGyLs5gvzeI/AAAAAAAABAE/zA0bXZq8pY4/s1600-h/image%25255B24%25255D.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh4.ggpht.com/-0Plpa3aCy28/UGyLtLbjElI/AAAAAAAABAM/Qk8lqLITZsk/image_thumb%25255B14%25255D.png?imgmax=800" width="529" height="148" /></a></p> http://androidyou.blogspot.com/2012/10/how-to-test-ramdisk-ram-disk-on-centos.htmlnoreply@blogger.com (Ryan DH)1tag:blogger.com,1999:blog-4653070451761456668.post-2697188260083651341Fri, 28 Sep 2012 22:47:00 +00002012-09-28T15:50:11.371-07:00How to capture network traffic through command line in C#<p>Wireshark is a GUI tool which enable us to click and capture network traffic. if you are IT admin guy, you may want something like tcpdump in linux. actually, bundled with the wireshark installation, there is one tool called <u>tshark.exe</u></p> <p><a href="http://lh3.ggpht.com/-nBtw8pMBqTE/UGYo-5Rx3RI/AAAAAAAAA9U/72CPcejsk1c/s1600-h/image%25255B4%25255D.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh4.ggpht.com/-R-WEjqNrLSc/UGYo_DhZbkI/AAAAAAAAA9c/o7sJMCasG60/image_thumb%25255B2%25255D.png?imgmax=800" width="459" height="192" /></a></p> <p>you can run tshark –D to list all the NIC interfaces, <br /><a href="http://lh3.ggpht.com/-genQOzffbdg/UGYpADtgBeI/AAAAAAAAA9k/YdTYRfKlLF4/s1600-h/image%25255B9%25255D.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh4.ggpht.com/-5oHbiqr-NPA/UGYpAUeIKaI/AAAAAAAAA9o/yC_mQNXvSao/image_thumb%25255B5%25255D.png?imgmax=800" width="497" height="89" /></a></p> <p>If you want to see traffic for interface 4,using the –i command</p> <p><a href="http://lh3.ggpht.com/-PWYUBzLtyrw/UGYpnDaA0VI/AAAAAAAAA90/C1JnkiIjsug/s1600-h/image%25255B4%25255D.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh3.ggpht.com/-WEqkMRYqI2I/UGYpnUPDXYI/AAAAAAAAA98/l1eML1D5Nc0/image_thumb%25255B2%25255D.png?imgmax=800" width="636" height="152" /></a></p> <p>for me , I just wondering to know which app is trying to send out some http traffic, <br /><a href="http://lh4.ggpht.com/-ER30uUaZ4QM/UGYpoPj9qbI/AAAAAAAAA-E/fCyr8DFchhs/s1600-h/image%25255B9%25255D.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh3.ggpht.com/-umqo80GTxYU/UGYpouzihsI/AAAAAAAAA-M/Fjdl9YplHDw/image_thumb%25255B5%25255D.png?imgmax=800" width="952" height="118" /></a> <br />once found it, love it!</p> http://androidyou.blogspot.com/2012/09/how-to-capture-network-traffic-through.htmlnoreply@blogger.com (Ryan DH)0tag:blogger.com,1999:blog-4653070451761456668.post-5604791365254309498Thu, 27 Sep 2012 18:28:00 +00002012-09-27T11:28:40.002-07:00Cassandra DSE, Testing Solr integration<p>SOLR support is one of the DataStax commercial offering for cassandra. which basically enable us to run a real-time solr query against the data in the cassandra. Here is one basic try of the features. <br /> <br />when you create the DSE cluster, you can change some node by setting the /etc/default/dse enable hadoop or Solr. <br />Change the SOLR_ENABLED or HADOOP_ENABLED one will add one more role to that Cassandra node. <br /><a href="http://lh4.ggpht.com/-RqbytHz3xOc/UGSaq_Q0qzI/AAAAAAAAA5E/ZYOh-qmIwYs/s1600-h/image%25255B3%25255D.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh3.ggpht.com/-X1AmRu87hSY/UGSarfyFK6I/AAAAAAAAA5M/Yxq2EQuJ6Kk/image_thumb%25255B1%25255D.png?imgmax=800" width="578" height="320" /></a></p> <p>For me, I have 8 Nodes as a whole cluster. 3 as regular cassandra, 3 as Hadoop node, 2 as SOLR, you can see fro the ops center view. or just through node tool. </p> <p><a href="http://lh5.ggpht.com/-Xu95SPSqZZo/UGSarwElpiI/AAAAAAAAA5Q/AX5W_9pNyxk/s1600-h/image%25255B8%25255D.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh6.ggpht.com/-wGLmfWy5_tE/UGSasMBV_WI/AAAAAAAAA5c/YQNQY4iqbOE/image_thumb%25255B4%25255D.png?imgmax=800" width="502" height="174" /></a></p> <p><a href="http://lh4.ggpht.com/-OV7EK67ZX-E/UGSaszPEUEI/AAAAAAAAA5k/wFPoGEAJ-JQ/s1600-h/image%25255B12%25255D.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh4.ggpht.com/-_QOygMNDrc4/UGSatLBnbNI/AAAAAAAAA5s/5mIxlBnoNkY/image_thumb%25255B6%25255D.png?imgmax=800" width="732" height="838" /></a></p> <p>Now Let’s create one KS called <u>solrtest</u> first through the OPscenter admin ui, <br /><a href="http://lh3.ggpht.com/-4JicE5K8utg/UGSatl0IVyI/AAAAAAAAA50/kWiOumJAXWc/s1600-h/image%25255B16%25255D.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh6.ggpht.com/-QqIpeE8s2r0/UGSatz_OuiI/AAAAAAAAA58/Cf0-t6PEun4/image_thumb%25255B8%25255D.png?imgmax=800" width="522" height="385" /></a></p> <p>And create one column family called info using Cqlsh. and load some data. </p> <p><a href="http://lh5.ggpht.com/-dWfdBFAvESA/UGSauWnrjrI/AAAAAAAAA6E/o2f5rvd_nGI/s1600-h/image%25255B30%25255D.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh6.ggpht.com/-ZQWwRDJeS0s/UGSau2zGvcI/AAAAAAAAA6M/BSF0mw0Mqwo/image_thumb%25255B16%25255D.png?imgmax=800" width="917" height="134" /></a></p> <p>DSE has some default mapping between the data stored in cassandra, and data needed to be indexed to SOLR. <br /><a href="http://lh4.ggpht.com/-Q-VN6sfWl9g/UGSavLA3ueI/AAAAAAAAA6U/9oni5X-gZqU/s1600-h/image%25255B26%25255D.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh5.ggpht.com/-aiGOB0qXApc/UGSavgAGIWI/AAAAAAAAA6c/FVQ924Z5wpk/image_thumb%25255B14%25255D.png?imgmax=800" width="351" height="164" /></a></p> <p>By default, Nodes will be mapped to Shard. for my case, I have 2 Solr nodes, that means I have 2 Solr Shards. CF will be mapped to Core, so here I need to tell the system I want to index info column family.&#160; for columns in that CF, will be mapped to solr field. we can pick which columns need to be indexed throught some level of configration called schema.xml which is the same file in SOLR.</p> <p>in the /usr/share/dse-demo/wikipedia , there are some sample schemas and script. <br />&#160; we change the schema.xml first, basically we just need two fields to be indexed, and default search field is comments, <br /><a href="http://lh4.ggpht.com/-LaCNlfKsJQ8/UGSav0DcLbI/AAAAAAAAA6k/rhkVZD00y9A/s1600-h/image%25255B35%25255D.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh4.ggpht.com/-cgE1QN5x--M/UGSawY-uNpI/AAAAAAAAA6s/u0-9Juil-GU/image_thumb%25255B19%25255D.png?imgmax=800" width="661" height="246" /></a> <br /> <br />then we need post his xml to SOLR, here is one script called 1-add-schema.sh <br /><a href="http://lh6.ggpht.com/-uZu0VcxcXX4/UGSawkdTynI/AAAAAAAAA60/xWbBj0LKVMs/s1600-h/image%25255B39%25255D.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh3.ggpht.com/-Rt16mftDqmM/UGSaw2rfBnI/AAAAAAAAA68/4-xKp7kmMY0/image_thumb%25255B21%25255D.png?imgmax=800" width="759" height="229" /></a> <br /> <br />change the mapping url, shoul <a title="http://localhost:8983/solr/resource/solrtest.info/solrconfig.xml&#13;&#10;" href="http://ANYSOLRNODE:8983/solr/resource/KEYSPACE.CF/solrconfig.xml">http://<u>ANYSOLRNODE</u>:8983/solr/resource/<u>KEYSPACE</u>.<u>CF</u>/solrconfig.xml <br /></a> <br />then we run the script to post the schema, and config file. (you are only need run this for one solr server, the solr server shared those configuration.) <br /> <br />after done, you can access. <br /><a href="http://ANYSOlrServer:8983/solr/KEYSPACE.CF/admin/">http://ANYSOlrServer:8983/solr/KEYSPACE.CF/admin/</a> to see the solr admin ui, <br /><a href="http://lh3.ggpht.com/-VFyhgfg280Y/UGSaxW3J69I/AAAAAAAAA7E/AyLT3JATq-I/s1600-h/image%25255B43%25255D.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh4.ggpht.com/-P6pG0t6jqNk/UGSax92YCQI/AAAAAAAAA7M/GmD7du6OU8o/image_thumb%25255B23%25255D.png?imgmax=800" width="1062" height="518" /></a></p> <p>when you run search, you can see the docs returned as expected. <br /><a href="http://lh6.ggpht.com/-UjiG0Yosil0/UGSayI9FLWI/AAAAAAAAA7U/lsoQTxmK59s/s1600-h/image%25255B47%25255D.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh5.ggpht.com/-My87ZuJmSWU/UGSaySIHLFI/AAAAAAAAA7c/vYXblh2KJBs/image_thumb%25255B25%25255D.png?imgmax=800" width="771" height="485" /></a></p> <p>if we change the query to comments:hello, then only first doc will be returned <br /><a href="http://lh4.ggpht.com/-jxYg6_l4Di0/UGSazL67CII/AAAAAAAAA7k/K9RWMbLVYak/s1600-h/image%25255B52%25255D.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh5.ggpht.com/-wfDayc8gn1c/UGSazYyfcoI/AAAAAAAAA7s/qxOGiJvr7zY/image_thumb%25255B28%25255D.png?imgmax=800" width="763" height="425" /></a></p> <p>If we insert more data, those data will be indexed on the fly. <br /><a href="http://lh5.ggpht.com/-GTRxrWxwsNs/UGSazzIduaI/AAAAAAAAA70/6bdX4Ti4Dj8/s1600-h/image%25255B56%25255D.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh3.ggpht.com/-qSox7x31e6I/UGSa0I-CceI/AAAAAAAAA78/9IW4PBLDzdA/image_thumb%25255B30%25255D.png?imgmax=800" width="571" height="43" /></a> <br />search solr, 2 docs returned. </p> <p><a href="http://lh6.ggpht.com/-y3tBlmiGiOs/UGSa0evciNI/AAAAAAAAA8E/2R7dFovATBg/s1600-h/image%25255B60%25255D.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh6.ggpht.com/-FXzFykPIXBk/UGSa01OGheI/AAAAAAAAA8M/u9KZUZcnJQk/image_thumb%25255B32%25255D.png?imgmax=800" width="705" height="524" /></a></p> <p>At the same time, you can use the CQL to query the data using solr syntax. <br /><a href="http://lh5.ggpht.com/-Y_NOQpZo3CA/UGSa1B5UJcI/AAAAAAAAA8U/YreFWRIMs7k/s1600-h/image%25255B64%25255D.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh4.ggpht.com/-Gx6wEOgUL3o/UGSa13gwLhI/AAAAAAAAA8c/-vxFLxSFm-M/image_thumb%25255B34%25255D.png?imgmax=800" width="627" height="93" /></a></p> <p>So that’s it. you may wondering what happened underneath when we run this query? <br /> <br />basically it will query all SOLR Nodes to run a distrubuted shared query, get the items key, and pull the data from cassandra. </p> http://androidyou.blogspot.com/2012/09/cassandra-dse-testing-solr-integration.htmlnoreply@blogger.com (Ryan DH)3tag:blogger.com,1999:blog-4653070451761456668.post-7340996014517606052Sat, 15 Sep 2012 05:34:00 +00002012-09-14T22:34:01.259-07:00R data mining IDE, rattle tutorial<p>Besides <a href="http://androidyou.blogspot.com/2012/09/r-data-minding-package-rcmdr.html">the Rcmdr IDE</a>, Rattle is another one IDE for me to do interactive data minding or just data discovery. <br />installation is easy, just install rattle library, then load the library , and click yes to install the prerequisites components. </p> <p><a href="http://lh4.ggpht.com/-KJMUaRSglCc/UFQTK6GU1EI/AAAAAAAAA2Y/_mHeGo13kxc/s1600-h/image4.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh5.ggpht.com/-FcZaeKjasN0/UFQTLfMnRbI/AAAAAAAAA2g/dAwUr3GhcAc/image_thumb2.png?imgmax=800" width="357" height="172" /></a></p> <p>once done, run rattle() to load the Rattle IDE. </p> <p><a href="http://lh5.ggpht.com/-_a-O0sAmHHQ/UFQTLnvOEwI/AAAAAAAAA2o/6V93zw77dRs/s1600-h/image%25255B5%25255D.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh5.ggpht.com/-tTfoYoKaHk0/UFQTL_GtheI/AAAAAAAAA2w/0ohMe5o1Ak8/image_thumb%25255B2%25255D.png?imgmax=800" width="760" height="612" /></a></p> <p>like the Rcmdr, you can load/import data. then you can explore the data. Always remember to click Execute to make it happen. <br />since it’s used for modeling also, you can specify which column is primary key(ident here,) which one is the response value here it is called Target. <br /><a href="http://lh3.ggpht.com/-gGpcVD6VMIY/UFQTMEcO-pI/AAAAAAAAA24/tTSdVRxLspE/s1600-h/image%25255B10%25255D.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh5.ggpht.com/-2Ur8Z-qCVKs/UFQTMr7qj8I/AAAAAAAAA3A/9zt9BY1Vbgc/image_thumb%25255B5%25255D.png?imgmax=800" width="658" height="407" /></a> <br /> <br />then click explore tab, to do more exploring. like a summary. </p> <p><a href="http://lh5.ggpht.com/-jl1oimR4ztY/UFQTMz5VJuI/AAAAAAAAA3I/9j_7eE6r01A/s1600-h/image%25255B15%25255D.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh3.ggpht.com/-AONo0dIk0k0/UFQTNN8mwWI/AAAAAAAAA3Q/NFa1x9gnxG0/image_thumb%25255B8%25255D.png?imgmax=800" width="826" height="421" /></a></p> <p>click distribution, you can do some plotting.</p> <p><a href="http://lh5.ggpht.com/-YB8Bg4yh5Q0/UFQTNTPDgbI/AAAAAAAAA3Y/fsBmi2D7I3Q/s1600-h/image%25255B20%25255D.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh4.ggpht.com/-eqmFeEl2GKw/UFQTORZuo1I/AAAAAAAAA3g/_KEfe9ccuHA/image_thumb%25255B11%25255D.png?imgmax=800" width="1017" height="642" /></a></p> <p>in the correlation, you can tell which variable are correlated to others, blue means positive. </p> <p>for the sample data, of course, revenue is correlated with request, impression and clicks. <br />has no relationship with fill_rate. <br /><a href="http://lh4.ggpht.com/-ZaYQSQQL8Hw/UFQTQF0_giI/AAAAAAAAA3o/ZhHE2iqPP6I/s1600-h/image%25255B25%25255D.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh6.ggpht.com/-ILE-3wxJrJ8/UFQTQlXLerI/AAAAAAAAA3w/-Pw_IeeRIlg/image_thumb%25255B14%25255D.png?imgmax=800" width="578" height="596" /></a>f</p> <p>for the interactive , you can use plot builder to do a lot plotting. rember to install JDK and rJava library. <br /><a href="http://lh6.ggpht.com/--Tq1_MsUdNs/UFQTROK1IqI/AAAAAAAAA34/Abisi3GQMqQ/s1600-h/image%25255B30%25255D.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh6.ggpht.com/-xBdzwGUJZAE/UFQTRX4IXjI/AAAAAAAAA4A/LZTvLS8BOXw/image_thumb%25255B17%25255D.png?imgmax=800" width="698" height="607" /></a></p> <p>here is one cool bubble plot, <br /><a href="http://lh4.ggpht.com/-GG5dssjx-Dc/UFQTRoFJYYI/AAAAAAAAA4I/EUlYl9Bw6aM/s1600-h/image%25255B35%25255D.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh4.ggpht.com/-rZQSVY8svxo/UFQTR1NQe2I/AAAAAAAAA4Q/CI5vdTAl6lQ/image_thumb%25255B20%25255D.png?imgmax=800" width="885" height="475" /></a></p> <p>Also you can run transform, clustering. </p> http://androidyou.blogspot.com/2012/09/r-data-mining-ide-rattle-tutorial.htmlnoreply@blogger.com (Ryan DH)0tag:blogger.com,1999:blog-4653070451761456668.post-3294684943332840744Sat, 15 Sep 2012 04:41:00 +00002012-09-14T21:41:56.582-07:00R data minding package , Rcmdr tutorial/setup guide<p>being using the RStudio for a while , RStudio is a great IDE for R programmers, you need remember all the function/parameters. For the c# programmers, RStudio is just like the Visual Studio which has a great support for intellisense, IDE. project workspace, Version control. Rcmdr is a great Visual GUI tools for data mining, even for&#160; just plotting/graphics. here is one basic tutorial,</p> <p>Install Rcmdr, basically just click RStudio or Any R IDE, or just R command, try install package ‘Rcmdr’ <br /><a href="http://lh6.ggpht.com/-eeeXTN5noIk/UFQG-fzM4FI/AAAAAAAAAz8/Mni3SIJLVZg/s1600-h/image%25255B4%25255D.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh4.ggpht.com/-H0ZOIguzSaQ/UFQG-mR1FqI/AAAAAAAAA0E/0BU3_gV3ovA/image_thumb%25255B2%25255D.png?imgmax=800" width="521" height="189" /></a> <br /> <br />once done, you can run library(Rcmdr) to startup the IDE, you may be prompted to install some components , just click yes to GO.</p> <p><a href="http://lh6.ggpht.com/-_-4XTAkKniM/UFQG_9oCXoI/AAAAAAAAA0M/IYE2mgj18pE/s1600-h/image%25255B9%25255D.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh5.ggpht.com/-9nlLN3EzDrM/UFQHAuhaRAI/AAAAAAAAA0U/AEweQWjHI8c/image_thumb%25255B5%25255D.png?imgmax=800" width="731" height="210" /></a></p> <p>once done, you will see a new IDE, Rcmdr which has more menus. <br /><a href="http://lh3.ggpht.com/-Ooydbk2aFE0/UFQHA5UPr2I/AAAAAAAAA0c/2lEHK5Gt3sE/s1600-h/image%25255B14%25255D.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh4.ggpht.com/-aNTffQ3OrFs/UFQHBa_mk_I/AAAAAAAAA0k/KX3DiogLMjc/image_thumb%25255B8%25255D.png?imgmax=800" width="699" height="300" /></a></p> <p>basically, you can use the Data menu to import data from external data sources, or load data in packages, and run some data processing, like convert numbers to factors, or get a subset data <br />after data was loaded, you can view/edit the data, also from the script window, you can see the genrated R script, <br /><a href="http://lh4.ggpht.com/-kePhelvML_c/UFQHB3JkWzI/AAAAAAAAA0s/AwrBhaFgo6U/s1600-h/image%25255B19%25255D.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh3.ggpht.com/-WPmonuGCftE/UFQHCC0-b4I/AAAAAAAAA00/-i2guHhjQZc/image_thumb%25255B11%25255D.png?imgmax=800" width="691" height="297" /></a></p> <p>Now, let’s run some basic plotting, select Graphics menu,-&gt;histogram, you will be asked to chose the varible to plot based on existing dataset. <br /><a href="http://lh6.ggpht.com/-RsR3rGGiLz4/UFQHC0IyOfI/AAAAAAAAA08/xVlsxPsudmE/s1600-h/image%25255B24%25255D.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh4.ggpht.com/-Bh2RvrZXR8M/UFQHDHz3FvI/AAAAAAAAA1E/bz0pFHIzIM0/image_thumb%25255B14%25255D.png?imgmax=800" width="656" height="272" /></a></p> <p>Click OK, the graphics will be shown on IDE hosted the R, here will be Rstudio for me. <br /><a href="http://lh4.ggpht.com/-yc9ni88f0fY/UFQHDc-6E3I/AAAAAAAAA1M/CLUG0-YPNbs/s1600-h/image%25255B28%25255D.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh6.ggpht.com/-YLzdAHnkpqM/UFQHDu0D3mI/AAAAAAAAA1U/kCH0pwjI-Mk/image_thumb%25255B16%25255D.png?imgmax=800" width="181" height="242" /></a></p> <p>you can click statistics to create one Model like LInear model, or do some dimentional analysis</p> <p>one you get the model, you can click models to visualize it. <br /><a href="http://lh6.ggpht.com/-Z626dIloKJM/UFQHEceEmDI/AAAAAAAAA1c/Ki_ypHXRUQo/s1600-h/image%25255B33%25255D.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://lh4.ggpht.com/-BWfHA1wCjE4/UFQHE2BY4kI/AAAAAAAAA1k/qQCQsdzusZw/image_thumb%25255B19%25255D.png?imgmax=800" width="415" height="564" /></a></p> http://androidyou.blogspot.com/2012/09/r-data-minding-package-rcmdr.htmlnoreply@blogger.com (Ryan DH)0