This file contains hidden or 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 preiss; | |
import java.io.IOException; | |
import java.net.UnknownHostException; | |
import java.util.Iterator; | |
import java.util.Vector; | |
import org.snmp4j.CommandResponder; | |
import org.snmp4j.CommandResponderEvent; | |
import org.snmp4j.MessageDispatcherImpl; |
This file contains hidden or 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 preiss; | |
import org.snmp4j.CommandResponder; | |
import org.snmp4j.CommandResponderEvent; | |
import org.snmp4j.CommunityTarget; | |
import org.snmp4j.PDU; | |
import org.snmp4j.PDUv1; | |
import org.snmp4j.ScopedPDU; | |
import org.snmp4j.Snmp; | |
import org.snmp4j.TransportMapping; |
This file contains hidden or 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
-- Get All Published Posts | |
select * from wp_posts where post_status='publish' | |
-- Given a category name, get all the tags associated with posts in the category | |
select distinct terms.slug, terms.name | |
from | |
wp_term_relationships rel, wp_term_taxonomy txnm, wp_terms terms | |
where |
This file contains hidden or 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
DateFormat df = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss"); | |
Date today = Calendar.getInstance().getTime(); | |
String reportDate = df.format(today); | |
//------- long to Date ------- | |
The Date constructor (click the link!) accepts the time as long in milliseconds, not seconds. | |
You need to multiply it by 1000 and make sure that you supply it as long. | |
Date d = new Date(1220227200L * 1000); |
This file contains hidden or 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 preiss; | |
import java.io.*; | |
import java.net.*; | |
public class SocketListener extends Thread { | |
public static final int PORT_NUMBER = 4241; |
This file contains hidden or 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
import java.io.*; | |
import java.net.*; | |
public class Client { | |
public static void main(String args[]) { |
This file contains hidden or 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 | |
//Assign automatically | |
$cars = array("Volvo", "BMW", "Toyota"); | |
//or assign manually | |
$cars[0] = "Volvo"; | |
$cars[1] = "BMW"; | |
$cars[2] = "Toyota"; | |
echo "I like " . $cars[0] . ", " . $cars[1] . " and " . $cars[2] . "."; |
This file contains hidden or 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
$age = array("Peter"=>"35", "Ben"=>"37", "Joe"=>"43"); | |
//or | |
$age['Peter'] = "35"; | |
$age['Ben'] = "37"; | |
$age['Joe'] = "43"; | |
echo "Peter is " . $age['Peter'] . " years old."; |
This file contains hidden or 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 preiss.lru; | |
import java.util.LinkedHashMap; | |
import java.util.Collection; | |
import java.util.Map; | |
import java.util.ArrayList; | |
/** | |
* An LRU cache, based on <code>LinkedHashMap</code>. | |
* |
OlderNewer