boilerplate

“Boilerplate” code in Python?

孤街浪徒 提交于 2019-12-02 17:59:29
Google has a Python tutorial, and they describe boilerplate code as "unfortunate" and provide this example: #!/usr/bin/python # import modules used here -- sys is a very standard one import sys # Gather our code in a main() function def main(): print 'Hello there', sys.argv[1] # Command line args are in sys.argv[1], sys.argv[2] .. # sys.argv[0] is the script name itself and can be ignored # Standard boilerplate to call the main() function to begin # the program. if __name__ == '__main__': main() Now, I've heard boilerplate code being described as "seemingly repetitive code that shows up again

A good HTML skeleton

痴心易碎 提交于 2019-12-02 17:00:57
I want to start creating websites again, but I've been out of the HTML scene for a while now. I was just wondering if this is a good skeleton for a website. And if not, what should I change, add and/or remove? <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <html> <head> <rel="stylesheet" type="text/css" href="css/main.css" /> <meta http-equiv="content-type" content="text/php; charset=utf-8" /> <title>Site Template - Welcome!</title> </head> <body> <div class="Container"> <div

HTML5 Boilerplate vs. HTML5 Reset [closed]

吃可爱长大的小学妹 提交于 2019-12-02 14:11:52
Hey everyone — HTML5 Boilerplate and HTML5 Reset are two HTML, CSS, and JavaScript templates with a lot of modern best practices built-in. Their goals are largely the same: Fast, robust, modern Web development HTML5 (duh!) Cross-browser normalization (including support for IE6 and mobile browsers) Progressive enhancement and graceful degradation Performance optimizations Not a framework, but the starting point for your next project Obviously, they're very similar in function. In what ways are their implementations different (for example, perhaps IE-specific CSS fixes are achieved using

Proper autogenerate of __str__() implementation also for sqlalchemy classes?

跟風遠走 提交于 2019-12-02 11:56:49
问题 I would like to display / print my sqlalchemy classes nice and clean. In Is there a way to auto generate a __str__() implementation in python? the answer You can iterate instance attributes using vars, dir, ...:... helps in the case of simple classes. When I try to apply it to a Sqlalchemy class (like the one from Introductory Tutorial of Python’s SQLAlchemy - see below), I get - apart from the member variables also the following entry as a member variable: _sa_instance_state=<sqlalchemy.orm

Proper autogenerate of __str__() implementation also for sqlalchemy classes?

风格不统一 提交于 2019-12-02 06:32:18
I would like to display / print my sqlalchemy classes nice and clean. In Is there a way to auto generate a __str__() implementation in python? the answer You can iterate instance attributes using vars, dir, ...:... helps in the case of simple classes. When I try to apply it to a Sqlalchemy class (like the one from Introductory Tutorial of Python’s SQLAlchemy - see below), I get - apart from the member variables also the following entry as a member variable: _sa_instance_state=<sqlalchemy.orm.state.InstanceState object at 0x000000004CEBCC0> How can I avoid that this entry appears in the __str__

Short name for imported constant class fields

余生颓废 提交于 2019-12-01 23:23:24
问题 I have a java program with hundreds of configuration constants: public static final String C1="C1"; public static final String C2="C2"; Since there are so many of them, I've put them into a separate class, MyClassConstants . Now, I need to use them on MyClass : import mynamespace.MyClassConstants; myMethod( MyClassConstants.C1, MyClassConstants.C2 ); This gets very verbose very fast, so I was wondering if it was possible to somehow import the fields directly: import mynamespace

How does HTML5 Boilerplate jQuery library fallback work?

家住魔仙堡 提交于 2019-12-01 13:23:25
This is a beginner question to html5 boilerplate, and javascript in general, but I can't seem to find the answer anywhere, so here it goes... <script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script> <script>window.jQuery || document.write('<script src="js/vendor/jquery-1.10.2.min.js"><\/script>')</script> How does the second script line checks whether the google's CDN has been loaded or not? There's no if statement or anything to suggest that. I'm sorry if this sounds stupid. Any help? The || is the if statement in this case. If window.jQuery returns TRUE , then

How does HTML5 Boilerplate jQuery library fallback work?

柔情痞子 提交于 2019-12-01 11:40:16
问题 This is a beginner question to html5 boilerplate, and javascript in general, but I can't seem to find the answer anywhere, so here it goes... <script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script> <script>window.jQuery || document.write('<script src="js/vendor/jquery-1.10.2.min.js"><\/script>')</script> How does the second script line checks whether the google's CDN has been loaded or not? There's no if statement or anything to suggest that. I'm sorry if this

How do I use Paul Irish's Conditional comments in a SharePoint 2010 master page

◇◆丶佛笑我妖孽 提交于 2019-12-01 06:05:19
I want to use Paul Irish's Conditional comments from the Boilerplate HTML template: <!--[if lt IE 7 ]> <html lang="en" class="no-js ie6"> <![endif]--> <!--[if IE 7 ]> <html lang="en" class="no-js ie7"> <![endif]--> <!--[if IE 8 ]> <html lang="en" class="no-js ie8"> <![endif]--> <!--[if IE 9 ]> <html lang="en" class="no-js ie9"> <![endif]--> <!--[if (gt IE 9)|!(IE)]><!--> <html lang="en" class="no-js"> <!--<![endif]--> in a SharePoint 2010 masterpage. I have read 'conditional comments don’t always work so well in SP2010'. (not sure what that means!) The advice is to use: <SharePoint

“duplicate class” on boilerplate generation (GWTP) with maven

流过昼夜 提交于 2019-12-01 01:04:42
After using the boilerplate mechanisms of GWTP I get the error that the classes (which where generated) are already existing. The folder target/generated-sources contains "annotations" and "apt" but no "gwt". Both folders "annotations" and "apt" have the same content. my pom.xml: <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>de.s.pp</groupId> <artifactId