Thursday, August 13, 2009

Heritrix 1

    About Heritrix binaries:
  • To start the Heritrix server at 127.0.0.1:8080, just right click the project on Eclipse and run it.
  • The ARC Writer crawl output goes to:
    C:\tools\Heritrix\archive-crawler\heritrix\jobs
  • Unzip IAH-20090813141952-00000-stutzmann.arc.gz with 7zip
  • run perl C:\tools\Heritrix\ArcExtractor\ArcExtractor.pl
    You get crawled files with names changed, but extensions preserved
  • change in bin/heritrix: JAVA_OPTS=" -Xmx512M"
  • You can shut down through the web interface: http://127.0.0.1:8080/
    About the dev version on Vista:
  • I build the heritrix-1.15.4.jar on Windows using "maven dist" (version 1.0.2). I get a build error that is actually related to the tests (C:\Users\toto\.maven\cache\maven-test-plugin-1.6.2\plugin.jelly), but if you comment out the tests in project.xml, the jar is fine (heritrix-1.15.4.jar in C:\tools\Heritrix\archive-crawler\heritrix\target). I had to use jdk 1.5 because jdk 1.6 would not work because of tools.jar
  • I copy the jar to a Linux heritrix 1.14.3 binary install and rename the existing heritrix-1.14.3.jar to *.old
  • I run it on Linux doing:
    "bin/heritrix --bind=/ --admin=LOGIN:PASSWORD"
  • Note that if you add a writer in the jar file, you can choose it from the web interface from:
    "Profiles", edit your profile, "Modules", and writer
    About Maven (need maven 1.0.2 for Heritrix):
  • to display all the targets:
    maven -g > toto.txt
  • List of targets are in project.xml, see "build" target
  • "dist:" postgoals are described in maven.xml
  • To add a jar like mysql, you need to add it to project.properties and project.xml

Tuesday, July 7, 2009

Java survival kit

- Java2 (1998)
- Java5 (2004): Generics and enum
- Java6 (2006)
  • Web Services
  • All developers get first-class support for writing XML web service client applications. No messing with the plumbing: You can expose your APIs as .NET interoperable web services with a simple annotation. Not your style? Want to handle the XML directly? Knock yourself out: Java SE 6 adds new parsing and XML to Java object-mapping APIs, previously only available in Java EE platform implementations or the Java Web Services Pack.
- Java8 (LTS, 2014 )

    - Java17 (LTS.  2021)

      - annotations

      - alternatives
        - alternatives (works with "java" and "javac")
      /usr/bin/update-alternatives --config java
      /usr/bin/update-alternatives --install

      http://askubuntu.com/questions/56104/how-can-i-install-sun-oracles-proprietary-java-jdk-6-7-8-or-jre

      - To switch from open-jdk to Sun Hotspot JDK on ubuntu:
        sudo update-alternatives --set    java    /usr/lib/jvm/jdk1.7.0_67/bin/java

      - other notes
      • keywords const and goto are reserved, even though they are not currently used
      • // @formatter:off

      • JAVA_HOME when using Java11
        • in .bash_profile:       export JAVA_HOME=$(/usr/libexec/java_home)

      Monday, July 6, 2009

      Apache HTTP server on vista

      I installed apache_2.2.11-win32-x86-openssl-0.9.8i.msi on Vista on port 8080 for myself. Then, from the apache console, it tells me that there is no service, and the "start" button is disabled. The way I had to start it, is from the MS console: httpd.exe. When I start it, a Vista pop-up asks me if I want to open the firewall for this process. That's the way I start it.
      It also starts from the menu /Control Apache Server/Start Apache in Console.
      Could not start it from the "Apache Server Monitor"
      Ah also, I had to go through the security vista nightmare to add files in htdocs in Program Files.

      Friday, June 5, 2009

      Google search functions


      • Google cache for a URL:

      {-inurl:(htm|html|php) intitle:"index of" +"last modified" +"parent directory" +description +size +(wma|mp3) "DIGG"}

      Thursday, April 30, 2009

      Use a SonyEricsson phone as a modem for your PC

    • Plug your USB telephone cable into your PC, the telephone not being plugged in.
    • Start SonyEricsson PC Suite 4.0.
    • Plug the USB cable into the K800 phone
    • Don't select neither "File transfer" nor "Phone mode" on the phonee
    • Click on "connect" on the PC Suite window in the internet tab, you are done.
    • Tuesday, March 10, 2009

      Posix thread

      #include 
      #include 
      #include 
      
      void my_routine(void * arg)
      {
      printf("\n hello \n");
      }
      
      int main(int argc, char* argv[])
      {
      pthread_t th;
      pthread_attr_t attr;
      
      pthread_attr_init(&attr);
      
      int rc = pthread_create(&th, (void *)&args, (void *)my_routine, NULL);
      
      return 0;
      }
      

      Monday, March 2, 2009

      C++ survival kit

    • If you don't want somebody to instanciate your class, set the constructor private

    • Operator precedence
      http://en.wikipedia.org/wiki/Operators_in_C_and_C%2B%2B#Operator_precedence

    • Operator overloading:
      Complex Complex::operator+( Complex &other ) {
      return Complex( re + other.re, im + other.im );
      }
      


    • Dummy template
      // ---------------------------------------
      class MyPairClass
      {
      int pair_1;
      int pair_2;
      };
      
      // ---------------------------------------
      template < class T, int i > class MyTemplate
      {
      public:
      T* testFunc(T* pl);
      };
      
      template < class T, int i >
      T* MyTemplate::testFunc(T* p1) 
      {
      return p1;
      };
      
      // ---------------------------------------
      void myTemplateFunc()
      {
      
      MyPairClass * myPairClass = new MyPairClass();
      MyTemplate < MyPairClass, 2 >  myList;
      myList.testFunc(myPairClass);
      }
      


    • Access to class members
      The default access to class members (members of a class type declared using the class keyword) is private; the default access to global struct and union members is public. For either case, the current access level can be changed using the public, private, or protected keyword.

    • const array size
      const int maxarray = 255;
      char store_char[maxarray];  // allowed in C++; not allowed in C
      
    •