Posts

Showing posts from February, 2011

wpf - Image edit and save Out of Memory Exception C# -

i'm working in wpf application show images in 2 places means same image gets loaded in 2 places. in 1 of place image shown along other few images in slider able edit , save. if there no image available in location should showing separate image image not found not editable. when started working on functionality got used process exception during edit , save. after searching came solution , @ rare time out of memory exception when click next or previous or first or last in slider. slider image control 4 buttons. when buttons clicked below method called. i'm not sure if there memory leaks. bool noimage = true; private static readonly object _syncroot = new object(); private bitmapsource loadimage(string path) { lock (_syncroot) //lock object doesn't executed more once @ time. { bitmapdecoder decoder = null; try { //if image not found in folder, show image not found. if (!file.exists(path) && (path != null)

html - How to change pressed item background color in ion-list on Ionic? -

i have list of items, want change background color of pressed item in ionic project. index.html <ion-list> <ion-item ng-repeat="item in familleitems"> <div ng-click="selectsousfamille(item.numfam)">{{item.nomfam}}</div> </ion-item> </ion-list> help me please highlight hover item purely css ion-item:hover { background-color: slategray !important; } highlight active item you add active css class using ng-class. define custom css 'active' class. <ion-item ng-repeat="item in familleitems" ng-class="{'activeitem': active}"> <div ng-click="selectsousfamille(item.numfam)">{{item.nomfam}}</div> </ion-item> example: <ion-content padding="true"> <ul class="product-list"> <!-- need .selected in stylesheet --> <li ng-repeat="(key, item) in products" ng-

javascript - Setting a css property using a normal variable for knockout js -

i want set css property using if condition using normal variable other observables. like: a.html file: <span class="label" data-bind="text: isapproved, css: sampleglobalvar == true ? 'label-success' : 'label-important'"></span> a.js file: edit: define('durandal/app'],function(app) { var = function() { sampleglobalvar = 'true' }; } i getting error such 'sampleglobalvar' doesnt exist in viewmodel . know observable has used , have other problems observable switching between 'true' , 'false' observables creating problems: like if use: sampleglobalvar = ko.observable(""); setting : if(//condition) { sampleglobalvar(true); } else { sampleglobalvar(false); } was not clearing observable , due getting different results. to summarize possible use normal javascript variable use in css data-bind property? yes, it's possible. true global (i.e. stu

sql server - Issue with MS-Access Application on shared network(Citrix) using by many users simultaneously -

a ms-access application sql server backend running on shared location(citrix) through mde file. running fine on local machine when multiple users generate certificate simultaneously, gives error , may file corrupt because after getting error file not work on local environment. ms-access application error

Flask Restful URLs giving 404 while in a blueprint -

i trying use flask restful blueprint in pattern works other blueprints. keep getting 404 error when go /todos/1 my project setup follows: folder structure ├── app │   ├── __init__.py │   ├── mod_api │   │   ├── __init__.py │   │   └── routes.py │   ├── main │   │   ├── __init__.py │   │   ├── forms.py │   │   └── views.py │   └── templates │   ├── base.html │   └── home.html ├── config.py ├── manage.py └── requirements.txt __init__.py from flask import flask flask_restful import api flask_bootstrap import bootstrap config import config bootstrap = bootstrap() api = api() def create_app(config_name): app = flask(__name__) app.config.from_object(config[config_name]) config[config_name].init_app(app) bootstrap.init_app(app) api.init_app(app) .main import main main_blueprint .mod_api import mod_api api_blueprint app.register_blueprint(main_blueprint) app.register_blueprint(api_blueprint) return app mod_api/__init__.py fr

linux - poll(2) on read fd of pipe(2) and fd of inotify_init() is resulting in endless EINTR -

update possible bug in firefox - https://bugzilla.mozilla.org/show_bug.cgi?id=1288293 old post i writing inotify file watcher. my main thread first creates pipe pipe , creates polling thread, , sends thread read fd of pipe. int mypipe[2]; rez = pipe(mypipe) if (pipe(pipefd) == -1) { exit(exit_failure); } int mypipe_fd = mypipe[0]; my polling thread starts infinite poll watching inotify inotify_fd , pipe mypipe_fd poll this: int inotify_fd = inotify_init1(0); if (inotify_fd == -1) { exit('inotify init failed'); } // in_all_events = in_access | in_modify | in_attrib | const.in_close_write | in_close_nowrite | in_open | in_moved_from | in_moved_to | in_create | in_delete | in_delete_self | in_move_self if (inotify_add_watch(inotify_fd, path_to_desktop, in_all_events) == -1) { exit('add watch failed'); } int mypipe_fd = blah; // read end of pipe generated on main thread pollfd fds[2]; fds[0].fd = mypipe_fd; fds[1].fd = inotif

Android ripple effect outside view for pre lollipop -

Image
i have circular view , need generate ripple effect outside view light shade when click on view. take @ these 2 libraries: https://github.com/skyfishjy/android-ripple-background https://github.com/ruzhan123/rippleview

jenkins - How can I increase my Docker Sonarqube disk space to avoid this warning? -

i following output when running sonarqube scanner jenkins: 2016.02.23 11:01:00 info es[o.e.c.r.a.decider] [sonar-1456222793208] high disk watermark exceeded on 1 or more nodes, rerouting shards 2016.02.23 11:01:30 warn es[o.e.c.r.a.decider] [sonar-1456222793208] high disk watermark [90%] exceeded on [vkgyodbwsrylfj46lqt_xw][sonar-1456222793208] free: 436.6mb[2.3%], shards relocated away node 2016.02.23 11:02:00 warn es[o.e.c.r.a.decider] [sonar-1456222793208] high disk watermark [90%] exceeded on [vkgyodbwsrylfj46lqt_xw][sonar-1456222793208] free: 436.6mb[2.3%], shards relocated away node 2016.02.23 11:02:00 info es[o.e.c.r.a.decider] [sonar-1456222793208] high disk watermark exceeded on 1 or more nodes, rerouting shards 2016.02.23 11:02:30 warn es[o.e.c.r.a.decider] [sonar-1456222793208] high disk watermark [90%] exceeded on [vkgyodbwsrylfj46lqt_xw][sonar-1456222793208] free: 436.6mb[2.3%], shards relocated away node as stated in header, in addition if warning c

javascript - How to show and hide an element when scrolling the window using jquery -

i want show border effect when i'll scroll down , reach on desired section.and it'll hide when i'll leave section. possible using jquery? using $(document).on('scroll') , this: <html> <head> <script type="text/javascript" src="http://code.jquery.com/jquery-latest.js"></script> <style> html,body { height:101%; } #box-1 { width:200px; height:200px; background-color:#333; } .border-1 { border: 10px solid #696969; } </style> <body> <h1 id="mytarget">this desire section</h1> <p>lorem ipsum dolor amit. lorem ipsum dolor amit. lorem ipsum dolor amit. </p> <p>lorem ipsum dolor amit. lorem ipsum dolor amit. lorem ipsum dolor amit. </p> <p>lorem ipsum dolor amit. lorem ipsum dolor amit. lorem ipsum dolor amit. </p> <p>lorem ipsum dolor amit. lorem ipsum dolor amit. lorem ipsum dolor amit. </p> <div id=&quo

reactjs - rowHasChanged Undefined is not a constructor -

hello i'm creating grid , have constructor in class export class grid extends component { constructor (props) { super(props) var ds = new listview.datasource({rowhaschanged: (r1, r2) => r1 !== r2}) this.state = {datasource: ds.clonewithrows(this._genrows({}))} } . . . } i'm getting following error when try run this: undefined not constructor (evaluating 'new) _reactnative.listview.datasource({rowhaschanged:function rowhaschanged(r1,r2){returnr1!==r2;}})') can give me hand on this? thank in advance! i think typo. try using datasource instead of datasource in line: var ds = new listview.datasource( ... listview reference: http://facebook.github.io/react-native/releases/0.29/docs/listview.html

math - Incorrect calculation using decimals in php -

i have arrays, holding numbers multiplication quiz. here examples: if($level==8){ $first=array(13,14,16,17,18,19); $second=array(9,10,11,12,13,14,15,16,17,18,19);} if($level==9){ $first=array(23,19,46,87,98,39); $second=array(19,10,111,112,139,178,145,166,167,185,192);} if($level>9){ $first=array(2.3,1.9,4.6,8.7,9.8,3.9); $second=array(1.9,10,11.1,11.2,13.9,17.8,14.5,16.6,16.7,18.5,19.2);} these numbers used calculate answers placed on button , user has click on correct answer. // correct answer $b=rand(0,5); $c=rand(0,10); $f=$first[$b]; $s=$second[$c]; $d=$f*$s; // wrong answer no. 1 $w1a=rand(0,5); $w1b=rand(0,10); $w1c=$first[$w1a]; $w1d=$second[$w1b]; $w1e=$w1c*$w1d; if ($w1e==$d){ wronganswer1(); } // wrong answer no. 2 $w2a=rand(0,5); $w2b=rand(0,10); $w2c=$first[$w2a];

apache spark - Error when creating a StreamingContext -

i open spark shell spark-shell --packages org.apache.spark:spark-streaming-kafka_2.10:1.6.0 then want create streaming context import org.apache.spark._ import org.apache.spark.streaming._ val conf = new sparkconf().setmaster("local[2]").setappname("networkwordcount").set("spark.driver.allowmultiplecontexts", "true") val ssc = new streamingcontext(conf, seconds(1)) i run exception: org.apache.spark.sparkexception: 1 sparkcontext may running in jvm (see spark-2243). ignore error, set spark.driver.allowmultiplecontexts = true. running sparkcontext created at: when open spark-shell, there streaming context created. called sc, meaning not need create configure object. use existing sc object. val ssc = new streamingcontext(sc,seconds(1)) instead of var use val

c# - Getting Excel data to SQL table with EPPlus and SqlBulkCopy -

i have added epplus library solution. can't seem figure out how excel data datatable allow bulkcopy work. below code doesn't work. can me massage place? thank in advance assistance. have edited after comments 'mason' below. try { //// open file var excel = request.files[0]; var file = path.combine(server.mappath("~/uploads/"), excel.filename); var sqlconnectionstring = configurationmanager.connectionstrings["mydb"].tostring(); // datatable procedure on utility.cs page var datapush = utility.importtodatatable(file, "sheet1"); // open connection sql , use bulk copy write exceldata table using (var destinationconnection = new sqlconnection(sqlconnectionstring)) { destinationconnection.open(); using (var bulkcopy = new sqlbulkcopy(destinationconnection)) { bulkcopy.destinationtablename = "mytable"; bulkcopy.

PHP GD: merge a blurry rectangle -

Image
i need merge blurry rectangle on image (a white rectangle). tried imagesavealpha() unfortunately background of rectangle remains black, , want gradient red white. here code: <?php $width = 200; $height = 180; $bw = $bh = 30; $img1 = imagecreatetruecolor($width, $height); $img2 = imagecreatetruecolor($width, $height); $white = imagecolorallocate($img1, 255, 255, 255); $red = imagecolorallocate($img2, 255, 0, 0); imagefilledrectangle($img1, 0, 0, 100, 100, $white); imagefilledrectangle($img2, 5, 5, 25, 25, $red); imagefilter($img2, img_filter_gaussian_blur); imagefilter($img2, img_filter_gaussian_blur); imagefilter($img2, img_filter_gaussian_blur); imagefilter($img2, img_filter_gaussian_blur); imagefilter($img2, img_filter_gaussian_blur); imagesavealpha($img2, true); imagecopymerge($img1, $img2, 20, 20, 0, 0, $bw, $bh, 100); header('content-type: image/png'); imagepng($img1); imagedestroy($img1); the restulting image is: if want blurred red rectan

c# - Is error that specified in JsonSerializerSettings catches all exceptions -

i try implement code error handling newtonsoft documentation i using following jsonserializersettings errors = new jsonerrors(); jsonserializersettings = new jsonserializersettings { error = delegate (object sender, erroreventargs args) { errors.add(args.errorcontext.error.message); args.errorcontext.handled = true; } }; i use following code deserialize response. try { deserializedobject = jsonconvert.deserializeobject(response, jsonserializersettings); } catch (exception ex) { console.writeline(ex.message); throw; } if add chars @ end of response string expect catch deserialize exception see relevant error added jsonerrors object. can sure error raised de-serialization/serialization catched jsonserializersettings mechanism. can remove try catch in code? in theory exceptions should caught , passed handler (other exceptions cannot caught such stackoverflowexception .) if go github source , search iserrorhandled see

javascript - scroll animation not working properly; when i click the link i get directed but with no animation -

smooth scrolling not working?? when click link scroll element/section takes me directly no smooth scrolling after changing animation speed 5000. scripts correct don't know do this code below; query , have tagged links '#' tag , created id each of elements properly $(function() { $('a[href*="#"]:not([href="#"])').click(function() { if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname) { var target = $(this.hash); target = target.length ? target : $('[name=' + this.hash.slice(1) +']'); if (target.length) { $('html, body').animate({ scrolltop: target.offset().top }, 5000); return false; } } }); }); $(function() { $('a[href*="#"]:not([href="#"])').click(function() { if (location.pathname.replace(/^\//,'') == thi

java - What happens when writing to aux file on Windows? -

i have following code: public class mytest { public static void main(string [] args) throws exception { java.io.file f = new java.io.file("aux.txt"); f.createnewfile(); java.io.filewriter fw = new java.io.filewriter(f); fw.write("hello"); fw.flush(); fw.close(); } } the code runs , not throw exception. except: file aux.txt not there. found f.createnewfile() return false, because aux file not allowed created on windows . ok, can live that. but, confusion this: if filewriter did not throw exception, did write to? according msdn do not use following reserved names name of file: con, prn, aux, nul, com1, com2, com3, com4, com5, com6, com7, com8, com9, lpt1, lpt2, lpt3, lpt4, lpt5, lpt6, lpt7, lpt8, , lpt9. avoid these names followed extension; example, nul.txt not recommended. false returned means, file exists. according this blog writing aux on windows causes writing auxiliary device, serial port.

javascript - iframe inside angular2 component, Property 'contentWindow' does not exist on type 'HTMLElement' -

i have iframe inside angular2 component, , trying change content of iframe accessing contentwindow. iframe should contain simple button. my code: import { component } '@angular/core'; @component({ moduleid: module.id, selector: 'component-iframe', template: '<iframe id="iframe"></iframe>' }) export class componentiframe { constructor() { let iframe = document.getelementbyid('iframe'); let content = '<button id="button" class="button" >my button </button>'; let doc = iframe.contentdocument || iframe.contentwindow; doc.open(); doc.write(content); doc.close(); } } if comment constructor's code , start app, compiles , runs correctly. uncomment , runs (the button present in iframe). if decomment code start app (npm start) have compilation bugs message: property 'contentwindow

android - Is there any way to get the location updates even if the gps is off -

i working on app involves tracking of android device. found google's sample code getting location updates here working , easy implement problem stops getting location updates when mobile's gps turned off. want know there any way location updates network connection using fused location api if gps of mobile turned off. thanks fused location provider tries best possible location location data gps. if want location mobile network put following permission in manifest. <uses-permission android:name="android.permission.access_coarse_location" /> theoretically, should location mobile network.

hadoop cluster not using all the memory provided,just using 24 gb out of 72gb? -

i using 3 node hadoop cluster. node 1: 32gb ram, node 2: 32gb ram, node 3: 8gb ram while running job using 24gb, 8 gb each node. containers used 24. vcores used 24. should use memory provided i.e total 72gb. can me out solution.

vb6 - Is this code creating a getter? I am trying to translate this to C# -

private samples collection public function count() integer count = samples.count end function i trying translate code c#. trying understand code's logic. have code, public int count {get; set;} this written in c#. no, if says function , means function. conversely, if said property property , could (optionally) contain getter. the precise equivalent is: public int count() { return samples.count; } where may have been tripped looking @ calling code - in vb, parentheses optional when calling parameterless function, may see code invokes above function saying count rather count() .

oracle - How can I get this data in a single row -

select to_char(x,'mon'),to_char(x,'dd') (select case when to_char(to_date('01-may-2015')+(rownum-1),'dy') = 'fri' then<br> to_date('01-may-15')+(rownum-1) else null end x all_objects<br> rownum < (select (to_date ('01-may-16') - to_date('01-may-15')+1) <br> dual)) x not null; i want display the date of friday on every week of month give year, starting give date. suppoise if give start date 01-mar-2015 29-feb-2016 ten should like mar mar mar mar apr apr apr apr may............feb feb 06 13 20 27 3 10------------------------- 19 26 i getting them in columns. how can them in row. in advance. you may need this: with test(start_date) (select to_date('15022016', 'ddmmyyyy') dual) /* start date */ select listagg(to_char(date_, 'dd/mm/yyyy'), ', ') within group(order date_) /* concatenation of dates */ ( select star

ios - how to get data from JSON array SwiftyJSON? -

i able data json array: here below, trying show earliest > date func parsejsontowns() { let url = nsurl(string: "https://api.tfl.gov.uk/journey/journeyresults/\(selectedstation)/to/\(selectedstation1)") let jsondata = nsdata(contentsofurl: url!) let readablejson = try! nsjsonserialization.jsonobjectwithdata(jsondata!, options: []) as! [string:anyobject] let object = json(readablejson) let searchcriteria = object["earliest"] option in searchcriteria.arrayvalue { let commonname = option["date"].stringvalue commonnamearray.append(commonname) } selectedstation = selectedstation.stringbyreplacingoccurrencesofstring("%20", withstring: " ") numberofrows = commonnamearray.count nslog("\(url)") nslog("number of rows: \(numberofrows)") } the date of earliest in dictionary timeadjustments in dictionary searchcriteria let object = json(readablejs

python - Why is Button parameter “command” executed when declared? -

my code is: from tkinter import * admin = tk() def button(an): print print 'het' b = button(admin, text='as', command=button('hey')) b.pack() mainloop() the button doesn't work, prints 'hey' , 'het' once without command, , then, when press button nothing happens. the command option takes reference function, fancy way of saying need pass name of function. when button('hey') calling function button , and result of being given command option . to pass reference must use name only, without using parenthesis or arguments. example: b = button(... command = button) if want pass parameter such "hey" must use little code: you can create intermediate function can called without argument , calls button function, you can use lambda create referred anonymous function . in every way it's function except doesn't have name. when call lambda command returns reference created function, means

c - fwrite() performance drop -

my commands-line c-application windows uses fwrite() continuously dump received data 1 gb files on ssd drive. data comes pcie card in chunks of 16 kb, data count use when calling fwrite(). under these circumstances, each fwrite() call takes less 100 (measured using windows performance counter) but there outliers taking 2 or more seconds complete , causing buffer overflows in pcie card. what's cause of these sporadic performance drops? there can prevent them happening? update #1 : part of problem seems caused ssd drive. when dumping regular, mechanical hdd, outliers in order of 100 msecs (instead of 1000s of msecs). update #2 : seems fwrite() slowdown occurs after writing first 1.5 gb of data. when dumping 1 gb files, slowdown occurs in middle of second file. when using 512 mb files, it's after 3rd file. when using 256 mb files, it's after 6th file. stealing something : flash memory uses erase-write cycle. erase sets memory 1s. writing sets bits 0,

javascript - Validating form fields before submit -

i have function frmvalidator using compare 2 input fields. thing got 2 fields required , user need fill 1 or both can not leave 2 input unfilled. here i've been working on: <form id="contact_form" action="contact.php" method="post"> <label>rfc ** </label> <input class="fiscal-input" type="text" name="rfc" placeholder=""> <label> ó curp **</label> <input class="fiscal-input" type="text" name="curp" placeholder=""> </form> frmvalidator.addvalidation("curp","regexp=^[a-z]{1}[aeiou]{1}[a-z]{2}[0-9]{2}(0[1-9]|1[0-2])(0[1-9]|1[0-9]|2[0-9]|3[0-1])[hm]{1}(as|bc|bs|cc|cs|ch|cl|cm|df|dg|gt|gr|hg|jc|mc|mn|ms|nt|nl|oc|pl|qt|qr|sp|sl|sr|tc|ts|tl|vz|yn|zs|ne)[b-df-hj-np-tv-z]{3}[0-9a-z]{1}[0-9]{1}$","por favor ingrese un curp válido."); frmvalidator.addvalidation("rfc","regexp=^

sh - Linux how to make the space similar with previous -

i have input , replace (row,column) . have done replace (row,columnn) needed how come whole line formate shift? code need add in prevent format changes? code using replace (row,column) cat abc.txt | awk '$1 ~/^0(1?[0-9])|^00(1?[0-9])$/' | awk '{ if (nr==2) $8="9" ;if ($8 == "9") $66="9";print}' input file 024 1 1 1 1 1 1 1 1 1 1 248 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1^m 025 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1^m 026 1 1 1 1 1 1 1 1 1 1

r - Get columns from column's values -

this question has answer here: reshaping data.frame wide long format 4 answers the dataframe contains information in format: type value ------------------- cata 1 catb 2 cata 3 my target convert dataframe format (type's values columns): cata catb ----------------- 1 - - 2 3 - i have been looking "dummy variables" it's not need. ¿could give me ideas? library(reshape2) df <- data.frame(type=c("cata","catb","cata"),value=c("one","two","three")) df # type value # 1 cata 1 # 2 catb 2 # 3 cata 3 dcast(df,value~type) # value cata catb # 1 1 1 <na> # 2 3 three <na> # 3 2 <na> 2 dcast(df,type~value) # type 1 3 2 # 1 cata 1 3 <na> # 2 catb <na> <

database - MySQL does not utilize server fully -

i have mariadb 10.0.17 running on amazon rds db.m4.xlarge (16gb ram, 4vcpu) multi az deployment. use provisioned iops storage max set 10000 iops. users table contains 17m records; user_properties table contains 350m records. user_properties table describes "map" of props attached user. upkey key, string_value , integer_value etc values per-type; string, date, integer, double. indexes per-type. we try insert insert more data user_properties table: application inserts data innodb temp table temp1 , data gets copied temp1 user_properties table. problem reach 2500 write iops , 500-1000 read iops. queue depth holds on ~7 in average. mysql server cpu usage holds on 20-30% , never reaches 60%. application seems feed enough data mysql: feed similar data files db , see how processing time increases table size increases. time application waits mysql query completion. in process insertion temp1 table takes small fraction of overall time, time waiting insertion temp1

.net - How to set images after the names in Kendo drodpdown list? -

i have used html.kendo.dropdownlist, want add edit , delete image @ right hand side of each text. @(html.kendo().dropdownlist() .name("preferncenamelist") .datatextfield("text") .datavaluefield("value") .events(e => e.change("preferncenamechange")) .bindto(viewbag.preferncenames) .value(model.defaultpreference) how modify template achieve same ? if need display images next item content , selected text, need use template , valuetemplate options: http://docs.telerik.com/kendo-ui/api/aspnet-mvc/kendo.mvc.ui.fluent/dropdownlistbuilder#methods-valuetemplate(system.string) check online demo shows how use them: http://demos.telerik.com/aspnet-mvc/dropdownlist/template

java - How to get the integer values from the String -

this question has answer here: how split string whitespace chars delimiters? 11 answers my string like string body = "gh 1234 ring 5"; i want extract number 1234, ring , last 5 separate variables , want compare each of values..it like.. pass = 1234, cmnd = ring , duration = 5 this.. please me figure out how achieve this. im doing like string body="gh 1234 ring"; string pass=bodypass = body.replaceall("[^0-9]", ""); to 1234 in it.but cant find how retrieve ring , 5. do this string body = "gh 1234 ring 5"; string[] splited = body.split("\\s+"); now result splited[0] = gh splited[1] = 1234 splited[2] = ring splited[3] = 5

c++ - VCRedist compatibility across VS Updates, library linking and dll usage -

i know, vredists not compatible between major versions of visual studios (2013 not compatible 2015 , vcredist of 215 needed install because of different stl implementations - right?). however, not sure, minor versions - updates. let's say, have 2 developement environments: a) vs 2015 update 2 - 14.0.25123.00 vcredist 14.0.23918 b) vs 2015 update 3 - 14.0.25421.03 vcredist 14.0.24210 1) i have lib / dll (particullary opencv 2.4.13) built vs 2015 update 2 (environment a) ), can library linked program in vs 2015 update 3 (environment b) )? can user safely run program vcredist 14.0.23918 installed or needed install vcredist 14.0.24210? and reversed situation... 2) the lib / dll built vs 2015 update 3 (environment b) ), can library linked program in vs 2015 update 2 (environment a) )? can user safely run program vcredist 14.0.23918 installed? answers appreciated.

c++ - How can I use vector or algorithm for finding maximum amount in this code? -

i wrote following code finding maximum score: #include "stdafx.h" #include <iostream> #include<vector> #include <string> #include <algorithm> constexpr int max_students = 3; using namespace std; class student{ public: void vrod(); void dis(); int stno; int score int i; string name; }; void student::vrod(){ cout << "name="; cin >> name; cout << "stno="; cin >> stno; cout << "score="; cin >> score; } void student::dis(){ cout << "name=" << name << "\n" << "stno=" << stno << "\n" << "score=" << score<< "\n"; cin.get(); } int main(){ int l; vector<student> my_vector; for(int = 0; < n; i++) { student new_student; cout << "number: "; cin >> new_

npm - What is the use of gulp-sourcemaps? -

i'm learning angular2 , have seen gulp-sourcemaps plugin used in angular2-quickstart project. question general, why use gulp-sourcemaps? in circumstances should use plugin? it automatically creates source maps code. source map used tell file , line in original code part of minified code comes from. sourcemaps can helpful when debugging minified angular apps in browser.

java - Understanding External Class Folder -

Image
whilst learning develop servlets added c:\program files\apache\tomcat8\lib\servlet-api.jar j2ee project's build path servlets work. fine: i decided instead add entire folder c:\program files\apache\tomcat8\lib "external class folder" , i'm "javax.servlet cannot resolved". this seems make no sense when compared how eclipse adds tomcat library - looks identical: [ i guess questions are: what wrong including entire folder "library"? how 1 add folder appears proper library in "apache tomcat v8.0" library eclipse adds via wizard class-folders folders compiled classes not folder libs. use user-library feature of eclipse in generell have add every jar hand.

angularjs - UI Router Resolves - Redirect in child resolve without re-running parent resolves -

i have scoured web days. understand if redirect ($state.go, etc) in resolve, transition cancelled , resolves run again. but, if need prevent going child state. , fetch data in resolves don't need, nor want, fetch again. i can't believe unusual scenario people. if has idea, please me plnkr working! http://plnkr.co/edit/gfdcrqopxkbd1zzwylo9?p=preview var app = angular.module('plunker', ['ui.router']); app.config(['$stateprovider', function($stateprovider){ $stateprovider .state('posts', { url: "/posts", templateurl: "posts-index.html", controller: "postsindexcontroller", resolve: { posts: function(post) { console.log('hi'); return post.all() } }, onenter: function($state, posts) { if (posts.length > 1 && confirm("redirect first post?")) { console.log('howdy') // $st

evernote - API rate limits on calling getSyncChunk() -

given evernote don't publish exact api rate limits (at least can't find them), i'd ask guidance on it's usage. i'm creating application sync user's notes , store them locally. i'm using getfilteredsyncchunk this. i'd know how can make api call without hitting limits. understand limits on per-user basis, acceptable call every 5 minutes latest notes? tia the rate limit on per api key basis. you'll okay calling getfilteredsyncchunk every 5 minutes, although it's little more efficient call getsyncstate instead. in case haven't seen yet, check out this guide info on sync (accessible this page ).

php - "__(" in custom post types -

i'm building custom post types wordpress project, not understand why in examples on internet it's possbile find this: register_post_type('omb_prodotti', array( 'labels' => array( 'name' => __( 'customposttype' ), 'singular_name' => __( 'customposttype' ) ) what "__(" used for? related translations? wouldn't possible write instead: register_post_type('omb_prodotti', array( 'labels' => array( 'name' => 'customposttype', 'singular_name' => 'customposttype' ) sorry i'm beginner in both php , building custom wp themes. thank much. it's impossible search __ in search engine wordpress double underscore found answer in wordpress documentation: description retrieves translated string translate(). usage <?php $translated_text = __( $text, $d

SWIFT append data to dictionary -

i'm having trouble coding apparently simple task. want add new client profile data client profile dictionary (clientdatabase) keep getting errors - can't seem append - error: value of type '(string: clientprofile)' has no member 'append' (see error @ bottom of code) any insights can provide appreciated. thanks, bill //: playground - noun: place people can play import uikit import foundation /* code copied b-c dev database - structs simplified fewer variables goal getappend new client work. */ /* globals: these go in main.swift file */ struct clientprofile { var firstname: string = "" var lastname: string = "" var group: int = 0 } //var clientdatabase : nsmutabledictionary! = [string:clientprofile]() var clientdatabase:[string:clientprofile] /* sample data template: phone key, sub array is; (firstname: "", lastname: "",pilatesgroup: ) */ clientdatabase = [ "1234567": clientpro

php - Laravel 5 Throw an exception: BadMethodCallException with message 'Call to undefined method Illuminate\Database\Query\Builder::tags() -

i'm using laravel 5, , i'm bit new framework. searched lot problem, in return got nothing related. so, have 2 models: article , tag. in article model have method this: public function tags() { return $this->belongstomany("app\tag"); } and in tag model have method this: public function articles() { return $this->belongstomany("app\article"); } now thing when i'm testing in tinker this: $article->tags()->attach(1); it gives me following exception: badmethodcallexception message 'call undefined method illuminate\database\query\builder::tags()' but when i'm calling this: $tag->articles()->attach(1); it totally works charm , doesn't throw kind of exception whatsoever. i'm learning stuff laracast , classes , methods , files kind of this: badmethodcallexception message 'call undefined method illuminate\database\query\builder::belongtomany()' except think don't have typ

javascript - How to populate a group in mongoose -

i have in mongoose schema...with group... 'use strict'; var mongoose = require('mongoose') , schema = mongoose.schema; var clientschema = new mongoose.schema({ name : { type: string }, offerings : [{ type: string }], cscpersonnel : { salesexec : { type: schema.types.objectid, ref: 'user' }, accountgm : { type: schema.types.objectid, ref: 'user' }, }, }, netpromoterscore : { type: number } }); module.exports = mongoose.model('clients', clientschema); i tried populate reff dis way...i have populated in ref (user {path:'cscpersonnel'}) function getonebyid(id){ var deferred = q.defer(); console.log("im in id" +id); model .findone({ _id: id }) .populate({path:'cscpersonnel'})//one way /* 'cscpersonnel salesexec', //second

python - numpy boolean indexing multiple conditions -

i have 2 dimensional numpy array , using python 3.5. starting learn boolean indexing way cool. can 2 dimensional array, arr. mask = arr > 127 arr[mask] = 0 this works perfect trying change logic use boolean indexing for x in range(arr.shape[0]): y in range(arr.shape[1]): if arr[x,y] < -10: arr[x,y] = 0 elif arr[x,y] < 15: arr[x,y] = arr[x,y] + 5 else: arr[x,y] = 30 i tried multiple conditional operators indexing following error: valueerror: boolean index array should have 1 dimension boolean index array should have 1 dimension . i tried multiple versions try work. here 1 try produced valueerror. arr_temp = arr.copy() mask = arry_temp < -10 mask2 = arry_temp < 15 mask3 = mask ^ mask3 arr[mask] = 0 arr[mask3] = arry[mask3] + 5 arry[~mask2] = 30 i received error on mask3. new know code above not efficient trying work out it. any tips appreciated.

Generating Unique Random Numbers in Java -

i'm trying random numbers between 0 , 100. want them unique, not repeated in sequence. example if got 5 numbers, should 82,12,53,64,32 , not 82,12,53,12,32 used this, generates same numbers in sequence. random rand = new random(); selected = rand.nextint(100); add each number in range sequentially in list structure. shuffle it. take first 'n'. here simple implementation. print 3 unique random numbers range 1-10. import java.util.arraylist; import java.util.collections; public class uniquerandomnumbers { public static void main(string[] args) { arraylist<integer> list = new arraylist<integer>(); (int i=1; i<11; i++) { list.add(new integer(i)); } collections.shuffle(list); (int i=0; i<3; i++) { system.out.println(list.get(i)); } } } the first part of fix original approach, mark byers pointed out in answer deleted, use single random instance. th

Scala - Implicit conversion to implicit argument -

i have class a defines implicit conversion b . case class a(number:int) case class b(number:int, tag:string) implicit def atob(a:a) = b(a.number,"hello world") i have function retrieves a , invoke function takes argument implicit b : def hello()(implicit b:b)= {....} def execute = { implicit val a:a = .... hello() //doesnt compile missing implicit parameter b } how can code work without explicitly defining b ? i.e val b:b = define function this: implicit def implicitbfroma(implicit a: a): b = and either have in scope when call hello , or put companion object of b . this function not implicit conversion. states, there implicit value of type b available, if there implicit value of type a available in scope. note work, should either defined after atob in file, or atob should have explicitly specified return type: implicit def atob(a:a): b = b(a.number, "hello world") , or should explicitly call atob in body: implicit d

Android/Java creating a helper class to create graphs -

goal: to create helper class graph generation background: i have 3 fragments each collect sensor data (accelerometer, gyroscope, rotation) , plots graph using graphview. here code looks 1 of fragments (this code works correctly): public class gyroscopefragment extends fragment implements sensoreventlistener { private final short type_gyroscope = sensor.type_gyroscope; private final short poll_frequency = 100; //in milliseconds private final short max_points_displayed = 50; private sensormanager sensormanager; private sensor sensor; private sensor gyroscope; private long lastupdate = -1; float curgyrox; float curgyroy; float curgyroz; private linegraphseries<datapoint> gyroxseries; private linegraphseries<datapoint> gyroyseries; private linegraphseries<datapoint> gyrozseries; private double graphxtime = 1d; public gyroscopefragment() { // required empty public constructor } @o