Reading kml file from saved email attachment - android-file

I have set up a file "import - export" process (using gmail client) in my app that would allow users to share kml files between each other or even just between devices. Please read the steps the user goes through to best understand.
File Out Process:
1) User adds placemarks to map.
2) User saves placemarks in kml format on /sdcard with user defined name (let's say "Saved.kml").
3) User "Exports" Saved.kml via gmail attachment.
File In Process:
1) User saves gmail attachment to Download folder on device.
2) User chooses "Import KML" and selects Saved.kml from list.
3) Everything works perfect! Placemarks appear on map just as exported/expected!
Except for one major flaw... This only works when you use the same device for your importing/exporting. I have two devices; Nexus 7 and LG Motion and it works great on either of them. But I can't get it to work between the two and I'm starting to get very frustrated.
Here is what I have tried:
Manifest changes:
android:sharedUserId="com.xxx.xxx"
android:sharedUserLabel="#string/sharedUserLabel"
Runtime.getRuntime().exec( "chmod 444 Saved.kml" ); // (need to support Android level 4)
Even tried this just before parsing Saved.kml -- importFileIn.renameTo(importFileOut);
and the file gets renamed but still fails to parse.
adb shell shows:
-rw-rw-r-- root sdcard_rw 867 2013-02-28 10:39 Saved.kml
-rw-rw-r-- root sdcard_rw 867 2013-02-28 11:44 SavedRenamed.kml
I used "adb push" and it showed the exact same userid/permissions on the pushed file and still won't load.
I was just at the point of last minute testing before publishing when I caught this.
Testing on the same device never had a single issue... Please help.

Sorry Folks,
Asking this question through Stack Overflow made me type out everything that I've been pondering and finally led me to believe that this is not a file permission problem. By using Log.i I printed out the exception and found out this is actually a "File not found" error. Which of course is a whole different thing! Path error, problem solved!
Thanks for your patience with me.

To be more specific as to try to help: I was pulling data from files in the devices "Download" folder. On the Nexus 7 this is: "/storage/emulated/0/Download". On the LG Motion this is:"/sdcard/Download". By using "root.getAbsolutePath() + "/download" my problem was resolved.

Related

SQLAlchemy/pgAdmin: Error: password authentication failed for user "root"

I'm conducting a study and I need to store some data. I found an open source data scraper and parser online: https://github.com/hicsail/materials
I've followed some instructions (some of which but not all came from here) and
installed Postgres, created a docker-compose.yml file, and created a config file:
Above is the config file, and this is the .yml file
I started by going into the pgAdmin folder and running "docker-compose up", after which, this was the result:
I'm not sure if the "no privileges flag" means anything. Anyway, after this, I opened up a localhost:5050 in my browser and logged into pgAdmin.
I named the database "materials" as this was what it was supposed to be named.
Same thing with the username and password; both were named "root". However, when I run the command to parse the data, I'm getting this error:
I've been stuck on this for a long time now, and I can't seem to find any solution. This is running in a python2.7 conda environment, as per the requirements. These were the other installed libraries (I'm not 100% sure those were the exact versions, but I tried to get them as close as possible).
psycopg2==2.7.3.1
requests>=2.20.0
SQLAlchemy==1.0.9
wheel==0.24.0
If I need to clarify anything please let me know.
Thanks.
I found an answer for this. I had to go into services, then to postgres, and stop it from running. I then had to kill the port "5432" and run it again.

Google Appengine Deployment Security Woes

We are having trouble deploying our Google Appengine application. We get the following error message
from the indicated deployment command at the Unix shell prompt.
/home/leffstudent/appengine/bin/appcfg.sh update ~/u3/web/war -p proxy.wiu.edu:8080
The following URL can be used to authenticate:
https://accounts.google.com/o/oauth2/auth?access_type=offline&approval_prompt=force&client_id=550516889912.apps.googleusercontent.com&redirect_uri=urn:ietf:wg:oauth:2.0:oob&response_type=code&scope=https://www.googleapis.com/auth/appengine.admin%20https://www.googleapis.com/auth/cloud-platform
Attempting to open it in your browser now.
Unable to open browser. Please open the URL above and copy the resulting code.
Please enter code:
There is no browser on this computer, a Linux virtual machine, used as the programming opportunity for the School of
Computer Sciences. We simply use putty to log in.
I cut and pasted the address and entered into Chrome into the computer that has run putty. I get the code in that browser. I cut that and tried to paste it back
into the browser. NO luck.
I get
"java.net.ConnectException: Connection refused"
(This has been difficult because this Putty does not seem to have menu items for cut and paste.)
I tried about seven times. Several times, I also tried simply typing the code in carefully. No luck.
The graduate student on the project also tried themselves--no luck!
Thanks for any insight. In particular, it seems I should I ask the system administrator who set up the disk slice with our School of Computer Sciences'
server for a "browser." What should I specifically ask for? I did not see any documentation of what the google appcfg.sh program is doing when it tries to "open it in your browser now."
We have a project on which five people have worked over several year time frame that is dead in the water because we can no longer
deploy.
I'm not sure why the code isn't working - it should. As a work-around why not:
push the code to a git repo (e.g. bitbucket)
pull it to a machine that does have a browser
Set up the browser-machine to run GCloud under the account you're hoping to authenticate with
Deploy from there

Trouble updating my site to Drupal 7.34. Maybe problems connecting programs to webserver

I am new to this, and I hope someone can help me with the supposedly simple task of downloading an update of Drupal. A few months ago I finally created a website at Unoeuro and with Drupal. I even got around to chose themes and put content in.
My system: Windows 7, Webserver Apache, host: Unoeuro, run Drupal 7.32 just fine, besides the warning message on most of the pages on my site's Admin.
Problem: A little while ago Drupal started saying "There is a security update available for your version of Drupal. To ensure the security of your server, you should update immediately! See the available updates page for more information and to install your missing updates."
When I follow the link, it says: "Manual updates required" and "Updates of Drupal core are not supported at this time."
Do you think THAT is the reason, why I can't make it work?
However, since there is a link to the latest update, Drupal 7.34. and it is coloured red and looks like I need it.
When I follow the Update link, I'm told to download it through one of three methods- https://www.drupal.org/project/drupal After checking my Systemrequirements through NetCraft.com, reading the Installation Guide, and downloading and extracting the 7.34 zip-file with Zipwizzard, my command prompt doesn't know, what I'm talking about.
I've tried alsmost every combination of methods, both the Drush and Command Prompt, and different zip-files and tar-files and extracting in every command prompt.
Problem: It seems like none of them are not connected to a 'prober Drupal environment', as they say.
I've tried changing the PATH to the drupal-7.34 folder, where the environment should be (I suppose, because I just downloaded it). But the command prompt still says '... is not recognized as an internal or external command, operable program or batch file' or that the command is not made in a 'prober Drupal Environment'.
I don't know what I'm doing wrong and I hope someone can give me a hint about it.
Bro you need to be in the correct folder to use drush to update your site. If you are running a non-multi site instance move to [drupal_root]/sites/all and run the command "drush up", press y a few times and enjoy. SO thats:
ssh selsen#selsonssite.com
cd [drupal_root]/sites/all
drush up -y
PS using -y on drush up means you don't have to press y multiple times.
You can also contact me # josh#hamrent.com for more Drupal support.

Trying to find information on how to build a simple file version controll system

Im want to build a file system for non-tecks( dont care about old versions of the file so no merging or svn/git). The thougt is that a user should be able to download a file, in the same instance the file should be locked for other users. When the first user is done editing the, the file should then automaticaly upload to the server. When he closes the file, the lock should den be opend.
Is this even possible? Im thingking a sort of browser plugin, but I cant find anywone that has done the same thing. (besides microsoft, but who want to go down that road)
That would be: Sharepoint, Alfresco, (almost every WIKI), ...
Actually that is a basic feature of most document management systems. Even SVN has that already and IIRC you can set that up with mod_dav_svn without a line of code (considering configuration is not code).
Also the interesting question is, IMHO, not TheHappyCase where the described unit of work goes well but what about this*:
I Checkout 50 random documents you need
(get some popcorn and wait for your stresslevel to go up)
?????
I get bored and forget about it (everything still being checked out)
*: Points (1) and (2) may change order

How do I find the database file on an Android virtual device?

My plan is to prepopulate a database on a virtual device and then include database in the distribution of my app.
However, I can't find the database file.
Is it on my hard disk some where?
How do I get it?
I tried connecting using adb, I did an "ls" and then got really scared by this obscure list of directories:
sqlite_stmt_journals
cache
sdcard
etc
system
sys
sbin
proc
init.rc
init.goldfish.rc
init
default.prop
data
root
dev
Even when I cd over to /data/data/your.package.here/databases I still do not have access to the actual database file. I can't use sqlite3 or do a pull on it. Is there a way to change permissions?
This works fine on my emulator, but fails on the actual device
adb pull /data/data//databases/mydb.db .
It should be in /data/data/your.package.here/databases, where your.package.here represents the package associated with your application, as defined in your AndroidManifest.xml file.
If you want to navigate to your database (which is located /data/data/your.package.here/databases), make sure you are a root user while navigating shell. To do so, type "su" once you enter the command prompt. When you are a root user, you can navigate wherever you want.
The blog post below gives a good solution of how to find and access your database. The post talks about using busybox, which provides useful utilities at the command line, to find your database and gives a few useful examples on how to use sqlite3 to access the DB and tables.
http://davanum.wordpress.com/2007/12/11/android-how-to-poke-around-the-sqlite3-databases/

Resources