Wednesday, June 29, 2011

Figure for Manuscript: Retinoic Acid Binding Site


PyMOL>show surface, 1CBS
PyMOL>color blue, 1CBS
PyMOL>select active, resn REA around 5.0
PyMOL>zoom active
PyMOL>select ligand, resn REA
PyMOL>show stick, ligand
PyMOL>set stick_radius = 0.15
PyMOL>set transparency = 0.3
PyMOL>center ligand
PyMOL>zoom center,9
PyMOL>ray 3000,3000

Tuesday, June 14, 2011

Color Swirl in Both background and foreground

import java.awt.Font;
import java.awt.Graphics;
import java.util.Date;
import java.awt.Color;

public class ColorSwirl extends java.applet.Applet implements Runnable {

Font swirlFont = new Font("Arial", Font.BOLD, 24 );
Color[] colors = new Color[50];
Thread runner;

public void start() {
if (runner == null) {
runner = new Thread(this);
runner.start();
}

}

public void stop() {
if (runner != null) {
runner.stop();
runner = null;
}

}

public void update(Graphics g){
paint(g);
}

public void run() {

// Initialize the color array
float c = 0;
for (int i=0; i < colors.length; i++){
colors[i] = Color.getHSBColor(c, (float) 1.0, (float) 1.0);
c = c + 0.02f;
}

// Cycle through the colors
int j = 0;
while (true) {
setBackground(colors[49-j]);
setForeground(colors[j]);
repaint();
j++;
try { Thread.sleep(100); }
catch (InterruptedException e) {}
if (j == colors.length) j = 0;

}
}

public void paint (Graphics g) {
g.setFont(swirlFont);
g.drawString("I love my dear DaXiongXiong", 15, 50);
}

}

Monday, June 6, 2011

How to create 4 dimensional Vector

import java.awt.Point;

class FourDPoint extends Point {

/**
* @param args
*/
int threeDimension, fourDimension;

FourDPoint(int x, int y, int threeD, int fourD){
super(x,y);
this.threeDimension = threeD;
this.fourDimension = fourD;
}


public static void main(String[] args) {
// TODO Auto-generated method stub
FourDPoint fourDimPoint = new FourDPoint(5, 10, 120, 600);

System.out.println("The First Dimension is: " + fourDimPoint.x);
System.out.println("The Second Dimension is: " + fourDimPoint.y);
System.out.println("The Third Dimension is: " + fourDimPoint.threeDimension);
System.out.println("The Fourth Dimension is: " + fourDimPoint.fourDimension);
}

}

Thursday, June 2, 2011

java.util.StringTokenizer

import java.util.StringTokenizer;

class showToken {

/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
StringTokenizer stringOne;
String myBirthdayMonth, myBirthdayDate, myBirthdayYear;

String quoteOne = "01/22/2010/";
stringOne = new StringTokenizer(quoteOne, "/");
myBirthdayMonth = stringOne.nextToken();
myBirthdayDate = stringOne.nextToken();
myBirthdayYear = stringOne.nextToken();

System.out.println("My Birthday Month: " + myBirthdayMonth);
System.out.println("My Birthday Date: " + myBirthdayDate);
System.out.println("My Birthday Year: " + myBirthdayYear);

}

}

Wednesday, June 1, 2011

How to determine if an element exists in a Perl array

#!/usr/bin/perl

my @testArray = qw(apple apple1 apple2 banana);

my $testElement1 = "apple1";

my $testElement2 = "banana";

my $Counter = 0; my %testHash = {};

%testHash = map { $_ => $Counter++} @testArray;

print "Test element 1 exists!\n" if (exists $testHash{$testElement1});

print "Test element 2 exists!\n" if (exists $testHash{$testElement2});

Eunice in China 05/31/2011


My dear daughter