This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Properties props = System.getProperties(); | |
props.setProperty("mail.pop3.port", prop.getProperty("995")); | |
Session session = Session.getInstance(props, null); | |
Store store = session.getStore("imaps"); | |
store.connect("pop.gmail.com", "name", "password"); | |
javax.mail.Folder[] dfolders = store.getDefaultFolder().list("*"); | |
for (Folder f : dfolders) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
IMAPFolder folder = null; | |
String[] folders = new String[]{"INBOX", "[Gmail]/Spam"}; | |
for (String fname : folders) { | |
folder = (IMAPFolder) store.getFolder(fname); | |
folder.open(Folder.READ_WRITE); | |
int c = folder.getMessageCount(); | |
System.out.println(c); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
delimiter $$ | |
CREATE DEFINER=`i88ca`@`192.168.%` PROCEDURE `general_split_list`(in v_listid int, in v_listid1 int, in v_listid2 int, in percentage int) | |
BEGIN | |
-- split v_listid into v_listid1 and v_listid2, the ratio is the percentage.set @v_listid=v_listid; | |
select l.totalcontacts into @total from lists l where l.listid=@v_listid; | |
select @total*percentage/100 into @count; | |
set @v_listid1=v_listid1; | |
set @v_listid2=v_listid2; | |
set @count2=@total-@count; | |
PREPARE i88_ca FROM 'insert low_priority ignore into sharedlist(listid, contactid) select ?, sl.contactid from sharedlist sl join contacts c on c.contactid=sl.contactid where sl.listid=? order by c.email limit ?'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8" ?> | |
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd"> | |
<log4j:configuration xmlns:log4j='http://jakarta.apache.org/log4j/'> | |
<appender name="CA" class="org.apache.log4j.ConsoleAppender"> | |
<layout class="org.apache.log4j.PatternLayout"> | |
<param name="ConversionPattern" value="%-4r [%t] %-5p %c %x:%L - %m%n" /> | |
</layout> | |
</appender> | |
<appender name="FA" class="org.apache.log4j.FileAppender"> | |
<param name="File" value="sample.log"/> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class TreeNode { | |
Object val; | |
TreeNode left; | |
TreeNode right; | |
TreeNode(Object x) { val = x; } | |
public TreeNode leftNode() {return left;} | |
public TreeNode rightNode() {return right;} | |
public Object getNodeValue() {return val;} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void preOrder (TreeNode root) | |
{ | |
if(root == null) return; | |
root.getNodeValue(); | |
preOrder( root.leftNode() ); | |
preOrder( root.rightNode() ); | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class preOrderTreeNodeStack { | |
public ArrayList<Object> preorderTraversal(TreeNode root) { | |
ArrayList<Object> returnList = new ArrayList<Object>(); | |
if(root == null) | |
return returnList; | |
Deque<TreeNode> stack = new ArrayDeque<TreeNode>(); | |
stack.push(root); | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package ca.i88.example; | |
import java.io.BufferedReader; | |
import java.io.IOException; | |
import java.io.InputStreamReader; | |
/** | |
* | |
* @author i88.ca | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Script-as-app template. | |
function doGet() { | |
var app = UiApp.createApplication(); | |
var button = app.createButton('Click Me'); | |
app.add(button); | |
var label = app.createLabel('The button was clicked.') | |
.setId('statusLabel') | |
.setVisible(false); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.mycompany.mavenproject3; | |
import java.sql.Connection; | |
import java.sql.DriverManager; | |
import java.sql.PreparedStatement; | |
import java.sql.ResultSet; | |
import java.sql.SQLException; | |
/** | |
* |