Search Results

Search found 2018 results on 81 pages for 'jason bunting'.

Page 71/81 | < Previous Page | 67 68 69 70 71 72 73 74 75 76 77 78  | Next Page >

  • Population count of rightmost n integers

    - by Jason Baker
    I'm implementing Bagwell's Ideal Hash Trie in Haskell. To find an element in a sub-trie, he says to do the following: Finding the arc for a symbol s, requires ?nding its corresponding bit in the bit map and then counting the one bits below it in the map to compute an index into the ordered sub-trie. What is the best way to do this? It sounds like the most straightforward way of doing this is to select the bits below that bit and do a population count on the resulting number. Is there a faster or better way to do this?

    Read the article

  • How can I change the color of a complex graphic?

    - by Jason Christa
    I have a graphic in Adobe Illustrator (lets say a cat) that I want to use in an Android application. I would like to have the user be able to change the color of the fur using a color picker. What can I save the graphic as (SVG?) to allow me to programatically control the color from with the android app? Do I have to have a separate image for each color of the cat?

    Read the article

  • Mixing stored procedures and ORM

    - by Jason
    The company I work for develops a large application which is almost entirely based on stored procedures. We use classic ASP and SQL Server and the major part of the business logic is contained inside those stored procedures. For example, (I know, this is bad...) a single stored procedure can be used for different purposes (insert, update, delete, make some calculations, ...). Most of the time, a stored procedure is used for operations on related tables, but this is not always the case. We are planning to move to ASP.NET in a near future. I have read a lot of posts on StackOverflow recommending that I move the business logic outside the database. The thing is, I have tried to convince the people who takes the decisions at our company and there is nothing I can do to change their mind. Since I want to be able to use the advantages of object-oriented programming, I want to map the tables to actual classes. So far, my solution is to use an ORM (Entity Framework 4 or nHibernate) to avoid mapping the objects manually (mostly to retrieve the data) and use some kind of Data Access Layer to call the existing stored procedures (for saving). I want your advice on this. Do you think it is a good solution? Any ideas?

    Read the article

  • Centre of a circle that intersects two points

    - by Jason
    Given two points in a 2D plane, and a circle of radius r that intersects both of those points, what would be the formula to calculate the centre of that circle? I realise there would two places the circle can be positioned. I would want the circle whose centre is encountered first in a clockwise direction when sweeping the line that joins the two points around one of those points, starting from an arbitrary angle. I guess that is the next stage in my problem, after I find an answer for the first part. I'm hoping the whole calculation can be done without trigonometry for speed. I'm starting with integer coordinates and will end with integer coordinates, if that helps.

    Read the article

  • How to store data to Excel from DataSet without going cell-by-cell?

    - by Jason Barnwell
    Duplicate of: What’s the simplest way to import a System.Data.DataSet into Excel? Using c# under VS2008, we can create an excel app, workbook, and then worksheet fine by doing this: Application excelApp = new Application(); Workbook excelWb = excelApp.Workbooks.Add(template); Worksheet excelWs = (Worksheet)this.Application.ActiveSheet; Then we can access each cell by "excelWs.Cells[i,j]" and write/save without problems. However with large numbers of rows/columns, we are expecting a loss in efficiency. Is there a way to "data bind" from a DataSet object into the worksheet without using the cell-by-cell approach? Most of the methods we have seen at some point revert to the cell-by-cell approach. Thanks for any suggestions.

    Read the article

  • Weird Rails database errors

    - by Jason Swett
    I've had some trouble getting my Rails app to connect to PostgreSQL so I decided to just say screw it and use SQLite for now. (I'm using the tutorial here: http://guides.rubyonrails.org/getting_started.html) I started a BRAND NEW, fresh Rails app from this tutorial. When I visit my app in the browser after deleting public/index.html, I get this the first time: Please install the pg adapter: `gem install activerecord-pg-adapter` (no such file to load -- active_record/connection_adapters/pg_adapter) That's odd to me because I'm not mentioning PostgreSQL anywhere. Here's my databases.yml: # SQLite version 3.x # gem install sqlite3-ruby (not necessary on OS X Leopard) development: adapter: sqlite3 database: db/development.sqlite3 pool: 5 timeout: 5000 # Warning: The database defined as "test" will be erased and # re-generated from your development database when you run "rake". # Do not set this db to the same as development or production. test: adapter: sqlite3 database: db/test.sqlite3 pool: 5 timeout: 5000 production: adapter: sqlite3 database: db/production.sqlite3 pool: 5 timeout: 5000 To make things more confusing, I only get that "pg adapter" error on the first load. For every subsequent page request, I get this error: ActiveRecord::ConnectionNotEstablished So even though I removed all mention of PostgreSQL, I'm still getting errors. What could be going on?

    Read the article

  • Pre-loading external files (CSS, JavaScript) for other pages

    - by Jason Young
    I'm curious if there is an efficient way to wait for the front page of a site to load, and then pre-load CSS and script files that I know will likely be needed for the other pages on the site. I want the front page of the site to be as fast as possible (lean and mean). It's likely that the user will not immediately click on a link. Since there will likely be some idle time, this seems like an opportune time to pre-load some of the external assets. Pre-loading should cause them to become cached. When the user does click on another page, the only request needed will be for the content and possibly some images, etc. Has anyone done this? Is it a bad idea? Is there an elegant way to implement it?

    Read the article

  • Quick question regarding MVC framework for a java game

    - by Jason
    I have a question regarding the use of the MVC framework for a blackjack game im writing in java. As I understand, my model would be a class that stores the state of the game, and more specifically, each players hand. Within the model class, I would have an array of listeners, which would be notified each time the game state changes (ie a player has drawn a new card). These listeners would be my viewer, which is the class that handles the display of the game. This class would implement the ActionListener interface, and each time the model changes, it would call/"notify" my viewer's actionPerformed method. My question is as follows: I intend to have two JPanels, each devoted to displaying the respective player's hand. As a player draws a new card, a new ImageIcon would be added to the panel. My question is how would the viewer class know what card has been added to the player's hand? I suppose I could store the player's hand before a notify event, and then upon the notification event, compare the new state with the old, to find out what has changed. I'm a complete novice here, so I could be completely wrong, but it seems a bit tedious to do this. Is there a more efficient/common way of detecting what has changed in the model between the before and after state? Another solution would be to redraw the entire panel each time the notification occurs? Would this be a better idea?

    Read the article

  • xhtml validation javascript

    - by Jason
    <!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"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> onmouseover="text.show('<br /><b>XXXXXX</b><br />')" Validation Output: Error: character "<" is the first character of a delimiter but occurred as data How can I fix it? thanks

    Read the article

  • Executing sc.exe from .NET Process unable to start and stop service.

    - by Jason
    I'm trying to restart the service from a remote machine. Here is my code. The problem is that I need to enter startinfo.filename = "sc.exe" since I'm putting "start /wait sc" this is causing an error. Here is my code, any thoughts. Also if anyone has any idea how to keep the cmd window open after this is ran so I could see the code that was ran that would be awesome. string strCommandStop1; string strCommandStop2; string strCommandStart1; string strCommandStart2; string strServer = "\\" + txtServerName.Text; string strDb1 = "SqlAgent$" + txtInsName.Text; string strDb2 = "MSSQL$" + txtInsName.Text; strCommandStop1 = @"start /wait sc " + strServer + " Stop " + strDb1; strCommandStop2 = @"start /wait sc " + strServer + " Stop " + strDb2; strCommandStart1 = @"start /wait sc " + strServer + " Start " + strDb2; strCommandStart2 = @"start /wait sc " + strServer + " Start " + strDb1; try { ProcessStartInfo startInfo = new ProcessStartInfo(); startInfo.CreateNoWindow = true; startInfo.Arguments = strCommandStop1; startInfo.Arguments = strCommandStop2; startInfo.Arguments = strCommandStart1; startInfo.Arguments = strCommandStart2; startInfo .FileName = "sc.exe"; Process.Start(startInfo); } catch (Exception e) { MessageBox.Show(e.Message); }

    Read the article

  • svn: default name for a tag when name is not important?

    - by Jason S
    I need to tag the current state of my source tree in svn. My problem is I don't care what the name is, I just need to mark the current revision in an immutable* manner. (*subject to malicious behavior) What's the best way to do this? branches/ tags/ ??? trunk/ should ??? be the date, an incrementing sequence, the repository rev # ...?

    Read the article

  • The shell dotfile cookbook

    - by Jason Baker
    I constantly hear from other people about how much of the stuff they've used to customize their *nix setup they've shamelessly stolen from other people. So in that spirit, I'd like to start a place to share that stuff here on SO. Here are the rules: DON'T POST YOUR ENTIRE DOTFILE. Instead, just show us the cool stuff. One recipe per answer You may, however, post multiple versions of your recipe in the same answer. For example, you may post a version that works for bash, a version that works for zsh, and a version that works for csh in the same answer. State what shells you know your recipe will work with in the answer. Let's build this cookbook as a team. If you find out that an answer works with other shells other than the one the author posted, edit it in. If you like an idea and rewrite it to work with another shell, edit the modified version in to the original post. Give credit where credit is due. If you got your idea from someone else, give them credit if possible. And for those of you (justifiably) asking "Why do we need another one of these threads?": Most of what I've seen is along the lines of "post your entire dotfile." Personally, I don't want to try to parse through a person's entire dotfile to figure out what I want. I just want to know about all the cool parts of it. It's helpful to have a single dotfile thread. I think most of the stuff that works in bash will work in zsh and it may be adapted to work with csh fairly easily.

    Read the article

  • Using jQuery find string A or B and replace based on css class and ID

    - by Jason
    Using jQuery, how do you check for and replace the occurrence of stringA or stringB when it falls under a specific css class and ID? stringA = " | " stringB = "|" css = .login #bav <p id="nav"> <a href="#">oh ya</a> | <a href="#" title="Password Lost and Found"></a> </p> I have variations of this: jQuery(document).ready(function($) { $(".login #nav").replaceText( /testA|testB/gi, "fooBar" ); }); });

    Read the article

  • Prototype - DOM Traversal with up()

    - by Jason McCreary
    I have the following structure: <form> <div class="content"> ... </div> <div class="action"> <p>Select <a class="select_all" href="?select=1" title="Select All">All</a></p> </div> </form> I am using Prototype's up() to traverse the DOM in order to find the <form> element in respect to the a.select_all. However the following doesn't work: select_link.up('form'); // returns undefined Yet, this does. select_link.up().up().up(); // returns HTMLFormElement Clearly this is an ancestor of a.select_all. The API Docs state Element.up() supports a CSSRule. What am I missing here?

    Read the article

  • Running a program on multiple PC's

    - by Jason T.
    I have some of the basic coding down for the program but I do need assistance with something. My goal is to have an alarm go off on multiple PC's in a network indicating that a certain task needs done. Anyone who receives this alarm may stop it, complete the task and log that they did that. What would be the best way to accomplish this in a network? But not every computer in the network will be running this program, just a few.

    Read the article

  • Why does this properly escaped SQL query fail?

    - by Jason Rhodes
    Here's the query: INSERT INTO jobemails (jobid, to, subject, message, headers, datesent) VALUES ('340', '[email protected]', 'We\'ve received your request for a photo shoot called \'another\'.', 'message', 'headers', '2010-04-22 15:55:06') The datatypes are all correct, it always fails at the subject, so it must be how I'm escaping the values, I assume. I'm sure one of you will see my idiot mistake right away. A little help?

    Read the article

  • What is the advantage of creating an enumerable object using to_enum in Ruby?

    - by Jason
    Hi, Why would you create a proxy reference to an object in Ruby, by using the to_enum method rather than just using the object directly? I cannot think of any practical use for this, trying to understand this concept & where someone might use it, but all the examples I have seen seem very trivial. For example, why use: "hello".enum_for(:each_char).map {|c| c.succ } instead of "hello".each_char.map {|c| c.succ } I know this is a very simple example, does anyone have any real-world examples? Thanks!

    Read the article

  • Using curl to submit/retrieve a forms results

    - by Jason
    I need help in trying to use curl to post data to a page and retrieve the results after the form has been submitted. I created a simple form: <form name="test" method="post" action="form.php"> <input type="text" name="name" size="40" />e <input type="text" name="comment" size="140" /> <input type="submit" name="submit" value="submit" /> </form> In addition, I have php code to handle this form in the same page. All it does is echo back the form values. The curl that I have been using is this: $h = curl_init(); curl_setopt($h, CURLOPT_URL, "path/to/form.php"); curl_setopt($h, CURLOPT_POST, true); curl_setopt($h, CURLOPT_POSTFIELDS, array( 'name' = 'yes', 'comment' = 'no' )); curl_setopt($h, CURLOPT_HEADER, false); curl_setopt($h, CURLOPT_RETURNTRANSFER, 1); $result = curl_exec($h); When I launch the page with the curl code in it, I get the form.php page contents but it doesn't not show the variables that PHP should have echo'd when the form is submitted. would appreciate any help with this. Thanks.

    Read the article

  • matlab: putting a circled number onto a graph

    - by Jason S
    I want to put a circled number on a graph as a marker near (but not on) a point. Sounds easy, but I also want to be invariant of zoom/aspect ratio changes. Because of this invariant, I can't draw a circle as a line object (without redrawing it upon rescale); if I use a circle marker, I'd have to adjust its offset upon rescale. The simplest approach I can think of is to use the Unicode or Wingdings characters ① ② ③ etc. in a string for the text() function. But unicode doesn't seem to work right, and the following sample only works with ① and not for the other numbers (which yield rectangle boxes): works: clf; text(0.5,0.5,char(129),'FontName','WingDings') doesn't work (should be a circled 2): clf; text(0.5,0.5,char(130),'FontName','WingDings') What gives, and can anyone suggest a workaround?

    Read the article

  • cakePHP, multiple hasOne in a single model

    - by jason
    say you have 3 models : user, hair_color, and eye_color user hasOne hair_color user also hasOne eye_color however var $hasOne = 'hair_color'; var $hasOne = 'eye_color'; obviously wont work. So how do you implement many hasOne relationships in a single model? I assume the answer is in the cookbook, Im going over that area now, I suspect it has something to do with passing an array to $hasOne, but no example of doing this.

    Read the article

  • Nested Resource - How to pass needed keys, and attribute to update?

    - by Jason B
    My nested resources are working for form_for updates, but I have a few toggles that I need to setup to change a status field. So I am using link_to, and accessing the url helper. link_to "toggle", edit_project_expense_path(@project[:id],expense_item[:id]) routes.rb resources :projects do resources :expenses end match '/submit_expense/:id' => 'expenses#submit_expense', :as => 'submit_expense' rake routes edit_project_expense GET /projects/:project_id/expenses/:id/edit(.:format) expenses#edit My question is: How can I also send along :approval_status = "1", with my link_to?

    Read the article

< Previous Page | 67 68 69 70 71 72 73 74 75 76 77 78  | Next Page >