local

Local functions in Python

不想你离开。 提交于 2019-11-28 21:06:37
In the following Python code, I get an UnboundLocalError . As I understand it, local functions share the local variables of the containing function, but this hardly seems to be the case here. I recognise that a is an immutable value in this context, but that should not be a problem. def outer(): a = 0 def inner(): a += 1 inner() outer() It would seem that the inner function has received copies of all the references in the parent function, as I do not get the UnboundLocalError exception if the value of a is wrapped in a mutable type. Is someone able to clarify the behaviour here, and point me

POS: get a website to print directly to a defined local printer/s

跟風遠走 提交于 2019-11-28 19:02:15
I have a website which runs a box office service which issues tickets and reports. I am trying to figure out how to get tickets (currently PDFs) sent directly to a specified printer on a local/client PC. I have followed many old/dead/useless links and have not found any up-to-date solutions to this although many tantalising glimmers of hope. The scenario is this: Remote hosted website - 1 or more users connected - web page generates ticket/s (PDF) which is sent to a specified printer on the user pc (not the default printer) silently (no extra clicking through of print prompts). I know PHP does

Javascript: Download data to file from content within the page

僤鯓⒐⒋嵵緔 提交于 2019-11-28 18:19:51
setting is the following: I have a homepage where I display a diagram that has been constructed using comma seperated values from within the page. I'd like to give users the possibility to download the data as cvs-file without contacting the server again. (as the data is already there) Is this somehow possible? I'd prefer a pure JavaScript solution. So far I've discovered: http://pixelgraphics.us/downloadify/test.html but it involves flash which I'd like to avoid. I can't imagine this question hasn't been asked before. I'm sorry to double post, but it seems I've used the wrong keywords or

Is there any way to test PHP locally without installing a server?

一世执手 提交于 2019-11-28 17:02:52
问题 I'm looking for something like http://phpfiddle.org/, but completely local. I don't want to commit to installing something as complex as Apache, then PHP on top of that, just to try out code when I'm offline. Is there anything that can run PHP 5.5 on the local machine without installing an entire server underneath it? 回答1: There's no need for a server if using PHP 5.5+ - it has a built-in server (http://www.php.net/manual/en/features.commandline.webserver.php) Just use: $ cd ~/public_html $

Unable to start/launch local mongo db

岁酱吖の 提交于 2019-11-28 15:37:57
I'm new to MongoDB. I currently have a dump of a mongo db (i.e. directory of .bson files) and am trying to import that into mongo. I installed mongo as per the instructions on http://docs.mongodb.org/manual/tutorial/install-mongodb-on-os-x/ . I'm currently trying to test starting a local mongo instance by running mongod --dbpath /path/to/my/mongodata (which is an empty directory). I get the following in stdout: Thu Sep 20 09:46:01 [initandlisten] MongoDB starting : pid=1065 port=27017 dbpath=/path/to/my/mongodata/ 64-bit host=dhcp-18-111-28-92.dyn.mit.edu Thu Sep 20 09:46:01 [initandlisten]

Working offline with SVN on local machine temporary

会有一股神秘感。 提交于 2019-11-28 14:54:06
问题 I am working on a project currently on SVN. I however will not have access to the internet for a few days, and will be working on my project. Is there any way to make a clone of the repository on my local machine, commit changes to it, and when I gain access to the internet "push" them onto the shared repository? Thinking in terms of Mercurial here, is it worth migrating completely?! 回答1: Your problem sounds to me like the use case for git-svn: set up your Git repo: git svn clone http://svn

localStorage and 'file:' protocol not persistent, SQLite gives SECURITY_ERR

倾然丶 夕夏残阳落幕 提交于 2019-11-28 13:58:24
Introduction I work with RapidWeaver — Mac OS X CMS application — and it uses no server environment. It has an editor and a preview mode. The preview mode is a Webkit based renderer, and I can use 'Inspect Element', like you normally could do in Safari. I want to store some settings for a toolbar, either using localStorage or SQLite . I have read some information about indexedDB, though I have found no concrete implementations on how to use it. Problems with localStorage localStorage works fine when I stay in the preview mode, when I switch between editor and preview mode the url — location

How to keep the local file or the remote file during merge using Git and the command line?

▼魔方 西西 提交于 2019-11-28 13:14:49
问题 I know how to merge modification using vimdiff, but, assuming I just know that the entire file is good to keep or to throw away, how do I do that? I don't want to open vimdiff for each of them, I change want a command that says 'keep local' or 'keep remote'. E.G: I got a merge with files marked as changed because somebody opened it under windows, changing the EOL, and then commited. When merging, I want to just keep my own version and discard his. I'm also interested in the contrary: I

Img Src on local computer

自作多情 提交于 2019-11-28 13:06:56
I imagine that this is a common beginner question, but I've found no responses that quite cover my problem: I am having trouble linking to an image on my local computer. I'm working on making a theme for a wordpress installation (on a Dell running Windows 7 using Xampp.) My index.php file is located at: C:\xampp\htdocs\tutorials\wordpress\wp-content\themes\LeftColumn\index.php and the image I want to show is at: C:\xampp\htdocs\tutorials\wordpress\wp-content\themes\LeftColumn\images\pmsplogo.jpg ... and while I've tried many variations, somehow nothing I put in the <img src=""/> seems to be

Java error, duplicate local variable

痞子三分冷 提交于 2019-11-28 12:48:57
I'm trying to debug a portion of code for an assignment (I'm still very new to Java) and have combed through many resources to solve this conflict but still can't quite work it out. public static void main(String [] args){ Scanner keyboard = new Scanner(System.in); String input = null; do { System.out.println("Enter 'A' for option A or 'B' for option B."); String input = keyboard.next(); input.toLowerCase(); input.charAt(0); } while ((input != "a") || (input != "b")); } I always get a Duplicate Local Variable error with the input String. Any help would be greatly appreciated! replace String