C# for Java/*nix programmers - c#

I am mainly a java programmer, using linux/os x for as long as i remember. I am extremely comfortable in emacs and usually prefer doing things through command line.
I need to create a internet explorer addon for our next project. I need to intercept url ie is about to download and if they meet certain criteria pass it to our application.
So my questions are,
How can i build a c# project through command line so i can integrate it with our current build process.
Current i have windows 2k installed in a virtual machine that i use for testing. Is there going to be any compatibility problems.
I am assuming i am going to be creating a dll and inject it to ie to intercept url's. Am i on the right track?

Here are responses to your questions:
Use the C# Command Line Compiler. MSDN has an entire section devoted to its use.
Not for an IE add-on. If you plan to do more, using some newer libraries, you may run into problems unless you're running Windows XP or later. For IE addons, 2000 should be fine.
That's the basic idea. I'd refer to the MSDN articles on creating add-ons for IE, such as this one showing how to make custom menus.
Be aware, though, that you'll have a more difficult time if you avoid using Visual Studio (or some other IDE). There is no reason not to use VS, especially since you can use the Express Edition for free. If you're doing that, you can use msbuild instead of csc directly, and it will simplify your build process (even if you build from the command line).
However, the productivity gains from a good IDE will come in handy, especially for C#.

Responses to your questions:
If you use Ant maybe this will help. If you use Maven, maybe this will help. Otherwise, I'd just use MSBuild or NAnt.
Can't say for sure. I would guess that the IE API would be the same on each of the platforms. YMMV.
I'm busy writing an IE addon at work and I'm using SpicIE. It's very straightforward and simplifies the IE API drastically.
I've read in the comments elsewhere that you're not a fan of VS. I would probably use it (or MonoDevelop/SharpDevelop if they can create .csproj) to create the .csproj that can be used as an input to MSBuild. It might save you time rather than having to learn the syntax of the file.

If you give up the IDE, you give up one of the best debuggers on the planet and the best code-completion I've ever seen. Other than the fact that it will be a new system to you, there is no reason to claim that you can develop faster in EMACS. Everything you need is in the IDE, and there are keyboard shortcuts to mostly everything.
If you computer can handle the work load, I really see no good reason not to use Visual Studio.
edit: the newest version of visual studio won't run on anything less than XP sp2, to my recollection. This is most likely because the new versions of .NET won't run on anything lower than that... which would be a huge compatibility problem.

Related

Is there any way to make sure the end user gets the same voices for TTS that I use with SpeechSynthesizer?

I want to create a winforms application with text to speech implemented. However, the voices that are available are based on what you have installed on your OS. Is there a way to make sure the end-user also gets the correct voices that are needed, without telling them to install them manually?
This is ofcourse, if you are using SpeechSynthesizer.
If this isn't possible, I would like to know if there is an alternative to a free/open source TTS API that doesn't require your application to be on an Azure platform or being registrated somewhere (Google, TranslatingService and what not).
This is one of those question, where the answer seems so simple and obvious, we are not even certain we understood the question right:
You make a installer.
Part of the installer is to also install those TTS packagages containing the voices.
Done. Everyone using your programm via the installer you provided has the same voices. And that (plus maybe some links in the Programm Registery) is all that Installers do.
Points of note:
of course you need the legal allowance to redistiribute those packages. With some it is clear cut (like the DirectX redistirbuteable). But you need to check the licensing agreement.
older versions of Visual Studio did have a "Installer Project". But as Installer Systems like InstallShield and Windows Installer proliferated, those were cut without replacement.

How can I check if the computer is a Surface Studio?

I am developing an app specifically for Surface Studio - how is it possible to check that the machine is indeed a Surface Studio?
Ideally from within .NET, although perhaps this is information gleaned from the registry, I am not sure.
You can get more info about it by using Win32 Classes, it will help you a lot querying almost everything about your system.
To be easier, you can also download an application provided by Microsoft which allows you to better search the info you are looking for. The information you are looking for is probably located at Win32_ComputerSystem.

WPF desktop application without Visual Studio [duplicate]

Would it be practical to create WPF applications without ever touching Visual Studio (or any other IDEs)? As in, coding and compiling completely within Vim and the command-line? What resources would you recommend for someone trying to do so?
It would be possible, since basically WPF is based on XAML - a variant of XML - and C# or VB.NET or another .NET language as its backend language.
The question really is whether that's practical and if it makes sense - I highly doubt it. WPF is all about visual design, e.g. totally without a visual designer (either the built-in one in Visual Studio, preferably the 2010 version; or some other visual designer), it seems a bit silly to want to program WPF....
As for resources - well, a least a text editor is a must, then definitely a few good books on WPF, and you could leverage the C# or VB.NET compiler that comes with the .NET framework.
I have found myself writing XAML in Notepad on a number of occasions where I needed to create a quick UI but couldn't load an IDE. It is really quite trivial, and almost - but not quite - as fast as using an IDE. The main advantages of an IDE such as Blend or VS.NET are in quickly getting things like colors and animations to be "just right."
Another occasion when I frequently write XAML or C# in a text editor is here on Stack Overflow. I only fire up Visual Studio when I need to test something out.
My main recommendations for creating WPF applications without an IDE are:
First you should make proper use of WPF's layout system, using appropriate panels and "Auto" sizing wherever possible. For example, if you want a stack of buttons with some space between them, create a <StackPanel>, and on each button add Margin="4" or whatever. This is good design anyway. Most beginning WPF programmers treat it like WinForms with no layout capability, which is a shame. WPF has a very powerful layout engine and it should be used. If it is, there will never be any need for graph paper or measurements. In addition, your UI will automatically adjust its layout if you change font sizes or objects are larger than expected.
Second you should use msbuild for your project unless it is ultra-simple. msbuild is installed along with NET Framework so it is always available. The file format is very easy to edit with a text editor, and it is much better than a batch file with the appropriate "csc" command because it allows you to use code-behind and is less error-prone when adding new source files.
Third keep a PowerShell command line window open separate from your editor, with a command that runs "msbuild" and then executes your application. To run your app, then just Alt-Tab to this window and hit uparrow, Enter. Some text editors have the ability to execute user-defined commands directly from within the editor and see the output, in which case this second window is not necessary.
Fourth keep a copy of cordbg or mdbg handy. Although an IDE is the ideal place to do your debugging, any debugger is better than none at all. You will find your problems much faster if you stop at breakpoints and examine variables than if you just keep editing code and re-running.
Fifth, use "ColorPad" or a similar application to select your colors for use. Just guessing and entering your best guess in hexadecimal just doesn't work very well.
For resources, I recommend you get the book "WPF Unleashed" and work through the examples. I would also read a lot of other people's XAML, such as can be found on CodePlex.
Possible, Yes. Practical No.
For production work, I would consider Microsoft Expression Blend 3. Then copy the XAML and paste it into the editor of your choice and compile from the command line.
You could download KAXAML . It's a free, lightweight editor. I found it good for learning about XAML and seeing how minor changes and tweaks can impact on an overall design.
XAML is plain old text so find a free editor (KAXAML), use it, and if you must, paste into your editor.
If you really want to go down this route, I'd recommend getting some graph (squared) paper and a sharp pencil.
Draw out your designs on that, read off the positions and type them into your editor of choice.
One benefit of this is that you're going to have a paper prototype to show people ;)
As James Keesey points out in his comment on marc_s's answer, your edit-compile-test cycle is going to be painful.
It's definitely possible. I'd say it's not practical, though.
To be honest, I do professional WPF development and I do it with the visual designer closed. I'm much more comfortable editing the XAML by hand, just like I write HTML. However, the benefits of an IDE go far beyond the visual designer. There's IntelliSense, debugging and a whole host of other invaluable features.
Really, I must question your motives. What are you trying to gain? Visual Studio Express editions fully support WPF development, so it can't, or shouldn't, be a cost issue.
The newest version (3.0) now supports the wpf template.
Just download it from: https://dotnet.microsoft.com/
Just type in console:
dotnet new wpf -o wpfHello
cd wpfHello
code .
Greetings :-)

Windows explorer integration like tortoisesvn

My company uses a flavour of GIT for moving source code from your local system to the repository at the desired location (which later deploys and stuff , its a server basically) and the support for that tool is BAD. It uses the commandline and its very tedious to use it . I want to build somthing similar to tortoiseSVN / tortoiseGIT for this purpose and i am looking for a starting point.
How would i get the overlay icons in the folder ?
How would i be able to do windows explorer integration in the "right" way ?
I'm going to use .Net C# to build this tool.
Thanks in advance for the help!
Cheers.
You can write a Shell Extension! There is a lot to learn, though. Part IX of the complete idiot's guide to shell extensions series explains how to deal with icons.
In general writing IE and Shell extensions in C# isn't supported. Of course, newer versions of the runtime do allow you more flexibility in the area of SxS support. But you're on your own in terms of writing the COM interop and you need to think very carefully about how this will effect other apps that do things like use the file-open dialog.

Where to start with ASP.net in C# and Dreamweaver?

I am looking to start working on a personal site using C#. I work as a web developer and have used VBScript previously and am using Coldfusion now at work. I use Dreamweaver for development in these languages.
I have read a lot of people recommending that you should use a MS IDE to develop in .net and that C# is the way to go in terms of the language. I would like to stick with Dreamweaver as I feel I would be taking on a bit too much to learn how to use a new IDE and a new language at the same time.
Will using something like Visual Studio help with developing in .net so much that it is worth the effort of changing from Dreamweaver?
If so which IDE would be best to learn with?
If I choose to stick with Dreamweaver is there any recommendations you can make as to how to best setup Dreamweaver for easy development?
I believe not. Dreamweaver is not a good tool for developing code. This is what you need in ASP.NET. You'll need debugging. You'll enjoy IntelliSense, and you can always open single files in Dreamweaver occasionally (which I doubt you would, anyway).
Grab Visual Studio Express 2013 for Web (which is free) and enjoy. It's a Windows app, like many other Windows apps! You don't need professional training to use it.
As someone who formerly coded PHP in Dreamweaver, I would strongly suggest the use of the Visual Studio IDE for C# ASP.NET applications. The benefits are numerous:
Intellisense - where any object, property, method, etc. that you create will automatically appear in an auto-complete box, drastically reducing syntax errors
Project templates - starting a web application from scratch is going to be very very tricky if you have to do it all via source code
Debugging - errors can be caught and debugged directly in the source code
Add-ins - my favorite being the Configuration Section Designer
I'm sure there are even more reasons, these are just the biggest ones.
If you feel comfortable using Dreamweaver for design, you can still continue to use it, but I would strongly recommend you familiarise yourself with Visual Studio Express however (it's free). Trying to learn .NET and C# using a text editor or an application like dreamweaver is feasible, but you would be making the learning process unnecessarily difficult. Visual Studio gives you syntax highlighting, intellisense, debugging, and many other features that you just aren't going to get in another IDE targeted at web design. VS is really very strongly coupled to .NET development.
I started my career as a web designer many years ago using Dreamweaver, and have gradually made the transition to software developer. Leaving tools like Dreamweaver behind has actually given me a lot more freedom in terms of working as a designer, and I find that I don't in fact need any tools for markup and css other than a text editor. You may find that abandoning a design tool like dreamweaver actually makes you a better designer; and just as well - the "design" tools in Visual Studio are absolutely useless :)
If you do decide to continue using Dreamweaver for markup, be aware that things may render differently in Visual Studio. Ignore the Visual Studio design pane entirely and just check your design in the various browsers (I'm sure you already do this).
I think you would be very disappointed with the ASP.NET support in Dreamweaver. You would be MUCH better off getting yourself a copy of Visual Studio / Web Developer (express editions are free) and doing your development there.
That said, there's no reason why you can't create your HTML and CSS in Dreamweaver, then bring those files into Visual Studio to actually put in the code. This is kind of a one-time deal though since usually once you've started splitting up your HTML into master pages and user controls/partial views, it's pretty difficult to go back and edit them again in Dreamweaver.
Visual Studio 2008 will be probably better. Not only IntelliSense, but also debugging in JavaScript can be helpfull sometimes (don't know is it included in the Express edition).
Yes, coming from the exact same situation I can tell you now it will help a great deal to walk away from Dreamweaver for your .net work. The intellisense for C# is not super great in Dreamweaver. You will find features you miss a great deal from Dreamweaver though, specifically code completion on the HTML side is much better in Dreamweaver then in VS.
Another vote for Visual Studio, with the addition that you don't have to give up Dreamweaver. You can use Dreamweaver to build a basic layout and interface design. Then use Visual Studio to realize the implementation of that design.
You will find building ASP.Net without a purpose-build IDE painful.
I'd really like to point out that "IntelliSense" is nothing new and nothing Microsoft invented by any means. IntelliSense IS code hinting with links to the Microsoft help page, which I've never needed personally. Please see that Dreamweaver does have code hinting exactly the same as Visual Studio, however is not designed to develop C# and similar languages, and for that reason alone I would not recommend trying to develop with it.
As for developing purely in HTML, CSS, and JavaScript, a plain text editor is a better choice than Visual Studio granted you don't change any of the settings. There are so many things I hate about how VS behaves while I'm writing HTML, but that's another thread. On another site.

Categories