[Solved] i need help adding the leap year functionality into my python program [closed]

[ad_1] Roll-your-own parser code is silly. Python has batteries included for this: import datetime repeat = True datestr = raw_input(‘Enter a date in the format MM/DD/YYYY’) while repeat: try: # Parse to datetime, then convert to date since that’s all you use date = datetime.datetime.strptime(datestr, ‘%m/%d/%Y’).date() except ValueError: pass # Handle bad dates in common … Read more

[Solved] JavaScript MySQL injection prevention [closed]

[ad_1] For a start, JavaScript is code that a user can actually edit using DOM tools (like inspect element) and should never be used as a mechanism to security with Databases. You should firstly start to research about prepare statements in PDO if you’re using un-trusted user input; the bind paramtter in the PDO interface … Read more

[Solved] do while loop not looping properly

[ad_1] You’re returning totalMonsterHealth in if(battleChoice ==’A’ || battleChoice == ‘a’) So when the user hits A or a it will exit the loop 2 [ad_2] solved do while loop not looping properly

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

[ad_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 … Read more

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

[ad_1] 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 … Read more

[Solved] Console Application with few tasks [closed]

[ad_1] 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 … Read more

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

[ad_1] 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 [ad_2] … Read more

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

[ad_1] 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 … Read more

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

[ad_1] 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 [ad_2] solved When i click on an element add another ID or … Read more

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

[ad_1] 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’){ } [ad_2] solved Getting the result of a checkbox in php [closed]

[Solved] Virus signature extraction form malware [closed]

[ad_1] 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 … Read more