How to change the code template/layout in VS Code - visual-studio-2019

I have started to learn C#, so I have started to use VS Code as my editor and have also installed dotnet framework with it.
The problem is that when I create a new file, my file has a completely different code setup/layout/template, unlike the one that I had seen in a video, and I was wondering if I could change that default template, to the one in the video, so that it automatically loads in when I create a new C# file.
I tried to search through the VS settings and preferences, googling it, but can't seem to find this specific answer.
Currently when I create a new file I get such looking code:
look of the code that I get when I create the file
but I am looking to find this type of code, so that I can follow up with the tutorial that I am following:
look of code that I want to get when I create the file

You can set template by following below steps

Related

How can I route my solution into different projects?

I'm looking for a solution to be able to store my websites in individual projects, while keeping one project as an entrypoint that can route into those projects.
The ideal setup would be something like the following:
- Main (entrypoint)
- Website1
- Website2
- Website3
I need this format to allow someone to access their website (ie. Website1) as a solution they can run and debug on their own, without having access to the entire application.
Basically, I want to be able to set up a new project, add the reference to the Main project, add an entry into my routes, and allow the new project to be built out and tested if it needs to be.
Is this possible?
I've looked at using areas and tried several plugins, but I can't seem to get this working properly. My biggest issue right now isn't routing into the project's controller, as I can get into that action perfectly, but once there, I can't reference any of the ASPX files properly. (I need to be able to reference them within the context of the project and the entire solution.)
If anyone could direct me towards other resources or questions I might have missed, I'd appreciate that as well. Thank you!
You should be able to doe this using a source control program of your choice. Put each website project in a separate folder and reference each website project file to a main master.sln file in a different folder called MasterSolution. Commit it all to source control. Then, for a user that opens Website one only, they just do open project, and go to the Website1 project folder and open the project file for Website1. Your MasterSolution is not opened but always gets the latest code as after the Website1 developer does a commit of his/her Website1 updates.

Using resources for localization in MVC4

I'm following this tutorial that was given as answer in this question, however I'm stuck at displaying the resource.
Just like in tutorial I've created two files
App_GlobalResources
/Global.en.resx
/Global.ru.resx
I've made data annotation class that works and adds a cookie with no errors, it means it injects the local data into current thread properly. When I try to output resource it cannot find it.
I've tried to output it like this and none of these works:
#Global.HomeHello
#Global.en.HomeHello
#Resources.Global.Homhello
// The name 'Resources/Global/etc...' does not exist in the current context
Also, in this tutorial site I see no logic that will inject the proper resource file, how it can do something like (in tutorial) #Global.HomeHello and it will know that if url is /en/ he needs to use Global.en.resx
Please help, first time using resources and implementing multiple languages, feels 100 times more harder and confusing than using *.yml files in other frameworks/languages...
You took a bad example to follow I guess. Please look into the following article:
Resource Files and ASP.NET MVC Projects
Don't forget to change Custom Tool to PublicResXFileCodeGenerator and Custom Tool Namespace to Resources.
Hope this helps & good luck.

Easy way to find a view file in rails?

I develop rails applications with my designer who has minimum knowledge about rails.
She works on Windows through file-sharing from a Linux server.
She always has hard time finding view files to work on.
I usually use 'grep' to find a view file.
But she can't.
If you have a good suggestion, please share with me.
I have an idea which may be overkill.
Is there a way to automatically add comments around view files (including layouts and partials?) in html file?
Like this:
<!--Starting app/views/some_dir/some_file.html.erb-->
HTML here...
<!--Ending app/views/some_dir/some_file.html.erb-->
This way, my designer can find the file very easily.
Of course, this should be automatic and development environment only.
Thanks.
Sam
I use the Rails Footnotes gem (https://github.com/josevalim/rails-footnotes) in some of my projects which allows me to click a link in the footer of my app that opens the current view (also shows partials) in TextMate. Not sure if it could be customised to work with a Windows text editor but you could look at the URL to work out the file name.
I.e to open a file in MacVim, it creates the following link:
mvim://open?url=file:///Users/steveholt/Sites/foo/app/views/projects/log.html.haml
and for TextMate:
txmt://open?url=file:///Users/steveholt/Sites/foo/app/views/projects/log.html.haml

How to create a new "templates" category on Xcode 4 and use my own file templates there?

I would like to start using my own templates for iOS applications. I don't want any significant changes, but simpler things like
add/remove some boilerplate code
add some pragma mark sections
hardcode my company's name and some comments for every file
change the indentation
etc etc etc
The idea is that we will share these templates when we create apps, but at the same time we want to keep the default template files that Xcode 4 already provides. So, in the following screenshot, how can I add a "CompanyName Application" section that contains exactly the same templates (Navigation-based, View-based etc), but with my own changes?
I found that I can add a folder under /Developer/Library/Xcode/Templates/ or /Developer/Platforms/iPhoneOS.platform/Developer/Library/Xcode/ but I'm a bit confused with what do I need to do exactly. I would really appreciate it if you could help me with that, as I have already messed up my folders twice with no luck. Thanks!
This blog post by borealkiss has detailed instructions. For starters:
If you add your own templates, the place you should use is under the following path:
~/Library/Developer/Xcode/Templates/
The problem is that it is quite hard to create a custom template.
For example, to copy and paste the
built-in template to your place will
not show up the template on Xcode 4
until you manually change its
identifier in TemplateInfo.plist.
I just found this article from Bob McCune "Creating Custom Xcode 4 File Templates" that is exactly what I needed, so I put it here for reference.

Troubleshooting "call to undefined function" when adding Markdown to project

I'm trying to add some Markdown capabilities to my Symfony project (Symfony version 1.3.3).
To accomplish that, I had already included the Markdown library into lib/vendor directory. Also, I added the need configuration in the autoload.yml for the previous library.
However, I'm getting a fatal PHP error:
Call to undefined function Markdown()
How can I resolve this problem?
The symfony autoloader loads classes from php files named like <classname>.class.php. If you're using the markdown.php file from mitchelf.com, it does not follow the naming scheme, nor does it contain a class called Markdown, as a matter of fact: it has a function called Markdown.
Symfony isn't even trying to load it, for reasons I described above. You will have to include it manually. I suggest you have a look at http://www.symfony-project.org/plugins/sfEasyMarkdownPlugin.
I do NOT suggest installing a plugin for such a simple feature. It is not hard for you to figure it out if you have some real examples.
There is an open source project based on symfony named Bookeet. It has embedded MarkDowm feature. It uses markitup as the markdown editor. And it uses php markdown to convert markdown code to html code.
To save your time, go directly to changeset 29f0ba1807 of the Bookeet project(I am sorry that I can't post the hyperlink because SO doesn't permit new user to post more than one hyperlink). You could see clearly what should be done in order to add markdown feature to your website.

Resources