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
| var win = Titanium.UI.currentWindow; | |
| win.backgroundImage = 'images/bg.png'; | |
| //database | |
| var db = Titanium.Database.open('todolist'); | |
| db.execute('CREATE TABLE IF NOT EXISTS TODOLIST (ID INTEGER, TITLE TEXT, DETAIL TEXT, CREATEDATE DATETIME)'); | |
| var rows = db.execute('select * from todolist'); | |
| var data = []; | |
| var cnt = 0; |
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
| <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> | |
| <html dir="ltr"> | |
| <head> | |
| <meta http-equiv="Content-type" content="text/html; charset=utf-8"> | |
| <link rel="stylesheet" type="text/css" href="http://ajax.googleapis.com/ajax/libs/dojo/1.4/dijit/themes/soria/soria.css"> | |
| <style type="text/css"> | |
| body, html { font-family:helvetica,arial,sans-serif; font-size:90%; } |
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
| """ | |
| data packet sent | |
| 0 1 2 3 | |
| 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 | |
| +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | |
| | Type | Code | Checksum | | |
| +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | |
| | Identifier | Sequence Number | | |
| +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
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
| from socket import * | |
| if __name__ == '__main__': | |
| target = raw_input('Enter host to scan: ') | |
| targetIP = gethostbyname(target) | |
| print 'Starting scan on host ', targetIP | |
| #scan reserved ports | |
| for i in range(20, 1025): | |
| s = socket(AF_INET, SOCK_STREAM) |
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
| var url='http://www.dogameok.com/image.jpg'; | |
| var httpClient = Titanium.Network.createHTTPClient(); | |
| var filepath = "data/image.jpg"; | |
| if (httpClient.open('GET', url)){ | |
| httpClient.receive(function(data){ | |
| var file = Titanium.Filesystem.getFile(Titanium.Filesystem.applicationDataDirectory, filepath); | |
| var fileStream = file.open(Titanium.Filesystem.MODE_APPEND); | |
| fileStream.write(data); |
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
| var f = Titanium.Filesystem.getFile( | |
| Titanium.Filesystem.resourcesDirectory, | |
| 'data/branch.xml' | |
| ); | |
| var fdata = f.read(); | |
| var xml = Titanium.XML.parseString(fdata.text); |
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
| var xhr = Titanium.Network.createHTTPClient(); | |
| xhr.open("GET","http://www.yourdomain.com/test.txt"); | |
| xhr.onload = function(){ | |
| statusCode = xhr.status; | |
| if(statusCode == 200) | |
| { | |
| var doc = this.responseText; | |
| var f = Titanium.Filesystem.getFile(Titanium.Filesystem.applicationDataDirectory,'test.txt'); | |
| f.write(doc); |
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
| //feed for database | |
| // ------- | |
| var db = Ti.Database.install('../book.sqlite','db_name'); | |
| var rows = db.execute('select * from books where download_complete = 1'); | |
| var arrBook = []; | |
| while (rows.isValidRow()){ | |
| //rows.fieldByName('issue_name'); | |
| rows.next(); | |
| } |
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
| var db = Titanium.Database.open('imagazine'); | |
| //db.execute('drop database imagzine'); // for clear old | |
| //db.execute('insert into books (book_id, issue_name, cover_image, book_name, download_completed) values(1,"101","issues/0/cover.jpg","car",1)'); | |
| var rows = db.execute('select * from books where download_completed = 1'); | |
| while (rows.isValidRow()){ | |
| /* | |
| alert(rows.fieldByName('book_id')); |
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
| var f = Titanium.Filesystem.getFile( Titanium.Filesystem.resourcesDirectory, | |
| 'issues/0/data.xml' | |
| ); | |
| var fdata = f.read(); | |
| var xml = Titanium.XML.parseString(fdata.text); | |
| var imagesFile = []; | |
OlderNewer