I've seen a "_" as variable prefix. What's that mean?

Thanks for replying!

More precisely, it often means this is a class-level variable (that is, one defined for the class - could be a static class variable or a per-object instance variable). By "often" I mean that this is a common coding convention, to help distinguish class-level variables from local variables. Without such a convention, it is easy to unwittingly mask your class-level variable with a local one using the same name:
class Zorch
  private boolean enabled;
  ... (many source lines later) ...
  public void zorchBlast()
    boolean enabled;  // this declaration masks the class-level variable
    enabled = true;   // only sets local boolean, not class-level one
    }(What's really bad is if the local declaration of enabled isn't at the beginning of zorchBlast, but instead is buried 10-20 lines into the method. I saw this in a code review just yesterday, it really happens.)
With the coding convention "Prefix all class-level variables with '_'" this code now looks like:
class Zorch
  private boolean _enabled;
  public void zorchBlast()
    boolean enabled;  // this declaration is clearly local, no '_'
    boolean _enabled; // this declaration masks the class-level one,
                      // but is easier to spot - hey, what's this local variable
                      // doing with a leading '_'?
    (etc...)Other common conventions to highlight class-level variables:
- leading 'm' or 'm_', meaning "member" (popularized by Microsoft)
- trailing '_'
- always reference class-level variables using explicit 'this.'
But there is nothing inherent in the '_' prefix that this must be a class-level variable, and there is nothing in the Java compiler to enforce this one way or another, it is just a common style.
(My personal preference is trailing '_'. I think my aversion to prefix '_' goes back to my C++ days, when some compilers had problems with variables with leading '_'s. Also, I find it easier to say these variable names - "enabled_" is just spoken "enabled", but I find the need to say "_enabled" as "underscore enabled" - when either discussing the code with someone else, or even just verbalizing it to myself while coding.)
-- Paul

Similar Messages

  • TS3276 "message failed because you have exceeded your sending limit."  Has anyone seen this before & what does it mean?

    What does this mean?  Has anyone seen before?

    Most e-mail servers impose limits on how many messages you can send per day and how many different e-mail addresses you can send messages to per day. This is a measure to prevent spam, and you're unlikely to hit those limits unless you're sending messages to a very large group of people. Generally, those limits are somewhere in the hundreds.
    If you haven't been sending that much e-mail, or to that many recipients, then your e-mail account may have been hacked and used to send spam. See:
    Someone is sending messages from my e-mail address!

  • How define a global variable in a class that all the methods will recognize

    hi friends,
    i need to define a global variable in a class that all the methods will recognize it.
    any suggestions?
    thanks,
    dana.

    Dera Dana,
    In se24, create your own "Z" class.
    Open the Attributes tab.
    Insert your variable in the declaration part.
    EQ:
    Attribute     Level                       Visibility   Typing      Associated Type         Description        
    ITAB     Instance Attribute     Public     Type     Structure name     Description
    In the Layout of View page,
    <phtmlb:formLayoutDropDownListBox id                = "Dropdown"
                                              label             = "Drop Down"
                                              table             = "<%= controller->Itab %>"
                                              nameOfKeyColumn   = "CODE"
                                              nameOfValueColumn = "VALUE"
                                              selection         = "<%= controller->feild to be selected %>"
                                               />
    Hope this will be helpful
    Regards,
    Gokul.N

  • I have a HD video clip (MPEG 4), able to watch in VLC in my Mac-book-pro, but not in Quicktime player and FCP X - just seen as full green. Help please to view in FCP X by changing the format or what ever thats required.

    I have a HD video clip (MPEG 4), able to watch in VLC in my Mac-book-pro, but not in Quicktime player and FCP X - just seen as full green. Help please to view in FCP X by changing the format or what ever thats required.  Thank you.

    Thanks for your reply. This video was recorded by my own professional camera, Sony PMW EX 3, two years back. But I am neither a professional cameraman nor an editor. I am just like a beginner in both.  I didnt have space in my storage device, so I just copied all my clips, thinking I can edit it latter, without recompressing or editing or whatever I should have done it at that point of time.  Now I need to edit it and use it in my profession. I am very upset.  Please help me in going step by step to get it in FCP X for editing.  Also I would like to know, do I need to buy the Compressor 4 for any reason. I dont mind in buying, if you think it is going to be useful for some reason.  Thank you very much in anticipation for any kind of proper guidance.

  • I have an itouch 4G...problem is while on landscape mode whenever i press down left of the screen edge..ripples are seen ...similarly while we press LCD tv screen in between...and circles are seen around our fingre...what to do??

    I have an itouch 4G...problem is while on landscape mode whenever i press down left of the screen edge..ripples are seen ...similarly while we press LCD tv screen in between...and circles are seen around our fingre...what to do??

    - You can make an appointment at the Genius Bar of an Apple store and see what they say or call AppleCare
    - Just do not press hard.  The iPod screen includes an LCD screen

  • Any idea what this errorr means? the data type of the reference does not match the data type of the variable

    I am using Veristand 2014, Scan Engine and EtherCat Custom Device.  I have not had this error before, but I was trying to deploy my System Definition File (run) to the Target (cRio 9024 with 6 modules) and it failed. It wouldn't even try to communicate with the target. I get the 'connection refused' error.  
    I created a new Veristand project
    I added the Scan Engine and EtherCat custom device.
    I changed the IP address and auto-detected my modules
    i noticed tat Veristand didn't find one of my modules that was there earlier. (this week)
     So, i went to NiMax to make sure software was installed and even reinstalled Scan Engine and Veristand just to make sure.
    Now, it finds the module, but when i go to deploy it getsto the last step of deploying the code to the target, and then it fails.
    Any thoughts?
    Start Date: 4/10/2015 11:48 AM
    • Loading System Definition file: C:\Users\Public\Documents\National Instruments\NI VeriStand 2014\Projects\testChassis\testChassis.nivssdf
    • Initializing TCP subsystem...
    • Starting TCP Loops...
    • Connection established with target Controller.
    • Preparing to synchronize with targets...
    • Querying the active System Definition file from the targets...
    • Stopping TCP loops.
    Waiting for TCP loops to shut down...
    • TCP loops shut down successfully.
    • Unloading System Definition file...
    • Connection with target Controller has been lost.
    • Start Date: 4/10/2015 11:48 AM
    • Loading System Definition file: C:\Users\Public\Documents\National Instruments\NI VeriStand 2014\Projects\testChassis\testChassis.nivssdf
    • Preparing to deploy the System Definition to the targets...
    • Compiling the System Definition file...
    • Initializing TCP subsystem...
    • Starting TCP Loops...
    • Connection established with target Controller.
    • Sending reset command to all targets...
    • Preparing to deploy files to the targets...
    • Starting download for target Controller...
    • Opening FTP session to IP 10.12.0.48...
    • Processing Action on Deploy VIs...
    • Setting target scan rate to 10000 (uSec)... Done.
    • Gathering target dependency files...
    • Downloading testChassis.nivssdf [92 kB] (file 1 of 4)
    • Downloading testChassis_Controller.nivsdat [204 kB] (file 2 of 4)
    • Downloading CalibrationData.nivscal [0 kB] (file 3 of 4)
    • Downloading testChassis_Controller.nivsparam [0 kB] (file 4 of 4)
    • Closing FTP session...
    • Files successfully deployed to the targets.
    • Starting deployment group 1...
    The VeriStand Gateway encountered an error while deploying the System Definition file.
    Details:
    Error -66212 occurred at Project Window.lvlibroject Window.vi >> Project Window.lvlib:Command Loop.vi >> NI_VS Workspace ExecutionAPI.lvlib:NI VeriStand - Connect to System.vi
    Possible reason(s):
    LabVIEW: The data type of the reference does not match the data type of the variable.
    =========================
    NI VeriStand: NI VeriStand Engine.lvlib:VeriStand Engine Wrapper (RT).vi >> NI VeriStand Engine.lvlib:VeriStand Engine.vi >> NI VeriStand Engine.lvlib:VeriStand Engine State Machine.vi >> NI VeriStand Engine.lvlib:Initialize Inline Custom Devices.vi >> Custom Devices Storage.lvlib:Initialize Device (HW Interface).vi
    • Sending reset command to all targets...
    • Stopping TCP loops.
    Waiting for TCP loops to shut down...
    • TCP loops shut down successfully.
    • Unloading System Definition file...
    • Connection with target Controller has been lost.

    Can you deploy if you only have the two 9401 modules in the chassis (no other modules) and in the sysdef?  I meant to ask if you could attach your system definition file to the forum post so we can see it as well (sorry for the confusion).  
    Are you using any of the specialty configurations for the 9401 modules? (ex: counter, PWM, quadrature, etc)
    You will probably want to post this on the support page for the Scan Engine/EtherCAT Custom Device: https://decibel.ni.com/content/thread/8671  
    Custom devices aren't officially supported by NI, so technical questions and issues are handled on the above page.
    Kevin W.
    Applications Engineer
    National Instruments

  • How do I create an automator variable for a path that includes a date?

    I like to use Image Capture to scan documents into a hierarchy of folders under my ~/Documents directory that are organized by year and document type.  For example, I have
    ~/Documents/archives/2011
         /Misc
         /Utilities
    and
    ~/Documents/archives/2012
         /Misc
         /Utilities
    for archiving miscellaneous docs and utilities bills. Now, switching folders in Image Capture is annoying so I want to use the Automator support built into that app to direct the scanned images to ~/Documents/archives/<Current Year>/Misc or ~/Documents/archives/<Current Year>/Utilities.  I was able to do this with separate Automator workflows, each with a hard-coded path to the destination folder.  For example,
    What I would like to do is use an Automator variable to dynamically determine ~/Documents/archives/<Current Year>/Misc.  I see variables for Home, Documents, and Current Year.   However, when I try to create a new path variable it only lets me choose a full path to a Finder folder.  How do I combine Documents and Current Year variables with the "archives" and "Misc" folder names to create a new path variable?

    Well now, you went and made me learn something today.  In the Variables Library, under Utilities, is a variable named AppleScript.  You can put a small script into this that evaluates to your path, for example:
    ((((path to documents folder) as text) & "archives:" & (year of (current date)) as text) & ":Utilities") as alias
    If the script evaluates to a proper path, it can be used wherever any other path can - you can experiment by looking at the results of a Get Value of Variable action.

  • How do you use the windows User32.dll Library functions to read variables from other applications that are running

    I am trying to read a text box from a programme running at the same time as my Labview application using calls to the Windows
    User32.dll. I believe I need to find the window handle for the 'form' containing this text string and use this together with
    various other defined input variables to access the sting.
    I have no experience of using this 'Call Library Function Node', but have an understanding of the 'C' programming language. Does anyone have
    example Labview code showing how this might be done.
    Thanks

    If you're trying to access information that's being displayed in the window of another application and that application has no ActiveX interface, then yes, Windows calls can be used. There's a very good example on calling DLLs that ship with LabVIEW. Open the Example Finder (Help->Find Examples) and switch to the Search tab. Enter "Call" in the search box and open the VI "Call DLL". Run the VI, select any of the examples, and click the "Open Example VI..." button. That shows you how to call a DLL.
    Now, given that you have no experience in calling DLLs, have only an "understanding" of C (which to me means you have never written something like a DLL), and don't seem to know that much about what Windows functions you may need, you're going to find this route pretty difficult, especially since you have to deal with Windows API calls, which are not always that easy to do from LabVIEW.
    Let me propose an alternate solution. Go over to http://www.autoitscript.com/autoit3/ and download AutoIt. This is an automation tool that allows you to automate just about anything you want. It has an ActiveX interface that you can call from LabVIEW. I've attached an example VI that shows you how to use it to get the value of a text box from one of the tabs in the computer "System Properties" control panel applet.
    Attachments:
    AutoIt Example (v7).vi ‏25 KB

  • How create a variable in the TVARVC that calculate the last week

    Hi Gurus,
    i need create a Variable in the table TVARVC that calculate which was the last week to run a Program in BW,  i have no idea how can i do it, where do i must start? please can you tell me step by step, i will really appreciate it

    This blog should help you create a variable in TVARVC table:
    http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/9075b11a-6e43-2c10-b7be-cfa0e97ec0cc?quicklink=index&overridelayout=true
    you can leave out the information broadcasting part. But can you elaborate what exactly is the requirement.

  • XSU doesn't support bind variables - how dumb is that?

    I am using XSU to generate XML from a SQL statement using class OracleXMLQuery. Either I am blind or stupid or there is no support for bind variables in this class! I have used DBMS_xmlquery in PL/SQL before and this does support bind variables, I naturally assumed the Java equivalent would also have this. The lack of bind variable support means a huge performance hit as every single SQL statement will be treated as unique and will require hard parsing on the server!
    Is there another Java XML utility I can use for generating XML from a SQL statement that does support bind variables? I have trawled through the Oracle documentation and I am getting very confused and lost.
    Thanks,
    Steve

    makaidog,
    Read get rid of community toolbar: Apple Support Communities.

  • Using Formulas and Variables To Count Rows That Meet Certain Conditions

    I have a web intelligence report designed that shows results of shipments that arrived and departed in a given period and the mode of transport (air, ocean, motor).   I've tried building formulas to give me counts for example of the number of shipments arrived via ocean, number of shipments that departed via ocean, and so on.
    I tried various the Count and If functions in different ways but I can't seem to get them to work.  What is the correct logical set of variables or formulas I need to build so that I can display summarized information in my report that shows:
    Shipments Arrived via Ocean
    Shipments Arrived via Air
    Shipments Departed via Ocean
    Shipments Departed via Air
    Key report fields are [Shipment Identifier] , [Mode]=Ocean, Air, Motor, and [Status] = Arrive;Depart

    You should be able to do one of the following:
    1. Create a measure variable ShipmentCount as
    =Count([Shipment Identifier])
    In the report, use Mode, Status and ShipmentCount. This will give an aggregated count per Mode per Status.
    2. Create a formula for each of Mode/Status combination like
    =Count([Shipment Identifier]) where ([Mode] = "Ocean" and [Status] = "Arrive")

  • Pass variable name to class that modifies it

    in my main fla:
    import Preloader;
    var prel:Preloader = new Preloader();
    var toPass=9;
    prel.loads(this,stage,"toPass",2);
    in my Preloader.as:
    package  {
              import flash.display.Sprite;
              import flash.display.Stage;
              import flash.events.Event;
         public class Preloader extends Sprite {
              private var stageRef:Stage;
              private var mainTimeLineRef:*;
              public function loads(a,b,c,d):void{
                   this[c]=d
    I want to pass the toPass var to my class that has to edit that, how can i do?  (i know that i could simply write toPass = d)

    i'm not sure what you're trying to do but to pass a variable's value, use:
    framode wrote:
    in my main fla:
    import Preloader;
    var prel:Preloader = new Preloader();
    var toPass:int=9;
    prel.loads(stage,toPass);
    in my Preloader.as:
    package  {
              import flash.display.Sprite;
              import flash.display.Stage;
              import flash.events.Event;
         public class Preloader extends Sprite {
              private var stageRef:Stage;
              private var mainTimeLineRef:*;
    private var toPassRef:int;
              public function loads(a:Stage,b:int):void{
    stageRef=a;
                 toPassRef=b;

  • JSP Accessing variables in a class that are located outside of the class

    I am having a problem accessing a nested HashMap in a function. The HashMap is defined before the HTML starts and the function is located near the end (Shouldn't make a difference).
    List tires = databean.getTires();
    Map frontTireInfo = (Map)tires.get(0); //Works
    Map rearTireInfo = (Map)tires.get(tires.size()-1); //Works
    Map neumaticos = new HashMap();
    for(Iterator itr=tires.iterator();itr.hasNext();) {
         HashMap tempTire = (HashMap)itr.next();
         String tirePosition = (String)tempTire.get("position");
         neumaticos.put(tirePosition, tempTire);
    <HEAD>. . . </HEAD>
    <BODY>. .
    <%=getTireInspectionTable("FRONT_RIGHT")%> //Works
    </BODY>
    I believe the above stores the tempHash in the tirePosition.
    <%!
         private String getTireInspectionTable(String tirePos) {
              StringBuffer sb = new StringBuffer();
         sb.append("<input type='text' value=" +
    *****<% neumaticos.get(tirePos) %> + " />" ) illegal start of expression
    return sb.toString();
    %>
    Why can I not access neumaticos in the method?
    I am able to call other methods from this one, but not variables.
    If it is possible, please help point me in the correct direction.
    Thanks in advance,
    Mike

    MPDreiding wrote:
         sb.append("<input type='text' value=" +
    *****<% neumaticos.get(tirePos) %> + " />" ) illegal start of expression
              Illegal start of expression sounds like a compile time error so your syntax is wrong. Why are you using scriptlet
    <% neumaticos.get(tirePos) %>
    inside of declaration? I think that's the problem. Just remove <% and %> and see what happens.

  • What's the meanning of "bad status" in DSC alarm config for Shared Variable?

    as the title
    LabVIEW 8.20程序设计从入门到精通已经出版,敬请关注!
    欢迎访问LabVIEW学习乐园: http://labviewstudy.blog.edu.cn

    Can I read the quality  of an OPC tag which binded with a Shared Variable by using this  "status"?
    LabVIEW 8.20程序设计从入门到精通已经出版,敬请关注!
    欢迎访问LabVIEW学习乐园: http://labviewstudy.blog.edu.cn

  • BW -  Can Wild Carding be done  with Variables or what ?

    Hello All,
    Topic is "Can Wild Carding be done in BW" ?
    Need direction and solutions to this question. My definition is the abiliy to select key data within a  characteristic to generate a report. The data can be any part of the characteristic. An example of this is 0Fund, 10 characters; the cleint wants\needs to pull 'xyzz' from the field.
    IN the old system, the client would type in '*xyzz' to capture the requested data. Does BW possess this capability?
    Thank you all in advance for your suggestions
    Jim

    Hi Jeff,
    I tried your suggestion and got the same results, no data and there is data in the cube.
    When the query was excuted, '*' was selected from the dropdown box, then the middle 4 digits of the fund was entry in the filter field. Have any idea's why it might not be working.
    The variable was created with the wizard, with the following options; Processing By = User Enty/Default Value, Selection Option, Default = none.
    Do see anything wrong?
    Thanks In advance.......Jim

Maybe you are looking for

  • RFC_ERROR_SYSTEM_FAILURE

    Try to execute a function (ECATT_EXECUTE) with JCO. It is okay, when SAP system ist Release 6.40 but on a SAP 7.0 system it fails with: com.sap.mw.jco.JCO$Exception: (104) RFC_ERROR_SYSTEM_FAILURE: Zugriff über 'NULL' Objektreferenz nicht möglich.   

  • ERROR WHEN START ESR: Cannot activate endpoint for message-driven bean

    Hi Gurus, We just upgraded our PI 7.1 to SP11, and we have finished it successfully, then we go to the /rep/start/repository.jnlp to start the ESR but some error happens,while the ID,SLD and RWB works well, below is the detailed message: Application

  • Deactivate inspection type 08 against mvt type 413

    Dear Sir Whenever planning person does 413 oe 413E movement for sales order transfer there is an error message combination of stock error and when i deactivate 08 from material master, they are able to do it.My concern why the error is shown nor insp

  • Need an efficient String searching algo

    Hi ! i'm in desperate need of the algorithm i hope some of you may already have it. actually i'm developing a chat application and i need to implement the functionality of inserting images on finding special tokens in the text..i'm using JTextPane an

  • Errors in LDAP configuration with Shared Services

    Dear sirs, we are getting errors in LDAP configuration with Shared Services. Base DN is ou=Grupos,cn=East,o=SSGH,c=br,o=Grupo East The group cn is cn=AH In LDAP log you can see the applications is searching the group: "ou=Grupos,cn=East,o=SSGH,c=br,o