Search Results

Search found 622 results on 25 pages for 'aaron hammond'.

Page 21/25 | < Previous Page | 17 18 19 20 21 22 23 24 25  | Next Page >

  • How do I connect StaticListableBeanFactory with ClassPathXmlApplicationContext?

    - by Aaron Digulla
    In the setup of my test cases, I have this code: ApplicationContext context = new ClassPathXmlApplicationContext( "spring/common.xml" ); StaticListableBeanFactory testBeanFactory = new StaticListableBeanFactory(); How do I connect the two in such a way that tests can register beans in the testBeanFactory during setup and the rest of the application uses them instead of the ones defined in common.xml? Note: I need to mix a static (common.xml) and a dynamic configuration. I can't use XML for the latter because that would mean to write 1000 XML files.

    Read the article

  • What is the optimum way to select the most dissimilar individuals from a population?

    - by Aaron D
    I have tried to use k-means clustering to select the most diverse markers in my population, for example, if we want to select 100 lines I cluster the whole population to 100 clusters then select the closest marker to the centroid from each cluster. The problem with my solution is it takes too much time (probably my function needs optimization), especially when the number of markers exceeds 100000. So, I will appreciate it so much if anyone can show me a new way to select markers that maximize diversity in my population and/or help me optimize my function to make it work faster. Thank you # example: library(BLR) data(wheat) dim(X) mdf<-mostdiff(t(X), 100,1,nstart=1000) Here is the mostdiff function that i used: mostdiff <- function(markers, nClust, nMrkPerClust, nstart=1000) { transposedMarkers <- as.array(markers) mrkClust <- kmeans(transposedMarkers, nClust, nstart=nstart) save(mrkClust, file="markerCluster.Rdata") # within clusters, pick the markers that are closest to the cluster centroid # turn the vector of which markers belong to which clusters into a list nClust long # each element of the list is a vector of the markers in that cluster clustersToList <- function(nClust, clusters) { vecOfCluster <- function(whichClust, clusters) { return(which(whichClust == clusters)) } return(apply(as.array(1:nClust), 1, vecOfCluster, clusters)) } pickCloseToCenter <- function(vecOfCluster, whichClust, transposedMarkers, centers, pickHowMany) { clustSize <- length(vecOfCluster) # if there are fewer than three markers, the center is equally distant from all so don't bother if (clustSize < 3) return(vecOfCluster[1:min(pickHowMany, clustSize)]) # figure out the distance (squared) between each marker in the cluster and the cluster center distToCenter <- function(marker, center){ diff <- center - marker return(sum(diff*diff)) } dists <- apply(transposedMarkers[vecOfCluster,], 1, distToCenter, center=centers[whichClust,]) return(vecOfCluster[order(dists)[1:min(pickHowMany, clustSize)]]) } }

    Read the article

  • iPhone using Camera causes array to be unloaded

    - by Aaron Dale
    I have an array of images that I'm displaying in a UITableView. When choosing images from the library using the UIImagePicker, everything is totally fine and I can add a lot of images to the array. As soon as I add an image from the camera using the Picker I receive a memory warning and my array of images is ditched. Coming back from the camera picker, the table view is empty. The UIImagePicker when using the camera as the source generates a memory warning before I have a chance to resize the image.

    Read the article

  • Slideshow in Javascript without framework, animation?

    - by aaron
    The issue I am having is fairly complicated to explain. I have written up a javascript that displays an image slideshow, and it works fairly well, despite using up more resources than I would like // imgArr[] is populated before var i = 0; var pageLoaded = 0; window.onload = function() {pageLoaded = 1;} function loaded(i,f) { if (document.getElementById(i) != null) f(); else if (!pageLoaded) setTimeout('loaded(\''+i+'\','+f+')',100); } } function displaySlideshow() { document.getElementById(destinationId).innerHTML = '<div id="slideWindow"><img src="'+imgArr[i]+'" />' + '<img src="'+imgArr[i + 1]+'" /></div>'; setTimeout('displaySlideshow()',1000*3); i++; if (i >= imgArr.length - 1) i = 0; } loaded(destinationId,displaySlideshow); So, this script dynamically adds two images to a HTML element, and it is wrapped in a div. The div is styled with the height and width of the image, with the overflow (the second image) hidden. The second image is below the first, and the slideshow is meant to go from RIGHT to LEFT. My inquiry is twofold: 1) Is there a more efficient way of doing this? 2) How would I animate the images? Would I need to put the second image on the right of the first with CSS somehow, and then set a timer to pull the images (via a style) leftward?

    Read the article

  • Exposing console apps to the web with Ruby

    - by Aaron
    I'm looking to expose an interactive command line program via JSON or another RPC style service using Ruby. I've found a couple tricks to do this, but im missing something when redirecting the output and input. One method at least on linux is to redirect the stdin and stdout to a file then read and write to that file asynchronously with file reads and writes. Another method ive been trying after googling around was to use open4. Here is the code I wrote so far, but its getting stuck after reading a few lines from standard output. require "open4" include Open4 status = popen4("./srcds_run -console -game tf +map ctf_2fort -maxplayers 6") do |pid, stdin, stdout, stderr| puts "PID #{pid}" lines="" while (line=stdout.gets) lines+=line puts line end while (line=stderr.gets) lines+=line puts line end end Any help on this or some insight would be appreciated!

    Read the article

  • Find a variable with a given value in VS2008

    - by Aaron
    I have an instance variable with several members, many of which have their own members and so on. Using the debugger and watch variables, I found a string variable with a specific value that I need by diving into this variable's members. However, after spending some time on other things and coming back to this, I am now unable to find where this value is located. When I have my application paused, is there a way to search the values of variables in the current context for a given value? To clarify, if I have the given structure: myVariable | |--aMember1 | |--subMember = "A value" | |--aMember2 |--subMember = "Another value" Is there a way (possibly using the watch list in VS debugger) to search myVariable for any member or submember with the value "A value", returning to me the path myVariable->aMember->subMember?

    Read the article

  • Attempted GCF app for Android

    - by Aaron
    I am new to Android and am trying to create a very basic app that calculates and displays the GCF of two numbers entered by the user. Here is a copy of my GCF.java: package com.example.GCF; import java.util.Arrays; import android.app.Activity; import android.os.Bundle; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.EditText; import android.widget.TextView; public class GCF extends Activity { private TextView mAnswer; private EditText mA, mB; private Button ok; private String A, B; private int iA, iB; public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); mA = (EditText) findViewById(R.id.entry); mB = (EditText) findViewById(R.id.entry1); ok = (Button) findViewById(R.id.ok); mAnswer = (TextView) findViewById(R.id.answer1); ok.setOnClickListener(new OnClickListener() { public void onClick(View v) { A = mA.getText().toString(); B = mB.getText().toString(); } }); // the String to int conversion happens here iA = Integer.parseInt(A.trim()); iB = Integer.parseInt(B.trim()); while (iA != iB) { int[] nums={ iA, iB, Math.abs(iA-iB) }; Arrays.sort(nums); iA=nums[0]; iB=nums[1]; } updateDisplay(); } private void updateDisplay() { mAnswer.setText( new StringBuilder().append(iA)); } } Any Suggestions? Thank you!

    Read the article

  • Representing a Gameworld that is Irregularly shaped

    - by Aaron M
    I am working on a project where the game world is irregularly shaped (Think of the shape of a lake). this shape has a grid with coordinates placed over it. The game world is only on the inside of the shape. (Once again, think Lake) How can I efficiently represent the game world? I know that many worlds are basically square, and work well in a 2 or 3 dimension array. I feel like if I use an array that is square, then I am basically wasting space, and increasing the amount of time that I need to iterate through the array. However, I am not sure how a jagged array would work here either. Example shape of gameworld X XX XX X XX XXX XXX XXXXXXX XXXXXXXX XXXXX XX XX X X Edit: The game world will most likely need each valid location stepped through. So I would a method that makes it easy to do so.

    Read the article

  • Add a Message Bar or Info Bar to Word using interop or vsto

    - by Aaron
    I have VS 2010 and Word 2010. In Word 2010 there is sometimes a message/warning bar that pops up under the ribbon but above the body of the document that allows the user to do an action. It looks something like this... Can I programmatically though VSTO or Interop create a custom bar that allows the user to click a button and then it executes some code. If not, is there an alternative popup or dialog box that will do something like this? Thanks, A

    Read the article

  • PHP GD problem--not enough permission to make image?

    - by aaron
    Error: Warning: imagejpeg() [function.imagejpeg]: Unable to open 'images/xxx/xxx.jpg' for writing: Permission denied in /usr/www/users/xxx/resources/func.createthumbs.php on line 48 images/xxx/xxx/xxx.jpg Warning: Cannot modify header information - headers already sent by (output started at /usr/www/users/xxx/resources/updatethumbs.php:17) in /usr/www/users/xxx/resources/func.createthumbs.php on line 3 So... How can I change the permission? This is being run on a shared server--is it possible?

    Read the article

  • Windows 7 Missing Shortnames

    - by Aaron Bush
    I noticed that if you get a Scripting.File object from certain windows files (Example: any wav in C:\Windows\Media) the Scripting.File.ShortPath property shows the long path. Curious I dropped to the command prompt and tried Dir /A /X and sure enough the short paths were missing from all the files in that directory. Anyone know: A.) What that's all about? B.) How to get the short path of a file that doesn't seem to have one?

    Read the article

  • What is the best way to include other scripts?

    - by Aaron H.
    The way you would normally include a script in bash is source. For example: main #!/bin/bash source incl.bash echo "The main script" incl.bash echo "The included script" The output of executing ./main: The included script The main script Now, if you attempt to execute that shell script from another location, it can't find the include unless it's in your PATH. What's a good way to ensure that your script can find the included script, especially if for instance, the script needs to be portable?

    Read the article

  • Qt: How to use QTimer to print a message to a QTextBrowser every 10 seconds?

    - by Aaron McKellar
    Hello, I have working at this for hours and cannot figure it out nor can I find any help online that works. Basically the gist of what I am trying to accomplish is to have a Qt GUI with a button and a QTextBrowser. When I push the button I want it to diplay a message and then keep printing this message every 10 seconds. I figured I would use QTimer because it makes sense to have a timer to diplay the message every 10 seconds. When I originally implemented this into my buttonClicked() SLOT it caused the program to freeze. I looked online for a solution and found QApplication::processEvents(). So basically in my function I had something like this: while(1) { QTimer *timer; connect(...) //omitted parameters for this example timer.start(10000); ui->diplay->append("Message"); while(timer.isActive()) { QApplication::processEvents() } } I figured it would break out of the timer.isActive() while loop but it won't it simply stays in there. So I figured this is a threading issue. So I figured out how to use QThreads but I still can't get it to work. Basically when I create a thread with a timer on it and the thread tells the timer to start, the program closes and the console says "The program has unexpectedly finished". There has to be an easy way to do this but my track record with Qt has always been that th

    Read the article

  • Why is ServerVariables["HTTP_REFERER"] skipping a page?

    - by Aaron
    Here is my situation: Page1.aspx redirects to Page2.aspx which does some processing (does not display to the user) and then redirects to Page3.aspx which checks the ServerVariables["HTTP_REFERER"] or Request.UrlReferrer. I understand that the referring information can sometimes be blank and can't be entirely relied upon; however the ServerVariables["HTTP_REFERER"] or Request.UrlReferrer on Page3.aspx is showing Page1.aspx instead of Page2.aspx which I would have expected. Does the referring information only get set if the page displays to the user? Redirecting is done using Response.Redirect in order to change the URL in the address bar of the browser.

    Read the article

  • .htaccess mod_rewrite subdomains

    - by Aaron
    .htaccess: RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{HTTP_HOST} ^site\.com$ [NC] RewriteRule ^(.*)$ http://www.site.com/$1 [L,R=301] RewriteRule ^new/?$ index.php?section=new This works great and all, but I have recently implemented a subdomain m.site.com which reads off of a /mobile directory. When accessing m.site.com/new it will not display anything except return a server error. What can I do to correct this problem? Basically, I want http://m.site.com/new To achieve the same affect as http://www.site.com/new

    Read the article

  • Easy Regex question

    - by Aaron
    Trying to replace the first 12 digits of credit card numbers with X's in a predictable blob of text that contains the string: Credit Card Number: 1234123412341234 Here's my PHP function: preg_replace('/Credit Card Number: ([0-9]{12})/','Credit Card Number: XXXXXXXXXXXX',$str); Help?

    Read the article

  • Centering An Inline-Block DIV

    - by Aaron Brewer
    Does anybody know how to center align a DIV that has the display set to inline-block? I cannot set the display to block because I have a background image that needs to be repeated, and it needs to expand based on the content. It sits inside of a parent div, in which is larger when it comes to width. So all in all. Does anyone have a fix to center align a div with the display set to inline-block? And no, text-align: center; does not work, nor does margin: 0 auto; jsFiddle: http://jsfiddle.net/HkvzM/ Thank you!

    Read the article

  • Rails: How to have dynamic association

    - by Aaron Dufall
    I'll use an example to explain what behaviour I would like to achieve. If you had a project management app and you added a task, but not all the contributors are users of the app. So when you adding contributors to the task you can enter a user name or email address. Here is the part that I'm finding a little tricky. The task model has many contributors which are linked through the user model, but from this point on I want to achieve 2 things. Store the non members email(this would obviously be quite simple) If that email address was to create an account it would then link that user to the task and remove the temporally saved email. This way, when that user creates an account all the related tasks will already be associated with their email. Is this something that i could achieve with a polymorphic association? or is there something else I should be looking at?

    Read the article

  • Hibernate-Search: Search records from the last x hours, x days, x months, x years?

    - by Aaron
    @Entity @Table(name = "USERS") public class User { @Id @GeneratedValue(strategy = GenerationType.AUTO) private long id; @Column(name = "USERNAME", nullable = false, length = 20) private String userName; @Column(name = "PASSWORD", nullable = false, length = 10) private String password; @Column(name = "Date", nullable = false ) private Date date; } How can I select the records which have the date between [now | now-x hours] [now | now-x days] [now | now-x months] [now | now-x years]

    Read the article

  • Using Javascript to detect the bottom of the window and ignoring all events when a request is loading

    - by Aaron Reba
    I have an anonymous function to detect the user has scrolled to the bottom of the window. Inside of the anonymous function, I have a call to a database that takes a while to complete. var allowing_more = 1; $(window).scroll(function() { if (allowing_more == 1){ if ($(window).scrollTop() + $(window).height() == $(document).height()) { allowing_more = 0; //query allowing_more = 1; } } }); In this time, if the user scrolls to the bottom of the window again, it seems a queue is made holding the occurences the user scrolled to the bottom of the window while the query was loading. Upon completing of the query, these occurences are then executed. I have a boolean statement to detect if the anonymous function is accepting more query requests but this seems to be ignored. Is there some sort of way to ignore an anonymous function temporarily and re-enable it?

    Read the article

  • cin.getline() equivalent when getting a char from a function.

    - by Aaron
    From what I understand cin.getLine gets the first char(which I think it a pointer) and then gets that the length. I have used it when cin for a char. I have a function that is returning a pointer to the first char in an array. Is there an equivalent to get the rest of the array into a char that I can use the entire array. I explained below what I am trying to do. The function works fine, but if it would help I could post the function. cmd_str[0]=infile();// get the pointer from a function cout<<"pp1>"; cout<< "test1"<<endl; // cin.getline(cmd_str,500);something like this with the array from the function cout<<cmd_str<<endl; this would print out the entire array cout<<"test2"<<endl; length=0; length= shell(cmd_str);// so I could pass it to this function

    Read the article

  • Python os.path.walk() method

    - by Aaron Moodie
    I'm currently using the walk method in a uni assignment. It's all working fine, but I was hoping that someone could explain something to me. in the example below, what is the a parameter used for on the myvisit method? >>> from os.path import walk >>> def myvisit(a, dir, files): ... print dir,": %d files"%len(files) >>> walk('/etc', myvisit, None) /etc : 193 files /etc/default : 12 files /etc/cron.d : 6 files /etc/rc.d : 6 files /etc/rc.d/rc0.d : 18 files /etc/rc.d/rc1.d : 27 files /etc/rc.d/rc2.d : 42 files /etc/rc.d/rc3.d : 17 files /etc/rc.d/rcS.d : 13 files

    Read the article

  • How is a set partitioned into valid and invalid items using LINQ?

    - by Aaron Anodide
    Is there a way to write a single LINQ expression to get the same result of the following code? var validations = new Func<conversion, bool>[] { c => c.affiliate.affiliate_id > 0, c => c.campaign_id > 0 }; var invalidConversions = from c in extractedConversions where validations.Any(valid => !valid(c)) select c; var validConversions = from c in extractedConversions where validations.All(valid => valid(c)) select c;

    Read the article

< Previous Page | 17 18 19 20 21 22 23 24 25  | Next Page >