syntax Questions
24
Using MySQL I can run the query:
SHOW CREATE TABLE MyTable;
And it will return the create table statement for the specificed table. This is useful if you have a table already created, and want t...
42
Solved
I've recently started maintaining someone else's JavaScript code. I'm fixing bugs, adding features and also trying to tidy up the code and make it more consistent.
The previous developer used two w...
Footstool asked 3/12, 2008 at 11:31
4
Solved
I have defined a Java function:
static <T> List<T> createEmptyList() {
return new ArrayList<T>();
}
One way to call it is like so:
List<Integer> myList = createEmptyLis...
32
Solved
Recently, I ran some of my JavaScript code through Crockford's JSLint, and it gave the following error:
Problem at line 1 character 1: Missing "use strict" statement.
Doing some searchi...
Kinin asked 26/8, 2009 at 16:10
2
Solved
As I've seen from the examples in PlantUML you can have certain graphical objects with text in it like
folder folder1 [
Here you can have some explanation with
====
--Markdown-- //formatting// ...
34
I find it more convenient to access dict keys as obj.foo instead of obj['foo'], so I wrote this snippet:
class AttributeDict(dict):
def __getattr__(self, attr):
return self[attr]
def __setattr_...
Roughdry asked 13/2, 2011 at 14:23
5
Solved
In code like zip(*x) or f(**k), what do the * and ** respectively mean? How does Python implement that behaviour, and what are the performance implications?
See also: Expanding tuples into argumen...
Friedrick asked 27/5, 2010 at 14:10
2
Solved
How does one use arrays (representing busses) in HDL?
For example, I have the following code:
/**
* 16-bit bitwise And:
* for i = 0..15: out[i] = (a[i] and b[i])
*/
CHIP And16 {
IN a[16], b[...
Waterborne asked 21/12, 2016 at 5:0
2
Solved
Is there a more "Groovy" way to write this Groovy code:
def myVar=(System.getProperty("props") == null)?
null : System.getProperty("props")
Logic is:
If System.getProperty("props") is NULL, I...
Leigha asked 30/7, 2014 at 14:20
24
Solved
Forgive me for this is a very simple script in Bash. Here's the code:
#!/bin/bash
# june 2011
if [ $# -lt 3 -o $# -gt 3 ]; then
echo "Error... Usage: $0 host database username"
exit 0
fi
afte...
2
Solved
Most programming languages use ~ to represent a unary bitwise-not operation. Go, by contrast, uses ^:
fmt.Println(^1) // Prints -2
Why did the Go designers decide to break with convention here?
...
Hengist asked 25/3, 2016 at 2:15
16
Solved
Is there markdown syntax for the equivalent of:
Take me to <a href="#pookie">pookie</a>
...
<a name="pookie">this is pookie</a>
24
Solved
How do you write a comment in Markdown, i.e. text that is not rendered in the HTML output? I found nothing on the Markdown project.
1
Solved
C++23 allows [[...]] attributes in lambda expressions:
auto lambda = [] [[nodiscard]]
{
return 42;
};
But the grammar has place for two lists of attributes, roughly before and after the parameter...
Thurstan asked 22/12, 2023 at 14:6
3
Solved
I need to pass a instance (which will be created in this very moment) of a certain type to a method. This type offers several events which I'd like to subscribe to too, so my code looks like this:
...
Cady asked 25/7, 2014 at 8:45
6
Can anyone explain how to add syntax highlighting to a Tkinter Text widget ?
Every time the program finds a matching word, it would color that word to how I want. Such as : Color the word tkinter ...
8
Solved
I am looking for a LaTeX package that does syntax highlighting on code. For example, right now I use the verbatim block to write code:
\begin{verbatim}
<html>
<head>
<title>He...
13
Solved
How do you split multi-line string into lines?
I know this way
var result = input.Split("\n\r".ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
looks a bit ugly and loses empty lines. Is ...
24
Solved
I've heard it said that multiline lambdas can't be added in Python because they would clash syntactically with the other syntax constructs in Python. I was thinking about this on the bus today and ...
3
Solved
Can I name a custom column in the SELECT statement and reference that in the WHERE clause without duplicating code?
For example;
SELECT RIGHT(REPLICATE('0', 5) + RTRIM(SOME_ID)), 5) AS DISPLAY_ID...
Textile asked 1/4, 2010 at 17:48
18
Solved
I have been working with Java a couple of years, but up until recently I haven't run across this construct:
int count = isHere ? getHereCount(index) : getAwayCount(index);
This is probably a ver...
Villanelle asked 28/4, 2009 at 15:28
8
Solved
Consider:
<?php
define('my_const', 100);
echo <<<MYECHO
<p>The value of my_const is {my_const}.</p>
MYECHO;
?>
If I put a variable inside the braces, it prints out....
2
Solved
I am trying to learn programming through Python, so I apologize in advance if this is an absurdly simple question.
I am attempting to simplify my convoluted directory structure and utilize some o...
Syrinx asked 9/6, 2014 at 20:45
14
Solved
What is the difference between the dot (.) and the dollar sign ($)?
As I understand it, they are both syntactic sugar for not needing to use parentheses.
Elagabalus asked 2/6, 2009 at 16:6
17
Solved
I've always used single quotes when writing my HTML by hand. I work with a lot of rendered HTML which always uses double quotes. This allows me to determine if the HTML was written by hand or gener...
© 2022 - 2024 — McMap. All rights reserved.