Posts

c# - Mongo update response says no document updated, but the document is there -

i'm using mongodb 2.6.10 , using c# driver 1.9.2. server has replicaset of 2 servers. my documents of format. itemid unique. { "itemid": 2314, "favorites": [1, 24, 26, 34] } then have code remove favorite of form var query = query.eq("itemid", itemid); var result = collection.update(query, update.pull("favorites", favoriteidtoremove)); after each time, check result.documentsaffected equal 1. once in while, value comes 0. when go mongodb myself, can find document matching itemid, , can see favoriteid tried remove in array still there. result.ok true, , there's no error information. what cause fail? i'm no expert guess write concerns since there different levels of guarantee writing , updating documents in mongodb. see write concerns so instead of using method : mongocollection.update method (imongoquery, imongoupdate) it might better use method instead: mongocollection.update method (imong...

angularjs - Gather both first and lastname into a full name -

i started working first app angular such must have showcased full name when 1 has written both names first , last name. what mean few first name , last name , indicate full name overall. right problem such not add full name total @ all. userscreate.js - ( i'm sure fault lies around here ) var usercreatennow = angular.module('usercreatennow', []); usercreatennow.controller('createusernow', function ($scope) { //checking on first name , surname written. if ($scope.name != null && $scope.lastname != null) { //prints $fullname = "welcome " + $scope.name + " " + $scope.lastname; } }); create.cshtml <div ng-app="usercreatennow" ng-controller="createusernow"> <div class="form-group"> <div class="col-xs-12"> @html.labelfor(u => u.fornavn) @html.textboxfor(u => u.fornavn, new ...

android - Cardview in the recyclerview overlaps the collapsing toolbar -

i trying create recyclerview below collapsing toolbar cardviews inside recyclerview.how overcome overlapping of cardview inflated inside recyclerview. overlaps collapsing toolbar image . xml file <?xml version="1.0" encoding="utf-8"?> <android.support.design.widget.coordinatorlayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" app:layout_behavior="@string/appbar_scrolling_view_behavior" android:layout_width="match_parent" android:layout_height="match_parent" android:fitssystemwindows="true"> <android.support.design.widget.appbarlayout android:id="@+id/app_bar_layout" android:layout_width="match_parent" android:layout_height="wrap_content" android:theme="@style/themeoverlay.appcompat.dark.actionbar" android:fit...

How does connecting Namespaces work in C#? -

i new c# , trying print out number different namespace in main. provide code below. using system; using system.collections.generic; using system.linq; using system.text; using system.threading.tasks; namespace consoleapplication1 { class program { static void main(string[] args) { console.writeline("hello world" + x); console.readline(); } } } namespace applicaton { class program2 { public int test() { int x = 5; return x; } } } i want have x program2 class appear in main in program class. just call class. program2 p = new program2(); console.writeline(p.test().tostring()); and ever program2 have can call on it. or assign it. int num = p.test(); console.writeline(num); then print it.

bash - getting the pid of a subshell command -

i trying write init service script java program. have following in init script. $user = awesomeuser $program_cmd = "java -server com.test.testclass" $program_log = "/var/log/awesome_log" sudo -u $user nohup $program_cmd >> $program_log 2>&1 </dev/null & server_pid=$! echo $server_pid > $pidfile what happening getting pid of parent process want the pid of java process running within subshell. is there anyway can structure command subshell command pid back? thanks! instead of sudo -u $user nohup $program_cmd >> $program_log 2>&1 </dev/null & try this: sudo -u $user bash -c "nohup $program_cmd >> $program_log 2>&1 & </dev/null; echo "'$!' sudo spawns child process , calls exec in it. fork -ing can avoided proper config of sudo (see sudo(1) ). seems easier me set user , run shell. this approach seems better me obtaining pid of process ps | grep | blabla ...

replace - How to rename all files in winrar -

i have text files in winrar. how can remove first character name of each file, replace letters in name, , add character onto beginning of file name? for example, name-words : after removal, ame-words after replace ( "-w","l" ), ame-lords and after adding letter, same-lords

mandrill - Embedded images show as attachment -

i'm sending mail via mandrill smtp server. embedded images shows attachments. when using smtp host displayed inline expected. this how raw email sent via mandrill looks like, --_av-wpsilwanbd9ltkj6pvyncq content-type: application/octet-stream content-transfer-encoding: base64 content-disposition: attachment; filename="header.jpg" and same email sent via other smtp server, ------=_part_2_149158871.1452888744955 content-type: application/octet-stream; name=header.jpg content-transfer-encoding: base64 content-disposition: inline; filename=header.jpg content-id: <1.1452888744955@10.0.1.2> any ideas i'm doing wrong? or not possible mandrill? mails sent java application using javax.