Search Results

Search found 5586 results on 224 pages for 'global illumination'.

Page 144/224 | < Previous Page | 140 141 142 143 144 145 146 147 148 149 150 151  | Next Page >

  • C static variables and intialization

    - by yCalleecharan
    Hi, If I have a global static variable x like in this code #include <stdio.h> #include <stdio.h> static int x; int main(void) { DO SOMETHING WITH x HERE x++; } What will be difference if I opted to initialize x to a value first say as in static int x = 0; before entering "main"? In my first case where I didn't assign a value to x, does the compiler implicitly know that x is to be set to zero as it's a static variable? I heard that we can do this with static variables. Thanks a lot...

    Read the article

  • Sharing variable within different javascript file at client side

    - by Aman
    I was actually going through this link. which explains how we can share global variable across multiple js. but the point is what need to be done if I am getting some variable into one js and need to pass to another one mentioned in same document after the 1st one. approach which followed was: Script 1 <script type="text/javascript" src="js/client.js"></script> body added some hidden input with id myHiddenId, where values are set using client.js Script 2 <script type="text/javascript" src="js/anotherJS.js"></script> inside script 2 I am simply using $("#myHiddenId").val(); and using for my purpose. I want to know whether I am following correct approach, because that hidden field may have some data which client should not get aware of. is there any other way through which I can pass the variable values across the js files ? Since I am at beginner level hence digging up some resources/books but still no luck.

    Read the article

  • How do I write a scheme macro that defines a variable and also gets the name of that variable as a s

    - by Jason Baker
    This is mostly a follow-up to this question. I decided to just keep YAGNI in mind and created a global variable (libpython). I set it to #f initially, then set! it when init is called. I added a function that should handle checking if that value has been initialized: (define (get-cpyfunc name type) (lambda args (if libpython (apply (get-ffi-obj name libpython type) args) (error "Call init before using any Python C functions")))) So now here's what I want to do. I want to define a macro that will take the following: (define-cpyfunc Py_Initialize (_fun -> _void)) And convert it into this: (define Py_Initialize (get-cpyfunc "Py_Initialize" (_fun -> _void))) I've been reading through the macro documentation to try figuring this out, but I can't seem to figure out a way to make it work. Can anyone help me with this (or at least give me a general idea of what the macro would look like)? Or is there a way to do this without macros?

    Read the article

  • SQLite not pluralizing Table Names

    - by weenet
    I am using SQLite as my db during development, and I want to postpone actually creating a final database until my domains are fully mapped. So I have this in my Global.asax.cs file: private void InitializeNHibernateSession() { Configuration cfg = NHibernateSession.Init( webSessionStorage, new [] { Server.MapPath("~/bin/MyNamespace.Data.dll") }, new AutoPersistenceModelGenerator().Generate(), Server.MapPath("~/NHibernate.config")); if (ConfigurationManager.AppSettings["DbGen"] == "true") { var export = new SchemaExport(cfg); export.Execute(true, true, false, NHibernateSession.Current.Connection, File.CreateText(@"DDL.sql")); } } The AutoPersistenceModelGenerator hooks up the various conventions, including a TableNameConvention like so: public void Apply(FluentNHibernate.Conventions.Instances.IClassInstance instance) { instance.Table(Inflector.Net.Inflector.Pluralize(instance.EntityType.Name)); } This is working nicely execpt that the sqlite db generated does not have pluralized table names. Any idea what I'm missing? Thanks.

    Read the article

  • Wordpress show next 3 x number adjacent custom posts from existing

    - by user2463284
    On a single/detail Custom Post Page I would like to display a custom nav of li's or divs in a sidebar that displays both title, excerpt and permalink for the next 3 posts within the custom post series. So if we are on custom post 3 then it would show 4, 5, 6 in the sidebar. The closest I've found to this is :-= global $post; $current_post = $post; // remember the current post for($i = 1; $i <= 3; $i++){ $post = get_previous_post(); // this uses $post->ID setup_postdata($post); // do your stuff here the_title(); } $post = $current_post; // restore Problem is this only shows the first next post and I need to show 3. Thanks Glennyboy

    Read the article

  • Rails 3.2.3 mysql error "max_prepared_stmt_count"

    - by Rob Momary
    I am running a Rails 3.2.3 app deployed with apache2/passenger on a virtual host with a mysql database server. I got this error after a lot of traffic was hitting the site: ActiveRecord::StatementInvalid (Mysql::Error: Can't create more than max_prepared_stmt_count statements (current value: 16382) I'm thinking it has something to do with the amount of traffic, but if so I have to find a way around this. Anyone had this error before? I can't figure out how to stop it. Here's what i see in mysql: mysql show global status like 'com_stmt%'; | Com_stmt_close | 1720319 | Com_stmt_execute | 2094137 | | Com_stmt_fetch | 0 | | Com_stmt_prepare | 1768924 | | Com_stmt_reprepare | 0 | | Com_stmt_reset | 0 | | Com_stmt_send_long_data | 0 | +-------------------------+---------+ I am running resque gem.

    Read the article

  • Javascript: selfmade methods not working correctly

    - by hdr
    Hi everyone, I tried to figure this out for some days now, I tried to use my own object to sort of replace the global object to reduce problems with other scripts (userscripts, chrome extensions... that kind of stuff). However I can't get things to work for some reason. I tried some debugging with JSLint, the developer tools included in Google Chrome, Firebug and the integrated schript debugger in IE8 but there is no error that explains why it doesn't work at all in any browser I tried. I tried IE 8, Google Chrome 10.0.612.3 dev, Firefox 3.6.13, Safari 5.0.3 and Opera 11. So... here is the code: HTML: <!DOCTYPE HTML> <html manifest="c.manifest"> <head> <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> <meta charset="utf-8"> <!--[if IE]> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/chrome-frame/1/CFInstall.min.js"></script> <script src="https://ie7-js.googlecode.com/svn/version/2.1(beta4)/IE9.js">IE7_PNG_SUFFIX=".png";</script> <![endif]--> <!--[if lt IE 9]> <script src="js/lib/excanvas.js"></script> <script src="https://html5shiv.googlecode.com/svn/trunk/html5.js"></script> <![endif]--> <script src="js/data.js"></script> </head> <body> <div id="controls"> <button onclick="MYOBJECTis.next()">Next</button> </div> <div id="textfield"></div> <canvas id="game"></canvas> </body> </html> Javascript: var that = window, it = document, k = Math.floor; var MYOBJECTis = { aresizer: function(){ // This method looks like it doesn't work. // It should automatically resize all the div elements and the body. // JSLint: no error (execpt for "'window' is not defined." which is normal since // JSLint does nor recognize references to the global object like "window" or "self" // even if you assume a browser) // Firebug: no error // Chrome dev tools: no error // IE8: that.documentElement.clientWidth is null or not an object "use strict"; var a = that.innerWidth || that.documentElement.clientWidth, d = that.innerHeight || that.documentElement.clientHeight; (function() { for(var b = 0, c = it.getElementsByTagName("div");b < c.length;b++) { c.style.width = k(c.offsetWidth) / 100 * k(a); c.style.height = k(c.offsetHight) / 100 * k(d); } }()); (function() { var b = it.getElementsByTagName("body"); b.width = a; b.height = d; }()); }, next: function(){ // This method looks like it doesn't work. // It should change the text inside a div element // JSLint: no error (execpt for "'window' is not defined.") // Firebug: no error // Chrome dev tools: no error // IE8: no error (execpt for being painfully slow) "use strict"; var b = it.getElementById("textfield"), a = [], c; switch(c !== typeof Number){ case true: a[1] = ["HI"]; c = 0; break; case false: return Error; default: b.innerHtml = a[c]; c+=1; } } }; // auto events (function(){ "use strict"; that.onresize = MYOBJECTis.aresizer(); }()); If anyone can help me out with this I would very much appreciate it. EDIT: To answer the question what's not working I can just say that no method I showed here is working at all and I don't know the cause of the problem. I also tried to clean up some of the code that has most likely nothing to do with it. Additional information is in the comments inside the code.

    Read the article

  • Zend - Deny access to CSS, JS, Image files

    - by Vincent
    All, I have the following Zend application structure: helloworld - application - configs - controllers - models - layouts - include - library - public - design -- css -- site.css -- js -- global.js -- images -- siteheader.gif -- sitefooter.gif - .htaccess - index.php My .htaccess file in public folder looks like this: Options -MultiViews RewriteEngine On RewriteCond %{REQUEST_FILENAME} -s [OR] RewriteCond %{REQUEST_FILENAME} -l [OR] RewriteCond %{REQUEST_FILENAME} -d RewriteRule ^.*$ - [NC,L] RewriteRule ^.*$ index.php [NC,L] My document root points to the "public" folder. Currently, if the user visits a directory level URL, (Ex: http://localhost/design or localhost/css) , my .htaccess file above make sure to show him the "Access Forbidden" page. But if he visits the file level URL, (Ex: http://localhost/design/css/site.css), it shows him the CSS file or the js file or PHP file.. How can I make sure to lock file level access for the above file types, if accessed directly from the URL? Since my application is JS intensive, I want to protect it from users looking at it. Thanks

    Read the article

  • Should every code for the Wordpress plgins be included in the functions and hooked with the Wordpres

    - by Chetan sharma
    I just started the Plugin development for the Wordpress, but finding it little difficult to understand. Looks like everything should be hooked with the wordpess to get it run and moreover are there all the global variables that i need to use. I am making a video plugin and designed some of the forms and display page, but didn't went through the templates, is it compulsory to follow the template structure or we can design our on layout. I am pretty much confused about all this. Can someone explain a little. Thanks.

    Read the article

  • How do I crash the App Pool?

    - by willem
    Our ASP.NET 2 web application handles exceptions very elegantly. We catch exceptions in Global ASAX in Application_Error. From there we log the exception and we show a friendly message to the user. However, this morning we deployed the latest version of our site. It ran ok for half an hour, but then the App Pool crashed. The site did not come back up until we restored the previous release. How can I make the app pool crash and skip the normal exception handler? I'm trying to replicate this problem, but with no luck so far. Update: we found the solution. One of our pages was screenscraping another page. But the URL was configured incorrectly and the page ended up screenscraping itself infinitely, thus causing a stack overflow exception.

    Read the article

  • String Functions in IIS Url Rewrite Module

    - by Nariman
    The IIS URL Rewrite Module ships with 3 built-in functions: * ToLower - returns the input string converted to lower case. * UrlEncode - returns the input string converted to URL-encoded format. This function can be used if the substitution URL in rewrite rule contains special characters (for example non-ASCII or URI-unsafe characters). * UrlDecode - decodes the URL-encoded input string. This function can be used to decode a condition input before matching it against a pattern. The functions can be invoked by using the following syntax: {function_name:any_string} The question is: can this list be extended by introducing a Replace function that's available for changing values within a rewrite rule action or condition? Another way to frame the question: is there any way to do a global replace on a URL coming in using this module? It seems that you're limited to using regular expressions and back-references to construct strings, without a search/replace functionality to replace every X with Y in {REQUEST_URI} before issuing a redirect.

    Read the article

  • Resources for memory management in embedded application

    - by Elazar Leibovich
    How should I manage memory in my mission critical embedded application? I found some articles with google, but couldn't pinpoint a really useful practical guide. The DO-178b forbids dynamic memory allocations, but how will you manage the memory than? preallocate everything in advance and send a pointer to each function that needs allocation? Allocate it on the stack? Use a global static allocator (but then it's very similar to dynamic allocation)? Answers can be of the form of regular answer, reference to a resource, or reference to good opensource embedded system for example. clarification: The issue here is not whether or not memory management is availible for the embedded system. But what is a good design for an embedded system, to maximize reliability.

    Read the article

  • Help me for creating huge database in Mysql

    - by user90552
    We are building a website for business on global wise, for every country major cities are covered in this concept. I need some suggestions from PHP Mysql People. Can i create single databse for all cities or multiple databases. Because in this system contains some relations between cities ,every chamber need nearly 50 tables for networking and some other tables. If I can create separate databases for every chamber there would be nearly 50*1000 tables need because we have 1000 cities. So Please give suggestions how can i build database for my system. Thank you Ravi

    Read the article

  • Hosting an NServiceBus subscriber in the same application as the producer.

    - by Jack Ryan
    Is it possible to use NServiceBus to publish and consume messages in the same application, specifically a web application? In the future we will almost certainly need to maintain a separate long running service to process messages generated by this application, and this is why we are hoping to use NServiceBus from the start, but right now it would be nice to just start up the consumer and the publisher when the web application starts. This will make testing and deployment far easier for us. I presume I will need to reference the NServiceBus.Host.exe and start up the process in the global.asax, but need help on what exactly I need to call to do this.

    Read the article

  • Are static delegates thread-safe?

    - by leypascua
    Consider this code snippet: public static class ApplicationContext { private static Func<TService> Uninitialized<TService>() { throw new InvalidOperationException(); } public static Func<IAuthenticationProvider> AuthenticationProvider = Uninitialized<IAuthenticationProvider>(); public static Func<IUnitOfWorkFactory> UnitOfWorkFactory = Uninitialized<IUnitOfWorkFactory>(); } //can also be in global.asax if used in a web app. public static void Main(string[] args) { ApplicationContext.AuthenticationProvider = () => new LdapAuthenticationProvider(); ApplicationContext.UnitOfWorkFactory = () => new EFUnitOfWorkFactory(); } //somewhere in the code.. say an ASP.NET MVC controller ApplicationContext.AuthenticationProvider().SignIn(username, true); Are delegates in the static class ApplicationContext thread-safe in the sense that multiple-threads can invoke them? What potential problems will I face if I pursue this approach?

    Read the article

  • NSMutableArray in appdelegate - EXEC_BAD_ACCESS

    - by Tejaswi Yerukalapudi
    Hi, I'm trying to use a global array in the appdelegate as a quick fix for a demo I'm building. The relevant code for this .h file has the declaration { NSMutableArray *trnEntered; } @property (nonatomic, retain) NSMutableArray *trnEntered .m file has the following code - trnEntered = [[NSMutableArray alloc] init]; NSLog(@"%@",[trnEntered count]); // prints null. [trnEntered addObject:@"1"]; NSLog(@"%@",[trnEntered count]); // exec bad access. Not sure where I'm going wrong here. Looks fairly straight forward. Thanks for the help in advance, Teja.

    Read the article

  • How to auto-deploy web-app

    - by Frankie
    Hello, I'm trying to make sense on the best way to do automatize a series of things in a row in order to deploy a web-app and haven't yet came up with a suitable solution. I would like to: use google's compiler.jar to minify my JS use yahoo's yui-compressor.jar to minify my CSS access a file and change a string so that header files like "global.css?v=21" get served the correct version deploy the app (sftp, mercurial or rsync?) omitting certain directories like "/userfiles" Can you guys put me on the right track to solve this? Thank you!

    Read the article

  • make db connection persistent throught zend framework

    - by kamikaze_pilot
    I'm using zend framework. currently everytime I need to use the db I go ahead and connect to the DB: function connect(){ $connParams = array("host" => $host, "port" => $port, "username" => $username, "password" => $password, "dbname" => $dbname); $db = new Zend_Db_Adapter_Pdo_Mysql($connParams); return $db } so I would just call the connect() function everytime I need to use the db My question is...suppose I want to reuse $db everywhere in my site and only connect once in the very initial stage of the site load and then close the connection right before the site gets sent to the user, what would be the best practice to accomplish this? Which file in Zend should I save $db in, what method should I use to save it (global variable?), and which file should I do the connection closing in?

    Read the article

  • Converting digits, generated by weblog service, to Arabic form

    - by Sorush Rabiee
    sorry if this is irrelevance :-) I need to write something in my html code to convert digits of form 0123456789 to ?????????? (Persian digits uni06F0..uni06F9). the number of visitors is generated by blog service. and I want to convert its digits to Arabic. Counter: ????? ????????????? : <BlogSky:Weblog Counter /> ??? the Persian part of above code mean 'Number of visitors' and 'Persons' (from left to right). but digits are represented in latin (0123...). Is it possible to write something like a function in html? i want it to be a global one for using in weblogs. Note: I don't know anything about web programming languages. I'm not sure about language of above code. (html?)

    Read the article

  • HttpsURLConnection failing intermittently to the same URL

    - by Arkaitz Jimenez
    I think I'm experiencing the same as http://groups.google.com/group/android-developers/msg/9d37d64aad0ee357 This is Android 1.5 SDK. I happen to call several times below code(which is in a method) with the same url and it fails intermittently. When it fails, there is no exception, the stream is empty so the readConnection fails, and getResponseCode returns -1. Global caching is disabled, setDefaultUseCaches(false); I suppose there must be some kind of url connection object pool somewhere. Any idea on how can I workaround this? HttpURLConnection connection = null; try { URL url = new URL(this.url); connection = (HttpURLConnection) url.openConnection(); connection.setRequestProperty("Authorization", "basic " + Base64Coder.encodeString(user + ":" + password)); connection.setRequestProperty("User-Agent", userAgent); connection.connect(); readConnection(connection.getInputStream()); connection.disconnect(); } catch (IOException ex) { reportException(ex, connection.getResponseCode()) } catch (ParserException ex) { reportException(ex, connection.getResponseCode()) }

    Read the article

  • Ruby execute code in class getting inherited to

    - by AdamB
    I'm trying to be able to have a global exception capture where I can add extra information when an error happens. I have two classes, "crawler" and "amazon". What I want to do is be able to call "crawl", execute a function in amazon, and use the exception handling in the crawl function. Here are the two classes I have: require 'mechanize' class Crawler Mechanize.html_parser = Nokogiri::HTML def initialize @agent = Mechanize.new end def crawl puts "crawling" begin #execute code in Amazon class here? rescue Exception => e puts "Exception: #{e.message}" puts "On url: #{@current_url}" puts e.backtrace end end def get(url) @current_url = url @agent.get(url) end end class Amazon < Crawler #some code with errors def stuff page = get("http://www.amazon.com") puts page.parser.xpath("//asldkfjasdlkj").first['href'] end end a = Amazon.new a.crawl Is there a way I can call "stuff" inside of "crawl" so I can use that exception handling over the entire stuff function? Is there a better way to accomplish this?

    Read the article

  • tkinter python entry not being displayed

    - by user1050619
    I have created a Form with labels and entries..but for some reason the entries are not being created, peoplegui.py from tkinter import * from tkinter.messagebox import showerror import shelve shelvename = 'class-shelve' fieldnames = ('name','age','job','pay') def makewidgets(): global entries window = Tk() window.title('People Shelve') form = Frame(window) form.pack() entries = {} for (ix, label) in enumerate(('key',) + fieldnames): lab = Label(form, text=label) ent = Entry(form) lab.grid(row=ix, column=0) lab.grid(row=ix, column=1) entries[label] = ent Button(window, text="Fetch", command=fetchRecord).pack(side=LEFT) Button(window, text="Update", command=updateRecord).pack(side=LEFT) Button(window, text="Quit", command=window.quit).pack(side=RIGHT) return window def fetchRecord(): print('In fetch') def updateRecord(): print('In update') if __name__ == '__main__': window = makewidgets() window.mainloop() When I run it the labels are created but not the entries.

    Read the article

  • How will you register a custom view engine where in the Areas will not be affected?

    - by Fleents
    I made a custom view engine for my application. ~/Themes/Default/Views.. And I have an Area called Admin. Area/Admin/Views.. I register my custom view engine in Global.asax : RegisterViewEngines(ViewEngines.Engines); AreaRegistration.RegisterAllAreas(); RegisterRoutes(RouteTable.Routes); When I browsed my admin site, it cant find the views.. I know its because of my custom view engine.. But how can you register new custom view engine without affecting the view engine of areas?

    Read the article

  • How to get route "name" when in route controller

    - by Murph
    I'm using routing in asp.net to get nice URLs When I define routes in global.asax I create two distinct routes that use the same controller (c#): // Setup code for route a... routes.Add("routeb", routea); // Setup code for route b... routes.Add("routeb", routeb); (How) is it possible to determine from within the controller what the "key" value is that directed the user to this controller? Alternatively is the pattern of use wrong - it would be straightforward to subclass the Controller (again) to distinguish between the two and retain common code if that is a more appropriate solution.

    Read the article

  • C++ - Access array (in main) from methods outside main

    - by John Smith
    I have an array in my main class that holds objects that I need to print out for a menu listing. The array is declared and initialized in main. I need to, however, access the same array in a sub-menu function. If I copy the code (for loop that prints out the values) to the sub-menu, nothing is printed (presumably because it can't access the original array and has made a new, blank one). Is there any way (without making the array a global variable) that I can access the array in this sub-menu? Both the main and the sub-menu function are in the same file and the sub-menu is called from main. Maybe to put it more simply, can I use scope resolution to bring me up one 'level' in scope?

    Read the article

< Previous Page | 140 141 142 143 144 145 146 147 148 149 150 151  | Next Page >