Posts Tagged ‘windows’

常用命令

March 4th, 2014

Linux

  • find /home -iname “*.log” -exec rm {} \;

    Delete file recursively by extension.

Windows

Install Lucene Solar with Tomcat on Windows

May 7th, 2013

Installing the example solar web application is actually super easy. Here we suppose you already installed the Tomcat sevlet container on your computer TOMCAT_HOME (for example: D:\prog\apache-tomcat-7.0.35). If not, you can download it here http://tomcat.apache.org and install it (at TOMCAT_HOME).

The next step is to install Solar:

  1. download Solr at: http://lucene.apache.org/solr/
  2. extract the solar package into, for example, solr-4.3.0
  3. copy the sample “Solr Home” directory solr-4.3.0\example\solr\ (Note that it’s the folder ‘example\solr\’ itself, not the content under it!!!) into the home directory of tomcat: TOMCAT_HOME if you start tomcat with Tomcat Monitor or into TOMCAT_HOME\bin if you start tomcat with TOMCAT_HOME\bin\startup.bat. Note that the solr hoe directory must be put in the right directory. This is very important!!! Otherwise you will get such an exception: “HTTP Status 500 – {msg=SolrCore ‘collection1′ is not available due to init failure: Could not load config for solrconfig.xml …… ”
    In a word, the solr home directory should be put in the Java current working directory. You can also “Configure the servlet container such that a JNDI lookup of “java:comp/env/solr/home” by the Solr webapp will point to the Solr home”.
  4. copy the solr war file (solr-N.N.N.war) under solr-4.3.0\dist\ as solr.war into the tomcat webapps directory TOMCAT_HOME/webapps. Tomcat will automatically deploy it.
  5. After solr.war is extracted, copy the SLF4j logging jars from solr-4.3.0/example/lib/ext into TOMCAT_HOME/lib or TOMCAT_HOME/webapps/solr/WEB-INF/lib. If this step is ignored, this exception will be thrown out: org.apache.catalina.core.StandardContext filterStart
    SEVERE: Exception starting filter SolrRequestFilter
    org.apache.solr.common.SolrException: Could not find necessary SLF4j logging jars. If using Jetty, the SLF4j logging jars need to go in the jetty lib/ext directory. For other containers, the corresponding directory should be used. For more information, see: http://wiki.apache.org/solr/SolrLogging

OK. That’s it! Now locate your web browser to http://localhost:8080/solr (Change the port if necessary) and you will see the admin page of solr.

If there are exceptions, check your tomcat logs (such as localhost.YYYY-MM-DD.log) under TOMCAT_HOME\logs\.

PS. actually to install solar on windows is not so much different from that on any other OS. :)

More details can be found on the Solr Wiki: http://wiki.apache.org/solr/SolrInstall

Using powershell on Windows

December 6th, 2011

Powershell on windows is the same thing as Bash in linux.

Set the prowershell enviroment

The prowershell script file .ps1 is defaultly forbidden to execute with the ExecutionPolicy “Ristricted”. To see your current ExecutionPolicy, open a powershell windown and type:
Get-ExecutionPolicy

There are totally 4 levels of ExecutionPolicy:

  1. Restricted: no .ps1 execution is allowed
  2. AllSigned: .ps1 files can run, but need a signed digital signature. No matter they are written locally or downloaded form Internet.
  3. RemoteSigned: Local .ps1 files can run, but downloaded scripts need a digital signature.
  4. Unrestricted: All scripts can run without digital signature.
  5. Normally, we need to run local scripts, so we set it to “RemoteSigned”:
    Set-ExecutionPolicy remoteSigned -Scope CurrentUser
    With “-Scope CurrentUser”, the ExecutionPolicy will only be changed to the logged user.

    Basics

    Loops

    There are many ways to loop in powershell: do…while…, while(){}, for(){}, …
    Here is an example of while{} loop

    $i = 1
    while ($i -le 5) {
    	Write-Host $i; # write on console
    	mkdirdir x$i # create a folder
    	
    	$i++
    } 

solve the problem of no output in console on windows eclipse with MinGW

October 14th, 2011

If you are experiencing the problem of no output in console on windows eclipse with MinGW, here is the solution.

And actually the solution the is very simple, you only have to add a PATH variable to your MinGW bin directory in the run configuration.

Here are the steps:

From menu: Run -> Run Configuration…, open the run configuration window, and add the PATH variable to your MinGW bin directory (as shown in the picture below).

Windows 7 cannot find a specific wireless network

September 18th, 2011

After an accidently reboot of the router, my win 7 laptop could not find this wireless network anymore. I tried to reboot the router and my computer. But either worked. All the other computers (and phones) can find this network and connect to it. And this computer can found other wireless networks and connect to them, but just not this. I also tried adding this network manually, however without luck. Searching on the internet didn’t give me any clue either.

Finally I thought reinstalling the network adapter’s driver might work. So I went to Device Manager, found the adaptoer, and updated the driver software. Bingo! It worked! Thank god, I don’t have to use someone else’s weak unsecured wireless network any more.

How to install MemCache on Windows 7 X64 for PHP with WAMP

August 22nd, 2011

Basics

The memcache sonsists of 2 parts: the server MemCached and the client MemCache.

  • MemCached is the cache server, the same as Mysqld (mysql server), which save and feed cache to clients.
  • MemCache is a client. With php, we need to install it as a mod, just the same as pdo_mysql (php_pdo_mysql.dll on windows).

Install MemCached

  • Download memcached from http://code.jellycan.com/memcached/ (get the win32 binary version). Here we suppose you extract the memcached in d:\memcached\.
  • If you are on Sindows Vista/7, rightclick on memcached.exe and select Properties; click on the Compatibility tab. At the bottom you’ll see Privilege Level, check “Run this program as an administrator”.
  • Open the command line by Win + R (or Start -> All Programs -> Accessories -> Command Prompt), and then run: d:\memcached\memcached.exe -d install to install the service.
  • Still in the command line, run d:\memcached\memcached.exe -d start, or net start "memcached Server" to start the service.
  • Check whether the service is running. Open Windows Task Manager, go to Services tab, you should find status of “memcached server” is “Running”.

Install MemCache php module

Note

  • To change MemCached memory size (default is 64mb), go to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\memcached Server in your registry, find the ImagePath entry and change it to:
    “C:\memcached\memcached.exe” -d runservice -m 512
  • More details see: memcached -help

安装显卡驱动时提示无法复制文件nv4_mini.sy_

June 11th, 2010

今天在安装acer 4520G中NGForce 8400显卡驱动时,老师提示“无法复制文件nv4_mini.sy_“这个错误,刚开始还以为下载的版本错了,于是在别的地方找了号几个版本。都不行,总是提示这个错误。在网上看了,也没有什么解决方案。有一个答案居然说拿到售后那换了主板才搞定,吓我一跳。

不过后来,我在文件夹下仔细查看,发现nv4_mini.sy_这个文件是确确实实存在的。于是联想到windows(至少xp)下这个臭名昭著的文件夹空格问题(不过说实话其实也不能怪xp,其实程序里面稍作处理也就没事)。而我正好是把文件夹放在桌面,而桌面是在“Documents and Settings/XXX”里面,正好有空格。于是把驱动的安装文件夹拷贝到C盘根目录下,再安装。乖乖!果然一切OK!!!日!浪费了我整整1个上午啊。本来机器就不怎么灵光了,还害我整来整去,郁闷煞也!