Sunday, 1 September 2013

Using HTML5 and CSS display 2 images level with each other, and each with a list below

Using HTML5 and CSS display 2 images level with each other, and each with
a list below

I'm new to CSS. I want to code a page in HTML5 that has 2 rather large
images of equal size and level with each other and with space between
them. I also want a left-margin between the left image and the left edge
of the page.
Directly below each image there will be an unnumbered list of 6 or so
items. Would someone be so kind as to draft the code for this? I know one
way to use CSS for spacing the images:
img { margin-right: 38px; margin-left: 50px; }
But what to do about the lists?
Thanks

Saturday, 31 August 2013

python thread weird behavior

python thread weird behavior

I have a timer function which I am calling it in another function like this
def f(self):
while(True):
print "hello"
time.sleep(5)
def execute(self):
t = threading.Timer(5,self.f)
t.start()
command = ''
while command != 'exit':
command = raw_input()
if command == 'exit':
t.cancel()
Even if after entering "exit" command, the function is printing "hello" I
am not able to figure out Whats wrong with the code

Import Excel data to Sql in Asp.Net

Import Excel data to Sql in Asp.Net

I Have imported excel data to the sql server in ASP.NET. what i got the
Problem is it upload data upto 100 row withn a minute bt after 100 of row
of excel data(even the 101) it will not upload... it gives error like
Timeout experied. The timeout Period piror to obtaning a connection from
the pool. this may occured because all the pooled connections were in use
and max pool size was reached

How to run razor webapp on Windows XP

How to run razor webapp on Windows XP

I need to run a .net 4.0 razor asp.net app on Windows XP, is this possible
with IIS6 or do I need IIS7?

How to alphabetically sort strings?

How to alphabetically sort strings?

I have been trying to use this c++ program to sort 5 names alphabetically:
#include <iostream>
#include <cstring>
#include <conio.h>
using namespace std;
int main()
{
char names[5][100];
int x,y,z;
char exchange[100];
cout << "Enter five names...\n";
for(x=1;x<=5;x++)
{
cout << x << ". ";
cin >> names[x-1];
}
getch();
for(x=0;x<=5-2;x++)
{
for(y=0;y<=5-2;y++)
{
for(z=0;z<=99;z++)
{
if(int(names[y][z])>int(names[y+1][z]))
{
strcpy(exchange,names[y]);
strcpy(names[y],names[y+1]);
strcpy(names[y+1],exchange);
break;
}
}
}
}
for(x=0;x<=5-1;x++)
cout << names[x];
return 0;
}
If I enter Earl, Don, Chris, Bill, and Andy respectively, I get this:
AndyEarlDonChrisBill
Could someone please tell me whats wrong with my program?

What is the RFC 822 format for the email addresses?

What is the RFC 822 format for the email addresses?

I have to make a regular expression for the email addresses (RFC 822) and
I want to know which characters are allowed in the local part and in the
domain.
T found this http://tools.ietf.org/html/rfc822#section-6.1 but I don't see
that it says which are the valid characters.

Form for ManyToMany relationship on Detail page

Form for ManyToMany relationship on Detail page

I have the following (simplified) models:
class Idea(models.Model):
tagline = models.TextField()
class Lot(models.Model):
address = models.CharField()
...other fields...
ideas = models.ManyToManyField(Idea)
I want to display a Lot detail page that lists all the info about the lot,
including ideas associated with that lot. This is simple to do.
However, in addition, I want the user to be able to add a new idea for
that lot from this page. Upon submission, the user should return to the
Lot detail page with their new idea now part of the list.
I've tried inline formsets for the new idea, but that only shows up as a
drop down of existing ideas, it does not allow for a new idea to be
created. Plus, it seems overkill as I only need the user to be able to add
a new idea, not edit/remove ideas already submitted. And I also don't need
them to be able to edit the other lot information, only add a related
idea.
I know there is probably a simple way to achieve this, but I'm a bit stuck
at the moment.
Any help would be appreciated.
Thanks!