Search Results

Search found 2521 results on 101 pages for 'typed constants'.

Page 14/101 | < Previous Page | 10 11 12 13 14 15 16 17 18 19 20 21  | Next Page >

  • How do you preserve the viewstate while using strongly typed views in asp MVC 2?

    - by Mark Kadlec
    I have an ActionResult returning from a strongly typed view where I manually validate some conditions, pass in an error message, but would like to preserve the users responses. Since my View is strongly typed, I am calling it like this: return View("PrincipalInvestigatorForm", new SmartFormViewModel(sections, questions)); My problem though, is that the error message is displayed but all the users data is wiped. How do I preserve the "ViewState" in MVC? Is there an easy way?

    Read the article

  • Java regex patterns - compile time constants or instance members?

    - by KepaniHaole
    Currently, I have a couple of singleton objects where I'm doing matching on regular expressions, and my Patterns are defined like so: class Foobar { private final Pattern firstPattern = Pattern.compile("some regex"); private final Pattern secondPattern = Pattern.compile("some other regex"); // more Patterns, etc. private Foobar() {} public static Foobar create() { /* singleton stuff */ } } But I was told by someone the other day that this is bad style, and Patterns should always be defined at the class level, and look something like this instead: class Foobar { private static final Pattern FIRST_PATTERN = Pattern.compile("some regex"); private static final Pattern SECOND_PATTERN = Pattern.compile("some other regex"); // more Patterns, etc. private Foobar() {} public static Foobar create() { /* singleton stuff */ } } The lifetime of this particular object isn't that long, and my main reason for using the first approach is because it doesn't make sense to me to hold on to the Patterns once the object gets GC'd. Any suggestions / thoughts?

    Read the article

  • Capture text typed by user on website and allow user to email a link to someone else so that they can view the message [on hold]

    - by Dano007
    Using the following html, css,jquery, js, what would be the best approach to achieving this. A visitor hits the website. The website page is displaying html and a css3 animation. The visitor is given the option to enter text freely into a text box, they enter an email address and hit send. The person receiving the message gets an email with a link, when they click the link it takes them to the webpage with the animation and the custom message their friend entered. Is this easy to achieve, what would be the best approach? anyone know of existing code I could use? Thanks

    Read the article

  • Where can I define Conditional compilation constants for Delphi Prism?

    - by Martijn
    I've just ported a Web service from Delphi.NET 2006 to Delphi Prism 2009 (running in the Visual Studio 2008 IDE). But I can't find where I'm supposed to set (or unset) the conditional compilation constants! Am I blind, has this option been left out, or is it just not supported in VS? [edit: thanks to Mohammed Nasman for the link] MSDN tells me to set them using the Project Designer. First, it took me a while to figure out that the Project menu is only visible when the Solution is selected (and not the web service project). Then, there's still no way to set conditional compilation constants in the Project Designer! I just can't find a way to get to the Project Options in an ASP.NET project... Is it really not possible?

    Read the article

  • static constants return instance of specific class in Flex?

    - by Sang
    So here's what I mean. Let's say I have a class ErrorMessages which holds all my error messages as static constants. So I could access them like ErrorMessages.PASSWORD_INVALID or ErrorMessage.PASSWORD_TOO_SHORT. I want to know if it is possible to have separate classes that hold subset of these constants and access them like ErrorMessages.PASSWORD.INVALID or ErrorMessages.PASSWORD.TOO_SHORT, etc. This way I can more structured static structure and makes it much easier to use autocomplete. I tried few different ways and couldn't figure out if this was possible..

    Read the article

  • Improving WIF&rsquo;s Claims-based Authorization - Part 3 (Usage)

    - by Your DisplayName here!
    In the previous posts I showed off some of the additions I made to WIF’s authorization infrastructure. I now want to show some samples how I actually use these extensions. The following code snippets are from Thinktecture.IdentityServer on Codeplex. The following shows the MVC attribute on the WS-Federation controller: [ClaimsAuthorize(Constants.Actions.Issue, Constants.Resources.WSFederation)] public class WSFederationController : Controller or… [ClaimsAuthorize(Constants.Actions.Administration, Constants.Resources.RelyingParty)] public class RelyingPartiesAdminController : Controller In other places I used the imperative approach (e.g. the WRAP endpoint): if (!ClaimsAuthorize.CheckAccess(principal, Constants.Actions.Issue, Constants.Resources.WRAP)) {     Tracing.Error("User not authorized");     return new UnauthorizedResult("WRAP", true); } For the WCF WS-Trust endpoints I decided to use the per-request approach since the SOAP actions are well defined here. The corresponding authorization manager roughly looks like this: public class AuthorizationManager : ClaimsAuthorizationManager {     public override bool CheckAccess(AuthorizationContext context)     {         var action = context.Action.First();         var id = context.Principal.Identities.First();         // if application authorization request         if (action.ClaimType.Equals(ClaimsAuthorize.ActionType))         {             return AuthorizeCore(action, context.Resource, context.Principal.Identity as IClaimsIdentity);         }         // if ws-trust issue request         if (action.Value.Equals(WSTrust13Constants.Actions.Issue))         {             return AuthorizeTokenIssuance(new Collection<Claim> { new Claim(ClaimsAuthorize.ResourceType, Constants.Resources.WSTrust) }, id);         }         return base.CheckAccess(context);     } } You see that it is really easy now to distinguish between per-request and application authorization which makes the overall design much easier. HTH

    Read the article

  • Netlogo: error when putting variable in table, only constants allowe??

    - by Chantal
    Hello, Currently I am working on a Netlogo program where I need to use nodes and links for vehicle routing problem. (links are called streets in the program) Here I have some practical problems of how to input variable linkspeed in a table with another node. Constants like 200 etc are fine. Online I found some examples where variables are used, but I do not know why I keep getting the following error: Expected a constant. (or why netlogo expects a constant) Here is the relevant piece of code: extensions [table] streets-own [linkspeed linktoll] nodes-own [netw] ;; In another piece of code linkspeed is assigned successfully to the links to cheapcalc ;; start conditions set costs very high 300000 ;; state 3 unsearched state 2 searching state 1 searched (for later purposes) ask nodes [ set i 0 set j count nodes set netw table:make while [i < j][ table:put netw (i) [3000000 3] set i (i + 1)]] set i 0 let k 0 ask node 35 ;; here i use node 35 as an example. ;; node 35 is connected to node 34, 36, 20 and 50 [table:put netw (35) [0 1] ;; node need to search costs to travel to itself ;; putting constants is ok. while [i < j] [ask my-links [ask both-ends [if (who != 35) [set color blue ;; set temp ([linkspeed] of street 35 who) ;; here my real goal is to put this in stat of i. but i is easier than linkspeed. table:put netw (who) [ i 2 ] ] ] ] set i (i + 1)] ] ;; next node for later, no it is just repetition of the same. end I hope somebody knows what is going on... Kind regards, Chantal

    Read the article

  • when i merge a data table with a typed dataset, one single field on a single row is DBNull sometimes

    - by benj007
    Hi everybody, I have a strange problem sometimes when I try to merge a data table with a typed dataset my data table is filled in with a stored procedure and when I checked the content of this table it is ok, everything is in there straight after I merge it with my core typed dataset like this : MyTypedDataSet.TheTable.Clear(); MyTypedDataSet.TheTable.Merge(MyDataTable); and now if i check the table in the dataset everything is ok except only one single field on one single row which is DBNull, that makes no sense because the source data table contains the good integer vaue. Thanks a lot in advance guys :)

    Read the article

  • iPhone SDK: How to store the time each word was typed?

    - by Harkonian
    My problem is twofold: 1) I'm trying to determine an eloquent way to allow the user to type into a UITextView and store the time each word was typed into an array. The time will be a float which starts at 0 when the user begins to type. 2) Conversely, I'd like the user to be able to tap on a word in the UITextView and display the time that word was typed (displaying in an NSLog() is fine). Considerations that may throw a wrench into a possible approach -- what if the user goes back to the top of the text and starts typing or to the middle of the text? Even a suggested approach without code would be appreciated, because right now I'm drawing a blank.

    Read the article

  • Typed DataSet connection - required to have one in the .xsd file?

    - by Kyralessa
    In the .xsd file for a typed DataSet in .NET, there's a <Connections> section that contains a list of any data connections I've used to set up the DataTables and TableAdapters. There are times when I'd prefer not to have those there. For instance, sometimes I prefer to pass in a connection string to a custom constructor and use that rather than look for one in settings, .config, etc. But it seems like if I remove the connection strings from that section (leaving it empty), or remove the section entirely, the DataSet code-generation tool freaks out. Whereas if I don't remove them, the DataSet gripes when I put it in a different project because it can't find the settings for those connection strings. Is there any way I can tell a typed DataSet not to worry about any connections? (Obviously I'll have to give it a connection if I change any TableAdapter SQL or stored procs, but that should be my problem.)

    Read the article

  • What is a modern C++ approach to structures containing symbolic constants?

    - by Ken
    enum bool { FALSE = 0, TRUE = 1 }; I'm wondering how to translate this in a modern C++ approach and if there is a well suited container for that; i know that the enum are not really that appreciated, but i can't think about a real alternative in the C++ world. What if would like to associate the execution of a particular method with a state? Ok, this is the part where i will be more verbose. I would like to stress the fact that i'm asking about structures symbolic constants and not about TRUE and FALSE, i'm not that "needy". Suppose that i have a structure that can represent several states with their own constants enum semaphore { GREEN = 0, ORANGE = 1, RED = 2 }; this is C code, now my question is about how to do the same in C++ if there is a better way. My question continue when i ask about the possibility to do something like an automatic triggering when a change of state will occur, for example: int main{ ... semaphore = 1; ... } and without any extra statements this has to trigger a method() just because the semaphore is now orange. I hope that is more clear now.

    Read the article

  • integer Max value constants in SQL Server T-SQL?

    - by AaronLS
    Are there any constants in T-SQL like there are in some other languages that provide the max and min values ranges of data types such as int? I have a code table where each row has an upper and lower range column, and I need an entry that represents a range where the upper range is the maximum value an int can hold(sort of like a hackish infinity). I would prefer not to hard code it and instead use something like SET UpperRange = int.Max

    Read the article

  • VSTS 2008 Database Edition doesn't seem to know 'DATEADD' constants, any ideas?

    - by Marcel Marchon
    I'm trying to implement a database build using VSTS 2008 Database Edition. The build always fails on the following constraint: ALTER TABLE [dbo].[tablename] ADD CONSTRAINT [DF_tablename_date] DEFAULT (CONVERT([varchar],dateadd(hour,(-1),getdate()),(1))) FOR [date]; The error that it shows is the following: TSD03082: The name "hour" is not permitted in this context. Valid expressions are constants, constant expressions, and (in some contexts) variables. Column names are not permitted. Anybody have an idea what is wrong here?

    Read the article

  • Performance of String literals vs constants for Session[...] dictionary keys

    - by FreshCode
    Session[Constant] vs Session["String Literal"] Performance I'm retrieving user-specific data like ViewData["CartItems"] = Session["CartItems"]; with a string literal for keys on every request. Should I be using constants for this? If yes, how should I go about implementing frequently used string literals and will it significantly affect performance on a high-traffic site? Related question does not address ASP.NET MVC or Session.

    Read the article

  • Delphi plugin for pasting text constants in source code?

    - by mjn
    Inserting (pasting from clipboard) of text constants in the Delphi code editor requires some manual "postprocessing" ... split up long text into multiple lines (and insert the string concatenation symbol) escape quotes (replace single quotes with double quotes) enclose the string with quotes keep original white space (leadinng blanks, line feeds) Is there a IDE plugin available which helps to reduce these manual steps?

    Read the article

  • Why are member constants available even if there are no instances of a its class?

    - by flockofcode
    1) Why are member constants available even if there are no instances of a its class? 2) Is the only reason why constant expressions need to be fully evaluated at compile time due to compiler replacing constant variable with literal value? 3) Since string is also an object, I would think the following would produce an error, but it doesn’t. Why? class A { const string b = “it works”; } thank you

    Read the article

  • ASP.NET MVC 2 - How do I use an Interface as the Type for a Strongly Typed View

    - by Rake36
    I'd like to keep my concrete classes separate from my views. Without using strongly typed views, I'm fine. I just use a big parameter list in the controller method signatures and then use my service layer factory methods to create my concrete objects. This is actually just fine with me, but it got me thinking and after a little playing, I realized it was literally impossible for a controller method to accept an interface as a method parameter - because it has no way of instantiating it. Can't create a strongly-typed view using an interface through the IDE either (which makes sense actually). So my question. Is there some way to tell the controller how to instantiate the interface parameter using my service layer factory methods? I'd like to convert from: [Authorize] [AcceptVerbs(HttpVerbs.Post)] [UrlRoute(Path = "Application/Edit/{id}")] public ActionResult Edit(String id, String TypeCode, String TimeCode, String[] SelectedSchoolSystems, String PositionChoice1, String PositionChoice2, String PositionChoice3, String Reason, String LocationPreference, String AvailableDate, String RecipientsNotSelected, String RecipientsSelected) { //New blank app IApplication _application = ApplicationService.GetById(id); to something like [Authorize] [AcceptVerbs(HttpVerbs.Post)] [UrlRoute(Path = "Application/Edit/{id}")] public ActionResult Edit(String id, IApplication app) { //Don't need to do this anymore //IApplication _application = ApplicationService.GetById(id);

    Read the article

< Previous Page | 10 11 12 13 14 15 16 17 18 19 20 21  | Next Page >