I want to develop an application with c#.net(winforms) to be a parser and editor for php.
I have many experiences in .net, but I am confused.
In fact I need to write an editor in which I can implement syntax coloring,
line numbers, gutters, expandable/collapsable regions, ...
I can write it with RichTextBox, but it has many difficulties.
Is there an easier way to do it, or is there a component to do this (free and source available of course), or ...
I want to know what various ways of doing this are.
Thanks for your replies
I guess that ScintillaNET will do the trick. (Tho I've never used it my self)
Related
I searched around the webs and found tools that can indent java,C,php,HTML etc.
Is there a tool, that can reliably indent mixed sourcecode and different languages?
-> one indent tool to rule them all?
I am looking for a standalone opensource program or even a NetBeans plugin (but there seems to be only jindent).
The indentation rules for different languages are different. If there were a "universal indenter", it would first determine in which language the text was written, and then invoke what is essentially a language-specific indentation subroutine.
There are packages for LaTeX and the like which can indent more than one language, but you tell them which language they're dealing with...
Do you have a particular task you wish to accomplish?
I ended up using NetBeans' own indention functionality ( [SHIFT]+[ctrl]+F - on MacOS ).
It works quite well, though I have to indent by hand sometimes.
For really bad structured code I use the common tools.
SourceFormat claims to be a multi-language pretty printer. But it isn't free and only runs on windows.
WebStorm and IDEA (both from Jetbrains) can reformat mixed source, but they aren't open source. (via T.J. Crowder)
Background
I'm looking to create a wiki-style website.
First I took a look at http://en.wikipedia.org/wiki/List_of_wiki_software
Wanting to use PHP and being sceptic about using plain file storage the choice was lijited down to three alternatives:
Tiki Wiki CMS Groupware
PhpWiki
MediaWiki
Correct me if I'm wrong but all of these felt very heavyweight and pretty much overkill for a rather small project.
The question
My idea was then to use some kind of existing libraries and/or tools for the history, diff and markup parts but implementing the rest myself.
Do you know of any (good) libraries and/or tools like these?
Use an existing library like Markdown for marking up wiki text. Extend it if you have to. A diff algorithm for a wiki can be as trivial as you want it to be. First result on google for php diff showed an extremely simple algorithm that will probably get you started in the right direction.
PHP Diff Algorithm
PHP Markdown
Also don't forget about Github! There are all kinds of wiki projects written in PHP on there. Like this one!
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 9 years ago.
Improve this question
I am an applications developer for a for-profit college in Virginia. At this point I could code all of what I do in notepad if I wanted to, or had to, but I prefer to use an IDE for speed and organization. As a Mac user, I've used such IDEs as NotePad++, Coda, TextMate, TextEdit, NetBeans, and of course Dreamweaver.
At work my company owns licenses for the Adobe Suite that includes Dreamweaver and I enjoy the code hinting, the grouping of related files, the built-in FTP, the code snippets and custom keyboard actions. I get flack from other developers when I mention that I use Dreamweaver.
Is there a reason why I should NOT be using it...or is it just a case similar to people who think only black and white tattoos are cool and anything else isn't?
The people who object to you using Dreamweaver probably mean the WYSIWYG part which is known to produce tag soup.
By the way, NotePad++, Coda, TextMate and TextEdit are just editors, not IDEs, because they don't integrate build automation or debugging tools out of the box.
The issue most people have with Dreamweaver is that it's a code generator, and code generators are renowned for producing poor-quality HTML. (the main issue with that - other than pride in one one's word - being that it causes cross-browser compatibility issues)
if you take away the code generation aspect, it's a straight fight between any other IDE, and other IDEs are just as good or better.
That said, I haven't used Dreamweaver in a long time so I can't really comment on its current version. Maybe the code generation has improved massively (but I doubt it). Maybe it really is a better IDE than all the rest. In the end, the choice of IDE is a personal one; if you're comfortable in Dreamweaver, then it's a good choice for you.
Any person who gives you flack for your choice of editor is not a true developer. Certain IDEs have certain benefits based on the languages/frameworks they are targeting to speed or ease development pains. If your company bought Adobe, and you like Dreamweaver and code comfortably in it... then keep doing it. Dreamweaver is an outstanding product, and if it does what you need it to do then use it.
None of these developers who give you flack are responsible for your paycheck, so screw them. Use the tool that gets it done. If someone shows you a better one, have no shame in switching. If they don't, keep on keepin' on.
If you like it then use it. It's only up to you which editor to use and to decide is it worth that money.
Obviously we could all do 99% of our coding in notepad, but we choose IDEs for their productivity boosting, code-writing abbilities.
It depends what you are developing in. If you're coding C# and .NET using Dreamweaver would be an odd choice, though you could make it work.
If you're developing client side web stuff in XHTML, JavaScript, and CSS Dreamweaver is a fine choice.
I do like Dreamweaver when I'm building front ends and I want to see what I'm building. When it comes to coding I'd pick another tool. I think NetBeans is great for PHP and I love it how it raises code problems, and HTML issues (especially in regards to accessibility, standards, doctypes). Notepad++ is a godsend! I couldn't develop without it.
One think I always hated with Dreamweaver was the auto JavaScript features (and later SPRY framework) as these appealed to non coders as they provide functionality. What they don't realise is that Dreamweaver will produced bloated, horrible scripts. I once produced a JS/CSS dynamic menu using 2 CSS classes and 11 lines of unobtrusive JS. When getting Dreamweaver to produce something similar using a wizard it produced JS code in my page and a 1200 line JS file.
When I'm writing C# I have to use Visual Studio...
Just something I wanted to get off my chest.
I personally use Eclipse [currently 3.6 Helios], but have worked once on DW and I must say that it is extremely handy when it comes to write HTML or CSS. It is not that useful when it comes to write PHP or other programming languages, but for frontend it is VERY nice.
Funny, I remember a time in pre-Adobe acquisition days when Dreamweaver was considered the serious developer's tool and tools like Front Page were for novices. I agree with others that it may be the code generation aspects that the detractors have in mind. I used them once when I was learning PHP. After seeing the generated code, once was enough. Like you I now use it for it's other features.
If it forces nothing on you (if it lets you edit HTML without adding all kinds of nonsense you're not interested in), and you like using it, I see no reason not to. Especially since you mentioned some interesting features it has that you like to use.
Those "other developers" are probably thinking in black and white, unless Dreamweaver cannot be used as simply a code editor, but I believe it can.
I wouldn't care much about what those other developers think, unless they have compelling arguments. I think you would've mentioned those, if they had any. They're probably also the kind of developer that thinks anything Microsoft or Apple or whatever makes is automatically crap.
I've used it, a few, and quite time ago.
IMHO, the worst feature of Dreamweaver was that the basic layout of almost all HTML web pages was controlled using tables.
If you wanted to write an accesible HTML page (wich was requirement for a bunch of customers) you had to fight against it, and code the divs against its natural tendence to build tables.
Experienced web developers often use plain text editors (with syntax-highlighting) because the richer tools can get in the way as much as they help. However, any tool that lets you control every last character of the code will generally keep any developer happy, and I believe Dreamweaver does allow this via its bidirectional WYSIWYG-code editing mechanism.
Anyone who knows enough about coding to complain about "tag soup" or the spaghetti Javascript Dreamweaver produces should also know how to close the "snippets" toolbox and just use the program for what it's good at.
I personally find Dreamweaver's Live Code to be an excellent tool for debugging jQuery.
I'm working with websites written in PHP, along with many other programmers, and sometimes I have to deal with really awful code.
Indentation totally messed up, curly braces in the wrong places, terrible whitespace use, it really hurts my eyes and actually makes my work harder and take longer.
Is there a tool where you can specify your coding style and then it applies it to files?
I'm sure there must be such functions in different IDEs, but I need an independent tool as I code with simple notepads like Notepad++ or the like. ( if it's such a function in Notepad++, I didn't see it )
Try PHP Code Sniffer.
That should be exactly what you are looking for(at least that's what I thought afert reading the heading, see the update).
UPDATE:
Actually what Code Sniffer does is go through your code and detect coding style violations, it does not however fix the problems.
But by telling you what's wrong it enforces you to adhere to a certain coding style. So that might be an option for you in the future.
While I have never used any, as I (luckly?) don't use anyone else code much, google found this, PHP Beautifier.
EDIT
See this question which recommends PHP Code Beautifier which is free (but requires an account creation)
Eclipse PDT also can format your code. Not sure how configurable it is. Just hit CTRL-Shift-F.
Well for a quick solution Aptana IDE does support a code format option
See the SD PHP Formatter for a tool that prettyprints source files, one at a time, or in large batches, according to your preferred style.
From what I can find Notepad++ doesn't even do basic linting (syntax checking) so it won't be able to do code sniffing: http://sourceforge.net/p/notepad-plus/discussion/482781/thread/b802c218:
Can anyone write a PHP syntax checker plugin?
...
What's wrong with PHP itself? If you run PHP as a command line utility with -l (letter L), it will run as PHP lint and check for syntax errors. e.g.
php -l broken.php
Hook it up as an external tool, perhaps through a batch file.
But you can get Code Sniffers for other text editors e.g. Sublime Text, Atom.io.
I am going to start working on a website that has already been built by someone else.
The main script was bought and then adjusted by the lead programmer. The lead has left and I am the only programmer.
Never met the lead and there are no papers, documentation or comments in the code to help me out, also there are many functions with single letter names. There are also parts of the code that are all compressed in one line (like where there should be 200 lines there is one).
There are a few hundred files.
My questions are:
Does anyone have any advice on how to understand this system?
Has anyone had any similar experiences?
Does anyone have a quick way of decompressing the lines?
Please help me out here. This is my first big break and I really want this to work out well.
Thanks
EDIT:
On regards to the question:
- Does anyone have a quick way of decompressing the lines?
I just used notepad++ (extended replace) and netbeans (the format option) to change a file from 1696 lines to 5584!!
This is going to be a loooonnngggg project
For reformatting the source, try this online pretty-printer: http://www.prettyprinter.de/
For understanding the HTML and CSS, use Firebug.
For understanding the PHP code, step through it in a debugger. (I can't personally recommend a PHP debugger, but I've heard good things about Komodo.)
Start by checking the whole thing into source control, if you haven't already, and then as you work out what the various functions and variables do, rename them to something sensible and check in your changes.
If you can cobble together some rough regression tests (eg. with Selenium) before you start then you can be reasonably sure you aren't breaking anything as you go.
Ouch! I feel your pain!
A few things to get started:
If you're not using source control, don't do anything else until you get that set up. As you hack away at the files, you need to be able to revert to previous, presumably-working versions. Which source-control system you use isn't as important as using one. Subversion is easy and widely used.
Get an editor with a good PHP syntax highlighter and code folder. Which one is largely down to platform and personal taste; I like JEdit and Notepad++. These will help you navigate the code within a page. JEdit's folder is the best around. Notepad++ has a cool feature that when you highlight a word it highlights the other occurrences in the same file, so you can easily see e.g. where a tag begins, or where a variable is used.
Unwind those long lines by search-and-replace ';' with ';\n' -- at least you'll get every statement on a line of its own. The pretty-printer mentioned above will do the same plus indent. But I find that going in and indenting the code manually is a nice way to start to get familiar with it.
Analyze the website's major use cases and trace each one. If you're a front-end guy, this might be easier if you start from the front-end and work your way back to the DB; if you're a back-end guy, start with the DB and see what talks to it, and then how that's used to render pages -- either way works. Use FireBug in Firefox to inspect e.g. forms to see what names the fields take and what page they post to. Look at the PHP page to see what happens next. Use some echo() statements to print out the values of variables at various places. Finally, crack open the DB and get familiar with its schema.
Lather, rinse, repeat.
Good luck!
Could you get a copy of the original script version which was bought? It might be that that is documented. You could then use a comparison tool like Beyond Compare in order to extract any modifications that have been made.
If the functions names are only one letter it could be that the code is encoded with some kind of tool (I think Zend had a tool like that - Zend Encoder?) so that people cannot copy it. You should try to find an unencoded version, if there is one because that would save a lot of time.