Posts

jquery cycle slideshow images

Image
up vote 1 down vote favorite My jQuery cycle slideshow doesn't work. I wrote the script in html but I can't work out how to get it working. $("#next").click(function() { $(".cycle-slideshow").cycle('next'); }); $("#prev").click(function() { $(".cycle-slideshow").cycle('prev'); }); .body-content { width: 100%; min-height: 100px; float: left; margin-top:25px; } .content-left{ width:63%; float: left; display: inline-block; } .content-right { width: 34%; float: right; display: inline-block; padding: 5px; background-color: blue; } .slider { width: 100%; float: left; display: inline-block; position: relative; } .cycle-slideshow { position: relative...

sorting a map by converting it to vector

Image
up vote 5 down vote favorite 1 I have a map that I want to print out sorted by value, I convert it to vector and sort the vector. Is this code correct? #include <map> #include <iostream> #include <vector> #include <algorithm> #include <utility> int main() { std::map<char, int> freq; std::string text; std::getline(std::cin, text); std::vector<std::pair<char, int>> items; for(auto & ch: text) freq[ch]++; for(auto [key, value]: freq) items.push_back(std::make_pair(key, value)); std::sort(items.begin(), items.end(), (auto a, auto b) { return a.second > b.second;}); for(auto [key, value]: items) std::cout << key << " " << value << std...