128 Topics

Member Avatar for
Member Avatar for dimitrilc

## Introduction ## There are many ways to design secure Java objects. In this tutorial, we are going to learn how to create secure Java objects by understanding **Accessibility**, **Extensibility**, and **Immutability**. ## Goals ## At the end of this tutorial, you would have learned: 1. Understand how and why …

Member Avatar for JamesCherrill
2
144
Member Avatar for seularts

I have 2 files: apix.php and crud.php. I am trying to convert the fetched data from php to a jason print. The issue is that the function does not the results for me to parse in the next section of my code. The CRUD.php: class crud { private $db; function …

Member Avatar for seularts
0
450
Member Avatar for Violet_82

Hi guys, I wonder if you can help. As I've started as a programmer, I've been told I have to practice OO a bit more. I've done the theory, but I think I will have to take another look at it. , Above all though, I have to do exercises. …

Member Avatar for AssertNull
1
582
Member Avatar for veedeoo

This is a continuation of our basic tutorial on MVC Framework. In this section, we will be creating the template files for both the TBS and the Smarty template engines. **The recap** In [part one](http://www.daniweb.com/web-development/php/tutorials/476695/part-one-php-mvc-framework-understanding-the-basics), we have created application controllers, models, and the one and only lone View class. Once …

Member Avatar for Geetha_1
3
8K
Member Avatar for Sphinx'LostNose

Normally you can do this and pass the reference type by reference and the new keyword won't make the variables point to different objects: static void Main(string[] args) { Object origObj = new Object(); ExampleMethod(ref origObj); } void ExampleMethod(ref Object newObj) { //origObj will also reference the newly created object …

Member Avatar for ddanbe
0
235
Member Avatar for jkon

Although objects collections have a place in the PHP world many years now , their use is now flourishing because more and more PHP programmers turn to OOP. This tutorial is a sequel of https://www.daniweb.com/programming/web-development/tutorials/500118/a-simple-data-layer-for-oop-php-applications (we will refer to it as “previous tutorial”) and https://www.daniweb.com/programming/web-development/tutorials/500118/a-simple-data-layer-for-oop-php-applications , in order to understand …

Member Avatar for jkon
2
809
Member Avatar for loldafuq

Here is what i have to do Create Class CSalary with private member variables string m_strProfession double m_dSalary Constructors:Default,Copy,Explicit Functions: 1/string GetProf(void),double GetSalary(void) 2/SetProf(const string val),SetSalary(const double val) 3/Output(ostream&) and Input(istram&) 4/Operators:<<,>>,=,==,<,double operator*(const CSalary&obj) Create Class CCalcCorr with private member variables: vector<CSalary>m_vCity1//data for city 1 vector<CSalary>m_vCity2//data for city 2 double …

Member Avatar for tinstaafl
0
353
Member Avatar for jkon

Hello, This tutorial is the next of “[A simple Data Layer for OOP PHP Applications](https://www.daniweb.com/programming/web-development/tutorials/500118/a-simple-data-layer-for-oop-php-applications)” so having read it and made your own tests is needed to understanding what we are doing. So far we have a Db object (child of PDO that standardize and simplifies its use) , a …

Member Avatar for jkon
4
592
Member Avatar for toxicandy

First off, here is the code I will be referencing: package com.airamerica.dataConversion; import com.airamerica.Airports; import com.airamerica.Person; import com.airamerica.Products.Products; import com.airamerica.Products.Tickets; public class FindObject { public static Airports findAirport(String airportCode, Airports [] airportsArray){ Airports airport = null; for(int j = 0; j < airportsArray.length; j++) { if (airportCode.equals(airportsArray[j].getCode())){ airport = airportsArray[j]; …

Member Avatar for overwraith
0
286
Member Avatar for rpv_sen

Hi I am trying to create a update function. But it not updating in the database. Please help me to fix. **Test-2.php** $whereString = ''; $bind = NULL; if(isset($_POST['Submit'])) { if($_POST) { $SCYQ64UKID = $_GET['SCYQ64UKID']; $SCYQ64AVGP = $_POST['SCYQ64AVGP']*100; $searchFields = array('SCYQ64EMAL'=>$_POST['SCYQ64EMAL'],'SCYQ64EV01'=>$_POST['SCYQ64EV01'],'SCYQ64EV02'=>$_POST['SCYQ64EV02'],'SCYQ64EV03'=>$_POST['SCYQ64EV03'],'SCYQ64EV04'=>$_POST['SCYQ64EV04'],'SCYQ64EV05'=>$_POST['SCYQ64EV05'],'SCYQ64EV06'=>$_POST['SCYQ64EV06'],'SCUSER'=>$_POST['SCUSER'],'SCYQ64AVGP'=>$SCYQ64AVGP,'SCYQ64TZ'=>$_POST['SCYQ64TZ'],'SCJOBN'=>gethostname(),'SCPID'=>'SSWEB','SCUPMJ'=>$_POST['SCUPMJ'],'SCUPMT'=>$_POST['SCUPMT']); if($post = array_filter($_POST)) { if($fields = array_intersect_key($searchFields, $post)) { …

Member Avatar for rpv_sen
0
449
Member Avatar for rpv_sen

Hi I am trying to display count of a row using function with get values. Please help me to fix the issue **class** class Users { private $conn; private $db_name= "DATABASE"; public function __construct($db) { $this->conn = $db; } /*Join Two Tables with where condition and order by*/ public function …

Member Avatar for rpv_sen
0
575
Member Avatar for rpv_sen

I have created a function. if i provide correct username and password. i am getting a error message as **Sorry, that username / password is invalid !** can any one please help me to fix the issue. **login.php** <?php require 'include/init.php'; $general->logged_in_protect(); if(empty($_POST) === false) { $username = trim($_POST['username']); $password …

Member Avatar for rpv_sen
0
573
Member Avatar for rpv_sen

Hi I am trying to connection my database ODBC using function. I am getting an error **Connection error: could not find driver** **mycode is** <?php class Database{ // specify your own database credentials private $host = "servername"; private $db_name = "databsename.schemaname"; private $username = "username"; private $password = "password"; public …

Member Avatar for rpv_sen
0
3K
Member Avatar for veedeoo

This tutorial is intended for people who are looking for alternative to PHP template engines like smarty, twig, dwoo, TBS, and others. Not all developers are willing to take the extra efforts needed to learn the template engine syntax. Some are just left behind thinking that PHP is a template …

Member Avatar for Gideon_1
6
2K
Member Avatar for m-soft

Hi, Reading CodeIgnitier documentation I saw some statements having this form: $this->someword->somefunction(); and I don't know what is that. Is someword an multi-dimensional/associative array? I know that if I create an instance of a class I can access its properties and functions with a single -> operator or with :: …

Member Avatar for pritaeas
0
148
Member Avatar for jay.barnes

Hi all, I've been working with PHP, using procedural methods, for several years now, and have begun to explore the object-oriented side of it. While it didn't take me long to understand the potential advantages that come with working in this manner, I'm still having some trouble wrapping my head …

Member Avatar for jay.barnes
0
416
Member Avatar for G_S

Hello everyone. I am currently making some database connection modules in Python inb order to learn Python's approach to OOP and also to lear how to connect to databases via Python. I successfully made a package with modules for postgres, mysql, sqlite3, and MongoDB. The classes simply connect, disconnect and …

Member Avatar for Gribouillis
0
514
Member Avatar for SkateX

Greetings, I'm having problems with my output. Essentially I am just trying to print out any Cat who is over 3 years old and has Claws. But my output keeps printing out either nothing at all or the 3rd cat 3 times. I've struggled with this for hours trying to …

Member Avatar for JamesCherrill
0
296
Member Avatar for samson.dadson.3_1

the problem I have here is: when I input an integer it works fine, but when i input any other thing, it doesn't give me a chance to input again when the loop iterates, it just keeps printing "error type the right thing" to the screen even though "cin var" …

Member Avatar for samson.dadson.3_1
0
2K
Member Avatar for kxjakkk

I'm trying to write a boolean function that takes two Mytime objects, t1 and t2 as arguments, and returns True if the object falls inbetween the two times. This is a question from the How to Think Like a Computer Scientist book, and I need help. What I've gotten so …

Member Avatar for David W
0
440
Member Avatar for Builder_1

please tell me in how many ways OBJECT ORIENTED PROGRAMMING is different from procedural programming in JAVA

Member Avatar for JamesCherrill
0
292
Member Avatar for veedeoo

**Part One**: Learning the Basic Patterns **Disclaimer**: please pardon my spellogrammatico errors. I am not really a rough draft person. I type and write codes the split seconds as they crossed my mind, otherwise I will get extremely lazy and then will eventually hibernate like a tardigrade. I hope I …

Member Avatar for veedeoo
3
2K
Member Avatar for raminshahab

I can't seem to get a response from my query method. I have a database connection from method ping_server and use mysqli as connector. Can anyone help me figure out why I cannot print results from mysqli_fetch_array. dbclass.php class db { private $connection; private $selectdb; private $lastQuery; private $config; function …

Member Avatar for raminshahab
0
345
Member Avatar for tunisia

I'm trying to modify this code to take advantage of classes and some other oop features. However, I'm struggling with getting beyond the basics. This is the code that I started with which I am trying to change and make more class absed. import glob import os import sys print(os.getcwd()) …

0
199
Member Avatar for BenWard

Hi, I've got a class in PHP with an array of objects in it. I need to loop through these objects and call 2 methods on them but I'm not sure of the best approach. When dealing with arrays, if you use foreach, you can't seem to update the actual …

Member Avatar for BenWard
0
232
Member Avatar for Robert Rusu

First things first, the story about this article. Recently I've created an Wordpress Plugin [WordPress - WP - Keywords To Tooltip | CodeCanyon](http://codecanyon.net/item/wp-keywords-to-tooltip/6513598) After a few days, somebody asked me if it's working with Wordpress Multi Site, initially scared, I didn't expect it to be so easy, I've achieved the …

Member Avatar for Robert Rusu
2
400
Member Avatar for Qazi_1

Hi guys, Tomorrow is my theory paper exam of C++ OOP and Data Strucutre. Paper will be based on 50% theory Q/A and 50% on coding implentaion. Can you give me some hints to prepare for this coming exam? PS. I have gone throw all lectures slides and course material, …

Member Avatar for mathijs
0
253
Member Avatar for annyangel

hlo all, i need to write a code in php oop for registration without using form and data directly goes in the database. i try to write the code for this. i show u that code and help me to correct that or by giving me another code. the database …

Member Avatar for annyangel
0
237
Member Avatar for Gaetane

This started out as `I love PHP traits! I'm going to use them everywhere! ^_^` and now it has turned into a `Thought Exercise / Learning Experience >_<`. Consider the following example: trait TheErrorOfYourWays{ public function booboo(){ echo 'You had a booboo :('; } } trait SpectacularStuff1 { use TheErrorOfYourWays; …

Member Avatar for Gaetane
2
2K
Member Avatar for diafol

Having just found 'traits' - see http://www.daniweb.com/web-development/php/threads/468928/php-trait-method-conflicts-trait-inheritance#post2043565 I was wondering whether they could be used to share a DB connection object across disparate classes, or would the old singleton or dependency injection methods still be the way to go? I'd value any views on this.

Member Avatar for diafol
2
713

The End.