How do you open a remote sqlite database over http? - actionscript-3

Is it possible to open an sqlite file over http? I only need to read the db, and was hoping I could do something like:
var dbFile:File = new File("http://10.1.1.50/project/db.sqlite");
sqlConnection.open(dbFile);
Error #3125: Unable to open the database file.', details:'Connection closed.', operation:'open', detailID:'1001'
My situation calls for several apps compiled for various devices to share this file, which is served locally via wamp.

Zip your sqlite file from db.sqlite to db.zip. Load this zip file in flex using URLLoader and unzip it back in flex.
If not, you can also rename the file's extension to .xml, load it using httpservice or urlloader and once you get the result, you can rename the file's name back to .sqlite and start querying the file and it will work just fine.

There is no way you can achieve this over HTTP.
SqLite is a file and not a service/process that may be accessible via any port.
The best case scenario is when you have network access to the computer where the sqlite file is stored, like:
\\myserver\databases\mysqlitefile.db
...but this may work only on windows :(

You can adapt your code to use modsqlite http://modsqlite.sourceforge.net/#using

there's an apache module to allow remote sqlite access via http.
http://modsqlite.sourceforge.net/

Related

How to download some files from heroku

I made one Dyno app in Heroku using node.js
that Dyno task is to collect data and create json file daily
but I don't know how to download them locally
I tried
http://myappname.heroku.com/filename.json
but failed
Heroku is new for me,so please don't treat me like advance user
You cannot do this.
If your code is writing a JSON file to the Heroku server daily, that file is almost instantly being deleted, so there is no way you can download it.
Heroku dynos are ephemeral. This means that any data you 'save' to the filesystem will be deleted almost instantly. If you need to save files, you should save them to a file service like Amazon S3 -- then download them through there.
Save your JSON file to /public folder.
Ensure that your app.js has the following:
app.use(express.static(__dirname + '/public'))
Now, you should be able to access:
http://myappname.heroku.com/filename.json

Where is chrome.storage.local stored for Chrome Apps?

Where is chrome.storage.local stored for Chrome Apps in OSX yosemite?
I finally found it: ~/Library/Application Support/Google/Chrome/Default/Local App Settings/{{chrome-app-id}}. The whole {{chrome-app-id}} folder is a leveldb database. I was able to open it and inspect the contents of the stored file using the leveldb-ruby gem. Just do the following
require 'leveldb'
db = LevelDB:DB.new '~/Library/Application Support/Google/Chrome/Default/Local App Settings/{{chrome-app-id}}'
You can now query the database using the db object. By the way if you get a weird error saying that the db is being used by someone else make sure you kill chrome and erase the LOCK file.
localStorage is located in ~/Library/Application Support/Google/Chrome/Default/Local Storage. You'll need the ID to find the correct files but they'll be prefixed with chrome- and have a file extension of .localstorage.
Based on some picking through the POSTMan App, it looks like it makes a call to chrome.storage.local and the data on my Mac is located here: ~/Library/Application Support/Google/Chrome/Default/Local App Settings/<ID>/000003.log.

app.config for a windows service doesn't work on the fly

I wrote a Windows Service program, say myService.exe and it has myService.exe.config file. But it seems changes to the app.config is not repected by the service until the service is restarted. So, is this by design? Or how could I make my service always respects the config file change without restarting?
Thanks!
This is by design, it doesn't work the same as a web.config file.
You can use a FileSystemWatcher object to monitor for changes to the config file, and take an appropriate action if the file changes.
Yes, any .NET console/Winforms/Windows Service application will read its corresponding config file at startup and cache its contents. Altering it while the app is running typically doesn't change the running app.
If you need this kind of feature, you'd have to implement that yourself - e.g. make the app re-check the config periodically, or respond to a filesystem-watcher event that the file has changed.

Upload file button for remote files

Here's the scenario. I have a simple browse button. Right now, it opens up the folder hierarchy on my local computer. (PC).
However, I want to pick a file from a remote unix server which I have access to. Is there a way to display the file hierarchy of the remote unix server WITHOUT having to mount the drive?
Are there other options other than using a java applet?
Thanks,
Michael
If you don't really want an applet you can do it server-side in PHP by using this something like this to let the user select a folder:
<?php
$connection = ssh2_connect('host', 22);
ssh2_auth_password($connection, 'username', 'password');
$stream = ssh2_exec($connection, 'ls -a --file-type');
?>
Just parse the $stream variable to identify the folders (the ones ending with /) and present them in a table.
I guess this solves your problem. If you want the user to upload a file just put a simple file upload field, Once the user have selected a folder and uploaded a file in a temporal location in the server just move it with SSH too:
<?php
$connection = ssh2_connect('host', 22);
ssh2_auth_password($connection, 'username', 'password');
ssh2_scp_send($connection, '/temporal/filename', '/remote/filename');
?>
For getting this working you need to have enabled SSH2 libraries for PHP in your server.
Don't know how it is in Unix, but in Windows, you can either map a drive letter to remote path, or simply type the remote path in the browse dialog (\\server\share\filename)
Instead of using the regular input type file, invoke a Java applet. You can use VFS from apache to access your UNIX machines. VFS API supports many file access protocols.
http://commons.apache.org/vfs/filesystems.html
A friend of mine recommended Samba:
http://us3.samba.org/samba/
It apparently lets you link a unix server as a windows file/print server, which should show up in a file browser. :)
I don't know why; I've had much difficulty with installing anything on the solaris machine. So i've decided to go a slightly different route -- I found out that the machine is already mounted properly, so I can simply switch user accounts to access what I need -- without SSH.

How to copy the contents of an FTP directory to a shared network path?

I have the need to copy the entire contents of a directory on a FTP location onto a shared networked location. FTP Task has you specify the exact file name (not a directory) and File System Task does not allow accessing a FTP location.
EDIT: I ended up writing a script task.
Nothing like reviving a really old thread... but there is a solution to this.
To copy the all files from a directory then specify your remote path to be /[directory name]/*
Or for just files and not directories /[directory name]/.
Or specific file types; /[directory name]/*.csv
I've had some similar issues with the FTP task before. In my case, the file names changed based on the date and some other criteria. I ended up using a Script Task to perform the FTP operation.
It looks like this is what you ended up doing as well. I'd be curious if anyone else can come up with a better way to use the FTP task. It's nice to have...but VERY limited.
When I need to do this sort of thing I use a batch file to call FTP on the command line and use the mget command. Then I call the batch from the DTS/DTSX package.