How to save a string of 0's and 1's as bits
can any one help me with this
i have a string 000100011110101010
i have to save each 1 and 0 as bits
http://java.sun.com/j2se/1.5.0/docs/api/java/util/BitSet.html
Edit: Sorry originally posted the index, but wanted the class (like it is now).
Similar Messages
-
How to save a string input by the user to a file
Hi,
Can anyone please teach me how to save a string or several string that requires the input of the user into a text file?
Your help is very much appreciated!
Thank you!http://java.sun.com/docs/books/tutorial/essential/io/index.html
-
How to save .pdf file using office word and excel
Can someone help me how to save .pdf files using office word and excel? I reinstalled my adobe 7.0 pro in my new pc and before I was able to do it but with my old pc.
For anything after Office 2003, you have to print to the Adobe PDF printer. If you installed AA 7 on OS newer than XP, you may have to do a workaround to get it to work. With later versions of WORD you can always use the MS plugin for creating PDFs.
-
How to save column widths in tag monitor and tag config editor?
how to save column widths in tag monitor and tag config editor?
The attached example may help.
After launching the editor, I locate a reference to the front panel control named "Tag List".
This is type cast as a multicolumn list box which then allows me to increment through all of the cells and set the widths as i go.
Trying to help,
Ben
Ben Rayner
I am currently active on.. MainStream Preppers
Rayner's Ridge is under construction
Attachments:
Set_Width2.vi 60 KB
SET_WIDTH.JPG 94 KB -
How to save the string from JTextFied to database?
can i know how to save the data from JTextFied to databse. Is it using update?
The most straightforward way would be something like:
String myKey=myKeyField.getText();
String foo=fooField.getText();
String sql="update mytable set foo='"+foo+"' where mykey='"+myKey+"'";
connection.createStatement().executeUpdate(sql);
This example assumes that the input fields cannot possibly contain quotes or the string won't be built correctly. Which by the way brings up a question I'd be interested in hearing others answer: What do you do about this? Sometimes I use PreparedStatement which handles that problem, other times I write my own little function to escape the string properly.
You can also read the record into a ResultSet and use ResultSet.update(). I'm mostly using mySql and I found that in mySql ResultSet.update just creates a SQL update statement like I did above and executes it, so the only real advantage would be if you find the syntax more convenient. Perhaps other database drivers do something different that would give other pros and cons. -
How to save a string to a variable..
i need to save a string to a variable but have no idea......
currently my code looks like
Scanner getname = new Scanner (System.in);
System.out.print("You have entered the name: " + getname.next());anyone with any ideas i will appreciate a lot!Keep this to one thread.
http://forum.java.sun.com/thread.jspa?threadID=5258663&tstart=0 -
How to save a TCP session ID opened and use it in another VI?
what i want to achieve:
open a TCP session in a VI, save the session ID to Teststand, then after certain process, write/read/close the same TCP session in another VI.
my question:
1. how to pass TCP session ID between labview and Teststand
2. how to use the same TCP session across different VIs.
thanks
Solved!
Go to Solution.You could typecast the reference to a U32 and sent that u32 to Teststand.
Be aware that the VI that opens the reference should be kept active (=running) or LabVIEW might close the reference silently.
Ton
Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
Nederlandse LabVIEW user groep www.lvug.nl
My LabVIEW Ideas
LabVIEW, programming like it should be! -
how to save firefox,without losing data.that means when i am closing firefox its not asking to svae or not
In the Tools menu select Options to open the options dialog. Select the General panel and change the setting "When Firefox starts" to "Show my windows and tabs from last time".
-
How to send a string to CVI .c and get string return through TestStand sequence?
Hi, I am using TestStand 3.1 and I have the StringConverter.c with CVI 8.0 with the function:
char * string_concat_2 (char* str1,char* str2)
char * str_ret;
str_ret = calloc(200, sizeof(char*));
str_ret = strcat (str_ret, str1);
str_ret = strcat (str_ret, str2);
return str_ret;
I would like to use it through Teststand, so I add a sequence using 'StringValueTest'. I Spectify Module CVI & link to StringConverter.c and type in Function Name: char * string_concat_2 (char* str1,char* str2)
1. How I define to send the string1 ("Hello") & string2 ("World") to the Module?
2. How I define to string return ("HelloWorld" from the Module?
ThanksHi plit string,
You will need to have a parameter passed by reference to return the
string. To do this, use a "C String Buffer" instead of a "C String
(const)" parameter type. There is documentation on this in TestStand
Help. Here is a quote from there:
"When using string parameters, use the C String Buffer or Unicode
String Buffer type if you want the function to be able to change the contents of
the argument in TestStand. Use the C String or Unicode String type if the DLL
function does not modify the argument. You can pass a literal string, a
TestStand string property, or an expression that evaluates to a string as the
value of a string parameter."
Gavin Fox
Systems Software
National Instruments -
How to read a string character by character and pass it into an array
Hi,
I have a requirement to write a function.The thing is,i need to read string,replace space with a NULL,return in the form of an arrayy.
for this what i thought is,if the character is not a space,i need to put that into array,if its space,put a NULL for that.
the string is of type varchar2.
ex:XX XX XX
i need some suggestions for this.
thanksWell, you can just use a loop that runs for the length of the string.
Then for each iteration of the loop, take the next character of the string (substr or similar) and add it to the array. If it's a space, then add a NULL to the array (if that's what you want).
Easy :) -
How to save data from JTable multiple rows and columns
Hi Y_Not thanks for your help before...
But what should I do if I want to get/save many data from many column and rows??i don't quite understand your (repeated) question. what is the problem with "multiple rows and columns". Y_NOT and i have shown you ways to access them.
all you need are 2 loops: one around your number of rows and one around the number of columns or vice versa depending in which order you want to save things:
for (int col = 0; col < data.size(); col++) {
for (int row = 0 ; row < data[col].size(); row++) {
// save your data
saveData(data[col].getElementAt(row));
// or use yourtable.getValueAt(row, col);
}this is not a problem of Swing/Java but of simple algorithm...
thomas -
How to save data in a 4D array and make partial plots in real time?
Hi, this is a little complex, so bear with me...
I have a test system that tests a number of parts at the same time. The
experiment I do consists of measuring a number of properties of the
parts at various temperatures and voltages. I want to save all the
measured data in a 4-dimensional array. The indices represent,
respectively, temperature, voltage, part, property.
The way the experiment is done, I first do a loop in temperature, then
in voltage, then switch the part. At this point, I measure all the
properties for that condition and part and want to add them as a 1D
array to the 4D array.
At the same time, I want to make a multiple plot (on an XY graph) of
one selected property and part (using two pull-down selectors near the
XY graph) vs. voltage. (The reason I need to use an XY graph and not a
waveform graph, which would be easier, is that I do not have
equidistant steps in voltage, although all the voltage values I step
through are the same for all cases). The multiple plots are the data
sets at different temperatures. I would like to draw connection lines
between the points as a guide to the eye.
I also want the plot to be updated in the innermost for loop in real
time as the data are measured. I have a VI working using nested loops
as described above and passing the 4D array through shift registers,
starting with an array of the right dimensions initialized by zeroes. I
know in advance how many times all the loops have to be executed, and I
use the ReplaceArraySubset function to add the measured properties each
time. I then use IndexArray with the part and property index terminals
wired to extract the 2D array containing the data I want to plot. After
some transformation to combine these data with an array of the voltage
values in the form required to pass to the XYGraph control, I get my
plot.
The problem is: During program execution, when only partial data is
available, all the zero elements in the array do not allow the graph to
autoscale properly, and the lines between the points make little sense
when they jump to zero.
Here is how I think the problem could be solved:
1. Start with an empty array and have the array grow gradually as the
elements are measured. I tried to implement this using Insert Into
Array. Unfortunately, this VI is not as flexible as the Replace Array
Subset, and does not allow me to add a 1D array to a 4D array. One
other option would be to use the Build Array, but I could not figure
out if this is usable in this case.
2. The second option would be to extract only the already measured data
points from the 4D array and pass them to the graph
3. Keep track of the min. and max. values (only when they are different
from zero) and manually reset the graph Y axis scale each time.
Option 3 is doable, but more work for me.....
Option 2: I first tried to use Array Subset, but this always returns an
array of the same dimensionality of the input array. It seems to be
very difficult, but maybe not impossible, to make this work by using
Index Array first followed by Array Subset. Option 3 seems easier.
Ideally, I would like option 1, but I cannot figure out how to achieve
this.
Your help is appreciated, thanks in advance!
germ Remove "nospam" to replyIn article <[email protected]>,
chutla wrote:
> Greetings!
>
> You can use any of the 3D display vi's to show your "main" 3d
> data, and then use color to represent your fourth dimension. This can
> be accessed via the property node. You will have to set thresholds
> for each color you use, which is quite simple using the comparison
> functions. As far as the data is concerned, the fourth dimension will
> be just another vector (column) in your data file.
chutla, thanks for your post, but I don't want a 3D display of the
data....
> Also, check out
> the BUFFER examples for how to separate out "running" data in real
> time.
Not clear to me what you mean, but will c
heck the BUFFER examples.
> As far as autoscaling is concerned, you might have to disable
> it, or alternatively, you could force a couple of "dummy" points into
> your data which represent the absolute min/max you should encounter.
> Autoscaling should generally be regarded as a default mode, just to
> get things rolling, it should not be relied on too heavily for serious
> data acquisition. It's better to use well-conditioned data, or some
> other means, such as a logarithmic scale, to allow access to all your
> possible data points.
I love autoscaling, that's the way it should be.
germ Remove "nospam" to reply -
How to save a booklet to e-mail and retain book format?
I've created a brochure using the "booklet" format in Indesign. I'd like to be able to e-mail out and have it retain the "book" layout. Is that possible? If I save as a pdf it loses all formatting and it's a regular scroll down to view page after page. The end users/readers will have varying computers and programs and there's no way for me to tell which.
Alternatively, I would be happy enough to get this up on my website to be viewed in booklet format and refer people there, preferably with an option to print it out.
Does anyone know how I can do both or either of these?
Thanks in advance.
AnnetteIn a situation like this I would export a PDF as single pages -- DON'T make a booklet, you aren't printing and it will just confuse readers to see things imposed -- and set the initial view in Acrobat Pro to display two-up with coverpage. Your readers can then decid if they want to see the spreads, or change the view for themselves.
-
How does "Unflatten From String" take a type and return a value of that type?
http://zone.ni.com/reference/en-XX/help/371361E-01/glang/unflatten_from_string/
How exactly does the "type" argument for "Unflatten From String" work? I need to create a VI that takes a type, passes it as an argument to several calls of the "Unflatten From String" function, and returns an array containing elements of the type originally passed. The "Unflatten From String" function seems to do some magic though, because the type of the "value" that it outputs changes depending on the type it is passed as input. How do I do the same magic in my VI?
Ultimately, what I need to accomplish is an unflatten-list operation. Given a type T and a byte string of length L (which contains a concatenation of T elements that are flattened to their bytes), create a VI that unflattens all the types in the string and return an array of length (L / sizeof(T)) that contains each type.
Note: performing the unflatten-list operation is trivial, but I cannot for the life of me figure out how to do it in a VI that takes a type and returns an array of the appropriate type. By the way, my data is being given to me from another source, so please don't bother suggesting that I should be flattening an array using LabVIEW's "Flatten To String" function in the first place. My data is not given in LabVIEW's array format: http://zone.ni.com/reference/en-XX/help/371361B-01/lvconcepts/flattened_data/
Thanks a ton!
-WakkaTake a look at this example: You can see that the flattened string contains several bytes. The first four bytes contain the length of array (number of elements). Since the data type is U32, the next 32 bits (4 bytes) contains the value of the first element, and so on. Could you possibly use this scheme to do what you want to do? Other data types present different outputs. You would have to experiment with them.
- tbob
Inventor of the WORM Global -
How to split a string into alfa-numerics and numerics ?
Thru I/O Assistant.vi I queried a GPIB frequency synthesizer and get a string " FRq99999.999999Hz " ( this is a micro Herz synthesizer and the query shows the correct value ).
The "9"'s are alfanumerics as well as the " FRq " and the " Hz ".
Thru a string indicator I can see this complete value on the front panel.
So far so good.
But now :
1.
How could I separate the numerics ( in string format ) out of this string and convert them into numerics in order to have them displayed in some numerics graph form ?
2.
How could I delete the " FRq " and the " Hz " out of the string, so that the " 9 " 's remain and could be converted into numerics ?
This result wil be the same as my question #1 but now ther
e will be no A/N remainder.
Thanks for any help.reteb wrote:
> Thru I/O Assistant.vi I queried a GPIB frequency synthesizer and get a
> string " FRq99999.999999Hz " ( this is a micro Herz synthesizer and
> the query shows the correct value ).
> The "9"'s are alfanumerics as well as the " FRq " and the " Hz ".
>
> 2.
> How could I delete the " FRq " and the " Hz " out of the string, so
> that the " 9 " 's remain and could be converted into numerics ?
> This result wil be the same as my question #1 but now there will be no
> A/N remainder.
Scan From String with a format string of "%.;%[^0-9]%f"
Explanation:
%.; : use point as decimal comma
%[0-9] : scan all characters not equal to 0 up to 9
%f : scan for floating point number using the decimal comma
indicated at the beginning.
Rolf Kal
bermatter
Rolf Kalbermatter
CIT Engineering Netherlands
a division of Test & Measurement Solutions
Maybe you are looking for
-
Download to Data option for Hyperlinks on Reports
Hi, There is a column called OrderNumber which will display its values in the form of hyperlink. On Master Report Page, it is taken from a fact called Orders.OrderNumber which when clicked leads to Details Report on a new window where the value need
-
What can I do about an iPhone 4S where the on/off button has quit working?
I've heard this is a common problem. Will Apple pay for fixing it as a product defect?
-
I have just installed CS 5.5 but no program icons are showign on my desktop screen. Can you help me?
-
Paying double each month for Internet Security Suite?
I noticed that we are paying twice each month for Internet Security Suite: once as a billed item ($6.99); and again as part of the Backup and Security Bundle ($11.00). It seems this has been going on since about Aug 2013. Hence, I dropped the standal
-
My home page only displays computers and settings icons. No other icon. How can I get other icons?