Ярлыки
- Задачки 3
- Поиск маршрутов 1
- Amazon 2
- apache 2
- Celery 3
- curl 1
- Django 9
- english 1
- fabric 1
- GLPK 1
- HTML 1
- java 6
- Job 1
- JS 1
- knockout JS 3
- LP 2
- mongo 1
- MySQL 9
- neo4j 5
- Oracle 1
- parallel 1
- PostgreSQL 3
- PsyCo 1
- PyQt 17
- Python 30
- routers finding 3
- Soft 1
- SSH 4
- supervisor 1
- SVG 2
- SVN 1
- TEX 1
- Ubuntu 15
- web 1
- wsgi 1
понедельник, 12 марта 2012 г.
суббота, 3 марта 2012 г.
problem with easy_install mysql-python
http://stackoverflow.com/questions/1511661/virtualenv-mysql-python-pip-anyone-know-how
libmysqlclient-dev можно установить из ubuntu software center
libmysqlclient-dev можно установить из ubuntu software center
psyco.bind
psyco.bind делаю для каждой функции длявсехсразупочему−тонеработает:
psyco.bindmySolve.startSolve
result=mySolve.startSolvexArray knockout - Single page application
<script src="/scripts/lib/sammy.js" type="text/javascript" ></script>
<!-- Folders -->
<ul class="folders" data-bind="foreach: folders" >
<li data-bind="text: $data,
css: { selected: data==root.chosenFolderId },
click: $root.goToFolder"></li>
</ul>
<!-- Mails grid -->
<table class="mails" data-bind= "with: chosenFolderData">
<thead><tr><th>From</th><th>To </th><th>Subject</th><th>Date </th></tr></thead>
<tbody data-bind="foreach: mails">
<tr data-bind="click: $root.goToMail">
<td data-bind="text: from"></td>
<td data-bind="text: to"></td>
<td data-bind="text: subject"></td>
<td data-bind="text: date"></td>
</tr>
</tbody>
</table>
<!-- Chosen mail -->
<div class="viewMail" data-bind ="with: chosenMailData">
<div class="mailInfo">
<h1 data-bind="text: subject"></h1>
<p><label>From</label>: <span data-bind="text: from"></span></p>
<p><label>To</label>: <spandata-bind ="text: to"></span></p>
<p><label>Date</label>: <span data-bind="text: date"></span></p>
</div>
<p class="message" data-bind= "html: messageContent" />
</div>
function WebmailViewModel() {
// Data
var self = this;
self.folders = ['Inbox', 'Archive' , 'Sent', 'Spam'];
self.chosenFolderId = ko.observable ();
self.chosenFolderData = ko.observable ();
self.chosenMailData = ko.observable ();
// Behaviours
self.goToFolder = function(folder ) { location.hash = folder };
self.goToMail = function(mail ) { location.hash = mail.folder + '/' + mail.id };
// Client-side routes
Sammy(function() {
this.get('#:folder', function () {
self.chosenFolderId(this.params .folder);
self.chosenMailData(null);
$.get("/mail", { folder: this .params.folder }, self.chosenFolderData );
});
this.get('#:folder/:mailId', function() {
self.chosenFolderId(this.params .folder);
self.chosenFolderData(null);
$.get("/mail", { mailId: this .params.mailId }, self.chosenMailData );
});
this.get('', function() { this .app.runRoute('get', '#Inbox' ) });
}).run();
};
ko.applyBindings(new WebmailViewModel ());
<!-- Folders -->
<ul class="folders" data-bind=
<li data-bind="text: $data,
css: { selected: data==root.chosenFolderId },
click: $root.goToFolder"></li>
</ul>
<!-- Mails grid -->
<table class="mails" data-bind
<thead><tr><th>From</th><th>
<tbody data-bind="foreach: mails">
<tr data-bind="click: $root.goToMail">
<td data-bind="text: from"></td>
<td data-bind="text: to"></td>
<td data-bind="text: subject"></td>
<td data-bind="text: date"></td>
</tr>
</tbody>
</table>
<!-- Chosen mail -->
<div class="viewMail" data-
<div class="mailInfo">
<h1 data-bind="text: subject"></h1>
<p><label>From</label>: <spa
<p><label>To</label>: <span
<p><label>Date</label>: <spa
</div>
<p class="message" data-bind
</div>
// Data
var self = this;
self.folders = ['Inbox', '
self.chosenFolderId = ko.obs
self.chosenFolderData = ko.o
self.chosenMailData = ko.obs
// Behaviours
self.goToFolder = function(f
self.goToMail = function(mai
// Client-side routes
Sammy(function() {
this.get('#:folder', functio
self.chosenFolderId(this.par
self.chosenMailData(null);
$.get("/mail", { folder: thi
});
this.get('#:folder/:mailId',
self.chosenFolderId(this.par
self.chosenFolderData(null);
$.get("/mail", { mailId: thi
});
this.get('', function() { th
}).run();
};
ko.applyBindings(new WebmailVi
knockout - working with Lists and Collections
<h2>Your seat reservations (<span data-bind="text: seats.length"></span>)</h2>
<h3 data-bind="visible: totalSurcharge > 0 ">
Total surcharge: $<span data-bind="text: totalSurcharge.toFixed2"></ span>
</h3>
<table>
<thead><tr>
<th>Passenger name</th><th>Meal</th><th>Surcharge </th><th></th>
</tr></thead>
<!-- Todo: Generate table body -->
<tbody data-bind="foreach: seats">
<tr>
<td><input data-bind="value: name" /></td>
<td><select data-bind="options: $root.availableMeals, value: meal, optionsText: 'mealName'" ></select></td>
<!--<td data-bind="text: name"></td>
<td data-bind="text: meal.mealName"></td>
<td data-bind="text: meal.price"></td>-->
<td data-bind="text: formattedPrice"></td>
<td><a href="#" data-bind="click: $root.removeSeat" >Remove</a></td >
</tr>
<tr><button data-bind="click: addSeat, enable: seats.length < 5" >Reserve another set</button></tr>
</tbody>
</table>
// Class to represent a row in the seat reservations grid
function SeatReservation(name, initialMeal) {
var self = this;
self.name = name;
self.meal = ko.observable(initialMeal );
self.formattedPrice = ko.computed (function() {
var price = self.meal().price ;
return price ? "$" + price.toFixed (2) : "None";
});
}
// Overall viewmodel for this screen, along with initial state
function ReservationsViewModel( ) {
var self = this;
// Non-editable catalog data - would come from the server
self.availableMeals = [
{ mealName: "Standard sandwich", price: 0 },
{ mealName: "Premium lobster", price: 34.95 },
{ mealName: "Ultimate wholezebra", price: 290 }
];
// Editable data
self.seats = ko.observableArray ([
new SeatReservation("Steve", self.availableMeals[0]),
new SeatReservation("Bert",self .availableMeals[0])
]);
// Operations
self.addSeat = function() {
self.seats.push(new SeatReservation ("", self.availableMeals [0]));
};
self.removeSeat = function(seat ) {
self.seats.remove(seat);
};
//Total price
self.totalSurcharge = ko.computed (function() {
var total = 0;
for (var i = 0; i < self.seats ().length; i++) {
total += self.seats()[i].meal ().price
};
return total;
});
}
ko.applyBindings(new ReservationsViewModel ());
<h3 data-bind="visible: totalSurcharge > 0 ">
Total surcharge: $<span data-bind="text: totalSurcharge.toFixed2"><
</h3>
<table>
<thead><tr>
<th>Passenger name</th><th>Meal</th><th>Surc
</tr></thead>
<!-- Todo: Generate table body -->
<tbody data-bind="foreach: seats">
<tr>
<td><input data-bind="value: name" /></td>
<td><select data-bind="
<!--<td data-bind="text: name"></td>
<td data-bind="text: meal.mealName"></td>
<td data-bind="text: meal.price"></td>-->
<td data-bind="text: formattedPrice"></td>
<td><a href="#" data-bind="
</tr>
<tr><button data-bind="
</tbody>
</table>
function SeatReservation(name,
var self = this;
self.name = name;
self.meal = ko.observable(in
self.formattedPrice = ko.com
var price = self.meal().pric
return price ? "$" + price.t
});
}
// Overall viewmodel for this screen, along with initial state
function ReservationsViewModel
var self = this;
// Non-editable catalog data - would come from the server
self.availableMeals = [
{ mealName: "Standard sandwich", price: 0 },
{ mealName: "Premium lobster", price: 34.95 },
{ mealName: "Ultimate wholezebra", price: 290 }
];
// Editable data
self.seats = ko.observableAr
new SeatReservation("Steve",
new SeatReservation("Bert",
]);
// Operations
self.addSeat = function() {
self.seats.push(new SeatRese
};
self.removeSeat = function(s
self.seats.remove(seat);
};
//Total price
self.totalSurcharge = ko.com
var total = 0;
for (var i = 0; i < self.sea
total += self.seats()[i].mea
};
return total;
});
}
ko.applyBindings(new Reservati
Подписаться на:
Сообщения Atom