Questions tagged [converter]

Converters can change data from one type to another, translate data based on cultural information, or modify other aspects of the presentation.

Value converters are culture-aware. Both the Convert and ConvertBack methods have a culture parameter that indicates the cultural information.

Ref: IValueConverter

3976 questions
42
votes
2 answers

Using enum in ConverterParameter

I am building an application that can be used by many users. Each user is classified to one of the next Authentication levels: public enum AuthenticationEnum { User, Technitian, Administrator, Developer } Some controls (such as…
Leonid
  • 421
  • 1
  • 4
  • 3
40
votes
2 answers

Conversion Error setting value for 'null Converter' - Why do I need a Converter in JSF?

I have problems understanding how to use selection in JSF 2 with POJO/entity effectively. For example, I'm trying to select a Warehouse entity via the below dropdown:
Albert Gan
  • 16,262
  • 44
  • 125
  • 177
37
votes
2 answers

Jade to HTML converter

I have started writing an application using nodejs and jade, but after a while my team decided to switch to Django. I would still like to use the web pages written using jade, without having to re-write them by hand. Does anyone know of a tool that…
Clara
  • 2,725
  • 6
  • 26
  • 49
36
votes
3 answers

Powershell: Convert XML to String

I am searching for a way to convert a XML-Object to string. Is there a way like $xml.toString() in Powershell?
uprix
  • 363
  • 1
  • 3
  • 5
35
votes
1 answer

Use converter on bound items in combobox

i have a combobox which is bound to a datatable column like this: ComboBox.DataContext = DataDataTable; ComboBox.DisplayMemberPath = DataDataTable.Columns["IDNr"].ToString(); The IDNr in the Column always starts with 4 letters…
lebhero
  • 1,267
  • 4
  • 17
  • 33
35
votes
4 answers

How to convert datetime to integer in python

how can i convert YYYY-MM-DD hh:mm:ss format to integer in python? for example 2014-02-12 20:51:14 -> to integer. i know how to convert only hh:mm:ss but not yyyy-mm-dd hh:mm:ss def time_to_num(time_str): hh, mm , ss = map(int,…
Tomáš Konyárik
  • 373
  • 1
  • 3
  • 7
34
votes
19 answers

Concatenating elements in an array to a string

I'm confused a bit. I couldn't find the answer anywhere ;( I've got an String array: String[] arr = ["1", "2", "3"]; then I convert it to a string by: String str = Arrays.toString(arr); System.out.println(str); I expected to get the string "123",…
Leo
  • 1,659
  • 5
  • 20
  • 41
33
votes
8 answers

How do I convert web application into desktop executable?

I've HTML application build with AngularJS/jQuery/Bootstrap with AJAX REST API. Is it possible to create executable/installer for Windows operating system? Without any 3rd-party software, it should look like native application, but HTML. For…
Miraage
  • 3,030
  • 3
  • 21
  • 40
32
votes
3 answers

use of boolean to color converter in XAML

I am working on WPF application.I have bound my textblock to my button. I want to set foreground of my textblock to black color when its associated button's isEnabled is true. I want to do this using converter. But its not working. also not giving…
deathrace
  • 827
  • 3
  • 20
  • 42
32
votes
3 answers

Convert non-ASCII characters (umlauts, accents...) to their closest ASCII equivalent (slug creation)

I am looking for way in JavaScript to convert non-ASCII characters in a string to their closest equivalent, similarly to what the PHP iconv function does. For instance if the input string is Rånades på Skyttis i Ö-vik, it should be converted to…
Max
  • 11,487
  • 26
  • 79
  • 129
31
votes
9 answers

Are there any recent Lua to JavaScript converters or interpreters somewhere?

I need to find a good Lua to JavaScript converter; lua2js on luaforge.org is out of date (3 or so years old and looks like it doesn't work on Lua 5.1) and I haven't yet found anything on Google. Does anyone have any experience with any other…
Kevlar
  • 8,378
  • 9
  • 51
  • 80
29
votes
2 answers

Convert.ChangeType How to convert from String to Enum

public static T Convert(String value) { return (T)Convert.ChangeType(value, typeof(T)); } public enum Category { Empty, Name, City, Country } Category cat=Convert("1");//Name=1 When I…
Mixer
  • 1,172
  • 3
  • 18
  • 38
28
votes
5 answers

How to inject @EJB, @PersistenceContext, @Inject, @Autowired, etc in @FacesConverter?

How can I inject a dependency like @EJB, @PersistenceContext, @Inject, @AutoWired, etc in a @FacesConverter? In my specific case I need to inject an EJB via @EJB: @FacesConverter public class MyConverter implements Converter { @EJB protected…
user550738
28
votes
7 answers

C# How to translate virtual keycode to char?

I am trying to map a virtual keycode to a char. My code uses ProcessCmdKey to listen to WM_KEYDOWN which gives me access to the key pressed. For example, when I press single quote I get a key of 222 which I want to have it mapped to keychar 39 which…
Horas
  • 1,641
  • 3
  • 16
  • 11
27
votes
7 answers

convert string to arraylist in java

How to convert a String without separator to an ArrayList. My String is like this: String str = "abcd..." I know one way of doing this is converting the String to char[] first, and then convert the char [] to ArrayList . Is…
Pan Long
  • 944
  • 1
  • 7
  • 16