Not sure of the correct use IP2Location database - ip2location

I've used:-
$db = new \IP2Location\Database('./database/IP2LOCATION-LITE-DB3.IPV6.BIN', \IP2Location\Database::FILE_IO);
it seems to work OK.
IP2 docs. says "Class Database, Expects 2 input parameters"
Full path of IP2Location BIN data file. -- OK
File Open Mode. -- Why does it also need "\IP2Location\Database::" ?
Tried not using "\IP2Location\Database::FILE_IO" just using "FILE_IO".

Related

SAP HANA custom dictionary: full-text-index not generated or updated

There are two problems with SAP HANA custom dictonaries.
Updating and recompiling the dictionary has no effect on the full-text-index table (even by dropping and generating the full-text-index again)
using custom dictionaries & configuration may lead to an empty fulltext-index-table
For the 1. Problem
deleting the configuration file and replace it with a new file (same content but different file name) then activating all changes (activates the deletion of the old config and adds the new config) seems to be a work-around.
Note: this means you also have to change the configuration name in the SQL command.
For the 2. Problem
Check this trace file:
/usr/sap/HDB/HDB00/hanadb/trace/preprocessor_alert_hanadb.trc
This error message:
File read Error '/usr/sap/HDB/SYS/global/hdb/custom/config/lexicon//EXTRACTION_CORE_MOD2', error='Storage object does not exist: $STORAGEOBJECT$'
occurs if the configuration file EXTRACTION_CORE_MOD2 is not properly activated in the repository under sap.hana.ta.config. So double check the repository if the configuration file exists in the specified path.
For the first problem, I have the same scenario in which I need to make some changes in the custom dictionary and activated it. It did not affect my index table unit I run the following statement:
ALTER INDEX MYINDEX REBUILD;
I have checked it and the changes affect the index table by this statement. So you do not have to remove your index or save the changes of your custom dictionary in a file with new name.

Can the Path assigned a SQLite DB be an arbitrary value?

In this blog post, some prerequisite code for getting started using SQLite in Windows Store Apps is given, for adding to the OnLaunched method of App.xaml.cs:
// Get a reference to the SQLite database
this.DBPath = Path.Combine(
Windows.Storage.ApplicationData.Current.LocalFolder.Path, "customers.sqlite");
My question is: Can I use any arbitrary value to replace the "customers.sqlite" part, or does it have to match something else in my code, such as the name of my table definition class (in my case "PhotraxCoreData.cs" which, according to Mr. Green's suggestion, I added below a newly-created "Models" folder)?
My understanding is that, once I've got those classes defined (I do), and the code above in App.xaml.cs, along with this there (adapted for my SQLite classes):
using (var db = new SQLite.SQLiteConnection(this.DBPath))
{
// Create the tables if they don't exist
db.CreateTable<PhotraxBaseData>();
db.CreateTable<PhotraxNames>();
db.CreateTable<PhotraxQueries>();
}
...SQLite tables based on those classes I specified will be created, and have the name "customers.sqlite" (provided I don't change it).
So, can I use:
this.DBPath = Path.Combine(
Windows.Storage.ApplicationData.Current.LocalFolder.Path, "platypus.sqlite");
...or must it be something like:
this.DBPath = Path.Combine(
Windows.Storage.ApplicationData.Current.LocalFolder.Path, "PhotraxCoreData.sqlite");
That database name is just a file name.
The directory must be accessible by your app, but the file name can be anything.
AS CL says, the file name can be anything the app has direct access to. Windows Store apps have limited access to the file system, so the sqlite database must be in either the apps install location (read only) or it's app data folder (read write). A common pattern is to ship a seed database in the app package and then copy it from the install location to app data on first use so it can be written to.

Documentum DQL Query

How to create a new dm_document object using document from local system using DQL? I have tried the following but it's not working:
create dm_document object
SET title = 'TEST',
SET subject = 'TRIAL',
set object_name = 'Test123',
SETFILE 'c:\test.txt' with CONTENT_FORMAT= 'msww'
How do you run this DQL?
If you're doing it via Documentum Administrator, Documentum looks for the file with path 'C:\test.txt' on an application server machine wherer DA runs. So if you want to upload it into documentum you must place this file into appserver machine or use another tool for execution DQL.
And could you please show us an error, that you got
Your DQL works for me (!) but after clean any line-warp, so try this
create dm_document object SET title = 'TEST', SET subject = 'TRIAL', set object_name = 'Test123', SETFILE 'c:\test.txt' with CONTENT_FORMAT= 'msww'
...and be sure there is a such file on Content Server (not local) file system
good luck

Playframework 2 SQLite

I am trying to get SQLite working with the playframework but so far no luck.
I have Downloaded sqlitejdbc-v056.jar and put it into the lib folder.
I then changed the application.conf:
db.driver=org.sqlite.JDBC
db.url="jdbc:sqlite:/db/geolookup.sqlite"
db.default.user=sa
db.default.password=sa
I created a folder db and drop my sqlite db into it.
Now I start play with play run
Everything seems to compile ok, but when I call the url: http://127.0.0.1:9000
I get the following error:
driver.url has type STRING rather than OBJECT
with the following line highlited:
db.driver=org.sqlite.JDBC
What am I missing?
try this:
db.default.driver="org.sqlite.JDBC"
db.default.url="jdbc:sqlite:/home/tex/dbtest"
db.default.user="sa"
db.default.password=""
Notice that the folder of the db must be an absolute path !
(BTW: with this configuration the application starts but when I try to run the evolution it throws an exception, I think this is a "dialect" problem...)
Hope this helps...
You are propably using the wrong method to get the data from the config. From your error I assume you use it like this:
configuration.getConfig("db.driver")
But this method expects an JSON object under the path "db.driver". Since under the "db.driver" path you have a string, you should read the data using this method:
configuration.getString("db.driver")
This will make the "rather than OBJECT" error go away.

Drupal - Get image from url and import it into node

Im writing a module for drupal, Im trying to create a node from my module, everything is fine , I only have 1 problem with creating an image , The image exist on different server, so I want to grab the page and insert it , I install module http://drupal.org/project/filefield_sources , which has remote option , I search in the module code , I could not find the function that he used for this process, module work very nice from interface , but how i make it do the job from code ? which function should i call and what parameter should i pass .
I'm over Drupal 6.
Hopefully you're using Drupal 7...
The system_retrieve_file() function will download a file from a remote source, copy it from temp to a specified destination and optionally save it to the file_managed table if you want it to be managed.
$managed = TRUE; // Whether or not to create a Drupal file record
$path = system_retrieve_file($url, 'public://my_files/', $managed);
If you want to get the file object immediately after you've done this, the following is the only way I've found so far:
$file = file_load(db_query('SELECT MAX(fid) FROM {file_managed}')->fetchField());
get fid using $path->fid. no need to mysql

Resources