[Solved] PHP Login & MySql Query

There are a few problems with your script. First off, you start by using PDO to connect to the database, then you use mysql_* functions (which are deprecated, stick to PDO !!!). Plus, you are not properly escaping your data, and your code is potentially vulnerable to SQL injection. Secondly, the query you are using … Read more

[Solved] ‘IndexError: list index out of range’ – reading & writing from same csv file [closed]

For anyone who has the same problem in the future, the solution is to remove the extra line. writer=csv.DictWriter(f,fieldnames=fieldnames, lineterminator=”\n”) Although it can be read with the extra line spacing by changing This: namesList = [x[0] for x in people] To this: namesList = [x[0:1] for x in people] (in my example) blank results are … Read more

[Solved] Find maximum sum possible

Probably something along these lines; public int getMaxSum(int[] numbers) { //this stores the highest sum we have found so far //Integer.MIN_VALUE is the smallest possible value, //but your assignment would work with maxSum = -10000; int maxSum = Integer.MIN_VALUE; //starting at the 1st number in the list, then the 2nd, etc for (int pos = … Read more

[Solved] C# Sudoku Board Generator [closed]

Something like this will provide a basic console output of your board. foreach (var cell in board.Cells) { int x = cell.Column; int y = cell.Row; Console.SetCursorPosition(x * 2, y * 2); Console.Write(cell.Value.HasValue ? cell.Value.Value.ToString() : ” “); } Console.ReadKey(); I’m multiplying the X and Y by 2 for the purpose of separating the numbers, … Read more

[Solved] mysql , max ,groub by [closed]

suggest that if your above SQL statement can query the result. maybe you can just skip the “order by” and simply just select * from (/* your SQL statement without “order by”*/) a order by a.message_id desc sorry that as it is difficult to see your screen capture and help you to resolve the SQL … Read more

[Solved] How to make items on a list show, with input from the user [closed]

You can do that: a = [“first answer”, “second answer”, “last answer”] answer = raw_input(“\n”.join([chr(x + ord(‘A’)) + “) ” + a[x] for x in xrange(len(a))])) Edit (for Python 3): a = [“first answer”, “second answer”, “last answer”] answer = input(“\n”.join([chr(x + ord(‘A’)) + “) ” + a[x] for x in range(len(a))])) Explanation: for x … Read more

[Solved] Linq join between two Lists [closed]

var result = studentList .Join(markList, m => m.Id, s => s.Sid, (s, m) => new { s, m }) .GroupBy(t => t.s) .Select(g => new { Student = g.Key, MarksCount = g.Count(), Marks = g.Select(x => x.m).ToList() }) .ToList(); MarksCount – total marks for this student Marks – List of marks for this student solved … Read more

[Solved] counting occurrences in list of list

We have some list of lists a. We want to get counts for each of the sublists, and the total of those counts. Note that the total counts will just be the sum of the counts of the sublists. from collections import Counter a = [[‘das’,’sadad’,’asdas’,’das’],[‘das’,’sadad’,’da’],[‘aaa’,’8.9′]] def count(list_of_lists): counts = [Counter(sublist) for sublist in list_of_lists] … Read more

[Solved] Responsive Background Video

Add these CSS rules to your body (the video’s parent container): text-align: center; /* ensures the image is always in the h-middle */ overflow: hidden; /* hide the cropped portion */ Add these CSS rules to your video: display: inline-block; position: relative; /* allows repositioning */ left: 100%; /* move the whole width of the … Read more

[Solved] Python dictionary subset

Update: for multiple dictionaries Iterate over your dictionaries and for every one of them, check if the value of ‘mesic’ is in [6,7,8] and if so, get the corresponding dictionary values: d1 = {‘stat’: u’AS’, ‘vyska’: 3.72, ‘stanice’: u’AQW00061705′, ‘mesic’: 8, ‘teplotaC’: 26.88} d2 = {‘stat’: u’AS’, ‘vyska’: 3.72, ‘stanice’: u’AQW00061705′, ‘mesic’: 1, ‘teplotaC’: 26.88} … Read more

[Solved] how does screenshot works? is it due to the hardware that supports or the software which pile ups the pixel?

Irrespective of hardware or software in computers or smartphones, there is something called a “frame buffer” that stores all of the pixels currently displayed on the screen as numbers. A screenshot is essentially a dump of all of those numbers into a file, with more numbers tacked on the front to cause a computer to … Read more