Search Results

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

Page 141/224 | < Previous Page | 137 138 139 140 141 142 143 144 145 146 147 148  | Next Page >

  • Sqlalchemy layout with WSGI application

    - by TheDude
    I'm working on writing a small WSGI application using Bottle and SqlAlchemy and am confused on how the "layout" of my application should be in terms of SqlAlchemy. My confusion is with creating engines and sessions. My understanding is that I should only create one engine with the 'create_engine' method. Should I be creating an engine instance in the global namespace in some sort of singleton pattern and creating sessions based off of it? How have you done this in your projects? Any insight would be appreciated. The examples in the documentation dont seem to make this entirely clear (unless I'm missing something obvious). Any thoughts?

    Read the article

  • How to inject a "runtime" dependency like a logged in user which is not available at application boot time?

    - by Fabian
    I'm just not getting this: I use Gin in my java GWT app to do DI. The login screen is integrated into the full application window. After the user has logged in I want to inject the user object into other classes like GUI Presenters which I create, so I have some sort of runtime dependency I believe. How do i do that? One solution I can think of is sth like: class Presenter { @Inject Presenter(LoggedInUserFactory userFactory) { User user = userFactory.getLoggedInUser(); } } class LoggedInUserFactoryImpl { public static User user; User getLoggedInUser() { return user; } } So, when the user is successfully logged in and I have the object i set the static property in LoggedInUserFactory, but this will only work if the Presenter is created after the user has logged in which is not the case. Or should I use a global static registry? I just don't like the idea of having static dependencies in my classes. Any input is greatly appreciated.

    Read the article

  • Sort NSFetchedResultsController results by user location

    - by cgp
    I have an application that contains some Locations in Core Data, and I want to show them to the user in order of proximity to the user's location. I am using an NSFetchedResultsController to serve the locations to the Table View. I thought about creating a virtual accessor method that returns the location's distance from the user, that would be calculated using a "global" CoreLocationManager, but it crashes with reason: Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'keypath distanceFromCurrentLocation not found in entity < NSSQLEntity Location id=4' I also give the user the option to sort alphabetically, so I would prefer it if I kept the NSFetchedResultsController, if possible. How should I do it? Thanks!

    Read the article

  • WordPress + Facebook comments addition (php knowledge needed)

    - by user1356223
    I succeded to fetch Facebok comments number via this function: <?php function fb_comment_count() { global $post; $url = get_permalink($post->ID); $filecontent = file_get_contents('https://graph.facebook.com/?ids=' . $url); $json = json_decode($filecontent); $count = $json->$url->comments; if ($count == 0 || !isset($count)) { $count = 0; } echo $count; } ;?> And I call it with: <?php fb_comment_count();?> Now how do I add it to this code: <?php comments_number(__('No Comments'), __('1 Comment'), __('% Comments'), '', __('Comments Closed') ); ?> so that WordPress shows number of WP and FB comments together in one number. Thank you very much to everyone!

    Read the article

  • Change page layout in the middle of a LaTeX document

    - by David
    I'm looking for a way to change some page layout dimensions in the middle of a LaTeX document. The reason is, I'd like to have smaller margins and longer lines in the "References" section of my report document (basically because short lines aren't so important there and I can save space). In my preamble I have (works fine): \setlength\textwidth{130mm} \setlength\oddsidemargin{14.6mm} In the document I simply try to re-set them at the right point but they're ignored. ... last paragraph ends here. \newpage \setlength\textwidth{150mm} % +20mm text width \setlength\oddsidemargin{13.6mm} % -10mm left margin (so it stays centered) References ... The geometry package is useful but only for global adjustments in the preamble, so I can't use it here. Is it not possible to change the page layout at some point in the document?

    Read the article

  • Display Computer Info on an ASP.NET Page

    - by Gene
    I want to build a page for end users to visit (in our MPLS Network) and it show the following information in regards to them: Computer Name OS Disk Space Memory IP Address Active Directory User Name Password Expiration Time (As defined by Global Policy) Maybe a few other things such as Trend Micro Office current version vs. their version, # of MS Updates needed (we utilize WSUS), and a few other things in the future. My question is how would I pull this information from the user when they visit the page? What is the proper function for this? Anyone have examples they wish to share for me to learn by if possible?

    Read the article

  • Replacing Text Nodes With DOM Nodes

    - by Greg
    Hey, say I have a text node via XPath. How would I replace the text node with a new DOM node? For example, this little patch of code will go through text nodes, and if text matches something, it will replace it with a corresponding image via img element. I wanted something faster then a global page regex or even a element innerHTML regex. Any help would be appreciated. EDIT: Never mind. I figured it out.

    Read the article

  • Saving contents of ApplicationState in ASP.Net (MVC)

    - by Saqib
    I have an internal app used to edit XML files on disk. The XML files are loaded into an object model which is stored in ApplicationState. I need to save this data. The one option is to do this every time the user changes some data. However, this seems a bit inefficient - writing the data out to disk each time a change is made. Instead, is it possible to be notified whenever the user closes their browser, plus just before the web server exits? Thus, the data would be saved each time a session ends, plus when the computer shuts down, etc. I thought that Application_End(), Application_Error() and Session_End() in Global.asax would provide this, but these methods don't seem to be called.

    Read the article

  • MVC4 link automatically redirected to default INDEX page/action even if defined action name with controller

    - by Raj Tamakuwala
    i am creating web mobile application in mvc4. My problem is when I click on particular link in my application,it works well, but sometimes it automatically redirected to INDEX page that is set as default page in global.asax as routes.MapRoute( "Default", // Route name "{controller}/{action}/{id}", // URL with parameters new { controller = "Home", action = "Index", id = UrlParameter.Optional } // Parameter defaults ); Now I don't know why its automatically redirected to INDEX page,even if I have already defined controller and action name where it show redirected as, <a href='@(Url.Action( "ActivityWall", "Home"))' > </a> logically it should redirect to "ActivityWall" page,which it does.but sometime only it goes to INDEX page.then when I clear my cookie problem will again solved but after some time it again start redirecting to INDEX page. I also posted question related to cookies issue yesterday,but I think that is nit main issue. can someone help please ?

    Read the article

  • release vs setting-to-nil to free memory

    - by Dan Ray
    In my root view controller, in my didReceiveMemoryWarning method, I go through a couple data structures (which I keep in a global singleton called DataManager), and ditch the heaviest things I've got--one or maybe two images associated with possibly twenty or thirty or more data records. Right now I'm going through and setting those to nil. I'm also setting myself a boolean flag so that various view controllers that need this data can easily know to reload. Thusly: DataManager *data = [DataManager sharedDataManager]; for (Event *event in data.eventList) { event.image = nil; event.thumbnail = nil; } for (WondrMark *mark in data.wondrMarks) { mark.image = nil; } [DataManager sharedDataManager].cleanedMemory = YES; Today I'm thinking, though... and I'm not actually sure all that allocated memory is really being freed when I do that. Should I instead release those images and maybe hit them with a new alloc and init when I need them again later?

    Read the article

  • How to enable absolute paths in LaTeX

    - by Matthias Günther
    Hey, I have one document under ~/my_files/test.tex and want to include in test.tex some styling informations, which can be found under ~/latex/styles/info_hypersetup.tex. When I include the following statement into my test.tex: %% setting the infos for the pdf \include{home/helex/latex/styles/info_hypersetup.tex} I get the following error when running pdflatex test.test: ! I can't write on file `~/latex/styles/info_hypersetup.tex.aux'. I set the rights to 777 but this doesn't changed anything. It works, if I put info_hypersetup.tex in the directory-structure where test.tex is. But I want to use this styleinformation as a global setting for all my documents and don't want to copy it into every project. Thanks for your help.

    Read the article

  • How Do I Handle errors in Windows Applications

    - by yytg
    I did a program and in some point - when the program needs to exit he throw an exception here is the code try { Application.Run(new Form1()); } catch (ExitException) { } In the VS it's working fine (VS 2008 - C#) But when I run it separately from the VS - the program say so the error is not handled I know so I can do like this Application.ExitThread() - But... I need to handle the exit of the program. Why In VS its work fine and outside its create errors? And how to solve it without using the global error handling? Thanks in advance

    Read the article

  • Conditionally embed ASP.NET MVC2 Views as resources during build in Visual Studio 2010

    - by jslatts
    I have a ASP.NET MVC2 project in VS2010 that can be deployed in two modes: standalone or plugin. In standalone mode, the views should live outside the compiled assembly as .aspx files (the default setup). In plugin mode, the views are switched (currently by hand) to embedded resources and the entire assembly is dropped into a host project folder. Currently, this requires the developer to go through each view and switch it from Build Action: "Content" to "Embedded Resource" and vice versa. I would like to create a new solution configuration to automatically grab all .aspx files and build them as resources. This SO post seems like the solution, but I would prefer not to have to edit the .csproj every single time I add a new view to the project. Is there a way to use a wild cards or some other batch/global conditionally statement to change resources from content to embedded?

    Read the article

  • NSUserDefaults and default language used for I18N

    - by fedmest
    I have searched around a lot for this and found some answers that sounded quite like what I wanted but never worked. I simply need to have my iPhone app load NIBs and Localizable.strings that I decide (through user selection) rather than the ones that are established through the global iPhone/iPad settings. General consensus seems to be that this line [[NSUserDefaults standardUserDefaults] setObject:[NSArray arrayWithObject:@"ro"] forKey:@"AppleLanguages"]; would do the trick (in this specific case, load the NIBs and Localizable.strings in ro.lproj) but I have not had such luck. It keeps on looking for the files in en.lproj or whatever language I chose in the Settings app. I have then tried adding this line [[NSUserDefaults standardUserDefaults] setObject:[NSArray arrayWithObject:@"ro_RO"] forKey:@"AppleLocale"]; and to my great surprise, it worked! ...only once :-( then back to the same issue. Has anyone got any idea how to solve this issue? The aforementioned code was added at the very start of applicationDidFinishLaunching, which is before any NIBs or strings files should be loaded.

    Read the article

  • In Windows 7, clicking between file explorer windows does not generate window events. What's up?

    - by asmw
    I have a custom made global hook installed and am monitoring for window messages when file explorer windows are clicked on. The funny thing is that they don't generate any window messages! I click between two file explorer windows and nothing. No VM_CREATE, no VM_ACTIVATE. Nothing. Why is this? Spy++ crashes on my machine so I can't use it but my hook is pretty good and should pick everything up. For some reason these windows just don't function like normal windows in that they don't generate the standard window messages when they become active. It seems windows 7 does not see them as normal windows? what's going on?

    Read the article

  • Drawing random circles

    - by ViktorC
    I am trying to draw a cupola circles at random positions in an Android application. I draw them on a bitmap and then draw that bitmap on the canvas. This is the function where a draw the circles: private void drawRandomCircles(int numOfCircles) { Canvas c = new Canvas(b); Paint cPaint = new Paint; cPaitn.setColor(Color.RED); for(int i = 0; i < numOfCircles; i++) { int x = Math.Random % 100; int y = Math.Random % 100; c.drawCircle(x, y, 20, cPaint) } } The Bitmap b is global. And after calling this function I just draw the bitmap in the onDraw method. Now the problem is that I only get one circle drawn on the screen, no matter the size of numOfCircles. Any clue what is happening here?

    Read the article

  • PHP code in Drupal 6

    - by abhishekgupta92
    A very standard example of the problem that I am facing is that of a custom content say blog type. Now there is a view namely "My Blog Posts". In that view i take the argument as User:uid. Now, for the link part i simply write the code below: global $user; and send $user-uid as the argument to User:Uid. This give me link for "My Blog Posts" or the blog posts of the logged-in user What I want is a view like "His Blog Posts". So, if i visit the profile of some other user. There should be a tab in his profile "Blog Posts by Me". So for that i need to have the UID of the user whose profile I am visiting. So, how can I get this parameter from URL of his profile or somevhere else.

    Read the article

  • Can I get information about the IIS7 virtual directory from Application_Start?

    - by Keith
    I have 3 IIS7 virtual directories which point to the same physical directory. Each one has a unique host headers bound to it and each one runs in its own app pool. Ultimately, 3 instances of the same ASP.NET application. In the Application_Start event handler of global.asax I would like to identify which instance of the application is running (to conditionally execute some code). Since the Request object is not available, I cannot interrogate the current URL so I would like to interrogate the binding information of the current virtual directory? Since the host header binding is unique for each site, it would allow me to identify which application instance is starting up. Does anyone know how to do this or have a better suggestion?

    Read the article

  • Confused about GNU `sort(1)` of a numerical sub field

    - by Chen Levy
    I wish to sort a space separated table, with the numerical value that found on the 2nd field. I can assume that the 2nd field is always fooN but the length of N is unknown: antiq. foo11 girls colleaguing foo2 Leinsdorf Cousy foo0 Montgomeryville bowlegged foo1 pollack Chevrier foo10 ill-conceived candlebomb foo3 seventieths autochthony foo101 re-enable beneficiate foo100 osteometric I read man sort(1) and played with all sort of options. On my system I found the line: sort -n -k2.5 table to work. My question is why? According to the man page: -k, --key=POS1[,POS2] start a key at POS1, end it at POS 2 (origin 1) ... POS is F[.C][OPTS], where F is the field number and C the characterposition in the field. OPTS is one or more single-letter ordering options, which override global ordering options for that key. If no key is given, use the entire line as the key. So why sort -n -k2.4 table don't work and sort -n -k.5 does?

    Read the article

  • Is it possible to iterate all the OutputCache keys?

    - by Deane
    Is it possible to iterate the OutputCache keys? I know you can remove them individually via HttpResponse.RemoveOutputCacheItem(), but is there a way I can iterate all the keys to see what's in the collection? I searched through Object Viewer, but didn't see anything. Worst case, I can maintain my own index. Since I'm doing everything by VaryByCustom, they get "fed" through a method in global.asax. It just strikes me that there has to be a more elegant way of doing this.

    Read the article

  • How to remove proxy from WebRequest and leave DefaultWebProxy untouched

    - by Elephantik
    I use FtpWebRequest to do some FTP stuff and I need to connect directly (no proxy). However WebRequest.DefaultWebProxy contains IE proxy settings (I reckon). WebRequest request = WebRequest.Create("ftp://someftpserver/"); // request.Proxy is null here so setting it to null does not have any effect WebResponse response = request.GetResponse(); // connects using WebRequest.DefaultWebProxy My code is a piece in a huge application and I don't want to change WebRequest.DefaultWebProxy because it is global static property and it can have adverse impact on the other parts of the application. Any idea how to do it?

    Read the article

  • Can I prevent a user from using windows taskmanager to end a process?

    - by Russ
    I have a c# 4.0 application that I hear grumblings and rumors about problems with. Now, this application has a global unhandled exception handler that reports back to me with errors. I also know that it works because SOME people fill it in, and submit it. It seems though; that a large number of people do NOT fill it in, but instead, use the Windows Taskmanager to end the process. Is it possible to prevent a user from using the Windows Taskmanager to end a specific process? My goal would be that if the application crashes, the form that the user is presented with prevents the process from being ended. I'll also accept steps that would prevent the Windows Taskmanager from being launched.

    Read the article

  • different explanation

    - by Delirium tremens
    The following code echoes 5, not 10: $global_obj = null; class my_class { var $value; function my_class() { global $global_obj; $global_obj = &$this; } } $a = new my_class; $a->my_value = 5; $global_obj->my_value = 10; echo $a->my_value; "Upon first examination, it would seem that the constructor of my_class stores a reference to itself inside the $global_obj variable. Therefore, one would expect that, when we later change the value of $global_obj-my_value to 10, the corresponding value in $a would change as well. Unfortunately, the new operator does not return a reference, but a copy of the newly created object." Please, give me a different explanation.

    Read the article

  • C++ option/long option implementation

    - by K Hein
    I am working on a parser for meta programming language using C++ on Linux platform. Right now, I need to implement option/long option for the parser to provide some additional features. Basically, if the user pass in some additional option, the parser needs to store statistics while parsing the text files. I can think of two ways to implement it. One way is to user global to store options entered by users. Another way is to create a singleton class to store options. So I would like to know if there is any other way to implement it. What is the best/most recommended way of implementing it? Thanks in advance. Regards, K.Hein

    Read the article

  • Error in Using Dynamic Data Entities WebSite in VS2012

    - by amin behzadi
    I decided to use Dynamic Data Entities website in vs2012. So, I created this website,then added App_Code directory and added a new edmx to it and named it myDB.edmx. After that I uncommented the code line in global.asax which registers the entity context : DefaultModel.RegisterContext(typeof(myDBEntities), new ContextConfiguration() { ScaffoldAllTables = true }); But when I run the website this error occurs : The context type 'myDBEntities' is not supported. how can I fix it? p.s: You now there are some differences between using L2S by Dynamic Data L2S website AND using entity framework by Dynamic Data Entities website.

    Read the article

< Previous Page | 137 138 139 140 141 142 143 144 145 146 147 148  | Next Page >