About the folder for scripts - zend-framework

I'm at this part of tutorial for zf1.
It says:
At this point we have a connection to a database; in our case, its a connection to a Sqlite database located inside our application/data/ director..",
And then it shows an sql clause that I should save in a folder called scripts, but... where is that folder?

You can create the folder if it doesn't already exist. Its location is not important as its contents are not used by your application directly, but by convention the folder would sit in the root of your app.
For reference, he's the recommended folder structure for a ZF1 application: http://framework.zend.com/manual/1.12/en/project-structure.project.html - the scripts folder there is the one on line 35. This is an extreme example - your application will likely have a lot less folders than shown in that guide.

Related

VS Code don't load the user-data

My problem is that the portable version of visual studio code don't load my settings I had copied from the folder %APPDATA%/code/user.
I loaded the .zip data and extracted the folder. I added a data folder into the extracted folder of VS Code. It's in Visual Studio Code\data. In there i copied the folder "user" from %APPDATA%/code/ and renamed the user folder into "user-data". Then I started code and the usersettings are not loaded.
The command .\code.exe --user-directory .\data\user-data won't work.
Is this a bug or did I do something wrong?
In portable mode, the --user-directory command linte option is ignored.
From the documentation:
--user-data-dir <dir>
Specifies the directory that user data is kept in, useful when running as root. Has no effect in Portable Mode.
Instead, use the default location of user data for a portable install and copy your user data to that directory (from a previous comment it seems like you've already done so successfuly).
For anyone wishing to use a different user data directory when in portable mode, symlink-ing the user data folder should be a viable option if on a linux-like platform.
(Trivia: this was at first reported as bug, after which the documentation was updated, rather making it a feature.)
You can simply create a folder called data in the root folder with
VS Code.
After the startup, the files with standard settings will be
created in the data folder.
Then you can just copy the settings from the folder %AppData%\Code\User to the folder data\user-data\User.
To migrate already installed extensions, copy the contents of the %HomePath%\.vscode\extensions folder to the data\extensions folder.

How do I specify the path to my SQLite database in Slick?

I'm trying the Play framework with Scala and Slick for data access.
I'm playing with the play-scala-intro example app. I'm trying to set up my own database instead of using the bundled in memory H2 database.
I can't figure out how to specify the path to the database file.
If the code in application.conf reads:
slick.dbs.default.db.url="jdbc:sqlite:/test.db"
slick.dbs.default.db.driver="org.sqlite.JDBC"
where should my test.db file be placed?
Does that mean the test.db file should be in the home directory of the web app, meaning the root play-scala-intro dir, or the app/assets dir?
I'd say storing your database in Java resources (and that's where assets will end up) doesn't sound like a good idea to me. I would be surprised if nothing went wrong during e.g. writing to DB.
It would be better to have it in the same directory as JAR, and even better set some defaults and let them be overridden:
database.location="test.db"
database.location=${?DBLOCATION}
slick.dbs.default.db.url="jdbc:sqlite:"${database.location}
This should assume that your database is names test.db and placed in your working directory (see: https://stackoverflow.com/a/21061029/1305121). It can be overridden using environment variable DBLOCATION like:
export DBLOCATION="/tmp/my/database.db"
# run Play application

Deploy files in the localState folder during installation of a store app

I am building an app for windows store and I need some default and example data to be in the localstate folder (Windows.Storage.ApplicationData.current.localFolder) when the app run the first time.
The folder and files structure is a bit complex and I tryed to copy the files at the start of the application, but I can't manage that way.
Is it possible to have files being copied automatically from the installation folder to the localstate folder during the store app installation?
Unfortunately, customization of the app install process isn't currently supported. You have to do this as part of your first run processing.
One possibility is that you include the data in your package as a .ZIP or other compressed file and use an appropriate library to expand that file into a folder structure on startup. That could simplify your logic considerably. (I don't have a library to recommend; it's just an idea.)

Can Google Package App use external directories during packing?

I am writing a number of Google Packaged Apps which run independently, but share lots of code. For example, they all use "library.js". I would like to have only one copy of library.js so any changes to it will be used by all newly packed apps.
To package my apps, it seems they all must have a copy of library.js in their own directory structure, whereas it would be nice to have a single master copy in some other directory that is accessible to all. I currently do a manual check to make sure all files are up-to-date before packing, and I am writing some code to do the check automatically, but it seems like a work-around.
Can a Google Packaged App use JS code in external library directories, or must all code be under the root directory of the app (i.e., requiring copying from external directory) when packing?
Have you tried providing a URL i.e. host the javscript file in .js format to an accessible location to your apps and then provide the .js file URL in all your apps code. The very next time you want to change, all you have to do is to update that .js file.

packaging and deploying java desktop application with embedded database

I created a simple desktop application that uses embedded database(derby) from netbeans.After adding two entries into the table inside the ide and running it again works perfect.But when i double click the executable jar file outside the ide an empty database is shown what might be the reason? I would also like to know how to make this run on client machine.I tried adding the jar and lib files into a folder and converting it into a rar file but i don't find the jar file after extracting.I am new to this and any help would be appreciated.thanks in advance
There are two common reasons why you find that you are getting an empty database unexpectedly:
You are saying ';create=true' and using a relative database name, meaning that you are giving Derby permission to create the database fresh if it doesn't exist, and then your Derby system home directory is changing from run to run, so you are ending up creating new copies of the database each time, in different current directories.
You are using a different username when you connect to the database. Since the username with which you connect implicitly specifies the schema in which your tables reside, using a different username causes you to see a whole different set of tables, or, depending on how you look at it, an empty database.
Regarding jars and rars and such, the crucial thing is to manage your CLASSPATH properly. You need to have the Derby code in your CLASSPATH at runtime. There are a large variety of ways to make this happen, so you'll need to be quite explicit about the particulars of your situation in order for others to give you much help.