format

Angular2 SystemJs Bundles and Non Bundled js

雨燕双飞 提交于 2019-12-11 21:15:46
问题 I'm new to SystemJs and Angular2. I am using 3rd party packages, some of which have bundles/code.js files and some do not. The ones that are using bundles/code.js I have managed to get working. I include <script src=foo/bundles/code.js> and am then able to import * from 'code/foo' inside my ts files. This all makes sense to me as the bundles/code.js has something like System.registerDynamic("code/foo",...) and so the import knows what code/foo is (This is my understanding of it) I have come

What format use to store code snippets with cross-platform compatibility in mind

只愿长相守 提交于 2019-12-11 21:06:32
问题 Consider that there are different programming languages and different IDE. Some IDE is possible to use for many languages, almost all Text Editor possible use with any programming language. There also many operation systems. And we have code snippets. We want write it once, use it anywhere. We don't want to be bound to any language, tool or platform. What format use to store code snippets ? Personally at this moment I store all snippets as files in single folder located in Dropbox. Files have

C# convert string to datetime without time

混江龙づ霸主 提交于 2019-12-11 21:05:03
问题 It seems like it is not possible what I want(at least according to some articles i have read). But just to double check it. I am reading a DateTime from my database. In the database it is written like "01.01.2011" but when I read it with SQL and store it in a string it says "01.01.2011 00:00:00". Then I thought OK, I will just cut the time from the string . But there is the trick, it seems like this is not possible. Even when I cut the "00:00:00" part from the string (and it just says "01.01

Format Phone Numbers in MySQL

眉间皱痕 提交于 2019-12-11 19:48:03
问题 I have a bunch of phone numbers in a DB that are formatted as such: (999) 123-3456. I'm needing them to look like 123-123-1234 Is there any sort of regex or something I can do in MySQL to quickly format all these phone numbers? Also, frustratingly, some are NOT formatted like that, so I couldn't just apply this to an entire column. Thanks! 回答1: A quick solution would be to run these two queries: UPDATE table_name set PhoneCol = REPLACE(PhoneCol, '(', ''); UPDATE table_name set PhoneCol =

Simple form format a time field to show '21:30' instead of entire UTC time string

时间秒杀一切 提交于 2019-12-11 19:34:11
问题 My rails _form code: <%= simple_form_for @admin_event, :html => { :class => 'main-form' } do |f| %> <%= f.input :time_of_event, :format => l(:time_of_event, '%d %b. %Y'), :as => :string, :label => 'Hora', :input_html => { :class => 'thin', :placeholder => 'eg: 20:30' } %> <% end %> I'm getting the error message: Cannot convert symbol to string. How can I set up this _form to always display this field using a time converter so while the database has a full field ( 2000-01-01 19:30:00.000000 ),

Error is being raised when executing a sub-process using “ | ”

你离开我真会死。 提交于 2019-12-11 19:32:57
问题 I am trying to automate the process of executing a command. When I this command: ps -eo pcpu,pid,user,args | sort -k 1 -r | head -10 Into a termianl I get the response: %CPU PID USER COMMAND 5.7 25378 stackusr whttp 4.8 25656 stackusr tcpproxy But when I execute this section of code I get an error regarding the format specifier: if __name__ == '__main__': fullcmd = ['ps','-eo','pcpu,pid,user,args | sort -k 1 -r | head -10'] print fullcmd sshcmd = subprocess.Popen(fullcmd, shell= False, stdout

Converting 12 hour to 24 hour time format in sqlite

二次信任 提交于 2019-12-11 19:14:17
问题 Say I have a script named 'importscript.sql' to create a table and populate it from a text file named 'rawdata.txt' like so: CREATE TABLE rawdata ( timestamp text, value REAL ); .separator , .import '~/path of the file/rawdata.txt' rawdata The 'rawdata.txt' file looks like this: 4/14/2012 3:50:09 PM,24.7 4/14/2012 3:51:09 PM,24.2 4/14/2012 3:52:09 PM,99.3 Then creating a database named RAWDATA.db with the rawdata table in it in the command prompt using: sqlite3 RAWDATA.db < ~/path to the

Evaluate python format string for number of values expected

萝らか妹 提交于 2019-12-11 18:34:12
问题 I have a method that receives a format string and a set of values provided by a user, and uses these to write an output to a screen. def makestring(fmt, vals): s = fmt.format(*vals) return s fmt_expecting_three = 'a={:0.2f}, b={:0.4f}, c={:0.1f}' threevalues = [(x+1)/7. for x in range(3)] makestring(fmt_expecting_three, threevalues) produces 'a=0.14, b=0.2857, c=0.4' I would like to perform a test to discover the number of values matches what the format is "expecting". I show an ugly test

Localtion of pattern for date formats in java

蹲街弑〆低调 提交于 2019-12-11 18:22:46
问题 In java you can get the date format based for a specific locale by doing: Locale locale = new Locale("en", "UK"); DateFormat format = DateFormat.getDateInstance(DateFormat.MEDIUM, locale); System.out.println( ((SimpleDateFormat)format).toPattern()); This prints dd-MMM-yyyy Is this pattern hardcoded in a properties file somewhere? Is there any way I can extend the java mechanism and apply my own pattern (locale dependent) so when I run the above code I get: dd-MM-yyyy 回答1: The idea is to work

ggplot not adding legend. What am I missing? very new to R

你。 提交于 2019-12-11 18:14:05
问题 I'm plotting three samples with ggplot but it's not adding a legend for the samples. It's not spitting out any error message so I'm not sure where I'm going wrong. I'd really appreicate some guidance. I've tried to declare color for each sample for the legend manually but there is still no legend on the plot. df<-data.frame(samples$V1, samples$V2, samples$V3, samples$V4, samples$V5, samples$V6, samples$V7) CG_methplot <- ggplot(df, aes(x=samples$V1,))+ scale_x_continuous(breaks=number_ticks