Search Results

Search found 710 results on 29 pages for 'containers'.

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

  • C++ STL question related to insert iterators and overloaded operators

    - by rshepherd
    #include <list> #include <set> #include <iterator> #include <algorithm> using namespace std; class MyContainer { public: string value; MyContainer& operator=(const string& s) { this->value = s; return *this; } }; int main() { list<string> strings; strings.push_back("0"); strings.push_back("1"); strings.push_back("2"); set<MyContainer> containers; copy(strings.begin(), strings.end(), inserter(containers, containers.end())); } The preceeding code does not compile. In standard C++ fashion the error output is verbose and difficult to understand. The key part seems to be this... /usr/include/c++/4.4/bits/stl_algobase.h:313: error: no match for ‘operator=’ in ‘__result.std::insert_iterator::operator* [with _Container = std::set, std::allocator ]() = __first.std::_List_iterator::operator* [with _Tp = std::basic_string, std::allocator ]()’ ...which I interpet to mean that the assignment operator needed is not defined. I took a look at the source code for insert_iterator and noted that it has overloaded the assignment operator. The copy algorithm must uses the insert iterators overloaded assignment operator to do its work(?). I guess that because my input iterator is on a container of strings and my output iterator is on a container of MyContainers that the overloaded insert_iterator assignment operator can no longer work. This is my best guess, but I am probably wrong. So, why exactly does this not work and how can I accomplish what I am trying to do?

    Read the article

  • C++ STL question related to insert iterators and sets

    - by rshepherd
    #include #include #include #include using namespace std; class MyContainer { public: string value; MyContainer& operator=(const string& s) { this->value = s; return *this; } }; int main() { list<string> strings; strings.push_back("0"); strings.push_back("1"); strings.push_back("2"); set<MyContainer> containers; copy(strings.begin(), strings.end(), inserter(containers, containers.end())); } The preceeding code does not compile. In typical STL style the error output is verbose and difficult to understand. The key part seems to be this... /usr/include/c++/4.4/bits/stl_algobase.h:313: error: no match for ‘operator=’ in ‘__result.std::insert_iterator::operator* [with _Container = std::set, std::allocator ]() = __first.std::_List_iterator::operator* [with _Tp = std::basic_string, std::allocator ]()’ ...which I interpet to mean that the assignment operator needed is not defined. I took a look at the source code for insert_iterator and noted that it has overloaded the assignment operator. The copy algorithm must uses the insert iterators overloaded assignment operator to do its work(?). I guess that because my input iterator is on a container of strings and my output iterator is on a container of MyContainers that the overloaded insert_iterator assignment operator can no longer work. This is my best guess, but I am probably wrong. So, why exactly does this not work and how can I accomplish what I am trying to do?

    Read the article

  • Gateway on a virtual network interface used by LXC guests

    - by linkdd
    I'm currently having some problems with configuring a gateway for a virtual network interface. Here is what I've done : I created a virtual network interface : # brctl addbr lxc0 # brctl setfd lxc0 0 # ifconfig lxc0 192.168.0.1 promisc up # route add -net default gw 192.168.0.1 lxc0 The output of ifconfig gave me what I wanted : lxc0 Link encap:Ethernet HWaddr 22:4f:e4:40:89:bb inet adr:192.168.0.1 Bcast:192.168.0.255 Masque:255.255.255.0 adr inet6: fe80::88cf:d4ff:fe47:3b6b/64 Scope:Lien UP BROADCAST RUNNING PROMISC MULTICAST MTU:1500 Metric:1 RX packets:623 errors:0 dropped:0 overruns:0 frame:0 TX packets:7412 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 lg file transmission:0 RX bytes:50329 (49.1 KiB) TX bytes:335738 (327.8 KiB) I configured dnsmasq to provide a DNS server (using the default : 192.168.1.1) and a DHCP server. Then, my LXC guest is configured like this : lxc.network.type=veth lxc.network.link=lxc0 lxc.network.flags=up Every thing is working perfectly, my containers have an IP (192.168.0.57 and 192.168.0.98). I can ping the host and the containers from the containers and from the host : (host)# ping -c 3 192.168.0.114 PING 192.168.0.114 (192.168.0.114) 56(84) bytes of data. 64 bytes from 192.168.0.114: icmp_req=1 ttl=64 time=0.044 ms 64 bytes from 192.168.0.114: icmp_req=2 ttl=64 time=0.038 ms 64 bytes from 192.168.0.114: icmp_req=3 ttl=64 time=0.043 ms --- 192.168.0.114 ping statistics --- 3 packets transmitted, 3 received, 0% packet loss, time 1998ms rtt min/avg/max/mdev = 0.038/0.041/0.044/0.007 ms (guest)# ping -c 3 192.168.0.1 PING 192.168.0.1 (192.168.0.1) 56(84) bytes of data. 64 bytes from 192.168.0.1: icmp_req=1 ttl=64 time=0.048 ms 64 bytes from 192.168.0.1: icmp_req=2 ttl=64 time=0.042 ms 64 bytes from 192.168.0.1: icmp_req=3 ttl=64 time=0.042 ms --- 192.168.0.1 ping statistics --- 3 packets transmitted, 3 received, 0% packet loss, time 1999ms rtt min/avg/max/mdev = 0.042/0.044/0.048/0.003 ms Now, it's time to configure the host as a gateway for the network 192.168.0.0/24 : #!/bin/sh # Clear rules iptables -F iptables -t nat -F iptables -t mangle -F iptables -X iptables -A FORWARD -i lxc0 -o eth0 -j ACCEPT iptables -A FORWARD -i eth0 -o lxc0 -m state --state ESTABLISHED,RELATED -j ACCEPT iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE echo 1 > /proc/sys/net/ipv4/ip_forward The final test failed completely, ping the outside : (guest)# ping -c 3 google.fr PING google.fr (173.194.67.94) 56(84) bytes of data. From 192.168.0.1: icmp_seq=3 Redirect Host(New nexthop: wi-in-f94.1e100.net (173.194.67.94)) From 192.168.0.1 icmp_seq=1 Destination Host Unreachable From 192.168.0.1 icmp_seq=2 Destination Host Unreachable From 192.168.0.1 icmp_seq=3 Destination Host Unreachable --- google.fr ping statistics --- 3 packets transmitted, 0 received, +3 errors, 100% packet loss, time 2017ms Did I missed something ?

    Read the article

  • How to change from own Internal/Extrernal DNS to use an outsourced service like DNS Made Easy?

    - by Joakim
    Our current setup is a co-located linux box with an openvz kernel with a handful virtual containers for www, mail etc. and one container run Bind9 with a split views configuration serving External and Internal DNS. The HW-Node runs a shorewall firewall and all containers uses private ip's. The box (and DNS) basically handles web and mail for a handful domains and it works well but we still think it would be a good idea to outsource the public DNS and now to my question... Although I am fairly comfortable with the server stuff and DNS, I'm far from a pro and guess I basically need some confirmation that I am thinking in the right direction in that I basically just move the content of our external view (with zone files) to the external service and keep the internal view (or actually remove the view), update the new external DNS with thier names servers, update the info at my registrar and wait for propagation or have I missed something? Maybe someone else here run something similar already and can share some exteriences? I found this question which at least confirms it can be done.

    Read the article

  • null pointers vs. Null Object Pattern

    - by GlenH7
    Attribution: This grew out of a related P.SE question My background is in C / C++, but I have worked a fair amount in Java and am currently coding C#. Because of my C background, checking passed and returned pointers is second-hand, but I acknowledge it biases my point of view. I recently saw mention of the Null Object Pattern where the idea is than an object is always returned. Normal case returns the expected, populated object and the error case returns empty object instead of a null pointer. The premise being that the calling function will always have some sort of object to access and therefore avoid null access memory violations. So what are the pros / cons of a null check versus using the Null Object Pattern? I can see cleaner calling code with the NOP, but I can also see where it would create hidden failures that don't otherwise get raised. I would rather have my application fail hard (aka an exception) while I'm developing it than have a silent mistake escape into the wild. Can't the Null Object Pattern have similar problems as not performing a null check? Many of the objects I have worked with hold objects or containers of their own. It seems like I would have to have a special case to guarantee all of the main object's containers had empty objects of their own. Seems like this could get ugly with multiple layers of nesting.

    Read the article

  • Creating packages in code - Workflow

    This is just a quick one prompted by a question on the SSIS Forum, how to programmatically add a precedence constraint (aka workflow) between two tasks. To keep the code simple I’ve actually used two Sequence containers which are often used as anchor points for a constraint. Very often this is when you have task that you wish to conditionally execute based on an expression. If it the first or only task in the package you need somewhere to anchor the constraint too, so you can then set the expression on it and control the flow of execution. Anyway, back to my code sample, here’s a quick screenshot of the finished article: Now for the code, which is actually pretty simple and hopefully the comments should explain exactly what is going on. Package package = new Package(); package.Name = "SequenceWorkflow"; // Add the two sequence containers to provide anchor points for the constraint // If you use tasks, it follows exactly the same pattern, they all derive from Executable Sequence sequence1 = package.Executables.Add("STOCK:Sequence") as Sequence; sequence1.Name = "SEQ Start"; Sequence sequence2 = package.Executables.Add("STOCK:Sequence") as Sequence; sequence2.Name = "SEQ End"; // Add the precedence constraint, here we use the package's constraint collection // as it hosts the two objects we want to constrain (link) // The default constraint is a basic On Success constraint just like in the designer PrecedenceConstraint constraint = package.PrecedenceConstraints.Add(sequence1, sequence2); // Change the settings to use a (dummy) expression only constraint.EvalOp = DTSPrecedenceEvalOp.Expression; constraint.Expression = "1 == 1";   The complete code file is available to download below. SequenceWorkflow.cs

    Read the article

  • From The OU Classrooms...

    - by rajeshr
    No excuses for not doing this systematically, and I'm trying my best to break this bad habit of bulk uploads of class photographs and do it regularly instead. But for the time being, please forgive my laziness and live by my mass introduction of all fun loving, yet talented folks whom I met in the OU classrooms during the last three months or so through these picture essay that follow. It's unfortunate, I don't get to do this for my Live Virtual Classes for obvious reason,but let me take a moment to thank them all as well for choosing OU programs on various products. Thanks again to each one for memorable moments in the OU classrooms: Pillar Axiom MaxRep session at Bangkok. For detailed information on the OU course on Pillar Axiom Max Rep, access this page. Pillar Axiom SAN Administration Session at Bangkok. Know more about the product here. Details on the Pillar Axiom training program from Oracle University can be found here. Oracle Solaris ZFS Administration & Oracle Solaris Containers session at Hyderabad. Read more about ZFS here. Gain information on Solaris Containers by going here. Oracle University courses on Solaris 10 and its features can be viewed at this page. Oracle Solaris Cluster program at Hyderabad. Here's the OU landing page for the training programs on Oracle Solaris Cluster. Oracle Solaris 11 Administration Session at Bangalore. If you are interested to get trained on Solaris 11, get more details at this webpage. Sun Identity Manager Deployment Fundamentals session at Bangalore. The product is n.k.a Oracle Waveset IDM. Click here to get detailed description on this fabulous hands on training program. With Don Kawahigashi at Taipei for Pillar Axiom Storage training.

    Read the article

  • syslog-ng fails to log on lxc host

    - by christian
    we are running CentOS 6 servers with multiple lxc-containers. For system logging we are using syslog-ng. After a while the syslog-ng daemon stops logging messages, but the daemon keeps running. This happens on the host and inside the containers (where another syslog-ng is running) as well. We could not find any patterns for the failure yet but we assume that it has something to do with lxc, because we don't have these problems on other hosts. We have the suspicion that these problems occur when more than on lxc-container is running and that only "new" processes can not log. We are running the following software versions: CentOS-Linux 6.4/6.5 lxc-0.7.5 syslog-ng-3.2.5 Do you have any ideas? Best regards trademesh

    Read the article

  • Virtual environment firewall with CSF + iptables rules on VM?

    - by luison
    We are getting into virtualization with a Proxmox VE (OpenVZ + KVM) server. Our plan for firewall is to have CSF (http://configserver.com/cp/csf.html) running on the host machine as we've had a reasonable good experience with it in the past. Apart from that we plan simple firewall rules on the VM machines (mostly OpenVZ containers with same kernel) and maybe fail2ban simple specific rules. I would appreciate comments with anyone with similar experiences? I understand all traffic comes via the host machine so a combined firewall there with specific firewalling on the VM should work, alltough some iptables rules are hard to get to work on OpenVZ containers.

    Read the article

  • Feature Updates to the Windows Azure Portal

    - by Clint Edmonson
    Lots of activity over at the Windows Azure portal this weekend, including some exciting new features and major improvements to existing features. Here are the highlights: Support for Managing Co-administrators Set up account co-administrators to allow others to share service management duties for each Azure subscription Import/Export support for SQL Databases Export existing SQL Azure databases to blob storage using SQL Server 2012’s BACPAC format. Create a new SQL Azure database from an existing BACPAC stored in blob storage Storage Container Management and Access Control Create blob storage containers directly within the portal Edit their public/private access settings Drill into storage containers and see the blobs contained within them Improved Cloud Service Status Notifications Detailed health status information about cloud services and roles as they transition between states Virtual Machine Experience Enhancements Option to automatically delete corresponding VHD files from blob storage when deleting VM disks Service Bus Management and Monitoring Ability to create and manage service bus Namespaces, Queues, Topics, Relays and Subscriptions Rich monitoring of Topics, Queues, and Subscriptions with detailed and customizable dashboard metrics Entity status (Topic, Queue, or Subscription) can be changed interactively via dashboard Direct links to the Access Control Services (ACS) namespaces when working with service bus access keys Media Services Monitoring Support Monitor encoding jobs that are queued for processing as well as active, failed and queued tasks for encoding jobs The above features are all now live in production and available to use immediately.  If you don’t already have a Windows Azure account, you can sign-up for a free trial and start using them today. Stay tuned to my twitter feed for Windows Azure announcements, updates, and links: @clinted Reference ID: P7VVJCM38V8R

    Read the article

  • eSTEP Newsletter November 2011 now available

    - by uwes
    Dear Partners,We would like to inform you that the November issue of our Newsletter is now available.The issue contains informations to the following topics:Notes from Corporate: Magic Quadrant for Enterprise Application Servers, Oracle Buys RightNow Technical Corner: Oracle Solaris 11 – The First Cloud OS, Oracle Solaris 10 8/11 now available, New RAC/Containers certifications, DTrace and Container for Oracle Linux, Oracle Enterprise Manager Ops Center released, News from the Oracle Solaris Cluster, SPARC - New roadmap, T-Series Benchmarks Learning & Events: eSTEP Events Schedule, Recently Delivered TechCasts, Delivered Campaigns in 2011 How to ...: About Oracle Solaris Containers, Detailed feature comparison between the different versions of database 11g, Upgrade Advantage Program + table with examples, Sun Software Name ===> New Oracle Name, Oracle Linux and OVM Certification Search, TO YOUR ATTENTION - Repricing Servers and Xoptions You find the Newsletter on our portal under eSTEP News ---> Latest Newsletter. You will need to provide your email address and the pin below to get access. Link to the portal is shown below.URL: http://launch.oracle.com/PIN: eSTEP_2011Previous published Newsletters can be found under the Archived Newsletters section and more useful information under the Events, Download and Links tab. Feel free to explore and any feedback is appreciated to help us improve the service and information we deliver.Thanks and best regards,Partner HW Enablement EMEA

    Read the article

  • Did C++11 address concerns passing std lib objects between dynamic/shared library boundaries? (ie dlls and so)?

    - by Doug T.
    One of my major complaints about C++ is how hard in practice it is to pass std library objects outside of dynamic library (ie dll/so) boundaries. The std library is often header-only. Which is great for doing some awesome optimizations. However, for dll's, they are often built with different compiler settings that may impact the internal structure/code of a std library containers. For example, in MSVC one dll may build with iterator debugging on while another builds with it off. These two dlls may run into issues passing std containers around. If I expose std::string in my interface, I can't guarantee the code the client is using for std::string is an exact match of my library's std::string. This leads to hard to debug problems, headaches, etc. You either rigidly control the compiler settings in your organization to prevent these issues or you use a simpler C interface that won't have these problems. Or specify to your clients the expected compiler settings they should use (which sucks if another library specifies other compiler settings). My question is whether or not C++11 tried to do anything to solve these issues?

    Read the article

  • Loading a PyML multiclass classifier... why isn't this working?

    - by Michael Aaron Safyan
    This is a followup from "Save PyML.classifiers.multi.OneAgainstRest(SVM()) object?". I am using PyML for a computer vision project (pyimgattr), and have been having trouble storing/loading a multiclass classifier. When attempting to load one of the SVMs in a composite classifier, with loadSVM, I am getting: ValueError: invalid literal for float(): rest Note that this does not happen with the first classifier that I load, only with the second. What is causing this error, and what can I do to get around this so that I can properly load the classifier? Details To better understand the trouble I'm running into, you may want to look at pyimgattr.py (currently revision 11). I am invoking the program with "./pyimgattr.py train" which trains the classifier (invokes train on line 571, which trains the classifier with trainmulticlassclassifier on line 490 and saves it with storemulticlassclassifier on line 529), and then invoking the program with "./pyimgattr.py test" which loads the classifier in order to test it with the testing dataset (invokes test on line 628, which invokes loadmulticlassclassifier on line 549). The multiclass classifier consists of several one-against-rest SVMs which are saved individually. The loadmulticlassclassifier function loads these individually by calling loadSVM() on several different files. It is in this call to loadSVM (done indirectly in loadclassifier on line 517) that I get an error. The first of the one-against-rest classifiers loads successfully, but the second one does not. A transcript is as follows: $ ./pyimgattr.py test [INFO] pyimgattr -- Loading attributes from "classifiers/attributes.lst"... [INFO] pyimgattr -- Loading classnames from "classifiers/classnames.lst"... [INFO] pyimgattr -- Loading dataset "attribute_data/apascal_test.txt"... [INFO] pyimgattr -- Loaded dataset "attribute_data/apascal_test.txt". [INFO] pyimgattr -- Loading multiclass classifier from "classifiers/classnames_from_attributes"... [INFO] pyimgattr -- Constructing object into which to store loaded data... [INFO] pyimgattr -- Loading manifest data... [INFO] pyimgattr -- Loading classifier from "classifiers/classnames_from_attributes/aeroplane.svm".... scanned 100 patterns scanned 200 patterns read 100 patterns read 200 patterns {'50': 38, '60': 45, '61': 46, '62': 47, '49': 37, '52': 39, '53': 40, '24': 16, '25': 17, '26': 18, '27': 19, '20': 12, '21': 13, '22': 14, '23': 15, '46': 34, '47': 35, '28': 20, '29': 21, '40': 32, '41': 33, '1': 1, '0': 0, '3': 3, '2': 2, '5': 5, '4': 4, '7': 7, '6': 6, '8': 8, '58': 44, '39': 31, '38': 30, '15': 9, '48': 36, '16': 10, '19': 11, '32': 24, '31': 23, '30': 22, '37': 29, '36': 28, '35': 27, '34': 26, '33': 25, '55': 42, '54': 41, '57': 43} read 250 patterns in LinearSparseSVModel done LinearSparseSVModel constructed model [INFO] pyimgattr -- Loaded classifier from "classifiers/classnames_from_attributes/aeroplane.svm". [INFO] pyimgattr -- Loading classifier from "classifiers/classnames_from_attributes/bicycle.svm".... label at None delimiter , Traceback (most recent call last): File "./pyimgattr.py", line 797, in sys.exit(main(sys.argv)); File "./pyimgattr.py", line 782, in main return test(attributes_file,classnames_file,testing_annotations_file,testing_dataset_path,classifiers_path,logger); File "./pyimgattr.py", line 635, in test multiclass_classnames_from_attributes_classifier = loadmulticlassclassifier(classnames_from_attributes_folder,logger); File "./pyimgattr.py", line 529, in loadmulticlassclassifier classifiers.append(loadclassifier(os.path.join(filename,label+".svm"),logger)); File "./pyimgattr.py", line 502, in loadclassifier result=loadSVM(filename,datasetClass = SparseDataSet); File "/Library/Python/2.6/site-packages/PyML/classifiers/svm.py", line 328, in loadSVM data = datasetClass(fileName, **args) File "/Library/Python/2.6/site-packages/PyML/containers/vectorDatasets.py", line 224, in __init__ BaseVectorDataSet.__init__(self, arg, **args) File "/Library/Python/2.6/site-packages/PyML/containers/baseDatasets.py", line 214, in __init__ self.constructFromFile(arg, **args) File "/Library/Python/2.6/site-packages/PyML/containers/baseDatasets.py", line 243, in constructFromFile for x in parser : File "/Library/Python/2.6/site-packages/PyML/containers/parsers.py", line 426, in next x = [float(token) for token in tokens[self._first:self._last]] ValueError: invalid literal for float(): rest

    Read the article

  • How can I have different colors for different tabs in SuperTabNavigator.

    - by Zeeshan Rang
    Hi Well the heading is basically what my question is: How can I have different colors for different tabs in SuperTabNavigator. Below is the code to my SuperTabNavigator with three tabs: <containers:SuperTabNavigator x="0" y="10" width="100%" height="100%" right="1" top="1" left="1" bottom="1" color="black" creationPolicy="all" id="tab_nav" popUpButtonPolicy="{SuperTabNavigator.POPUPPOLICY_OFF}"> <mx:Canvas label="My Friends" id="friends_container" width="100%" height="100%"/> <mx:Canvas label="My Groups" id="groups_container" width="100%" height="100%"/> <mx:Canvas label="Address Book" id="address_container" width="100%" height="100%"/> </containers:SuperTabNavigator> I want to have different color for every different tab. How should I do this. Thank you Zeeshan

    Read the article

  • Integrate flex 3.5 projects in flash builder 4 beta 2

    - by Cyrill Zadra
    Hi I'm currently using Flex Builder 3 and Flex SDK 3.5 for my projects. But I'd like to try out the new Flash Builder 4. So I downloaded and installed the new software, configured all the additional software like subversion, server adapter .. and finally a importet my 2 projects. 1) Main Project (includes a swc generated by the Library Project) (flex sdk 3.5) 2) Library Project (flex sdk 3.4) After the import and project cleanup the project is running perfectly. But as soon as I replace the existing LibraryProject.swc through a new one (compiled with flash builder 4 beta 2 sdk 3.4) VerifyError: Error #1014: class mx.containers::Canvas not found. VerifyError: Error #1014: class mx.containers::HBox not found. VerifyError: Error #1014: class IWatcherSetupUtil not found. ... and several others not found errors. Does anyone has the same error. How can I get my project running again? thanks & regards cyrill

    Read the article

  • Quartz in Webapplication

    - by JKV
    I have a question in scheduling jobs in web application. If we have to schedule jobs in web application we can either use java util Timer/TimerTask or Quartz(there are also other scheduling mechanism, but I considered Quartz). I was considering which one to use, when i hit the site http://oreilly.com/pub/a/java/archive/quartz.html?page=1 which says using timer has a bad effect as it creates a thread that is out of containers control in the last line. The other pages discuss Quartz and its capabilities, but I can read that Quartz also uses thread and/or threadpool to schedule tasks. My guess is that these threads are also not under the containers control Can anybody clarify this to me Is it safe to use Quartz in my web applications without creating hanging threads or thread locking issues? Thanks in advance

    Read the article

  • WPF - Make two controls the same size

    - by John Michaels
    Is there any way to make two controls that are in different containers the same size in WPF? For example, suppose you have two textboxes: textbox1 and textbox2. Textbox1 is in a grid and its size can grow and shrink when the user resizes the window. Textbox2 is in another part of the window and I need it to always have the same size as textbox1. Is there any way to do this? Keep in mind SharedSizeGroup will not work because the textboxes are in different containers. Also, I've tried binding textbox2's height property to textbox1 and that doesn't seem to work either. Finally, I tried catching textbox1's SizeChanged event, but its Height property is always NaN for some reason.

    Read the article

  • Jquery AJAX and figuring out how NOT to nest callbacks for multiple reloads.

    - by David H
    I have a site with a few containers that need to load content dynamically via AJAX. Most of the links inside of the containers actually load new data in that same container. I.E: $("#navmenu_item1").click(function() { $("#navmenu").load(blah); }); When I click on a link, lets say "logout," and the menu reloads with the updated login status, none of the links now work because I would need to add a new .click into the callback code. Now with repeated clicks and AJAX requests I am not sure how to move forward from here, as I am sure nested callbacks are not optimal. What would be the best way to do this? Do I include the .click event inside the actual AJAX file being pulled from the server, instead of within index.php? Or can I somehow reload the DOM? Thanks for the help!

    Read the article

  • FIFO implementation

    - by Narek
    While implementing a FIFO I have used the following structure: struct Node { T info_; Node* link_; Node(T info, Node* link=0): info_(info), link_(link) {} }; I think this a well known trick for lots of STL containers (for example for List). Is this a good practice? What it means for compiler when you say that Node has a member with a type of it's pointer? Is this a kind of infinite loop? And finally, if this is a bad practice, how I could implement a better FIFO. EDIT: People, this is all about implemenation. I am enough familiar with STL library, and know a plenty of containers from several libraries. Just I want to discuss with people who can gave a good implementation or a good advice.

    Read the article

  • Active X Development: VC++ or VB or Other technologies

    - by Gopalakrishnan Subramani
    We are in the process of creating active-x controls used within our application. Since Microsoft stopped supporting classic Visual Basic, is it wise to use Visual Basic to develop the Active X control or the latest VC++/ATL/MFC libraries provide more feature where we can create controls faster by leaving Visual Basic flexibility? We will not be able to use .NET/VB.NET/C# since the application is supposed to work inside containers and containers may not support latest .NET runtime. Any other language is best fit for Active X control development other than VB and VC++?

    Read the article

  • JQuery/JavaScript div tag "containment" approach/algorithm?

    - by Pete Alvin
    Background: I've created an online circuit design application where div tags are containers that contain smaller div containers and so forth. Question: For any particular div tag I need to quickly identify if it contains other div tags (that may in turn contain other div tags). I've searched JQuery and I don't see any built-in routine for this. Does anyone know of an algorithm that's quicker than O(n^2)? Seems like I have to walk the list of div tags in an outer loop (n) and have an inner loop (another n) to compare against all other div tags and do a "containment test" (position, width, height), building a list of contained div tags. That's n-squared. Then I have to build a list of all nested div tags by concatenating contained lists. So the total would be O(n^2)+n. There must be a better way?

    Read the article

  • Exporting classes containing std:: objects (vector, map, etc) from a dll

    - by RnR
    I'm trying to export classes from a DLL that contain objects such as std::vectors and std::stings - the whole class is declared as dll export through: class DLL_EXPORT FontManager { The problem is that for members of the complex types I get this warning: warning C4251: 'FontManager::m__fonts' : class 'std::map<_Kty,_Ty' needs to have dll-interface to be used by clients of class 'FontManager' with [ _Kty=std::string, _Ty=tFontInfoRef ] I'm able to remove some of the warnings by putting the following forward class declaration before them even though I'm not changing the type of the member variables themselves: template class DLL_EXPORT std::allocator<tCharGlyphProviderRef>; template class DLL_EXPORT std::vector<tCharGlyphProviderRef,std::allocator<tCharGlyphProviderRef> >; std::vector<tCharGlyphProviderRef> m_glyphProviders; Looks like the forward declaration "injects" the DLL_EXPORT for when the member is compiled but is it safe? Does it realy change anything when the client compiles this header and uses the std container on his side? Will it make all future uses of such a container DLL_EXPORT (and possibly not inline?)? And does it really solve the problem that the warning tries to warn about? Is this warning anything I should be worried about or would it be best to disable it in the scope of these constructs? The clients and the dll will always be built using the same set of libraries and compilers and those are header only classes... I'm using Visual Studio 2003 with the standard STD library. ---- Update ---- I'd like to target you more though as I see the answers are general and here we're talking about std containers and types (such as std::string) - maybe the question really is: Can we disable the warning for standard containers and types available to both the client and the dll through the same library headers and treat them just as we'd treat an int or any other built-in type? (It does seem to work correctly on my side.) If so would should be the conditions under which we can do this? Or should maybe using such containers be prohibited or at least ultra care taken to make sure no assignment operators, copy constructors etc will get inlined into the dll client? In general I'd like to know if you feel designing a dll interface having such objects (and for example using them to return stuff to the client as return value types) is a good idea or not and why - I'd like to have a "high level" interface to this functionality... maybe the best solution is what Neil Butterworth suggested - creating a static library?

    Read the article

  • Flex 4: Getter getting before setter sets

    - by Steve
    I've created an AS class to use as a data model, shown here: package { import mx.controls.Alert; import mx.rpc.events.FaultEvent; import mx.rpc.events.ResultEvent; import mx.rpc.http.HTTPService; public class Model { private var xmlService:HTTPService; private var _xml:XML; private var xmlChanged:Boolean = false; public function Model() { } public function loadXML(url:String):void { xmlService = new HTTPService(); if (!url) xmlService.url = "DATAPOINTS.xml"; else xmlService.url = url; xmlService.resultFormat = "e4x"; xmlService.addEventListener(ResultEvent.RESULT, setXML); xmlService.addEventListener(FaultEvent.FAULT, faultXML); xmlService.send(); } private function setXML(event:ResultEvent):void { xmlChanged = true; this._xml = event.result as XML; } private function faultXML(event:FaultEvent):void { Alert.show("RAF data could not be loaded."); } public function get xml():XML { return _xml; } } } And in my main application, I'm initiating the app and calling the loadXML function to get the XML: <fx:Script> <![CDATA[ import mx.containers.Form; import mx.containers.FormItem; import mx.containers.VBox; import mx.controls.Alert; import mx.controls.Button; import mx.controls.Label; import mx.controls.Text; import mx.controls.TextInput; import spark.components.NavigatorContent; private function init():void { var model:Model = new Model(); model.loadXML(null); var xml:XML = model.xml; } ]]> </fx:Script> The trouble I'm having is that the getter function is running before loadXML has finished, so the XML varible in my main app comes up undefined in stack traces. How do I put a condition in here somewhere that tells the getter to wait until the loadXML() function has finished before running?

    Read the article

  • Dynamically Creating Flex Components In ActionScript

    - by Joshua
    Isn't there some way to re-write the following code, such that I don't need a gigantic switch statement with every conceivable type? Also, if I can replace the switch statement with some way to dynamically create new controls, then I can make the code smaller, more direct, and don't have to anticipate the possibility of custom control types. Before: <?xml version="1.0" encoding="utf-8"?> <mx:WindowedApplication xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical"> <mx:Script> <![CDATA[ import mx.containers.HBox; import mx.controls.Button; import mx.controls.Label; public function CreateControl(event:Event):void { var Type:String=Edit.text; var NewControl:Object; switch (Type) { case 'mx.controls::Label':NewControl=new Label();break; case 'mx.controls::Button':NewControl=new Button();break; case 'mx.containers::HBox':NewControl=new HBox();break; ... every other type, including unforeseeable custom types } this.addChild(NewControl as DisplayObject); } ]]> </mx:Script> <mx:Label text="Control Type"/> <mx:TextInput id="Edit"/> <mx:Button label="Create" click="CreateControl(event);"/> </mx:WindowedApplication> AFTER: <?xml version="1.0" encoding="utf-8"?> <mx:WindowedApplication xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical"> <mx:Script> <![CDATA[ import mx.containers.HBox; import mx.controls.Button; import mx.controls.Label; public function CreateControl(event:Event):void { var Type:String=Edit.text; var NewControl:Object= *???*(Type); this.addChild(NewControl as DisplayObject); } ]]> </mx:Script> <mx:Label text="Control Type"/> <mx:TextInput id="Edit"/> <mx:Button label="Create" click="CreateControl(event);"/> </mx:WindowedApplication>

    Read the article

  • How to save an order (permutation) in an sql db

    - by Bendlas
    I have a tree structure in an sql table like so: CREATE TABLE containers ( container_id serial NOT NULL PRIMARY KEY, parent integer REFERENCES containers (container_id)) Now i want to define an ordering between nodes with the same parent. I Have thought of adding a node_index column, to ORDER BY, but that seem suboptimal, since that involves modifying the index of a lot of nodes when modifying the stucture. That could include adding, removing, reordering or moving nodes from some subtree to another. Is there a sql datatype for an ordered sequence, or an efficient way to emulate one? Doesn't need to be fully standard sql, I just need a solution for mssql and hopefully postgresql EDIT To make it clear, the ordering is arbitrary. Actually, the user will be able to drag'n'drop tree nodes in the GUI

    Read the article

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