I want to standardize coding style accross all the developers computers in my office, I want to export my netbeans configuration and ask the other programmers to import it on their IDEs, do you know where that config file is?
I'm using netbeans 8.02 but if you have found it on another version I can use that information to figure it out. Thanks.
you can export your preferences via Tools|Options and use the "Export..." button on the bottom left corner. Check the "Formatting" checkboxe(s) to export formatting preferences only.
It will export your settings to a ZIP file.
To import these settings on other computers, simply go to Tools|Options and use the "Import..." button ;)
I've come to the conclusion that some settings are stored in hyperspace. So while that makes your efforts (to pass settings files around) futile, on the bright side it does mean interstellar travel is one step closer!
My experimental proof is to use this from inside the ~/.netbeans/ folder:
find . -mtime 1
I then altered some settings, closed netbeans, ran the above command again, and looked for which files changed. Nothing plausible seemed to, and the implausible ones did not contain anything that looked like my changes. I also ran the same test on the Project's nbproject folder (nothing had changed), and also had a poke around inside /etc/ (there seem to be no NetBeans files there). Yet, when I restart NetBeans, and go and look at the Options again (Editor | Formatting | PHP, then "Blank Lines" was where I did my test changes), my changes are still there.
So it is either Hyperspace, or Magic. And being a scientist I am not allowed to believe in magic. QED.
Related
The Problem
In the previous versions of Eclipse PDT, all PHP classes inside a project have been, to my current understanding, included under the default proposals. In Oxygen, however, it would seem as though only files located in directories marked as source folders show up under the default proposals.
All directories except one in my project are marked as source folders, but I believe this is the case since I created them with a previous version of Eclipse (cannot remember; bad memory). The classes inside the directory which is not marked as a source folder does not show up at all under the default proposals, and yield errors when I try to use them in other parts of the code.
TL;DR version
Some classes does not show up under the default proposals, and yield errors if used elsewhere in the code. It is as though they do not exist, at all. It appears as though this is happening because some directories are not marked as source folders, thus making the contents therein as though invisible by Eclipse.
Contemplation
I have been considering what might cause such a thing to occur, and as described above, I believe this problem might have to do with some directories not being marked as source folders. In Eclipse PDT Oxygen, apart from the previous versions of Eclipse, it is not possible to mark directly mark directories as source folders.
Everything from recreating directories, refactoring them, looking through menus, and much more, I have tried. But, no luck from those actions.
Hopefully someone will know what it is I am describing, and thus being able to point me in the right direction!
After quite some exploration of the web, I came across the help reference for the Eclipse platform, and managed to change it to the current release of Eclipse (even though that seemed to change nothing on the page.) The example is for C/C++, but adding source folders is done somewhat similarly in PDT.
Solution
In order to mark a directory as a source folder in Eclipse PDT Oxygen, right click the project you wish to add a source folder for, then:
Properties > PHP > Source Paths > Build Path
On this page, you can press the "Add Folder..." button. Check the folder (or folders) you wish to make source folders, then apply the changes and close the settings window.
How can I (in the Netbeans IDE) add files as links, or point to existing files, kind of like a shortcut?
Visual Studio 2012 can do this, as shown in the following screenshot (found on Google Images - not mine).
I miss this feature in Netbeans. Copying my files over all the time is not an option, since I constantly improve my PHP library files, that are used across all other projects.
I am using the full version of Netbeans, and in this case, I am doing PHP development.
I am not sure that PHP is supposed to work like that, since its code is not compiled.
I could be completely wrong, and if I am, I'm sure someone else will educate us both.
What I've usually done is put the library in some directory and then add that directory to PHP's include path by adding this to php.ini:
include_path = "dir to your library"
And then I'd make sure that whatever class autoloader I was using was looking through the include path.
That said, I've more recently moved away from this, because a global library that changes often has caused me problems (a change would break something and similar issues).
I have a huge live running web site wich has lot of issues. This has developed by lot of programmers around the world. So If I want to fix some errors its really hard to find where it is and so on....These files are in zend framework. There are 100s of php files, css files java sripts files, etc. Is there any way that I can do global search a file or how to understand the file linkage of this kind of large systems?
If you are using Linux there are a bunch of ways to find the correct file -
On the command line
Find a file by name -
find . -name filename
Or the faster find a file by name -
sudo updatedb #Only needed the first time you run locate
locate filename
Search a directory's contents recursively for a string -
grep -ri somestring .
Here's a new trick I learnt recently - Using Ack! If you are on a Debian/Ubuntu system you can install ack by doing -
sudo apt-get install ack-grep
Then you can do -
ack-grep somestring
This is blazing fast!
In IDEs
In most IDEs or advanced editors you should be able to simply control click or right click and select "go to definition" to navigate to a function's definition.
I can attest that this works in Netbeans, Eclipse, Komodo, Emacs etc.
If you are open to adopting a new IDE, I suggest Netbeans. It's PHP mode is full of goodies including improved navigation. For example, to quickly open a file you can simply do Alt-Shift-O and type the filename.
First of all I think you'll need to learn a bit about Zend Framework, how it's MVC framework works and where the models, views and controllers are stored. This'll help you guess where to go looking for problems.
In terms of searching for specific lines of code or patterns most operating systems or IDEs will allow you perform a recursive search of a set of files. I think that's outside the scope of this site.
if you are using aptana you can search your whole workspace by going to search->search. If you are using dreamweaver you can open find menu and search through your current site
It will be pretty hard to locate the right file in a quick way if you don't have any knowledge about the application at all. I would recommend reading up on Zend Framework and how it's working.
debug_backtrace() can come in handy if you need to show a backtrace. This can be useful if you need to know from where a function has been called.
If you're searching for a file that outputs something, a simple "search all directories, recursive" search will probably do just fine. Most IDEs (even "simple" one like Notepad++) or even OSes have this built in.
Right, since watching Rasmus Lerdorf's talk on PHP performance I've been wanting to profile the ERP / Accounting application I am working on, not least because I know there are performance issues with it, profiling should highlight the major problems for me to investigate.
So downloaded xdebug and put the following few lines in my php.ini file:
zend_extension="/usr/lib/php5/20090626+lfs/xdebug.so"
xdebug.profiler_output_dir="/home/me/xdebug/profiles/"
xdebug.ptofiler_enable_trigger=On
With this I simply aim my browser as my app with &XDEBUG_PROFILE in the query string and the profiling begins. The problem is the output I am viewing with KCacheGrind doesn't include any of the functions from with my application, and no flow between entities.
When the page is executing I copied (in the terminal) the profile file to a separate file, to capture it's state throughout the profile. I loaded each of these separately into KCacheGrind and they all show the full profile of the application, all but the last one?
Can anyone tell me why the full profile isn't being output? Looking at the file sizes of my copied files it appears the first few are rather large, but the last one is significantly smaller, is xdebug messing with them after it has been captured?
Many thanks :-)
EDIT
Just to help, this is what I see when I open up one of the copied profiles (before the profile has completed), I'm sure there is much more to this.
And this is what I get from the final profile, no relationships, just a bunch of PHP functions. I want to see all the full profile.
EDIT 2
So here I am constantly running the ls -als command, the last list is the cut down version, the previous one is the last ls where the file was at it's full size.
I cannot upload the large file as it's over 3 million lines long, if it helps here is the xdebug php info section.
Right, I've actually solved the problem myself, I added this option to my php.ini file:
xdebug.profiler_append=1
This will append the data to the same filename if it exists, therefore I'll need to make sure the filename option is set correctly, but I think that has solved my problem for now.
Thanks to those that answered :-)
I have a rather large php project with all kinds of different third party includes. Its all managed with Netbeans PHP. I have a few problems i would like some oppinions on.
Does anyone build there php-project? When i upload to server via ftp i get all kinds of project files which doesnt belong to live environment.
Would be nice if a build solution could encode all files when building (actually copying files to new location and leaving out project files and files like that).
Let me hear how you handle your php projects (development, test, build/deploy) with OS X.
Thanks
Well you could write a shell (or scripting language of your choice) script to selectively copy the files you want to your remote server.
Alternately, you could put the code to be published (again, leaving out the undesired files) into a version control system (git, svn, etc) and pull the code to the remote machine that way. There are lots of other benefits of using VCS as well.
You could also use something like ant to write a "build" script which does any manipulation needed for deployment.
I use Eclipse PDT and mount server with Macfusion. Eclipse File Sync plugin then syncs everytihing to mounted drive (can exclude unwanted files/directories).
Also using a SVN and opening project directly from remote drive with Eclipse and including libraries from project properties. So there is two projects - one for local development and other is live in server - syncronized with SVN
(Eclipse plugin Clay for database diagrams is awsome too)
Though I am not an OSX user I am a Mac-in-the know. Basically I get invited to their house parties and politely decline to run amok with Windows and Linux/Unix (who is OSX's older sister, it is all so very confusing). In any case, Mac adds extra files to everything. I know when a designer is using a mac vs a pc. I get extra files and directories in their attachments if there is a folder. As far as project files, there needs to be a way to set up netbeans to keep the files for project in a different location from your working on files. If not then shame on your IDE. Well, if nothing works, since Linux/Unix is close to my heart I can write a script for you to pull all files of a list of extensions out and copy them to a new directory with subfolders in tact. Here ya are:
This should work
find . -name '*.php' | xargs rsync -avuzb '{}' exportdirectory/
I do not have a machine to test it on right now and Cygwin, for all it's effort just fails sometimes. Let me know how it goes, otherwise use Unix wizardy :D Because yes, as we know OSX uses Unix command line. The crude script is mainly to give you an idea of a way you can do it. I am sure there is php, html, css, js, and other files and on rare occasion (god lets hope not) just knowing extensions isn't going to be enough.
Personally I use gvim and refuse to use project managers, I use gvim and command line and though I have used both, I am highly preferential to the current way I am doing everything. Hey, it's a choice though. No criticism here if you walk another journey.