[Solved] The Possibility of a “True” Quiz Generator [closed]

Is an automatic quiz generator possible? It depends on what you call automatic, and what you consider a successful level of functionality. Something is definitely possible. Is it that automatic, or do you have to enter your own questions and correct answers? Can it observe text syntax so that it can create questions based on … Read more

[Solved] How to secure javascript code from being run on other domain (stolen) ? need more ideas

No matter how complex you make your code, it can always be read, if necessary with abstract interpretation, i.e. automatically capturing the essence of your code. Code without knowledge of internals, variable names (I assume you’re already using minimization, for example with the YUI compressor), documentation, support, and generalization is worthless for anyone else. If … Read more

[Solved] REGEX – Get specific values [closed]

If this is an exercise in using Regular Expressions, so you really want to use a Regular Expression to solve it, you can do something like this: regex = /^(PL|PH|MH|M)$/ choices = [“PL”, “PH”, “M”, “MH”, “other”, “invalid”, “value”] index = Math.floor(Math.random() * choices.length) input = choices[index] console.log(“Testing”, ‘”‘+input+'”‘) x = input.match(regex) if (x) { … Read more

[Solved] Difference between getElementById and createElement in javascript? [closed]

The main difference is that getElementById will get an element from the DOM by it’s ID attribute, and createElement will create an entirely new DOM element. Let’s say you had a page with the following HTML: <!doctype html> <html> <head> </head> <body> <div>Hello, World!</div> <div id=”message”>What a nice day!</div> </body> </html> And then you had … Read more

[Solved] Python – ValueError: invalid literal for int() with base 10: ‘hello’

The following solution worked. Instead of using int(x) , we need to use len(x.encode(‘utf-8′)) so the final code is updated as import io with io.open(r’C:\Python\Data\somefile.txt’,’r+’) as fp: bytecolumn = (line.rsplit(None,1)[1] for line in fp) bytes = ( len(x.encode(‘utf-8’)) for x in bytecolumn if x != ‘-‘) print(‘Total’, sum(bytes)) solved Python – ValueError: invalid literal for … Read more

[Solved] Remove empty properties from object in list in C#

You cannot achieve this if you want to stay with your custom type. Reason is that if you define a type with some properties then when initializing that type the properties are there, whether you assign to them a value or not. However using anonymous types and dynamic you can: var result = data.Select(item => … Read more

[Solved] Is it important to declare [duplicate]

Simple Google will solve more than 95% of your early questions into coding 😉 https://en.wikipedia.org/wiki/Document_type_declaration#HTML_4.01_DTDs and https://en.wikipedia.org/wiki/Document_type_definition The short summary: HTML is a subset of XML (eXtensible Markup Language) with specified tags. In XML you can use a wide range of custom tags (called elements) like <price value=”10″ currency=”euro”></price> So to bring order and consistency … Read more

[Solved] Checking for elements in list

The Main approach for checking elements of a list in a string is : s=””‘<a href=”https://ertfwetwer” target=”_blank”>[Nerve Center]</a>”’ my_list=[‘href’,’a’] def checker(mylist, my_string) new = list() for i in mylist: if i in my_string: # if elements is in string (you can check only special elements ) print i ,’is in string’ new.append(i) #storing result to … Read more

[Solved] C program goes into infinite loop with scanf [duplicate]

Check return value of scanf and clear input buffer in case of illegal input. Like this: #include <stdio.h> #include <stdbool.h> int main(void) { float sales, commission, earnings; int state; while(true) { printf( “Enter sales in dollars ( -1 to end ): ” ); if((state = scanf(“%f”, &sales )) != 1){ if(state == EOF) return 0; … Read more

[Solved] How to format a date from yyyy-MM-dd to yyMMdd [closed]

Try this String s; DateFormat formatter; formatter = new SimpleDateFormat(“yyyy-MM-dd”); Date date1 = formatter.parse(“2013-07-17”); formatter = new SimpleDateFormat(“yyMMdd”); s = formatter.format(date1); System.out.println(s); 0 solved How to format a date from yyyy-MM-dd to yyMMdd [closed]