Wednesday, August 21, 2013

java, testing salted hash using the commons-codec

There is one class called DigestUtils in the apache commons-codec, here is a quick how to start tutorial to pickup the jar and do a simple one way hash.

Add a dependency to commons-codec in your pom file

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>com.androidyou</groupId>
    <artifactId>testhash</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <dependencies>
        <dependency>
            <groupId>commons-codec</groupId>
            <artifactId>commons-codec</artifactId>
            <version>1.8</version>
        </dependency>

    </dependencies>
</project>


then update the project ,we can see the jar is included in the project

image

image

If you want included the jar in the dependenciy, add one plugin for the assembling

then mvn assembly:assembly you will see the jar with the inlined codec jar files.

<build>
    <plugins>
        <plugin>
            <artifactId>maven-assembly-plugin</artifactId>
            <executions>
                <execution>
                    <phase>package</phase>
                    <goals>
                        <goal>attached</goal>
                    </goals>
                </execution>
            </executions>
            <configuration>
                <descriptorRefs>
                    <descriptorRef>jar-with-dependencies</descriptorRef>
                </descriptorRefs>
            </configuration>
        </plugin>
    </plugins>
</build>

Tuesday, August 6, 2013

How to FIx,”New Nexus 7 stuck at X logo, but FULLY CHARGED”

Got a New Nexus 7 (2013) modal, and it was stuck on the X logo forever, it’s fully charged.
  my firs try is to restore to the factory image, however, no official image for “flo” the New nexus 7 in the Google page.
image

it only have the old one

https://developers.google.com/android/nexus/images?hl=de-DE

after did a lot Goggling, found this one works

http://droidbasement.com/asus/razor/flo/sys-backup/

image

fastboot boot recovery.img

then clear cache, install the zip for sdcard or sideload

then it will works, Good luck

Sunday, August 4, 2013

Centos: disable Ipv6

To begin, log in as root and disable IPv6 by typing:
echo "install ipv6 /bin/true" > /etc/modprobe.d/disable-ipv6.conf
Now run the following command to disable ip6tables:
chkconfig ip6tables off
We must now disable any calls to IPv6 in its various locations. To do this we will start by opening the following configuration file:
vi  /etc/sysconfig/network
Scroll down and add or amend the following line to read:
NETWORKING_IPV6=no
To complete this process, you must now modify the configuration for each Ethernet device to show the following values:
IPV6INIT=no
IPV6_AUTOCONF=no

after rebooting, you can tell no IPv6 address listed on the nic card

also lsmod|grep ipv6 returns nothing

Wednesday, June 5, 2013

How to, use windbg to catch .net process exception

for some cases, you may find it’s hard to debug the .net application exception using mdbg or cordbg. then windbg will be the good shoot.

you don’t need to download the full sdk to the production server, just go to http://windbg.org/, under the windbg quick links download the x86 or 64 bit debuggers which are less then 20M , install it on the server.

Now, let’s assume we have one bug application.

image

when we run the application, start the windbg, click attach to process(F6). then windbg is attached to the buggy application.

load the clr sos extension, and setup to break when there is one clr exception.
image
then the app will stop and breakpoint will be hit whenever there is one .net exception.
image

!pe will show the expcetion.
image

and we can use !clrstack to see the full stacktrace
image

!clrstack –a will show the arguments on each method call

image

besides the sxe, also we can use sxd, sxn and sxi

image

Wednesday, May 29, 2013

Jquery Url parser library

jQuery-URL-Parser is one great utility to parse urls, and provide access to attributes, querystrings.

image

p.segment return all the pathes in the url

image

param() return all the query string and values

image

Thursday, May 23, 2013

How to: Adb install apk get error, INSTALL_FAILED_ALREADY_EXISTS

If you are a developer, and want test your new build and keeping the old settings of your app.here is the quick answer.

TRY install the new apk, you will get [INSTALL_FAILED_ALREADY_EXISTS] failure.

image

here is the trick, add the –r, will keep the old setting while applying the new app.
image

Friday, May 3, 2013

ZeroMq, pub/sub mode tutorial , how-to

following the last post, it’s extremely easy to do a pub/sub empowering the zeromq.

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.

 image

then in the Node.js, create one special socket sub, and remember to call subscribe with the interested topic.


image

C# subscriber code,
image

Run the app, from c#, we can see message published and received,

image

from node.js client,
image

 
Locations of visitors to this page