Search Results

Search found 6357 results on 255 pages for 'generic relations'.

Page 161/255 | < Previous Page | 157 158 159 160 161 162 163 164 165 166 167 168  | Next Page >

  • Java mobile: Android or Blackberry?

    - by jpartogi
    Hi all, Most of the questions on SO has been too generic, comparing iPhone, Android and Blackberry all at once. I want to ask your experience between developing on Android and Blackberry. From your experience as Java programmer: Which platform do you enjoy developing on the most? Which API do you find is well written and fun to code? Which development platform that is fun to work with? Which platform do you find most stable and less issues with? Android or Blackberry? Any other noteworthy checklists to share to Java programmers that want to choose whether to develop on Android or Blackberry? Thank you for sharing your experience with us here.

    Read the article

  • How can I perform action from ASP.NET MVC with different user credentials?

    - by Rob
    Hopefully this explanation will make sense, but what is the best way (if it is even possible) to pass along user credentials to preform a specific application from an ASP.NET MVC application. Currently I am working on trying to create directories on another server, we can't do this using the generic credentials that the application is running with; however, we have been told that we can if we pass the credentials of the user currently using the application along. Currently we are running on IIS 6.0 but will be moving to IIS 7.0 in the near future and likewise we are using Integrated Windows authentication for the web applications.

    Read the article

  • If you have an application localized in pt-br and pt-pt, what language you should choose if the syst

    - by Sorin Sbarnea
    If you have an application localized in pt-br and pt-pt, what language you should choose if the system is reporting only pt code (generic Portuguese)? This question is independent of the nature of the application, desktop, mobile or browser based. Let's assume you are not able to get region information from another source and you have to choose one language as the default one. The question does apply as well for more case including: * pt-pt and pt-br * en-us and en-gb * fr-fr and fr-CA * zh-cn, zh-tw, .... - in fact in this case I know that zh can be used as predominant language for Simplified Chinese where full code is zh-hans. For zh-tw, zh-hant-tw, zh-hk, zh-mo the proper code (canonical) should be zh-hant. In fact the question can be extended to: How to I determine the predominant languages for a specified meta-language? I need a solution that will include at least Portuguese, English and French.

    Read the article

  • C++: Declaration of template class member specialization (+ Doxygen bonus question!)

    - by Ziv
    When I specialize a (static) member function/constant in a template class, I'm confused as to where the declaration is meant to go. Here's an example of what I what to do - yoinked directly from IBM's reference on template specialization: template<class T> class X { public: static T v; static void f(T); }; template<class T> T X<T>::v = 0; template<class T> void X<T>::f(T arg) { v = arg; } template<> char* X<char*>::v = "Hello"; template<> void X<float>::f(float arg) { v = arg * 2; } int main() { X<char*> a, b; X<float> c; c.f(10); // X<float>::v now set to 20 } The question is, how do I divide this into header/cpp files? The generic implementation is obviously in the header, but what about the specialization? It can't go in the header file, because it's concrete, leading to multiple definition. But if it goes into the .cpp file, is code which calls X::f() aware of the specialization, or might it rely on the generic X::f()? So far I've got the specialization in the .cpp only, with no declaration in the header. I'm not having trouble compiling or even running my code (on gcc, don't remember the version at the moment), and it behaves as expected - recognizing the specialization. But A) I'm not sure this is correct, and I'd like to know what is, and B) my Doxygen documentation comes out wonky and very misleading (more on that in a moment). What seems most natural to me would be something like this, declaring the specialization in the header and defining it in the .cpp: ===XClass.hpp=== #ifndef XCLASS_HPP #define XCLASS_HPP template<class T> class X { public: static T v; static void f(T); }; template<class T> T X<T>::v = 0; template<class T> void X<T>::f(T arg) { v = arg; } /* declaration of specialized functions */ template<> char* X<char*>::v; template<> void X<float>::f(float arg); #endif ===XClass.cpp=== #include <XClass.hpp> /* concrete implementation of specialized functions */ template<> char* X<char*>::v = "Hello"; template<> void X<float>::f(float arg) { v = arg * 2; } ...but I have no idea if this is correct. The most immediate consequence of this issue, as I mentioned, is my Doxygen documentation, which doesn't seem to warm to the idea of member specialization, at least the way I'm defining it at the moment. It will always present only the first definition it finds of a function/constant, and I really need to be able to present the specializations as well. If I go so far as to re-declare the entire class, i.e. in the header: /* template declaration */ template<class T> class X { public: static T v; static void f(T); }; /* template member definition */ template<class T> T X<T>::v = 0; template<class T> void X<T>::f(T arg) { v = arg; } /* declaration of specialized CLASS (with definitions in .cpp) */ template<> class X<float> { public: static float v; static void f(float); }; then it will display the different variations of X as different classes (which is fine by me), but I don't know how to get the same effect when specializing only a few select members of the class. I don't know if this is a mistake of mine, or a limitation of Doxygen - any ideas? Thanks much, Ziv

    Read the article

  • No persister for: <ClassName> issue with Fluent NHibernate

    - by Amit
    I have following code: //AutoMapConfig.cs using System; using FluentNHibernate.Automapping; namespace SimpleFNH.AutoMap { public class AutoMapConfig : DefaultAutomappingConfiguration { public override bool ShouldMap(Type type) { return type.Namespace == "Examples.FirstAutomappedProject.Entities"; } } } //CascadeConvention.cs using FluentNHibernate.Conventions; using FluentNHibernate.Conventions.Instances; namespace SimpleFNH.AutoMap { public class CascadeConvention : IReferenceConvention, IHasManyConvention, IHasManyToManyConvention { public void Apply(IManyToOneInstance instance) { instance.Cascade.All(); } public void Apply(IOneToManyCollectionInstance instance) { instance.Cascade.All(); } public void Apply(IManyToManyCollectionInstance instance) { instance.Cascade.All(); } } } //Item.cs namespace SimpleFNH.Entities { public class Item { public virtual long ID { get; set; } public virtual string ItemName { get; set; } public virtual string Description { get; set; } public virtual OrderItem OrderItem { get; set; } } } //OrderItem.cs namespace SimpleFNH.Entities { public class OrderItem { public virtual long ID { get; set; } public virtual int Quantity { get; set; } public virtual Item Item { get; set; } public virtual ProductOrder ProductOrder { get; set; } public virtual void AddItem(Item item) { item.OrderItem = this; } } } using System; using System.Collections.Generic; //ProductOrder.cs namespace SimpleFNH.Entities { public class ProductOrder { public virtual long ID { get; set; } public virtual DateTime OrderDate { get; set; } public virtual string CustomerName { get; set; } public virtual IList<OrderItem> OrderItems { get; set; } public ProductOrder() { OrderItems = new List<OrderItem>(); } public virtual void AddOrderItems(params OrderItem[] items) { foreach (var item in items) { OrderItems.Add(item); item.ProductOrder = this; } } } } //NHibernateRepo.cs using FluentNHibernate.Cfg; using FluentNHibernate.Cfg.Db; using NHibernate; using NHibernate.Criterion; using NHibernate.Tool.hbm2ddl; namespace SimpleFNH.Repository { public class NHibernateRepo { private static ISessionFactory _sessionFactory; private static ISessionFactory SessionFactory { get { if (_sessionFactory == null) InitializeSessionFactory(); return _sessionFactory; } } private static void InitializeSessionFactory() { _sessionFactory = Fluently.Configure().Database( MsSqlConfiguration.MsSql2008.ConnectionString( @"server=Amit-PC\SQLEXPRESS;database=SimpleFNH;Trusted_Connection=True;").ShowSql()). Mappings(m => m.FluentMappings.AddFromAssemblyOf<Order>()).ExposeConfiguration( cfg => new SchemaExport(cfg).Create(true, true)).BuildSessionFactory(); } public static ISession OpenSession() { return SessionFactory.OpenSession(); } } } //Program.cs using System; using System.Collections.Generic; using System.Linq; using SimpleFNH.Entities; using SimpleFNH.Repository; namespace SimpleFNH { class Program { static void Main(string[] args) { using (var session = NHibernateRepo.OpenSession()) { using (var transaction = session.BeginTransaction()) { var item1 = new Item { ItemName = "item 1", Description = "test 1" }; var item2 = new Item { ItemName = "item 2", Description = "test 2" }; var item3 = new Item { ItemName = "item 3", Description = "test 3" }; var orderItem1 = new OrderItem { Item = item1, Quantity = 2 }; var orderItem2 = new OrderItem { Item = item2, Quantity = 4 }; var orderItem3 = new OrderItem { Item = item3, Quantity = 5 }; var productOrder = new ProductOrder { CustomerName = "Amit", OrderDate = DateTime.Now, OrderItems = new List<OrderItem> { orderItem1, orderItem2, orderItem3 } }; productOrder.AddOrderItems(orderItem1, orderItem2, orderItem3); session.Save(productOrder); transaction.Commit(); } } using (var session = NHibernateRepo.OpenSession()) { // retreive all stores and display them using (session.BeginTransaction()) { var orders = session.CreateCriteria(typeof(ProductOrder)) .List<ProductOrder>(); foreach (var item in orders) { Console.WriteLine(item.OrderItems.First().Quantity); } } } } } } I tried many variations to get it working but i get an error saying No persister for: SimpleFNH.Entities.ProductOrder Can someone help me get it working? I wanted to create a simple program which will set a pattern for my bigger project but it is taking quite a lot of time than expected. It would be rally helpful if you can explain in simple terms on any template/pattern that i can use to get fluent nHibernate working. The above code uses auto mapping, which i tried after i tried with fluent mapping.

    Read the article

  • Monotouch UITableView image "flashing" while background requests are fetched

    - by Themos Piperakis
    I am in need of some help from you guys. I have a Monotouch UITableView which contains some web images. I have implemented a Task to fetch them asynchronously so the UI is responsive, an even added some animations to fade them in when they are fetched from the web. My problems start when the user scrolls down very fast down the UITableView, so since the cells are resusable, several background tasks are queued for images. When he is at the bottom of the list, he might see the thumbnail displaying an image for another cell, then another, then another, then another, as the tasks are completed and each image replaces the other one. I am in need of some sort of checking whether the currently displayed cell corresponds to the correct image url, but not sure how to do that. Here is the code for my TableSource class. using System; using MonoTouch.UIKit; using MonoTouch.Foundation; using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; using System.Diagnostics; { public class ListDelegate:UITableViewDelegate { private UINavigationController nav; public override float GetHeightForRow (UITableView tableView, NSIndexPath indexPath) { return 128; } public override void RowSelected (UITableView tableView, NSIndexPath indexPath) { DealViewController c = new DealViewController(((ListDataSource)tableView.DataSource).deals[indexPath.Row].Id,nav); nav.PushViewController(c,true); tableView.DeselectRow(indexPath,true); } public ListDelegate(UINavigationController nav) { this.nav = nav; } } public class ListDataSource:UITableViewDataSource { bool toggle=true; Dictionary<string,UIImage> images = new Dictionary<string, UIImage>(); public List<MyDeal> deals = new List<MyDeal>(); Dictionary<int,ListCellViewController> controllers = new Dictionary<int, ListCellViewController>(); public ListDataSource(List<MyDeal> deals) { this.deals = deals; } public override int RowsInSection (UITableView tableview, int section) { return deals.Count; } public override UITableViewCell GetCell (UITableView tableView, MonoTouch.Foundation.NSIndexPath indexPath) { UITableViewCell cell = tableView.DequeueReusableCell("cell"); ListCellViewController cellController = null; if (cell == null || !controllers.ContainsKey(cell.Tag)) { cellController = new ListCellViewController(); NSBundle.MainBundle.LoadNib("ListCellViewController", cellController, null); cell = cellController.Cell; cell.Tag = Environment.TickCount; controllers.Add(cell.Tag, cellController); } else { cellController = controllers[cell.Tag]; } if (toggle) { cell.BackgroundView = new UIImageView(UIImage.FromFile("images/bg1.jpg")); } else { cell.BackgroundView = new UIImageView(UIImage.FromFile("images/bg2.jpg")); } toggle = !toggle; MyDeal d = deals[indexPath.Row]; cellController.SetValues(d.Title,d.Price,d.Value,d.DiscountPercent); GetImage(cellController.Thumbnail,d.Thumbnail); return cell; } private void GetImage(UIImageView img, string url) { img.Alpha = 0; if (url != string.Empty) { if (images.ContainsKey(url)) { img.Image = images[url]; img.Alpha = 1; } else { var context = TaskScheduler.FromCurrentSynchronizationContext (); Task.Factory.StartNew (() => { NSData imageData = NSData.FromUrl(new NSUrl(url)); var uimg = UIImage.LoadFromData(imageData); images.Add(url,uimg); return uimg; }).ContinueWith (t => { InvokeOnMainThread(()=>{ img.Image = t.Result; RefreshImage(img); }); }, context); } } } private void RefreshImage(UIImageView img) { UIView.BeginAnimations("imageThumbnailTransitionIn"); UIView.SetAnimationDuration(0.5f); img.Alpha = 1.0f; UIView.CommitAnimations(); } } } Here is the ListCellViewController, that contains a custom cell using System; using System.Collections.Generic; using System.Linq; using MonoTouch.Foundation; using MonoTouch.UIKit; { public partial class ListCellViewController : UIViewController { #region Constructors // The IntPtr and initWithCoder constructors are required for items that need // to be able to be created from a xib rather than from managed code public ListCellViewController (IntPtr handle) : base(handle) { Initialize (); } [Export("initWithCoder:")] public ListCellViewController (NSCoder coder) : base(coder) { Initialize (); } public ListCellViewController () : base("ListCellViewController", null) { Initialize (); } void Initialize () { } public UIImageView Thumbnail { get{return thumbnailView;} } public UITableViewCell Cell { get {return cell;} } public void SetValues(string title,decimal price,decimal valuex,decimal discount,int purchases) { } #endregion } } All help is greatly appreciated

    Read the article

  • jQuery: How to select the next element with name-xyz?

    - by Shpigford
    I'm trying to build a really simple generic toggle functionality where the toggling "switch" has a class of .toggle and then I want it to toggle() the next element that has the class .toggle-content. Example HTML: <p> <a href="#" class="toggle">Toggle the thing</a> </p> <p class="toggle-content hidden">I'm totally hidden right now</p> So right now I'd toggle that with: $(".toggle").click(function() { $(this).parent().next('.toggle-content').toggle(); }); The problem is if the .toggle class is any deeper in the DOM, I have to keep tacking on more parent()'s depending on how deep it is/isn't. So how can I just select the next instance of .toggle-content without having use a bunch of parent()'s and next()'s?

    Read the article

  • nested linq-to-sql queries

    - by ile
    var result = ( from contact in db.Contacts join user in db.Users on contact.CreatedByUserID equals user.UserID orderby contact.ContactID descending select new ContactListView { ContactID = contact.ContactID, FirstName = contact.FirstName, LastName = contact.LastName, Company = (from field in contact.XmlFields.Descendants("Company") select field.Value).SingleOrDefault().ToString() }).Take(10); Here I described how my database tables look like. So, contacts table has one field that is xml type. In that field is stored Company filename and I need to read it. I tried it using this way: Company = (from field in contact.XmlFields.Descendants("Company") select field.Value).SingleOrDefault().ToString() }).Take(10); but I get following error: Member access 'System.String Value' of 'System.Xml.Linq.XElement' not legal on type 'System.Collections.Generic.IEnumerable`1[System.Xml.Linq.XElement]. Any solution for this? Thanks in advance, Ile

    Read the article

  • F# return type coercion

    - by Alex
    Hi, In F# I have a function that returns System.Linq.Expression instances: and System.Object with member this.ToExpression() = match this with | :? System.Int32 -> Expression.Constant(this) :> Expression | :? System.Boolean -> Expression.Constant(this) :> Expression | :? Tml.Runtime.Seq as s -> s.ToExpression() | _ -> failwith "bad expression" If I omit the type coercions on the return values F# will infer the return type of the function to ConstantExpression. My first thought was to explicitly mark the return type as being : #Expression, but that didn't work. Is there a more elegant way of doing this that doesn't involve manually casting return types to the most generic type? Thanks.

    Read the article

  • Entity Relationship Multiple 1:1's

    - by Evan
    I have an application where I have a generic object (table) called Hull. Each hull in the table is unique. I have another object that has three hulls, but they are specifically the Port_Hull, Center_Hull and Starboard_Hull. Rather than create a One to Many relationship, I was trying to create a one to one relationship for each one, but this results in numerous errors unless I make the relationship from Hull to Vessel one to many (which it is not). Any idea how I go about this, or should I abandon the concept and make the vessel to hull relationship one to many and deal with lists that always have three entries? p.s. Using uniqueidentifiers as many users can be adding records while disconnected. Hull Table HullID uniqueidentifier (primary key) plus bunch of hull data fields Vessel Table VesselID uniqueidentifier (primary key) MainHullID uniqueidentifier (tried as key and non-key) PortHullID uniqueidentifier StarboardHullID uniqueidentifier plus bunch of Vessel data fields

    Read the article

  • The ctags command doesn't recurse saying "it is not a regular file".

    - by indiv
    When I run ctags -R *, I get errors saying that all directories are not regular files and it skips them instead of recursively generating tags for them. ctags: skipping arpa: it is not a regular file. ctags: skipping asm: it is not a regular file. ctags: skipping asm-generic: it is not a regular file. ctags: skipping bits: it is not a regular file. ctags: skipping blkid: it is not a regular file. ctags: skipping boost: it is not a regular file. What is the problem?

    Read the article

  • JQuery "Any Row" Picker

    - by Eli
    Hi All, I'm looking for a generic "Row Picker" for JQuery. We've all seen the cool "Picker" tools like date pickers, color pickers, time pickers, etc, where you click in a text box and a little calendar or color palate or clock or something comes up. You select something (like a date) and the text box is then populated with a value. I really need an all-purpose "row picker" where you can populate something (a table, divs, etc) with some rows of data (say a list of timezones). This would be linked to a text field and would pop up when the user clicks in the field. They would click a row (say a timezone), and the timezone id would be passed back to the field. Anyone know of anything that does this? Thanks!

    Read the article

  • $.(ajax) wrapper for Jquery - passing parameters to delegates

    - by gnomixa
    I use $.(ajax) function extensively in my app to call ASP.net web services. I would like to write a wrapper in order to centralize all the ajax calls. I found few simple solutions, but none address an issue of passing parameters to delegates, for example, if i have: $.ajax({ type: "POST", url: "http://localhost/TemplateWebService/TemplateWebService/Service.asmx/GetFoobar", data: jsonText, contentType: "application/json; charset=utf-8", dataType: "json", success: function(response) { var results = (typeof response.d) == 'string' ? eval('(' + response.d + ')') : response.d; OnSuccess(results, someOtherParam1, someOtherParam2); }, error: function(xhr, status, error) { OnError(); } }); The wrapper to this call would have to have the way to pass someOtherParam1, someOtherParam2 to the OnSuccess delegate...Aside from packing the variables into a generic array, I can't think of other solutions. How did you guys address this issue?

    Read the article

  • Anyone succeeded at injecting Interfaces into Entity Framework 4 Entities, using T4?

    - by Ciel
    Hello: POCO sort of leaves me wanting: (how can I say I use DI/IoC, if the Repository is not the only place that is creating the entities?)...hence my desire to lock it down, get rid of the temptation of newing up POCOs or EntityObjects anywhere in the code, and just allowing entity interfaces above the Repository/Factory layer. For a second there, I nearly thought I had it...was editing EF4's T4 in order to inject in an Interface def. Was going swimmingly, compiled and worked, until I got to the Associations... I wrapped them with a ICollection, and renamed the underlying original collection with a prefix of Wrapped. Unfortunately, when run, throws an error: //The Member 'WrappedSubExamples' in the CLR type 'XAct.App.Data.Model.EF4.Example' is not present in the conceptual model type 'XAct.App.Data.Model.Entity.Example'. var examples = context2.CreateObjectSet(); My T4 segment I used was (this may not work, as it's the longest code snippet I've ever posted here...sorry): #region Generic Property Abstraction <# if (navProperty.ToEndMember.RelationshipMultiplicity == RelationshipMultiplicity.Many) {#> //XAct.App Generic Wrapper: <#=code.SpaceAfter(NewModifier(navProperty))#><#=Accessibility.ForProperty(navProperty)#> ICollection<I<#=MultiSchemaEscape(navProperty.ToEndMember.GetEntityType(), code)#>> <#=code.Escape(navProperty)#> { get { if (_X<#=code.Escape(navProperty)# == null){ _X<#=code.Escape(navProperty)# = new WrappedCollection,<#=MultiSchemaEscape(navProperty.ToEndMember.GetEntityType(), code)#(this.<#=(navProperty.ToEndMember.RelationshipMultiplicity == RelationshipMultiplicity.Many)?"Wrapped":""#<#=code.Escape(navProperty)#); } return _X<#=code.Escape(navProperty)#; } } private ICollection _X<#=code.Escape(navProperty)#; <# } else { # <#=code.SpaceAfter(NewModifier(navProperty))#<#=Accessibility.ForProperty(navProperty)# I<#=MultiSchemaEscape(navProperty.ToEndMember.GetEntityType(), code)# <#=code.Escape(navProperty)# { get { return (I<#=code.Escape(navProperty)#)this.Wrapped<#=code.Escape(navProperty)#; } set { this.Wrapped<#=code.Escape(navProperty)# = value as <#=code.Escape(navProperty)#; } } <# } # #endregion which then wraps the original collection, renamed with the prefix 'Wrapped': /// <summary> /// <#=SummaryComment(navProperty)#> /// </summary><#=LongDescriptionCommentElement(navProperty, region.CurrentIndentLevel) #> [XmlIgnoreAttribute()] [SoapIgnoreAttribute()] [DataMemberAttribute()] [EdmRelationshipNavigationPropertyAttribute("<#=navProperty.RelationshipType.NamespaceName#>", "<#=navProperty.RelationshipType.Name#>", "<#=navProperty.ToEndMember.Name#>")] <# if (navProperty.ToEndMember.RelationshipMultiplicity == RelationshipMultiplicity.Many) { #> <#=code.SpaceAfter(NewModifier(navProperty))#><#=Accessibility.ForProperty(navProperty)#> EntityCollection<<#=MultiSchemaEscape(navProperty.ToEndMember.GetEntityType(), code)#>> Wrapped<#=code.Escape(navProperty)#> { <#=code.SpaceAfter(Accessibility.ForGetter(navProperty))#>get { return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedCollection<<#=MultiSchemaEscape(navProperty.ToEndMember.GetEntityType(), code)#>>("<#=navProperty.RelationshipType.FullName#>", "<#=navProperty.ToEndMember.Name#>"); } <#=code.SpaceAfter(Accessibility.ForSetter(navProperty))#>set { if ((value != null)) { ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedCollection<<#=MultiSchemaEscape(navProperty.ToEndMember.GetEntityType(), code)#>>("<#=navProperty.RelationshipType.FullName#>", "<#=navProperty.ToEndMember.Name#>", value); } } } <# } else { #> <#=code.SpaceAfter(NewModifier(navProperty))#><#=Accessibility.ForProperty(navProperty)#> <#=MultiSchemaEscape(navProperty.ToEndMember.GetEntityType(), code)#> Wrapped<#=code.Escape(navProperty)#> { <#=code.SpaceAfter(Accessibility.ForGetter(navProperty))#>get { return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<<#=MultiSchemaEscape(navProperty.ToEndMember.GetEntityType(), code)#>>("<#=navProperty.RelationshipType.FullName#>", "<#=navProperty.ToEndMember.Name#>").Value; } <#=code.SpaceAfter(Accessibility.ForSetter(navProperty))#>set { ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<<#=MultiSchemaEscape(navProperty.ToEndMember.GetEntityType(), code)#>>("<#=navProperty.RelationshipType.FullName#>", "<#=navProperty.ToEndMember.Name#>").Value = value; } } <# string refPropertyName = navProperty.Name + "Reference"; if (entity.Members.Any(m => m.Name == refPropertyName)) { // 6017 is the same error number that EntityClassGenerator uses. Errors.Add(new System.CodeDom.Compiler.CompilerError(SourceCsdlPath, -1, -1, "6017", String.Format(CultureInfo.CurrentCulture, GetResourceString("Template_ConflictingGeneratedNavPropName"), navProperty.Name, entity.FullName, refPropertyName))); } #> /// <summary> /// <#=SummaryComment(navProperty)#> /// </summary><#=LongDescriptionCommentElement(navProperty, region.CurrentIndentLevel)#> [BrowsableAttribute(false)] [DataMemberAttribute()] <#=Accessibility.ForProperty(navProperty)#> EntityReference<<#=MultiSchemaEscape(navProperty.ToEndMember.GetEntityType(), code)#>> <#=refPropertyName#> { <#=code.SpaceAfter(Accessibility.ForGetter(navProperty))#>get { return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<<#=MultiSchemaEscape(navProperty.ToEndMember.GetEntityType(), code)#>>("<#=navProperty.RelationshipType.FullName#>", "<#=navProperty.ToEndMember.Name#>"); } <#=code.SpaceAfter(Accessibility.ForSetter(navProperty))#>set { if ((value != null)) { ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedReference<<#=MultiSchemaEscape(navProperty.ToEndMember.GetEntityType(), code)#>>("<#=navProperty.RelationshipType.FullName#>", "<#=navProperty.ToEndMember.Name#>", value); } } } <# } The point is...it bugs out. I've tried various solutions...none worked. Any ideas -- or is this just a wild goose chase, and time to give it up?

    Read the article

  • Choosing embedded EJB 3.x container to run JEE 5 app on Tomcat

    - by grigory
    I am sorry in advance if my question sounds too generic - I am doing all preliminary research myself but nothing substitutes real experience... My goal is to port a legacy JEE application (pre-EJB 3.x) to Tomcat with embedded EJB container. My choices currently stand as follows: JBoss Embeddable EJB Apache OpenEJB OW2 Consortium EasyBeans anything else? I am expecting to use JMS (with MDBs), Session beans (stateful and stateless), JPA and I am really excited about using JSF with Seam. Now, given choices above, are there any advantages in using one or another embedded EJB provider?

    Read the article

  • string extension method - Not available through WebMethod

    - by Peter Bridger
    I've written a simple extension method for a web project, it sits in a class file called StringExtensions.cs which contains the following code: using System; using System.Collections.Generic; using System.Linq; using System.Web; /// <summary> /// Useful extensions for string /// </summary> static class StringExtensions { /// <summary> /// Is string empty /// </summary> /// <param name="value"></param> /// <returns></returns> public static bool IsEmpty(this string value) { return value.Trim().Length == 0; } } I can access this extension method from all the classes I have within the App_Code directory. However I have a web page called JSON.aspx that contains a series of [WebMethods] - within these I cannot see the extension method - I must be missing something very obvious!

    Read the article

  • Kohana PHP - Multiple apps with shared model

    - by Josamoto
    I'm using Kohana 3 to create a website that has two applications, an admin application and the actual site frontend. I have separated my folders to have the two applications separated, so the hierarchy looks as follows: /applications /admin /classes /controller /... /site /classes /controller /.... My question is, how I need to go about creating a shared /model folder. Essentially, both the admin and site itself operates on the same data, so the database layer and business logic remains more or less the same. So to me, it makes sense to have a single model folder, sitting outside of the two application folders. Is it possible to achieve the following hierarchy: /applications /model --> Where model sits in a neatly generic location, accessible to all applications /admin /classes /controller /... /site /classes /controller /.... Thanks in advance!

    Read the article

  • tchar safe functions -- count parameter for UTF-8 constants

    - by Dustin Getz
    I'm porting a library from char to TCHAR. the count parameter of this fragment, according to MSDN, is the number of multibyte characters, not the number of bytes. so, did I get this right? _tcsncmp(access, TEXT("ftp"), 3); //or do i want _tcsnccmp? "Supported on Windows platforms only, _mbsncmp and _mbsnbcmp are multibyte versions of strncmp. _mbsncmp will compare at most count multibyte characters and _mbsnbcmp will compare at most count bytes. They both use the current multibyte code page. _tcsnccmp and _tcsncmp are the corresponding Generic functions for _mbsncmp and _mbsnbcmp, respectively. _tccmp is equivalent to _tcsnccmp."

    Read the article

  • How do you perform macro expansion within #ifdef?

    - by Malvineous
    Hi all, I have some fairly generic code which uses preprocessor macros to add a certain prefix onto other macros. This is a much simplified example of what happens: #define MY_VAR(x) prefix_##x "prefix_" is actually defined elsewhere, so it will be different each time the file is included. It works well, but now I have some code I would like to skip if one of the tokens doesn't exist, but this doesn't work: #if defined MY_VAR(hello) What I want it to expand to is this: #ifdef prefix_hello But I can't figure out how. I need to use the MY_VAR() macro to do the expansion, so I can't just hardcode the name. (It's actually for some testing code, the same code gets included with a different prefix each time to test a bunch of classes, and I want to skip a couple of tests for a handful of the classes.) Is this possible with the C++ preprocessor?

    Read the article

  • How to display unique success messages on jquery form validation

    - by mastah
    Hi guys, hope you can help me on this one, I'm currently using this: jQuery plugin:validation (Homepage) I've been reading related questions here, but this one is the closest get. http://stackoverflow.com/questions/1863448/jquery-validation-on-success from the plugin's documentation http://docs.jquery.com/Plugins/Validation/validate#toption success String, Callback If specified, the error label is displayed to show a valid element. If a String is given, its added as a class to the label. If a Function is given, its called with the label (as a jQuery object) as its only argument. That can be used to add a text like "ok!". Currently I'm only object given to me is the label, and I can only add text to it. Now what I want is to have unique success message. For example: username field will have a success message: 'username okay!' email = 'email seems right' something along those lines, instead of displaying just one generic success message on all the fields. Thanks in advanced :)

    Read the article

  • Lack of IsNumeric function in C#

    - by Michael Kniskern
    One thing that has bothered me about C# since its release was the lack of a generic IsNumeric function. I know it is difficult to generate a one-stop solution to detrmine if a value is numeric. I have used the following solution in the past, but it is not the best practice because I am generating an exception to determine if the value is IsNumeric: public bool IsNumeric(string input) { try { int.Parse(input); return true; } catch { return false; } } Is this still the best way to approach this problem or is there a more efficient way to determine if a value is numeric in C#?

    Read the article

  • How can I use my own connection class with a strongly typed dataset?

    - by Maslow
    I have designed a class with sqlClient.SqlCommand wrappers to implement such functionality as automatic retries on timeout, Async (thread safety), error logging, and some sql server functions like WhoAmI. I've used some strongly typed datasets mainly for display purposes only, but I'd like to have the same database functionality that I use with my class. Is there an interface I can implement or a way to hook my command/connection class into the dataset at design or runtime? Or would I need to somehow write a wrapper for the dataset to implement these types of functions? if this is the only option could it be made generic to wrap anything that inherits from dataset?

    Read the article

  • Simple ADO.NET C# Stored Procedure Generator

    - by Ron
    I am using Visual Studio 2005, Sql Server 2005, C#, ADO.NET. We have a very large database and routinely adding new stored procedures. I am tired of writing the C# wrapper code for these stored procedures, seems like there should be some simple utility or Add In that would allow me to simply point to a stored procedure and generate some generic C# code. I am not looking for some big ORM or data access layer framework. The company I am doing this for is not interested in moving to something like that right now. Just wanting something to take the grunt work out of writing the C# wrappers around stored procedures. Again, prefer that we do not have to include in other 3rd party libraries, etc. Any ideas?

    Read the article

  • How to render the properties of the view model's base class first when using ViewData.ModelMetadata.

    - by Martin R-L
    When I use the ViewData.ModelMetadata.Properties in order to loop the properties (with an additional Where(modelMetadata => modelMetadata.ShowForEdit && !ViewData.TemplateInfo.Visited(modelMetadata))), and thereby create a generic edit view, the properties of the view model's base class are rendered last. Is it possible to use a clever OrderBy() or is there another way to first get the properties of the base class, and then the sub class'? Reverse won't do the trick since the ordering of each class' properties is perfectly fine. A workaround would of course be composition + delegation, but since we don't have mixins, it's too un-DRY IMHO, why I seek a better solution if possible.

    Read the article

  • Obfuscate strings in Python

    - by Caedis
    I have a password string that must be passed to a method. Everything works fine but I don't feel comfortable storing the password in clear text. Is there a way to obfuscate the string or to truly encrypt it? I'm aware that obfuscation can be reverse engineered, but I think I should at least try to cover up the password a bit. At the very least it wont be visible to a indexing program, or a stray eye giving a quick look at my code. I am aware of pyobfuscate but I don't want the whole program obfuscated, just one string and possibly the whole line itself where the variable is defined. Target platform is GNU Linux Generic (If that makes a difference)

    Read the article

< Previous Page | 157 158 159 160 161 162 163 164 165 166 167 168  | Next Page >