Posts

Showing posts from April, 2013

How to use javascript origin addEventListener in angularjs -

Image
i write origin javascript before load angularjs this: <ng-app> <ng-controller> <element /> </ng-controller> <script> element.addeventlistener('click', some_function); </script> <script src='angularjs.js'></script> </ng-app> this code add feature before angularjs init when mobile network 2g/3g. hope element.click event can run whatever angularjs init. i found angularjs replace element event html.ng-scope after loaded. how use javascript origin addeventlistener in angularjs or disable strange behaviour? thanks.

matlab - Custom Curve-Fitting equation doesn' t works -

i trying fit custom equation cumsu=a+b*(1586-x).^m estimate parameters a,b,m. data: cumsu=[...];%the reason don't give vector cumsu large number of values included. x=[1:1586]; i thankful if can helps me. thank in advance! you can create custom fitting models via fit function . fitobject = fit(x,y,fittype,fitoptions) in case should replace fittype fitting equation: customfit=fit(x,cumsu,'a+b*(1568-x)^m') with random numbers output was: general model: f(x) = a+b*(1568-x)^m coefficients (with 95% confidence bounds): = -2.011 (-2.959e+06, 2.959e+06) b = 1.479 (-2.424e+06, 2.424e+06) m = 0.1049 (-9.702e+04, 9.702e+04)

debugging - How to attach erlang dbg to a running process? -

how attach debugger running erlang process (rabbitmq)? have source code of same rabbit version that's running. set breakpoint on source line, , attach debugger running rabbit instance. i'm not sure if erlang requires debug symbols async_dirty. in perfect world, able both locally , remotely. i'm such erlang beginner, wouldn't i'm new erlang. i'm trying learn debug rabbitmq plugin. from you're saying, don't need run debugger. erlang vm's concurrency model doesn't fit concept of stop-everything-and-inspect-style debugging. on other hand, vm has great, built-in tracing capabilities. dbg module exposed, module's interface quite difficult use, if you're beginner. i'd recommend using recon_trace view what's going on process: http://ferd.github.io/recon/recon_trace.html . if don't feel installing recon, start program erlang shell, , in shell, type: %enable tracing capabilities 1> dbg:tracer(). % trace pa...

Ampl finds optimal solution in 0 iteration, but the variables are wrongly set to 0 -

i'm trying solve non-linear problem: var c; var n; minimize error: ( (6770924 - (n * c * exp(-c * 1)))^2 + (3617627 - (n * c * exp(-c * 2)))^2 + (2344172 - (n * c * exp(-c * 3)))^2 ) / 3; when execute code, have success message 0 iteration: minos 5.51: optimal solution found. 0 iterations, objective 214759264300000 non lin evals: obj = 3 grad = 2. but variables 'n' , 'c' set '0'. , using answer bad value function, since nothing subtracted constant values. if take out 'n' variable function have normal answer, 'c' minimizing function. wrong model described? thanks in advance. as mentioned in this post , minos sensitive starting point. example, using 1 starting value n gives better objective value: ampl: let n := 1; ampl: solve; minos 5.51: optimal solution found. 10 iterations, objective 24439722900 nonlin evals: obj = 34, grad = 33.

variables - OLEDB Source dosn`t receive Sql Statment from Skrip Task -

i have problem script task. have package foreach loop container contains skriptask creating sql statment variable. variable defined , contains default value when after execution skripttask i`m trying create dataflow (oledb source) has sqlstatment variable, oledb getting default value variable , not new 1 script. is options miss? thanks lot! update: case "feed" msgbox("feed") if cstr(dts.variables("executionflag").value) = "1" dts.variables("feed").value = "select [symbolname] ,[bid],[ask],[ticktime],[server],[serverid],[lastupdate] feed cast( " & columndatefilter & " date) between '" & fromdate & "' , '" & todate & "'" msgbox(dts.variables("executionflag").value.tostring) elseif cstr(dts.variables("executionflag").value) = "0"...

Complete C++11 support on Android -

i'm trying cross-compile cross-platform library have developed in order use on android. so, use arm-linux-androideabi-g++ (4.9) compiler provided ndk, , link gnu-libstdc++ present in ndk. unfortunately, compilation won't succeed due use of c++11 features. such features specific methods present in "string.h" std::to_string or std::stof, replaced other ones if have to. use more complex ones, things "future.h" such std::future , std::async. i've located reason of compilation error "string.h", in file "ndk/sources/cxx-stl/gnu-libstdc++/4.9/bits/basic_string.h", following statement returning false (_glibcxx_use_c99 isn't defined): //basic_string.h #if ((__cplusplus >= 201103l) && defined(_glibcxx_use_c99) \ && !defined(_glibcxx_have_broken_vswprintf)) //methods want use #endif from understood, these restrictions induced android bionic libc. what options have solve ? i tried use crystax nd...

java - STS-3.6.4-RELEASE tcserver not configured after tcruntime-instance.sh -

i installed sts-3.5.4-release , used tcruntime-instance.sh script define new server. able create new server in sts using "new" menu item , selecting "existing instance" option pointing server created using tcruntime-instance.sh script. however, when attempt run new server, fails error message: apr 01, 2015 1:08:21 org.apache.catalina.startup.catalina load warning: catalina.start using conf/server.xml: error @ (23, 68) : org.apache.catalina.core.jasperlistener apr 01, 2015 1:08:21 org.apache.catalina.startup.catalina load warning: catalina.start using conf/server.xml: error @ (23, 68) : org.apache.catalina.core.jasperlistener apr 01, 2015 1:08:21 org.apache.catalina.startup.catalina start severe: cannot start server. server instance not configured. any suggestions of how solve issue appreciated, since using tcruntime-instance.sh script worked create new servers prior upgrading sts.3.6.4-release version. when created server tc server instance comman...

javascript - Ajax calls, sending images and other data -

i wondering there length limit it? im sending images , data server, returns cannot "find" required data. can , cant find it. , getting frustrating because cant find problem. im sending images dataurl. server gets nothing. there empty formdata checking inspection tool data writen correctly. any other things check? posting code: var id = this.id.substr(11); if (!user) { if (document.getelementbyid('username').value.length < 1) { listing.alert('{{trans('adsadd.entername')}}', true); $('#username').parent().addclass('has-error'); $('#username').addclass('has-error'); return; } if (document.getelementbyid('userphone').value < 1) { listing.alert('{{trans('adsadd.enterphone')}}', true); $('#userphone').parent().addclass('has-error'); ...

android - Mobile Design: Should I be using double resolution images? -

the galaxy s5 has display resolution of 1920 x 1080, iphone 1334 x 750, , many others similar. these resolutions work same way apple's retina screens work, images blurry unless have @2x size version? basically, if creating mobile landing page add, , use image 300px wide in browser, image sharp in browser or need else make sure looks on mobile devices? if you're talking photos or photo-like images, android resizes , fair job of avoiding unpleasant image artifacts because uses accurate rescaling methods. anything expect "pixel-perfect" 2px-wide line in image blurry in resized result. those types of images, you'd want generate different resolution versions of images in drawables-* (or mipmap-*) folders , keep in mind relationship between screen density , pixels. mdpi 1:1 hdpi 1.5:1 xhdpi 2:1 xxhdpi 3:1 xxxhdpi 4:1 (and you're unlikely find right now) ...so if wanted 1px border in image that's displayed on xxhdpi screen, in drawabl...

c# - Get fields from any class (based on type) -

i have class class1 public class class1 { public string abc { get; set; } public string def { get; set; } public string ghi { get; set; } public string jlk { get; set; } } how can list of, in case 'abc', 'def', ... want name of public fields. i tried following: dictionary<string, string> props = new dictionary<string, string>(); foreach (var prop in classtype.gettype().getproperties().where(x => x.canwrite == true).tolist()) { //console.writeline("{0}={1}", prop.name, prop.getvalue(classitem, null)); //objectitem.setvalue("abc", "test"); props.add(prop.name, ""); } and: var bindingflags = bindingflags.instance | bindingflags.nonpublic | bindingflags.public; var fieldvalues = classtype.gettype() .getfields(bindingflags) .select(field => field.getvalue(classtype)) .tolist(); but neither...

javascript - How to focus fist input field in the active navigation tab in angular bootstrap ui? -

how focus fist input field in active tab? next tab becomes active programmatically, after activates first input has selected. using angular js bootstrap ui i have had todo sounds same. to change tab <button class="btn btn-default btn-sm" ng-click="tabs[0].active = true">select second tab</button> from https://angular-ui.github.io/bootstrap/#/tabs if static html5 attribute may work <input type="text" name="fname" autofocus> mine dynamic did (and, dident know html5 thing when did this) .factory('focus', function($timeout) { return function(id) { $timeout(function() { var element = document.getelementbyid(id); if (element) element.focus(); }); }; }) and call code, had todo had code change made showup.

properties - Is there a way to override "property" setters and getters in Swift? -

after reading @property/@synthesize equivalent in swift , became curious how functionality objective c retained. say have following in objective c: @interface myclass @property (readwrite) mytype *myvar; @end this can accessed such dot- , smalltalk-based syntaxes: type *newvar1 = myclassinstance.myvar; type *newvar2 = [myclassinstance myvar]; myclassinstance.myvar = newvar1; [myclassinstance setmyvar: newvar2]; and if want add additional functionality getters/setters, can this: @implementation myclass - (mytype *) myvar { // more stuff return self._myvar; } - (void) setmyvar: (mytype *) newvar { self._myvar = newvar; // more stuff } @end (see custom setter @property? ) however, the accepted answer above linked question says swift doesn't differentiate between properties , instance variable. so, have following in swift: class myclass { var myvar: mytype } as far know, way access myvar such: var newvar1 = myclassinstance.myvar; myc...

python - Show label probability/confidence in NLTK -

i'm using maxent classifier python nltk library. dataset, have many possible labels, , expected, maxent returns 1 label. have trained dataset , 80% accuracy. i've tested model on unknown data items, , results good. however, given unknown input, want able print/display ranking of possible labels based on internal criteria maxent used select one, such confidence/probability. example, suppose had a,b,c possible labels , use maxent.classify(input) , 1 label, let's c . however, want able view a (0.9), b(0.7), c(0.92) , can see why c selected, , possibly choose multiple labels based on parameters. apologies fuzzy terminology, i'm new nlp , machine learning. solution based on accepted answer, here's skeleton code example demonstrate wanted , how can achieved. more classifier examples on nltk website . import nltk contents = read_data('mydataset.csv') data_set = [(feature_sets(input), label) (label, input) in contents] # user-defined feature_sets() func...

data.table - How to assign column names with fread in R? -

i have following code - zz3 <- 'data,key "va1,va2,20140524,,0,0,5969,20140523134902,s7,s1147,140,20140523134902,m/t",4503632376496128 "va2,va3,20140711,,0,0,8824,20140601095714,s1,s6402,175,20140601095839,m/t",4503643113914368 "va1,va3,20140710,,0,0,11678,20140604085203,s1,s1430,250,20140604085329,m/t",4503666467799040 "va2,va1,20140724,,0,0,7109,20140523133835,s7,s793,130,20140523133835,m/t",4503679218483200 "va3,va1,20140925,,0,0,10592,20140604092548,s7,s109,395,20140604092714,m/t",4503694653521920' columnclasses <- c("or"="factor", "d"="factor", "ddate"="factor", "rdate"="factor", "changes"="integer", "class"="factor", "price"="integer", "fdate"="factor", "company"="factor", "number"="factor", "dur"="i...

ember.js - Filter values in the controller -

Image
i want filter products depending of selected category can selected drop-down menu. products belongto category what have change in controller filter products depending of chosen value of drop-down menu? how can add empty field in drop-down menu , display products when chosen? here current ember cli code: app/routes/index.js import ember 'ember'; export default ember.route.extend({ model: function() { return { categories: this.store.find('category'), products: this.store.find('product') }; } }); app/controllers/index.js import ember 'ember'; export default ember.controller.extend({ selectedcategory: null, categories: function(){ var model = this.get('model.categories'); return model; }, products: function(){ var model = this.get('model.products'); return model; }.property('selectedcategory') }); app/templates/index.hbs <p> {{view "select...

google app engine - How to write app.yaml for vast php project? -

i have ready php website. website writing app.yaml google app engine. read many answers doesnt me. facing problem php files under various subfolders in libraries folder. in index.php , accept rss feed url , process full text feed calling other php files. getting error. /makefulltextfeed.php?url=https%3a%2f%2fnews.google.co.in%2fnews%3fpz%max =10&links=preserve&exc=&submit=create+feed not found on server. how write app.yaml php files comes under various sub-folders?? have write handlers: individual php files?? stuck here whole day. new topic. if find stupid question please forgive me. here app.yaml application: xxxx-xxxx-90212 version: alpha-001 runtime: php api_version: 1 handlers: - url: / script: index.php - url: /config script: config.php - url: /makefulltextfeed script: makefulltextfeed.php - url: /css static_dir: css - url: /js static_dir: css - url: /images static_dir: images i have php files in subfolder. how write app.yaml that. ...

c++ - Porting Unix Sockets to Windows -

i have simple c++ library implements unix sockets , works fine on linux systems, i'm facing problem of porting part of code windows platform, not support unix sockets. alternative, far understand, implement tcp sockets, whoose principle similar (writing/reading tcp port instead of specific file). contextually , logistically, conversion of code simple enough implement on top of existing code or should rewrite code scratch? the berkeley api exist on windows , largely compatible other berkeley sockets implementation. see msdn article " porting socket applications winsock " information porting sockets code windows.

javascript - Black image bug when exporting highcharts in Firefox -

i using highcharts display several graphs on webpage display fine. i have export function tries combine charts pdf. getting svg of chart , converting jpeg image included in pdf created jspdf. here code using generate images: if ($('.chart').length > 0) { var chartsvg = $('.chart').highcharts().getsvg(), chartimg = new image(); chartimg.src = "data:image/svg+xml;base64," + window.btoa(unescape(encodeuricomponent(chartsvg))); var chartcanvas = document.createelement("canvas"); chartcanvas.width = 600; chartcanvas.height = 400; chartcanvas.getcontext("2d").drawimage(chartimg, 0, 0, 600, 400); var chartimgdata = chartcanvas.todataurl("image/jpeg"); } this works in chrome in firefox returns black image. does know might going wrong or has seen similar issue? thanks help. update i've updated code no image appended pdf document, either in chrome or firefox. if ($('.s...

ios - Getting Facebook Image using graph api - bigger image than picture.type(large) -

im requesting users image so: fbrequestconnection startwithgraphpath:@"me" parameters:@{@"fields":@"first_name, last_name, picture.type(large), email, gender, birthday, age_range"} httpmethod:@"get" completionhandler:^(fbrequestconnection *connection, id result, nserror *error) but large image still quite small, there way request larger image, or better, , xlarge image. shot in dark tried picture.type(xlarge) caused error. you can specify width , height using picture.width(200) or picture.height(200) sizes want, , graph api return url picture that's closest size. note not profile pictures have size want, still need handle smaller images.

python - Package import creates a module, submodules still importable -

i've been working on python package , turn small rpm distribution. package includes few modules, 1 of executable. can create rpm-package python setup.py bdist_rpm , install on fedora box rpm . at point have desired command myscript , works charm. when try import package in ipython , run strange. can following from myscript import sdf import myscript.mol2 both work flawlessly, but import myscript myscript.sdf throws attributeerror: 'module' object has no attribute 'sdf' i've been working while no avail. there's plenty of questions of import problems, haven't found answer 1 yet. what should change make work? the current folder structure is: myscript/ #project root setup.py src/ myscript/ __init__.py functions.py sdf.py mol2.py runner.py bin/ myscript #symbolic link src/myscript/runner.py setup.py is: from distutils.core import setup setup(name = 'myscript', version =...

php - How can I select a subset of values from an array using the values from another array as keys? -

this question has answer here: get array values keys 4 answers here's array of $keys : array ( [0] => 1 [1] => 3 [2] => 4 ) and $values : array ( [0] => red [1] => orange [2] => yellow [3] => green [4] => blue ) i want create new array of of values in $values using values in $keys keys: array ( [1] => orange [3] => green [4] => blue ) obviously can foreach values want, want make sure i'm not overlooking in plethora of php array functions. i've googled question, , answer comes using array_combine , won't achieve desired output. your appreciated :) flip $keys array make values keys , use array_intersect_key() : $result = array_intersect_key($values, array_flip($keys)); returns values $values have same keys flipped $keys .

ruby - rails duplication code user_attributes -

i have master admin can create 2 different admins [property, content_contributor]. in master admin's require params have this class masteradmins::contentcontributorscontroller < masteradmins::maincontroller .... params.require(:content_contributor).permit(:user_id, user_attributes: [:id, :activation_token, :email, :encrypted_password, :authentication_token, :sign_in_count] and in master admins property have this class masteradmins::propertyadminscontroller < masteradmins::maincontroller ..... params.require(:property_admin).permit(user_attributes: [:id, :activation_token, :email, :encrypted_password, :authentication_token, :sign_in_count] i getting duplicate found in code climate. how can avoid user attribute duplication?

html - Mobile stacking for dotmailer 3 column easy editor - doesn't work on iphone -

i'm using dotmailer 's easy editor create responsive template , going until hit 3 column element need stack. refuses render on iphone! code below, ideas please! <table class="ee_element ee_borders ee_contains_bdr" style="table-layout: auto;" cellspacing="0" cellpadding="0" data-eewidth="600"><tbody><tr><td class="ee_pad ee_bdr" style="padding: 0px; border-top-color: rgb(29, 44, 112); border-top-width: 4px; border-top-style: solid;"><table class="eebdrtbl" style="table-layout: auto;" cellspacing="0" cellpadding="0"><tbody><tr><td class="eeb_width" style="width: 600px;"><table width="100%" class="ee_spacer eev_element" style="width: 600px; table-layout: auto;" border="0" cellspacing="0" cellpadding="0" data-eewidth="600" ee...

c++ - ICU, Unicode and libraries -

my goal implement unicode in utf-16 format in embedded system. want able use multiple languages display on lcd. texts in multiple languages going written in separate text files. program eclipse gcc compiler. i've done research unicode , seems icu holds libraries unicode working on embedded systems. icu version i've downloaded written windows visual studio 10. i'm new program bear me.. i've installed microsoft visual c++ 2010 compile icu , changed library path mentioned in readme file. when trying run cintltst im getting following error: #### note: icu init without build-specific setdatadirectory() failed. u_file_access_error #### error! c:\documents\icu\source\test\cintltst\.\x86\debug\cintltst.exe: u_init() failed status = "u_file_access_error". *** check icu_data environment variable , *** check data files present. *** exiting. use '-w' option if data files *** purposely removed, continue test anyway. now couple of questions: 1) don...

git push - Confused as to why Git believes my branch tip is behind the origin -

i have branch created develop (created atlassian stash) has handful of commits. when try , push commits error updates being rejected because pushed branch tip behind remote counterpart. based on understanding, means else committed, should pull changes. however, there nothing pull. funny thing looking @ atlassian stash i'm able see push has in fact gone through. $ git push repo_url ! [rejected] develop -> develop (non-fast-forward) ! [rejected] feature/135-add-button-to-ticket-indicating -> feature/ 135-add-button-to-ticket-indicating (non-fast-forward) error: failed push refs 'repo_url' hint: updates rejected because pushed branch tip behind remote hint: counterpart. check out branch , integrate remote changes hint: (e.g. 'git pull ...') before pushing again. hint: see 'note fast-forwards' in 'git push --help' details. i'm not sure i'm doing wrong, love know why particular issue rears ugly head every few days. i...

owin - Can IdentityServer return claims as part of authenticate request -

i implementing wsfed authentication using wsfederation plugin on top of thinktecture identityserver, got own userservice implemented authenticatelocalasync method below public async task<authenticateresult> authenticatelocalasync(string username, string password, signinmessage message) { var requestviewmodel = new signinrequestviewmodel { emailaddress = username, password = password }; var result = await signinapplicationservice.signinasync(requestviewmodel); var responseviewmodel = result.viewmodel; var claims = claimbuilder.getclaims(responseviewmodel); return new authenticateresult( responseviewmodel.customerid.tostring(), string.format("{0} {1}", responseviewmodel.firstname, responseviewmodel.lastname), claims); ...

excel - Change a column in PowerQuery based on another column -

i try make in excel powerquery equal operation sql operation: set columna = "max" columnc = "george" i know can create new colum n m expression if columna = "max" "george" else "something" but don't create third column again , again. any ideas how ? you can chain if statements together, so if [columna] = "max" "george" else if [columna] = "jane" "janet" else "something" you can create record looks names , uses alternate name if exists. can done creating record in 1 query: let source = [max = "george", jane = "janet"] in source let query called names. then, when add custom column, can use expression: if record.hasfields(names, [columna]) record.field(names, [columna]) else "something" hope helps.

c# - Find items in list where word exist and ignor special chars -

i have list of myitems: my item { string name; int age; } list<myitem> list = new list<myitem>(); list.add(new test("name", 2)); list.add(new test("ŚćĄa", 4)); list.add(new test("may nĄmĄa bb" , 7)); list.add(new test("may maa cc" , 7)); for : var newlist = list.where(m => m.name.tolower().contains(texttosearch.tolower())).tolist(); i can ignore lower , upper case, how ignore special chars ĄĆŚ , when set texttosearch = "aa"; item two, 3 , four. but when set texttosearch = "Ąa"; i'd item 2 , four try this: list.where(m => cultureinfo.invariantculture.compareinfo.indexof( m.name, texttosearch, compareoptions.ignorenonspace | compareoptions.ignorecase) > -1 ).tolist(); two, 3 , 4 listed.

Javascript - Object return itself -

this question has answer here: how “this” keyword work? 18 answers i have object , want print value console: var pagestatistics = function (page) { var myfunctionname = function () { //some logic of operation //i want print console current object state see if logic works console.log(this); } } but when looking @ console see "window" window's details, instead of object of pagestatistics. how can return current instance of pagestatistics ? update: added real code code gets response facebook api query calculate statistics page's behaviour: var pagestatistics = function (page) { var numberofposts = 0; var numberoflikes = 0; var numberofcomments = 0; var numberofshares = 0; var bestpostid = 0; var bestpostlikes = 0; var bestpostcomments = 0; var bestpostshares = 0; var bestposttot...

excel - Loop through filter criteria -

i've been trying figure out no progress... i have filter (column d) , i'm trying create loop each criteria (i got @ least 1000 criterias) on filter. ex: each criteria on filter (column d), i'll run range copy... that code isnt working @ all: sub whatfilters() dim ifilt integer ifilt = 4 dim ifiltcrit integer dim numfilters integer dim crit1 variant activesheet.range("$a$1:$aa$4635").autofilter field:=16, criteria1:= _ "waiting" numfilters = activesheet.autofilter.filters.count debug.print "sheet(" & activesheet.name & ") has " & numfilters & " filters." if activesheet.autofilter.filters.item(ifilt).on crit1 = activesheet.autofilter.filters.item(ifilt).criteria1 ifiltcrit = 1 ubound(crit1) debug.print "crit1(" & ifiltcrit & ") '" & crit1(ifiltcrit) 'copy next i...

c# - Send selectedText from AutocompleteTextView Automatically - Jquery / Asp.net -

i searched lot. created autocomplete jquery citytextbox , selecteditem autocomplete textbox. split selecteditem "|" , assign string[] lines after user select autocomplete view. on code assign lines below( lines[0] citytextbox , lines[1] postcodetextbox); $('#postcodetextbox').text = $("#<%=postcodetextbox.clientid%>").val(lines[1].trim()); $('#citytextbox').text = $("#<%=citytextbox.clientid%>").val(lines[0].trim()); }); this works fine after select when click somewhere or focus ect(events define in $("#citytextbox").bind() ). happens. want send lines[0] , lines[1] text boxes automatically when select autocomplete list without click etc. can see java script code below: $(function () { $("#citytextbox").autocomplete({ source: function (request, response) { var param = { cityname: $('#ci...

javascript - Optimalisation of displaying data in real time in ASP.NET MVC -

long story short, trying display real time data, using asp.net mvc , eventhubs. i have async method in controller receiving messages hub , placing them in class-variable. views on other hand using js retrieve value , value div tag js based chart can retrieve value read innerhtml value of div. i feel not way work, , feels system unstable @ times, please take @ code better understanding: methods of interest found in controller: public async static void updatelist() { { try { var message = await consumer.receiveasync(); if (message != null) { //alot of code receive needed double } } catch (exception exception) { console.writeline("exception on receive {0}", exception.message); } } while (true); } public async task<actionresult> refreshlatest() { ...

python - Pandas: Adding conditionally -

i have data frame set of columns, on want perform conditional operation follows: foo = 0 * foobar2['var1'] foo.loc[foobar2['var1'] > 0] += foobar2.loc[foobar2['var1'] > 0, 'var1'] foo.loc[foobar2['var2'] > 0] += foobar2.loc[foobar2['var2'] > 0, 'var2'] foo.loc[foobar2['var3'] > 0] -= foobar2.loc[foobar2['var3'] > 0, 'var3'] foo.loc[foobar2['var4'] > 0] -= foobar2.loc[foobar2['var4'] > 0, 'var4'] that is, want sum var1 , var2 , , subtract var3 , var4 - whenever these variables positive, negative variables indicate missing values , similar in data set. code works, quite slow. there more efficient way this? this approach fastest have tried: foo = foobar2.clip_lower(0) foo = foo['var1']+foo['var2']-foo['var3']-foo['var4'] this approach tiny bit little slower: foo = foobar2.clip_lower(0) foo['var3']*=-...

linux - Why MySQL disable load local infile is not working? -

as part of security hardening, trying disable local_infile , prevent accessing local files of operating system. per documentation can disable either setting variable local-infile=0 in my.cnf or start mysqld service option --local-infile=0 . of option able load local files. i tried first adding in /etc/my.cnf [mysqld] local-infile=0 after confirmed changes got reflected. mysql> show global variables 'local_infile'; +---------------+-------+ | variable_name | value | +---------------+-------+ | local_infile | off | +---------------+-------+ 1 row in set (0.00 sec) then mysql client loaded local file using load_file mysql> select load_file("/etc/passwd"); the above command shows content of /etc/passwd file, though local_infile disabled.can tell going wrong here? i repeated same steps passing mysqld --local-infile=0 no change. have tried starting mysql client --local-infile=0 option no difference. use query in mysql database ...

visual studio - 32-bit .obj in 64-bit project -

i have 32-bit object file o.obj , want use in project uses 64-bit library l.lib . to make .lib happy, visual studio configuration needs set x64. however, linker throws error of error lnk1112: module machine type 'x86' conflicts target machine type 'x64' . i went through visual studio's linker options, nothing jumped out. there way resolve error? i under impression 32-bit code compatible 64-bit systems, modulo libraries. x86 executables (that is, object code compiled 32-bit x86 processors) can executed on x64 machines running 64-bit operating systems, through special compatibility mode supported jointly processor , operating system. feasible because x86 instruction set subset of x64 instruction set. however, many elements of abi differ between x86 , x64 code, notably calling conventions , pointer size. calling convention needs match between calling code , called code, or things screw up. thus, there no straightforward way call 64-bit code 32-b...

c - What is Partial Linking in GNU Linker? -

the best explanation able find official document: -r --relocateable generate relocatable output--i.e., generate output file can in turn serve input ld. called partial linking. side effect, in environments support standard unix magic numbers, option sets output file's magic number omagic. if option not specified, absolute file produced. when linking c++ programs, option not resolve references constructors; that, use -ur. option same thing `-i'. i interested in knowing happens symbols present in inputs linker. take specific case when have static library libstatic.a contains single object file component.o . now, want create static library libfinal.a work interface libstatic.a . use command create it: ld -r -o libfinal.a wrapper.o -l. -lstatic where wrapper.o provides exclusive apis call functions defined in libstatic.a will libfinal.a combined archive having wrapper.o , component.o or references can-be-resolved between wrapper.o , component....

javascript - SuccessCallback firing immediately in Xrm.Page.data.save -

i writing javascript code change form of entity in dynamics crm based on value of field on each form. to change form, user has change value of field. during onchange event, js comes in, triggers saving, has wait result , change form. (if save , change @ same time, there still window shown asking user confirm leaving unsaved changes) now there should way that: xrm.page.data.save(saveoptions).then(successcallback, errorcallback) as described on msdn : saves record asynchronously option set callback functions executed after save operation completed. i using such: var campaigntype = xrm.page.getattribute('typecode').getvalue(); if (xxx.forms.hasownproperty(campaigntype)) { xrm.page.data.save().then(function () { xxx.redirecttoform(xxx.forms[campaigntype]); }, null); but form change still triggered during save. what doing wrong? i faced similar problem while trying update process bar. xrm.page.data.save().then (function () { ...

java - Execution failed for task ':app:dexDebug' in Android Studio -

com.android.ide.common.process.processexception: org.gradle.process.internal.execexception: process 'command 'c:\program files\java\jdk1.7.0_75\bin\java.exe'' finished non-zero exit value 2 when developing app error , not able run app. build getting successful. not run app. please provide me information solve this........ and getting exception while build app aapt err(1229713066): c:\users\rramnath143729\androidstudioprojects\appathon_app\app\src\main\res\drawable-hdpi\ic_drawer.png: libpng warning: iccp: not recognizing known srgb profile has been edited aapt err(2016822147): c:\users\rramnath143729\androidstudioprojects\appathon_app\app\src\main\res\drawable-mdpi\ic_drawer.png: libpng warning: iccp: not recognizing known srgb profile has been edited aapt err(949986979): c:\users\rramnath143729\androidstudioprojects\appathon_app\app\src\main\res\drawable-xhdpi\ic_drawer.png: libpng warning: iccp: not recognizing known srgb profile has been edited aa...

xmpp - How to keep chat history locally on android? -

i using openfire , asmack chat application. i able send , receive messages using asmack library. can tell me how keep these messages in local(android) storage, whenever user opens application next time, can see previous chat history ? there api provided asmack/smack ? simply register packet listener , interceptor , log messages backing store of choice.

redmine error with RMagic -

hello install redmine when try migrate database there error : [deprecation] requiring "rmagick" deprecated. use "rmagick" instead there stacktrce : root@server:/opt/redmine/redmine-3.0# bundle exec rake db:migrate [deprecation] requiring "rmagick" deprecated. use "rmagick" instead rake aborted! activerecord::adapternotspecified: 'development' database not configured. available: ["production"] /var/lib/gems/2.1.0/gems/activerecord-4.2.1/lib/active_record/connection_adapters/connection_specification.rb:248:in `resolve_symbol_connection' /var/lib/gems/2.1.0/gems/activerecord-4.2.1/lib/active_record/connection_adapters/connection_specification.rb:211:in `resolve_connection' /var/lib/gems/2.1.0/gems/activerecord-4.2.1/lib/active_record/connection_adapters/connection_specification.rb:139:in `resolve' /var/lib/gems/2.1.0/gems/activerecord-4.2.1/lib/active_record/connection_adapters/connection_specification.rb:169...