Search Results

Search found 3076 results on 124 pages for 'beginner'.

Page 18/124 | < Previous Page | 14 15 16 17 18 19 20 21 22 23 24 25  | Next Page >

  • C#: Semantics for generics?

    - by Rosarch
    I have a list: private readonly IList<IList<GameObjectController>> removeTargets; PickUp inherits from GameObjectController. But when I try this: public IList<PickUp> Inventory // ... gameObjectManager.MoveFromListToWorld(this, user.Model.Inventory); I get a compiler error: cannot convert from 'System.Collections.Generic.IList' to 'System.Collections.Generic.IList' Why does this occur? Shouldn't this be fine, since PickUp is a subclass of GameObjectController? Do I need something like Java's Map<E extends GameObjectController>? Earlier, I was having a similar problem, where I was trying to implicitly cast inventory from an IList to an ICollection. Is this the same problem?

    Read the article

  • How to use HTML Agility pack

    - by chh
    I want to know how to use the HTML Agility Pack as I am totally new to it. My XHTML document is not completely valid. Thats why i wanted to use it. Can any one tell me how to use it in my project? My project is in C#.

    Read the article

  • Python repl in python application

    - by Olorin
    Hello i am learning python(so i can use qt with python not only c++) and i'm curios if it would be possible to embed a python interpreter in my application as a repl. I would like to give users to possibility to script the app using python either loading a file (and that file to act as a plugin for the app) or by evaluating code entered in a text box or something like that. Just like you can embed the interpreter in C or C++ and script the app using python can this be done if the application is itself written in python(and made a stand-alone binary using py2exe or something similar)? something like Anders did with the C# repl or Miguel with mono. Thanks.

    Read the article

  • processing: convert int to byte

    - by inspectorG4dget
    Hello SO, I'm trying to convert an int into a byte in Processing 1.0.9. This is the snippet of code that I have been working with: byte xByte = byte(mouseX); byte yByte = byte(mouseY); byte setFirst = byte(128); byte resetFirst = byte(127); xByte = xByte | setFirst; yByte = yByte >> 1; port.write(xByte); port.write(yByte); According to the Processing API, this should work, but I keep getting an error at xByte = xByte | setFirst; that says: cannot convert from int to byte I have tried converting 128 and 127 to they respective hex values (0x80 and 0x7F), but that didn't work either. I have tried everything mentioned in the API as well as some other blogs, but I feel like I'm missing something very trivial. I would appreciate any help. Thank you.

    Read the article

  • perl regex groups

    - by Aaron Moodie
    I've currenly trying to pull out dates from a file and feed them directly into an array. My regex is working, but I have 6 groups in it, all of which are being added to the array, when I only want the first one. @dates = (@dates, ($line =~ /((0[1-9]|[12][0-9]|3[01])(\/|\-)(0[1-9]|1[0-2])(\/|\-)([0-9][0-9][0-9][0-9]|[0-9][0-9]))/g )); is there a simple way to grab the $1 group of a perl regex? my output is looking like this: 13/04/2009, 13, /, 04, /, 2009, 14-12-09, 14, -, 12, -, 09

    Read the article

  • Usage of ||, OR in PHP

    - by shin
    I have the following code which redirect pages depends on $path. ... $path = $this->uri->segment(3); $pathid = $this->uri->segment(4); if($path=='forsiden'){ redirect('','refresh'); }elseif($path =='contact'){ redirect('welcome/kontakt','refresh'); }elseif($path =='illustration'){ $this->_gallery($path,$pathid); }elseif($path =='webdesign'){ redirect('welcome/webdesign','refresh'); }elseif($path==('web_tjenester' || 'webdesigndetails' || 'vismahjemmeside' || 'joomla' || 'vismanettbutikk' || 'vpasp' || 'artportfolio')){ ... CODE A ... }else{ ... CODE B ... } I am not getting right results with $path==('web_tjenester' || 'webdesigndetails' || 'vismahjemmeside' || 'joomla' || 'vismanettbutikk' || 'vpasp' || 'artportfolio') contact, illustration, gallery and webdesign are redirected and working alright. However all other pages are added CODE A. I am expecting CODE A only when $path is web_tjenester', 'webdesigndetails', 'vismahjemmeside', 'joomla', 'vismanettbutikk', 'vpasp' or 'artportfolio'. Could anyone point out my mistake and correct me please? Thanks in advance. --UPDATE-- The following works, but is there any ways shorten the code? I am repeating ($path==..). elseif(($path=='web_tjenester') || ($path=='webdesigndetails') || ($path=='vismahjemmeside') || ($path=='joomla') || ($path=='vismanettbutikk') || ($path=='vpasp') || ($path=='artportfolio')){

    Read the article

  • How do I reload .bashrc without logging out and back in?

    - by Jed Daniels
    Hello StackOverflowers, If I make changes to .bashrc, how do I reload it without logging out and back in? I'm embarrassed that I don't know the answer to this question, since I do a fair amount of bash scripting. I'm also couldn't decide if I should post this on ServerFault, but since I do more scripting than sysadmin, I chose StackOverflow; go ahead and move it if you (the community) feel that SF would have been a better choice. Thanks in advance. I'm sure once I hear the answer I'll be saying "doh! I knew that.", but it'll probably be good to have the answer here for other folks like me that should know (or do), but can't remember (I did search before asking, and couldn't find the answer, sorry if this is a repost). --jed

    Read the article

  • passing a fortran int array to C++ by calling C++ function in fortran

    - by cppb
    hi, I am trying to call a C++ function in FORTRAN subroutine. This C+ function is supposed to update an integer array. Here is a non-working code I wrote. Can someone please let me know what the issue is: ! FORTRAN function that calls a C++ function subroutine my_function() integer(4) ar(*) integer(4) get_filled_ar ! Need correct syntax here. ar = get_filled_ar() end // C++ function: extern "C" { void get_filled_ar(int *ar){ ar[0] = 1; ar[1] = 10; ar[3] = 100; } }

    Read the article

  • java.lang.NoSuchMethodError: main when starting HelloWorld with Eclipse Scala plugin

    - by Matt Sheppard
    I've just been playing with Scala, and installed the Eclipse plugin as described at http://www.scala-lang.org/node/94, but after entering the "Hello World" test example and setting up the run configuration as described, I get the following error Exception in thread "main" java.lang.NoSuchMethodError: main For reference the code is package hello object HelloWorld extends Application { println("Hello World!") } I've tinkered a bit with the obvious solutions (adding a main method, adding a singleton object with a main method) but I'm clearly doing something wrong. Can anyone get their test example to work, or point out what I am doing wrong?

    Read the article

  • Modifying Bresenham's line algorithm

    - by sphennings
    I'm trying to use Bresenham's line algorithm to compute Field of View on a grid. The code I'm using calculates the lines without a problem but I'm having problems getting it to always return the line running from start point to endpoint. What do I need to do so that all lines returned run from (x0,y0) to (x1,y1) def bresenham_line(self, x0, y0, x1, y1): steep = abs(y1 - y0) > abs(x1 - x0) if steep: x0, y0 = y0, x0 x1, y1 = y1, x1 if x0 > x1: x0, x1 = x1, x0 y0, y1 = y1, y0 if y0 < y1: ystep = 1 else: ystep = -1 deltax = x1 - x0 deltay = abs(y1 - y0) error = -deltax / 2 y = y0 line = [] for x in range(x0, x1 + 1): if steep: line.append((y,x)) else: line.append((x,y)) error = error + deltay if error > 0: y = y + ystep error = error - deltax return line

    Read the article

  • Can I avoid explicit 'self'?

    - by bguiz
    I am fairly new to Python and trying to pick it up, so please forgive if this question has a very obvious answer! I have been learning Python by following some pygame tutorials. Therein I found extensive use of the keyword self, and coming from a primarily Java background, I find that I keep forgetting to type self. For example, instead of self.rect.centerx I would type rect.centerx, because, to me, rect is already a member variable of the class. The Java parallel I can think of for this situation is having to prefix all references to member variables with this. Am I stuck prefixing all member variables with self, or is there a way to declare them that would allow me to avoid having to do so? Even if what I am suggesting isn't "pythonic", I'd still like to know if it is possible. I have taken a look at these related SO questions, but they don't quite answer what I am after: Python - why use “self” in a class? Why do you need explicitly have the “self” argument into a Python method?

    Read the article

  • Python MySQLdb placeholders syntax

    - by ensnare
    I'd like to use placeholders as seen in this example: cursor.execute (""" UPDATE animal SET name = %s WHERE name = %s """, ("snake", "turtle")) Except I'd like to have the query be its own variable as I need to insert a query into multiple databases, as in: query = """UPDATE animal SET name = %s WHERE name = %s """, ("snake", "turtle")) cursor.execute(query) cursor2.execute(query) cursor3.execute(query) What would be the proper syntax for doing something like this?

    Read the article

  • Python for a hobbyist programmer ( a few questions)

    - by Matt
    I'm a hobbyist programmer (only in TI-Basic before now), and after much, much, much debating with myself, I've decided to learn Python. I don't have a ton of free time to teach myself a hundred languages and all programming I do will be for personal use or for distributing to people who need them, so I decided that I needed one good, strong language to be good at. My questions: Is python powerful enough to handle most things that a typical programmer might do in his off-time? I have in mind things like complex stat generators based on user input for tabletop games, making small games, automate install processes, and build interactive websites, but probably a hundred things along those lines Does python handle networking tasks fairly well? Can python source be obscufated (mispelled I think), or is it going to be open-source by nature? The reason I ask this is because if I make something cool and distribute it, I don't want some idiot script kiddie to edit his own name in and say he wrote it And how popular is python, compared to other languages. Ideally, my language would be good and useful with help found online without extreme difficulty, but not so common that every idiot with computer knows python. I like the idea of knowing a slightly obscure language. Thanks a ton for any help you can provide.

    Read the article

  • lwjgl 101: How can I write the basics?

    - by Vuntic
    This ought to be really simple, but I cannot for the life of me figure out how to compile anything with lwjgl and have it work. I can write something like package gwison; import org.lwjgl.Sys; public class G { public static void main(String[] args) { System.out.println(Sys.getTime()); } } and I can easily compile a program with several classes in different packages, as long as I wrote all the classes myself. But I have no clue how to make G work. I think it has something to do with classpathes? Maybe? Help?

    Read the article

  • Union struct produces garbage and general question about struct nomenclature

    - by SoulBeaver
    I read about unions the other day( today ) and tried the sample functions that came with them. Easy enough, but the result was clear and utter garbage. The first example is: union Test { int Int; struct { char byte1; char byte2; char byte3; char byte4; } Bytes; }; where an int is assumed to have 32 bits. After I set a value Test t; t.Int = 7; and then cout cout << t.Bytes.byte1 << etc... the individual bytes, there is nothing displayed, but my computer beeps. Which is fairly odd I guess. The second example gave me even worse results. union SwitchEndian { unsigned short word; struct { unsigned char hi; unsigned char lo; } data; } Switcher; Looks a little wonky in my opinion. Anyway, from the description it says, this should automatically store the result in a high/little endian format when I set the value like Switcher.word = 7656; and calling with cout << Switcher.data.hi << endl The result of this were symbols not even defined in the ASCII chart. Not sure why those are showing up. Finally, I had an error when I tried correcting the example by, instead of placing Bytes at the end of the struct, positioning it right next to it. So instead of struct {} Bytes; I wanted to write struct Bytes {}; This tossed me a big ol' error. What's the difference between these? Since C++ cannot have unnamed structs it seemed, at the time, pretty obvious that the Bytes positioned at the beginning and at the end are the things that name it. Except no, that's not the entire answer I guess. What is it then?

    Read the article

  • Short Python alphanumeric hash with minimal collisions

    - by ensnare
    I'd like to set non-integer primary keys for a table using some kind of hash function. md5() seems to be kind of long (32-characters). What are some alternative hash functions that perhaps use every letter in the alphabet as well as integers that are perhaps shorter in string length and have low collision rates? Thanks!

    Read the article

  • Textmate RSpec Run Example fails

    - by Barb
    When I try to run an RSpec example from within Textmate. I get "Rails requires RubyGems = 1.3.2 (you have 1.3.1). Please gem update --system and try again." I run gem update and I get nothing to update. I think the RSpec bundle is running from the built in directories rather than /local/. How do I change where the bundle looks? Thanks! :)

    Read the article

  • bitwise OR on strings

    - by mr.bio
    How can i do a Bitwise OR on strings? A: 10001 01010 ------ 11011 Why on strings? The Bits can have length of 40-50.Maybe this could be problematic on int ? Any Ideas ?

    Read the article

  • How to include text files with Executable Jar

    - by Jake
    Hi guys rookie Java question. I have a Java project and I want to include a text file with the executable jar. Right now the text file is in the default package. InputFlatFile currentFile = new InputFlatFile("src/theFile.txt"); I grab the file with that line as you can see using src. However this doesn't work with the executable jar. Can someone please let me know how to keep this file with the executable jar so someone using the program can just click a single icon and run the program. Thanks!

    Read the article

  • Difficulty getting Saxon into XQuery mode instead of XSLT

    - by Rosarch
    I'm having difficulty getting XQuery to work. I downloaded Saxon-HE 9.2. It seems to only want to work with XSLT. When I type: java -jar saxon9he.jar I get back usage information for XSLT. When I use the command syntax for XQuery, it doesn't recognize the parameters (like -q), and gives XSLT usage information. Here are some command line interactions: >java -jar saxon9he.jar No source file name Saxon-HE 9.2.0.6J from Saxonica Usage: see http://www.saxonica.com/documentation/using-xsl/commandline.html Options: -a Use xml-stylesheet PI, not -xsl argument -c:filename Use compiled stylesheet from file -config:filename Use configuration file -cr:classname Use collection URI resolver class -dtd:on|off Validate using DTD -expand:on|off Expand defaults defined in schema/DTD -explain[:filename] Display compiled expression tree -ext:on|off Allow|Disallow external Java functions -im:modename Initial mode -ief:class;class;... List of integrated extension functions -it:template Initial template -l:on|off Line numbering for source document -m:classname Use message receiver class -now:dateTime Set currentDateTime -o:filename Output file or directory -opt:0..10 Set optimization level (0=none, 10=max) -or:classname Use OutputURIResolver class -outval:recover|fatal Handling of validation errors on result document -p:on|off Recognize URI query parameters -r:classname Use URIResolver class -repeat:N Repeat N times for performance measurement -s:filename Initial source document -sa Use schema-aware processing -strip:all|none|ignorable Strip whitespace text nodes -t Display version and timing information -T[:classname] Use TraceListener class -TJ Trace calls to external Java functions -tree:tiny|linked Select tree model -traceout:file|#null Destination for fn:trace() output -u Names are URLs not filenames -val:strict|lax Validate using schema -versionmsg:on|off Warn when using XSLT 1.0 stylesheet -warnings:silent|recover|fatal Handling of recoverable errors -x:classname Use specified SAX parser for source file -xi:on|off Expand XInclude on all documents -xmlversion:1.0|1.1 Version of XML to be handled -xsd:file;file.. Additional schema documents to be loaded -xsdversion:1.0|1.1 Version of XML Schema to be used -xsiloc:on|off Take note of xsi:schemaLocation -xsl:filename Stylesheet file -y:classname Use specified SAX parser for stylesheet --feature:value Set configuration feature (see FeatureKeys) -? Display this message param=value Set stylesheet string parameter +param=filename Set stylesheet document parameter ?param=expression Set stylesheet parameter using XPath !option=value Set serialization option >java -jar saxon9he.jar -q:"..\w3xQueryTut.xq" Unknown option -q:..\w3xQueryTut.xq Saxon-HE 9.2.0.6J from Saxonica Usage: see http://www.saxonica.com/documentation/using-xsl/commandline.html Options: -a Use xml-stylesheet PI, not -xsl argument // etc... >java net.sf.saxon.Query -q:"..\w3xQueryTut.xq" Exception in thread "main" java.lang.NoClassDefFoundError: net/sf/saxon/Query Caused by: java.lang.ClassNotFoundException: net.sf.saxon.Query // etc... Could not find the main class: net.sf.saxon.Query. Program will exit. I'm probably making some stupid mistake. Do you know what it could be?

    Read the article

< Previous Page | 14 15 16 17 18 19 20 21 22 23 24 25  | Next Page >