Removing or renaming actions - zend-framework

I am working on zend framework. I have mistakenly created some actions which are not useful for me now. So either I want to remove those actions or rename them. Is there any command by which I can do that. If no, how can I do it manually? Means which are the files I need to edit to remove or rename the action completely.

I think it should be enough to remove the xxxxxAction() methods from your controllers. This is how I've always done it. If you have view scripts associated to the action it's good to remove them too, for housekeeping purposes, although it's not strictly necessary. If you are using Zend_Tool, you'll also need to edit your .zfproject.xml file (it's used only by Zend_Tool).
Perhaps there is another way of doing it, using Zend_Tool, but I'm more used to work "the manual way".
EDIT:
Actually, there is a similar question already posted: Zend_Tool remove controller/action
Hope that helps...

Related

Track code changes to specific functions

Not sure how to even search for this topic so I'm just going to ask. I have a couple places in my code where changes to one function have to be also made to a similar function. Basically the operations in the functions are very similar but the data being worked on is different.
I don't like it but for now that's how it is. My question is anyone knows of a way or a tool that will notify me if a certain function has changed. If I get the notification I know to confirm the changes were made to other function.
Please don't tell me to change my code. I know this isn't ideal and thought has been put into alternatives, but nothing elegant has popped up.
Thanks,
Gunner
Here is an idea I have. Maybe it will set the train of thought...
I can add a special comment in my code for a block that I want to be tracked. The comment will have opening and closing syntax:
my_code.php...
//track-start-1234
[CODE]
//track-end-1234
//track-start-5678
[CODE]
//track-end-5678
I will then have a script that I tell to check a list of files, my_code.php, for now. It will look for the special comment syntax. "1234" will represent a file that holds the last modified code for that function, so 1234.php. If the contents between the comments do not match the code stored in the file then an alert is fired. Also I might add a relationship to the other code so the alert says something like
Code 1234 has changed. Please make sure code 5678 has been updated as well.
I think I can add this script to GIT somehow so it either is part of the core git commands like "push" or maybe just another command I have to run as part of our deployment process. A second option might be adding it to phpstorm's code inspector or something like that.
When the code has been modified and everything is good I will just manually copy the new code into the comparison file. There will not be a ton of updates so this will not be too tedious.
For now this is probably the route I'll go, but any critiques or suggestions are definately welcome.

NetBeans: should nbactions.xml, nb-configuration.xml and catalog.xml go into source control?

This thread is very useful for finding out which files in Netbeans should go into source countrol, but it doesn't cover all files.
In particular I'm wondering whether the following files should go into source control. Here are my assumptions/guesses:
nb-configuration.xml - easiest - the file itself in the comment says it should go into source control.
nbactions.xml - from what I see this file stores information typical to running the application. I.e. JVM arguments etc. So I suppose it is a question of taste - if you want other developers to have a "suggested" Run configuration - include it. Otherwise - don't. Correct?
catalog.xml - not sure what this does (I GUESS it's used by the editor to find out xml schemas and such to enable syntax coloring, but it's just a guess). Anyway - I see that this file has system-specific information (path) - so it shouldn't go into source control.
Can anyone confirm the above?
Thanks,
Piotr
I never put my IDE configuration files in the repository, for several reasons:
other colleagues may want to use theirs;
other colleagues may want to use other IDEs (such as Eclipse) and seeing those files (or even have to exclude them from the checkout) could be annoying for them;
some of these files are generally not related to a single project, others automatically generated, so no need to store them in the source code of every project.
In order to exclude them, our first solution was the .svnignore, but it was still logically wrong to modify some shared content for the specific needs of a single user, so we decided to be more strict:
in my ~/.subversion/config I have:
[miscellany]
global-ignores = nbactions.xml nbproject
Hope this helps,
Marcello
In my Maven based projects I put nbactions.xml into source control. Just make sure to change absolute paths to relative ones.
I put nbactions.xml into source control BUT there is a caveat: it's internal format can change so if your developers, for any reason, use different versions of NetBeans you could have to remove it because sharing it becomes nasty.
Recently I upgraded from NetBeans 7.3.1 to 7.4 and the "Run" action was giving a strange error message. I solved the problem by deleting and regenerating nbactions.xml: the old one had a custom Maven goal for the "Run" and "Debug" actions; it was org.codehaus.mevenide:netbeans-deploy-plugin:1.2.4:deploy it was not visible in the IDE v7.3.1 (perhaps it has been generated by an even older version for internal usage) and was generating a class not found for org.openide.util.Lookup in v7.4. I'm documenting the problem here because I found the solution by myself after an unsuccessful search on the Net. I hope this can help someone else.

Adding code to class files just before building - Objective C

I am looking to develop a framework, for which I dont want get into details.
Suppose if I am having 100+ classes with 1000+ methods in my iPhone application.
In this scenario I want to add NSLog in each method(at start or end or both) of each class.
Manually adding NSLog is possible but is there any better solution?
Like building application in such a way that I can add this Log without me having to do manual work.
Thanks and Regards,
Denis,
Your answer was most useful throughout many forums.
Thanks a lot.
The reason I'm looking for something like this is, we have many client projects and many time it happens that we get some crashing or other issues while QA and UAT. ~80% of them are not reproducible or require some particular scenario. We were using .crash and dsym to track such issues. But it is not that useful in such scenario.
What I'm looking for is providing add hoc build which will log the steps which user has followed so that it will make easy to reproduce such issues.
Currently I am using precompiled headers and first method you have mentioned (searching for the first opening brace then replace it with macro).
I will look into DTrace and objc_msgSend as you mentioned. I will google out these meanwhile if you have any preferred tutorials it will be great.
Thanks and Regards,
:D
So you want to add a trace facility to your code?
Apple doesn't provide anything like this. You'll have to add your trace facility yourself. If your source code style is consistent, this might be relatively easy to do automatically, something like searching for the first opening brace following a line starting with a minus (or plus) sign...
Alternatively, you might want to use the public Objective-C runtime functions to enumerate all classes and all their methods, then method-swizzle each of them with another one that NSLog before jumping to the original.
Alternatively, you can take the open source implementation of objc_msgSend and insert a call to NSLog at the beginning. Note that obj_msgSend tail calls into the method, so that will prevent you from adding a call upon return. Be prepared to humongous output of course. You might want to condition your call to NSLog to the value of the selector parameter to objc_msgSend (such as a common prefix).
Finally, the best way to trace is probably to attach a DTrace probe to the entry to objc_msgSend. For the same tail-call reason mentioned above, you won't be able to attach a DTrace probe to its return though.
But the better question is why do you want to do that.

XCode file naming

OK, this is in the pet peeve department. Not terribly important but sometimes annoying.
I am creating a series of test projects to experiment with various ideas. The projects are named "Test 1" through whatever.
When the project is created by XCode I get file names like "Test_1AppDelegate.h" and "Test_1ViewController.h".
What I want is: "Test_1_AppDelegate.h" and "Test_1_ViewController.h", which is far more readable and "civilized", if you will.
Is there a way to make this happen?
What I've resorted to now is a really messy process:
I name the project with a trailing space: "Test 1 "
This gives me the file names I want within the project.
I then have to go and use Project>Rename to remove the trailing space from the project name
At this point, close the project and rename the directory to remove the trailing space.
OK, it works, but it is convoluted and hopefully not necessary. This also produces a couple of "casualties" with weird naming that I simply have to live with:
"Test_1__Prefix.pch" // Double underscores
"Test_1_-Info.plist" // Underscore prior to hyphen
Again, not a huge deal, but it'd sure be nice to clean-up the naming as a part of the automagic project creation process.
Like many things XCode, it's a love-hate relationship.
Thanks,
-Martin
While I haven't done it, you can define your own custom project template. I would start first by examining the supplied project templates at:
(Xcode folder)/Library/Xcode/Project Templates/
to see the overall structure. The most difficult part is finding documentation on this topic, because I could not find any documentation supplied by Apple. This likely means that it is subject to change at any time and the work you put into defining your own template may need to be tossed.
I was able to find some instructions with a simple google search: Xcode custom project template
For example:
Cocoa dev: Design your own Xcode
project templates
Xcode: How to customize the existing
project templates

How should I provide help for a related set of functions?

I built tfs.el to allow developers to do TFS things (checkout, checkin, etc) from within emacs.
There are 13 interactive commands in the tfs package, like tfs/checkout, tfs/rename, tfs/diff, and so on, and I'd like to be able to provide help on all of them in a single place. An overview of all the available functions.
What's the "emacs way" of doing that? I thought of defining an additional function, like tfs/help , that would invoke describe-function-1 on each of the tfs functions, and then present all that in a TFS-Help buffer.
Is there a better way?
Well, there are many "Emacs way"s.
The most polished would be to write an info page, see the page "Info for Experts", which basically says to use Texinfo and convert that into an info page. You can be as verbose as you want there, and the user can search, use hyperlinks, etc. The user can easily get there via C-h F tfs/checkout.
Another way some folks seem to do it is to write short documentation strings for each of the commands, ending with "see documentation for tfs-mode for details" and put all the common documentation in the docstring for tfs-mode.
Another way some packages document things is with a big comment at the top of the tfs.el file.
Take your pick, they all have trade-offs.
You can use
(describe-bindings "\C-xv")
You have multiple, related commands. So far, I guess, they are related only by their names.
Two possibilities come to mind:
Create a mode for this stuff. Document everything in the doc string of the command that turns the mode on/off. It could be a major mode or a minor mode. If a minor mode it could be buffer-local or global.
Create a group (defgroup) for this stuff and document everything in its doc string.
The basic idea is to somehow actually relate these commands: bundle them together in some way, so you can document them together as the doc for the bundle.
Offhand, without knowing more, my guess is that you might want to create a global minor mode.