I want my regex to catch:
monday mon thursday thu ...
So it's possible to write something like this:
(?P<day>monday|mon|thursday|thu ...
But I guess that there should be a more elegant solution.
I can use this verb in the Python Windows SDK. But not in production. Why? What am I doing wrong?
The error message includes (only seen via firebug or fiddler)
Malformed request
or something like that
My code looks like:
from google.appengine.ext import db
from google.appengine.ext import webapp
class Handler(webapp.RequestHandler):
def delete(self):
key = self.request.get('key')
item = db.get(key)
item.delete()
self.response.out.write(key)
In a MySQL master-slave replication enviroment if I have 4 slave servers how can I execute load balanced select queries?
Should I write a PHP class to dealing with the 4 slaves or it is possible to address queries to MySQL's own load balancer solution? Is there a MySQL load balancing solutions?
Can I use some other tool to distribute my queries? What is the typical set up in situations like this?
Thanks for all answers!
Say I have a table with a unique positive integer field. I currently have rows with id's of [1, 2, 3, 4, 5, 8, 12, 35]. Is there a insert query that I could write that would assign the id field to the lowest unique positive integer (in this case 6)? It would have to do this atomically so there isn't the possibility of concurrent inserts wiping out each other or failing.
Currently we use log4net and create a new folder (usually below C:) with write and create access rights for the worker process user. Is there perhaps a standard windows folder we should or could be using such as LOCALAPPDATA? I'm guessing that LOCALAPPDATA is a bad choice in the general case because IIS users tend to be non-interactive users and thus I don't think they have the usual user folder structrues available.
In SQL Profiler you can see that very simple updates to a table by primary key take about 10-30ms each. On about every 10th update the write column shows 1, on all other updates it shows 0. This must mean that about every 10th update statement still requires disk IO. I wonder why that is. Would it not be more efficient queue up all IO until the transaction commits?
I am using mod_rewrite to remap the URLs in my website in the following format:
http://www.mydomain.com/health/54856
http://www.mydomain.com/economy/strategy/911025/
http://www.mydomain.com/tags/obama/new
The problem is that I am making AJAX calls to a file: http://www.mydomain.com/login.php
And I don't want to write the FULL url or even use the ../ trick because there isn't a fixed level of folders.
So, what i want is something to access the login.php from the root, whatever the domain name is:
$.ajax({
type: "POST",
url: "http://www.mydomain.com/login.php"
});
I'm trying to grab content where id = 3 OR id = 9 OR id = 100... Keep in mind, I can have a few hundred of these ids.
What is the most efficient way to write my query?
$sql = "SELECT name FROM artists WHERE (id=3 OR id=9 OR .... id-100)"
Is it possible to access Firefox info from my program? Specificly I need to read URL of opened site in active tab. Is something like this possible?
I guess I can write extension that will allow me to do something like this, but I wanted to know if it is posible with some FF api...
I know that boost.asio has a mechanism that calls a callback function whenever a packet is received but is there an option to emit a signal instead?
Do I have to write a function that emits the signal?
If it is so, why?
Is it possible to work with an encrypted SQLite database directly in Qt? Or, do I have to read it entirely into memory, decrypt in memory, do work, encrypt in memory, write to disk?
I have this code that saves a pdf file.
FileStream fs = new FileStream(SaveLocation, FileMode.Create);
fs.Write(result.DocumentBytes, 0, result.DocumentBytes.Length);
fs.Flush();
fs.Close();
It works fine. However sometimes it does not release the lock right away and that causes file locking exceptions with functions run after this one run.
Is there a ideal way to release the file lock right after the fs.Close()
Hi i m using GridView with hovermenu
and i want that when we click on edit button then we get TextBox to write in Gridview
and also i get error when click on edit for e.commandArgument is null
so please give me code for this both
Hello!
How to write the exprission shorter:
return '%.0f' % float_var if float_var else float_var
or
if float_var:
return formatted_string
else:
return None
Thanks!
I am trying to update a datetime column in an android sqlite db to use international date format (yyyy-mm-dd) instead of the current format (mm/dd/yyyy). I want to use the sqlite date() function to reformat the current value of the column. I thought it would be as simple as the following:
update tblename set thedate = date(thedate)
but the above does not work.
How would i write the sql statement to accomplish this?
thanks
patrick
i need to write a vba script that will find a file. the file could be in three different locations
how do i find where the file is?
the file must have a specific string as part of the file name
my file name could be 9424.bas or 9424a.esy or 9424_.bas or 9424...esy, i dotn know what the file name exactly is but i know the important characters 9424
For example, let's use the Add method of the ArrayList class. If I am using the default compiler settings in Visual Studio C# project in which arithmetic overflow is not checked, would ArrayList.Add() throw an OverflowException if I added too many items? Would surrounding the method call with checked or unchecked make any difference?
BTW, I would write a test program to determine the answer to this question if I had Visual Studio available to me right now.
I want to use implicit linking in my project , and nmake really wants a .def file . The problem is , that this is a class , and I don't know what to write in the exports section .
Could anyone point me in the right direction ?
The error message is the following :
NMAKE : U1073: don't know how to make 'DLLCLASS.def'
P.S: I'm trying to build using Windows CE Platform Builder .
I'm trying to bring Django admin to front-end. The problem is in most cases I just have to write trivial model forms. Is there some way to use ModelAdmin forms outside of Django Admin?
I am trying to program according to Behavior Driven Development,
which states that no line of code should be written without writing
failing unit test first.
My question is, how to use BDD with private methods?
How can I unit test private methods?
Is there better solution than:
- making private methods public first and then making them private
when I write public method that uses those private methods;
or
- in C# making all private methods internal and using InternalsVisibleTo
attribute.
Robert
Rules are simple. Write an obfuscated function in any language that takes in an integer and returns the same integer. Try to use math tricks and not language tricks. IE. Try to make your function portable.
How would I write a regular expression (C#) which will check a given string to see if any of its characters are characters OTHER than the following:
a-z
A-Z
Æ æ Å å Ø ø - '
Thanks!
Hello,
I would like to know how to check which action displayed the current View (from the current view).
For instance, to check if controller myController originated the rendering (I guess) I can write:
<% if(ViewContext.Controller is myApplication.Controllers.myController)%>
In fact, I want to use the same View model for 2 actions methods, like this:
<% If( First Action rendered this view){%>
// Display this
<%} else {%>
//Display that
<%}%>
Thanks for helping
Hi,
While considering another problem one question appeared.
I do not know how to write html when I want to redirect page when select option changes.
In other words user chooses option from select list and page is redirected after that.
Have you met anything like this?
Regards,