add

How do I add time to a timestamp?

主宰稳场 提交于 2019-12-04 04:06:54
问题 I need to add 14 minutes and 59 seconds to an unknown time in an array. How do I do this? This is what I have so far: Date duration = df.parse("0000-00-00 00:14:59"); arrayOpportunity[2] = arrayOpportunity[2] + duration; The time is not being changed. Thanks! I have done my research. I cant paste the entire code I have. But mainly I didnt want to make you read it all. Just looking for a simple answer of how to add two timestamps. 回答1: If you are talking about a java.sql.Timestamp , it has a

Python merging dictionary of dictionaries into one dictionary by summing the value

戏子无情 提交于 2019-12-04 03:47:49
问题 I want to merge all the dictionaries in a dictionary, while ignoring the main dictionary keys, and summing the value of the other dictionaries by value. Input: {'first':{'a': 5}, 'second':{'a': 10}, 'third':{'b': 5, 'c': 1}} Output: {'a': 15, 'b': 5, 'c': 1} I did: def merge_dicts(large_dictionary): result = {} for name, dictionary in large_dictionary.items(): for key, value in dictionary.items(): if key not in result: result[key] = value else: result[key] += value return result Which works,

Add characters to a numeric column in dataframe

爱⌒轻易说出口 提交于 2019-12-04 00:29:40
I have a dataframe like this: V1 V2 V3 1 1 3423086 3423685 2 1 3467184 3467723 3 1 4115236 4115672 4 1 5202437 5203057 5 2 7132558 7133089 6 2 7448688 7449283 I want to change the V1 column and add chr before the number. Just like this: V1 V2 V3 1 chr1 3423086 3423685 2 chr1 3467184 3467723 3 chr1 4115236 4115672 4 chr1 5202437 5203057 5 chr2 7132558 7133089 6 chr2 7448688 7449283 Is there a way to do this in R? The regex pattern "^" (outside any character-class brackets) represents the point just before the first character of a "character"-class item (aka "string" in other computer languages)

Is it possible to add,delete xml nodes with jquery $.ajax?

强颜欢笑 提交于 2019-12-03 21:35:04
I want to delete some nodes or add some nodes in xml with jquery, I try it with append , empty , remove but all of them seem to not work, like ( in $.ajax ): success:function(xml){ $(xml).find("layout").append('<app id="' + $children.eq(i).attr("id") + '"></app>'); $(xml).find("layout").empty(); } also I find there is no tutorial on google. So I wonder is it possible add or delete nodes in xml with jquery? OK ,I write it in details ,the xml file just save in local domain as Database/UserConfig/config.xml here is my Ajax code : function layout_change() { var $children=$input.children(); $.ajax(

Android Click on Widget not working after adding widget

偶尔善良 提交于 2019-12-03 20:59:52
prefs.java Intent resultValue = new Intent(); resultValue.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, appWidgetId); setResult(RESULT_OK, resultValue); Context context = getApplicationContext(); RemoteViews views = new RemoteViews(context.getPackageName(), R.layout.main); Intent configIntent = new Intent(context, Prefs.class); configIntent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, appWidgetId); PendingIntent pendingIntent = PendingIntent.getActivity(context, 0, configIntent, PendingIntent.FLAG_UPDATE_CURRENT); views.setOnClickPendingIntent(R.id.callbackwidget, pendingIntent);

Adding a block of XML as child of a SimpleXMLElement object

流过昼夜 提交于 2019-12-03 20:27:20
问题 I have this SimpleXMLElement object with a XML setup similar to the following... $xml = <<<EOX <books> <book> <name>ABCD</name> </book> </books> EOX; $sx = new SimpleXMLElement( $xml ); Now I have a class named Book that contains info. about each book. The same class can also spit out the book info. in XML format akin the the above (the nested block).. example, $book = new Book( 'EFGH' ); $book->genXML(); ... will generate <book> <name>EFGH</name> </book> Now I'm trying to figure out a way by

Kendo Ui DataSource Add Function not working properly

我的梦境 提交于 2019-12-03 17:17:41
I defined a Kendo Data Source as below. It is populating values in a ListView. var datasourceAppList = new kendo.data.DataSource({ transport: { create: function(options){ //alert(options.data.desc); alert(options.data.desc); var localData = JSON.parse(localStorage.getItem("LsAppList")); localData.push(options.data); localStorage.setItem("LsAppList", JSON.stringify(localData)); //localStorage["LsAppList"] = JSON.stringify(localData); options.success(localData); }, read: function(options){ var localData = JSON.parse(localStorage["LsAppList"]); options.success(localData); }, update: function

Problem adding validation list in excel sheet using VBA

六眼飞鱼酱① 提交于 2019-12-03 16:17:45
I have an excel sheet that is loaded with a dynamic result set of data. I need to add a YES/NO dropdown at the end of each row once all the data is loaded. I have to do this dynamically as I do not know the size of the result set beforehand. The following code throws an 'Applicaton-defined or object-defined error': Dim firstRow As Integer Dim lastRow As Integer Dim I As Integer Dim VOptions As String VOptions = "1. Yes, 2. No" firstRow = GetResultRowStart.row + 1 lastRow = GetResultRowStart.End(xlDown).row For I = firstRow To lastRow Range("AO" & firstRow & ":AO" & lastRow).Select With

Two y axis with the same x-axis [duplicate]

╄→尐↘猪︶ㄣ 提交于 2019-12-03 13:04:06
问题 This question already has answers here : Closed 8 years ago . Possible Duplicate: Plotting 4 curves in a single plot, with 3 y-axes assuming I have the following dataset as an example here in Matlab: x = linspace(0, 9, 10); y1=arrayfun(@(x) x^2,x); y2=arrayfun(@(x) 2*x^2,x); y3=arrayfun(@(x) x^4,x); thus you can see they have the SAME x-axis. Now I want the following plot: one x-axis with the limits 0 to 9 (those limits should also be ticks) with N ticks (I want to be able to define N myself)

Add a new column to the file

亡梦爱人 提交于 2019-12-03 11:48:49
How can I add a new column to a file with awk codes? original.file F1 F2 F3 ..F10 add F11 to original.file F1 F2 F3 ..F10 F11 try: awk 'BEGIN{getline to_add < "f3"}{print $0,to_add}' f Reads the column to add from file "f3" and saves it in the variable to_add. After that it adds the column to each line of file f. HTH Chris awk '{print $0, "F11"}' original.file If you want to add a column to a file, you can do the following. remark: We assume that the field separator FS equals to the string "fs" . You can replace this by anything, or if you just use <blanks> as field separator, you can remove