Search Results

Search found 210 results on 9 pages for 'n00b'.

Page 1/9 | 1 2 3 4 5 6 7 8 9  | Next Page >

  • n00b needs some PHP syntax guidance [closed]

    - by Michael
    If you look at http://www.cruc.es/?paged=12/ and go to the bottom of the page you'll see the bottom navigation with the next and previous options. I've been able to make the page numbers work by changing page to paged= in the code. I don't know enough about PHP to get the previous/next options to work. Any advice would be appreciated and I've pasted the code below. Thank you: n00b if ( $query->found_posts > $query->query_vars["posts_per_page"] ) { echo '<ul class="paging">'; // Previous link? if ( $page > 1 ) { echo '<li class="previous"><a href="'.$baseURL.'/page/'.($page-1).'/'.$qs.'">previous</a></li>'; } // Loop through pages for ( $i=1; $i <= $query->max_num_pages; $i++ ) { // Current page or linked page? if ( $i == $page ) { echo '<li class="active">'.$i.'</li>'; } else { echo '<li><a href="'.$baseURL.'/?paged='.$i.'/'.$qs.'">'.$i.'</a></li>'; } } // Next link? if ( $page < $query->max_num_pages ) { echo '<li><a href="'.$baseURL.'/page/'.($page+1).'/'.$qs.'">next</a></li>'; } echo '</ul>'; }

    Read the article

  • n00b: receive input over TCP/IP and use it to update HTML

    - by mawg
    This has got to be a FAQ, so can someone please just direct me to a "network programming for dummies" URL? The server wants to push information to a client or broadcast to all, when an event happens - as opposed to the clients constantly polling the server "just in case". The client then updates a browser page display. How do I do that? (toldya it was a n00b question) Should I have a thread which receives info on a socket and then writes it to a database which the browser display (PHP) can process with an HTML refresh tag, or what? Sorry to sound so dumb.

    Read the article

  • Anyone willing to help out a javascript n00b? :-)

    - by Splynx
    Since I am asking for a lot, and know it, the following is a wall of text for those who might show some interest and want to know a little before offering their help to me. First a little about my level of programming skills, and a little about what I ask for. Where I'm at: I am not totally new to Javascript, and have dabbled a little with PHP earlier - well have dabbled a lot with PHP in fact, but never got good at it because I program alone. And I have until now never used forums to get help etc. other that searching to see if anyone else had my problem before and what the solution was. So I am not a intuitive or talented programmer, I'm more of a very maticulate programmer and you would be surprised how far you can get with if else... (ok that's a joke hehe). My solutions are usually (I am guessing here) not the best ones - and slow I take it, and the code is usually too long and I have to look up most of the stuff I use (really a lot of it is not done in "freehand"). I have a LOT of experience with HTML and CSS, and have always done well formed markup, as well as I am really into x-browsing and always require that my work validates when it's done. I also worry about optimizing a lot, and work with sprites for images, minimize the number of http requests etc, using H1,H2 etc. where it is logically correct, as well as use the correct elements and not just div span or p it... So because I am a workhorse and very maticulate I can actually pull off some quite "advanced" features, but it's always the basics that bite me in the end. Not fully understanding the syntax and so on usually gives me problems. Have recently discovered jQuery - wich is a lot of fun.... But I want to use it for the DOM node manipulation/handling only. As I mentioned I worry about optimizing, and jQuery used for everything seems... well not optimal, it strikes me as doing it yourself when possible is faster than accesing another script that may take a whole lot of other considerations into perspective when handling your variables and objects (and I am just guessing here since I as explained know nothing). So thats where I'm at... As mentioned I just started with javascript for "real" so I do not have much to show, but at the end of my WOT you can see two unfinisheded scripts I have made so you can see where I'm at roughly - just check out the URL without the /feedback.html for the second example (I am only allowed to post 1 link since I am also a SO n00b) (and for those rushing over to a validation service, remember I wrote "when it's done"...) What I ask for: I am figuring this... I have a piece of code I am working on at the moment, and this little project has taught me a whole lot already, and I have "grown" a lot as a javascript programmer. If I add a whole lot of comments to the script, and explain what it is intended to do, will you then show me where: I am writing incorrect code - making mistakes Where/how my code could be more optimal Where I am just simply being a muppet The code I want to use as the background for the tuition is the one here http://projects.1000monkeys.dk/feedback.html Use firebug and have a quick look see...

    Read the article

  • Scala n00b: Critique my code

    - by Peter
    G'day everyone, I'm a Scala n00b (but am experienced with other languages) and am learning the language as I find time - very much enjoying it so far! Usually when learning a new language the first thing I do is implement Conway's Game of Life, since it's just complex enough to give a good sense of the language, but small enough in scope to be able to whip up in a couple of hours (most of which is spent wrestling with syntax). Anyhoo, having gone through this exercise with Scala I was hoping the Scala gurus out there might take a look at the code I've ended up with and provide feedback on it. I'm after anything - algorithmic improvements (particularly concurrent solutions!), stylistic improvements, alternative APIs or language constructs, disgust at the length of my function names - whatever feedback you've got, I'm keen to hear it! You should be able to run the following script via "scala GameOfLife.scala" - by default it will run a 20x20 board with a single glider on it - please feel free to experiment. // CONWAY'S GAME OF LIFE (SCALA) abstract class GameOfLifeBoard(val aliveCells : Set[Tuple2[Int, Int]]) { // Executes a "time tick" - returns a new board containing the next generation def tick : GameOfLifeBoard // Is the board empty? def empty : Boolean = aliveCells.size == 0 // Is the given cell alive? protected def alive(cell : Tuple2[Int, Int]) : Boolean = aliveCells contains cell // Is the given cell dead? protected def dead(cell : Tuple2[Int, Int]) : Boolean = !alive(cell) } class InfiniteGameOfLifeBoard(aliveCells : Set[Tuple2[Int, Int]]) extends GameOfLifeBoard(aliveCells) { // Executes a "time tick" - returns a new board containing the next generation override def tick : GameOfLifeBoard = new InfiniteGameOfLifeBoard(nextGeneration) // The next generation of this board protected def nextGeneration : Set[Tuple2[Int, Int]] = aliveCells flatMap neighbours filter shouldCellLiveInNextGeneration // Should the given cell should live in the next generation? protected def shouldCellLiveInNextGeneration(cell : Tuple2[Int, Int]) : Boolean = (alive(cell) && (numberOfAliveNeighbours(cell) == 2 || numberOfAliveNeighbours(cell) == 3)) || (dead(cell) && numberOfAliveNeighbours(cell) == 3) // The number of alive neighbours for the given cell protected def numberOfAliveNeighbours(cell : Tuple2[Int, Int]) : Int = aliveNeighbours(cell) size // Returns the alive neighbours for the given cell protected def aliveNeighbours(cell : Tuple2[Int, Int]) : Set[Tuple2[Int, Int]] = aliveCells intersect neighbours(cell) // Returns all neighbours (whether dead or alive) for the given cell protected def neighbours(cell : Tuple2[Int, Int]) : Set[Tuple2[Int, Int]] = Set((cell._1-1, cell._2-1), (cell._1, cell._2-1), (cell._1+1, cell._2-1), (cell._1-1, cell._2), (cell._1+1, cell._2), (cell._1-1, cell._2+1), (cell._1, cell._2+1), (cell._1+1, cell._2+1)) // Information on where the currently live cells are protected def xVals = aliveCells map { cell => cell._1 } protected def xMin = (xVals reduceLeft (_ min _)) - 1 protected def xMax = (xVals reduceLeft (_ max _)) + 1 protected def xRange = xMin until xMax + 1 protected def yVals = aliveCells map { cell => cell._2 } protected def yMin = (yVals reduceLeft (_ min _)) - 1 protected def yMax = (yVals reduceLeft (_ max _)) + 1 protected def yRange = yMin until yMax + 1 // Returns a simple graphical representation of this board override def toString : String = { var result = "" for (y <- yRange) { for (x <- xRange) { if (alive (x,y)) result += "# " else result += ". " } result += "\n" } result } // Equality stuff override def equals(other : Any) : Boolean = { other match { case that : InfiniteGameOfLifeBoard => (that canEqual this) && that.aliveCells == this.aliveCells case _ => false } } def canEqual(other : Any) : Boolean = other.isInstanceOf[InfiniteGameOfLifeBoard] override def hashCode = aliveCells.hashCode } class FiniteGameOfLifeBoard(val boardWidth : Int, val boardHeight : Int, aliveCells : Set[Tuple2[Int, Int]]) extends InfiniteGameOfLifeBoard(aliveCells) { override def tick : GameOfLifeBoard = new FiniteGameOfLifeBoard(boardWidth, boardHeight, nextGeneration) // Determines the coordinates of all of the neighbours of the given cell override protected def neighbours(cell : Tuple2[Int, Int]) : Set[Tuple2[Int, Int]] = super.neighbours(cell) filter { cell => cell._1 >= 0 && cell._1 < boardWidth && cell._2 >= 0 && cell._2 < boardHeight } // Information on where the currently live cells are override protected def xRange = 0 until boardWidth override protected def yRange = 0 until boardHeight // Equality stuff override def equals(other : Any) : Boolean = { other match { case that : FiniteGameOfLifeBoard => (that canEqual this) && that.boardWidth == this.boardWidth && that.boardHeight == this.boardHeight && that.aliveCells == this.aliveCells case _ => false } } override def canEqual(other : Any) : Boolean = other.isInstanceOf[FiniteGameOfLifeBoard] override def hashCode : Int = { 41 * ( 41 * ( 41 + super.hashCode ) + boardHeight.hashCode ) + boardWidth.hashCode } } class GameOfLife(initialBoard: GameOfLifeBoard) { // Run the game of life until the board is empty or the exact same board is seen twice // Important note: this method does NOT necessarily terminate!! def go : Unit = { var currentBoard = initialBoard var previousBoards = List[GameOfLifeBoard]() while (!currentBoard.empty && !(previousBoards contains currentBoard)) { print(27.toChar + "[2J") // ANSI: clear screen print(27.toChar + "[;H") // ANSI: move cursor to top left corner of screen println(currentBoard.toString) Thread.sleep(75) // Warning: unbounded list concatenation can result in OutOfMemoryExceptions ####TODO: replace with LRU bounded list previousBoards = List(currentBoard) ::: previousBoards currentBoard = currentBoard tick } // Print the final board print(27.toChar + "[2J") // ANSI: clear screen print(27.toChar + "[;H") // ANSI: move cursor to top left corner of screen println(currentBoard.toString) } } // Script starts here val simple = Set((1,1)) val square = Set((4,4), (4,5), (5,4), (5,5)) val glider = Set((2,1), (3,2), (1,3), (2,3), (3,3)) val initialBoard = glider (new GameOfLife(new FiniteGameOfLifeBoard(20, 20, initialBoard))).go //(new GameOfLife(new InfiniteGameOfLifeBoard(initialBoard))).go // COPYRIGHT PETER MONKS 2010 Thanks! Peter

    Read the article

  • Prolog n00b question: Doing whatever

    - by dmindreader
    I want to load this simple something into my Editor: Write:-repeat,write("hi"),nl,fail. So that it prints "hi". What should I do? I'm currently trying to do File->New and Saving a file named Write into E:\Program Files\pl\xpce\prolog\lib When doing the query: ?-Write. It's printing: 1 ?- Write. % ... 1,000,000 ............ 10,000,000 years later % % >> 42 << (last release gives the question) Why?

    Read the article

  • Delphi 7: ADO, need basic coding example

    - by mawg
    I am a complete n00b here. Can someone please post some Delphi code to create a database add a simple table close the database then, later open a database read each table read each field of a given table perform a simple search Sorry to be so clueless. I did google, but didn't find a useful tutorial ...

    Read the article

  • GNU/Linux developement n00b needs help porting C++ application from windows to GNU/Linux.

    - by AndrejaKo
    Hi! These questions may not be perfectly suited for this site, so I apologize in advance for asking them here. I'm trying to port a computer game from windows to GNU/Linux. It uses Ogre3D,CEGUI, ogreogg and ogrenewt. As far as I know all dependencies work on GNU/Linux and in the game itself there is no ooze-specific code. Here's the questions part: Is there any easy way to port visual studio 2008 project to GNU/Linux tool-chain? How do I manage dependencies? In Visual Studio, I'd just add them in property sheets or default directories. I assume on GNU/Linux autoconf and make take care of that, but in which way? Do I have to add each .cpp and .hpp manually or is there some way to automate things? How do I solve the problem of dependencies on different locations on different systems? I'd like to use Eclipse as IDE under GNU/Linux. I know that the best answer to most of my questions is RTFM, but I'm not sure what I exactly need and where to start looking.

    Read the article

  • In China. Want to set up my own private proxy. Already have website/webhosting. Help please! n00b with respect to coding/programming, go easy on me [closed]

    - by user1725461
    I am in China and have used freegate in the past -- http://en.wikipedia.org/wiki/Freegate Recently I've been having too many problems with that and some other web-based proxies I usually use. I have a website that is hosted in the US which I can access from China. Is there an easy way for me to setup my own secure private proxy? I'm sick of all my internet problems and looking for a new workable solution. Thank you! PS: and I really hope this is the right place for such a question...

    Read the article

  • Improving exception handling ?

    - by n00b
    Hello, I am a newbie programmer and I recently started learning about exception handling in Java. I know what try, catch and finally blocks do, but I really need to understand how to use them well and where to handle something in the call stack... I have a project right now that involves I/O and all I'm doing is handling the exception in the lowest possible method in the call stack. I'm sure my exception handling can be improved, so I'm asking you guys how you think of exception handling? How did you guys get good at this and how can I better wrap my head around this idea?

    Read the article

  • need to generate unlimited number of unique id's with jQuery

    - by jquery n00b
    Hi all, extreme n00b here... I've got a number of elements (dynamically generated by back end so it could be quite a few) and all need a unique id. I'm trying to work out how to do this wth jQuery and not doing so well. Any help is appreciated. In the code below, I'd want each "bar" div to get a unique id, like id1, id2 etc etc <div class="foo"> <ul class="bar"> </ul> <ul class="bar"> </ul> <ul class="bar"> </ul> <ul class="bar"> </ul> </div>

    Read the article

  • jQuery "best practices" is an oxymoron [closed]

    - by n00b
    jQuery "best practices", oxymoron for several reasons sadly To speak candidly, the entire jQuery library has a HIGHLY inconsistent API, and virtually no coding standards. It's basically a subset of JavaScript, a new language if you will, which is probably the most confusing part for normal javascript developers. In my opinion, use normal JavaScript where possible to save on memory consumption. Or, better yet, use a professional tool like YUI. If you already come from a javascript background, you will appreciate it much more than jQuery because it doesn't have n00b wrappers around everything. In tools like YUI, you interact directly with the native DOM to do things, instead of a super-jQuery object that tries to do everything. I'll get voted down for saying the truth. Don't get me wrong, jQuery is cool if you wanna throw something flashy up quick, but if you're going to build a larger app you're going to need a more refined tool (especially since jQuery leaks memory like no other once you start chaining too much things). jQuery does have one of the lowest learning curves, and you won't outgrow it for awhile, but when you do it will be highly apparent and tedious to merge to something else. over 60 years programming experience someone clean this up and community wiki please

    Read the article

  • When to alter a function vs when to just write a new one...?

    - by Andrew Heath
    /is n00b Through the gift of knowledge and expertise encoded here, I am doing my best to avoid n00b mistakes as I learn the basics of programming. I use functions when I (think I) can in PHP, and keep them somewhat sorted in different includes. The n00b problem I'm running into now is situations where perhaps 4/5th of an existing function is relevant to a new need. Maybe there are a slightly different set of inputs, or an additional calculation or two in the series, or output needs a different format/structure... but the core of the function is still applicable. Is there a good rule of thumb regarding when one should bolt-on crap to an original function and when one should (literally) copy & paste most of it into a new function and tweak to fit the situation? On the one hand I feel bad duping code, on the other I feel bad cluttering up an existing function with stuff not always needed...

    Read the article

  • Cursor moves when left or right clicking on trackpad

    - by n00b
    I'm on an acer aspire v5-572p. When I am using the touchpad, and I left or right click something, the cursor moves every time by a couple pixels because unfortunately the clicking area, is also a touch area. I've tried switching to the synaptics mouse drivers provided on the Acer driver website, but the same problem exist. I have researched this problem and there is a fix for this issue in Ubuntu, but I am running Windows 8.1 x64. The problem also existed when I was on 8.0 How do I stop the cursor from moving on a click?

    Read the article

  • Tomcat and IIS 7 both on different ip's and different ports

    - by n00b
    I have Tomcat and IIS 7 installed together on a Windows 2008 server. The machine has two IPs (134.133.1.1 and 134.133.2.2). I want Tomcat to handle 134.133.1.1, on port 80, and IIS to handle both 134.133.2.2, on port 80 AND 134.133.1.1, on port 443, but can't seem to get the last two together (I can get one or the other by themselves on IIS, along with the first IP address on Tomcat). I have configured Tomcat to successfully listen to ip 134.133.1.1, on port 80 with this configuration; <Connector port="80" protocol="HTTP/1.1" address="134.133.1.1" connectionTimeout="20000" redirectPort="8443" /> I also have a site configured in IIS bound to ip 134.133.1.1, on port 443 (SSL). When I turn on IIS, after Tomcat, I can reach both 134.133.1.1:80 (Tomcat) and 134.133.1.1:443 (IIS) successfully (as desired). The problem now comes when I want to introduce a new site via IIS, at the new ip address. In IIS I have setup a new site at IP 134.133.2.2, port 80. I can not start the site. The event log shows this error; Unable to bind to the underlying transport for [::]:80. The IP Listen-Only list may contain a reference to an interface which may not exist on this machine. The data field contains the error number. I think this is because IIS 7 tries to listen to port 80 on all IPs, and it cant because Tomcat is taking port 80 for 134.133.1.1. From reading, the resolution is to specify the IP address you want IIS to bind on port 80. The problem is, when I add 134.133.2.2 to the iplisten list, then I get a 404 when I try navigating to 134.133.1.1:443. I assume this is because IIS is no longer listening to ANY port on 134.133.1.1. How do I resolve this such that IIS will return both sites? EDIT: Per request my IIS binding for site A is 134.133.2.2 on port 80 (http) and 134.133.2.2 on port 443. For site B in IIS, the binding is 134.133.1.1 on port 443 (https). Note the IPs in this example are just for example purposes, but consistent with my setup.

    Read the article

  • Integrating MarkitUp and MarkdownSharp with asp.net forms website

    - by N00b
    Hi, I'm using markdownsharp with my asp.net forms website. I want to use MarkItUp as my editor and have found a straight forward article on how to integrate with MVC which seems straight forward enough: http://rsolberg.com/2010/09/asp-net-mvc-markitup-rich-text-editor/ However, how do I do this with a forms website? How do I get the MarkItDown Textarea on a postback and get the preview to work as well?

    Read the article

  • in tcl, how do I replace a line in a file?

    - by n00b programmer
    let's say I opened a file, then parsed it into lines. Then I use a loop: foreach line $lines {} inside the loop, for some lines, I want to replace them inside the file with different lines. Is it possible? Or do I have to write to another temporary file, then replace the files when I'm done? e.g., if the file contained AA BB and then I replace capital letters with lower case letters, I want the original file to contain aa bb Thanks!

    Read the article

  • Scheme. Tail recursive ?

    - by n00b
    Hi guys, any tail-recursive version for the below mentioned pseudocode ? Thanks ! (define (min list) (cond ((null? list '()) ((null? (cdr list)) (car list)) (#t (let ((a (car list)) (b (min (cdr list))) ) (if (< b a) b a) ) ) ) )

    Read the article

  • Open currency exchange rate API thingy

    - by n00b
    The table is: currency_name exchange_rate USD 1.000000 EUR 1.194929 CAD 0.942142 etc. What I want is to make a simple little cron job Python script to run every couple hours and update these values in the database. Are there any open APIs? I mean I am like 99% sure Yahoo! or Google finance has something like this but cannot find. Maybe someone here has done this?

    Read the article

  • Refactor throwing not null exception if using a method that has a dependency on a certain contructor

    - by N00b
    In the method below the second constructor accepts a ForumThread object which the IncrementViewCount() method uses. There is a dependency between the method and that particular constructor. Without extracting into a new private method the null check in IncrementViewCount() and LockForumThread() (plus other methods not shown) is there some simpler re-factoring I can do or the implementation of a better design practice for this method to guard against the use of the wrong constructor with these dependent methods? Thank you for any suggestions in advance. private readonly IThread _forumLogic; private readonly ForumThread _ft; public ThreadLogic(IThread forumLogic) : this(forumLogic, null) { } public ThreadLogic(IThread forumLogic, ForumThread ft) { _forumLogic = forumLogic; _ft = ft; } public void Create(ForumThread ft) { _forumLogic.SaveThread(ft); } public void IncrementViewCount() { if (_ft == null) throw new NoNullAllowedException("_ft ForumThread is null; this must be set in the constructor"); lock (_ft) { _ft.ViewCount = _ft.ViewCount + 1; _forumLogic.SaveThread(_ft); } } public void LockForumThread() { if (_ft == null) throw new NoNullAllowedException("_ft ForumThread is null; this must be set in the constructor"); _ft.ThreadLocked = true; _forumLogic.SaveThread(_ft); }

    Read the article

  • c# parameters question

    - by n00b
    I am new to c# and need help understanding what going on in the following function public bool parse(String s) { table.Clear(); return parse(s, table, null); } where table is a Dictionary. I can see that is is recursive but how is parse being passed three params when it is defined to take just a string?

    Read the article

  • Why make anything internal?

    - by c-charp N00b
    I don't really see the point of making methods or classes internal. In my very limited understanding, all it does is make working with your code very difficult for other programmers. Say I write Big_Important_Class for Project A and make said class internal. Then Bob, working on Project B needs to use my class to have project B work with Project A, but since its internal he can't. As of now this is the only thing I have seen internals do, make things really complicated for the guy working on Project B. I know there has to be a good reason to use internals, but I don't see any. Could someone please explain how they can be a good thing?

    Read the article

  • incremental OL using letters (jQuery)

    - by jquery n00b
    Hi, I'm trying to dynamically add a span to an ol, where the counter should be in letters. eg: A result B result C result etc etc I've got this code which is great for using numbers but I've no idea what to do to it to make the numbers into letters jQuery(document).ready( function() { jQuery('.results ol').each(function () { jQuery(this).find('li').each(function (i) { i = i+1; jQuery(this).prepend('<span class="marker">' + i + '</span>'); }); }); }); Any help is greatly appreciated!

    Read the article

  • jQuery - want to get input value for submit but it gets one and repeats

    - by jquery n00b
    I'm trying to replace all submit buttons with a span so cufon will work. The input still needs to be there so have done some css to hide it and overlay to span on top. My issue is getting the value from the input tag is proving quite diffcult. The code below gets the first input value (being 'search' from the search box at the top of the page, and then puts that value into all the spans, even for buttons that have different values (eg: send). This is a .NET page so the whole page is wrapped in one form tag. Any help is greatly appreciated. jQUERY: jQuery(document).ready( function() { jQuery(".button-wrap input.button").each(function() { var values = jQuery(".button-wrap input").attr('value'); jQuery(this).before("<span class='input-replacer'>" +values+ "</span>"); });

    Read the article

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