[Solved] Find same elements in a list, and then change these elemens to tuple (f.e. 2 to (2,1))

To just add a count you could keep a set of itertools.count objects in a defaultdict: from itertools import count from collections import defaultdict counters = defaultdict(lambda: count(1)) result = [(n, next(counters[n])) for n in inputlist] but this would add counts to all elements in your list: >>> from itertools import count >>> from collections … Read more

[Solved] Referring to an id from url on a php page [closed]

This entirely depends on how you’ve set your page up, but just as with any HTML page you should be able to refer to: page.php#anchor Where anchor refers to an id within the page. Note the lack of / before the # solved Referring to an id from url on a php page [closed]

[Solved] header of php not working btw html? [duplicate]

header() must be called before any actual output is sent, either by normal HTML tags, blank lines in a file, or from PHP. It is a very common error to read code with include, or require, functions, or another file access function, and have spaces or empty lines that are output before header() is called. … Read more

[Solved] Console Application with few tasks [closed]

I feel taking risk to answer your question but what the hack.. “refactor” his digits like that: hundreds, tens, ones. int i = 123, reverse = 0; while (i > 0) { reverse = (reverse * 10) + (i % 10); i /= 10; } Console.WriteLine(reverse); //321 sum of all 3 digits (ex. if the … Read more

[Solved] how to add this jquery to mysite [closed]

this should work … $(document).ready(function() { $(“#web”).click(function () { $(“#contweb”).stop().slideToggle(); return false; }); $(“#web”).hover(function () { $(this).stop().css({ “cursor”: “pointer” }) }); $(“#screen”).click(function () { $(“#contscreen”).stop().slideToggle(); return false; }); $(“#screen”).hover(function () { $(this).stop().css({ “cursor”: “pointer” }) }); $(“#keyboard”).click(function () { $(“#contkey”).stop().slideToggle(); return false; }); $(“#keyboard”).hover(function () { $(this).stop().css({ “cursor”: “pointer” }) }); }); 3 solved how … Read more

[Solved] Hundreds of buttons in one page with same name and same ids, how to differentiate?

You can do it like Braziliam way, we call it as “Gambiarra” $(‘input [type=submit]’).click(function(){ var productname = $(this).parent().find(‘.post-meta-ab a’).html(); }); PS. If you cant set a UNIQUE ID for your DOM elements, don’t use any at all. Basically for each product on you list you have this structure: <li class=”ms-tt grid_3″ data-id=”id-1″ data-type=”digital”> <div class=”m-thumb … Read more

[Solved] When i click on an element add another ID or class

Try .on() As your content is added dynamically so it is not accessible directly ,So you have to use Event delegation. $(“.minwidth_IE”).on(“click”,”#custom_background span”,function () { $(“#account ,.minwidth_IE ,.main .main-head ,#fa_toolbar”).removeClass(“bg1 bg2 bg3 bg4 bg5 bg7 bg8 bg_custom”).addClass(this.id); my_setcookie(“custom_background”, this.id, true) }); 3 solved When i click on an element add another ID or class

[Solved] Getting the result of a checkbox in php [closed]

if(isset($_POST[‘new’])){ } Will tell you if it was checked. If you want to be able to check the value as well you need to give the input a value. <input type=”checkbox” name=”new” value=”someval” style=”float:right” /> <?php if(isset($_POST[‘new’]) && $_POST[‘new’] == ‘someval’){ } solved Getting the result of a checkbox in php [closed]

[Solved] Virus signature extraction form malware [closed]

Retrieving a “signature” could be as simple as generating a digital signature via hashing for the virus(es) respective binaries. MD5 or SHA. I.E. implementing the following functionality in your code that I’m sure you’ve already started…: md5sum virus -> md5hashofvirus | md5sum virus2 -> md5hashofvirus2 Complete dossier of md5sum available here. MD5 implementation in C … Read more

[Solved] Unable to query two tables in mysql [closed]

You can make something like this: $postID = 1;//Post id we want to get from the database $getPost = $connection->query(“SELECT * FROM posts WHERE post_id=’$postID'”);//Get the post by the id $post = $getPost->fetch_assoc();//Fetch the result to an array $getUser = $connection->query(“SELECT username FROM users WHERE user_id=”.$post[‘id’]);//Get the username by using the id we got from … Read more

[Solved] Changing background of cell in tableview behaves not as expected [closed]

When changing cell/textview backgorund color or any other attribute every seventh cell/textview also accepts changes. The Problem is due to re-usability of your UITableViewCell. Modify your -cellForRowAtIndexPath like this… Sample Code : -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *reuseIdentifier = @”MyCellType”; UITableViewCell *cell; //UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:reuseIdentifier]; if(cell == nil) { /* … Read more

[Solved] Renaming button name [closed]

Your question is not very clear, but the String name is a java.awt.Component property. In case you mean this name, you can change a component’s name with .setName() and get the name with .getName(). A component’s name by default is null, until you set it. It makes usually sense to .getName() in listeners. Here is … Read more

[Solved] How to make header become static in the top [closed]

If you want the menu should be fixed even when you scroll down then you have to use css property postion:fixed and the demo site which you have provided did the same thing <div id=”top” class=”wrapper”> <div class=”wrapper”> <div class=”logo left”> <img src=”https://stackoverflow.com/questions/17133819/images/dipstrategy.png” alt=”web agency”> </div> <div class=”navigation right”> <ul id=”nav”> <li class=”margin-right15 current”><a href=”#home”>HOME</a></li> … Read more

[Solved] best Java code to control big heap memeory used (like 1G) [closed]

Quickly allocate 1 GB of memory: byte[][] memoryWaster = new byte[1024][1_048_576]; See last test run below for successful allocation of 16 GB of memory. Test program Runtime runtime = Runtime.getRuntime(); System.out.printf(“total: %11d max: %d%n”, runtime.totalMemory(), runtime.maxMemory()); System.out.printf(“used: %11d%n”, runtime.totalMemory() – runtime.freeMemory()); System.gc(); System.out.printf(“gc: %11d%n”, runtime.totalMemory() – runtime.freeMemory()); byte[][] memoryWaster = new byte[1024][1_048_576]; memoryWaster[0][0] = 2; … Read more