Leaderboard
Popular Content
Showing content with the highest reputation on 06/21/2014 in all areas
-
Hopefully not! The actual purpose of any hash algorithm is to implement a one-way "function", which can't be inverted by any known mean. I put function in quotes since it's very hard to formally prove that there is at least one input for every possible resulting hash. But what we can be sure of is that there exist an infinity of inputs which all result in any given hash. This makes it impossible to decide which input was actually used, especially since it is extremely hard if not plain impossible to find an input corresponding to a given hash.2 points
-
Powerful HTTP Server in Pure AutoIt
Skeletor reacted to jvanegmond for a topic
This is a full HTTP server written in pure AutoIt. No external libraries are used. The server code is readable and very simple to modify. Abilities: A full web server in a single executable. Able to integrate the web pages into your source code and modify its contents with code. ( This is how the first web pages were build ) The ability to send a page with over 1000 images in under 5 seconds. Fully compatible with both Firefox, Internet Explorer 6 through 9, Chrome and Safari. Nearly every line is commented. It helps you understand the code easily, so that you may reuse it and add on new code with ease. GET, POST are both supported and even cookies and sessions are supported This is intended to be a base for any future projects that provide any service over HTTP. Three different servers give you the base code that you need, and nothing you won't need. In the download there is included a short guide on how to choose the right one. BrettF has done some awesome work and added to capability to retain sessions in this post: >http://www.autoitscript.com/forum/topic/...e-autoit/page__view__findpost_ If you need sessions, you can use his version. This version is added in the above v1.1 download. Edit: Please find the webserver attached to this post. You guys keep eating my bandwidth and I had to move it again. webserver_011.zip1 point -
So far it is going well, just using the private XML link in the goggle settings for your calendar. It uses that and gets the info from the xml file. Then calculates and re-orders the data for view. I am still working on it but wanted some feedback if you think I am doing or going about doing something either wrongly, inefficiently etc. I like to think I am a pretty good coder of autoit but I do have a habbit of "ghetto-rigging" things to work if I have no better method. Script: #region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Outfile=Goocal.exe #AutoIt3Wrapper_Compression=4 #AutoIt3Wrapper_UseX64=n #endregion ;**** Directives created by AutoIt3Wrapper_GUI **** #include <string.au3> #include <inet.au3> #include <File.au3> #include <date.au3> #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <array.au3> #NoTrayIcon Global $count, $entries, $currentrecord, $numberof, $thetitle, $thedescription, $thewhen $ini = FileOpen(@ScriptDir & '\GooCal Settings\Settings.ini', 9) FileClose($ini) If FileGetSize(@ScriptDir & '\GooCal Settings\Settings.ini') < 5 Then $url = InputBox('Enter URL', 'Enter the URL to your Google calendar XML file.', '') $theurl = StringStripWS($url, 8) IniWrite(@ScriptDir & '\GooCal Settings\Settings.ini', 'Settings', 'CalendarUrl', $theurl) EndIf $entryamountreceived = FileOpen(@ScriptDir & '\GooCal Settings\Entry amount received last.txt', 9) GetRawData() ExtractDataThenSave() #region ### START Koda GUI section ### Form=C:\Users\techwg\calendar.kxf Global $guiCalendar = GUICreate("GooCal V1", 451, 339, 192, 124) Global $ButtonPrevious = GUICtrlCreateButton("Previous", 184, 248, 59, 25) Global $ButtonNext = GUICtrlCreateButton("Next", 312, 248, 59, 25) Global $ButtonRefresh = GUICtrlCreateButton("Refresh", 249, 248, 59, 25) $Group1 = GUICtrlCreateGroup("", 16, 208, 161, 65) $minutes = GUICtrlCreateInput("5", 47, 243, 57, 21, BitOR($GUI_SS_DEFAULT_INPUT, $ES_CENTER)) $Label6 = GUICtrlCreateLabel("Auto Refresh Delay", 24, 223, 114, 17) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") $Label7 = GUICtrlCreateLabel("Minutes", 119, 243, 48, 17) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") GUICtrlCreateGroup("", -99, -99, 1, 1) $Group2 = GUICtrlCreateGroup("", 16, 32, 415, 169) Global $guiDescription = GUICtrlCreateEdit("", 162, 112, 255, 73, BitOR($ES_AUTOVSCROLL, $ES_WANTRETURN, $WS_VSCROLL, $ES_READONLY)) Global $guiWhen = GUICtrlCreateInput("", 162, 72, 255, 21, BitOR($GUI_SS_DEFAULT_INPUT, $ES_READONLY)) Global $guiTitle = GUICtrlCreateInput("", 162, 48, 255, 21, BitOR($GUI_SS_DEFAULT_INPUT, $ES_READONLY)) $Label1 = GUICtrlCreateLabel("Entry Title ----", 74, 48, 82, 17) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") $Label2 = GUICtrlCreateLabel("Entry Date / Time ----", 31, 72, 125, 17) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") $Label3 = GUICtrlCreateLabel("Entry Description ----", 35, 112, 121, 17) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") GUICtrlCreateGroup("", -99, -99, 1, 1) $Label4 = GUICtrlCreateLabel("Google Calendar Offline Backup Access", 72, 8, 251, 24) GUICtrlSetFont(-1, 12, 800, 0, "Arial Narrow") RetrieveData() GUISetState(@SW_SHOW) #endregion ### END Koda GUI section ### $timer = TimerInit() While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $ButtonNext If $currentrecord <= ($numberof[0] - 1) Then $currentrecord += 1 RetrieveData() EndIf Case $ButtonPrevious If $currentrecord >= 2 Then $currentrecord -= 1 RetrieveData() EndIf Case $ButtonRefresh GetRawData() ExtractDataThenSave() RetrieveData() Case Else If TimerDiff($timer) >= ((GUICtrlRead($minutes) * 60) * 1000) Then GetRawData() ExtractDataThenSave() RetrieveData() $timer = TimerInit() EndIf Sleep(10) EndSwitch WEnd Func RetrieveData() Global $numberof = IniReadSectionNames(@ScriptDir & '\GooCal Settings\Current Entries.ini') If Not $currentrecord Then $currentrecord = $numberof[0] / $numberof[0] $thetitle = IniRead(@ScriptDir & '\GooCal Settings\Current Entries.ini', $numberof[$currentrecord], 'Title', '') $thewhen = IniRead(@ScriptDir & '\GooCal Settings\Current Entries.ini', $numberof[$currentrecord], 'When', '') $thedescription = IniRead(@ScriptDir & '\GooCal Settings\Current Entries.ini', $numberof[$currentrecord], 'Description', '') GUICtrlSetData($guiTitle, $thetitle) GUICtrlSetData($guiWhen, $thewhen) GUICtrlSetData($guiDescription, $thedescription) If $currentrecord = $numberof[0] Then GUICtrlSetState($ButtonNext, $GUI_DISABLE) Else GUICtrlSetState($ButtonNext, $GUI_ENABLE) EndIf If $currentrecord = 1 Then GUICtrlSetState($ButtonPrevious, $GUI_DISABLE) Else GUICtrlSetState($ButtonPrevious, $GUI_ENABLE) EndIf EndFunc ;==>RetrieveData Func GetRawData() $datemin = _DateAdd('D', -1, @YEAR & '/' & @MON & '/' & @MDAY) $datemax = _DateAdd('M', +6, @YEAR & '/' & @MON & '/' & @MDAY) $urltocal = IniRead(@ScriptDir & '\GooCal Settings\Settings.ini', 'Settings', 'CalendarUrl', '') $urltocal &= '?singleevents=true&start-max=' & StringReplace($datemax, '/', '-') & '&start-min=' & StringReplace($datemin, '/', '-') Global $file = _INetGetSource($urltocal) Global $entries = _StringBetween($file, '<entry>', '</entry>') Global $count = UBound($entries) EndFunc ;==>GetRawData Func ExtractDataThenSave() If $count <> '' Or $count <> 0 Then If $count > 0 Then FileWrite($entryamountreceived, @CRLF & $count) $currententries = FileOpen(@ScriptDir & '\GooCal Settings\Current Entries.ini', 10) FileClose($ini) $create = $count + 10 Global $sort[$create][2] For $entryretrieval = ($count - 1) To 0 Step -1 $ID = _StringBetween($entries[$entryretrieval], '<ID>', '</ID>') $tmp = StringInStr($ID[0], 'morthawt.com') $ID = StringTrimLeft($ID[0], ($tmp + 12)) $title = _StringBetween($entries[$entryretrieval], '<title type=''html''>', '</title>') If IsArray($title) Then $title = $title[0] $when = _StringBetween($entries[$entryretrieval], '<summary type=''html''>When: ', '<br>') If IsArray($when) Then $when = StringReplace($when[0], '&nbsp;', '') $when = StringReplace($when, @LF, ' ') $sort[$entryretrieval][0] = $ID $contents = StringSplit($when, ' ') Select Case $contents[3] = 'Jan' $month = '01' Case $contents[3] = 'Feb' $month = '02' Case $contents[3] = 'Mar' $month = '03' Case $contents[3] = 'Apr' $month = '04' Case $contents[3] = 'May' $month = '05' Case $contents[3] = 'Jun' $month = '06' Case $contents[3] = 'Jul' $month = '07' Case $contents[3] = 'Aug' $month = '08' Case $contents[3] = 'Sep' $month = '09' Case $contents[3] = 'Oct' $month = '10' Case $contents[3] = 'Nov' $month = '11' Case $contents[3] = 'Dec' $month = '12' EndSelect $dayofyear = _DateDiff('D', $contents[4] & '/' & $month & '/' & $contents[2], $contents[4] & '/01/01') $dayofyear *= -1 If _DateIsLeapYear($contents[4]) Then $daysthisyear = 366 Else $daysthisyear = 365 EndIf $decimalpercentofyear = $dayofyear / $daysthisyear $sort[$entryretrieval][1] = $contents[4] + $decimalpercentofyear $sort[$entryretrieval][0] = $ID $description = _StringBetween($entries[$entryretrieval], '<br />Event Description: ', '</content>') If IsArray($description) Then $description = $description[0] IniWrite(@ScriptDir & '\GooCal Settings\Settings.ini', $ID, 'ID', $ID) IniWrite(@ScriptDir & '\GooCal Settings\Settings.ini', $ID, 'Title', $title) IniWrite(@ScriptDir & '\GooCal Settings\Settings.ini', $ID, 'When', $when) IniWrite(@ScriptDir & '\GooCal Settings\Settings.ini', $ID, 'Description', $description) IniWrite(@ScriptDir & '\GooCal Settings\Settings.ini', $ID, 'YearPosition', $contents[4] + $decimalpercentofyear) Next _ArraySort($sort, 1, 0, 0, 1) For $a = ($count - 1) To 0 Step -1 $cOrderTitle = IniRead(@ScriptDir & '\GooCal Settings\Settings.ini', $sort[$a][0], 'Title', '0') $cOrderWhen = IniRead(@ScriptDir & '\GooCal Settings\Settings.ini', $sort[$a][0], 'When', '0') $cOrderDescription = IniRead(@ScriptDir & '\GooCal Settings\Settings.ini', $sort[$a][0], 'Description', '0') IniWrite(@ScriptDir & '\GooCal Settings\Current Entries.ini', $sort[$a][0], 'Title', $cOrderTitle) IniWrite(@ScriptDir & '\GooCal Settings\Current Entries.ini', $sort[$a][0], 'When', $cOrderWhen) IniWrite(@ScriptDir & '\GooCal Settings\Current Entries.ini', $sort[$a][0], 'Description', $cOrderDescription) Next EndIf EndFunc ;==>ExtractDataThenSave Do you have any opinions or observations about this code so far? Thanks guys.1 point
-
BlazerV60, See my posts >here and later in the same thread for more explanation. M231 point
-
Did you read the help file for _ArrayAdd()? Change the $sDelim_Item to something other than |. Ticket closed!1 point
-
2D water simulation using a C++ dll
GreenCan reacted to DatMCEyeBall for a topic
I wrote this a while ago and only recently implemented shading. The current shading algorithm could use some improvements. Most of the source is based from here. The .dll source is also in the archive (made with Visual Studio 2012 Express). 2D Water simulation using a C++ dll.7z If you use a x64 bit OS then: EDIT: Added an example using a .gif file (split into frames).1 point -
The following is an example that fetches name/address/phone number for places of your criteria. If you needed to poll many different locations and aggregate the data, a solution as such may prove useful. As always my hopes is that people see this pile i left, fix the inefficiencies, and the result weeks from now is far finer than this initial offering. You need an API key from google (which is free), in your api console make sure you kick on both maps and places and JSMN from #Include "JSMN.au3" #Include <Array.au3> #Include <File.au3> Global $aFarray Global $aDarray $input1 = inputbox("What Place?" , "Enter the Place Name or Type of Place" , "University") $input2 = inputbox("Where At?" , "Enter the Zip or City" , "76504") $radius = inputbox("Prioritize Returns" , "Priority is given to places within this many meters" , "10000") $sInputs = $input1 & " " & $input2 $location = stringreplace($sInputs , " " , "+") Local $Json = BinaryToString(InetRead("https://maps.googleapis.com/maps/api/place/textsearch/json?query=" & $location & "&radius=" & $radius & "&sensor=false&key=YourKeyHere"), 4) Local $Obj = Jsmn_Decode($Json) $file = fileopen(@ScriptDir & "\JSON_RADIUS_OUTPUT.txt" , 2) filewrite($file , Jsmn_Encode($Obj, $JSMN_PRETTY_PRINT)) fileclose($file) _FileReadToArray(@ScriptDir & "\JSON_RADIUS_OUTPUT.txt" , $aFarray) ;~ _ArrayDisplay($aFarray) For $i = $aFarray[0] to 1 step -1 If stringinstr($aFarray[$i] , '"formatted_address": ') or stringinstr($aFarray[$i] , '"name": ') or stringinstr($aFarray[$i] , '"reference": ') Then ContinueLoop Else _ArrayDelete($aFarray , $i) Endif next _ArrayDelete($aFarray , 0) For $i = 2 to ubound($aFarray) - 1 step 3 $aFarray[$i] = stringtrimright(stringtrimleft($aFarray[$i], 17),2) Local $Json2 = BinaryToString(InetRead("https://maps.googleapis.com/maps/api/place/details/json?reference="& $aFarray[$i] &"&sensor=false&key=YourKeyHere"), 4) Local $Obj2 = Jsmn_Decode($Json2) $file = fileopen(@ScriptDir & "\JSON_Details_OUTPUT.txt" , 2) filewrite($file , Jsmn_Encode($Obj2, $JSMN_PRETTY_PRINT)) fileclose($file) _FileReadToArray(@ScriptDir & "\JSON_Details_OUTPUT.txt" , $aDarray) For $j = 1 to $aDarray[0] If stringinstr($aDarray[$j] , '"formatted_phone_number": ') Then $aFarray[$i] = stringtrimright(stringtrimleft($aDArray[$j], 29),2) Endif next Next $results = Fileopen(@ScriptDir & "\results.txt" , 2) for $k = 0 to ubound($aFArray) - 1 step 3 filewrite($results , stringtrimright(stringtrimleft($aFArray[$k+1], 12),2)) filewrite($results , @CRLF) filewrite($results , stringtrimright(stringtrimleft($aFArray[$k], 25),2)) filewrite($results , @CRLF) filewrite($results , $aFArray[$k+2]) filewrite($results , @CRLF) filewrite($results , @CRLF) Next FileClose ($results) shellexecute(@ScriptDir & "\results.txt")1 point