Search Results

Search found 3113 results on 125 pages for 'spin city'.

Page 10/125 | < Previous Page | 6 7 8 9 10 11 12 13 14 15 16 17  | Next Page >

  • jqtransform form selector (onchange) problem !!!!

    - by Newbie
    I'm styling a form with Jqtransform script. The form includes a selector which enlist some cities, when i click a one, it should update the selector below it with some locations within that city. here is the code of the selector <select name="city" id="city" class="wide" onchange="populateDestrict(this)"> It was working fine with default style , but after applying JQ, it lost it's functionality I asked a question before here LINK and i did as Dormilich did by writing: $(function() { $("form.jqtransform").jqTransform(); $("#city").change(populateDestrict(this)); }); But it didn't work ! here is also the code of the function if it helps <script language="javascript"> function populateDestrict(obj){ var city=obj.value; if(city!=""){ $.post('city_state.php',{ city: city},function(xml){ $("#state").removeOption(/./); $("district",xml).each(function() { $("#state").addOption($("key",this).text(), $("value",this).text()); }); }); } } </script> Any help people ???????? Thanks

    Read the article

  • JPA - Entity design problem

    - by Yatendra Goel
    I am developing a Java Desktop Application and using JPA for persistence. I have a problem mentioned below: I have two entities: Country City Country has the following attribute: CountryName (PK) City has the following attribute: CityName Now as there can be two cities with same name in two different countries, the primaryKey for City table in the datbase is a composite primary key composed of CityName and CountryName. Now my question is How to implement the primary key of the City as an Entity in Java @Entity public class Country implements Serializable { private String countryName; @Id public String getCountryName() { return this.countryName; } } @Entity public class City implements Serializable { private CityPK cityPK; private Country country; @EmbeddedId public CityPK getCityPK() { return this.cityPK; } } @Embeddable public class CityPK implements Serializable { public String cityName; public String countryName; } Now as we know that the relationship from Country to City is OneToMany and to show this relationship in the above code, I have added a country variable in City class. But then we have duplicate data(countryName) stored in two places in the City class: one in the country object and other in the cityPK object. But on the other hand, both are necessary: countryName in cityPK object is necessary because we implement composite primary keys in this way. countryName in country object is necessary because it is the standard way of showing relashionship between objects. How to get around this problem?

    Read the article

  • JSON feed to Java Object

    - by mnml
    Hi, I would like to know if there is a webpage/software that can "translate" a Json feed object to a Java object with attributes. For example : { 'firstName': 'John', 'lastName': 'Smith', 'address': { 'streetAddress': '21 2nd Street', 'city': 'New York' } } Would become: class Person { private String firstName; private String lastName; private Address address; public String getFirstName() { return firstName; } public String getLastName() { return lastName; } public Address getAddress() { return address; } public void setFirstName(String firstName) { this.firstName = firstName; } public void setLastName(String lastName) { this.lastName = lastName; } public void setAddress(Address address) { this.address = address; } public String toString() { return String.format("firstName: %s, lastName: %s, address: [%s]", firstName, lastName, address); } } class Address { private String streetAddress; private String city; public String getStreetAddress() { return streetAddress; } public String getCity() { return city; } public void setStreetAddress(String streetAddress) { this.streetAddress = streetAddress; } public void setCity(String city) { this.city = city; } public String toString() { return String.format("streetAddress: %s, city: %s", streetAddress, city); } } I'm not asking that because I'm lazy, but the JSON I would like to parse has quite a lot of attribute.

    Read the article

  • mysql to xml (DOM question)

    - by Jerry
    Hello guys I am new to php dom and trying to get the mysql data transfer into xml. My current xml output is like this <markers> <city> <name>Seattle</name> <size>medium</size> <name>New York</name> <size>big</size> <city> <markers> but I want to change it to <markers> <city> <name>Seattle</name> <size>medium</size> <city> <city> <name>New York</name> <size>big</size> </city> <city> <markers> my php $dom=new DOMDocument("1.0"); $node=$dom->createElement("markers"); $parnode=$dom->appendChild($node); $firstElement=$dom->createElement("city"); $parnode->appendChild($firstElement); $getLocationQuery=mysql_query("SELECT * FROM location",$connection); header("Content-type:text/xml"); while($row=mysql_fetch_assoc($getLocationQuery)){ foreach ($row as $fieldName=>$value){ $child=$dom->createElement($fieldName); $value=$dom->createTextNode($value); $child->appendChild($value); $firstElement->appendChild($child); } } I can't figure out how to change my php code. Please help me about it. Thanks a lot.

    Read the article

  • Running a Model::find in for loop in cakephp v1.3

    - by Gaurav Sharma
    Hi all, How can I achieve the following result in cakephp: In my application a Topic is related to category, category is related to city and city is finally related to state in other words: topic belongs to category, category belongs to city , city belongs to state.. Now in the Topic controller's index action I want to find out all the topics and it's city and state. How can I do this. I can easily do this using a custom query ($this-Model-query() function ) but then I will be facing pagination difficulties. I tried doing like this function index() { $this->Topic->recursive = 0; $topics = $this->paginate(); for($i=0; $i<count($topics);$i++) { $topics[$i]['City'] = $this->Topic->Category->City->find('all', array('conditions' => array('City.id' => $topics[$i]['Category']['city_id']))); } $this->set(compact('messages')); } The method that I have adopted is not a good one (running query in a loop) Using the recursive property and setting it to highest value (2) will degrade performance and is not going to yield me state information. How shall I solve this ? Please help Thanks

    Read the article

  • Having an issue with the "this" modifier...

    - by user344246
    I have this method in City class. It should create a new city based on the object which the method is applied to: public City newCity(string newCityName, int dX, int dY) { City c=new City(this); //based on a constructor : City(City c){} c.CityName=newCityName; c.NoOfNeighborhoods=1; c.NumOfResidents=0; c.CityCenter.Move(dX,dY); return c; } CityCenter is of type "Point" which has two fields - x,y. the Move method in Point class is ment to change the CityCenter location. It looks like this: public void Move(int dX, int dY) { this.X = x + dX; this.Y = y + dY; } What happens is that the new object,c and the existing City object are both changed. I think that "this" modifier works on the existing object too... How can I take advantage of the Move method without causing this behavior? Note: this is a closed API, so I can only add private methods to the project.

    Read the article

  • ASP.net User Controls and business entities

    - by Chris
    Hi all, I am currently developing some user controls so that I can use them at several places within a project. One control is a about editing a list of addresses for a customer. Since this needs to be done at several places within the project I want to make it a simple user control. The user control contains a repeater control. By default the repeater displays one address item to be edited. If more addresses need to be added, the user can click on a button to append an additional address to be entered. The user control should work for creating new addresses as well as editing existing ones. The address business entity looks something like this: public class Address { public string Street { get; set; } public City City { get; set; } public Address(string street, City city) { Check.NotNullOrEmpty(street); Check.NotNull(city); Street = street; City = city; } } As you can see an address can only be instantiated if there is a street and a city. Now my idea was that the user control exposes a collection property called Addresses. The getter of this property collects the addresses from the repeater and return it in a collection. The setter would databind the addresses to be edited to the repeater. Like this: public partial class AddressEditControl : System.Web.UI.UserControl { public IEnumerable<Address> Addresses { get { IList<Address> addresses = new List<Address>(); // collect items from repeater and create addresses foreach (RepeaterItem item in addressRepeater.Items) { // collect values from repeater item addresses.Add(new Address(street, city)); } return addresses; } set { addressRepeater.DataSource = value; addressRepeater.DataBind(); } } } First I liked this approach since it is object oriented makes it very easy to reuse the control. But at some place in my project I wanted to use this control so a user could enter some addresses. And I wanted to pre-fill the street input field of each repeater item since I had that data so the user doesn't need to enter it all by his self. Now the problem is that this user control only accepts addresses in a valid state (since the address object has only one constructor). So I cannot do: IList<Addresses> addresses = new List<Address>(); addresses.Add(new Address("someStreet", null)); // i dont know the city yet (user has to find it out) addressControl.Addresses = addresses; So the above is not possible since I would get an error from address because the city is null. Now my question: How would I create such a control? ;) I was thinking about using an Address DTO instead of a real address, so it can later be mapped to an address. That way I can pass in and out an address collection which addresses don't need to be valid. Or did I misunderstood the way user controls work? Are there any best practices?

    Read the article

  • Faceted search with Solr on Windows

    - by Dr.NETjes
    With over 10 million hits a day, funda.nl is probably the largest ASP.NET website which uses Solr on a Windows platform. While all our data (i.e. real estate properties) is stored in SQL Server, we're using Solr 1.4.1 to return the faceted search results as fast as we can.And yes, Solr is very fast. We did do some heavy stress testing on our Solr service, which allowed us to do over 1,000 req/sec on a single 64-bits Solr instance; and that's including converting search-url's to Solr http-queries and deserializing Solr's result-XML back to .NET objects! Let me tell you about faceted search and how to integrate Solr in a .NET/Windows environment. I'll bet it's easier than you think :-) What is faceted search? Faceted search is the clustering of search results into categories, allowing users to drill into search results. By showing the number of hits for each facet category, users can easily see how many results match that category. If you're still a bit confused, this example from CNET explains it all: The SQL solution for faceted search Our ("pre-Solr") solution for faceted search was done by adding a lot of redundant columns to our SQL tables and doing a COUNT(...) for each of those columns:   So if a user was searching for real estate properties in the city 'Amsterdam', our facet-query would be something like: SELECT COUNT(hasGarden), COUNT(has2Bathrooms), COUNT(has3Bathrooms), COUNT(etc...) FROM Houses WHERE city = 'Amsterdam' While this solution worked fine for a couple of years, it wasn't very easy for developers to add new facets. And also, performing COUNT's on all matched rows only performs well if you have a limited amount of rows in a table (i.e. less than a million). Enter Solr "Solr is an open source enterprise search server based on the Lucene Java search library, with XML/HTTP and JSON APIs, hit highlighting, faceted search, caching, replication, and a web administration interface." (quoted from Wikipedia's page on Solr) Solr isn't a database, it's more like a big index. Every time you upload data to Solr, it will analyze the data and create an inverted index from it (like the index-pages of a book). This way Solr can lookup data very quickly. To explain the inner workings of Solr is beyond the scope of this post, but if you want to learn more, please visit the Solr Wiki pages. Getting faceted search results from Solr is very easy; first let me show you how to send a http-query to Solr:    http://localhost:8983/solr/select?q=city:Amsterdam This will return an XML document containing the search results (in this example only three houses in the city of Amsterdam):    <response>     <result name="response" numFound="3" start="0">         <doc>            <long name="id">3203</long>            <str name="city">Amsterdam</str>            <str name="steet">Keizersgracht</str>            <int name="numberOfBathrooms">2</int>        </doc>         <doc>             <long name="id">3205</long>             <str name="city">Amsterdam</str>             <str name="steet">Vondelstraat</str>             <int name="numberOfBathrooms">3</int>          </doc>          <doc>             <long name="id">4293</long>             <str name="city">Amsterdam</str>             <str name="steet">Wibautstraat</str>             <int name="numberOfBathrooms">2</int>          </doc>       </result>   </response> By adding a facet-querypart for the field "numberOfBathrooms", Solr will return the facets for this particular field. We will see that there's one house in Amsterdam with three bathrooms and two houses with two bathrooms.    http://localhost:8983/solr/select?q=city:Amsterdam&facet=true&facet.field=numberOfBathrooms The complete XML response from Solr now looks like:    <response>      <result name="response" numFound="3" start="0">         <doc>            <long name="id">3203</long>            <str name="city">Amsterdam</str>            <str name="steet">Keizersgracht</str>            <int name="numberOfBathrooms">2</int>         </doc>         <doc>            <long name="id">3205</long>            <str name="city">Amsterdam</str>            <str name="steet">Vondelstraat</str>            <int name="numberOfBathrooms">3</int>         </doc>         <doc>            <long name="id">4293</long>            <str name="city">Amsterdam</str>            <str name="steet">Wibautstraat</str>            <int name="numberOfBathrooms">2</int>         </doc>      </result>      <lst name="facet_fields">         <lst name="numberOfBathrooms">            <int name="2">2</int>            <int name="3">1</int>         </lst>      </lst>   </response> Trying Solr for yourself To run Solr on your local machine and experiment with it, you should read the Solr tutorial. This tutorial really only takes 1 hour, in which you install Solr, upload sample data and get some query results. And yes, it works on Windows without a problem. Note that in the Solr tutorial, you're using Jetty as a Java Servlet Container (that's why you must start it using "java -jar start.jar"). In our environment we prefer to use Apache Tomcat to host Solr, which installs like a Windows service and works more like .NET developers expect. See the SolrTomcat page.Some best practices for running Solr on Windows: Use the 64-bits version of Tomcat. In our tests, this doubled the req/sec we were able to handle!Use a .NET XmlReader to convert Solr's XML output-stream to .NET objects. Don't use XPath; it won't scale well.Use filter queries ("fq" parameter) instead of the normal "q" parameter where possible. Filter queries are cached by Solr and will speed up Solr's response time (see FilterQueryGuidance)In my next post I’ll talk about how to keep Solr's indexed data in sync with the data in your SQL tables. Timestamps / rowversions will help you out here!

    Read the article

  • Is VBoxManage guestcontrol passing parameters incorrectly?

    - by Dan Jones
    I had an idea of using my Windows VM (on a Ubuntu host) to open itms:// links (for iTunes) from the host. So, I'm using vboxmanage guestcontrol to make this happen. I have a script (win_vm_launcher.sh) that takes a link as the argument, and passes it to the host like this: vboxmanage guestcontrol "$VM" exec --image 'C:\Windows\System32\cmd.exe' --username "$USER" --password "$PASSWORD" -- /c start "$@" This works if I copy a link from my browser, and change http to itms. E.g., for https://itunes.apple.com/us/album/new-york-city/id3202598, I can do win_vm_launcher.sh itmss://itunes.apple.com/us/album/new-york-city/id3202598 and it works fine. The album opens up in iTunes on my VM. However, when I click a "View in iTunes" link from the iTunes site, it adds an extra parameter to the URI (specifically, the referrer), so it looks something like itmss://itunes.apple.com/us/album/new-york-city/id3202598?ign-msr=https%3A%2F%2Fitunes.apple.com%2Fus%2Falbum%2Fit-came-upon-midnight-clear%2Fid578946739 Unfortunately, if I try to run win_vm_launcher.sh itmss://itunes.apple.com/us/album/new-york-city/id3202598?ign-msr=https%3A%2F%2Fitunes.apple.com%2Fus%2Falbum%2Fit-came-upon-midnight-clear%2Fid578946739 it insteads opens up a regular Command Prompt window with the title "itmss://itunes.apple.com/us/album/new-york-city/id3202598?ign-msr=https%3A%2F%2Fitunes.apple.com%2Fus%2Falbum%2Fit-came-upon-midnight-clear%2Fid578946739". I don't even know how to set the command prompt window title, so I'm not sure how that's happening. If I run the command in the guest, it works fine, opening the album in iTunes: cmd /c start itmss://itunes.apple.com/us/album/new-york-city/id3202598?ign-msr=https%3A%2F%2Fitunes.apple.com%2Fus%2Falbum%2Fit-came-upon-midnight-clear%2Fid578946739 I found a VirtualBox bug that seems somewhat related, but not exactly. It probably doesn't matter, but my host is Ubuntu 12.04, and my guest is Windows 7. So, any idea if vboxmanage is incorrectly passing the arguments, and if so, is there a way around it? If I can't figure out the right way to do it, I'll end up having to process each argument, and stripping out any parameters on any URIs. P.S. I tried creating a batch script (out.bat) like this: echo %1 > %TEMP%/testing.txt and then running it from the host like this: vboxmanage guestcontrol "$VM" exec --image 'C:\Windows\System32\cmd.exe' --username "$USER" --password "$PASSWORD" -- /c "C:\path\to\out.bat" "itmss://itunes.apple.com/us/album/new-york-city/id3202598?ign-msr=https%3A%2F%2Fitunes.apple.com%2Fus%2Falbum%2Fit-came-upon-midnight-clear%2Fid578946739" It ran as expected, and when I open %TEMP%/testing.txt, it contained: "itmss://itunes.apple.com/us/album/new-york-city/id3202598?ign-msr=https%3A%2F%2Fitunes.apple.com%2Fus%2Falbum%2Fit-came-upon-midnight-clear%2Fid578946739" including the quotes. So, it sort of passed the parameter correctly (not sure why it still had quotes), so maybe the problem is with cmd.exe, or even the start command. I'm stymied.

    Read the article

  • treeview binding wpf cannot bind nested property in a class

    - by devnet247
    Hi all New to wpf and therefore struggling a bit. I am putting together a quick demo before we go for the full implementation I have a treeview on the left with Continent Country City structure when a user select the city it should populate some textboxes in a tabcontrol on the right hand side I made it sort of work but cannot make it work with composite objects. In a nutshell can you spot what is wrong with my zaml or code. Why is not binding to a my CityDetails.ClubsCount or CityDetails.PubsCount? What I am building is based on http://www.codeproject.com/KB/WPF/TreeViewWithViewModel.aspx Thanks a lot for any suggestions or reply DataModel public class City { public City(string cityName) { CityName = cityName; } public string CityName { get; set; } public string Population { get; set; } public string Area { get; set; } public CityDetails CityDetailsInfo { get; set; } } public class CityDetails { public CityDetails(int pubsCount,int clubsCount) { PubsCount = pubsCount; ClubsCount = clubsCount; } public int ClubsCount { get; set; } public int PubsCount { get; set; } } ViewModel public class CityViewModel : TreeViewItemViewModel { private City _city; private RelayCommand _testCommand; public CityViewModel(City city, CountryViewModel countryViewModel):base(countryViewModel,false) { _city = city; } public string CityName { get { return _city.CityName; } } public string Area { get { return _city.Area; } } public string Population { get { return _city.Population; } } public City City { get { return _city; } set { _city = value; } } public CityDetails CityDetailsInfo { get { return _city.CityDetailsInfo; } set { _city.CityDetailsInfo = value; } } } XAML <DockPanel> <DockPanel LastChildFill="True"> <Label DockPanel.Dock="top" Content="Title " HorizontalAlignment="Center"></Label> <StatusBar DockPanel.Dock="Bottom"> <StatusBarItem Content="Status Bar" ></StatusBarItem> </StatusBar> <Grid DockPanel.Dock="Top"> <Grid.ColumnDefinitions> <ColumnDefinition/> <ColumnDefinition Width="Auto"/> <ColumnDefinition Width="2*"/> </Grid.ColumnDefinitions> <TreeView Name="tree" ItemsSource="{Binding Continents}"> <TreeView.ItemContainerStyle> <Style TargetType="{x:Type TreeViewItem}"> <Setter Property="IsExpanded" Value="{Binding IsExpanded,Mode=TwoWay}"/> <Setter Property="IsSelected" Value="{Binding IsSelected,Mode=TwoWay}"/> <Setter Property="FontWeight" Value="Normal"/> <Style.Triggers> <Trigger Property="IsSelected" Value="True"> <Setter Property="FontWeight" Value="Bold"></Setter> </Trigger> </Style.Triggers> </Style> </TreeView.ItemContainerStyle> <TreeView.Resources> <HierarchicalDataTemplate DataType="{x:Type ViewModels:ContinentViewModel}" ItemsSource="{Binding Children}"> <StackPanel Orientation="Horizontal"> <Image Width="16" Height="16" Margin="3,0" Source="Images\Continent.png"/> <TextBlock Text="{Binding ContinentName}"/> </StackPanel> </HierarchicalDataTemplate> <HierarchicalDataTemplate DataType="{x:Type ViewModels:CountryViewModel}" ItemsSource="{Binding Children}"> <StackPanel Orientation="Horizontal"> <Image Width="16" Height="16" Margin="3,0" Source="Images\Country.png"/> <TextBlock Text="{Binding CountryName}"/> </StackPanel> </HierarchicalDataTemplate> <DataTemplate DataType="{x:Type ViewModels:CityViewModel}" > <StackPanel Orientation="Horizontal"> <Image Width="16" Height="16" Margin="3,0" Source="Images\City.png"/> <TextBlock Text="{Binding CityName}"/> </StackPanel> </DataTemplate> </TreeView.Resources> </TreeView> <GridSplitter Grid.Row="0" Grid.Column="1" Background="LightGray" Width="5" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"/> <Grid Grid.Column="2" Margin="5" > <TabControl> <TabItem Header="Details" DataContext="{Binding Path=SelectedItem.City, ElementName=tree, Mode=OneWay}"> <StackPanel > <TextBlock VerticalAlignment="Center" FontSize="12" Text="{Binding CityName}"/> <TextBlock VerticalAlignment="Center" FontSize="12" Text="{Binding Area}"/> <TextBlock VerticalAlignment="Center" FontSize="12" Text="{Binding Population}"/> <!-- DONT WORK WHY--> <TextBlock VerticalAlignment="Center" FontSize="12" Text="{Binding SelectedItem.CityDetailsInfo.ClubsCount}"/> <TextBlock VerticalAlignment="Center" FontSize="12" Text="{Binding SelectedItem.CityDetailsInfo.PubsCount}"/> </StackPanel> </TabItem> </TabControl> </Grid> </Grid> </DockPanel> </DockPanel>

    Read the article

  • SQL Self Join Query Help

    - by hdoe123
    Hi All, I'm trying to work out a query that self join itself on a table using the eventnumber. I've never done a self join before. What i'm trying to query is when a client has started off in a city which is chester to see what city they moved to. But I dont want to be able to see if they started off in another city. I would also like be only see the move once (So i'd only like to see if they went from chester to london rather then chester to london to wales) The StartTimeDate is the same EndDateTime if they moved to another city. Data example as follows if they started off in the city chester :- clientid EventNumber City StartDateTime EndDateTime 1 1 Chester 10/03/2009 11/04/2010 13:00 1 1 Liverpool 11/04/2010 13:00 30/06/2010 16:00 1 1 Wales 30/07/2010 16:00 the result I would like to see is on the 2nd row - so it only shows me liverpool. Could anyone point in the right direcetion please?

    Read the article

  • Jquery menu with less code

    - by Sergio
    I'm using Jquery for menu created like: <div class="prof_info1">home</div><div class="prof_info2">info2</div><div class="prof_info3">info3</div> And Jquery code like: $(document).ready(function(){ $(".prof_info1").unbind("click").click(function(event) { $("#main").html('<img src="img/spin.gif" class="spin">'); location.replace("?&id=<?=$id?>") return false; }); $(".prof_info2").unbind("click").click(function(event) { $("#main").html('<img src="img/spin.gif" class="spin">'); $("#main").load('?a=2&id=<?=$id?>'); return false; }); $(".prof_info3").unbind("click").click(function(event) { $("#glavni").html('<img src="img/spin.gif" class="spin">'); $("#glavni").load('?a=3&id=<?=$id?>'); return false; }); }); Is there any easier way to do write this Jquery code and make it with less code? Something like if click somethind{ ... }elseif{ ....}

    Read the article

  • how to send a dynamic set of parameters to webmethod using jquery ajax method?

    - by kranthi
    hi, I am using jquery ajax method on my aspx page,which will invoke the webmethod in the code behind.Currently the webmethod takes a couple of parameters like firstname,lastname,address etc which I am passing from jquery ajax method using data:JSON.stringify({fname:firstname,lname:lastname,city:city}) now my requirement has been changed such that,the number and type of parameters that are going to be passed is not fixed for ex.parameter combination can be something like fname,city or fname,city or city,lname or fname,lname,city or something else.So the webmethod should be such that it should accept any number parameters.I thought of using arrays to do so, as described here. But I do not understand how can I identify which and how many parameters have been passed to the webmethod to insert/update the data to the DB.Please could someone help me with this? thanks

    Read the article

  • Newbie's problems with MySQL and php

    - by Mirage81
    I'm a real newbie with php and MySQL. Now I'm working on the following code which should search the database for eg. all the Lennons living in Liverpool. 1) How should I modify "get.php" to get the text "no results" to appear if there are no search results. 2) How should I modify "index.php" to get the option values (city and lastname) straight from the database instead of having to type them one by one? 3) Am I using mysql_real_escape_string the right way? 4) Any other mistakes in the code? index.php: <form action="get.php" method="post"> <p> <select name="city"> <option value="Birmingham">Birmingham</option> <option value="Liverpool">Liverpool</option> <option value="London">London</option> </select> </p> <p> <select name="lastname"> <option value="Lennon">Lennon</option> <option value="McCartney">McCartney</option> <option value="Osbourne">Osbourne</option> </select> </p> <p> <input value="Search" type="submit"> </p> </form> get.php: <?php $city = $_POST['city']; $lastname = $_POST['lastname']; $conn = mysql_connect('localhost', 'user', 'password'); mysql_select_db("database", $conn) or die("connection failed"); $query = "SELECT * FROM users WHERE city = '$city' AND lastname = '$lastname'"; $result = mysql_query($query, $conn); $city = mysql_real_escape_string($_POST['city']); $lastname = mysql_real_escape_string($_POST['lastname']); echo $rowcount; while ($row = mysql_fetch_row($result)) { if ($rowcount == '0') echo 'no results'; else { echo '<b>City: </b>'.htmlspecialchars($row[0]).'<br />'; echo '<b>Last name: </b>'.htmlspecialchars($row[1]).'<br />'; echo '<b>Information: </b>'.htmlspecialchars($row[2]); } } mysql_close($conn);

    Read the article

  • Select count / duplicates

    - by mike
    Hello! I have a table with all U.S. zip codes. each row contains the city and state name for the zip code. I'm trying to get a list of cities that show up in multiple states. This wouldn't be a problem if there weren't X amount of zip codes in the same city... So basically, I just want to the city in a state to count as 1 instead of it counting the city/state 7 times because there are 2+ zip codes in that city/state... I'm not really sure how to do this. I know I need to use count but how do I tell the mysql to only count a given city/state combo as 1?

    Read the article

  • How to get the place name by latitude and longitude using openstreetmap in android

    - by Gaurav kumar
    In my app i am using osm rather than google map.I have latitude and longitude.So from here how i will query to get the city name from osm database..please help me. final String requestString = "http://nominatim.openstreetmap.org/reverse?format=json&lat=" + Double.toString(lat) + "&lon=" + Double.toString(lon) + "&zoom=18&addressdetails=1"; RequestBuilder builder = new RequestBuilder(RequestBuilder.GET, URL.encode(requestString)); try { @SuppressWarnings("unused") Request request = builder.sendRequest(null, new RequestCallback() { @Override public void onResponseReceived(Request request, Response response) { if (response.getStatusCode() == 200) { String city = ""; try { JSONValue json = JSONParser.parseStrict(response); JSONObject address = json.isObject().get("address").isObject(); final String quotes = "^\"|\"$"; if (address.get("city") != null) { city = address.get("city").toString().replaceAll(quotes, ""); } else if (address.get("village") != null) { city = address.get("village").toString().replaceAll(quotes, ""); } } catch (Exception e) { } } } }); } catch (Exception e1) { }

    Read the article

  • Mapping child objects in fluent nhibernate to a read-only view

    - by grenade
    Given that I am implementing a read-only UI, how do I create a ClassMap for Shop: public class Shop { public int Id { get; set; } public City City { get; set; } } public class City { public string Name { get; set; } public string CountryCode { get; set; } } The DB interface for Shops is a View containing 3 columns (ShopId, CityName, CountryCode). I was hoping to do something like this: public sealed class ShopMap : ClassMap<Shop> { public ShopMap() { Table("Shop"); Id(x => x.Id, "ShopId"); Map(x => x.City.Name, "CityName"); Map(x => x.City.CountryCode, "CountryCode"); } } Will fluent auto-instantiate Shop.City?

    Read the article

  • ComboBox WPF Databinding to a DataView

    - by Oleg
    Hello Everyone! Lets say I have one ComboBox and 2 TextBox items on my GUI. And I have one DataView with data (City, PostalCode, Street, ID). While initializing the whole thing I fill my DataView with some data :) City 1, 11111, Street 1, 1 City 1, 22222, Street 2, 2 City 1, 33333, Street 3, 3 Now I want to bind this to my ComboBox. DataView is a Class Member called "m_dvAdresses", but this code doesnt help: ItemsSource="{Binding Source=m_dvAdresses}" SelectedValuePath="ID" DisplayMemberPath="Street" Also I want to have my 2 ComboBox items to show PostalCode and City, depending on what to i pick in my ComboBox. Like if I pick "Street 2", TextBox1 show me "City 1" and TexBox2 show me "22222"... How can I bind all of them ONLY in the WPF code? Thanks for help!!!!!!!!!!! :)

    Read the article

  • What is the difference between declaring data attributes inside or outside __init__

    - by user1898540
    I'm trying to get my head around OOP in Python and I'm a bit confused when it comes to declare variables within a class. Should I declare them inside of the __init__ procedure or outside it? What's the difference? The following code works just fine: # Declaring variables within __init__ class MyClass: def __init__(self): country = "" city = "" def information(self): print "Hi! I'm from %s, (%s)"%(self.city,self.country) me = MyClass() me.country = "Spain" me.city = "Barcelona" me.information() But declaring the variables outside of the __init procedure also works: # Declaring variables outside of __init__ class MyClass: country = "" city = "" def information(self): print "Hi! I'm from %s, (%s)"%(self.city,self.country) me = MyClass() me.country = "Spain" me.city = "Barcelona" me.information()

    Read the article

  • how to get the individual parameters from the list of dynamic parameters in a webmethod,sent using

    - by kranthi
    hi, I am using jquery ajax method on my aspx page,which will invoke the webmethod in the code behind.Currently the webmethod takes a couple of parameters like firstname,lastname,address etc which I am passing from jquery ajax method using data:JSON.stringify({fname:firstname,lname:lastname,city:city}) now my requirement has been changed such that,the number and type of parameters that are going to be passed is not fixed for ex.parameter combination can be something like fname,city or fname,city or city,lname or fname,lname,city or something else.So the webmethod should be such that it should accept any number parameters.I thought of using arrays to do so, as described here. But I do not understand how can I identify which and how many parameters have been passed to the webmethod to insert/update the data to the DB.Please could someone help me with this? thanks

    Read the article

  • Make a shortcode echo in the middle of an URL in HREF

    - by Liso22
    The shortcode [mmjs-city] echoes the city the user is in. I want to make a link that takes the user to a results page with the user's city as search term. Basically the URL should be the results page URL + the result of the shortcode (the city). I tried to write it this way: Search for your city Normally I would just use PHP and assign the city to a value but I'm in a page not the theme and PHP doesn't work on pages for some reason, most likely It's possible but I don't know how. Anyway, anybody knows how could I do it? Thanks and merry christmas

    Read the article

  • Dropdown list with a "Select All" option

    - by shawnboy
    I have three dropdown boxes, Region, District, and City. I want my District dropdown to have a "Select All" option so the user can get all Cities in the Region, else just display the City based on the selected District. My query looks like this: IF @district =-2 THEN (SELECT DISTINCT city FROM myTable WHERE RIGHT(Region, 3) = ?) ORDER BY city) ELSE (select DISTINCT city FROM myTable WHERE District = ?) Order by city I'm using vb.net/sql I couldn't find any complex case scenarios in my search either. Any sugguestions would be appreciated!

    Read the article

  • SQL to get rows (not groups) that match an aggregate

    - by xulochavez
    Given table USER (name, city, age), what's the best way to get the user details of oldest user per city? I have seen the following example SQL used in Oracle which I think it works select name, city, age from USER, (select city as maxCity, max(age) as maxAge from USER group by city) where city=maxCity and age=maxAge So in essence: use a nested query to select the grouping key and aggregate for it, then use it as another table in the main query and join with the grouping key and the aggregate value for each key. Is this the standard SQL way of doing it? Is it any quicker than using a temporary table, or is in fact using a temporary table interanlly anyway?

    Read the article

  • Inverted schedctl usage in the JVM

    - by Dave
    The schedctl facility in Solaris allows a thread to request that the kernel defer involuntary preemption for a brief period. The mechanism is strictly advisory - the kernel can opt to ignore the request. Schedctl is typically used to bracket lock critical sections. That, in turn, can avoid convoying -- threads piling up on a critical section behind a preempted lock-holder -- and other lock-related performance pathologies. If you're interested see the man pages for schedctl_start() and schedctl_stop() and the schedctl.h include file. The implementation is very efficient. schedctl_start(), which asks that preemption be deferred, simply stores into a thread-specific structure -- the schedctl block -- that the kernel maps into user-space. Similarly, schedctl_stop() clears the flag set by schedctl_stop() and then checks a "preemption pending" flag in the block. Normally, this will be false, but if set schedctl_stop() will yield to politely grant the CPU to other threads. Note that you can't abuse this facility for long-term preemption avoidance as the deferral is brief. If your thread exceeds the grace period the kernel will preempt it and transiently degrade its effective scheduling priority. Further reading : US05937187 and various papers by Andy Tucker. We'll now switch topics to the implementation of the "synchronized" locking construct in the HotSpot JVM. If a lock is contended then on multiprocessor systems we'll spin briefly to try to avoid context switching. Context switching is wasted work and inflicts various cache and TLB penalties on the threads involved. If context switching were "free" then we'd never spin to avoid switching, but that's not the case. We use an adaptive spin-then-park strategy. One potentially undesirable outcome is that we can be preempted while spinning. When our spinning thread is finally rescheduled the lock may or may not be available. If not, we'll spin and then potentially park (block) again, thus suffering a 2nd context switch. Recall that the reason we spin is to avoid context switching. To avoid this scenario I've found it useful to enable schedctl to request deferral while spinning. But while spinning I've arranged for the code to periodically check or poll the "preemption pending" flag. If that's found set we simply abandon our spinning attempt and park immediately. This avoids the double context-switch scenario above. One annoyance is that the schedctl blocks for the threads in a given process are tightly packed on special pages mapped from kernel space into user-land. As such, writes to the schedctl blocks can cause false sharing on other adjacent blocks. Hopefully the kernel folks will make changes to avoid this by padding and aligning the blocks to ensure that one cache line underlies at most one schedctl block at any one time.

    Read the article

< Previous Page | 6 7 8 9 10 11 12 13 14 15 16 17  | Next Page >