Quantcast
Channel: User krock - Stack Overflow
Browsing index pages (45 articles)
↧

Answer by krock for What is the meaning of ord in ord() function in Python?

From the python docs for ord()Given a string representing one Unicode character, return an integer representing the Unicode code point of that character... This is the inverse of chr().So ord() will...

View Article


Answer by krock for Explain regular expression in Python

For the regular expression [^aeiouAEIOU]y[^aeiouAEIOU] we can break it down into:[^aeiouAEIOU] - not a vowely - the letter 'y'[^aeiouAEIOU] - not a vowelSpecifically, [aeiou] would be a set of all...

View Article


Answer by krock for How do i get the value of an html dropped item in Python?

open up the browser inspection and look at network and you should see what you're posting in the network tab.Forms will post your <input> fields but I can't see any of those in your html code....

View Article

Answer by krock for How to ping several IP addresses without using the same...

I think you've answered your own question by saying you need 'to iterate'. You should put the ip addresses in a list and iterate over them:ip_addressses = [.....]for ip in ip_addresses:...

View Article

Answer by krock for What is the "volatile" keyword used for?

The volatile keyword has different meanings in both Java and C#.JavaFrom the Java Language Spec :A field may be declared volatile, in which case the Java memory model ensures that all threads see a...

View Article


Answer by krock for How to exclude older versions of maven dependency and use...

There may be incompatible differences between the version of a library that a dependency requires and the one you want to use. If you are happy to take this risk, you can use maven exclusions to ignore...

View Article

Image may be NSFW.
Clik here to view.

Answer by krock for Generating getters/setters in Java (again)

That sounds like a lot of work just to generate getter and setter methods. Why not just use eclipses getter and setter generator:(source: eclipse-blog.org)

View Article

Image may be NSFW.
Clik here to view.

Answer by krock for Any freeware or open source tool to populate database...

With Jailer you can export data to an SQL script which can traverse foreign key constraints to include all data needed to maintain referential integrity.Here is a screenshot from the Jailer website...

View Article


Image may be NSFW.
Clik here to view.

Answer by krock for C++ corrupt my thinking, how to trust auto garbage...

Turn garbage collection logging on and view the results in GCViewer. This will show you how memory in your app is performing and if enough memory being cleaned up when the garbage collector...

View Article


Answer by krock for Java arithmetic int vs. long

When mixing types the int is automatically widened to a long and then the two longs are added to produce the result. The Java Language Specification explains the process for operations containing...

View Article

Answer by krock for How can a test 'dirty' a spring application context?

Each JUnit test method is assumed to be isolated, that is does not have any side effects that could cause another test method to behave differently. This can be achieved by modifying the state of beans...

View Article

Answer by krock for Finding Palindromes in Sentences Using Java

To check if a string is a palindrome we need to compare the word reversed and see if they are the same:boolean isPalindrome = word.equals(new StringBuilder(word).reverse().toString());Now that you can...

View Article

Answer by krock for Javascript: I am having trouble ordering a random string...

You can convert your string into an Array (using split()) and use sort(). Then finally join() your array back into a string:str.split("").sort().join("");

View Article


Answer by krock for Printing element in array python problems

First of all, change xcoords so that it isn't a list inside a list:xcoords = range(2, 31)We don't need to iterate over a list using an index into the list using len(xcoords). In python we can simply...

View Article

Answer by krock for Python: Better way to compare two lists?

You can convert one of the lists to a set and use set.intersection:if not set(List_s).intersection(List_big): print('no common items between lists')Note that the elements in both lists must be hashable.

View Article


Answer by krock for Find the position of the longest repeated letter

A quick way of achieving this is to use a regex to match repeating characters with (.)(\1+). Then we loop over all those results using a generator comprehension and find the max according to the length...

View Article

Answer by krock for Replace final comma in a string with '&' - Ruby

You can do this using capturing groups around the last comma:>> "one, two, three, four".gsub(/(.*),(.*)/, '\1 &\2')=> "one, two, three & four"These groups will match around the last ,...

View Article


Answer by krock for Can't run and debug groovy tests under intellij idea

Intellij can automatically add the groovy source as a source directory based on your pom. Add build-helper-maven-plugin config to your maven pom under plugins specifying ${basedir}/src/test/groovy as a...

View Article

Answer by krock for Designing backend for Mobile app?

This will depend on how your controllers are written.If your controller actions resemble REST like actions you could use spring mvc content negotiation to return html or json depending on the request.

View Article

Answer by krock for Catch exceptions in Python 3 like in C#

From the python documentation on errors you handle errors in python using try/except:>>> while True:... try:... x = int(input("Please enter a number: "))... break... except ValueError:......

View Article
Browsing index pages (45 articles)


Latest Images