Search Results

Search found 3923 results on 157 pages for 'binary x'.

Page 23/157 | < Previous Page | 19 20 21 22 23 24 25 26 27 28 29 30  | Next Page >

  • Binary Tree operator overloading and recursion

    - by furious.snail
    I was wondering how to overload the == operator for a binary tree to compare if two trees have identical data at same nodes. So far this is what I have: bool TreeType::operator==(const TreeType& otherTree) const { if((root == NULL) && (otherTree.root == NULL)) return true; //two null trees are equal else if((root != NULL) && (otherTree.root != NULL)) { return((root-info == otherTree.root-info) && //this part doesn't actually do anything recursively... //(root-left == otherTree.root-left) && //(root-right == otherTree.root-right)) } else return false; //one tree is null the other is not } I have a similar function that takes two TreeNode pointers as parameters but I've been stuck on how to convert it to this function.

    Read the article

  • Binary search of unaccesible data field in ldap from python

    - by EricR
    I'm interested in reproducing a particular python script. I have a friend who was accessing an ldap database, without authentication. There was a particular field of interest, we'll call it nin (an integer) for reference, and this field wasn't accessible without proper authentication. However, my friend managed to access this field through some sort of binary search (rather than just looping through integers) on the data; he would check the first digit, check if it was greater or less than the starting value, he would augment that until it returned a true value indicating existence, adding digits and continuing checking until he found the exact value of the integer nin. Any ideas on how he went about this? I've access to a similarly set up database.

    Read the article

  • Putting binary resources (images) in a separate assembly (WPF/.NET)

    - by haagel
    I have a .NET solution with a couple of projects. The output is a WPF application. Now I would like to put my binary resources (images/icons) in a single project/assembly in this solution, so that all my other projects in can use them. My question is how I can do that? What type of project should I create and how should I reference these resources in my XAML code (in the other projects)? I've tried quite a few things but I can't seem to get it to work...

    Read the article

  • Mahout Recommendations on Binary data

    - by Pranay Kumar
    Hi, I'm a newbie to mahout.My aim is to produce recommendations on binary user purchased data.So i applied item-item similarity model in computing top N recommendations for movie lens data assuming 1-3 ratings as a 0 and 4-5 ratings as a 1.Then i tried evaluating my recommendations with the ratings in the test-data but hardly there have been two or three matches from my top 20 recommendations to the top rated items in test data and no match for most users. So are my recommendations totally bad by nature or do i need to go for a different measure for evaluating my recommendations ? Please help me ! Thanks in advance. Pranay, 2nd yr ,UG student.

    Read the article

  • [C++] Wrong EOF when unzipping binary file

    - by djzmo
    Hello there, I tried to unzip a binary file to a membuf from a zip archive using Lucian Wischik's Zip Utils: http://www.wischik.com/lu/programmer/zip_utils.html http://www.codeproject.com/KB/files/zip_utils.aspx FindZipItem(hz, filename.c_str(), true, &j, &ze); char *content = new char[ze.unc_size]; UnzipItem(hz, j, content, ze.unc_size); delete[] content; But it didn't unzip the file correctly. It stopped at the first 0x00 of the file. For example when I unzip an MP3 file, it will only unzip the first 4 bytes: 0x49443303 (ID3\0) because the 5th to 8th byte is 0x00000000. I also tried to capture the ZR_RESULT, and it always return ZR_OK (which means completed without errors). I think this guy also had the same problem, but no one replied to his question: http://www.codeproject.com/KB/files/zip_utils.aspx?msg=2876222#xx2876222xx Any kind of help would be appreciated :)

    Read the article

  • Converting a C# DataTable instance to xml that contains HTML or binary data

    - by Wardy
    Hmmmm ... Although it works in most cases, one column has html data in it. It seems that doing this ... StringBuilder xmltarget = new StringBuilder(); XmlWriter xmlWriter = XmlWriter.Create(xmltarget); tableData.WriteXml(xmlWriter); ... doesn't identify where this html or binary data exists and wrap the data in cdata tags as it should ... Is there something i need to do to ensure the relevant checks are made and a working xml string is produced?

    Read the article

  • Find&Replace using Python - Binary file

    - by Aaron Hoffman
    Hello, I'm attempting to do a "find and replace" in a file on a Mac OS X computer. Although it appears to work correctly. It seems that the file is somehow altered. The text editor that I use (Text Wrangler) is unable to even open the file once this is completed. Here is the code as I have it: import fileinput for line in fileinput.FileInput("testfile.txt",inplace=1): line = line.replace("newhost",host) print line, When I view the file from the terminal, it does say "testfile" may be a binary file. See it anyway? Is there a chance that this replace is corrupting the file? Do I have another option for this to work? I really appreciate the help. Thank you, Aaron UPDATE: the actual file is NOT a .txt file it is a .plist file which is preference file in Mac OS X if that makes any difference

    Read the article

  • storing multiple values as binary in one field

    - by Enghoej
    Hi I have a project where I need to store a large number of values. The data is a dataset holding 1024 2Byte Unsigned integer values. Now I store one value at one row together with a timestamp and a unik ID. This data is continously stored based on a time trigger. What I would like to do, is store all 1024 values in one field. So would it be possible to do some routine that stores all the 1024 2byte integer values in one field as binary. Maybe a blobfield. Thanks. Br. Enghoej

    Read the article

  • Panel data with binary dependent variable in R

    - by Abiel
    Is it possible to do regressions in R using a panel data set with a binary dependent variable? I am familiar with using glm for logit and probit and plm for panel data, but am not sure how to combine the two. Are there any existing code examples? Thank you. EDIT It would also be helpful if I could figure out how to extract the matrix that plm() is using when it does a regression. For instance, you could use plm to do fixed effects, or you could create a matrix with the appropriate dummy variables and then run that through glm(). In a case like this, however, it is annoying to generate the dummies yourself and it would be easier to have plm do it for you. Abiel

    Read the article

  • Using memory mapping in C for reading binary

    - by user1320912
    I am trying to read data from a binary file and process it.It is a very large file so I thought I would use memory mapping. I am trying to use memory mapping so I can read the file byte by byte. I am getting a few compiler errors while doing this. I am doing this on a linux platform #include <unistd.h> #include <sys/types.h> #include <sys/mman.h> int fd; char *data; fd = open("data.bin", O_RDONLY); pagesize = 4000; data = mmap((caddr_t)0, pagesize, PROT_READ, MAP_SHARED, fd, pagesize); The errors i get are : caddr not initialized, R_RDONLY not initialized, mmap has too few arguments. Could someone help me out ?

    Read the article

  • C++'s unordered_map / hash_map / Google's dense_hash - how to input binary data (buf+len) and insert

    - by shlomif
    Hi all, I have two questions about Google's dense_hash_map, which can be used instead of the more standard unordered_map or hash_map: How do I use an arbitrary binary data memory segment as a key: I want a buffer+length pair, which may still contain some NUL (\0) characters. I can see how I use a NUL-terminated char * string , but that's not what I want. How do I implement an operation where I look if a key exists, and if not - insert it and if it does return the pointer to the existing key and let me know what actually happened. I'd appreciate it if anyone can shed any light on this subject. Regards, -- Shlomi Fish

    Read the article

  • Complexity in using Binary search and Trie

    - by user121196
    given a large list of alphabetically sorted words in a file,I need to write a program that, given a word x, determines if x is in the list. Preprocessing is ok since I will be calling this function many times over different inputs. priorties: 1. speed. 2. memory I already know I can use (n is number of words, m is average length of the words) 1. a trie, time is O(log(n)), space(best case) is O(log(n*m)), space(worst case) is O(n*m). 2. load the complete list into memory, then binary search, time is O(log(n)), space is O(n*m) I'm not sure about the complexity on tri, please correct me if they are wrong. Also are there other good approaches?

    Read the article

  • Transferring binary file from web server to client

    - by Yan Cheng CHEOK
    Usually, when I want to transfer a web server text file to client, here is what I did import cgi print "Content-Type: text/plain" print "Content-Disposition: attachment; filename=TEST.txt" print filename = "C:\\TEST.TXT" f = open(filename, 'r') for line in f: print line Works very fine for ANSI file. However, say, I have a binary file a.exe (This file is in web server secret path, and user shall not have direct access to that directory path). I wish to use the similar method to transfer. How I can do so? What content-type I should use? Using print seems to have corrupted content received at client side. What is the correct method?

    Read the article

  • Optimality of Binary Search

    - by templatetypedef
    Hello all- This may be a silly question, but does anyone know of a proof that binary search is asymptotically optimal? That is, if we are given a sorted list of elements where the only permitted operation on those objects is a comparison, how do you prove that the search can't be done in o(lg n)? (That's little-o of lg n, by the way.) Note that I'm restricting this to elements where the only operation permitted operation is a comparison, since there are well-known algorithms that can beat O(lg n) on expectation if you're allowed to do more complex operations on the data (see, for example, interpolation search). Thanks so much! This has really been bugging me since it seems like it should be simple but has managed to resist all my best efforts. :-)

    Read the article

  • change label text from a VB6 binary (not source code)

    - by Jun
    Hi, we have a VB6 binary executable that comes with no source code. And we need to change the label text for that VB6 application from "AAA" to "BBB". Is there any way or tools that can do that? The closest tool I can find right now is microsoft UISpy, it can read all the other elements but not the label. I hope there is a tool that can change the resource in the .exe so that the label "AAA" will read "BBB". Or is it possible to write a wrapper application, it will launch the .exe, examine the application screen for "AAA" and change that to "BBB"? Thank you for your help!

    Read the article

  • read text files containing binary data as a single matrix in matlab

    - by user1716595
    I have a text file which contains binary data in the following manner: 00000000000000000000000000000000001011111111111111111111111111111111111111111111111111111111110000000000000000000000000000000 00000000000000000000000000000000000000011111111111111111111111111111111111111111111111000111100000000000000000000000000000000 00000000000000000000000000000000000011111111111111111111111111111111111111111111111111111111100000000000000000000000000000000 00000000000000000000000000000000000111111111111111111111111111111111111111111111111111111111100000000000000000000000000000000 00000000000000000000000000000000000011111111111111111111111111111111111111111111111111111111100000000000000000000000000000000 00000000000000000000000000000000000000011111111111111111111111111111111111111111111111111111100000000000000000000000000000000 00000000000000000000000000000000000000011111111111111111111111111111111111111111111111000111110000000000000000000000000000000 00000000000000000000000000000000000000111111111111111111111111111111111111111111111111111111110000000000000000000000000000000 00000000000000000000000000000000000000000000111111111111111111111111111111111111110000000011100000000000000000000000000000000 00000000000000000000000000000000000000011111111111111111111111111111111111111111111111100111110000000000000000000000000000000 00000000000000000000000000000000000111111111111111111111111111111111111111111111111111110111110000000000000000000000000000000 00000000000000000000000000000000001111111111111111111111111111111111111111111111111111111111100000000000000000000000000000000 00000000000000000000000000000000000000001111111111111111111111111111111111111111111111000011100000000000000000000000000000000 00000000000000000000000000000000000000001111111111111111111111111111111111111111111111000011100000000000000000000000000000000 00000000000000000000000000000000000001111111111111111111111111111111111111111111111111111111000000000000000000000000000000000 00000000000000000000000000000000000000011111111111111111111111111111111111111111111110000011100000000000000000000000000000000 00000000000000000000000000000000000000000000011111111111111111111111111111111111100000000011100000000000000000000000000000000 00000000000000000000000000000000000000111111111111111111111111111111111111111111111111110111100000000000000000000000000000000 Plz note that each 1 or 0 is independent i.e the values are not decimal.I need to find the column wise sum of the file.There are 125 columns in all (here it is jumping onto the next line) and there are 840946 rows. I have tried textread,fscanf and a few other matlab commands but the result is that they all read each row in decimal format and create a 840946*1 array.I want to create a 840946*125 array to compute a column wise sum. Kindly help, Thanks!

    Read the article

  • haskell. words into binary numbers

    - by Katja
    I need to convert words into binary numbers. With a bit help of yours I got this blCo::String -> Integer blCo x = num2bin(lett2num x) blCo (x:xs) | x:xs = num2bin(lett2num x):blCo xs num2lett :: Int -> Char num2lett n | (n <= ord 'A') && (n <= ord 'Z') = chr(ord 'A'+ n - 1) | (n <= ord 'a') && (n <= ord 'Z') = chr(ord 'A'+ n - 1) num2bin :: Integer -> String num2bin n | n >= 0 = concatMap show (reverse ( n2b n)) | otherwise = error "num2bin: negative number" where n2b 0 = [] n2b n = n `mod` 2 : n2b (n `div` 2) he tells me a mistake.I dont undertsand it mistake: Couldn't match expected type `Char' against inferred type `String' In the first argument of `lett2num', namely `x' In the first argument of `num2bin', namely `(lett2num x)' In the expression: num2bin (lett2num x)

    Read the article

  • Java print binary number using bit-wise operator

    - by user69514
    Hi I am creating a method that will take a number and print it along with its binary representation. The problems is that my method prints all 0's for any positive number, and all 1's for any negative number private static void display( int number ){ System.out.print(number + "\t"); int mask = 1 << 31; for(int i=1; i<=32; i++) { if( (mask & number) != 0 ) System.out.print(1); else System.out.print(0); if( (i % 4) == 0 ) System.out.print(" "); } }

    Read the article

  • Export SQL Binary/BLOB Data?

    - by davemackey
    Recently a software application we utilize upgraded from ASP to ASP.NET. In the process they abandoned the old web-based product and rewrote the entire UI, using new DB tables. The old DB tables still exist in the database and contain legacy files in binary or blob formats. I'm wondering if there is an easy way to export all these legacy files from the database to the filesystem (NTFS)? Then we could delete these old unused tables and save a few GB of space in the DB backups, etc.

    Read the article

  • Java : Count even values in a Binary Search Tree recursively

    - by user307682
    Hi, I need to find out how many even values are contained in a binary tree. this is my code. private int countEven(BSTNode root){ if ((root == null)|| (root.value%2==1)) return 0; return 1+ countEven(root.left) + countEven(root.right); } this i just coded as i do not have a way to test this out. I'm not able to test it out at the moment but need an answer so badly. any help is deeply appreciated.

    Read the article

  • Dividing n-bit binary integers

    - by Julian
    Was wondering if anyone could help me with creating a pseudocode for how to go about dividing n-bit binary integers. Here is what I'm thinking could possibly work right now, could someone correct this if I'm wrong: divide (x,y) if x=0: return (0,0) //(quotient, remainder) (q,r) = divide(floor(x/2), y) q=2q, r=2r if x is odd: r = r+1 if r >= y: r = r-y, q = q+1 return (q,r) Would you guys say that this general pseudocode algorithm would accomplish the intended task of dividing n-bit numbers or am I missing something in my psuedocode before I start coding up something that's wrong?

    Read the article

  • Fastest way to convert a binary file to SQLite database

    - by chown
    I've some binary files and I'm looking for a way to convert each of those files to a SQLite database. I've already tried C# but the performance is too slow. I'm seeking an advice on how and what programming language should be the best to perform this kind of conversion. Though I prefer any Object Oriented Language more (like C#, Java etc), I'm open for any programming language that boosts up the conversion. I don't need a GUI frontend for the conversion, running the script/program from console is okay. Thanks in advance

    Read the article

  • Implementing an iterator over binary tree using C++ 11

    - by user1459339
    I would like to create an iterator over the binary tree so as to be able to use range-based for loop. I understand I ought to implement the begin() and end() function first. Begin should probably point to the root. According to the specification, however, the end() functions returns "the element following the last valid element". Which element (node) is that? Would it not be illegal to point to some "invalid" place? The other thing is the operator++. What is the best way to return "next" element in tree? I just need some advice to begin with this programming.

    Read the article

  • Trying to serialize and unserialze a Binary search tree to a file

    - by ClearMist
    I am trying to find a way to use these methods to save and restore a binary search tree that contains names and phone numbers in each node. I am just very lost and how to go about doing this. 'public void save(String fileName) { // TODO : implement this method. // save bst to its original shape. } public void restore(String fileName) { // TODO : implement this method. // restore bst from a file, if file exists. // do nothing, otherwise. File fichier = new File(fileName); if (fichier.exists()) { } }'

    Read the article

  • Is it safe to convert a mysqlpp::sql_blob to a std::string?

    - by Runcible
    I'm grabbing some binary data out of my MySQL database. It comes out as a mysqlpp::sql_blob type. It just so happens that this BLOB is a serialized Google Protobuf. I need to de-serialize it so that I can access it normally. This gives a compile error, since ParseFromString() is not intended for mysqlpp:sql_blob types: protobuf.ParseFromString( record.data ); However, if I force the cast, it compiles OK: protobuf.ParseFromString( (std::string) record.data ); Is this safe? I'm particularly worried because of this snippet from the mysqlpp documentation: "Because C++ strings handle binary data just fine, you might think you can use std::string instead of sql_blob, but the current design of String converts to std::string via a C string. As a result, the BLOB data is truncated at the first embedded null character during population of the SSQLS. There’s no way to fix that without completely redesigning either String or the SSQLS mechanism." Thanks for your assistance!

    Read the article

< Previous Page | 19 20 21 22 23 24 25 26 27 28 29 30  | Next Page >