Search Results

Search found 889 results on 36 pages for 'convention'.

Page 4/36 | < Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • check for naming convention in java.

    - by Vivart
    through java reflection how to check that method name is in camelCase? e.g. import java.lang.reflect.*; public class TestClass { private int simpleMethod( Object p, int x) throws NullPointerException { if (p == null) throw new NullPointerException(); return x; } public static void main(String args[]) { try { Class cls = Class.forName("method1"); Method methlist[] = cls.getDeclaredMethods(); for (int i = 0; i < methlist.length; i++) { Method m = methlist[i]; System.out.println("name= " + m.getName()); } } catch (Throwable e) { System.err.println(e); } } } here i am getting method names simpleMethod and main i have to check that these names are in camelCase.

    Read the article

  • Naming convention for the primary key in a Table

    - by kwokwai
    Hi all, I am learning the Model relationship types in cakephp. I have built twotables and in one of the Table A, I got these fields in it: Table A {postID, topic, content} Table B {replyID, content, postID} And when I ran the web page, a bunch of error related to SQL popped up saying that cakephp couldn't find post_id. It is weird that I have already declared the $primaryKey to be using postID in the tableA.php under Models folder, but cakephp seemed want me to change the ID field to post_id instead of postID, because the error disappeared after I have changed the primaryKey to post_id. ANy ideas?

    Read the article

  • ASP.NET NamingContainer naming convention

    - by EOLeary
    The Background Hello! I'm working on a project in which the client has required a lot of things to happen on a single page, and this has resulted in a rather large blob of HTML being rendered out to the client browser. The main issue is with input tags (where runat="server" attribute is set), these tend to cause a drastic increase in markup size due to validation, updatepanel triggers, viewstate, and the control markup itself. I've done what I can to reduce the amount of triggers I'm using, I'm compressing the viewstate (to something like 8% of the original viewstate size), I've gotten rid of a lot of ASP.NET Validators and rolled my own, and and I've been using ClientIdMode to reduce the length of the ID attributes of many asp.net elements. All of these combined significantly reduces the amount of HTML being sent to the client, (for example going from 2 megabytes for a request down to 500-600 kb - these are HUGE pages, mind you). The Issue One area which I've been having trouble reducing is simply the auto-generated 'name' attribute of input elements. <input name="ctl00$ctl00$ctl00$_main$_main$_bodyMatterPhase$_phaseTree$ctl00$_taskTree$ctl00$_taskDetails$_detailList$ctrl0$_row$_descriptionText" type="text" value="Investigation Week 1" maxlength="100" id="_taskTree_0__taskDetails_0__detailList_0__row_0__descriptionText_0" style="width:170px;"> As you can see above, the name attribute is 139 out of 297 characters, that's almost 50% of the tag markup taken up by that HUGE name. Does anyone have any ideas on how to stick a hook in somewhere in ASP.NET where I can somehow translate these or generate them differently; say instead of ctl00$ctl00$ctl00$_main$_main$_bodyMatterPhase$_phaseTree$ctl00$_taskTree$ctl00$_taskDetails$_detailList$ctrl0$_row$_descriptionText, it could be a GUID like 0x0AEED4B6445A11E08F873606E0D72085, which is 105 characters shorter. Any help would be greatly appreciated!

    Read the article

  • Naming convention for utility classes in Java

    - by Zarjay
    When writing utility classes in Java, what are some good guidelines to follow? Should packges be "util" or "utils"? Is it ClassUtil or ClassUtils? When is a class a "Helper" or a "Utility"? Utility or Utilities? Or do you use a mixture of them? The standard Java library uses both Utils and Utilities: javax.swing.Utilities javax.print.attribute.AttributeSetUtilities javax.swing.plaf.basic.BasicGraphicsUtils Apache uses a variety of Util and Utils, although mostly Utils: org.apache.commons.modeler.util.DomUtil org.apache.commons.modeler.util.IntrospectionUtils org.apache.commons.io.FileSystemUtils org.apache.lucene.wordnet.AnalyzerUtil org.apache.lucene.util.ArrayUtil org.apache.lucene.xmlparser.DOMUtils Spring uses a lot of Helper and Utils classes: org.springframework.web.util.UrlPathHelper org.springframework.core.ReflectiveVisitorHelper org.springframework.core.NestedExceptionUtils org.springframework.util.NumberUtils So, how do you name your utility classes?

    Read the article

  • Rails reserved words and convention

    - by PatrickLightning
    After having spent a lot of time researching Rails reserved words and implementing, I still have a few questions regarding use. In my example here, I'll consider the reserved word 'time'. Let's say I want to create a class 'Timepiece'. Is it not recommended to use 'timepiece' because the name begins with 'time'? Would it be recommended to use 'time_piece' or to avoid inserting the reserved word at all? My question here is also about use of the exact reserved word within the class like that. Thank you.

    Read the article

  • C# naming convention for extension methods for interface

    - by Sarah Vessels
    I typically name my C# interfaces as IThing. I'm creating an extension method class for IThing, but I don't know what to name it. On one hand, calling it ThingExtensions seems to imply it is an extension class to some Thing class instead of to the IThing interface. It also makes the extension class be sorted away from the interface it extends, when viewing files alphabetically. On the other hand, naming it IThingExtensions makes it look like it is an interface itself, instead of an extension class for an interface. What would you suggest?

    Read the article

  • Java language convention; getters/setters

    - by Skogen
    Public class Example { private int number; public Example(int number){ this.number = number; } public int getNumber(){ return number; } public void setNumber(int number){ this.number = number; } public static void main(String[] args){ Example e = new Example(5); What is preffered when accessing a variable within its own class; "e.number" or "e.getNumber()" ?

    Read the article

  • Java Interfaces/Implementation naming convention

    - by Amir Rachum
    How do you name different classes / interfaces you create? Sometimes I don't have implementation information to add to the implementation name - like interface FileHandler and class SqlFileHandler. hen this happens I usually name the interface in the "normal" name, like Truck and name the actual class TruckClass. How do you name interfaces and classes in this regard?

    Read the article

  • REST verbs - which convention is "correct"

    - by ctacke
    I'm well into implementing a REST service (on a Windows CE platform if that matters) and I started out using IBM's general definitions of using POST for creating (INSERTs) and PUT for updating. Now I've run across Sun's definitions which are exactly the opposite. So my question is, which is the "generally accepted" definition? Or is there even one?

    Read the article

  • Handle/Grip bar convention

    - by tomdemuyt
    Greetings, Because textarea elements do not resize with jquery.touch ( http://plugins.jquery.com/project/touch ), I've put an textarea in a table where the first row allows the user to drag the table around and resize it with the textarea growing/shrinking/moving along. It works well, except that users dont seem to 'get' that they can use the bar to resize/move. I was trying to find some 'grip bar' graphics but google isnt helping me. What is the best way to show users that an element can be moved/resized ? Pointer to graphics ( generators ) would be great. Or, does any one know how to make textarea's movable/resizable ? T.

    Read the article

  • Project Naming Convention Feedback Please

    - by Sam Striano
    I am creating a ASP.NET MVC 3 application using Entity Framework 4. I am using the Repository/Service Pattern and was looking for feedback. I currently have the following: MVC Application (GTG.dll) GTG GTG.Controllers GTG.ViewModels Business POCO's (GTG.Business.dll) This contains all business objects (Customer, Order, Invoice, etc...) EF Model/Repositories (GTG.Data.dll) GTG.Business (GTG.Context.tt) I used the Entity POCO Generator Templates. GTG.Data.Repositories Service Layer (GTG.Data.Services.dll) GTG.Data.Services - Contains all of the service objects, one per aggregate root. The following is a little sample code: Controller Namespace Controllers Public Class HomeController Inherits System.Web.Mvc.Controller Function Index() As ActionResult Return View(New Models.HomeViewModel) End Function End Class End Namespace Model Namespace Models Public Class HomeViewModel Private _Service As CustomerService Public Property Customers As List(Of Customer) Public Sub New() _Service = New CustomerService _Customers = _Service.GetCustomersByBusinessName("Striano") End Sub End Class End Namespace Service Public Class CustomerService Private _Repository As ICustomerRepository Public Sub New() _Repository = New CustomerRepository End Sub Function GetCustomerByID(ByVal ID As Integer) As Customer Return _Repository.GetByID(ID) End Function Function GetCustomersByBusinessName(ByVal Name As String) As List(Of Customer) Return _Repository.Query(Function(x) x.CompanyName.StartsWith(Name)).ToList End Function End Class Repository Namespace Data.Repositories Public Class CustomerRepository Implements ICustomerRepository Public Sub Add(ByVal Entity As Business.Customer) Implements IRepository(Of Business.Customer).Add End Sub Public Sub Delete(ByVal Entity As Business.Customer) Implements IRepository(Of Business.Customer).Delete End Sub Public Function GetByID(ByVal ID As Integer) As Business.Customer Implements IRepository(Of Business.Customer).GetByID Using db As New GTGContainer Return db.Customers.FirstOrDefault(Function(x) x.ID = ID) End Using End Function Public Function Query(ByVal Predicate As System.Linq.Expressions.Expression(Of System.Func(Of Business.Customer, Boolean))) As System.Linq.IQueryable(Of Business.Customer) Implements IRepository(Of Business.Customer).Query Using db As New GTGContainer Return db.Customers.Where(Predicate) End Using End Function Public Sub Save(ByVal Entity As Business.Customer) Implements IRepository(Of Business.Customer).Save End Sub End Class End Namespace

    Read the article

  • Table naming convention?

    - by MattSlay
    In our manufacturing shop, each Employee hits the time clock every time they change Jobs or Machines (work centers) during their work day. Each record created in the Time Clock app has foreign keys that link the record to: the Employee, the Job, and the Machine which they are about to operate. I’m trying to determine the best name for this table… If I were tempted to call it ClockRecords or TimeClockRecords, why wouldn’t I also consider naming it JobTimeRecords, or why not MachineTimeRecords. Any ideas on a good name?

    Read the article

  • Objective C convention: When to use For and when to use With

    - by Howard
    According to the Apple guideline , seems it is confusing, e.g. for method viewWithTag In Java, I would have a method called getViewByTag // Java version, equivalent to viewWithTag in Obj-C But I also found there are some method like objectForKey, so why not just use objectWithKey instead? getObjectByKey or just get // Java version, equivalent to objectForKey, // but why not objectWithKey? Or not viewForKey above?

    Read the article

  • Is "convention over configuration" not violating basic programming principles?

    - by Geerten
    I was looking at the WPF MVVM framework Caliburn.Micro and read that a lot of standard things are based on naming conventions. For example, automatic binding of properties in the View to properties in the ViewModel. Although this seems to be convenient (removes some boilerplate code), my first instinct reaction is that it isn't completely obvious to a new programmer that will read this code. In other words, the functionality of the application is not completely explained by its own code, but also by the documentation of the framework. EDIT: So this approach is called convention over configuration. Since I could not find any questions concerning this, I altered my question: My question is: Is convention over configuration a correct way of simplifying things, or is it violating some programming principles (and if so, which ones)?

    Read the article

  • Calling SDL/OpenGL from Assembly code on Linux

    - by Lie Ryan
    I'm write a simple graphic-based program in Assembly for learning purpose; for this, I intended to use either OpenGL or SDL. I'm trying to call OpenGL/SDL's function from assembly. The problem is, unlike many assembly and OpenGL/SDL tutorials I found in the internet, the OpenGL/SDL in my machine apparently doesn't use C calling convention. I wrote a simple program in C, compile it to assembly (using -S switch), and apparently the assembly code that is generated by GCC calls the OpenGL/SDL functions by passing parameters in the registers instead of being pushed to the stack. Now, the question is, how do I determine how to pass arguments to these OpenGL/SDL functions? That is, how do I figure out which argument corresponds to which registers? Obviously since GCC can compile C code to call OpenGL/SDL, so therefore there must be a way to figure out the correspondence between function arguments and registers. In C calling conventions, the rule is easy, push parameters backwards and return value in eax/rax, I can simply read their C documentation and I can easily figure out how to pass the parameters. But how about these? Is there a way to call OpenGL/SDL using C calling convention? btw, I'm using yasm, with gcc/ld as the linker on Gentoo Linux amd64.

    Read the article

  • What are your Common Magento Configuration Mistakes?

    - by Alan Storm
    If there's something that everybody hates about Magento it's endlessly configuring your modules before being able to write some code. I'm trying to collect a list of common Magento configuration errors for a future project that's I'm close to launching. I'm looking for specific examples of things like using the wrong naming convention on classnames, forgetting the <class /> wrapper when setting up grouped class names. Little things like that that drive you batty for hours until you realize your error. The more details the better!

    Read the article

  • What is the advantage of the 'src/main/java'' convention?

    - by Chris
    I've noticed that a lot of projects have the following structure: Project-A bin lib src main java RootLevelPackageClass.java I currently use the following convention (as my projects are 100% java): Project-A bin lib src RootLevelPackageClass.java I'm not currently using Maven but am wondering if this is a Maven convention or not or if there is another reason. Can someone explain why the first version is so popular these days and if I should adopt this new convention or not? Chris

    Read the article

  • Pass a Delphi class to a C++ function/method that expects a class with __thiscall methods.

    - by Alan G.
    I have some MSVC++ compiled DLL's for which I have created COM-like (lite) interfaces (abstract Delphi classes). Some of those classes have methods that need pointers to objects. These C++ methods are declared with the __thiscall calling convention (which I cannot change), which is just like __stdcall, except a this pointer is passed on the ECX register. I create the class instance in Delphi, then pass it on to the C++ method. I can set breakpoints in Delphi and see it hitting the exposed __stdcall methods in my Delphi class, but soon I get a STATUS_STACK_BUFFER_OVERRUN and the app has to exit. Is it possible to emulate/deal with __thiscall on the Delphi side of things? If I pass an object instantiated by the C++ system then all is good, and that object's methods are called (as would be expected), but this is useless - I need to pass Delphi objects. Edit 2010-04-19 18:12 This is what happens in more detail: The first method called (setLabel) exits with no error (though its a stub method). The second method called (init), enters then dies when it attempts to read the vol parameter. C++ Side #define SHAPES_EXPORT __declspec(dllexport) // just to show the value class SHAPES_EXPORT CBox { public: virtual ~CBox() {} virtual void init(double volume) = 0; virtual void grow(double amount) = 0; virtual void shrink(double amount) = 0; virtual void setID(int ID = 0) = 0; virtual void setLabel(const char* text) = 0; }; Delphi Side IBox = class public procedure destroyBox; virtual; stdcall; abstract; procedure init(vol: Double); virtual; stdcall; abstract; procedure grow(amount: Double); virtual; stdcall; abstract; procedure shrink(amount: Double); virtual; stdcall; abstract; procedure setID(val: Integer); virtual; stdcall; abstract; procedure setLabel(text: PChar); virtual; stdcall; abstract; end; TMyBox = class(IBox) protected FVolume: Double; FID: Integer; FLabel: String; // public constructor Create; destructor Destroy; override; // BEGIN Virtual Method implementation procedure destroyBox; override; stdcall; // empty - Dont need/want C++ to manage my Delphi objects, just call their methods procedure init(vol: Double); override; stdcall; // FVolume := vol; procedure grow(amount: Double); override; stdcall; // Inc(FVolume, amount); procedure shrink(amount: Double); override; stdcall; // Dec(FVolume, amount); procedure setID(val: Integer); override; stdcall; // FID := val; procedure setLabel(text: PChar); override; stdcall; // Stub method; empty. // END Virtual Method implementation property Volume: Double read FVolume; property ID: Integer read FID; property Label: String read FLabel; end; I would have half expected using stdcall alone to work, but something is messing up, not sure what, perhaps something to do with the ECX register being used? Help would be greatly appreciated. Edit 2010-04-19 17:42 Could it be that the ECX register needs to be preserved on entry and restored once the function exits? Is the this pointer required by C++? I'm probably just reaching at the moment based on some intense Google searches. I found something related, but it seems to be dealing with the reverse of this issue.

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >