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
extension UITextField { | |
var stringValue : String { return text ?? "" } | |
var integerValue: Int { return Int(stringValue) ?? 0 } | |
var doubleValue : Double { return Double(stringValue) ?? 0 } | |
var floatValue : Float { return Float(stringValue) ?? 0 } | |
} | |
let textField = UITextField() | |
textField.text.dynamicType // returns an Optional<String>.Type | |
let optionalIntegerValue = Int(textField.text!) // returns NIL |
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
import org.joda.time.format.DateTimeFormat | |
import org.joda.time.{DateTime, DateTimeZone} | |
import scala.util.Try | |
object TimeStampUtility { | |
def getCurrentTimeStamp(): Long = { | |
val timestamp: Long = System.currentTimeMillis / 1000 | |
timestamp |
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
import java.io.IOException; | |
import org.pcap4j.core.BpfProgram.BpfCompileMode; | |
import org.pcap4j.core.NotOpenException; | |
import org.pcap4j.core.PacketListener; | |
import org.pcap4j.core.PcapHandle; | |
import org.pcap4j.core.PcapNativeException; | |
import org.pcap4j.core.PcapNetworkInterface; | |
import org.pcap4j.core.PcapNetworkInterface.PromiscuousMode; | |
import org.pcap4j.packet.Packet; | |
import org.pcap4j.util.NifSelector; |