Search Results

Search found 4337 results on 174 pages for 'binary runner'.

Page 12/174 | < Previous Page | 8 9 10 11 12 13 14 15 16 17 18 19  | Next Page >

  • C++ how to store integer into a binary file??

    - by blaxc
    i gt a struct with 2 integer, i want to store them in a binary file and read it again... here is my code... struct pw { int a; int b; }; void main(){ pw* p = new pw(); pw* q = new pw(); std::ofstream fout(ADMIN_FILE, ios_base::out | ios_base::binary | ios_base::trunc); std::ifstream fin(ADMIN_FILE, ios_base::in | ios_base::binary); p->a=123; p->b=321; fout.write((const char*)p, sizeof(pw)); fin.write((char*)q, sizeof(pw)); fin.close(); cout<< q->a << endl;} my output is 0. anyone can tell me what is the problem?

    Read the article

  • How to generate and encode (for use in GA), random, strict, binary rooted trees with N leaves?

    - by Peter Simon
    First, I am an engineer, not a computer scientist, so I apologize in advance for any misuse of nomenclature and general ignorance of CS background. Here is the motivational background for my question: I am contemplating writing a genetic algorithm optimizer to aid in designing a power divider network (also called a beam forming network, or BFN for short). The BFN is intended to distribute power to each of N radiating elements in an array of antennas. The fraction of the total input power to be delivered to each radiating element has been specified. Topologically speaking, a BFN is a strictly binary, rooted tree. Each of the (N-1) interior nodes of the tree represents the input port of an unequal, binary power splitter. The N leaves of the tree are the power divider outputs. Given a particular power divider topology, one is still free to map the power divider outputs to the array inputs in an arbitrary order. There are N! such permutations of the outputs. There are several considerations in choosing the desired ordering: 1) The power ratio for each binary coupler should be within a specified range of values. 2) The ordering should be chosen to simplify the mechanical routing of the transmission lines connecting the power divider. The number of ouputs N of the BFN may range from, say, 6 to 22. I have already written a genetic algorithm optimizer that, given a particular BFN topology and desired array input power distribution, will search through the N! permutations of the BFN outputs to generate a design with compliant power ratios and good mechanical routing. I would now like to generalize my program to automatically generate and search through the space of possible BFN topologies. As I understand it, for N outputs (leaves of the binary tree), there are $C_{N-1}$ different topologies that can be constructed, where $C_N$ is the Catalan number. I would like to know how to encode an arbitrary tree having N leaves in a way that is consistent with a chromosomal description for use in a genetic algorithm. Also associated with this is the need to generate random instances for filling the initial population, and to implement crossover and mutations operators for this type of chromosome. Any suggestions will be welcome. Please minimize the amount of CS lingo in your reply, since I am not likely to be acquainted with it. Thanks in advance, Peter

    Read the article

  • How to create a complete binary tree of height 'h' using Python?

    - by Jack
    Here is the node structure class Node: def __init__(self, data): # initializes the data members self.left = None self.right = None self.parent = None self.data = data complete binary tree Definition: A binary tree in which every level, except possibly the deepest, is completely filled. At depth n, the height of the tree, all nodes must be as far left as possible. -- http://www.itl.nist.gov/div897/sqg/dads/HTML/completeBinaryTree.html I am looking for an efficient algorithm.

    Read the article

  • Can I use a binary literal in C or C++?

    - by hamza
    I need to work with a binary number. I tried writing: const x = 00010000 ; But it didn't work. I know that I can use an hexadecimal number that has the same value as 00010000 but I want to know if there is a type in C++ for binary numbers & if there isn't, is there another solution for my problem?

    Read the article

  • Deserialization error using Runtime Serialization with the Binary Formatter

    - by Lily
    When I am deserializing a hierarchy I get the following error The input stream is not a valid binary format. The starting contents (in bytes) are The input stream is not a valid binary format. The starting contents (in bytes) are: 20-01-20-20-20-FF-FF-FF-FF-01-20-20-20-20-20-20-20 ..." Any help please? Extra info: public void Serialize(ISyntacticNode person) { Stream stream = File.Open(fileName, FileMode.OpenOrCreate); try { BinaryFormatter binary = new BinaryFormatter(); pList.Add(person); binary.Serialize(stream, pList); stream.Close(); } catch { stream.Close(); } } public List<ISyntacticNode> Deserialize() { Stream stream = File.Open(fileName, FileMode.OpenOrCreate); BinaryFormatter binary = new BinaryFormatter(); try { pList = (List<ISyntacticNode>)binary.Deserialize(stream); binary.Serialize(stream, pList); stream.Close(); } catch { pList = new List<ISyntacticNode>(); binary.Serialize(stream, pList); stream.Close(); } return pList; } I am Serializing a hierarchy which is of type Proxem.Antelope.Parsing.ISyntacticNode Now I have gotten this error System.Runtime.Serialization.SerializationException: Binary stream '116' does not contain a valid BinaryHeader. Possible causes are invalid stream or object version change between serialization and deserialization. i'm using a different instance. How may I avoid this error please

    Read the article

  • 'Binary XML' for game data?

    - by bluescrn
    I'm working on a level editing tool that saves its data as XML. This is ideal during development, as it's painless to make small changes to the data format, and it works nicely with tree-like data. The downside, though, is that the XML files are rather bloated, mostly due to duplication of tag and attribute names. Also due to numeric data taking significantly more space than using native datatypes. A small level could easily end up as 1Mb+. I want to get these sizes down significantly, especially if the system is to be used for a game on the iPhone or other devices with relatively limited memory. The optimal solution, for memory and performance, would be to convert the XML to a binary level format. But I don't want to do this. I want to keep the format fairly flexible. XML makes it very easy to add new attributes to objects, and give them a default value if an old version of the data is loaded. So I want to keep with the hierarchy of nodes, with attributes as name-value pairs. But I need to store this in a more compact format - to remove the massive duplication of tag/attribute names. Maybe also to give attributes native types, so, for example floating-point data is stored as 4 bytes per float, not as a text string. Google/Wikipedia reveal that 'binary XML' is hardly a new problem - it's been solved a number of times already. Has anyone here got experience with any of the existing systems/standards? - are any ideal for games use - with a free, lightweight and cross-platform parser/loader library (C/C++) available? Or should I reinvent this wheel myself? Or am I better off forgetting the ideal, and just compressing my raw .xml data (it should pack well with zip-like compression), and just taking the memory/performance hit on-load?

    Read the article

  • Shell not finding binary when attempting to execute it (it's _definitely_ there)

    - by eegg
    I have a specific set of binaries installed at: ~/.GutenMark/binary/<binaries...> These were previously working correctly, but for seemingly no reason when I attempt to execute them the shell claims not to find them: james@anubis:~/.GutenMark/binary$ ls -al ... -rwxr-xr-x 1 james james 2979036 2009-05-10 13:34 GUItenMark ... -rwxrwxrwx 1 james james 76952 2009-05-10 13:34 GutenMark ... -rwxr-xr-x 1 james james 10156 2009-05-10 13:34 GutenSplit ... james@anubis:~/.GutenMark/binary$ ./GutenMark bash: ./GutenMark: No such file or directory james@anubis:~/.GutenMark/binary$ I've tried to isolate the cause of this, with no success. The same happens with zsh, bash, and sh (all giving their appropriate "file not found" error -- this is definitely not a strange output from the binary itself). The same happens either as user james or as root. Nor is it directory specific; if I move the whole directory installation, or just a single binary, to anywhere else, the same happens when attempting to execute it. The same even happens when I put the directory in $PATH and just execute "GutenMark". It also happens when I execute it from a script (I've tried Python's commands module -- though this appears to just call sh). The problem appears to be specific to the binaries themselves, yet they appear to never actually get executed. Any ideas?

    Read the article

  • App.config for SpecFlow not recognized by NUnit GUI runner

    - by INTPnerd
    How do I get my App.config file to be recognized/used by the NUnit GUI runner? I have tried placing it in the top folder of my project and in the same folder as my feature files. Here are the contents of my App.config file: <?xml version="1.0" encoding="utf-8" ?> <configuration> <configSections> <section name="specFlow" type="TechTalk.SpecFlow.Configuration.ConfigurationSectionHandler, TechTalk.SpecFlow"/> </configSections> <specFlow> <runtime detectAmbiguousMatches="true" stopAtFirstError="false" missingOrPendingStepsOutcome="Error" /> </specFlow> </configuration> Specifically I am trying to tell NUnit to have a fail result when there is a missing or pending step which is why I am specifying "Error" for this. This actually works correctly when I use TestDriven.net but not when I use the NUnit GUI runner. The GUI always shows a green bar and displays the test as Inconclusive instead of Error or Failed

    Read the article

  • How to efficiently convert String, integer, double, datetime to binary and vica versa?

    - by Ben
    Hi, I'm quite new to C# (I'm using .NET 4.0) so please bear with me. I need to save some object properties (their properties are int, double, String, boolean, datetime) to a file. But I want to encrypt the files using my own encryption, so I can't use FileStream to convert to binary. Also I don't want to use object serialization, because of performance issues. The idea is simple, first I need to somehow convert objects (their properties) to binary (array), then encrypt (some sort of xor) the array and append it to the end of the file. When reading first decrypt the array and then somehow convert the binary array back to object properties (from which I'll generate objects). I know (roughly =) ) how to convert these things by hand and I could code it, but it would be useless (too slow). I think the best way would be just to get properties' representation in memory and save that. But I don't know how to do it using C# (maybe using pointers?). Also I though about using MemoryStream but again I think it would be inefficient. I am thinking about class Converter, but it does not support toByte(datetime) (documentation says it always throws exception). For converting back I think the only options is class Converter. Note: I know the structure of objects and they will not change, also the maximum String length is also known. Thank you for all your ideas and time. EDIT: I will be storing only parts of objects, in some cases also parts of different objects (a couple of properties from one object type and a couple from another), thus I think that serialization is not an option for me.

    Read the article

  • sudo apt-get update problem

    - by Jeon
    I have a problem with sudo apt-get update that I can't seem to fix and It's causing problems with alot of installations I want to do. I run Ubuntu 12.04. Ign http://ftp.availo.se precise InRelease Ign http://ftp.availo.se precise-updates InRelease Ign http://ftp.availo.se precise-backports InRelease Ign http://ftp.availo.se precise-security InRelease Get:1 http://repository.spotify.com stable InRelease [2,979 B] Ign http://ppa.launchpad.net precise InRelease Ign http://extras.ubuntu.com precise InRelease Ign http://archive.canonical.com precise InRelease Ign http://ppa.launchpad.net precise InRelease Ign http://ppa.launchpad.net precise InRelease Ign http://repository.spotify.com stable InRelease Ign http://ftp.availo.se precise Release.gpg Ign http://ftp.availo.se precise-updates Release.gpg Ign http://ftp.availo.se precise-backports Release.gpg Ign http://repository.spotify.com stable/non-free amd64 Packages/DiffIndex Hit http://ppa.launchpad.net precise Release.gpg Hit http://ppa.launchpad.net precise Release.gpg Hit http://archive.canonical.com precise Release.gpg Hit http://extras.ubuntu.com precise Release.gpg Ign http://ftp.availo.se precise-security Release.gpg Ign http://repository.spotify.com stable/non-free i386 Packages/DiffIndex Ign http://repository.spotify.com stable/non-free TranslationIndex Hit http://ppa.launchpad.net precise Release.gpg Hit http://archive.canonical.com precise Release Hit http://extras.ubuntu.com precise Release Ign http://ftp.availo.se precise Release Ign http://ftp.availo.se precise-updates Release Hit http://ppa.launchpad.net precise Release Hit http://archive.canonical.com precise/partner amd64 Packages Hit http://extras.ubuntu.com precise/main Sources Ign http://ftp.availo.se precise-backports Release Ign http://ftp.availo.se precise-security Release Hit http://ppa.launchpad.net precise Release Hit http://archive.canonical.com precise/partner i386 Packages Ign http://archive.canonical.com precise/partner TranslationIndex Hit http://ppa.launchpad.net precise Release Hit http://extras.ubuntu.com precise/main amd64 Packages Hit http://extras.ubuntu.com precise/main i386 Packages Ign http://ftp.availo.se precise/main TranslationIndex Ign http://ftp.availo.se precise/multiverse TranslationIndex Ign http://ftp.availo.se precise/restricted TranslationIndex Hit http://ppa.launchpad.net precise/main Sources Hit http://ppa.launchpad.net precise/main amd64 Packages Hit http://ppa.launchpad.net precise/main i386 Packages Ign http://ppa.launchpad.net precise/main TranslationIndex Ign http://extras.ubuntu.com precise/main TranslationIndex Ign http://ftp.availo.se precise/universe TranslationIndex Hit http://ppa.launchpad.net precise/main Sources Hit http://ppa.launchpad.net precise/main amd64 Packages Hit http://ppa.launchpad.net precise/main i386 Packages Ign http://ppa.launchpad.net precise/main TranslationIndex Hit http://ppa.launchpad.net precise/main Sources Hit http://ppa.launchpad.net precise/main amd64 Packages Hit http://ppa.launchpad.net precise/main i386 Packages Ign http://ppa.launchpad.net precise/main TranslationIndex Ign http://ftp.availo.se precise-updates/main TranslationIndex Ign http://ftp.availo.se precise-updates/multiverse TranslationIndex Ign http://ftp.availo.se precise-updates/restricted TranslationIndex Ign http://ftp.availo.se precise-updates/universe TranslationIndex Hit http://repository.spotify.com stable/non-free amd64 Packages Ign http://ftp.availo.se precise-backports/main TranslationIndex Ign http://ftp.availo.se precise-backports/multiverse TranslationIndex Ign http://ftp.availo.se precise-backports/restricted TranslationIndex Ign http://ftp.availo.se precise-backports/universe TranslationIndex Hit http://repository.spotify.com stable/non-free i386 Packages Ign http://archive.canonical.com precise/partner Translation-en_US Ign http://ftp.availo.se precise-security/main TranslationIndex Ign http://ftp.availo.se precise-security/multiverse TranslationIndex Ign http://ftp.availo.se precise-security/restricted TranslationIndex Ign http://ftp.availo.se precise-security/universe TranslationIndex Ign http://repository.spotify.com stable/non-free Translation-en_US Ign http://archive.canonical.com precise/partner Translation-en Ign http://repository.spotify.com stable/non-free Translation-en Ign http://extras.ubuntu.com precise/main Translation-en_US Ign http://extras.ubuntu.com precise/main Translation-en Ign http://ppa.launchpad.net precise/main Translation-en_US Ign http://ppa.launchpad.net precise/main Translation-en Ign http://ppa.launchpad.net precise/main Translation-en_US Ign http://ppa.launchpad.net precise/main Translation-en Ign http://ppa.launchpad.net precise/main Translation-en_US Ign http://ppa.launchpad.net precise/main Translation-en Err http://ftp.availo.se precise/main Sources 404 Not Found Err http://ftp.availo.se precise/restricted Sources 404 Not Found Err http://ftp.availo.se precise/universe Sources 404 Not Found Err http://ftp.availo.se precise/multiverse Sources 404 Not Found Err http://ftp.availo.se precise/main amd64 Packages 404 Not Found Err http://ftp.availo.se precise/restricted amd64 Packages 404 Not Found Err http://ftp.availo.se precise/universe amd64 Packages 404 Not Found Err http://ftp.availo.se precise/multiverse amd64 Packages 404 Not Found Err http://ftp.availo.se precise/main i386 Packages 404 Not Found Err http://ftp.availo.se precise/restricted i386 Packages 404 Not Found Err http://ftp.availo.se precise/universe i386 Packages 404 Not Found Err http://ftp.availo.se precise/multiverse i386 Packages 404 Not Found Err http://ftp.availo.se precise-updates/main Sources 404 Not Found Err http://ftp.availo.se precise-updates/restricted Sources 404 Not Found Err http://ftp.availo.se precise-updates/universe Sources 404 Not Found Err http://ftp.availo.se precise-updates/multiverse Sources 404 Not Found Err http://ftp.availo.se precise-updates/main amd64 Packages 404 Not Found Err http://ftp.availo.se precise-updates/restricted amd64 Packages 404 Not Found Err http://ftp.availo.se precise-updates/universe amd64 Packages 404 Not Found Err http://ftp.availo.se precise-updates/multiverse amd64 Packages 404 Not Found Err http://ftp.availo.se precise-updates/main i386 Packages 404 Not Found Err http://ftp.availo.se precise-updates/restricted i386 Packages 404 Not Found Err http://ftp.availo.se precise-updates/universe i386 Packages 404 Not Found Err http://ftp.availo.se precise-updates/multiverse i386 Packages 404 Not Found Err http://ftp.availo.se precise-backports/main Sources 404 Not Found Err http://ftp.availo.se precise-backports/restricted Sources 404 Not Found Err http://ftp.availo.se precise-backports/universe Sources 404 Not Found Err http://ftp.availo.se precise-backports/multiverse Sources 404 Not Found Err http://ftp.availo.se precise-backports/main amd64 Packages 404 Not Found Err http://ftp.availo.se precise-backports/restricted amd64 Packages 404 Not Found Err http://ftp.availo.se precise-backports/universe amd64 Packages 404 Not Found Err http://ftp.availo.se precise-backports/multiverse amd64 Packages 404 Not Found Err http://ftp.availo.se precise-backports/main i386 Packages 404 Not Found Err http://ftp.availo.se precise-backports/restricted i386 Packages 404 Not Found Err http://ftp.availo.se precise-backports/universe i386 Packages 404 Not Found Err http://ftp.availo.se precise-backports/multiverse i386 Packages 404 Not Found Err http://ftp.availo.se precise-security/main Sources 404 Not Found Err http://ftp.availo.se precise-security/restricted Sources 404 Not Found Err http://ftp.availo.se precise-security/universe Sources 404 Not Found Err http://ftp.availo.se precise-security/multiverse Sources 404 Not Found Err http://ftp.availo.se precise-security/main amd64 Packages 404 Not Found Err http://ftp.availo.se precise-security/restricted amd64 Packages 404 Not Found Err http://ftp.availo.se precise-security/universe amd64 Packages 404 Not Found Err http://ftp.availo.se precise-security/multiverse amd64 Packages 404 Not Found Err http://ftp.availo.se precise-security/main i386 Packages 404 Not Found Err http://ftp.availo.se precise-security/restricted i386 Packages 404 Not Found Err http://ftp.availo.se precise-security/universe i386 Packages 404 Not Found Err http://ftp.availo.se precise-security/multiverse i386 Packages 404 Not Found Ign http://ftp.availo.se precise/main Translation-en_US Ign http://ftp.availo.se precise/main Translation-en Ign http://ftp.availo.se precise/multiverse Translation-en_US Ign http://ftp.availo.se precise/multiverse Translation-en Ign http://ftp.availo.se precise/restricted Translation-en_US Ign http://ftp.availo.se precise/restricted Translation-en Ign http://ftp.availo.se precise/universe Translation-en_US Ign http://ftp.availo.se precise/universe Translation-en Ign http://ftp.availo.se precise-updates/main Translation-en_US Ign http://ftp.availo.se precise-updates/main Translation-en Ign http://ftp.availo.se precise-updates/multiverse Translation-en_US Ign http://ftp.availo.se precise-updates/multiverse Translation-en Ign http://ftp.availo.se precise-updates/restricted Translation-en_US Ign http://ftp.availo.se precise-updates/restricted Translation-en Ign http://ftp.availo.se precise-updates/universe Translation-en_US Ign http://ftp.availo.se precise-updates/universe Translation-en Ign http://ftp.availo.se precise-backports/main Translation-en_US Ign http://ftp.availo.se precise-backports/main Translation-en Ign http://ftp.availo.se precise-backports/multiverse Translation-en_US Ign http://ftp.availo.se precise-backports/multiverse Translation-en Ign http://ftp.availo.se precise-backports/restricted Translation-en_US Ign http://ftp.availo.se precise-backports/restricted Translation-en Ign http://ftp.availo.se precise-backports/universe Translation-en_US Ign http://ftp.availo.se precise-backports/universe Translation-en Ign http://ftp.availo.se precise-security/main Translation-en_US Ign http://ftp.availo.se precise-security/main Translation-en Ign http://ftp.availo.se precise-security/multiverse Translation-en_US Ign http://ftp.availo.se precise-security/multiverse Translation-en Ign http://ftp.availo.se precise-security/restricted Translation-en_US Ign http://ftp.availo.se precise-security/restricted Translation-en Ign http://ftp.availo.se precise-security/universe Translation-en_US Ign http://ftp.availo.se precise-security/universe Translation-en Fetched 2,979 B in 9s (328 B/s) W: GPG error: http://repository.spotify.com stable InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 082CCEDF94558F59 W: Failed to fetch http://ftp.availo.se/ubuntu/dists/precise/main/source/Sources 404 Not Found W: Failed to fetch http://ftp.availo.se/ubuntu/dists/precise/restricted/source/Sources 404 Not Found W: Failed to fetch http://ftp.availo.se/ubuntu/dists/precise/universe/source/Sources 404 Not Found W: Failed to fetch http://ftp.availo.se/ubuntu/dists/precise/multiverse/source/Sources 404 Not Found W: Failed to fetch http://ftp.availo.se/ubuntu/dists/precise/main/binary-amd64/Packages 404 Not Found W: Failed to fetch http://ftp.availo.se/ubuntu/dists/precise/restricted/binary-amd64/Packages 404 Not Found W: Failed to fetch http://ftp.availo.se/ubuntu/dists/precise/universe/binary-amd64/Packages 404 Not Found W: Failed to fetch http://ftp.availo.se/ubuntu/dists/precise/multiverse/binary-amd64/Packages 404 Not Found W: Failed to fetch http://ftp.availo.se/ubuntu/dists/precise/main/binary-i386/Packages 404 Not Found W: Failed to fetch http://ftp.availo.se/ubuntu/dists/precise/restricted/binary-i386/Packages 404 Not Found W: Failed to fetch http://ftp.availo.se/ubuntu/dists/precise/universe/binary-i386/Packages 404 Not Found W: Failed to fetch http://ftp.availo.se/ubuntu/dists/precise/multiverse/binary-i386/Packages 404 Not Found W: Failed to fetch http://ftp.availo.se/ubuntu/dists/precise-updates/main/source/Sources 404 Not Found W: Failed to fetch http://ftp.availo.se/ubuntu/dists/precise-updates/restricted/source/Sources 404 Not Found W: Failed to fetch http://ftp.availo.se/ubuntu/dists/precise-updates/universe/source/Sources 404 Not Found W: Failed to fetch http://ftp.availo.se/ubuntu/dists/precise-updates/multiverse/source/Sources 404 Not Found W: Failed to fetch http://ftp.availo.se/ubuntu/dists/precise-updates/main/binary-amd64/Packages 404 Not Found W: Failed to fetch http://ftp.availo.se/ubuntu/dists/precise-updates/restricted/binary-amd64/Packages 404 Not Found W: Failed to fetch http://ftp.availo.se/ubuntu/dists/precise-updates/universe/binary-amd64/Packages 404 Not Found W: Failed to fetch http://ftp.availo.se/ubuntu/dists/precise-updates/multiverse/binary-amd64/Packages 404 Not Found W: Failed to fetch http://ftp.availo.se/ubuntu/dists/precise-updates/main/binary-i386/Packages 404 Not Found W: Failed to fetch http://ftp.availo.se/ubuntu/dists/precise-updates/restricted/binary-i386/Packages 404 Not Found W: Failed to fetch http://ftp.availo.se/ubuntu/dists/precise-updates/universe/binary-i386/Packages 404 Not Found W: Failed to fetch http://ftp.availo.se/ubuntu/dists/precise-updates/multiverse/binary-i386/Packages 404 Not Found W: Failed to fetch http://ftp.availo.se/ubuntu/dists/precise-backports/main/source/Sources 404 Not Found W: Failed to fetch http://ftp.availo.se/ubuntu/dists/precise-backports/restricted/source/Sources 404 Not Found W: Failed to fetch http://ftp.availo.se/ubuntu/dists/precise-backports/universe/source/Sources 404 Not Found W: Failed to fetch http://ftp.availo.se/ubuntu/dists/precise-backports/multiverse/source/Sources 404 Not Found W: Failed to fetch http://ftp.availo.se/ubuntu/dists/precise-backports/main/binary-amd64/Packages 404 Not Found W: Failed to fetch http://ftp.availo.se/ubuntu/dists/precise-backports/restricted/binary-amd64/Packages 404 Not Found W: Failed to fetch http://ftp.availo.se/ubuntu/dists/precise-backports/universe/binary-amd64/Packages 404 Not Found W: Failed to fetch http://ftp.availo.se/ubuntu/dists/precise-backports/multiverse/binary-amd64/Packages 404 Not Found W: Failed to fetch http://ftp.availo.se/ubuntu/dists/precise-backports/main/binary-i386/Packages 404 Not Found W: Failed to fetch http://ftp.availo.se/ubuntu/dists/precise-backports/restricted/binary-i386/Packages 404 Not Found W: Failed to fetch http://ftp.availo.se/ubuntu/dists/precise-backports/universe/binary-i386/Packages 404 Not Found W: Failed to fetch http://ftp.availo.se/ubuntu/dists/precise-backports/multiverse/binary-i386/Packages 404 Not Found W: Failed to fetch http://ftp.availo.se/ubuntu/dists/precise-security/main/source/Sources 404 Not Found W: Failed to fetch http://ftp.availo.se/ubuntu/dists/precise-security/restricted/source/Sources 404 Not Found W: Failed to fetch http://ftp.availo.se/ubuntu/dists/precise-security/universe/source/Sources 404 Not Found W: Failed to fetch http://ftp.availo.se/ubuntu/dists/precise-security/multiverse/source/Sources 404 Not Found W: Failed to fetch http://ftp.availo.se/ubuntu/dists/precise-security/main/binary-amd64/Packages 404 Not Found W: Failed to fetch http://ftp.availo.se/ubuntu/dists/precise-security/restricted/binary-amd64/Packages 404 Not Found W: Failed to fetch http://ftp.availo.se/ubuntu/dists/precise-security/universe/binary-amd64/Packages 404 Not Found W: Failed to fetch http://ftp.availo.se/ubuntu/dists/precise-security/multiverse/binary-amd64/Packages 404 Not Found W: Failed to fetch http://ftp.availo.se/ubuntu/dists/precise-security/main/binary-i386/Packages 404 Not Found W: Failed to fetch http://ftp.availo.se/ubuntu/dists/precise-security/restricted/binary-i386/Packages 404 Not Found W: Failed to fetch http://ftp.availo.se/ubuntu/dists/precise-security/universe/binary-i386/Packages 404 Not Found W: Failed to fetch http://ftp.availo.se/ubuntu/dists/precise-security/multiverse/binary-i386/Packages 404 Not Found E: Some index files failed to download. They have been ignored, or old ones used instead. I would appreciate a fix to this. Thank you for the help.

    Read the article

  • From Binary to Data Structures

    - by Cédric Menzi
    Table of Contents Introduction PE file format and COFF header COFF file header BaseCoffReader Byte4ByteCoffReader UnsafeCoffReader ManagedCoffReader Conclusion History This article is also available on CodeProject Introduction Sometimes, you want to parse well-formed binary data and bring it into your objects to do some dirty stuff with it. In the Windows world most data structures are stored in special binary format. Either we call a WinApi function or we want to read from special files like images, spool files, executables or may be the previously announced Outlook Personal Folders File. Most specifications for these files can be found on the MSDN Libarary: Open Specification In my example, we are going to get the COFF (Common Object File Format) file header from a PE (Portable Executable). The exact specification can be found here: PECOFF PE file format and COFF header Before we start we need to know how this file is formatted. The following figure shows an overview of the Microsoft PE executable format. Source: Microsoft Our goal is to get the PE header. As we can see, the image starts with a MS-DOS 2.0 header with is not important for us. From the documentation we can read "...After the MS DOS stub, at the file offset specified at offset 0x3c, is a 4-byte...". With this information we know our reader has to jump to location 0x3c and read the offset to the signature. The signature is always 4 bytes that ensures that the image is a PE file. The signature is: PE\0\0. To prove this we first seek to the offset 0x3c, read if the file consist the signature. So we need to declare some constants, because we do not want magic numbers.   private const int PeSignatureOffsetLocation = 0x3c; private const int PeSignatureSize = 4; private const string PeSignatureContent = "PE";   Then a method for moving the reader to the correct location to read the offset of signature. With this method we always move the underlining Stream of the BinaryReader to the start location of the PE signature.   private void SeekToPeSignature(BinaryReader br) { // seek to the offset for the PE signagure br.BaseStream.Seek(PeSignatureOffsetLocation, SeekOrigin.Begin); // read the offset int offsetToPeSig = br.ReadInt32(); // seek to the start of the PE signature br.BaseStream.Seek(offsetToPeSig, SeekOrigin.Begin); }   Now, we can check if it is a valid PE image by reading of the next 4 byte contains the content PE.   private bool IsValidPeSignature(BinaryReader br) { // read 4 bytes to get the PE signature byte[] peSigBytes = br.ReadBytes(PeSignatureSize); // convert it to a string and trim \0 at the end of the content string peContent = Encoding.Default.GetString(peSigBytes).TrimEnd('\0'); // check if PE is in the content return peContent.Equals(PeSignatureContent); }   With this basic functionality we have a good base reader class to try the different methods of parsing the COFF file header. COFF file header The COFF header has the following structure: Offset Size Field 0 2 Machine 2 2 NumberOfSections 4 4 TimeDateStamp 8 4 PointerToSymbolTable 12 4 NumberOfSymbols 16 2 SizeOfOptionalHeader 18 2 Characteristics If we translate this table to code, we get something like this:   [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)] public struct CoffHeader { public MachineType Machine; public ushort NumberOfSections; public uint TimeDateStamp; public uint PointerToSymbolTable; public uint NumberOfSymbols; public ushort SizeOfOptionalHeader; public Characteristic Characteristics; } BaseCoffReader All readers do the same thing, so we go to the patterns library in our head and see that Strategy pattern or Template method pattern is sticked out in the bookshelf. I have decided to take the template method pattern in this case, because the Parse() should handle the IO for all implementations and the concrete parsing should done in its derived classes.   public CoffHeader Parse() { using (var br = new BinaryReader(File.Open(_fileName, FileMode.Open, FileAccess.Read, FileShare.Read))) { SeekToPeSignature(br); if (!IsValidPeSignature(br)) { throw new BadImageFormatException(); } return ParseInternal(br); } } protected abstract CoffHeader ParseInternal(BinaryReader br);   First we open the BinaryReader, seek to the PE signature then we check if it contains a valid PE signature and rest is done by the derived implementations. Byte4ByteCoffReader The first solution is using the BinaryReader. It is the general way to get the data. We only need to know which order, which data-type and its size. If we read byte for byte we could comment out the first line in the CoffHeader structure, because we have control about the order of the member assignment.   protected override CoffHeader ParseInternal(BinaryReader br) { CoffHeader coff = new CoffHeader(); coff.Machine = (MachineType)br.ReadInt16(); coff.NumberOfSections = (ushort)br.ReadInt16(); coff.TimeDateStamp = br.ReadUInt32(); coff.PointerToSymbolTable = br.ReadUInt32(); coff.NumberOfSymbols = br.ReadUInt32(); coff.SizeOfOptionalHeader = (ushort)br.ReadInt16(); coff.Characteristics = (Characteristic)br.ReadInt16(); return coff; }   If the structure is as short as the COFF header here and the specification will never changed, there is probably no reason to change the strategy. But if a data-type will be changed, a new member will be added or ordering of member will be changed the maintenance costs of this method are very high. UnsafeCoffReader Another way to bring the data into this structure is using a "magically" unsafe trick. As above, we know the layout and order of the data structure. Now, we need the StructLayout attribute, because we have to ensure that the .NET Runtime allocates the structure in the same order as it is specified in the source code. We also need to enable "Allow unsafe code (/unsafe)" in the project's build properties. Then we need to add the following constructor to the CoffHeader structure.   [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)] public struct CoffHeader { public CoffHeader(byte[] data) { unsafe { fixed (byte* packet = &data[0]) { this = *(CoffHeader*)packet; } } } }   The "magic" trick is in the statement: this = *(CoffHeader*)packet;. What happens here? We have a fixed size of data somewhere in the memory and because a struct in C# is a value-type, the assignment operator = copies the whole data of the structure and not only the reference. To fill the structure with data, we need to pass the data as bytes into the CoffHeader structure. This can be achieved by reading the exact size of the structure from the PE file.   protected override CoffHeader ParseInternal(BinaryReader br) { return new CoffHeader(br.ReadBytes(Marshal.SizeOf(typeof(CoffHeader)))); }   This solution is the fastest way to parse the data and bring it into the structure, but it is unsafe and it could introduce some security and stability risks. ManagedCoffReader In this solution we are using the same approach of the structure assignment as above. But we need to replace the unsafe part in the constructor with the following managed part:   [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)] public struct CoffHeader { public CoffHeader(byte[] data) { IntPtr coffPtr = IntPtr.Zero; try { int size = Marshal.SizeOf(typeof(CoffHeader)); coffPtr = Marshal.AllocHGlobal(size); Marshal.Copy(data, 0, coffPtr, size); this = (CoffHeader)Marshal.PtrToStructure(coffPtr, typeof(CoffHeader)); } finally { Marshal.FreeHGlobal(coffPtr); } } }     Conclusion We saw that we can parse well-formed binary data to our data structures using different approaches. The first is probably the clearest way, because we know each member and its size and ordering and we have control about the reading the data for each member. But if add member or the structure is going change by some reason, we need to change the reader. The two other solutions use the approach of the structure assignment. In the unsafe implementation we need to compile the project with the /unsafe option. We increase the performance, but we get some security risks.

    Read the article

  • unstripped binary or object creating debian package

    - by Jaime
    I'm new to package creation and I'm trying to create a .deb package and keep getting 'unstripped-binary-or-object' on all my libraries and executables. I have everything setup in the directory tree where I want them to end up (and a DEBIAN folder with the control file) and then do fakeroot dpkg-deb --build ./mypackage when I lint with lintian mypackage.deb I get that error. Any ideas or suggestions? Thanks

    Read the article

  • Android Eclipse Plugin: Instrumentation Test Runner not specified.

    - by Rob Stevenson-Leggett
    I'm getting this error when trying to run unit tests from Eclipse with an Android Project. The list of Instrumentation Test Runners is empty in the Android preferences. [2009-06-17 23:57:51 - MyApp] ERROR: Application does not specify a android.test.InstrumentationTestRunner instrumentation or does not declare uses-library android.test.runner Google-fu failing me. It's also annoyingly decided that because I tried to run a unit test once, that's what I always want to do... Grr

    Read the article

  • @RunWith causes Maven to ignore my Test running with my own runner

    - by Benju
    I am moving from using only Intellij to manage my build system to Intellij/Maven. When I run my integration test "MapSimulationTest" with my own runner via @RunWith(KmlParameterizedRunner.class) Intellij correctly handles the situation, the directory specified by the system property "user.dir" is scanned for .kml files and each is tested. The problem seems to be that Surefire ignores @RunWith, any suggestions?

    Read the article

  • codepad.org Perl runner limitations

    - by Lemurik
    Sometimes I see people use http://codepad.org as a way to quickly run/test their Perl snippets (it supports doing that with a wide variety of languages, from C to Scheme to Perl). It's pretty obious that there must be some limitations as to what code/features can be tested with codepad - does anyone know what those limitations are for Perl runner? I'll get the ball rolling on my own observation: not every CPAN module is avialable :(

    Read the article

  • NUnit GUI Runner and Apartment State

    - by tyndall
    how do you set the apartment state in the NUnit GUI runner? I'm trying to run a single NUnit test with WatiN and I'm getting the message. MyNamespace.LoginTests.CanLogin: System.Threading.ThreadStateException : The CurrentThread needs to have it's ApartmentState set to ApartmentState.STA to be able to automate Internet Explorer.

    Read the article

  • TeamCity Integrated with Xcode Projects (BUILD RUNNER)

    - by alex n
    Im trying to get TeamCity to work with the github server for our xcode projects. I've got the git server working and now i'm stuck at the Build Runner Settings. i downloaded the teamcity-xcode plugin from http://github.com/orj/teamcity-xcode and moved it into the ~/.BuildServer/plugins folder. is there any kind of tutorial how to set up TeamCity for xcode projects ?

    Read the article

  • No tests found with test runner 'JUnit 4'

    - by lamisse
    Hello , my java test worked well from Eclipse ,I do not know I relaunch test from run menu and then have the following message: No tests found with test runner 'JUnit 4' In the .classpath file I have all jar files, and at the end have : <classpathentry exported="true" kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/> <classpathentry kind="output" path="bin"/> </classpath> please help!

    Read the article

  • What are codepad.org's Perl runner limitations?

    - by Lemurik
    Sometimes I see people use http://codepad.org as a way to quickly run/test their Perl snippets (it supports doing that with a wide variety of languages, from C to Scheme to Perl). It's pretty obvious that there must be some limitations as to what code/features can be tested with codepad - does anyone know what those limitations are for Perl runner? I'll get the ball rolling on my own observation: not every CPAN module is available :(

    Read the article

< Previous Page | 8 9 10 11 12 13 14 15 16 17 18 19  | Next Page >