Change format of the "date" variable when writing snippets in KDevelop - kdevelop

I am writing a simple snippet in KDevelop 4 to print the date of today, taking advantage of the Snippets feature and of the variable %{date}. The default format, however, is apparently MM/DD/YYYY, and I'd like to change it into YYYY-MM-DD. I have browsed over the Settings of both the Editor and the whole KDevelop, without luck. Can anyone point me to the relevant settings, if any exists?
I am using version 4, but I guess that's close to irrelevant (or is it?).

Found the answer in the KDE Help Center: %{date} is a Kate template macro (Kate is the editor used by KDevelop). Its expansion depends on the system locale, and there is no indication about a way to change the locale. By using other macros, however, I can obtain the desired result:
%{year}-%{month}-%{day}
For more complex cases, I suspect I'd need some more digging into the Kate Template Format, but the information so far satisfies my immediate need.

Related

Spreadsheet Gear migration errors

I am migrating Spreadsheet gear of my application from 6.0.3.190 to
7.4.1.104.I am getting my issues with Color property.Can any one help me in this.Now I am using using Color = System.Drawing.Color; and also ToSGColor().This became very hectic to do in all places where ever we use color.I expect we should have some shortcut to do this.Can any one suggest me How can i get all functionalities with few changes only.I am also getting exceptions to c onvert IColorFormat.LineColor to system.drawing.Color.
Note the "Breaking Changes" page in the SpreadsheetGear 2012 documentation, which lists this particular change:
In order to support WPF and Silverlight, the core API has been
separated from the GDI+ and Windows Forms APIs and therefore uses the
new SpreadsheetGear.Color type rather than
SpreadsheetGear.Drawing.Color. SpreadsheetGear.Drawing.Color has been
moved to SpreadsheetGear2012.Drawing.dll. See
SpreadsheetGear.Drawing.Color for an example which uses the implicit
and static converters to convert between SpreadsheetGear.Color,
SpreadsheetGear.Drawing.Color and System.Drawing.Color.
SpreadsheetGear.Colors and SpreadsheetGear.SystemColors provide
helpful predefined colors to replace the use of predefined colors in
System.Drawing.Color.
So you'll need to ensure than any place where you were previously using System.Drawing colors now use SpreadsheetGear.Drawing colors, including API like IColorFormat.LineColor.
There aren't really any "migration" tools to automatically convert such instances to the new API. So you'll need to resolve these errors for each code file. Doing a Find/Replace keyword search for "System.Drawing" and "SpreadsheetGear.Drawing" could possibly speed up the process, though this would depend on what using statements you have added to each code file.

Dynamic locale name in multi-language site

I am developing an application in cakephp 2.3.4, Which is multi-language.
Admin can add any number of new languages.
My question is, When admin decides to add a new language, how resulting locale name should be defined.
Can a locale name be any arbitrary name, given by admin or it should be a dropdown containg all languages code according to language.
Unfortunately, your question is a bit 'vague', i.e., will administrators be able to add GNU-locale files (*.po), or are you talking about adding translations inside the database.
In any case, CakePHP uses locales according to the ISO 639-3 standard see here and here for more information. A complete list of those locales can be found inside the I10n class.
Since you probably also want to switch the locale of PHP itself when switching locales, so that, for example, date, money and time-formats will follow the right format for the locale, it's best to stick with those locales and not 'invent' your own locales.
See setlocale(). Be aware though, that PHP may use slightly different locale-codes than CakePHP uses. And it will depend on what locales are installed on your server.
To get a list of locales installed on your server, use locale -a on the command line. See this page for more information: https://wiki.archlinux.org/index.php/Locale
Which techniques to use for localization
A quick summary of techniques to use;
Short messages (interface/UI)
In general, locale files are used for short pieces of text. Locale-files are therefore mostly used for fixed strings,
for example, strings that are used in the interface (like 'are you sure you want to delete this file?' => 'weet u zeker dat u dit bestand wilt verwijderen?).
Longer (fixed) text
For longer pieces of text in your application, that are not part of the 'content' (not the blog-post, but for example a fixed page with a disclaimer),
it's best to use separate views for translated content, for example;
app/Views/MyController/disclaimer_eng.ctp
app/Views/MyController/disclaimer_deu.ctp
app/Views/MyController/disclaimer_fre.ctp
Content
For the content of your website (the part of your website that is managed by the 'user' of the website),
put translations inside the database. This data may be updated frequently and all translations should be updated as well.
How to implement this, is really up to you and depends on your situation. CakePHP offers a Translate behavior that you can use (http://book.cakephp.org/2.0/en/core-libraries/behaviors/translate.html), but in most of my situations that behavior didn't really fit our needs (IMO it is not very efficient, because it stores translations per-field, per-model).

File browser in R

I need to write a small R script for people who never used R before that imports a file and does some things with it. I would like to minimize user input as much as possible, and since assigning the file-path is basically all the user input required I was wondering, is it possible to get a popup screen (basically your usual "open file" screen) allowing someone to select a file (import the name as string in R or something)?
The file.choose function performs this, eg:
fname <- file.choose()
source(file.choose())
You may also want to look at choose.files (for multiple files) and choose.dir (for just selecting a directory path).
The tcltk package gives you tk_choose.files.
If you want to go beyond file choosers then you can use the package to build user interfaces.
It's worth mentioning rChoiceDialogs::rchoose.files. I'm not completely sold yet, but they advertise it as being completely cross platform and fixing the annoying problem common to choose.files and tk_choose.files of popping up behind other windows. See their vignette here.

Best way of maintaining versions

I want to maintain version control in following application so what will be best option for maintaining version?
In my app there is tool which will generate resources as input for my frame work.
For the sake of simplicity we can take a eg like in tool there are same options so one can set some values over there.
Just assume there are ten integer ctrl box are on tool and user can set values there so tool will generate the values either as xml file or some struct define in c as follows.
Note here parameters name like TITLE and DIALOG use respectively with Integer ctrl. these string name are ie TITLE/DIALOG will remain fixed.
<root>
<TITLE value = '1' />
<DIALOG value = '2' />
.
.
</root>
and
Struct data
{
1, //TITLE
2. //DIALOG
.
.
.
}
etc
So tomorrow it may possible there are some new parameter like TITLE and DIALOG may also added.
Then what is the best way to keep the version control in this scenario.
actually i am not talking about version control like perforce or svn, my question is regarding like if there are 10 parameters ot wd mine version 1.0 or if there are 12 param then it wd may 1.1 etc, like in that sense i am talking. I always want assurance that with these strings i will generate some key and this key will be write into the xml, then in framework i will calculate that key by those param so there is always assurance that data generated by tool is as same version with the current frame work version.
I know its bit lengthy but i hope it make problem more translucent
Thanks in Advance
Could you be a little more specific ?
If you talking about the versionning of your code, there existe an array of software that you could use. SourceSafe, Team Foundation, SubVersion and CVS are but a few. Some of them are pretty simple and free, while other are quite expensive but can be easily integrated into you IDE if you have one.
Hope that helps.

Diff tool which generates documentation?

I have tried Beyond Compare, and it seems to be a good tool.
But I haven't found a way to export an overview of the differences.
The format of it should be one that most people can read. Doc, Rtf, Pdf, Html...
What I need is to display the differences of two folder. And it would be enough to display which files has been changed. But it would also be nice if it would be possible to, in the documentation, go deeper and actually see which rows in a file has been changed.
Are there any tools that can do this?
Beyond Compare has some functions to do that.
For example, in the folder diff view, select the files you want to report and then select Actions->File Compare Report. HTML is one of the output formats supported there.
Araxis Merge covered all of my needs.
Simple to use
Generated a nice overview of files in folder structure
Could click on changed files to see the changes in the content
The colors could be better, but that can be solved by inserting a custom CSS-file. :)
This script to colorize diff output to HTML might be useful. There are many other tools, one more is difftool.
On a relatively different note, I had used a code coverage tool that also generated HTML code views from gcov coverage information. Its called lcov.

Resources