Search Results

Search found 2017 results on 81 pages for 'jason'.

Page 58/81 | < Previous Page | 54 55 56 57 58 59 60 61 62 63 64 65  | Next Page >

  • Does the order of readonly variable declarations guarantee the order in which the values are set?

    - by Jason Down
    Say I were to have a few readonly variables for filepaths, would I be able to guarantee the order in which the values are assigned based on the order of declaration? e.g. readonly string basepath = @"my\base\directory\location"; readonly string subpath1 = basepath + @"\abc\def"; readonly string subpath2 = basepath + @"\ghi\klm"; Is this a safe approach or is it possible that basepath may still be the default value for a string at the time subpath1 and subpath2 make a reference to the string? I realize I could probably guarantee the order by assigning the values in a constructor instead of at the time of declaration. However, I believe this approach wouldn't be possible if I needed to declare the variables inside of a static class (e.g. Program.cs for a console application, which has a static void Main() procedure instead of a constructor).

    Read the article

  • Merge two rows in SQL

    - by Jason
    Assuming I have a table containing the following information: FK | Field1 | Field2 ===================== 3 | ABC | *NULL* 3 | *NULL* | DEF is there a way I can perform a select on the table to get the following FK | Field1 | Field2 ===================== 3 | ABC | DEF Thanks Edit: Fix field2 name for clarity

    Read the article

  • how to implement a "soft barrier" in multithreaded c++

    - by Jason
    I have some multithreaded c++ code with the following structure: do_thread_specific_work(); update_shared_variables(); //checkpoint A do_thread_specific_work_not_modifying_shared_variables(); //checkpoint B do_thread_specific_work_requiring_all_threads_have_updated_shared_variables(); What follows checkpoint B is work that could have started if all threads have reached only checkpoint A, hence my notion of a "soft barrier". Typically multithreading libraries only provide "hard barriers" in which all threads must reach some point before any can continue. Obviously a hard barrier could be used at checkpoint B. Using a soft barrier can lead to better execution time, especially since the work between checkpoints A and B may not be load-balanced between the threads (i.e. 1 slow thread who has reached checkpoint A but not B could be causing all the others to wait at the barrier just before checkpoint B). I've tried using atomics to synchronize things and I know with 100% certainty that is it NOT guaranteed to work. For example using openmp syntax, before the parallel section start with: shared_thread_counter = num_threads; //known at compile time #pragma omp flush Then at checkpoint A: #pragma omp atomic shared_thread_counter--; Then at checkpoint B (using polling): #pragma omp flush while (shared_thread_counter > 0) { usleep(1); //can be removed, but better to limit memory bandwidth #pragma omp flush } I've designed some experiments in which I use an atomic to indicate that some operation before it is finished. The experiment would work with 2 threads most of the time but consistently fail when I have lots of threads (like 20 or 30). I suspect this is because of the caching structure of modern CPUs. Even if one thread updates some other value before doing the atomic decrement, it is not guaranteed to be read by another thread in that order. Consider the case when the other value is a cache miss and the atomic decrement is a cache hit. So back to my question, how to CORRECTLY implement this "soft barrier"? Is there any built-in feature that guarantees such functionality? I'd prefer openmp but I'm familiar with most of the other common multithreading libraries. As a workaround right now, I'm using a hard barrier at checkpoint B and I've restructured my code to make the work between checkpoint A and B automatically load-balancing between the threads (which has been rather difficult at times). Thanks for any advice/insight :)

    Read the article

  • How to debug CSS/Javascript hover issues

    - by Jason Creighton
    I often find myself wanting to debug CSS layout issues that involve DOM changes caused by Javascript in reaction to a hover event or different CSS rules applying due to the :hover selector. Normally, I'd use Firebug to inspect the element that's giving me trouble and see what its CSS properties were, and where those properties come from. However, when hovering is involved, it becomes impossible, because as soon as you move your mouse down to the Firebug panel, the elements you're interested in are no longer hovered, the CSS rules that apply are different, and (in the case of JS hovers) the DOM is changed. Is there any way I can "freeze" the state of the DOM and application of :hover in order to inspect the DOM as it was during a hover event? Any other ideas on how to debug this sort of issue are welcome, of course.

    Read the article

  • What are the best workarounds for known problems with Hibernate's schema validation of floating poin

    - by Jason Novak
    I have several Java classes with double fields that I am persisting via Hibernate. For example, I have @Entity public class Node ... private double value; When Hibernate's org.hibernate.dialect.Oracle10gDialect creates the DDL for the Node table, it maps the value field to a "double precision" type. create table MDB.Node (... value double precision not null, ... It would appear that in Oracle, "double precision" is an alias for "float". So, when I try to verify the database schema using the org.hibernate.cfg.AnnotationConfiguration.validateSchema() method, Oracle appears to describe the value column as a "float". This causes Hibernate to throw the following Exception org.hibernate.HibernateException: Wrong column type in DBO.ACL_RULE for column value. Found: float, expected: double precision A very similar problem is listed in Hibernate's JIRA database as HHH-1961 (http://opensource.atlassian.com/projects/hibernate/browse/HHH-1961). I'd like to avoid doing anything that will break MySql, Postgres, and Sql Server support so extending the Oracle10gDialect appears to be the most promising of the workarounds mentioned in HHH-1961. But extending a Dialect is something I've never done before and I'm afraid there may be some nasty gotchas. What is the best workaround for this problem that won't break our compatibility with MySql, Postgres, and Sql Server? Thanks for taking the time to look at this!

    Read the article

  • Data synchronization using XMPP

    - by Jason
    Hi: I'm looking for some insight/advice on synchronizing data over XMPP. I've never developed anything for XMPP before so excuse me if some of my questions seem ridiculous. Basically, what I have is a decentralized social network. Each person has it's own Web site (or server) with a unique URI (one domain could host many servers). Each of these servers can have many clients. E.g., a desktop application, mobile application, etc. What I would like to accomplish is near real-time synchronization/communication between client and server, e.g., I update something on my desktop application, I see it change on my Web site. My server and client code is Python. So, I would like to make use of SleekXMPP if possible (it's license seems to have changed to MIT). I was thinking, and here is where I need advice, that each server would register an account at a dedicated XMPP server, e.g., [email protected]. and then I could use different resources for clients [email protected]/client1, [email protected]/client2, etc. If anyone can register any username, then maybe I also need some intermediate service (since it's decentralized, i'm not sure how to control registrations). Another option, I guess, is that each server runs it's own xmpp server. Assuming, that was all worked out, if I want to broadcast messages to all my resources (except the sending one), how do I do that? Do I have to subscribe to myself? This also seems like a good candidate for publish-subscribe, let me know if you think that could work and what the design/flow of that process would be. thanks :)

    Read the article

  • Unexpected $end...

    - by Jason
    I keep getting a error - Parse error: syntax error, unexpected $end in ... on line 75, but everything looks fine to me. <?php get_header(); ?> <div id="content-top"> <div class="title"> <h2>Welcome!</h2> </div> </div> <div id="content"> <div class="contentbox"> <?php get_sidebar(); ?> <?php if (have_posts()) : ?> <?php if (have_posts()) : while (have_posts()) : the_post(); ?> <div class="post" id="post-<?php the_ID(); ?>"> <h2><a href="<?php echo get_permalink($post->post_parent); ?>" rev="attachment"><?php echo get_the_title($post->post_parent); ?></a> &raquo; <?php the_title(); ?></h2> <div class="entry"> <p class="attachment"><a href="<?php echo wp_get_attachment_url($post->ID); ?>"><?php echo wp_get_attachment_image( $post->ID, 'medium' ); ?></a></p> <div class="caption"><?php if ( !empty($post->post_excerpt) ) the_excerpt(); // this is the "caption" ?></div> <?php the_content('<p class="serif">Read the rest of this entry &raquo;</p>'); ?> <div class="navigation"> <div class="alignleft"><?php previous_image_link() ?></div> <div class="alignright"><?php next_image_link() ?></div> </div> <br class="clear" /> <p class="postmetadata alt"> <small> This entry was posted on <?php the_time('l, F jS, Y') ?> at <?php the_time() ?> and is filed under <?php the_category(', ') ?>. <?php the_taxonomies(); ?> You can follow any responses to this entry through the <?php post_comments_feed_link('RSS 2.0'); ?> feed. <?php if (('open' == $post-> comment_status) && ('open' == $post->ping_status)) { // Both Comments and Pings are open ?> You can <a href="#respond">leave a response</a>, or <a href="<?php trackback_url(); ?>" rel="trackback">trackback</a> from your own site. <?php } elseif (!('open' == $post-> comment_status) && ('open' == $post->ping_status)) { // Only Pings are Open ?> Responses are currently closed, but you can <a href="<?php trackback_url(); ?> " rel="trackback">trackback</a> from your own site. <?php } elseif (('open' == $post-> comment_status) && !('open' == $post->ping_status)) { // Comments are open, Pings are not ?> You can skip to the end and leave a response. Pinging is currently not allowed. <?php } elseif (!('open' == $post-> comment_status) && !('open' == $post->ping_status)) { // Neither Comments, nor Pings are open ?> Both comments and pings are currently closed. <?php } edit_post_link('Edit this entry.','',''); ?> </small> </p> </div> </div> <?php comments_template(); ?> <?php endwhile; else: ?> <p>Sorry, no attachments matched your criteria.</p> <?php endif; ?> <div class="clear"></div> </div> </div>

    Read the article

  • Ruby GraphViz Binary Tree Record

    - by Jason M
    I'm using the ruby-graphviz gem and I'm trying to draw binary trees. I'd like to use the record shape so that each node can have a left, middle, and right field and, thus, if there are two edges leaving a node, the left and right edges can be distinguished. I tried specifying the field by concatenating the field name like this: @node1.name + ":left" But that did not work. What is the correct way of specifying the field? require 'rubygems' require 'graphviz' @graph = GraphViz.new( :G, :type => :digraph ) @node1 = @graph.add_node("1", "shape" => "record", "label" => "<left>|<f1> 1|<right>" ) @node2 = @graph.add_node("2", "shape" => "record", "label" => "<left>|<f1> 2|<right>" ) @graph.add_edge(@node1.name + ":left", @node2) # generate a random filename filename = "/tmp/#{(0...8).map{65.+(rand(25)).chr}.join}.png" @graph.output( :png => filename ) exec "open #{filename}"

    Read the article

  • Reimplementing data structures in the real world

    - by Jason
    The topic of algorithms class today was reimplementing data structures, specifically ArrayList in Java. The fact that you can customize a structure for in various ways definitely got me interested, particularly with variations of add() & iterator.remove() methods. But is reimplementing and customizing a data structure something that is of more interest to the academics vs the real-world programmers? Has anyone reimplemented their own version of a data structure in a commercial application/program, and why did you pick that route over your particular language's implementation?

    Read the article

  • How to get link_to in Rails output an SEO friendly url?

    - by Jason
    Hi, My link_to tag is: <%= link_to("My test title",{:controller=>"search", :action=>"for-sale", :id=> listing.id, :title => listing.title, :search_term => search_term}) %> and produces this ugly URL: http://mysite.com/search/for-sale/12345?title=premium+ad+%2B+photo+%5Btest%5D How can I get link_to to generate: http://mysite.com/search/for-sale/listing-title/search-term/12345 Been trying this a few different ways and cannot find much online, really appreciate any help!

    Read the article

  • Working with arrays passed byref

    - by Jason
    I would like for someone to explain this to me: function myFunction(array){ array = $.grep(array, function(n,i){return n > 1 }); } var mainArray = [1,2,3]; myFunction(mainArray); document.write(mainArray) // 1,2,3, but i'm expecting 2,3 but if i do something like array[3] = 4; in place of the $.grep line, i get 1,2,3,4. Shouldn't mainArray become the new array created by $.grep?

    Read the article

  • bash: listing files in date order, with spaces in filenames

    - by Jason Judge
    I am starting with a file containing a list of hundreds of files (full paths) in a random order. I would like to list the details of the ten latest files in that list. This is my naive attempt: ls -las -t `cat list-of-files.txt` | head -10 That works, so long as none of the files have spaces in, but fails if they do as those files are split up at the spaces and treated as separate files. I have tried quoting the files in the original list-of-files file, but the here-document still splits the files up at the spaces in the filenames. The only way I can think of doing this, is to ls each file individually (using xargs perhaps) and create an intermediate file with the file listings and the date in a sortable order as the first field in each line, then sort that intermediate file. However, that feels a bit cumbersome and inefficient (hundreds of ls commands rather than one or two). But that may be the only way to do it? Is there any way to pass "ls" a list of files to process, where those files could contain spaces - it seems like it should be simple, but I'm stumped.

    Read the article

  • Postback problem? Not getting data back from DB

    - by Jason Shultz
    I'm not getting back data from my DB like I'm expecting. I know that I can get data from the DB because I have other functions working. With this page, what I'm trying to do is the following: If no postback, then I would like it to echo "No Category Selected" If a category has been chosen, then I would like for it to get that data from the DB and show it on the page. I'm sure I can do this all in one view, I'm just not doing something right. Can someone help please? Pastebin: http://pastebin.com/AQqcvnAb

    Read the article

  • How to prevent Artificial Intelligence from escaping into the internet?

    - by Jason
    I have an interest in artificial intelligence from a evolutionary standpoint. I want to experiment with it somewhat with a high level language like C#, however, I'm stuck on one of the most elementary problems with artificial life -- how to contain it? The best thing I can think of is a virtual machine. Where would I start to create a VM for my budding digital organisms in C#? How could I be sure they couldn't escape into the 'wild'? (I understand this unlikely, by the way.)

    Read the article

  • Resolve naming conflict in included XSDs for JAXB compilation

    - by Jason Faust
    I am currently trying to compile with JAXB (IBM build 2.1.3) a pair of schema files into the same package. Each will compile on it's own, but when trying to compile them together i get a element naming conflict due to includes. My question is; is there a way to specify with an external binding a resolution to the naming collision. Example files follow. In the example the offending element is called "Common", which is defined in both incA and incB: incA.xsd <?xml version="1.0" encoding="UTF-8"?> <schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.example.org/" xmlns:tns="http://www.example.org/" elementFormDefault="qualified"> <complexType name="TypeA"> <sequence> <element name="ElementA" type="string"></element> </sequence> </complexType> <!-- Conflicting element --> <element name="Common" type="tns:TypeA"></element> </schema> incB.xsd <?xml version="1.0" encoding="UTF-8"?> <schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.example.org/" xmlns:tns="http://www.example.org/" elementFormDefault="qualified"> <complexType name="TypeB"> <sequence> <element name="ElementB" type="int"></element> </sequence> </complexType> <!-- Conflicting element --> <element name="Common" type="tns:TypeB"></element> </schema> A.xsd <?xml version="1.0" encoding="UTF-8"?> <schema targetNamespace="http://www.example.org/" elementFormDefault="qualified" xmlns="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://www.example.org/"> <include schemaLocation="incA.xsd"></include> <complexType name="A"> <sequence> <element ref="tns:Common"></element> </sequence> </complexType> </schema> B.xsd <?xml version="1.0" encoding="UTF-8"?> <schema targetNamespace="http://www.example.org/" elementFormDefault="qualified" xmlns="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://www.example.org/"> <include schemaLocation="incB.xsd"></include> <complexType name="B"> <sequence> <element ref="tns:Common"></element> </sequence> </complexType> </schema> Compiler error when both are compiled from one evocation of xjb: [ERROR] 'Common' is already defined line 9 of file:/C:/temp/incB.xsd [ERROR] (related to above error) the first definition appears here line 9 of file:/C:/temp/incA.xsd (For reference, this is a generalization to resolve an issue with compiling the OAGIS8 SP3 package)

    Read the article

  • python: help defining/installing simple script to setup machine-specific information

    - by Jason S
    (This is related to scons but I think most of the following should be fairly general to python) I would like to define a python file/library that I put in a Well-Known Place somewhere on my computer that I can use to define machine-specific paths, and was looking for help on how to do this well, since I'm a beginner to Python & really only use it for my scons work. scons uses a SConstruct file which can execute python code. What I would like to do is something like this: My SConstruct file would contain this at the beginning: defaultEnv = JJJJJ.getMachineSpecificPaths() or (do both of these syntaxes work?) import JJJJJ defaultEnv = getMachineSpecificPaths() I define a JJJJJ.py file somewhere installed in the python dir which contains the following def getMachineSpecificPaths(): ... does something here, I don't know what ... that reads a file machine-specific-paths.txt (maybe it has the code Ross Rogers mentioned in my other question) located in the same directory as JJJJJ.py containing the following: machine-specific-paths.txt TI_C28_ROOT C:/appl/ti/ccs/?4.1.1/ccsv4/tools/co?mpiler/c2000 JSDB c:/bin/jsdb/jsdb.exe PYTHON_PATH c:/appl/python/2.6.4 The thing is, I don't really know much about the conventions in Python about where you put system-wide libraries and files. This is probably really simple to get right but I don't know how.

    Read the article

  • Adding XOR function to bigint library

    - by Jason Gooner
    Hi, I'm using this Big Integer library for Javascript: http://www.leemon.com/crypto/BigInt.js and I need to be able to XOR two bigInts together and sadly the library doesn't include such a function. The library is relatively simple so I don't think it's a huge task, just confusing. I've been trying to hack one together but not having much luck, would be very grateful if someone could lend me a hand. This is what I've attempted (might be wrong). But im guessing the structure is going to be quite similar to some of the other functions in there. function xor(x, y) { var c, k, i; var result = new Array(0); // big int for result k=x.length>y.length ? x.length : y.length; // array length of the larger num // Make sure result is the correct array size? maybe: result = expand(result, k); // ? for (c=0, i=0; i < k; i++) { // Do some xor here } // return the bigint xor result return result; } What confuses me is I don't really understand how it stores numbers in the array blocks for the bigInt. I don't think it's a case of simply bigintC[i] = bigintA[i] ^ bigintB[i], then most other functions have some masking operation at the end that I don't understand. I would really appreciate any help getting this working. Thanks

    Read the article

  • sha1(password) encryption

    - by Jason
    Alright, so I tried to make my users info super secure by adding '" . sha1($_POST['password']) . "' when inserting their password when they register. THAT WORKS great, looking at the database, I have no clue what their password is. Now the problem is logging in. I'm running some tests and when I try to log in, the password 12345 doesn't match the encrypted password using "$password=sha1($_POST['mypassword']);" Any idea's why?

    Read the article

  • search engine (bing) lost my www

    - by Jason
    I just found that my site in the result of bing was broken, casue bing display wrong domain name: my site domain name: www.mysite.com; bing list my site domain name : mysite.com How can i ask bing to change it to the right one? Another search engines list it correctly.

    Read the article

  • Extensionless URLs in IIS 6

    - by Jason Marsell
    My client has asked me to build a personalized URL system so that they can send out really short URLs in postcards to customers like this: www.client.com/JasonSmith03 www.client.com/TonyAdams With these URLs, I need IIS 6 to trap the incoming request and pass that “JasonSmith03” token to my database to determine which landing page to redirect them to. I’d love to use an HttpHandler or HttpModule but they both look like they require an file extension (.aspx) in the URL. Wildcard mapping will chew up every incoming request and that’s ridiculous. ISAPI filters are just text routing files, so I can’t employ logic to call the database. According to Scott Guthrie, this would be cake if I had IIS 7, but I don’t. Can this be done using MVC? I’ve been working with MVP for the last few years, so I haven’t done any MVC and routing. I thought I remembered that MVC has the ability to use REST-style extensionless URLs. I’d be more than happy to have these personalized URLs land on a site that’s built in MVC, if it will work. Thank you!

    Read the article

  • Specify which xml file to load when link is clicked

    - by Jason
    Good morning, I would like it so when a link is clicked on the homepage it would load a particular xml file into the next page (the page is called category-list.apsx). This category list page uses the Repeater Control method to display the xml details on the page. I used the example shown here: http://www.w3schools.com/aspnet/aspnet_repeater.asp So at the moment the repeater script looks like: <script runat="server"> sub Page_Load if Not Page.IsPostBack then dim mycategories=New DataSet mycategories.ReadXml(MapPath("categories.xml")) categories.DataSource=mycategories categories.DataBind() end if end sub </script> After doing some research I did find someone with the same problem and the solution was to insert #tags as part of the link on the homepage (i.e. category-list.apsx#company1results) and then some script on the list page to pick up the correct xml file: <script type="text/javascript"> var old_onload = window.onload; // Play it safe by respecting onload handlers set by other scripts. window.onload=function() { var categories = document.location.href.substring(document.location.href.indexOf("#")+1); loadXMLDoc('XML/'+categories+'.xml'); old_onload(); } </script> This was from the following link: http://www.hotscripts.com/forums/javascript/45641-solved-specify-xml-file-load-when-click-link.html How can I get these two scripts to connect with each other? Thank you for your time

    Read the article

< Previous Page | 54 55 56 57 58 59 60 61 62 63 64 65  | Next Page >