Search Results

Search found 14152 results on 567 pages for 'private'.

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

  • J2ME private folder(only accessible to my midlet)

    - by Shankar
    I have two midlets, one will download some files form server everyday and the other uses these files. If i download the files to a normal folder the mobile user may delete the folder or files manually. So i need a private folder which is hidden and only accessible for my midlets. I heard about private folders which symbian platform provides for each application which are not accessible to users. I need such a folder for my j2me app. How to create such folder?? Shankar

    Read the article

  • How to Access a Private Variable?

    - by SoulBeaver
    This question isn't meant to sound as blatantly insulting as it probably is right now. This is a homework assignment, and the spec sheet is scarce and poorly designed to say the least. We have a function: double refuel( int liter, GasStation *gs ) { // TODO: Access private variable MaxFuel of gs and decrement. } Sound simple enough? It should be, but the class GasStation comes with no function that accesses the private variable MaxFuel. So how can I access it anyway using the function refuel? I'm not considering creating a function setFuel( int liter ) because the teacher always complains rather energetically if I change his specification. So... I guess I have to do some sort of hack around it, but I'm not sure how to go about this without explicitely changing the only function in GasStation and giving it a parameter so that I can call it here. Any hints perhaps?

    Read the article

  • A pragmatic view on private vs public

    - by Denis Gorbachev
    Hello everybody! I've always wondered on the topic of public, protected and private properties. My memory can easily recall times when I had to hack somebody's code, and having the hacked-upon class variables declared as private was always upsetting. Also, there were (more) times I've written a class myself, and had never recognized any potential gain of privatizing the property. I should note here that using public vars is not in my habit: I adhere to the principles of OOP by utilizing getters and setters. So, what's the whole point in these restrictions?

    Read the article

  • delegating into private parts

    - by FredOverflow
    Sometimes, C++'s notion of privacy just baffles me :-) class Foo { struct Bar; Bar* p; public: Bar* operator->() const { return p; } }; struct Foo::Bar { void baz() { std::cout << "inside baz\n"; } }; int main() { Foo::Bar b; // error: 'struct Foo::Bar' is private within this context Foo f; f->baz(); // fine } Since Foo::Bar is private, I cannot declare b in main. Yet I can call methods from Foo::Bar just fine. Why the hell is this allowed? Was that an accident or by design?

    Read the article

  • .NET Properties - Use Private Set or ReadOnly Property?

    - by tgxiii
    In what situation should I use a Private Set on a property versus making it a ReadOnly property? Take into consideration the two very simplistic examples below. First example: Public Class Person Private _name As String Public Property Name As String Get Return _name End Get Private Set(ByVal value As String) _name = value End Set End Property Public Sub WorkOnName() Dim txtInfo As TextInfo = _ Threading.Thread.CurrentThread.CurrentCulture.TextInfo Me.Name = txtInfo.ToTitleCase(Me.Name) End Sub End Class // ---------- public class Person { private string _name; public string Name { get { return _name; } private set { _name = value; } } public void WorkOnName() { TextInfo txtInfo = System.Threading.Thread.CurrentThread.CurrentCulture.TextInfo; this.Name = txtInfo.ToTitleCase(this.Name); } } Second example: Public Class AnotherPerson Private _name As String Public ReadOnly Property Name As String Get Return _name End Get End Property Public Sub WorkOnName() Dim txtInfo As TextInfo = _ Threading.Thread.CurrentThread.CurrentCulture.TextInfo _name = txtInfo.ToTitleCase(_name) End Sub End Class // --------------- public class AnotherPerson { private string _name; public string Name { get { return _name; } } public void WorkOnName() { TextInfo txtInfo = System.Threading.Thread.CurrentThread.CurrentCulture.TextInfo; _name = txtInfo.ToTitleCase(_name); } } They both yield the same results. Is this a situation where there's no right and wrong, and it's just a matter of preference?

    Read the article

  • private class calling a method from its outer class

    - by oxinabox.ucc.asn.au
    Ok, so I have a class for a "Advanced Data Structure" (in this case a kinda tree) SO I implimented a Iterator as a private class with in it. So the iterator needs to implement a remove function to remove the last retuirned element. now my ADT already impliments a remove function, and in this case there is very little (thinking about it, i think nothing) to be gain by implimenting a different remove function for the iterator. so how do I go about calling the remove from my ADT sketch of my struture: public class ADT { ... private class ADT_Iterator impliments java.util.Itorator{ ... public void remove(){ //where I want to call the ADT's remove function from } ... public void remove( Object paramFoo ) { ... } ... } So just calling remove(FooInstance) won't work (will it?) and this.remove(FooInstance) is the same thing. what do i call? (and changign the name of the ADT's remove function is not an option, as that AD T has to meet an Interace wich I am note at liberty to change) I could make both of them call a removeHelper functon, I guess...

    Read the article

  • class modifier issues in C# with "private" classes

    - by devoured elysium
    I had a class that had lots of methods: public class MyClass { public bool checkConditions() { return checkCondition1() && checkCondition2() && checkCondition3(); } ...conditions methods public void DoProcess() { FirstPartOfProcess(); SecondPartOfProcess(); ThirdPartOfProcess(); } ...process methods } I identified two "vital" work areas, and decided to extract those methods to classes of its own: public class MyClass { private readonly MyClassConditions _conditions = new ...; private readonly MyClassProcessExecution = new ...; public bool checkConditions() { return _conditions.checkConditions(); } public void DoProcess() { _process.DoProcess(); } } In Java, I'd define MyClassConditions and MyClassProcessExecution as package protected, but I can't do that in C#. How would you go about doing this in C#? Setting both classes as inner classes of MyClass? I have 2 options: I either define them inside MyClass, having everything in the same file, which looks confusing and ugly, or I can define MyClass as a partial class, having one file for MyClass, other for MyClassConditions and other for MyClassProcessExecution. Defining them as internal? I don't really like that much of the internal modifier, as I don't find these classes add any value at all for the rest of my program/assembly, and I'd like to hide them if possible. It's not like they're gonna be useful/reusable in any other part of the program. Keep them as public? I can't see why, but I've let this option here. Any other? Name it! Thanks

    Read the article

  • (C#) iterate over read-only private collection member

    - by DGH
    I have a class which has two HashSet collections as private members. Other classes in my code would like to be able to iterate over those HashSets and read their contents. I don't want to write a standard getter because another class could still do something like myClass.getHashSet().Clear(); Is there any other way to expose the elements of my HashSets to iteration without exposing the reference to the HashSet itself? I'd love to be able to do this in a way that is compatible with for-each loops.

    Read the article

  • Accessing "Public" methods from "Private" methods in javascript class

    - by mon4goos
    Is there a way to call "public" javascript functions from "private" ones within a class? Check out the class below: function Class() { this.publicMethod = function() { alert("hello"); } privateMethod = function() { publicMethod(); } this.test = function() { privateMethod(); } } Here is the code I run: var class = new Class(); class.test(); Firebug gives this error: publicMethod is not defined: [Break on this error] publicMethod(); Is there some other way to call publicMethod() within privateMethod() without accessing the global class variable [i.e. class.publicMethod()]?

    Read the article

  • List of private iPhone APIs?

    - by diego nunes
    . . Hi there, everybody. . . I need to do an app to be distributed ad hoc (it doesn't need to go to the store) but I need to get the information about the "data usage" (gprs/3g traffic). It is available on the system, but there is no official API call to get that info. One app made it through Apple testing (it's called "Download Meter"), though, and I emailed the guys to see if they would share the call, but they were not in that mood. . . Is there any list of private APIs or anything like that? Does anyone have any ideas of how could I get that info? Again: the app doesn't need to go to the store, but I need to install it on stock iPhone (ad hoc will do). . Thanks.

    Read the article

  • Keeping some files private

    - by user490895
    Hi, I was trying to create a directory of private files that could only be accessed when a user logs in. To do this, I used a folder outside the web directory, and then php to access it, if allowed. Here's an example: function display_movie($file){ printf("<video id='movie' width='960' height='416' controls='controls' onerror='fix()'> <source src='movie.php?file=%s' type='video/ogg; codecs=\"theora, vorbis\"'> </video>", rawurlencode($file)); } This works great for images, but breaks the media player. Also, I've only tested this locally on a Linux machine. Any ideas? Thanks.

    Read the article

  • JScript.NET private variables

    - by Paul Podlipensky
    I'm wondering about JScript.NET private variables. Please take a look on the following code: import System; import System.Windows.Forms; import System.Drawing; var jsPDF = function(){ var state = 0; var beginPage = function(){ state = 2; out('beginPage'); } var out = function(text){ if(state == 2){ var st = 3; } MessageBox.Show(text + ' ' + state); } var addHeader = function(){ out('header'); } return { endDocument: function(){ state = 1; addHeader(); out('endDocument'); }, beginDocument: function(){ beginPage(); } } } var j = new jsPDF(); j.beginDocument(); j.endDocument(); Output: beginPage 2 header 2 endDocument 2 if I run the same script in any browser, the output is: beginPage 2 header 1 endDocument 1 Why it is so?? Thanks, Paul.

    Read the article

  • ERROR: iPhone Private Frameworks "No such file or directory"

    - by WrightsCS
    I have added Private Frameworks To my project. When I build in DEVICE | RELEASE everything works fine and I am able to ldid -S the application and it successfully launches on my device. However, when trying to BUILD AND GO in Simulator, I get the error "No such file or directory" as indicated below: (I also get the error twice which is strange too.) Line Location HomeProfileViewController.h:10: error: BluetoothManager/BluetoothManager.h: No such file or directory Below are the project and build settings that I currently have, maybe someone can find a mistake and let me know, that would be awesome! PROJECT SETTINGS: PRIVATE_HEADERS_FOLDER_PATH = "/Developer/SDKs/iPhoneOS.sdk/Versions/iPhoneOS3.0.sdk/include" PUBLIC_HEADERS_FOLDER_PATH = "/Developer/SDKs/iPhoneOS.sdk/Versions/iPhoneOS3.0.sdk/include" USER_HEADER_SEARCH_PATHS = "/Developer/SDKs/iPhoneOS.sdk/Versions/iPhoneOS3.0.sdk/include" OTHER_CFLAGS = "-I/Developer/SDKs/iPhoneOS.sdk/Versions/iPhoneOS3.0.sdk/include-I/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.0.sdk/usr/include-I/Developer/Platforms/iPhoneOS.platform/Developer/usr/lib/gcc/arm-apple-darwin9/4.0.1/include-F/System/Library/Frameworks-F/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.0.sdk/System/Library/Frameworks-F/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.0.sdk/System/Library/PrivateFrameworks-DMAC_OS_X_VERSION_MAX_ALLOWED=1050" TARGET BUILD SETTINGS: PRIVATE_HEADERS_FOLDER_PATH = "/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.0.sdk/System/Library/PrivateFrameworks" FRAMEWORK_SEARCH_PATHS = "$(inherited) $(SDKROOT)$(SYSTEM_LIBRARY_DIR)/PrivateFrameworks" USER_HEADER_SEARCH_PATHS = "/Developer/SDKs/iPhoneOS.sdk/Versions/iPhoneOS3.0.sdk/include/**" OTHER_CFLAGS = "-I/Developer/SDKs/iPhoneOS.sdk/Versions/iPhoneOS3.0.sdk/include-I/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.0.sdk/usr/include-I/Developer/Platforms/iPhoneOS.platform/Developer/usr/lib/gcc/arm-apple-darwin9/4.0.1/include-F/System/Library/Frameworks-F/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.0.sdk/System/Library/Frameworks-F/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.0.sdk/System/Library/PrivateFrameworks-DMAC_OS_X_VERSION_MAX_ALLOWED=1050" Note: The quotation marks in the paths aren't actually in my project, I put them in so the site will syntax them better. Cydia

    Read the article

  • Is private members hacking a defined behaviour ?

    - by ereOn
    Hi, Lets say I have the following class: class BritneySpears { public: int getValue() { return m_value; }; private: int m_value; }; Which is an external library (that I can't change). I obviously can't change the value of m_value, only read it. Even subclassing BritneySpears won't work. What if I define the following class: class AshtonKutcher { public: int getValue() { return m_value; }; public: int m_value; }; And then do: BritneySpears b; // Here comes the ugly hack AshtonKutcher* a = reinterpret_cast<AshtonKutcher*>(&b); a->m_value = 17; // Print out the value std::cout << b.getValue() << std::endl; I know this is a bad practice. But just for curiosity: is this guaranted to work ? Is it a defined behaviour ? Bonus question: Have you ever had to use such an ugly hack ? Thanks !

    Read the article

  • Javascript private member on prototype...

    - by Wilq32
    Well I tried to figure out is this possible in any way. Here is code: a=function(text) { var b=text; if (!arguments.callee.prototype.get) arguments.callee.prototype.get=function() { return b; } else alert('already created!'); } var c=new a("test"); // creates prototype instance of getter var d=new a("ojoj"); // alerts already created alert(c.get()) // alerts test alert(d.get()) // alerts test from context of creating prototype function :( As you see I tried to create prototype getter. For what? Well if you write something like this: a=function(text) { var b=text; this.getText=function(){ return b} } ... everything should be fine.. but in fact every time I create object - i create getText function that uses memory. I would like to have one prototypical function lying in memory that would do the same... Any ideas? EDIT: I tried solution given by Christoph, and it seems that its only known solution for now. It need to remember id information to retrieve value from context, but whole idea is nice for me :) Id is only one thing to remember, everything else can be stored once in memory. In fact you could store a lot of private members this way, and use anytime only one id. Actually this is satisfying me :) (unless someone got better idea). someFunc = function() { var store = new Array(); var guid=0; var someFunc = function(text) { this.__guid=guid; store[guid++]=text; } someFunc.prototype.getValue=function() { return store[this.__guid]; } return someFunc; }() a=new someFunc("test"); b=new someFunc("test2"); alert(a.getValue()); alert(b.getValue());

    Read the article

  • Outside classes accessing package-private methods

    - by Jake
    Suppose I have a class in my package org.jake and it has a method with default access (no modifier). Then the method is visible inside the package only. However, when someone receives the jar of my framework, what is to stop them from writing a new class, declaring its package as org.jake, and using my supposedly invisible method? In other words, is there anything I can do to prevent them from doing that?

    Read the article

  • How to use Private Inheritence aka C++ in C# and Why not it is present in C#

    - by Vijay
    I know that private inheritance is supported in C++ and only public inheritance is supported in C#. I also came across an article which says that private inheritance usually defines a HAS-A relationship and kind of an aggregation relationship between the classes. EDIT: C++ code for private inheritance: The "Car has-a Engine" relationship can also be expressed using private inheritance: class Car : private Engine { // Car has-a Engine public: Car() : Engine(8) { } // Initializes this Car with 8 cylinders using Engine::start; // Start this Car by starting its Engine }; Now, Is there a way to create a HAS-A relationship between C# classes which is one of the thing that I would like to know - HOW? Another curious question is why doesn't C# support the private (and also protected) inheritance ? - Is not supporting multiple implementation inheritance a valid reason or any other? Is private (and protected) inheritance planned for future versions of C#? Will supporting the private (and protected) inheritance in C# make it a better and widely used language?

    Read the article

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