Posts

Showing posts from September, 2014

python - Errors with turning string into integer? -

okay i'm reading in these values, used type(value) figure out being read in strings. tried convert them integers. here have: with open('sextractordata1488.csv') f: #getting rid of title, aka unusable lines: _ in xrange(15): next(f) line in f: cols = line.split() object_num = int(float(cols[0])) and received error: valueerror: not convert string float: # i tried int(cols[0]) and received error: valueerror: invalid literal int() base 10: '#' why giving me #? read means of values text, they're not. they're numbers. gives me error every line, , every line number. someone wanted me copy , paste sample of data, here without first 16 lines removed , ... indicate there many more columns of data there wasn't room: 1 -7.9031 0.0364 13.69501 489.4349... 2 -6.5735 0.1097 13.69501 193.0220... 3 -6.4870 0.1184 13.69501 192.5962... 4 -7.6035 0.0462 13.69

angularjs - How to Store Values from Controller into Service? -

i have ng-repeat list in partial. list(messages), want store clicked item service, dont want store one, want store many clicked. on otherhand want able pull data , place controller have service on. if see way improve existing code please let me know. still learning angularjs fun! the feature similar to: http://qnimate.com/facebook-style-chat-box-popup-using-javascript-and-css/ except not know how convert method angularjs. user clicks on message message appears on taskbar user can add multiple messages taskbar i have kind of started service: app.factory('chatbox',['$http',function($http){ var chats; << variable hold chats array return { killchat: function (userid) { }, registerchat: function (userid) { } }; }]); and controller: app.controller("taskbarcontroller", ['$scope', 'authdata', '$location', '$aside', 'poller', function ($scope, authdata, $loc

c# - Is it possible to get caret position in Word to update faster? -

i'm using low level keyboard hook , guithreadinfo caret position in windows applications on every keyup. works applications - except word. reason word updates position of caret after arbitrary delay (meaning position off 1 or more characters). i can correct position if wait couple hundred milliseconds ( thread.sleep(400) example) before fetching position - usable solution application i'm working on. any way can correct caret position faster? either forcing word render caret, using word specific function, subscribing word event or entirely different? keyboard hook class: using system; using system.collections.generic; using system.text; using system.runtime.interopservices; using system.windows.forms; using system.componentmodel; namespace cs_test { /// <summary> /// class manages global low level keyboard hook /// </summary> public class globalkeyboardhook { #region constant, structure , delegate definitions ///

R Programming Issue: Passing characters to matrix converts them to a number -

i'm trying write pretty simple loop i'm passing name top row of 1 data frame space in matrix. i'm having issue when try this, name trying pass matrix instead showing number in matrix (which turns out number in cell down 4 rows name in original data frame). here's of code results get: mock_board 8x14 matrix trying pass names to adpsort large data frame kinds of names , statistics sorted category name want pull @ top row of data frame. all i'm trying is: mock_board[1,1] <- adpsort[1,1] (there's more in actual program, when breaking down far still gives me error) here getting (commands in regular, computer response in italics): adpsort[1,1] - player name mock_board[1,1] - na but after mock_board[1,1] <- adpsort[1,1] mock_board[1,1] - 4 so reason instead of passing player name mock_board[1,1], r passing 4 instead. tried changing matrix data frame did make mock_board[1,1] = "4" after attempting pass "player name&q

Passing a boolean type into a bit parameter type in C# and MS SQL Server -

i have c# method accepts clientid (int) , haspaid (boolean) represents if client has paid or not. ms sql server stored procedure expects bit value (1 or 0) @haspaid parameter yet method expects boolean type (true/false) haspaid. ado.net code take care of converting boolean bit type sql server or need convert value of haspaid 1 or 0 ? public void updateclient(int clientid, bool haspaid) { using (sqlconnection conn = new sqlconnection(this.myconnectionstring)) { using (sqlcommand sqlcommand = new sqlcommand("uspupdatepaymentstatus", conn)) { sqlcommand.commandtype = commandtype.storedprocedure; sqlcommand.parameters.addwithvalue("@clientid", clientid); sqlcommand.parameters.addwithvalue("@haspaid", haspaid); sqlcommand.connection.open(); var rowsaffected = sqlcommand.executenonquery(); } } } when working sql parameters find addwithvalue 's a

linux - Shell comm parameters issue -

i have issue running shell script parameters. command running directly on linux works: comm -13 <(sort /tmp/f1.txt) <(sort /tmp/f2.txt) > /tmp/f3.txt if trying run shell script command sending parameters , getting error below: test.sh: line 6: syntax error near unexpected token `(' 'est.sh: line 6: `comm -13 <(sort $1) <(sort $2) > $3 here shell code: #!/bin/bash comm -13 <(sort $1) <(sort $2) > $3 i run following command: sh test.sh /tmp/f1.txt /tmp/f2.txt /tmp/f3.txt i have ran out of ideas might wrong. please assist. thank you, -andrey solutions: since have specified bash in script's shebang , why call sh ? run ./test.sh /tmp/f1.txt /tmp/f2.txt /tmp/f3.txt use bash explicitly: bash test.sh /tmp/f1.txt /tmp/f2.txt /tmp/f3.txt

scala - Pattern Matching on Disjunction -

given following: scala> val err: \/[string, boolean \/ int] = -\/("bad") err: scalaz.\/[string,scalaz.\/[boolean,int]] = -\/(bad) i wrote function takes \/[string, boolean \/ int] , returns boolean \/ int : scala> def f(x: \/[string, boolean \/ int]): \/[boolean, int] = x match { | case -\/(_) => -\/(false) | case \/-(y) => y | } f: (x: scalaz.\/[string,scalaz.\/[boolean,int]])scalaz.\/[boolean,int] it appears work expected: scala> f(err) res6: scalaz.\/[boolean,int] = -\/(false) scala> f(\/-(\/-(5)) | ) res7: scalaz.\/[boolean,int] = \/-(5) is there more concise, idiomatic scalaz way this? def f(x: \/[string, boolean \/ int]) = x.getorelse(-\/(false))

sql server 2008 r2 - Remove duplicate with separate column check TSQL -

i have 2 tables having same columns , permission records in it. 1 columns named isallow available in both tables. getting records of both tables in combine using union want skip similar records if isallow = 0 in 1 column - don't want records. union returns records , getting confused. below columns isallow, userid, functionactionid i tried union gives both records. want exclude isallow = 0 in either table. sample data table 1 isallow userid functionactionid 1 2 5 1 2 8 sample data table 2 isallow userid functionactionid 0 2 5 (should excluded) 1 2 15 you can try this: ;with cte as(select *, row_number() over(partition userid, functionactionid order isallow desc) rn (select * table1 union select * table2) t) select * cte rn = 1 , isallow = 1 version2: select distinct coalesce(t1.userid, t2

unity3d - How to let a camera follow a rolling ball with photon in unity -

i created multiplayer game photon in unity. player rolling ball, want set camera each player can't child of ball otherwise rotates to. without photon worked script on camera multiplayer camera doesn't follow rolling ball. how can fix it? you need create script , add camera. public gameobject player = gameobject.find("player"); this.transform.position = new vector3(player.transform.position.x, player.transform.position.y, transform.position.z); so player in center of camera.

javascript - CSS Transition making tile position wrong (Angular Material) -

using angularjs i'm displaying tiles filtering using search input. <md-grid-list md-cols-sm="2" md-cols-md="4" md-cols-lg="6" md-cols-gt-lg="8" md-row-height-gt-md="1.2:1" md-row-height="1:1" md-gutter="10px" md-gutter-gt-sm="10px"> <md-grid-tile class="gray" ng-repeat="carto in cartolist | filter : { fulldisplayname: searchinput}"> <md-button ng-click="changesvg(carto.filename)" aria-label="carto.displayname"> <img src="style/images/thumbnails/{{carto.filename}}.png" width="100%" height="100%"></img> </md-button> <md-grid-tile-footer><h3 align="center">{{carto.displayname}}</h3> </md-grid-tile-footer> </md-grid-tile> <

asp.net - C# ASP Response.Redirect URL Parameter being moved in output URL -

i'm using response.redirect to refresh page parameter appended end of url reason parameter being moved different part of url. here's example, url http://domain.com/en/members/careers/vacancies/?output=html i want url refresh following: http://domain.com/en/members/careers/vacancies/?output=html&param=1 i want include parameter used following function: string url = currentpage.linkurl; response.redirect(url+"?output=html&param=1"); yet when page refreshes has redirected following url: http://domain.com/en/?output=html/members/careers/vacancies/ i have no idea why the output parameter being put there after /en/ or second parameter has gone. i've been @ few hours , i'm going crazy looking @ it, suggestions on appreciated. thanks! maybe try instead of currentpage.linkurl. in response.redirect take out "?output=html" in string string url = system.web.httpcontext.current.request.url.absoluteuri; response.redirect(url +

How to fix Ruby on Rails obj != nil error -

Image
i'm trying ensure object not nil in ruby on rails , i'm getting error: called id nil, mistakenly 4 -- if wanted id of nil, use object_id this object looks in debugger (it not nil): how correctly check nil in case? cases? i've found similar posts not specific case: check nil gives error , , called id nil, mistakenly 4 -- if wanted id of nil, use object_id . the != comparator using id check equality. checking if ob1.id != ob2.id , or in case map_set.id != nil.id to check if object nil, can check if object has value. if object or if !object.nil?

ios - EXC_BAD_ACCESS when accessing computed property of NSManagedObject -

i have defined class has calculated property. when try access property in code, exc_bad_access . set breakpoint in getter of property , noticed never called. don't know causing this. can access other properties of object. here code import uikit import coredata @objc(person) class person: nsmanagedobject { struct keys { static let name = "name" static let profilepath = "profile_path" static let movies = "movies" static let id = "id" } @nsmanaged var name: string @nsmanaged var id: nsnumber @nsmanaged var imagepath: string? @nsmanaged var movies: [movie] override init(entity: nsentitydescription, insertintomanagedobjectcontext context: nsmanagedobjectcontext?) { super.init(entity: entity, insertintomanagedobjectcontext: context) } init(dictionary: [string : anyobject], context: nsmanagedobjectcontext) { let entity = nsentitydescription.entityforname("p

javascript - Add additional information to route - workaround for TypeScript? -

normally put settings route. example: .when('products', { templateurl: 'app/products.html', settings: { showbuy: true, showexport: true, description: "product list" },[...] since started typescript , angularjs interface of irouteprovider brings limitations regarding irouteprovder btw. iroute interface. iroute interface doesn't provide properties store custom settings object. at moment can set predefined properties of iroute interface like: app.config([ <any>'$routeprovider', function routes($routeprovider: ng.route.irouteprovider) { $routeprovider .when('/product', { templateurl: 'app/products.html', controller:'somecontroller' [...] }) the

Remove HTML Tags in Haskell -

i have string such &lt;b&gt;vitamin a&lt;/b&gt;&lt;br&gt;chloe braided halter swim top&#44; using text.html.tagsoup attempting remove html , have "vitamin chloe braided halter swim top" using import qualified text.html.tagsoup ts ts.parsetags "&lt;b&gt;vitamin a&lt;/b&gt;&lt;br&gt;chloe braided halter swim top&#44;" [tagtext "<b>vitamin a</b><br>chloe braided halter swim top,"] how can strip html tags ? does have text.html.tagsoup ? seems hakyll.web.html better fit: https://hackage.haskell.org/package/hakyll-4.1.2.1/docs/hakyll-web-html.html there have function seems want: striptags :: string -> stringsource strip html tags string

sql - Add X number of Working days to a date -

i have table postingperiod uses company calendar track working days. simplified, looks this: date year quarter month day isworkingday 25.06.2015 2015 2 6 25 1 26.06.2015 2015 2 6 26 1 27.06.2015 2015 2 6 27 0 i have table contains purchase lines orderdate, confirmed delivery date vendor , maximum allowed timeframe in working days between orderdate , deliverydate: purchid orderdate confdelivery deliverydays 1234 14.04.2015 20.05.2015 30 1235 14.04.2015 24.05.2015 20 i want create new column returns maximum allowed date (regardless of workday or not) each order. usual approach (workingdays / 5 weeks, multiplied 7 days) doesn't work, holidays etc need taken consideration. dwh feed olap database, performance not issue. you assigning each working day arbitrary index using row_number , e.g. select date, workingdayindex = row_number() over(order date) dbo.calendar which give like: date workin

javascript - Why does TypeScript wrap class in anonymous function? -

this question has answer here: how class implementation? 1 answer let's have, example, dog class: class dog { static food; private static static_var = 123; constructor(private name) {} speak() { console.log(this.name + ', eat ' + dog.food + ', ' + dog.static_var); } } compiled js: var dog = (function () { function dog(name) { this.name = name; } dog.prototype.speak = function () { console.log(this.name + ', eat ' + dog.food + ', ' + dog.static_var); }; dog.static_var = 123; return dog; })(); this works equally , less complicated: function dog(name) { this.name = name; } dog.prototype.speak = function () { console.log(this.name + ', eat ' + dog.food + ', ' + dog.static_var); }; dog.static_var = 123; is there (other "ae

c++ - How to ensure method in ActiveX class gets into DLL (Checking by ITypeLib) -

in visual studio 2013, how ensure methods added in activex accessible in javascript , can viewed in olleview's itypelib i have method not show in itypelib in olleview there methods showing: public: stdmethod(sendtorest)(bstr resource, bstr operation, bstr data); // not showing stdmethod(writebuf)(/*[in]*/ bstr a); // showing i've been doing regsvr32 registration of dll still method not showing up. what can use trace why method not showing up? is because method not in dll or registry not updated? should manually add project's idl file? (because cannot see there) you need add methods in question interface in idl. interfaces should either in library block there, or referenced library block. necessary these idl definitions compiled type library. make sure type library registered. c++ code reference derivative of idl , classes override abstract virtual methods defined in idl interfaces. how c++ code connected type library definitions.

c++ - Virtual inheritance using empty classes -

can tell exact reason output of following code in c++ ?the output received code included in header comments. have virtual table , v pointer. /* sizeof(empty) 1 sizeof(derived1) 1 sizeof(derived2) 8 sizeof(derived3) 1 sizeof(derived4) 16 sizeof(dummy) 1 */ #include <iostream> using namespace std; class empty {}; class derived1 : public empty {}; class derived2 : virtual public empty {}; class derived3 : public empty { char c; }; class derived4 : virtual public empty { char c; }; class dummy { char c; }; int main() { cout << "sizeof(empty) " << sizeof(empty) << endl; cout << "sizeof(derived1) " << sizeof(derived1) << endl; cout << "sizeof(derived2) " << sizeof(derived2) << endl; cout << "sizeof(derived3) " << sizeof(derived3) << endl; cout <

c# - Json RestSharp deserilizing Response Data null -

i use restsharp access rest api. data poco. restsharp client looks this: var client = new restclient(@"http:\\localhost:8080"); var request = new restrequest("todos/{id}", method.get); request.addurlsegment("id", "4"); //request.onbeforedeserialization = resp => { resp.contenttype = "application/json"; }; //with enabling next line new empty object of todo //as data //client.addhandler("*", new jsondeserializer()); irestresponse<todo> response2 = client.execute<todo>(request); todo td=new jsondeserializer().deserialize<todo>(response2); var name = response2.data.name; my class jsonobject looks this: public class todo { public int id; public string created_at; public string updated_at; public string name; } and json response: { "id":4, "created_at":"2015-06-18 09:43:15"

c# - MSBuild called by Process.Start() behaving differently between VS2010 and VS2013? -

i have both vs2010 , vs2013 installed , trying run program compiles .net 4.0 solution calling msbuild ( c:\windows\microsoft.net\framework64\v4.0.30319 ). for record, code looks like: var processstartinfo = new processstartinfo { filename = pathtomsbuild, arguments = "c:\path\to\mysolution.sln /nr:false", createnowindow = true, useshellexecute = false }; var process = process.start(processstartinfo); process.waitforexit(); i've checked .sln, contains .vcxproj , .csproj file, , these contain references toolsversion=4.0 . when execute program in vs2010 (or open cmd.exe , run msbuild command myself) works fine , compiles solution. however, when run same program using vs2013 following error msbuild: c:\program files (x86)\msbuild\microsoft\visualstudio\v12.0\codeanalysis\micros oft.codeanalysis.targets(214,5): error msb4175: task factory "codetask

sql server - PHP: Custom Session Handler Unserialize Not Working on Windows -

the development environment of application zend framework 1.11, mssql server 2012, sqlsrv extension database connectivity pdo, windows 7, iis 7. session being stored in database using custom session handler class. the issue when print $_session after session_start() written in bootstrap.php file, not show complete unserialized array of session data. seems session data being returned "read" method of session class handler, not being unserialized reason. here source code:- bootstrap.php protected function _initsession() { $handler = new mcd_core_sessionhandler_database(); session_set_save_handler( array($handler, 'open'), array($handler, 'close'), array($handler, 'read'), array($handler, 'write'), array($handler, 'destroy'), array($handler, 'gc') ); session_start(); echo "<pre>"; print_r($_session); } sessionhandler class

ruby on rails - ActiveRecord: scope with a lambda applied on top of has_many Error -

i have following code: class user < activerecord::base has_many :transactions end class transaction < activerecord::base belongs_to :user belongs_to :owner, class_name: 'user' scope :user, ->(user) { where('user_id = ?', user.id) } scope :owner, ->(user) { where('owner_id = ?', user.id) } scope :active, where(is_active: true) end if type following in console have: transaction.user(user.first).class # activerecord::transaction ok user.first.transactions.class # array ko user.first.transactions.active.class # activerecord::transaction ok user.first.transactions.where(used_id: user.first.id).class # activerecord::transaction ok user.first.transactions.owner(user.first) # error: nomethoderror: undefined method `+' #<user:0x00000007d7d528> /home/augustin/.rvm/gems/ruby-2.1.4/gems/activemodel-3.2.21/lib/active_model/attribute_methods.rb:407:in `method_missing' /home/augustin/.rvm/gems/ruby-2.1.4/gems/activere

PowerShell cmdlet is changing the type of the returned object -

this behavior mystifying! consider following powershell script: [reflection.assembly]::loadfrom("newtonsoft.json.dll") | out-null function convertfrom-jsonnet { [cmdletbinding()] param( [parameter(mandatory=$true)] [string] $json ) $o = [newtonsoft.json.linq.jobject]::parse($json) write-host $o.gettype().name return $o } clear-host $json = '{"test":"prop"}' $o1 = convertfrom-jsonnet '{"test":"prop"}' $o2 = [newtonsoft.json.linq.jobject]::parse($json) write-host $o1.gettype().name write-host $o2.gettype().name you'd expect output be: jobject jobject jobject but it's not! it's: jobject jproperty jobject how possible? how type of object within function jobject , after it's passed out of function, it's jproperty ? sigh yay powershell's inflexibility! apparently, powershell "unroll" collections destined pipeline. in

yii - Yii2 DetailView widget - access data with role -

this query using find user: $model = user::find()->with('role')->where(['id' => $id])->one(); and detailview widget : <?= detailview::widget([ 'model' => $model, 'attributes' => [ 'first_name', 'email:email', 'password', ], ]) ?> i need access role name. how can this? you write getrole in user model: public function getrole() { $role = yii::app()->db->createcommand() ->select('itemname') ->from('authassignment') ->where('userid=:id', array(':id'=>$this->id)) ->queryscalar(); return $role; } and use direct in widget $model->getrole() hope solve problem.

ios8 - Will I get shell script invocation error If I don't have an apple developer account -

i working on open source code(mobfoxsdk) github. getting following error. can me? /users/vertoz11/library/developer/xcode/deriveddata/mobfoxsdksource-fjjrujatystitafrsoonvksnbgni/build/intermediates/mobfoxsdksource.build/debug-iphonesimulator/universal framework.build/script-a7992e581489342100e86ac8.sh: line 97: /applications/xcode.app/contents/developer/platforms/iphonesimulator.platform/developer/usr/bin/libtool: no such file or directory

ios - Delete Row from Table view -

i developing ios app. delete row in tableview , data load in core data in table view. when click delete button app crash. reason reason: invalid update: invalid number of rows in section 0. number of rows contained in existing section after update (18) must equal number of rows contained in section before update (18), plus or minus number of rows inserted or deleted section (0 inserted, 1 deleted) , plus or minus number of rows moved or out of section (0 moved in, 0 moved out)... _fetchedobj nsarray fetch data core data //code - (nsinteger)tableview:(uitableview *)tableview numberofrowsinsection:(nsinteger)section { return _fetchedobj.count; } - (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath { static nsstring *myidentifier = @"myreuseidentifier"; uitableviewcell *cell = [mytable dequeuereusablecellwithidentifier:myidentifier]; if (cell == nil) { cell = [[uitableviewcell alloc] initwit

jquery - How to implement Collapse/Expand in LightSwitch 2013? -

i'm building project in lightswitch 2013 on visual studio 2013. i have 2 dialog screen: 1. view details (dialog screen mode) 2. edit details (dialog screen mode) view screen navigates edit screen , edit screen returns view screen (view --> edit --> view). i'm using following code change dialog screen width , height: $('div[class~="msls-dialog-frame"]').css('maxwidth', '50%'); $('div[class~="msls-dialog-inner-frame"]').css('maxheight', '100%'); this code in main group post render. my problem is: when navigate edit screen view screen, view screen show supposed to, shows 1 button without rest of elements supposed displayed. this bug occurs because i'm using code above. anybody have idea? thanks. fortunately 1 easy fix. you need include screen element in jquery selector. e.g: $('div[class~="msls-dialog-frame"]', element).css('maxwidth', '5

java - Neither Binding result nor plain target for bean name user available as request attribute -

i new spring , hibernate. when try open jsp page getting following error: severe: neither bindingresult nor plain target object bean name 'user' available request attribute java.lang.illegalstateexception: neither bindingresult nor plain target object bean name 'user' available request attribute @ org.springframework.web.servlet.support.bindstatus.<init>(bindstatus.java:144) @ org.springframework.web.servlet.tags.form.abstractdataboundformelementtag.getbindstatus(abstractdataboundformelementtag.java:168) @ org.springframework.web.servlet.tags.form.abstractdataboundformelementtag.getpropertypath(abstractdataboundformelementtag.java:188) @ org.springframework.web.servlet.tags.form.abstractdataboundformelementtag.getname(abstractdataboundformelementtag.java:154) @ org.springframework.web.servlet.tags.form.abstractdataboundformelementtag.autogenerateid(abstractdataboundformelementtag.java:141) @ org.springframework.web.servlet.tags.form.a

How to build pygobject for custom installation of Python? -

for own reasons have installed python3.3 source on debian wheezy. want add modules it, including pygobject (gi.repository, etc). of software want working , installed on same machine python3.2 (the default python3 on wheezy). i can point python3.3 generic /usr/lib/python3/dist-packages pick already-installed python3.2 code manipulating pythonpath, (of course?) fails import correctly. so, figured needed build pygobject source python3.3. having obtained wheezy source package pygobject tried following, pointing configuration python3.3 installation , executable in downloaded pygobject directory: $ python=/usr/local/bin/python3.3 $ export python $ ./configure --prefix=/usr/local the output of follows: checking whether make supports nested variables... yes checking bsd-compatible install... /usr/bin/install -c checking whether build environment sane... yes checking thread-safe mkdir -p... /bin/mkdir -p checking gawk... no checking mawk... mawk checking whether make sets $(ma

soap Signature verification error - PHP -

im facing problem consuming webservices wssecurity. im using robrichard's wse-php working fine encryption ( if miss mandatory field , server throw error msg mandatory field missing means can decrypt msg im sending ) . but have problem signature. server returning signature verification failed error , when view log showing [2015-06-24 11:16:33,061] warn uuid:3f6c703f-05e6-85e8-6b62-a4fa343cd54f [org.apache.ws.security.validate.signaturetrustvalidator] [[active] executethread: '3' queue: 'weblogic.kernel.default (self-tuning)']: no subject dn certificate constraints defined. security issue please post full code here. did have xml sample request ? test soapui first

ios - Access UITextField's text content nested in a UITableView -

i'm trying access content of uitextfields that's nested in uitableview when "save" button pressed. however, debugging (as shown further below) shows i can access texfield except text ... whatever type inside before pressing button has no impact... i feel should use uitextfield delegate don't understand neither why nor how ... this code i'm using: @ibaction func savenewguestbutton(sender: uibarbuttonitem) { let entity : nsentitydescription = nsentitydescription.entityforname("guest", inmanagedobjectcontext: self.managedobjectcontext)! // initialize record let record : guest = guest(entity:entity, insertintomanagedobjectcontext:managedobjectcontext) // populate record in 0..<3 { let indexpath : nsindexpath = nsindexpath(forrow: i, insection: 0) let cell = tableview(self.tableview, cellforrowatindexpath: indexpath) as! newguestprotocell if i==0 { record.guestfirst = c

c# - New rule to existing regex allowing single quotes -

i asked another question here , still having problems it. i have expression follows rules: the character ' must first , last character there can zero-or-more spaces inside '' there can zero-or-more % inside '' there can zero-or-more words (letters , numbers) inside '' expression: (?i)^(?<q>['])[%\p{zs}\p{l}\p{n}|()]*\k<q>$ now, there must rule: there can zero-or-more words between '' pairs. example: 'content1' text should pass 'content2' update: the trick here following should pass: ' content ' text ' > pass ' ' content ' > pass what like? if know books regular expressions, useful me. you can add alternative list using | operator: ^(?<q>')(?:'[^']*'|[%\p{zs}\p{l}\p{n}|()])*\k<q>$ i removed [] around ' , placed * quantifier alternative list. also, (?i) redundant since there no literal letters in regex. he

C++ CListCtrl How get cell border in View List -

i have clistbox view of type list. has 1 column view of type list splits. i need draw border around each item . the column contains blank icon size 1 , text. how can draw box ? thanks. try adding style lvs_ex_gridlines .

c# - How to check if predicate expression was changed? -

var predicate = predicatebuilder.true<o_order>(); this predicate expression, on conditions append expressions it. likewise if (!string.isnullorempty(param.ssearch)) predicate = predicate.and(s => s.orderid.tostring().contains(param.ssearch)); now question if expression doesn't pass condition there expression? , how know if returns no expression it. simply want do- if(predicate==null) or if(predicate contains no expression) this easy, didn't consider that. since predicatebuilder builds new predicate instances each time (notice must write predicate = predicate.and... replacing pred each time), can remember original value , compare final value against that. var predicate = predicatebuilder.true<o_order>(); var oldpredicate = predicate; if (!string.isnullorempty(param.ssearch)) predicate = predicate.and(s => ........... ); // replace! if (!string.isnullorempty(....)) predicate = predicate.and(s => ....

ZooKeeper reliability - three versus five nodes -

from zookeeper faq : reliability: single zookeeper server (standalone) coordinator no reliability (a single serving node failure brings down zk service). 3 server ensemble (you need jump 3 , not 2 because zk works based on simple majority voting) allows single server fail , service still available. if want reliability go @ least 3. typically recommend having 5 servers in "online" production serving environments. allows take 1 server out of service (say planned maintenance) , still able sustain unexpected outage of 1 of remaining servers w/o interruption of service. with 3-server ensemble, if 1 server taken out of rotation , 1 server has unexpected outage, there still 1 remaining server should ensure no interruption of service. why need 5 servers? or more interruption of service being considered? update: thanks @sbridges pointing out has maintaining quorum. , way zk defines quorum ceil(n/2) n original number in ensemble (and not available set). now, goog

Which features of Perl make it a functional programming language? -

inspired little by: https://stackoverflow.com/questions/30977789/why-is-c-not-a-functional-programming-language i found: higher order perl it made me wonder assertion perl functional programming language. now, appreciate functional programming technique (much object oriented). however i've found list of what makes functional programming language : first class functions higher order functions lexical closures pattern matching single assignment lazy evaluation garbage collection type inference tail call optimization list comprehensions monadic effects now of these i'm quite familiar with: garbage collection, example, perl reference counting , releasing memory when no longer required. lexical closures part of faq: what closure? - there's better article here: http://www.perl.com/pub/2002/05/29/closure.html but start bit fuzzy on of these - list comprehensions, example - think that's referring map / grep ( list::util , reduce ?) i able