Search Results

Search found 3120 results on 125 pages for 'php5 oop'.

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

  • Is there a programming language with not a tree but tags idea behind OOP?

    - by kolupaev
    I'm thinking about tree structures, and I feel that I don't like them. It's like when you have a shop, then you try to put all products to tree-like catalog, and then you need to place one product to multiple categories, now you have multiple routing, bla-bla. I don't feel like everything in the world could be put to a tree. Instead, I like idea of tags. I would like to store everything with tags. With tags I could do much more. I can even simulate trees if I want. I want to have tag-based filesystem! But hey - modern OOP paradigm with inheritance is based on tree. I want to see how it is when you don't have such basement. Closest thing I found is mixins in some languages. Do you know what else is also about this ideas?

    Read the article

  • How to explain OOP concepts to a non technical person?

    - by John
    I often try to avoid telling people I'm a programmer because most of the time I end up explaining to them what that really means. When I tell them I'm programming in Java they often ask general questions about the language and how it differs from x and y. I'm also not good at explaining things because 1) I don't have that much experience in the field and 2) I really hate explaining things to non-technical people. They say that you truly understand things once you explain them to someone else, in this case how would you explain OOP terminology and concepts to a non technical person?

    Read the article

  • AS3 OOP MVC with PHP

    - by Pepe Sanchez
    Im new to ActionScript and Flex 3... im trying to develop an MVC 100% OOP application with Flex 3 using MXML,AS3 and PHP. M (PHP) V (MXML) C (AS3) The 3 layers i choose for my development. I have 10 AS3 classes that are object related between them and some inherit or implement interfaces. The only problem here is how to interact 100% OOP with my model. In this case my model has to be a PHP Class that needs to be called from AS3 (the controller). For example the AS3 class : Patient have a method called Save: public function Save(data:Array) : void { /* PHP call - model layer */ } I want to create an instance of my PHP Patient Model class that connects to the DB and insert the data array into it. What should i use ? how can i also return a variable to AS3 ? What happen to as3 if there is a cached Exception in PHP ? Thanks in advanced :)

    Read the article

  • PHP OOP Concepts (Value Objects / Data Access Objects)

    - by Iuhiz
    Hi, I've just started to learn PHP OOP, previously I have been doing PHP in a procedural manner. I was reading this article and I've got a couple of quick questions, How is the constructor for value objects commonly defined? As one that takes in all "data members" as parameters or stick to the default constructor and use mutator / accessor methods to set / get data members? Is this actually the recommended way to start doing PHP OOP? Cos honestly, the concepts explained in the article was a tad confusing for me. Cheers

    Read the article

  • OOP Design of items in a Point-of-Sale system

    - by Jonas
    I am implementing a Point-of-Sale system. In the system I represent an Item in three places, and I wounder how I should represent them in OOP. First I have the WarehouseItem, that contains price, purchase price, info about the supplier, suppliers price, info about the product and quantity in warehouse. Then I have CartItem, which contains the same fields as WarehouseItem, but adds NrOfItems and Discount. And finally I have ReceiptItem, thats contains an item where I have stripped of info about the supplier, and only contains the price that was payed. Are there any OOP-recommendations, best-practices or design patterns that I could apply for this? I don't really know if CartItem should contain (wrap) an WarehouseItem, or extend it, or if I just should copy the fields that I need. Maybe I should create an Item-class where I keep all common fields, and then extend it to WarehouseItem, CartItem and ReceiptItem. Sometimes I think that it is good to keep the field of the item and just display the information that is needed.

    Read the article

  • Learning OOP Design

    - by waiwai933
    I've read Head First Java, and I understand how OOP works. Here's my problem: I'm a PHP programmer, and while I've used OOP in PHP, I'm having trouble figuring out what should be an object and what methods to give it. For example, let's say I have a app that allows people to log in and edit a document. Why should the document be an object if there will ever only be one instance? Should I give the deleteDocument() method to the document object or the admin object? The document is the one being deleted, but the admin is the one performing the action. So my real question is, coming from a procedural background, how do I figure out what should be objects and what should have what methods?

    Read the article

  • SQL constructs translated to OOP

    - by python dude
    As someone who comes from the world of Object Orientation, I find it rather difficult to wrap my head around SQL. Recently, however, I realized that the classical SQL construct select X from Y where Z is basically equivalent to the following OOP construct: List<SomeType> results = db.query(new Matcher<SomeType> () { public boolean match(SomeType candidate) { return ...; // checks condition Z on candidate, returns true for match } }; So my question is: What are the OOP equivalents for other SQL constructs, such as joins?

    Read the article

  • PHP OOP properity constant usage

    - by Misiur
    Hi there. I'm really new to OOP. I'm even not a newbie - I'm noob. So. I want to transfer my pseudo-CMS from "normal" programming, into OOP programming system. And so: private static $dsn = DB_TYPE.':host='.DB_HOST.';dbname='.DB_NAME; What here causes problem? Usage of constraints? I don't know. My editor (aptana studio) shows error after 1 constant. Thanks

    Read the article

  • C++ Typing and OOP child classes

    - by Zack
    I'm a bit confused: If I have a base class A, and a class B which extends A, can a variable of the type A hold a value of the type B and vice versa? If yes, why? Aren't they completely different even if B is derived from A? How about type-safety? If this is possible, what things do I have to mind when taking use of this? How would this work out in terms of performance? Note: Sorry if I asked too many questions, just ignore them and just look out for those "marked" with the list decoration dot :) Also, this is not my homework. I'm a hobby programmer and have skills in scripting languages with OOP, yet I'm relatively new to OOP typing in C++.

    Read the article

  • Installing Apache2 and PHP5 on a XServe G5 running 10.4

    - by Chris
    Hello- I have an Apple XServe G5, running OS X Server 10.4. I want to update my Apache installation from 1.3 to 2 and PHP to 5. I also want to install PHP GD support. I have scoured the internet for a guide on how to do this, but to no avail. I also tried to use Entropy to install PHP 5 several times, and it always manages to royally mess up my system. Obviously I can't install Leopard or Snow Leopard because it is a PowerPC processor. Can anyone give me any tips on how to get this software updated or point me to a guide? Thanks, Chris

    Read the article

  • How can I override mod-php5's .php mapping to php4-cgi per VirtualHost or Directory?

    - by geocoo
    I am running Debian Linux with apache2 and libapache2-mod-php5 5.3.3-7. I have one VirtualHost which requires php4. So I researched and compiled php4-cgi. However, I cannot seem to: Override mod-php5's mapping of .php in that vhost (or even globally, without disabling php completley). Even find where that mapping is made, in hope of disabling it and enabling mod-php5 or php4-cgi per vhost. This is my php4-cgi mapping (Inside the one php4 vhost): ScriptAlias /php4 /usr/local/php4/bin <Directory /usr/local/php4/bin> Options +ExecCGI +FollowSymLinks </Directory> <Directory /www/test> AddHandler php4-cgi-script .php Action php4-cgi-script /php4/php Options +ExecCGI </Directory> This does not work, mod-php5 still runs all .php files in that vhost/directory. If I change the file extension in the AddHandler above from .php to .php4, then .php4 files do run php4-cgi as expected, but I can't change all the files in the app to .php4. I thought maybe I could disable the mod-php5's mapping in my vhost or directory, then do my cgi-config (as above) but many combinations of these in different contexts did not work: RemoveHandler .php RemoveType .php php_flag engine off (this seems to even disable my php4-cgi so that wont work) The only other place I can find any mapping is in /etc/mime.types, but commenting out the relevant lines and restarting apache2 does not affect mod-php5's .php mapping. I have searched as much as I can, it is now a mystery to me. Any help or direction would be greatly appreciated.

    Read the article

  • compiling php5.4 on macosx 10.6.8

    - by ling
    I'm trying to compile php 5.4.7 on mac osx 10.6.8. I could install it using the default procedure: ./configure \ --prefix=/usr/local \ --with-config-file-path=/usr/local/etc \ --with-apxs2=/usr/local/apache2/bin/apxs \ --with-mysql sudo make clean sudo make sudo make install But now if I try to install to compile php with the curl module it fails: ./configure \ --prefix=/usr/local \ --with-config-file-path=/usr/local/etc \ --with-curl=/usr \ --with-apxs2=/usr/local/apache2/bin/apxs \ --with-mysql sudo make clean sudo make = last lines of make output: Undefined symbols: "_CRYPTO_set_locking_callback", referenced from: _zm_shutdown_curl in interface.o _zm_startup_curl in interface.o "_CRYPTO_num_locks", referenced from: _zm_shutdown_curl in interface.o _zm_startup_curl in interface.o "_CRYPTO_get_id_callback", referenced from: _zm_startup_curl in interface.o "_CRYPTO_set_id_callback", referenced from: _zm_shutdown_curl in interface.o _zm_startup_curl in interface.o ld: symbol(s) not found collect2: ld returned 1 exit status make: * [libs/libphp5.bundle] Error 1 I read somewhere ( http://user.xmission.com/~georgeps/documentation/tutorials/compilation_and_makefiles.html ) that in this case, I should tell the compiler where to find the missing library, so that it can links the missing files. The problem is that I don't what library I should look for, is it libssl2 ?

    Read the article

  • How can I enable PHP5 for a site? Having problems with every single method.

    - by user347662
    I'm working on a client site that is hosted on someone's DIY Debian Linux server [Apache/1.3.33 (Debian GNU/Linux)], and I'm trying to install a script that requires PHP5. By default, the server parses .php files with PHP 4.3.10-22, which is configured at /etc/php4/apache/php.ini, according to phpinfo(). On the server I can see a config directory for PHP5 adjacent to the PHP4 directory: /etc/php5.0/apache2/php.ini. I have tried multiple methods to enable PHP5 for the document root where the site's files are hosted, including all available methods mentioned here. By far, the most common suggestion I've found is to add one or both of the following lines to the site's .htaccess file: AddHandler application/x-httpd-php5 .php AddType application/x-httpd-php5 .php Trouble is, when either or both of those lines are present, the site forces my browser to download any .php files requested, without parsing the PHP at all. All of the other methods mentioned in the above article cause a 500 Internal Server Error. There is no hosting control panel I can access in a browser to enable PHP5 for the site, but I do have shell access. When I asked the server administrator about this issue, he encouraged me to search for the answer on Google. Where could I begin to troubleshoot this issue? Are there ways to test or verify the server's specific PHP5 installation and configuration, using the command line or some other method? Do you have other suggestions to enable PHP5?

    Read the article

  • Understanding OOP Principles in passing around objects/values

    - by Hans
    I'm not quite grokking a couple of things in OOP and I'm going to use a fictional understanding of SO to see if I can get help understand. So, on this page we have a question. You can comment on the question. There are also answers. You can comment on the answers. Question - comment - comment - comment Answer -comment Answer -comment -comment -comment Answer -comment -comment So, I'm imagining a very high level understanding of this type of system (in PHP, not .Net as I am not yet familiar with .Net) would be like: $question = new Question; $question->load($this_question_id); // from the URL probably echo $question->getTitle(); To load the answers, I imagine it's something like this ("A"): $answers = new Answers; $answers->loadFromQuestion($question->getID()); // or $answers->loadFromQuestion($this_question_id); while($answer = $answers->getAnswer()) { echo $answer->showFormatted(); } Or, would you do ("B"): $answers->setQuestion($question); // inject the whole obj, so we have access to all the data and public methods in $question $answers->loadFromQuestion(); // the ID would be found via $this->question->getID() instead of from the argument passed in while($answer = $answers->getAnswer()) { echo $answer->showFormatted(); } I guess my problem is, I don't know when or if I should be passing in an entire object, and when I should just be passing in a value. Passing in the entire object gives me a lot of flexibility, but it's more memory and subject to change, I'd guess (like a property or method rename). If "A" style is better, why not just use a function? OOP seems pointless here. Thanks, Hans

    Read the article

  • php OOP function declarations

    - by kris
    I'm a big fan of OOP in php, but i feel like defining class methods gets disorganized so fast. I have a pretty good background in OOP in C++, and i am pretty comfortable with how it is handled there, and am curious if there are ways to do it similarly in php. To be more specific, here is what i mean. I like how in C++ you can define a class header (myclass.h) and then define the actual details of the functions in the implementation file (myclass.cc). Ive found that this can easily be replicated using interfaces in php, but i havent found a good solution for the following: I like to organize my code in C++ in different files based on how they are accessed, so for example, public methods that can be called outside of the class would be in 1 place, and private methods would be organized somewhere else - this is personal preference. Ive tried to define class methods in php like: private function MyPHPClass::myFunction(){ } when the definition isnt directly inside the class block( { } ), but i havent had any success doing this. Ive been through all of the pages on php.net, but couldnt find anything like this. Im assuming that there is no support for something like this, but thought i would ask anyway. thanks

    Read the article

  • Large Switch statements: Bad OOP?

    - by Mystere Man
    I've always been of the opinion that large switch statements are a symptom of bad OOP design. In the past, I've read articles that discuss this topic and they have provided altnerative OOP based approaches, typically based on polymorphism to instantiate the right object to handle the case. I'm now in a situation that has a monsterous switch statement based on a stream of data from a TCP socket in which the protocol consists of basically newline terminated command, followed by lines of data, followed by an end marker. The command can be one of 100 different commands, so I'd like to find a way to reduce this monster switch statement to something more manageable. I've done some googling to find the solutions I recall, but sadly, Google has become a wasteland of irrelevant results for many kinds of queries these days. Are there any patterns for this sort of problem? Any suggestions on possible implementations? One thought I had was to use a dictionary lookup, matching the command text to the object type to instantiate. This has the nice advantage of merely creating a new object and inserting a new command/type in the table for any new commands. However, this also has the problem of type explosion. I now need 100 new classes, plus I have to find a way to interface them cleanly to the data model. Is the "one true switch statement" really the way to go? I'd appreciate your thoughts, opinions, or comments.

    Read the article

  • Objective-C As A First OOP Language?

    - by Daniel Scocco
    I am just finishing the second semester of my CS degree. So far I learned C, all the fundamental algorithms and data structures (e.g., searching, sorting, linked lists, heaps, hash tables, trees, graphs, etc). Next year we'll start with OOP, using either Java or C++. Recently I got some ideas for some iPhone apps and got itchy to start working on them. However I heard some bad things about Objectice-C in the past, so I am wondering if learning it as my first OOP language could be a problem. Not to mention that I think it will be hard to find books/online courses that teach basic OOP concepts using Objective-C to illustrate the concepts (as opposed to books using Java or C++, which are plenty), so this could be another problem. In summary: should I start learning Objective-C and OOP concepts right now by my own, or wait one more semester until I learn Java/C++ at university and then jump into Objective-C? Update: For those interested in getting started with OOP via Objective-C I just found some nice tutorials inside Apple's Developer Library - http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/OOP_ObjC/Introduction/Introduction.html

    Read the article

  • Composing programs from small simple pieces: OOP vs Functional Programming

    - by Jay Godse
    I started programming when imperative programming languages such as C were virtually the only game in town for paid gigs. I'm not a computer scientist by training so I was only exposed to Assembler and Pascal in school, and not Lisp or Prolog. Over the 1990s, Object-Oriented Programming (OOP) became more popular because one of the marketing memes for OOP was that complex programs could be composed of loosely coupled but well-defined, well-tested, cohesive, and reusable classes and objects. And in many cases that is quite true. Once I learned object-oriented programming my C programs became better because I structured them more like classes and objects. In the last few years (2008-2014) I have programmed in Ruby, an OOP language. However, Ruby has many functional programming (FP) features such as lambdas and procs, which enable a different style of programming using recursion, currying, lazy evaluation and the like. (Through ignorance I am at a loss to explain why these techniques are so great). Very recently, I have written code to use methods from the Ruby Enumerable library, such as map(), reduce(), and select(). Apparently this is a functional style of programming. I have found that using these methods significantly reduce code volume, and make my code easier to debug. Upon reading more about FP, one of the marketing claims made by advocates is that FP enables developers to compose programs out of small well-defined, well-tested, and reusable functions, which leads to less buggy code, and low code volume. QUESTIONS: Is the composition of complex program by using FP techniques contradictory to or complementary to composition of a complex program by using OOP techniques? In which situations is OOP more effective, and when is FP more effective? Is it possible to use both techniques in the same complex program? Do the techniques overlap or contradict each other?

    Read the article

  • Is OOP hard because it is not natural?

    - by zvrba
    One can often hear that OOP naturally corresponds to the way people think about the world. But I would strongly disagree with this statement: We (or at least I) conceptualize the world in terms of relationships between things we encounter, but the focus of OOP is designing individual classes and their hierarchies. Note that, in everyday life, relationships and actions exist mostly between objects that would have been instances of unrelated classes in OOP. Examples of such relationships are: "my screen is on top of the table"; "I (a human being) am sitting on a chair"; "a car is on the road"; "I am typing on the keyboard"; "the coffee machine boils water", "the text is shown in the terminal window." We think in terms of bivalent (sometimes trivalent, as, for example in, "I gave you flowers") verbs where the verb is the action (relation) that operates on two objects to produce some result/action. The focus is on action, and the two (or three) [grammatical] objects have equal importance. Contrast that with OOP where you first have to find one object (noun) and tell it to perform some action on another object. The way of thinking is shifted from actions/verbs operating on nouns to nouns operating on nouns -- it is as if everything is being said in passive or reflexive voice, e.g., "the text is being shown by the terminal window". Or maybe "the text draws itself on the terminal window". Not only is the focus shifted to nouns, but one of the nouns (let's call it grammatical subject) is given higher "importance" than the other (grammatical object). Thus one must decide whether one will say terminalWindow.show(someText) or someText.show(terminalWindow). But why burden people with such trivial decisions with no operational consequences when one really means show(terminalWindow, someText)? [Consequences are operationally insignificant -- in both cases the text is shown on the terminal window -- but can be very serious in the design of class hierarchies and a "wrong" choice can lead to convoluted and hard to maintain code.] I would therefore argue that the mainstream way of doing OOP (class-based, single-dispatch) is hard because it IS UNNATURAL and does not correspond to how humans think about the world. Generic methods from CLOS are closer to my way of thinking, but, alas, this is not widespread approach. Given these problems, how/why did it happen that the currently mainstream way of doing OOP became so popular? And what, if anything, can be done to dethrone it?

    Read the article

  • php5 , how makes templates?

    - by oussama17
    I am currently developing a social network using PHP5 without any framework , I create the template by this method , every time I put the header -content -footer but I found that the previous template still there , how can I make templates with this method and show me the path to the best method to play with templates in PHP5.public function affiche($afficheTPL){ $this->registry->getObject('template')->addTemplateBit('hello', 'hellop.tpl.php'); $this->registry -> getObject('template') -> buildFromTemplates($afficheTPL.'/header.tpl.php', $afficheTPL.'/main.tpl.php', $afficheTPL.'/footer.tpl.php'); $this->registry -> getObject('template') -> parseOutput(); print $this -> registry -> getObject('template') -> getPage() -> getContentToPrint(); }

    Read the article

  • Best Practise/Subjective: Implement a finite state automaton in OOP

    - by poeschlorn
    Hi guys, I am thinking about implementing a programm with finite state automaton in an OOP language like Java or C++. What would you think is the best way to implement this with a manageable amount of available states, regarding to good software design? Is it good to implement for each state an own class? If yes, how to do the bridge between two states? Thanks for any comment!

    Read the article

  • I dont understand Access modifiers in OOP (JAVA)

    - by Imran
    I know this is a silly question but i don't understand Access Modifiers in OOP. Why do we make for example in JAVA instance variables private and then use public getter and setter methods to access them? I mean whats the reasoning/logic behind this? You still get to the instance variable but why use setter and getter methods when you can just make your variables public? please excuse my ignorance as i'm simply trying to understand why we do this? Thank you in advance;-)

    Read the article

  • How to emulate OOP with C?

    - by Francisco Garcia
    I would like to know which articles or books are good to use OOP concepts in C. I mean things like using function pointers to emulate classes, strict naming conventions to emulate namespaces, and things like that. Also a reference about how to code in C different types of UML diagrams would be great.

    Read the article

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