internal

How to limit subclassing of public abstact class to types in same assembly and thus allow protected members typed to internal types

你离开我真会死。 提交于 2019-12-04 03:24:55
问题 This question is similar to c# internal abstract class, how to hide usage outside but my motiviation is different. Here is the scenario I started with the following: internal class InternalTypeA {...} public class PublicClass { private readonly InternalTypeA _fieldA; ... } The above compiles fine. But then I decided that I should extract a base class and tried to write the following: public abstract class PublicBaseClass { protected readonly InternalTypeA _fieldA; ... } And thus the problem,

Saving public files in the internal storage

荒凉一梦 提交于 2019-12-03 23:35:15
I have an application that saves files downloaded from a server. These files are not private to my application and should be accessible to other applications as well. I want to know what would be the correct path to save these files when the SD card is ABSENT. For the SD card, there is the well known API - getExternalStorageDirectory() For the application's private data in the internal memory there is - Context.getFilesDir() On some devices, the internal memory is represented by /emmc/. It will be really helpful if someone could elaborate on /emmc/. I know it stands for embedded Memory card

PHP: friend classes and ungreedy caller function/class

徘徊边缘 提交于 2019-12-03 21:49:33
Is there any way to get the caller function with something else than debug_backtrace()? I'm looking for a less greedy way to simulate scopes like friend or internal . Let's say I have a class A and a class B. Until now, I've been using debug_backtrace() , which is too greedy (IMHO). I thought of something like this: <?php class A { public function __construct(B $callerObj) {} } class B { public function someMethod() { $obj = new A($this); } } ?> It might be OK if you want to limit it to one specific class, but let's say I have 300 classes, and I want to limit it to 25 of them? One way could be

Android Internal Storage when updating application

醉酒当歌 提交于 2019-12-03 09:10:37
问题 I use the internal storage (http://developer.android.com/guide/topics/data/data-storage.html#filesInternal) to store some necessary application files, that the user creates. I suppose that these files are stored forever right? They are removed only when the user uninstalls the application, am I correct? In case of updating the application (for example from version 1.0 to 1.1) through the Android Market, then what will happen to the files that were stored from the previous version? Are they

Android: how to delete internal image file

三世轮回 提交于 2019-12-03 06:15:16
What i want to do: delete an image file from the private internal storage in my app. I save images in internal storage so they are deleted on app uninstall. I have successfully created and saved: String imageName = System.currentTimeMillis() + ".jpeg"; FileOutputStream fos = openFileOutput(imageName, Context.MODE_PRIVATE); bitmap.compress(Bitmap.CompressFormat.JPEG, 35, fos); an image that i receive through bitmap = BitmapFactory.decodeStream(inputStream); I am able to retrieve the image later for display: FileInputStream fis = openFileInput(imageName); ByteArrayOutputStream bufStream = new

Static functions declared in “C” header files

╄→гoц情女王★ 提交于 2019-12-03 04:52:00
For me it's a rule to define and declare static functions inside source files, I mean .c files. However in very rare situations I saw people declaring it in the header file. Since static functions have internal linkage we need to define it in every file we include the header file where the function is declared. This looks pretty odd and far from what we usually want when declaring something as static. On the other hand if someone naive tries to use that function without defining it the compiler will complaint. So in some sense is not really unsafe to do this even sounding strange. My questions

Download Doc/PDF from the internet and save to internal memory [closed]

五迷三道 提交于 2019-12-03 01:15:18
I am attempting to make an application that will primarily open and read a predetermined set of documents that I have. The original idea was for all the documents (about 40 equaling MB) to be copied into the user's internal memory (/data/data/(appname)/files) on first run or install. I realize that this may be a bad idea with some phones having limited space in the internal memory. I now am thinking of changing my app idea to download a file from a stored location on the internet and have it saved to the internal memory. This way the user can view only the needed documents, severely shaving

How to do internal interfaces visible for Moq?

狂风中的少年 提交于 2019-12-02 20:05:44
I have 3 project in my C# solution. Signatures Structures Tests Signatures has public and internal interfaces. Also it has [assembly: InternalsVisibleTo("Structures")] [assembly: InternalsVisibleTo("Tests")] in AssemblyInfo.cs of. Structures has public and internal classes and [assembly: InternalsVisibleTo("Tests")] in AssemblyInfo.cs of. Tests has next source: <packages> <package id="Moq" version="4.2.1409.1722" targetFramework="net45" /> <package id="NUnit" version="2.6.4" targetFramework="net45" /> <package id="NUnitTestAdapter" version="1.2" targetFramework="net45" /> </packages> as NuGet

How do you handle R Data internal to a package?

只愿长相守 提交于 2019-12-02 17:06:44
The R package I am developing requires several R data objects, such as pre-computed models and parameters. Currently I have each object in the 'data' directory of the package in individual .RData files. When using the package users can use the "data" function to attach these objects to their environment. The behaviour I would like instead would be that on loading the package the data objects are automatically attached to the internal package environment and not accessible to the user directly. My understanding is that placing a 'sysdata.rda' file in the 'R' directory of the package containing

saving a json file to internal memory

こ雲淡風輕ζ 提交于 2019-12-02 09:03:28
hey there guys and girls i have this code that should download a json object and then save it to internal memory, i keep getting stuck here try{ //connects to mySQL HttpClient client = new DefaultHttpClient(); HttpPost post = new HttpPost("http://10.0.2.2/textures_story_list.php"); HttpResponse response = client.execute(post); //captures the response entity = response.getEntity(); }catch(Exception e) { Log.e("log_tag", "Error in http connection "+e.toString()); } try{ is = entity.getContent(); String FILENAME = "story.json"; //gives file name FileOutputStream output = openFileOutput(FILENAME,