Ярлыки
- Задачки (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.bind(mySolve.startSolve)
result=mySolve.startSolve(xArray) 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>Dat e</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>: <spa n data-bind="text: from"></span></p>
<p><label>To</label>: <span data-bind="text: to"></span></p>
<p><label>Date</label>: <spa n 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.obs ervable();
self.chosenFolderData = ko.o bservable();
self.chosenMailData = ko.obs ervable();
// Behaviours
self.goToFolder = function(f older) { location.hash = folde r };
self.goToMail = function(mai l) { location.hash = mail.fold er + '/' + mail.id };
// Client-side routes
Sammy(function() {
this.get('#:folder', functio n() {
self.chosenFolderId(this.par ams.folder);
self.chosenMailData(null);
$.get("/mail", { folder: thi s.params.folder }, self.chosen FolderData);
});
this.get('#:folder/:mailId', function() {
self.chosenFolderId(this.par ams.folder);
self.chosenFolderData(null);
$.get("/mail", { mailId: thi s.params.mailId }, self.chosen MailData);
});
this.get('', function() { th is.app.runRoute('get', '# Inbox') });
}).run();
};
ko.applyBindings(new WebmailVi ewModel());
<!-- 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().toFixed(2)">< /span>
</h3>
<table>
<thead><tr>
<th>Passenger name</th><th>Meal</th><th>Surc harge</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(in itialMeal);
self.formattedPrice = ko.com puted(function() {
var price = self.meal().pric e;
return price ? "$" + price.t oFixed(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 (whole zebra)", price: 290 }
];
// Editable data
self.seats = ko.observableAr ray([
new SeatReservation("Steve", self.availableMeals[0]),
new SeatReservation("Bert", self.availableMeals[0])
]);
// Operations
self.addSeat = function() {
self.seats.push(new SeatRese rvation("", self.availableMeal s[0]));
};
self.removeSeat = function(s eat) {
self.seats.remove(seat);
};
//Total price
self.totalSurcharge = ko.com puted(function() {
var total = 0;
for (var i = 0; i < self.sea ts().length; i++) {
total += self.seats()[i].mea l().price
};
return total;
});
}
ko.applyBindings(new Reservati onsViewModel());
<h3 data-bind="visible: totalSurcharge() > 0 ">
Total surcharge: $<span data-bind="text: totalSurcharge().toFixed(2)"><
</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 (whole zebra)", 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)