Search Results

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

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

  • Update table.column with another table.column with common joined column

    - by Matt
    Hit a speed bump, trying to update some column values in my table from another table. This is what is supposed to happen when everything works Correct all the city, state entries in tblWADonations by creating an update statement that moves the zip city from the joined city/state zip field to the tblWADonations city state TBL NAME | COLUMN NAMES tblZipcodes with zip,city,State tblWADonations with zip,oldcity,oldstate This is what I have so far: UPDATE tblWADonations SET oldCity = tblZipCodes.city, oldState = tblZipCodes.state FROM tblWADonations INNER JOIN tblZipCodes ON tblWADonations.zip = tblZipCodes.zip Where oldCity <> tblZipcodes.city; There seems to be easy ways to do this online but I am overlooking something. Tried this by hand and in editor this is what it kicks back. Msg 8152, Level 16, State 2, Line 1 String or binary data would be truncated. The statement has been terminated. Please include a sql statement or where I need to make the edit so I can mark this post as a reference in my favorites. Thanks!

    Read the article

  • DOM innerHTML Duplicate Problem

    - by Kubi
    function SwapPlans(city, id) { var tp = GetTravelPlanById(id); var content = MakeHTMLAccordionMe(tp.items[0]); document.getElementById(city).innerHTML = " "; document.getElementById(city).innerHTML = content.innerHTML; document.getElementById(city).outerHTML = " "; document.getElementById(city).outerHTML = content.outerHTML; } Hi, I have a problem with the snippet above. MakeAccordionME function returns the content that I want to change by document.getElementById(city) = value; but It doesn't remove the first content of the first div. Is there any content.clear method in DOM javascript ? thx p.s. the div that returns from document.getElementById(city) is a jquery accordion div.

    Read the article

  • How I can get logged in user's info like email id,name,city etc. in Facebook with uId

    - by vaibhavbhalke
    Hi all Can any one help me to get logged in user's info like email id,name,city etc. with the help of Facebook uId . " Long uid = apiClient.getLoggedInUser ();" Users_getInfo is not useful. It returns No of users connected to _User & according that there info gets. If user login successfully using fb connect, Facebook gives us uid. However, I need to match the logged in user with our member's account If that member is not present in DB then want to register him and I'm trying to do that with e-mail(hashed) address and other info.

    Read the article

  • subset a data.frame with multiple conditions

    - by pslice
    Suppose my data looks like this: 2372 Kansas KS2000111 HUMBOLDT, CITY OF ATRAZINE 1.3 05/07/2006 9104 Kansas KS2000111 HUMBOLDT, CITY OF ATRAZINE 0.34 07/23/2006 9212 Kansas KS2000111 HUMBOLDT, CITY OF ATRAZINE 0.33 02/11/2007 2094 Kansas KS2000111 HUMBOLDT, CITY OF ATRAZINE 1.4 05/06/2007 16763 Kansas KS2000111 HUMBOLDT, CITY OF ATRAZINE 0.61 05/11/2009 1076 Kansas KS2000111 HUMBOLDT, CITY OF METOLACHLOR 0.48 05/12/2002 1077 Kansas KS2000111 HUMBOLDT, CITY OF METOLACHLOR 0.3 05/07/2006 I want to be able to subset by the Analyte and a partial match on the date(namely I just want the year). I have been trying this, but I know it isn't quite right. data[data$Analyte=="ATRAZINE" & grep("2006",as.character(data$Date)),] Any suggestions?

    Read the article

  • How to get City, Country, and Country Code for a particular IP Address in ASP.NET?

    - by Prashant
    Hi, I am having an application in which i am storing user ip address. But now i want to store the City, Country and Country Code of the user on the basis of their ip addresses. So I am able to get the user's IP Address in ASP.NET but how to get other details. If its possible (which i don't thin it is) then tell me else tell me some alternate way to do this, is there any online FREE service using which ican get these details. How to do this in ASP.NET using C# Thanks.

    Read the article

  • Removing entity bug

    - by Greg
    hello, I am trying out the ria services and I am experiencing this problem that seems very strange to me. I am creating a new entity of type "House" and add it to context without saving the context so the id of the new entity is 0, after i remove this entity and add another new entity of type "House" again and again without saving the context, here comes the weird part, now I have an entity of type "City" which holds entityset of all "Houses" in that city, so to put the newly created entity "House" into the city i do something like this - house.City = city, where house is type "House" and city is type "City", afte this step a check the context and suddenly there are 2 entities of type "House" with id 0, one of them is the one I have deleted at the beginning. Any idea what is causing this and how to fix it?? thank you Greg

    Read the article

  • ria entity remove bug

    - by Greg
    hello, I am trying out the ria services and I am experiencing this problem that seems very strange to me. I am creating a new entity of type "House" and add it to context without saving the context so the id of the new entity is 0, after i remove this entity and add another new entity of type "House" again and again without saving the context, here comes the weird part, now I have an entity of type "City" which holds entityset of all "Houses" in that city, so to put the newly created entity "House" into the city i do something like this - house.City = city, where house is type "House" and city is type "City", afte this step a check the context and suddenly there are 2 entities of type "House" with id 0, one of them is the one I have deleted at the beginning. Any idea what is causing this and how to fix it?? thank you Greg

    Read the article

  • How to very efficiently assign lat/long to city boundary described by shape ?

    - by watcherFR
    I have a huge shapefile of 36.000 non-overlapping polygones (city boundaries). I want to easily determine the polygone into which a given lat/long falls. What would the best way given that it must be extremely computationaly efficient ? I was thinking of creating a lookup table (tilex,tiley,polygone_id) where tilex and tiley are tile identifiers at zoom levels 21 or 22. Yes, the lack of precision of using tile numbers and a planar projection is acceptable in my application. I would rather not use postgres's GIS extension and am fine with a program that will run for 2 days to generate all the INSERT statements.

    Read the article

  • Problem while inserting data from GUI layer to database

    - by Rahul
    Hi all, I am facing problem while i am inserting new record from GUI part to database table. I have created database table Patient with id, name, age etc....id is identity primary key. My problem is while i am inserting duplicate name in table the control should go to else part, and display the message like...This name is already exits, pls try with another name... but in my coding not getting..... Here is all the code...pls somebody point me out whats wrong or how do this??? GUILayer: protected void BtnSubmit_Click(object sender, EventArgs e) { if (!Page.IsValid) return; int intResult = 0; string name = TxtName.Text.Trim(); int age = Convert.ToInt32(TxtAge.Text); string gender; if (RadioButtonMale.Checked) { gender = RadioButtonMale.Text; } else { gender = RadioButtonFemale.Text; } string city = DropDownListCity.SelectedItem.Value; string typeofdisease = ""; foreach (ListItem li in CheckBoxListDisease.Items) { if (li.Selected) { typeofdisease += li.Value; } } typeofdisease = typeofdisease.TrimEnd(); PatientBAL PB = new PatientBAL(); PatientProperty obj = new PatientProperty(); obj.Name = name; obj.Age = age; obj.Gender = gender; obj.City = city; obj.TypeOFDisease = typeofdisease; try { intResult = PB.ADDPatient(obj); if (intResult > 0) { lblMessage.Text = "New record inserted successfully."; TxtName.Text = string.Empty; TxtAge.Text = string.Empty; RadioButtonMale.Enabled = false; RadioButtonFemale.Enabled = false; DropDownListCity.SelectedIndex = 0; CheckBoxListDisease.SelectedIndex = 0; } else { lblMessage.Text = "Name [<b>" + TxtName.Text + "</b>] alredy exists, try another name"; } } catch (Exception ex) { lblMessage.Text = ex.Message.ToString(); } finally { obj = null; PB = null; } } BAL layer: public class PatientBAL { public int ADDPatient(PatientProperty obj) { PatientDAL pdl = new PatientDAL(); try { return pdl.InsertData(obj); } catch { throw; } finally { pdl=null; } } } DAL layer: public class PatientDAL { public string ConString = ConfigurationManager.ConnectionStrings["ConString"].ConnectionString; public int InsertData(PatientProperty obj) { SqlConnection con = new SqlConnection(ConString); con.Open(); SqlCommand com = new SqlCommand("LoadData",con); com.CommandType = CommandType.StoredProcedure; try { com.Parameters.AddWithValue("@Name", obj.Name); com.Parameters.AddWithValue("@Age",obj.Age); com.Parameters.AddWithValue("@Gender",obj.Gender); com.Parameters.AddWithValue("@City", obj.City); com.Parameters.AddWithValue("@TypeOfDisease", obj.TypeOFDisease); return com.ExecuteNonQuery(); } catch { throw; } finally { com.Dispose(); con.Close(); } } } Property Class: public class PatientProperty { private string name; private int age; private string gender; private string city; private string typedisease; public string Name { get { return name; } set { name = value; } } public int Age { get { return age; } set { age = value; } } public string Gender { get { return gender; } set { gender = value; } } public string City { get { return city; } set { city = value; } } public string TypeOFDisease { get { return typedisease; } set { typedisease = value; } } } This is my stored Procedure: CREATE PROCEDURE LoadData ( @Name varchar(50), @Age int, @Gender char(10), @City char(10), @TypeofDisease varchar(50) ) as insert into Patient(Name, Age, Gender, City, TypeOfDisease)values(@Name,@Age, @Gender, @City, @TypeofDisease) GO

    Read the article

  • Miami 311: Built on Windows Azure

    - by Josh Holmes
    This is a cool use of Azure. The city of Miami tool their “311” data around potholes, trash pickup issues, recycling issues, broken sidewalks and the like and put that data in Azure. The next step is that they leveraged Bing Maps and Silverlight to visualize those issues spread on a map of the city. The solution takes advantage of virtually unlimited storage and processing power, provides the ability to quickly address service requests and implement updates even during peak times such as hurricane season. If things change, the City can bring the solution on site or move to a physical facility, all based on  need and cost-effectiveness. As a result, residents logging on to Miami 311 can see on average 4,500 issues in progress - not represented as a ‘list', but located on a map in relation to other projects in their neighborhood .  A simple click on the map allows them to easily drill down to more and more specific details if they want. In short, they have turned what used to be represented by a meaningless list of data into useful information, and created  actionable and consumable knowledge that is relevant to the citizens of Miami. For Miami, their ‘service call to the city' becomes an interactive process they can follow - and the City has a new tool to manage and deliver outcomes. … When the city made the move to the web, they chose tools they knew and software they trust. The Microsoft Windows Azure cloud platform made it easy to do, and they used both Bing mapping and Silverlight to build a user friendly front end. According to Port25 (Miami 311: Built on Windows Azure - Port 25: The Open Source Community at Microsoft), it took two people 8 days to implement the whole system and they are going to open source their solution so that other cities can leverage it. I haven’t seen yet where and how they are going to release it but I’ll keep you posted if I find out.

    Read the article

  • Very Cool &ndash; Miami 311 System for tracking citizen service requests (Windows Azure, Silverlight

    - by Jim Duffy
    Having grown up in South Florida this short, but very enlightening, video explaining how the City of Miami has implemented a 311 citizen service request system using Windows Azure, Silverlight and Bing Maps definitely caught my attention. Miami311 The Miami311 System is a Windows Azure/Silverlight-based solution which enables City of Miami citizens report and track issues reported to city management. The system uses Bing Maps to plot the location and relevant information about each issue reported. Citizens now have the ability to easily see the status of the issue without having to call the city office. What I found interesting were a couple of benefits that a metropolitan area such as Miami can take advantage of in Windows Azure cloud-based solution. For the city of Miami, both benefits center around the weather. Of course the threat of a hurricane is a real issue in South Florida and what better way to make sure your site stays up during a hurricane then to have the site hosted far away from the eye of the storm. Using a Windows Azure cloud-based architecture the City of Miami is able to host the application within the Microsoft data centers safely away from any hurricane passing through South Florida. The second benefit is the inherent scalability of a Windows Azure based solution. During a severe weather event like thunderstorms or even worse, a hurricane, downed trees and power lines are a commonly reported problem. Being able to quickly scale up the computing resources required to handle the spike in citizens reporting these types of problems on the site is a huge benefit. Once the weather event has passed and downed tree reports begin to subside they can quickly reverse the process and scale the system back down to pre-storm levels. It’s kind of day-to-day kind of stuff but very cool stuff nonetheless. Have a day. :-|

    Read the article

  • How can I change the location of my ip address to Orlando, FL from other city where I live and using forum/chat-room? [on hold]

    - by MSEUCF
    I live in West Palm Beach, Florida. However, I am attending to school at University of Center Florida for materials science and engineering. Right now, I am on vacation and live in WPB, FL. There is one certainly problem when I login at private forum I'm getting error for not same the ip-address so I had to make new account with false information in city and still unable to success. Of course, it won't do that due to policy from forum required the ip-address has to be same in Orlando, FL. local only. How can I change the location of my ip address to Orlando? Also, in chat-room from forum it would show my ip-address so I'd be in trouble if they find out that I am not live in Orlando. Please help with me. Tell me how to change ip adress step and step. Thank you. *I use AT&T and Belkin Router Wifi. Forgiven me for my English is not very well. ESL. I am a foreign student.

    Read the article

  • Best way to lay-out the website when sections of it are almost identical

    - by Linas
    so, I have a minisite for the mobile application that I did. The mobile application is a public transport (transit) schedule viewer for a particular city (let's call it Foo), and I'm trying to sell it via that minisite. I publish that minisite in www.myawesomeapplication.com/foo/. It has the usual "standard" subpages, like "About", "Compatible phones", "Contact", etc. Now, I have decided to create analogue mobile application for other cities, Bar and Baz. These mobile applications (products) would be almost identical to the one for the Foo city, thus the minisites for those would (should) look very similar too (except for some artwork and Foo = Bar replacement). The question is: what do you think would be the most logical way to lay-out the website in this situation, both from the business and search engine perspective? In other words, should I just duplicate the /foo/ website to /bar/ and /baz/, or would it be better to try to create a single website under root path (/)? I don't want search engine penalties for almost-duplicate information under /foo/, /bar/ and /baz/, and also I don't want a messy, non-localized website (I guess the user is more likely to buy something if he/she sees "This-and-that is the application for NYC, the city you live in", not "This-and-that is the application for city A, city B, ..., NYC, ..., and city Z.")

    Read the article

  • Cannot implicitly convert type 'System.Linq.IQueryable<int>' to 'int?'

    - by Aneef
    Hi this is my code var cityList = from country in doc.Element("result").Element("cities").Descendants("city") select new { Name = country.Element("name").Value, Code = country.Element("code").Value, CountryCode = int.Parse(country.Element("countrycode").Value) }; foreach(var citee in cityList) { City city = new City(); city.CountryID = from cnt in db.Countries where cnt.DOTWInternalID == citee.CountryCode select cnt.ID; } Im getting an error on the second query as the title of this post, i tried converting to int, to nullable int nothing worked? help me guys Thanks,

    Read the article

  • Linq Projection Question

    - by Micah
    I'm trying to do the following: from c in db.GetAllContactsQuery() select new { ID= c.ID, LastName = c.LastName, FirstName = c.FirstName, Email = c.Email, City =c.City+" "+c.State } The issue i'm running into is that if c.City or c.State are null, the City property returns null. How can I put a function right beside that City= declaration?

    Read the article

  • Htaccess rewrite rule .aspx to .php

    - by Markus Ossi
    Background: I have a website that has been built with ASP.NET 2.0 and is on Windows hosting. I now have to rewrite my site in PHP and move it into Linux hosting. I have a lot of incoming links to my site from around the web that point directly into the old .aspx-pages. The site itself is very simple, one dynamic page and five static ones. I saved the static .aspx pages as .php-pages and rewrote the dynamic page in PHP. The dynamic page is called City.aspx and I have written it in PHP and it is now called City.php. On my old Windows hosting, I used ASP.NET's URL mapping for friendly URL. For example, incoming URL request for Laajakaista/Ypaja.aspx was mapped into City.aspx?CityID=981. My goal: To redirect all human visitors and search engines looking for the old .aspx pages into the new .php pages. I am thinking that the easiest way to redirect visitors into new pages will be by making a redirect, where all requests for .aspx-files will be redirected into .php filetypes. So, if someone asks for MYSITE/City.aspx?CityID=5, they will be taken into MYSITE/City.php?CityID=5 instead. However, I am having a lot of trouble getting this to work. So far this is what I have found: rewriterule ^([.]+)\.aspx$ http://www.example.com/$1.php [R=301,L] However, I think this can not handle the parameters after the filetype and I am also not quite sure what to put on front. To make things a bit more complicated, at my previous site I used friendly URL's so that I had a huge mapping file with mappings like this: <add url="~/Laajakaista/Ypaja.aspx" mappedUrl="~/City.aspx?CityID=981" /> <add url="~/Laajakaista/Aetsa.aspx" mappedUrl="~/City.aspx?CityID=988" /> <add url="~/Laajakaista/Ahtari.aspx" mappedUrl="~/City.aspx?CityID=989" /> <add url="~/Laajakaista/Aanekoski.aspx" mappedUrl="~/City.aspx?CityID=992" /> I tried to make a simple redirect like this: Redirect 301 Laajakaista/Aanekoski.aspx City.php?CityID=992 but was not able to get it to work. I ended up with an internal server error and a 50k .htaccess-file... Any help is greatly appreciated.

    Read the article

  • How to add an additional column in a table by comparing the values in a different column

    - by S-Man
    I have a table with the following records id name city 1 aaa NY 2 bbb NY 3 ccc LA 4 ddd LA 5 eee NY I want the table with an additional column by comparing the 'city' column. The values in the col4 should have '1' for every unique value in 'city' column and '0' for the repeating values in 'city' column. id name city col4 1 aaa NY 1 2 bbb NY 0 3 ccc LA 1 4 ddd LA 0 5 eee NY 0 I hope to get some help. Thanks

    Read the article

  • Jquery stop load function after too many clicks

    - by Sergio
    How can I stop loading function after user is clicked too many times on link? Jquery code looks like: $(document).ready(function(){ $(".menu_rfr").click(function() { $("#main").html('<img src="img/spin.gif" class="spin">'); location.replace($(this).attr('rel')); }); $(".menu_clickable").click(function() { $("#main").html('<img src="img/spin.gif" class="spin">'); $("#main").load($(this).attr('rel')); }); });

    Read the article

  • PHP matching a string

    - by John Jones
    Hi, I have an Indian company data set and need to extract the City and Zip from the address field: Address Field Example: Gowripuram West, Sengunthapuram Post, Near L.G.B., Karur, Tamilnadu, Karur - 639 002, India As you can see the City is Karur and the zip is followed after the - (hyphen). I need the PHP code to match [city] - [zip] Not sure how to do this I can find the Zip after the Hypen but not sure how to find the City, please note the City can be 2 words. Cheers for your time./ J

    Read the article

  • LINQ Query returns false when it should be true.

    - by deliriousDev
    I have the following LINQ query written by a former developer and it isn't working when it should. public bool IsAvailable(Appointment appointment) { var appointments = _appointmentRepository.Get; var shifts = _scheduleRepository.Get; var city = _customerRepository.Find(appointment.CustomerId).City ?? appointment.Customer.City; const int durationHour = 1; DateTime scheduledEndDate = appointment.ScheduledTime.Add(new TimeSpan(durationHour, 0, 0)); var inWorkingHours = shifts .Where(x => //Check if any available working hours x.Employee.City == city && x.ShiftStart <= appointment.ScheduledTime && x.ShiftEnd >= scheduledEndDate && //check if not booked yet !appointments .Where(a => (appointment.Id == 0 || a.Id != appointment.Id) && a.Employee.Id == x.Employee.Id && ( (a.ScheduledTime <= appointment.ScheduledTime && appointment.ScheduledTime <= EntityFunctions.AddHours(a.ScheduledTime, durationHour)) || (a.ScheduledTime <= scheduledEndDate && scheduledEndDate <= EntityFunctions.AddHours(a.ScheduledTime, durationHour)) )) .Select(a => a.Employee.Id) .Contains(x.Employee.Id) ); if (inWorkingHours.Any()) { var assignedEmployee = inWorkingHours.FirstOrDefault().Employee; appointment.EmployeeId = assignedEmployee.Id; appointment.Employee = assignedEmployee; return true; } return false; } The query is suppose to handle the following scenarios Given An Appointment With A ScheduledTime Between A ShiftStart and ShiftEnd time But Does not match any employees in same city - (Return true, Assign as "Unassigned") Given An Appointment With A ScheduledTime Between A ShiftStart and ShiftEnd time AND Employee for that shift is in the same city as the customer (Return True AND Assign to the employee) If the customer is NOT in the same city as an employee we assign the appointment as "Unassigned" as along as the scheduledTime is within an of the employees shift start/end times If the customer is in the same city as an employee we assign the appointment to one of the employees (firstOrdefault) and occupy that timeslot. Appointments CAN NOT overlap (Assigned Ones). Unassigned can't overlap each other. This query use to work (I've been told). But now it doesn't and I have tried refactoring it and various other paths with no luck. I am now on week two and just don't know where the issue in the query is or how to write it. Let me know if I need to post anything further. I have verified appointments, shifts, city all populate with valid data so the issue doesn't appear to be with null or missing data.

    Read the article

  • writing an Dynamic query in sqlserver

    - by prince23
    hi, DECLARE @sqlCommand varchar(1000) DECLARE @columnList varchar(75) DECLARE @city varchar(75) DECLARE @region varchar(75) SET @columnList = 'first_name, last_name, city' SET @city = '''London''' SET @region = '''South''' SET @sqlCommand = 'SELECT ' + @columnList + ' FROM dbo.employee WHERE City = ' + @city and 'region = '+@region --and 'region = '+@region print(@sqlCommand) EXEC (@sqlCommand) when i run this command i get an error Msg 156, Level 15, State 1, Line 8 Incorrect syntax near the keyword 'and'. and help would great thank you

    Read the article

  • Accessing child collection in query

    - by Gokul
    I am populating a list using List<Country> countries = new List<Country> { new Country() { CountryID = "US", City = new List<City> { new City() { CountryID = "US", CityName="dfdsf", sqkm = 2803 } } }; and so on How to access sqkm in the following query? var countryQuery = countries .Select(c => new { Id = c.CountryId, Area = c.City.sqkm???}); c.city.sqkm gives compilation error...how to modify query

    Read the article

  • WebGrid Helper and Complex Types

    - by imran_ku07
        Introduction:           WebGrid helper makes it very easy to show tabular data. It was originally designed for ASP.NET Web Pages(WebMatrix) to display, edit, page and sort tabular data but you can also use this helper in ASP.NET Web Forms and ASP.NET MVC. When using this helper, sometimes you may run into a problem if you use complex types in this helper. In this article, I will show you how you can use complex types in WebGrid helper.       Description:             Let's say you need to show the employee data and you have the following classes,   public class Employee { public string Name { get; set; } public Address Address { get; set; } public List<string> ContactNumbers { get; set; } } public class Address { public string City { get; set; } }               The Employee class contain a Name, an Address and list of ContactNumbers. You may think that you can easily show City in WebGrid using Address.City, but no. The WebGrid helper will throw an exception at runtime if any Address property is null in the Employee list. Also, you cannot directly show ContactNumbers property. The easiest way to show these properties is to add some additional properties,   public Address NotNullableAddress { get { return Address ?? new Address(); } } public string Contacts { get { return string.Join("; ",ContactNumbers); } }               Now you can easily use these properties in WebGrid. Here is the complete code of this example,  @functions{ public class Employee { public Employee(){ ContactNumbers = new List<string>(); } public string Name { get; set; } public Address Address { get; set; } public List<string> ContactNumbers { get; set; } public Address NotNullableAddress { get { return Address ?? new Address(); } } public string Contacts { get { return string.Join("; ",ContactNumbers); } } } public class Address { public string City { get; set; } } } @{ var myClasses = new List<Employee>{ new Employee { Name="A" , Address = new Address{ City="AA" }, ContactNumbers = new List<string>{"021-216452","9231425651"}}, new Employee { Name="C" , Address = new Address{ City="CC" }}, new Employee { Name="D" , ContactNumbers = new List<string>{"045-14512125","21531212121"}} }; var grid = new WebGrid(source: myClasses); } @grid.GetHtml(columns: grid.Columns( grid.Column("NotNullableAddress.City", header: "City"), grid.Column("Name"), grid.Column("Contacts")))                    Summary:           You can use WebGrid helper to show tabular data in ASP.NET MVC, ASP.NET Web Forms and  ASP.NET Web Pages. Using this helper, you can also show complex types in the grid. In this article, I showed you how you use complex types with WebGrid helper. Hopefully you will enjoy this article too.  

    Read the article

  • PHP, javascript, single quote problems with IE when passing variable from ajax post to javascript fu

    - by Mattis
    Hi! I have been trying to get this to work for a while, and I suspect there's an easy solution that I just can't find. My head feels like jelly and I would really appreciate any help. My main page.php makes a .post() to backend.php and fetches a list of cities which it echoes in the form of: <li onclick="script('$data');">$data</li> The list is fetched and put onto the page via .html(). My problem occurs when $data has a single quote in it. backend.php passes the variable just fine to page.php but when i run html() it throws a javascript error (in IE, not FF obviously); ')' is expected IE parses the single quote and messes up the script()-call. I've been trying to rebuild the echoed string in different ways, escaping the 's on the php side and/or on the javascript side - but in vain. Do I have to review the script in total? page.php $.post("backend.php", {q: ""+str+""}, function(data) { if(data.length >0) { $('#results').html(data); } backend.php while ($row = $q->fetch()) { $city = $row['City']; // $city = addslashes($row['City']); // $city = str_replace("'","&#39;",$row['City']); echo "<li onclick=\"script('$city');\">".$city."</li>"; }

    Read the article

  • nested attributes with polymorphic has_one model

    - by Millisami
    I am using accepts_nested_attributes_for with the has_one polymorphic model in rails 2.3.5 Following are the models and its associations: class Address < ActiveRecord::Base attr_accessible :city, :address1, :address2 belongs_to :addressable, :polymorphic => true validates_presence_of :address1, :address2, :city end class Vendor < ActiveRecord::Base attr_accessible :name, :address_attributes has_one :address, :as => :addressable, :dependent => :destroy accepts_nested_attributes_for :address end This is the view: - form_for @vendor do |f| = f.error_messages %p = f.label :name %br = f.text_field :name - f.fields_for :address_attributes do |address| = render "shared/address_fields", :f => address %p = f.submit "Create" This is the partial shared/address_fields.html.haml %p = f.label :city %br= f.text_field :city %span City/Town name like Dharan, Butwal, Kathmandu, .. %p = f.label :address1 %br= f.text_field :address1 %span City Street name like Lazimpat, New Road, .. %p = f.label :address2 %br= f.text_field :address2 %span Tole, Marg, Chowk name like Pokhrel Tole, Shanti Marg, Pako, .. And this is the controller: class VendorsController < ApplicationController def new @vendor = Vendor.new end def create @vendor = Vendor.new(params[:vendor]) if @vendor.save flash[:notice] = "Vendor created successfully!" redirect_to @vendor else render :action => 'new' end end end The problem is when I fill in all the fileds, the record gets save on both tables as expected. But when I just the name and city or address1 filed, the validation works, error message shown, but the value I put in the city or address1, is not persisted or not displayed inside the address form fields? This is the same case with edit action too. Though the record is saved, the address doesn't show up on the edit form. Only the name of the Client model is shown. Actually, when I look at the log, the address model SQL is not queried even at all.

    Read the article

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