Help!Working with bits

Hi all!
First of all sorry, because my email is too long :(
I'm trying to make read/write operations with bits buy I'm going mad. That's my problem:
I have a file called "doubles.bin" which stores numbers in double format and I need to read every data in that file, take a number of bits specified by the user and create a file with those new data,that is:
doubles.bin : ...
_1000001000001011100000_111110000000000000000000000000000000000000
num_bits_to_read = 22
new.bin: ...
1000001000001011100000
I've tried with different libraries:
BitSet ,
[java.lang.Object-> BitInputStream|http://www.iu.hio.no/~ulfu/appolonius/e-bok/vedleggA/BitInputStream.html],
[org.kc7bfi.jflac.io.BitOutputStream|http://jflac.sourceforge.net/apidocs/org/kc7bfi/jflac/io/BitOutputStream.html#writeRawULong(long,%20int)]
and the last one seems to be the most useful but I'm not sure how exactly wotks the method "writeRawULong"
so, the questions are:
1. What do you think is the most efficient library or way to solve this?
2. Does anybody know what exactly does the method "writeRawULong(long val, int bits)" of the last library?
Any help would be apreciated!

platters wrote:
jverd wrote:
Is this a text file, with the ASCII character 11010011 etc.? Or is it a binary file?
What format is it in? Not "text" or "binary". Rather, in addition to it being text or binary, which specific textual or binary format was used to encode the values? How did the file get written in the first place?"doubles.bin" has been created using the writeDouble method in class DataOutputStream, so values are stored according to the IEEE 754 floating-point "double format" bit layout.So just read it with readDouble() then.
>
>>
What specific problems are you having? "Not perfect" contains no useful information.Ok, I'm gonna try to explain well the problem.
I want to read from that "doubles.bin" each data in long format Why long format? Why not double format, since that's what you wrote it with. But if you want long format, use readLong. Every valid double is also a valid long, BUT the values will be very different. 1.0 in double will NOT be 1 in long, and 123.456 will not just be rounded to 123. They're totally different formats.
and create a new file which stores n-bits of each data read in order to create a smaller file.Huh???
The problem is that I have to create an image with the modified data and I've noticed that when the number of bits I read from each original data is multiple of 8 the image is ok but in the other case there is noise. Well, you can't just trim out arbitrary bits and expect it still to be meaningful. Have you studied up in [IEEE-754|http://en.wikipedia.org/wiki/IEEE_754]? Which bits will you strip out, and what will you replace them with when you reconstruct your double or long or whatever you're ultimately after.
I must admit, I have no clue what you're actually trying to accomplish.

Similar Messages

  • DES working with bits

    I hawe working DES code that works with Strings. But I need it to work with bits (key, plaintext and encrypted text in bit format). Witch is the best way to do it if it is possible. Or maybe do it in other language.
    import java.io.UnsupportedEncodingException;
    import javax.crypto.*;
    public class DESEncrypter {
        Cipher ecipher;
        Cipher dcipher;
        DESEncrypter(SecretKey key) {
            try {
                ecipher = Cipher.getInstance("DES");
                dcipher = Cipher.getInstance("DES");
                ecipher.init(Cipher.ENCRYPT_MODE, key);
                dcipher.init(Cipher.DECRYPT_MODE, key);
            } catch (javax.crypto.NoSuchPaddingException e) {
            } catch (java.security.NoSuchAlgorithmException e) {
            } catch (java.security.InvalidKeyException e) {
        public String encrypt(String str) {
            try {
                // Encode the string into bytes using utf-8
                byte[] utf8 = str.getBytes("UTF8");
                // Encrypt
                byte[] enc = ecipher.doFinal(utf8);
                // Encode bytes to base64 to get a string
                return new sun.misc.BASE64Encoder().encode(enc);
            } catch (javax.crypto.BadPaddingException e) {
            } catch (IllegalBlockSizeException e) {
            } catch (UnsupportedEncodingException e) {
            } catch (java.io.IOException e) {
            return null;
        public String decrypt(String str) {
            try {
                // Decode base64 to get bytes
                byte[] dec = new sun.misc.BASE64Decoder().decodeBuffer(str);
                // Decrypt
                byte[] utf8 = dcipher.doFinal(dec);
                // Decode using utf-8
                return new String(utf8, "UTF8");
            } catch (javax.crypto.BadPaddingException e) {
            } catch (IllegalBlockSizeException e) {
            } catch (UnsupportedEncodingException e) {
            } catch (java.io.IOException e) {
            return null;
    Thanks

    Exceptions are fixed. Code looks much better.
    Now I'm looking for some fast algorithm that could run throu all bit combinations from 0 to 2 ^64^ -1 and to write them in byte[8]. In beginig with 1 +"1"+ from all 64 bits, then 2 +"1"+, 3 +"1"+ and so on to 64 +"1"+.
    My previous code:
    public void runAll() throws IllegalBlockSizeException, BadPaddingException, SQLException, ClassNotFoundException{
            byte[] pt = new byte[8];
            byte[] et = new byte[8];
            int ptbc, etbc;
            SQLoutput sqlout = new SQLoutput();
            sqlout.createTables();
            for(int n00=-128;n00<128;n00++){
                pt[0] = (byte)n00;
                for(int n01=-128;n01<128;n01++){
                    pt[1] = (byte)n01;
                    for(int n02=-128;n02<128;n02++){
                        pt[2] = (byte)n02;
                        for(int n03=-128;n03<128;n03++){
                            pt[3] = (byte)n03;
                            for(int n04=-128;n04<128;n04++){
                                pt[4] = (byte)n04;
                                for(int n05=-128;n05<128;n05++){
                                    pt[5] = (byte)n05;
                                    for(int n06=-128;n06<128;n06++){
                                        pt[6] = (byte)n06;
                                        for(int n07=-128;n07<128;n07++){
                                            pt[7] = (byte)n07;
                                            et = encrypt(pt);
                                            ptbc = byteCount(pt);
                                            etbc = byteCount(et);
                                            sqlout.updtRec(etbc, ptbc);
        }Edited by: Hugo.Knife on Dec 11, 2007 5:39 PM

  • Improving the LabVIEW Help: Working with Data Types

    Have you ever had trouble figuring out how to work with the waveform data type, the dynamic data type, or some of the other more complex data types in LabVIEW? As a tech writer on the LabVIEW team, I'd like to improve our documentation about working with data. What would you like to see? What would be helpful? Have you ever given up on a particular data type because it didn't work? Have you ever created a replacement data type because you preferred not to use a LabVIEW data type?
    Lacy Klosterman Rohre | Marketing Editor | National Instruments | 512.683.6376 | ni.com/newsletter

    I've been programming LabVIEW since around 3.1 / 4.0.  Over the years and versions, I've found it necessary to approach a lot of the new datatypes and algorithms with some healthy skepticism because I don't think we're usually given a "fair and balanced" overview.  Some of the things that are highly promoted that bring "ease of use" for beginners (and I *do* understand the importance of that when you're growing your LabVIEW user base) can carry significant performance penalties that are mentioned in more of a whisper, if at all.  I'd just like a more full disclosure of the tradeoffs -- the good, the bad, and the ugly.
    Waveforms -- very rarely use them, unless required for analysis functions.  I have a vague notion (between a belief and a memory) that they used to carry a significant performance penalty compared to arrays, but that the gap is now much smaller.  Still, I'm most comfortable with my old habit of using data arrays.  Some of this came about because a lot of my work uses counters where I may have a variable "dt" value or where my AI is clocked by a counter and the "dt" isn't internally generated.
    Dynamic signals -- have never used them.  Have no clear idea what good they're supposed to be, and they seem to be tied in primarily with Express VI's, which I have also studiously avoided.
    Variants -- Use them only slightly.  Performance issues are a question mark.  Exception: have learned that the implementation of Variant properties allows their use as an efficient way to create associates for string lookup tables. 
    Digital Waveform -- have typically avoided it except when graphing digital data during debug.  Haven't found any compelling reasons to use it.  I do like the notion of a compress/expand capability for sparse digital data, but haven't exercised it enough to trust the implementation. 
    Recap:  I don't need more simple "how-to's" in the help.  I need a LOT more "why bother's" that include both pros and cons. 
    -Kevin P.

  • Will downloader helper work with 5 or should I wait to upgrade to 5

    As I use Download Helper frequently will it work with Firefox 5 if I upgrade to V5 now or should I wait to download V5 at a later date?
    Thank you,
    Chad

    Download helper is working fine on version 5 firefox, and it's just updated itself

  • Help: Working with .MOV files in FCP and forced to RENDER FOR EVERY EDIT

    I'm working with .MOV files from my digital camera in Final Cut Pro and every time I make a new edit, I have to render it in order to see it in the canvas.
    How do I make it so that I don't have to render every edit in order to see it?
    (I've worked with files straight from a DV camera, and editing went fine. I'm assuming it has to do with the .MOV files)

    DV Cameras are not the same thing as a Digital camera. Digital cameras offer video on a limited basis and it's usually highly compressed in a non-editing format such as MPEG-2 or similar. NLEs are made to work with video cameras, not still cameras which is why you're having trouble.
    That's not to say you can't edit video captured with a digital camera, but you need to know how to prep it for editing. Some digital cameras shoot at odd frame rates and they all use some form of compression that is not typically used in editing. This means that you'll likely need to convert your clips to an editable format first using Compressor.
    Andy

  • Help working with File() objects

    Hi,i'm sorry for my not-so-perfect English.
    I'm working with java.io.File object, to use and know the contents of a folder.
    But if i try to use the function list() on a folder that is the first in my hard drive (For example: C:\Test on windows, or /usr on unix), and try to get the Parent...i receive null.
    This is a regoular way,in my opinion; But i have a problem: i'm working at a Java File Manager, and i'd like to LIST all my hard driver present in my computer (ie. C:,D:, E:) but i don't really know how to do...!!
    On UNIX, i can resolve this problem using a list() on /mnt folder, for mounted drive...but on Windows...how can i!?
    Thanks for the answers...

    Hi,
    Take a look at:
    File.listRoots()
    Kaj

  • Help working with this dope bassline

    A numerous amount of songs that have been released in the past few months have had these deep and long basslines. Ive been working with logic trying to figure out what the trick is behind creating this sound, but I don't think it has to do with sidechaining, but I would really appreciate it if anyone could fill me in on what the trick is. Here are 2 sample tracks.
    http://www.youtube.com/watch?v=kVuWy76vw
    http://www.youtube.com/watch?v=wrpUKm9oL2Y

    buckdice wrote:
    A numerous amount of songs that have been released in the past few months have had these deep and long basslines. Ive been working with logic trying to figure out what the trick is behind creating this sound, but I don't think it has to do with sidechaining, but I would really appreciate it if anyone could fill me in on what the trick is. Here are 2 sample tracks.
    http://www.youtube.com/watch?v=kVuWy76vw
    http://www.youtube.com/watch?v=wrpUKm9oL2Y
    Track one is probably a synth bass played well. Since this is a mixed track, AND it's thru youtube, there is no way to be accurate as to what instrument was played.
    Track two, the low bass on the first beat is a DRUM. Like an 808 detuned and elongated.
    Either way, experiment with Logic's synths, already. We can't tell you how to play, or how to get the sounds. That is your job...
    Cheers

  • How about a little help working with Gbps Ethernet I/O (embedded and instantiated) and the Zynq SoC?

    A new Xilinx TechTip gives you some basics for working with the embedded Gbps Ethernet ports on all Zynq SoCs. This TechTip also applies to additional Gbps Ethernet ports you might instantiate in the Zynq SoC’s programmable logic. (More than one, if you like.) If you’re not familiar with basic Ethernet tools including the Wireshark protocol analyzer and the NetPerf benchmarking utility for Linux, give this one a read.
     

    kglad wrote:
    that code should be attached to the first keyframe that contains your flvplayback component.
    if you have more than one, you'll need to assign each a different instance name and adjust the code accordingly.
    the trace() should be added to your button listener function (openurl).
    All right, I think its going to be easy to explain if you please check my image here http://thenewmediastudio.com/roland/example.png
    I'm placing the code in the first frame, however, the movie is located in the 2nd frame but is not working, not sure where exactly I should place the code.
    And sorry but, that other thing about the trace, didn't understood that one.
    Thanks so much!

  • Help needed with bit & unicode

    Hi,
    I have an issue with the following code when setting the unicode flag for a Z program.
    check usr02-uflag o lock.
    check usr02-uflag z lock.
    The field usr02-uflag has a data type of INT1and an output length of 3.
    The field lock is defined as "lock(1) type x value '40'."
    what do I need to do to satisfy unicode?
    Is it just a case of defining another variable as type X and copy usr02-uflag to it and then do the comparison. i.e.
    DATA: new_var(1) type x.
    new_var = usr02-uflag.
    check new_var o lock.
    check new_var z lock.
    pls help.
    C

    Hi Chris,
    I do niot see the issue:
    uflag has a data type of INT1 - No change in unicode
    lock is defined as "lock(1) type x value '40'  - No change in unicode
    Only fields of type C or STRING are affected by Unicode.
    It should work as it does now [Comparing Bit Sequences|http://help.sap.com/saphelp_webas620/helpdata/EN/fc/eb3523358411d1829f0000e829fbfe/content.htm].
    Am I wrong?
    Regards,
    Clemens

  • Not sure if this is the right place, but I need help working with wtmpx

    I am trying to write a program that collects data from the /var/adm/wtmpx file and I would like to use the structures and functions provided by the utmpx.h file in /usr/include. I can read the utmpx file with no problem, however I would like to read the wtmpx file. I think the way to do it is to use the function utmpxname(). However, this appears to be the one function that doesn't seem to work. The compiler complains that there is no function utmpxname(). I am mainly a C++ programmer so this code is a little confusing to me. Where can I find the actual implementation of the utmpxname()? PLEASE HELP!!

    This is a Solaris question. You should post it to that discussion.
    Items in section 3 of the manual are not part of the compiler. They
    would be in libc or some other system lib distributed with
    the OS and not maintained under the compiler collection.

  • Need help working with frames. Nothing opens in target frame...always new window :(

    Guess I should reach out and ask for help before I get so frustrated, as my name implies.
    I am new to frames. I have my frameset page done. I have a top section from my logo. I have
    a side section for my navigation and a main section (body) that is my target for the navigation links.
    It all looks great on the main frameset page. But whenever I click on a link on the side of the page,
    that should be a navigational link that feeds into my main section (body) area it always opens a
    new page. I can't ever get those pages to show up in that 'body' frame.
    I have tried using the <base target>
    I have tried doing each line individually, leaving the <base target> in and taking it out.
    I have tried writing the code myself.
    I have tired using the GoLive Action thing and doing a link and using ForceFrame.
    I have tried everything I can think of and wonder if anyone has any ideas.
    This is what I have, using the forceframe:
    <head>
      <meta http-equiv="content-type" content="text/html;charset=iso-8859-1">
      <meta name="generator" content="Adobe GoLive 6">
      <title>Welcome to Adobe GoLive 6</title>
      <csactions>
       <csaction name="5F8BE850" class="FrameMaker" type="onevent" val0="clearance1.html" val1="Body" urlparams="1"></csaction>
       <csaction name="609B1923" class="FrameMaker" type="onevent" val0="clearance1.html" val1="Body" urlparams="1"></csaction>
       <csaction name="606FEA72" class="FrameMaker" type="onevent" val0="clearance1.html" val1="Body" urlparams="1"></csaction>
       <csaction name="71581815" class="FrameMaker" type="onevent" val0="clearance1.html" val1="Body" urlparams="1"></csaction>
       <csaction name="716388D6" class="FrameMaker" type="onevent" val0="clearance1.html" val1="Body" urlparams="1"></csaction>
      </csactions>
      <csscriptdict import>
       <script type="text/javascript" src="GeneratedItems/CSScriptLib.js"></script>
      </csscriptdict>
      <csactiondict>
       <script type="text/javascript"><!--
    CSAct[/*CMP*/ '5F8BE850'] = new Array(frameP,/*URL*/ 'clearance1.html','Body');
    CSAct[/*CMP*/ '609B1923'] = new Array(frameP,/*URL*/ 'clearance1.html','Body');
    CSAct[/*CMP*/ '606FEA72'] = new Array(frameP,/*URL*/ 'clearance1.html','Body');
    CSAct[/*CMP*/ '71581815'] = new Array(frameP,/*URL*/ 'clearance1.html','Body');
    CSAct[/*CMP*/ '716388D6'] = new Array(frameP,/*URL*/ 'clearance1.html','Body');
    // --></script>
      </csactiondict>
    </head>
    <body background="Images/bgd.gif" bgproperties="fixed" link="#7b00ff" vlink="#7b00ff" alink="#7b00ff">
                          <table width="232" border="2" cellspacing="2" cellpadding="0">
       <td width="200" height="24">
        <div align="left">
         <b><a title="accessories-f.html" onclick="CSAction(new Array(/*CMP*/'609B1923'));return CSClickReturn();" href="accessories-f.html" target="Body" csclick="609B1923">Accessories</a></div>
       </td>
       <td width="5" height="24">  4  </td>
       </tr>
       <tr><td width="200" height="24">
        <div align="left">
         <b><a title="audio-consoles.html" onclick="CSAction(new Array(/*CMP*/'5F8BE850'));return CSClickReturn();" href="audio-consoles.html" target="Body" csclick="5F8BE850">Audio Consoles</a></div>
       </td>
        <td width="5" height="24">  3  </td>
       </tr>
       <tr><td width="200" height="24">
        <div align="left">
         <b><a title="cases.html" onclick="CSAction(new Array(/*CMP*/'606FEA72'));return CSClickReturn();" href="cases.html" target="Body" csclick="606FEA72">Cases</a></div>
       </td>
        <td width="5" height="24">  2  </td>
       </tr>
    This is what I have for the framset page that is called clearance1.html  :
    </head>
    <frameset border="0" frameborder="no" framespacing="0" rows="201,*">
      <frame name="ClearanceT" noresize src="clearance-top.html">
      <frameset border="0" cols="275,*" frameborder="no" framespacing="0">
       <frame name="ClearanceS" noresize scrolling="no" src="clearance-side.html">
       <frame name="Body" noresize src="clearance-main.html">
      <noframes><body><center>This website uses frames. Your current browser does not display frames <br>or frame viewing has been turned off.
      To view these pages please <a href="clearance.html">Click here</a></center>
                  </body>
      </noframes>
    </frameset>
    If someone could please help I would be so appreciative!!!!! Thanks!

    Hi,
    I appreciate the help but I tried that and it still doesn't work. I had done what you said already, other than changing the name of the frame, so this time I tried that. Still didn't work.
    Here is my current code....I changed the frame to "Baby" and only tried the one item, Accessories:
      <csactions>
       <csaction name="5F8BE850" class="FrameMaker" type="onevent" val0="audio-consoles.html" val1="Body" urlparams="1"></csaction>
       <csaction name="609B1923" class="FrameMaker" type="onevent" val0="accessories-f.html" val1="Baby" urlparams="1"></csaction>
       <csaction name="606FEA72" class="FrameMaker" type="onevent" val0="cases.html" val1="Body" urlparams="1"></csaction>
       <csaction name="71581815" class="FrameMaker" type="onevent" val0="/clearance1.html" val1="Body" urlparams="1"></csaction>
       <csaction name="716388D6" class="FrameMaker" type="onevent" val0="clearance1.html" val1="Body" urlparams="1"></csaction>
      </csactions>
      <csscriptdict import>
       <script type="text/javascript" src="GeneratedItems/CSScriptLib.js"></script>
      </csscriptdict>
      <csactiondict>
       <script type="text/javascript"><!--
    CSAct[/*CMP*/ '5F8BE850'] = new Array(frameP,/*URL*/ 'audio-consoles.html','Body');
    CSAct[/*CMP*/ '609B1923'] = new Array(frameP,/*URL*/ 'accessories-f.html','Baby');
    CSAct[/*CMP*/ '606FEA72'] = new Array(frameP,/*URL*/ 'cases.html','Body');
    CSAct[/*CMP*/ '71581815'] = new Array(frameP,/*URL*/ '/clearance1.html','Body');
    CSAct[/*CMP*/ '716388D6'] = new Array(frameP,/*URL*/ 'clearance1.html','Body');
    // --></script>
      </csactiondict>
    </head>
    <body background="Images/bgd.gif" bgproperties="fixed" link="#7b00ff" vlink="#7b00ff" alink="#7b00ff">
                          <table width="232" border="2" cellspacing="2" cellpadding="0">
       <td width="200" height="24">
        <div align="left">
         <b><a title="accessories-f.html" onclick="CSAction(new Array(/*CMP*/'609B1923'));return CSClickReturn();" href="accessories-f.html" target="Baby" csclick="609B1923">Accessories</a></div>
       </td>
       <td width="5" height="24">  4  </td>
       </tr>
       <tr><td width="200" height="24">
        <div align="left">
         <b><a title="audio-consoles.html" onclick="CSAction(new Array(/*CMP*/'5F8BE850'));return CSClickReturn();" href="audio-consoles.html" target="Body" csclick="5F8BE850">Audio Consoles</a></div>
       </td>
        <td width="5" height="24">  3  </td>
       </tr>
       <tr><td width="200" height="24">
        <div align="left">
         <b><a title="cases.html" onclick="CSAction(new Array(/*CMP*/'606FEA72'));return CSClickReturn();" href="cases.html" target="Body" csclick="606FEA72">Cases</a></div>
       </td>
        <td width="5" height="24">  2  </td>
       </tr>
    It appears that I should be able to just use the 'target' tag to get this to work right. It didn't. So I tried the action menu item with the ForceFrame
    and that didn't work either. I don't get why something that looks so simple doesn't work

  • Help working with CSV files

    I have a CSV file with 3 columns
    Jobtitles-----ADRole1----- AdRole2
    title1---------Role1---------Role4
    title2---------Role2---------Role5
    title2---------Role3--------Role6
    And i also have a list of Active Directory Users in other variable $users.
    I need to get the AD users which jobtitle match the ones in the first column of the csv "jobtitles"
    I do it like:
    import-module activedirectory
    $csv2= Import-Csv e:\mycsv.csv | Select-Object JobTitles
    $Jobtitles = @()
    foreach ($line in $csv2) {
    $Jobtitles += $line.title
    $users = foreach ($user in $result){
    get-aduser $user.loginname -properties title, samaccountname
    foreach ($User in $Users) {
    if ($Jobtitles -contains $User.title) {
    write-host $User.samaccountname $User.title
    This works fine.
    What i don't know how to do is reference the same row in the csv
    For example if the user jobtitle matches title1, add the user to the AD group Role1 and Role4 (because it is in the same row as those roles)
    Any idea?
    thanks

    In the second line in your script, the " | select-object jobTitles" causes only the data from the jobTitles column in the .CSV file to be included in the array of objects stored in the $csv2 variable. If you avoid doing that, then all of the data from the
    .CSV file will be present in $CSV.
    But I don't think the code as shown "works fine". In the first foreach statement, your code references a property called .title, whereas the only property in $csv would appear to be .jobTitles. But, if it had been coded correctly, this would be a wasted
    step, as it seems only intended to create another array of "title" values, which you already have in $csv2.
    then the second foreach processes data in an undefined array called $result.
    With these issues, it is a little difficult to determine what actually happens in the following code.
    I'd suggest you give it another try then copy/paste the complete code for us to comment on.
    Al Dunbar -- remember to 'mark or propose as answer' or 'vote as helpful' as appropriate.

  • Script Help - Working with Files - Reading/Writing

    Hey Folks,
    I need help build a script that will read a text string from a specific .INI file, and then write that string to a file along with the name of the computer where the string originated from.
    I plan on deploying this script to our targeted workstations with SCCM 12, so it does not need recursive abilities. We want each of the machines which run the script to write their data to a single file with a date stamp as part of the name. The data written
    needs to include the unique string which follows this format "devicename=DJ########", along with the computer's name. The device name which needs to be extracted starts with DJ and is followed by an 8 digit number. It would be better if we could
    use export-csv than out-file. 
    This is what my very inexperienced self came up with so far:
    get-content 'C:\users\Public\Something\myfile.ini' | Select-String devicename=dj | out-file
    \\server\folder\data.txt -append
    I
    found this bit of code which should allow me to set the file name to a date, but I am unsure exactly how to implement this:
    $enddate = (Get-Date).tostring("yyyyMMdd")
    $filename = 'C:\Documents and Settings\User\Desktop\' + $enddate + '_VMReport.doc'
    $filename
    The developer of a core piece of software requires all computers have a unique ID, but provides absolutely no tools or guidance for tracking this crucial information. Any input you can provide will be greatly appreciated!
    Please help us fix this nightmare! Thank you in advance!

    I am trying to add a step where the script grabs a list of all domain workstations and saves it to a file. This file is then used as the input for the rest of the script. There is a problem with the way the computers names are imported using this method.
    Here is the script:
    # Rename the existing DJNumbers.csv to yesterday's date
    $date = (Get-Date).AddDays(-1)
    Rename-Item -Path '\\Server\Library\DJs\DJnumbers.csv' -NewName ("DJNumbers_{0}.csv" -f (Get-Date $date -Format yyyy-MM-dd))
    #Save a list of all current AD computers
    Get-ADComputer -Filter * | select name | Out-File \\Server\C$\DJs\complist.csv
    #Extract the DJ number for every computer in complist.csv
    Get-Content '\\Server\C$\DJs\complist.csv' |
    ForEach-Object {
    $devicename=get-content "\\$_\C$\Users\Public\myfile.ini" | Select-String devicename=
    $djnumber=$devicename -replace "devicename=","`t"
    $prize=$_ += $djnumber
    $prize | Out-File \\Server\Library\DJs\DJnumbers.csv -Append
    The problem is that the computer names include a ton of blank spaces if I use Out-File in the line:
    #Save a list of all current AD computers
    Get-ADComputer -Filter * | select name | Out-File \\Server\C$\DJs\complist.csv
    Error looks like this:
    get-content : Cannot find path '\\CM112233
    \C$\Users\Public\Software\myfile.ini' because it does
    not exist.
    At line:11 char:13
    + $devicename=get-content "\\$_\C$\Users\Public\Software\...
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : ObjectNotFound: (\\CM112233 ...ction\myfile.ini:String) [Get-Content], ItemNotFoundException
    + FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.GetContentCommand
    If I use Export-Csv, it puts ""'s around the computer names and that breaks it as well.
    #Save a list of all current AD computers
    Get-ADComputer -Filter * | select name | Export-Csv \\Server\C$\DJs\complist.csv
    This is the error:
    get-content : Illegal characters in path.
    At line:11 char:13
    + $devicename=get-content "\\$_\C$\Users\Public\Software\ ...
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : InvalidArgument: (\\"CM112233"\C$\U...are\myfile.ini:String) [Get-Content], ArgumentException
    + FullyQualifiedErrorId : ItemExistsArgumentError,Microsoft.PowerShell.Commands.GetContentCommand

  • Help working with sockets, please

    hi
    i've managed to do some applications similar to chat programs, and i would like to know if my design is... acceptable
    my problem used to be that any function trying to read data from a socket would block until it gets some data. if my applicacion is like a chat, i don't know when data is arriving.
    so my solution is:
    create a thread, which would be always reading the input stream from the socket. whenever it gets data, it send an event which listened by the main class, say, a JFrame.
    so i created my own events, listener and listenermulticaster. well it works great but i wonder if there is another simpler way to do it.
    another think that bothers me:
    when i have my thread with my connected socket, and i want to shut the appz down, the only way i've found is to close the socket. the thread must be able to manage that, and afterwards, returns from run function.
    well what do u think about all of this?? i would be very grateful for any opinion you tell me
    thanks in advance

    a reference to the thread, calls that method. the
    socket is closed, the main loop breaks (i dont
    remember now if an exception is thrown) and the thread
    ends
    i agree, i dont like this and it seems unreliable.
    about the method interrupt, what is the diference from
    retunrning from run method??
    thanks very much for your help!!you will have a method that is reading from the Socket, it will block until some data is available
    closing the Socket (one would hope) should cause that method to throw an Exception, you can use that Exception to exit the run() method, but if the Socket is closed from the other end, then it seems unreliable that the Exception is thrown, leavin the read method waiting for data that it can never recive
    Thread.interrupt() will terminate all such blocking IO methods and you can use this also to exit the run() method
    belt and braces maybe, but handy all the same

  • Program Help, working with spaces and only letters

    I'm writing a program that takes an input string and gets the length and/or gets the number of vowels and consonants in the string. I've gotten it working except for consideration of spaces (which are allowed) and error checking for input other than letters. Here is what I've got so far. ANY suggestions would be greatly appreciated. Thank You
    import java.io.*;
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    import java.util.*;
    public class LetterStringManip extends JFrame
    {//declaring variables
         private JLabel stringOfLettersL, lengthL, lengthRL, vowelsL, vowelsRL, consonantsL, consonantsRL;
           private JTextField stringOfLettersTF;
           private JButton lengthB,vowelB, quitB;
           private LengthButtonHandler lbHandler;
           private VowelButtonHandler vbHandler;
           private QuitButtonHandler qbHandler;
           private static final int WIDTH = 750;
           private static final int HEIGHT = 150;
           public LetterStringManip()
           {// setting up GUI window with buttons
               stringOfLettersL = new JLabel("Enter a String of Letters", SwingConstants.CENTER);
                   lengthL = new JLabel("Length of String: ", SwingConstants.CENTER);
                   lengthRL = new JLabel("", SwingConstants.LEFT);
                   vowelsL = new JLabel("Number of Vowels: ", SwingConstants.CENTER);
                   vowelsRL = new JLabel("", SwingConstants.LEFT);
                   consonantsL = new JLabel("Number of Consonats: ", SwingConstants.CENTER);
                   consonantsRL = new JLabel("", SwingConstants.LEFT);
                   stringOfLettersTF = new JTextField(15);
                   lengthB = new JButton("Length");
                   lbHandler = new LengthButtonHandler();
                   lengthB.addActionListener(lbHandler);
                   vowelB = new JButton("Vowels");
                   vbHandler = new VowelButtonHandler();
                   vowelB.addActionListener(vbHandler);
                   quitB = new JButton("Quit");
                   qbHandler = new QuitButtonHandler();
                   quitB.addActionListener(qbHandler);
                   setTitle("String Of Letters");//Window title
                   Container pane = getContentPane();
                   pane.setLayout(new GridLayout(3,4)); //Window layout
                   pane.add(stringOfLettersL);
                   pane.add(stringOfLettersTF);
                   pane.add(lengthL);
                   pane.add(lengthRL);
                   pane.add(vowelsL);
                   pane.add(vowelsRL);
                   pane.add(consonantsL);
                   pane.add(consonantsRL);
                   pane.add(lengthB);
                   pane.add(vowelB);
                   pane.add(quitB);
                   setSize(WIDTH, HEIGHT);
                   setVisible(true);
                   setDefaultCloseOperation(EXIT_ON_CLOSE);
           }//closes public LetterStringManip()
           private class LengthButtonHandler implements ActionListener
               public void actionPerformed(ActionEvent e)//Length Button is clicked, getLength() method is performed
                      getLength();
                   }//closes public void actionPerformed(ActionEvent e)
           }//closes private class LengthButtonHandler implements ActionListener
           private class VowelButtonHandler implements ActionListener
               public void actionPerformed(ActionEvent e)//Vowels Button is clicked, getVowels() method is performed
                      getVowels();
                   }//closes public void actionPerformed(ActionEvent e)
           }//closes private class VowelButtonHandler implements ActionListener
           private class QuitButtonHandler implements ActionListener//Quit Buttton is pressed
               public void actionPerformed(ActionEvent e)
                       System.exit(0);
                   }//closes public void actionPerformed(ActionEvent e)
           }//closes private class QuitButtonHandler implements ActionListener
                     public void getLength()//gets the length of the string
                       String letString = (stringOfLettersTF.getText());
                       String lengthString;
                 int length;
                         length = letString.length();
                         lengthString = Integer.toString(length);
                         lengthRL.setText(lengthString);
                    }//closes public void getLength()
                     public void getVowels()//gets the number of vowels in the string
                 String letString = (stringOfLettersTF.getText());
                       String vowString;
                         String conString;
                 int countVow = 0;
                         int countCon = 0;
                         int i;
                         int length = letString.length();
                         char[] letter = new char[length];
                 for (i = 0; i < letString.length(); i++)
                     letter[i] = letString.charAt(i);
                     if (letter=='a' || letter[i]=='e' || letter[i]=='i' || letter[i]=='o' || letter[i]=='u')
    countVow++;
                        }//closes for
                        countCon = letString.length() - countVow;
    vowString = Integer.toString(countVow);
                        conString = Integer.toString(countCon);
                        vowelsRL.setText(vowString);
                        consonantsRL.setText(conString);
                   }//closes public void getVowels()
         public static void main(String[] args)
         LetterStringManip stringObject = new LetterStringManip();
         }// closes public static void main(String[] args)
    }//closes public class LetterStringManip extends JFrame

    OK, per the instructions above: I will re-post my code that I have now. I have dealt with the space not being counted now, I only need to figure out how to validate my input so that only letters are allowed. If anyone has any suggestions, or can help me out in any way, it'd be great. The suggestions with creating word and sentence objects is still a little beyond what we have gone over thus far in my Java course, I feel like I can almost grasp it to code it, but end up getting really confused. anyways, hear is my 'crude' code so far:
                     public void getLength()
                       String letString = (stringOfLettersTF.getText());
                       String lengthString;
                          int finalLength;
                          int countSpace = 0;
                                int length = letString.length();
                       char[] letter = new char[length];
                        int i;
                                 for (i = 0; i < letString.length(); i++)
                                    letter[i] = letString.charAt(i);
                                    if (letter==' ')
    countSpace++;
              finalLength = length - countSpace;
                   lengthString = Integer.toString(finalLength);
                   lengthRL.setText(lengthString);
                   public void getVowels()
    String letString = (stringOfLettersTF.getText());
                   String vowString;
                   String conString;
    int countVow = 0;
                   int countCon = 0;
                   int countSpace = 0;
                   int i;
                   int length = letString.length();
                   char[] letter = new char[length];
    for (i = 0; i < letString.length(); i++)
    letter[i] = letString.charAt(i);
    if (letter[i]=='a' || letter[i]=='e' || letter[i]=='i' || letter[i]=='o' || letter[i]=='u')
    countVow++;
                   if (letter[i]==' ')
    countSpace++;
                   countCon = (letString.length() - countVow) - countSpace;
    vowString = Integer.toString(countVow);
                   conString = Integer.toString(countCon);
                   vowelsRL.setText(vowString);
                   consonantsRL.setText(conString);

Maybe you are looking for

  • Error in Control framework

    Hi All,   I created a webdynpro development.  In that all applications are working fine. One button i added and click of that it will download all the attachments corresponding to the sales order and it will place the attachments in desktop folder. I

  • Currency conversion with query selection mask and InfoObject 0Curtype

    Hi, question to following scenario: in the data source is an column with the currency type. This currency type column contains values like 10 = company code currency 20 = account area currency So for each data set in the table is an assignment of cur

  • Features in ECC6 - MM

    Hi, What are all the special features available in ECC 6 than in 4.7 in MM module for purchasing. Is there any value added reports available on controlling spends in MM. Thanx Kalaa

  • Simple XSL question.

    Hi there, I am trying to do a form with a List Menu that will populate the Labels and Values from an xsl fragment page, so far I was able to set the labels from the XML file but I am having problems when placing code on the VALUE section of the list

  • REUSE_ALV_LIST_DISPLAY on a dialog program

    Hi, I have a requirement where in I have to call REUSE_ALV_LIST_DISPLAY on a dialog program. Can any one tell me how we can call a list display from a dialog program. Regards, Abhishek.