How to convert LocalDate to SQL Date Java?

The answer is really simple; import java.sql.Date; … LocalDate locald = LocalDate.of(1967, 06, 22); Date date = Date.valueOf(locald); // Magic happens here! r.setDateOfBirth(date); If you would want to convert it the other way around, you do it like this: Date date = r.getDate(); LocalDate localD = date.toLocalDate(); r is the record you’re using in JOOQ … Read more

Need API for currency converting [closed]

free.currencyconverterapi.com returns results in JSON format. The web service also supports JSONP. The API is very easy to use, and it lets you convert one currency to another. Disclaimer, I’m the author of the website. A sample conversion URL is: http://free.currencyconverterapi.com/api/v6/convert?q=USD_PHP&compact=ultra&apiKey=sample-api-key which will return a value in json format, e.g. {“USD_PHP”:51.459999}

How to convert HTML to XHTML? [closed]

Convert from HTML to XML with HTML Tidy Downloadable Binaries JRoppert, For your need, i guess you might want to look at the Sources c:\temp>tidy -help tidy [option…] [file…] [option…] [file…] Utility to clean up and pretty print HTML/XHTML/XML see http://tidy.sourceforge.net/ Options for HTML Tidy for Windows released on 14 February 2006: File manipulation —————– … Read more

How to write a custom converter for

It’s possible, whithout other database access, but i don’t know the best way. I use a very specific converter, works only for picklist. Try this: @FacesConverter(value = “primeFacesPickListConverter”)public class PrimeFacesPickListConverter implements Converter { @Override public Object getAsObject(FacesContext arg0, UIComponent arg1, String arg2) { Object ret = null; if (arg1 instanceof PickList) { Object dualList = … Read more

How can I generate all possible IPs from a list of ip ranges in Python?

This function returns all ip addresses like from start to end: def ips(start, end): import socket, struct start = struct.unpack(‘>I’, socket.inet_aton(start))[0] end = struct.unpack(‘>I’, socket.inet_aton(end))[0] return [socket.inet_ntoa(struct.pack(‘>I’, i)) for i in range(start, end)] These are the building blocks to build it on your own: >>> import socket, struct >>> ip = ‘0.0.0.5’ >>> i = … Read more

Split java.util.Date over two h:inputText fields representing hour and minute with f:convertDateTime

This particular case is not possible if you want to use a single model value. This is however a perfect candidate for a composite component. It allows you to bind a single model value to a group of closely related existing components and perform the processing/conversion in the backing component, fully decoupled from the view … Read more

Using a “Please select” f:selectItem with null/empty value inside a p:selectOneMenu

When the select item value is null, then JSF won’t render <option value>, but only <option>. As consequence, browsers will submit the option’s label instead. This is clearly specified in HTML specification (emphasis mine): value = cdata [CS] This attribute specifies the initial value of the control. If this attribute is not set, the initial … Read more

Convert xlsx to csv in Linux with command line

The Gnumeric spreadsheet application comes with a command line utility called ssconvert that can convert between a variety of spreadsheet formats: $ ssconvert Book1.xlsx newfile.csv Using exporter Gnumeric_stf:stf_csv $ cat newfile.csv Foo,Bar,Baz 1,2,3 123.6,7.89, 2012/05/14,, The,last,Line To install on Ubuntu: apt-get install gnumeric To install on Mac: brew install gnumeric