Friday, April 18, 2014

SSL, Bank domains, heart beat


To Times of India Editor:
Saw an article in the technology section of the TOI physical news paper on 17th April, 2014 about HeartBeat and SSL, it has lists of banks and other websites and the results from some tool.

Would be  good if they update the website with note on banks, instead of just pulling the article.
The main domain of the banks like hdfcbank.com or icicibank.com when anyone who has used netbanking and looked a the address bar should know that the domain changes. and with that the certificate so for example icici is https://infinity.icicibank.co.in and HDFC is https://netbanking.hdfcbank.com/ why the difference - i dont know just the way it was implemented - maybe can change the link without affecting the main site. someone did it years back and just continued. with a sub domain can even have a different IP/ web server, more clustering options. And a sub domain needs a different certificate;  so they put the grand security on this and the main site that is just links, marketing & help content.

  Is incorrect to say icici has no ssl, please add this note that the sub domains where net banking happens does have (after testing it). I don't work for a bank nor a share holder but know something about server tech.

Really makes you think how much of what you report is true and how much is just ignorant, under researched or a way of getting back to people who are not advertising enough?
Maybe vet these articles by paying tech savvy people to proof read first?

Thursday, May 13, 2010

Java pre compiler ... well nearly

Ant
For simple needs, Ant can be used to do substitution in your sources.

We insert into the code a special tag to delimit code that need to be stripped by the Ant script. Let's say we use //@STARTDEBUG@// and //@ENDDEBUG@//.

package academic.howto;

import javax.swing.JFrame;

public class Example {

public static void main(String args[]){
JFrame f = new JFrame();
f.setSize(300,200);
f.setVisible(true);
f.setTitle("HowTo");
//@STARTDEBUG@//
f.setTitle(f.getTitle() + " DEBUG version");
//@ENDDEBUG@//
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
}

If you execute this code, the JFrame title will have the word "DEBUG" appended to it.

The Ant script to remove the debugging code is :
<project default="buildme">

   <target name="compileprod">
    <copy todir="../out" includeEmptyDirs="false">
    <filterchain>
            <tokenfilter>
            <replacestring from="//@STARTDEBUG@//" to="/*" />
            <replacestring from="//@ENDDEBUG@//" to="*/" />
            </tokenfilter>
    </filterchain>
        <fileset dir=".">
          <include name="**/*.java" />
       </fileset>
    </copy>

    <javac srcdir="../out" />
   </target>

   <target name="compiledebug">
     <javac srcdir="." />
   </target>

  
   <target name="buildme" depends="compileprod" />
</project>



After running this script, the source (in the ..\out directory)
 
package academic.howto;

import javax.swing.JFrame;

public class Example {

  public static void main(String args[]){
    JFrame f = new JFrame();
    f.setSize(300,200);
    f.setVisible(true);
    f.setTitle("HowTo");
    /*
    f.setTitle(f.getTitle() + " DEBUG version");
    */
    f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  }
}

Only disadvantage is a few more minutes to compile but that is small trade off for a better runtime code - with less logging etc

http://www.rgagnon.com/javadetails/java-0130.html

this is another method ...have a class with a single static final bool and use if statements ... compiler automatically optimizes. CAUTION:this will work for a single project/ jar. if the variable ( public static final boolean RELEASE = true; ) is in another jar then javac will not optimize as you can replace the jars with the var set to false... for big applications might work if each package has the debug class and care is taken to reference only that.



CODE:

public class Debug {
  public static final boolean RELEASE = true;
  }
In your source, when you need some debugging codes, you included them in
 a if statement like 
if (Debug.RELEASE) {
   System.out.println("The value of i is " + i);
}
During compilation, since Debug.RELEASE is always true, the code will be present. In the production environment, the Debug class looks like this:
public class Debug {
  public static final boolean RELEASE = false;
  }
When compiling in that environment, the debugging code will be absent from the class file since Debug.release is always false.
 
 
 
REFERENCE:

rgagnon.com/..java-0164.html

rgagnon.com/..java-0130.html

Thursday, April 15, 2010

sleep.exe, pause a batch program for specified time

when you need to sleep a while when using a batch program etc

http://hp.vector.co.jp/authors/VA007219/sleep/sleep.html sleep.vbs and v1/sleep.exe works with XP and win7 copied to system32 folder so can call it from anywhere






http://unattended.msfn.org/unattended.xp/view/web/10/ does not work on

Monday, April 12, 2010

java setting multiple system properties via command line options

if you want to set system properties when you invoke java (vs setting them in the system before you start java/ command prompt) can do so with the -D option to java.exe or javaw.exe

You do this for each property.


Lets assume your command line to start jva initially looks like:
java org.mypack.Main

 So if you need to set to properties
usePort=2322
factoryClass=org.mypack.net.Factory1

Then the new command line will be:

java -DusePort=2322 -DfactoryClass=org.mypack.net.Factory1 org.mypack.Main

Pretty obvious except I was not sure if I need to put a ; between properties or have multiple -D

For those using an IDE:
See image - remember these are VM options (VM arguments) and not program arguments
(Click image for full size)

Followers