Search Results

Search found 1462 results on 59 pages for 'adam johns'.

Page 47/59 | < Previous Page | 43 44 45 46 47 48 49 50 51 52 53 54  | Next Page >

  • How to implement the API/SPI Pattern in Java?

    - by Adam Tannon
    I am creating a framework that exposes an API for developers to use: public interface MyAPI { public void doSomeStuff(); public int getWidgets(boolean hasRun); } All the developers should have to do is code their projects against these API methods. I also want them to be able to place different "drivers"/"API bindings" on the runtime classpath (the same way JDBC or SLF4J work) and have the API method calls (doSomeStuff(), etc.) operate on different 3rd party resources (files, servers, whatever). Thus the same code and API calls will map to operations on different resources depending on what driver/binding the runtime classpath sees (i.e. myapi-ftp, myapi-ssh, myapi-teleportation). How do I write (and package) an SPI that allows for such runtime binding, and then maps MyAPI calls to the correct (concrete) implementation? In other words, if myapi-ftp allows you to getWidgets(boolean) from an FTP server, how would I could this up (to make use of both the API and SPI)? Bonus points for concrete, working Java code example! Thanks in advance!

    Read the article

  • Win32: Reading WS_VSCROLL style from a combo box (or list box)

    - by Adam Tegen
    I'm iterating through the controls in a dialog and I'm trying to determine if a combobox was created with the WS_VSCROLL style. The style, obtained from GetWindowLong(hwnd, GWL_STYLE), doesn't contain the WS_VSCROLL bit (0x200000), even when I know it was set on create. Clarification: I am looking to see if the ComboBox was created with the WS_VSCROLL style. Calling GetWindowLong() (or using spy++) to get the style of the combo's listbox will include WS_VSCROLL if a scrollbar is needed to based on the current contents of the list. I am trying to determine if the ComboBox was created with WS_VSCROLL, not if a scrollbar is currently visible.

    Read the article

  • Rails - Beginner wants feedback on how they've modeled their app and how to do it better.

    - by adam
    I think the way I've modelled my app is a bit fishy and i need to rejig things, im just not sure how. I've already re-jigged and refactored before. It took a long time ( I'm a beginner ) and I'm hesitant to it again in case i head off in the wrong direction again. Basic Idea, user can submit an answer, another user can mark it correct or incorrect. If incorrect they have to write the correct answer. Users can view their and everybody else's correct and incorrect answers. So I did it this way class Answer has_one: correction end class Correction belongs_to :answer end when a user marks an answer as correct, I set checked_at:DateTime and checked_by_id:integer on the Answer object to keep track of who checked the answer and when. For incorrect answers I create a correction object which holds the correct answer and again checked_by and checked_at details. I don't like this because I have checked_by and checked_at in both models. It just doesn't sit right. Possible solutions are: Create a third model such as VerifiedAnswer and move the checked_by/at attributes to that. It will handle the situtation where an answer is marked correct. Or are these models thin enough (they dont have any other attributes) that I can just have one model ( Answer ) that has all the attributes to store all this information?

    Read the article

  • Version control PHP Web Project

    - by Adam Lerman
    We have a php project that we would like to version control. Right now there are three of us working on a "Dev" version of the project that all have our Eclipse linked to it with just an external folder, and thus no version control. What is the right way, and what is the best way, to version control this (not necessarily the same I dont think) We have a SVN set up but just need to find a good way to check in and check out that lets us test on the dev server. Any ideas?

    Read the article

  • What's the best way to link formal specs to JIRA enchancement requests?

    - by Adam
    What's the best way to link formal specs to JIRA enhancement requests? I want to track changes to specifications using JIRA. Ideally, I'd like to refer to a functional ID reference in a JIRA ticket (e.g. MYAPPAPPROVAL LOGICMAIN SCREEN), so that program managers can retrospectively categorise defects. The reason for this, is so that QA scripts and documentation tickets can be searched/categorised meaningfully in the tracking system. There seems to be a million possible ways to do this, e.g. should I write a custom component to select functional IDs from a tree? should I write the specs in confluence, or another CMS with a TrackBack facility? should I include a link to the documentation URL? should I use some other 3rd party plugin application? should I use some Atlassian application that i'm unaware of? am I using the wrong tracking tool/process to measure spec growth? What's the best way, in your experience?

    Read the article

  • OCR combined with font recognition?

    - by Adam
    I have a bold idea where a user could take an image like the following and in a few seconds of processing, be able to edit a document which looks roughly the same. The software would use WhatTheFont (or something similar) to recognize the fonts used, and OCR and other software to handle the font size, color, line-spacing, and of course the text content itself. In the case of the example image, there would be three separate "textboxes" produced, each starting at the upper left corner of the text, and extending as far to the bottom right as it could before running into another text box. So the user would then see something like this: (The rectangles are just used to show the boundaries of each textbox.) From here, the user would be able to edit the text in each of these boxes to create a new document. Of course there are tons of obvious uses for such an application, especially on a mobile phone with a built in camera. So my questions are the following: I doubt the answer is yes, but does anything do this already? If I'm going to try to build this, what should I write it in? Can I use Python? What would be the best OCR libraries to start with? Is there a service other than WhatTheFont for font recognition that has better API support? Anybody want to help me build it? :) etc. etc. Update: One thing I wanted to mention (but forgot) is I would also like the background to be preserved. In other words, if the example above had an image behind the text, I'd like the document to use that image with text removed. I know this complicates things a lot because that would require some image editing techniques too (something akin to Photoshop CS5' "content-aware fill"). But if we can solve diminished reality on iPhones, I think we can figure this out!

    Read the article

  • Rails - using :include to find objects based on their child's attributes

    - by adam
    I have a sentence and correction model class Sentence < ActiveRecord::Base has_one :correction class Correction < ActiveRecord::Base belongs_to :sentence and I'm trying find all sentences which don't have a correction. To do this I'm simply looking for corrections which don't exist i.e. whose id = nil. But it is failing and i can't figure out why Sentence.find :all, :include => :correction, :conditions => {:correction => {:id => nil}} Perhaps its the syntax or maybe just the overall approach. Can anyone help?

    Read the article

  • Getting req.params in order in Express JS

    - by Adam Terlson
    In Express, is there a way to get the arguments passed from the matching route in the order they are defined in the route? I want to be able to apply all the params from the route to another function. The catch is that those parameters are not known up front, so I cannot refer to each parameter by name explicitly. app.get(':first/:second/:third', function (req) { output.apply(this, req.mysteryOrderedArrayOfParams); // Does this exist? }); function output() { for(var i = 0; i < arguments.length; i++) { console.log(arguments[i]); } } Call on GET: "/foo/bar/baz" Desired Output (in this order): foo bar baz

    Read the article

  • How exactly do you use json_decode to pass a javascript array to php?

    - by Adam
    This is how I got my php array to javascript echo 'var daysofweek = '.json_encode($daysofweek).';'; Now I am aware that json_decode can do the opposite, however the problem is I don't know the syntax to do so. I tried: <script> var array_days = new Array(); array_days[] = "psdfo"; array_days[] = "bsdf"; <?php $array_days = json_decode(?>array_days<?php);?> </script> yes im clueless. I forgot to mention that I want to send an array through post, having all my information regarding all the form values dynamically created by javascript. Otherwise, I wouldn't know which name="" to look for as it will be decided by the user. Unless someone else has an alternative solution...

    Read the article

  • I need help to disable shadowbox from resizing

    - by Adam
    This overlay seems to be the only overlay plugin that works within my schools wonky template... but the problem is that when the browser is resized the shadowbox resizes too, clipping the contents inside. I want it so the box stats fixed and if the browser does get smaller the browser will have scrollbars. I know it's been modified before, but i dont know where to start. I cant even find an unminified version of the .js file. Thanks

    Read the article

  • A question about making a C# class persistant during a file load

    - by Adam
    Apologies for the indescriptive title, however it's the best I could think of for the moment. Basically, I've written a singleton class that loads files into a database. These files are typically large, and take hours to process. What I am looking for is to make a method where I can have this class running, and be able to call methods from within it, even if it's calling class is shut down. The singleton class is simple. It starts a thread that loads the file into the database, while having methods to report on the current status. In a nutshell it's al little like this: public sealed class BulkFileLoader { static BulkFileLoader instance = null; int currentCount = 0; BulkFileLoader() public static BulkFileLoader Instance { // Instanciate the instance class if necessary, and return it } public void Go() { // kick of 'ProcessFile' thread } public void GetCurrentCount() { return currentCount; } private void ProcessFile() { while (more rows in the import file) { // insert the row into the database currentCount++; } } } The idea is that you can get an instance of BulkFileLoader to execute, which will process a file to load, while at any time you can get realtime updates on the number of rows its done so far using the GetCurrentCount() method. This works fine, except the calling class needs to stay open the whole time for the processing to continue. As soon as I stop the calling class, the BulkFileLoader instance is removed, and it stops processing the file. What I am after is a solution where it will continue to run independently, regardless of what happens to the calling class. I then tried another approach. I created a simple console application that kicks off the BulkFileLoader, and then wrapped it around as a process. This fixes one problem, since now when I kick off the process, the file will continue to load even if I close the class that called the process. However, now the problem I have is that cannot get updates on the current count, since if I try and get the instance of BulkFileLoader (which, as mentioned before is a singleton), it creates a new instance, rather than returning the instance that is currently in the executing process. It would appear that singletons don't extend into the scope of other processes running on the machine. In the end, I want to be able to kick off the BulkFileLoader, and at any time be able to find out how many rows it's processed. However, that is even if I close the application I used to start it. Can anyone see a solution to my problem?

    Read the article

  • C# Attributes Aren't Supposed to Inherit

    - by Adam
    Since attributes don't inherit in C# (at least I didn't think they did) - how does the following code still display the Hello popup when the MyTestMethod test is run: [TestClass] public class BaseTestClass { [TestInitialize] public void Foo() { System.Windows.Forms.MessageBox.Show("Hello"); } } [TestClass] public class TestClass : BaseTestClass { [TestMethod] public void MyTestMethod() { Assert.IsTrue(true); } }

    Read the article

  • Ruby on Rails: Best way to save search queries in a database

    - by Adam Templeton
    For a RoR app I'm helping develop, I need to save all search queries in a database so I can analyze them later. My plan right now is to create a Result model and table, and just save each search query's text in that table, along with a user's ID, the time, etc. However, the app has about 15,000 users, so I'm afraid the single table approach won't be super efficient when it comes time to parse that data. (The database is setup via MySQL, if that factors in at all.) Am I just being paranoid? Is there a Ruby gem that handles this sort of thing, or a better approach I could take? Any input would be appreciated.

    Read the article

  • JavaScript Prototype and Encapsulation

    - by Adam Davies
    Sorry I'm probably being a realy noob here...but: I have the following javascript object: jeeni.TextField = (function(){ var tagId; privateMethod = function(){ console.log("IN: privateMethod"); } publicMethod = function(){ console.log("IN: publicMethod: " + this.tagId); } jeeni.TextField = function(id){ console.log("Constructor"); this.tagId = id; } jeeni.TextField.prototype = { constructor: jeeni.TextField, foo: publicMethod }; return jeeni.TextField; }()); Now when I run the following code I get the corresponding result: var textField1 = new jeeni.TextField(21); // Outputs: Constructor textField1.foo(); // Outputs: IN: publicMethod: 21 console.log(textField1.tagId); // Outputs: 21 console.log(textField1.privateMethod); // Outputs: undefined So my question is why is privateMethod hidden and tagId is not. I want them both to be private scope. Please help a noob. Thanks

    Read the article

  • What was your first home computer?

    - by Adam Tegen
    What was your first home computer? The one that made you "fall in love" with programming. There are 300+ entries, many (most?) of which are duplicates. As with all StackOverflow Poll type Q&As, please make certain your answer is NOT listed already before adding a new answer - searching doesn't always find it (model naming variations, I assume). If it already exists, vote that one up so we see what the most popular answer is, rather than duplicating an existing entry. If you see a duplicate, vote it down so the top entries have only one of each model listed. If you have interesting or additional information to add, use a comment or edit the original entry rather than creating a duplicate.

    Read the article

  • Unable to .append(); without eliminating all the spaces in the code

    - by Adam
    $('#form_holder').append('<div id="spec_id_'+count+'"><div class="avail_container"> <input class="avail_fields" type="checkbox" checked="checked" name="special'+count+'" /><span class="avail_field_label">Special Date</span></div> <div class="avail_container"><div class="avail_time_container"><span class="field_label">Time</span> <select name="special'+count+'_time_from_1"> <?php for ($t = 0; $t<24; $t++){ ?> <option value="<?php echo $t; ?>"><?php echo $t; ?></option> <?php } ?> </select>: <select name="special'+count+'_time_from_2"> <?php for ($t = 0; $t<60; $t+=15){ ?> <option value="<?php if($t == 0){ echo $t . '' . $t; }else{ echo $t; } ?>"><?php if($t == 0){ echo $t . '' . $t; }else{ echo $t; } ?></option> <?php } ?> </select> <span class="field_label">to</span> <select name="special'+count+'_time_to_1"> <?php for ($t = 0; $t<24; $t++){ ?> <option value="<?php echo $t; ?>"><?php echo $t; ?></option> <?php } ?> </select>: <select name="special'+count+'_time_to_2"> <?php for ($t = 0; $t<60; $t+=15){ ?> <option value="<?php if($t == 0){ echo $t . '' . $t; }else{ echo $t; } ?>"><?php if($t == 0){ echo $t . '' . $t; }else{ echo $t; } ?></option> <?php } ?> </select> </div> </div> </div>'); I'm assuming javascript or jquery does not like breaks like I have here, because all my javascript code does not work. What would be an alternative to eliminating all the spaces, which would make viewing the code difficult?

    Read the article

  • Loop through Javascript array, print with string.

    - by Adam
    I have a simple array like: var myArr=["one","two","three"]; an I have a counting loop, which increases the value of var "i" by one. What I want to do is print the next value from the array each time the loop runs, next to a text string, like so: alert('value number '+myArr[i]+); But for some reason I can't get this to work. The following code works, so I'm assuming I'm not calling the counter right: alert('value number '+myArr[0]+);

    Read the article

  • Multiple column Union Query without duplicates

    - by Adam Halegua
    I'm trying to write a Union Query with multiple columns from two different talbes (duh), but for some reason the second column of the second Select statement isn't showing up in the output. I don't know if that painted the picture properly but here is my code: Select empno, job From EMP Where job = 'MANAGER' Union Select empno, empstate From EMPADDRESS Where empstate = 'NY' Order By empno The output looks like: EMPNO JOB 4600 NY 5300 MANAGER 5300 NY 7566 MANAGER 7698 MANAGER 7782 MANAGER 7782 NY 7934 NY 9873 NY Instead of 5300 and 7782 appearing twice, I thought empstate would appear next to job in the output. For all other empno's I thought the values in the fields would be (null). Am I not understanding Unions correctly, or is this how they are supposed to work? Thanks for any help in advance.

    Read the article

  • How to change size of UIButton

    - by Adam
    I'm trying to resize a UIButton in my iPhone app. I have a UIButton synthesized and when I call the following code, it moves on the screen, but the width & height of the button never change. button.frame.size = CGRectMake(104, 68, 158, 70); For example, when I change the height (70) to 40, the height of the button does not change. If I change the x or y, however, it will move on the screen. Any ideas?

    Read the article

  • Django Custom Field: Only run to_python() on values from DB?

    - by Adam Levy
    How can I ensure that my custom field's *to_python()* method is only called when the data in the field has been loaded from the DB? I'm trying to use a Custom Field to handle the Base64 Encoding/Decoding of a single model property. Everything appeared to be working correctly until I instantiated a new instance of the model and set this property with its plaintext value...at that point, Django tried to decode the field but failed because it was plaintext. The allure of the Custom Field implementation was that I thought I could handle 100% of the encoding/decoding logic there, so that no other part of my code ever needed to know about it. What am I doing wrong? (NOTE: This is just an example to illustrate my problem, I don't need advice on how I should or should not be using Base64 Encoding) def encode(value): return base64.b64encode(value) def decode(value): return base64.b64decode(value) class EncodedField(models.CharField): __metaclass__ = models.SubfieldBase def __init__(self, max_length, *args, **kwargs): super(EncodedField, self).__init__(*args, **kwargs) def get_prep_value(self, value): return encode(value) def to_python(self, value): return decode(value) class Person(models.Model): internal_id = EncodedField(max_length=32) ...and it breaks when I do this in the interactive shell. Why is it calling to_python() here? >>> from myapp.models import * >>> Person(internal_id="foo") Traceback (most recent call last): File "<console>", line 1, in <module> File "/usr/local/lib/python2.6/dist-packages/django/db/models/base.py", line 330, in __init__ setattr(self, field.attname, val) File "/usr/local/lib/python2.6/dist-packages/django/db/models/fields/subclassing.py", line 98, in __set__ obj.__dict__[self.field.name] = self.field.to_python(value) File "../myapp/models.py", line 87, in to_python return decode(value) File "../myapp/models.py", line 74, in decode return base64.b64decode(value) File "/usr/lib/python2.6/base64.py", line 76, in b64decode raise TypeError(msg) TypeError: Incorrect padding I had expected I would be able to do something like this... >>> from myapp.models import * >>> obj = Person(internal_id="foo") >>> obj.internal_id 'foo' >>> obj.save() >>> newObj = Person.objects.get(internal_id="foo") >>> newObj.internal_id 'foo' >>> newObj.internal_id = "bar" >>> newObj.internal_id 'bar' >>> newObj.save() ...what am I doing wrong?

    Read the article

  • Best practices for storing & selecting time/date with php & mysql?

    - by Adam
    I often find myself storing data in a mysql database, and then wanting to display all sorts of stats about my data, specifically stuff like 'how many rows do I have for this date, or that date'. Does anyone know of (or could write) a good tutorial on this subject? Ideally a good tutorial would overview: Best practices when storing the data (i.e. what formats to use, how to use them servertime vs. generated time, etc.) Best practices when selecting data from the database with php (i.e. how to sort rows by date, how to retrieve only rows from a certain date, or a certain hour, etc).. Timezones and other issues that might come up. Thanks in advance.

    Read the article

< Previous Page | 43 44 45 46 47 48 49 50 51 52 53 54  | Next Page >