Search Results

Search found 1689 results on 68 pages for 'andrew 1510'.

Page 55/68 | < Previous Page | 51 52 53 54 55 56 57 58 59 60 61 62  | Next Page >

  • Can JAXB store the class name in the XML so that the the deserialize code doesn't need knowledge of the class?

    - by Andrew
    It seems the standard approach for deserializing JAXB XML is to specify the package name when creating the context. Then, JAXB looks up the class based on the root element: JAXBContext jc = JAXBContext.newInstance("com.foo"); Unmarshaller u = jc.createUnmarshaller(); Object o = u.unmarshal(new StringReader("...")); I'm looking for a more flexible approach where I don't have to specify the package name and could still deserialize any object. This would be as simple as JAXB storing the package in the XML, but I can't seem to find out how to do this. I can write the code to do it myself but that would be unpleasant. It would like JAXB to do it, if possible. BTW, I am not using schemas, just Annotations and marshal/unmarshal. Any ideas?

    Read the article

  • Can I cache a ManyToOne hibernate object without it being lazy loaded?

    - by Andrew
    @ManyToOne @JoinColumn(name = "play_template_id", table = "team_play_mapping" ) public Play getPlay() { return play; } public void setPlay( Play play ) { this.play = play; } By default, this is eager loading. Can I get it so that it will read the play object from a cache without making it lazy loading? Am I correct that eager loading will force it to do a join query and hence no caching?

    Read the article

  • Excel - Programming Cells

    - by Andrew
    I just started programming in Excel and I have a problem figuring some code out. I have created a work schedule in Excel with lists in order to add new people. I wanted to create a macro in which the user inputs a value in a cell (I chose B3) and depending on that 'start time' in cell B3, the headers for the lists all change to correspond with that starting time. For example: B3 says 5:00 am. All the headers will follow with: 5:00 am, 6:00 am, 7:00 am, etc. of course the headers will move at some point so I'm wondering how do you point to a cell that moves too?

    Read the article

  • nonatomic property in model class when using NSOperationQueue (iPhone)?

    - by Andrew B.
    I have a custom model class with an NSMutableData ivar that will be accessed by custom NSOperation subclasses (using an NSOperationQueue). I think I can guarantee thread-safe access to the ivar from multiple NSOperations by using dependencies, and I can guarantee that I don't access the ivar from other code (say my main app thread) by waiting until the Q has finished all operations. Should I use a nonatomic property specification, or leave it atomic? Is there a significant impact on performance?

    Read the article

  • Is it possible to store only a checksum of a large file in git?

    - by Andrew Grimm
    I'm a bioinformatician currently extracting normal-sized sequences from genomic files. Some genomic files are large enough that I don't want to put them into the main git repository, whereas I'm putting the extracted sequences into git. Is it possible to tell git "Here's a large file - don't store the whole file, just take its checksum, and let me know if that file is missing or modified." If that's not possible, I guess I'll have to either git-ignore the large files, or, as suggested in this question, store them in a submodule.

    Read the article

  • Is it possible to use .data() as a search criteria?

    - by Andrew
    I have a pretty complex chat application going on, and there are multiple chat panes, chat entries, chat submits, etc. going on in the same window. At first I was going to do something like.... <input type="text" class="chattext" id="chattext-42"> <input type="text" class="chattext" id="chattext-93"> <input type="button" class="chatsubmit" id="chatsubmit-42"> <input type="button" class="chatsubmit" id="chatsubmit-93"> ... etc. (of course this is vastly simplified, they'd be in separate divs, separate visibilities, etc) So, when they clicked on a .chatsubmit, it would then get the id of that and find the last two characters for the chat ID. This presents some problems, as it would require rewrites if IDs changed lengths, and seems just plain inelegant to me. I then remembered the .data() facility in jQuery... I thought, maybe I could do it more like this: <input type="text" class="chattext"> ... and add a .data("id", 42) to this one <input type="button" class="chatsubmit"> ... and add a .data("id", 42) So that when they click chatsubmit, it gets the ID, and then finds the chattext with that ID and processes it. But looking at the documentation, I don't see an easy way to search by this. For example, let's say the event target in this case is the chatsubmit with the data('id') of 42... var ID = $(event.target).data('id'); // Sets it to 42 var chattext = ... And here I run into the trouble. How do I find which DOM element matches a class of chattext and a data('id') of 42? Is there any easy method, or do I have to search every .chattext for the one with an id of 42? Or is there another easy way of doing this? I did consider the possibility of the container div having the ID, which would make it, I think,? slightly easier to get. But if this works, it could be dealing with things in other container divs as well, making that not a long-term solution. Edit: Literally seconds after posting this, I found this: http://james.padolsey.com/javascript/extending-jquerys-selector-capabilities/ which includes information on extending the selector to data. So I'll try that out, and in the meantime, is this a completely foolhardy way of handling this?

    Read the article

  • Projects to learn Python

    - by Andrew
    I know this isn't a question about a specific snippet of code or anything, but here goes - I've been messing around with the idea of learning Python since I'm pretty bored with PHP (and web development in general), but I can't think of any projects to help me learn. I've already worked through some of Project Euler with Python, but it's getting old. I know the basics, and I want to write something more fun that will introduce me to new things in Python. Is there a cliche beginner project for Python? (for example, PHP's would be a blog or something similiar) Are there any common Python projects for newcomers, or any uncommon ones that you'd suggest? Any ideas would help.

    Read the article

  • Navigating sorted XML data (XSLT)

    - by Andrew Parisi
    I have an XML file with company data in it, for 30 companies across 8 industries, on a portfolio page. The user has the option to sort this data by Industry, and this XML file will be added to constantly. This sorting is done in my XSL file using <xsl:choose>. Example: <xsl:when test="(invest[@investid='con'])"> <xsl:for-each select="$invest-port/portfolio/company[@industry='Communications']"> <xsl:sort select="name" /> <div class="invest-port-thumb"> <a> <xsl:attribute name="href"> <xsl:value-of select="link" /> </xsl:attribute> </a> </div> </xsl:for-each> </xsl:when> When navigating to an individual company's page, there are "previous" and "next" buttons at the bottom of the window. My issue is that I need these to dynamically link to the previous and next elements from within the XML data that has been sorted. Is this possible? Or is there an easier way to do this? (such as place each company in industry-divided XML files instead of one) Any insight would be greatly appreciated!

    Read the article

  • asp.net mvc. Inserting string data from model into javascript. best-practice

    - by Andrew Florko
    Hello everybody, I have to populate javascript code in html layout (hidden fields, method params) with string data from model. Html.Encode is not appropriate for my task because it encodes ' symbol, bypass : (that ruines object attributes declaration) and so on. I wrote static helper class that is used from View like this: alert('<%=ViewHelper.MakeJavaScriptSafe(Model.Message)%>'); I hope there is asp.net in-built function I don't know about for this task. Does it exist really? Thank you in advance.

    Read the article

  • JQuery. Layout is shaking during animation

    - by Andrew Florko
    Hello everybody, JQuery accordion animation (as well as simple hides / shows) looks weird with some browsers (IE, Opera). But Fire Fox and Chrome renders animation perfectly without artifacts. Html layout tends to shake with IE / Opera during animation as if surrounding paddings / margins are changed for small random value. How can I minimize this effect. Is it jquery bug or browsers issue?

    Read the article

  • CTRL+mouse wheel in gvim (windows) not paging

    - by andrew
    Hello, I'm loving vim, but one thing that's bugging me is that when I hold the control key and mouse wheel up or down, the window scrolls normally when the bindings are telling it to page up/down. I'm using the exact same vimrc file (and plugins) on one of my linux machines and the CTRL+mouse wheel does page up down (as opposed to just normally scrolling like in windows). Is there some way to force gvim to response to a ctrl+MouseUp/Down event? It seems to be ignoring it in windows ='[

    Read the article

  • C++ Word-Number to int

    - by Andrew
    I'm developing a program that makes basic calculations using words instead of numbers. E.g. five + two would output seven. The program becomes more complex, taking input such as two_hundred_one + five_thousand_six (201 + 5006) Through operator overloading methods, I split each number and assign it to it's own array index. two would be [0], hundred is [1], and one is [2]. Then the array recycles for 5006. My problem is, to perform the actual calculation, I need to convert the words stored in the array to actual integers. I have const string arrays such as this as a library of the words: const string units[] = { "", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine" }; const string teens[] = { "ten", "eleven", "twelve", "thirteen", "fourteen", "fifteen", "sixteen", "seventeen", "eighteen", "nineteen" }; const string tens[] = { "", "", "twenty", "thirty", "forty", "fifty", "sixty", "seventy", "eighty", "ninety" }; If my 'token' array has stored in it two hundred one in index 0, 1, and 2, I'm not sure what the best way to convert these to ints would involve.

    Read the article

  • Easy way to keep counting up infinitely

    - by Andrew Alexander
    What's a good way to keep counting up infinitely? I'm trying to write a condition that will keep going until there's no value in a database, so it's going to iterate from 0, up to theoretically infinity (inside a try block, of course). How would I count upwards infinitely? Or should I use something else? I am looking for something similar to i++ in other languages, where it keeps iterating until failure.

    Read the article

  • Working with PHP and MySQL - need a good and secure design with OO design

    - by Andrew
    I am new to PHP- first time developer. I am working on my web application and it is nearly done; nevertheless, most of my sql was done directly via code using direct mysql requests. This is the way I approached it: In classes_db.php I declared the db settings and created methods that I use to open and close DB connections. I declare those objects on my regular pages: class classes_db { public $dbserver = 'server; public $dbusername = 'user'; public $dbpassword = 'pass'; public $dbname = 'db'; function openDb() { $dbhandle = mysql_connect($this->dbserver, $this->dbusername, $this->dbpassword); if (!$dbhandle) { die('Could not connect: ' . mysql_error()); } $selected = mysql_select_db($this->dbname, $dbhandle) or die("Could not select the database"); return $dbhandle; } function closeDb($con) { mysql_close($con); } } On my regular page, I do this: <?php require 'classes_db.php'; session_start(); //create instance of the DB class $db = new classes_db(); //get dbhandle $dbhandle = $db->openDb(); //process query $result = mysql_query("update user set username = '" . $usernameFromForm . "' where iduser= " . $_SESSION['user']->iduser); //close the connection if (isset($dbhandle)) { $db->closeDb($dbhandle); } ?> My questions is: how to do it right and make it OO and secure? I know that I need incorporate prepared queries- how to do it the best way? Please provide some code

    Read the article

  • GIt Deployment + Configuration Files + Heroku

    - by Andrew
    I'm using Heroku to host a Rails app, which means using Git to deploy to Heroku. Because of the "pure Git workflow" on Heroku, anything that needs to go upstream to the server has to be configured identically on my local box. However I need to have certain configuration files be different depending on whether I'm in the local setup or deployed on Heroku. Again, because of the deployment method Heroku uses I can't use .gitignore and a template (as I have seen suggested many times, and have used in other projects). What I need is for git to somehow track changes on a file, but selectively tell git not to override certain files when pulling from a particular repo -- basically to make certain changes one-way only. Can this be done? I'd appreciate any suggestions!

    Read the article

  • jquery load function problem

    - by andrew
    Hi, i have a select box like that <select name="sehirler_post" id="sehirler_post"> i am getting values via jquery. i know two different ways to get values. first one is : var sehirler_post = jQuery('select#sehirler_post').attr('value'); second one is: jQuery('#sehirler_post ').val() and finally here is my problem, i have something like this: jQuery("#okay").load("ajax_post_category.php?okay="+id+""); i would like to use selectbox value instead of id (okay="+id+"). so, i must change +id+ part with select box value. however i can not do it.. i tried to do like that: jQuery("#okay").load("ajax_post_category.php?okay="+jQuery('#sehirler_post').val()+""); it did not work. there must be a way, so i can use selectbox value instead of id in my load function. if anyone helps me, ill be so glad. regards

    Read the article

  • PHP syntax question: global $argv, $argc;

    - by Andrew
    So I have a PHPUnit test, and found this code within a function. global $argv, $argc; echo $argc; print_r($argv); I understand what these variables represent (arguments passed from the command line), but I've never seen this syntax before:global $argv, $argc; What specifically is going on here?

    Read the article

  • Nowaday C++ projects for Windows

    - by Andrew Florko
    Please, describe nowadays projects you took part in where C++ platform was preferred to .net where .net runtime could be installed. Some of my friends works in SCADA area. They have to program microcontrollers with Linux Embedded and so on. So my friends have nearly no choice in programming tools. But when you had, why did you prefer C++ ?

    Read the article

  • Understand link redirect

    - by Andrew
    wordpress placed into category 'blog' there are no subcategory 'contact' into category 'blog', neither .htaccess with redirect directives. How I can find what script does executed? and I VERY want understand how server find it. http://domain.com/freeaccess/blog/contact Thank you!

    Read the article

  • Rails: RESTful Find, Initialize, or Create

    - by Andrew
    I have an app that has Cities in it. I'm looking for some suggestions on how to RESTfully structure a controller so that I can lookup, initialize, and create city records via AJAX requests. For instance: Given a text field city_name A user enters the name of a City, like "Paris, France" The app checks this location to see if there is such a city in the database already If there is, it returns the city object If there is not, it returns a new record initialized with the name "Paris" and the country "France", and prompts the user to confirm they want to add this city to the database If the user says "Yes" the record is saved. If not the record is discarded and the form is cleared. Now, my first approach was to change the Create action to use find_or_create, so that an AJAX post to cities_path would result in either returning the existing city or creating it and returning it. That works ok... However, it would be better to setup controller actions that would take a string input, find , or else initialize and return, then only create if the user confirms the generated record is correct. The ideal scenario would put this all in one action so AJAX request can go to that url, the server responds with JSON objects, and javascript can handle things from there. I'd like to keep all the user-interaction logic client side, and also minimize the number of requests it takes to achieve this. Any suggestions on the cleanest, most RESTful way to accomplish this?

    Read the article

  • Parallel doseq for Clojure

    - by andrew cooke
    I haven't used multithreading in Clojure at all so am unsure where to start. I have a doseq whose body can run in parallel. What I'd like is for there always to be 3 threads running (leaving 1 core free) that evaluate the body in parallel until the range is exhausted. There's no shared state, nothing complicated - the equivalent of Python's multiprocessing would be just fine. So something like: (dopar 3 [i (range 100)] ; repeated 100 times in 3 parallel threads... ...) Where should I start looking? Is there a command for this? A standard package? A good reference? So far I have found pmap, and could use that (how do I restrict to 3 at a time? looks like it uses 32 at a time - no, source says 2 + number of processors), but it seems like this is a basic primitive that should already exist somewhere. clarification: I really would like to control the number of threads. I have processes that are long-running and use a fair amount of memory, so creating a large number and hoping things work out OK isn't a good approach (example which uses a significant chunk available mem). update: Starting to write a macro that does this, and I need a semaphore (or a mutex, or an atom i can wait on). Do semaphores exist in Clojure? Or should I use a ThreadPoolExecutor? It seems odd to have to pull so much in from Java - I thought parallel programming in Clojure was supposed to be easy... Maybe I am thinking about this completely the wrong way? Hmmm. Agents?

    Read the article

  • Chat Server with sockets in C

    - by Andrew
    I'm trying to write a chat server in C that allows communication between two clients using POSIX sockets. I'm not sure I have a good grasp on this concept or how I should set up the communication protocol between the clients and the server. I know I need one socket to bind() the server port to so I can accept incoming connections from clients, but in order to have two clients connected at the same time do I need to create a socket for each of these clients when I accept() or should I accept() a client and then fork() so I can have another client accept? I'm not worried about concurrent chatting yet, it's more of a ping-pong approach where the clients need to wait for a recv() after they send() before they can type a new message.

    Read the article

< Previous Page | 51 52 53 54 55 56 57 58 59 60 61 62  | Next Page >