Country/city dropdown list in the web-page - dynamic

Where can I find a database of European countries and related cities to implement country/city dropdown list (dynamic) in the web-page?
UPDATE: I´m interested in some database that I can utilize from the javascript or php source code. This is to avoid manual work.
My answer: I have found one more good free resource: http://www.geodatasource.com/world-cities-database

MaxMind World Cities is a free list that you can download and use in your app (assuming that the license is ok for your purposes). Otherwise they've also got a webservice (though you have to pay for that).
An alternative is GeoNames.

http://en.wikipedia.org/wiki/Europe#Political_geography
Wikipedia always works :)
For some reason I thought about capitals only, but I guess you mean all cities.
Take a look at:
http://download.geonames.org/export/dump/
Check out the readme.txt which has more info.
Perhaps cities1000.zip could be used as a base for you. Maybe you need to create a database with the countries you want, and then perhaps filter the list from the link above by ISO-code or something.
The readme also mentions some continent code, so maybe that can be of use?

http://www.webservicex.net/country.asmx/GetCountries list of countries in xml

http://www.timdavis.com.au/data/
Get an excel for list of country and state.

You need use Jquery for dynamic ajax dropdown list. See here php/ajax script -
http://myip.ms/info/cities_sql_database/
Cities table format will be -
CREATE TABLE `cities` (
`cityID` mediumint(8) unsigned NOT NULL AUTO_INCREMENT,
`cityName` varchar(50) NOT NULL,
`stateID` smallint(5) unsigned NOT NULL DEFAULT '0',
`countryID` varchar(3) NOT NULL DEFAULT '',
`language` varchar(10) NOT NULL DEFAULT '',
`latitude` double NOT NULL DEFAULT '0',
`longitude` double NOT NULL DEFAULT '0',
PRIMARY KEY (`cityID`),
UNIQUE KEY `unq` (`countryID`,`stateID`,`cityID`),
KEY `cityName` (`cityName`),
KEY `stateID` (`stateID`),
KEY `countryID` (`countryID`),
KEY `latitude` (`latitude`),
KEY `longitude` (`longitude`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

Related

USING Ellucian Banner API

I'm attempting to use a Banner API Call.
per the documentation the create call looks like this.
PROCEDURE p_create(
p_pidm gorimmu.gorimmu_pidm%TYPE,
p_immu_code gorimmu.gorimmu_immu_code%TYPE,
p_seq_no gorimmu.gorimmu_seq_no%TYPE,
p_user_id gorimmu.gorimmu_user_id%TYPE DEFAULT gb_common.f_sct_user,
p_immu_date gorimmu.gorimmu_immu_date%TYPE DEFAULT NULL,
p_imst_code gorimmu.gorimmu_imst_code%TYPE DEFAULT NULL,
p_comment gorimmu.gorimmu_comment%TYPE DEFAULT NULL,
p_data_origin gorimmu.gorimmu_data_origin%TYPE DEFAULT NULL,
p_seq_no_out OUT gorimmu.gorimmu_seq_no%TYPE,
p_rowid_out OUT gb_common.internal_record_id_type);
I'm not sure how to use the last two fields that have OUT.
I've used other API calls..but none of them used an OUT.
any help is appreciated..banner documentation not helpful
That just means you must provide a parameter for the API call to populate. So define two variables to pass in such as:
l_seq_no_out gorimmu.gorimmu_seq_no%TYPE;
l_rowid_out gb_common.internal_record_id_type;
Then just pass those as the last two parameters to the p_create call.

Odoo 12 - CSV data import query

Some data imports are simple and others I am finding impossible!
The ImportFAQ document is OK up to a point but not quite adequate for some imports.
The import-compatible export is not, as far as I can tell, comprehensive in specifying the mandatory fields for an import. Or am I missing something?
Specifically I am trying to import an Inventory Transfer from stock to a specific customer - any suggestions how to find the minimum set of fields needed in the import file?
Eg when I try - despite there being a valid product_id - I get
null value in column "product_id" violates not-null constraint
DETAIL:
Failing row contains (187, Canis Plus Lamb - 500g - Rolle, 10, 1, 2019-02-25
16:29:58.929875, 2019-02-23 17:49:58, 1, 2019-02-23 17:49:21, null, 5.0,
10.000, null, null, 12, 9, null, 103, null, draft, null, null,
make_to_stock, f, null, null, t, null, null, null, null, null, f, null,
null, 2, 2, 2019-02-25 16:29:58.929875, f, null, null, null, null, null). at row 2
Is the data that follows in the error message useful/usable in any way?
Happy to post my import file but at the moment most keen to understand the principles rather than solve one problem. I think others might find that useful too.
Cant ask on the Odoo Forum as I dont have enough karma so any assistance here would be most welcome. Thanks
The import compatible export doesn't specify required fields in any way, the only difference is the import compatible export keeps the header of the exported document (csv/excel) such that, headers are actual technical name of the fields that's getting exported, so same the document can be imported without any need of manually selecting the columns. You don't get the functionality if your column headers are not matching with underlying fields name. The error message specifically mentioned that product_id field is null, even if you added product_id column, that column is not mapped with the required field, for example in case of importing stock.picking (Inventory Transfer) document, every line in stock.picking record is a stock.move record and for a stcok.move record, product_id is having not null constraint. So if you somehow managed to map product_id column with wrong related field, you get this error message.
If you had attach example of your file, it would be much easier.
I have generated a working stock.picking for you to test, just import as it is, but you have to change the value of move_lines/product_id/.id and partner_id/.id fields according to your product and partner database ID.
name,company_id/id,location_dest_id/id,picking_type_id/id,move_type,location_id/id,move_lines/product_id/.id,move_lines/product_uom_qty,move_lines/date_expected,move_lines/location_dest_id/id,move_lines/name,move_lines/date,move_lines/location_id/id,move_lines/procure_method,move_lines/product_uom/id,partner_id/.id
IMPORT0001,base.main_company,stock.stock_location_stock,stock.picking_type_in,As soon as possible,stock.stock_location_suppliers,1000,40,2019-04-05 19:41:54,stock.stock_location_stock,"Digitizer (Black, OEM, Apple iPad)",2019-04-07 08:32:24,stock.stock_location_suppliers,Default: Take From Stock,product.product_uom_unit,705

Where to save configuration data for web application?

I'm developing small application.
It is small CMS like application. Admin of this site should have option to change settings in application. Like text in header, message of the day.
Where should I store those values? Table in database? Some kind of file? I want admin to be able to change those values from website without manually editing files on server.
I think the small table in DB with WebSiteSettings would be the best solution as for me.
EDITED
WebSiteSettings table example:
PK Id [int] not null
StrTmplVal_1 [nvarchar(128)] null
StrTmplVal_2 [nvarchar(256)] null
StrTmplVal_3 [nvarchar(512)] null
BoolTmplVal_1 [bit] null
BoolTmplVal_2 [bit] null
BoolTmplVal_3 [bit] null
IntTmplVal_1 [int] null
IntTmplVal_2 [int] null
IntTmplVal_3 [int] null
WebSiteSettings model example for an individual website:
SettingsId -> Id
SiteName -> StrTmplVal_1
PageHeader -> StrTmplVal_2
WelcomeText -> StrTmplVal_3
IsDemoVersion -> BoolTmplVal_1
IsTilesShowed -> BoolTmplVal_2
MaxRowCountOnPage -> IntTmplVal_1
WelcomeAnimationDelay -> IntTmplVal_2
I suppose a table following this structure would be a start:
Table Settings
ID(int, primary key), Name(varchar)
Table SettingValues ID(int, primary key), SettingID(int foreign key), Value(blob)
Please note that I use BLOB (Binary Large Object) type for the actual value of the setting. Therefore, you could save the settings just by serializing them.
Hope I helped!

Create a db or use xml

This is a question that has to do more about performance and implementation. I want to create an app for getting info about tv series and would like to use thetvdb.com api. thetvdb offers an xml api and some guides to get u started. For initialization they say you must download a zip file (according to the id of the series you want to add).
The xml consists of three xml files. One is about the actors, one is about the banners and one that has all the info about the tv show inclucing seasons and episodes and overviews etc. The guide says that you parse the xml and add them to the tables of your db as you like.
My question is the following: Is it better to download the xml parse it and store it in my db and delete the xmls? Or should I use the xmls and parse them every time i want to get the show's info and present them to the user? What is the cost of one implementation and what is the cost of the second one?
No code yet since I am still designing it.
I would definitely parse the xml files and put them in to a database. Parsing xml files has considerable overhead - and relational databases are designed with the intent of querying the data inside them, and are very performant at this (especially if you design your database well , provide useful indexes and logical joins between the tables.
I think the right solution could depend on your application load(how many users will simultaneously use it), the average size and structure of xml files and the need to refresh the data.
The possible solutions are:
If the xml files are not very big and complicated and don't contain a lot of unwanted information you possibly do not need to store this info in your db.
In this case you can add the caching layer to your app that will store the files and repeatedly get them from the thetvdb if the previous request was too long time ago.
If you think that you can send the required information to the clients in more compact or convenient way or it requires additional processing or you are planning to execute some group opperations on your data in the future then the better option is to store the data in db
Also think about refreshing the data in your db (similarly to the 2-nd option).
Also you can store only critical information in your db.
Update: Generally I would not recommend to use local databases as in future it could cause problems with schema migration (when you want to change something in your db schema).
Storing data into a db is definitely the best way if you have to execute particular queries. I'm also using TheTVDB APIs (integrated in Wordpress) and I can give you some PHP code. First you have to create the DB with the following code, then you have the PHP script that insert data from the XML url of a TV show.
SQL query:
CREATE TABLE IF NOT EXISTS `tvshowsinfo` (
`id` int(9) NOT NULL AUTO_INCREMENT,
`showname` varchar(255) CHARACTER SET utf8 NOT NULL,
`lang` varchar(255) CHARACTER SET utf8 NOT NULL,
`episodeid` int(9) NOT NULL,
`episodenumber` int(5) NOT NULL,
`season` int(5) NOT NULL,
`director` varchar(255) CHARACTER SET utf8 NOT NULL,
`episodename` varchar(255) CHARACTER SET utf8 NOT NULL,
`firstaired` varchar(255) CHARACTER SET utf8 NOT NULL,
`gueststars` text CHARACTER SET utf8 NOT NULL,
`overview` text CHARACTER SET utf8 NOT NULL,
`rating` varchar(255) CHARACTER SET utf8 NOT NULL,
`ratingcnt` int(9) NOT NULL,
`writer` varchar(255) CHARACTER SET utf8 NOT NULL,
`episodeimg` varchar(255) CHARACTER SET utf8 NOT NULL,
`seasonid` int(9) NOT NULL,
`seriesid` int(9) NOT NULL,
`thumbht` int(4) NOT NULL,
`thumbwd` int(4) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 ;
PHP/Wordpress script:
<?php
$url = "Your URL";
$xmlstr = file_get_contents($url);
$elements = json_decode(json_encode((array)simplexml_load_string($xmlstr)),1);
global $wpdb;
$mquery = "INSERT INTO tvshowsinfo (showname,lang,episodeid,episodenumber,season,director,episodename,firstaired,gueststars,overview,rating,ratingcnt,writer,episodeimg,seasonid,seriesid,thumbht,thumbwd) VALUES ";
$i = 0;
foreach ($elements['Episode'] as $element) {
if ($i !== 0) { $mquery .= ", "; }
if ($element["Combined_season"] !== "0") {
$mquery .= "('".mysql_real_escape_string($_POST["seriesname"])."', '".$element["Language"]."', '".$element["id"]."', '".$element["Combined_episodenumber"]."', '".$element["Combined_season"]."', '".mysql_real_escape_string($element["Director"])."', '".mysql_real_escape_string($element["EpisodeName"])."', '".$element["FirstAired"]."', '".mysql_real_escape_string($element["GuestStars"])."', '".mysql_real_escape_string($element["Overview"])."', '".$element["Rating"]."', '".$element["RatingCount"]."', '".mysql_real_escape_string($element["Writer"])."', 'http://thetvdb.com/banners/".$element["filename"]."', '".$element["seasonid"]."', '".$element["seriesid"]."', '".$element["thumb_height"]."', '".$element["thumb_width"]."')";
$i++;
}
}
$wpdb->query($mquery);
$wpdb->print_error();
/* DEBUG */
?>
<pre><?php print_r($elements); ?></pre>

Creating charts from sql files

I have a sql file containing information about a potential clients website keywords. I have exported this file from an ipad SEO app and got a sql file. I would like be able to show the information as charts or tables but Ive never worked with this file format before. Are there any good programs that can do this or is this a "hardcore programer task"?
Thank you!
Few lines taken from the sql file
SQLite format 3# Ô Ô-‚%
‡‡bgÅÅ_tabledomainsdomainsCREATE TABLE domains (domain_name varchar(100), id INTEGER PRIMARY KEY, sort integer, country varchar(2))Å--Ågtablekeywords_historykeywords_historyCREATE TABLE keywords_history (position integer, date_added varchar(10), id INTEGER PRIMARY KEY, kid integer)^ÅatablekeywordskeywordsCREATE TABLE keywords (sort integer, domain_id integer, id INTÅÇ tablekeywordskeywordsCREATE TABLE keywords (sort integer, domain_id integer, id INTEGER PRIMARY KEY, keyword_text varchar(500), country varchar(2))
ÉÓ◊¬∞ñÉliving.seSE-unifiedsweden.seSEes√§k.seSE#virotell.seSE) mediaanalys.seSEapple.comUS˚˚≤£ìiT6 Ï› ¥ûÑo]D%÷¡•ëvW1·ƒ®˛ãtV)1hallm√∂bler malm√∂SE(#hallm√∂blerSE'/f√•t√∂ljer malm√∂SE%-belysning malm√∂SE#/
inredningskonsultSE"3heminredning malmöSE!%
heminredningSE$belysningSE$Aträdgårds möbler malmöSE3
trädgårds möblerSE+ soffbord malmöSEsoffbordSE-köksbord malmöSEköksbordSE$Avardagsrums möbler malmöSE&!fåtöljerSEsoffaSE3vardagsrums möblerSE )möbler malmöSEmöblerSE visitkortSE)webbutvecklingSE!webbdesignSE!web designSEadwordsSE
ppcSE
/sponsrade länkarSE
seoSE 3sökmarknadsföringSE
3sökmotoroptimeringSE !värmepumpSE!abonnemangSEvirotellSE mobilSE
teleSE
ppcSE 3s√∂kmotoroptimeringSEseoSE apple )˚˚∏•íÄn\J9&Ì⁄»∂§íÄn\J8&Ó€…∑•ìÅo]K9'ÒfiÀ∏¶îÇp2!2013-02-07
1!2013-02-070!2013-02-07/!2013-02-07
.! 2013-01-24-!2013-01-24,!)2013-01-24+!2013-01-24
*!2013-01-24)!2013-01-24(!2013-01-24
'!2013-01-23&!2013-01-23%!2013-01-23
$!2013-01-23#!2013-01-23"!2013-01-23
!!2013-01-11
!2013-01-11!2013-01-11! 2013-01-11!2013-01-11!)2013-01-11!2012-12-24!2012-12-24!2012-12-24!2012-12-24!2012-12-24!2012-12-24!2012-12-24
!2012-12-24!2012-12-24!2012-12-24
!2012-12-19 ! 2012-12-19!2012-12-19!%2012-12-19
!2012-12-16!'2012-12-16 ! 2012-12-16
!2012-12-16 !2012-12-16!2012-12-16!2012-12-16!2012-12-16!2012-12-14!)2012-12-14 ! 2012-12-14! 2009-06-05! #2009-2
2pÓ‹À∏•íÄn\J9&Ì⁄»∂§íÄn\J8&Ó€…∑•ìÅo]K9'ÒfiÀ∏¶îÇp2!2013-02-07
1!2013-02-070!2013-02-07/!2013-02-07
.! 2013-01-24-!2013-01-24,!)2013-01-24+!2013-01-24
*!2013-01-24)!2013-01-24(!2013-01-24
'!2013-01-23&!2013-01-23%!2013-01-23
$!2013-01-23#!2013-01-23"!2013-01-23
!!2013-01-11
!2013-01-11!2013-01-11! 2013-01-11!2013-01-11!)2013-01-11!2012-12-24!2012-12-24!2012-12-24!2012-12-24!2012-12-24!2012-12-24!2012-12-24
!2012-12-24!2012-12-24!2012-12-24
!2012-12-19 ! 2012-12-19!2012-12-19!%2012-12-19
!2012-12-16!'2012-12-16 ! 2012-12-16
!2012-12-16 !2012-12-16!2012-12-16!2012-12-16!2012-12-16!2012-12-14!)2012-12-14 ! 2012-12-14! 2009-06-05! #2009-06-01
!¶Ó‹ ∏¶îÇo]K'›À∏î¶Å9o]J8%Ó‹ ∏¶U!2013-02-180T!2013-02-18/S!2013-02-18.R!2013-02-18-Q!2013-02-18,P!2013-02-18+O!2013-02-18*N!
2013-02-18)M!2013-02-18(L!2013-02-18'K!2013-02-18&J!2013-02-18%H!2013-02-18#F!2013-02-18!G!2013-02-18"D!+2013-02-18C!2013-02-18B!2013-02-18A!2013-02-18#!2013-02-18?!2013-02-18>!2013-02-18I!2013-02-18$<!2013-02-18;!2013-02-18:!
2013-02-189!2013-02-188!2013-02-077!2013-02-076!2013-02-075!2013-02-074!2013-02-073!2013-02-07
'VÌfl¡≤£ìiT6 Ï› ¥ûÑo]D&÷¡•ëvW1·ƒ®˛ãtV)1hallm√∂bler malm√∂SE(#hallm√∂blerSE'/f√•t√∂ljer malm√∂SE%-belysning malm√∂SE#/
inredningskonsultSE"3heminredning malmöSE!%
heminredningSE$belysningSE$Aträdgårds möbler malmöSE3
trädgårds möblerSE+ soffbord malmöSEsoffbordSE-köksbord malmöSEköksbordSE$Avardagsrums möbler malmöSE&!fåtöljerSEsoffaSE1vardagsrumsmöblerSE )möbler malmöSEmöblerSE visitkortSE)webbutvecklingSE!webbdesignSE!web designSEadwordsSE
ppcSE
/sponsrade länkarSE
seoSE 3sökmarknadsföringSE
3sökmotoroptimeringSE !värmepumpSE!abonnemangSEvirotellSE mobilSE
teleSE
ppcSE 3sökmotoroptimeringSEseoSE apple macUS
[Ì”¡®ñ|[07sovrumsm√∂bler malm√∂SE/)sovrumsm√∂blerSE.sovrumSE-'mattor malm√∂SE,mattorSE+)matbord malm√∂SE*matbordSE
JFreeChart is a useful Java library for chart generation. While I've never used it with a sql file, I believe that it is possible.
The file seems to be a SQLLite file which represents a database. To be able to use it, you need to install a SQLLite database browser like this one. I think you may have to change the file extension to .db to be able to open it. If this works, I think your best bet would be to view the table data, and copy and paste it into excel or some similar program you are familiar with to create the chart.