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 it.i88.ca.example.se.observer; | |
import java.util.Observable; | |
import java.util.Observer; | |
class MyObserver implements Observer { | |
public void update(Observable o, Object arg) { | |
System.out.println("update: " + arg); | |
} |
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 it.i88.ca.example.se.observer; | |
public class ObserverTest { | |
public static void main(String[] args) { | |
Observered oed = new Observered(); | |
MyObserver mo1 = new MyObserver(); | |
MyObserver mo2 = new MyObserver(); | |
oed.addObserver(mo1); |
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 it.i88.ca.example.se.observer; | |
import java.util.Observable; | |
class Observered extends Observable { | |
private String event; | |
public String getEvent() { | |
return event; |
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 html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> | |
<html xmlns="http://www.w3.org/1999/xhtml" | |
xmlns:h="http://java.sun.com/jsf/html"> | |
<h:head> | |
<title>it.i88.ca</title> | |
</h:head> | |
<h:body> | |
<h:form> | |
<h:commandButton value="Fire!" action="#{observerTest.fire()}"/> |
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.sample.pattern.observer.ee; | |
/** | |
* | |
* @author it.i88.ca | |
*/ | |
class I88caEvent { | |
private String msg; |
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.sample.pattern.observer.ee; | |
import java.util.Date; | |
import javax.enterprise.event.Event; | |
import javax.inject.Inject; | |
import javax.inject.Named; | |
/** | |
* | |
* @author it.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
package ca.i88.sample.pattern.observer.ee; | |
import javax.ejb.Stateless; | |
import javax.enterprise.event.Observes; | |
/** | |
* | |
* @author it.i88.ca | |
*/ | |
@Stateless |
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
''' | |
@author: it.i88.ca | |
''' | |
import MySQLdb | |
import time | |
db = MySQLdb.connect(host="192.168.1.19", user="i88ca", passwd="i88ca", db="i88ca") | |
#create a cursor for the select | |
cur = db.cursor() |
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
<?php | |
$mysqli = new mysqli("192.168.1.19","user","password","i88ca"); | |
$result = $mysqli->query("select l.* from lists l limit 8"); | |
$resultArray = $result->fetch_all(MYSQLI_ASSOC); | |
foreach ($resultArray as $value) { | |
foreach ($value as $value2) { | |
echo ($value2); | |
echo "\n"; | |
} | |
} |
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 AWSeMailService { | |
public static void send(AmazonSimpleEmailService ses, String from, | |
String to, String subject, String body) throws IOException { | |
/* | |
* Before you can send email via Amazon SES, you need to verify that you | |
* own the email address from which you'll be sending email. This will | |
* trigger a verification email, which will contain a link that you can | |
* click on to complete the verification process. |
OlderNewer