Search Results

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

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

  • Struts2 dynamic form elements

    - by bozo
    Hi, I would like to create little higer-level framework on top of Stuts2 which can take form element description from Action and render a complete form, in order to avoid having a separate JSP files with hardcoded form elements for every form in a large web application (so if I manage to do this I will have just a few generic JSPs for data form and few for layout). Application is extremely data-driven. My idea is to create form description using custom objects in the Action (i.e. Button, TextInput etc.) and then to create a single JSP page that will render eveything out. What is the best way of doing this? Can you propose some concrete way to do this? I don't want to write something if I can reuse the existing code with some effort. Any ideas are appreciated. Kind regards, Bozo

    Read the article

  • Best way to store sales tax information

    - by Seph
    When designing a stock management database system (sales / purchases) what would be the best way to store the various taxes and other such amounts? A few of the fields that could be saved are: Unit price excluding tax Unit price including tax Tax per item Total excluding tax (rounded to 2 decimals) Total including tax (rounded to 2 decimals) Total tax (rounded to 2 decimals) Currently the most reasonable solution so far is storing down (roughly) item, quantity, total excluding tax (rounded) and the total tax (rounded). Can anyone suggest some better way of storing this details for a generic system? Also, given the system needs to be robust, what should be done if there were multiple tax values (eg: state and city) which might need to be separated, in this case a separate table would be in order, but would it be considered excessive to just have a rowID and some taxID mapping to a totalTax column?

    Read the article

  • Opera Mobile for Windows + Reported Screen Size

    - by Antony Scott
    I know this isn't a direct programming question, but's it's kinda relevant as I'm trying to get a good testing environment set up before I embark on my latest project. I'm trying to set up Opera Mobile for Windows to allow me to test a new website. The UserAgent I get is a fairly generic one, so my workaround is to tweak my mobile.browser file to have the correct screen width and height of the target device. Is it possible to add to the list of "fake" user agents that Opera Mobile for Windows can pretend to be? It currently supports S60, Android and Windows Mobile.

    Read the article

  • How to do a natural sort on an NSArray?

    - by Cory Imdieke
    I've got an array of objects, and I need them sorted by their "title" key. It's currently working, though it's using an ASCII sort instead of a natural sort. The titles are filenames, so they look like this: file1 file2 file3 ... file10 file11 file12 I'm getting, as you would expect: file1 file10 file11 file12 file2 file3 ... Does anyone know if there is a way built-in to the NSArray sorting functionality to get this natural sorting as opposed to the alphabetical sort? I found some generic algorithms, but I was hoping for something built-in...

    Read the article

  • Python: How do I create a reference to a reference?

    - by KCArpe
    Hi, I am traditionally a Perl and C++ programmer, so apologies in advance if I am misunderstanding something trivial about Python! I would like to create a reference to a reference. Huh? Ok. All objects in Python are actually references to the real object. So, how do I create a reference to this reference? Why do I need/want this? I am overriding sys.stdout and sys.stderr to create a logging library. I would like a (second-level) reference to sys.stdout. If I could create a reference to a reference, then I could create a generic logger class where the init function receives a reference to a file handle reference that will be overrided, e.g., sys.stdout or sys.stderr. Currently, I must hard-code both values. Cheers, Kevin

    Read the article

  • Trying to recognize _NSFaultingMutableSet as member of NSSet

    - by Will
    I'm trying to recognize the result of a generic query to a managed object as an NSSet. Currently the class returned is a member of _NSFaultingMutableSet, which is clearly related, but fails the isMemberOf:[NSSet class] and isKindOf:[NSSet class] calls. Given that Cocoa doesn't do a direct implementation of NSSet, it's not surprising that I've got some air in the pipes, but I'm wondering if I'm messing something obvious up or this requires a higher grade of kung-fu than I possess. Code follows: SEL selector = NSSelectorFromString(someString); if(![self respondsToSelector:selector]){ NSLog(@"Error processing item"); return; } id items = [self performSelector:selector]; Class itemsClass = [items class]; if ( [itemsClass isKindOfClass:[NSSet class]]) { // do something }

    Read the article

  • What would be the use of accepting itself as type arguments in generics

    - by Newtopian
    I saw some code on an unrelated question but it got me curious as I never saw such construct with Java Generics. What would be the use of creating a generic class that can take as type argument itself or descendants of itself. Here is example : abstract class A<E extends A> { abstract void foo(E x); } the first thing that came to mind would be a list that takes a list as parameter. Using this code feels strange, how do you declare a variable of type A ? Recursive declaration !? Does this even work ? If so did any of you see that in code ? How was it used ?

    Read the article

  • Is testability alone justification for dependency injection?

    - by fearofawhackplanet
    The advantages of DI, as far as I am aware, are: Reduced Dependencies More Reusable Code More Testable Code More Readable Code Say I have a repository, OrderRepository, which acts as a repository for an Order object generated through a Linq to Sql dbml. I can't make my orders repository generic as it performs mapping between the Linq Order entity and my own Order POCO domain class. Since the OrderRepository by necessity is dependent on a specific Linq to Sql DataContext, parameter passing of the DataContext can't really be said to make the code reuseable or reduce dependencies in any meaningful way. It also makes the code harder to read, as to instantiate the repository I now need to write new OrdersRepository(new MyLinqDataContext()) which additionally is contrary to the main purpose of the repository, that being to abstract/hide the existence of the DataContext from consuming code. So in general I think this would be a pretty horrible design, but it would give the benefit of facilitating unit testing. Is this enough justification? Or is there a third way? I'd be very interested in hearing opinions.

    Read the article

  • jquery checked checkbox IE problem

    - by lidermin
    Hi, I'm having an issue verifying if a checkbox is checked using jquery on Internet Explorer. This is the code I'm using: if ($('#chkjq_1').attr('checked') == true) It works fine on Firefox or Chrome, but on Internet Explorer 7, the condition is always false because the browser sets the property this way: <input id="chkjq_1" type="checkbox" CHECKED/> IE7 And the right way is the following: (Firefox, Chrome): <input id="chkjq_1" type="checkbox" checked="checked"/> FF, Chrome, etc What should I do to avoid this issue on Internet Explorer 7; is there a generic way in jquery to solve this? Thanks in advance.

    Read the article

  • Scripting.dictionary to c#

    - by naresh
    Facing one problem please help me.... We are product development company and our existing application is in ASP, I am trying to send scripting.dictionary object to c#'s com visible class. I am using the System.Collections.Generic class here is my code ASP: dim dictForm set dictForm=CreateObject("scripting.dictionary") dictForm("First") ="one" dictForm("Second") ="two" SET OBJMSGBOX = Server.CreateObject("DictionarySerializer.DictionarySerializer") call OBJMSGBOX.ConvertDictionary(dictForm) c#: [ComVisible(true)] public class DictionarySerializer : IXmlSerializable { Dictionary dict = new Dictionary(); public void ConvertDictionary(Dictionary dictionary) { this.dict = dictionary; } } I am getting error Invalid procedure call or argument: 'ConvertDictionary' Please tell me where I am going in wrong way.

    Read the article

  • Testing complex entities

    - by Carlos
    I've got a C# form, with various controls on it. The form controls an ongoing process, and there are many, many aspects that need to be right for the program to run correctly. Each part can be unit tested (for instance, loading some coefficients, drawing some diagnostics) but I often run into problems that are best described with an example: "If I click here, then here, then change this, then re-open the form, then click here, it crashes or produces an error" I've tried my best to use common code organisational ideas (inheritance, DRY, separation of concerns) but there never seems to be a way to test every single path, and inevitably, a form with several controls will have a huge number of ways to execute. What can I read (preferably online) that addresses this kind of issue, and is there a (non-generic) term for it. This isn't a specific problem I'm having, but one that creeps up on me, especially with WinForms.

    Read the article

  • Unexpected generics behaviour

    - by pronicles
    I found strange generics behaviour. In two words - thing I realy want is to use ComplexObject1 in most general way, and the thing I realy missed is why defined generic type(... extends BuisnessObject) is lost. The discuss thread is also awailable in my blog http://pronicles.blogspot.com/2010/03/unexpected-generics-behaviour.html. public class Test { public interface EntityObject {} public interface SomeInterface {} public class BasicEntity implements EntityObject {} public interface BuisnessObject<E extends EntityObject> { E getEntity(); } public interface ComplexObject1<V extends SomeInterface> extends BusinessObject<BasicEntity> {} public interface ComplexObject2 extends BuisnessObject<BasicEntity> {} public void test(){ ComplexObject1 complexObject1 = null; ComplexObject2 complexObject2 = null; EntityObject entityObject1 = complexObject1.getEntity(); //BasicEntity entityObject1 = complexObject1.getEntity(); wtf incompatible types!!!! BasicEntity basicEntity = complexObject2.getEntity(); } }

    Read the article

  • Accessing WPF Template for Custom Control from Code behind

    - by Ashwani Mehlem
    Hi, i am trying to access a named grid inside a default template for a custom control from code behind. But it seems that the template for the control is null, even after calling ApplyTemplate(). Is that impossible inside the controls constuctor? Here's the code: Generic.xaml: ... <ControlTemplate TargetType="{x:Type local:TimeTableControl}"> <Grid Name="ContentGrid"> </Grid> </ControlTemplate> ... TimeTableControl.cs: public TimeTableControl() { ApplyTemplate(); contentGrid = (Grid)(Template.FindName("ContentGrid", this)); //Line above causes null-pointer-exception ... }

    Read the article

  • mod_wsgi | linux installation error

    - by MMRUser
    I'm getting the following error when I try to install mod_wsgi ./configure checking for apxs2... no checking for apxs... /usr/sbin/apxs checking Apache version... 2.2.3 configure: creating ./config.status config.status: creating Makefile make /usr/sbin/apxs -c -I/usr/local/include/python2.6 -DNDEBUG mod_wsgi.c -L/usr/local/lib -L/usr/local/lib/python2.6/config -lpython2.6 -lpthread -ldl -lutil -lm /apr-1/build/libtool --silent --mode=compile gcc -prefer-pic -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m32 -march=i386 -mtune=generic -fasynchronous-unwind-tables -fno-strict-aliasing -DLINUX=2 -D_REENTRANT -D_GNU_SOURCE -D_LARGEFILE64_SOURCE -pthread -I/usr/include/httpd -I/usr/include/apr-1 -I/usr/include/apr-1 -I/usr/local/include/python2.6 -DNDEBUG -c -o mod_wsgi.lo mod_wsgi.c && touch mod_wsgi.slo sh: /apr-1/build/libtool: No such file or directory apxs:Error: Command failed with rc=8323072 . make: *** [mod_wsgi.la] Error 1 libtool is installed on my system.. mod_wsgi 3.2 *Apache 2.2* *Python 2.6*

    Read the article

  • Using hash functions with Bloom filters

    - by dangerstat
    Hi, A bloom filter uses a hash function (or many) to generate a value between 0 and m given an input string X. My question is how to you use a hash function to generate a value in this way, for example an MD5 hash is typically represented by a 32 length hex string, how would I use an MD5 hashing algorithm to generate a value between 0 and m where I can specify m? I'm using Java at the moment so an example of to do this with the MessageDigest functionality it offers would be great, though just a generic description of how to do about it would be fine too. Thanks

    Read the article

  • Problem with running c# application on another PC

    - by draghia-aurelian
    I wrote a Windows Form Application in C# and it works well for my computer. But on another PC, an error occurs when i try to do some stuff. code 1 private void rUNToolStripMenuItem_Click(object sender, EventArgs e) { MessageBox.Show("I'm in rUNToolStripMenuItem_Click!"); ... } code 2 private void dataPositionToolStripMenuItem_Click(object sender, EventArgs e) { MessageBox.Show("I'm in dataPositionToolStripMenuItem_Click!"); ... } Running on my computer: code1: MessageBox appears! code2: MessageBox appears! Running on another computer: code1: MessageBox doesn't appear and the error happens! code2: MessageBox appears! The error is: Method not found: "Void Microsoft.CSharp.RuntimeBinder.CSharpGetMemberBider..ctor(System.String.System.Type, System.Collections.Generic.IEnumerable'1)'. This is the PrintScreen with error: Please help me to solve the problem!

    Read the article

  • adhoc struct/class in C#?

    - by acidzombie24
    Currently i am using reflection with sql. I find if i want to make a specialize query it is easiest to get the results by creating a new class inheriting from another and adding the 2 members/columns for my specialized query. Then due to reflections in the lib in my c# code i can write foreach(var v in list) { v.AnyMember and v.MyExtraMember) Now instead of having the class scattered around or modifying my main DB.cs file can i define a class inside a function? I know i can create an anonymous object by writing new {name=val, name2=...}; but i need a to pass this class in a generic function func(query, args);

    Read the article

  • Track pageviews in Google Analytics on partial url of Grails application

    - by Pieter van Gent
    For my Grails application I want to set up Google Analytics to track only "partial" url's. I 'll explain: a typical Grails url consists of the following parts: domain + application-name + controller + action + id e.g. www.mydomain.com/myapp/controller/action/12345 As far as I understand for Google Analytics the page to be tracked is identified by the entire url. For my purpose I'm not interested in the id part of the url: I want to know which actions have been performed, but I need not know for which id the action was executed. And of course I would like a generic solution, because I have multiple controllers and multiple actions... Maybe some kind of filter stating "I want to track pages 3 levels deep (/myapp/controller/action)" would do? Or a filter stating "exclude everything from url after the last /"? Any help would be much appreciated. Kind regards, Pieter

    Read the article

  • LINQ how to concatenate 2 db columns to display in dropdownlist

    - by Simke Nys
    I'm trying to concatenate product_name with product_prize_kg by using LINQ so I can display it as one field in a dropdownlist. When I try to do this I get the following error. value of type 'system.collections.generic.list(of anonymous type )' cannot be converted to ... My code is like this: Public Function selectAll() As List(Of tblProduct) Dim result = From product In dc.tblProducts Select New With { Key .productID = product.pk_product_id, Key .productNameKg = Convert.ToString(product.product_name) & " " & Convert.ToString(product.product_price_kg) } Return result.ToList() End Function This is the dropdownlist that I want to fill. <asp:DropDownList ID="DropDownList1" runat="server" DataSourceID="ObjectDataSource1" DataTextField="productNameKg" DataValueField="productID"> </asp:DropDownList> Thanks Grtz Simke

    Read the article

  • How can I render a custom view in a UIScrollView at varying zoom levels without distorting the view?

    - by eczarny
    The scenario: I have a custom view (a subclass of UIView) that draws a game board. To enable the ability to zoom into, and pan around, the board I added my view as a subview of UIScrollView. This kind of works, but the game board is being rendered incorrectly. Everything is kind of fuzzy, and nothing looks right. The question: How can I force my view to be redrawn correctly ay varying scales? I'm providing my view with the current scale and sending it a setNeedsDisplay message after the scroll view is done zooming in/out, but the game board is still being rendered incorrectly. My view should be redrawing the game board depending on the zoom level, but this isn't happening. Does the scroll view perform a generic transformation on subviews? Is there a way to disable this behavior?

    Read the article

  • Sketchflow component target parent state

    - by user186106
    Hi, I'm using Sketchflow in Expression Blend 4 RC (although this is relevant to Blend 3 too). I have a screen with a datagrid on it (MainScreen) and there's a "New" button. I have a component screen that has a generic form (GenericForm) and a "Save and close" button. I have two states on MainScreen: State1 (and default): GenericForm visibility set to Hidden State2: GenericForm visibility set to Visible The "New" button on MainScreen has: Active State = State2, meaning when the "New" button is pressed, it changes the state of MainScreen to State2 (where the GenericForm component is visible). My problem is that I cannot link the "Save and close" button on GenericForm to State1 on MainScreen. In effect I would like to be able to press "Save and close" and for the MainScreen to set its state to State1. Any ideas?

    Read the article

  • Sharing view logic in Django

    - by Jeremy B.
    I've begun diving into Django again and I'm having trouble finding the parallel to some common concepts from my life in C#. While using .NET MVC I very often find myself creating a base controller which will provide a base action implementation to take care of the type of stuff I want to do on every request, like retrieving user information, getting localization values. Where I'm finding myself confused is how to do this in Django. I am getting more familiar with the MVT concept but I can't seem to find how to solve this scenario. I've looked at class based views and the generic views yet they didn't seem to work how I expected. What am I missing? How can i create default logic that each view will be instructed to run but not have to write it in each view method?

    Read the article

  • Nhibernate: one-to-many, based on multiple keys?

    - by e36M3
    Lets assume I have two tables Table tA ID ID2 SomeColumns Table tB ID ID2 SomeOtherColumns I am looking to create a Object let's call it ObjectA (based on tA), that will have a one-to-many relationship to ObjectB (based on tB). In my example however, I need to use the combination of ID and ID2 as the foreign key. If I was writing SQL it would look like this: select tB.* from tA, tB where tA.ID = tB.ID and tA.ID2 = tB.ID2; I know that for each ID/ID2 combination in tA I should have many rows in tB, therefor I know it's a one-to-many combination. Clearly the below set is not sufficient for such mapping as it only takes one key into account. <set name="A2" table="A2" generic="true" inverse="true" > <key column="ID" /> <one-to-many class="A2" /> </set> Thanks!

    Read the article

  • Calling Html.ActionLink in a custom HTML helper

    - by Sylvain
    I am designing a custom HTML helper and I would like to execute Html.ActionLink to provide dynamic URL generation. namespace MagieMVC.Helpers { public static class HtmlHelperExtension { public static string LinkTable(this HtmlHelper helper, List<Method> items) { string result = String.Empty; foreach (Method m in items) { result += String.Format( "<label class=\"label2\">{0}</label>" + System.Web.Mvc.Html.ActionLink(...) + "<br />", m.Category.Name,m.ID, m.Name); } return result; } } } Unfortunately Html.ActionLink is not recognized in this context whatever the namespace I have tried to declare. As a generic question, I would like to know if it is possible to use any existing standard/custom Html helper method when designing a new custom helper. Thanks.

    Read the article

  • Best PHP framework for an experienced PHP developer?

    - by andybaird
    Okay, before I start this, I am well aware of how subjective this question is. For my case, I'd like to define the 'best' for me as: Rapid development "Pretty" URLs Data validation Good knowledge base available Not impossible to integrate other PHP software with This is a pretty generic definition, but all I'm looking for here is opinions. Edited: Here's a better way to ask this question: You have two weeks to create a full scale booking and scheduling system that accepts Google Checkout payments (via the API) and integrates with an open source message board software. Which framework do you choose and why?

    Read the article

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