Search Results

Search found 52 results on 3 pages for 'incrediman'.

Page 1/3 | 1 2 3  | Next Page >

  • MVC: Nested Views, and Controllers (for a website)

    - by incrediman
    I'm doing a PHP website using the MVC pattern. I am not using a framework as the site is fairly simple and I feel that this will give me a good opportunity to learn about the pattern directly. I have a couple questions. Question 1: How should I organize my views? I'm thinking of having a Page view which will have the header and footer, and which will allow for a Content view to be nested between them. Question 2: If I have 5 Content pages, should I make 5 different views that can be used as the content that is nested within the Page view? Or, should I make them all extend an abstract view called AbstractContent? Question 3: What about controllers? I think there should be one main controller at least. But then where does the request go from there? To another controller? Or should I just call the Page view and leave it at that? I thought that controllers were supposed to handle input, possibly modify a model, and select a view. But what if one of the views nested within the view that a controller calls requires additional input to be parsed? Question 4: Are controllers allowed to pass parameters into the view? Or should the controller simply modify the model, which will then affect the view? Or is the model only for DB access and other such things?

    Read the article

  • Wordpress autoformatting

    - by incrediman
    Why is Wordpress autoformatting my html? It keeps breaking my html code by adding <br>'s and <p>'s everywhere. I mean ffs, it even adds them around html comments. And forget javascript - it adds <div> tags around every line. How can I make it stop? Note: I only want to disable this for a specific page, and the issue is only occuring when editing html using the html content editor within the admin panel.

    Read the article

  • Java: Why is this Subclass valid?

    - by incrediman
    Here, I have an abstract class: abstract class A<E extends A> { abstract void foo(E x); } Here's a class that extends A: class B extends A<B>{ void foo(B x){} } And here's another (E is B here on purpose): class C extends A<B>{ void foo(B x){} } Both of those classes are valid, and the reasoning for that makes sense to me. However what confuses me is how this could possibly be valid: class D extends A{ void foo(A x){} } Since when are generics optional like that? I thought the extending class (subclass) of A would be required to specify an E?

    Read the article

  • MySQL queries - how expensive are they really?

    - by incrediman
    I've heard that mysql queries are very expensive, and that you should avoid at all costs making too many of them. I'm developing a site that will be used by quite a few people, and I'm wondering: How expensive are mysql queries actually? If I have 400,000 people in my database, how expensive is it to query it for one of them? How close attention do I need to pay that I don't make too many queries per client request?

    Read the article

  • Converting to Base 10

    - by incrediman
    Hi, Let's say I have a string or array which represents a number in base N, N1, where N is a power of 2. Assume the number being represented is larger than the system can handle as an actual number (an int or a double etc). How can I convert that to a decimal string? I'm open to a solution for any base N which satisfies the above criteria (binary, hex, ...).

    Read the article

  • does flex use frames?

    - by incrediman
    I'm looking into developing a game using the flex SDK instead of flash. I'm kind of not sure how to start. One question I have - does Flex have a timeline like Flash, with frames etc? Is there a main/root timeline?

    Read the article

  • Why is my masm32 program crashing whenever I try using interrupts?

    - by incrediman
    Here's the code: .386 ;target for maximum compatibility .model small,stdcall ;model .code main: int 20h END main Result: http://img705.imageshack.us/img705/3738/resultom.png "test.exe has stopped working" - always right when it reaches the interrupt. This is the interrupt I'm trying to use. It should simply exit the program. Others I've tried include character input/output, etc.. Nothing works. I'm on windows 7, using masm32 with the WinAsm IDE. There are so many cool things it seems I should be able to do with interrupts... however, it crashes whenever I try to use an interrupt - always the same way. This seems related and possibly useful: http://stackoverflow.com/questions/1414260/dos-interrupt-in-masm-x86-assembly-crashing ...but I haven't really been able to figure anything out from it. Any suggestions?

    Read the article

  • Banning by IP with php/mysql

    - by incrediman
    I want to be able to ban users by IP. My idea is to keep a list of IP's as rows in an BannedIPs table (the IP column would be an index). To check users' IP's against the table, I will keep a session variable called $_SESSION['IP'] for each session. If on any request, $_SESSION['IP'] doesn't match $_SERVER['REMOTE_ADDR'], I will update $_SESSION['IP'] and check the BannedIPs table to see if the IP is banned. (A flag will also be saved as a session variable specifying whether or not the user is banned) Here are the things I'm wondering: Does that sound like a good strategy with regards to speed and security (would someone be able to get around the IP ban somehow, other than changing IP's)? What's the best way to structure a mysql query that checks to see if a row exists? That is, what's the best way to query the db to see if a row with a certain IP exists (to check if it's banned)? Should I save the IP's as integers or strings? Note that... I estimate there will be between 1,000-10,000 banned IP's stored in the database. $_SERVER['REMOTE_ADDR'] is the IP from which the current request was sent.

    Read the article

  • How would you go about tackling this problem?

    - by incrediman
    I have a programming contest coming up in about half a week, and I've been prepping :) I found a bunch of questions from this canadian competition, they're great practice: http://cemc.math.uwaterloo.ca/contests/computing/2009/stage2/day1.pdf I'm looking at problem B ("Dinner"). Any idea where to start? I can't really think of anything besides the naive approach (ie. trying all permutations) which would take too long to be a valid answer. Btw, the language there says c++ and pascal I think, but i don't care what language you use - I mean really all I want is a brief description of how to tackle the problem. Like "use X technique treating each programmer as a Y" or something :)

    Read the article

  • Flex (Lex, not actionscript or w/e) Error

    - by incrediman
    I'm totally new to flex. I'm getting a build error when using flex. That is, I've generated a .c file using flex, and, when running it, am getting this error: 1>lextest.obj : error LNK2001: unresolved external symbol "int __cdecl isatty(int)" (?isatty@@YAHH@Z) 1>C:\...\lextest.exe : fatal error LNK1120: 1 unresolved externals here is the lex file I'm using (grabbed from here): /*** Definition section ***/ %{ /* C code to be copied verbatim */ #include <stdio.h> %} /* This tells flex to read only one input file */ %option noyywrap %% /*** Rules section ***/ /* [0-9]+ matches a string of one or more digits */ [0-9]+ { /* yytext is a string containing the matched text. */ printf("Saw an integer: %s\n", yytext); } . { /* Ignore all other characters. */ } %% /*** C Code section ***/ int main(void) { /* Call the lexer, then quit. */ yylex(); return 0; } As well, why do I have to put a 'main' function in the lex syntax code? What I'd like is to be able to call yylex(); from another c file.

    Read the article

  • Actionscript 2.0, load images into array

    - by incrediman
    I need to load an external image into an array. Let's say the image is http://sstatic.net/so/img/logo.png I'm using AS2 - I do not have the option of using AS3. Any idea what to do? I'm able to load the image just fine into a movieclip in _root (below), but not into an array. var loader:MovieClipLoader = new MovieClipLoader(); loader.loadClip("http://sstatic.net/so/img/logo.png",_root.mcOnTheStage); Like is there some way to make an array ov MC's that I can load the images into?

    Read the article

  • Multidimensional vectors in scheme?

    - by incrediman
    I earlier asked a question about arrays in scheme (turns out they're called vectors but are basically otherwise the same as you'd expect). Is there an easy way to do multidimensional arrays vectors in PLT Scheme though? For my purposes I'd like to have a procedure called make-multid-vector or something. By the way if this doesn't already exist, I don't need a full code example of how to implement it. If I have to roll this myself I'd appreciate some general direction though. The way I'd probably do it is to just iterate through each element of the currently highest dimension of the vector to add another dimension, but I can see that being a bit ugly using scheme's recursive setup. Also, this seems like something I should have been able to find myself so please know that I did actually google it and nothing came up.

    Read the article

  • 'Overwrite' php.ini settings

    - by incrediman
    I have a folder, and for all php files in that folder (or even better, in that folder or any folders within it) I'd like to make some changes to the php settings. Can I just place a php.ini file in that folder with those settings I'd like to change? If so, any reason why this wouldn't be working for me? It's my own server. Thanks!

    Read the article

  • Java declarations (ordering)

    - by incrediman
    In Java, what's generally the most accepted way to organize a class in terms of the order in which declared data members and methods should be listed in the class file, keeping in mind the following and anything else you can think of for each one: its visibility whether it's a constructor, method, or member if it's a method, does it overload, or override other method(s)?

    Read the article

  • PHP upload filename

    - by incrediman
    I'd like to have my PHP script upload a file with a certain filename in a directory of my choosing. However, the catch is that I need it to exist there immediately upon upload so I can moniter it on my server. I don't want to use a PHP extension or something - this should be very easy to transfer to any PHP setup. So basically: Is there a way to guarantee that, from the very beginning of the file upload process, the file has a certain name and location on the server?

    Read the article

  • jquery: Why do opacity animations only work with FF?

    - by incrediman
    I'm wondering why opacity animations only work with Firefox, and not with chrome or internet explorer. For example, jQuery("#a").fadeTo(1000,1); fades the element in with firefox, but just makes it appear with Chrome or IE. All I want is for the element to fade in. How can I get this to work with IE and chrome? Edit: Same thing if I use fadeIn() or any other similar function, like show()

    Read the article

  • Explain this AS2 code?

    - by incrediman
    Why does this code trace 'undefined'? this.createEmptyMovieClip("myLoader",1); trace(this.myLoader); this too? this.createEmptyMovieClip("myLoader",1); trace(this["myLoader"]); (when the code is in the constructor of a class which extends MovieClip) But this code traces _level0.myLoader (code placed on main timeline) this.createEmptyMovieClip("myLoader",1); trace(this.myLoader);

    Read the article

  • MySQL: SELECT a Winner, returning their rank

    - by incrediman
    Earlier I asked this question, which basically asked how to list 10 winners in a table with many winners, according to their points. This was answered. Now I'm looking to search for a given winner X in the table, and find out what position he is in, when the table is ordered by points. For example, if this is the table: Winners: NAME:____|__POINTS: Winner1 | 1241 Winner2 | 1199 Sally | 1000 Winner4 | 900 Winner5 | 889 Winner6 | 700 Winner7 | 667 Jacob | 623 Winner9 | 622 Winner10 | 605 Winner11 | 600 Winner12 | 586 Thomas | 455 Pamela | 434 Winner15 | 411 Winner16 | 410 These are possible inputs and outputs for what I want to do: Query: "Sally", "Winner12", "Pamela", "Jacob" Output: 3 12 14 623 How can I do this? Is it possible, using only a MySQL statement? Or do I need PHP as well? This is the kind of thing I want: WHEREIS FROM Winners WHERE Name='Sally' LIMIT 1 Ideas?

    Read the article

  • Scheme define/lambda shorthand

    - by incrediman
    In Scheme, how can I make use of the define/lambda shorthand for nested lambda expressions within my define? For example given the following procedure... (define add (lambda (num1 num2) (+ num1 num2))) One can shorten it to this: (define (add num1 num2) (+ num1 num2)) However, how can I shorten the following function similarly ? (define makeOperator (lambda (operator) (lambda (num1 num2) (operator num1 num2)))) ;example useage - equivalent to (* 3 4): ((makeOperator *) 3 4)

    Read the article

  • Flex build error

    - by incrediman
    I'm totally new to flex. I'm getting a build error when using flex. That is, I've generated a .c file using flex, and, when running it, am getting this error: 1>lextest.obj : error LNK2001: unresolved external symbol "int __cdecl isatty(int)" (?isatty@@YAHH@Z) 1>C:\...\lextest.exe : fatal error LNK1120: 1 unresolved externals here is the lex file I'm using (grabbed from here): /*** Definition section ***/ %{ /* C code to be copied verbatim */ #include <stdio.h> %} /* This tells flex to read only one input file */ %option noyywrap %% /*** Rules section ***/ /* [0-9]+ matches a string of one or more digits */ [0-9]+ { /* yytext is a string containing the matched text. */ printf("Saw an integer: %s\n", yytext); } . { /* Ignore all other characters. */ } %% /*** C Code section ***/ int main(void) { /* Call the lexer, then quit. */ yylex(); return 0; } As well, why do I have to put a 'main' function in the lex syntax code? What I'd like is to be able to call yylex(); from another c file.

    Read the article

  • Query MSQL for winners, starting at xth place using SELECT

    - by incrediman
    In my MySQL table Winners, I have a list of people who have won. What I'd like to do is select a list of the names of 10 winners. So what I have right now is this: SELECT name FROM Winners ORDER BY points DESC LIMIT 10 This returns the first 10 winners which is great. But how can I make it (for example) return 10 winners, but starting at 20th place?

    Read the article

  • Methods and properties in scheme - is object oriented programming possible in scheme?

    - by incrediman
    I will use a simple example to illustrate my question. In Java, C, or any other OOP language, I could create a pie class in a way similar to this: class Apple{ public String flavor; public int pieces; private int tastiness; public goodness(){ return tastiness*pieces; } } What's the best way to do that with Scheme? I suppose I could do with something like this: (define make-pie (lambda (flavor pieces tastiness) (list flavor pieces tastiness))) (define pie-goodness (lambda (pie) (* (list-ref pie 1) (list-ref pie 2)))) (pie-goodness (make-pie 'cherry 2 5)) ;output: 10 ...where cherry is the flavor, 2 is the pieces, and 5 is the tastiness. However then there's no type-safety or visibility, and everything's just shoved in an unlabeled list. How can I improve that? Sidenote: The make-pie procedure expects 3 arguments. If I want to make some of them optional (like I'd be able to in curly-brace languages like Java or C), is it good practice to just take the arguments in as a list (that is treat the arguments as a list - not require one argument which is a list) and deal with them that way?

    Read the article

1 2 3  | Next Page >