Jump to content

Marlo

Active Members
  • Posts

    291
  • Joined

  • Last visited

About Marlo

  • Birthday 04/08/1989

Profile Information

  • Location
    Bulgaria

Marlo's Achievements

Universalist

Universalist (6/7)

1

Reputation

  1. So I have a ~6Mb that is formatted like so: { "realm":{"name":"Someserver","slug":"someserver"}, "side1":{"data":[ {"auc":9999999999,"item":01234,"owner":"SomeNáme","bid":999999,"buyout":999999,"quantity":999,"timeLeft":"VERY_LONG"}, {"auc":9999999999,"item":01234,"owner":"SomeNáme","bid":999999,"buyout":999999,"quantity":999,"timeLeft":"VERY_LONG"}, {"auc":9999999999,"item":01234,"owner":"SomeNáme","bid":999999,"buyout":999999,"quantity":999,"timeLeft":"VERY_LONG"}]}, "Side2":{"data":[ {"auc":9999999999,"item":01234,"owner":"SomeNáme","bid":999999,"buyout":999999,"quantity":999,"timeLeft":"VERY_LONG"}, {"auc":9999999999,"item":01234,"owner":"SomeNáme","bid":999999,"buyout":999999,"quantity":999,"timeLeft":"VERY_LONG"}, {"auc":9999999999,"item":01234,"owner":"SomeNáme","bid":999999,"buyout":999999,"quantity":999,"timeLeft":"VERY_LONG"}]}, "Side3":{"data":[ {"auc":9999999999,"item":01234,"owner":"SomeNáme","bid":999999,"buyout":999999,"quantity":999,"timeLeft":"VERY_LONG"}, {"auc":9999999999,"item":01234,"owner":"SomeNáme","bid":999999,"buyout":999999,"quantity":999,"timeLeft":"VERY_LONG"}, {"auc":9999999999,"item":01234,"owner":"SomeNáme","bid":999999,"buyout":999999,"quantity":999,"timeLeft":"VERY_LONG"}]} } Now bearing in mind that the file can oft times contain 50k lines of this stuff. I started by reading the file line by line and parsing it with a simple regexp string which extracted the basic info and pushed it into a SQLite memory database but even so it takes upwards of 30 seconds to process a whole file (and it takes about 30-50% CPU usage). Here is the RegExp i used; ^.*?{.?auc":(d*).*?"item":(d*),"owner":"([w]+)","bid":(d*),"buyout":(d*),"quantity":(d*),"timeLeft":"([a-zA-Z_]+)"} I am new to RegExp so my method is probably very bad : / So does anyone know a better way for me to be doing this? My way feels way too clunky.
  2. WoW AH Browser This application uses the World of Warcraft auction and item API's to get the information so this does not break any of Blizzard's ToS and does not require any of your personal or login information to function
  3. So i started using the SQLite UDF which is now shipped with AutoIT along with the a sqlite dll i found on the net and all is working fine but i have a slight issue when it comes to saving a database. I have 60,000 or so entries which i need to very quickly write to a new SQLite table which can be done within seconds when using a memory database like so _SQLite_Startup() If @error Then MsgBox(0, @error, "Failed to start SQLite") Return EndIf $hDB = _SQLite_Open() If @error Then MsgBox(0, @error, "Failed to create memory database.") Return EndIf $Q = _SQLite_Exec($hDB, "Create table '" & $sName & "' (`auc` INT ( 11 ) NOT NULL , `item` INT ( 11 ) NOT NULL , `owner` VARCHAR ( 13 ) NOT NULL , " & _ "`bid` INT ( 11 ) NOT NULL , `buyout` INT ( 11 ) NOT NULL , `quantity` INT ( 11 ) NOT NULL , `timeleft` VARCHAR ( 11 ) NOT NULL)") If @error Then MsgBox(0, @error, "Failed to create table") Return EndIf While True $iItt += 1 $Line = FileReadLine($hFile) If @error = -1 Then ExitLoop $Info = StringRegExp($Line, '^.*?{.?auc":(\d*).*?"item":(\d*),"owner":"([\w]+)","bid":(\d*),"buyout":(\d*),"quantity":(\d*),"timeLeft":"([a-zA-Z_]+)"}', 1) If $Info = 0 Then ContinueLoop $Q = _SQLite_Exec($hDB, "INSERT INTO '" & $sName & "' VALUES ("&$Info[0]&", "&$info[1]&", '"&$info[2]&"', "&$info[3]&", "&$info[4]&", "&$info[5]&", '"&$info[6]&"');") If @error Then MsgBox(0, @error, $Q) ContinueLoop EndIf If Mod($iItt, 100) = 0 Then _Log($iItt & " itterations so far.") EndIf WEnd But if i want to save the database to disc by using a permanent database like so $hDB = _SQLite_Open(@scriptdir & "\database.aql") Then the script takes about half an hour to write all 60,000~ entries to disc. Is there a way i can use the memory database whilst it processes the information and THEN write the database to disc? I can see no functions related to this in the UDF
  4. I just threw this together: To use it just save the script to the directory where the files are and run it. #include <File.au3> $Files = _FileListToArray(@ScriptDir, "*", 1) For $I = 1 To $Files[0] $Name = StringLeft($Files[$I], StringInStr($Files[$I], ".")-1) If Not FileExists(@ScriptDir & "" & $Name) Then DirCreate(@ScriptDir & "" & $Name) FileCopy(@ScriptDir & "" & $Files[$I], @ScriptDir & "" & $Name) Next MsgBox(0, "", "Done!") It copies the file opposed to moving them just in-case something goes wrong and it also lacks recursion (but you didn't mention that so...)
  5. Maybe this could help with the missing DLL http://answers.microsoft.com/en-us/windows/forum/windows_7-windows_programs/trying-to-open-computer-management-the-program/5c9d301a-2191-4edb-916e-5e4958558090
  6. Hey guys. I've started work on a simple client/server app and i have hit a snag. So i have my app set up to use TCP to send and receieve data between 2 apps and in order to correctly proccess the data i want to prefix any data sent with a flag so the client or server app will know what to do with the data. I tried doing something like the following (Added comments for info) $Flag = 0x100 ;Will be 4 bytes long. $Dat = "This is some data" ;Will be 17 bytes long msgbox(0, "Flag Length", BinaryLen($Flag)) MsgBox(0, "Dat Length", BinaryLen($Dat)) $Pack = ($Flag) + Binary($Dat) ;I even tried converting the $Flag into binary but it just seemed to add more bits. MsgBox(0, "Packet Length", BinaryLen($Pack)) MsgBox(0, "Trying to extract Flag", (BinaryMid($Pack, 1,4))) ;Try to extract the first 4 bytes from the packet. Fails. MsgBox(0, "Trying to extract data", BinaryToString(BinaryMid($Pack, 5))) ;Try to extract the remaining bytes from the packet and convert to string. Works. I could easily accomplish this using strings and just separating out the flags using stringinstr but i would prefer to get it working this way. So does anyone know why it won't extract out the flag?
  7. I may have solved the memory leak by de-initialising the FreeImage lib after about 100 conversions yet still don't know how to reduce the file size.
  8. Hello! So i have made an app that converts multiple images to a different type, colour and size using the library but have run into a couple of issues. So here is an example of the code I use to convert my images. _FreeImage_LoadDLL(@ScriptDir&"\FreeImage.dll") _FreeImage_Initialise() For $I = 1 To $Example[0] _ProcessImage($ExampleInput[$I], $ExampleOutput) Next Func _ProcessImage($Input, $Output) $sFile = $Input $iTWidth = 600 $iTHeight = 800 $FIF = _FreeImage_GetFileTypeU($sFile) If $FIF = $FIF_UNKNOWN Then $FIF = _FreeImage_GetFIFFromFilenameU($sFile) EndIf $hImage = _FreeImage_LoadU($FIF, $sFile) $oWidth = _FreeImage_GetWidth($hImage) $oHeight = _FreeImage_GetHeight($hImage) $Ratio = $oWidth / $oHeight If $Ratio > 1 Then $hImage = _FreeImage_RotateClassic($hImage, 90) EndIf $hImage = _FreeImage_Rescale($hImage, $iTWidth, $iTHeight, $FILTER_BILINEAR) $hImage = _FreeImage_ConvertToGreyscale($hImage) _FreeImage_SaveU($FIF_PNG, $hImage, $Output, $PNG_Z_BEST_COMPRESSION) _FreeImage_Unload($hImage) EndFunc Okay so this actually works quite nicely and does exactly what i want it to but with 2 problems. 1) FreeImage doesn't seem to dump the image from memory after each iteration resulting in huge RAM consumption (i usually convert about 400-600 images at a time) 2) The filesize of the output files is usually bigger than the inputs despite being converted to grey-scale and scaled down in size. I would also like to somehow make the images crisper. If anyone can shed some light on this for me i would be appreciative
  9. How would i go about reducing the output file size? I start out with a JPEG roughly 150KB in size and once i run the following code it outputs at around 250KB's. Is there a way to down sample it a bit?I tried changing the filter but it didn't seem to change much. Also would just like to thank you for making such an awesome script Func _ProcessImage($Input, $Output) $sFile = $Input $iTWidth = 600 $iTHeight = 800 _FreeImage_Initialise() $FIF = _FreeImage_GetFileTypeU($sFile) If $FIF = $FIF_UNKNOWN Then $FIF = _FreeImage_GetFIFFromFilenameU($sFile) EndIf $hImage = _FreeImage_LoadU($FIF, $sFile) $oWidth = _FreeImage_GetWidth($hImage) $oHeight = _FreeImage_GetHeight($hImage) $Ratio = $oWidth / $oHeight If $Ratio > 1 Then $hImage = _FreeImage_RotateClassic($hImage, 90) EndIf $hImage = _FreeImage_Rescale($hImage, $iTWidth, $iTHeight, $FILTER_BILINEAR) $hImage = _FreeImage_ConvertToGreyscale($hImage) _FreeImage_SaveU($FIF_PNG, $hImage, $Output) _FreeImage_Unload($hImage) _FreeImage_DeInitialise() EndFunc
  10. If you put this at the top of your script: #include <GUIConstantsEx.au3> then you can do stuff like: if GUICtrlRead($radio1) = $GUI_CHECKED then ;radio button has been checked if GUICtrlRead($radio1) = $GUI_UNCHECKED then ;radio button is unchecked
  11. Fixed, had to set FTP to passive mode.
  12. Has anyone else tried using the FTPEX functions along with an awardspace account? Because I can use the functions to open a connection to my server without problems but I cannot do anything else like upload files or get file lists : / It's a very annoying problem and it would be cool if anyone could shed some light onto this for me.
  13. Super useful, Thanks alot mate <3
×
×
  • Create New...