I have code written both ways and I see flaws in both of them. Is there another way to write this or is one approach more "correct" than the other?
def functionOne(subscriber):
try:
results = MyModelObject.objects.filter(
project__id=1,
status=MyModelObject.STATUS.accepted,
subscriber=subscriber).values_list(
'project_id',
flat=True).order_by('-created_on')
except:
pass
def functionOne(subscriber):
try:
results = MyModelObject.objects.filter(
project__id=1,
status=MyModelObject.STATUS.accepted,
subscriber=subscriber)
results = results.values_list('project_id', flat=True)
results = results.order_by('-created_on')
except:
pass
I heard that Windows 7 restricts access to its registry, so that applications cannot write directly to it. Is this so? I am developing an application in C#, and I would like to be able to save things such as port settings, last file used, etc. between sessions. Is the registry still a good option, or is there another preferred means of doing this now? Thanks.
Suppose I want to add minor syntactic sugars to Java. Just little things like adding regex pattern literals, or perhaps base-2 literals, or multiline strings, etc. Nothing major grammatically (at least for now).
How would one go about doing this?
Do I need to extend the bytecode compiler? (Is that possible?)
Can I write Eclipse plugins to do simple source code transforms before feeding it to the standard Java compiler?
Reading online about this topic is confusing. Is there a way to cut around the history, politics and technicalities to answer the question: Which standard should I refer to when I write code to generate feeds?
I want to use UTF-8 encoding, which may affect the choice. Otherwise I'm most interested in compatibility with a decent range of readers.
I need to do some macros and I wanna know what is the most recommended way to do it...
So, I need to write somethings and click some places with it and I need to emulate the TAB key to..
Thank you
I need to be able to write a script to automatically connect mysql in batch mode so that I can run some .sql files.
I tried to enter the following at the prompt:
./mysql -u root -p mypassword
but I keep getting a "Enter password: " prompt.
What am I doing incorrectly?
Thanks.
what is the current state of user authentication? is it good to go with openid or another alternative, or we still have to write our own user/password?
Hi, I am looking for ideas for how I can stop external scripts connecting with my site. I'm looking for the same kind of idea behind Google. As in if a certain amount of requests are made per a certain amount of time then block the IP address or something. I thought there maybe a htaccess solution if not, I will write a PHP one.
Any ideas or links to existing methods or scripts is much appreciated.
Regards
Phil
Since input and raw_input() stop the program from running anymore, I want to use a subprocess to run this program...
while True: print raw_input()
and get its output.
This is what I have as my reading program:
import subprocess
process = subprocess.Popen('python subinput.py', stdout=subprocess.PIPE, stderr=subprocess.PIPE)
while True:
output=process.stdout.read(12)
if output=='' and process.poll()!=None:
break
if output!='':
sys.stdout.write(output)
sys.stdout.flush()
When I run this, the subprocess exits almost as fast as it started. How can I fix this?
Hi.
I am trying to write some data from an NSMutableArray to a plist, while keep the old plists content.
The function writeToFile:atomically: overwrites the old contents with the new, I want to append the objects in the new array to the plist.
How can this be done? Thank you.
(I am newbie to tortoise SVN)
I have 2 folders in my tortoise SVN.
Each need a different set of authorization
(I do not want
people who have access to the first folder to have read / write access to the second folder).
How can I accomplish it? I noticed that all permissions are defined in a file in the root level.
I have the requirement of updating an app to use multiple (i.e., two in this case) datasources depending upon the type of query. For instance, use DB1 for reads and DB2 for write operations. How would I approach this?
hi all
I have a file having some number of records and I want to copy only first and last 10 records into another file.
Can anybody tell how to write jcl, using sort, icetool, ect.
Basically my problem is this, I need to parse text where , is the delimiter but anything in " " quotes should not be checked for a delimiter. Is this what the Scanner.skip method is for? I would check it myself but I don't understand how to write a regex pattern in java where the token is something in between two " ". I also want to include any quoted text in the proper token which was delimited by the valid ,.
I need to be able to execute a shell command through LaTeX [*] and have the resulting output available for use later on in the form of a LaTeX 'variable' (e.g., via a subsequent \newcommand command). If necessary a temporary file could be used to hold the output, although I would like to avoid this. I have been able to use
\immediate\write18
to invoke a bash command before, but this was only used to write to a temporary file.
[*] I realise that the -shell-escape flag must be set for this to be allowed
I am from a windows background (VC++), and moved to Linux (Ubuntu) about a year ago.
I would like to be able to write simple make files to build the following types of binaries:
A shared library
An executable that links into third party libraries (static and shared libraries)
Create an install section in my makefile (which can then be used my checkinstall)
Hello,
i'm trying to write unobtrusive default/placeholder text in input (actually, relatively placed label over input, which hides on onFocus, and stays hidden if input isn't empty on onBlur), but I don't want to use jQuery, because this is the only javascript used on page - therefore using jQuery seems a bit over the top.
Please, how can I do this without jQuery?
Thank you.
I'm hosting my own svn repository on ubuntu 8.04. Is there a way for svn to send emails to team members whenever a commit has happened?
If coding is required, the only language I'm able to use on a linux server is PHP. So I could write a php script to be triggered by svn.
Can anyone tell me how to hook up my php script to an svn commit? Or is there another way to do this?
I'm creating a sql based procedure which can
Accept a table
load the values one at a time
send the variables to a remote API
Record the response of the API
Write the response to a table for viewing later
I have successfully implemented 1,2, and 5. I am hoping there may be some way of choosing an address to contact and for SQL to listen too for a response. Please let me know if you have any suggestions!
I installed emacs 23.3.1 in c:/emacs-23.3.
Following the hints in this page, I updated the site-start.el to set HOME environment variable.
(setenv "HOME" "c:/users/USER/emacs")
And I made c:/users/USER/.emacs (like I did in unix/mac) to write the code for using slime, but it doesn't seem to start slime correctly.
Is this a correct way of setting emacs in Windows 7? Where do I put the .emacs file?
I want to add a few drawing functions to an iPhone project for drawing things. Something like drawTile(x,y,len,wid); which would call openGL to draw a box somewhere. I should just be able to write a procedural C file to do this but the openGL libraries are objective C and I'm getting weird errors. Do I have to make a class for all of my drawing commands and call class methods?
hi , my project this year is to develop a text mining tool (with new features)
so we need a mini script language in this tool to add annotation to texts
this language should be simple and like lisp grammars (left and right side) .
what i need is how to design this language ,i know how to constract the compiler ,
but how to write language grammars ? , and i want to use some mini open source language or any language bnf
please advice me and if there is a language i can use and customize to meet my needs ?
thanks
i need to set a image at 128*128px on a html page. i know the way width="128px" height="128px" but are i can do it by write a parameter on image like param="128px" then he set width and height 128px;