Search Results

Search found 697 results on 28 pages for 'matthew guay'.

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

  • need help with a small Python program

    - by Matthew
    Basically looking for a small program that will do nothing but activate the F6 key every x seconds for the active window, x being whatever number I enter, and the program stops with the hit of like ctrl+z or something. What would be a good way to do this?

    Read the article

  • Is there a fast alternative to creating a Texture2D from a Bitmap object in XNA?

    - by Matthew Bowen
    I've looked around a lot and the only methods I've found for creating a Texture2D from a Bitmap are: using (MemoryStream s = new MemoryStream()) { bmp.Save(s, System.Drawing.Imaging.ImageFormat.Png); s.Seek(0, SeekOrigin.Begin); Texture2D tx = Texture2D.FromFile(device, s); } and Texture2D tx = new Texture2D(device, bmp.Width, bmp.Height, 0, TextureUsage.None, SurfaceFormat.Color); tx.SetData<byte>(rgbValues, 0, rgbValues.Length, SetDataOptions.NoOverwrite); Where rgbValues is a byte array containing the bitmap's pixel data in 32-bit ARGB format. My question is, are there any faster approaches that I can try? I am writing a map editor which has to read in custom-format images (map tiles) and convert them into Texture2D textures to display. The previous version of the editor, which was a C++ implementation, converted the images first into bitmaps and then into textures to be drawn using DirectX. I have attempted the same approach here, however both of the above approaches are significantly too slow. To load into memory all of the textures required for a map takes for the first approach ~250 seconds and for the second approach ~110 seconds on a reasonable spec computer. If there is a method to edit the data of a texture directly (such as with the Bitmap class's LockBits method) then I would be able to convert the custom-format images straight into a Texture2D and hopefully save processing time. Any help would be very much appreciated. Thanks

    Read the article

  • WPF Inner Property Binding not updating.

    - by Matthew Kruskamp
    I have an INotifyProperty item that I have bound to a wpf control. <local:ScrollingSelector DataContext="{Binding Path=SelectedScreen.VisualizationTypes}" Grid.ColumnSpan="2" Grid.Column="3" Margin="0,0,0,0" Grid.Row="1"/> If I change the SelectedScreen property to a different control the binding still assumes the first control. Why is this? Is there an easy work-around?

    Read the article

  • Architecture with NHibernate and Repositories

    - by Matthew
    I've been reading up on MVC 2 and the recommended patterns, so far I've come to the conclusion (amongst much hair pulling and total confusion) that: Model - Is just a basic data container Repository - Provides data access Service - Provides business logic and acts as an API to the Controller The Controller talks to the Service, the Service talks to the Repository and Model. So for example, if I wanted to display a blog post page with its comments, I might do: post = PostService.Get(id); comments = PostService.GetComments(post); Or, would I do: post = PostService.Get(id); comments = post.Comments; If so, where is this being set, from the repository? the problem there being its not lazy loaded.. that's not a huge problem but then say I wanted to list 10 posts with the first 2 comments for each, id have to load the posts then loop and load the comments which becomes messy. All of the example's use "InMemory" repository's for testing and say that including db stuff would be out of scope. But this leaves me with many blanks, so for a start can anyone comment on the above?

    Read the article

  • Hard-coded 8191 10485 values in JavaScript rounding function

    - by Matthew Hegarty
    I've seen the following (bizarre) Javascript rounding function in some legacy code. After googling for it I can see that it crops up in a number of places online. However I can't work out why the hard-coded values 8191 and 10485 are present. Does anyone know if there's any sensible reason why these values are included? If not, hopefully we can kill off the meme! function roundNumber(num,dec) { var newnumber = 0; if (num > 8191 && num < 10485) { num = num-5000; newnumber = Math.round(num*Math.pow(10,dec))/Math.pow(10,dec); newnumber = newnumber+5000; } else { newnumber = Math.round(num*Math.pow(10,dec))/Math.pow(10,dec); } return newnumber; }

    Read the article

  • Maven not setting classpath for dependencies properly

    - by Matthew
    OS name: "linux" version: "2.6.32-27-generic" arch: "i386" Family: "unix" Apache Maven 2.2.1 (r801777; 2009-08-06 12:16:01-0700) Java version: 1.6.0_20 I am trying to use the mysql dependency in with maven in ubuntu. If I move the "mysql-connector-java-5.1.14.jar" file that maven downloaded into my $JAVA_HOME/jre/lib/ext/ folder, everything is fine when I run the jar. I think I should be able to just specify the dependency in the pom.xml file and maven should take care of setting the classpath for the dependency jars automatically. Is this incorrect? My pom.xml file looks like this: <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.ion.common</groupId> <artifactId>TestPreparation</artifactId> <version>1.0-SNAPSHOT</version> <packaging>jar</packaging> <name>TestPrep</name> <url>http://maven.apache.org</url> <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> </properties> <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-jar-plugin</artifactId> <configuration> <archive> <manifest> <addClasspath>true</addClasspath> <mainClass>com.ion.common.App</mainClass> </manifest> </archive> </configuration> </plugin> </plugins> </build> <dependencies> <!-- JUnit testing dependency --> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>3.8.1</version> <scope>test</scope> </dependency> <!-- MySQL database driver --> <dependency> <groupId>mysql</groupId> <artifactId>mysql-connector-java</artifactId> <version>5.1.14</version> <scope>compile</scope> </dependency> </dependencies> </project> The command "mvn package" builds it without any problems, and I can run it, but when the application attempts to access the database, this error is presented: java.lang.ClassNotFoundException: com.mysql.jdbc.Driver at java.net.URLClassLoader$1.run(URLClassLoader.java:217) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:205) at java.lang.ClassLoader.loadClass(ClassLoader.java:321) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294) at java.lang.ClassLoader.loadClass(ClassLoader.java:266) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:186) at com.ion.common.Functions.databases(Functions.java:107) at com.ion.common.App.main(App.java:31) The line it is failing on is: Class.forName("com.mysql.jdbc.Driver"); Can anyone tell me what I'm doing wrong or how to fix it?

    Read the article

  • (MyClassName)object vs. object as MyClassName

    - by Matthew Doyle
    Hello all, I was wondering what is the better method for Casting objects for C#: MyClassName test = (MyClassName)object; MyClassName test = object as MyClassName; I know already that if you do the first way, you get an exception, and the second way it sets test as null. However, I was wondering why do one over the other? I see the first way a lot, but I like how the second way because then I can check for null... If there isn't a 'better way' of doing it, what are the guidelines for using one way or the other?

    Read the article

  • [Hibernate Mapping] relationship set between table and mapping table to use joins.

    - by Matthew De'Loughry
    Hi guys, I have two table a "Module" table and a "StaffModule" I'm wanting to display a list of modules by which staff are present on the staffmodule mapping table. I've tried from Module join Staffmodule sm with ID = sm.MID with no luck, I get the following error Path Expected for join! however I thought I had the correct join too allow this but obviously not can any one help StaffModule HBM <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"> <!-- Generated Apr 26, 2010 9:50:23 AM by Hibernate Tools 3.2.1.GA --> <hibernate-mapping> <class name="Hibernate.Staffmodule" schema="WALK" table="STAFFMODULE"> <composite-id class="Hibernate.StaffmoduleId" name="id"> <key-many-to-one name="mid" class="Hibernate.Module"> <column name="MID"/> </key-many-to-one> <key-property name="staffid" type="int"> <column name="STAFFID"/> </key-property> </composite-id> </class> </hibernate-mapping> and Module.HBM <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"> <!-- Generated Apr 26, 2010 9:50:23 AM by Hibernate Tools 3.2.1.GA --> <hibernate-mapping> <class name="Hibernate.Module" schema="WALK" table="MODULE"> <id name="id" type="int"> <column name="ID"/> <generator class="assigned"/> </id> <property name="modulename" type="string"> <column length="50" name="MODULENAME"/> </property> <property name="teacherid" type="int"> <column name="TEACHERID" not-null="true"/> </property> </class> hope thats enough information! and thanks in advance.

    Read the article

  • How to display a date as iso 8601 format with PHP

    - by Matthew James Taylor
    I'm trying to display a datetime from my MySQL database as an iso 8601 formated string with PHP but it's coming out wrong. 17 Oct 2008 is coming out as: 1969-12-31T18:33:28-06:00 which is clearly not correct (the year should be 2008 not 1969) This is the code I'm using: <?= date("c", $post[3]) ?> $post[3] is the datetime (CURRENT_TIMESTAMP) from my MySQL database. Any ideas what's going wrong?

    Read the article

  • Why does it make a difference where I include the jQuery script file?

    - by Matthew Jones
    On my master page (for all pages in my site) I have a ToolkitScriptManager. On my content page, there are a series of hyperlinks and divs for collapsible functionality. The code to show/hide the panels work like the following: $('#nameHyperLink').click(function() { var div = $('#nameDiv'); var link = $('#nameHyperLink'); if (div.css('display') == 'none') { link.text('Hide Data'); div.show('100'); } else { link.text('Show Data'); div.hide('100'); } }); If I include a ScriptReference to the jQuery 1.4.2 file in the toolkitscriptmanager, the javascript code is executed incorrectly on the page (only the text for the hyperlink is changed, the div is not actually shown.) However, if I don't include the jQuery file in the ToolkitScriptManager and instead include it in the content page, it works correctly. I'm a Javascript/jQuery newbie, and this makes no sense at all. What's going on here?

    Read the article

  • What HTTP redirect status should I use to link offsite?

    - by Matthew Scharley
    While randomly browsing my website via Google, I noticed that it was showing up remote redirects as local files. Now this can be both good and bad, but I'm wondering how can I fix this so it doesn't happen? I'm currently using PHP and header('Location: ... which sends a 302 redirect. Looking over the list of HTTP status codes, I'd take a guess that I should be using 303 redirects to redirect offsite. Is anyone able to help me here, and either confirm/deny this, or tell me what I should be doing instead? Obviously, due to me not being able to tell Google to reindex my site on command, there's issues with being able to test this myself...

    Read the article

  • Correct Time Display

    - by Matthew
    Guys, I''m looking to get this correct and i'm getting a bit fustrated with this. What I want to do is get hours and days and weeks correct. Example: if this post is < 60min old then have it read: Posted Less then 1 minute ago if this post is < 120min old then have it read: Posted 1 hour ago if this post is 120min old then have it read: Posted 1 hours ago if this post is < 1440min old then have it read: Posted 1 day ago if this post is 1440min old then have it read: Posted 2 days ago Is that right?? This is what I have so far: if (lapsedTime < 60) { return '< 1 mimute'; } else if (lapsedTime < (60*60)) { return Math.round(lapsedTime / 60) + 'minutes'; } else if (lapsedTime < (12*60*60)) { return Math.round(lapsedTime / 2400) + 'hr'; } else if (lapsedTime < (24*60*60)) { return Math.round(lapsedTime / 3600) + 'hrs'; } else if (lapsedTime < (7*24*60*60)) { return Math.round(lapsedTime / 86400) + 'days'; } else { return Math.round(lapsedTime / 604800) + 'weeks'; }

    Read the article

  • Static library not included in resulting LLVM executable

    - by Matthew Glubb
    Hi, I am trying to compile a c program using LLVM and I am having trouble getting some static libraries included. I have successfully compiled those static libraries using LLVM and, for example, libogg.a is present, as is ogg.l.bc. However, when I try to build the final program, it does not include the static ogg library. I've tried various compiler options with the most notable being: gcc oggvorbis.c -O3 -Wall -I$OV_DIR/include -l$OV_DIR/lib/libogg.a -l$OV_DIR/lib/libvorbis.a -o test.exe This results in the following output (directories shortened for brevity): $OV_DIR/include/vorbis/vorbisfile.h:75: warning: ‘OV_CALLBACKS_DEFAULT’ defined but not used $OV_DIR/include/vorbis/vorbisfile.h:82: warning: ‘OV_CALLBACKS_NOCLOSE’ defined but not used $OV_DIR/include/vorbis/vorbisfile.h:89: warning: ‘OV_CALLBACKS_STREAMONLY’ defined but not used $OV_DIR/include/vorbis/vorbisfile.h:96: warning: ‘OV_CALLBACKS_STREAMONLY_NOCLOSE’ defined but not used llvm-ld: warning: Cannot find library '$OV_DIR/lib/ogg.l.bc' llvm-ld: warning: Cannot find library '$OV_DIR/lib/vorbis.l.bc' WARNING: While resolving call to function 'main' arguments were dropped! I find this perplexing because $OV_DIR/lib/ogg.l.bc DOES exit, as does vorbis.l.bc and they are both readable (as are their containing directories) by everyone. Does anyone have any idea with what I am doing wrong? Thanks, Matt

    Read the article

  • Invoke Blue Screen of Death using Managed Code

    - by Matthew Ruston
    Just curious here: is it possible to invoke a Windows Blue Screen of Death using .net managed code under Windows XP/Vista? And if it is possible, what could the example code be? Just for the record, this is not for any malicious purpose, I am just wondering what kind of code it would take to actually kill the operating system as specified.

    Read the article

  • MSSQL Search Proper Names Full Text Index vs LIKE + SOUNDEX

    - by Matthew Talbert
    I have a database of names of people that has (currently) 35 million rows. I need to know what is the best method for quickly searching these names. The current system (not designed by me), simply has the first and last name columns indexed and uses "LIKE" queries with the additional option of using SOUNDEX (though I'm not sure this is actually used much). Performance has always been a problem with this system, and so currently the searches are limited to 200 results (which still takes too long to run). So, I have a few questions: Does full text index work well for proper names? If so, what is the best way to query proper names? (CONTAINS, FREETEXT, etc) Is there some other system (like Lucene.net) that would be better? Just for reference, I'm using Fluent NHibernate for data access, so methods that work will with that will be preferred. I'm using MS SQL 2008 currently.

    Read the article

  • How to compile OpenGL with a python C++ extension using distutils on Mac OSX?

    - by Matthew Mitchell
    When I try it I get: ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/cscalelib.so, 2): Symbol not found: _glBindFramebufferEXT Referenced from: /Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/cscalelib.so Expected in: dynamic lookup I've tried all sort of things in the setup.py file. What do I actually need to put in it to link to OpenGL properly? My code compiles fine so there's no point putting that on there.

    Read the article

  • How to create and use resources in .NET

    - by Matthew Scharley
    How do I create a resource that I can reference and use in various parts of my program easily? My specific problem is that I have a NotifyIcon that I want to change the icon of depending on the state of the program. A common problem, but one I've been struggling with for a long time.

    Read the article

  • Is it bad practice to have state in a static class?

    - by Matthew
    I would like to do something like this: public class Foo { // Probably really a Guid, but I'm using a string here for simplicity's sake. string Id { get; set; } int Data { get; set; } public Foo (int data) { ... } ... } public static class FooManager { Dictionary<string, Foo> foos = new Dictionary<string, Foo> (); public static Foo Get (string id) { return foos [id]; } public static Foo Add (int data) { Foo foo = new Foo (data); foos.Add (foo.Id, foo); return foo; } public static bool Remove (string id) { return foos.Remove (id); } ... // Other members, perhaps events for when Foos are added or removed, etc. } This would allow me to manage the global collection of Foos from anywhere. However, I've been told that static classes should always be stateless--you shouldn't use them to store global data. Global data in general seems to be frowned upon. If I shouldn't use a static class, what is the right way to approach this problem? Note: I did find a similar question, but the answer given doesn't really apply in my case.

    Read the article

  • asp.net mvc rhino mocks mocking httprequest values

    - by Matthew
    Hi Is there a way to mock request params, what is the best approach when testing to create fake request values in order to run a test would some thing like this work? _context = MockRepository.GenerateStub<HttpContext>(); request = MockRepository.GenerateStub<HttpRequest>(); var collection = new NameValueCollection(); collection.Add("", ""); SetupResult.For(request.Params).Return(collection); SetupResult.For(_context.Request).Return(request);

    Read the article

  • php simplexmlelement - I can access most properties (except the one with a dash?)

    - by Matthew Steiner
    So I run some code like this: $quote = simplexml_load_string($xml); $quote = $quote->Stock; echo 'Name: '; echo $quote->Name; echo '<br>'; echo 'Sybmol: '; echo $quote->Symbol; echo '<br>'; echo 'Last Price: '; echo $quote->Last; echo '<br>'; echo 'Earnings To Price Ratio: '; echo $quote->P-E; echo '<br>'; I know that the second to last line ($quote-P-E) is incorrect - I don't think you can use dashes like that. But for some reason I can't figure out how to access that property. The weird thing is that's how it's written if I var_dump($quote) (It's towards the end): object(SimpleXMLElement)#17 (16) { ["Symbol"]=> string(4) "AAPL" ["Last"]=> string(6) "271.87" ["Date"]=> string(9) "6/17/2010" ["Time"]=> string(6) "3:59pm" ["Change"]=> string(5) "+4.62" ["Open"]=> string(6) "270.72" ["High"]=> string(6) "272.90" ["Low"]=> string(6) "269.50" ["Volume"]=> string(8) "31195032" ["MktCap"]=> string(6) "247.4B" ["PreviousClose"]=> string(6) "267.25" ["PercentageChange"]=> string(6) "+1.73%" ["AnnRange"]=> string(15) "132.88 - 272.90" ["Earns"]=> string(6) "11.796" ["P-E"]=> string(5) "22.66" ["Name"]=> string(10) "Apple Inc." } How should I be accessing this attribute/property?

    Read the article

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