Search Results

Search found 2003 results on 81 pages for 'james rogers'.

Page 9/81 | < Previous Page | 5 6 7 8 9 10 11 12 13 14 15 16  | Next Page >

  • Using StructureMap, how do you explicitly trigger the reinstantiation of a object with InstanceScope

    - by Mark Rogers
    I have an integration test harness where I want to teardown and then re-instantiate some of the singleton-scoped objects I've registered with StructureMap, after and before each test. This way I can simulate the actual run time environment, but not have the singleton's state being passed from one test to another. Maybe this isn't a great way to do an integration test, but I'm running out of alternative solutions (read open to any advice). So can an object with InstanceScope.Singleton, be re-instantiated? What's the best way to do re-instantiate a singleton-scoped object with StructureMap?

    Read the article

  • Characters in string changed after downloading HTML from the internet.

    - by Callum Rogers
    Using the following code, I can download the HTML of a file from the internet: WebClient wc = new WebClient(); // .... string downloadedFile = wc.DownloadString("http://www.myurl.com/"); However, sometimes the file contains "interesting" characters like é to é, ? to ↠and ????? to フシギダãƒ. I think it may be something to do with different unicode types or something, as each character gets changed into 2 new ones, perhaps each character being split in half but I have very little knowledge in this area. What do you think is wrong?

    Read the article

  • Stopping and Play button for Audio (Android)

    - by James Rattray
    I have this problem, I have some audio I wish to play... And I have two buttons for it, 'Play' and 'Stop'... Problem is, after I press the stop button, and then press the Play button, nothing happens. -The stop button stops the song, but I want the Play button to play the song again (from the start) Here is my code: final MediaPlayer mp = MediaPlayer.create(this, R.raw.megadeth); And then the two public onclicks: (For playing...) button.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { // Perform action on click button.setText("Playing!"); try { mp.prepare(); } catch (IllegalStateException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } mp.start(); // } }); And for stopping the track... final Button button2 = (Button) findViewById(R.id.cancel); button2.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { mp.stop(); mp.reset(); } }); Can anyone see the problem with this? If so could you please fix it... (For suggest) Thanks alot... James

    Read the article

  • Is there a predefined enumeration for Month in the .NET library?

    - by Mark Rogers
    I'm looking to see if there is an official enumeration for months in the .net framework. It seems possible to me that there is one, because of how common the use of month is, and because there are other such enumerations in the .net framework. For instance, there is an enumeration for the days in the week, System.DayOfWeek, which includes monday, tuesday, etc.. I'm wondering if there is one for the months in the year, ie. January, February, etc? Does anyone know? Thanks for reading!

    Read the article

  • Returning a variable in a public void...

    - by James Rattray
    Hello, I'm abit new to programming Android App's, however I have come across a problem, I can't find a way to make global variables -unlike other coding like php or VB.NET, are global variables possible? If not can someone find a way (and if possible implement the way into the code I will provide below) to get a value from the variable 'songtoplay' so I can use in another Public Void... Here is the code: final Spinner hubSpinner = (Spinner) findViewById(R.id.myspinner); ArrayAdapter adapter = ArrayAdapter.createFromResource( this, R.array.colours, android.R.layout.simple_spinner_item); adapter .setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); hubSpinner.setAdapter(adapter); // hubSpinner.setOnItemSelectedListener(new OnItemSelectedListener() { public void onItemSelected(AdapterView<?> parentView, View selectedItemView, int position, long id) { //code Object ttestt = hubSpinner.getSelectedItem(); final String test2 = ttestt.toString(); Toast message1 = Toast.makeText(Textbox.this, test2, Toast.LENGTH_LONG); message1.show(); String songtoplay = test2; // Need songtoplay to be available in another 'Public Void' } public void onNothingSelected(AdapterView<?> parentView) { //Code } }); Basically, it gets the value from the Spinner 'hubSpinner' and displays it in a Toast. I then want it to return a value for string variable 'songtoplay' -or find a way to make it global or useable in another Public Void, (Which is will a button, -loading the song to be played) Please help me, Thanks alot. James

    Read the article

  • Can Fluent nhibernate's automapper be configured to handle private readonly backing fields?

    - by Mark Rogers
    I like private readonly backing fields because some objects are mostly read-only after creation, and for collections, which rarely need to be set wholesale (instead using collection methods to modify the collection). For example: public class BuildingType : DomainEntity { /* rest of class */ public IEnumerable<ActionType> ActionsGranted { get { return _actionsGranted; } } private readonly IList<ActionType> _actionsGranted = new List<ActionType>(); private readonly Image _buildingTile; public virtual Image BuildingTile { get { return _buildingTile; } } } But as far as I remember fluent-nhibernate's automapper never had a solution for private readonly backing fields, I'm wondering if that's changed in the last few months. So here's my question: How do I configure automapper or create an automapping convention to map private readonly backing fields?

    Read the article

  • In Sphinx, can I register a bunch of keywords that should always be translated into links?

    - by Ross Rogers
    My doc strings have references to other python classes that I've defined. Every time Sphinx encounters one of these classes, I want it to insert a link to the documentation for that other class. Is this possible in Sphinx? Specifically, I have a doc string like: '''This class contains a bunch of Foo objects''' I could write: '''This class contains a bunch of :class:`~foo.Foo` objects''' but I would prefer that Sphinx finds all text matching Foo and makes it seem as though I had typed :class:~foo.Foo

    Read the article

  • Using RhinoMocks, how do you mock or stub a concrete class without an empty constructor?

    - by Mark Rogers
    Mocking a concrete class with Rhino Mocks seems to work pretty easy when you have an empty constructor on a class: public class MyClass{ public MyClass() {} } But if I add a constructor that takes parameters and remove the one that doesn't take parameters: public class MyClass{ public MyClass(MyOtherClass instance) {} } I tend to get an exception: System.MissingMethodException : Can't find a constructor with matching arguments I've tried putting in nulls in my call to Mock or Stub, but it doesn't work. Can I create mocks or stubs of concrete classes with Rhino Mocks, or must I always supply (implicitly or explicitly) a parameter-less constructor?

    Read the article

  • How can I allow undefined options when parsing args with Getopt

    - by Ross Rogers
    If I have a command line like: my_script.pl -foo -WHATEVER My script knows about --foo, and I want Getopt to set variable $opt_foo, but I don't know anything about -WHATEVER. How can I tell Getopt to parse out the options that I've told it about, and then get the rest of the arguments in a string variable or a list. An example: use strict; use warnings; use Getopt::Long; my $foo; GetOptions('foo' => \$foo); print 'remaining options: ', @ARGV; Then, issuing perl getopttest.pl -foo -WHATEVER gives Unknown option: whatever remaining options:

    Read the article

  • When to use certain optimizations such as -fwhole-program and -fprofile-generate with several shared libraries

    - by James
    Probably a simple answer; I get quite confused with the language used in the GCC documentation for some of these flags! Anyway, I have three libraries and a programme which uses all these three. I compile each of my libraries seperately with individual (potentially) different sets of warning flags. However, I compile all three libraries with the same set of optimisation flags. I then compile my main programme linking in these three libraries with its own set of warning flags and the same optimisation flags used during the libraries' compilation. 1) Do I have to compile the libraries with optimisation flags present or can I just use these flags when compiling the final programme and linking to the libraries? If the latter, will it then optimise all or just some (presumably that which is called) of the code in these libraries? 2) I would like to use -fwhole-program -flto -fuse-linker-plugin and the linker plugin gold. At which stage do I compile with these on ... just the final compilation or do these flags need to be present during the compilation of the libraries? 3) Pretty much the same as 2) however with, -fprofile-generate -fprofile-arcs and -fprofile-use. I understand one first runs a programme with generate, and then with use. However, do I have to compile each of the libraries with generate/use etc. or just the final programme? And if it is just the last programme, when I then compeil with -fprofile-use will it also optimise the libraries functionality? Many thanks, James

    Read the article

  • How do I get the sequence of numbers in a sorted-set that are between two integers in clojure?

    - by Greg Rogers
    Say I have a sorted-set of integers, xs, and I want to retrieve all the integers in xs that are [x, y), ie. between x and y. I can do: (select #(and (>= % x) (< % y)) xs) But this is inefficient - O(n) when it could be O(k log n) where k is the number of integers returned. I am just learning clojure so here is how I would do it in C++: set<int>::iterator first = xs.lower_bound(x); set<int>::iterator last = xs.upper_bound(y); for (; first != last; ++first) // do something with *first Can I do this in clojure?

    Read the article

  • In chrome with a greasemonkey extension, how can I modify an `<a...>` construct to strip out the onc

    - by Ross Rogers
    I want to modify an internal webpage to strip away some of the onclick behavior of certain links. The internal webpage has a bunch of links like: <a href="/slm/detail/ar/3116370" onclick="rallyPorthole.showDetail('/ar/view.sp','3116370','pj/b');return false;">foo de fa fa</a> How can I do an extension to Chrome so it does the following: for link in all_links: if link's href attribute matches '/slm/detail/ar/...': remove the onclick attribute

    Read the article

  • Why is Grails Searchable Plugin causing errors on Hibernate AutoFlush?

    - by Mark Rogers
    In the Grails 1.2.5 project that I am trying to troubleshoot, we use the Grails Searchable plugin .5.5.1. The problem is that whenever we attempt to index large sets domain classes, Grails keeps throwing: ERROR hibernate.AssertionFailure - an assertion failure occured (this may indicate a bug in Hibernate, but is more likely due to unsafe use of the session) org.hibernate.AssertionFailure: collection [domain-class] was not processed by flush() But the domain classes involved have been mapped and used by hibernate without issues outside of the calls to searchable plugin. The use of the searchable plugin goes as follows: Create a compass session with compass.openSession() Begin compass transaction: compassSession.beginTransaction() Then compassSession.create(result.get(0)) is called on an important unindexed domain class Finally compassTransaction.commit() is called to commit the transaction. Goto 2 and process next domain class Between the 3 and 4th Domain class, an autoflush is triggered that throws the error. Can anyone give me any hints about how to solve this problem? Has anyone encountered this problem before? I know that they had a systemic issue with this back in pre .5 versions of the searchable-plugin. Is it possible those issues weren't totally fixed?

    Read the article

  • When using Dependency Injection with StructureMap how do I chooose among multiple constructors?

    - by Mark Rogers
    I'm trying to get structuremap to build Fluent Nhibernate's SessionSource object for some of my intregration tests. The only problem is that Fluent's concrete implementation of ISessionSource (SessionSource) has 3 constructors: public SessionSource(PersistenceModel model) { Initialize(new Configuration().Configure(), model); } public SessionSource(IDictionary<string, string> properties, PersistenceModel model) { Initialize(new Configuration().AddProperties(properties), model); } public SessionSource(FluentConfiguration config) { configuration = config.Configuration; sessionFactory = config.BuildSessionFactory(); dialect = Dialect.GetDialect(configuration.Properties); } I've tried configuring my ObjectFactory supplying an argument for the first constructor but it seems like it wants to try the second one. How do I configure my ObjectFactory so that I can choose the first constructor or perhaps even another one if I decide to use that?

    Read the article

  • Using StructureMap, when a default concrete type is defined in one registry, can it be redefined in

    - by Mark Rogers
    In the project I'm working on I have a StructureMap registry for the main web project and another registry for my integration tests. During some of the tests I wire up the web project's registry, so that I can get objects out of the container for testing. In one case I want to be able to replace a default concrete type from the web registry with one in the test registry. Is this possible? How do you do it?

    Read the article

  • Can StructureMap be configured so that one can use different .config settings based on whether the p

    - by Mark Rogers
    I know that in StructureMap I can read from my *.config files (or files referenced by them), when I want to pass specific arguments to an object's constructor. ForRequestedType<IConfiguration>() .TheDefault.Is.OfConcreteType<SqlServerConfiguration>() .WithCtorArg("db_server_address") .EqualToAppSetting("data.db_server_address") But what I would like to do is read from one config setting in debug mode and another in release mode. Sure I could surround the .EqualToAppSetting("data.db_server_address"), with #if DEBUG, but for some reason those statements make me cringe a little when I put them in. I'd like to know if there was some way to do this with the StructureMap library itself. So can I feed my objects different settings based on whether the project is built in debug or release mode?

    Read the article

  • My mod_rewrite won't work, what's wrong?

    - by Tim Rogers
    I have the following rewrite rule, but nothing is hapenning at all when I try to use it. I have the file in the directory server.blahblahblah.com/todo and the following is my .htaccess file: Options +FollowSymLinks Options +Indexes RewriteEngine On RewriteBase / RewriteRule ^tasks/view/([0-9]+)?/$ controller.php?task=view&id=$1 RewriteRule ^tasks/view/([0-9]+).xml$ controller.php?task=viewxml&id=$1 RewriteRule ^tasks/new?/$ controller.php?task=new RewriteRule ^tasks/delete/([0-9]+)?/$ controller.php?task=delete&id=$1 RewriteRule ^tasks/completed/([0-9]+)?/$ controller.php?task=complete&id=$1 RewriteRule ^tasks?/$ controller.php?task=home Does anyone know why this won't work at all? Thanks, Tim

    Read the article

  • getting html tags from xml and echoing in php?

    - by Whitney Sarah Rogers
    I am trying to echo a result from xml into my html code form expedia. But I ran into a problem. There text is a little messed up: <areaInformation> Distances are calculated in a straight line from the property&apos;s location to the point of interest or attraction, and may not reflect actual travel distance. &lt;br /&gt;&lt;br /&gt; Distances are displayed to the nearest 0.1 mile and kilometre. &lt;p&gt;La Isla Shopping Mall - 0.5 km / 0.3 mi &lt;br /&gt;Yamil Lu&apos;um - 0.5 km / 0.3 mi &lt;br /&gt;Acuario Interactivo - 0.6 km / 0.3 mi &lt;br /&gt;Luxury Avenue - 1.5 km / 0.9 mi &lt;br /&gt;Cancun Golf Club at Pok Ta Pok - 2.2 km / 1.3 mi &lt;br /&gt;Nautilus Diving and Training Center - 2.6 km / 1.6 mi &lt;br /&gt;Cancun Convention Center - 2.8 km / 1.7 mi &lt;br /&gt;Plaza Caracol - 2.8 km / 1.8 mi &lt;br /&gt;Playa Tortuga - 3.1 km / 1.9 mi &lt;br /&gt;Aquaworld - 3.6 km / 2.2 mi &lt;br /&gt;Playa Langosta - 4.1 km / 2.6 mi &lt;br /&gt;Museo de Arte Popular Mexicano - 4.6 km / 2.9 mi &lt;br /&gt;Playa Linda - 5 km / 3.1 mi &lt;br /&gt;Playa Delfines - 6.1 km / 3.8 mi &lt;br /&gt;El Rey Ruins - 6.2 km / 3.8 mi &lt;br /&gt;&lt;/p&gt;&lt;p&gt;The preferred airport for ME Cancun - Complete ME All Inclusive is Cancun, Quintana Roo (CUN-Cancun Intl.) - 14.3 km / 8.9 mi. &lt;/p&gt; </areaInformation> And I echo it in php: <div id="hotelInfo"><?php echo $areaInfo ?></div> And of course I get this in the browser window: Distances are calculated in a straight line from the property's location to the point of interest or attraction, and may not reflect actual travel distance. <br /><br /> Distances are displayed to the nearest 0.1 mile and kilometre. <p>La Isla Shopping Mall - 0.5 km / 0.3 mi <br />Yamil Lu'um - 0.5 km / 0.3 mi <br />Acuario Interac etc. How can I fix this??? Any help would be greatly apreciated! Thanks!

    Read the article

  • Random Movement in a Fixed Container

    - by James Barracca
    I'm looking to create something that can move randomly inside of a fixed div container. I love the way the object moves in this example that I found searching this website... http://jsfiddle.net/Xw29r/15/ The code on the jsfiddle contains the following: $(document).ready(function(){ animateDiv(); }); function makeNewPosition(){ // Get viewport dimensions (remove the dimension of the div) var h = $(window).height() - 50; var w = $(window).width() - 50; var nh = Math.floor(Math.random() * h); var nw = Math.floor(Math.random() * w); return [nh,nw]; } function animateDiv(){ var newq = makeNewPosition(); var oldq = $('.a').offset(); var speed = calcSpeed([oldq.top, oldq.left], newq); $('.a').animate({ top: newq[0], left: newq[1] }, speed, function(){ animateDiv(); }); }; function calcSpeed(prev, next) { var x = Math.abs(prev[1] - next[1]); var y = Math.abs(prev[0] - next[0]); var greatest = x > y ? x : y; var speedModifier = 0.1; var speed = Math.ceil(greatest/speedModifier); return speed; }? CSS: div.a { width: 50px; height:50px; background-color:red; position:fixed; }? However, I don't believe the code above constricts that object at all. I need my object to move randomly inside of a container that is let's say for now... 1200px in width and 500px in height. Can someone steer me in the right direction? I'm super new to coding so I'm having a hard time finding an answer on my own. Thanks so much! James

    Read the article

  • How do you determine how coarse or fine-grained a 'responsibility' should be when using the single r

    - by Mark Rogers
    In the SRP, a 'responsibility' is usually described as 'a reason to change', so that each class (or object?) should have only one reason someone should have to go in there and change it. But if you take this to the extreme fine-grain you could say that an object adding two numbers together is a responsibility and a possible reason to change. Therefore the object should contain no other logic, because it would produce another reason for change. I'm curious if there is anyone out there that has any strategies for 'scoping', the single-responsibility principle that's slightly less objective?

    Read the article

< Previous Page | 5 6 7 8 9 10 11 12 13 14 15 16  | Next Page >