This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from flaskext import wtf | |
| from flaskext.wtf import validators | |
| class PostForm(wtf.Form): | |
| self.languages = ['Java','Python','C','C++','Perl','HTML'] | |
| langTuples = [ (str(i) ,self.languages[i])for i in range(0,len(self.languages)) ] | |
| name = wtf.TextField('name', validators=[validators.Required()],) | |
| code = wtf.TextAreaField('code', validators=[validators.Required()]) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include<iostream.h> | |
| #include<fstream.h> | |
| #include<string.h> | |
| #include<stdio.h> | |
| struct details | |
| { | |
| char *category; | |
| char *name; | |
| char *phone; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [error] /Users/abhishekk/flipkart/platform/star-command/src/main/scala/flipkart/platform/starcommand/model/Models.scala:34: inferred type arguments [flipkart.platform.starcommand.model.Host,flipkart.platform.starcommand.model.Tag,Nothing] do not conform to method manyToManyRelation's type parameter bounds [L <: org.squeryl.KeyedEntity[_],R <: org.squeryl.KeyedEntity[_],A <: org.squeryl.KeyedEntity[_]] | |
| [error] val hostTags = manyToManyRelation(hosts, tags).via[HostTag]((h, t, ht) => (ht.tagId == t.id, h.id == ht.hostId)) | |
| [error] ^ | |
| [error] one error found |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def _allHostNames(template: SimpleJdbcTemplate): List[String] = { | |
| val dbResult = template.queryForList("select name from host") | |
| dbResult.flatMap(db => db.getOrElse("name", "").toString) | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def tagJson(tag: String, json: JValue): String = { | |
| val jsonMap = json.asInstanceOf[JObject].values | |
| val hmm = jsonMap.collect { | |
| case (key: String, value) => (tag + "." + key, value) | |
| } | |
| implicit val formats = net.liftweb.json.DefaultFormats | |
| compact(JsonAST.render(decompose(hmm))) | |
| } | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| object Host { | |
| def configForHost(host: String): String = { | |
| val resultMap = template.queryForMap("SELECT config FROM host WHERE NAME = ?", host) | |
| resultMap.get("config").toString | |
| } | |
| } | |
| ApiServlet { | |
| get("/config/host/:host") { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function [J, grad] = costFunction(theta, X, y) | |
| %COSTFUNCTION Compute cost and gradient for logistic regression | |
| % J = COSTFUNCTION(theta, X, y) computes the cost of using theta as the | |
| % parameter for logistic regression and the gradient of the cost | |
| % w.r.t. to the parameters. | |
| % Initialize some useful values | |
| m = length(y); % number of training examples | |
| % You need to return the following variables correctly |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @app.route('/tag/<tag>') | |
| def show_tag(tag): | |
| q = Query(CONFIG_ROOT) | |
| tag_config = q.tag_config(tag, as_yaml=True) | |
| hosts = q.hosts_by_tag(tag) | |
| details = [(h, url_for('show_host', host=h)) for h in hosts] | |
| return render_template("item.html", conf=tag_config, details=details) | |
| @app.route('/api/alltags') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <build> | |
| <plugins> | |
| <plugin> | |
| <artifactId>maven-assembly-plugin</artifactId> | |
| <version>2.2</version> | |
| <configuration> | |
| <finalName>${project.name}</finalName> | |
| <appendAssemblyId>false</appendAssemblyId> | |
| <outputDirectory>${project.build.directory}/package</outputDirectory> |