Monthly Archives: February 2011

Zip files and folders (including empty folders) with LiveCode

/*
iZip 1.0.1
Make a zip file recursively without the
need for a callback message. This script includes empty folders
if there are any.
—————————————————————-
Usage: iZip path[,true|false]

Parameters:
The first parameter is a string containing the path to a file or
folder. The zip file will have the same name as the original
file or folder, appended by “.zip”, and is created in the same
directory as the original.
The second parameter is a boolean excluding “.DS_Store” files if
true and includes them if false or empty.

Error messages:
If the zip external encounters a problem, an  error message is
returned of the form “error: file not open”.

Comment:
You need to write your own script to check that the revZip
external is available.

Copyright © 2011 by Economy-x-Talk
http://www.economy-x-talk
This script is free to use. Please give credit if you do. Always
include this copyright notice in a visible place in your
software.
*/
on iZip theFile,theExcludeDsStore
     if not (there is a file theFile or there is a folder theFile) then
          return “error: file not found”
     end if
     set the itemDel to slash
     put number of items of theFile into myAbsolutPathLength
     put theFile into myFolderlist
     put theFile & “.zip” into myZipFile
     // need to zip the whole thing recursively
     // item names should probably be the relative folder paths
     put the directory into myOldDir
     put 0 into myCounter
     revZipOpenArchive myZipFile,”write”
     put the result into rslt
     if rslt is not empty then
          set the itemDel to comma
          return “error:” && item 2 of rslt
     end if
     if there is a file theFile then
          put last item of theFile into myItemName
          revZipAddItemWithFile myZipFile,myItemName,theFile
          put the result into rslt
          if rslt is not empty then
               set the itemDel to comma
               return “error:” && item 2 of rslt
          end if
     else // folder
          repeat forever with messages
               add 1 to myCounter
               put line 1 of myFolderList into myCurrentFolder
               // add folder
               put item myAbsolutPathLength to -1 of
                      (myCurrentFolder & “//”) into myItemName
               revZipAddItemWithFile myZipFile,myItemName,””
               put the result into rslt
               if rslt is not empty then
                    set the itemDel to comma
                    return “error:” && item 2 of rslt
               end if
               set the directory to myCurrentFolder
               put the files into myFileList
               // zip the files
               repeat for each line myFile in myFileList with messages
                    if (myFile is “.” or myFile is “..”) or
                           theExcludeDsStore is true and myFile is
                           “.DS_Store” then next repeat
                    put item myAbsolutPathLength to -1 of
                           (myCurrentFolder & slash & myFile) into
                           myItemName
                    if char -4 to -1 of myFile is “.zip” then
                         revZipAddUncompressedItemWithFile
                                myZipFile,myItemName,myFile
                    else
                         revZipAddItemWithFile myZipFile,myItemName,myFile
                    end if
                    wait 0 millisecs with messages
               end repeat
               put the folders into myTempFolderList
               repeat for each line myFolder in myTempFolderList
                    if myFolder is “.” or myFolder is “..” then next repeat
                    put cr & myCurrentFolder & slash & myFolder after
                           myFolderList
               end repeat
               delete line 1 of myFolderList
               if number of lines of myFolderList is 0 then exit repeat
               wait 0 millisecs with messages
          end repeat
     end if
     revZipCloseArchive myZipFile
     put the result into rslt
     if rslt is not empty then
          set the itemDel to comma
          return “error:” && item 2 of rslt
     end if
     set the directory to myOldDir
end iZip

What is a reasonable privacy statement?

Here’s my rather personal interpretation of a privacy policy statement. As a source, I used the Daily’s statement. You can find the full text here http://www.thedaily.com/privacy/ . I might be slightly exaggerating, maybe not. Honestly, I don’t know. Just read it.

“When you use the Services, we may collect certain non-personally identifiable information about that use. For example, […], our servers receive and record information about your computer and browser, including potentially your IP address, browser type, and other software or hardware information. […] we may also collect transactional information such as a unique device identifier assigned to that device (“UDID”), your geolocation, or other transactional information for the device in order to serve content to it. We also may use cookies and other tracking technologies […], which are comprised of small bits of data that often include an anonymous unique identifier.”

If you use our services, we will know who you are, where you are, what you do and with whom you do it.

“Third parties […] may also use these technologies […]. We do not control these third-party technologies and their use is governed by the privacy policies of third parties using such technologies. For more information about third-party ad networks that use these technologies, see www.aboutads.info.”

We work together with companies that collect the same information and we don’t care about their ethics. Oh, yeah, apparently we use it for ads mainly.

“Most browsers are initially set to accept cookies, but you can change your settings […] to block cookies altogether. […] Please note that by blocking any or all cookies you may not have access to certain features or personalization available through the Services.”

If you prevent us from earning money with advertisements, we might treat you badly.

“Third Parties. To improve the quality of our services, we may also supplement the information we collect with information we obtain from other users, business partners and other companies.”

We cross-link databases! (Is that legal?!).

“If you access the Services through a third-party connection or log-in, we may also collect your public user ID […] and any information you have made public in connection with that service and which the third party shares with partner services.”

We will spy on you.

“The Services are hosted in the United States. If you are a user located outside the United States, you understand and consent to having any personal information you provide transferred to and processed in the United States.”

We may help the CIA to spy on you.

“The Services may also be linked to websites and other services […]. We are not responsible for the privacy practices of any such third parties, and once you leave our website via a link, enable a third-party service, or click an advertisement, you should check the applicable privacy policy of the third-party site.”

Although we share your data with everyone and everyone shares your data with us, we don’t care what our partners to with this data. You’re on your own, dude!

“We only share your non-public personal information with non-affiliated third parties when we believe sharing is permitted by you or authorized by this Privacy Policy.”

We do what we believe is right.

“The Daily may periodically send promotional materials […]. If you want to stop receiving promotional materials from the Daily, you can follow the unsubscribe instructions […]. There are certain service notification emails that you may not opt-out of […].”

We will push the spam up your….

“We may make your non-public personal information available to […] contractors, agents or sponsors […]. These service providers are required to protect any personal information entrusted to them and not use it for any other purpose than the specific service they are providing to the Services.”

We can use your data for any third-party service we like.

“There may be instances when we may access, preserve and disclose user information without providing notice or choice, if required to do so by law or if based on a good faith belief that such access, preservation or disclosure is reasonably necessary to (a) comply with the law or legal process; (b) enforce this Agreement; (c) respond to claims that any content or information violates the rights of any third party; (d) respond to your requests for customer or technical service; or (e) protect the rights, property or personal safety of Company, users or any third parties including acting in urgent circumstances.”

…and just in case we haven’t made clear that we don’t really care, let’s repeat once more…

“We may also retain backup information related to your account on our servers for some time after cancellation for fraud detection or to comply with applicable law or our internal security policies.”

Once we got you hooked…

I have to say, the Daily is kind of honest. After all, they do tell you exactly what they might do with your personal information. Unfortunately, most people just don’t read this kind of stuff and are utterly surprised when they discover their data ending up all over the commercial world. If you decide to accept the terms, either with or without reading, it is your own fault. The only question that really bothers me is: can all those companies issuing endless privacy statements reasonably expect from their partly illiterate customers to read all this stuff?!