Search Results

Search found 1854 results on 75 pages for 'country'.

Page 15/75 | < Previous Page | 11 12 13 14 15 16 17 18 19 20 21 22  | Next Page >

  • Counting multiple entries in a MySQL database?

    - by Aaron
    Hi all, I'm trying to count multiple entries in a MySQL database, I know how to use COUNT(), but the exact syntax I want to get the results I need eludes me. The problem: Table structure: ID, CODE, AUTHOR, COUNTRY, TIMESTAMP. Code, Author and Country overlap many times in the table. I am trying to discover if there is one simple query that can be ran to return (using WHERE clause on COUNTRY) the author field, the code field, and then a final field that counts the number of times the CODE was present in the query result. So, theoretically I could end up with an array like: array('author', 'code', 'codeAppearsNTimes'); Authors also have varying codes associated with them, so I don't want the results merged. I suppose the end result would be: 'This author is associated with this code this many times'. Is this possible with MySQL? Thanks in advance.

    Read the article

  • Need a list of all countries in the world, with a longitude and latitude coordinate

    - by ptrn
    I need a list of all the countries in the world, with one lat/long coordinate for the country. I had a look at GeoNames, but all I can seem to find are lists that have the countries as well as cities in the same list. I guess I can just parse it and filter out the countries, but I was hoping to avoid that. Basically, what I need; Country name - Lat/long coordinate (some sort of center of the country) It doesn't need to say anything about continent, but I wouldn't mind if it did. _L

    Read the article

  • Summing the results of Case queries in SQL

    - by David Stelfox
    I think this is a relatively straightforward question but I have spent the afternoon looking for an answer and cannot yet find it. So... I have a view with a country column and a number column. I want to make any number less than 10 'other' and then sum the 'other's into one value. For example, AR 10 AT 7 AU 11 BB 2 BE 23 BY 1 CL 2 I used CASE as follows: select country = case when number < 10 then 'Other' else country end, number from ... This replaces the countries values with less than 10 in the number column to other but I can't work out how to sum them. I want to end up with a table/view which looks like this: AR 10 AU 11 BE 23 Other 12 Any help is greatly appreciated. Cheers, David

    Read the article

  • var_dump help needed.

    - by acctman
    The coding below seperates the $state data, I need help putting the var_dump info into $dat1 $dat2 and $dat3 where needed if($en['country'] == 'US'){ if ($_POST['locus'] == ''){$err .= 'Please select and fillin your locale.<br>';} $state = $_POST['locus']; // separate: NEW YORK, NY 10011 preg_match("/(.*)\,\s+([A-Z]{2})\s+([\d]+)/", $state, $parts); var_dump($parts); } elseif($en['country'] == 'CA'){ if ($_POST['locca'] == ''){$err .= 'Please select and fillin your locale.<br>';} $state = $_POST['locca']; // separate: PARADISE, NL A1L1P1 preg_match("/(.*)\,\s+([A-Z]{2})\s+([\S]+)/", $state, $parts); var_dump($parts); } elseif($en['country'] == 'GB'){ if ($_POST['locuk'] == ''){$err .= 'Please select and fillin your locale.<br>';} $state = $_POST['locuk']; // separate: LONDON, H9 preg_match("/(.*)\,\s+([\S]{2})/", $state, $parts); var_dump($parts); }

    Read the article

  • pushViewController for same instance - only for animation purpose

    - by techastute
    Hi there, I am having single table view in a view controller. That table view lists the countries first. When I click on a country(row), it has to push the same view controller's view with cities under that country. I need to see the slide animation, which we usally get while pushing views in navigator. Is it possible to use the pushViewController for the same view controller by calling the tableView reloadData with city data (This should happen when country is selected) ? Please let me know whether it is possible.. Thanks in advance.. Raj

    Read the article

  • Parent Child Relationships with Fluent NHibernate?

    - by ElHaix
    I would like to create a cascading tree/list of N number of children for a given parent, where a child can also become a parent. Given the following data structure: CountryType=1; ColorType=3; StateType=5 6,7,8 = {Can, US, Mex} 10, 11, 12 = {Red, White, Blue} 20,21,22= {California, Florida, Alberta} TreeID ListTypeID ParentTreeID ListItemID 1 1 Null 6 (Canada is a Country) 2 1 Null 7 (US is a Country) 3 1 Null 8 (Mexico is a Country) 4 3 3 10 (Mexico has Red) 5 3 3 11 (Mexico has White) 6 5 1 22 (Alberta is in Canada) 7 5 7 20 (California is in US) 8 5 7 21 (Florida is in US) 9 3 6 10 (Alberta is Red) 10 3 6 12 (Alberta is Blue) 11 3 2 10 (US is Red) 12 3 2 11 (Us is Blue) How would this be represented in Fluent NHibernate classes? Some direction would be appreciated. Thanks.

    Read the article

  • Sql Server 2008 Cross-database table linking (relationships)

    - by Alex
    Hi guys, I have a bit of an issue, and to be honest I don't think there's an answer, but I'll give it a try anyway. So I have two databases [A]-Company and [B]-Product. Both databases have a Country table which is then linked to other tables in each individual database. The problem is that the data between the two Country tables is a complete duplicate. So, I essentially have to duplicate some of the relationships in each database, and maintenance on top of that is just difficult... So, I'm curious is there a way to create a cross-database relationship between tables so I can have only one set of Country+Helper tables that govern both databases? Thanks in advance!

    Read the article

  • Searching through Collections in Java

    - by Click Upvote
    I have a java properties file containing a key/value pair of country names and codes. I will load the contents of this file into a Collection like List or HashMap. Then, I want users to be able to search for a country, e.g if they type 'Aus' in a textbox and click submit, then I want to search through the collection I have, containing a key/value pair of country codes/names (e.g AUS=Australia), and return those countries which are found matching. Is there any more efficient way of doing this, other than looping through the elements of the collection and using charAt()?

    Read the article

  • does mysql stored procedures support data types like array, hash,etc?

    - by Yang
    i am creating a mysql function which takes in a varchar and change it to a int based on a mapping table. select name, convert_to_code(country) from users where sex = 'male' here, the convert_to_code() function takes in a country name (e.g. Japan, Finland..) and change it to country code which is an integer (e.g. 1001, 2310..) based on a mapping table called country_maping like below: country_name (varchar) | country_code (int) Japan | 1001 Finland | 2310 Canada | 8756 currently, the stored function need to select country_code from country_mapping where country_name = country_name and return the query result. is that possible to create a hash data struct in SP to optimize the process so that it will not need to perform the query for each row matches the where clause. thanks in advance!

    Read the article

  • MS Access CrossTab query - across 3 tables

    - by Prembo
    Hi, I have the following 3 tables: 1) Sweetness Table FruitIndex CountryIndex Sweetness 1 1 10 1 2 20 1 3 400 2 1 50 2 2 123 2 3 1 3 1 49 3 2 40 3 3 2 2) Fruit Name Table FruitIndex FruitName 1 Apple 2 Orange 3 Peaches 3) Country Name Table CountryIndex CountryName 1 UnitedStates 2 Canada 3 Mexico I'm trying to perform a CrossTab SQL query to end up with: Fruit\Country UnitedStates Canada Mexico Apple 10 20 400 Orange 50 123 1 Peaches 49 40 2 The challenging part is to label the rows/columns with the relevant names from the Name tables. I can use MS Access to design 2 queries, create the joins the fruit/country names table with the Sweetness table perform crosstab query However I'm having trouble doing this in a single query. I've attempted nesting the 1st query's SQL into the 2nd, but it doesn't seem to work. Unfortunately, my solution needs to be be wholly SQL, as it is an embedded SQL query (cannot rely on query designer in MS Access, etc.). Any help greatly appreciated. Prembo.

    Read the article

  • ASP.net MVC3 entities, don't know how to count

    - by Spedax
    I have 2 tables, 1 with countries, 1 with states. The states table has a column with Population. I'm using entities and I have created a List of states for the countries public class TblCountries { //Entities for my table country ... public List<tblStates> States { get; set; } } So now I can for example List all the states that belong to a country. Now what I want to do is count the population, so I can show the population that of an entire country. I tried using in my view @foreach (var item in Model.Countries) { @Html.DisplayFor(modelItem => item.States.Count<population>) } But this doesn't work, anyone know how to do this? Thanks in advanced!

    Read the article

  • Adding "selected" into option from matching variable. PHP

    - by Dolan
    I have $country which stores the 2 letter country code of a user. US for example. <select id="countries"> <option value="US">United States</option> <option value="EN">England</option> <option value="AU">Australia</option> <option value="CA">Canada</option> etc. </select> What's the best practice to add "selected" to the option of the users country code? I'm against adding a million if's. Also note, the countries are harcoded in HTML, so no array. :(

    Read the article

  • How to display a tree of objects in a JTree?

    - by paul
    Imagine a collection of objects such as World, Country, Region and City. World contains a list of Country objects, Country contains a list of Region objects etc. I would like to represent this structure in a JTree and be able to add, remove and move objects around the tree. Can I easily create a TableModel from this structure? World would be the root object and I would need to perform some object-specific rendering. Any one know of an appropriate tutorial?

    Read the article

  • How to test if a string is inside a list of predinfined list of string in oracle pl/sql

    - by drupalspring
    I define a list a string which contains different country codes ( for example , USA ,CHINA ,HK ,JPN) How can I check that if a input variable equal to one of the country of the country list in pl/sql . I use the following code to test it but fail, how can I revise it? declare country_list CONSTANT VARCHAR2(200) := USA,CHINA,HK,JPN; input VARCHAR2(200); begin input := 'JPN'; IF input IN (country_list) DBMS_OUTPUT.PUT_LINE('It is Inside'); else DBMS_OUTPUT.PUT_LINE('It is not Inside'); END IF; end;

    Read the article

  • Grails: Duplicates & unique constraint validation

    - by rukoche
    OK here is stripped down version of what I have in my app Artist domain: class Artist { String name Date lastMined def artistService static transients = ['artistService'] static hasMany = [events: Event] static constraints = { name(unique: true) lastMined(nullable: true) } def mine() { artistService.mine(this) } } Event domain: class Event { String name String details String country String town String place String url String date static belongsTo = [Artist] static hasMany = [artists: Artist] static constraints = { name(unique: true) url(unique: true) } } ArtistService: class ArtistService { def results = [ [ name:"name", details:"details", country:"country", town:"town", place:"place", url:"url", date:"date" ] ] def mine(Artist artist) { results << results[0] // now we have a duplicate results.each { def event = new Event(it) if (event.validate()) { if (artist.events.find{ it.name == event.name }) { log.info "grrr! valid duplicate name: ${event.name}" } artist.addToEvents(event) } } artist.lastMined = new Date() if (artist.events) { artist.save(flush: true) } } } In theory event.validate() should return false and event will not be added to artist, but it doesn't.. which results in DB exception on artist.save() Although I noticed that if duplicate event is persisted first everything works as intended. Is it bug or feature? :P

    Read the article

  • how to manipulate Json response like an object?

    - by loviji
    Hello, my jQuery.ajax return JSon object. I firstly read other articles. but their response text not likes mine. My Response content: from firebug response {"item":"[{\"country\":\"USA\",\"lan\":\"EN\"},{\"country\":\"Turkiye\",\"lan\":\"TR\"}]"} Now i trying to alert countryName: $('#loadData').click(function() { $.ajax({ type: "POST", url: "WS/myWS.asmx/getDaa", data: "{}", contentType: "application/json; charset=utf-8", dataType: "json", success: function(msg) { $("#jsonResponse").html(msg); $.each(msg.item, function(i, d) { alert(this.country); debugger; }); }, }); }); but it is alerting "undefined"

    Read the article

  • creating a table based on fields from three different tables

    - by ozlem
    Hi, I am using MS-Access 2003. I have three tables containing values of w,Q and L. In the Q table I have three fields: country_name, ISIC_code, and Q value. In the L table, there are three fields, country_name, ISIC_code, and L value. And in the w table there are two fields; country_name and w value. Country_names, and ISIC_code might be different for each table. What I want to do is create a new table with the values b(j)=w(i)L(ij)/Q(ij), where i is the country and j is the ISIC_code. So first I will check if the country name and ISIC_code are the same in L and Q tables. If they are equal I will calculate L/Q and then multiply this with w value of the same country if it exists. I appreciate any help.

    Read the article

  • Database with 5 Tables with Insert and Select

    - by kirbby
    hi guys, my problem is that i have 5 tables and need inserts and selects. what i did is for every table a class and there i wrote the SQL Statements like this public class Contact private static String IDCont = "id_contact"; private static String NameCont = "name_contact"; private static String StreetCont = "street_contact"; private static String Street2Cont = "street2_contact"; private static String Street3Cont = "street3_contact"; private static String ZipCont = "zip_contact"; private static String CityCont = "city_contact"; private static String CountryCont = "country_contact"; private static String Iso2Cont = "iso2_contact"; private static String PhoneCont = "phone_contact"; private static String Phone2Cont = "phone2_contact"; private static String FaxCont = "fax_contact"; private static String MailCont = "mail_contact"; private static String Mail2Cont = "mail2_contact"; private static String InternetCont = "internet_contact"; private static String DrivemapCont = "drivemap_contact"; private static String PictureCont = "picture_contact"; private static String LatitudeCont = "latitude_contact"; private static String LongitudeCont = "longitude_contact"; public static final String TABLE_NAME = "contact"; public static final String SQL_CREATE = "CREATE TABLE IF NOT EXISTS " + TABLE_NAME + "(" + IDCont + "INTEGER not NULL," + NameCont + " TEXT not NULL," + StreetCont + " TEXT," + Street2Cont + " TEXT," + Street3Cont + " TEXT," + ZipCont + " TEXT," + CityCont + " TEXT," + CountryCont + " TEXT," + Iso2Cont + " TEXT," + PhoneCont + " TEXT," + Phone2Cont + " TEXT," + FaxCont + " TEXT," + MailCont + " TEXT," + Mail2Cont + " TEXT," + InternetCont + " TEXT," + //website of the contact DrivemapCont + " TEXT," + //a link to a drivemap to the contact PictureCont + " TEXT," + //a photo of the contact building (contact is not a person) LatitudeCont + " TEXT," + LongitudeCont + " TEXT," + "primary key(id_contact)" + "foreign key(iso2)"; and my insert looks like this public boolean SQL_INSERT_CONTACT(int IDContIns, String NameContIns, String StreetContIns, String Street2ContIns, String Street3ContIns, String ZipContIns, String CityContIns, String CountryContIns, String Iso2ContIns, String PhoneContIns, String Phone2ContIns, String FaxContIns, String MailContIns, String Mail2ContIns, String InternetContIns, String DrivemapContIns, String PictureContIns, String LatitudeContIns, String LongitudeContIns) { try{ db.execSQL("INSERT INTO " + "contact" + "(" + IDCont + ", " + NameCont + ", " + StreetCont + ", " + Street2Cont + ", " + Street3Cont + ", " + ZipCont + ", " + CityCont + ", " + CountryCont + ", " + Iso2Cont + ", " + PhoneCont + ", " + Phone2Cont + ", " + FaxCont + ", " + MailCont + ", " + Mail2Cont + ", " + InternetCont + ", " + DrivemapCont + ", " + PictureCont + ", " + LatitudeCont + ", " + LongitudeCont + ") " + "VALUES (" + IDContIns + ", " + NameContIns +", " + StreetContIns + ", " + Street2ContIns + ", " + Street3ContIns + ", " + ZipContIns + ", " + CityContIns + ", " + CountryContIns + ", " + Iso2ContIns + ", " + PhoneContIns + ", " + Phone2ContIns + ", " + FaxContIns + ", " + MailContIns + ", " + Mail2ContIns + ", " + InternetContIns + ", " + DrivemapContIns + ", " + PictureContIns + ", " + LatitudeContIns + ", " + LongitudeContIns +")"); return true; } catch (SQLException e) { return false; } } i have a DBAdapter class there i created the database public class DBAdapter { public static final String DB_NAME = "mol.db"; private static final int DB_VERSION = 1; private static final String TAG = "DBAdapter"; //to log private final Context context; private SQLiteDatabase db; public DBAdapter(Context context) { this.context = context; OpenHelper openHelper = new OpenHelper(this.context); this.db = openHelper.getWritableDatabase(); } public static class OpenHelper extends SQLiteOpenHelper { public OpenHelper(Context context) { super(context, DB_NAME, null, DB_VERSION); } @Override public void onCreate(SQLiteDatabase db) { // TODO Auto-generated method stub db.execSQL(Contact.SQL_CREATE); db.execSQL(Country.SQL_CREATE); db.execSQL(Picture.SQL_CREATE); db.execSQL(Product.SQL_CREATE); db.execSQL(Project.SQL_CREATE); } @Override public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { // TODO Auto-generated method stub Log.w(TAG, "Upgrading database from version " + oldVersion + " to " + newVersion + ", which will destroy all old data"); db.execSQL(Contact.SQL_DROP); db.execSQL(Country.SQL_DROP); db.execSQL(Picture.SQL_DROP); db.execSQL(Product.SQL_DROP); db.execSQL(Project.SQL_DROP); onCreate(db); } i found so many different things and tried them but i didn't get anything to work... i need to know how can i access the database in my activity and how i can get the insert to work and is there sth wrong in my code? thanks for your help thats how i tried to get it into my activity public class MainTabActivity extends TabActivity { private Context context; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.maintabactivity); TabHost mTabHost = getTabHost(); Intent intent1 = new Intent().setClass(this,MapOfLight.class); //Intent intent2 = new Intent().setClass(this,Test.class); //Testactivity //Intent intent2 = new Intent().setClass(this,DetailView.class); //DetailView Intent intent2 = new Intent().setClass(this,ObjectList.class); //ObjectList //Intent intent2 = new Intent().setClass(this,Gallery.class); //Gallery Intent intent3 = new Intent().setClass(this,ContactDetail.class); mTabHost.addTab(mTabHost.newTabSpec("tab_mol").setIndicator(this.getText(R.string.mol), getResources().getDrawable(R.drawable.ic_tab_mol)).setContent(intent1)); mTabHost.addTab(mTabHost.newTabSpec("tab_highlights").setIndicator(this.getText(R.string.highlights),getResources().getDrawable(R.drawable.ic_tab_highlights)).setContent(intent2)); mTabHost.addTab(mTabHost.newTabSpec("tab_contacts").setIndicator(this.getText(R.string.contact),getResources().getDrawable(R.drawable.ic_tab_contact)).setContent(intent3)); mTabHost.setCurrentTab(1); SQLiteDatabase db; DBAdapter dh = null; OpenHelper openHelper = new OpenHelper(this.context); dh = new DBAdapter(this); db = openHelper.getWritableDatabase(); dh.SQL_INSERT_COUNTRY("AT", "Austria", "AUT"); } } i tried it with my country table because it has only 3 columns public class Country { private static String Iso2Count = "iso2_country"; private static String NameCount = "name_country"; private static String FlagCount = "flag_image_url_country"; public static final String TABLE_NAME = "country"; public static final String SQL_CREATE = "CREATE TABLE IF NOT EXISTS " + TABLE_NAME + "(" + Iso2Count + " TEXT not NULL," + NameCount + " TEXT not NULL," + FlagCount + " TEXT not NULL," + "primary key(iso2_country)"; public boolean SQL_INSERT_COUNTRY(String Iso2CountIns, String NameCountIns, String FlagCountIns) { try{ db.execSQL("INSERT INTO " + "country" + "(" + Iso2Count + ", " + NameCount + ", " + FlagCount + ") " + "VALUES ( " + Iso2CountIns + ", " + NameCountIns +", " + FlagCountIns + " )"); return true; } catch (SQLException e) { return false; } } another question is it better to put the insert and select from each table into a separate class, so i have 1 class for each table or put them all into the DBAdapter class?

    Read the article

  • Codeigniter view file looping query

    - by user2505513
    Right, I'm unsure about how to code my view file to generate following query results WITHOUT compromising the principles of mvc. Query in model: SELECT * FROM events GROUP BY country, area ORDER BY country, area View: <?php if (isset($query)):?> <?php foreach ($query as $row):?> <h2><?=$row->country?></h2> <h3><?=$row->area?></h3> <?php endforeach;?> <?php endif;?> I want the results to display: England North South West - utilising the GROUP BY parameter As opposed to: England North England South England West Has anybody any advice as to how to achieve this?

    Read the article

  • Rails group validation with just one error message

    - by Victor
    The following validation code in the model: validates :formatted_address, :zip, :city, :state, :country, :presence => true, :message => "is incomplete. Please enter full address." is displayed when either of the fields are empty. Let's say now :address and country are empty, 2 errors are displayed: Formatted Address is incomplete. Please enter full address. Country is incomplete. Please enter full address. How can I group the error message in the validation to just show one error message if either of the fields validated does not exist? Address is incomplete. Please enter full address. Thanks.

    Read the article

  • Freelancer - client agreement. What things are worth to write explicitely?

    - by Dzida
    Hi guys, This is not technical question, though I think it is quite important for software developers who work as a freelancers. There is some general good advice to make paper contracts before starting new jobs. When I started my work as a freelancer I hadn't got any clue how such contract should looks like. Now I have some ideas but I believe many of freelancers gathered on SO can add some interesting advices for less-experienced colleagues (like me). So the question is: what clauses freelancers should put on agreements with their clients to make their projects less stressful and better secured. What are your experiences here? PS: Please write your country on the bottom of your post - I guess some stuff might be country specific. Probably there are differences in form of agreements depending on country where business is made.

    Read the article

  • WPF Converter to look up in generic list

    - by user310046
    I have a list of data where I keep e.g. countries with code, name and some other data. List<Country> countries = <deserialized objects from file> which consist of objects like this: public class Country { public string Code { get; set;} public string Name { get; set;} } The object which use as a DataContext may look like this: public class Address { public string StreetName{ get; set;} public string CountryCode { get; set;} } Then in my XAML I want to do something like this to show the name of the country <TextBlock Text="{Binding Path=CountryCode, Converter={StaticResource CountryNameLookupConverter}}"/> But how can I make the CountryNameLookupConverter use the countries list I read from the xml file?

    Read the article

  • Storing information for drop-down menus

    - by Mark
    Suppose you're building an HTML form and you want to have 2 or more drop-down menus, where after picking an option from the first, the 2nd menu is populated, and so forth. For example, choosing a country would bring up a list of provinces for that country, which would in turn list the cities. How would you store that sort of information in a database? Would you have a table Countries(id, name), Provinces(id, country_id, name), Cities(id, province_id, name) or would you have just one big denormalized table Entries(country, province, city)? (Why?)

    Read the article

  • What is the best way for converting phone numbers into international format (E.164) using Java?

    - by Vihung
    What is the best way for converting phone numbers into international format (E.164) using Java? Given a 'phone number' and a country id (let's say an ISO country code), I would like to convert it into a standard E.164 international format phone number. I am sure I can do it by hand quite easily - but I would not be sure it would work correctly in all situations. Which Java framework/library/utility would you recommend to accomplish this? P.S. The 'phone number' could be anything identifiable by the general public - such as * (510) 786-0404 * 1-800-GOT-MILK * +44-(0)800-7310658 that last one is my favourite - it is how some people write their number in the UK and means that you should either use the +44 or you should use the 0. The E.164 format number should be all numeric, and use the full international country code (e.g.+44)

    Read the article

  • Is there any way to generate a set of JWebUnit tests from an apache rewrite config?

    - by robbbbbb
    Seems unlikely, but is there any way to generate a set of unit tests for the following rewrite rule: RewriteRule ^/(user|group|country)/([a-z]+)/(photos|videos)$ http:/whatever?type=$1&entity=$2&resource=$3 From this I'd like to generate a set of urls of the form: /user/foo/photos /user/bar/photos /group/baz/videos /country/bar/photos etc... The reason I don't want to just do this once by hand is that I'd like the bounded alternation groups (e.g. (user|group|country)) to be able to grow and maintain coverage without having the update the tests by hand. Is there a rewrite rule or regex parser that might be able to do this, or am I doing it by hand?

    Read the article

< Previous Page | 11 12 13 14 15 16 17 18 19 20 21 22  | Next Page >