Search Results

Search found 6089 results on 244 pages for 'double'.

Page 23/244 | < Previous Page | 19 20 21 22 23 24 25 26 27 28 29 30  | Next Page >

  • LinqToSQL Double Insert issue

    - by Vaccano
    I have a WCF service with an object structure similar to this: public class MyClass { public List<MySubItem> SubItems { get; set; } } public class MySubItem { public List<MySubSubItem> SubSubItems { get; set; } } public class MySubSubItem { public string DataValue { get; set; } } public class MyClassDAL { public void InsertMyClass(MyClass myClass) { ctx.MyClasses.InsertOnSubmit(myClass); ctx.SubmitChanges(); } } Sometimes my client will call in with a MyClass that submits only half of the values that it has in the list SubSubItems. Later it calls the insert with the rest of the list. The problem is that when it does this I get a Primary Key violation. The reason is that it is trying to insert the MySubItem again (because there are more items in the SubSubItems owned by the same MySubItem object). How do I deal with this? Do I just call an Update? Do I have to try to separate them out (updates from inserts)? SQL Server 2008 has a really cool Merge functionally. Is there some way to access that from LinqToSQL?

    Read the article

  • Double Loaded event in WPF

    - by Simon
    I had some difficulties with bindng data to custom controll's value made by someone else so i used "Loaded" event to assign control's value during, but i've noticed that this event is fired up twice. How can i find out what's firing that event? (VS2008) Or mayby any solution would be expected :)

    Read the article

  • iframe.document.body.scrollHeight is double the correct value

    - by Dean J
    <iframe name="asdf" id="asdf" onload="change_height(this)" src="asdf.jsp" width="250" scrolling="no" frameborder="0"></iframe> function change_height(iframe) { if (document.all) { // IE. ieheight = iframe.document.body.scrollHeight; iframe.style.height = ieheight; } else { // Firefox. ffheight= iframe.contentDocument.body.offsetHeight; iframe.style.height = ffheight+ 'px'; } } ieheight is twice the actual height when this runs in IE7; haven't tested on IE6. It's the same value if I use scrollHeight or offsetHeight. It's the correct height in Firefox. Before I patch this by just dividing the IE value /2, what's the right way to do this?

    Read the article

  • Reading string value from Excel with HSSF but it's double

    - by egaga
    Hi, I'm using HSSF-POI for reading excel data. The problem is I have values in a cell that look like a number but really are strings. If I look at the format cell in Excel, it says the type is "text". Still the HSSF Cell thinks it's numeric. How can I get the value as a string? If I try to use cell.getRichStringValue, I get exception; if cell.toString, it's not the exact same value as in Excel sheet. Thanks! edit: until this gets resolved, I'll use new BigDecimal(cell.getNumericCellValue()).toString()

    Read the article

  • enclosing double quotes in array

    - by Jared
    Hi all I might be looking at this the wrong way, but I have a form that does its thing (sends emails etc etc) but I also put in some code to make a simple flatfile csv log with some of the user entered details. If a user accidentally puts in for instance 'himynameis","bob' this would either break the csv row (because the quotes weren't encapsulated) or if I use htmlspecialchars() and stripslashes() on the data, I end up with a ugly data value of 'himynameis&quot;,&quot;bob'. My question is, how can I handle the incoming data to cater for '"' being put in the form without breaking my csv file? this is my code for creating the csv log file. @$name = htmlspecialchars(trim($_POST['name'])); @$emailCheck = htmlspecialchars(trim($_POST['email'])); @$title = htmlspecialchars(trim($_POST['title'])); @$phone = htmlspecialchars(trim($_POST['phone'])); function logFile($logText) { $path = 'D:\logs'; $filename = '\Log-' . date('Ym', time()) . '.csv'; $file = $path . $filename; if(!file_exists($file)) { $logHeader = array('Date', 'IP_Address', 'Title', 'Name', 'Customer_Email', 'Customer_Phone', 'file'); $fp = fopen($file, 'a'); fputcsv($fp, $line); } $fp = fopen($file, 'a'); foreach ($logText as $record) { fputcsv($fp, $record); } } //Log submission to file $date = date("Y/m/d H:i:s"); $clientIp = getIpAddress(); //get clients IP address $nameLog = stripslashes($name); $titleLog = stripslashes($title); if($_FILES['uploadedfile']['error'] == 4) $filename = "No file attached."; //check if file uploaded and return $logText = array(array("$date", "$clientIp", "$titleLog", "$nameLog", "$emailCheck", "$phone", "$filename")); logFile($logText); //write form details to log Here is a sample of the incoming array data: Array ( [0] => Array ( [0] => 2010/05/17 10:22:27 [1] => xxx.xxx.xxx.xxx [2] => title [3] => """"himynameis","bob" [4] => [email protected] [5] => 346346 [6] => No file attached. ) ) TIA Jared

    Read the article

  • Komodo Double Indentation with Tab

    - by T. Stone
    In Komodo Edit, if I name the file *.django.html it gives me django syntax highlighting BUT it also indents with a tab character (8 spaces) instead of giving me the usual 4 space indent. How can I fix this? I've tried changing the value in Edit Preferences Editor Indentation Language Settings, but that seems to have no effect on it. The indentation works as normal (4 spaces) if I'm using any other extension (.py, .html, etc.). Ideas?

    Read the article

  • sqlite select query round of double value

    - by Scorpion
    I have stored location in my sqlite database. CREATE TABLE city ( latitude NUMERIC, longitude NUMERIC ) Below are the value :- latitude = 41.0776605;//actual value in db - NUMERIC stored as DB longitude = -74.170086;//actual value in db - NUMERIC stored as DB final String query = "SELECT * FROM city"; cursor = myDataBase.rawQuery(query, null); if (null != cursor) { while (cursor.moveToNext()) { Log.i(TAG, "Latitude == " + cursor.getDouble(cursor.getColumnIndex("latitude"))); Log.i(TAG, "Longitude == " + cursor.getDouble(cursor.getColumnIndex("longitude"))); } } Result :- Latitude = 40.4127 Longitude = -74.25252 I don't want round off this values. Is there any way to solve this problem.

    Read the article

  • Double linking array in Python

    - by cdecker
    Since I'm pretty new this question'll certainly sound stupid but I have no idea about how to approach this. I'm trying take a list of nodes and for each of the nodes I want to create an array of predecessors and successors in the ordered array of all nodes. Currently my code looks like this: nodes = self.peers.keys() nodes.sort() peers = {} numPeers = len(nodes) for i in nodes: peers[i] = [self.coordinator] for i in range(0,len(nodes)): peers[nodes[i%numPeers]].append(nodes[(i+1)%numPeers]) peers[nodes[(i+1)%numPeers]].append(nodes[i%numPeers]) # peers[nodes[i%numPeers]].append(nodes[(i+4)%numPeers]) # peers[nodes[(i+4)%numPeers]].append(nodes[i%numPeers]) The last two lines should later be used to create a skip graph, but that's not really important. The problem is that it doesn't really work reliably, sometimes a predecessor or a successor is skipped, and instead the next one is used, and so forth. Is this correct at all or is there a better way to do this? Basically I need to get the array indices with certain offsets from each other. Any ideas?

    Read the article

  • java double[][] - display as image

    - by joe_shmoe
    Hi all, just wondering if there is a simple way in java to display the contents of say 16x16 array of doubles [0..1] as a greyscale image (ala matlab)? using an unfamiliar matrix library, so I'd like to check that I'm on the right track. don't really care if it is slow or ugly, or if it requires external library - it's just there for a quick look, so as long as it works, I'm fine.

    Read the article

  • cocoa - IF failing for double?

    - by Mike
    I have a set of NSTimeIntervals like this: NSArray *mySet = [NSArray arrayWithObjects: [NSNumber numberWithDouble: time1], // [NSNumber numberWithDouble: time2], [NSNumber numberWithDouble: time3], nil]; // suppose that at this time // time1 = 0.00000 // time2 = 18.3200 // time3 = 21.6500 at some point in my code I want to test if currentTime is greater or equal to one of the times on the array, so I do // currentTime = 18.32 right now for (int i=0; i<[mySet count]; i++) { if (currentTime >= [[mySet objectAtIndex:i] doubleValue]) { NSLog(@"%d...", i); } } The output should be "1...2..." but the output is just "1..." when i = 1, it is comparing 18.32 to 18.32 and failing to recognize that the value is equal or greater than the other? WTF??? How can that be? thanks for any help.

    Read the article

  • Double confirmation on exit

    - by Sean
    I am trying to make it so that the user is prompted to confirm exiting my program in c#, but for some reason, if they say "yes" they would like to exit, the confirmation box would pop up again. I can't figure out why. if (MessageBox.Show("Are you sure you want to exit?", "Confirm exit", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) { e.Cancel = true; } else { Application.Exit(); }

    Read the article

  • How to get rid of the double scroll bar problem when using an iframe

    - by stu
    I've seen this problem on the web, and all the suggested solutions aren't working for me, so I thought I'd come here. I have a page that has an iframe. The top of the page is a dropdown menu, the rest of the page is the iframe. The idea like I'm sure everybody else does, is to have the menu stay stationary and the menu selection runs an application in the iframe. The contents of the iframe should scroll, but the page as a whole should not. I've tried putting the iframe width=height=100% inside a single table element also with width=height=100% but I get two scrollbars if I make the window too short vertically. Any suggestions?

    Read the article

  • Prevent automatic popToRootViewController on double-tap of UITabBarController

    - by NilObject
    The default behavior of a UITabBarController is to pop the contained UINavigationController to the root view controller when a particular tab is tapped a second time. I have a particular use case where I'm wanting this to not work automatically, and I'm having a hard time figuring out how to prevent this. Has anyone run into this, and if so, what did you do? Do I need to subclass UINavigationController and override popToRootViewController or is there a simpler way?

    Read the article

  • php: replacing double <br /> with </p><p>

    - by andufo
    i use nicEdit to write RTF data in my CMS. The problem is that it generates strings like this: hello first line<br><br />this is a second line<br />this is a 3rd line since this is for a news site, i much prefer the final html to be like this: <p>hello first line</p><p>this is a second line<br />this is a 3rd line</p> so my current solution is this: i need to trim the $data for <br /> at the start/end of the string replace <br /><br /> with </p><p> (one single <br /> is allowed). finally, add <p> at the start and </p> at the end i only have the 3rd step so far. can someone give me a hand with steps 1 and 2? function replace_br($data) { # step 3 $data = '<p>'.$data.'</p>'; return $data; } thanks! ps: it would be even better to avoid specific situations. example: "hello<br /><br /><br /><br /><br />too much space" -- those 5 breaklines should also be converted to just one "</p><p>"

    Read the article

  • Java method overloading + double dispatch

    - by Max
    Can anybody explain in detail the reason the overloaded method print(Parent parent) is invoked when working with Child instance in my test piece of code? Any pecularities of virtual methods or methods overloading/resolution in Java involved here? Any direct reference to Java Lang Spec? Which term describes this behaviour? Thanks a lot. public class InheritancePlay { public static class Parent { public void doJob(Worker worker) { System.out.println("this is " + this.getClass().getName()); worker.print(this); } } public static class Child extends Parent { } public static class Worker { public void print(Parent parent) { System.out.println("Why this method resolution happens?"); } public void print(Child child) { System.out.println("This is not called"); } } public static void main(String[] args) { Child child = new Child(); Worker worker = new Worker(); child.doJob(worker); } }

    Read the article

  • double left MYSQL join?

    - by Haroldo
    I've been trying left joins but as there are 2 joins, i think the problem is the 2nd join roots from table_B not table_A. i am not getting any results where there is the required data in the db. I am not getting a query error the query (simplified) SELECT events.*, ven.*, events_genres.* FROM events LEFT JOIN ven //OPTIONAL JOIN ON events.ven_id = ven.ven_id //OPTIONAL JOIN LEFT JOIN events_genres //REQUIRED JOIN ON events.event_id = events_genres.event_id //REQUIRED JOIN WHERE events.date >= '$this->now' AND WHERE events_genres.g_id = $g_id //REQUIRED MATCH ORDER BY date ven = optional, i'll have the info if its there. events_genres = required, i dont want any results that do not have a genre

    Read the article

  • Double associative array or indexed + associative array

    - by clover
    I'm undecided what's the best-practice approach for what I'm trying to do. I'm trying to enter data into an array where the data will look like this: apple color: red price: 2 orange color: orange price: 3 banana color: yellow price: 2 pineapple color: yellow price: 5 When I get input, let's say green apple (notice it's a combo of color + name of fruit), I'm going to check if the name of fruit part exists in the array and display its data (if it exists). What's the right way to compose those arrays? How would I do an indexed array containing an associative array? (or would this be better as 2 nested associative arrays, I'm guessing not)

    Read the article

  • Vim replacing tabs with double spaces

    - by oxinabox.ucc.asn.au
    So I've written some code of an assignment and i forgot the universities polocy of indent with 2spaces. Normally I'ld have put a: vim: ts=2:tw=2: et: at the top of my files, but this time i forgot. How should I go about replacing all tabs with 2 space? would s// work? (repalcing and with the respectiove characters.

    Read the article

  • CSS RGBA border / background alpha double

    - by stockli
    I'm working on a website that has a lot of transparency involved, and I thought I would try to build it entirely in RGBA and then do fallbacks for IE. I need a "facebox" style border effect, where the outer border is rounded and is less opaque than the background of the box it surrounds. The last example from http://24ways.org/2009/working-with-rgba-colour seems to suggest that it's possible, but I can't seem to get it to work. When I try the following: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> <title>RGBA Test</title> <style type='text/css'> body { background: #000; color: #fff; } #container { width: 700px; margin: 0 auto; background: rgba(255, 255, 255, 0.2); border: 10px solid rgba(255, 255, 255, 0.1); padding: 20px; } </style> </head> <body> <div id='container'> This should look like a facebox. </div> </body></html> It seems like the background "extends" underneath the border of the element, which causes the pixel values to get added together. Thus, when both the background and the border are semi-transparent, the border will ALWAYS be more opaque than the background of the element. This is exactly the opposite of what I am trying to achieve, but it seems like it should be possible based on the examples I've seen. I should also add that I can't use another element inside the container, because I'm also going to use a border-radius on the container to get rounded corners, and webkit squares the corners of the child elements if they have a background assigned, which would essentially mean a rounded outer border with square contents. Sorry I can't post an image of this... Apparently I don't have enough rep to post an image.

    Read the article

  • Counting common Bytes, Words and Double Words.

    - by Recursion
    I am scanning over a large amount of data and looking for common trends in it. Every time I meet a recurrence of a unit, I want to increment the count of it. What is the best data structure or way to hold this data. I need to be able to search it quickly, and also have a count with each unit of data.

    Read the article

  • Double pointer const-correctness warnings in C

    - by Michael Koval
    You can obviously cast a pointer to non-const data to a a pointer of the same type to const data: int *x = NULL; int const *y = x; Adding additional const qualifiers to match the additional indirection should logically work the same way: int * *x = NULL; int *const *y = x; /* okay */ int const *const *z = y; /* warning */ Compiling this with GCC or Clang with the -Wall flag, however, results in the following warning: test.c:4:23: warning: initializing 'int const *const *' with an expression of type 'int *const *' discards qualifiers in nested pointer types int const *const *z = y; /* warning */ ^ ~ Why does adding an additional const qualifier "discard qualifiers in nested pointer types"?

    Read the article

  • jQuery Address double load on init

    - by dazhall
    Hi All! I'm using jQuery Address to load in my content, but it's doing it twice on the init. I set it up so that if you go to the main category it loads the first image, but it's doing it twice and I'm not sure how to stop it. A fresh pair of eyes would be appreciated! $.address.init(function(event) { $('#carousel-clip a').address(); if(!event.pathNames[0]) { var url = $('#carousel-clip ul li:first a').attr('href').replace('#!/',''); $.address.path(url); } }).change(function(event) { if(event.pathNames[0]) { $.getJSON(location.pathname + 'image/' + event.pathNames[0] + '/', function(data, textStatus, XMLHttpRequest) { handler(data); }); } }); You can see it working here: http://bit.ly/cKftwA Thanks! Darren.

    Read the article

< Previous Page | 19 20 21 22 23 24 25 26 27 28 29 30  | Next Page >