Naming string variables which point to files and directories [closed] - naming-conventions

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 9 years ago.
This is the kind of question where if you ask 10 people, you'll get 10 answers, but I'm trying to work out how best to name the following variables:
Variable 1) A string which points to a folder containing some software on the C drive. The variable will contain something like "C:\Program Files\MySoftware".
Variable 2) A string which contains an absolute path to a web.config file within the above folder. For example "C:\Program Files\MySoftware\web.config".
Variable 1 could be called something like "softwarePath", but then if variable 2 was called "webConfigPath", it's not immediately obvious if that variable should contain the complete path to the file, or the path to the folder which the file lives in.
It seems to me that using the word "path" in a variable is a little ambiguous, since it could mean a file or a directory, and I like to make variable names as self-explanatory as possible.
So I'm interested to hear any naming conventions that others might use for the above scenario when referencing absolute paths to files, and absolute paths to directories.
Please note I am not interested in having variables which contain JUST a filename. All variables will contain absolute paths to either a file or a folder.

If you like it as self-explanatory as possible why not add an additional qualifier?
webConfigDirPath and webConfigFilePath

Related

How to parse xml data [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 9 years ago.
I am making an iPhone app, which calls an web API, and retrieves XML files. I have XML data that I need to parse, but I only need one element from the whole XML file. There may be multiple xml files loaded at once, but I still only need one element from each file. I am trying to use NSXMLParser to parse the data, but if there are any easier options, I am open to them. Does anyone know any good tutorials about how to do this, or know to explain it? Thanks for the help.
I've used both XMLParser and XPath to parse and each has its costs and benefits. XPath is fantastic if you know for a fact what the DOM path of the target object is. XMLParser allows for more flexibility in terms of iterating through the XML programmatically.
I would recommend both of these links:
NSXMLParser
XPath

FTP Upload in a Cocoa application? [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
i have made a Mac OS application, that i was wanting to add a feature to. The user adds data to a NSTableView, then the data is compiled into a .xml file. What i want to do is upload that .xml file to a server, and overwrite the existing file named that. How would i do this? I have hear of Apple's Version, but it is for iPhone and looks a bit confusing. I am only 16, and was wanting to know if there is an easier way of uploading a file to a remote server. Thanks!
There are at least a couple built-in ways to do ftp'ing from an OSX application.
Apple has a useful article available here which shows how to do uploading. I'm not certain (it may be dependent on server implementation) if an upload overwrites a previous file or throws an error if a file already exists.
There's also a commercial Objective C library found here ($300) that might have everything you need available. There may be other hints available on related Stack Overflow questions as well.

How to split Objective-C code into differents files? [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
I'm looking for a (certainly basic) thing to do in Objective-C/Cocoa : I would like to split my code into multiple files (one for functions, one for tab view N°1 methods, one for tab view N°2 methods, etc) to make my projects well organized.
I would like to be able to call functions and/or methods from my "AppDelegate.m".
But I don't know how to formulate this question correctly to find help around the web. I come from Delphi, and in Delphi you have just to create a new .PAS file and declare it in USES section.
We are in 2013, so it's certainly an ultra-basic way to code properly via XCode :)
Thanks in advance for any help.
Basically, it's the same - except with the C background of Objective-C you will have to create 4 files. Two header files (.h) and two implementations (.m).
Instead of the uses section you will use the #import statement at top of the .m files.
#import "myClassHeader.h"
As this belongs to the more basic tasks in Objective-C or any C-based language, you should start with reading some beginners tutorial, how to define classes and methods.

Xcode Project Comparison Tool [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
I facing a problem, on tracking changes made by other developers.
Note: SVN is not used for some reasons.
So, is there any better way apart from individual file comparison using kDiff. This is too tiresome for large number of files.
Such as looking for entire Project's Comparison, for projects created in Xcode.
Thanks.
You can use FileMerge that comes as part of the Xcode package. This will take two directories and compare the contents of the trees rooted at that point showing files only in one tree, that differ in the two trees, etc. For differing files you get a standard visual diff. This should give you what you need quickly and easily, we actually use it in conjunction with svn to compare branches, check merges, etc.
You can use any other SCM, it's a natural way of tracking changes ("Source Control...")
If you still want make own life harder, you can use any OS-specific tool, which can compare directories, not only separate files

which is better "destination, source" or "source, destination"? [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 11 years ago.
My question is language transcendent, I've often found prototypes of "copy" functions define parameters in the order: argument1:"destination" then argument2:"source".
It is the case of memcpy for example in C. But it is NOT the case of file copy on bash ! You say, e.g.: "$ cp file file2" where file2 is the new file.
Which makes much more sense to me, we always say "copy that text here please" and not "copy here that text" which is Yoda-esque.
So the true question is: a good API should use what form (order) ? and maybe another subsidiary question: what form is everybody expecting, if there is any ?
I expect source to come first, and destination later.
If you can disambiguate in the language, it would be better. For example, in a OO language:
source.copyTo(destination);
In a language with named parameters:
copy(source: s, destination: d);
The important thing is to make clear what's going on for people reading the code. Code is more often read than it's written.
I've always preferred source-destination (I'm pushing from here to here), but it probably also depends on the call. If it's only 'copy' you're referring to, I think this works. I'm sure there's there are other pull oriented calls that dest-source would apply better to.