I wonder if this possible with Zend_Db, but I am looking for something like SQL query logging similar to how Hibernate does it, where it shows you what SQL it generates in the log file.
Suppose I have a datetime column in MySQL.
How do I select all that have a datetime within 2500 seconds of the current datetime?
SELECT ALL where current_datetime - that_datetime < 2500 ...
sorry, im sure this is asked a bunch, but i couldnt find it.
in myModule.py:
from myModule.subModule import myClass
i am working on myClass, and want to stay in my ipython session and test it. reload(myModule) doesnt re-compile myClass.
how can i do this?
I have noticed that the quality of the images produced by the JPEGEncoder does not match that of other encoders available (i.e. php's built in image compression functions from the gd library)
Any explanation ? or hints/workarounds for improving the quality of compressed images by JPEGEncoder ??
d3 = dict(d1, **d2)
I understand that this merges the dictionary. But, is it unique? What if d1 has the same key as d2 but different value? I would like d1 and d2 to be merged, but d1 has priority if there is duplicate key.
I know there are many settings for a language for a table and a database.
I already created the database. I believe when I created it, it was default/LATIN. I want to change everything-I mean...both the table and the database, to UTF-8.
How can I do that? thanks.
Is there a simple :) and efficient way or reading very large number of rows sequentially using Zend_Db?
Basically I need to process entire table, row by row. Table is large, primary key sequence is not guaranteed(i.e. not an autoincrement, but is UNSIGNED INT).
What's the best way to approach this?
Environment: PHP 5.2, Zend Framework 1.10, MySQL 5.1
I display a best-sell list in front-end,Now I also want to show the QTY that how many already sell for this product,How do I get the QTY ?
And if the product is a "Configurable Product",How do I get the QTY ?
How do I use JQuery to get number from the drop down select?
<select aria-invalid="false" id="RatePercent" class="wpcf7-form-control wpcf7-select ratePercent" name="RatePercent">
<option value="">---</option>
<option value="Floating-6.5%">Floating-6.5%</option>
<option value="6 Months-5.65%">6 Months-5.65%</option>
<option value="1 Year-5.85%">1 Year-5.85%</option>
<option value="18 Months-5.99%">18 Months-5.99%</option>
<option value="2 Years-6.19%">2 Years-6.19%</option>
<option value="3 Years-6.85%">3 Years-6.85%</option>
<option value="4 Years-7.19%">4 Years-7.19%</option>
<option value="5 Years-7.40%">5 Years-7.40%</option>
</select>
If you choose 1 Year-5.85%, it returns '5.85', instead of '1 Year-5.85%'?
Hello, could some one recommend a way to get page name from a url using JavaScript?
For instance if I have http://www.cnn.com/news/1234/news.html?a=1&b=2&c=3
I just need to get "news.html" string
Thanks!
<td valign="center" colspan="2">
<a href="" class="table_desc" >
<span class="desc_info_butt"></span>
</a>
text here
</td>
.desc_info_butt{
background:url(Description_Button.png) top left no-repeat;
height:16px;
width:16px;
display:block;
}
For some reason, the image and text appear on two different lines!~
Hello there,
I'm working with a page that has several links that contain the same href text, and I need to select the second anchor element on the page that contains said href text. Here's a simplified version of the link structure of the page:
<a href="same/link/to/stuff/">same link</a>
<a href="same/link/to/stuff/">same link</a>
How do I fashion my selector so that it only selects the second anchor in the above example?
Currently I'm trying:
$('a[href=same/link/to/stuff/] :eq(1)')
but it is not working.
Thanks!!
This is a follow-up to my previous question. I've simplified things as much as I could, and it still doesn't work! Although the good thing I got around using getGraphics().
A detailed explanation on what goes wrong here is massively appreciated. My suspicion is that something's wrong with the the way I used addMouseListener() method here.
import java.awt.Color;
import java.awt.Graphics;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import javax.swing.JFrame;
import javax.swing.JPanel;
public class MainClass1{
private static PaintClass22 inst2 = new PaintClass22();
public static void main(String args[]){
JFrame frame1 = new JFrame();
frame1.add(inst2);
frame1.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame1.setTitle("NewPaintToolbox");
frame1.setSize(200, 200);
frame1.setLocationRelativeTo(null);
frame1.setVisible(true);
}
}
class PaintClass11 extends MouseAdapter{
int xvar;
int yvar;
static PaintClass22 inst1 = new PaintClass22();
public PaintClass11(){
inst1.addMouseListener(this);
inst1.addMouseMotionListener(this);
}
@Override
public void mouseClicked(MouseEvent arg0) {
// TODO Auto-generated method stub
xvar = arg0.getX();
yvar = arg0.getY();
inst1.return_paint(xvar, yvar);
}
}
class PaintClass22 extends JPanel{
private static int varx;
private static int vary;
public void return_paint(int input1, int input2){
varx = input1;
vary = input2;
repaint(varx,vary,10,10);
}
public void paintComponent(Graphics g){
super.paintComponents(g);
g.setColor(Color.RED);
g.fillRect(varx, vary, 10, 10);
}
}
class MyController(BaseController):
def index(self):
# Return a rendered template
#return render('/test.mako')
# or, return a response
return ''
Why does the function "index" have "self"?
I got this code from Pylons controller
I have a method that effectively takes a string. However, there is a very limited subset of strings I want to use. I was thinking of typedef'ing std::string as some class, and call the functions explicit. I'm not sure that would work, however. Ideas?
i have tables
profiles (id, name, deleted)
categories (id, name, deleted)
profiles_categories (id, profile_id, category_id, , deleted)
I have wrong query
SELECT p.id, p.name CONCAT_WS(', ', c.name) AS keywords_categories
FROM profiles p
LEFT JOIN profiles_categories pc ON p.id = pc.profile_id
LEFT JOIN categories c ON pc.id = c.id
WHERE p.deleted = FALSE
So, i want have result with all profiles with concan categories.name.
Thanks
Basically, what I want to do is to be notified whenever a specific method has been called. I was hoping I could accomplish this using Reflection, but my attempts haven't gotten me anywhere yet, so I'm hoping that perhaps somebody else with the same need has accomplished this before and can enlighten me.
I figured using MethodInfo was the way to go, but like I said, I found nothing there that could help me accomplish what I wanted to do. Any suggestions, hints or solutions would be greatly appreciated.
in active_admin partials created a form input:
<%= semantic_nested_form_for @item, :url => admin_items_path(@item) do |f| %>
<fieldset class="inputs">
<ol>
<%= f.input :category %></br>
<%= f.input :title %>
<%= f.input :photo1 %>
<%= f.input :photo2 %>
</ol>
</fieldset>
<%= f.fields_for :ItemColors do |i| %>
<fieldset class="inputs">
<ol>
<%= i.input :DetailColor %>
<%= i.input :size, :input_html => { :size => "10" } %>
<%= i.link_to_remove "remove" %>
</ol>
</fieldset>
<% end %>
<%= f.link_to_add "add", :ItemColors %>
<%= f.actions %>
<% end %>
to create a new Item okay creates and throws On the New Item, but if I do update an existing item is routed to an error occurs while such a path exists:
No route matches [PUT] "/admin/items.150" #150 is item_id
rake routes:
batch_action_admin_items POST /admin/items/batch_action(.:format) admin/items#batch_action
admin_items GET /admin/items(.:format) admin/items#index
POST /admin/items(.:format) admin/items#create
new_admin_item GET /admin/items/new(.:format) admin/items#new
edit_admin_item GET /admin/items/:id/edit(.:format) admin/items#edit
admin_item GET /admin/items/:id(.:format) admin/items#show
PUT /admin/items/:id(.:format) admin/items#update
DELETE /admin/items/:id(.:format) admin/items#destroy
help to solve this problem
UPD
I found the error, but not yet understood how to fix it
the upgrade is a request:
PUT "/admin/items"
but should:
PUT "/admin/items/some_id"
any ideas?
i have a working bing Image search api with jsonp datatype. It's working with no problems. When i load the image search script in a Jquery UI dialog, it display properly and i'm able to search and see the results in the dialog() box. But if i close the dialog() and open it again, now if i search no results show. Looking at console.log, i do confirm the jason data is recieved, but for some reason it's not appending to the result div, so i see no result on the screen. This onyl happens if i close the dialog and open it again. If i refresh refresh the page and open the dialog again then search results are displayed.
This is what i'm using to append the results.
$.each(data.SearchResponse.Image.Results,
function(i, item) {
console.log(item.Thumbnail.Url);
$("#Results").append("<li><img style='width:100px; height:75px;' src='" + item.Thumbnail.Url + "'/></li>");
});