Skip to content

Instantly share code, notes, and snippets.

View goyuninfo's full-sized avatar

goyun.info goyuninfo

View GitHub Profile
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);
}
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);
package it.i88.ca.example.se.observer;
import java.util.Observable;
class Observered extends Observable {
private String event;
public String getEvent() {
return event;
<?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()}"/>
package ca.i88.sample.pattern.observer.ee;
/**
*
* @author it.i88.ca
*/
class I88caEvent {
private String msg;
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
package ca.i88.sample.pattern.observer.ee;
import javax.ejb.Stateless;
import javax.enterprise.event.Observes;
/**
*
* @author it.i88.ca
*/
@Stateless
'''
@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()
<?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";
}
}
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.