Can I create an AIR app which will only run with the provided CD? - air

I'm looking to make an AIR application. However, unlike the normal distro, I want to sell these on a CD. I want the AIR app to only be able to be run when the CD is in the CD drive (I don't care that people can hack around this, its the default behavior I want) Does anyone know if this is possible?

You can get drive list with:
var drives:Array = File.getRootDirectories();
Next, you want to check ones with spaceAvailable = 0 if they contain files like on your CD. If the disk isn't in the drive, drive will not be listed in array.

Related

Teachable machine on PC

Hi there i am pretty new to programming, but is it possible to use Google's teachable machine in command prompt on PC? Or it is a special application?
My plan is that.
One folder contains the image 1
Other Folder contains image 2
Then it teaches it self with the images in folder two
Then i have a third folder and only keep the images the third folder which are 50% more likely image 1 or image 2.
Just like on their website but in local pc, and mass scale.
Is it possible or it is too hard just asking :D
https://teachablemachine.withgoogle.com/train/image

How do small teams do secure backups of source code?

First of all, I don't mean version control such as git.
I do use git locally but, I'm trying to determine the best way to do back-ups of source code (as well as other app assets) in case of hardware failure or such.
I was thinking I could set up a script to tar my project folders, and encrypt them with gpg. I would then save the encrypted tar to external hard drives and to 1 or more off-site locations using a service such as amazon drive or dropbox.
Currently, I'm a sole developer so my thinking was that this method should be okay. But I wanted to get some input to make sure I'm doing this the best/most reliable way possible.
If there is a better approach to this that may be more applicable to small teams, then please let me know, as I'm more than happy to do the extra work implementing the approach.
There are much of ways of doing that.
But, if you always work local and you need a simple way of doing that, you may take a look at run scripts if some specific usb device is plugged in.
Meaning that a simple backup script with tar would run if you plug in your specific backup hdd.
Take a look at udev rules in linux.
udev is a generic device manager running as a daemon on a Linux system and listening (via a netlink socket) to uevents the kernel sends out if a new device is initialized or a device is removed from the system. The udev package comes with an extensive set of rules that match against exported values of the event and properties of the discovered device. A matching rule will possibly name and create a device node and run configured programs to set up and configure the device.
Take a look at these posts:
https://unix.stackexchange.com/questions/65891/how-to-execute-a-shellscript-when-i-plug-in-a-usb-device
&
https://askubuntu.com/questions/401390/running-a-script-on-connecting-usb-device
If you plan to go further, to extend the team or even to keep your code for a while in other words, if you want to be professional, I would go with a scalable and reliable tool designed for this: use a real backup and restore tool and don't use scripts. A lot of people, small (and even not so small) companies are doing it and they end up in trouble: maintenance, scalabolity, update, and so on.
There are plenty of backup & restore tools for different purposes and/or platforms, prices and so on. https://en.wikipedia.org/wiki/List_of_backup_software would be a good start :)
Cheers
Werlan

In OSX (Mountain Lion) Only allowing an application to open if a condition is met

Is there any simple way to do this?
I basically want iTunes to not open if an external hard drive is not connected. This is essentially a user issue - as despite asking multiple times, my girlfriend will forget and open an audio or video file without the external HDD connected (where the iTunes library is kept) and so the usual rigamarole occurs... the media file will then try and add itself to the iTunes library, which can't be found, so it'll default back to it's position on the internal hard disk, and then when I come to use it, it'll try and consolidate it for me (which is nice), except it then decides it needs to organise it - and this takes about 6 hours due to the amount of music I have on there.
I've tried changing the internal (default) iTunes music folder path to an alias to the external one, but that starts throwing out some beastly errors once you get into the loop (when the alias is essentially a pointer to an invalid location).
Is Automator something that could be used? Sorry I'm not very pro with OS X I'm afraid.
Thanks,
Duncan
It seems a straightforward way to do this is just to move the iTunes.app onto the external hard drive, and replace iTunes.app in the Applications folder with an alias pointing to iTunes on the external HDD (called iTunes).
As iTunes is system protected, you'll need to change the permissions of iTunes.app to move it, which you can do via gui or terminal (sudo chmod...)
Simples.

Download List - Mac Objective-c

It would be far to much for me to ask for a full solution. However, could you point me in the right direction in what I need to look up, learn etc as its the first time I am going to attempt something like this.
What I want to do, is in my Mac application, have a list of items which are files which I want to store online. Then from inside the application the user can download any of the items stored at that location online. If I add new items to download online I want the app to automatically add them to the list for download.
That make sense? Anyway, its the first time I have done anything like this using an online server and accessing it via an app, so any support would be hugely appreciated.
Sounds like you want an ftp type server, you can then get list of remote files, upload and download file, if you do search for Cocoa ftp I am sure you will find someone has written a nice wrapper class for ftp, there are even complete open source apps for ftp whose code you can examine, FileZilla, other you could just use NSTask, and call the ftp command line tool on all macs.

File path for J2ME FileConnection?

I'm writing a MIDlet which needs to write file. I'm using FileConnection from JSR-75 to accomplish this.
The intention is to have this MIDlet runnning on as much devices as possible (all MIDP 2.0 devices with JSR-75 support, ideally).
On several emulators and an HTC Touch Pro2, I can perfectly use the following code to get the root of the filesystem:
Enumeration drives = FileSystemRegistry.listRoots();
String root = (String) drives.nextElement();
String path = "file:///" + root;
However, on a Nokia S60 5th edition emulator, trying to open a FileConnection to this path throws a java.lang.SecurityException. Apparently S60 devices do not allow connections to the root of the filesystem. I realise I can use something like System.getProperty("fileconn.dir.photos"), but that isn't supported on all devices either.
So, my actual question: what is the best approach to get a path to create a FileConnection with, that allows for maximum portability?
Thanks.
Edit:
I suppose I could iterate over all the roots in the Enumeration, and check for a writable one, but that's hardly optimal for two reasons. First, there aren't necessarily any writable roots. Second, this could be the phone memory or a memory card, so the storage method wouldn't be consistent across devices, which is rather ugly.
You are supposed to open read-only connections to roots in order to find out what folder they contain.
As a general rule, when opening a read_write connection to a folder throws a SecurityException, try to open a read-only connection to browse through sub-folders in order to find a writable one.
Specifically on Symbian (and other platforms advanced enough to provide secure data cages to your MIDlets), you can use System.getProperty("fileconn.dir.private"); to find a writable area.
I will tell you what we do. We have a test app that just finds out the file system root and the SD card root if applicable. We set this as a jad parameter. The code reads it from the Jad file. Since you dont need to recompile the jar for different devices this works out very well, just change the jad parameter for a handset with different file system root.