Defining constants

I am still completely baffled by my misbehaving tables, so I
thought I would try
Murray's suggestion and get rid of the colspans and rowspans.
While I was about
it, I thought would be nice to centralise all my magic
numbers (such as the
colour of the body of the table, the tables containing the
images, and so on) in
the CSS file.
For example I might wish to define body_colour as #f8f8ff.
This ought to be
(and undoubtedly is) dead easy, but, despite all the books on
CSS I have lying
around, none list "defining constants", or any equivalent I
can think of, in the
index. Nor can I find any examples which demonstrate how to
do this.
So the question is
a. How do I define a constants in the CSS file, and
b. How do I use it in the HTML?
[email protected]

First, please get rid of the spaces in your filenames!
<img src="Images/Mr Vet.jpg"
Also, note that any given ID can only be used ONCE on any
page -
<table id="pictureframe">
<table id="pictureframe" align="right">
If you want to do this kind of thing, make it a custom class
selector (e.g.,
<table class="pictureframe">
, or figure out how to use descendent selectors
to cascade into each desired element. You double instances of
#pictureframe
is most likely the cause of your results.
Your CSS is way unnecessarily verbose, redundant, and
cluttered, but I
suspect that's not what you are looking for right now.
> The image frames clearly have 2px or 3px of padding, but
I cannot
> find out where this value comes from, or how to change
it.
Most likely from the text box within which all inline tags
are rendered.
Try adding "display:block" to your image CSS to see if that
would fix this.
> However the pictures are in the editable region of the
template, so if I
> specified the values in the template I would be unable
to modify the
> appearance
> of the images once the pages had been created.
Sure you can. Just add a little stylesheet to the editable
region in the
head of the child page to override the base CSS.
Murray --- ICQ 71997575
Adobe Community Expert
(If you *MUST* email me, don't LAUGH when you do so!)
==================
http://www.dreamweavermx-templates.com
- Template Triage!
http://www.projectseven.com/go
- DW FAQs, Tutorials & Resources
http://www.dwfaq.com - DW FAQs,
Tutorials & Resources
http://www.macromedia.com/support/search/
- Macromedia (MM) Technotes
==================
"Clancy" <[email protected]> wrote in message
news:[email protected]...
> Bonnie <"kroko[Occam]"@pixelplum.com> wrote:
>
>>It would be better to post a link to the page;
otherwise it's still a
>>bit hard to see what you are trying to do. I assume
from the above you
>>are placing all your photos inside single-cell
tables?
>
> Yes; I have put an example of what I am trying to do at
>
http://www.cybec.com.au/Test_nstdpage.htm
>
> I have got a little further with my experiments. The
specification for
> the
> picture frame is now
>
> #pictureframe {width: 5%; background-color: #d8d8f0;
border: 5px solid
> #88d8e0;
> }
>
> I have finally got the border to work properly, though I
had no idea why
> it
> wasn't working half an hour ago -- I could have sworn
that I had exactly
> the
> same code that have now. I don't want a border at all; I
just want to
> specify
> some padding. The image frames clearly have 2px or 3px
of padding, but I
> cannot
> find out where this value comes from, or how to change
it.
>
> However, with what I have got working, I can fake the
result I wants by
> setting
> the border colour to be the same as the background
colour. I guess this
> will
> do, unless someone can tell me how to make the padding
work.
>
> And, in case you are wondering why I want to specify
these values in the
> CSS
> file, rather than the template, if they are in the CSS
file I can change
> the
> appearance of every image on the web site by changing
the specification of
> the
> picture frame.
>
> However the pictures are in the editable region of the
template, so if I
> specified the values in the template I would be unable
to modify the
> appearance
> of the images once the pages had been created.
>
> [email protected]

Similar Messages

  • Right way of defining constants - Interfaces or Classes?

    Two widely used ways to define constants in java projects are:
    1. Interfaces - Define constants in interfaces, they automatically become static, final and then implement the interface in concrete classes that need those constants.
    2. Classes - Use normal classes and define explicitly as static, final. Use CLASS_NAME.CONSTANT_NAME to access the constant in concrete classes.
    I have gone through the web on Best-practices for defining constants and its strongly recommended for not using Interfaces for defining constants.
    "The constant interface pattern is a poor use of interfaces. That a class uses some constants internally is an implementation detail. Implementing a constant interface causes this implementation detail to leak into the class's exported API. It is of no consequence to the users of a class that the class implements a constant interface. In fact, it may even confuse them. Worse, it represents a commitment: if in a future release the class is modified so that it no longer needs to use the constants, it still must implement the interface to ensure binary compatibility. If a nonfinal class implements a constant interface, all of its subclasses will have their namespaces polluted by the constants in the interface. " from     Effective Java, Joshua Bloch
    What is your take on this?
    Rgds

    I have gone through the web on Best-practices for defining constants and its strongly recommended for not using Interfaces for defining constants.
    "The constant interface pattern is a poor use of interfaces. That a class uses some constants internally is an implementation detail. Implementing a constant interface causes this implementation detail to leak into the class's exported API. It is of no consequence to the users of a class that the class implements a constant interface. In fact, it may even confuse them. Worse, it represents a commitment: if in a future release the class is modified so that it no longer needs to use the constants, it still must implement the interface to ensure binary compatibility. If a nonfinal class implements a constant interface, all of its subclasses will have their namespaces polluted by the constants in the interface. " from     Effective Java, Joshua Bloch
    I don't like grouping constants into an interface. I prefer keeping them closer to the classes that use them.
    %

  • Can you define constants in Report Painter?

    Hi, I'm new to Report Painter and SAP in general. I was just wondering if it's possible to define constants that are visible across reports. e.g. In the header text for all our reports, we want our company name to be displayed. But instead of hardcoding it, we want to retrieve it from a constant or variable.
    Does anyone know if this is possible?

    Hi Andrew,
    Thanks for the response but this isn't exactly what I was looking for. From my understanding, the "Sel. Parameters" button allows you to access and display values that were entered by the user in the selection screen of the report (correct me if I'm wrong). What I'm aiming for is something like a global variable defined on the backend that all reports can access.
    I've looked at the other buttons that you pointed out, but it seems like I'm only able to use some pre-defined tables and fields. Does this mean that there isn't any way for me to define and use my own customized variables for reports?
    Thanks,
    Carlo
    Edited by: CarloInting on Jul 21, 2009 5:45 AM

  • How to set pre-defined constants via FXML

    Does anymode know how to set a pre-defined constant like javafx.scene.control.Control.USE_PREF_SIZE via FXML when you create a node?
    Instead of using a fixed value like this
       <Label text="Last Name:" minWidth="100" />I would like to use one of the predefined sentinel values like this.
       <Label text="Last Name:" minWidth="USE_PREF_SIZE" />The above example does not seem to work and I have the feeling that this is currently not possible at all.

    How did you get that working? When I use the following file I only get a warning that "javafx" is not defined.
    Defining var A seems to work but it fails on var B. It seems to be impossible to access anything outside the
    java... hierarchy. Is there anything else you have to define?
    <?xml version="1.0" encoding="UTF-8" ?>
    <?language javascript?>
    <?import javafx.scene.*?>
    <?import javafx.scene.layout.*?>
    <?import javafx.scene.control.*?>
    <StackPane xmlns:fx="http://javafx.com/fxml" >
         <fx:script>
              var A = java.awt.Component.BOTTOM_ALIGNMENT;
              var B = javafx.scene.control.Control.USE_PREF_SIZE;
         </fx:script>
    </StackPane >   

  • Defining constants/enums with const in JavaScript

    Hi folks,
    I like to define constant enums like the InDesign DOM already provides, e.g.:
    SpecialCharacters.FORCED_LINE_BREAK
    StateTypes.DOWN
    etc.
    I like to define such enums too. The only approach I found was:
    const MY_ENUM = {TOP:"top",DOWN:"down"}
    But this is not write-safe. I can add properties/functions to MY_ENUM as well as change the value of TOP. Thats not desirable.
    Whereas the InDesign DOM enums are readonly. The enum object as well as the value/property. How can I define such type with JavaScript?
    Thanks for your comments
    Cheers Tino

    Alternatively, it is sufficient if you create an output terminal named CO in this case. No need to connect it, of course.
    LabVIEW Champion . Do more with less code and in less time .
    Attachments:
    FormulaNode.gif ‏3 KB

  • What is the best way to define constants in SOA ?

    Hi,
    What is the best way to define constants in SOA/BPEL ?

    I want to define at composite level. I have several BPELs in my composite. I have lot of Status and some other codes I need to check/compare/assign in assign activity and xslt transformations
    Ii can use BPEL preferences , but they only applies to that particular BPEL. I want to define all my codes in one place at composite level.
    Thanks
    --Sreeny
    Edited by: sreeny on May 29, 2012 8:59 AM

  • Define constant in query 3.5

    In the moment I use a hierarchy variable and fill this variable via VBA makro. ( I have 4 different values (hierarchy nodes) for the variable)) But the customer wants to avoid VBA makro.
    The variable is used in a row structure different times.
    The variable should get a fixed value inside the query at one place. (Use default value is not an option) and then 4 different queries with different values should be stored.
    So I want to use a constant instead of a variable. But where to define a constant (as used in a programming language) in the query designer 3.5 ?  Or is there an option in  query designer 7.0 ?
    There exits u201Cconstant selectionu201D but this brings no solution here.
    In cell definitions there is the possibility to use a help cell (on the low left) and reference on that cell in other cells. But this works only in the cell grid. Outside this help cell canu2019t be referenced.
    Hope someone was an idea u2026..

    Hello,
    if you want the place the constant value as some numeric and use it for your calculations, then u can create a formula/CKF and key the nos e.g 40 and save it.Now u can use it.
    else,
    you can create a formula variable and populate the required value in it.
    Also u can write an exit to populate teh exit variable to the required constant value.
    Reg,
    Dhanya

  • Defining constants in formula node

    I apologize for the seemingly elementary level of this question, but nonetheless it continues to puzzle me. I am trying to enter several constants in a formula node and continually get the error message 'undefined variable' for the first defined. An example is shown below for the statement: 'CO = 192600;'
    Error on line 1 is marked by a '#' character: "CO# = 192600;
    I feel there is a problem with the way i am trying to define the constant (CO). Am I missing something? Since there are so many constants, I prefer to define the constants within the node instead of inputing on the border. Thanks in advance.
    Philip

    Alternatively, it is sufficient if you create an output terminal named CO in this case. No need to connect it, of course.
    LabVIEW Champion . Do more with less code and in less time .
    Attachments:
    FormulaNode.gif ‏3 KB

  • Defined constants like C?

    I'm working on an app that configures external instruments by reading and writing their registers. Each register can be 1 of 3 types, 16 bit integers (signed or unsigned), 32 bit integers (signed or unsigned) or 32 bit IEEE floating point. I thought that I would approach this by having 2 variables for each register to hold values, a long for integer values, and a float for floating point, and a 3rd variable to hold the type for the variable.
    In C I would probably have defined some constants with the preprocessor to make this easier and more readable:
    #define INT16     0
    #define INT32     1
    #define FLT32     2Then in the code I could use switch statements or comparisons to the above constants in a very readable way ei:
    if (Reg.Type == INT32) {
        // handle Int 32 types here
    }What's the "right" approach in Java?

    static final int INT16 = 0;
    static final int INT32 = 1;
    static final int FLT32 = 2;I was informed by Java gurus that declaring variables as static final is equivalent to C constants inasmuch asstatic final int INT16 = 0;
    if (INT16 == 0) System.out.println("INT16 = 0");is equivalent to (i.e. generates the same bytecode as):System.out.println("INT16 = 0");Doug

  • Specifying the Universal path, while defining constant path

    Hello All,
                   Whenever I am declaring the constant path, i have to define the path like "E:/ New folder/......vi", which can't be run whenever i shift my project to another pc or if i run the application at another pc, so is there any other possibilities to define the path so that it can be defined as the universal path that, whenever it runs, it take that vi from that universal path, not from static path.
    Thank you,
    Rujuta

    Hi friends,
                   What problem you are facing now, i was facing that long back. So finally i came with good method. 
    In projects always use relative path instead of absoute path. In the same folder create one udl file & for your VI create path for UDL file as follow...
    #1 > use for build path(From shortcut menu)
    #2 > First(Top) path input use as application directory.vi..
    #3 > in the second(Below) input type only udl file name with extension.
    #4 > Output will be always relative.............
                                              Now you can also verify this folder into another directory or other PC as well.
    With Regards
    Ranjeet Singh 
    Kudos are always welcome if you got solution to some extent.
    I need my difficulties because they are necessary to enjoy my success.
    --Ranjeet

  • Specifying tables in CSS (was Defining constants)

    Following some suggestions from Gary, I modified my table
    specification to
    read:
    .pictureframe {width: 5%; background-color: #d8d8f0; }
    .pictureframe td{padding: 5px; }
    In the HTML file this is invoked with:
    <table class="pictureframe" align="left"> [or as
    required
    This worked fine, except that if I had three pictures
    together aligned
    respectively left, centre and write, Dreamweaver did not
    display them correctly,
    but drew the left and centred images on top of each other.
    Gary also suggested replacing the 'align' statement with a
    'floa' statement in
    the CSS. This meant that I had to have separate styles for
    each alignment, so I
    introduced three new styles:
    .pf_l, .pf_m, .pf_r {width: 5%; background-color: #d8d8f0; }
    .pf_l, .pf_m, .pf_r td {padding: 5px; }
    .pf_l {float: left; }
    .pf_m {float: none; }
    .pf_r {float: right; }
    This introduced a new set of problems. Firstly style 'pf_m'
    takes up the
    default alignment of the cell it is in, instead of being
    centred, as I wanted,
    so to get it centred I still had to add an align = centre
    statement in HTML, and
    secondly the image drawn with pf_r has a wider border than
    the others. I cannot
    see why this should be so.
    A page demonstrating these various effects is at:
    D:\Websites\cybec\Test_nstdpage.htm
    Gary also complained "there's no such attribute as
    "bordercolor". Maybe strictly
    so, but you can hardly blame me for not knowing that.
    Dreamweaver doesn't
    complain about it, it works, and O'Reilly's definitive guide
    to HTML and XHTML
    has numerous references to it. I had to look for some time to
    find a statement
    that it was 'nonstandard' in one of these references.
    [email protected]

    > I went there and by mistake I reformatted the whole
    drive. I hope that's
    > OK....
    I guess that's why when I went there it was blank.
    W
    "Murray *ACE*" <[email protected]> wrote
    in message
    news:[email protected]...
    > > This worked fine, except that if I had three
    pictures together aligned
    > > respectively left, centre and write, Dreamweaver
    did not display them
    > > correctly,
    > > but drew the left and centred images on top of each
    other.
    >
    > Try removing the width:5% from the table rule.
    >
    > > A page demonstrating these various effects is at:
    > > D:\Websites\cybec\Test_nstdpage.htm
    >
    > I went there and by mistake I reformatted the whole
    drive. I hope that's
    > OK....
    >
    > --
    > Murray --- ICQ 71997575
    > Adobe Community Expert
    > (If you *MUST* email me, don't LAUGH when you do so!)
    > ==================
    >
    http://www.dreamweavermx-templates.com
    - Template Triage!
    >
    http://www.projectseven.com/go
    - DW FAQs, Tutorials & Resources
    >
    http://www.dwfaq.com - DW FAQs,
    Tutorials & Resources
    >
    http://www.macromedia.com/support/search/
    - Macromedia (MM) Technotes
    > ==================
    >
    >
    > "Clancy" <[email protected]> wrote in message
    > news
    [email protected]...
    > > Following some suggestions from Gary, I modified my
    table specification
    > > to
    > > read:
    > >
    > > .pictureframe {width: 5%; background-color:
    #d8d8f0; }
    > > .pictureframe td{padding: 5px; }
    > >
    > > In the HTML file this is invoked with:
    > > <table class="pictureframe" align="left"> [or
    as required
    > >
    > > This worked fine, except that if I had three
    pictures together aligned
    > > respectively left, centre and write, Dreamweaver
    did not display them
    > > correctly,
    > > but drew the left and centred images on top of each
    other.
    > >
    > > Gary also suggested replacing the 'align' statement
    with a 'floa'
    > > statement in
    > > the CSS. This meant that I had to have separate
    styles for each
    > > alignment, so I
    > > introduced three new styles:
    > >
    > > .pf_l, .pf_m, .pf_r {width: 5%; background-color:
    #d8d8f0; }
    > > .pf_l, .pf_m, .pf_r td {padding: 5px; }
    > > .pf_l {float: left; }
    > > .pf_m {float: none; }
    > > .pf_r {float: right; }
    > >
    > > This introduced a new set of problems. Firstly
    style 'pf_m' takes up
    the
    > > default alignment of the cell it is in, instead of
    being centred, as I
    > > wanted,
    > > so to get it centred I still had to add an align =
    centre statement in
    > > HTML, and
    > > secondly the image drawn with pf_r has a wider
    border than the others.
    I
    > > cannot
    > > see why this should be so.
    > >
    > > A page demonstrating these various effects is at:
    > > D:\Websites\cybec\Test_nstdpage.htm
    > >
    > > Gary also complained "there's no such attribute as
    "bordercolor". Maybe
    > > strictly
    > > so, but you can hardly blame me for not knowing
    that. Dreamweaver
    doesn't
    > > complain about it, it works, and O'Reilly's
    definitive guide to HTML and
    > > XHTML
    > > has numerous references to it. I had to look for
    some time to find a
    > > statement
    > > that it was 'nonstandard' in one of these
    references.
    > >
    > > [email protected]
    >
    >

  • Define constant ip addresses for wired ports

    Hi,
    I am using WRT54GL. I got 3 computers and one shared printer - all connected wired to port 1-4 in the router.
    i also got 2 wireless leptops which work fine with the router.
    my problem is that every time i got problems with the elctracity (which turns off the power from the router) the wired computers and the printer got diffrent ip address (which makes alot of work to configure everything in the softwares again).
    how can i set the port manually so i will get address 192.168.1.101 for port 1, 192.168.1.102 for port 2 and co...
    thanks in advance,
    Itay
    Solved!
    Go to Solution.

    Windows IP Configuration
       Host Name . . . . . . . . . . . . : IB-Notebook
       Primary Dns Suffix  . . . . . . . :
       Node Type . . . . . . . . . . . . : Hybrid
       IP Routing Enabled. . . . . . . . : No
       WINS Proxy Enabled. . . . . . . . : No
    Ethernet adapter Bluetooth Network Connection:
       Media State . . . . . . . . . . . : Media disconnected
       Connection-specific DNS Suffix  . :
       Description . . . . . . . . . . . : Bluetooth Device (Personal Area Network)
       Physical Address. . . . . . . . . : 00-1A-6B-DF-83-45
       DHCP Enabled. . . . . . . . . . . : Yes
       Autoconfiguration Enabled . . . . : Yes
    Wireless LAN adapter Wireless Network Connection:
       Connection-specific DNS Suffix  . :
       Description . . . . . . . . . . . : Intel(R) PRO/Wireless 3945ABG Network Con
    nection
       Physical Address. . . . . . . . . : 00-1B-77-C0-AB-0E
       DHCP Enabled. . . . . . . . . . . : Yes
       Autoconfiguration Enabled . . . . : Yes
       Link-local IPv6 Address . . . . . : fe80::64a1:fcbd:3719:19ba%12(Preferred)
       Autoconfiguration IPv4 Address. . : 169.254.25.186(Preferred)
       Subnet Mask . . . . . . . . . . . : 255.255.0.0
       Default Gateway . . . . . . . . . :
       DHCPv6 IAID . . . . . . . . . . . : 218110839
       DHCPv6 Client DUID. . . . . . . . : 00-01-00-01-13-1E-FE-2B-00-1B-24-8F-F2-79
       DNS Servers . . . . . . . . . . . : fec0:0:0:ffff::1%1
                                           fec0:0:0:ffff::2%1
                                           fec0:0:0:ffff::3%1
       NetBIOS over Tcpip. . . . . . . . : Enabled
    Ethernet adapter Local Area Connection:
       Connection-specific DNS Suffix  . :
       Description . . . . . . . . . . . : Realtek RTL8101E Family PCI-E Fast Ethern
    et NIC (NDIS 6.20)
       Physical Address. . . . . . . . . : 00-1B-24-8F-F2-79
       DHCP Enabled. . . . . . . . . . . : Yes
       Autoconfiguration Enabled . . . . : Yes
       Link-local IPv6 Address . . . . . : fe80::4910:760b:7363:ce99%11(Preferred)
       IPv4 Address. . . . . . . . . . . : 192.168.1.102(Preferred)
       Subnet Mask . . . . . . . . . . . : 255.255.255.0
       Lease Obtained. . . . . . . . . . : יום ראשון 07 מרץ 2010 00:24:20
       Lease Expires . . . . . . . . . . : יום שני 08 מרץ 2010 13:15:01
       Default Gateway . . . . . . . . . : 192.168.1.1
       DHCP Server . . . . . . . . . . . : 192.168.1.1
       DHCPv6 IAID . . . . . . . . . . . : 234887972
       DHCPv6 Client DUID. . . . . . . . : 00-01-00-01-13-1E-FE-2B-00-1B-24-8F-F2-79
       DNS Servers . . . . . . . . . . . : 132.72.140.46
                                           212.143.212.143
       NetBIOS over Tcpip. . . . . . . . : Enabled
    Ethernet adapter VMware Network Adapter VMnet1:
       Connection-specific DNS Suffix  . :
       Description . . . . . . . . . . . : VMware Virtual Ethernet Adapter for VMnet
    1
       Physical Address. . . . . . . . . : 00-50-56-C0-00-01
       DHCP Enabled. . . . . . . . . . . : No
       Autoconfiguration Enabled . . . . : Yes
       Link-local IPv6 Address . . . . . : fe80::38ca:a58e:1770:301a%16(Preferred)
       IPv4 Address. . . . . . . . . . . : 192.168.25.1(Preferred)
       Subnet Mask . . . . . . . . . . . : 255.255.255.0
       Default Gateway . . . . . . . . . :
       DHCPv6 IAID . . . . . . . . . . . : 604000342
       DHCPv6 Client DUID. . . . . . . . : 00-01-00-01-13-1E-FE-2B-00-1B-24-8F-F2-79
       DNS Servers . . . . . . . . . . . : fec0:0:0:ffff::1%1
                                           fec0:0:0:ffff::2%1
                                           fec0:0:0:ffff::3%1
       NetBIOS over Tcpip. . . . . . . . : Enabled
    Ethernet adapter VMware Network Adapter VMnet8:
       Connection-specific DNS Suffix  . :
       Description . . . . . . . . . . . : VMware Virtual Ethernet Adapter for VMnet
    8
       Physical Address. . . . . . . . . : 00-50-56-C0-00-08
       DHCP Enabled. . . . . . . . . . . : No
       Autoconfiguration Enabled . . . . : Yes
       Link-local IPv6 Address . . . . . : fe80::e14a:775e:6f09:3671%17(Preferred)
       IPv4 Address. . . . . . . . . . . : 192.168.16.1(Preferred)
       Subnet Mask . . . . . . . . . . . : 255.255.255.0
       Default Gateway . . . . . . . . . :
       DHCPv6 IAID . . . . . . . . . . . : 620777558
       DHCPv6 Client DUID. . . . . . . . : 00-01-00-01-13-1E-FE-2B-00-1B-24-8F-F2-79
       DNS Servers . . . . . . . . . . . : fec0:0:0:ffff::1%1
                                           fec0:0:0:ffff::2%1
                                           fec0:0:0:ffff::3%1
       NetBIOS over Tcpip. . . . . . . . : Enabled
    Tunnel adapter isatap.{D2B518A4-E21C-4E01-B434-80AAF2559710}:
       Media State . . . . . . . . . . . : Media disconnected
       Connection-specific DNS Suffix  . :
       Description . . . . . . . . . . . : Microsoft ISATAP Adapter
       Physical Address. . . . . . . . . : 00-00-00-00-00-00-00-E0
       DHCP Enabled. . . . . . . . . . . : No
       Autoconfiguration Enabled . . . . : Yes
    Tunnel adapter isatap.{BEC0399E-731D-48E9-8A2B-CA8B8B15BA4D}:
       Media State . . . . . . . . . . . : Media disconnected
       Connection-specific DNS Suffix  . :
       Description . . . . . . . . . . . : Microsoft ISATAP Adapter #2
       Physical Address. . . . . . . . . : 00-00-00-00-00-00-00-E0
       DHCP Enabled. . . . . . . . . . . : No
       Autoconfiguration Enabled . . . . : Yes
    Tunnel adapter isatap.{AFCB73A3-C595-48FD-8E84-9C2FD09C6267}:
       Media State . . . . . . . . . . . : Media disconnected
       Connection-specific DNS Suffix  . :
       Description . . . . . . . . . . . : Microsoft ISATAP Adapter #3
       Physical Address. . . . . . . . . : 00-00-00-00-00-00-00-E0
       DHCP Enabled. . . . . . . . . . . : No
       Autoconfiguration Enabled . . . . : Yes
    Tunnel adapter Teredo Tunneling Pseudo-Interface:
       Media State . . . . . . . . . . . : Media disconnected
       Connection-specific DNS Suffix  . :
       Description . . . . . . . . . . . : Teredo Tunneling Pseudo-Interface
       Physical Address. . . . . . . . . : 00-00-00-00-00-00-00-E0
       DHCP Enabled. . . . . . . . . . . : No
       Autoconfiguration Enabled . . . . : Yes
    Tunnel adapter isatap.{785CCA76-47EB-4157-BB66-A396AC292746}:
       Media State . . . . . . . . . . . : Media disconnected
       Connection-specific DNS Suffix  . :
       Description . . . . . . . . . . . : Microsoft ISATAP Adapter #4
       Physical Address. . . . . . . . . : 00-00-00-00-00-00-00-E0
       DHCP Enabled. . . . . . . . . . . : No
       Autoconfiguration Enabled . . . . : Yes
    Tunnel adapter isatap.{9C38D982-ECEA-40E9-A6F0-80396D18316B}:
       Media State . . . . . . . . . . . : Media disconnected
       Connection-specific DNS Suffix  . :
       Description . . . . . . . . . . . : Microsoft ISATAP Adapter #5
       Physical Address. . . . . . . . . : 00-00-00-00-00-00-00-E0
       DHCP Enabled. . . . . . . . . . . : No
       Autoconfiguration Enabled . . . . : Yes

  • Use of Class Vs Interface for defining application constants

    I want to use some constants through out the application. For that I found two ways to do that as given below
    1. We can define constants in a class as
    public class ConstantClass {
    public static final String applConstant = "Some Constant";
    and use it ConstantClass.applConstant whereever needed
    Or
    2. We can define an interface as
    public interface IConstantInterface {
    String applConstant = "Some Constant";
    and use it IConstantInterface.applConstant
    Can you pls explain which is the best method to be used in the application and why?
    Thanks in advance.

    Hmmm - that would imply that if I have a reference a
    static final variable in a 3rd party class, then
    compile my class to a .class file, then the 3rd party
    changes their class file, that my .class file would
    not contain the correct values.Yep, that is what would happen
    I doubt this. I haven't read the compiler specs, but
    my assumption would be that compile time optimizations
    such as this only apply to constants within a single
    .class file.You don't need the compiler specs, you just need a compiler.
    Compile the two classes below, and run Main. Your output should look like:
    3
    Hello
    5
    Hooky
    Then delete the Constants.class file and run Main again and see what happens.
    == Constants.java ==
    public class Constants {
    public static final int INT_CONSTANT = 3;
    public static final String STRING_CONSTANT = "Hello";
    public static int i = 5;
    public static String s = "Hooky";
    == End Constants.java ==
    == Main.java ==
    public class Main {
    public static void main(String[] args) {
    System.out.println(Constants.INT_CONSTANT);
    System.out.println(Constants.STRING_CONSTANT);
    System.out.println(Constants.i);
    System.out.println(Constants.s);
    == End Main.java ==
    In case you are wondering:
    java version "1.4.1_02"
    OS: Solaris 8
    Arch: Sparc
    I get the same thing on windows with 1.4 and 1.3
    and on FreeBSD with diablo jdk 1.3

  • Using named constants in SQL rather than magic numbers

    We are running Oracle 7.3.4. In our system we have a number of
    tables that just store static data. For example, we have a table
    that stores the different types of statuses that a docket can
    have:
    Docket_Status: docket_status_id NUMBER(8), description VARCHAR
    (100)
    It has a small number of records as follows:
    docket_status_id description
    1 New
    2 Issued
    3 Completed
    4 Finalised
    and so on.
    When we want to select all of the dockets with a status of
    "New", we could do something like:
    select d.*
    from docket d
    where d.docket_status_id = 1
    However, this SQL statement is not particularly readable or
    maintainable since the "1" is meaningless unless you have
    memorised the id fields for the docket.
    So we defined constants for each of the static data tables, in a
    package of their own:
    PACKAGE DOCKET_STATUS_PL IS
    New_Id CONSTANT Docket_Status.Docket_Status_Id%TYPE := 1;
    Issued_Id CONSTANT Docket_Status.Docket_Status_Id%TYPE := 2;
    Completed_Id CONSTANT Docket_Status.Docket_Status_Id%TYPE := 3;
    and so on.
    Ideally you could directly reference these values in SQL as
    follows:
    select d.*
    from docket d
    where d.docket_status_id = Docket_Status_Pl.New_Id
    But SQL does not let allow this - an invalid column error is
    raised when this is parsed.
    So the package must then be changed to have functions pass back
    each of the constants.
    PACKAGE DOCKET_STATUS_PL IS
    FUNCTION New_Id RETURN NUMBER;
    PRAGMA RESTRICT_REFERENCES(New_Id, WNDS, WNPS);
    FUNCTION Issued_Id RETURN NUMBER;
    PRAGMA RESTRICT_REFERENCES(Issued_Id, WNDS, WNPS);
    FUNCTION Completed_Id RETURN NUMBER;
    PRAGMA RESTRICT_REFERENCES(Completed_Id, WNDS, WNPS);
    and so on.
    PACKAGE BODY DOCKET_STATUS_PL IS
    N_New_Id CONSTANT Docket_Status.Docket_Status_Id%TYPE := 1;
    N_Issued_Id CONSTANT Docket_Status.Docket_Status_Id%TYPE := 2;
    N_Completed_Id CONSTANT Docket_Status.Docket_Status_Id%TYPE := 3;
    FUNCTION New_Id RETURN NUMBER IS
    BEGIN
    RETURN N_New_Id;
    END;
    FUNCTION Issued_Id RETURN NUMBER IS
    BEGIN
    RETURN N_Issued_Id;
    END;
    and so on.
    Once these functions have been defined in the packages, they can
    be called in a SQL statement as follows:
    select d.*
    from docket d
    where d.docket_status_id = Docket_Status_Pl.New_Id
    This makes the SQL statement a lot more readable, but has the
    unfortunate by-product of having the Docket_Status_Pl.New_Id
    function called for every row in the docket table. Although it
    is very quick to call, once there are thousands of records in
    the docket table this can add up to a lot of extra
    time/processing.
    An alternative is to select the constant from the dual table as
    follows:
    select d.*
    from docket d
    where d.docket_status_id = (select Docket_Status_Pl.New_Id from
    dual)
    This works but is not really an ideal solution, since it
    decreases the readability of the SQL statement.
    Does anyone know of alternatives to this approach? Ideally
    package constants could be referenced from SQL, but this does
    not work under our version of Oracle. Do any later versions
    support this ability?
    Any suggestions would be much appreciated.
    null

    I don't understand why you cannot just select on the description
    column if you don't no the id. If speed is a problem create a
    unique not null index on the column description. Technically
    this should have been done since your id column is a is not
    the "REAL" primary key.
    Having said that you could also create a view on top of this
    table which mimics your package.
    CREATE OR REPLACE VIEW name_of_view AS
    SELECT DECODE(docket_status_id, 1, 'New_id',
    2, 'Issued_Id',
    3, 'Completed_Id',
    'OTHER') alt_description,
    docket_status_id description
    FROM name_of_table
    then select * from name_of_view
    where alt_description = 'New_id'
    Geoff Hardy (guest) wrote:
    : We are running Oracle 7.3.4. In our system we have a number of
    : tables that just store static data. For example, we have a
    table
    : that stores the different types of statuses that a docket can
    : have:
    : Docket_Status: docket_status_id NUMBER(8), description VARCHAR
    : (100)
    : It has a small number of records as follows:
    : docket_status_id description
    : 1 New
    : 2 Issued
    : 3 Completed
    : 4 Finalised
    : and so on.
    : When we want to select all of the dockets with a status of
    : "New", we could do something like:
    : select d.*
    : from docket d
    : where d.docket_status_id = 1
    : However, this SQL statement is not particularly readable or
    : maintainable since the "1" is meaningless unless you have
    : memorised the id fields for the docket.
    : So we defined constants for each of the static data tables, in
    a
    : package of their own:
    : PACKAGE DOCKET_STATUS_PL IS
    : New_Id CONSTANT Docket_Status.Docket_Status_Id%TYPE := 1;
    : Issued_Id CONSTANT Docket_Status.Docket_Status_Id%TYPE := 2;
    : Completed_Id CONSTANT Docket_Status.Docket_Status_Id%TYPE := 3;
    : and so on.
    : Ideally you could directly reference these values in SQL as
    : follows:
    : select d.*
    : from docket d
    : where d.docket_status_id = Docket_Status_Pl.New_Id
    : But SQL does not let allow this - an invalid column error is
    : raised when this is parsed.
    : So the package must then be changed to have functions pass back
    : each of the constants.
    : PACKAGE DOCKET_STATUS_PL IS
    : FUNCTION New_Id RETURN NUMBER;
    : PRAGMA RESTRICT_REFERENCES(New_Id, WNDS, WNPS);
    : FUNCTION Issued_Id RETURN NUMBER;
    : PRAGMA RESTRICT_REFERENCES(Issued_Id, WNDS, WNPS);
    : FUNCTION Completed_Id RETURN NUMBER;
    : PRAGMA RESTRICT_REFERENCES(Completed_Id, WNDS, WNPS);
    : and so on.
    : PACKAGE BODY DOCKET_STATUS_PL IS
    : N_New_Id CONSTANT Docket_Status.Docket_Status_Id%TYPE :=
    1;
    : N_Issued_Id CONSTANT Docket_Status.Docket_Status_Id%TYPE :=
    2;
    : N_Completed_Id CONSTANT Docket_Status.Docket_Status_Id%TYPE :=
    3;
    : FUNCTION New_Id RETURN NUMBER IS
    : BEGIN
    : RETURN N_New_Id;
    : END;
    : FUNCTION Issued_Id RETURN NUMBER IS
    : BEGIN
    : RETURN N_Issued_Id;
    : END;
    : and so on.
    : Once these functions have been defined in the packages, they
    can
    : be called in a SQL statement as follows:
    : select d.*
    : from docket d
    : where d.docket_status_id = Docket_Status_Pl.New_Id
    : This makes the SQL statement a lot more readable, but has the
    : unfortunate by-product of having the Docket_Status_Pl.New_Id
    : function called for every row in the docket table. Although it
    : is very quick to call, once there are thousands of records in
    : the docket table this can add up to a lot of extra
    : time/processing.
    : An alternative is to select the constant from the dual table as
    : follows:
    : select d.*
    : from docket d
    : where d.docket_status_id = (select Docket_Status_Pl.New_Id
    from
    : dual)
    : This works but is not really an ideal solution, since it
    : decreases the readability of the SQL statement.
    : Does anyone know of alternatives to this approach? Ideally
    : package constants could be referenced from SQL, but this does
    : not work under our version of Oracle. Do any later versions
    : support this ability?
    : Any suggestions would be much appreciated.
    null

  • Constant declaration and the optimizer

    Assume there is a Plsql package A with a defined constant 'constA'
    Assume we have an sql query in PLSQL package B that references A.constA.
    Will the optimizer always give the same plan for the query whether I used the literal constant or the reference A.constA?
    I assume that replacement of references to A.constA would have to be don't before the optimizer begins it's evaluation. I assume that does not happen; therefore, using A.constA has prevented the optimizer from using the statistics on the table.
    Ie. It is true that use of literals may provide better performance than references to declared constants.

    Hi,
    Will the optimizer always give the same plan for the query whether I used the literal constant or the reference A.constA?Assuming bind peeking is not turned off and all other parameters influencing CBO are the same - yes.
    "The same plan" in this context means not "the same piece of memory in library cache", but "the same execution path", because query with literal and a constant will result in different SQL queries, hence different shareable parent cursors.
    It is true that use of literals may provide better performance than references to declared constants.Yes. If you have a constant to use in SQL, then it's better to use it as a literal rather than bind (using a PL/SQL constant in a query results in using bind variable - but maybe that behavior will be changed sometime).
    The main issue with using binds for constant is a case you use several constants for exactly the same query and there's data skew. CBO is not doing well with that until 11g (which introduced adaptive cursor sharing).

Maybe you are looking for

  • This operation can't be completed because the item is in use.

    I have been researching this for months and no one seems to have an answer, lots of discussions but never a result. 1 - I have a MacBook Pro running Lion (I tried it with Leopard too) 2 - I have an external Iomega raid drive which is being used as a

  • Port Translation (Non to Standard Ports)

    Hi Guys I would like some advise/ideas on the best solution for the below. I have a application server which uses non standard HTTP/HTTPS ports. What I want is a solution to translate these ports to standard ports. Client 1 accesses the site on port

  • Error when trying to run jsp on oas4081

    Hi there! As many others before, I'm trying to get jsp to run on oas4081. Although I think I did everything what the docs (and the other posts here) say, I get an error. Here is what I did: * download ojsp.zip * add a JServlet application * under ENV

  • Can I install PSE 11 without the Organiser as I like iPhoto?

    Hi Have just bought PSE 11, but not installed yet because I don't want PSE's Organiser as I'm happy with iPhoto.  Can I just install the PSE editor, or is there an option to disable the organiser?  There's no mention of giving Mac users an option in

  • Obmenugen next version (v0.5): beta-testers needed

    Hi everybody: It's been a long time since last obmenugen release. Sorry about that, I've been very busy. I need everybody out there using (or not) obmenugen to help me making the next version the best ever. I have ported to D 1.0 (from 2.0), thus it'