Search Results

Search found 3592 results on 144 pages for 'pointer'.

Page 101/144 | < Previous Page | 97 98 99 100 101 102 103 104 105 106 107 108  | Next Page >

  • Simple C++ container class that is thread-safe for writing

    - by conradlee
    I am writing a multi-threaded program using OpenMP in C++. At one point my program forks into many threads, each of which need to add "jobs" to some container that keeps track of all added jobs. Each job can just be a pointer to some object. Basically, I just need the add pointers to some container from several threads at the same time. Is there a simple solution that performs well? After some googling, I found that STL containers are not thread-safe. Some stackoverflow threads address this question, but none that forms a consensus on a simple solution.

    Read the article

  • Which tool can list writing access to a specific variable in C?

    - by Lichtblitz
    Unfortunately I'm not even sure how this sort of static analysis is called. It's not really control flow analysis because I'm not looking for function calls and I don't really need data flow analysis because I don't care about the actual values. I just need a tool that lists the locations (file, function) where writing access to a specific variable takes place. I don't even care if that list contained lines that are unreachable. I could imagine that writing a simple parser could suffice for this task but I'm certain that there must be a tool out there that does this simple analysis. As a poor student I would appreciate free or better yet open source tools and if someone could tell me how this type of static analysis is actually called, I would be equally grateful! EDIT: I forgot to mention there's no pointer arithmetic in the code base.

    Read the article

  • Manipulating both unicode and ASCII character set in C#

    - by Murlex
    I have this mapping in my C# application string [,] unicode2Ascii = { { "&#3001;", "\x86" } }; ஹ - is the unicode value for a tamil literal "ஹ". This is the raw hex literal for the unicode value saved by MS Word as a byte sequence. I am trying to map these unicode value "strings" to a hex value under 255 (so as to accommodate non-unicode supported systems). I trying to use string.replace like this: S = S.replace(unicode2Ascii[0,0], unicode2Ascii[0,1]); However the resultant ouput has a ? instead of the actual hex 0x86 stored. Any pointer on how I could set the encoding for the second element of that array to something like windows-1252? Or is there a better way to do this conversion? thanks in advance

    Read the article

  • AS2: How do I swapDepth of a Shape and a TextField?

    - by Alex Jordan
    AS2 this.createTextField("lbl_txt", this.getNextHighestDepth(), 70, 5, 150, 30) lbl_txt.autoSize = true; lbl_txt.text = "Hello"; var fmt:TextFormat = new TextFormat(); fmt.bold = true; fmt.color = 0x000000; fmt.underline = true; fmt.font = "Arial"; lbl_txt.setTextFormat(fmt); Timeline Layers action button_layer (button_layer is a animation on rollOver) arrow background Desired Result button_layer and action to be topmost layers and cursor to remain a pointer and not switch to text cursor on rollOver. action button_layer arrow lbl_txt (TextField created by AS) background

    Read the article

  • How to return a copy of the data in C++

    - by Josh Curren
    I am trying to return a new copy of the data in a C++ Template class. The following code is getting this error: invalid conversion from ‘int*’ to ‘int’. If I remove the new T then I am not returning a copy of the data but a pointer to it. template<class T> T OrderedList<T>::get( int k ) { Node<T>* n = list; for( int i = 0; i < k; i++ ) { n=n->get_link(); } return new T( n->get_data() ); // This line is getting the error ********** }

    Read the article

  • c# marshaling dynamic-length string

    - by mitsky
    i have a struct with dynamic length [StructLayout(LayoutKind.Sequential, Pack = 1)] struct PktAck { public Int32 code; [MarshalAs(UnmanagedType.LPStr)] public string text; } when i'm converting bytes[] to struct by: GCHandle handle = GCHandle.Alloc(value, GCHandleType.Pinned); stru = (T)Marshal.PtrToStructure(handle.AddrOfPinnedObject(), typeof(T)); handle.Free(); i have a error, because size of struct less than size of bytes[] and "string text" is pointer to string... how can i use dynamic strings? or i can use only this: [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 32)]

    Read the article

  • c++: truth assignment warning with arguments?

    - by John
    I use the following to work with arguments in my programs, but it seems to just hand me a warning (just a warning): "warning: suggest parentheses around assignment used as truth value" The beginning of the code is as follows: enum{OPT_DISP_H = 0x2, OPT_DISP_W = 0x1}; int main(int argc, char *argv[]) { int opt = 0x00; char c; while((++argv)[0] && argv[0][0]=='-'){ while(c =* ++argv[0]) switch(c){ case 'h': opt |= OPT_DISP_H; break; //etc.. The while(c =* ++argv[0]) part being where the warning persists. The code works fine, but what does this warning mean opposed to what is used? I think the code is c = *++argv[0], using the pointer. So why does the single = work and what is really recommended to be used?

    Read the article

  • Official definition of CSCI (Computer Software Configuration Item)

    - by Andreas_D
    I'm looking for the most official definition of CSCI / Configuration Item - not just what it is but what we have to deliver / can expect when a contract defines subsystems which shall be developed as configuration items. I spend some time with my famous search tool and found a lot of explanations for CSCI (wikipedia, acronym directories, ...) but I haven't found a standard or a pointer to a standard (like ISO-xxx) yet which tells (1) what it is and (2) what has to be done from a QM/CM point of view. I just ask, because a contractors QM representative stated during an acceptance test, that CI only requires to not forget the CI in the configuration plan and to assign a serial number ... I expected to see some SRS, SDD, ICD, SVD, SIP, ... documents and acceptance test documentation for those subsystems...

    Read the article

  • HTML5 placing image where i want it on screen

    - by corrigan_sam
    I have a little start screen running and i want the image, which is acting as a button, to placed at a certain point, but when i try to it stays in the same place, and i don't know how i can get it to stay in the place i want it. Here is my code, its is HTML with some css: <style> #SplashScreen{ position:relative; overflow:hidden; } #StartButton { cursor:pointer; position:absoloute; left:100px; top:100px; } </style> <div id="SplashScreen" width="400" height="400"> <h1>Game Title</h1> <img id="StartButton" src="play.png"/> </div> The image just draws underneath the title and not where i want it. Any help?

    Read the article

  • std::out_of_range error?

    - by vette982
    I'm dealing with a file with a linked list of lines with each node looking like this: struct TextLine{ //The actual text string text; //The line number of the document int line_num; //A pointer to the next line TextLine * next; }; and I'm writing a function that adds spaces at the beginning of the lines found in the variable text, by calling functions like linelist_ptr->text.insert(0,1,'\t'); The program compiles, but when I run it I get this error: terminate called after throwing an instance of 'std::out_of_range' what(): basic_string::at Aborted Any ideas?

    Read the article

  • I serialized a C++ object, how to allocate memory for it without knowing what type it is?

    - by Neo_b
    Hello, I have serialized a C++ object and I wish to allocate space for it, although I can't use the "new" operator, because I do not know the object's class. I tried using malloc(sizeof(object)), although trying to typecast the pointer to the type the serialized object is of, the program shut down. Where is the information about the object class stored? class object { public: virtual void somefunc(); int someint; }; class objectchild:public object { } object *o=(object*)malloc(sizeof(objectchild)); cout << int(dynamic_cast<objectchild*>(o)) << endl; This causes a program shutdown. Thank you in advance.

    Read the article

  • C++ inheritance question

    - by user233973
    Hi guys, I have a C++ inheritance related question. I have a set of classes like this (I have not given the complete class structure coz I am lazy :) ). I want to access chiComponent class public methods using com pointer. How should I go about it? Note that I am having to change the object which "com" is pointing to in a lot of places. So I do not think I can have another chiComponent *ccom = <some_cast> com; ccom.chiComponentMethod() How should I go about it? class Component{ }; class chiComponent : public Component { public: void chiComponentMethod() { cout << "Hi! Chi component function called!!"; } } class parent { protected: Component *com; }; class child : public parent{ public: child() { com = new chiComponent(); } } Regards Arun

    Read the article

  • Fast comparison of char arrays?

    - by StackedCrooked
    I'm currently working in a codebase where IPv4 addresses are represented as pointers to u_int8. The equality operator is implemented like this: bool Ipv4Address::operator==(const u_int8 * inAddress) const { return (*(u_int32*) this->myBytes == *(u_int32*) inAddress); } This is probably the fasted solution, but it causes the GCC compiler warning: ipv4address.cpp:65: warning: dereferencing type-punned pointer will break strict-aliasing rules How can I rewrite the comparison correctly without breaking strict-aliasing rules and without losing performance points? I have considered using either memcmp or this macro: #define IS_EQUAL(a, b) \ (a[0] == b[0] && a[1] == b[1] && a[2] == b[2] && a[3] == b[3]) I'm thinking that the macro is the fastest solution. What do you recommend?

    Read the article

  • What exactly does a self-describing type in .Net mean?

    - by tzup
    Given this MSDN article, we learn that the Common Type System in .Net has this classification of reference types: "Reference types can be self-describing types, pointer types, or interface types. The type of a reference type can be determined from values of self-describing types. Self-describing types are further split into arrays and class types." So an array, for instance, is a self-describing type because we can determine it's type from its values? How? Is that it, or is there more to this definition?

    Read the article

  • How to create a Mutex with security attribute to share resource from different application?

    - by Antony Tess
    How to create a Mutex with security attribute rigth to share resource from different application? In according with Microsoft SDK documentation the CreateMutex API accept as first parameter a SECURITY_ATTRIBUTES pointer. HANDLE WINAPI CreateMutex( __in LPSECURITY_ATTRIBUTES lpMutexAttributes, __in BOOL bInitialOwner, __in LPCTSTR lpName ); I want to create the rigth security attribute so only my application group can open the MUTEX and access to a specific resource (a file) where my application gruop read/write data operation. The target opertaing system are XP, Vista and Seven. The feature must working in both, administrator/standard user, login shenario.

    Read the article

  • Expected symbol problems with this function declaration

    - by Derek
    I am just getting back into the C programming realm and I am having an issue that I think is linker related. I am using cmake for the first time as well, so that could be adding to my frustration. I have included a third party header file that contains a typedef that my code is trying to use, and it has this line: typedef struct a a_t so my code has a_t *var; //later..... var->member;// this line throws the error which throws the error: dereferencing pointer to incomplete type So am I just missing another include file, or is this a linker issue? I am building this code in QtCreator and using cmake. I can dive on a_t to see that typedef declaration in the included header, but I can't seem to dive on "struct a" itself to see where it's coming from. Thanks

    Read the article

  • MySQL: host name universal change.

    - by ctrlShiftBryan
    I am making some updates to a php site which I did not design. I have a local copy of the site. At the top of each page there are settings for the host name for the db connection. Is there someway I can setup a pointer to the remote address. The address is 'mysqlhost' for example and I want that to point to 'mysql.myhost.com'. I tried creating a HOST record for mysqlhost pointing to the IP address it resolves to but that doesn't work. If I put 'mysql.myhost.com' in the connection it works. If I put that IP address it doesn't so that is probably why the HOST record idea doesn't work. Other than creating a local copy of the DB is there a quick way so that I don't have to modify each file in my dev environment and then again when I redeploy?

    Read the article

  • Multiple selection in a TreeView

    - by Frederick
    I am using a Windows Forms TreeView control in my program. I would like to allow the user to select multiple nodes at the same level by dragging their mouse pointer around (also called a "lasso" selection). I don't think a standard TreeView allows that. My question is what would be the best way to achieve this? Do I have to write custom selection behaviour of my own in perhaps a custom or derived control? Where do I start? I don't need a detailed explanation. Just a small nudge in the right direction.

    Read the article

  • Does the Internet make us less good programmers? [closed]

    - by stagas
    With all the information and code available nowadays on the Internet has that diminished our capability of remembering or learning stuff just because we know they're available somewhere out there, just a Google away or a StackOverflow question away? For example I find myself visiting php.net quite often to check the syntax of the same functions over and over again, not because my memory sucks, but I don't feel like keeping the information in me, since I know I'll find it again on the net. And about StackOverflow, isn't the process of figuring things out on your own supposed to improve your programming skills? If the answers are all just clicks away, do we actually learn something or just keep a pointer in our heads where to search for it again when we need it? Your thoughts are welcome. Hope it doesn't shut down as subjective or anything, the answers would be really interesting ;)

    Read the article

  • C++ volatile required when spinning on boost::shared_ptr operator bool()?

    - by JaredC
    I have two threads referencing the same boost::shared_ptr: boost::shared_ptr<Widget> shared; On thread is spinning, waiting for the other thread to reset the boost::shared_ptr: while(shared) boost::thread::yield(); And at some point the other thread will call: shared.reset(); My question is whether or not I need to declare the shared pointer as volatile to prevent the compiler from optimizing the call to shared.operator bool() out of the loop and never detecting the change? I know that if I were simply looping on a variable, waiting for it to reach 0 I would need volatile, but I'm not sure if boost::shared_ptr is implemented in such a way that it is not necessary here.

    Read the article

  • Deferred printing in Java

    - by Bober02
    I have a specific issue with general console printing and I was wondering whether anyone has a solution for it. I am trying to print a dataTable which would look like sth like this: Table ---------------------- Name |Surname | ---------------------- Mike |Mikhailowish| Rafaello|Mirena | and so on. In order to print the border of the bar I need to know what the maximum length of each column value is. I don't want to go through the whole database to find that out and then again to print it. I would rather like to do sth like: System.out.printLater(s); //herejust leave a pointer to a StringBuilder you will build ... s.append("--------"); ... System.out.printAllDeferred(); I understand the above is probably in 99.99999% chances impossible, but perhaps you guys have a clever way of achieving the above?

    Read the article

  • CSS Position Help (horizontal sidebar showing up when animate content over)

    - by jstacks
    Let me try my best to explain what I'd like to have happen, show you the code I have an hopefully I can get some help. So, I'm trying to do a sliding navigation UI from the left side of the screen (like a lot of mobile apps). The main content slides over, displaying the navigation menu beneath. Right now the browser thinks the screen is getting wider and introduces a horizontal scroll bar. However, I don't want that to happen... How do I get the div to animate off screen but not enlarge the width of the screen (i.e. keep it partially off screen)? Anyway here is my fiddle: http://jsfiddle.net/2vP67/6/ And here is the code within the post: HTML <div id='wrapper'> <div id='navWide'> </div> <div id='containerWide'> </div> <div id='containerTall'> <div id='container'> <div id='nav'> <div id='navNavigate'> Open Menu </div> <div id='navNavigateHide'> Close Menu </div> </div> </div> </div> <div id='sideContainerTall'> <div id='sideContainer'> <div id='sideNav'>Side Navigation </div> </div> </div> </div> CSS #wrapper { width:100%; min-width:1000px; height:100%; min-height:100%; position:relative; top:0; left:0; z-index:0; } #navWide { color: #ffffff; background:#222222; width:100%; min-width:1000px; height:45px; position:fixed; top:0; left:0; z-index:100; } #containerWide { width:100%; min-width:1000px; min-height:100%; position:absolute; top:45px; z-index:100; } #containerTall { color: #000000; background:#dadada; width:960px; min-height:100%; margin-left:-480px; position:absolute; top:0; left:50%; z-index:1000; } /***** main container *****/ #container { width:960px; min-height:585px; } #nav { color: #ffffff; background:#222222; width:960px; height:45px; position:fixed; top:0; z-index:10000; } #navNavigate { background:yellow; font-size:10px; color:#888888; width:32px; height:32px; padding:7px 6px 6px 6px; float:left; cursor:pointer; } #navNavigateHide { background:yellow; font-size:10px; color:#888888; width:32px; height:32px; padding:7px 6px 6px 6px; float:left; cursor:pointer; display:none; } #sideContainerTall { background:#888888; width:264px; min-height:100%; margin-left:-480px; position:absolute; top:0; left:50%; z-index:500; } #sideContainer { width:264px; min-height:585px; display:none; } #sideContainerTall { background:#888888; width:264px; min-height:100%; margin-left:-480px; position:absolute; top:0; left:50%; z-index:500; } #sideContainer { width:264px; min-height:585px; display:none; } #sideNav { width:264px; height:648px; float:left; } Javascript $(document).ready(function() { $('div#navNavigate').click(function() { $('div#navNavigate').hide(); $('div#navNavigateHide').show(); $('div#sideContainer').show(); $('div#containerTall').animate({ 'left': '+=264px' }); }); $('div#navNavigateHide').click(function() { $('div#navNavigate').show(); $('div#navNavigateHide').hide(); $('div#containerTall').animate({ 'left': '-=264px' }, function() { $('div#sideContainer').hide(); }); }); });

    Read the article

  • collect string in loop and printout all the string outside loop

    - by user1508163
    I'm newbie here and there is some question that I want have some lesson from you guys. For example: #include <stdio.h> #include<stdlib.h> #include<ctype.h> void main() { char name[51],selection; do { printf("Enter name: "); fflush(stdin); gets(name); printf("Enter another name?(Y/N)"); scanf("%c",&selection); selection=toupper(selection); }while (selection=='Y'); //I want to printout the entered name here but dunno the coding printf("END\n"); system("pause"); } As I know when the loops perform will overwrite the variable then how I perform a coding that will printout all the name user entered? I have already ask my tutor and he is ask me to use pointer, can anyone guide me in this case?

    Read the article

  • Rails 3 namespacing requires model to be defined twice?

    - by RSG
    I'm pulling my hair out trying to understand namespacing in Rails 3. I've tried following a few different tutorials, and the only way I can get my models to work is if I define my model in both the base directory and my namespace directory. If I only define the model in the namespace directory it expects it to define both Model and Namespace::Model, as below: LoadError (Expected .../app/models/plugins/chat.rb to define Chat): or LoadError (Expected .../app/models/plugins/chat.rb to define Plugins::Chat): I'm sure I'm missing something obvious, but I could really use a pointer in the right direction. Here are the relevant excerpts. /models/plugins/chat.rb class Plugins::Chat include ActiveModel::Validations include ActiveModel::Conversion extend ActiveModel::Naming ... end /controllers/plugins/chats_controller.rb class Plugins::ChatsController < Plugins::ApplicationController load_and_authorize_resource ... end /config/routes.rb namespace :plugins do resources :chats end /config/application.rb config.autoload_paths += Dir["#{config.root}/app/models/**/"]

    Read the article

  • How to get "printer ready bytes" from a source in c#?

    - by luis_villase
    Hey everyone! I'm in a bit of trouble here, hoping you can help a fellow programmer out. I have an application that receives a pointer to raw bytes (plus length and stuff) and sends said raw data to a printer. This is important, I have no choice but to use this method to get any printing done. If I send a raw string, it will print with no problem. However, I need to be able to print formatted text, images, etc. So the thing is... I would like to be able to get printer ready bytes from a given source (maybe a pdf, or html, does not matter as long as it contains formatted text and/or images). It would be like "splitting" the print command like so: a) Open file and read data b) Load printer data into memory c) Send bytes to printer Obviously, I've got a) and c) covered, it's b) the one that's breaking my head. Any thoughts? Thanks in advance for your help.

    Read the article

< Previous Page | 97 98 99 100 101 102 103 104 105 106 107 108  | Next Page >