FAQ Database Discussion Community


Performance of container of objects vs performance of container of pointers

c++,pointers,c++11,optimization,containers
class C { ... }; std::vector<C> vc; std::vector<C*> pvc; std::vector<std::unique_ptr<C>> upvc; Depending on the size of C, either the approach storing by value or the approach storing by pointer will be more efficient. Is it possible to approximately know what this size is (on both a 32 and 64 bit...

Adding Children to Container() EaselJS

javascript,containers,easeljs,uncaught-typeerror
I am going through some tutorials and experimenting with javascript and more particularly EaselJS. I want to create a number of containers which hold images and a text together. But I get the following error: "Uncaught TypeError: undefined is not a function" when I try to add the text and...

How if I set hdfs blocksize to 1 GB?

hadoop,size,containers,block,hdfs
I want to ask. How if I set the hdfs blocksize to 1 GB, and I'll upload file with size almost 1 GB. Would it become faster to process mapreduce? I think that with larger block size, the container request to resource manager (map task) will fewer than the default....

load JPanel that contains another JPanel

java,swing,jpanel,containers
I'm trying to load a Class that extends JPanel and has components from another Class that also extends JPanel into another Class. And this is what i need to achieve: Example of First.java public class First extends JPanel{ JPanel cont = new JPanel(); public First(){ cont.setBackground(Color.YELLOW); } } Example of...

Push Back in Map

c++,vector,containers,push-back
Is there any possibility to use push_back() in maps? I want to make a map < int, vector<string>> and fill the vector in a loop with strings. It should look something like this: map[int] = vector.push_back(string); ...

how to overwrite the file with map contents in cpp

c++,file,containers,fwrite
I'm trying to overwrite my text file with map contents, can anyone give me the idea on that upto to now i did #include <string.h> #include <iostream> #include <map> #include <utility> using namespace std; int main() { map<int, string> mymap; mymap[34] = "hero"; mymap[74] = "Clarie"; mymap[13] = "Devil"; for(...

Refresh custom container through a button inside it in Java

java,awt,refresh,components,containers
Good morning, I have a class that inherit from java.awt.Container. His scope is to wrap a list of Files showing them vertically as a "file name Labels + delete Buttons" list. files are shown properly and every time a new one is added, it refresh correctly. The component class's code:...

c++ map container [this] () [duplicate]

c++,dictionary,this,containers
This question already has an answer here: Strange use of [] in C++. What is happening? [duplicate] 2 answers I am learning to use map containers, and I can see the logic, we can define the key and the value when we insert any object. I also know that...

How to correctly instantiate a service from a Command in Symfony2

symfony2,dependency-injection,containers,symfony-2.6
I have a Command in Symfony2 that requires a ProductManager service. I pass two arguments to this service: Doctrine's entity manager and a config array from app/config/config.yml Here is my services.xml in the bundle: <service id="acme.product_manager" class="Acme\ApiBundle\ProductManager" public="true"> <argument>[email protected]_manager'</argument> <argument>"keys"</argument> </service> Here is the code from the command: protected function...

Are there any methods built into the Spring framework that make working with polymorphic containers easier?

delphi,polymorphism,containers,delphi-xe2,spring4d
I have a dictionary that contains different kinds of values and I want to filter for an item that has a specific sub-type and that satisfies a certain condition: var FData: IDictionary<TGUID, TObject>; // Polymorphic begin TMicroStep(FData.Values.Single( function(const O: TObject): Boolean begin Result := (O is TMicroStep) and (TMicroStep(O).OrderTag =...

Java - Show multiple canvases in container

java,canvas,containers
I am pretty new to Java. I want to show multiple Canvas objects in one Container object. I don't want to use Swing components. Here is my code: //===============================================================================================| package main; //===============================================================================================| import java.awt.*; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent;...

How to write in container field table from code?

table,containers,axapta,x++,dynamics-ax-2012
I have a simple question, I have in my Table a Field. This field is type container . How I can write in this field. I used this code, but don't work: MyTable myTable; str value = "value" ; ttsBegin; select forupdate myTable; conIns( myTable.FieldContainet, 1 , value ); myTable.insert();...

Spring XD container groups

containers,spring-xd
I have put the containers into three groups (group1,group2,group3) is it possible to deploy a stream to group1 as a priority and then, if all containers in group1 are down, to group2 as second perference and avoid going to group3. e.g. module.*.criteria=groups.contains('group1','group2')" this is for springXD 1.0.1...

Is there a flat unsorted map/set implementation?

c++,c++11,boost,stl,containers
There is the boost.container flat_map and others, and the Loki AssocVector and many others like these which keep the elements sorted. Is there a modern (c++11 move-enabled, etc.) implementation of an unsorted vector adapted as a map/set? The idea is to use it for very small maps/sets (less than 20...

Qt containers with object

qt,containers,copy-constructor,push-back
When using a Qt container as Qlist, Qvector etc to hold some class (say a complex class with many data members and logics) and calling insert/append/push_back will the object added to the container be inserted to the container or it will be copied (cctor) ? Suppose it is copied then...

How to enforce parent / derived relationship of two independent classes inside a container?

c++,pointers,polymorphism,containers,vtable
Consider the following class definitions: #include <string> class CParty { public: CParty(); virtual ~CParty(); int m_nId; }; class CPartyEx : public CParty { public: CPartyEx(); ~CPartyEx(); std::string m_sName; }; class CTransaction { public: CTransaction(); virtual ~CTransaction(); int m_nClassNo; }; class CTransactionEx : public CTransaction { public: CTransactionEx(); ~CTransactionEx(); std::string m_sDesc;...

Why are takeR, dropR and splitAtR missing from Data.Sequence?

haskell,containers,sequence
Data.Sequence has takeWhileR and dropWhileR for efficient deconstruction of Seqs from the right. However, takeR, dropR and splitAtR are conspicuously absent. take and drop are implemented in terms of splitAt. So, do finger trees not admit an efficient splitAtR or was this functionality not included for some other reason? (Separate...

How to get Container object from LifecycleEventArgs of postLoad in Entity?

php,symfony2,entity,containers,symfony-2.6
I'm trying to inject the Container object (which is available in controllers) into an Entity using postLoad lifecycleCallbacks. The argument to the postLoad method is LifecycleEventArgs. I could see the container property (which I want to retrieve) in EventManager of LifecycleEventArgs according to the dump output, but it seems to...

Bind docker container to IP on OSX

ip,docker,containers
On Ubuntu I do something like this sudo ip addr add 192.168.33.30/21 dev eth0 docker run -p 192.168.33.30:80:80 -d foo/bar /sbin/my_init Then I can open up a browser at http://192.168.33.30. How would I accomplish the same thing on OSX? (OSX has no 'ip addr' and this boot2docker-vm thing)...

Which STL container(s)/algorithm(s) could I use to solve this?

c++,algorithm,sorting,stl,containers
I have an MFC project which, given an initial root path, iterates through every file, folder and subfolder, and subsequently displays each file to the user in a List Control. Since this can easily become a rather lengthy operation, I occasionally yield control to the operating system (via processing a...

Storing Child Class Objects in the Same Container without loosing data?

c++,object,containers,parent-child,base
So lets say I have a base class called Fruits, class Fruit{ public TYPE{ Apples, Oranges, Grapes, NoType }; virtual int getType(){ return Fruit::TYPE::NoType; }; virtual ~Fruits(){}; virtual int randomFunc(){ return 991; }; } And then lets say I have a child class called Apple, class Apple : public Fruit{...

How to make a dictionary of arrays?

arrays,matlab,dictionary,mapping,containers
I can't seem to figure out how containers.Map works. It's doing okay with characters and numbers, but flips out when I try to feed it arrays. How do I make something like this? function test global a a = containers.Map(); a(pi) = 3:14; a(5) = 4:2:10; end ...

Div stretching to browser width and not the content inside it

html,css,containers
Hi i have a problem i need to fix i have a form that i need to put inside a box so i put the form inside a div and assigned a background-color to the div the only problem is the div is sretching the whole browser width when i...

Insert new element into hash table?

c++,data-structures,containers
auto iterator = unorderedMap.find(element); if (iterator == unorderedMap.end()) { //If the element doesn't already exist in the table, create a new entry iterator = unorderedMap.insert(make_pair((element), vector<unsigned>()).first; } iterator->second.push_back(unsigned_number_associated_with_element); The hashtable is a table of strings and vector<unsigned> (the key is of type string). element is of type of string....

How to get a last element of ES6 Map without iterations?

containers,ecmascript-6
How to get a last element of ES6 Map/Set without iterations(forEach or for of) pass through a full length of the container?

Bluemix: service bound to container does not appear in VCAP_SERVICES

ssh,docker,containers,cloudfoundry,bluemix
I'm trying to use IBM Containers for Bluemix to deploy a container and bind it to a Bluemix service. I start with an existing Bluemix app, which is bound to the MongoDB service I want. I verify that its VCAP_SERVICES environment variable is correctly populated: $ cf env mamacdon-app Getting...

Associative Key to Key map in C++

c++,c++11,boost,stl,containers
I'm searching for something like a "Key to Key" map in C++. My intention is as follows: Each Key - either on the "left" or "right" side is unique The key of the left side can be looked up by the key of the right side et vice versa As...

Is docker a solution for making application cross platform?

docker,containers
I'm getting started with docker by reading some blogs and introduction material. My understanding is docker can wrap a single application into a standardized container. The container provides a sandbox, all the necessary resources the application needs to run, and the application inside always live within that container. That means...

Container of Miscellaneous Types - C++

c++,generics,c++11,containers
So I'm trying to create a "Table" class in C++ with a structure like so: Table.h class Table { private: class TableImpl; TableImpl* impl; }; Table.cpp class Table::TableImpl { private: class Row { private: template <typename T> class RowDataCell { T data; } std::vector<RowDataCell*> data; }; std::vector<Row*> rows; }; The...

HTML/CSS line break when text overflows container

html,css,overflow,containers
On my website, the Lorem Ipsum text overflows the container. How can I automatically add a line break when the text reaches its container's borders. I have created this JSFiddle to demonstrate my issue. HTML: <body> <div id="wrapper"> <div id="content"> <div class="flex"> <div class="flexchild"> <img src="img.jpg" width="200"></img> </div> <div class="flexchild">...

Fastest Way to Determine if Character Belongs to a Set of Known Characters C++

c++,c++11,stl,containers,unordered-set
Given any character, what's the fastest way for me to determine if that character belongs to a set (not the container-type) of known characters. In other words, what's the fastest elegant way to implement the conditional: char c = 'a'; if(c == ch1 || c == ch2 || c ==...

Drools 6.2 How to generate and deploy DRL file from my own rule editor

containers,drools,workbench,kie
As a proof of concept, I have used Drools workbench to create data objects and DRL files. I created the jar file and deployed to kie server (with container). All done through workbench UI. I used KIE REST services from my c# application to post the input object via XML...

Accessing all class variables in a container without a loop

python,list,for-loop,containers
I have a list 'users' that contains objects of the class 'user'. Each user has a list 'records', which contains objects of the class 'record'. Each record has a datetime variable describing when that specific record was made. I would like to create a list that contains all the datetime...

Can I initialize elements with an additional default-parameter using std::vector?

c++,c++11,vector,stl,containers
I'm currently working on my own little framework which has the following design pattern: Each object inherits from LObject and has a parent which it informs when something has changed in the object. Here's an example: class LObject { public: LObject(LObject* const _pParent = nullptr) : _mpParent(_pParent), _mChildrenCount(0) { if(parent()...

How to use default comparator in own class?

c++,c++11,stl,containers,comparator
I want to create own data container like STL-containers. template <class priorityType = size_t, class Compare = std::less<priorityType>> class task_queue { public: task_queue(Compare c = Compare()) { } private: std::priority_queue<priorityType, std::vector<priorityType>, Compare> tasks_id; }; int main() { struct foo { int a; }; struct foo_compare { bool operator()(const foo& lhs,...

Container hidden behind other container

html,css,css-position,containers
I am pretty sure this is a positioning issue, but unfortunately positioning is my weakness. I have a container with a jquery image slideshow in it. The images in the slideshow have to be {position: absolute;} or else they will just display one after the other down the page. Unfortuntely,...

F# when should you use tuple and when should you use struct? [closed]

struct,f#,tuples,containers
What are the underlying differences between F# tuples and structs. They can both hold multiple variables, but I just want to know when one is used over the other. To be more specific, I am trying to pass a bunch of parameters through a bunch of functions with a new...

Swift : Changin content of an image from another Container

swift,uiviewcontroller,containers
I have two container views as seen in the attached image. I am trying to click a button which is inside the top container which will change the content of the UIImage which is in the bottom container. I have a method which handles the change in the class of...

Cannot create and run Bluemix container, Unathorized

cloud,docker,containers,bluemix
I followed the official instructions and also double checked with these instructions. 1. I authenticated using sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys myKey command. 2. I was able to push using sudo ice --local push registry-ice.ng.bluemix.net/myAccount/myApp. However when I try to create and run the container I get the following...

find out if the `in` operator can be used

python,iterator,containers
What is the simplest (and most elegant) way, to find out if the in operator can be used in python? If I open a python shell and type in: "" in 2 it prints: Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: argument of type 'int'...

Insert in unordered map calls constructor

c++,c++11,containers,destructor,rvalue
In order to avoid duplication of elements, I'm building a class that holds elements and provide an acces to them. My elements (DynLibrary) are movable but not copyable class DynLibrary { public: DynLibrary() : _handle(nullptr) {} DynLibrary(const std::string& path) { DynLibrary::open(path); } DynLibrary(const DynLibrary&) = delete; DynLibrary(DynLibrary&&) = default; ~DynLibrary()...

Can we change width of container in css using Bootstrap3

twitter-bootstrap-3,width,containers
how can i change width of container in bootstrap3. I want content in center of browser (70% of browser's width). <p> Use Bootply to design, prototype, or test the Bootstrap framework. Find examples, share code and rapidly build interfaces for Bootstrap. Use Bootply to design, prototype, or test the Bootstrap...

c++ container very efficient at adding elements to the end

c++,vector,containers
I have been running a c++ program for scientific purpose and I am now looking at optimizing it. The bottleneck seems to be a function where I need to stack pairs of integers. Their number is impossible to know from the start, and I have been using a std::vector of...

Child view controller's view is not shown in a container

ios,uiview,uiviewcontroller,containers,subview
I have a scene in the storyboard with a Container View. As you may suppose, I want its associated UIViewController to load there another UIViewController as a child view controller, and to show its view as a subview. So, in the parent UIViewController I defined the properties: @property (weak, nonatomic)...

Can you have a variable amount of variables in a class in C++?

c++,class,variables,containers
This is my first question here, and I'm not very skilled at programming yet, so my apologies if I do something wrong. That said, I searched both here and on Google before asking the question, so if a duplicate exists, it's because I didn't know how to find it. My...

Docker list only stopped containers

docker,containers
Docker gives you a way of listing running containers or all containers including stopped ones. This can be done by docker ps \ docker ps -a Do we have a way of only listing container that have been stopped....

Memory Allocation in STL C++

c++,memory,stl,containers
I am a little confused about memory reallocation in STL C++. For example, I know if I declare a vector, and keep pushing back elements into it, the vector will at some point need a reallocation of memory space and copy all the existing elements into it. For linked lists...

What container to store unique values?

c++,memory-management,containers
I've got the following problem. I have a game which runs on average 60 frames per second. Each frame I need to store values in a container and there must be no duplicates. It probably has to store less than 100 items per frame, but the number of insert-calls will...

Templates. adding , getting element char*

c++,templates,char,containers
I've got a problem with my template class and using it for char*. I storage elements in class and try to add or get element ,but segmentation fault appear. Is it possible without class specialisation for type char* ? Edit 1: Let's assume that I can't change the code in...

Positioning child at bottom of parent with scroll

html,css,containers,parent
I would like to position a child div at the very bottom of its parent. Normally, I understand this could be done using position: absolute; bottom: 0; - However, this places the child to the bottom of the screen in view, but my page has overflow-y, as height: 1000px; (i.e....

How to route to host in docker container during 'docker build'

routing,docker,containers,host
TL;DR My Dockerfile has a RUN step that executes a shell script that downloads a build from a build server. I'd like this build server to be on my docker host for quick transfer. If possible, how can I get the container spun up for the docker build command to...

LXC Container as VPS

linux,containers,vps,lxc
I've been looking into LXC containers and I was wondering as to whether or not it is possible to use an LXC container like an ordinary VPS? What I mean is; How do I assign an external IP address to an LXC container? How do I ssh into an LXC...

What are the advantages and disadvantages of using std::stack instead of just deque, vector or list

c++,stl,stack,containers
I am writing a very simple std::stack using vector as its underlying container. I realized that I could replace all the push(), pop() and top() functions with push_back(), pop_back() and back() of the vector container. My questions are: why to use a container adaptor when the controlled use of the...

Use of container docker as a proxy for CF app to get public IP

docker,containers,bluemix
I need a public IP for my application: is it a proper solution to use docker container as a proxy? I can see the price increasing quite a lot with all traffic going through proxy to reach the application. Is there any other option recommended?

2d array with std::vector in c++ - container

c++,vector,graph,containers
I am trying to make a 2d array by making a vector of vectors of EdgeWeights (it is for an adjacency matrix), but am having trouble understanding how the nested containers function. I am constructing the before mentioned structure as such, std::vector<std::vector<EdgeWeight> > M = std::vector<std::vector<EdgeWeight>>(num_edges, std::vector<EdgeWeight>(num_nodes)); but am having...

Constructing priority_queue instance with Compare instance of different type

c++,gcc,constructor,containers
Could anybody please explain why my compiler (GCC) accepts the code below as valid? priority_queue<int, deque<int>, less<int>> pq(greater<int>()); I expect this constructor (for an instance of type having less<int> as Comparator, as specified for priority_queue instance pq) to be incompatible with an instance of greater<int> (passed as constructor parameter), which...

Which C# containers are contiguous and which are node-based?

c#,list,containers
In Item 1 of Effective STL, Herb Sutter makes a distinction between contiguous and node-based containers. Vectors, strings, and deques are contiguous, while linked lists and associative containers are node-based. This is useful for performance considerations (speed of insertion or deletion from the start, middle, or end, iteration, large memory...

How do I use “<<” with my own struct?

c++,stl,sqlite3,containers
I have following program to access sqlite database and to get the content of a table into a LIST CONTAINER. All I want is to print the data which is in the list container.But I get this ERROR. error: expected primary-expression before ‘<<’ token The below file is DBAccess1.cpp #include...

Why C++ doesn't invalidate begin() when using containers [closed]

c++,containers,invalidate
As I read that using containers' insert() or erase() method can invalidate the container and therefore it's better to not cache the end of a container using iterators before performing the insert () or erase() operation, I am confused about why only the last position of a container is invalidated...

Sort an STL container of structs by a certain data member

c++,stl,containers
I know that this would be simpler with C++11, but is there a way to make it work in C++98? I have the following example code: #include <boost/lambda/lambda.hpp> #include <boost/lambda/bind.hpp> #include <vector> #include <algorithm> #include <iostream> struct foo { foo(const int a_, const double b_): a(a_), b(b_) {} int a;...

Making a heap with list causes errors

c++,heap,containers
The following code: std::list<int> list; std::make_heap(list.begin(), list.end()); Live demo causes a whole bunch of errors, including: error: no match for 'operator-' When I declare list as std::vector, I do not get these errors, why?...

How to use std::back_inserter to insert into a container (only have a pointer to container)

c++,stl,iterator,containers
I would like to transform from foo to bar. struct A { explicit A(int d): m_d(d) {}; private: int m_d; }; A some_function (int i) { return A(2*i); } std::vector<int> foo; std::vector<A> bar; // This is part of a Library not under my control The interface only provides pbar std::vector<A>*...

Not able to access shared data volume

docker,containers
I have been trying to share data between my host and docker container. I am using this command to mount data volume: sudo docker run -it -v /home/peeyush/Docker/docker/:/opt/test/:rw ubuntu /bin/bash Now, when I run docker and try to access /opt/test/, it says I don't have the permission. But I have...

Docker images as OS for multiple servers

virtual-machine,docker,containers
I received a rather puzzling question from my lecturer about Docker after doing a presentation on the differences between docker.io and virtual machines. I told him that the main purpose of docker.io is to deploy software applications without the need of a virtual machine's hypervisor. The question is: Is it...

Grouping all the containers on a Docker.io host: advantages or not?

cloud,virtual-machine,docker,containers,lxc
There is something that still doesn't convince me in using Docker.io. Let suppose to deploy a MongoDb replica set on 3 three different containers installed on a Linux VM running on AWS. If for any reasons the VM goes down then all the mongo instances belonging to the replica set...

How to force operator>>(C) overload to match container?

c++,templates,operator-overloading,containers,extraction-operator
I would like to have operator>>() overloads for any "base" type and for any container type. This is what I have so far: typedef uintmax_t my_t; template <typename T> std::istringstream &operator>>(std::istringstream &iss, T &v) { static my_t um = 6009; v = um++; return iss; } template <template <class> class...

Get container in test class Symfony2

php,unit-testing,symfony2,phpunit,containers
how I can get container to be able getting mys services in tests classes. I found the solution to require_once dir(__FILE__). '/...../AppKernel.php;, But when I go into WebTestCase class and found protected static function createClient(array $options = array(), array $server = array()) { static::bootKernel($options); $client = static::$kernel->getContainer()->get('test.client'); $client->setServerParameters($server); return $client;...

Custom iterator for multiple containers in C++

c++,iterator,containers
I have a pure abstract class and two derived classes that I use to store the same kind of data, let's say int, but in different data structures, let's say a map and a vector. class AbstractContainer { public: virtual MyIterator firstValue() = 0; } class ContainerMap : public AbstractContainer...

Changing button label in the container view by clicking button in the main view

ios,swift,cocoa-touch,containers,segue
I'm new to IOS programming. In my app, I have a container view which is connected to a page view controller with three pages. It works well. When I push a button in the main view controller, I want to change the button labels in the container view. So, I...

Placing two containers among each other

html,css,layout,containers
I have some layout problems. If you look at the fiddle here, there are two container, contentAbout and contentPortfolio. My problem is that I can't set those divs correctly among each other. There is always a space between. Maybe you could give me some tips to get this working. This...

C++ Own comparison in std::list

c++,containers,stdlist
I have some structure in my program and list of them. It's something like this: struct person{ string name; char relation; string child; } typedef std::list < person > listP; listP MyList; I want sort this list by person.name using std::list::sort() but I don't know how to deal with it....

get container parameter in my custom classes Symfony2

symfony2,service,configuration,containers
I have the class, it declare as service. When I get() my service I run some method and this method require two params what I want to let user configure in config.yml. How I can get these parameters in this class? Maybe exist some way to do this in my...

Link container and host when using systemd-nspawn with macvlan

containers,systemd
I'm starting a debian jessie container from jessie like this: systemd-nspawn --network-macvlan=eth0 -b -j -D /var/lib/container/debsid The container get's an IPv4 from the gateway via DHCP, that's fine and also reaches servers outside. But I can't connect to the host and from the host the container's IP is not reachable....

boot2docker - An error occurred trying to connect when running docker version command

windows-7,docker,containers,boot2docker
When I use boot2docker to start the boot2docker-vm, then in gitbash I run the docker version command I get the following: $ docker version Client version: 1.6.2 Client API version: 1.18 Go version (client): go1.4.2 Git commit (client): 7c8fca2 OS/Arch (client): windows/amd64 FATA[0021] An error occurred trying to connect: Get...

How to move docker containers between different hosts

docker,containers,docker-registry
I cannot find a way of moving docker running containers from one host to another. Is there any way I can push my containers to repos like we do it for images ? Currently I am not using data volumes to store the data associated with applications running inside containers....

two floating div inside a container

html,css,containers
I try to define two div side by side. The left is div content, the right is div sidebar. These two divs are inside the container div. I tried several different ways, but none of them works. Here is my code for css: #container { width:1000px; position: relative; } #content...

how to get agents on all containers jade?

containers,agents-jade
hi i m working on my theses under jade i use the ams to discover all the jade agents on the main container but when i tried to make some agent containers i failed to search all the containers to get all agents on them please help me fixing my...

What tool can manage Docker container to start in order?

docker,containers
We're trying to port our system to the containers, currently we try Docker module with Puppet and we face an issue with the order of starting some specific conainers. We have a web application, MySQL, NginX and then everything connect through HAproxy. Each of them live in their own container....

Docker container mongod error when starting via ssh

mongodb,ubuntu,ssh,docker,containers
I have installed mongodb on a docker container together with openssh on ubuntu 14.04. The container is running with ssh but when I ssh into the container I get the following error when trying to start mongod. [email protected]:~# service mongod start Rather than invoking init scripts through /etc/init.d, use the...

Adding a JLabel above a GridLayout [closed]

java,swing,containers,layout-manager,grid-layout
I'm having a hard time with containing a GridLayout so that adding a JLabel above it won't throw off anything. I've tried a few different things but still cant seem to get it aligned right. It's a Tic Tac Toe game: package assg01; import javax.swing.*; import java.awt.*; import java.awt.event.*; public...

CSS fit image to the container depending on the height or width

html,css,css3,containers
I have a container that has size, say 600 for width and 400 for height. Also I have 2 images one has size 600(width) * 1 and one has dimension 1 * 400(height). Is there a way that I fit the first image to the container using width or max-width...

C++ atomic list container

c++,list,stl,containers,atomic
Probably this is a stupid question and I get downvoted but I'll ask it anyways. I'm playing around with std::atomic but I think I didn't fully understand the concept. I'm wondering why there are no atomic Containers. So I played a Little bit around. First I tried the following: std::atomic<std::list<int>...

How to expand div based on child content size?

html,css,containers,expand
I have a following structure on my view: <div id="container_card"> <div id="child_top_container"> <div id="logo"><img src="http://placehold.it/175x100"></div> <div id="title"><p>This title block width depends on size of logo</div> </div> ... </div> Div #container_card have fixed width and height, i.e. 600px x 300px. Also, Div #child_top_container follow same width, 600px but the height is...

Custom container range-based iteration

c++,containers
I have a custom container which I want to use in a ranged-based for loop. The container is somewhat based on a vector, like this: template<typename T> class IDMap { private: struct Item { uint16_t mVersion; T mItem; template <typename... Arguments> Item(uint16_t version, Arguments&&... args) : mVersion(version), mItem(args...) { }...

How to make Hadoop YARN faster with memory and vcore configuration?

hadoop,memory,containers,core,yarn
On Hadoop YARN, if I have more containers to run map task or reduce task, would it become faster to process a job? So if that's true when I make container allocation memory smaller than default, I can get more containers run on the host, and make the job faster....

iterating on a list of vectors of some class (C++)

c++,list,vector,iterator,containers
Can anyone help me with why this code give me a segmentation fault on the inner loop? I am trying to iterate on a list of vectors of some class block. class chain { list<vector<Block*>* >* _blockChain; } Chain* someChain = new Chain(); for(list<vector<Block*>*>::iterator listIter = someChain->getChain()->end() ; listIter !=...

Why magic methods are not intercepted by __getattr__ implementation in python?

python,indexing,containers,magic-methods,getattr
Subj. Example: MyList(object): def __init__(self, list_to_be_wrapped): self._items = list_to_be_wrapped def __getattr__(self, item): return getattr(self._items, item) Then MyList([1, 2, 3])[-1] will raise: TypeError: ‘MyList’ object does not support indexing while: MyList([1, 2, 3]).pop() will work perfectly (pop will be intercepted by the __getattr__ and redirected to _items) It seems for me...