[Solved] how can we add two String arraylist in hashmap and retrive value as match with key name index

I guess, you want to store first list items as keys and second list items as values in a HashMap. For that, you need to create a hashmap of string, string type as given below and store all its value there. HashMap<String, String> hmap = new HashMap<String, String>(); for(int i=0;i<a1.size();i++){ hmap.put(a1.get(i),a11.get(i)); } for(Map.Entry m:hmap.entrySet()) { … Read more

[Solved] Random Number Gen as function

You need to use if ( (RanNum == 1) || (RanNum == 2) || (RanNum == 3) || (RanNum == 4) || (RanNum == 5) ) instead of if (RanNum = 1||2||3||4||5) Similarly for the other if statement. That’s one problem. The other problem is that you have the line: int RanNum; in main but … Read more

[Solved] algorithm for finding the number of 1s in a matrix (only vertical 1s). The image is self explanatory that what i exactly want

algorithm for finding the number of 1s in a matrix (only vertical 1s). The image is self explanatory that what i exactly want solved algorithm for finding the number of 1s in a matrix (only vertical 1s). The image is self explanatory that what i exactly want

[Solved] Objective C: split text between brackets

You can solve this problem using a regular expression and NSRegularExpression. Construct a pattern which matches the text between brackets. For example the pattern @”\\[([^]]*)]” matches an opening bracket \\[ – the backslash is required to treat the bracket as a literal character, zero or more characters except a closing bracket [^]]*, groups that text … Read more

[Solved] How to parse JSON extract array [closed]

That depends of the definition of your structs. if you want only the array of items, you should unmarshal the main structure and then get the items array. something like this package main import ( “encoding/json” “fmt” “io/ioutil” “os” ) type Structure struct { Items []Item `json:”items”` } type Item struct { ID int `json:”id”` … Read more

[Solved] Split a string into parts

I assume that your expected output is bye see you.If I understood correctly then following methods can be used to get the desired output: In this string splits into an array(splits()) with delimiter ” ” and find index of bye (j)and you(k) in the array then using a for loop to get strings in the … Read more

[Solved] C++ object(int) [closed]

You want to overload << operator. For instance: ostream& operator<<(ostream& os, const Date& dt) { os << dt.mo << “https://stackoverflow.com/” << dt.da << “https://stackoverflow.com/” << dt.yr; return os; } If a() isn’t constructor, but only a () operator overloaded which I assumed changes the a field of the class A to the parameter provided inside … Read more

[Solved] Permanent Threads in QT

You should use Qt signaling mechanism. class QWindow : QMainWindow { //this macro is important for QMake to let the meta programming mechanism know //this class uses Qt signalling Q_OBJECT slots: void updateLabel(QString withWhat) … }; And now You just need to connect this slot to some signal class SomeThreadClass : QObject { Q_OBJECT … … Read more

[Solved] Can someone help me rewrite this code (fig with multiple histograms) with a for loop or function?

You could create a list with the years and iterate over it: years = [‘1990’, ‘1995’, ‘2000’, ‘2005’, ‘2010’, ‘2015’] plot_i = 1 for y in years: data = mmr[mmr[‘Year’]==y] ax = fig.add_subplot(2,3,plot_i) ax.hist(data[‘MMR’], color=”darkred”, edgecolor=”white”) ax.set_title(y + ‘ MMR Distribution’, fontweight=”bold”, loc=”left”) ax.spines[‘left’].set_visible(False) ax.spines[‘top’].set_visible(False) ax.spines[‘right’].set_visible(False) ax.spines[‘bottom’].set_visible(False) ax.tick_params(length=0) ax.set_xlim(0,3000,500) plot_i = plot_i + 1 1 … Read more

[Solved] Responsive Font Size Java [closed]

There are a lot of specifications missing for the question, but the basic concept might be the following: Listen the events for the container resizing with a ComponentListener In the Event listener make the resize logic, for example by increasing the font size until the text does not fit in the container. See this example. … Read more

[Solved] “Cannot read property … of undefined” in jQuery 1.11.0 — how can I satisfy jQuery’s requirement?

You have incorrect syntxis What do you whant to do with ? jQuery(function() { jQuery.each(jQuery(‘h1’).add(‘h2’).add(‘h3’).add(‘h4’).add(‘h5’).add(‘h6’).add(‘ul#navigation’)).function(index, element) { var bounds = jQuery(element).offset(); var image_left = bounds.left; var image_top = bounds.top + bounds.height; var image = jQuery(‘<img src=”https://stackoverflow.com/media/images/foldback.png”>’); image.style.position = ‘absolute’; image.style.top = image_top + ‘px’; image.style.left = image_left + ‘px’; } function set_search_width() { var offset … Read more

[Solved] Advice on how to resolve this error.

A typical linked list structure is made of three parts The Data class Bunny { string name; // don’t use pointers unless you really, really need them int age; bool gender; string color; bool radioactive_bunny; public: string getGender(); // don’t need to know which Bunny anymore because // these functions are bound to a particular … Read more