Skip to content

Instantly share code, notes, and snippets.

Post data ( from firebug in firefox) ---
name
oilit0001 chicken
oilit00013 -
oilit00014 1
telephone
Source
name=&telephone=&oilit0001=chicken&oilit00013=-&oilit00014=1 .
cur.execute('insert into invoice (itemId, nameOfPerson, telephone, currentDate, waitTime ) values(?,?,?,CURRENT_TIMESTAMP,?)',
[value , name, telephone, 30 ])
g.db.commit()
# now delete all used up values from the values dict
lastId = cur.lastrowid
allRows = [dict(q =row[3]) for row in cur.fetchall()]
return render_template('basant.html' , values = details, i = itemName , s =lastId , ar = allRows)
drop table if exists invoice;
drop table if exists items;
create table invoice(
id integer primary key autoincrement,
itemId varchar,
nameOfPerson text not null,
telephone integer ,
currentDateTime integer not null,
Question --- so suppose I have two tables as below. items.id is fk and references invoice.key1 which is pk . now on the server side I have collected all rows or table1 in cur1 and table2 in cur2. What I want is to print table1 and then for each pk print corresponding table2 elements . All of this on the html . how to do this .
sample result will be like --
invoice.id invoice.name invoice.telephone items.id1 items.name1 .......
items.id1 items.name2 ..........
items.id1 items.name3 ........
the sql schema
drop table if exists invoice;
drop table if exists items;
Question --- so suppose I have two tables as below. items.id is fk and references invoice.key1 which is pk . now on the server side I have collected all rows or table1 in cur1 and table2 in cur2. What I want is to print table1 and then for each pk print corresponding table2 elements . All of this on the html . how to do this .
sample result will be like --
invoice.id invoice.name invoice.telephone items.id1 items.name1 .......
items.id1 items.name2 ..........
items.id1 items.name3 ........
the sql schema
drop table if exists invoice;
drop table if exists items;
<div id="currentOrdersList">
{% for x in display %}
<div id="{{x}}" class="orderClass" float="left" order="reverse">
<li class="orderedItemsListElement">{{display[x]['name']}}</li>
<li class="orderedItemsListElement">{{display[x]['telephone']}}</li>
{% for y in display[x]['items'] %}
<li class="orderedItemsListElement">{{y['name']}} {{y['size']}} {{y['quantity']}}</li>
{% endfor %}
<input id="'c'+{{x}}" name="'c'+{{x}}" type="checkbox"
class="doneBoxes"
<!--trying to build the simplest of Json examples for pocoo. -->
<html>
<head></head>
<body>
<input tyep="text" id="test" name="test"/>
<a href=" " id="calculate">calculate</a>
<script type="text/javascript" src="/static/jquery.js"></script>
<script type="text/javascript" >
The test is as follows:
Deploy Drupal 7
Write a connector to collect all the data from http://nvd.nist.gov
Setup a cron to update the latest changes daily
Write this to MySQL
Create a user registration block, allow self registration
Create a search box for the NVD data - permit simple text search and use a levenshtian algorithm to do two things -
Find most likely matches
Display the most likely "alias" that represents multiple distinct name entries - take a look at Microsoft Office (you will see what I mean)
# Function to print the last order row of new Order
def printOrder(d):
key = d.keys()[-1]
lpr = subprocess.Popen("/usr/bin/lpr", stdin=subprocess.PIPE)
lpr.stdin.write("OrderNo"+ str(key)+"\n")
lpr.stdin.write("Name :"+ d[key]['name'] + "\n")
lpr.stdin.write("tel :"+ str(d[key]['telephone'])+"\n")
for y in d[key]['items']:
lpr.stdin.write(y['name'] + " " + y['size'] +" " + str(y['quantity']) + " " +str(y['price']) + "\n")
lpr.stdin.write("$ "+ str(d[key]['total']) + " discount" +" "+ str(d[key]['discount']) )
Mahen: ok
in eclipse
install subclipse
Mahen: svn plugin
me: ok
Mahen: its just html framework
me: I already have it I guess
Mahen: its html templating framework
we will use it
Mahen: tomcat