Saturday, 31 August 2013

model definition debug in django

model definition debug in django

my model definition is below,when I run python manage.py sql
application,it comes nothing. my application name is application. when I
change the models' content to the tutorial
https://docs.djangoproject.com/en/1.5/intro/tutorial01/ ,it comes the
right sql sentence,so it must some error in the models below,can anyone
point it out?
class Applicationinfo(models.Model):
applicationinfo_id = models.BigIntegerField(primary_key=True,
db_column='ApplicationInfo_id') # Field name made lowercase.
mainproduct = models.CharField(max_length=300,
db_column='MainProduct') # Field name made lowercase.
subproduct = models.CharField(max_length=300, db_column='SubProduct')
# Field name made lowercase.
appname = models.CharField(max_length=300, db_column='AppName') #
Field name made lowercase.
employee = models.CharField(max_length=48, db_column='Employee') #
Field name made lowercase.
employeeid = models.CharField(max_length=24, db_column='Employeeid') #
Field name made lowercase.
applicantmail = models.CharField(max_length=90,
db_column='applicantMail') # Field name made lowercase.
mailnotifytimes = models.IntegerField(db_column='MailNotifyTimes') #
Field name made lowercase.
applicantim = models.CharField(max_length=48, db_column='ApplicantIM')
# Field name made lowercase.
applicantmobilephone = models.CharField(max_length=33,
db_column='ApplicantMobilephone') # Field name made lowercase.
messagenotifytimes =
models.IntegerField(db_column='MessageNotifyTimes') # Field name made
lowercase.
applicantdpt = models.CharField(max_length=300,
db_column='ApplicantDPT') # Field name made lowercase.
applicationdate = models.DateTimeField(db_column='ApplicationDate') #
Field name made lowercase.
onlinestorid = models.CharField(max_length=30,
db_column='OnlineStorID') # Field name made lowercase.
appid = models.BigIntegerField(unique=True, db_column='AppID') # Field
name made lowercase.
tapesavecopies = models.IntegerField(null=True,
db_column='TapeSaveCopies', blank=True) # Field name made lowercase.
appowner = models.CharField(max_length=48, db_column='AppOwner',
blank=True) # Field name made lowercase.
appownermail = models.CharField(max_length=96,
db_column='AppOwnerMail', blank=True) # Field name made lowercase.
subproductowner = models.CharField(max_length=48,
db_column='SubProductOwner', blank=True) # Field name made lowercase.
subproductownermail = models.CharField(max_length=96,
db_column='SubProductOwnerMail', blank=True) # Field name made
lowercase.
mainproductowner = models.CharField(max_length=48,
db_column='MainProductOwner', blank=True) # Field name made lowercase.
mainproductownermail = models.CharField(max_length=96,
db_column='MainProductOwnerMail', blank=True) # Field name made
lowercase.
applicationreason = models.CharField(max_length=500,
db_column='ApplicationReason', blank=True)
filetype = models.BooleanField(db_column='FileType')
applicationstatus = models.IntegerField(db_column='ApplicationStatus')
class Meta:
db_table = 'applicationinfo'
app_label = 'backupcenter1'

Friday, 30 August 2013

What's the deal with catching exceptions?

What's the deal with catching exceptions?

So I've read a lot about catching exceptions. Let's talk about this and
iOS together. I've used it with Google Analytics to submit information
about the crash and using that to fix bugs.
But this raises a question. Can catching these exceptions help prevent
apps from crashing. Can you theoretically prevent that bit of code from
crashing the app and keep the app open. Now I get the fact that it would
probably be impossible to do if there was no memory to be used but it
would still be nice to know about.
Sorry if this sounds like a stupid questions and I really should read more
about it and do some more research. Any information would be helpful.
I do have a fairly decent knowledge of iOS obj-c for my age and am willing
to look into what you have to say.
Thanks!

Thursday, 29 August 2013

Ho to check if php session is valid?

Ho to check if php session is valid?

I'm using Zend framework 1.12 and I've been built a web app where the
users has to be logging in order to do tasks.
All the task are made through json calls to functions in php modules.
The problem it's when the session has expired and the user wants to
execute a task, the response from the JSON it's the login page and the
response code it's 200.
There is a way to check if the session it's expired?
In the controller of user validation I've:
if ($User->isValid()) {
$this->_redirect(base64_decode($this->redirect));
} else {
return $this->render('logging');
}
Can you help me?
Thanks

Is there standard format for represent date/time in URIs?

Is there standard format for represent date/time in URIs?

I am building an API endpoint that accepts DateTime as a parameter.
So far I have considered two formats:
A) Exclamation mark as minute delimiter:
http://api.example.com/resource/2013-08-29T12!15
Looks unnatural and even with clear documentation, API consumers are bound
to make mistakes.
B) URI segment per DateTime part:
http://api.example.com/resource/2013/08/29/12/15
Looks unreadable. Also, once I add further numeric parameters - it will
become incomprehensible!
Is there standard/convention for for representing date/time in URIs?

Wednesday, 28 August 2013

What is a good way to pause a thread?

What is a good way to pause a thread?

I'm creating a java 2D platformer game, and I'm having a little trouble
getting an animation to go through when the player dies. When the player
dies, all enemies are removed and an explosion animation is played where
they used to be. At the same time, the player begins to blink. I want that
to go on for about two seconds, and then have my setState() method switch
to the "PlayerDeadState", which is basically the retry or return to main
menu option screen. I've used Thread.sleep(), but it doesn't work, and
I've heard it's bad for GUI threads. Here is my code: public void update()
{ // check if player is dead if(player.dead == true) {
player.flinching = true;
for(int i = 0; i < enemies.size(); i++) {
Enemy e = enemies.get(i);
e.update();
e.hit(200);
if(e.isDead()) {
enemies.remove(i);
i--;
eExplosions.add(
new Explosion(e.getx(), e.gety()));
}
}
gsm.setState(3);
}
}
The animations go through if I comment out my setState() method.
Any suggestions?

How to create ArrayList properly?

How to create ArrayList properly?

Below are two ways how to create ArrayList:
List<String/*or other object*/> arrList = new ArrayList();//Imports List,
ArrayList
ArrayList<String/*or other object*/> arrList = new ArrayList();//Imports
just ArrayList
What is the difference? Which method should be used?

GIMP does not see Windows fonts

GIMP does not see Windows fonts

I have downloaded some fonts and installed them by double-clicking to open
them, then clicking "Install font". Word and other Windows programs can
see them, but GIMP does not list them in the text tool. Why is this?
These are TrueType fonts (packaged in .ttf files). I'm using Gimp 2.8.2