Search Results

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

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

  • Controller getting NULL value?

    - by RSolberg
    I'm trying to make a call to a controller via jQuery $.post, but the parameter for my controller method keeps getting a NULL value despite it appearing to be setup similar to other controller methods. CONTROLLER [AcceptVerbs(HttpVerbs.Post)] public ActionResult SearchWeatherLocations(string searchFor) { //Do Some Magic } GLOBAL.ASAX routes.MapRoute("SearchWeatherLocations", "Home/SearchWeatherLocations/{searchFor}", new { controller = "Home", action = "SearchWeatherLocations" }); jQuery Call From View <script type="text/javascript" language="javascript"> $(document).ready(function () { GetWeatherLocations("seat"); }); function GetWeatherLocations(sSearchFor) { var divToBeWorkedOn = '#locations'; var webMethod = '<%= Url.Action("SearchWeatherLocations", "Home") %>/'; var url = webMethod + sSearchFor; $.post(url, function (data) { $('#locations').children().remove(); for (var count in data) { $('#locations').append("<li>" + data[count].LocationName + "&nbsp;(" + data[count].LocationCode + ")</li>"); } }); } </script>

    Read the article

  • Whats the scope of a c function defined within objective-c class?

    - by roja
    I was reading up about bypassing objective-c's messaging to gain performance (irrelevant to this specific question) when i found an interesting bit of code: #import <Cocoa/Cocoa.h> @interface Fib : NSObject { } - (long long) cFib: (NSUInteger) number; @end @implementation Fib // c implementation of fib long long cFibIMP(NSUInteger number) { return (number < 3) ? 1 : cFib(number - 1) + cFib(number - 2); } // method wrapper for c implementation of fib - (long long) cFib: (NSUInteger) number { return cFibIMP(number); } @end My question is; when using c function, within an objective-c object, what scope is the c function (cFibIMP in this particular case) placed in? Does the objective-c class encapsulate the c function removing change of name-clash or is the c function simply dumped into the global scope of the whole objective-c program?

    Read the article

  • Help with MVC controller: passing a string from view to controller

    - by 109221793
    Hi guys, I'm having trouble with one particular issue, I was hoping someone could help me out. I've completed the MVC Music Store tutorial, and now I'm trying to add some administrator functionality - practice as I will have to do this in an MVC application in my job. The application is using the aspnet membership api, and what I have done so far is created a view to list the users. What I want to be able to do, is click on the users name in order to change their password. To try and carry the username to the changeUserPassword controller (custom made). I registered a new route in the global.asax.cs file in order to display the username in the URL, which is working so far. UserList View <%: Html.RouteLink(user.UserName, "AdminPassword", new { controller="StoreManager", action="changeUserPassword", username = user.UserName }) %> Global.asax.cs routes.MapRoute( "AdminPassword", //Route name "{controller}/{action}/{username}", //URL with parameters new { controller = "StoreManager", action = "changeUserPassword", username = UrlParameter.Optional} ); So now the URL looks like this when I reach the changeUserPassword view: http://localhost:51236/StoreManager/changeUserPassword/Administrator Here is the GET changeUserPassword action: public ActionResult changeUserPassword(string username) { ViewData["username"] = username; return View(); } I wanted to store the username in ViewData as I would like to use it in the GET changeUserPassword for display purposes, and also as a hidden value in the form. This is in order to pass it through to enable me to reset the password. Having debugged through the code, it seems that 'username' is null. How can I get this to work so that the username carries over from the Html.RouteLink, to the changeUserPassword action? Any help would be appreciated :) Here is my complete code: UserList.aspx <%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<System.Web.Security.MembershipUserCollection>" %> <asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server"> UserList </asp:Content> <asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server"> <h2>UserList</h2> <table> <tr> <th>User Name</th> <th>Last Activity date</th> <th>Locked Out</th> </tr> <%foreach (MembershipUser user in Model){ %> <tr> <td><%: Html.RouteLink(user.UserName, "AdminPassword", new { controller="StoreManager", action="changeUserPassword", username = user.UserName }) %></td> <td><%: user.LastActivityDate %></td> <td><%: user.IsLockedOut %></td> </tr> <% }%> </table> </asp:Content> changeUserPassword.aspx <%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<musicStoreMVC.ViewModels.ResetPasswordAdmin>" %> <asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server"> changeUserPassword </asp:Content> <asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server"> <h2>Change Password: <%: ViewData["username"] %></h2> <% using (Html.BeginForm()) {%> <%: Html.ValidationSummary(true) %> <fieldset> <legend>Fields</legend> <div class="editor-label"> <%: Html.Hidden("username",ViewData["username"]) %> <%: Html.LabelFor(model => model.password) %> </div> <div class="editor-field"> <%: Html.TextBoxFor(model => model.password) %> <%: Html.ValidationMessageFor(model => model.password) %> </div> <div class="editor-label"> <%: Html.LabelFor(model => model.confirmPassword) %> </div> <div class="editor-field"> <%: Html.TextBoxFor(model => model.confirmPassword) %> <%: Html.ValidationMessageFor(model => model.confirmPassword) %> </div> <p> <input type="submit" value="Create" /> </p> </fieldset> <% } %> <div> <%: Html.ActionLink("Back to List", "Index") %> </div> </asp:Content> My actions public ActionResult UserList() { var users = Membership.GetAllUsers(); return View(users); } public ActionResult changeUserPassword(string username) { ViewData["username"] = username; return View(); }

    Read the article

  • Can I make controls defined in my markup public instead of protected

    - by RoboShop
    Say I have a web site with a master page and an aspx page. In my ASPX page, I am pointing to my masterpage with the MasterType tag. <%@ MasterType VirtualPath="~/mymasterpage.master" % Say, I've defined a label in the markup of my master page. If you look at the designer code, this label should be something like this. protected global::System.Web.UI.WebControls.Label label1; Now in my content page, I would like to reference this label. If I type in this "Master.label1", the complier will complain that the control is inaccessible due to the protection level" and rightly so, as label1 is automatically defined as "protected". My question is, if I define controls in my markup page, is it possible to set these controls as public instead of protected? I do not see an attribute for it. thanks in advance.

    Read the article

  • Where to start when programming process synchronization algorithms like clone/fork, semaphores

    - by David
    I am writing a program that simulates process synchronization. I am trying to implement the fork and semaphore techniques in C++, but am having trouble starting off. Do I just create a process and send it to fork from the very beginning? Is the program just going to be one infinite loop that goes back and forth between parent/child processes? And how do you create the idea of 'shared memory' in C++, explicit memory address or just some global variable? I just need to get the overall structure/idea of the flow of the program. Any references would be appreciated.

    Read the article

  • CUDA threads output different value

    - by kar
    HAi, I wrote a cuda program , i have given the kernel function below. The device memory is allocated through CUDAMalloc(); the value of *md is 10; __global__ void add(int *md) { int x,oper=2; x=threadIdx.x; * md = *md*oper; if(x==1) { *md = *md*0; } if(x==2) { *md = *md*10; } if(x==3) { *md = *md+1; } if(x==4) { *md = *md-1; } } executed the above code add<<<1,5>>(*md) , add<<<1,4>>>(*md) for <<<1,5>>> the output is 19 for <<<1,4>>> the output is 21 1) I have doubt that cudaMalloc() will allocate in device main memory? 2) Why the last thread alone is executed always in the above program? Thank you

    Read the article

  • Custom date time picker for Windows Forms that is locked to GMT time

    - by m3ntat
    Using Visual Studio 2008, c#, .net 2.0. I have a Windows Forms client application that contains a scheduling UI section, currently this is housed only in the London office with the standard datetime picker control, the selected time is saved in a UK database (GMT) and a London based server aapplication processes the schedules. There is a requirement to roll the client out to various global locations, Hong Kong, New York etc and allow them to setup schedules that run according to GMT time on the London server. I'll have a label on screen saying "note schedules are GMT" what I need is a good way to present a datetime picker that always shows and is in sync with the database server's GMT time regardless of where the client app is running globally. Suggestions on how to acheive this? thanks.

    Read the article

  • Using type aliases to Java enums

    - by oxbow_lakes
    I would like to achieve something similar to how scala defines Map as both a predefined type and object. In Predef: type Map[A, +B] = collection.immutable.Map[A, B] val Map = collection.immutable.Map //object Map However, I'd like to do this using Java enums (from a shared library). So for example, I'd have some global alias: type Country = my.bespoke.enum.Country val Country = my.bespok.enum.Country //compile error: "object Country is not a value" The reason for this is that I'd like to be able to use code like: if (city.getCountry == Country.UNITED_KINGDOM) //or... if (city.getCountry == UNITED_KINGDOM) Howver, this not possible whilst importing my type alias at the same time. Note: this code would work just fine if I had not declared a predefined type and imported it! Is there some syntax I can use here to achieve this?

    Read the article

  • Thread Proc for an instancable class?

    - by user146780
    Basically I have a class and it is instincable (not static). Basically I want the class to be able to generate its own threads and manage its own stuff. I don't want to make a global callback for each instance I make, this doesnt seem clean and proper to me. What is the proper way of doing what I want. If I try to pass the threadproc to CreateThread and it is the proc from a class instance the compiler says I cannot do this. What is the best way of achieving what I want? Thanks

    Read the article

  • Need to determine if ELMAH is logging an unhandled exception or one raised by ErrorSignal.Raise()

    - by Ronnie Overby
    I am using the Elmah Logged event in my Global.asax file to transfer users to a feedback form when an unhandled exception occurs. Sometimes I log other handled exceptions. For example: ErrorSignal.FromCurrentContext().Raise(new System.ApplicationException("Program code not found: " + Student.MostRecentApplication.ProgramCode)); // more code that should execute after logging this exception The problem I am having is that the Logged event gets fired for both unhandled and these handled, raised exceptions. Is there a way to determine, in the Logged event handler, whether the exception was raised via ErrorSignal class or was simply unhandled? Are there other Elmah events that I can take advantage of?

    Read the article

  • creating Contact in Active Director with Exchange

    - by Data-Base
    Hello, I made a VBS script that imports users and creates a Contact Objects everything working OK till I found that users does not appear in the GAL (Global Address List) looking around I found that I need to use the attribute (showInAddressBook) I tried to use it but I get some errors (Null ......) but my supplied inputs are not empty and I have a checking function before sending the inputs to showInAddressBook so what should I use in there? I used the users names, but it did not work also the users are externals (just to use them in our GAL) they have different emails than our normal users any idea on what should I use with showInAddressBook ? cheers

    Read the article

  • Using the Module Pattern for larger projects

    - by Rob
    I'm interested in using the Module Pattern to better organize my future projects. Unfortunately, there are only a few brief tutorials and proof-of-concept examples of the Module Pattern. Using the module pattern, I would like to organize projects into this sort of structure: project.arm.object.method(); Where "project" is my global project name, "arm" is a sub-section or branch of the project, "object" is an individual object, and so on to the methods and properties. However, I'm not sure how I should be declaring and organizing multiple "arms" and "objects" under "project". var project = window.project || {}; project.arm = project.arm || {}; project.arm.object = (function() { var privateVar = "Private contents."; function privateMethod() { alert(privateVar); } return { method: privateMethod }; }()); Are there any best practices or conventions when defining a complex module structure? Should I just declare a new arm/object underneath the last?

    Read the article

  • How do you change the style of cell in a JQuery.DataTable?

    - by Sephrial
    Hello fellow coders, I have a question about setting the style attributes for a data cell in the jQuery.DataTable. I was able to set the width for each column when initializing the dataTable using the following: oTable = $('#example').dataTable( { "aoColumns" : [ { sWidth: '40%' }, { sWidth: '60%' } ] } ); However, now I want to change the alignment for the second column like so: style="text-align: right;". I am adding rows dynamically: /* Global var for counter */ var giCount = 2; function fnClickAddRow() { oTable.fnAddData( [ 'col_1', 'col_2' ] ); giCount++; } Can you tell me how I can select the second cell of the added row after it's inserted? OR can you tell me how to set the style of the row before/during insertion? Any help would be greatly appreciated!

    Read the article

  • Call a macro every time any method is called - Objective C

    - by Jacob Relkin
    Hi, I wrote a debug macro that prints to the console the passed-in string whenever the global kDebug flag == YES. I need to print out the name of a method and it's classname whenever any method is called. That works fine when i painstakingly go through every method and write the name of the class and the method in a string. Is there any special handler that gets called when any method in Objective-C is called, and if so, is there a way i can somehow override it to call my debug macro?? The entire purpose of this is so that I don't have to go through every method in my code and hand-code the method signature in the debug macro call. Thanks

    Read the article

  • SoundPlayer causing Memory Leaks?

    - by Nick Udell
    I'm writing a basic writing app in C# and I wanted to have the program make typewriter sounds as you typed. I've hooked the KeyPress event on my RichTextBox to a function that uses a SoundPlayer to play a short wav file every time a key is pressed, however I've noticed after a while my computer slows to a crawl and checking my processes, audiodlg.exe was using 5 GIGABYTES of RAM. The code I'm using is as follows: I initialise the SoundPlayer as a global variable on program start with SoundPlayer sp = new SoundPlayer("typewriter.wav") Then on the KeyPress event I simply call sp.Play(); Does anybody know what's causing the heavy memory usage? The file is less than a second long, so it shouldn't be clogging the thing up too much.

    Read the article

  • Tips on refactoring existing .net applications to support localization?

    - by Lee Warner
    We're going global. I've been tasked with refactoring our existing products to support localization. Last week I shunned using resource files (.resx) in favor of a home-baked database look-up method. After hitting a serious snag with that, I'm back to the microsoft way of using resx. All the documentation I've seen so far details how to create new "World-Ready" applications, but I don't see anything on changing existing applications. Is my only recourse to touch the application form by form and control by control to have it point to newly created resource files? Any good sources/links for internationalizing your apps?

    Read the article

  • Showing a Toast using "setUncaughtExceptionHandler"

    - by VitalyB
    Hi everyone, I'm trying to do a simple global exception handler in my Android app and I am having troubles: public class TicTacToe extends Activity { /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Thread.currentThread().setUncaughtExceptionHandler(new UncaughtExceptionHandler() { @Override public void uncaughtException(Thread thread, Throwable ex) { Toast.makeText(this, "TOAST", Toast.LENGTH_LONG); } }); setContentView(R.layout.main); } } I'm a rather new with both Android AND java but in .NET that would work. Can't I access local variable from anonymous methods in java? If so, how should I rewrite it? Thanks, Vitaly

    Read the article

  • JSF : Better way to check for existence of <h:message for="id"/>

    - by user552809
    I have a form in which validation error message needs to be displayed below the input elements. The error needs to be highlighted by showing an error bubble around the error message and the input text. To achieve this, I need to check for the existence of h:messages for individual elements. I am able to check for the existence of global error messages as follows <h:panelGroup rendered="#{not empty facesContext.messages}"> </h:panelGroup> How I can check the same for specific client id (say first name). So something like faceContent.messages("creditCardNo") A solution I have currently is to create a custom resolver but was wondering if there is a better solution.

    Read the article

  • Performance Counters in Server Development

    - by Mubashar Ahmad
    Dear Gurus All you be agree with the value and worth of Performance Counters while developing and maintaining a server kind application I would like to know what is the best way to implement those, Specifically using C#? Usually performance counters have the following attributes They are shared global Writing requires locks to ensure Synchronization Reading Some times requires locks too. Is it better to update them Asynchronously and what is the best way to make them so. (I am planning to use the ThreadPool.QueuWorketItem function, pls tell me you opinion on this too.) If my question seems a bit vague can you just take the example of a HelloWorld Wcf service and i wanted to know following how many times its being hit overall and within a certain period Average/min/max Response Times overall and within a certain period. Moreover if any one knows about the Specialized way provided by DotNet or WCF then please let me know as well.

    Read the article

  • Log4Net and GAC - How to reference Configuraition Files?

    - by Adam
    Hello all I am using log4net during my development, as as part of a project constraint, I now need to add it to the Global Assembly Cache. The logging definitions are in a file Log4Net.xml. That file is referenced in my assemblyinfo as: [assembly: log4net.Config.XmlConfigurator(ConfigFile = "Log4Net.xml", Watch = true)]. So long as the xml file was in the same directory as the log4net.dll, everything has been working fine. However now that I've added log4net to the GAC, it is no longer picking up the xml file. Does anyone know what I need to change in order to have it pick up the XML file again? Is hardcoding the patch in the assembly reference the only way? Many thanks

    Read the article

  • Xcode: code loses syntax coloring

    - by ColorMeFamous
    I find that in various situations Objective-C code in Xcode 3.1 (Leopard) can fail to get appropriate syntax coloring after typing or lose coloring that it had. This isn't just a "refresh" issue with new custom symbols -- but affects Cocoa framework symbols as well. Sometimes CMD-a to select all text on the code page will make the coloring (re)appear, sometimes double-clicking on a line to select it will work, sometimes I have to add/delete a space in a symbol to get that symbol to (re)color. Rebuilding, or closing/reopening the project may or may not work. Is this a known issue with Xcode? For something so annoying to me, I'm not finding the plentiful discussions of it on SO and elsewhere I'd expect. And is there any command to force global syntax recoloring?

    Read the article

  • NHibernate: uninitialized proxy passed to save() and cascade

    - by jonnii
    Hi, I keep getting an NHibernate.PersistentObjectException when calling session.Save() which is due to an uninitialized proxy passed to save(). If I fiddle with my cascade settings I can make it go away, but then child objects aren't being saved. The only other fix I have found is by adding the following to my DefaultSaveEventListener. protected override bool ReassociateIfUninitializedProxy(object obj, global::NHibernate.Engine.ISessionImplementor source) { if (!NHibernateUtil.IsInitialized(obj)) NHibernateUtil.Initialize(obj); return base.ReassociateIfUninitializedProxy(obj, source); } This is obviously not an ideal solution. Any ideas?

    Read the article

  • Defining a dd/mm/yyyy field within an abstract table model

    - by Simon Andi
    I have defined an abstract table model but one of the columns should house date values as dd/mm/yyyy format not sure how to do this. I have a external global file and have hard coded the dates as dd/mm/yyyy. How can I define this column within my abstract table model so that to only allow only dates having dd/mm/yyyy format. public class OptraderGlobalParameters { public static boolean DEBUG = true; //Set DEBUG = true for Debugging /*=========================*/ /*Table Array For Dividends*/ /*=========================*/ public static String[] columnNames = {"Date", "Dividend", "Actual", "Yield (%)" }; public static Object[][] data = { {"dd/mm/yyyy", new Double(5), new Boolean(false), new Boolean(false)}, {"dd/mm/yyyy", new Double(5), new Boolean(false), new Boolean(false)}, {"dd/mm/yyyy", new Double(5), new Boolean(false), new Boolean(false)}, {"dd/mm/yyyy", new Double(5), new Boolean(false), new Boolean(false)}, {"dd/mm/yyyy", new Double(5), new Boolean(false), new Boolean(false)}, }; }

    Read the article

  • Globbing with MinGW on Windows

    - by Neil Butterworth
    I have an application built with the MinGW C++ compiler that works something like grep - acommand looks something like this: myapp -e '.*' *.txt where the thing that comes after the -e switch is a regex, and the thing after that is file name pattern. It seems that MinGW automatically expands (globs in UNIX terms) the command line so my regex gets mangled. I can turn this behaviour off, I discovered, by setting the global variable _CRT_glob to zero. This will be fine for bash and other sensible shell users, as the shell will expand the file pattern. For MS cmd.exe users however, it looks like I will have to expand the file pattern myself. So my question - does anyone know of a globbing library (or facility in MinGW) to do partial command line expansion? I'm aware of the _setargv feature of the Windows CRT, but that expands the full command line. Please note I've seen this question, but it really does not address partial expansion.

    Read the article

  • Dynamic scoping in Clojure?

    - by j-g-faustus
    Hi, I'm looking for an idiomatic way to get dynamically scoped variables in Clojure (or a similar effect) for use in templates and such. Here is an example problem using a lookup table to translate tag attributes from some non-HTML format to HTML, where the table needs access to a set of variables supplied from elsewhere: (def *attr-table* ; Key: [attr-key tag-name] or [boolean-function] ; Value: [attr-key attr-value] (empty array to ignore) ; Context: Variables "tagname", "akey", "aval" '( ; translate :LINK attribute in <a> to :href [:LINK "a"] [:href aval] ; translate :LINK attribute in <img> to :src [:LINK "img"] [:src aval] ; throw exception if :LINK attribute in any other tag [:LINK] (throw (RuntimeException. (str "No match for " tagname))) ; ... more rules ; ignore string keys, used for internal bookkeeping [(string? akey)] [] )) ; ignore I want to be able to evaluate the rules (left hand side) as well as the result (right hand side), and need some way to put the variables in scope at the location where the table is evaluated. I also want to keep the lookup and evaluation logic independent of any particular table or set of variables. I suppose there are similar issues involved in templates (for example for dynamic HTML), where you don't want to rewrite the template processing logic every time someone puts a new variable in a template. Here is one approach using global variables and bindings. I have included some logic for the table lookup: ;; Generic code, works with any table on the same format. (defn rule-match? [rule-val test-val] "true if a single rule matches a single argument value" (cond (not (coll? rule-val)) (= rule-val test-val) ; plain value (list? rule-val) (eval rule-val) ; function call :else false )) (defn rule-lookup [test-val rule-table] "looks up rule match for test-val. Returns result or nil." (loop [rules (partition 2 rule-table)] (when-not (empty? rules) (let [[select result] (first rules)] (if (every? #(boolean %) (map rule-match? select test-val)) (eval result) ; evaluate and return result (recur (rest rules)) ))))) ;; Code specific to *attr-table* (def tagname) ; need these globals for the binding in html-attr (def akey) (def aval) (defn html-attr [tagname h-attr] "converts to html attributes" (apply hash-map (flatten (map (fn [[k v :as kv]] (binding [tagname tagname akey k aval v] (or (rule-lookup [k tagname] *attr-table*) kv))) h-attr )))) (defn test-attr [] "test conversion" (prn "a" (html-attr "a" {:LINK "www.google.com" "internal" 42 :title "A link" })) (prn "img" (html-attr "img" {:LINK "logo.png" }))) user=> (test-attr) "a" {:href "www.google.com", :title "A link"} "img" {:src "logo.png"} This is nice in that the lookup logic is independent of the table, so it can be reused with other tables and different variables. (Plus of course that the general table approach is about a quarter of the size of the code I had when I did the translations "by hand" in a giant cond.) It is not so nice in that I need to declare every variable as a global for the binding to work. Here is another approach using a "semi-macro", a function with a syntax-quoted return value, that doesn't need globals: (defn attr-table [tagname akey aval] `( [:LINK "a"] [:href ~aval] [:LINK "img"] [:src ~aval] [:LINK] (throw (RuntimeException. (str "No match for " tagname))) ; ... more rules [(string? ~akey)] [] ))) Only a couple of changes are needed to the rest of the code: In rule-match?, when syntax-quoted the function call is no longer a list: - (list? rule-val) (eval rule-val) + (seq? rule-val) (eval rule-val) In html-attr: - (binding [tagname tagname akey k aval v] - (or (rule-lookup [k tagname] *attr-table*) kv))) + (or (rule-lookup [k tagname] (attr-table tagname k v)) kv))) And we get the same result without globals. (And without dynamic scoping.) Are there other alternatives to pass along sets of variable bindings declared elsewhere, without the globals required by Clojure's binding? Is there an idiomatic way of doing it, like Ruby's binding or Javascript's function.apply(context)?

    Read the article

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