Daily Archives

Articles indexed Friday April 16 2010

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

  • Hibernate Mapping Annotation Question?

    - by paddydub
    I've just started using hibernate and I'm trying to map walking distance between two coordinates into a hashmap, There can be many connections from one "FromCoordinate" to another "ToCoordinate". I'm not sure if i've implemented this correctly, What annotations do i need to map this MashMap? Thanks @Entity @Table(name = "COORDCONNECTIONS") public class CoordinateConnection implements Serializable{ private static final long serialVersionUID = -1624745319005591573L; /** auto increasing id number */ @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(name = "ID") @id private int id; @Embedded public FromCoordinate fromCoord; @Embedded public ToCoordinate toCoord; HashMap<Coordinate, ArrayList<Coordinate>> coordWalkingConnections = new HashMap<Coordinate, ArrayList<Coordinate>>(); } public class FromCoordinate implements ICoordinate { @Column(name = "FROM_LAT") private double latitude; @Column(name = "FROM_LNG") private double longitude; } public class ToCoordinate implements ICoordinate { @Column(name = "TO_LAT") private double latitude; @Column(name = "TO_LNG") private double longitude; @Column(name = "DISTANCE") private double distance; } DATABASE STRUCTURE id FROM_LAT FROM_LNG TO_LAT TO_LNG Dist 1 43.352669 -6.264341 43.350012 -6.260653 0.38 2 43.352669 -6.264341 43.352669 -6.264341 0.00 3 46.352669 -6.264341 43.353373 -6.262013 0.17 4 47.352465 -6.265865 43.351290 -6.261200 0.25 5 45.452578 -6.265768 43.352788 -6.264396 0.01 6 45.452578 -6.265768 45.782788 -6.234523 0.01 ..... ... . Example HashMap for HashMap<Coordinate, ArrayList<Coordinate>> <KEY{43.352669 -6.264341}, Arraylist VALUES{(43.350012,-6.260653,0.383657), (43.352669, -6.264341, 0.000095), (43.353373, -6.262013, 0.173201)}> <KEY{47.352465 -6.265865}, Arraylist VALUES{(43.351290,-6.261200,0.258781)}> <KEY{45.452578 -6.265768}, Arraylist VALUES{(43.352788,-6.264396,0.013726),(45.782788,-6.234523,0.017726)}>

    Read the article

  • Building vs. Compiling (Java)

    - by sixtyfootersdude
    Thinking that the answer to this is pretty obvious but here it goes: When I am working on a small project for school (in java) I "compile" it. On my coop we are using ant to "build" our project. I think that compiling is a subset of building. Is this correct? What is the difference between building and compiling?

    Read the article

  • NSArray multiply each argument

    - by seaworthy
    Is the there a way to multiply each NSNumber contained in the array by 10? Here is what I have so far: NSMutableArray *vertex = [NSMutableArray arrayWithCapacity:3]; [vertex addObject:[NSNumber numberWithFloat:1.0]]; [vertex addObject:[NSNumber numberWithFloat:2.0]]; [vertex addObject:[NSNumber numberWithFloat:3.0]]; [vertex makeObjectsPerformSelector:@selector(doSomethingToObject:)]; I am not sure what selector to use to do this, please help!

    Read the article

  • Getting the first result from a LINQ query - why does ElementAt<T>(0) fails when First<T>() succeeds

    - by Mr Roys
    I have a method AddStudent() which looks for a student with the same name and returns an existing student from the database if there is a student with the same name, otherwise it creates a new student and adds it to the database. I'm curious why se = students.First<StudentEntity>(); succeeds when se = students.ElementAt<StudentEntity>(0); fails when I try to get the first result from the LINQ query. Aren't the two methods the same? The full code for the method is shown below. public Student AddStudent(string name) { using (SchoolEntities db = new SchoolEntities()) { // find student with same name via LINQ var students = from s in db.StudentEntitySet where s.name == name select s; StudentEntity se = default(StudentEntity); // if student with the same name is already present, return // that student if (students.Count<StudentEntity>() > 0) { // if i use ElementAt, if fails with a "LINQ to Entities does not // recognize the method 'StudentEntity ElementAt[StudentEntity] // (System.Linq.IQueryable`1[StudentEntity], Int32)' method, // and this method cannot be translated into a store expression.", // but not when I use First. Why? // se = students.ElementAt<StudentEntity>(0); se = students.First<StudentEntity>(); } else { // passing 0 for first parameter (id) since it's represented by // a BigInt IDENTITY field in the database so any value // doesn't matter. se = StudentEntity.CreateStudentEntity(0, name); db.AddToStudentEntitySet(se); db.SaveChanges(); } // create a Student object from the Entity object return new Student(se); } } Thanks!

    Read the article

  • How can I allow NULL values in MySQL

    - by peakUC
    I was wondering how can I allow NULL values in the following code below along with keeping WHERE username = '$username'. here is the mysql code. "SELECT * FROM users WHERE username = '$username' AND user_id <> '$user_id'" I'm trying to check for usernames with the same username but I want all users to have a NULL value if they want.

    Read the article

  • gacutil - cannot launch on vista x64

    - by Berryl
    I thought this was a privilege issue but I logged on as admin and still couldn't get more than a brief flash of the command window. I am just double clicking on the exe file I found in the 7.0 sdk As a side question, can you just go into the GAC manually and delete something?? Cheers, Berryl

    Read the article

  • Permission Problem While Installing Module With CPAN

    - by neversaint
    I tried to following module using CPAN, but the message I get is the "I have neither the -x permission ..." . How can I resolve that? cpan[3]> install List::MoreUtils is it OK to try to connect to the Internet? [yes] Fetching with LWP: http://www.perl.org/CPAN/authors/id/V/VP/VPARSEVAL/List-MoreUtils-0.22.tar.gz CPAN: Digest::SHA loaded ok (v5.48) Fetching with LWP: http://www.perl.org/CPAN/authors/id/V/VP/VPARSEVAL/CHECKSUMS Checksum for /home/ewijaya/.cpan/sources/authors/id/V/VP/VPARSEVAL/List-MoreUtils-0.22.tar.gz ok Scanning cache /home/neversaint/.cpan/build for sizes .....I have neither the -x permission nor the permission to change the permission; cannot estimate disk usage of '/home/neversaint/.cpan/build/Module-Build-0.3607-Kvb1Vq' .I have neither the -x permission nor the permission to change the permission; cannot estimate disk usage of '/home/neversaint/.cpan/build/ExtUtils-ParseXS-2.2205-zuX4x2' ^CCaught SIGINT, trying to continue

    Read the article

  • Is there an equivalent in Scala to Python's more general map function?

    - by wheaties
    I know that Scala's Lists have a map implementation with signature (f: (A) => B):List[B] and a foreach implementation with signature (f: (A) => Unit):Unit but I'm looking for something that accepts multiple iterables the same way that the Python map accepts multiple iterables. I'm looking for something with a signature of (f: (A,B) => C, Iterable[A], Iterable[B] ):Iterable[C] or equivalent. Is there a library where this exists or a comparable way of doing similar?

    Read the article

  • What is the best way to move a UIToolbar?

    - by Ferdinand Rios
    Here is an interesting problem. On the iPhone, I have a view set up that has a toolbar on the bottom of the screen. I am currently trying to make this a universal app so that it runs on iPad as well. I would like the toolbar to be at the top of the iPad screen, so in the viewDidLoad method of the specific viewController I have the following code. if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) { //move the toolbar to the top of the page and move the webview down by the height of the toolbar CGRect toolBarFrame = self.aToolBar.frame; CGRect webFrame = self.aWebView.frame; webFrame.origin.y = toolBarFrame.size.height; [self.aWebView setFrame:webFrame]; toolBarFrame.origin.y = 0; [self.aToolBar setFrame:toolBarFrame]; [Utils errorString:[NSString stringWithFormat:@"origen: x=%f y=%f", self.aToolBar.frame.origin.x, self.aToolBar.frame.origin.y]]; [Utils errorString:[NSString stringWithFormat:@"origen: x=%f y=%f", self.aWebView.frame.origin.x, self.aWebView.frame.origin.y]]; } The problem I am having is that the webView moves down fine, but the toolbar only moves up to about what seems to be the height of a iPhone screen. The call to errorString tells me that the webView's origin is at 0,44 (where it should be) and that the toolbar's origin is at 0,0, but it is actually somewhere in the middle of the screen! Anybody have a clue what is going on here?

    Read the article

  • Intellij-Idea: Marking all files of unknown type be type: text (so that they are searchable)

    - by sixtyfootersdude
    Many of my scripts etc in intellij are marked with a question mark. Then when I click on them them it prompts me: The file "bla" cannot be associated with a registered file type. Please choose one: <insert table of file choices> This would not matter except the files are not searchable (with ctrl-shift-n) until they are marked as text. This is a major problem for me. I have an enormous code base and I don't want to mark all of the unknown files as text. Is there anyway that I can do that? *(Note: I have cross posted this to the intellij form

    Read the article

  • Convert MSSQL Varbinary field to MYSQL, keeping data intact

    - by Mike Sheridan
    I was given the daunting task of converting a ASP website to PHP and MSSQL to MySQL, and I ran into an issue that hopefully somebody can help I have a user table which has a password field with datatype Varbinary(128), are using pwdencrypt to encrypt the password. Is there a way to transfer that over to MySQL, and somehow i need to be able to keep the password intact... how can i go about that? any pointers would be greatly appreciated!

    Read the article

  • What is this obscure error in Google Analytics tracking code on a _trackEvent() call?

    - by Laizer
    I am calling the Google Analytics _trackEvent() function on a web page, and get back an error from the obfuscated Google code. In Firebug, it comes back "q is undefined". In Safari developer console: "TypeError: Result of expression 'q' [undefined] is not an object." As a test, I have reduced the page to only this call, and still get the error back. Besides the necessary elements and the standard Google tracking code, my page is: <script> pageTracker._trackEvent('Survey', 'Checkout - Survey', 'Rating', 3); </script> Results is that error. What's going on here?

    Read the article

  • Is there a way to use an inline PNG image in an Outlook e-mail?

    - by James McMahon
    In my work as a developer I sometimes find myself sending details emails with screenshots to illustrate some point or problem. The content of these screenshots is often text. So knowing that PNG is much better at handle compression of images with text, I save my screenshots as PNG and insert them into my email. However whenever I check my sent mail, the images are clearly being sent as a JPG because they look horribly compressed. I'm using Outlook 2003 as my email program. Is there some setting I can change to make Outlook send inline images as PNGs?

    Read the article

  • Needs clarification on C# Flags

    - by Jojo
    Hi guys, i have this code: [Flags] public enum MyUriType { ForParse, ForDownload, Unknown } and then: MyUriType uriType = MyUriType.ForDownload; but, I was wondering why this returns true: if ((uriType & MyUriType.ForParse) == MyUriType.ForParse) When it is not set in the second code group. Please advise.

    Read the article

  • How to recursively delete some xml elements using XSLT

    - by Monomachus
    Hi, So I got this situation which sucks. I have an XML like this <table border="1" cols="200 100pt 200"> <tr> <td>isbn</td> <td>title</td> <td>price</td> </tr> <tr> <td /> <td /> <td> <span type="champsimple" id="9b297fb5-d12b-46b1-8899-487a2df0104e" categorieid="a1c70692-0427-425b-983c-1a08b6585364" champcoderef="01f12b93-b4c5-401b-9da1-c9385d77e43f"> [prénom] </span> <span type="champsimple" id="e103a6a5-d1be-4c34-8a54-d234179fb4ea" categorieid="a1c70692-0427-425b-983c-1a08b6585364" champcoderef="01f12b93-b4c5-401b-9da1-c9385d77e43f">[nom]</span> <span></span> </td> </tr> <tr></tr> <tr> <td></td> <td>Phill It in</td> </tr> <tr> <table id="cas1"> <tr> <td ></td> <td >foo</td> </tr> <tr> <td >bar</td> <td >boo</td> </tr> </table> </tr> <tr> <table id="cas2"> <tr> <td ></td> <td >foo</td> </tr> <tr> <td ></td> <td >boo</td> </tr> </table> </tr> <tr> <table id="cas3"> <tr> <td >bar</td> <td ></td> </tr> <tr> <td >foo</td> <td >boo</td> </tr> </table> </tr> <tr> <table id="cas4"> <tr> <td /> <td /> </tr> <tr> <td>foo</td> <td>boo</td> </tr> </table> </tr> <table id="cas4"> <tr> <td /> <td /> </tr> <tr> <td>foo</td> <td>boo</td> </tr> </table> <tr> <td /> <td /> </tr> </table> Now the question is how would I recursively delete all empty td, tr and table elements? Now I use this XSLT <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output omit-xml-declaration="yes" indent="yes"/> <xsl:strip-space elements="*" /> <xsl:template match="node()|@*"> <xsl:copy> <xsl:apply-templates select="node()|@*"/> </xsl:copy> </xsl:template> <xsl:template match="td[not(node())]" /> <xsl:template match="tr[not(node())]" /> <xsl:template match="table[not(node())]" /> </xsl:stylesheet> But it doesn't do very well. After I delete td, a tr becomes empty but it doesn't handle that. Too bad. See the table element with "cas4". <table border="1" cols="200 100pt 200"> <tr> <td>isbn</td> <td>title</td> <td>price</td> </tr> <tr> <td> <span type="champsimple" id="9b297fb5-d12b-46b1-8899-487a2df0104e" categorieid="a1c70692-0427-425b-983c-1a08b6585364" champcoderef="01f12b93-b4c5-401b-9da1-c9385d77e43f"> [prénom] </span> <span type="champsimple" id="e103a6a5-d1be-4c34-8a54-d234179fb4ea" categorieid="a1c70692-0427-425b-983c-1a08b6585364" champcoderef="01f12b93-b4c5-401b-9da1-c9385d77e43f">[nom]</span> <span /> </td> </tr> <tr> <td>Phill It in</td> </tr> <tr> <table id="cas1"> <tr> <td>foo</td> </tr> <tr> <td>bar</td> <td>boo</td> </tr> </table> </tr> <tr> <table id="cas2"> <tr> <td>foo</td> </tr> <tr> <td>boo</td> </tr> </table> </tr> <tr> <table id="cas3"> <tr> <td>bar</td> </tr> <tr> <td>foo</td> <td>boo</td> </tr> </table> </tr> <tr> <table id="cas4"> <tr /> <tr> <td>foo</td> <td>boo</td> </tr> </table> </tr> <table id="cas4"> <tr /> <tr> <td>foo</td> <td>boo</td> </tr> </table> <tr /> </table> How would you solve this problem?

    Read the article

  • Use auto_ptr in VC6 dll cause crash

    - by Yan Cheng CHEOK
    // dll #include <memory> __declspec(dllexport) std::auto_ptr<int> get(); __declspec(dllexport) std::auto_ptr<int> get() { return std::auto_ptr<int>(new int()); } // exe #include <iostream> #include <memory> __declspec(dllimport) std::auto_ptr<int> get(); int main() { { std::auto_ptr<int> x = get(); } std::cout << "done\n"; getchar(); } The following code run perfectly OK under VC9. However, under VC6, I will experience an immediate crash with the following message. Debug Assertion Failed! Program: C:\Projects\use_dynamic_link\Debug\use_dynamic_link.exe File: dbgheap.c Line: 1044 Expression: _CrtIsValidHeapPointer(pUserData) Is it exporting auto_ptr under VC6 is not allowed? It is a known problem that exporting STL collection classes through DLL. http://stackoverflow.com/questions/2451714/access-violation-when-accessing-an-stl-object-through-a-pointer-or-reference-in-a However, I Google around and do not see anything mention for std::auto_ptr. Any workaround?

    Read the article

  • Absolutely positioned div on right causing scrollbar when the left doesn't

    - by Michael Snyder
    I'm trying to "flank" a centered div with some design elements that are absolutely positioned outside the main div's width. I'm getting a scroll bar due to the element on the right, but not the element on the left (IE6/7/8, Chrome, Firefox). How can I get rid of that horizontal scrollbar? <html> <head> <style type="text/css"> html, body { height: 100%; width: 100%; margin: 0; } body { text-align: center; } .wrapper { margin: 0 auto; position: relative; width: 960px; z-index: 0; } .main { background: #900; height: 700px; } .right, .left { position: absolute; height: 100px; width: 100px; } .right { background: #090; top: 0px; left: 960px; z-index: 1; } .left { background: #009; top: 0px; left: -100px; z-index: 1; } </style> </head> <body> <div class="wrapper"> <div class="main"></div> <div class="left"></div> <div class="right"></div> </div> </body> </html>

    Read the article

  • Simple Windows.Forms binding is failing using framework 4.0.

    - by jyoung
    This works under the .net framework 3.5 client. This fails under the .net framework 4.0 client. Was I doing something that was illegal under 3.5 but just happened to work, or is this a bug? Note that in my project 'PropInt' does not raise change events so using ctx[obj1.PropObj2, "PropInt"] is not an option. public class Obj1 { public Obj2 PropObj2 { get; set; } public Obj1() { PropObj2 = new Obj2(); } } public class Obj2 { public int PropInt { get; set; } } static class Program { [STAThread] static void Main() { var ctx = new BindingContext(); var obj1 = new Obj1(); var x1 = ctx[obj1, "PropObj2.PropInt"]; } }

    Read the article

  • strange MPMoviePlayer problem

    - by Rahul Vyas
    I am using mpmovieplayer in my application.I have a button for playing movie witch has an image of play.But when mpmovieplayer plays movie i can see that button on movie player's overlying controlls like when i pause movie i see my play button instead of movie player's default button.Also i have customized navigation bar and i can see that navbar when movie plays instead of default nav bar.I tried hiding button when playing movie but it didn't worked.Does Someone knows about this issue? also i am having cropping of video issues does someone knows about how to handle video orientation i mean i want full video in any orientation recorded video.Thanks

    Read the article

  • how to close popup using javascript with xml formatting

    - by Michael Robinson
    I bought this program that created a pretty nice imageuploader flash script however I can't get the Javascript function close window to close the popup and redirect the original page. here is the XML piece that defines the url's: <urls urlToUpload="upload.php?" urlOnUploadSuccess="http://www.home.com/purchase.html" urlOnUploadFail="http://www.home.com/tryagain.html" urlUpdateFlashPlayer="http://www.home.com/flashalternative.html" jsFunctionNameOnUpload=""/> This last line calls a javascript function on upload. The problem is I don't know what to call and where to put it. Here is the HTML file that is the popup: <HEAD> <title>Baublet Uploader</title> <script type="text/javascript" src="swfobject.js"></script> </HEAD> <BODY> <!-- Q-ImageUploader www.quadroland.com --> <div id="QImageUploader"> Flash Player stuff here </div> <script type="text/javascript"> // <![CDATA[ var so = new SWFObject("q_image_uploader.swf", "imageuploader", "650", "430", "9", "#FFFFFF"); so.addParam("scale", "noscale"); so.addParam("salign", "TL"); so.addVariable("AdditionalStringVariable","pass additional data here"); so.write("QImageUploader"); // ]]> </script> I found this Closing script I thought might work: <script language="javascript"> function close_window(page) { window.opener.location.href=page setTimeout(function(){window.close()},10); } </script> Does this go into the Popup HTML page above or would it be a separate close.js file in the root? Thanks, I'm really confused.

    Read the article

  • Mapping Hashmap of Coordinates in Hibernate with Annotation

    - by paddydub
    I've just started using hibernate and I'm trying to map walking distance between two coordinates into a hashmap, There can be many connections from one "FromCoordinate" to another "ToCoordinate". I'm not sure if i've implemented this correctly, What annotations do i need to map this MashMap? Thanks HashMap coordWalkingConnections = new HashMap(); @Entity @Table(name = "COORDCONNECTIONS") public class CoordinateConnection implements Serializable{ private static final long serialVersionUID = -1624745319005591573L; /** auto increasing id number */ @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(name = "ID") @id private int id; @Embedded public FromCoordinate fromCoord; @Embedded public ToCoordinate toCoord; HashMap<FromCoordinate, ArrayList<ToCoordinate >> coordWalkingConnections = new HashMap<FromCoordinate, ArrayList<ToCoordinate >>(); } public class FromCoordinate implements ICoordinate { @Column(name = "FROM_LAT") private double latitude; @Column(name = "FROM_LNG") private double longitude; } public class ToCoordinate implements ICoordinate { @Column(name = "TO_LAT") private double latitude; @Column(name = "TO_LNG") private double longitude; @Column(name = "DISTANCE") private double distance; } DATABASE STRUCTURE id FROM_LAT FROM_LNG TO_LAT TO_LNG Dist 1 43.352669 -6.264341 43.350012 -6.260653 0.38 2 43.352669 -6.264341 43.352669 -6.264341 0.00 3 46.352669 -6.264341 43.353373 -6.262013 0.17 4 47.352465 -6.265865 43.351290 -6.261200 0.25 5 45.452578 -6.265768 43.352788 -6.264396 0.01 6 45.452578 -6.265768 45.782788 -6.234523 0.01 ..... ... . Example HashMap for HashMap<Coordinate, ArrayList<Coordinate>> <KEY{43.352669 -6.264341}, Arraylist VALUES{(43.350012,-6.260653,0.383657), (43.352669, -6.264341, 0.000095), (43.353373, -6.262013, 0.173201)}> <KEY{47.352465 -6.265865}, Arraylist VALUES{(43.351290,-6.261200,0.258781)}> <KEY{45.452578 -6.265768}, Arraylist VALUES{(43.352788,-6.264396,0.013726),(45.782788,-6.234523,0.017726)}>

    Read the article

  • Can't concatenate 2 arrays in PHP

    - by alex
    I've recently learned how to join 2 arrays using the + operator in PHP. But consider this code... $array = array('Item 1'); $array += array('Item 2'); var_dump($array); Output is array(1) { [0]= string(6) "Item 1" } Why does this not work? Skipping the shorthand and using $array = $array + array('Item 2') does not work either. Does it have something to do with the keys?

    Read the article

  • Getting "undefined method" error on form select in cucumber

    - by zlog
    I'm trying to visit a page with cucumber, with: visit new_video_path but I get this error: undefined method `episode_id' for #<Video:0x22df8dc> (ActionView::TemplateError) On line #19 of app/views/videos/_form.html.erb ... 19: <%= select(:video, :episode_id, @episodes.collect {|e| [ e.title, e.id ] }, { :include_blank => true }) %> It loads fine in the browser, and the form processes fine too. What did I do wrong?

    Read the article

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