Need help with dynamic code generation
Hi Folks,
I am trying to dynamically create and execute the following query
Environment: Oracle Database 10g Enterprise Edition Release 10.2.0.4.0
DECLARE
A NUMBER;
stmt VARCHAR2(200);
4
5 CURSOR C1 IS
6 SELECT TABLE_NAME
7 FROM DB_MGMT.CTRL_TAB_RETENTION
8 WHERE RETENTION_PERIOD_IN_MONTHS = 11
9 AND rownum < 2;
10
11 BEGIN
12 FOR i IN C1
13 LOOP
14
15 -- dbms_output.put_line('Table Name: ' || i.TABLE_NAME);
16
17 -- dbms_output.put_line('SELECT min(DT_SKEY), max(DT_SKEY) FROM '||i.TABLE_NAME||' ;');
18
19 stmt :='SELECT min(DT_SKEY), max(DT_SKEY) FROM DWH_RSRC_PERF.'||i.TABLE_NAME||';';
20
21 dbms_output.put_line(stmt);
22
23 execute immediate stmt;
24 END LOOP;
25 END;
26 /I get the following error message
SQL> @sanity_check
SELECT min(DT_SKEY), max(DT_SKEY) FROM DWH_RSRC_PERF.FACT_NOK_CELL_SERVICE2_HH;
DECLARE
ERROR at line 1:
ORA-00911: invalid character
ORA-06512: at line 23Can anybody spot any obvious syntax errors in the above code?
Thanks in advance
rogers42
rogers42 wrote:
Hi,
Thanks for the suggestion.
While getting rid of the ";" helps, but the output of the select statement is not displayed?When you do a SELECT statement in PL/SQL, you have to select the results into variables or arrays.
Try something like this:
DECLARE
CURSOR C1 IS
SELECT TABLE_NAME
FROM DB_MGMT.CTRL_TAB_RETENTION
WHERE RETENTION_PERIOD_IN_MONTHS = 11
AND rownum < 2;
min_dt_skey NUMBER;
max_dt_skey NUMBER;
stmt VARCHAR2 (100);
BEGIN
FOR i IN C1
LOOP
-- dbms_output.put_line('Table Name: ' || i.TABLE_NAME);
stmt :='SELECT min(DT_SKEY), max(DT_SKEY) FROM DWH_RSRC_PERF.' || i.TABLE_NAME;
dbms_output.put_line(stmt);
EXECUTE IMMEDIATE stmt
INTO min_dt_skey, max_dt_skey;
dbms_output.put_line ( min_dt_skey || ' = MIN (dt_skey), '
|| max_dt_skey || ' = MAX (dt_skey) for table '
|| i.table_name
END LOOP;
END;
Similar Messages
-
I need help with this code error "unreachable statement"
the error_
F:\Java\Projects\Tools.java:51: unreachable statement <-----------------------------------------------------------------------------------------------------------------THIS
int index;
^
F:\Java\Projects\Tools.java:71: missing return statement
}//end delete method
^
F:\Java\Projects\Tools.java:86: missing return statement
}//end getrecod
^
3 errors
import java.util.*;
import javax.swing.*;
import java.awt.*;
public class Tools//tool class
private int numberOfToolItems;
private ToolItems[] toolArray = new ToolItems[10];
public Tools()//array of tool
numberOfToolItems = 0;
for(int i = 0; i < toolArray.length; i++)//for loop to create the array tools
toolArray[i] = new ToolItems();
}//end for loop
}//end of array of tools
public int search(int id)//search mehtod
int index = 0;
while (index < numberOfToolItems)//while and if loop search
if(toolArray[index].getID() == id)
return index;
else
index ++;
}//en while and if loop
return -1;
}//end search method
public int insert(int id, int numberInStock, int quality, double basePrice, String nm)//insert method
if(numberOfToolItems >= toolArray.length)
return 0;
int index;
index = search(id); <-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------HERE
if (index == -1)
toolArray[index].assign(id,numberInStock, quality, basePrice,nm);
numberInStock ++;
return 1;
}//end if index
}//end if toolitem array
return -1;
}//end insert method
public int delete(/*int id*/)//delete method
}//end delete method
public void display()//display method
for(int i = 0; i < numberOfToolItems; i++)
//toolArray.display(g,y,x);
}//end display method
public String getRecord(int i)//get record method
// return toolArray[i].getName()+ "ID: "+toolArray[i].getID()
}//end getrecod
}//end class
Edited by: ladsoftware on Oct 9, 2009 6:08 AM
Edited by: ladsoftware on Oct 9, 2009 6:09 AM
Edited by: ladsoftware on Oct 9, 2009 6:10 AM
Edited by: ladsoftware on Oct 9, 2009 6:11 AMladsoftware wrote:
Subject: Re: I need help with this code error "unreachable statement"
F:\Java\Projects\Tools.java:51: unreachable statement <-----------------------------------------------------------------------------------------------------------------THIS
int index;
^
F:\Java\Projects\Tools.java:71: missing return statement
}//end delete method
^
F:\Java\Projects\Tools.java:86: missing return statement
}//end getrecod
^
3 errorsThe compiler is telling you exactly what the problems are:
public int insert(int id, int numberInStock, int quality, double basePrice, String nm)//insert method
if(numberOfToolItems >= toolArray.length)
return 0; // <<== HERE you return, so everyting in the if block after this is unreachable
int index;
index = search(id); //< -----------------------------------------------------------------------------------------------------------------HERE
if (index == -1)
toolArray[index].assign(id,numberInStock, quality, basePrice,nm);
numberInStock ++;
return 1;
}//end if index
}//end if toolitem array
return -1;
}//end insert method
public int delete(/*int id*/)//delete method
// <<== HERE where is the return statement?
}//end delete method
public String getRecord(int i)//get record method
// return toolArray.getName()+ "ID: "+toolArray[i].getID() <<== HERE you commented out the return statement
}//end getrecod
}//end class -
I need help with my code..
hi guys. as the subject says I need help with my code
the Q for my code is :
write a program that reads a positive integer x and calculates and prints a floating point number y if :
y = 1 ? 1/2 + 1/3 - ? + 1/x
and this is my code
This program that reads a positive integer x and calculates
and prints a floating point number y if :
y = 1 - 1/2 + 1/3 - ? + 1/x
import java.util.Scanner; // program uses class Scanner
class Sh7q2
// main method begins execution of Java application
public static void main( String args[] )
// create Scanner to obtain input from command window
Scanner input = new Scanner( System.in );
int i = 1; // i is to control the loop
int n = 2; // n is suppose to control the number sign
int x; // a positive integer entered by the user
int m;
System.out.println("Enter a positive integer");
x = input.nextInt();
do
m = (int) Math.pow( -1, n)/i;
System.out.println(m);
n++;
i++;
while ( m >= 1/x );
} // end method main
} // end class Sh7q2 when I compile it there is no error
but in the run it tells me to enter a positive integer
suppose i entered 5
then the result is 1...
can anyone tell me what's wrong with my codeThis program that reads a positive integer x and calculates
and prints a floating point number y if :
y = 1 - 1/2 + 1/3 - ? + 1/x
import java.util.Scanner; // program uses class Scanner
class Sh7q2
// main method begins execution of Java application
public static void main( String args[] )
// create Scanner to obtain input from command window
Scanner input = new Scanner( System.in );
int i = 1; // i is to control the loop
int n = 1; // n is suppose to control the number sign
int x; // a positive integer entered by the user
double m;
int a = 1;
double sum = 0;
System.out.println("Enter a positive integer");
x = input.nextInt();
for ( i = 1; a <= x; i++)
m = Math.pow( -1, n+1)/i;
sum = sum + m;
n++;
a++;
System.out.print("y = " + sum);
} // end method main
} // end class Sh7q2is it right :S -
Need help with WMI code that will send output to db
'm new to WMI code writing, so I need some help with writing code that we can store on our server. I want this code to run when a user logs into their computer
and talks to our server. I also want the code to:
* check the users computer and find all installed patches
* the date the patches were installed
* the serial number of the users computer
* the computer name, os version, last boot up time, and mac address
and then have all this output to a database file. At the command prompt I've tried:
wmic qfe get description, hotfixid
This does return the patch information I'm looking for, but how do I combine that line of code with:
wmic os get version, csname, serialnumber, lastbootuptime
and
wmic nicconfig get macaddress
and then get all this to output to a database file?Thank you for the links. I checked out http://technet.microsoft.com/en-us/scriptcenter/dd793612.aspx and
found lots of good information. I also found a good command that will print information to a text file.
Basically what I'm trying to do is retrieve a list of all installed updates (Windows updates and 3rd party updates). I do like that the below code because it gives me the KB numbers for the Windows updates. I need this information so my IT co-workers &
I can keep track of which of our user computers need a patch/update installed and preferably which patch/update. The minimum we want to know is which patches / updates have been installed on which computer. If you wondering why we don't have Windows automatic
updates enable, that's because we are not allowed to.
This is my code so far.
#if you want the computer name, use this command
get-content env:computername
$computer = get-content env:computername
#list of installed patches
Get-Hotfix -ComputerName $computer#create a text file listing this information
Get-Hotfix > 'C:\users\little e\Documents\WMI help\PowerShell\printOutPatchList.txt'
I know you don't want to tell me the code that will print this out to a database (regardless if it's Access or SQL), and that's find. But maybe you can tell me this. Is it possible to have the results of this sent to a database file or do I need to go into
SQL and write code for SQL to go out and grab the data from an Excel file or txt file? If I'm understanding this stuff so far, then I suspect that it can be done both ways, but the code needs to be written correctly for this to happen. If it's true, then which
way is best (code in PowerShell to send information to SQL or SQL go get the information from the text file or Excel file)? -
Need help with error code 150:30
need help with finding out what error code 150:30 is and how to fix it
See the following:
Error 150:30 - Error "Licensing has stopped working" | Mac OS :
http://helpx.adobe.com/x-productkb/global/error-licensing-stopped-mac-os.html -
Noob needs help with this code...
Hi,
I found this code in a nice tutorial and I wanna make slight
adjustments to the code.
Unfortunately my Action Script skills are very limited... ;)
This is the code for a 'sliding menue', depending on which
button u pressed it will 'slide' to the appropriate picture.
Here's the code:
var currentPosition:Number = large_pics.pic1._x;
var startFlag:Boolean = false;
menuSlide = function (input:MovieClip) {
if (startFlag == false) {
startFlag = true;
var finalDestination:Number = input._x;
var distanceMoved:Number = 0;
var distanceToMove:Number =
Math.abs(finalDestination-currentPosition);
var finalSpeed:Number = .2;
var currentSpeed:Number = 0;
var dir:Number = 1;
if (currentPosition<=finalDestination) {
dir = -1;
} else if (currentPosition>finalDestination) {
dir = 1;
this.onEnterFrame = function() {
currentSpeed =
Math.round((distanceToMove-distanceMoved+1)*finalSpeed);
distanceMoved += currentSpeed;
large_pics._x += dir*currentSpeed;
if (Math.abs(distanceMoved-distanceToMove)<=1) {
large_pics._x =
mask_pics._x-currentPosition+dir*distanceToMove;
currentPosition = input._x;
startFlag = false;
delete this.onEnterFrame;
b1.onRelease = function() {
menuSlide(large_pics.pic1);
b2.onRelease = function() {
menuSlide(large_pics.pic2);
b3.onRelease = function() {
menuSlide(large_pics.pic3);
b4.onRelease = function() {
menuSlide(large_pics.pic4);
I need to adjust five things in this code...
(1) I want this menue to slide vertically not horizontally.
I changed the 'x' values in the code to 'y' which I thought
would make it move vertically, but it doesn't work...
(2) Is it possible that, whatever the distance is, the
"sliding" time is always 2.2 sec ?
(3) I need to implement code that after the final position is
reached, the timeline jumps to a certain movieclip to a certain
label - depending on what button was pressed of course...
I tried to implement this code for button number two...
b2.onRelease = function() {
menuSlide(large_pics.pic2);
if (currentPosition = finalDestination) {
this.large_pics.pic2.gotoAndPlay("s1");
--> sliding still works but it doesn't jump to the
appropriate label...
(4) I wanna add 'Next' & 'Previous' buttons to the slide
show - what would be the code in this case scenario ?
My first thought was something like that Flash checks which
'pic' movieclip it is showing right now (pic1, pic2, pic3 etc.) and
depending on what button u pressed u go to the y value of movieclip
'picX + 1' (Next button) or 'picX - 1' (Previous button)...
Is that possible ?
(5) After implementing the Next & Previous buttons I need
to make sure that when it reached the last pic movieclip it will
not go further on the y value - because there is no more pic
movieclip.
Options are to either slide back to movieclip 'pic1' or
simply do nothing any more on the next button...
I know this is probably Kindergarten for you, but I have only
slight ideas how to do this and no code knowledge to back it up...
haha
Thanx a lot for your help in advance !
Always a pleasure to learn from u guys... ;)
MikeHi,
I made some progress with the code thanx to the help of
Simon, but there are still 2 things that need to be addressed...
(1) I want the sliding time always to be 2.2 sec...
here's my approach to it - just a theory but it might work:
we need a speed that changes dynamically depending on the
distance we have to travel...
I don't know if that applies for Action Scrip but I recall
from 6th grade, that...
speed = distance / time
--> we got the time (which is always 2.2 sec)
--> we got the disctance
(currentposition-finaldestination)
--> this should automatically change the speed to the
appropriate value
Unfortunately I have no clue how the action script would look
like (like I said my action script skills are very limited)...
(2) Also, one other thing I need that is not implemented yet,
is that when the final destination is reached it jumps to a certain
label inside a certain movieclip - every time different for each
button pressed - something like:
if (currentPosition = finalDestination) {
this.large_pics.pic2.gotoAndPlay("s1");
that statement just doesn't work when I put it right under
the function for each button...
Thanx again for taking the time !!!
Mike -
Newb needs help with dynamic text
Hi Everyone,
I don't like being a newb - but that's how it is...
I'm trying to create a multipage registration form that
allows uses to register products.
The first page asks for name etc, and on the second page I
want it to say "Welcome "+username "!" - that sort of thing...
The problem is I can't get it to keep the dynamic text values
accross the pages.
I can get it to repeat the input on the first page with this
code:
_root.firstname_txt.onChanged = function() {
_root.firstname_repeat.text="Hello
"+_root.firstname_txt.text;
However when I call it on the second page it is undefined:
second_repeat.text="hello "+_root.firstnamt_txt.text;
trace (_root.second_repeat.text);
I'm sure this is something simple and I'm just a programming
dunce...
Any help is appreciated.
taif your textfield (_root.firstname_repeat) doesn't exist on
the 2nd frame, its text property will be undefined.
to remedy, either extend your textfield's existance into the
frames needed or use a variable to store its text property (in your
onChanged handler) and use that variable to retrieve the value you
need. -
Beginner needs help with simple code.
I just statrted learnind java, and I need some help with this simple program. For some reason everytime I enter my Farenheit value, the Celsius conversion returns as 0.0. Would really appreciate the help. Thanks.
Here's the code:
public class TempConverter
public static void main(String[] args)
double F = Double.parseDouble(args[0]);
System.out.println("Temperature in Farenheit is: " + F);
double C = 5 / 9;
C *= (F - 32);
System.out.println("Temperature in Celsius is: " + C);
}double C = 5 / 9This considers "5" and "9" to be integers and does an integer division, discarding the remainder. The result of that division is 0. Trydouble C = 5.0/9.0;
-
Need help with Dynamic Excel File Name please.
I am try to output an excel file with dynamic date.
Here what I done.
I am using SQL 2012.
Create Execute SQL Task Connect Type: Excel
Create Data Flow Task set to DelayValidation: True
Create OLE DB Sourc
Create Data Converstion
Excel Destination
Excel Connection, Expression, select ExcelFilePath
@[User::sXLFilePath] + @[User::sFileName] + RIGHT("0" + (DT_WSTR, 2) DATEPART("DD", GETDATE()), 2)+ RIGHT("0" + (DT_WSTR, 2) DATEPART("MM", GETDATE()), 2) + RIGHT((DT_WSTR,
4) DATEPART("YYYY", GETDATE()), 2) +".csv"
C:\ExcelOutPut\SOX_CAM_SQL_Report_010215.xls
What I try to accomplish is output the file with each day append to it, date must be DDMMYY.
I google it and found many samples, tested it, and none of them is work for me.
Any suggestions or some examples to share is greatly appreciate.
I am new to SSIS. I found one poster have similar issue and inside the posted below, there was one suggestion to create variable and connection string but how do I bind that variable to Excel Connection manger.
Please help.
Thank you so much in advance.
Ex: SOX_CAM_SQL_Report _020215.csv
SOX_CAM_SQL_Report _030215.csv
--Similar issue:
https://social.msdn.microsoft.com/Forums/en-US/bda433aa-c8f8-47c9-9e56-efd20b8354ac/creating-a-dynamic-excel-file?forum=sqlintegrationservices
Suggestion in the above posted but where can bind this to Excel Connection Manger.
Please help provide step by step. Thanks.
"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\\temp\\" + "ExcelTarget" + (DT_WSTR,4)DATEPART("yyyy",GETDATE()) +
".xls" + ";Extended Properties=\"EXCEL 8.0;HDR=YES\";"
And yes, as you were intimating, the delay validation on the dataflow should be set.Hi NguyenBL,
According to your description, you created ssis package to export data from database to excel, when the package runs, you want to create new excel and name the file with time stamp. If that is the case, we can achieve the goal by following steps:
Create a script task used to create excel files.
Create a data flow task to export data from database to excel.
Add OLE DB source to data flow task.
Add Excel Destination to data flow task.
Create connection manager for OLE DB and Excel.
Click Excel Connection Manager, in Properties window, click (…) button next to Expressions, then set ExcelFilePath with expression like below:
"C:\\ETL Lab\\CreateNewExcel\\ExportData_"+REPLACE((DT_STR, 20, 1252)(DT_DBTIMESTAMP)@[System::StartTime], ":", "")+".xls"
For detail information, please refer to the document:
https://sqljourney.wordpress.com/2013/01/12/ssis-create-new-excel-file-dynamically-to-export-data/
If you have any more questions, please feel free to ask.
Thanks,
Wendy Fu
Wendy Fu
TechNet Community Support -
What is wrong with this code? It does not play. It should play in Windows-7 and XP with IE8.
Also, on the screen there is a large white area where the <video> code is. Why?
How do I get rid of it?
Thanks.
<!DOCTYPE HTML>
<html>
<head>
<title>video testing</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
</head>
<body>
<p>Click the <a href="Download" _mce_href="http://www.amelox.com/Media/UX-CT-Tour-Short-1024d12db.mp4">Download">http://w ww.amelox.com/Media/UX-CT-Tour-Short-1024d12db.mp4">Download mp4 </a> button to start video.</p>
<p>Click the <a href="Download" _mce_href="http://www.amelox.com/Media/UX-CT-Tour-Short-1024d12db.webm">Download">http:// www.amelox.com/Media/UX-CT-Tour-Short-1024d12db.webm">Download webm </a> button to start video.</p>
<p>Click the <a href="Download" _mce_href="http://www.amelox.com/Media/UX-CT-Tour-Short-1024d12db.ogg">Download">http://w ww.amelox.com/Media/UX-CT-Tour-Short-1024d12db.ogg">Download ogg </a> button to start video.</p>
<p>Click the <a href="Download" _mce_href="http://www.amelox.com/Media/UX-CT-Tour-Short-1024d12db.flv">Download">http://w ww.amelox.com/Media/UX-CT-Tour-Short-1024d12db.flv">Download flv </a> button to start video.</p>
<video width="480" height="270" controls="controls">
<source media="all" src="rtp:UX-CT-Tour-Short-1024d12db.mp4" type='video/mp4; codecs="vp8, vorbis"' />
<source media="all" src="rtp:UX-CT-Tour-Short-1024d12db.webm" type='video/webm; codecs="avc1.42E01E, mp4a.40.2"' />
<source media="all" src="rtp:UX-CT-Tour-Short-1024d12dB.ogg" type="video/ogv; codecs="theora, vorbis"" />
<object data="id=player1" width="480" height="270">
<param name="classid" value="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" />
<param name="movie" value="player.swf" />
<param name="flashvars" value="UX-CT-Tour-Short-1024d12db.flv & autostart=true" />
<param name="allowfullscreen" value="false" />
<param name="quality" value="high" />
<param name="wmode" value="opaque" />
<param name="allowscriptaccess" value="always" />
<embed flashvars="file=UX-CT-Tour-Short-1024d12db.flv & autostart=true" id="player1" src="player.swf"
allowfullscreen="true" allowscriptaccess="always" width="480" height="270" />
</object>
</video>
<p>here is some more text</p>
</body>
</html>Data load? Did it pass a syntax check?
Anyway, maybe this will help:
DATA: create_date TYPE sy-datum,
update_date TYPE sy-datum,
number_of_days_closed(4) TYPE c,
alert_close_flag(1) TYPE c,
result LIKE number_of_days_closed.
IF alert_close_flag EQ 'Y'.
number_of_days_closed = update_date - create_date .
ELSE.
CLEAR number_of_days_closed.
ENDIF.
result = number_of_days_closed.
Rob -
Hi,
I'm trying to make a driver for an instrument with NAT9914 chipset and I'm having some problems. Sometimes, my Read lost the first character and my Write always get stuck waiting for BO after sending the first character.
Can somebody points me out what is wrong?
Here is my code:
* Initialization
// enable 9914 chip reset state
GPIBout(&(hDev->pIo->w.auxcr, 0x1c);
// disable all interrupts
GPIBout(&(hDev->pIo->w.imr0, 0);
GPIBout(&(hDev->pIo->w.imr1, 0);
// clear status registers by reading
GPIBin(&(hDev->pIo->r.isr0);
GPIBin(&(hDev->pIo->r.isr1);
// set GPIB address;
GPIBout(&(hDev->pIo->w.adr,(25 & 0x1f));
// speed is 4Mhz
GPIBout(&(hDev->pIo->w.accr), 0x0100 );
// Set T1 Delay to vstdl
GPIBout(&(hDev->pIo->w.auxcr), 0x97 );
// release 9914 chip reset state
GPIBout(&(hDev->pIo->w.auxcr), 0x00);
* Read
// Wait to be Active Listener
while( !((GPIBin(&(hDev->pIo->r.adsr)) & HR_LAPS)) );
// set and get eos
ibeos(hDev, (REOS << 8) | '\n');
eos = bdGetEOS();
// reading loop
while(1)
// send RHDF
GPIBout(&(hDev->pIo->w.auxcr),AUX_RHDF);
// wait for BI or stop on end
while(!((isreg1 = GPIBin(&(hDev->pIo->r.isr0)) & HR_BI) && !(isreg1 & HR_END ) && NotTimedOut());
// No BI
if( (isreg1 & HR_END) || TimedOut() )
break;
// read byte
bin[j++] = GPIBin(&(hDev->pIo->r.dir);
// read last character
bin[j] = GPIBin(&(hDev->pIo->r.dir));
// make string readable
if((eosmodes & REOS) && (bin[j] == eos ))
bin[j] = '\0';
else
bin[j+1] = '\0';
* Write
// Wait to be Active Talker
while( !((GPIBin(&(hDev->pIo->r.adsr)) & HR_TPAS)) );
// writting loop
while(i{
// write byte to register
GPIBout(&(hDev->pIo->w.cdor), buf[i++]);
// wait for BO or ERR
while( !((GPIBin(&(hDev->pIo->r.isr0)) & HR_BO))
|| !((GPIBin(&(hDev->pIo->r.isr1)) & HR_ERR)) )
// if error, stop
if((GPIBin(&(hDev->pIo->r.isr1)) & HR_ERR))
break;
// if no error, send EOI with last byte
if(!((GPIBin(&(hDev->pIo->r.isr1)) & HR_ERR)))
GPIBout(&(hDev->pIo->w.auxcr ), 0x08 );
GPIBout(&(hDev->pIo->w.cdor), buf[i]);
Thanks,
MichaelTry visiting the NI web site for Registry Level programming. It contains Manuals, Notes, Examples and KB entries that should help with your application:
ni.com>>Technical Support>>GPIB>>GPIB Register Level Programming -
Need help trying to upgrade itunes for windows, i get to a certain point and the following error comes up "ERROR 1714: THE OLD VERSION OF ITUNES CANNOT BE REMOVED CONTACT YOUR TECHNICAL SUPPORT GROUP" i click ok and then another error comes up "ERROR 1603 FATAL ERROR" can anybody help Please!!!!!!!!!!!!!!!!!!!!
hi wags!
hmmmm. okay, let's try using the complete uninstallation instructions from the following document to remove your existing itunes and QT:
Trouble installing iPod, iTunes, or QuickTime software in Windows
if you do that first, will the new itunes install go through properly?
if you get an error message on the uninstalls, let us know what it says. include error message numbers if you're getting any.
love, b -
Need help with LabVIEW code for motor control.
Hi,
My name is Sasi. I am a BME grad student working on my thesis topic of evaluating spine implants for low back pain. For this I am building a test machine that would apply pure moments to a spine specimen. I am using LabVIEW 8.5 to implement control of a brushless AC servo motor. My requirement is,
Step 1: Initialize the motor.
Step 2: Start moving it at a uniform RPM to the right (This RPM value too user can enter).
Step
3: While doin Step 2; simultaneously read torque cell data (Using DAQ
asst.). DAQ o/p is from 0 V to 10 V; 0 V being -10 Nm n
10 V being +10 Nm
Step 4: When Torque value reaches +10 Nm, i.e 10 V, the motor stops.
Step
5: From the position where motor stopped (i.e no need to reset to
initial position) Start moving in the opposite direction at the same
uniform RPM as in Step 2 while reading torque cell data.
Step 6: Once again when torque reaches -10 Nm, i.e. 0 V, the motor should stop.
Step 7: Repeat 'Step 2' to 'Step 6' 3 times.
Step 8: Reset motor postion.
Till now I have managed to get the motor to move forward n backward @ a desired vel, accl, n deceleration for 3 cycles. I am attaching my code. I am having problem inserting the code for reading DAQmx amidst all this. Can anyone help me out.
Thnks,
Sasi.
Solved!
Go to Solution.
Attachments:
Test_012609.vi 35 KBHi Sasidhar,
I took a look at your problem and I think I have a workable solution for you. I definitely agree with Lynn's suggestion of using parallel loops. This will allow the DAQmx portion to run uninhibited by the motion portion, and vice versa. Plus, you only need to iterate the motion loop whenever the voltage level crosses a threshold. So, by iterating on the motion code in the same loop that you are iterating on DAQmx code, you are essentially wasting processor.
I created a VI that should do what you are wanting. I tested it out myself and it works great. You might have a tweak a few things to apply to your system (like motion board ID and DAQmx physical channel, etc.). I used two parallel loops and event-based programming. Basically the motion loop starts the motor spinning at the specified velocity. Once the motor is spinning, it waits for the DAQmx loop to tell it that the voltage value has crossed the threshold. When the voltage value exceeds the maximum threshold (which I set to a value slightly less than 10 to allow for jitter and saturation), the DAQmx loop signals the motion loop that it can finish its iteration. The motion loop stops the motion, reverses the direction, and starts the motion again. Once motion has started, it again waits for the DAQmx loop to tell it that a threshold has occurred, but this time, it is looking for a minimum threshold. I used "Occurrences" to implement the event-based programming in LabVIEW.
I have commented the code rather thouroughly, so hopefully the comments will answer any remaining questions. The benefit of using event-based programming for this is that you save processor time, and your motion is more closely synchonized with the DAQmx. Instead of iterating the motion loop as fast as you can, checking for updates each time, you just pause it, and wait for the other loop to tell you when to start up again. In the mean time, the processor doesn't have to worry about iterating that loop over and over again. Also, when the occurrence does occur, you catch it immediately, instead of having to wait until the next iteration. Thus, you are more closely synchronized with the DAQmx portion of the code.
I hope this will help you. Please post back if you have any questions about the code or its implementation. Good Luck!
Message Edited by Wes P on 02-03-2009 05:18 PM
Wes P
Certified LabVIEW Developer
Attachments:
Motion and DAQ.vi 59 KB
DAQmx Loop.png 24 KB
Motion Loop.png 17 KB -
Need help with Labview code for DAQmx
I'm currently trying to write Labview code for some thesis research and am having problems. I'm using the cDAQ 9172 with strain gage modules and two voltage input modules. I'll be reading/recording a voltage from an external source on one channel, while recording strains and accelerations with the other channels. I need to do all this simultaneously.
Everything I've done to this point has been in SignalExpress so I'm not sure how to program any of this. I also need to be able to calibrate the strain gages prior to each set of recordings. Any help you guys could offer would be greatly appreciated. Thanks.Hi,
I'm not sure how much this will help you, but I've attached a screen dump of code from a project I did that sounds pretty similar to what you're working on. The code is from a subVI that I used to create the daqMX measurement task for my data acquisition. I was also using a 9172. This was written in 8.5, but the only thing that you may not have access to is the functions for null offset and shunt cal of the strain gage channels. Hopefully this will at least get you started on your way to setting this up.
Andrew Carollo
Attachments:
create task.jpg 208 KB -
I am a Microsoft J++ developer, but am switching to Sun technologies. The first application that I need to work on is an application that does a great deal of dynamic HTML. I originally wrote this application under J++ but I need to convert it to Sun Java. The methodology J++ used for dynamic HTML (extending DhDocument) appears to be duplicated (somewhat) with Swing. I need a little push start here, I seem to have a mental block. My application must run in the client browser, so I believe an applet is the way to go, but I can't figure out how to manipulate HTML from an applet through Swing. Can someone point me to a simple Applet that, say for example, changes the value of a text box that is predefined in the HTML, I would greatly appreciate it. That should get me past this mental block so I can go on with the conversion. I have successfully added textboxes with Swing through my Applet, but I need to manipulate HTML elements that already exist. That's where I'm stuck.
Here's the code I come up with. It doesn't work. I get a javascript exception on getWindow. I have never used the JSObject before. Can you give me any advice on what I am doing wrong?
import javax.swing.*;
import netscape.javascript.*;
public class Search extends JApplet
public void init()
JSObject obj = JSObject.getWindow(this);
JSObject doc = (JSObject) obj.getMember("document");
String[] element = new String[1];
element[0] = "UserID";
JSObject form = (JSObject) doc.call("getElementById", element);
}
Maybe you are looking for
-
why the iBooks doesnt belong to the programm which can transfer content from my pc to the new ipad? (whe i first installed itunes on the pc, every book was transfered in the iBooks' library, but not any more!).
-
Standby database in sync ... ?
Dear Experts, (Oracle 10g, Windows Server 2003). we have a standby database in maximum performace mode, I want to make sure that both are in sync or not, ihow to find ? and if they are not then what must be done to make them in sync. Thanks&Regards s
-
Hello All, I have a problem with editing options in FB60 . I want to change DOC.type option From Document type hidden To Doc type ready for input, then got error message 'Enter a valid value ' . Is there anybody see that kind of error message ? Best
-
Please help i can't open file or application such as notepad I am using Captivate 7
-
Bonjour, je ne trouve pas le pantone 2035 C sur Illustrator, quelqu'un peut il m'aider? Merci de votre retour