Posts

Showing posts from May, 2015

java - Hibernate entity virtual column error? -

i have defined virtual column distanceinkm in entity distance calculation , giving response user along distanceinkm virtual column not column in table,and it's working (case 1) . now using same entity fetching values table getting com.mysql.jdbc.exceptions.jdbc4.mysqlsyntaxerrorexception: unknown column 'restaurant0_.distanceinkm' in 'field list' . (case 2) i came know usage of @transiant annotation virtual columns used calculation.but if using virtual column not serialized/added user response in (case 1) .i need implement both api ie , case 1 & case 2 using 1 entity @entity @table(name = "restaurants") public class restaurants implements serializable { private static final long serialversionuid = 1l; @id @generatedvalue(strategy = generationtype.identity) @column(name = "restaurant_id") private int restaurantid; @column(name = "restaurant_name") pr

google maps - Javascript setter function -

i creating class function in js following create new google maps. i have problem having default value zoom variable , able change after object has been created. here piece of code of function: function gmap(lat,lng){ this.latitude = lat; this.longitude = lng; this.mapcenter = new google.maps.latlng(lat, lng); this.map = null; this.zoom = 20; // default value this.setzoom = function(value) { this.zoom = value; } this.getzoom = function() { return this.zoom; } this.mapoptions = { center: this.mapcenter, zoom: this.zoom }; this.createmap = function(htmlelement) { map = new google.maps.map(document.getelementbyid(htmlelement), this.mapoptions); return this.map; } } i calling above this: var gmap= new gmap(10, 20); gmap.setzoom(9); console.log(gmap.getzoom()); //returns 9 google.maps.event.adddomlistener(window, 'load', gmap.createmap('map

inno setup - InnoSetup: FileSize -

i need size of file. need check if file more 100b example: if filesize('c:\program files\myprogramm\myapp.exe') > 100 msgbox ('file more 100', mbinformation,mb_ok) else msgbox ('file less 100', mbinformation,mb_ok) i function filesize(const name: string; var size: integer): boolean; , it's work if need check - size correct or not. cann't check on more or less the var keyword in function prototype means need declare variable of given type , pass function. variable receives value. here example filesize function: var size: integer; begin // second parameter of filesize function defined 'var size: integer', // need pass there variable of type integer, size variable // declared above if filesize('c:\thefile.any', size) begin if size > 100 msgbox('the file bigger 100b in size.', mbinformation, mb_ok) else msgbox('the file smaller 100b in size.', mbinf

c# - Selenium webdriver - driver.Navigate on same page -

i doing testings, .net webdriver. the first test, opens windows ok, , next steps, want using same (current web page), , not opening new window browser each time. my code driver.navigate().gotourl(baseurl + "/tableaubord"); everytime, need tests of suite link, open me new window, , test fail. i found codes driver.to()...but compiler doesn' t propose choice. can me out cheers you check system properties possible solution e.g. system.setproperty("restart.browser.each.scenario", "false"); might you. otherwise try properties using system.getproperties().tostring() and check if there property fits need (or maybe find list properties via google).

java - Valid members of polymorphic array of an Interface type -

following sample class design hope me ask question: public interface foo { int somemethod(); } public abstract class bar implements foo { public int somemethod() { return 1; } } public class baz extends bar { } public class quz extends bar { public int somemethod() { return 2; } } public class norf extends baz { public static void main(string[] args) { foo[] arr = new foo[4]; // code take advantage of polymorphism } } in norf class , have created polymorphic array of type foo (which interface). trying understand objects of classes allowed member/element of array. from understand , if making polymorphic array of class , objects created sub-class (any of descendant in inheritance tree) can member of array. i trying formulate rule polymorphic array of interface. coming sample class design , following seems valid (i typed out in ide , did not complain) arr[0] = new baz(); arr[1] = ne

c# - Executing powershell threads in IIS as impersonated user -

Image
i've been working on web application makes use of powershell scripts. reason, asp.net impersonation, getting "access denied" errors on commands require elevated access. the web application deployed via iis 7.5 running on windows 2008 r2 standard sp1 server. i've checked exception logged in event viewer , noticed account being used in spawned thread network service account : from can tell, means impersonation not being carried powershell cmdlet threads. confident user impersonated should have access run script looks permissions being used of network service account not goal. i've made following changes aspnet.config file suggested in few articles i've read no avail: <legacyimpersonationpolicy enabled="false"/> <alwaysflowimpersonationpolicy enabled="true"/> here's snippet of asp net c# code explain situation: //create runspace runspaceconfiguration psconfig = runspacec

powershell - Detect application close based on app user's name -

been trying create script detect user's application crash. (assume computer used multiple users) so far managed come out below code query application (based on user name) not app close or crash gwmi -query "select * win32_process name='calc.exe'" | %{if($_.getowner().user -eq 'myuser'){ #do when app crash }} you can use register-wmievent cmdlet register event win32_processstoptrace event class. the win32_processstoptrace doesn't have getowner() method, can use current code gather process id's of processes you're interested in, , use in event query: $username = 'myuser' $processname = 'calc.exe' $pidfilters = get-wmiobject -query "select * win32_process name='$processname'" |where-object { $_.getowner().user -eq $username } |select-object -expandproperty processid |foreach-object { "processid={0}" -f $_ } $wmifilter = $pidfilters -join " or " now, have

javascript - How to combine two select fields in a form -

i'm trying combine values of 2 select fields in form single variable before submitting form. here of code: in new.html.erb (for ror): <%= form_for :character, url: characters_path, method: :post |f| %> <p> <%= f.label :alignment %><br> <%= f.select :alignment_lr, options_for_select([" ","chaotic","neutral","lawful"], disabled: " ", selected: " ") %> <%= f.select :alignment_ud, options_for_select([" ","good","neutral","evil"], disabled: " ", selected: " ") %> </p> <% end %> this generates following html: <p> <label for="character_alignment">alignment</label><br> <select id="character_alignment_lr" name="character[alignment_lr]"> <option disabled="disabled" selected="selected" value=" "

php - Database array into single user defined variables -

im trying setup dynamic settings database cms database set 2 columns. name | value template | exige installfolder | v2 basically want pull data out , put different variables. for example i'm trying set base_folder(installation folder) variable. so $base_folder = $coresettings[1] output should show (v2) $sql = "select * core_settings"; $query = mysqli_query($dbc, $sql) or die (mysqli_error($dbc)); $coresettings = array(); while($row = mysqli_fetch_assoc($query)){ // add each row returned array $coresettings[] = $row; } $base_folder = $coresettings; foreach( $coresettings $key => $val) { $$key = $val; } var_dump($base_folder); this outputs: array(5) { [0]=> array(2) { ["name"]=> string(8) "template" ["value"]=> string(5) "exige" } [1]=> array(2) { ["name"]=> string(13) "installfolder" ["value"]=> string(2) "v2" } [2]=> array(2) { [

dictionary - How to add custom map and custom data to Highmaps? -

i struggling including custom map custom data highmaps. sure it's pretty dumb thing, can't find examples , explanations on web. i have json file data, , geojson file map. so, this: $(function () { $.getjson('http://xxx/data/p_.json', function (data) { // initiate chart $('#container').highcharts('map', { series : [ { data : data, mapdata: 'http://www/data/countries.geojson', joinby: ['name', 'countries'], }] }); }); }); but quite wrong. how add custom mapdata? thanks help! there instruction how create custom geojson: http://www.highcharts.com/docs/maps/custom-geojson-maps in 9. there link jsfiddle show how geojson file should parsed used highchart

android - How to switch between buttons after a specific time interval? -

i creating android app(am beginner) in phone dialer screen, buttons have highlighted 1 one after given time interval sequentially.i using android studio. thanks in advance.:) a suggestion either using handler or timer : new android.os.handler().postdelayed( new runnable() { public void run() { // paint button x } }, 5000); or using new timer().scheduleatfixedrate(new timertask(){ @override public void run(){ // paint button x } }, 0, 5000);

How to configure server location for surveymonkey -

in countries servers surveymonkey located? possible configure location of server, customers answers surveys surveymonkey stored? security department of our german company accepts servers, located in western europe sure, european right protects customers data. i got answer via mail surveymonkey-support - copy here other users same question: "unfortunately, @ time, of our survey data stored on servers located within us, , wouldn't able host information on servers or outside servers."

php - Cgridview row update and version number increase -

i new in php & using yii framework.can 1 please me issue facing.i have grid view page update button.when update information of row in grid view works fine.but if mistake enter wrong entry , want update information should first check if there entry of data before.if there data entry before, version number increase id. , if there no data entry before there create new data new id. here controller update action code: public function actionupdate($id) { $model=new cvupload; $updatemodel= new cvupload; $model=$this->loadmodel($id); $cvhistory=new cvhistory; if(isset($_post['cvupload'])) { $model_unchanged = $this->loadmodel($id); $model_changed = $this->loadmodel($id); $model->attributes=$_post['cvupload']; $updatemodel->attributes=$_post['cvupload'] if ($model_unchanged->user_id == $_post['cvupload']['user_id'] && $model_unchanged->job_ti

javascript - Open iframe page in its parent when a direct link is to one of the child pages -

hi have multiple pages reside in iframe , them open in parent page when search engine indexes them or people directly link them. example: -this page parent page , have iframe -this first page.php -then there second page.php, third page.php, fourth page.php, ect. i if linked of pages require iframe load parent page iframe , load url iframe. if links third page load parent page , load third page in iframe. i have tried following scripts have found posts across web load parent page original src in frame. <script language='javascript'> try { if (top == self) { top.location.href = 'parent page.php'; } } catch(er) { } </script> and <script type="text/javascript"> if (window == top) { var url = 'window.location.replace("parent page.php?var1=' + window.location.href + '")'; eval(url); } </script> i tried: <body onload="refres

javascript - Strip all unwanted tags from html string but preserve whitespace in JS -

i trying strip html content of unwanted tags , return text basic formatting (ul, b, u, p etc) or plain text (but preserving new lines, spacing etc) having trouble creating catch solution let me keep structure of content pasted. example string: <p class="bodytext" style="color: rgb(51, 51, 51);background-color: rgb(255, 255, 255);"> <span lang="en-gb">hello <span class="apple-converted-space"> world,   </span> <span class="cross-reference"> <a href="" style="color: rgb(66, 139, 202);background-color: transparent;">cough </a> </span> <span class="apple-converted-space"></span>and <span class="apple-converted-space"></span> <span class="cross-reference"> <a href=""

php - ZfcTwig is not loading config and fails in bootstrap -

hi relatively new zf2 might simple mistake making. problem when loading zfctwig module exception fatal error: uncaught exception 'zend\servicemanager\exception\servicenotfoundexception' message 'zend\servicemanager\servicemanager::get unable fetch or create instance twig_environment' in /www/zendframework2/library/zend/servicemanager/servicemanager.php on line 555 this exception thrown in onbootstrap function of zfctwig\module.php : <?php class module implements bootstraplistenerinterface, configproviderinterface { public function onbootstrap(eventinterface $e) { /** @var \zend\mvc\mvcevent $e*/ $application = $e->getapplication(); $servicemanager = $application->getservicemanager(); $environment = $servicemanager->get('twig_environment'); // throws exception //... } public function getconfig(){ return [/*...*/]; } // never called } what don't why bootstrap called before configuration l

Excel VBA close function only saves to desktop, how do I change the save location? -

i have excel file in floder thats inside folder, on desktop. using dimbook.close savechanges:=true with dimbook current workbook in order close , save workbook, , works fine, except expected save same folder workbook using macro, when in fact saves desktop. how can specify save location? thanks change use save functionality: dimbook.saveas filename:="c:\path" then dimbook.close //etc etc

dataframe - Fast way to "translate" a column of variables in R using a lookup table -

this question has answer here: how join (merge) data frames (inner, outer, left, right)? 12 answers starting use r in data analysis, still relative newbie. have data frame looks this: locations loc idnum 100000001 1 100000009 7 100000021 3 100000004 2 100000017 3 100000007 7 100000067 5 and matrix list of id numbers (from second column) , corresponding strings (like translation table of sorts). looks similar this: names idnum idnames 1 nnw43 2 n3 3 se21 4 sw54 5 w6 6 w12 7 ne10 ... so matrix shorter because each id number has corresponding string, in original data frame there more 1 loc contain same idnum. i'm sure there easy way match each id number string , create new data frame first column same second containing strings instead of id numbers, i'm not sure is. know i'm told if use loops in r you're doing wrong. result

convert HEX string to Decimal in arduino -

i have hex string : "0005607947" , want convert decimal number , test on this site , correctly convert decimal number , answer : "90208583" when use code wrong value ! of code wrong or did have 1 , new code problem ? long int decimal_answer = getdec("0005607947") ; long int getdec(string str110) { long int id = 0 ; int len = str110.length() ; char buff[len] ; int power = 0 ; for(int = 0 ; <len ; i++) { buff[i] = str110.charat(i); } for(int = (len-1) ; >=0 ; i--) { int num = buff[i] - '0' ; id = id + num * pow(16 , power) ; power = power + 1 ; } serial.println(string(id , dec)); return id ; } // , use , error : invalid conversion 'void*' 'char**' [-fpermissive] unsigned int size = sizeof(f_value) ; char charbuf[size]; f_value.tochararray(charbuf , size); long decimal_answer = strtol(charbuf , null , 16); serial.println(decimal_answer , dec); drop code,

asp.net mvc - Retrieving associated elements based on ID in entity query -

i have entity query groups number of property reviews property. im having trouble query pull rest of data on property based on propertyid. thanks! example results: |propertyid | numofreviews | streetaddress | city | 1 14 1600 speaker st. miami query: var query1 = r in db.reviews group r r.propertyid g select new { propertyid = g.key, numofreviews = g.count() //get rest of data }; property model: public partial class property { public int propertyid { get; set; } public string streetaddress { get; set; } public string city { get; set; } public string zip { get; set; } public string state { get; set; } public string country { get; set; } public string route { get; set; } public virtual icollection<review> reviews { get; set;

collate - SQL Server '=' comparator Query case-sensitivity -

which of these 2 queries preferred , why? declare @value1 varchar(16) = 'hello' ,@value2 varchar(16) = 'hello' ,@a int = 0 if convert(varbinary(max), @value1) = convert(varbinary(max), @value2) set @a = 1; if @value1 = @value2 collate latin1_general_cs_ai set @a = 2;

javascript - How come "minus, space, minus" evaluates to the "plus" operator? -

node -e 'console.log(- -1)' // prints 1 makes sense however: node -e 'console.log(1 - - 1)' // prints 2 not make sense me integer - - integer magically converts "minus, space, minus" "plus" operator. why? update: seems wasn't clear enough. question not why double negative in mathematics evaluate positive how magically evaluates + operator; these 2 different scenarios - making negative number positive 1 thing, invoking implicitly + thing. makes perfect sense, double negative in mathematics evaluate positive

javascript - Cannot Load Routes in ./src/routes/index.js from ./app.js -

very new nodejs here. i've tried put routes in app.js without problem. however, after moving routes separate file under project_dir/src/routes/index.js , , open page in browser says "cannot /wines ". here's code in app.js , src/routes/index.js : // app.js var express = require('express'); var app = express(); var path = require('path'); global.app = express(); require('./src/routes/index'); // tried: require(path.join(__dirname, './src/routes/index')); global.server = app.listen(3000, '0.0.0.0', function () { var host = server.address().address; var port = server.address().port; console.log('example app listening @ http://%s:%s', host, port); }); // ./src/routes/index.js // tried console.error(app); , printed stuff app in server log app.get('/wines', function(req, res) { res.send([{name:'w1'}, {name:'w2'}]); }); app.get('/', function (req, res) { res.send('hel

WebGL position different on desktop and android phone -

Image
i'm trying create website contains webgl canvas. worked fine , got plane rendered, when opened website on samsung galaxy siii mini, planes origin point seems different you can check website @ http://portfolio.kamidesigns.be canvas located under thesis -> occluder simplification using planar sections here images show what's wrong. desktop cellphone the plane on cellphone located on top right corner although positions of vertices of plane are var positions = new float32array([-0.5, 0.5, 0, -0.5, -0.5, 0, 0.5, 0.5, 0, 0.5, -0.5, 0]); if can me, appreciated. you have bunch of typos in code prevent vertex array object being created properly. leads "default values" being fed through vertex pipeline resulting in different behavior on different browsers. firstly, change vao initialization ( missed var vao initialization): function cr

What is a target end point in reference to apigee? -

Image
could 1 explain me target end point reference apigee. related virtual hosting? i tried go through apigee docs , community didnt found useful a target endpoint apigee internal representation of "backend" functionality. i.e. have backend service (a.k.a. target endpoint) myserver.com/getaccounts point apigee @ , use functionality (via proxy endpoints) part of api apigee provides. apigees official description : " targetendpoint outbound equivalent of proxyendpoint. targetendpoint functions http client backend service or api " see here

php - Moving html data from mysql (wordpress) to sqlserver -

i upgrading website asp.net have @ least 100k posts in wordpress. not find related topic moving wanted share experience. big data not problem, however, of wordpress tables have html data containing quotes (both single , double), &nbsp's, tab characters , on. have tried many ways both exporting however, exporting sql file not work me (at least, not able work it, causes many troubles). best way move data exporting csv files, seperately each table. while exporting, have to: custom export different , unique strings both "columns separated with" , "columns enclosed with" (i used ############ , @@@@@@@, respectively) check "remove carriage return/line feed characters within columns" check "put columns names in first row" download export file after downloading, replacing take place: tabs spaces \t -> space double quotes single " -> ' ###### -> \t @@@@@@@ -> " finally, encoding conversio

apache zookeeper - Cannot see znodes added from Java application (DigestLoginModule) -

when adding znode java application, exhibitors explorer cannot show me status of node. error got is: keepererrorcode = noauth /z/node/path . on other side, when add znode rest api ( put www.my-zookeeper.com//exhibitor/v1/explorer/znode/z/node/path ) works correctly. in opinion problem might be, because java client using digestloginmodule authentication. client { org.apache.zookeeper.server.auth.digestloginmodule required username="my_user" password="my_password"; }; also woth mentioning when try analyze node in exhibitor error: problem accessing /exhibitor/v1/explorer/analyze. reason: keepererrorcode = noauth /z/node/path caused by: org.apache.zookeeper.keeperexception$noauthexception: keepererrorcode = noauth /z/node/path @ org.apache.zookeeper.keeperexception.create(keeperexception.java:113) @ org.apache.zookeeper.keeperexception.create(keeperexception.java:51) @ org.apache.zookeeper.zookeeper.getchildren(zookeeper.java

javascript - formvalidation jquery form group -

i using formvalidation plugin: have form-group, inside of 2 input fields, 1 being validated 1 not. yet when click validate red border applied in form-group though should not validated. any ideas why? <div class="form-group"> <div class="row"> <div class="col-xs-4"> <input type="text" class="form-control" name="phonenumber" placeholder="phone" /> </div> <div class="col-xs-4"> <input type="text" class="form-control" name="rooms" placeholder="# of bedrooms" /> </div> </div> </div> http://jsfiddle.net/k281at67/48/ update add each object , works wish. row: '.col-xs-4', as in phonenumber: { row: '.col-xs-4', // adding each object fixes issue. validators: { country: 'united states', ...

Taking photo in android -

hi developing app camera functionality surfaceview. want take picture when surface view created. in fragment's oncreateview method, initialized need. @override public view oncreateview(layoutinflater inflater, viewgroup container, bundle savedinstancestate) { // inflate layout fragment view = inflater.inflate(r.layout.game_one_start_fragment, container, false); initwidgets(view); return view; } in initwidgets() method initialized surfaceview object below msurfaceview = (surfaceview) view.findviewbyid(r.id.game_action_surfaceview); msurfaceholder = msurfaceview.getholder(); in onresume() method getting surfaceholder object. @override public void onresume() { super.onresume(); msurfaceholder.addcallback(this); msurfaceholder.settype(surfaceholder.surface_type_push_buffers); safecameraopen(camera.camerainfo.camera_facing_back); } safecameraopen() have f

PHP script send several emails when Outlook 2010 downloads an image -

using outlook 2010, insert image message intend send. insert image’s url (that points php file shown below) followed “insert” “link file”. the image displayed correctly in message area of mail. however, php script sends several emails instead of single 1 when image downloaded , displayed in outlook message area. looks outlook making serval retries load image. please me how fix problem , make script send single email. php code provided below: <?php // show image in browser/email client. $logo = "http://www.example.com/logo.gif"; // set image full path readfile($logo); // send test email ini_set( 'display_errors', 1 ); error_reporting( e_all ); $from = "abc@isp1.com"; $to = "def@isp2.net"; $subject = "test email"; $message = "this test check image download"; $headers = "from:" . $from; mail($to,$subject,$message, $headers); ?>

python - Calling a Flask REST service method in different OS with curl -

i wrote following post method rest api, built using flask. method receives 1 parameter, radio station url. @app.route('/todo/api/v1.0/predvajaj', methods=['post']) def create_task(): print "expression value: " + str(not request.json or not 'title' in request.json) if not request.json or not 'title' in request.json: abort(400) link=request.json['title'] print "link value: " + link cmd = "pkill sox" os.system(cmd) time.sleep(2) #link = "http://www.radiostationurl.m3u" cmd = "sox -t mp3 " + link + " -t wav -r 22050 -c 1 - | sudo ../pifm - 90.5 &" os.system(cmd) return jsonify({'status': "ok"}), 201 the api runs on raspberry pi ip address: 192.168.0.200. tried testing method locally (on pi), using curl tool. worked fine: curl -i -h "content-type: application/json" -x post -d '{"title&qu

android - Finding substring at the end of line in shell -

i new shell scripting. when write adb shell ps | grep "org.mozilla.fennec" u0_a52 908 57 557664 144820 ffffffff b6f755cc s org.mozilla.fennec and u0_a52 1083 57 243108 23824 ffffffff b6f755cc s org.mozilla.fennec.updateservice the problem need first line. tried adb shell ps | grep "org.mozilla.fennec$" surprisingly shows nothing. i need second field of first line. how can using grep? appreciated. thanks. to print 2nd field can use awk : adb shell ps | awk -v rs='\r' '$nf == "org.mozilla.fennec"{print $2}' to print whole line: adb shell ps | awk -v rs='\r' '$nf == "org.mozilla.fennec"'

XCT Testing of IBActions and IBOutlets Swift (Optionals) -

i wondering best way test iboutlets , ibactions in swift due ibactions being optionals. i rewriting project wrote in swift time want use xct unit testing. i have run small problem regarding testing of iboutlets , ibactions. here code: override func setup() { super.setup() storyboard = uistoryboard(name: "main", bundle: nil) mainmenuviewcontroller = storyboard.instantiateviewcontrollerwithidentifier("mainmenuviewcontroller") as! mainmenuviewcontroller let dummy = mainmenuviewcontroller.view // force loading subviews , setting outlets mainmenuviewcontroller.viewdidload() } override func teardown() { // put teardown code here. method called after invocation of each test method in class. super.teardown() } func testwhethertranslationgamemodebuttonexists() { xctassert(mainmenuviewcontroller.translatebutton != nil, "translate button should exist @ times"); } func testwhethertranslategamemodebuttontitleiscorrect() {

java - how can I count the number of exception thrown by threads? -

i have code: @test public void setusernamepropertyfrommultithreadsupdatescorrectly() throws exception { boolean oldval = usersconfig.s.no_db_mode; final list<string> lastname = new arraylist<string>(); usersconfig.s.no_db_mode = true; string user1 = testutils.generateusername(); final long createdid = testutils.createuserwithproperties(immutablemap.of("username", user1, "a", "a1", "isstaff", "true")); list<callable<void>> callables = new arraylist<callable<void>>(); (int = 0; < 20; i++) { callables.add(new callable<void>() { @override public void call() throws exception { string user2 = testutils.generateusername(); boolean issuccess = usersserveraccess.setproperties(createdid, immutablemap.of("isstaff&

ios - How to override mutable property from a superclass -

class arcanecardvc: uiviewcontroller { var currentcard: arcanecardview? } class postvc: arcanecardvc { override var currentcard: postcard? // <===== want cant } class arcanecardview: uiview { } class postcard: arcanecardview { } here error get: cannot override mutable property 'currentcard' of type 'arcanecardview?' covariant type 'postcard?' the other solution explicitly doing in code everytime use currentcard: var card = currentcard as! postcard the correct way way you're doing currentcard as! postcard . another option use property getter like // inside postvc // note camel case on 'c' makes different variable super class var currentcard: postcard { { return self.currentcard as! postcard } } then you'd use self.currentcard instead of self.currentcard as! postcard

vba - Input values in a column according to the reference from another column of the same sheet -

hi have problem in inputting values column conditions , referring other 2 or more columns determine input of other column using vba. example there 3 columns called rag cost (c), rag resources (r) , rag benefits (b). 3 columns determine input value in column called overall rag using vba. example if column (c) or column (b) contains value"r" , overall rag status input "a" in respective rows. tried using if else statement doesn't seems work. make clearer example: if rag cost(c) or rag resources(r) values = "r" overall rag status= "a". you don't need vba can write simple formula =if(iserror(match("r",b2:d2,0)),"","a") if want code please try sub rgb() dim lstrow long dim long dim lastcol long dim j long lstrow = range("b" & sheets("sheet1").rows.count).end(xlup).row lastcol = sheets("sheet1").cells(1, sheets("sheet1").columns.count).end(xltoleft).col

matlab - Apply the same function multiple time with different sets of arguments -

Image
here part of function, want past 4 sets of data function blood_type . in each set, 1 of arguments numeric , character . for output type , vol , each of them 3d-matrix of size 80*80*2 . i want have neat way such can obtain all_type result concatenating 4 outputs of blood_type (each type each patient_id , patient_name ). all_type = cat(3, type1, type2, type3, type4) similarly, want have all_vol = cat(3, vol1, vol2, vol3, vol4) instead of writing: [type1 vol1] = blood_type(1, 'ann'); [type2 vol2] = blood_type(2, 'ben'); [type3 vol3] = blood_type(3, 'chris'); [type4 vol4] = blood_type(4, 'david'); are there ways can choose pair of arguments , produce outputs more efficient? because have hundreds of patients , cumbersome if type hundreds of times names , ids. thanks in advance. here's approach, using cellfun ; %'the arguments of function need typed once anyways' patient_id = {1,2,3,4}; patient_name = {&#

row - R dplyr rowwise mean or min and other methods? -

how can dplyr minimum (or mean) value of each row on data.frame? mean same result as apply(mydataframe, 1, mean) apply(mydataframe, 1, min) i've tried mydataframe %>% rowwise() %>% mean or mydataframe %>% rowwise() %>% summarise(mean) or other combinations errors, don't know proper way. i know use rowmeans, there no simple "rowmin" equivalent. there exist matrixstats package functions don't accept data.frames, matrixes. if want calculate min rowwise use do.call(pmin, mydataframe) there simple rowwise mean? do.call(mean, mydataframe) doesn't work, guess need pmean function or more complex. thanks in order compare results work on same example: set.seed(124) df <- data.frame(a=rnorm(10), b=rnorm(10), c=rnorm(10)) i suppose trying accomplish: df <- data.frame(a=rnorm(10), b=rnorm(10), c=rnorm(10)) library(dplyr) df %>% rowwise() %>% mutate(min = min(a, b, c), mean = mean(c(a, b, c))) #

javascript - jQuery $.post problems (Not sending variable to PHP) -

i came across little problem , struggling solve it... wondering if had ideas... have read lot of stackoverflow posts same issues, still can't solve mine. workin in codeigniter. i trying send variable php controller form view using jquery ($.post). here mine js code, embedded view: $('#testbtn').on('click', function() { var ordervalue = this.value; $.post('http://localhost/codeigniter/welcome/index', {val: 'myvalue'}, function(data) { alert(data); }); }); here php code in controller: $a = isset($_post['val']) ? $_post['val'] : 'not set yet.'; echo $a ; here button: <button id="testbtn" value="thevalue">button</button> the button clicked, alert message variable , html code of whole page, php echo doesn't change, still says: "not set yet.". basically seems easy, can't still find error... without diving code more, w

d3.js - wrong shadows at a parallel coordinates plot -

Image
i'm (still) working on representation of data using parallel-coordinates library github ( https://github.com/syntagmatic/parallel-coordinates#parallel-coordinates )(based on d3.js). at moment i'm facing problem there shadow wich shouldn't exist, after reorder axes. after upload of data website plot looks that: after reordering (switch first axes) plot looks that: here can see shadow between second , third axis, shouldn't there. other shadows work fine (as can see in following picture). there additional one. i checked api description of library if maybe use .shadows() method in wrong way, didn't find anything. although checked issues, stackoverflow , google didn't find helpful. here code: <link rel="stylesheet" type="text/css" href="imports/d3.parcoords.css"> <link rel="stylesheet" type="text/css" href="imports/style.css"> <script src="imports/lib/d3.min.js"&

vb.net - Import XSD targetNameSpace From another Visual Studio project -

i have vb solution many vb projects in it. 1 of them, "core" project, has .xsd file in targetnamespace of urn:customnamespace . in core project, able import xsd namespace doing following: imports <xmlns="urn:customnamespace"/> how can imports statement work in project references core project? in core, xsd's namespace shows intellisense. not case in referring project. i know can done somehow, consuming nuget package has xsd importing. ******** update ******** it looks namespace intellisense dll in nuget package coming configuration section designer xsd file, .csd.xsd file. there other related files this, want same functionality comes referencing package has .csd.xsd file. it looks vs add in located @ https://csd.codeplex.com/ . i'll pull down project try find out how they're doing it, i'd appreciate answer if knows how it's done. nuget adding schema file project referencing "core" project. can

r - Add a $hint to rmongodb query -

does know how add hint argument mongo query when using rmongodb package? note: hint deprecated. currently i'm using mongo.find.all query it's simplicity rather separate cursor , buffer commands. mongo.find.all(mongo = mongo, ns = "ops.weather", query = "{\"where.zip_code\":\"60603\", \"what.currently.time\":{\"$gte\":1430936418}}", sort = mongo.bson.empty(), fields = list(what.currently.time = 1l, what.currently.precipintensity = 1l, what.currently.temperature = 1l, what.currently.windspeed = 1l, what.currently.windbearing = 1l, where.zip_code = 1l, where.latitude = 1l, where.longitude = 1l, what.observation_type = 1

vb.net - save dropdownlist selectedvalue from datagridview -

i have datagridview of questions dropdownlist of possible answers each question. want save answerid (dropdownlist.selecteditem.value) @ click of btnsavequestions_click event. however, after trying, version of visual web developer 2010 not give me errors, when viewing in internet explorer (version 10.0.9200.17377, , yes company policy requires have usable in internet explorer) states @ line "dim answerid string = ddanswer.selectedvalue" not set instance of object. assistance appreciated. <asp:datagrid id="dgfacilityquestions_datagrid" runat="server" cssclass="dgblue" horizontalalign="center" width="90%" onitemcreated="dgfacilityquestions_datagrid_itemcreated" onitemdatabound="dgfacilityquestions_datagrid_itemdatabound" cellpadding="3" autogeneratecolumns="false"> <headerstyle backcolor="#a09cbf" /> <columns> <asp:boundcolumn datafiel