21 Solved Topics

Remove Filter
Member Avatar for
Member Avatar for Mr.M

Hi DW. How can one read a file or change a file bits without reading the entire file. But first of all how can I read a file in such a way that I get it's bits. I want to read MP3 file and change it bits but I don't …

Member Avatar for AssertNull
0
649
Member Avatar for ryannnnn

**Read title.** username = base64.b64encode(username)+'\n' This is what I thought would have worked, but it comes up with an error, "TypeError: can't concat bytes to str", meaning that I cannot add +'\n' to the end of the code. If there is anyway anyone knows how to write the byte of …

Member Avatar for vegaseat
0
297
Member Avatar for Doogledude123

Alright, so I have seen `<<` and `>>` in a few different Java Programs and I have an idea of what they do, but I have no idea what you would use them for. I haven't ran into a problem where I need to use them, so if someone could …

Member Avatar for Doogledude123
0
181
Member Avatar for tony75

Hi Im using windows form applicaton and try using a method that returns a value and have a parmeterlist input. I try to creat a program that converts a number of kilobytes (KB) to byte. The program's user to specify the number of KiB and the program will print the …

Member Avatar for tony75
0
205
Member Avatar for CoilFyzx

Hello good day. I have a quick question is anyone able to assist me in saving a password file. I encrypted my password and so I want to save the salt and the encrypted password(which are byte arrays). I tried using a properties file, but I soon found out that …

Member Avatar for CoilFyzx
0
243
Member Avatar for Alexkid

Hi there, I have an array of unsigned chars that hold hex values, I’m interested in values [5] and [6] of the array. Say [5] = 0x5b = 0101 1011 and [6] = 0x7b = 0111 1011 I'm trying to get all of [5] and the first half of [6], …

Member Avatar for L7Sqr
0
191
Member Avatar for trishtren

Hey, Iv been looking around for a simple way (meaning less than 10 lines) to reverse the order of my bytes in a byte array. At the moment my code is: public byte[] outputarray() { byte b[] = new byte[10]; ByteBuffer buf = ByteBuffer.wrap(b); buf.putLong(output); } The problem is that …

Member Avatar for trishtren
0
3K
Member Avatar for trishtren

Hey, I was hoping someone can help me convert a piece of php code, im not really sure where to start pack( 'v', $test ); The pack php function above takes in an integer and converts it to an unsigned long. V - unsigned long (always 32 bit, little endian …

Member Avatar for keith.pastorek
0
1K
Member Avatar for Krokcy

So i have a working network file transfer program now (if you want to see some of the code look at my other '[article](http://www.daniweb.com/software-development/java/threads/426357/networking-in-java-not-doing-it-right)'). But now that im trying larger files, im running into a problem where i run out of memory (which is understandable when the array is 1 …

Member Avatar for Krokcy
0
4K
Member Avatar for trishtren

Hey, Im stuck trying to figure out how to insert one byte between two other bytes that have already been created in an output stream: OutputStream out = new FileOutputStream("MyFile"); try { out.write((byte) 70); /*Byte should be inserted between these elements*/ out.write((byte) 40); /* but must be performed at end …

Member Avatar for trishtren
0
176
Member Avatar for dshiells

Hi all, I'm sure this is a n00b question, but I can't seem to get my head around it! I have a 4 BYTE array which I want to display as a decimal value. For example, in the array it contains the hex values: 00 05 7d a4, and I …

Member Avatar for dshiells
0
2K
Member Avatar for DanWebb3148

[CODE]sizeA = 2**28 M = [0]*sizeA[/CODE] The above code creates an array but, each element is 4 bytes each. How do create a large byte array with type 'B' (eight bits unsigned)? I would like it to be as large as possible. I need it for a sieve prime number …

Member Avatar for DanWebb3148
0
960
Member Avatar for IcantC

Hi there, My question is how could I output byte value (meaning zeros and ones) to screen. I just want to try some shifts and see how it works.

Member Avatar for IcantC
0
9K
Member Avatar for janet@123

i am receiving a struct from the switch: [CODE]/* Packet received on port (datapath -> controller). */ struct ofp_packet_in { struct ofp_header header; uint32_t buffer_id; /* ID assigned by datapath. */ uint16_t total_len; /* Full length of frame. */ uint16_t in_port; /* Port on which frame was received. */ uint8_t …

Member Avatar for janet@123
0
264
Member Avatar for sathya88

how to free memory of byte array... code[CODE]for(int j=0;j<count;j++){ buffer=null; //[COLOR="Red"]free the memory by set as a null but not working????? shows array index out of bound exception for the second time[/COLOR] buffer= new byte[size]; //byte mem alloc temp2=di.read(buffer,total,size);// read buffer total=total+temp2; fo=null; ds=null; fo= new FileOutputStream(flist[j]); ds= new DataOutputStream(fo); …

Member Avatar for masijade
0
7K
Member Avatar for bleedi

Hey, I'm working on a project where we have to stream files from a server app to clients. I have it all working nicely, but we have a special client type that cannot save files to HDD, not even temporarily. I can get the byte stream from server to this …

Member Avatar for CsharpChico
0
733
Member Avatar for pi_lord12

Hey guys, I'm working on a project to use Huffman trees to compress a text file into binary. For instance, based on the frequency of the characters in a string like "aardvark", a - 3 r - 2 d - 1 v - 1 k - 1, compression using a …

Member Avatar for pi_lord12
0
214
Member Avatar for RenanLazarotto

Hey guys, quick questions! 1- How can I check the size of a variable? Size in bytes, not length. (; 2- What data can be stored into byte variables? And what the maxium size of the variable? 3- How do I store data inside a byte variable? Thats all for …

Member Avatar for RenanLazarotto
0
141
Member Avatar for rokape

Hi Guys, As the title says really... Sounds simple, it is. But....! I'm dealing with huge numbers here. I'm dragging bandwidth from a logging system I am developing for a client and it returns it in BYTES... Very accurate :| This is the sort of number I'm dealing with here... …

Member Avatar for rokape
0
2K
Member Avatar for waleed.makarem

Dear All , The question is quite simple for all of you . I have a binary file . A description for this file says that : "first 2 bytes in the header is the number of records" I have opened this file and loaded it into bytes by this …

Member Avatar for waleed.makarem
0
223
Member Avatar for Clawsy

Hi, I first convert the image on the server application in bytes: [code] //server public void sendImage(File file) throws IOException { ByteArrayOutputStream baos=new ByteArrayOutputStream(1000); BufferedImage img=ImageIO.read(new File(file.getAbsolutePath())); ImageIO.write(img, "jpg", baos); baos.flush(); os.write(baos.toByteArray());// this is a "new DataOutputStream(clientSocket.getOutputStream());" System.out.println("Done! Length is:"+baos.toByteArray().length); baos.close(); } [/code] Then my application freezes when trying to …

Member Avatar for Clawsy
0
219

The End.