Search Results

Search found 48 results on 2 pages for 'autogenerate'.

Page 1/2 | 1 2  | Next Page >

  • Hibernate won't autogenerate sequence table

    - by Jason
    I'm trying to use a sequence table to generate keys for my entities. I notice that if I just use the @GeneratedValue(strategy=GenerationType.TABLE) with no explicit generator, Hibernate will automatically create the hibernate_sequences table in my DB if it doesn't exist. This is great. However, I wanted to make some changes to the sequence table, so I created a @TableGenerator like the following: @GeneratedValue(strategy=GenerationType.TABLE, generator="vdat_seq") @TableGenerator(name="vdat_seq", table="VDAT_SEQ", pkColumnName="seq_name", valueColumnName="seq_next_val", allocationSize=1) This works fine if I manually create the VDAT_SEQ table in my schema; Hibernate won't auto-create it anymore. This causes an issue in my unit tests, since I'd rather not have to manually create a table and maintain it on our testing DB. Is there a configuration variable or some other way to get Hibernate to generate the sequence table?

    Read the article

  • [rails] do we need database level constraints

    - by shrimpy
    i have the same problem as in the following post http://stackoverflow.com/questions/1451570/ruby-on-rails-database-migration-not-creating-foreign-keys-in-mysql-tables so i am wondering, why rails do not support generate foreign key by default??? it is not necessary??? or we suppose to do it manually?

    Read the article

  • JQuery Checkbox generation

    - by Hash
    I have used the following code to generate some dynamic checkboxes. This works for the first time and adds the check box chk2 to the page and then after the trigger for the $('#newLink').click is not working. Please help me with this. <div id="chkBoxesDiv"> <input type="checkbox" id="chk1" ></input> <input id="answerText" type="text" size="30" ></input>&nbsp; <input type="button" value="add new" id="newLink"/> </div> $(document).ready(function(){ $('#newLink').click(function (event){ var i = 0; //To count the children $("#chkBoxesDiv").children().each(function(){ var child = $(this); if(child.is(":checkbox")){ i++; } }); //prevent action event.preventDefault(); //get textbox value to fill checkbox var text = $("#answerText").val(); alert(i); //if text not empty do stuff if(text != ""){ //add label $("#chk"+i).after("<label for=\"chk"+i+"\" id=\"lblchk"+i+"\">"+text+"</label>"); $("#newLink").remove(); $("#answerText").remove(); $("#lblchk1").after("<br /><input type=\"checkbox\" id=\"chk"+(1+i)+"\" ></input><input type=\"text\" id=\"answerText\" size=\"30\" ></input>&nbsp;<input type=\"button\" value=\"add new\" id=\"newLink\"/>"); } }); });

    Read the article

  • Why I sould not develop an opensource runtime UI Autogeneration from domain objects?

    - by Marco Bettiolo
    I'm using for my projects a rather complete UI auto-generation tool from database entities for windows forms and asp.net I wrote. Now I've built a working prototype UI auto-generation tool from domain objects. Right now it is in early stage of development and by reflection it generates user interface for creating and updating domain objects. I searched a bit and I didn't find other opensource projects that have the same goal. Why? This type of tool is not useful? Is this idea fundamentally flawed? Thanks.

    Read the article

  • Silverlight 4 Overriding the DataForm Autogenerate to insert Combo Boxes bound to Converters.

    - by kmacmahon
    I've been working towards a solution for some time and could use a little help. I know I've seen an example of this before, but tonight I cannot find anything close to what I need. I have a service that provides me all my DropDownLists, either from Cache or from the DomainService. They are presented as IEnumerable, and are requested from the a repository with GetLookup(LookupId). I have created a custom attribute that I have decorated my MetaDataClass that looks something like this: [Lookup(Lookup.Products)] public Guid ProductId I have created a custom Data Form that is set to AutoGenerateFields and I am intercepting the autogenerate fields. I am checking for my CustomAttribute and that works. Given this code in my CustomDataForm (standard comments removed for brevity), what is the next step to override the field generation and place a bound combobox in its place? public class CustomDataForm : DataForm { private Dictionary<string, DataField> fields = new Dictionary<string, DataField>(); public Dictionary<string, DataField> Fields { get { return this.fields; } } protected override void OnAutoGeneratingField(DataFormAutoGeneratingFieldEventArgs e) { PropertyInfo propertyInfo = this.CurrentItem.GetType().GetProperty(e.PropertyName); foreach (Attribute attribute in propertyInfo.GetCustomAttributes(true)) { LookupFieldAttribute lookupFieldAttribute = attribute as LookupFieldAttribute; if (lookupFieldAttribute != null) { // Create a combo box. // Bind it to my Lookup IEnumerable // Set the selected item to my Field's Value // Set the binding two way } } this.fields[e.PropertyName] = e.Field; base.OnAutoGeneratingField(e); } } Any cited working examples for SL4/VS2010 would be appreciated. Thanks

    Read the article

  • Can I autogenerate/compile code on-the-fly, at runtime, based upon values (like key/value pairs) parsed out of a configuration file?

    - by Kumba
    This might be a doozy for some. I'm not sure if it's even 100% implementable, but I wanted to throw the idea out there to see if I'm really off of my rocker yet. I have a set of classes that mimics enums (see my other questions for specific details/examples). For 90% of my project, I can compile everything in at design time. But the remaining 10% is going to need to be editable w/o re-compiling the project in VS 2010. This remaining 10% will be based on a templated version of my Enums class, but will generate code at runtime, based upon data values sourced in from external configuration files. To keep this question small, see this SO question for an idea of what my Enums class looks like. The templated fields, per that question, will be the MaxEnums Int32, Names String() array, and Values array, plus each shared implementation of the Enums sub-class (which themselves, represent the Enums that I use elsewhere in my code). I'd ideally like to parse values from a simple text file (INI-style) of key/value pairs: [Section1] Enum1=enum_one Enum2=enum_two Enum3=enum_three So that the following code would be generated (and compiled) at runtime (comments/supporting code stripped to reduce question size): Friend Shared ReadOnly MaxEnums As Int32 = 3 Private Shared ReadOnly _Names As String() = New String() _ {"enum_one", "enum_two", "enum_three"} Friend Shared ReadOnly Enum1 As New Enums(_Names(0), 1) Friend Shared ReadOnly Enum2 As New Enums(_Names(1), 2) Friend Shared ReadOnly Enum3 As New Enums(_Names(2), 4) Friend Shared ReadOnly Values As Enums() = New Enums() _ {Enum1, Enum2, Enum3} I'm certain this would need to be generated in MSIL code, and I know from reading that the two components to look at are CodeDom and Reflection.Emit, but I was wondering if anyone had working examples (or pointers to working examples) versus really long articles. I'm a hands-on learner, so I have to have example code to play with. Thanks!

    Read the article

  • All websites migrated from server running IIS6 to IIS7

    - by Leah
    Hi, I hope someone will be able to help me with this. We have recently migrated all of our clients' sites to a new server running IIS7 - all the sites were originally running on a server running IIS6. Ever since the migration, lots of our clients are reporting error messages. There seems to be quite a number of issues related to sending emails and also, we have had the following error message reported by several different clients: Server Error in '/' Application. -------------------------------------------------------------------------------- Validation of viewstate MAC failed. If this application is hosted by a Web Farm or cluster, ensure that <machineKey> configuration specifies the same validationKey and validation algorithm. AutoGenerate cannot be used in a cluster. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.Web.HttpException: Validation of viewstate MAC failed. If this application is hosted by a Web Farm or cluster, ensure that <machineKey> configuration specifies the same validationKey and validation algorithm. AutoGenerate cannot be used in a cluster. I have read elsewhere that this error can appear if a button is clicked before the whole page has finished loading. But as this error has now appeared on multiple sites and only since the server migration, it seems to me that it must be something else. I was wondering if someone could tell me if there is something specific which needs to be changed for .NET sites when sites are moved from a server running IIS6 to a server running IIS7? I don't deal with the actual servers very much so I'm afraid this is very much a grey area for me. Any help would be very much appreciated.

    Read the article

  • How to form submit and show a different page in ASP.Net MVC?

    - by melaos
    hi guys i'm new to asp.net mvc.. so basically i just build up a two page app which takes the registration information of the user and post it to the database. i use a lot of jquery and ajax calls to retrieve data from the database using linq to sql stored proc object. and currently i'm stuck at one page where after the user submits the form it should redirect him to /Home/AddProduct. What i found was the error: Validation of viewstate MAC failed. If this application is hosted by a Web Farm or cluster, ensure that <machineKey> configuration specifies the same validationKey and validation algorithm. AutoGenerate cannot be used in a cluster. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.Web.HttpException: Validation of viewstate MAC failed. If this application is hosted by a Web Farm or cluster, ensure that <machineKey> configuration specifies the same validationKey and validation algorithm. AutoGenerate cannot be used in a cluster. what used on my form are basically a combination of html controls, asp.net controls and some asp.net mvc type controls. i submit the form using action="/Home/ProductAdded" and after doing some googling i found i was supposed to add in the machine key but after doing so, the index page becomes unviewable. because it couldn't find the index file now. removing the action helps, but now it just doesn't go anywhere. so what am i missing here? i feel i'm missing a lot of fundamentals understanding about asp.net mvc and i don't even know how to submit a form and go to a different page here!!

    Read the article

  • Validation of viewstate MAC failed with nested master page

    - by just_name
    After I use a nested master page ,I face the following problem : Validation of viewstate MAC failed. If this application is hosted by a Web Farm or cluster, ensure that configuration specifies the same validationKey and validation algorithm. AutoGenerate cannot be used in a cluster. and sometimes Invalid related information [ViewStateException: Invalid viewstate. Client IP: 127.0.0.1 Port: User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:17.0) Gecko/20100101 Firefox/17.0 ViewState: /wEPDwULLTEzOTY5MjA1ODUPZBYCZg9kFgICAw9kFg4CAQ9kFgJmDxYCHgRocmVmBUZmcm1faXRlbXMyLmFzcHg/c3lzPURGJmdycD0xJmRiPTUmZW1wPTc1NCZmaXJzdFJlcXVlc3Q9dHJ1ZSZMaXN0VHlwZT0xFgICAQ8PFgIeBFRleHQFATFkZAIDDxYCHgVjbGFzcwUGYWN0aXZlFgJmDxYCHwAFRmZybV9pdGVtczIuYXNweD9zeXM9REYmZ3JwPTEmZGI9NSZlbXA9NzU0JmZpcnN0UmVxdWVzdD10cnVlJkxpc3RUeXBlPTIWAgIBDw8WAh8BBQI3OGRkAgUPZBYCZg8WAh8ABUZmcm1faXRlbXMyLmFzcHg/c3lzPURGJmdycD0xJmRiPTUmZW1wPTc1NCZmaXJzdFJlcXVlc3Q9dHJ1ZSZMaXN0VHlwZT0zFgICAQ8PFgIfAQUDODY0ZGQCBw9kFgJmDxYCHwAFRmZybV9pdGVtczIuYXNweD9zeXM9REYmZ3JwPTEmZGI9NSZlbXA9NzU0JmZpcnN0UmVxdWVzdD10cnVlJkxpc3RUeXBlPTQWAgIBDw8WAh8BBQEwZGQCCQ9kFgJmDxYCHwAFP2ZybV9Vc2VyVGFza3MyLmFzcHg/c3lzPURGJmdycD0xJmRiPTUmZW1wPTc1NCZmaXJzdFJlcXVlc3Q9dHJ1ZWQCCw9kFgJmDxYCHwAFN1NlYXJjaC5hc3B4P3N5cz1ERiZncnA9MSZkYj01JmVtcD03NTQmZmlyc3RSZXF1ZXN0PXRydWVkAg8PZBYMAgQPEA8WBh4ORGF0YVZhbHVlRmllbGQFCFRhc2tDb2RlHg1EYXRhVGV4dEZpZWxkBQhUYXNrTmFt...] [HttpException (0x80004005): Validation of viewstate MAC failed. If this application is hosted by a Web Farm or cluster, ensure that <machineKey> configuration specifies the same validationKey and validation algorithm. AutoGenerate cannot be used in a cluster.] System.Web.UI.ViewStateException.ThrowError(Exception inner, String persistedState, String errorPageMessage, Boolean macValidationError) +116 System.Web.UI.ViewStateException.ThrowMacValidationError(Exception inner, String persistedState) +13 System.Web.UI.ObjectStateFormatter.Deserialize(String inputString) +220 System.Web.UI.ObjectStateFormatter.System.Web.UI.IStateFormatter.Deserialize(String serializedState) +5 System.Web.UI.Util.DeserializeWithAssert(IStateFormatter formatter, String serializedState) +37 System.Web.UI.HiddenFieldPageStatePersister.Load() +202 System.Web.UI.Page.LoadPageStateFromPersistenceMedium() +106 System.Web.UI.Page.LoadAllState() +43 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3905 System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +262 System.Web.UI.Page.ProcessRequest() +79 System.Web.UI.Page.ProcessRequestWithNoAssert(HttpContext context) +21 System.Web.UI.Page.ProcessRequest(HttpContext context) +109 ASP.frm_items2_aspx.ProcessRequest(HttpContext context) in c:\Windows\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root\a961040e\19f53d4c\App_Web_frm_items2.aspx.cdcab7d2.nkfrbsfi.0.cs:0 System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +399 System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +76 I use this Tool to fix this problem but in vain !! I don't know even the root cause of this problem !!

    Read the article

  • Add Machine Key to machine.config in Load Balancing environment to multiple versions of .net framework

    - by davidb
    I have two web servers behind a F5 load balancer. Each web server has identical applications to the other. There was no issue until the config of the load balancer changed from source address persistence to least connections. Now in some applications I receieve this error Server Error in '/' Application. Validation of viewstate MAC failed. If this application is hosted by a Web Farm or cluster, ensure that configuration specifies the same validationKey and validation algorithm. AutoGenerate cannot be used in a cluster. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.Web.HttpException: Validation of viewstate MAC failed. If this application is hosted by a Web Farm or cluster, ensure that configuration specifies the same validationKey and validation algorithm. AutoGenerate cannot be used in a cluster. Source Error: The source code that generated this unhandled exception can only be shown when compiled in debug mode. To enable this, please follow one of the below steps, then request the URL: Add a "Debug=true" directive at the top of the file that generated the error. Example: or: 2) Add the following section to the configuration file of your application: Note that this second technique will cause all files within a given application to be compiled in debug mode. The first technique will cause only that particular file to be compiled in debug mode. Important: Running applications in debug mode does incur a memory/performance overhead. You should make sure that an application has debugging disabled before deploying into production scenario. How do I add a machine key to the machine.config file? Do I do it at server level in IIS or at website/application level for each site? Does the validation and decryption keys have to be the same across both web servers or are they different? Should they be different for each machine.config version of .net? I cannot find any documentation of this scenario.

    Read the article

  • C# WPF fill datagrid or listview from XML file

    - by Dave
    I have a well formed XML file I would like to fill a datagrid with. I would prefer using the AutoGenerate feature of WFPToolKit datagrid, but could hard code the columns in. The trouble I am having is getting the xml file contents into a datagrid. I had it partially working in a listview, but think a datagrid would be more suited for my needs. Can anyone provide a quick example of how to accomplish this? Thanks!

    Read the article

  • Automed CSSSprites -- csssprites.org

    - by Kerry
    If this is a question that shouldn't be on SO, please let me know. Has anyone tried the website: http://csssprites.org/ To autogenerate and use CSS Sprites? What are your thoughts? I'm thinking about implementing (constantly looking for new ways to improve performance)

    Read the article

  • Why does Visual Studio sometimes add a number when creating page events in codebehinds?

    - by Kevin Pang
    When writing up a codebehind in Visual Studio for ASP.NET web forms applications, I often use the dropdowns at the top of the window to autogenerate page event handlers (e.g. Page_Load, Page_PreRender). I've noticed that sometimes Visual Studio likes to add numbers to these function names like "Page_Load1" or "Page_PreRender2". Programatically speaking, this has no effect on the code. But stylistically, I find it a bit ugly. Is there any way to get rid of this behavior?

    Read the article

  • Retrieve ASP.Net AutoGenerated MachineKey

    - by Jared
    I have a .Net 1.1 app that must be upgraded to 2.0. The application encrypts passwords in the database using MD5CryptoServiceProvider. After I upgraded to 2.0, the MD5 value was different. In the machine.config, the machinekey was set to autogenerate. Is there a way to retrieve this key?

    Read the article

  • MVC-like Autogenerated Pages for Webforms

    - by CccTrash
    I noticed that MVC lets you pass in LINQ to SQL objects to its views and it will autogenerate Create, Update and View Pages based on the LINQtoSQL object. Is there anything for webforms that lets you do this kind of thing? (In a nice way with validators maybe?)

    Read the article

  • ViewState MAc Problem...

    - by Mitesh
    Validation of viewstate MAC failed. If this application is hosted by a Web Farm or cluster, ensure that configuration specifies the same validationKey and validation algorithm. AutoGenerate cannot be used in a cluster.

    Read the article

  • ASP.NET MVC localization DisplayNameAttribute alternatives: a good way

    - by Brian Schroer
    The ASP.NET MVC HTML helper methods like .LabelFor and .EditorFor use model metadata to autogenerate labels for model properties. By default it uses the property name for the label text, but if that’s not appropriate, you can use a DisplayName attribute to specify the desired label text: [DisplayName("Remember me?")] public bool RememberMe { get; set; } I’m working on a multi-language web site, so the labels need to be localized. I tried pointing the DisplayName attribute to a resource string: [DisplayName(MyResource.RememberMe)] public bool RememberMe { get; set; } …but that results in the compiler error "An attribute argument must be a constant expression, typeof expression or array creation expression of an attribute parameter type”. I got around this by creating a custom LocalizedDisplayNameAttribute class that inherits from DisplayNameAttribute: 1: public class LocalizedDisplayNameAttribute : DisplayNameAttribute 2: { 3: public LocalizedDisplayNameAttribute(string resourceKey) 4: { 5: ResourceKey = resourceKey; 6: } 7:   8: public override string DisplayName 9: { 10: get 11: { 12: string displayName = MyResource.ResourceManager.GetString(ResourceKey); 13:   14: return string.IsNullOrEmpty(displayName) 15: ? string.Format("[[{0}]]", ResourceKey) 16: : displayName; 17: } 18: } 19:   20: private string ResourceKey { get; set; } 21: } Instead of a display string, it takes a constructor argument of a resource key. The DisplayName method is overridden to get the display string from the resource file (line 12). If the key is not found, I return a formatted string containing the key (e.g. “[[RememberMe]]”) so I can tell by looking at my web pages which resource keys I haven’t defined yet (line 15). The usage of my custom attribute in the model looks like this: [LocalizedDisplayName("RememberMe")] public bool RememberMe { get; set; } That was my first attempt at localized display names, and it’s a technique that I still use in some cases, but in my next post I’ll talk about the method that I now prefer, a custom DataAnnotationsModelMetadataProvider class…

    Read the article

  • WPF DataGrid AutoColumn generation via ICustomTypeDescriptor.

    - by panamack
    In a test project I've managed to AutoGenerate WPF DataGrid columns in the following scenario, where the data is stored in a Dictionary and binding is performed via PropertyDescriptors: public class People:List<Person>{ ... } public class Person:Dictionary<string,string>,INotifyPropertyChanged,ICustomTypeDescriptor { } The problem I'm having is in my real life project I'm using MVVM so it's *People*ViewModel which inherits ViewModelBase and hence can't inherit List<Person>. I've tried implementing IList<Person> instead with an internal List<Person> and explicitly setting the DataContext to an IList<Person> reference but that didn't work. I've seen a similar post on binding a win forms DataGridView here, so I'm wondering if the same sort of logic applies in WPF and primarily, what exactly causes the ICustomTypeDescriptor implementation to be picked up when inheriting List<T> that is missing when you simply implement IList<T> instead.

    Read the article

  • ASP.NET MVC Validation of ViewState MAC failed

    - by Kevin Pang
    After publishing a new build of my ASP.NET MVC web application, I often see this exception thrown when browsing to the site: System.Web.Mvc.HttpAntiForgeryException: A required anti-forgery token was not supplied or was invalid. --- System.Web.HttpException: Validation of viewstate MAC failed. If this application is hosted by a Web Farm or cluster, ensure that configuration specifies the same validationKey and validation algorithm. AutoGenerate cannot be used in a cluster. --- System.Web.UI.ViewStateException: Invalid viewstate. This exception will continue to occur on each page I visit in my web application until I close out of Firefox. After reopening Firefox, the site works perfectly. Any idea what's going on? Additional notes: I am not using any ASP.NET web controls (there are no instances of runat="server" in my application) If I take out the <%= Html.AntiForgeryToken % from my pages, this problem seems to go away

    Read the article

1 2  | Next Page >