Daily Archives

Articles indexed Saturday March 13 2010

Page 13/89 | < Previous Page | 9 10 11 12 13 14 15 16 17 18 19 20  | Next Page >

  • How to refer to the true 'body' of a page? [NOT iFrame body]

    - by Jim
    I have a script that create a new div element. Then, I want to append the div to the body of the page using appendChild method. The script is look like this : var div = document.createElement('div'); div.id = 'newdiv'; document.body.appendChild(div); Unfortunately, the div also appended to the body of iframes. So, my question is, how to refer to the true body of the document, not including the body of the iframes? That way, the div just appended once, to the "true body" of the document. Thanks before, and sorry if my english is bad. :-D

    Read the article

  • Run java thread at specific times

    - by rmarimon
    I have a web application that synchronizes with a central database four times per hour. The process usually takes 2 minutes. I would like to run this process as a thread at X:55, X:10, X:25, and X:40 so that the users knows that at X:00, X:15, X:30, and X:45 they have a clean copy of the database. It is just about managing expectations. I have gone through the executor in java.util.concurrent but the scheduling is done with the scheduleAtFixedRate which I believe provides no guarantee about when this is actually run in terms of the hours. I could use a first delay to launch the Runnable so that the first one is close to the launch time and schedule for every 15 minutes but it seems that this would probably diverge in time. Is there an easier way to schedule the thread to run 5 minutes before every quarter hour?

    Read the article

  • IB Linking iPad SplVC table view

    - by Sam Jarman
    hey guys When you have an iPad Project, and you want to put a table view in your landscape view... I did this i dragged in a UITableView. but what do you 'hook' the data source to? there are about 3 options that all seem to crahing for me... when not hooked up, app launches fine. Any help would be appreciated. Cheers Sam

    Read the article

  • HttpServletResponse XML to Java

    - by Mike
    I am maintaining this servlet that has a HttpServletResponse response that replies back to the client an XML message. I want to take the XML message and convert it to JSON, then send the JSON back. I want to avoid writing my own JSON converter if possible. Does anyone have a good method of doing this? I googled for this: http://pvoss.wordpress.com/2009/02/26/servlet-filter-to-convert-xml-to-json/ , which is exactly what I want but they are using a hacked dom4j jar which doesn't help me.

    Read the article

  • how to serialize / deserialize classes defined in .proto (protobuf)

    - by make
    Hi, Could someone please help me with serialization/deserialization classes defined in .proto (protobuf). here is an exp that I am trying to build: file.proto message Data{ required string x1 = 1; required uint32 x2 = 2; required float x3 = 3; } message DataExge { repeated Data data = 1; } client.cpp ... void serialize(const DataExge &data_snd){ try { ofstream ofs("DataExge"); data_snd.SerializeToOstream(&ofs); } catch(exception &e) { cerr << "serialize/exception: " << e.what() << endl; exit(1); } } void deserialize(DataExge &data_rec){ try { ifstream ifs("DataExge"); data_rec.ParseFromIstream(&ifs); } catch(exception& e) { cerr << "deserialize/exception: " << e.what() << endl; exit(1); } } int main(){ ... DataExge dataexge; Data *dat = dataexge.add_data(); char *y1 = "operation1"; uint32_t y2 = 123 ; float y3 = 3.14; // assigning data to send() dat->set_set_x1(y1); dat->set_set_x2(y2); dat->set_set_x3(y3); //sending data to the client serialize(dataexge); if (send(socket, &dataexge, sizeof(dataexge), 0) < 0) { cerr << "send() failed" ; exit(1); } //receiving data from the server deserialize(dataexge); if (recv(socket, &dataexge, sizeof(dataexge), 0) < 0) { cerr << "recv() failed"; exit(1); } //printing received data cout << dat->x1() << "\n"; cout << dat->x2() << "\n"; cout << dat->x3() << "\n"; ... } server.cpp ... void serialize(const DataExge &data_snd){ try { ofstream ofs("DataExge"); data_snd.SerializeToOstream(&ofs); } catch(exception &e) { cerr << "serialize/exception: " << e.what() << endl; exit(1); } } void deserialize(DataExge &data_rec){ try { ifstream ifs("DataExge"); data_rec.ParseFromIstream(&ifs); } catch(exception& e) { cerr << "deserialize/exception: " << e.what() << endl; exit(1); } } int main(){ ... DataExge dataexge; Data *dat = dataexge.add_data(); //receiving data from the client deserialize(dataexge); if (recv(socket, &dataexge, sizeof(dataexge), 0) < 0) { cerr << "recv() failed"; exit(1); } //printing received data cout << dat->x1() << "\n"; cout << dat->x2() << "\n"; cout << dat->x3() << "\n"; // assigning data to send() dat->set_set_x1("operation2"); dat->set_set_x2(dat->x2() + 1); dat->set_set_x3(dat->x3() + 1.1); //sending data to the client serialize(dataexge); //error// I am getting error at this line ... if (send(socket, &dataexge, sizeof(dataexge), 0) < 0) { cerr << "send() failed" ; exit(1); } ... } Thanks for your help and replies -

    Read the article

  • overlay text on some else's window - HUD

    - by taglius
    I am interested in writing an app that overlays a small heads up display (HUD) over another application, in VB.NET. Does anyone have an example of this? I will need to enumerate all open windows to find the window that I want, and then overlay some text in a specific position on the window. If the user moves that window, my text will need to follow. (I will probably be painting the text in a loop over and over). Edit: nobody answered my original query - I added C# to the keywords to see if any of gurus in that language might have an answer. thanks.

    Read the article

  • PHP: Opening/closing tags & performance?

    - by Tom
    Hi, This may be a silly question, but as someone relatively new to PHP, I'm wondering if there are any performance-related issues to frequently opening and closing PHP tags in HTML template code, and if so, what might be best practices in terms of working with php tags? My question is not about the importance/correctness of closing tags, or about which type of code is more readable than another, but rather about how the document gets parsed/executed and what impact it might have on performance. To illustrate, consider the following two extremes: Mixing PHP and HTML tags: <?php echo '<tr> <td>'.$variable1.'</td> <td>'.$variable2.'</td> <td>'.$variable3.'</td> <td>'.$variable4.'</td> <td>'.$variable5.'</td> </tr>' ?> // PHP tag opened once Separating PHP and HTML tags: <tr> <td><?php echo $variable1 ?></td> <td><?php echo $variable2 ?></td> <td><?php echo $variable3 ?></td> <td><?php echo $variable4 ?></td> <td><?php echo $variable5 ?></td> </tr> // PHP tag opened five times Would be interested in hearing some views on this, even if it's just to hear that it makes no difference. Thanks.

    Read the article

  • "Can´t open socket or connection refused" with .NET

    - by HoNgOuRu
    Im getting a connection refused when I try to send some data to my server app using netcat. server side: IPAddress ip; ip = Dns.GetHostEntry("localhost").AddressList[0]; IPEndPoint ipFinal = new IPEndPoint(ip, 12345); Socket socket = new Socket(AddressFamily.InterNetworkV6, SocketType.Stream, ProtocolType.Tcp); socket.Bind(ipFinal); socket.Listen(100); Socket handler = socket.Accept(); ------> it stops here......nothing happens

    Read the article

  • libevent buffered events and half-closed sockets

    - by Vi
    It is simple to implement a port mapper using bufferevent_* functions of libevent. However, the documentation states that "This file descriptor is not allowed to be a pipe(2)". Will libevent work correctly if I shutdown the socket in one direction shutdown(socket, SHUT_WR);? I expect it to discard remaining data in the buffer and not write there anymore, but continue reading from socket and calling a read handler.

    Read the article

  • jQuery Highlight Radio Labels Only

    - by Michael
    I'm trying to use jQuery validation to highlight the labels for my radio buttons only, and not the labels for my other inputs. I have a label for my radio button set called 'type'. I can't seem to get it to work! $(document).ready(function(){ $("#healthForm").validate({ highlight: function(element, errorClass) { $(element).addClass(errorClass) $(element.form).find("label[for='type']") .addClass("radioerror"); }, unhighlight: function(element, errorClass) { $(element).removeClass(errorClass) $(element.form).find("label[for='type']") .removeClass("radioerror"); }, errorPlacement: function(error, element) { } }); });

    Read the article

  • What is the best practice for including third party jar files in a Java program?

    - by ZoFreX
    I have a program that needs several third-party libraries, and at the moment it is packaged like so: zerobot.jar (my file) libs/pircbot.jar libs/mysql-connector-java-5.1.10-bin.jar libs/c3p0-0.9.1.2.jar As far as I know the "best" way to handle third-party libs is to put them on the classpath in the manifest of my jar file, which will work cross-platform, won't slow down launch (which bundling them might) and doesn't run into legal issues (which repackaging might). The problem is for users who supply the third party libraries themselves (example use case, upgrading them to fix a bug). Two of the libraries have the version number in the file, which adds hassle. My current solution is that my program has a bootstrapping process which makes a new classloader and instantiates the program proper using it. This custom classloader adds all .jar files in lib/ to its classpath. My current way works fine, but I now have two custom classloaders in my application and a recent change to the code has caused issues that are difficult to debug, so if there is a better way I'd like to remove this complexity. It also seems like over-engineering for what I'm sure is a very common situation. So my question is, how should I be doing this?

    Read the article

  • What's the best way to move "a child up" in a C# XmlDocument?

    - by Mike
    Hi everyone, Given an xml structure like this: <garage> <car>Firebird</car> <car>Altima</car> <car>Prius</car> </garage> I want to "move" the Prius node "one level up" so it appears above the Altima node. Here's the final structure I want: <garage> <car>Firebird</car> <car>Prius</car> <car>Altima</car> </garage> So given the C# code: XmlNode priusNode = GetReferenceToPriusNode() What's the best way to cause the priusNode to "move up" one place in the garage's child list? Thanks! -Mike

    Read the article

  • Using PHP's IMAP library triggers Kaspersky's Antivirus

    - by TMG
    Hello, I just started today working with PHP's IMAP library, and while imap_fetchbody or imap_body are called, it is triggering my Kaspersky antivirus. The viruses are Trojan.Win32.Agent.dmyq and Trojan.Win32.FraudPack.aoda. I am running this off a local development machine with XAMPP and Kaspersky AV. Now, I am sure there are viruses there since there is spam in the box (who doesn't need a some viagra or vicodin these days?). And I know that since the raw body includes attachments and different mime-types, bad stuff can be in the body. So my question is: are there any risks using these libraries? I am assuming that the IMAP functions are retrieving the body, caching it to disk/memory and the AV scanning it sees the data. Is that correct? Are there any known security concerns using this library (I couldn't find any)? Does it clean up cached message parts perfectly or might viral files be sitting somewhere? Is there a better way to get plain text out of the body than this? Right now I am using the following code (credit to Kevin Steffer): function get_mime_type(&$structure) { $primary_mime_type = array("TEXT", "MULTIPART","MESSAGE", "APPLICATION", "AUDIO","IMAGE", "VIDEO", "OTHER"); if($structure->subtype) { return $primary_mime_type[(int) $structure->type] . '/' .$structure->subtype; } return "TEXT/PLAIN"; } function get_part($stream, $msg_number, $mime_type, $structure = false, $part_number = false) { if(!$structure) { $structure = imap_fetchstructure($stream, $msg_number); } if($structure) { if($mime_type == get_mime_type($structure)) { if(!$part_number) { $part_number = "1"; } $text = imap_fetchbody($stream, $msg_number, $part_number); if($structure->encoding == 3) { return imap_base64($text); } else if($structure->encoding == 4) { return imap_qprint($text); } else { return $text; } } if($structure->type == 1) /* multipart */ { while(list($index, $sub_structure) = each($structure->parts)) { if($part_number) { $prefix = $part_number . '.'; } $data = get_part($stream, $msg_number, $mime_type, $sub_structure,$prefix . ($index + 1)); if($data) { return $data; } } // END OF WHILE } // END OF MULTIPART } // END OF STRUTURE return false; } // END OF FUNCTION $connection = imap_open($server, $login, $password); $count = imap_num_msg($connection); for($i = 1; $i <= $count; $i++) { $header = imap_headerinfo($connection, $i); $from = $header->fromaddress; $to = $header->toaddress; $subject = $header->subject; $date = $header->date; $body = get_part($connection, $i, "TEXT/PLAIN"); }

    Read the article

  • What is the total amount of public IPv4 addresses?

    - by Earlz
    Yes, I am needing to know what the total number possible IPs in the public IPv4 space. I'm not sure where to even get a neat list of all the IP address ranges, so could someone point me to a resource to calculate this myself or calculate the total number of IPs for me? Also, by Public IPs I mean not counting reserved or private-range IP addresses.. Only the ones that can be access through the internet.

    Read the article

  • Issues running python scripts in Command Prompt (Specifically with command line arguments)?

    - by dmanatunga
    I am trying to run my python scripts in DOS without calling python.exe first. I am specifically doing this in relation to running django-admin.py. I have C:\Python26 and C:\Python26\Scripts in my PATH. However, if I try running django-admin.py by doing: django-admin.py startproject helloworld I get the message: Type 'django-admin.py help' for usage. Now, after some experimentation, I realized the problem is that the secondary arguments to these scripts are not being passed for some reason, since I tried it with a some other python scripts I have. I know I could avoid this problem by simply doing: python C:\Python26\Scripts\django-admin.py startproject helloworld But I know it should be possible to run the first command only and get it to work, because I had it working before. I've looked everywhere, and not many places have been helpful so any idea would be useful for me at this point.

    Read the article

  • Can documents indexed with Solr on JDK6 be retrieved using only lucene api on JDK1.4?

    - by huynhjl
    My runtime environment is still on JDK1.4 but I like the Solr features related to how documents are ingested and indexed. Would I be able to index my documents using Solr offline on a recent version of the JDK, copy the index over and use it in my runtime environment with an older version of the JDK? Version wise, Solr 1.4.0 uses Apache Lucene 2.9.1 which is JDK1.4 compatible. (but Solr itself requires JDK5). Assuming what I'm trying to do is even possible, what features would I lose if I search Solr indices only with the Lucene API?

    Read the article

  • MSDN Subscription Question for the lone developer

    - by BrianLy
    I'm looking to get an MSDN Subscription and I see a number of sites offering 2 year subscriptions versions. Are these sites offering a regular version that I can buy or are they for Software Assurance customers only? I don't want to buy one and find out I cannot activate it because I'm not associated with a company that has SA.

    Read the article

  • UVa #112 Tree Summing

    - by unclerojelio
    I'm working on UVa #112 Tree Summing. I have what I think should be a working solution but it is not accepted by the online judge due to a basic misunderstanding of the problem on my part. Consider the following inputs: -1 (-1()()) 77 (77(1()())()) or diagrammatically, the trees look like: -1 77 / \ / \ () () 1 () / \ () () According to at least two working solutions, the correct output for the above inputs is: yes no However, I don't understand why the second one should be 'no'. It looks to me like the rightmost path of the tree should give the proper sum. What am I missing?

    Read the article

  • Multi-platform development from one computer

    - by iama
    I am planning to build a new development computer for both Windows & Linux platforms. On Windows, my development would be primarily in .NET/C#/IIS/MSSQL Server. On Linux—preferably Ubuntu—my development would be in Ruby and Python. I am thinking of buying a laptop with Windows 7 pre-installed with 4GB RAM, Intel Core 2 Duo, and 320 GB HD; running 2 VMs for both Windows and Linux development with the host OS as my work station. Of course, I would be running DBs and web servers on the respective platforms. Is this a typical setup? My only concern is running two VMs side by side. Not sure if this configuration would be optimal. Alternative would be to do my Windows development on the host Windows 7 OS. What are your thoughts?

    Read the article

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