[Solved] What this function do? [closed]

This function counts all distinct elements in an array. The outer loop loops over all array elements. The inner loop loops over the array until the element of the outer loop. The count is incremented if there is no preceding element which is similar to the current element. For instance, given the array [1, 2, … Read more

[Solved] I don’t know what I’m doing wrong [closed]

You define emailTrainer inside another function (for no apparent reason: it is waiting for the DOM to be ready, but doesn’t operate on the DOM) but then try to access it in the global scope (where it doesn’t exist). You are using document.write after the document has loaded. This will wipe out the existing document. … Read more

[Solved] TutorialsPoint – Flask – SQLAlchemy not working

The tutorial has an indentation problem in the student class. The constructor code should be indented one level so it becomes a method of the student class. Corrected code: (note the indent of “def init(self, name, city, addr,pin):” in the code below) class students(db.Model): id = db.Column(‘student_id’, db.Integer, primary_key = True) name = db.Column(db.String(100)) city … Read more

[Solved] Why this c++ code doesn’t compile? [closed]

std::list<Tree<T>&>* children; Standard containers can’t store reference types. From the rest of the code, it looks like this should store Tree<T> objects. (If you wanted to refer to objects that live somewhere else, you’d have to store pointers rather than references; but this doesn’t seem to be the case here). You also have a duplicate … Read more

[Solved] Print all possible combinations, given a specific number format [closed]

Try this: with open(‘file.out’, ‘w’) as output: for n in xrange(100000000): s = “{0:08d}”.format(n) output.write(s[:2] + ‘-‘ + s[2:] + ‘\n’) … But be aware that that’s a lot of combinations, it’s possible that you’ll run out of memory, and if not anyway the resulting file will be huge and the program will take a … Read more

[Solved] Select database where datetime>now()? [closed]

Store now() in a variable and then compare using where clause. Also see this and this Update :<?php $timeZone=”Asia/Kolkata”; //variable for indian timezone date_default_timezone_set( $timeZone); //default timezone set to indian time $now = date(“m/d/y G.i:s”); echo $now; ?> Check for date functions in PHP 2 solved Select database where datetime>now()? [closed]

[Solved] A java program such that one character from the first string is concatenated with one character from the second string from left to right [closed]

Here is a solution expanding on your own code (with explanations). Please try to understand the code, before using it in your homework. public static String concateAndAppend(String data1, String data2) { char[] str1 = data1.toCharArray(); char[] str2 = data2.toCharArray(); String result = “”; //we must iterate to the length of the smaller string //if you … Read more

[Solved] Center horizontally absolute div in another floating div [closed]

These are the css elements you need to change: .right { width: 200px; height: 100%; background-color: green; float: right; position: relative; //here } .messageWrapper { overflow: hidden; bottom: 0; max-height: 100%; min-height: 20px; width: 170px; text-align: center; //here width: 100%; //here position: absolute; //here } .message { min-height: 20px; background-color: yellow; margin-left: auto; //here margin-right: … Read more

[Solved] How do I store a variable in Python

here is a simple way to do this : import random score = 0 number = int(raw_input (‘hello, please enter a times table you would like to practice \n’)) while number > 12 or number < 2: if number > 12: print ‘number is too big must be between 2 and 12 \n’ else: print … Read more

[Solved] How do I change the “design” of a ? [closed]

Simple. <div style=”background-color:YOUR_COLOR; width:YOUR_WIDTH; margin:MARGIN;”>TEXT</div> Uses: background-color is your background-color. You can also use color for text color. Refer to colors here. width is your chosen width for the div. You can also use px at the end of the number to define pixels length. Refer to a tutorial here margin is defining the margin … Read more