I'm developing with Visual Studio Code a codeigniter project and there are several parts across the code that reference strings defined inside the application/language/ folder for each translation.
Currently when I encounter something like echo lang("ctn_1") I have no idea what the ctn_1 string says so I need to open the language definition file and look for $lang['ctn_1'] = "Email Address";
I imagine there is a better way (wishing for a plugin in that lets me just hover over lang("ctn_1") and shows "Email Address" as a tool tip).
Any advice on how to make me more efficient around this?
Related
I work on an ASP.NET MVC 5 website. A while ago, I created a helper method to include specific CSS files with our Views - it accepts a string as input representing the file path to that CSS file, relative to the root of the project.
E.g:
AddStyleSheet("/path/to/the/file.css")
What I would absolutely love is a way to provide Intellisense in Visual Studio (ideally 2019, but 2022 could also work if necessary) to help create that string by showing relevant files, similar to what we get for #import statements in SCSS files (pictured), where a nice prompt pops up showing files at the current location represented by the file string.
Happy to change the helper method however necessary to accomplish this - is something like this possible? Maybe via an extension or some decorator on the string in the function?
Im learning angular and it would be nice if i could have $ the dollar sign, formatted so its maybe red since it would make reading angularjs code much easier.I am using visual studio 2013.
To recap.I want the dollar symbol in javascript files to be of color red.
Since this isn't really a question, add your suggestion/request to http://visualstudio.uservoice.com.
If you want to implement this yourself you would need to create your own intellisense settings for JavaScript, which I'd suspect is something you probably don't want to do.
Am developing a module for DotNetNuke 7. I want to be able to upload a thumbnail image for entries in a catalogue. Have managed place control in edit view of my module and upload and select files however when I build the project I get the following error:
C:\dnn\dotnetnuke\DesktopModules\EventCatalog\Edit.ascx.designer.cs(103,38,103,41): error CS0234: The type or namespace name 'Web' does not exist in the namespace 'DotNetNuke' (are you missing an assembly reference?)
Also I can't figure out how to get the selected file on the backend to save the url to database. When I enter the ID of the control VS recognizes it but intellisense doesn't provide any clues as possible options.
Can anyone tell me how to fix the above error and also if possible, point me towards a overview/tutorial for this control. Have done a fair amount of Googling but not found anything.
Well, to start, you probably need to add an assembly reference to DotNetNuke.Web to your project. Once that's there, it'll probably help with your lack of intellisense as well.
Looks like the main way you interact with the selected URL is via the FileID property. The control itself will manage saving the file to the selected FolderPath (which may or may not be something the user can change).
But, you're right, there aren't good resources for how to use the control. The best "tutorial" it probably looking through the DotNetNuke core code to see how the core uses the control.
The built in dnn upload control is specifically designed for uploading files to the dnn file system - but to be honest its pretty ugly to work with.
It makes a lot of assumptions about what you want to do with the file and as part of its process automatically registers new file in the dnn file system index.
Its also not really ideal for thumbnail uploads or any such fancy stuff - since it has no capability for file size management or scaling and cropping - its something that has been promised a couple of times but not eventuated to date.
On top of this is has a bit of a mind of its own when it comes to where it actually stores the uploaded file - which means you may be better off looking at a 3rd party uploader that you can control more easily.
FWIW - there is a full version of the telerik asyn upload library installed with every dnn install - you will need to setup it up manually but that is not that hard.
<dnn:DnnAsyncUpload></dnn:DnnAsyncUpload> is the markup basic structure and its functionally equivalent to <telerik:RadAsyncUpload></telerik:RadAsyncUpload>
Its documented here http://www.telerik.com/help/aspnet-ajax/asyncupload-overview.html
Having said all this if you do want to stick with dnn file picker - this code will let you find the file object that dnn uploaded the file too.
String thisURL = "";
String thisPHYSICAL = "";
Int32 itest001 = thisControl001.FileID;
if ( itest001 > 0 )
{
var thisFILE = (DotNetNuke.Services.FileSystem.FileInfo)FileManager.Instance.GetFile(itest001);
thisURL = FileManager.Instance.GetUrl(thisFILE );
thisPHYSICAL = thisURL.PhysicalPath;
}
thisURL will contain a url relative to your website domain
thisPHYSICAL will contain the physical location of the file on your server.
I'm having a little trouble getting localized resources files to work on Windows Phone 7. Here's what I'm doing:
Create a resource file, say "Strings.resx" (Build Action: Compile)
Create a key, say "TestKey" with a default value of empty string
Add a English resource file in the same folder with a value of "some English string": Strings.en-us.resx (Build Action: Embedded Resource)
Add a Japanese resource file in the same folder with a value of "some Japanese string": Strings.ja-jp.resx (Build Action: Embedded Resource)
In my PC Silverlight, WPF Apps that works fine when I change the Thread.CurrentThread.CurrentCulture. But in the phone I always seem to be getting the value that's in the Strings.resx file - an empty string.
I have tried using the designer generated code and wiring up the resource manager by hand and it does not seem to matter. Here's my code:
Type t = typeof(Strings);
_resourceManager = new ResourceManager(
t.Namespace + "." + t.Name,
t.Assembly);
_resourceManager.GetString("TestKey");
Tell me localized resources are supported on the phone... ;> What am I doing wrong? Thanks!
Update: Thanks Olivier for forwarding the link. I saw that as well but missed an important step. I didn't add the "SupportedCultures" node to my csproj. Made all the difference - hoping someone else doesn't loose two hours trying to figure this out like I did.
<SupportedCultures>de-DE;es-ES;</SupportedCultures>
Of course, localized resources are supported on the phone:
How to: Build a Localized Application for Windows Phone
I wrote a blog post that provides links to a bunch of Globalization / Localization guides for WP7. There is a Windows Phone 7 in 7 Training video that helped me understand the basics. After that it was simply a matter of learning how to do databinding:
The MSDN article shows you how to
setup the files and create the
LocalizedStrings class, but they then
assume that you know how to use that
class for data binding. Visual Studio
2010 and Silverlight handle data
binding differently than Winforms, and
it gets even more confusing since XAML
also has it’s own definition of
Resources that are different then the
.NET resources we just created.
Silverlight also uses the term
Resource to refer to files that use
the the Build Action of "Content”, as
these files get wrapped up into the
.XAP file similar to how files with
Build Action of "Resource” get
embedded into the .Dll assembly (ex:
loading an image from content or
resource files). I found that instead
of using the Text="{Binding
Path=resourceFile.resourceName,
Source={StaticResource
Localizedresources }}" XAML syntax it
was easier to use the following steps:
Open your primary XAML page (usually MainPage.xaml) in the Visual
Studio designer
Open the properties for the PhoneApplicationPage and set the
DataContext to be
Application.Resources –>
LocalizedStrings. NOTE: if you already
are using a DataContext object, then
you should integrate the
LocalizedStrings class into that
object so that it has localization
support.
Once the Page’s DataContext has been set you can change the data
binding for any control on the page by
simply selecting the property (ex:
text, checked, etc), selecting “Apply
Data Binding…”, and setting the Path
to Localizedresources.BtnText or
whatever the name of the desired
resource value is.
I remember reading once that there was a way to embed an image into a code file (e.g. a screenshot or diagram) in Visual Studio, but now I can't find any reference to that feature.
Is this possible to do, or am I imagining things?
EDIT: I don't mean embed the image in the executable, for use at runtime. I mean link or embed it literally in the code, for use by developers.
There is a plug-in for VS 2010 that can do this:
Plug-in
There is also a plugin for VS2012 and VS2013. At this moment installing for VS2013 does not seem to work for me though.
ImageComments extension on GitHub
You can embed images in your binary through the use of the ImageList control, which is typically used to store small icons for list controls, gridviews, etc., but could also be used for storing really any image for any purpose. A better solution would be to include a resource file and store your images there.