FAQ Database Discussion Community


Have Laravel load an alternate public folder on development machine

php,laravel,public
We have a build script that minimizes javascript/css and then copies it into the public folder. What I'd like is for development boxes to load files from the app folder, where the unminimized scripts are stored on dev boxes, but still run the minimized scripts on production. WHAT I'VE TRIED...

(Java) modifying public static variables

java,constructor,static,private,public
kinda new here. Anyways, I'm relatively new to Java, this is some practice questions from uni, I have one question. How do I make it so that TOTAL_RESERVES can't be modified by an outside. Right now if I say Gold.TOTAL_RESERVES = 500; That changes the value of it. How do...

c++ class: using a private array in a public function?

c++,arrays,class,private,public
Here's the code I'm working with in the header file: #ifndef TETRIS_TETRIMINO #define TETRIS_TETRIMINO const int TETRIMINO_GRID_SIZE = 4; struct Location { int row; int col; }; class Tetrimino { private: int grid[TETRIMINO_GRID_SIZE][TETRIMINO_GRID_SIZE]; char color; Location location; public: // constructor Tetrimino(int type = 7); // valid type values are 0-6...

Needing a private and public method for the same recursive function

c++,recursion,methods,private,public
We have recently been working on implementing recursive methods for several classes (trees, heaps, queues, linked lists, etc) in C++ for my computer science class. I have not been having any trouble writing the implementations for the methods, but something my professor mentioned briefly in passing confused me and she...

What does prepending '&' to a function name mean in PHP? [duplicate]

php,function,reference,public,static-function
This question already has an answer here: What does it mean to start a PHP function with an ampersand? 2 answers I'm using a CMS package written in PHP. In one of it's core files I saw following line that is for defining a function in a class body....

swift: declare public variable

ios,xcode,variables,swift,public
class XYActivity: UIActivity,YouTubeHelperDelegate { var youTubeHelper:YouTubeHelper var uploadURL: String! override init() { self.youTubeHelper = YouTubeHelper() } override func activityType() -> String? { return nil } // } I want to make uploadURL public, That is, to be assigned in other class. When I add public infront of var uploadURL:String! it...

setting public property in a private function executed on initialization Javascript

javascript,constructor,private,public
I have an object with myObj = function(){ this.myPublicMember = null; function privateInitFunc(){ this.myPublicMember = "blah blah test"; } privateInitFunc() } myObj.prototype = { getPublicMember: function(){ console.log(this.myPublicMember) } } and I instantiate like: var a = new myObj(); a.getPublicMember // logs Null! How do I set a public property in...

why public methods are there in object class?they can be protected and will keep thing more private

java,private,public,protected,access-specifier
As for java architecture is concern "to keep things as much private as possible".Thats why finalize method is protected in object class. protected void finalize() throws Throwable { } Why is the finalize() method in java.lang.Object “protected”?please have a look on Mehrdad Afshari answer. then why many other method like...

Can't call a public method c# [closed]

c#,class,methods,private,public
namespace ConsoleApplication3 { public class EncapulationTest { public static void publicMethod() { Console.WriteLine("This is the public method from the EncapsulationTest class!"); } private static void privateMethod() { Console.WriteLine("This is the private method from the EncapsulationTest class!"); } } public class Main { public static void Main() { publicMethod(); Console.ReadLine(); }...

How to call a public function from another form

vb.net,forms,function,call,public
Frm1 contains the code for validation of textbox: Public Function AlphabeticalOnly(ByVal Str As String) As Boolean Dim pattern As String = "^[a-zA-Z\s]+$" Dim reg As New Regex(pattern) If reg.IsMatch(Str) = False Then MsgBox(Str & " is invalid! Please enter alphabetical characters only!", MsgBoxStyle.Critical, "Error") End If Return reg.IsMatch(Str) End Function...

How to keep data secured from access via a public directory on apache server

apache,security,public
I have to design a website where users with account will upload images. Many users will upload their images and these images need to visible to the owner only in their account. Normally We have web directory structure like /httpdocs/images/user1_id/file_name.jpg and /httpdocs/images/user2_id/file_name.jpg but this brings security issue that anyone who...

returning reference to private vs public member

c++,qt,reference,private,public
I would like to know what could be reasons to provide a public access method returning a reference instead of making the member public. QPoint has methods int& rxand int& ry that let me directly manipulate the coordinates. I guess the implentation looks similar to this: public: int& rx(){return x;}...

How to get only specific values out of an custom public function

php,public
the function is: public function getData($symbol='', $stat='') { if (is_array($this->symbol)) { $symbol = implode("+", $this->symbol); //The Yahoo! API will take multiple symbols } if($symbol) $this->_setParam('symbol', $symbol); if($stat) $this->_setParam('stat', $stat); $data = $this->_request(); if(!$this->history) { if ($this->stat === 'all') { foreach ($data as $item) { //Add to $return[$symbol] array. Indice 23...

Questions regarding HTTP Public-Key-Pinning (HPKP)

ssl,public,ca,pinning
1. Question: Does HTTP Public-Key-Pinning (HPKP) really improve security? A MITM (e.g. NSA) could intercept the first request to a server and respond with a "faked" certificate, signed by a compromised CA. So HPKP only improves security if the initial connection to a server has not been tampered with, and...

Object-Oriented programming private class field + get / set or public class field?

java,oop,private,public
I'm a junior developer (currently exercise Java) and I have one question about the correctness of my code, here is an example: I am writing a simple MMO-game representation on Java, I have 2 classes (Character and spell). Character has properties (mName, mHealth and mEnergy), Spell class has properties (mSpellName,...

Any ideas of how make internal a base class implementation having a child class of that class public in C#?

c#,inheritance,visibility,public,internal
Any ideas of how make internal a base class having a child class of that class public in c#? In code: internal class Base { } public class Child : Base {} I have a layered architecture and need to expose to other layers (others assemblies) the Child class but...

can es6 class have public properties as well as functions?

javascript,class,properties,public,ecmascript-6
All the examples of classes I see are class myClass{ constructor(){} someFunction(){} what I want to add is someObject {myvalue:value} } this doesn't seem to compile. An old fashioned object would be { somefunction: function(){} someProperty: {myvalue:value} } is this not possible in es6 classes?...

Class created and Public Methods not going over to Test Method

java,class,methods,public
I created a very simple cash register class and wanted to test it in a separate method. When I call the methods created in the class over from the test method, there is an error saying that a certain method is undefined in the class where it was created, when...

Accessing parameters of the same name of different classes in Scala

scala,private,public
I have a very specific scenario, in which I have some different abstract classes the have child case classes that can have different parameters, for example: abstract class ball() {} case class football(_name: String, _shape: String) extends ball case class basketball(_name: String, _size: Int) extends ball and a different abstract...

Pinning public key in my app

android,public,pinning
I am pinning public key in my app as part of security measures, for that I have extracted public key from my PEM certificate which looks like -----BEGIN PUBLIC KEY----- MIIBIj....IDAQAB -----END PUBLIC KEY----- However in sample code of OWASP, we do see code to compare DER encoded public key,...

Use variable into php public php function

php,function,class,public
I'm new to php. I have: require_once('tcpdf_include.php'); $poruka = $user['porukanadnu']; class MYPDF extends TCPDF { // Page footer public function Footer() { // Position at 15 mm from bottom $this->SetY(-15); // Set font $this->SetFont('helvetica', 'I', 8); // Page number $this->Cell(0, 10, 'Page '.$poruka, 0, false, 'C', 0, '', 0, false,...