Search Results

Search found 4671 results on 187 pages for 'universal binary'.

Page 8/187 | < Previous Page | 4 5 6 7 8 9 10 11 12 13 14 15  | Next Page >

  • Getting access to a binary response byte-by-byte in classic asp/JScript

    - by user89691
    I asked this question a few days ago but it seems to have gone cold fairly quickly. What I want to do is pretty simple and I can't believe someone hasn't figured it out. Solution needs to be JScript classic ASP. I am reading a file from a remote server and I want to process that (binary) file on my server and spit the results back to the client as XML. Here's a simplified version of what I am trying to do. This code runs, or will if the URL is filled in for your site. This test file is readbin.asp. It reads a file called test.bin, and writes the result to a stream. I used a stream because that makes it easier to read the file and parse the contents. Basically I want to: while not end of stream read byte from stream process byte here is readbin.asp: <%@ LANGUAGE = JScript %> <% var url = "http:// (... your URL to the file test.bin goes here...) " ; var xmlhttp = Server.CreateObject ("MSXML2.ServerXMLHTTP") ; xmlhttp.open ("GET", url, false) ; xmlhttp.send () ; var BinaryInputStream = Server.CreateObject ("ADODB.Stream") ; BinaryInputStream.Type = 1 ; // binary BinaryInputStream.Open ; BinaryInputStream.Write (xmlhttp.responseBody) ; BinaryInputStream.Position = 0 ; Response.Write ("BinaryInputStream.size = " + BinaryInputStream.size + "<br>") ; Response.Write ("BinaryInputStream = " + BinaryInputStream + "<br>") ; var ByteValue = BinaryInputStream.read (1) ; Response.Write ("ByteValue = " + ByteValue + "<br>") ; Response.Write ("typeof (ByteValue) = " + typeof (ByteValue) + "<br>") ; %> My problem is: how do I get ByteValue as a number 0..255? typeof (ByteValue) is "unknown". Ord?? Byte()?? Asc?? Chr??

    Read the article

  • how do I base encode a binary file (JPG) in ruby

    - by Angela
    I have a binary files which needs to be sent as a string to a third-party web-service. Turns out it requires that it needs to be base64 encoded. In ruby I use the following: body = body << IO.read("#{@postalcard.postalimage.path}") body is a strong which conists of a bunch of strings as parameters. So...how do I base64 encode it into this string? Thanks.

    Read the article

  • binary number in c++

    - by baash05
    In c++ 0x10 is the way to represent a hex value. if I leave off the 0x then it's dec. Is there a way to define a binary? Not that I can't derive 0x0003 is 11, but it would be cool if I could use 0b0011. It would just make the code a little more obvious.

    Read the article

  • Need help with Binary Columns

    - by nusrath
    Hi, I have to query a column containing a Binary column with data like this ®â{Õ¦K!Eòû¦?;#§ø. How can i query this colmn..if I wanted something like: SELECT Name FROM Users WHERE ID = ®â{Õ¦K!Eòû¦?;#§ø THanks

    Read the article

  • Convert a post-order binary tree traversal index to an level-order (breadth-first) index

    - by strfry
    Assuming a complete binary tree, each node can be adressed with the position it appears in a given tree traversal algorithm. For example, the node indices of a simple complete tree with height 3 would look like this: breadth first (aka level-order): 0 / \ 1 2 / \ / \ 3 4 5 6 post-order dept first: 6 / \ 2 5 / \ / \ 0 1 3 4 The height of the tree and an index in the post-order traversal is given. How can i calculate the breadth first index from this information?

    Read the article

  • Wix CustomAction Binary SourceFile not found

    - by narenvarmap
    <Binary Id="binUpdate" SourceFile="c:\xxx\Update.exe"/> <CustomAction Id="Update" BinaryKey="binUpdate" Execute="deferred" ExeCommand="c:\xxx" /> When I build a Wix project with the above custom action, it complains that "The system cannot find the file 'C:\xxx\Update.exe". This update.exe is deployed by the same msi. So, how do I make Wix to ignore the fact that the file does not exist on my build machine? Thanks in advance

    Read the article

  • Building a balanced binary search tree

    - by Znarkus
    Hi! Is there a method to build a balanced binary search tree? Example: 1 2 3 4 5 6 7 8 9 5 / \ 3 etc / \ 2 4 / 1 I'm thinking there is a method to do this, without using the more complex self-balancing trees. Otherwise I can do it on my own, but someone probably have done this already :)

    Read the article

  • binary operator "<"

    - by md004
    Consider this expression as a "selection" control structure on integer "x": 0 < x < 10, with the intention that the structure returns TRUE if "x" is in the range 1..9. Explain why a compiler should not accept this expression. (In particular, what are the issues regarding the binary operator "<"? Explain how a prefix operator could be introduced so the expression can be successfully processed.

    Read the article

  • Haskell Binary Tree Function (map)

    - by Bizarro
    How can i define a Haskell function which will apply a function to every value in a binary tree? So i know that it is similar to the map function - and that its type would be: mapT :: (a - b) - Tree a - Tree b but thats about it...

    Read the article

  • Binary Search Tree Contains Function

    - by Suede
    I am trying to write a "contains" function for a binary search tree. I receive the following error at compile "Unhandled exception at 0x77291CB3 (ntdll.dll) in BST.exe: 0xC00000FD: Stack overflow (parameters: 0x00000001, 0x001E2FFC)." The following is my code. struct Node { int data; Node* leftChild; Node* rightChild; Node() : leftChild(NULL), rightChild(NULL) {} }; struct BST { Node* root; BST() : root(NULL) {} void insert(int value); bool contains(int value); }; void BST::insert(int value) { Node* temp = new Node(); temp->data = value; if(root == NULL) { root = temp; return; } Node* current; current = root; Node* parent; parent = root; current = (temp->data < current->data ? (current->leftChild) : (current->rightChild) while(current != NULL) { parent = current; current = (temp->data < current->data) ? (current->leftChild) : (current->rightChild) } if(temp->data < parent->data) { parent->leftChild = temp; } if(temp->data > parent->data) { parent->rightChild = temp; } } bool BST::contains(int value) { Node* temp = new Node(); temp->data = value; Node* current; current = root; if(temp->data == current->data) { // base case for when node with value is found std::cout << "true" << std::endl; return true; } if(current == NULL) { // base case if BST is empty or if a leaf is reached before value is found std::cout << "false" << std::endl; return false; } else { // recursive step current = (temp->data < current->data) ? (current->leftChild) : (current->rightChild); return contains(temp->data); } } int main() { BST bst; bst.insert(5); bst.contains(4); system("pause"); } As it stands, I would insert a single node with value '5' and I would search the binary search tree for a node with value '4' - thus, I would expect the result to be false.

    Read the article

  • Constructing a Binary Tree from its traversals

    - by user991710
    I'm trying to construct a binary tree (unbalanced), given its traversals. I'm currently doing preorder + inorder but when I figure this out postorder will be no issue at all. I realize there are some question on the topic already but none of them seemed to answer my question. I've got a recursive method that takes the Preorder and the Inorder of a binary tree to reconstruct it, but is for some reason failing to link the root node with the subsequent children. Note: I don't want a solution. I've been trying to figure this out for a few hours now and even jotted down the recursion on paper and everything seems fine... so I must be missing something subtle. Here's the code: public static <T> BinaryNode<T> prePlusIn( T[] pre, T[] in) { if(pre.length != in.length) throw new IllegalArgumentException(); BinaryNode<T> base = new BinaryNode(); base.element = pre[0]; // * Get root from the preorder traversal. int indexOfRoot = 0; if(pre.length == 0 && in.length == 0) return null; if(pre.length == 1 && in.length == 1 && pre[0].equals(in[0])) return base; // * If both arrays are of size 1, element is a leaf. for(int i = 0; i < in.length -1; i++){ if(in[i].equals(base.element)){ // * Get the index of the root indexOfRoot = i; // in the inorder traversal. break; } // * If we cannot, the tree cannot be constructed as the traversals differ. else throw new IllegalArgumentException(); } // * Now, we recursively set the left and right subtrees of // the above "base" root node to whatever the new preorder // and inorder traversals end up constructing. T[] preleft = Arrays.copyOfRange(pre, 1, indexOfRoot + 1); T[] preright = Arrays.copyOfRange(pre, indexOfRoot + 1, pre.length); T[] inleft = Arrays.copyOfRange(in, 0, indexOfRoot); T[] inright = Arrays.copyOfRange(in, indexOfRoot + 1, in.length); base.left = prePlusIn( preleft, inleft); // * Construct left subtree. base.right = prePlusIn( preright, inright); // * Construc right subtree. return base; // * Return fully constructed tree } Basically, I construct additional arrays that house the pre- and inorder traversals of the left and right subtree (this seems terribly inefficient but I could not think of a better way with no helpers methods). Any ideas would be quite appreciated. Side note: While debugging it seems that the root note never receives the connections to the additional nodes (they remain null). From what I can see though, that should not happen... EDIT: To clarify, the method is throwing the IllegalArgumentException @ line 21 (else branch of the for loop, which should only be thrown if the traversals contain different elements.

    Read the article

  • Track user through Google Universal Analytics

    - by raygo
    I want to track a user from my site, give an id to Google Analytics and later be able to see which pages that id visited and for how long did that id view the pages. I've tried custom variables with the classic analytics. I tried enabling the User-ID feature in the Universal Analytics. Neither of these have given me what I want yet. Is there any way to accomplish this with Universal Analytics? UPDATE This is a sample code with a user whose id is 2. I try to set the userid in different ways to see if at least in one way it shows. <script> (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) })(window,document,'script','//www.google-analytics.com/analytics.js','ga'); ga('create', 'UA-XXXXXXX-1', 'domain.com', { 'userId': '2' }); ga('set', '&uid', '2'); // Set the user ID using signed-in user_id. var dimensionValue = '2'; ga('set', 'dimension1', dimensionValue); ga('send', 'pageview'); </script>

    Read the article

  • Execute binary from memory in C# .net with binary protected from a 3rd party software

    - by NoobTom
    i've the following scenario: i've a C# application.exe i pack application.exe inside TheMida, a software anti-piracy/reverse engineering. i encrypt application.exe with aes256. (i wrote my own aes encryption/decryption and it is working) Now, when i want to execute my application i do the following: decrypt application.exe in memory execute the application.exe with the following code: BinaryReader br = new BinaryReader(decOutput); byte[] bin = br.ReadBytes(Convert.ToInt32(decOutput.Length)); decOutput.Close(); br.Close(); // load the bytes into Assembly Assembly a = Assembly.Load(bin); // search for the Entry Point MethodInfo method = a.EntryPoint; if (method != null) { // create an istance of the Startup form Main method object o = a.CreateInstance(method.Name); // invoke the application starting point method.Invoke(o, null); the application does not execute correctly. Now, the problem i think, is that this method is only to execute .NET executable. Since i packed my application.exe inside TheMida this does not work. Is there a workaround to this situation? Any suggestion? Thank you in advance.

    Read the article

  • How to determine if binary tree is balanced?

    - by user69514
    It's been a while from those school years. Got a job as IT specialist at a hospital. Trying to move to do some actual programming now. I'm working on binary trees now, and I was wondering what would be the best way to determine if the tree is height-balanced. I was thinking of something along this: public boolean isBalanced(Node root){ if(root==null){ return true; //tree is empty } else{ int lh = root.left.height(); int rh = root.right.height(); if(lh - rh > 1 || rh - lh > 1){ return false; } } return true; } Is this a good implementation? or am I missing something?

    Read the article

  • C Programming - Convert an integer to binary

    - by leo
    Hi guys - i was hopefully after some tips opposed to solutions as this is homework and i want to solve it myself I am firstly very new to C. In fact i have never done any before, though i have previous java experience from modules at university. I am trying to write a programme that converts a single integer in to binary. I am only allowed to use bitwise operations and no library functions Can anyone possibly suggest some ideas about how i would go about doing this. Obviously i dont want code or anything, just some ideas as to what avenues to explore as currenty i am a little confused and have no plan of attack. Well, make that a lot confused :D thanks very much

    Read the article

  • Average performance of binary search algorithm?

    - by Passonate Learner
    http://en.wikipedia.org/wiki/Binary_search_algorithm#Average_performance BinarySearch(int A[], int value, int low, int high) { int mid; if (high < low) return -1; mid = (low + high) / 2; if (A[mid] > value) return BinarySearch(A, value, low, mid-1); else if (A[mid] < value) return BinarySearch(A, value, mid+1, high); else return mid; } If the integer I'm trying to find is always in the array, can anyone help me write a program that can calculate the average performance of binary search algorithm?

    Read the article

  • No Binary File Generation

    - by Nathan Campos
    I've just bought a new laptop for me on the travel, then on my free time, I've started to test MinGW on it by trying to compile my own OS that is written in C++, then I've created all the files needed and the kernel.cpp: extern "C" void _main(struct multiboot_data* mbd, unsigned int magic); void _main( struct multiboot_data* mbd, unsigned int magic ) { char * boot_loader_name =(char*) ((long*)mbd)[16]; /* Print a letter to screen to see everything is working: */ unsigned char *videoram = (unsigned char *) 0xb8000; videoram[0] = 65; /* character 'A' */ videoram[1] = 0x07; /* forground, background color. */ } And tried to compile it with g++ G: g++ -o C:\kernel.o -c kernel.cpp -Wall -Wextra -Werror -nostdlib -nostartfiles -nodefaultlibs kernel.cpp: In function `void _main(multiboot_data*, unsigned int)': kernel.cpp:8: warning: unused variable 'boot_loader_name' kernel.cpp: At global scope: kernel.cpp:4: warning: unused parameter 'magic' G: But it don't create any binary file at C:/, what can I do?

    Read the article

  • Sending binary data from ASP to .net component

    - by john
    The ASP application allows uploading of image files (jpg, gif, tif). These files are sent to a .net component registered in the GAC of the server. In the component file is encoded using System.Text.Unicode to byte[] array. This encoding is done with some data loss. The byte array has values 253 and 255 in consequetive elements. What could be the problem ? I'm sending the binary data as a string. Please help me... Thanks in advance, John

    Read the article

  • Binary Search Tree node removal

    - by doc
    I've been trying to implement a delete function for a Binary Search Tree but haven't been able to get it to work in all cases. This is my latest attempt: if(t->get_left() == empty) *t = *t->get_left(); else if(t->get_right() == empty) *t = *t->get_right(); else if((t->get_left() != empty) && (t->get_right() != empty)) { Node* node = new Node(t->get_data(), t->get_parent(), t->get_colour(), t->get_left(), t->get_right()); *t = *node; } t is a node and empty is just a node with nothing in it. I'm just trying to swap the values but I'm getting a runtime error. Any ideas? Thanks

    Read the article

< Previous Page | 4 5 6 7 8 9 10 11 12 13 14 15  | Next Page >