I am making a multilingual Django website. I want the site to check from which country the user is accessing the website, and according to that decide which language to use.
What would be a good tool to use for that?
Hi All,
I handle a website which is designed in GWT and I want to check if internet connection goes down in between accessing the website. If internet is down I want to give message as cannot connect to server or something like Gmail handles it.
Can anybody suggest what will be the best way to handle this?
Hi there
I want to convert a string to a generic type
I have this:
string inputValue = myTxtBox.Text;
PropertyInfo propInfo = typeof(MyClass).GetProperty(myPropertyName);
Type propType = propInfo.PropertyType;
object propValue = ?????
I want to convert 'inputString' to the type of that property, to check if it's compatible
how can I do that?
tks
Hi all,
I want to update/insert file by using upload box to the database but before that it will check for the file type thats only pdf can be upload. Somthing wrong with the codes and i dont know what..Please help
here are part of my updates codes:
$id=$rs['id'];
$qry = "SELECT a.faillampiran FROM {$CFG->prefix}ptk_lampiran a, {$CFG->prefix}ptk b WHERE a.ptkid=$id and b.id=$id";
$sql = get_records_sql($qry);
if($_POST['check']){
$ext = pathinfo($faillampiran,PATHINFO_EXTENSION);
$err = "Upload Only PDF File. ";
if ($ext =='pdf'){
$qry="UPDATE {$CFG->prefix}ptk_lampiran SET
faillampiran='".$faillampiran."'
WHERE ptkid='".$_GET['id']."'";
$sql=mysql_query($qry);
$qry = "SELECT a.faillampiran FROM {$CFG->prefix}ptk_lampiran a, {$CFG->prefix}ptk b
WHERE b.id = '".$rs[id]."' AND a.ptkid = '".$rs[id]."' ";
$sql = get_records_sql($qry);
foreach($sql as $rs){ ?>
<?=basename($rs->faillampiran); ?><br>
<? }
?>
<tr><td></td><td></td><td>
<input type="file" size="50" name="faillampiran" alt="faillampiran" value= "<?=$faillampiran;?>" />
<input type="submit" name="edit" value="Muat naik fail ini" /><br />
</td></tr>
}
else {
echo "<script>alert('$err')</script>";
}
} else {
foreach($sql as $rs){ ?>
<?=basename($rs->faillampiran); ?><br>
<? }
?>
<input type="file" size="50" name="faillampiran" alt="faillampiran" value= "<?=$faillampiran;?>" />
<input type="submit" name="edit" value="Muat naik fail ini" /><br />
<?}
Sori bout the messiness of the codes, im still a beginner in this languages.
thx
I need to be able to check if a variable has a certain string of text inside it. Here's what I have now:
--This sample always goes to the ELSE block.
IF( @name LIKE '%John%' )
BEGIN
--do one thing
END
ELSE
BEGIN
--do the other thing
END
Hi,
I wanna do some local developer tests of IIS 7 but I don't have Windows Vista, 7 or 2008 server - I currently run XP SP3.
I have Virtual PC installed so I can use Microsoft's IE compatibility images - are there any time-limited images that I can use with Virtual PC so I can check out IIS 7?
The IIS 7 "Try it" link points to this page. But the VHS is for Windows Server platforms only I think and I don't want an ISO?
Any advice?
when I input
mysql -u root -p XXXX dbname < c:/filename.sql
alway get this error "error 1064 <42000:" you have an error in your SQL suntax; check the manual that corresponds to your MySql server version for the right syntax to use near .....
what is wrong with this statement?
I am moving an assembly with an embedded resource into a test environment, I am having issues with some of the details in an embedded XML file and need to check if they are correct.
Are there any tools that will allow me to look at the embedded resources in the .NET assembly? Even better if there is one that i can edit and drop back in.
Hi,
I would like to avoid the tags overlapping each other in this small Flex project:
I've this small FLEX project: http://dl.dropbox.com/u/72686/IVbeta1/main.html#
The items are LinkButtons. How can I check if they are colliding or not ?
Thanks
LINQ to SQL .Count takes way to much process time and decreases performances.
I am doing a recursive loop and for one child (lets call it parent) I have to check the number of children under it to make a decision if it should be included or not.
The Count is too slow 8 ms :( for 120 parent records.
Any ideas to make it quicker.
Does the method get called with a null value or does it give a null reference exception?
MyObject myObject = null;
myObject.MyExtensionMethod(); // <-- is this a null reference exception?
If this is the case I will never need to check my 'this' parameter for null?
I use the applicationUpdater framework with an Air application.
The delay property is set (in AS code) to 1 day.
However, the application checks every time it is run: the delay property seems to be ignored.
Does any one know where last run time is stored, so I can check if there's a reason it can't seem to remember ;-)
the app is at http://muchoswing.com/cantoyo
Hi,
I have a small problem.
I am creating an appointment table where in the foreign key is patient id which is referenced from patient table.This table is for all registered patients.
there will be unregistered patients also, who will be seeking appointments.SO i just need to store the name,phone and few details.
I don't want to make these 2 as different tables.
So is there a way to skip the integrity check of foreign key when i ma inserting unregistered patient data
I'm using jquery 1.3 and is trying to duplicate the 1.4 .has functionality.
I need to check if the .page element contains the image, and if it doesn't, append it.
Is it something like:
var imageid = thirdimage;
if ($('#page:has(#'+imageid+')') === undefined) {
$('#page').append($('#'+imageid));
}
Thanks.
Does anyone check the domain of an email address as part of their verification steps? eg. Confirm that gmail.com exists if the user specified [email protected] as their address.
Hi, I want to send the username and password values which user types in html input elements to server to check if the username and password is valid or not when user click login button, using post request in $.ajax(options) method in jquery, but I don't know how to send those username and password to server. What option should I write in $.ajax(options) method to get those values from server?
I have 2 input textboxes that take a host or IP. When the user leaves an input box an event is fired that checks the input to see if it is actually a live computer. The results are then put into the appropriate label.
My question is, should I be using separate events for each input box, since they update different labels? Or, can I use 1 event and check who the caller was, then update the appropriate label?
Is it possible for one to check the strong name of a .NET application that is already currently running separately from your own running applications process?
Hello, i am new in programming under linux and trying to get working this code:
http://scaryreasoner.wordpress.com/2007/11/17/using-ld_preload-libraries-and-glibc-backtrace-function-for-debugging/
but getting error: "ERROR: ld.so: object 'libwrap_ioctl.so' from LD_PRELOAD cannot be preloaded: ignored."
what can cause it?
system - Archlinux, kernel 2.6.32
thank you for answers
upd1:
"Check with ldd libwrap_ioctl.so if some dependency of this library is missing."
checked. no, i have all needed libraries
Sockets on Linux question
I have a worker thread that is blocked on an accept() call. It simply waits for an incoming network connection, handles it, and then returns to listening for the next connection.
When it is time for the program to exit, how do I signal this network worker thread (from the main thread) to return from the accept() call while still being able to gracefully exit its loop and handle it's cleanup code.
Some things I tried:
1. pthread_kill to send a signal. Feels kludgy to do this, plus it doesn't reliably allow the thread to do it's shutdown logic. Also makes the program terminate as well. I'd like to avoid signals if at all possible.
pthread_cancel. Same as above. It's a harsh kill on the thread. That, and the thread may be doing something else.
Closing the listen socket from the main thread in order to make accept() abort. This doesn't reliably work.
Some constraints:
If the solution involves making the listen socket non-blocking, that is fine. But I don't want to accept a solution that involves the thread waking up via a select call every few seconds to check the exit condition.
The thread condition to exit may not be tied to the process exiting.
Essentially, the logic I am going for looks like this.
void* WorkerThread(void* args)
{
DoSomeImportantInitialization(); // initialize listen socket and some thread specific stuff
while (HasExitConditionBeenSet()==false)
{
listensize = sizeof(listenaddr);
int sock = accept(listensocket, &listenaddr, &listensize);
// check if exit condition has been set using thread safe semantics
if (HasExitConditionBeenSet())
{
break;
}
if (sock < 0)
{
printf("accept returned %d (errno==%d)\n", sock, errno);
}
else
{
HandleNewNetworkCondition(sock, &listenaddr);
}
}
DoSomeImportantCleanup(); // close listen socket, close connections, cleanup etc..
return NULL;
}
void SignalHandler(int sig)
{
printf("Caught CTRL-C\n");
}
void NotifyWorkerThreadToExit(pthread_t thread_handle)
{
// signal thread to exit
}
int main()
{
void* ptr_ret= NULL;
pthread_t workerthread_handle = 0;
pthread_create(&workerthread, NULL, WorkerThread, NULL);
signal(SIGINT, SignalHandler);
sleep((unsigned int)-1); // sleep until the user hits ctrl-c
printf("Returned from sleep call...\n");
SetThreadExitCondition(); // sets global variable with barrier that worker thread checks on
// this is the function I'm stalled on writing
NotifyWorkerThreadToExit(workerthread_handle);
// wait for thread to exit cleanly
pthread_join(workerthread_handle, &ptr_ret);
DoProcessCleanupStuff();
}
Using Hibernate, what is the most efficient way to determine if a table is empty or non-empty? In other words, does the table have 0, or more than 0 rows?
I could execute the HQL query select count(*) from tablename and then check if result is 0 or non-0, but this isn't optimal as I would be asking the database for more detail than I really need.
This is related to this
Anyway what I need is actually something slightly different I need some way of doing this:
function run(arg) {
this.ran = this.ran || false;
if (!this.ran) init;
/* code */
this.ran = true;
}
This works fine, I just want to make sure that this code works even when this in case it was called with call() or apply()
Check this out for what I'm talking about, All of the calls after the first one should all be true, no matter the context