Thursday, July 26, 2012

how to, test opengpg on windows,

first I searched and found openpgp.org, turns out it was acquired by semantic, no way to get the windows gui installer, after a while, I found pgp4win, which has the windows installer, check it here,
http://www.gpg4win.org/download.html


so download and install the stable version, once done. run the app called Kleopatra

image

Click File, create a new PGP key pair. I will chose DSA+Elgamal. by clicking the advance settings.
image
once done, you will get the confirmation window,

image

Now you created one key-pair successfully.

Wednesday, July 25, 2012

How to , Disable the Sublime Text popup for new version

maybe sublime just follow the firefox style, always prompt me to download the new version. why not go with the chrome style, put the download task in background without annoying me with the Modal dialog?

image
then it must chat with the server to get the version information, so I run a network sniffer, it did.
image

So fix is easy, just point the host to 127.0.0.1 in your host file, it will mute the annoying dialog.

127.0.0.1       www.sublimetext.com

Monday, July 9, 2012

Eclipse 4.2 , android developers tools

Just loaded one latest eclipse Classic IDE.

image

Try to install the developers tools, get an error,

cannot complete the install because one or more required items could not be found.
  Software being installed: Android Development Tools 20.0.0.v201206242043-391819 (com.android.ide.eclipse.adt.feature.group 20.0.0.v201206242043-391819)
  Missing requirement: Android Development Tools 20.0.0.v201206242043-391819(com.android.ide.eclipse.adt.feature.group 20.0.0.v201206242043-391819) requires 'org.eclipse.wst.sse.core 0.0.0' but it could not be found


basically, the error means it need the wst feature, just insall the web feature, then the installation will go through,
image

Monday, July 2, 2012

Centos ,rmr rhadoop, hadoop streaming failed with error code 1

When I download RMR and installed all dependency packages , try to run a simple mapreduce job on R, get an unknown error.

b=mapreduce(input=a,map=function(k,v) keyval(v,v^2))
packageJobJar: [/tmp/Rtmp8skozB/rmr-local-env, /tmp/Rtmp8skozB/rmr-global-env, /tmp/Rtmp8skozB/rhstr.map14f121ad6582, /var/lib/hadoop-0.20/cache/root/hadoop-unjar8292210935392046645/] [] /tmp/streamjob4219155535407733796.jar tmpDir=null
12/06/27 11:31:45 INFO mapred.FileInputFormat: Total input paths to process : 1
12/06/27 11:31:46 INFO streaming.StreamJob: getLocalDirs(): [/var/lib/hadoop-0.20/cache/root/mapred/local]
12/06/27 11:31:46 INFO streaming.StreamJob: Running job: job_201206271130_0001
12/06/27 11:31:46 INFO streaming.StreamJob: To kill this job, run:
12/06/27 11:31:46 INFO streaming.StreamJob: /usr/lib/hadoop/bin/hadoop job -Dmapred.job.tracker=localhost:8021 -kill job_201206271130_0001
12/06/27 11:31:46 INFO streaming.StreamJob: Tracking URL: http://localhost.localdomain:50030/jobdetails.jsp?jobid=job_201206271130_0001
12/06/27 11:31:47 INFO streaming.StreamJob: map 0% reduce 0%
12/06/27 11:32:07 INFO streaming.StreamJob: map 100% reduce 100%
12/06/27 11:32:07 INFO streaming.StreamJob: To kill this job, run:
12/06/27 11:32:07 INFO streaming.StreamJob: /usr/lib/hadoop/bin/hadoop job -Dmapred.job.tracker=localhost:8021 -kill job_201206271130_0001
12/06/27 11:32:07 INFO streaming.StreamJob: Tracking URL: http://localhost.localdomain:50030/jobdetails.jsp?jobid=job_201206271130_0001
12/06/27 11:32:07 ERROR streaming.StreamJob: Job not successful. Error: NA
12/06/27 11:32:07 INFO streaming.StreamJob: killJob...
Streaming Command Failed!
Error in mr(map = map, reduce = reduce, reduce.on.data.frame = reduce.on.data.frame, :
hadoop streaming failed with error code 1

I checked that 3 environments requried are all set ,
image
the error is very general, then I checked the jobtracker/tasktracker log.

Caused by: java.lang.RuntimeException: configuration exception
at org.apache.hadoop.streaming.PipeMapRed.configure(PipeMapRed.java:230)
at org.apache.hadoop.streaming.PipeMapper.configure(PipeMapper.java:66)
... 22 more
Caused by: java.io.IOException: Cannot run program "Rscript": java.io.IOException: error=2, No such file or directory
at java.lang.ProcessBuilder.start(ProcessBuilder.java:460)
at org.apache.hadoop.streaming.PipeMapRed.configure(PipeMapRed.java:214)
... 23 more
Caused by: java.io.IOException: java.io.IOException: error=2, No such file or directory
at java.lang.UNIXProcess.<init>(UNIXProcess.java:148)
at java.lang.ProcessImpl.start(ProcessImpl.java:65)
at java.lang.ProcessBuilder.start(ProcessBuilder.java:453)
... 24 more

it looks like I try run the Rscript, but failed, so for my first impression, it could be a permission issue.

then I run as the mapreduce user, try to locate the Rscript. all are ok, the permission are ok.
image
everyone has the execute access, so could it be a path issue? so I just give a try, make a link under /usr/bin/Rscript. then, all works. super!

image

image

Wednesday, June 27, 2012

Google io 2012, Android 4.1 new features

Project Butter
.  Voice typing, offline support. (no data connection required.)
.  Accessibility support
.  Android Bean (NFC)
    send video/photo between phones.
.  Notifications.
   Actionable notification, display call button for missed call.
   Gmail new message, auto expand. swap to remove it.
   Like button on the notification bar without openning the app
   two finger gesture to expand the phones on pulse.
 . Search
    Google Now, New UI. knowldege graph
    Knowledge graph, like Siri for apple.
    Google Now, traffic, public transit. places around you,tell you what's the best food in the given restaurant. Flights information, like delay information. sports score in real time.

PDK

Google Play.
Apps,Movie, Books, Music.
600K apps, 20 B app installs.
Apk Expansion files,
improved analytics
ready to review
android training.

new features,
App Encryption. (encrypted with device-spcified key)
helpfurl for paid application. you cant export apk directly and use it on the fly.

Smart App update.

C2DM->Google cloud messaging.
    free for all developers, no quota limitations.
 Magazine.

Nexus 7
7 inch tablet. by Asus. loaded with 4.1
 view magzine, switch reading modes.
watching tv.
new recommandation engine.
what's the song playing widiget.
chrome, standard browser.
offline maps



Thursday, June 21, 2012

IE: crystal report can’t print, Please wait while the Crystal report print control is loaded

Click the print button for the Crystal report viewer, printing works well on firefox or chrome, but not IE.
  you will see the loading screen , maybe forever.

image

Why? basically, for the crystal report, it has one mode called Activex.

  • When the property is set to PrintMode.PDF, the report is exported as a PDF on the Web server, and then streamed to the browser. The user is given the option to print directly to the printer. This option is cross-platform compatible.
  • When the property is set to PrintMode.ActiveX, an ActiveX printing control allows users to print the report directly to their local printer.

since only IE supports the activex mode, so the good news is that you can print the report directly to printers, the bad news , for wahtever reason, maybe the user can’t install the activex client.

How to verify you get the correct activex client?
on IE9 or above, check program->add –ons. you can see the add-on by SAP.
image

for ie8 and down,check c:\windows\downloaded program files, there should be one like this,
image


if you didn’t see this , you will see the loading screen there forever,which is studip.

Wednesday, June 20, 2012

JAVA XPATH Examples for C# developers

In C#, you can use XLinq OR XPath, to query the document quickly. and for the xpath, just load one document, then pass the xpath expression to invoke the methods, you get the results.
here is one basic document,

<?xml version="1.0" encoding="UTF-8"?>
<orders>
    <header>
        <date>2010-12-1</date>
    </header>
    <items>
        <item id="1">
            <productname>Intel CPU I7</productname>
            <amount>200</amount>
        </item> 
        <item id="2">
            <productname>Windows 8</productname>
            <amount>110</amount>
        </item>
    </items>
</orders>


If we need to get the sum of all items, we can use the xpath as sum(//item/amount)
in C#, here is the code, let’s assume the document are located in order.xml
using xlinq,
image
or using xpath,
image

both outputs 310 here,
if use java, code will be more complicated. here is one sample using the DOM and Xpath in java

  DocumentBuilderFactory factory=DocumentBuilderFactory.newInstance();
       DocumentBuilder builder=factory.newDocumentBuilder();
      
       Document doc=builder.parse(domdemo.class.getResourceAsStream("/order.xml"));
      
       //item/productname
       XPathFactory xfactory=XPathFactory.newInstance();
       XPath xpath=xfactory.newXPath();
       XPathExpression exp=xpath.compile("sum(//item/amount)");
      
       Object o=exp.evaluate(doc, XPathConstants.NUMBER);
       System.out.println(o.toString());


that’s java, more codes to do the same thing compared with C#.

 
Locations of visitors to this page