Working directly with bits

I am working on a DNS tool. According to RFC 1035, communications with the DNS server are performed using bit streams.
I am working on some preliminary tests of a simple application. However, it would be very nice to use direct bit manipulation because several of the fields in a DNS query are single bit flags.
I have tried using byte primitives in arrays, however, due to signing, this has been problematic.
Frankly, I have not done a lot of bit math. Is their a good guide available or a means of directly manipulating bits? (I am fully willing to read. I just have not found anything significantto start with.)

Thank you Ge Ha. I looked at the BitSet class. This does allow for bitwise operations but seems to be a more "abstracted" text redition of a true bit stream. The BitSet Class uses booleans to represent the elements of the stream. This does look like a nice class for constructing bit stream representations, but I will need to do more research to verify whether or not it is viable in the application I am considering. (I will post the results.)

Similar Messages

  • What is available on new Windows servers that allow you to write scripts that can work directly with Windows, SQL Server, and Exchange Server?

    What is available on new Windows servers that allow you to write scripts that can work directly with Windows, SQL Server, and Exchange Server?
    a. PowerShell
    b. isql
    c. osql
    d. sqlcmd

    All questions seem to be from the interview or a test. I think I even took this test once, it's KForce test.
    For every expert, there is an equal and opposite expert. - Becker's Law
    My blog
    My TechNet articles

  • Flip Video now works directly with IM08

    PLug in your Flip, select import movies in IM08 and navigate to the DCIM folder on your Flip camera and select your videos. Wha la. The Flip videos are imported into IM08. And they appear to use the same codec in IM08 (ie they aren't converted to a format like DV which takes up 10x the hard drive space.)
    Either I've been a big idiot for a few months or a recent update from Apple fixed this.
    There's no need to (first) convert your Flip video footage any longer.

    I just updated my iMac to 10.5.4 and I can no longer import videos into iMovie08 from my Flip Mino. It goes through the import process and then nothing shows up. Everything is working fine on my macbook which is at 10.5.3. On both computersiMovie08 is at version 7.1.2
    What is going on?

  • Iphone 4S - Windows Vista - 64 Bit (and photoshop elements 9.0) is not recognizing my iphone as a camera - therefore I cannot download pictures from my iphone. iTunes works fine with the iPhone, but I do not see it in "My Computer" when connected via USB

    iphone 4S - Windows Vista - 64 Bit (and photoshop elements 9.0) is not recognizing my iphone as a camera - therefore I cannot download pictures from my iphone. iTunes works fine with the iPhone, but I do not see it in "My Computer" when connected via USB.  I already tried uninstalling and reinstalling iTunes....still nothing.  Any ideas?

    Thank u verrrrrrrrrrry much FoxFifth u save my life thank u.

  • 64 bit Lightroom 2.5 work well with 32 bit Photoshop CS4?

    Anyone know if 64 bit Lightroom 2.5 works well with 32 bit Photoshop CS4?  Any problems or conflicts?  Or should I stick to 32 bit Lightroom 2.5?

    It works fine, but the default will be to use the 64bit version of CS4 (which is also installed along with the 32bit version).
    If you want to use the 32bit version of CS4 the easiest way is to open the 32bit CS4 before sending files from LR. I only have a few plugins that don't have 64bit versions, so I mostly use the 64 bit version of CS4, but occasionally I do use the 32bit version and that's how I do it.

  • I am using iPhone 3GS. I am living in Saudi Arabia. I cannot find the directions with in GCC contries in the Navigation Application "COMPASS" of iphone. Can you please explain me how to work on it??

    I am using iPhone 3GS. I am living in Saudi Arabia. I cannot find the directions with in GCC contries in the Navigation Application "COMPASS" of iphone. Only the map is displayed. I am not gtting the directions or information when I use it. Can you please explain me how to work on it??

    See http://kb.mozillazine.org/Editing_configuration#How_to_edit_configuration_files
    Add code to [http://kb.mozillazine.org/UserChrome.css userChrome.css] below the @namespace line.
    <pre><nowiki>@namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"); /* only needed once */
    #context-sendlink {display:none !important;}</nowiki></pre>
    See also http://kb.mozillazine.org/Chrome_element_names_and_IDs

  • I can't install Java in Firefox. Intead Java works fine with IE. I preffer Firefox 4 but...I'm running Win 7 64-bit.

    I;m running win7 64-bit and I can;t install Java in Firefox 4. Java works fine with IE.

    On Java, I think we've covered the basics. There are a couple of other articles that might help:
    [http://support.mozilla.com/en-US/kb/Java-related%20issues Java-related issues | Troubleshooting | Firefox Help]
    [http://kb.mozillazine.org/Plugin_scanning Plugin scanning - MozillaZine Knowledge Base] (you would want to make sure it is ''not'' disabled; in about:config, filter on plugin.scan and see whether anything has been changed from its default)
    On Norton, there are a number of recent threads here, but I have not been reading them. Hopefully someone has posted the answer.

  • I have Windows 8 64 bit.  iTunes works fine with my iPHONE but when I try to go to the iTunes store it loads to about 80% and then the message "iTunes has stopped working"

    I have Windows 8 64 bit.  iTunes works fine with my iPHONE but when I try to go to the iTunes store it loads to about 80% and then the message "iTunes has stopped working"

    COPY   QTMovieWin.dll   FROM    c:\program files (x86)\common files\apple\apple application support\   INTO c:\program files (x86)/iTunes"

  • 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

  • Does Win XP 64 bit work well with X-Fi Titanium?

    I'm currently using Win XP Pro (32-bit) and I'm thinking of building a new Windows XP 64-bit system.
    are there any known problem with Windows XP 64-bit working with a X-Fi Titanium sound card?
    (I'm of the option that Vista blocks the installion of unsigned software)

    The X-FI Titanium works perfectly with XP X64. Sad that I can't say the same for Windows [email protected]

  • 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.

  • UNSUPPORTED : The way it works Apache with OC4J via AJPV13 with mod_jk

    RDBMS Version: 8.1.7.x
    Operating System and Version: SUSE Linux 7.2 / Win NT/2k/XP
    Product (i.e., OAS, IAS, etc): 9ias 1.0.2.2 OC4J 9.0.2.0.0
    Product Version:
    JDK Version: 1.3.1
    Error number:
    UNSUPPORTED : The way it works Apache with OC4J via AJPV13 with mod_jk
    We dont want to use the lame and old mod_jserv so we want to use oc4j but in connection with Apache.
    This is like mod_oc4j in the Oracle 9ias Release 2
    This guide is for advanced users !
    Step-by-Step :
    1) get Tomcat 3.3 for linux or nt with Apache module mod_jk
    http://jakarta.apache.org/builds/jakarta-tomcat/release/v3.3/bin/
    2) add mod_jk module to httpd.conf (9ias) and comment all mod_jserv, dms, oproc, ojsp ....
    LoadModule jk_module libexec/mod_jk.so
    Include mod_jk.conf
    3) edit mod_jk.conf
    JkMount /*.jsp ajp13
    JkMount /servlet/* ajp13 JkMount /servlets/* ajp13
    <Location "/WEB-INF/"> AllowOverride None
    deny from all
    </Location>
    3) edit workers.properties
    workers.tomcat_home=/opt/oracle/ias/oc4j/j2ee/home
    workers.java_home=/usr/java
    worker.list=ajp13
    worker.ajp13.port=8009 worker.ajp13.host=localhost worker.ajp13.type=ajp13
    4) edit http-web-site.xml (oc4j)
    <web-site host="localhost" port="8009" protocol="ajp13" display-name="Oracle9iAS Containers for J2EE HTTP Web Site">
    5) start oc4j
    java -verbose -jar oc4j.jar
    6) start apache (look in error_log)
    apachectl startssl
    7) try to request a jsp page or servlet ..
    http://localhost:7777/test.jsp
    8) good luck it works fine .. !!
    Matthias Roth
    Technical Manager
    Z|rich Investmentgesellschaft mbH
    [email protected]

    Thanks for the tip Mathias, it's always good to see people trying out experimental things with the products.
    We're providing a new module (mod_oc4j) with our Oracle9iAS Release2 product to do this directly from the Oracle HTTP Server (Apache). We've re-written bits and pieces of the module to improve it's performance. Likewise, we've also integrated mod_oc4j with our HA story so it will be notified when new OC4J instances are brought online or if existing ones go down, enabling it to actively route requests around the available OC4J instances.
    Thanks again!
    -steve0

  • I have a mid-2010 iMac and just purchased a 2TB TC, can't join existing wireless network with AC standard so attached to iMac via ethernet with TC wifi turned off.  How do i access TC now? not showing up in disk utility or on desktop. working fine with TM

    I have a mid-2010 iMac and just purchased a 2TB TC, I just found out that it can't join existing wireless network with new AC standard so attached to iMac via ethernet with TC's wifi turned off.  How do i access TC now? not showing up in disk utility or on desktop. It is working fine with TM.  My cheeper seagate drives etc kept crashing, so i didnt trust cheeper back up options anymore.  Connected those drives to TM via firewire and could see the drives and access them.
    Also, I didn't want to bridge TC with my new fios router that I paid 100 dollars for, to get N speed and also paying 10 dollars more a month for fast speed.  I heard that bridging slows down everything and then there can be port issues with mail etc.  I connect to the internet via airport only and it is pretty fast. Getting over 50mbs downloads and over 30mbs uploads.  Plus everything in my home it connected to my fios router, airport express for music streaming, two apple tvs, vuezone camer system.  I really didn't want to monkey around too much with my system.  But are there other options to connect the new TC.  Can't find info anywhere for this and called apple who gave me the info above.  after hanging up, i see that i cant access my TC and I am wondering if i would have to reset it to turn wifi on again to make changes to the drive, turn off blinking light  or repair it in disk utility if it should become corrupted.
    For other with similar issues i did solve some other problems: when i connected it to my ethernet port on my iMac wifi stopped working.  Found that I had to turn off the ethernet in the system>network screen, but then TM didn't see the TC so i restarted after changes and then it saw it.
    Now a rant.  I can't believe in this wireless age that Apple would make a product that cant join a wireless net work.  The apple rep said i could return it and look for the previous TC that would join an existing wireless network.  Are we going backwards?
    Thanks!
    lennydas

    Ok... it is getting a bit clearer but there are still some questions.
    I connect to the internet via airport only and it is pretty fast.
    I was assuming airport in this statement in your first post meant the TC or the Express.. but I now realise we are still in the mass confusion stage where apple calls everything wireless an airport. So what you mean is the airport internal card of the computer??
    Also, I didn't want to bridge TC with my new fios router that I paid 100 dollars for, to get N speed and also paying 10 dollars more a month for fast speed.  I heard that bridging slows down everything and then there can be port issues with mail etc.
    I think this is mistaken.
    Putting the TC in bridge mode plugged into your FIOS will not slow the network.. nor will it cause mail or port issues.. in bridge the TC is just a fancy WAP and switch plus the network hard drive.
    If the computer is close it will be faster than the FIOS.
    You can run both wireless networks with different names.. so it is clear which is which. But you can also setup roaming so the computers themselves pick which is the best wireless.
    I tried extending the wireless net work and tried joining wireless network, but the TC kept crashing and I had to keep resetting the TC.  the Apple support person said these, extend wireless network and joint wireless network, are no longer a connection option with the new TC because of the new AC protocol.
    Thanks again!
    You cannot extend to a non-apple wireless router.
    You cannot use join a wireless network because when you do the ethernet ports will be cut off.
    But that has not changed.. I don't think Apple support is correct.. there has been no change with the AC model.. it is simply a fact that apple routers do not work in join wireless mode other than as a dumb client. The same applies to AC as to the earlier version.. but I have asked another person to check this.
    Join in the express is the only apple router that still allows an ethernet connection.
    For now you best use of the TC is bridged to the FIOS. Wireless you can sort out between several options.

  • Opening Claris Works-documents with Pages 2.0.2

    Hi fellow users,
    I've got an iMac with OSX 10.5.5 and I'm using Firefox 3.0.1 as my browser right now. Is there any way I could open my old Claris Works -textdocuments with Pages 2.0.2? If not, then do you know a any other way I could open them?

    ridetti wrote:
    Thank you both Yvan and dwb. But. The problem is that because I don't have the original Apple Works in my hard disk anymore the AppleWorks 6 Update does not work in my case because it only tells: "The default location required for this install could not be found. This install will be cancelled".
    What you got is normal. The updater apply to older intalled AppleWorks 6.
    If you need to open your documents, you need AppleWorks 6.
    So search a bit on the Net to buy one copy.
    http://discussions.apple.com/thread.jspa?messageID=8212326
    Yvan, I'm sorry about the wrong forum, but I really could not find a more suitable one...
    Yvan KOENIG (from FRANCE dimanche 23 novembre 2008 17:01:43)

  • Looking for a Digital Handycam that works well with the PB. Any suggestions

    Hi people,
    I recently got the SONY DCR DVD 105 Digital Handycam as a gift, (along with the receipt) Well the nice little sony is not compatible with the PB.
    So i'm now on the market for a handycam, as I want to return it.
    Does anyone here have any suggestions as to a good camera, for basic home video's, that works well with the PB, for editing reasons?
    Any help would be appreciated.
    Thanks

    Sorry...
    When I did that, it was on Ver 2 I think.... I found this..... iMovie 2 Compatible Camcorders
    More searching.... I got this (bit more current)....
    List Of Compatible Camcorders For iMovie
    Beavis2084

Maybe you are looking for

  • Block based on Stored Procedures & Locking_Mode

    Hello, I'm creating a block in Forms 6.0.8 based on Stored Procedures. I'm using the example given in Metalink doc 52778.1. Updates to data work fine if locking_mode = 'Immediate'. If I set locking_mode to 'Delayed' and run the form, when I try to up

  • Consolidate Library and Japanese filenames

    I'm using iTunes 8.0.1 on WinXP Pro and I'm having an odd problem. I have a number of Japanese albums and music videos in my library, and I regularly use the Consolidate Library function to keep everything organized. When I change song titles in my l

  • ORABPEL-04076 - How to resolve?

    The big picture is that I am looking to check out the Oracle BPEL Process Manager on my JBoss system. I have used other BPEL products (even Collaxa a few years back), but my experience with Oracle is limited. Following Section 3 in the "Oracle BPEL P

  • MDI Window Scrolls Bars Displayed

    We are having a problem with scroll bars displaying that we don't need or want. This happened when we converted from forms 5.0 to 6i. We have the window scroll bar properties set to "no", when-new-window-activated trigger has: SET_WINDOW_PROPERTY(FOR

  • Firefox opens new homepage window by itself

    For some reason, Firefox keeps opening new windows by itself. Like, new homepage windows. I'm not sure why it's doing this it hasnt been doing this . . Ill just be on a tab minding my own business, then the the next thing I know, a new homepage windo