Search Results

Search found 1166 results on 47 pages for 'nick hodges'.

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

  • Best SSD tweak for Windows 7

    - by Nick Berardi
    I have seen many articles about tweaking an SSD, but many of them seem outdated, or too broad (read all Windows XP, Vista, and Windows 7 general tweaks). And I know that Windows 7 has been specifically tweaked for SSD by the Windows team, so I don't want to do something that was written for Windows XP in mind and end up circumventing something the Windows team has specifically designed in to Windows 7. So my question is what are the best SSD tweaks for Windows 7 that you have found to get the performance out of your drive? I hope to make a comprehensive list in the answers below so there won't be so much disinformation in the forums about what to do and what not to do. Here are a few that I see posted up on the forums alot: Disabling Superfetch. Yes or No Disabling Page File or limiting it to a really small size such as 500 MB. Disabling Indexing. Yes or No Disabling Defragmenting. Yes or No What are your thoughts do you have any that have worked for you? When providing an answer please do your best to back it up with a reason and possibly some documentation from MSDN, TechNet, or another credible source.

    Read the article

  • SQL server text

    - by Nick P
    I will be taking an independent study class on SQL server management. I will have to configure SQL Server 2008 on a Windows Server 2008 system. I was wondering if anyone could suggest decent text for configuration/administration of SQL Server 2008. The Murach text doesn't look like it will take me far.

    Read the article

  • Convert an entire DVD (with chapter menus) to Flash?

    - by Nick
    I was recently asked to put a DVD onto a website - I ripped the chapters individually as MP4 files and created a nicely formatted playlist which lets you select the chapter you'd like, but apparently it's a really big requirement that the original DVD menus are preserved too. Agh. I have no experience with using Flash or ActionScript whatsoever, and do not even have the software, so I was wondering if there is any software out there that could do this? I'm not too worried by cost as it'll presumably be cheaper than buying a copy of Flash anyway.

    Read the article

  • Prevent being locked out [duplicate]

    - by Nick
    This question already has an answer here: How do you test iptables rules to prevent remote lockout and check matches? 3 answers When you are configuring iptables or ssh over ssh and the data center is thousands of kilometers away(and getting someone there to plug in a KVM is hard) what are some standard practices to prevent locking yourself out?

    Read the article

  • The binary you uploaded was invalid. A pre-release beta version of the SDK was used to build the app

    - by Nick
    I am having a problem submitting my new app to the appstore. ItunesConnect gives me the error: The binary you uploaded was invalid. A pre-release beta version of the SDK was used to build the application. I haven't changed anything, I can compile to a ad-hoc certificate and that works fine. I uploaded another app yesterday and that worked fine too. All the targets and project info is set to compile to the base SDK iPhone OS 3.0. I even upgraded to the latest SDK but same result. Any ideas?

    Read the article

  • Customize baseUrl and baseDir in CKFinder

    - by Nick Petrie
    We use CKEditor and CKFinder for Coldfusion in many of our CMS applications. These apps point to different sites on our server, so we want CKFinder setup to upload files to directories specific to each app. But we one want one shared location for the CKEditor and CKFinder files on the server. In the config.cfm file, we have setup the default baseURL and baseDir like this: config.baseUrl = "http://www.oursite.com/_files/site1/ckfinder_uploads/"; config.baseDir = '\\ourserver01\_files\site1\ckfinder_uploads\'; In the header file for each app, we include the following to instantiate CKEditor and CKFinder (including the jQuery adapter): <script type="text/javascript" src="/shared/ckeditor/ckeditor.js"></script> <script type="text/javascript" src="/shared/ckeditor/adapters/jquery.js"></script> <script type="text/javascript" src="/shared/ckfinder/ckfinder.js"></script> <script type="text/javascript"> $(document).ready(function(){ CKFinder.setupCKEditor( null, '/shared/ckfinder/' ); }); </script> When I open a CKFinder window in one of the apps, it correctly opens to the default baseURL/baseDir. However, how can I override those defaults? I tried changing the CKFinder setupCKEditor function to this following with no luck: CKFinder.setupCKEditor( null, { basePath:'/shared/ckfinder/', baseUrl:"http://www.oursite.com/_files/NEWSITE/ckfinder_uploads/", baseDir:"\\\\ourserver01\\_files\\NEWSITE\\ckfinder_uploads\\" } ); It just ignored this and used the defaults. Thoughts? Thanks!!

    Read the article

  • Spring 3.0: Unable to locate Spring NamespaceHandler for XML schema namespace

    - by Nick Hristov
    My setup is fairly simple: I have a web front-end, back-end is spring-wired. I am using AOP to add a layer of security on my rpc services. It's all good, except for the fact that the web app aborts on launch: [java] SEVERE: Context initialization failed [java] org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Unable to locate Spring NamespaceHandler for XML schema namespace [http://www.springframework.org/schema/aop] [java] Offending resource: ServletContext resource [/WEB-INF/gwthandler-servlet.xml] Here is the snippet from my xml config file: <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:aop="http://www.springframework.org/schema/aop" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd"> <aop:config> <aop:aspect id="security" ref="securityAspect" > <aop:pointcut id="securedServices" expression="@annotation(com.fb.boog.common.aspects.Secured)"/> <aop:before method="checkSecurity" pointcut-ref="securedServices"/> </aop:aspect> </aop:config> I read over the internets that it may be my classloading the core of the problem. Doubtful, since here is my WEB-INF/lib directory: ./WEB-INF/lib ./WEB-INF/lib/aopalliance-alpha1.jar ./WEB-INF/lib/aspectj-1.6.6.jar ./WEB-INF/lib/commons-collections.jar ./WEB-INF/lib/commons-logging.jar ./WEB-INF/lib/ehcache-core-1.7.0.jar ./WEB-INF/lib/ejb3-persistence.jar ./WEB-INF/lib/hibernate ./WEB-INF/lib/hibernate/antlr.jar ./WEB-INF/lib/hibernate/asm.jar ./WEB-INF/lib/hibernate/bsh-2.0b1.jar ./WEB-INF/lib/hibernate/cglib.jar ./WEB-INF/lib/hibernate/dom4j.jar ./WEB-INF/lib/hibernate/freemarker.jar ./WEB-INF/lib/hibernate/hibernate-annotations.jar ./WEB-INF/lib/hibernate/hibernate-shards.jar ./WEB-INF/lib/hibernate/hibernate-tools.jar ./WEB-INF/lib/hibernate/hibernate.jar ./WEB-INF/lib/hibernate/jtidy-r8-20060801.jar ./WEB-INF/lib/jabsorb ./WEB-INF/lib/jabsorb/jabsorb-1.3.1.jar ./WEB-INF/lib/jta.jar ./WEB-INF/lib/jyaml-1.3.jar ./WEB-INF/lib/postgresql-8.4-701.jdbc4.jar ./WEB-INF/lib/sjsxp.jar ./WEB-INF/lib/spring ./WEB-INF/lib/spring/org.springframework.aop-3.0.0.RELEASE.jar ./WEB-INF/lib/spring/org.springframework.asm-3.0.0.RELEASE.jar ./WEB-INF/lib/spring/org.springframework.aspects-3.0.0.RELEASE.jar ./WEB-INF/lib/spring/org.springframework.beans-3.0.0.RELEASE.jar ./WEB-INF/lib/spring/org.springframework.context-3.0.0.RELEASE.jar ./WEB-INF/lib/spring/org.springframework.context.support-3.0.0.RELEASE.jar ./WEB-INF/lib/spring/org.springframework.core-3.0.0.RELEASE.jar ./WEB-INF/lib/spring/org.springframework.expression-3.0.0.RELEASE.jar ./WEB-INF/lib/spring/org.springframework.instrument-3.0.0.RELEASE.jar ./WEB-INF/lib/spring/org.springframework.instrument.tomcat-3.0.0.RELEASE.jar ./WEB-INF/lib/spring/org.springframework.jdbc-3.0.0.RELEASE.jar ./WEB-INF/lib/spring/org.springframework.jms-3.0.0.RELEASE.jar ./WEB-INF/lib/spring/org.springframework.orm-3.0.0.RELEASE.jar ./WEB-INF/lib/spring/org.springframework.oxm-3.0.0.RELEASE.jar ./WEB-INF/lib/spring/org.springframework.test-3.0.0.RELEASE.jar ./WEB-INF/lib/spring/org.springframework.transaction-3.0.0.RELEASE.jar ./WEB-INF/lib/spring/org.springframework.web-3.0.0.RELEASE.jar ./WEB-INF/lib/spring/org.springframework.web.portlet-3.0.0.RELEASE.jar ./WEB-INF/lib/spring/org.springframework.web.servlet-3.0.0.RELEASE.jar ./WEB-INF/lib/spring/org.springframework.web.struts-3.0.0.RELEASE.jar ./WEB-INF/lib/testng-5.11-jdk15.jar ./WEB-INF/web.xml

    Read the article

  • Which datagrid to use for ASP.NET MVC2 project?

    - by Nick
    Hi, I am developing a commercial MVC2 app that requires a grid that has callback update in some form to support 10,000+ rows. It should also support relatively rich content (icons, multiline descriptions etc). Although it requires the usual paging/scrolling/sorting features it does not need support for grouping. So nothing that special. The commercial grids I looked at were Component Art (http://www.componentart.com/products/aspnetmvc/datagrid/) and Telerik (http://www.telerik.com/products/aspnet-mvc/grid.aspx) which both look pretty good but may be a little OTT for what I need. They are also $800 and $999 respectively (1 developer). I've also looked at jqGrid (http://www.trirand.net/download.aspx) and the grid from MvcContrib. These appear ok but for a commercial app I am concerned that these may be risky options - though could be wrong there. I'd really appreciate any views/exprience on either the above grids or perhaps you can suggest a better option/approach. FYI I am using EF4 and C#. Cheers

    Read the article

  • Creating a Silverlight DataTemplate in code

    - by Nick R
    How do I create a silverlight data template in code? I've seen plenty of examples for WPF, but nothing for Silverlight. Edit: Here's the code I'm now using this for, based on the answer from Santiago below. public DataTemplate Create(Type type) { return (DataTemplate)XamlReader.Load( @"<DataTemplate xmlns=""http://schemas.microsoft.com/client/2007""> <" + type.Name + @" Text=""{Binding " + ShowColumn + @"}""/> </DataTemplate>" ); } This works really nicely and allows me to change the binding on the fly.

    Read the article

  • Installing PHP extensions in Debian

    - by Nick Sabatino
    I'm trying to install the PECL extension pecl_http so that I can use PHP's http_negotiate_language() function. I'm running PHP5 on Apache2 and Debian Lenny. I installed the php_http package from the debian repo, however, I still can't use that function in my php scripts! The package also doesn't show up under phpinfo(). I tried installing it from PECL, but I could not. Is there some procedure for enabling these extensions in PHP? Kind of like a2enmod for apache? Note: This is a repost from http://forum.slicehost.com/comments.php?DiscussionID=4650 I also tried adding extension=pecl_http.so to my apache2/php.ini with no effect. Any guesses?

    Read the article

  • Wordpress Widget - Adding URL to title

    - by Nick Canarelli
    I can't seem to figure out how to wrap the title of the widget in an tag. For example, I am trying to get it so that when you type the url in a text field, it is then placed in the tag so that it is a hyperlink on the website... class Example_Widget extends WP_Widget { /** * Widget setup. */ function Example_Widget() { /* Widget settings. */ $widget_ops = array( 'classname' => 'example', 'description' => __('A widget that displays company announcements.', 'example') ); /* Widget control settings. */ $control_ops = array( 'width' => 300, 'height' => 350, 'id_base' => 'example-widget' ); /* Create the widget. */ $this->WP_Widget( 'example-widget', __('Announcement Widget', 'example'), $widget_ops, $control_ops ); } /** * How to display the widget on the screen. */ function widget( $args, $instance ) { extract( $args ); /* Our variables from the widget settings. */ $title = apply_filters('widget_title', $instance['title'] ); $excerpt = $instance['excerpt']; $url = $instance['url']; /* Before widget (defined by themes). */ echo $before_widget; /* Display the widget title if one was input (before and after defined by themes). */ if ( $title ) echo $before_title . $title . $after_title; /* Display name from widget settings if one was input. */ if ( $excerpt ) printf( '<p style="font-family: arial; font-size: 12px; line-height: 16px;">' . __('%1$s.', 'example') . '</p>', $excerpt ); /* After widget (defined by themes). */ echo $after_widget; } /** * Update the widget settings. */ function update( $new_instance, $old_instance ) { $instance = $old_instance; /* Strip tags for title and name to remove HTML (important for text inputs). */ $instance['title'] = strip_tags( $new_instance['title'] ); $instance['excerpt'] = strip_tags( $new_instance['excerpt'] ); return $instance; } /** * Displays the widget settings controls on the widget panel. * Make use of the get_field_id() and get_field_name() function * when creating your form elements. This handles the confusing stuff. */ function form( $instance ) { /* Set up some default widget settings. */ $defaults = array( 'title' => __('Title Goes Here', 'example'), 'excerpt' => __('Excerpt goes here.'), ); $instance = wp_parse_args( (array) $instance, $defaults ); ?> <!-- Widget Title: Text Input --> <p> <label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e('Title:', 'hybrid'); ?></label> <input id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" value="<?php echo $instance['title']; ?>" style="width:100%;" /> </p> <!-- Your Name: Text Input --> <p> <label for="<?php echo $this->get_field_id( 'excerpt' ); ?>"><?php _e('Excerpt:', 'example'); ?></label> <input id="<?php echo $this->get_field_id( 'excerpt' ); ?>" name="<?php echo $this->get_field_name( 'excerpt' ); ?>" value="<?php echo $instance['excerpt']; ?>" style="width:100%;" /> </p> <?php } } ?> And here is the functions file code register_sidebar(array( 'name' => __( 'Announcements' ), 'description' => __( 'Display company announcements here.' ), 'before_widget' => '', 'after_widget' => '<hr style="margin-top: 4px; color: #f00; background-color: #585040; height: 1px; border: none; margin-bottom: 2px;"/>', 'before_title' => '<h2 style="font-size: 12px;">', 'after_title' => '</h2>' ));

    Read the article

  • rand() generating the same number – even with srand(time(NULL)) in my main!

    - by Nick Sweet
    So, I'm trying to create a random vector (think geometry, not an expandable array), and every time I call my random vector function I get the same x value, thought y and z are different. int main () { srand ( (unsigned)time(NULL)); Vector<double> a; a.randvec(); cout << a << endl; return 0; } using the function //random Vector template <class T> void Vector<T>::randvec() { const int min=-10, max=10; int randx, randy, randz; const int bucket_size = RAND_MAX/(max-min); do randx = (rand()/bucket_size)+min; while (randx <= min && randx >= max); x = randx; do randy = (rand()/bucket_size)+min; while (randy <= min && randy >= max); y = randy; do randz = (rand()/bucket_size)+min; while (randz <= min && randz >= max); z = randz; } For some reason, randx will consistently return 8, whereas the other numbers seem to be following the (pseudo) randomness perfectly. However, if I put the call to define, say, randy before randx, randy will always return 8. Why is my first random number always 8? Am I seeding incorrectly?

    Read the article

  • CheckBox menu item Decrypt in JAVA GUI

    - by Nick
    I am working on a project and part of ask for: add a CheckBox menu item Decrypt which can be checked for decrypt or unchecked for Encrypt. This item should be tied to the toggle button in the GUI. Both should reflect the current status of encrypting/decrypting in the application which is I not sure how to begin with

    Read the article

  • Urlrewriting.net pages are not causing postbacks

    - by Nick
    I'm using webforms with UrlRewriting.Net to rewrite pages, e.g. http://www.example.com/stuff.aspx?c=30 becomes http://www.example.com/stuff/30-this-stuff.aspx. It works in so far as the correct content is loading; however, none of the postbacks are working (mostly buttons on the page). If I set up a breakpoint on Page_Load, I see that IsPostBack is always false. Any ideas on how to fix this? Right now I'm just on Visual Studio 2008. EDIT: I have since switched to UrlRewriter.Net, which worked after a few tweaks (see Scott Gu's article). Besides here, I have posted my original problem to the developer's forum: if I ever get an answer, I'll post it here (unless else posts it here first).

    Read the article

  • SSRS 2008 Report Manager Error

    - by Nick
    I have just installed SQL Server 2008 including Reporting Services on Windows Server 2003. I'm having a problem though accessing the Report Manager. When the Reporting Service is first started I can access it fine but after maybe an hour when I try and access it I get an error saying: Unable to connect to the remote server. The reporting service is still running at this point. I can connect to it through Reporting Services Configuration Manager and clicking on the Web Service URL gives a directory listing (I assume that is correct behaviour). If I stop and start the service through Reporting Services Configuration Manager then I can access Report Manager once again (although in maybe an hour I will get the same error once again). I've installed the latest SP1 service pack. I'm using the same domain account to run all the SQL services. The report server is set to use the default ReportServer virtual directory, is set to IP address All Assigned, TCP Port 80 and no SSL certificate. The report manager is set to use the default Reports virtual directory, IP address All Assigned, TCP Port 80 and no SSL certificates. In the log file I get an error: Unable to connect to remote server HTTP status code 500 An attempt was made to access a socket in a way forbidden by its access permissions. Does anyone have any idea why this is happening? I've searched the net but haven't been able to find a solution.

    Read the article

  • Create Virtual Directory and Set Permissions IIS7 - Cannot read configuration file due to insufficie

    - by Nick
    I am trying to create a virtual directory and set it's permissions using IIS7 and C#. Here is a sample of my code: using (ServerManager serverManager = new ServerManager(webSite)) { ConfigurationSection anonymousAuthenticationSection = config.GetSection( @"system.webServer/security/authentication/anonymousAuthentication", webSite); anonymousAuthenticationSection["enabled"] = true; serverManager.CommitChanges(); return "true"; } This throws an exception and the message is: Cannot read configuration file due to insufficient permissions. Can someone help?

    Read the article

  • How to utilize WebDev.WebServer.exe (VS Web Server) in x64?

    - by Nick Craver
    Visual Studio is x86 until at least the 2010 release comes around, my question is can anyone think of a way or know of an independent ASP.NET debug server that's x64 for 2008? Background: Our ASP.NET application runs against Oracle as the DB. Since we're on 64-bit servers for memory concerns later, we need to use Oracle's 64-bit drivers (Instant Client). Setup: x64 OS (XP or Windows 7) IIS (5 or 7, both x64 App Pools) Oracle 64-bit Instant Client (Separate Directory, in the PATH) Visual Studio 2008 SP1 In IIS the application pool runs as 64-bit, uses the Oracle drivers as intended, however since WebDev.WebServer.exe is 32-bit you'll get a BadImageFormatException because it's trying to load 64-bit driver DLLs in a 32-bit environment. All of our developers would like to be able to use the quick debug server via Visual Studio 2008, but since it runs as 32-bit we're unable to. Some problems we run into are during application startup, so although we're attaching to the IIS process sometimes that isn't enough to track an issue down. Are there any alternatives, or work-arounds? We would like to match our Dev/Val/Prod tiers as much as possible, so everything running in x64 would be ideal.

    Read the article

  • Castle ActiveRecord "Could not compile the mapping document: (string)"

    - by Nick
    Hi I am having getting an exception when trying to initialize ActiveRecord and I cannot figure out what I am missing. I am trying to convince the company I work for to use Castle ActiveRecord and it won't look good if I can't demonstrate how it works. I have work on projects before with Castle ActiveRecord and I had never experience this problem before. Thanks for your help The exception that I get is Stack Trace: at Castle.ActiveRecord.ActiveRecordStarter.AddXmlString(Configuration config, String xml, ActiveRecordModel model) at Castle.ActiveRecord.ActiveRecordStarter.AddXmlToNHibernateCfg(ISessionFactoryHolder holder, ActiveRecordModelCollection models) at Castle.ActiveRecord.ActiveRecordStarter.RegisterTypes(ISessionFactoryHolder holder, IConfigurationSource source, IEnumerable`1 types, Boolean ignoreProblematicTypes) at Castle.ActiveRecord.ActiveRecordStarter.Initialize(IConfigurationSource source, Type[] types) at ConsoleApplication1.Program.Main(String[] args) in C:\Projects\CastleDemo\ConsoleApplication1\Program.cs:line 20 at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args) at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args) at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly() at System.Threading.ThreadHelper.ThreadStart_Context(Object state) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Threading.ThreadHelper.ThreadStart() Inner Exception: {"Could not compile the mapping document: (string)"} Below is my configuration file: <add key="connection.driver_class" value="NHibernate.Driver.SqlClientDriver" /> <add key="dialect" value="NHibernate.Dialect.MsSql2000Dialect" /> <add key="connection.provider" value="NHibernate.Connection.DriverConnectionProvider" /> <add key="connection.connection_string" value="Data Source=SPIROS\SQLX;Initial Catalog=CastleDemo;Integrated Security=SSPI" /> <add key="proxyfactory.factory_class" value="NHibernate.ByteCode.Castle.ProxyFactoryFactory, NHibernate.ByteCode.Castle" /> and this is the main method that runs the initialization: static void Main(string[] args) { //Configure ActiveRecord source XmlConfigurationSource source = new XmlConfigurationSource("../../config.xml"); // //Initialazi ActiveRecord ActiveRecordStarter.Initialize( source, typeof(Product)); // //Create Schema ActiveRecordStarter.CreateSchema(); // }

    Read the article

  • What is a proper way to pass a parameter to Set-Alias in powershell?

    - by Nick Gorbikoff
    Hello. A little background: I use PowerShell on windows xp at work and I set a bunch of useful shortcuts in Microsoft.PowerShell_profile.ps1 in My Documents, trying to emulate Mac environment inspired by Ryan Bates's shortcuts I have things like: Set-Alias rsc Rails-Console function Rails-Console {Invoke-Expression "ruby script/console"} Which works just fine when in command prompt I say: rsc #it calls the proper command However this doesn't work properly Set-Alias rsg Rails-Generate function Rails-Generate {Invoke-Expression "ruby script/generate"} So when I do : rsg model User which is supposed to call ruby script/generate model User all it calls is ruby script/generate #Dumping my params So how would I properly modify my functions to take params I send to functions? Thank you!!

    Read the article

  • How can I stop SQL Server Reporting Services 2008 going to sleep?

    - by Nick
    I have SSRS 2008 set-up on a server. All works fine except that if left inactive for a length of time the next time a request is made to the server it takes a long time for it to service it. I think this is to do with the worker process being shutdown after being idle for a certain length of time. However, as SSRS 2008 isn't managed through IIS I can't find any settings that I can adjust to stop this from happening. In IIS I'd go to the Performance tab of the Application Pool Properties and choose not to shutdown the worker process. How can I do this for SSRS 2008?

    Read the article

  • Reference from UITableViewCell to UITableView to UINavigationController

    - by Nick
    If the user taps and holds on a Foo table view cell for 2 seconds, a modal view should be shown. The modal view is also displayed when a new Foo is added to the cell. The modal view's delegate protocol is implemented by the parent UITableView subclass. My tap and hold detection code is in the Foo UITableViewCell class. I'm having difficulty referencing the parent tableview's navigation controller to display the modal view. FooModalViewController *modalController = [[FooModalViewController alloc] initWithNibName:@"FooModalViewController" bundle:nil]; FooTableViewController *tableView = (FooTableViewController *) self.superview; foo.delegate = tableView; Seems OK but I'm having problems referencing the navigation controller that contains the tableview.. The code below builds OK but throws an exception - NSOBject DoesNotRecognizeSelector. UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:modalController]; [[tableView.navigationController] presentModalViewController:navigationController animated:YES]; I think that perhaps my design is flawed..?

    Read the article

  • Building an interleaved buffer for pyopengl and numpy

    - by Nick Sonneveld
    I'm trying to batch up a bunch of vertices and texture coords in an interleaved array before sending it to pyOpengl's glInterleavedArrays/glDrawArrays. The only problem is that I'm unable to find a suitably fast enough way to append data into a numpy array. Is there a better way to do this? I would have thought it would be quicker to preallocate the array and then fill it with data but instead, generating a python list and converting it to a numpy array is "faster". Although 15ms for 4096 quads seems slow. I have included some example code and their timings. #!/usr/bin/python import timeit import numpy import ctypes import random USE_RANDOM=True USE_STATIC_BUFFER=True STATIC_BUFFER = numpy.empty(4096*20, dtype=numpy.float32) def render(i): # pretend these are different each time if USE_RANDOM: tex_left, tex_right, tex_top, tex_bottom = random.random(), random.random(), random.random(), random.random() left, right, top, bottom = random.random(), random.random(), random.random(), random.random() else: tex_left, tex_right, tex_top, tex_bottom = 0.0, 1.0, 1.0, 0.0 left, right, top, bottom = -1.0, 1.0, 1.0, -1.0 ibuffer = ( tex_left, tex_bottom, left, bottom, 0.0, # Lower left corner tex_right, tex_bottom, right, bottom, 0.0, # Lower right corner tex_right, tex_top, right, top, 0.0, # Upper right corner tex_left, tex_top, left, top, 0.0, # upper left ) return ibuffer # create python list.. convert to numpy array at end def create_array_1(): ibuffer = [] for x in xrange(4096): data = render(x) ibuffer += data ibuffer = numpy.array(ibuffer, dtype=numpy.float32) return ibuffer # numpy.array, placing individually by index def create_array_2(): if USE_STATIC_BUFFER: ibuffer = STATIC_BUFFER else: ibuffer = numpy.empty(4096*20, dtype=numpy.float32) index = 0 for x in xrange(4096): data = render(x) for v in data: ibuffer[index] = v index += 1 return ibuffer # using slicing def create_array_3(): if USE_STATIC_BUFFER: ibuffer = STATIC_BUFFER else: ibuffer = numpy.empty(4096*20, dtype=numpy.float32) index = 0 for x in xrange(4096): data = render(x) ibuffer[index:index+20] = data index += 20 return ibuffer # using numpy.concat on a list of ibuffers def create_array_4(): ibuffer_concat = [] for x in xrange(4096): data = render(x) # converting makes a diff! data = numpy.array(data, dtype=numpy.float32) ibuffer_concat.append(data) return numpy.concatenate(ibuffer_concat) # using numpy array.put def create_array_5(): if USE_STATIC_BUFFER: ibuffer = STATIC_BUFFER else: ibuffer = numpy.empty(4096*20, dtype=numpy.float32) index = 0 for x in xrange(4096): data = render(x) ibuffer.put( xrange(index, index+20), data) index += 20 return ibuffer # using ctype array CTYPES_ARRAY = ctypes.c_float*(4096*20) def create_array_6(): ibuffer = [] for x in xrange(4096): data = render(x) ibuffer += data ibuffer = CTYPES_ARRAY(*ibuffer) return ibuffer def equals(a, b): for i,v in enumerate(a): if b[i] != v: return False return True if __name__ == "__main__": number = 100 # if random, don't try and compare arrays if not USE_RANDOM and not USE_STATIC_BUFFER: a = create_array_1() assert equals( a, create_array_2() ) assert equals( a, create_array_3() ) assert equals( a, create_array_4() ) assert equals( a, create_array_5() ) assert equals( a, create_array_6() ) t = timeit.Timer( "testing2.create_array_1()", "import testing2" ) print 'from list:', t.timeit(number)/number*1000.0, 'ms' t = timeit.Timer( "testing2.create_array_2()", "import testing2" ) print 'array: indexed:', t.timeit(number)/number*1000.0, 'ms' t = timeit.Timer( "testing2.create_array_3()", "import testing2" ) print 'array: slicing:', t.timeit(number)/number*1000.0, 'ms' t = timeit.Timer( "testing2.create_array_4()", "import testing2" ) print 'array: concat:', t.timeit(number)/number*1000.0, 'ms' t = timeit.Timer( "testing2.create_array_5()", "import testing2" ) print 'array: put:', t.timeit(number)/number*1000.0, 'ms' t = timeit.Timer( "testing2.create_array_6()", "import testing2" ) print 'ctypes float array:', t.timeit(number)/number*1000.0, 'ms' Timings using random numbers: $ python testing2.py from list: 15.0486779213 ms array: indexed: 24.8184704781 ms array: slicing: 50.2214789391 ms array: concat: 44.1691994667 ms array: put: 73.5879898071 ms ctypes float array: 20.6674289703 ms edit note: changed code to produce random numbers for each render to reduce object reuse and to simulate different vertices each time. edit note2: added static buffer and force all numpy.empty() to use dtype=float32 note 1/Apr/2010: still no progress and I don't really feel that any of the answers have solved the problem yet.

    Read the article

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