Search Results

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

Page 138/224 | < Previous Page | 134 135 136 137 138 139 140 141 142 143 144 145  | Next Page >

  • PHP and Enums

    - by Henrik Paul
    I know that PHP doesn't have native Enumerations. But I have become accustomed to them from the Java world. I would love to use enums as a way to give predefined values which IDEs' auto completion features could understand. Constants do the trick, but there's the namespace collision problem and (or actually because) they're global. Arrays don't have the namespace problem, but they're too vague, they can be overwritten at runtime and IDEs rarely (never?) know how to autofill their keys. Are there any solutions/workarounds you commonly use? Does anyone recall whether the PHP guys have had any thoughts or decisions around enums?

    Read the article

  • Has anyone ever encountered a Monad Transformer in the wild?

    - by martingw
    In my area of business - back office IT for a financial institution - it is very common for a software component to carry a global configuration around, to log it's progress, to have some kind of error handling / computation short circuit... Things that can be modelled nicely by Reader-, Writer-, Maybe-monads and the like in Haskell and composed together with monad transformers. But there seem to some drawbacks: The concept behind monad transformers is quite tricky and hard to understand, monad transformers lead to very complex type signatures, and they inflict some performance penalty. So I'm wondering: Are monad transformers best practice when dealing with those common tasks mentioned above?

    Read the article

  • nhibernate webforms with class library

    - by frosty
    very new to nhibernate. I'm a little confused on where features should live. I have the following solution 1) MyProject.Web ( web forms application) 2) MyProject.Domain( class lib) - nhibernate.config - product.hbm.xml So is it correct I should put the following method in a IHttpModule? ( i can't use a global asax as it's use by the CMS i'm running ) Where should the connectionString live? HTTPModule in web forms application private static ISessionFactory CreateSessionFactory() { var cfg = new Configuration().Configure(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "nhibernate.config")); cfg.SetProperty(NHibernate.Cfg.Environment.ConnectionStringName, System.Environment.MachineName); NHibernateProfiler.Initialize(); return cfg.BuildSessionFactory(); } nhibernate.config <?xml version="1.0" encoding="utf-8" ?> NHibernate.Dialect.MsSql2005Dialect NHibernate.Connection.DriverConnectionProvider NHibernate.Driver.SqlClientDriver 16 web NHibernate.ByteCode.Castle.ProxyFactoryFactory, NHibernate.ByteCode.Castle enter code here

    Read the article

  • Ninject: Abstract Class

    - by Pickels
    Hello, Do I need to do something different in an abstract class to get dependency injection working with Ninject? I have a base controller with the following code: public abstract class BaseController : Controller { public IAccountRepository AccountRepository { get; set; } } My module looks like this: public class WebDependencyModule : NinjectModule { public override void Load() { Bind<IAccountRepository>().To<AccountRepository>(); } } And this is my Global.asax: protected override void OnApplicationStarted() { Kernel.Load(new WebDependencyModule()); } protected override IKernel CreateKernel() { return new StandardKernel(); } It works when I decorate the IAccountRepository property with the [Inject] attribute. Thanks in advance.

    Read the article

  • Best build dir location to use in Xcode

    - by neoneye
    I'm consolidating my Xcode/TextMate setup and is interested in where you put your build dir. Some years ago I started out having the build dir in the same dir as my xcodeproj file. However it became a mess when my project became a multi project with a applications and frameworks and tests, so I started using ../build as the build dir, so that all the sub projects used the same dir. However Spotlight is indexing this build dir and TextMate's global find is unusable when there is a build dir in the project. I'm thinking either using ~/.build or /build as Xcode's build dir. What build dir do you use and why?

    Read the article

  • ASP.NET MVC: Routing

    - by JamesBrownIsDead
    Let's say I have this Controller: public class GlobalizationController : Controller { public JavaScriptResult GlobalizedLabels(string virtualPath) { return new JavaScriptResult(); } } I want the controller to handle (i.e. invoke from) any of the relative URLs below: /globalization/~Enlargement/Controls/Container.ascx /globalization/test/foobar.aspx /globalization/HappyTimes/Are/Right/Now What would my entry in global.asax routes.MapRoute() entry look like? As in... routes.MapRoute("Globalization", "globalization/{virtualPath}", new { controller = "Globalization", action = "GlobalizedLabels" }); The URL pattern "{virtualPath}" is wrong. What should it be?

    Read the article

  • Best way to provide software settings?

    - by claws
    I'm using C# .NET. In my software I'm providing settings dialog through which user can set the application settings which I want to save to a file. Requirements (typical): Every class I defined uses some part of these settings. So, these should be global to all classes. These should be loaded while software is started. When ever user changes settings and clicks 'save'/'apply'. Current settings should change. I am wondering what is the best way to do this? Also, what is the best way to save these settings to disk? I mean should I create a Settings class object and serializing it to 'settings.dat' or provide an structured file like XML/JSON

    Read the article

  • genrating xlsheet with mysql but also contains html code in xl sheet need remove html code

    - by pmms
    following is the code for getting xlsheet from mysql ?php if($_POST['Submit']=='Generatexml') { $tblname=$_GET['genratexml']; //mysql_connect("localhost","root",""); //mysql_select_db("hitnrunf_db"); global $obj_mysql; $result = mysql_query("SELECT * FROM tbl_js_login"); while($row = mysql_fetch_array($result)) { $csv_output .= "$row[fld_id],$row[fld_fname],$row[fld_lname]"; $csv_output .="\015\012"; } header("Content-type: application/vnd.ms-excel"); header("Content-disposition: csv; filename= Student_Data_". date("Y-m-d") . ".csv"); print $csv_output; exit; } include_once $path."includes/jobseeker_form.php"; ? following is the link error we are getting http://www.eminosoft.com/screenshot/xlsheet.JPG

    Read the article

  • How to return the handle of a window when we click on it, without any DLL injection?

    - by Doo Dee
    Hello! For one of my projects, I need to create a function that will return a handle to a window when the user click on it (any window displayed on screen, and anywhere inside that window). I know it is possible to use a global hook, but I think there must be a more simple way of doing that, without using any DLL injection. In fact, I could intercept the left mouse click or intercept when a window is activated. Can I use one of those 2 solutions without any DLL injection?

    Read the article

  • Add custom Model Binders for derived objects and their base

    - by mare
    My class diagram: BaseContentClass Page inherits BaseContentClass Tab inherits BaseContentClass ... If I do this ModelBinders.Binders.Add(typeof(BaseContentObject), new BaseContentObjectCommonPropertiesBinder()); then when in controller action parameter of type Tab appears, custom model binder is not fired. It gets fired if I do this: ModelBinders.Binders.Add(typeof(Tab), new BaseContentObjectCommonPropertiesBinder()); But I don't want to go writing "n" number of Add statements in my global.asax.cs to associate all the derived classes with my custom model binder, do I? I don't know if I have any other option.

    Read the article

  • How can I make a security token automatically expire in a passive STS setup?

    - by Rising Star
    I have a passive STS set up for a new application I'm working on. I've noticed that when a user's session expires, the user is still authenticated. I would have thought that when the session expires, the user would no longer be authenticated. My boss discussed this with me as I am currently charged with setting up the authentication. He says that it would be good if we could make the user's log on expire after a certain period of inactivity similar to how the session expires. I am familiar with how to sign a user out with a few lines of code. How can I make it so that the user is automatically signed out after a specified period of inactivity? Currently, I have some code in the global.asax file that programmatically checks when the last request was and compares it to the current time; it then signs the user out if a certain period of time has expired.

    Read the article

  • Why is the destructor called when the CPython garbage collector is disabled?

    - by Frederik
    I'm trying to understand the internals of the CPython garbage collector, specifically when the destructor is called. So far, the behavior is intuitive, but the following case trips me up: Disable the GC. Create an object, then remove a reference to it. The object is destroyed and the __del__ method is called. I thought this would only happen if the garbage collector was enabled. Can someone explain why this happens? Is there a way to defer calling the destructor? import gc import unittest _destroyed = False class MyClass(object): def __del__(self): global _destroyed _destroyed = True class GarbageCollectionTest(unittest.TestCase): def testExplicitGarbageCollection(self): gc.disable() ref = MyClass() ref = None # The next test fails. # The object is automatically destroyed even with the collector turned off. self.assertFalse(_destroyed) gc.collect() self.assertTrue(_destroyed) if __name__=='__main__': unittest.main() Disclaimer: this code is not meant for production -- I've already noted that this is very implementation-specific and does not work on Jython.

    Read the article

  • ELMAH: Only sending specific exception type via mail

    - by Sir Code-A-Lot
    Hi, I have ELMAH set up for a webapp, logging exceptions to a SQL server. I wish to have ELMAH send me an email too, but only when a specific exception is thrown (ie. MySpecialException). ELMAH must still log all exceptions to SQL server. I know you can do it programmatically in global.asax, but I'd prefer to use web.config. So, how do I restrict ELMAH error mails to filter out everything but a specific exception type, using web.config?

    Read the article

  • Localization with separate Language folders within Views

    - by Adrian
    I'm trying to have specific folders for each language in Views. (I know this isn't the best way of doing it but it has to be this way for now) e.g. /Views/EN/User/Edit.aspx /Views/US/User/Edit.aspx These would both use the same controller and model but have different Views for each language. In my Global.asax.cs I have routes.MapRoute( "Default", // Route name "{language}/{controller}/{action}/{id}", // URL with parameters new { language = "en", controller = "Logon", action = "Index", id = UrlParameter.Optional }, // Parameter defaults new { language = @"en|us" } // validation ); This works ok but always points to the same View. If I put the path to the Lanagugage folder it works return View("~/Views/EN/User/Edit.aspx"); but clearly this isn't a very nice way to do it. Is there anyway to get MVC to look in the correct language folder? Thanks and again I know this isn't the best way of doing Localization but I can't use resource files.

    Read the article

  • Embedded Linux: Memory Fragmentation

    - by waffleman
    In many embedded systems, memory fragmentation is a concern. Particularly, for software that runs for long periods of time (months, years, etc...). For many projects, the solution is to simply not use dynamic memory allocation such as malloc/free and new/delete. Global memory is used whenever possible and memory pools for types that are frequently allocated and deallocated are good strategies to avoid dynamic memory management use. In Embedded Linux how is this addressed? I see many libraries use dynamic memory. Is there mechanism that the OS uses to prevent memory fragmentation? Does it clean up the heap periodically? Or should one avoid using these libraries in an embedded environment?

    Read the article

  • How do I refer to a view controller in a subclass?

    - by thekevinscott
    Hey all, I'm currently teaching myself Objective C and I'm kind of stuck. I'm building a backgammon game and I have a subclass, "Piece", which is being initialized, repeatedly, in BackGammonViewController. In BackGammonViewController, if I do this: UIImage *myImage = [ UIImage imageNamed: @"white-piece.png" ]; UIImageView *myImageView = [ [ UIImageView alloc ] initWithImage: myImage ]; [self.view addSubview:myImageView]; [myImageView release]; The image appears. However, I want to do this within my "piece" class. How do I refer to the "self.view" from within the piece class? Do I need to pass a reference to the view, into the "piece class" ? Or is there a global reference I can call from within the "piece class" ? Thanks for your help.

    Read the article

  • Visual Studio ASP.Net MVC undo set as start page action

    - by kingrichard2005
    I have an web application that I'm working on, it was working fine until my curiosity got the better of me and I right-clicked on a view and chose Set As Start Page option. Now, whenever I run my application it takes me to the Resource Not Found error page. I have the default register route set in my Global config route which was working fine before. I notice that the URL now reads: http://localhost:1234/Views/User/Login.aspx instead of http://localhost:1234/ like it was before. I'm not sure how to undo this action or what was changed, I've looked in my web.config file but I'm not sure what to look for exactly, Help is appreciated.

    Read the article

  • How can I access data that's stored in my App Delegate from my various view controllers?

    - by BeachRunnerJoe
    This question is similar to this other post, but I'm new to iPhone development and I'm getting used to the good practices for organizing my data throughout my app. I understand the ApplicationDelegate object to be the best place to manage data that is global to my app, correct? If so, how can I access data that's stored in my App Delegate from various view controllers? Specifically, I have an array of table section titles for my root table view controller created as such... appdelegate.m sectionTitles = [[NSArray alloc] initWithObjects: @"Title1", @"Title2", @"Title3", nil]; rootViewController.appDelegate = self; and I need to access it throughout the different views of my app, like such... rootviewcontroller.m NSUInteger numSections = [self.appDelegate.sectionTitles count]; Is this the best way to do it or are there any reasons I should organize my data a better way? Thanks so much in advance for your help!

    Read the article

  • host MVC app inside a website

    - by Nishant
    I have a website (not a web application- in visual studio you get two options-create a website/project) running on IIS 6.0. Now I want to develop few features in MVC architecture. So I created one MVC application in visual studio and everything is working fine on localhost as a separate application. Now I want to host this MVC app also inside the website I have already deployed. I created a virtual directory(MVCDir) inside the default website in IIS 6.0. The global.asax file which was in root folder I added the routing function- Shared Sub RegisterRoutes(ByVal routes As RouteCollection) routes.Ignore("{resource}.axd/{*pathInfo}") routes.Ignore("{resource}.aspx/{*pathInfo}") routes.MapPageRoute("Default4", "{controller}/{action}/{id}", "~/MVCDir", False, New RouteValueDictionary(New With {.controller = "Home", .action = "Index", .id = Mvc.UrlParameter.Optional})) End Sub * NOTE- If I write routes.ignoreRoute instead of routes,ignore it says- IgnoreRoute is not a member of System.Web.RoutingCollection* I called this routing function inside application_start function now when I run domain.com/home/index How to solve this problem? it says resource not found

    Read the article

  • Javascript clears a variable after there is no further reference it

    - by Praveen Prasad
    It is said, javascript clears a variable from memory after its being referenced last. just for the sake of this question i created a JS file with only one variable; //file start //variable defined var a=["Hello"] //refenence to that variable alert(a[0]); // //file end no further reference to that variable, so i expect javascript to clear varaible 'a' Now i just ran this page and then opened firebug and ran this code alert(a[0]); Now this alerts the value of variable, If the statement "Javascript clears a variable after there is no further reference it" is true how come alert() shows its value. Is it because all variable defined in global context become properties of window object, and since even after the execution file window objects exist so does it properties.

    Read the article

  • Suggestion to reverse string in c#

    - by HasanGursoy
    Is this the right method to reverse a string? I'm planning to use it to reverse a string like: Products » X1 » X3 to X3 « X1 « Products I want it to be a global function which can be used elsewhere. public static string ReverseString(string input, string separator, string outSeparator) { string result = String.Empty; string[] temp = Regex.Split(input, separator, RegexOptions.IgnoreCase); Array.Reverse(temp); for (int i = 0; i < temp.Length; i++) { result += temp[i] + " " + outSeparator + " "; } return result; }

    Read the article

  • Can An Assembly Be Installed In The GAC but not Show Up In Gacutil.exe?

    - by Brett Bim
    I've got an application where some assemblies are copied to C:\Windows\assembly upon deployment under the assumption that this installs them in the GAC. The application seems to work but when I run gacutil.exe on the copied assemblies, it says the Global Assembly Cache contains 0 assemblies. Should all assemblies in c:\Windows\assembly show up in gacutil? If not, why not? How can I verify that the assembly is in fact installed in the GAC? I have always used gacutil.exe in the past to register assemblies so doing a file copy is new to me and I'm trying to understand the ramifications.

    Read the article

  • ACCESS 2003 Excel 2003 : VBA for opening Excel file from Access and copying a pictre from excel the

    - by Justin
    So I have an excel workbook that has a nice global map of shaperange objects. With some very simple code I can change the colors, group and ungroup collections of countries into arrays, etc...and it works pretty well. However, I would like to bring this into Access. So I could copy and paste all the shapes into an access form manually, but then they become pictures and I cannot change the colors of the countries (shaperange objects) to have the map act interactively as I can in excel. So I am thinking that I know how to use excel functions from access, and how to open excel from access. Is there a way to copy an object from excel (I know the file name and the shape name that i mean to copy everytime), and bringing it back to access to paste on a form? Atypical, I know, all my Access questions are. Thanks!

    Read the article

  • Automatic exit from bash shell script on error

    - by radman
    Hi, I've been writing some shell script and I would find it useful if there was the ability to halt the execution of said shell script if any of the commands failed. See below for an example: #!/bin/bash cd some_dir ./configure --some-flags make make install So in this case if the script can't change to the indicated directory then it would certainly not want to do a ./configure afterward it fails. Now I'm well aware that I could have an if check for each command (which I think is a hopeless solution), but is there a global setting to make the script exit if one of the commands fails?

    Read the article

  • Rotate a feature Image in Open Layers

    - by Ozaki
    I have an open layers map. It adds and removes my "imageFeature" every 10secs or so. I have a JSON feed that gives me the rotation that I need, I have a request to get that rotation and set it as a variable of rotationv. Everything works but the fact when the image is recreated it does not update the rotation. My code is as follows: JSON request: var rotationv = (function () { rotationv = null; $.ajax({ 'async': false, 'global': true, 'url': urldefault, 'dataType': "json", 'success': function (data) { rotationv = data.rotation; } }); return rotationv })(); Creating image feature: imageFeature = new OpenLayers.Feature.Vector( new OpenLayers.Geometry.Point(mylon, mylat), { rotation: rotationv } ); The image is set in the styling elsewhere. Why does this not rotate my image?

    Read the article

< Previous Page | 134 135 136 137 138 139 140 141 142 143 144 145  | Next Page >