Search Results

Search found 2965 results on 119 pages for 'bill james'.

Page 73/119 | < Previous Page | 69 70 71 72 73 74 75 76 77 78 79 80  | Next Page >

  • "Anagram solver" based on statistics rather than a dictionary/table?

    - by James M.
    My problem is conceptually similar to solving anagrams, except I can't just use a dictionary lookup. I am trying to find plausible words rather than real words. I have created an N-gram model (for now, N=2) based on the letters in a bunch of text. Now, given a random sequence of letters, I would like to permute them into the most likely sequence according to the transition probabilities. I thought I would need the Viterbi algorithm when I started this, but as I look deeper, the Viterbi algorithm optimizes a sequence of hidden random variables based on the observed output. I am trying to optimize the output sequence. Is there a well-known algorithm for this that I can read about? Or am I on the right track with Viterbi and I'm just not seeing how to apply it?

    Read the article

  • Add a listener inside or outside get method

    - by James P.
    I'm learning Swing and have composed an interface using a series of get methods to add components. Is it a good practise to add a Listener inside a get method as follows? I'd like to make things as decoupled as possible. private JButton getConnectButton() { if (connectButton == null) { connectButton = new JButton(); connectButton.setText("Connect"); connectButton.setSize(new Dimension(81, 16)); connectButton.setLocation(new Point(410, 5)); connectButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { // actionPerformed code goes here } }); } return connectButton; }

    Read the article

  • how to copy a sqlite3 table to another file in python

    - by james
    hey i was wondering how i could make a copy of a sqlite3 table and save it to a seperate file in python. im confused as in python your sqlite3 object can only be connected to one database so how would i make it save to a seperate database? the reason i want to do this is in sqlite3 the database file size can never get smaller, and ive made alot of changes so i want just copy this table to another file which wont have all the extra empty space and then delete the origonal database thanks guys

    Read the article

  • Why is autorelease especially dangerous/expensive for iPhone applications?

    - by e.James
    I'm looking for a primary source (or a really good explanation) to back up the claim that the use of autorelease is dangerous or overly expensive when writing software for the iPhone. Several developers make this claim, and I have even heard that Apple does not recommend it, but I have not been able to turn up any concrete sources to back it up. SO references: autorelease-iphone Why does this create a memory leak (iPhone)? Note: I can see, from a conceptual point of view, that autorelease is slightly more expensive than a simple call to release, but I don't think that small penalty is enough to make Apple recommend against it. What's the real story?

    Read the article

  • Default boolean value in a array of record - Delphi

    - by James
    Hi, I am helping out my company with some old delphi 7 code. There is a record declared at the start that is used throughout to store all the data we want outputted. type TOutput_Type = record result: String; resultoffset: String; selected: boolean; resultcategory: integer; end; and then an array of this is declared Output: array of TOutput_Type; The length is set at the start to a large value, as actual length is unknown. This array is used all over the place, but unfortunately the value selected is not always set when used. My problem is I am adding in a summary of the data, but because selected is not set, delphi seems to give it a random true or false status. Is there a way of setting all instances of selected as true at the start? Seems like a simple enough thing to do, but I'm not a delphi programmer so am unsure if its possible? I know I can go through and add in selected := true every time a new record is made, but I'd like to do it cleanly at the start if possible.... Thanks in advance

    Read the article

  • asp.net 4.0 webforms - how to keep ContentPlaceHolder1_ out of client id's in a simple way?

    - by James Manning
    I'm attempting to introduce master pages to an existing webforms site that's avoided using them because of client id mangling in the past (and me not wanting to deal with the mangling and doing <% foo.ClientID % everywhere :) GOAL: use 'static' id values (whatever is in the server control's id attribute) except for data-bound / repeating controls which would break for those cases and therefore need suffixes or whatever to differentiate (basically, Predictable) Now that the site migrated to ASP.NET 4.0, I first attempted to use ClientIDMode of Static (in the web.config) but that broke too many places doing repeating controls (checkboxes inside gridviews, for instance) since they all resulted with the same id. So, I then tried Predictable (again, just in the web.config) so that the repeating controls wouldn't have conflicting id's, and it works well except that the master page content placeholder (which is indeed a naming container) is still reflecting in the resulting client id's (for instance, ContentPlaceHolder1_someCheckbox). Certainly I could leave the web.config setting as static and then go through all the databound/repeating controls switch them to Predictable, but I'm hoping there's some easier/simpler way to get that effect without having to scatter ClientIDMode attributes in those N number of places (or extend all those databound controls with my own usercontrol that just sets clientidmode, or whatever). I even thought of leaving web.config set to static and doing a master or basepage handler (preinit? not sure if that would work or not) that would go walk Controls with OfType<INamingContainer() (might be a better choice on the type, but that seems like a good starting choice looking at repeater and gridview) and then set those to Predictable so I'd get static for all my 'normal' things outside of repeating controls but not have to deal with static inside things like gridview/repeater/etc. I don't see any way to mark the content placeholder such that it 'opts out' of being included in child id's - setting the ID of the placeholder to empty/blank doesn't work as it's a required attribute :) At that point I figured there was a better/simpler way that I was missing and decided to ask on SO :) Edit: I thought about changing all my 'fetch by id' jquery calls from $('#foo') to fetch_by_id('foo') and then having that function return the 'right one' by checking $('#foo').length and then $('#ContentPlaceHolder1_foo').length (and maybe other patterns) or even just have it return $('#foo, #ContentPlaceHolder1_foo') (again, potentially other patterns) but changing all the places I fetch elements by id seemed pretty ugly too, and I'd like to avoid that abstraction layer if possible to do so easily :)

    Read the article

  • Retrieving top 50 rows from Table using LINQ

    - by James
    Hey, Am new to LINQ, and am trying to retrieve the top 50 rows of a particular table. In SQL Server using an actual query i coudl say "Select TOP 50 from Transactions" , but not sure how i need to do that with LinQ Any pointers that could help ? Thanks !

    Read the article

  • jQuery validation with submit handler

    - by James
    I setup the form validation using jQuery validation plug-in's validate method and I have a submit handler that modifies the input element's value (I use YUI editor and it needs saveHTML() call to copy the iframe's content to the textarea element.). When submitting the form, I want the validator to validate the form after executing my submit handler. But it doesn't execute my submit handler if it is registered after the validate call. For example, <form id="form1" action="/test"> <input type="text" name="txt1" id="txt1" /> <input type="submit" value="submit" /> $(document).ready(function() { $("#form1").submit(function() { $("#txt1").val("123456"); }); $("#form1").validate({ rules: { txt1: { maxlength: 5 } } }); }); The form is validated after my submit handler so submit is canceled. $(document).ready(function() { $("#form1").validate({ rules: { txt1: { maxlength: 5 } } }); $("#form1").submit(function() { $("#txt1").val("123456"); }); }); However if I change the order the form is validated before my submit handler.

    Read the article

  • Eclipse debugging "source not found"

    - by James
    I just started using Eclipse so go easy on me ;). But when trying to debug a JUnit test case I get a dialog that states the the source is not found when I get to this line in the code in my test method: Assert.assertEquals(1, contents.size()); I know I should probably go and try and download the source from somewhere, but I really don't want to because I have no interest in stepping into the JUnit code. I have the JUnit runtime jar so Why does Eclipse expect me to have all the referenced tools source code in order to debug my own code (seems somewhat silly)? My main question is though, how can I tell Eclipse to skip this dialog when the source is not available and allow me to continue to debug my own code? [Edit] I've isolated the cause of this. It seems that Eclipse seems to think it needs the source when an exception is thrown by the internal JUnit code. In general is there anyway to tell it that it doesn't and just have it throw up an error dialog of some kind instead?

    Read the article

  • Read Java in as Hex

    - by James
    Hi, I have tried to solve this but I keep coming up with stuff that is no help I'm sure this is easy (when you know how of course ;) ) What I would like to do is read in a file using a byte stream like below: while((read = in.read()) != -1){ //code removed to save space Integer.toHexString(read); System.out.println(read); } When it prints out the Hex to the screen it will print out numbers fine e.g 31 13 12 0 but when it comes to a hex code that should be 01 31 it will print 0 131. I want to read it in to a variable like you would see in a hex editor i.e 00 11 21 31 no single numbers as i need to scan the whole file and look for patterns which I know how to do I'm just stuck on this :/ so in short i need a variabe to contain the two hex characters i.e int temp = 01 not int temp = 0 , I hope this all makes sense, I'm a little confused as it's 3am! If anyone knows how to do this I would be most greatful, p.s thanks for the help in advance this site has saved me loads of research and have learnt a lot! Many thanks.

    Read the article

  • How can I get valgrind to tell me the address of each non-freed block of memory?

    - by James
    Valgrind tells me function xxx allocated memory which was not freed. Fine. It's proving more difficult than usual to trace however. To this end I have created numerous: #ifdef DEBUG fprintf(stderr, "something happening:%lx\n", (unsigned long)ptr); #endif So I just need to match these ptr addresses that are displayed with the addresses of non-freed memory. How can I get valgrind to tell me the address of each non-freed block of memory?

    Read the article

  • How can I get a rails server to use the same databse that cucumber uses during a test?

    - by James
    The cucumber test first makes an entry in the database and posts a form to a second server. This second server does some processing in background and then hits the first app (where the test is being run) with some data that the cucumber test needs to know about. I've tried running the main server via script/server and script/server -e test while the cucumber test is running, but I can't seem to force the server to use the same database that cucumber is using when it runs its step definitions. That is, when the second server pushes some data to a controller in the main server, the main server doesn't know about any entries that cucumber has made in the database. How can I get cucumber and the main server to use the same database?

    Read the article

  • How do I relocate assemblies from a deployment project without breaking application references?

    - by James
    Hi, I have recently refactored a lot of my applications existing code and I am now looking at tidying up the deployment side of things. The existing installer application installs everything in the application folder (with the exclusion of a couple of config files which are located in a sub folder). However, I have multiple applications which all use some common assemblies and my goal is to relocate a these particular assemblies to the "Common Files" folder in the program files directory. NB: I have read a lot about the GAC but I have no experience with it and also read a few horror stories, so trying to get a simple solution for the time being. I managed to get the assemblies installed into the Common Files folder, however, as a result (typical I.T.) I have broken my app! If I copy the assemblies back into the application folder it works fine so the problem is obviously to do with how my app is referencing the assemblies. To get the installer to install the assemblies into the Common Files folder I just updated the Folder property of each assembly in the Detected Dependencies list. My thoughts were when I did that the installer would somehow update my application to tell it to look in that folder for them but that doens't appear to be the case. What exactly am I doing wrong here?

    Read the article

  • What is the Action returned by the subscribe parameter of IObservable.Create actually for?

    - by James Hay
    The method definition of IObservable.Create is: public static IObservable<TSource> Create<TSource>( Func<IObserver<TSource>, Action> subscribe ) I get that the function is called once the observable is subscribed to, where by I can then call OnNext, OnError and OnComplete on the observer. But why do I need to return an Action from the subscibe parameter and when will it actually be called?

    Read the article

  • Find a free X11 display number

    - by James
    I have some unit tests that need an X11 display so I plan to start Xvfb before running them, but to start Xvfb I will need a free display number to connect it to. My best guess is to see what's free in /tmp/.X11-unix but I'm not sure how to handle the race if many tests try to start simultaneously. sshd must do this, does anyone know how?

    Read the article

  • a class function with if(this==NULL) test got compiled?

    - by James
    I saw this code snippet during our lab and it actually compiles in MSVC2008 and G++. void LinkList< class T ::Insert(T n) { if (this == NULL) // some code here } As far as I know the this must not be null since you cannot call a class functions in c++ if it wasn't instantiated. Is this a valid code? if so what's the reason behind and where it can be useful?

    Read the article

  • Python: For loop problem

    - by James
    I have a PSP page with html embedded. I need to place another for loop so i can insert another %s next to background-color: which will instert a appropriate colour to colour in the html table. For example i need to insert for z in colours so it can loop over the colours list and insert the correct colour. Where ever i try to insert the for loop it doesnt seem to work it most commonly colours each cell in the table 60 times then moves onto the next cell and repeats itself and crashes my web browser. The colours are held in a table called colours. code below: <table> <% s = ''.join(aa[i] for i in table if i in aa) for i in range(0, len(s), 60): req.write('<tr><td><TT>%04d</td>' % (i+1)); for k in s[i:i+60]: req.write('<TT><td><TT><font style="background-color:">%s<font></td>' % (k)); req.write('</TT></tr>') #end %> </table>

    Read the article

  • Why are all response bodies after the first blank in Cucumber?

    - by James A. Rosen
    I'm using Cucumber (0.6.3), Cucumber-Rails (0.3.0), Webrat (0.7.0), and Rails (2.3.5) for some tests. The following scenario passes just fine: Scenario: load one page Given I am on the home page Then I should see "Welcome" The following, however, fails: Scenario: load two pages Given I am on the FAQ pag When I go to the home page Then I should see "Welcome" The problem is that the second @response.body is blank. I added a Rack middleware to get a little more information: class LogEachRequest def initialize(app); @app = app; @count = 0; end def call(env) puts "Processing request # #{@count += 1)" @app.call(env) end end It shows me only one request processed. That is, it only ever prints out Processing request # 1

    Read the article

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