Onkeydown event on an ASPX page

I am trying to add a onKeyDown event to an aspx page in .NET . Since I don't have access to the body tag I tried doing something like this: if (window.addEventListener) { window.addEventListener('onkeydown', checkEnter(event), false); } else { window

Convert datetime to sql server

How can i convert the datetime format below 2010-10-25 11:13:36.700 into 25-Oct-2010 or 2010-10-25 00:00:00.000To get "25-Oct-2010" Assuming the value is supplied as a string, not a DATETIME data type: SELECT REPLACE(CONVERT(VARCHAR, CAST('2010-

Multiple WHERE clause for the same column

I wrote the query below, and it returns the data I need. However, I can't help but think there's a better way to write it. What I need is to find all the unique rows in Table1 that have prices greater than the price a specified vendor has in the cate

Sizeof (bool) g ++ vs vc ++

Possible Duplicate: Is sizeof(bool) implementation defined in C++? Im writing code that is compiled in vc++ with a g++ lib (libpng) and need to know if bool is the same size and bits in g++ and vc++. All I know is false is all 0's and that sizeof(boo

2 tuple wxpython

I've been working on a menu interface where I'm hoping to use a background and then custom images as buttons, however can't get them to display import wx import pygame import os class menu(wx.Frame): def __init__(self,parent,id): wx.Frame.__init__(se

Non-consecutive list of cells in a function (row)

This may be a simple "It's not possible" answer but I want to make sure. I am using LibreOffice at the moment but if it is possible in Excel I can switch. I have a spreadsheet with a few tables, each with results of the same test on different da

The value 10 is reset to 1

I have this problem, I store a number in a database field. After a while I check if a value exist and if it does I take the number and add 1 this works fine up until 10, when I add a number to 10 it gets reset to 2 as if the zero is not counted for.

Force an overall resolution in wx.Python in full screen

I am making a program in wx.Python that is set to be in full screen, but I have an unresolved question about screen resolution. I know how to detect the size of a window, and set the positions of items proportionally. And my program is currently doin

Wiring document. Event: IE behaving differently

I am used to typing: $(function(){}); syntax to wire events and do other stuff in document readyevent. But I noticed that IE8 was giving problems with calling functions from some included js files. I would not not have been able to crack it if the pa

Why can I convert an int in a secure but not thrown on an int?

Why does this work: ComboBox cb = sender as ComboBox; int validSelection = Convert.ToInt32(cb.Tag); if (cb.SelectedIndex != validSelection) { cb.SelectedIndex = validSelection; } ...but this: ComboBox cb = sender as ComboBox; int validSelection = (in

String String String C ++ to int

I'm writing a program that converts a binary string to decimal. I wanted to validate my output before I get really started on this method. I have the following code: int get_val() { int sum =0; for(int num_bits = size; num_bits>0; num_bits--) { print

Kruskal-Wallis test with details on pairwise comparisons

The standard stats::kruskal.test module allows to calculate the kruskal-wallis test on a dataset: >>> data(diamonds) >>> kruskal.test(price~carat, data=diamonds) Kruskal-Wallis rank sum test data: price by carat by color Kruskal-Wallis c

Extending the Global TypeScript Object in node.js

I have a node.js app that attaches some config information to the global object: global.myConfig = { a: 1, b: 2 } The TypeScript compiler doesn't like this because the Global type has no object named myConfig: TS2339: Property 'myConfig' does not exi

Rails 4.0.1 on Heroku, can not create database

I can't get rake db:migrate to run on my rails 4.0.1 app on Heroku. I'm guessing that I don't have postgres configured properly... but reading the docs on heroku hasn't really helped and I'm not sure what to do. I don't know too much about heroku or

What is the best way to download and store images on the site?

I have no idea how the big websites save the pictures on their servers. Could any one tell me how do they save the pictures that are uploaded by the users in their database? I was thinking, maybe they would just save the file(the picture) in some pat