Tuesday, April 24, 2012

SQLITE Sql query to get the value while comparing value

There are three table.




Table X

| Field 1 | Field 2



Table Y



| Field 2 | Field 3



Table Z



| Field 3 | Field 4




The idea is to get the row from table Z but need to go from table X comparing a value selected value for field 1.



From Table X field 1, will get the value for field 2. On Table Y the value from field 2 will get the value for field 3.



On Table Z field 3 will get the final value from Field 4.



Any idea on how to do it in sqlite?





"string is not a type" in namespace

I write a program in c++ with two files.



main.cpp



#include "var.hpp"
#include <iostream>
using namespace std;
using namespace YU;

int main()
{
string god = "THL";
age = 10;
cout << age << endl;
cout << god << endl;
return 0;
}


var.hpp



#ifndef __VAR_H__
#define __VAR_H__

#include <string>

namespace YU
{
int age;
string name;
}

Digit/Number Recognition Hand-written

Can anyone recommend a handwritten digit/number recognition library which I could use in c++/OpenGL. I need to recognise the digits/numbers in my OpenGL project written by a user.



Thanks





Asterisk GUI Using php or any other framework

In asterisk I would like to have GUI to add/remove/edit Extensions.
This gui will also enable to update mysql database along with extension.conf add/edit when I add/delete new users. FreePbx can add/remove/edit extensions only.



Is there any framework exists for this purpose or I should purely go to write PHP from scratch ?



Thanks.





Should sensitive data be encrypted through both script and database means?

I don't know too much about encryption, but is there any benefit to encrypting the already encrypted, lets say passwords? I am aware of salts, but before this is done, does it matter or not?





Django: creating form which has relationship

I've prepared a model with a relationship.
I'd like to get a form which will make it possible to create User for that form.



Could someone explain me how it can be resolved?



class UserProfile(models.Model):
user = models.OneToOneField(User, unique=True, primary_key=True)
website = models.URLField(null=True, blank=True)
accepted_rules = models.BooleanField(default=False)
accepted_rules_date = models.DateTimeField(auto_now_add=True)


class UserProfile(ModelForm):
class Meta:
model = UserProfile

@csrf_protect
def register(request):
if request.method == "POST":

form = UserProfile(request.POST or None)
if form.is_valid():
website = form.cleaned_data['website']
accepted_rules = form.cleaned_data['accepted_rules']

username = form.cleaned_data['username']
email = form.cleaned_data['email']
password = form.cleaned_data['password']



formset.save()


print "All Correct"


return TemplateResponse(request, 'base.html', {
'form':form,
}
)




On iOS, why the init in ViewController didn't work?

In the ViewController's interface, I have



@property int count;


and in the implementation, I have



@synthesize count;

-(id) init {
self = [super init];
if (self) {
self.count = 100;
}
return self;
}

-(void) touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
NSLog(@"%i", self.count++);
}


but for some reason, the first time self.count got printed, it is 0 but not 100?