Search Results

Search found 2229 results on 90 pages for 'newbie'.

Page 1/90 | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • Why the good append syntax is so ugly, asks python newbie

    - by Cawas
    Now following my series of "python newbie questions" and based on another question. Go to http://python.net/~goodger/projects/pycon/2007/idiomatic/handout.html#other-languages-have-variables and scroll down to "Default Parameter Values". There you can find the following: def bad_append(new_item, a_list=[]): a_list.append(new_item) return a_list def good_append(new_item, a_list=None): if a_list is None: a_list = [] a_list.append(new_item) return a_list So, question here is: why is the "good" syntax over a known issue ugly like that in a programming language that promotes "elegant syntax" and "easy-to-use"? Why not just something in the definition itself, that the "argument" name is attached to a "localized" mutable object like: def better_append(new_item, a_list=[].local): a_list.append(new_item) return a_list I'm sure there would be a better way to do this syntax, but I'm also almost positive there's a good reason to why it hasn't been done. So, anyone happens to know why?

    Read the article

  • Newbie python error in regards to import

    - by TylerW
    Hello. I'm a python newbie and starting out with using the Bottle web framework on Google App Engine. I've been messing with the super small, super easy Hello World sample and have already ran into problems. Heh. I finally got the code to work with this... import bottle from bottle import route from google.appengine.ext.webapp import util @route('/hello') def hello(): return "Hello World!" util.run_wsgi_app(bottle.default_app()) My question is, I thought I could just go 'import bottle' without the second line. But if I take the second line out, I get a NameError. Or if I do 'from bottle import *', I still get the error. bottle is just a single file called 'bottle.py' in my site's root directory. So neither of these work.... import bottle from google.appengine.ext.webapp import util @route('/hello') def hello(): return "Hello World!" util.run_wsgi_app(bottle.default_app()) Or from bottle import * from google.appengine.ext.webapp import util @route('/hello') def hello(): return "Hello World!" util.run_wsgi_app(bottle.default_app()) The error message I get is... Traceback (most recent call last): File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/dev_appserver.py", line 3180, in _HandleRequest self._Dispatch(dispatcher, self.rfile, outfile, env_dict) File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/dev_appserver.py", line 3123, in _Dispatch base_env_dict=env_dict) File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/dev_appserver.py", line 515, in Dispatch base_env_dict=base_env_dict) File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/dev_appserver.py", line 2382, in Dispatch self._module_dict) File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/dev_appserver.py", line 2292, in ExecuteCGI reset_modules = exec_script(handler_path, cgi_path, hook) File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/dev_appserver.py", line 2188, in ExecuteOrImportScript exec module_code in script_module.dict File "/Users/tyler/Dropbox/sites/dietgrid/code2.py", line 4, in @route('/hello') NameError: name 'route' is not defined So am I wrong in thinking it should be able to work the other ways or no?

    Read the article

  • [newbie]Webservice - Threads - close if no active threads, if any activen, then wait till its compl

    - by Raj
    Hi I have an ASP.Net webservice running. When the system date changes, i want to close all the threads and restart them again, if the thread/s aren't doing any work. If any of the thread/s is in the process of doing some work(active threads), then i need to wait till the current thread/s complete its process and then close. This will prevent from aborting any current process. Any ideas on how i can perform such a task? Thanks PS:I am new to ASP.NET and Multithreading.

    Read the article

  • Python: some newbie questions on sys.stderr and using function as argument

    - by Cawas
    I'm just starting on Python and maybe I'm worrying too much too soon, but anyways... log = "/tmp/trefnoc.log" def logThis (text, display=""): msg = str(now.strftime("%Y-%m-%d %H:%M")) + " TREfNOC: " + text if display != None: print msg + display logfile = open(log, "a") logfile.write(msg + "\n") logfile.close() return msg def logThisAndExit (text, display=""): msg = logThis(text, display=None) sys.exit(msg + display) That is working, but I don't like how it looks. Is there a better way to write this (maybe with just 1 function) and is there any other thing I should be concerned under exiting? Now to some background... Sometimes I will call logThis just to log and display. Other times I want to call it and exit. Initially I was doing this: logThis ("ERROR. EXITING") sys.exit() Then I figured that wouldn't properly set the stderr, thus the current code shown on the top. My first idea was actually passing "sys.exit" as an argument, and defining just logThis ("ERROR. EXITING", call=sys.exit) defined as following (showing just the relevant differenced part): def logThis (text, display="", call=print): msg = str(now.strftime("%Y-%m-%d %H:%M")) + " TREfNOC: " + text call msg + display But that obviously didn't work. I think Python doesn't store functions inside variables. I couldn't (quickly) find anywhere if Python can have variables taking functions or not! Maybe using an eval function? I really always try to avoid them, tho. Sure I thought of using if instead of another def, but that wouldn't be any better or worst. Anyway, any thoughts?

    Read the article

  • Newbie can't get Tomcat to reload Flex/BlazeDS application

    - by Captain Aporam
    I'm an experienced 'old school' programmer, but new to Tomcat and Flex. I've followed the getting started for BlazeDS. I'm making changes to the Flex code using Flex Builder 3, but I just can't get the changes to show up when I refresh the page on my client. Server and client are separate physical machines, I've even re-started the server hardware. One curious thing, even when I re-started the server I didn't have to re-login to the Tomcat manager page - I didn't restart my client, I guess it remembers my session? TIA, getting frustrated - like my flex page is 'write once'.

    Read the article

  • Newbie Python programmer tangling with Lists.

    - by Sergio Tapia
    Here's what I've got so far: # A. match_ends # Given a list of strings, return the count of the number of # strings where the string length is 2 or more and the first # and last chars of the string are the same. # Note: python does not have a ++ operator, but += works. def match_ends(words): counter = 0 for word in words: if len(word) >= 2 and word[0] == word[-1]: counter += counter return counter # +++your code here+++ return I'm following the Google Python Class, so this isn't homework, but me just learning and improving myself; so please no negative comments about 'not doing my homework'. :P What do you guys think I'm doing wrong here? Here's the result: match_ends X got: 0 expected: 3 X got: 0 expected: 2 X got: 0 expected: 1 I'm really loving Python, so I just know that I'll get better at it. :)

    Read the article

  • C++ Newbie: Passing an fstream to a function to read data

    - by vgm64
    I have a text file named num.txt who's only contents is the line 123. Then I have the following: void alt_reader(ifstream &file, char* line){ file.read(line, 3); cout << "First Time: " << line << endl; } int main() { ifstream inFile; int num; inFile.open("num.txt"); alt_reader(inFile, (char*)&num); cout << "Second Time: " << num << endl; } The output is: First Time: 123 Second Time: 3355185 Can you help me figure out how to get an fstream that is read in a function still assign the variable in main? I'm doing this because alt_reader really has a lot more to it, but this is the part I'm stuck on. Thanks a lot for the help.

    Read the article

  • Is perfectionism a newbie's friend or enemy? [closed]

    - by Akromyk
    Possible Duplicate: Where do you draw the line for your perfectionism? I see that the development community is very focused on doing things the right way and personally I would like to do the same too, however, is it a good or bad idea for a newbie to focus on design principles, design patterns, and commenting code when getting started, or is it better to let creativity run wild and potentially write sloppy code. Where should a newbie draw the line?

    Read the article

  • As a newbie, where should I go if I want to create a small GUI program?

    - by jimbmk
    Hello, I'm a newbie with a little experience writing in BASIC, Python and, of all things, a smidgeon of assembler (as part of a videogame ROM hack). I wanted to create small tool for modifying the hex values at particular points, in a particular file, that would have a GUI interface. What I'm looking for is the ability to create small GUI program, that I can distribute as an EXE (or, at least a standalone directory). I'm not keen on the idea of the .NET languages, because I don't want to force people to download a massive .NET framework package. I currently have Python with IDLE and Boa Constructor set up, and the application runs there. I've tried looking up information on compiling a python app that relies on Wxwidgets, but the search results and the information I've found has been confusing, or just completely incomprehensible. My questions are: Is python a good language to use for this sort of project? If I use Py2Exe, will WxWidgets already be included? Or will my users have to somehow install WxWidgets on their machines? Am I right in thinking at Py2Exe just produces a standalone directory, 'dist', that has the necessary files for the user to just double click and run the application? If the program just relies upon Tkinter for GUI stuff, will that be included in the EXE Py2Exe produces? If so, are their any 'visual' GUI builders / IDEs for Python with only Tkinter? Thankyou for your time, JBMK

    Read the article

  • Effective SEO Article Tutorials and Guide For Newbie Web Content Creators

    Getting updated knowledge for how to write SEO articles is essential because of the steady changes occurring in the search engine algorithms. There are certain challenges that most newbie content writers are facing when it comes to dealing with the issues like website content creation. With the introduction of Web 2.0, it is necessary to use high quality unique content in marketing products or services on the internet.

    Read the article

  • My method is being recognized within my own program. Newbie mistake probably.

    - by Sergio Tapia
    Here's my code: sentenceToTranslate = raw_input("Please write in the sentence you want to translate: ") words = sentenceToTranslate.split(" ") for word in words: if isVowel(word[0]): print "TEST" def isVowel(letter): if letter.lower() == "a" or letter.lower() == "e" or letter.lower() == "i" or letter.lower() == "o" or letter.lower() == "u": return True else: return False The error I get is: NameError: name 'isVowel' is not defined What am I doing wrong?

    Read the article

  • Trouble with this Python newbie exercise. Using Lists and finding if two adjacent elements are the s

    - by Sergio Tapia
    Here's what I got: # D. Given a list of numbers, return a list where # all adjacent == elements have been reduced to a single element, # so [1, 2, 2, 3] returns [1, 2, 3]. You may create a new list or # modify the passed in list. def remove_adjacent(nums): for number in nums: numberHolder = number # +++your code here+++ return I'm kind of stuck here. What can I do?

    Read the article

  • Trouble using the ref keyword. Very newbie question!

    - by Sergio Tapia
    Here's my class: public class UserInformation { public string Username { get; set; } public string ComputerName { get; set; } public string Workgroup { get; set; } public string OperatingSystem { get; set; } public string Processor { get; set; } public string RAM { get; set; } public string IPAddress { get; set; } public UserInformation GetUserInformation() { var CompleteInformation = new UserInformation(); GetPersonalDetails(ref CompleteInformation); GetMachineDetails(ref CompleteInformation); return CompleteInformation; } private void GetPersonalDetails(ref UserInformation CompleteInformation) { } private void GetMachineDetails(ref UserInformation CompleteInformation) { } } I'm under the impression that the ref keyword tells the computer to use the same variable and not create a new one. Am I using it correctly? Do I have to use ref on both the calling code line and the actual method implementation?

    Read the article

  • Unit testing newbie team needs to unit test

    - by Walter
    I'm working with a new team that has historically not done ANY unit testing. My goal is for the team to eventually employ TDD (Test Driven Development) as their natural process. But since TDD is such a radical mind shift for a non-unit testing team I thought I would just start off with writing unit tests after coding. Has anyone been in a similar situation? What's an effective way to get a team to be comfortable with TDD when they've not done any unit testing? Does it make sense to do this in a couple of steps? Or should we dive right in and face all the growing pains at once?? EDIT Just for clarification, there is no one on the team (other than myself) who has ANY unit testing exposure/experience. And we are planning on using the unit testing functionality built into Visual Studio.

    Read the article

  • Freshy Ubuntu 12.10 install (Newbie)

    - by Alexander Marcev
    Hi i just installed ubuntu 12.10 on my ssd(picture below) and i set up my home directory to the 1 TB disc(picture below). I want in general use the ssd as my root folder as u can see, and install only the apps which are necessary. Games and other stuff goes to the 1 TB disc, but this disc shows me in gparted a usage of 14 GB on a freshly install, whats wrong? What about the ssd, do i have to manually optimize things? thx Alex PS: What if i want to install a Game to my home folder, i heard sth. of a symbol link, how to do that?

    Read the article

  • Newbie error with Windows Azure–403 not authorised

    - by simonsabin
    Azure uses certificates to manage secure access to the management side of things. I’ve started looking into azure for some SQLBits . So in doing so I needed to configure certificates to  connect. VS nicely will create a cert for you and copies a path for you to use to upload to azure. I went to the Azure portal ( https://windows.azure.com/Default.aspx ) found the certificate bit and added the certificate. However after doing this I couldn’t connect. After trying numerous fruitless things, including...(read more)

    Read the article

  • Newbie, deciding Python or Erlang

    - by Joe
    Hi Guys, I'm a Administrator (unix, Linux and some windows apps such as Exchange) by experience and have never worked on any programming language besides C# and scripting on Bash and lately on powershell. I'm starting out as a service provider and using multiple network/server monitoring tools based on open source (nagios, opennms etc) in order to monitor them. At this moment, being inspired by a design that I came up with, to do more than what is available with the open source at this time, I would like to start programming and test some of these ideas. The requirement is that a server software that captures a stream of data and store them in a database(CouchDB or MongoDB preferably) and the client side (agent installed on a server) would be sending this stream of data on a schedule of every 10 minutes or so. For these two core ideas, I have been reading about Python and Erlang besides ruby. I do plan to use either Amazon or Rackspace where the server platform would run. This gives me the scalability needed when we have more customers with many servers. For that reason alone, I thought Erlang was a better fit(I could be totally wrong, new to this game) and I understand that Erlang has limited support in some ways compared to Ruby or Python. But also I'm totally new to the programming realm of things and any advise would be appreciated grately. Jo

    Read the article

  • Unit testing best practices for a unit testing newbie

    - by wilhil
    In recent years, I have only written small components for people in larger projects or small tools. I have never written a unit test and it always seems like learning how to write them and actually making one takes a lot longer than simply firing up the program and testing for real. I am just about to start a fairly large scale project that could take a few months to complete and whilst I will try to test elements as I write them (like always), I am wondering if unit testing could save me time. I was just wondering if anyone could give good advice: Should I be looking at unit testing at the start of the project and possibly adopt a TDD approach. Should I just write tests as I go along, after each section is complete. Should I complete the project and then write unit tests at the end.

    Read the article

  • Teamwork 101 for the solo newbie

    - by clankercrusher
    Forgive my newbishness but I have a question to ask about teamwork...mainly because I stink at it. Most of my projects up until this point have been solo so I have a very limited experience with teamwork. I did make graphics for a game that was being developed by several people, but that was completely different than programming with several different people. Right now I'm working with someone else on an indie MMO along with a few other team members. I've already made some pretty stupid mistakes, (like rewriting EVERYTHING) so I have two questions for you guys: 1) What are some of the most common mistakes that people make in a team environment and how can they be avoided? 2) How can the structure of your program be altered to allow for multiple teams members to work on different parts of the program at the same time? P.S. Is this the right stack exchange site for this type of question? (if not, where does it go? Thanks)

    Read the article

  • Newbie worried about CASE tool.

    - by Jason Evans
    Hi there. I'm looking for some guidance on CASE tools and whether my concerns are valid. Recently I was in a meeting between my employer and an external software company which have a CASE tool currently in beta. They demonstrated this tool to us, showing how you build a UML model in Enterprise Architect (or something like it) and then, through their tool, that UML model is transformed into a Visual Studio project, with C# files, stored procedures for SQL Server, code for the data layer, WCF stuff, logging code and allsorts. Now, admittedly, I don't see the point in this, as in I'm not convinced it will save that much time (plus it feels like overkill). The tool authors said that a trial of the tool at another company had saved a team there 5 weeks of development time (from 6 weeks down to about 1 week) using this tool. I find the accuracy of that estimate hard to believe. My main concern is whether using this tool is going slow down my productivity. For example - Say I have a UML model which I built a VS solution from. Now, I want to rename a class method to something else; will this mean having to update the UML model first and then rebuilding the code? Is this how case tools normally work? Something I will need to check with the authors is the structure of the generated VS solution. I like the Domain Driven Design way of project structure - Infrstructure, Services, Model, etc. I doubt very much this tool will do that. Also, I've been playing around with Entity Framework Code First and think it's a great way to build the data model. I have nice repositories, unit of work classes and other design patterns that work well with EF. I have data anootations and stuff like that working great. By not having EF (the CASE tool uses it's own data layer code) I'm concerned that this tool's data layer code might not be a nice to integrate in the UoW pattern, repositories, etc. This I will need to verify when I get a closer look at the generated code. What are other people's experiences with CASE tools? Am I being paranoid about nothing? Am I being unfair - are my negativities unfounded? EDIT: I like to use TDD/BDD for building my code, and using a CASE tool looks like it will make this difficult. Again, any feedback on this would be great. Cheers. Jas.

    Read the article

  • Newbie seeking advice on programming in general

    - by user974685
    need some of you to remember back to a time when you might have been bad at programming... Been at my new job (as a software developer) for a couple of months now, passed probation period. Have very little programming experience (C++ only) and am currently working with asp.net MVC and silverlight. So there's a website the company has been working on and I am joining the effort to make it better, iron out bugs etc. The problem is - learning about a system/website which has already been made, via visual studio. I ALWAYS feel HUGELY overwhelmed, never knowing which part of this line should I look up, and generally having lots of trouble getting the big picture. Visual studio itself is something I'm finding it difficult to get to grips with, let alone the asp.net framework. I get the impression that because my coworkers have more experience than me, they are getting all the good jobs, and I am left with crap to do - stuff which is not even vaguely programming. Meaning they are learning/creating more, and I am learning/creating near nothing. I'm getting demoralised, and too scared to say anything. I'm not stupid, I've read and practiced plenty of the fundamental programming concepts...I'm just bloody scared of this damn framework. I look at it and just feel paralyzed. The result is that I keep asking the older veteran guy of questions, and he is getting irritated, and would rather give me easy/mindless/non programming jobs to avoid wasting time with helping me out. Then when I don't understand something, I'm hesitating about whether or not I should ask him yet, and trying to decide if it would be a waste of time. I'm the kind of person who picks things up slowly, but with a lot of attention to detail. The former I think is making me look incompetent though. Anyone get where I'm coming from please say something helpful....I'm scared of losing my job in a few months or something...

    Read the article

1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >