Conky Conditional Statement
Is there a way to make a conky config that will check to see it your wlan card is on/off. When it is on, it should show some set of information that you choose. When it is off, none of that information should be shown.
I like to see:
Link Quality
SSID
Up
Down
Upload
Download
IP Address
I know that conky has if-elseif-endif statements, but I assume that those go through the config once, and then don't go through it again.
I guess that it could be done with an external script as well, but I am no programmer, so I am not sure about that.
Thoughts?
Michael
brisbin33 wrote:
michaelramm wrote:
Here is mine:
NETWORK ${hr 2}
${if_existing /proc/net/route eth0}
${alignc}Wired
Up: ${upspeed eth0} kb/s ${alignr}${upspeedgraph eth0 8,60 789E2D A7CC5C}
Down: ${downspeed eth0} kb/s ${alignr}${downspeedgraph eth0 8,60 789E2D A7CC5C}
Upload: ${alignr}${totalup eth0}
Download: ${alignr}${totaldown eth0}
Local IP: ${alignr}${addr eth0}
[b]${else}[/b]
${if_existing /proc/net/route eth1}
${alignc}Wireless
Signal: ${wireless_link_qual eth1}% ${alignr}${wireless_link_bar 8,60 eth1}
Attached to:${alignr}${wireless_essid eth1}
Up: ${upspeed eth1} kb/s ${alignr}${upspeedgraph eth1 8,60 789E2D A7CC5C}
Down: ${downspeed eth1} kb/s ${alignr}${downspeedgraph eth1 8,60 789E2D A7CC5C}
Upload: ${alignr}${totalup eth1}
Download: ${alignr}${totaldown eth1}
Local IP: ${alignr}${addr eth1}
${endif}
just an observation
if your first $if_existing is always true (eth0 exists) then the $else condition will never be run.
i'd reverse your statements and you may find it works as you want.
Thanks for the insight!
I took out the else that is bolded above, and it is rocking along just how I want it to. Wireless section goes away when I turn off wireless and it reappears when I turn it on!
Thanks,
Michael
Similar Messages
-
Conky Conditional Statement [MOVED TO DESKTOP ENVIRONMENTS!]
Is there a way to make a conky config that will check to see it your wlan card is on/off. When it is on, it should show some set of information that you choose. When it is off, none of that information should be shown.
I like to see:
Link Quality
SSID
Up
Down
Upload
Download
IP Address
I know that conky has if-elseif-endif statements, but I assume that those go through the config once, and then don't go through it again.
I guess that it could be done with an external script as well, but I am no programmer, so I am not sure about that.
Thoughts?
Michael
Last edited by michaelramm (2008-12-08 21:43:07)conky's if/else-if statements are run/checked each update so if your interval is 1 then that's each second.
i've seen many conky's around that display one set of info if eth0 is up (ethernet plugged in) and another if wlan0 is up (wifi). not useful for my desktop so i never saved any of the links. check through the "post your conky configs" thread here or go to google.
something like
${if_up wlan0} $--wifi info-- $endif${if_up eth0} $--ethernet info-- $endif
would probably work.
EDIT -- sorry, ignore this; i posted on the one in desktop environments now.
Last edited by brisbin33 (2008-12-08 22:07:25) -
IF and ABS condition statement in BEX query designer
Hi,
I would like to ask the best way for me to produce an acceptable result from Excel IF and ABS Condition statement.
The condition statement that I have on my Excel file is
=IF((A2-B2)>0,ABS(A2-B2),0)
I'm trying multiple times to reproduce this in BEX Query designer, unfortunately I'm getting a bad result or unacceptable formula.
Anyone who could help me with my issue?
Thanks,
ArnoldHi Arnold,
Thank you,
Nanda -
This is actually not a JSP question but an HTML question. I could'nt find any good html forum sites out there, and since I received excellent replies in my previous post, I am hoping that those of you who know JSP also know html. Heres my question, is there any conditional statement in html (I don't want to use scripts)? The only conditional statement I found was the logic:equal (not equal) statement. And it seems to only work for forms. I am using JSP in conjunction with html so I used an inner html variable declaration in my JSP function. This variable will be used by my html code. And I would like to check the value of that variable in html.
Heres my JSP function containing the inner html declaration:
function showItemEdit(field)
var elements = editWindowDiv.document.all;
elements("editWindowField").value = "";
fieldhtml.innerHTML = field;
var retVal = null;
retVal = window.showModalDialog("javascript:document.write(window.dialogArguments.innerHTML);editWindowInit();",editWindowDiv,
"dialogWidth:335px;dialogHeight:185px;scroll:no;status:no;unadorned:no");
if (retVal == "OK")
alert("OK");
else
alert("Cancel");
The inner html variable, fieldhtml.innerHTML, is the value I would like to check in my html code.
This is what I woul like to accomplish in my html code:
if fieldhtml == register then
<tr>
<td class="bodymd"> <bean:message key="label.register"/>:</td>
<td><input type="text" name="editWindowField" value="" maxlength="5"></td>
</tr>
else
<tr>
<td class="bodymd"> <bean:message key="label.shift_no"/>:</td>
<td><input type="text" name="editWindowField" value="" maxlength="3"></td>
</tr>
end if
I am not sure how to accomplish if-else statements in html. I would appreciate any help. Thanks!You are mixing things a bit. There is no JSP in your example. You cannot do conditional statements in HTML. However, you can use JavaScript to output HTML:
if(someCondition){
document.write("<yourHTMLTags>whatever</yourHTMLTags>");
else{
document.write("<yourHTMLTags>something else</yourHTMLTags>");
} -
Text box not empty conditional statement
I've been asked to develop a survey and, in several places, a
score is given for the completion of text box. However, if there is
no text in the box, then a score of zero should be given.
I thought the best way to do this would be to use a hidden
field with a conditional statement saying "if text box is not empty
then score=4, else score=0.
However, firstly I'm not sure how to write this and secondly,
how do you check if a text box is empty?
I think it really calls for some human input but the client
is quite sure this is how he wants it.
The scores are all going to be inserted into a mysql database
and sorted out there, so there may be some fudge available there
but if php could do something nice in the code, that would be
preferable.
Thanks in advance.
AndrewDrewbles wrote:
> However, firstly I'm not sure how to write this and
secondly, how do you check
> if a text box is empty?
Believe it or not, with the PHP function called empty();
http://docs.php.net/manual/en/function.empty.php
if (empty($_POST['fieldName'])) {
// give a score of 0
} else {
// give a positive score
David Powers, Adobe Community Expert
Author, "The Essential Guide to Dreamweaver CS3" (friends of
ED)
Author, "PHP Solutions" (friends of ED)
http://foundationphp.com/ -
OMP_SET_NUM_THREADS in a conditional statement?
I am having problems using OMP_SET_NUM_THREADS in a conditional statement. For example a code like following will make the program to hang indefinitely after starting to execute a parallel DO loop:
if(mybool.eq.0) then
call OMP_SET_NUM_THREADS(iprocessors)
else
call OMP_SET_NUM_THREADS(1)
endif
Is there a problem using this function in conditional statements?
I am using Forte Studio 7 under Solaris 8 and 10 (I know that it is old but for the moment this is what I have to use...).
Thanks,
RakThis is probably a bug in Forte 7.
Can you isolate the problem in a small test case and post the code here. We'll try it on the latest compiler and see if it works or not.
You know you can download Sun Studio 12 and run it on Solaris 10. (SS 12 is not supported on Solaris 8) -
Using conditional statements stored inside a variable
I'm trying to store the body of different emails inside of my
database to use in email sent with cfmail. The content of the
emails has conditional statements using cfif and other variables
based on a query running. If I set the content as a variable and
then place that inside of the cfmail tag it does not process the
cold fusion code. Is there a way that I can process this code so
that the final output is what is placed within the cfmail tag or is
it not possible to do what I'm trying to accomplish? Thanks in
advance for any ideas.Here is a sample taken from the text file. The output created
by the cfsavecontent tag is identical to the text file.
Dear <cfif IsDefined(GetData.strFirstName) AND
GetData.strFirstName IS NOT
"">#GetData.strFirstName#<cfelse>Member</cfif>,
Thank you for joining xxxxxxxxx. We're glad to
have you as a member and appreciate your support. Your
membership
application has been processed and your member packet will
arrive soon.
Your new membership number is #GetData.strCustomerID#. This
number is useful
when buying product from our online store, renewing your
membership or
contacting us with questions or comments.
<cfif GetData.ExpirationDate IS "9999-12-1">We are
especially grateful for your commitment to xxxxxxxx
through your Life Membership.<cfelse>Your membership is
current through #DateFormat(GetData.ExpirationDate, "MMMM
YYYY")#.</cfif> -
Using CONSTANT in Condition Statement
Hi
What I am trying to do is put CONSTANT into IN Condition Statement.
When I use Bind variables just like :bind, It works properly
But What if I use as a CONTANT, It doesn't work.
In my opinion, parenthesis is not work well.
Please help me out
thanks in advance and below is PL/SQL CODE
PROCEDURE PROC_MAIN
iUserID IN VARCHAR2,
iJobID IN VARCHAR2
) AS
C_AGENT CONSTANT VARCHAR(20) := '10,11';
C_staff CONSTANT VARCHAR(20) := '40';
C_newStaff CONSTANT VARCHAR(20) := '50';
C_ETC CONSTANT VARCHAR(20) := '20,30';
BEGIN
vJobId :=
CASE iJobID
WHEN '41' THEN C_AGENT
WHEN '42' THEN C_staff
WHEN '43' THEN C_newStaff
WHEN '40' THEN C_ETC
END;
insert into tbl_monthly
(emp_no, salary)
select emp_no, salary from tbl_emp
where Staff_cat in vJobId ;
end;
Message was edited by:
allboryHi,
Please check the changes:
Note: table_name is changed to test.
CREATE OR REPLACE PROCEDURE PROC_MAIN
iUserID IN VARCHAR2,
iJobID IN VARCHAR2
) AS
C_AGENT CONSTANT VARCHAR(20) := '10,11';
C_staff CONSTANT VARCHAR(20) := '40';
C_newStaff CONSTANT VARCHAR(20) := '50';
C_ETC CONSTANT VARCHAR(20) := '20,30';
vJobId VARCHAR2(20);BEGIN
vJobId :=
CASE iJobID
WHEN '41' THEN C_AGENT
WHEN '42' THEN C_staff
WHEN '43' THEN C_newStaff
WHEN '40' THEN C_ETC
END;
EXECUTE IMMEDIATE 'INSERT INTO tbl_monthly(empno, salary) SELECT empno, sal FROM scott.emp WHERE deptno IN ('||vJobId||')' ;
END; -
Got action sequence to "loop" but it shows in all states - conditional statement to fix it?
Using Flash Catalyst & Notepad (to open and alter the code in the "Main" MXML file) I'm able to "loop" an action sequence on the home state for my swf by changing the code as follows:
ORIGINAL CODE
<s:Parallel id="Sequence3">
ALTERED CODE
<s:Parallel id="Sequence3" effectEnd="Sequence3.play()">
The desired effect is a sequence (of 4 images) that loops whenever a user is viewing the home state. It is activated "On Application Start"
The PROBLEM is that the loop continues in all other states (it appears in the background - behind the objects that are supposed to show up on the other pages and only begins to show up in each state when the sequence begins another loop).
I am assuming I need a conditional statement --- something along the lines of:
while (condition){ statements;}
...in other words, ONLY while currentstate = "Home" it should loop the sequence. What would be the correct code for this conditional statement and where would the conditional statement be inserted to loop the sequence as desired??? Or... is there another better way??
My current code for this action sequence is:
<s:Parallel id="Sequence3" effectEnd="Sequence3.play()">
<s:Parallel target="{designlayer1}">
<s:Fade alphaTo="0" duration="500" startDelay="2100"/>
</s:Parallel>
<s:Parallel target="{bitmapimage2}">
<s:Fade alphaTo="0" startDelay="2100"/>
</s:Parallel>
<s:Parallel target="{bitmapimage3}">
<s:Fade alphaTo="0" startDelay="2100"/>
</s:Parallel>
<s:Parallel target="{bitmapimage4}">
<s:Fade alphaTo="0" startDelay="2100"/>
</s:Parallel>
<s:Parallel target="{bitmapimage5}">
<s:Fade alphaTo="0" startDelay="1650"/>
</s:Parallel>
<s:Parallel target="{bitmapimage6}">
<s:Fade alphaTo="0" startDelay="1800"/>
</s:Parallel>
<s:Parallel target="{bitmapimage7}">
<s:Fade alphaTo="0" startDelay="1950"/>
</s:Parallel>
<s:Parallel target="{designlayer5}">
<s:Fade alphaFrom="1" alphaTo="0" duration="0" startDelay="0"/>
<s:Fade alphaFrom="0" alphaTo="1" duration="0" startDelay="2650"/>
<s:Fade alphaTo="0" startDelay="5300"/>
</s:Parallel>
<s:Parallel target="{bitmapimage8}">
<s:Fade alphaFrom="1" alphaTo="0" duration="0" startDelay="0"/>
<s:Fade alphaFrom="0" alphaTo="1" duration="0" startDelay="2650"/>
<s:Fade alphaTo="0" startDelay="5350"/>
</s:Parallel>
<s:Parallel target="{bitmapimage9}">
<s:Fade alphaFrom="1" alphaTo="0" duration="0" startDelay="0"/>
<s:Fade alphaFrom="0" alphaTo="1" duration="0" startDelay="2650"/>
<s:Fade alphaTo="0" startDelay="5350"/>
</s:Parallel>
<s:Parallel target="{bitmapimage10}">
<s:Fade alphaFrom="1" alphaTo="0" duration="0" startDelay="0"/>
<s:Fade alphaFrom="0" alphaTo="1" duration="0" startDelay="2650"/>
<s:Fade alphaTo="0" startDelay="5350"/>
</s:Parallel>
<s:Parallel target="{bitmapimage11}">
<s:Fade alphaFrom="1" alphaTo="0" duration="0" startDelay="0"/>
<s:Fade alphaFrom="0" alphaTo="1" duration="0" startDelay="2650"/>
<s:Fade alphaTo="0" startDelay="4750"/>
</s:Parallel>
<s:Parallel target="{bitmapimage12}">
<s:Fade alphaFrom="1" alphaTo="0" duration="0" startDelay="0"/>
<s:Fade alphaFrom="0" alphaTo="1" duration="0" startDelay="2650"/>
<s:Fade alphaTo="0" startDelay="5000"/>
</s:Parallel>
<s:Parallel target="{designlayer6}">
<s:Fade alphaTo="0" duration="0"/>
<s:Fade alphaFrom="0" alphaTo="1" duration="0" startDelay="5900"/>
<s:Fade alphaTo="0" startDelay="7900"/>
</s:Parallel>
<s:Parallel target="{bitmapimage13}">
<s:Fade alphaTo="0" duration="0"/>
<s:Fade alphaFrom="0" alphaTo="1" duration="0" startDelay="5900"/>
<s:Fade alphaTo="0" startDelay="7550"/>
</s:Parallel>
<s:Parallel target="{bitmapimage14}">
<s:Fade alphaTo="0" duration="0"/>
<s:Fade alphaFrom="0" alphaTo="1" duration="0" startDelay="5900"/>
<s:Fade alphaTo="0" startDelay="7900"/>
</s:Parallel>
<s:Parallel target="{bitmapimage15}">
<s:Fade alphaTo="0" duration="0"/>
<s:Fade alphaFrom="0" alphaTo="1" duration="0" startDelay="5900"/>
<s:Fade alphaTo="0" startDelay="7750"/>
</s:Parallel>
<s:Parallel target="{bitmapimage16}">
<s:Fade alphaTo="0" duration="0"/>
<s:Fade alphaFrom="0" alphaTo="1" duration="0" startDelay="5900"/>
<s:Fade alphaTo="0" startDelay="7900"/>
</s:Parallel>
<s:Parallel target="{bitmapimage17}">
<s:Fade alphaTo="0" duration="0"/>
<s:Fade alphaFrom="0" alphaTo="1" duration="0" startDelay="5900"/>
<s:Fade alphaTo="0" startDelay="7900"/>
</s:Parallel>
<s:Parallel target="{designlayer7}">
<s:Fade alphaTo="0" duration="0"/>
<s:Fade alphaFrom="0" alphaTo="1" duration="0" startDelay="8500"/>
<s:Fade alphaFrom="1" alphaTo="0" startDelay="11000"/>
</s:Parallel>
<s:Parallel target="{bitmapimage18}">
<s:Fade alphaTo="0" duration="0"/>
<s:Fade alphaFrom="0" alphaTo="1" duration="0" startDelay="8500"/>
<s:Fade alphaFrom="1" alphaTo="0" startDelay="11000"/>
</s:Parallel>
<s:Parallel target="{bitmapimage19}">
<s:Fade alphaTo="0" duration="0"/>
<s:Fade alphaFrom="0" alphaTo="1" duration="0" startDelay="8500"/>
<s:Fade alphaFrom="1" alphaTo="0" startDelay="11000"/>
</s:Parallel>
<s:Parallel target="{bitmapimage20}">
<s:Fade alphaTo="0" duration="0"/>
<s:Fade alphaFrom="0" alphaTo="1" duration="0" startDelay="8500"/>
<s:Fade alphaFrom="1" alphaTo="0" startDelay="11000"/>
</s:Parallel>
<s:Parallel target="{bitmapimage21}">
<s:Fade alphaTo="0" duration="0"/>
<s:Fade alphaFrom="0" alphaTo="1" duration="0" startDelay="8500"/>
<s:Fade alphaFrom="1" alphaTo="0" startDelay="10650"/>
</s:Parallel>
<s:Parallel target="{bitmapimage22}">
<s:Fade alphaTo="0" duration="0"/>
<s:Fade alphaFrom="0" alphaTo="1" duration="0" startDelay="8500"/>
<s:Fade alphaFrom="1" alphaTo="0" startDelay="10800"/>
</s:Parallel>
</s:Parallel>
Thank you!!!!!!!!Figured out my issue...
I had to select each layer for the 4 photo sequence and "Remove From State" for each layer. If this is done with all layers except the "Home" state, the images show only where appropriate.
So... "Loop an action sequence" is really easy.
I've seen a lot of complaining that "FC can't do it" but with a very simple code mod, I was able to do it WITHOUT using the video timer method.
I should also mention that I've never worked with Flash at all before this project and am only self-taught in HTML (basics). I was able to make a pretty good looking Flash component for a web site and never would have attempted it without FC. I have to say, while FC is a bit limited, GUI-based Flash is a great add for Adobe and will save me over $2k per year in web admin.
To edit the document in Notepad as mentioned in the first post:
the full text can be found here http://www.judahfrangipane.com/blog/2010/09/03/flash-catalyst-jailbreak-for-flex-developer s/
Editing MXML Documents
To edit your projects MXML documents we first need to find the path to the Flash Catalyst workspace. To do this publish your Flash Catalyst project (CMD / CTRL + ENTER). Now, the browsers URL shows the path to the project workspace. So in this URL, "file:///Users/judah/Library/Application Support/Adobe/Flash Catalyst/workspace/Project/bin-debug/Main.html", the project MXML documents are located at, "file:///Users/monkeypunch/Library/Application Support/Adobe/Flash Catalyst/workspace/Project/" when on a Mac.
Flash Catalyst project files
Project Files Description
/src - location of the application source files
/bin - the location of any additional flex libraries
/bin-debug - location of testing swf
/html-template - location of the html template that wraps around your application
/src/Main.mxml - the main application file. make your application changes here
/src/Main.css - the css stylesheet of the main application
/src/components - the location of custom components and component skins
/src/assets/graphics - location of optimized FXG graphic symbols
/src/assets/images - location of images
You can edit these XML documents in any text editor. To apply the changes you need to save the file and refresh the Flash Catalyst project. You can do this by opening the changed document in Flash Catalyst code view. When we do this it will recognize the document has changed and prompt you to use the newer version of the file. Select Yes. If the project does not rebuild immediately publish it using CMD + Enter. -
Need Help W/ Conditional Statement...
Hi guys,
I have a project uploaded at:
http://www.jasonfraziercreativedesign.com/client_sites/kimyarbrough2/
After everything has loaded into place, and you click on -- say MODELING -- the photos slide away, the separator bars disappear, and the particular (sample) content is loaded in. This works wonderfully for all the buttons (MODELING, ACTING, MUSIC, SCHEDULE and ABOUT KIM) -- but only when you click on them when the site first loads.
If you try to click on the buttons again, when you're IN a section -- it will cycle through the animation again.
I know I need some kind of conditional statement that says if you're ALREADY LOOKING AT A SECTION (i.e. the sourceLoader.source = a section) then don't cycle through the animation again -- just get rid of the current content and display the appropriate new content.
If you're IN the MODELING SECTION, for instance and you click MODELING again -- I don't want Flash to do ANYTHING (ie NULL). But if you're in MODELING, and you click on ACTING -- I just want the MODELING stuff to go away and present the ACTING stuff (no animation).
Here's the pertinent AS that I have currently -- any help about where to place the proper CONDITIONAL (if/else) statement would be so appreciated:
function swap_photos_place_content(theSection:String):void {
// ANIMATE THE 4 PANEL PHOTOS LEAVING THE CONTENT AREA
var photo1Tween:Tween = new Tween(kim_photo1_mc, "y", Regular.easeOut, kim_photo1_mc.y, 620, 2, true);
var photo2Tween:Tween = new Tween(kim_photo2_mc, "y", Regular.easeOut, kim_photo2_mc.y, -600, 2, true);
var photo3Tween:Tween = new Tween(kim_photo3_mc, "y", Regular.easeOut, kim_photo3_mc.y, 620, 2, true);
var photo4Tween:Tween = new Tween(kim_photo4_mc, "y", Regular.easeOut, kim_photo4_mc.y, -600, 2, true);
// AFTER THE LAST PHOTO HAS MOVED OUT, FADE UP THE CONTENT MASK
photo4Tween.addEventListener(TweenEvent.MOTION_FINISH, fadeup_content_mask);
function fadeup_content_mask(event:TweenEvent):void {
var main_mask_fadeoutTween:Tween = new Tween(main_mask_mc, "alpha", Regular.easeOut, 1, 0, 1, true );
var content_mask_fadeupTween:Tween = new Tween(content_mask_mc, "alpha", Regular.easeOut, 0, 1, 1, true);
// AFTER THE CONTENT MASK FADES UP, THE STAGE IS READY TO LOAD IN THE CONTENT
content_mask_fadeupTween.addEventListener(TweenEvent.MOTION_FINISH, load_in_content);
function load_in_content(event:TweenEvent):void {
// BEFORE LOADING IN THE NEW SECTION, TAKE AWAY THE OLD SECTION
sectionLoader.source=null;
trace("ready to load in content");
sectionLoader.source=theSection;
// ADD LISTENERS FOR THE SECTION-CONTENT CLICKS
inv_modeling_button.addEventListener(MouseEvent.CLICK, modeling_click);
function modeling_click(event:MouseEvent):void {
trace("modeling_click");
swap_photos_place_content("modeling.swf");
inv_acting_button.addEventListener(MouseEvent.CLICK, acting_click);
function acting_click(event:MouseEvent):void {
trace("acting_click");
swap_photos_place_content("acting.swf");
inv_music_button.addEventListener(MouseEvent.CLICK, music_click);
function music_click(event:MouseEvent):void {
trace("music_click");
swap_photos_place_content("music.swf");
inv_schedule_button.addEventListener(MouseEvent.CLICK, schedule_click);
function schedule_click(event:MouseEvent):void {
trace("schedule_click");
swap_photos_place_content("schedule.swf");
inv_aboutkim_button.addEventListener(MouseEvent.CLICK, aboutkim_click);
function aboutkim_click(event:MouseEvent):void {
trace("aboutkim_click");
swap_photos_place_content("aboutkim.swf");One thing you can do is create a function that removes all the event listeners for all the buttons. Then when you click a button run that function then add event listeners for all other buttons.
-
How to use Conditional statements in SQL Loader control file
Hi,
I am using sql loader to load a flat file to the table. I am using control file for this purpose as show below:
LOAD
INTO TABLE store_shrink
TRUNCATE
FIELDS TERMINATED BY " "
TRAILING NULLCOLS
SITE_ID char,
ST_SHRINK char,
ST_REVENUE char,
SHRINK_PR char ":ST_SHRINK/:ST_REVENUE"
My question is this. If in the flat file the value of 'ST_REVENUE' is '0', then I want 'SHRINK_PR' to be '0' as well, and skip the calculation (:st_shrink/:st_revenue).
How to achieve this with the conditional statement or using any Oracle function?
Any help or suggestion is greatly appreciated.
Thanks in advance.Hi there,
I tried the following in my above query and it doesn't work somehow. Anyone has an idea? I have been on internet throughout but to no avail. Please help:
LOAD
INTO TABLE store_shrink
TRUNCATE
FIELDS TERMINATED BY " "
TRAILING NULLCOLS
SITE_ID char,
ST_SHRINK char,
ST_REVENUE char,
SHRINK_PR char "case (when :st_revenue<>'0.00' then :SHRINK_PR=:ST_SHRINK/:ST_REVENUE else :SHRINK_PR='0.00') end"
) -
Java programming standard for conditional statement
Hi,
Is it proper Java standard to use constants first in a conditional statement? I've never seen coding in this way, even when I was in college I never saw it in any of our books.
example:
String x = null;
if (null==x){
//Do some stuff
}kevjava wrote:
yawmark wrote:
...hence, more work.Not if "NAME_KEY" (i.e., the literal value) changes.
~If some wise guy resets it to null, then you've lost all benefit of making a constant out of it to begin withIf that happens, you've got some people problems to deal with! Anyways, if it's really a constant, it'll be final, right?
.... and I was sort-of reiterating that it was a self-named constant... you're right, of course, but I guess I'm just peaved at having to see stuff like...
private String JAN="JAN";
private String FEB="FEB";
// ...and on and on...
// later...
if (FEB.equals(month)) {
// do stuff
} else {
// do stuff
}Have you ever actually seen code like that in production? I wonder, what are you up to that a class needs its own, private, set of months?
My point is that the three-letter abbreviation is always going to be "FEB" (yes, i18N and language specializations aside)Why put them aside, though? They're not exactly corner cases -
Long execution times for TestStand conditional statements
I have two test stations – one here, one at the factory in China that has been operating for about a year. The test program uses TestStand 3.1 and calls primarily dll's developed using CVI. Up until a couple months ago, both test stations performed in a similar manner, then the computer at the factory died and was replaced with a new, faster computer. Now the same test sequence at the factory take three times as long to execute (30 min at the facotry, 10min here).
I have recoded the execution time at various point during the execution, and have found that the extra times seems to be occurring during the evaluation of conditional statements in TestStand (i.e. for loops, if statements, case statements). For example, one particular ‘for’ evaluation takes 30 ms on the test station here, but takes 400 ms at the test station at the factory (note: this is just the evaluation of the for condition, not the execution of the steps contained within the for loop).
The actual dll calls seem to be slightly faster with the new computer.
Also the ‘Module Times’ reported don’t seem to match the actual time for the module for the computer at the factory. For example, for the following piece of TestStand code:
Label1
Subsequence Call
Label2
I record the execution time to the report text in both Label1 and Label2. Subtracting one from the other gives me about 18 seconds. However the ‘Module Time’ recorded for ‘Subsequence Call’ is only 3.43 seconds.
Any body have any ideas why the long execution time with the new computer? I always setup the computers in exactly the same way, but maybe there is a TestStand setting somewhere that I have missed? Keep in mind, both test stations are running exactly the same revision of code.Got some more results from the factory this morning:
1) Task Manager shows that the TestExec.exe is the only thing using CPU to any significant degree. Also CPU Usage History show that the CPU Usage never reaches 100%.
2) I sent a new test program that will log test execution time in more places. Longer execution times are seen in nearly every area of the program, but one area where this is very dramatic is the time taken to return from one particular subsequence call. In this subsequence I log the time just before the <End Group> at then end of Main. There is nothing in Cleanup. I then log the time immediately after returning from this sequence. On the test system I have here this takes approximately 160 ms. On the test system at the factory this takes approximately 14.5 seconds! The program seems to be hanging here for some reason. Every time this function is called the same thing happens and for the same amount of time (and this function is called about 40 times in the test program, so this is kill me). -
Handling conditional statements in design view
I have to use conditional statements for proper cross browser
compatability but the design view of Dreamweaver isn't showing
anything. Here is the code:
quote:
<!--[if !IE]>--><!--#include file="header.html"
--><!--<![endif]-->
<!--[if gt IE 6]><!--#include file="header.html"
--><![endif]-->
<!--[if lte IE 6]><!--#include file="headerie.html"
--><![endif]-->
I would think that Dreamweaver would load the first one, or
perhaps there is a setting to tell design view to function as a
particular browser.
Does this exist?http://www.adobe.com/cfusion/exchange/index.cfm?event=extensionDetail&extid=1564018#
Ken Ford
Adobe Community Expert Dreamweaver/ColdFusion
Adobe Certified Expert - Dreamweaver CS3
Adobe Certified Expert - ColdFusion 8
Fordwebs, LLC
http://www.fordwebs.com
"justin_pdx" <[email protected]> wrote in
message
news:gdtdqe$pi2$[email protected]..
>I have to use conditional statements for proper cross
browser compatability
>but
> the design view of Dreamweaver isn't showing anything.
Here is the code:
>
>
quote:
> <!--[if !IE]>--><!--#include
file="header.html" --><!--<![endif]-->
> <!--[if gt IE 6]><!--#include
file="header.html" --><![endif]-->
> <!--[if lte IE 6]><!--#include
file="headerie.html" --><![endif]-->
>
>
> I would think that Dreamweaver would load the first one,
or perhaps there
> is a
> setting to tell design view to function as a particular
browser.
>
> Does this exist?
> -
Hello all,
I recently have been attempting to make conditional statements work in adobe acrobat X. Here is what I have in the custom calculation script text box:
var a = this.getField("endResult2").value;
if(a >= 120000) event.value = (a / 150000) * 100;
else event.value = 0;
This has worked for me however, I want to replace the values 120000 and 150000 with variables/fields (i.e. "minimum2" or "meet2"). Unfortunately, every time I replace the values with fields the calculation no longer works. Any help would be greatly appreciated.
Additionally, when the calculation is executed and a number is given the connecting equations downstream do not execute unless another field is edited. Any input on this would also be very helpful.
Thank you!!Thank you for the help!
Also, there were no 0s present in the fields. I believe I just had to switch the action to run as javascript?
Here is the new script:
var b = this.getField("endResult1").value;
var q = this.getField("minimum1").value;
var w = this.getField("meet1").value;
if(b >= q) event.value = (b / w) * 100;
else event.value = 0;
Maybe you are looking for
-
How to find out the users in XI?
Hello all, I need to find out how many users are logged into XI? In the ABAP side I can do that via sm66 or AL08. If some one is using the IR and ID how can I find out about those users? Regards, N.S
-
What is my hard drive type and size?
My model is: 13-inch, Early 2008, Generation 5, MB402xx/A I've found the manuals for my model of macbook, I think, and it tells me how to replace the RAM. But it doesn't tell me how to replace the hard drive. I'm just not looking in the right place,
-
I want" Bussines area & Section Code " So i created the validation for all vendor transaction ie. FB60,F-43,F-48 & MIRO. Validation is based on Tcode & Account type But i m not getting the compulsory field for MIRO. For all other transation i m getti
-
I've a really simple JSF question which I'm hoping someone can help me with... In ASP.NET you have full access to the page tag components from inside the backing (code-behind) bean. Is this possible in JSF? If so, how? On a related note, it does seem
-
Operating System: Lion 10.7.5 I was getting this warn in the logs [warn] mod_bonjour: Cannot read template index file '/System/Library/User Template/English.lproj/Sites/index.html'. and looking to the System directory on; System/Library/User Template