Posts

Showing posts from June, 2012

javascript - How to make a directive for adding sections in angular at runtime based on attribute value -

i have many sections and accordingly have different code maintained in html files home.html , about.html , want make angular custom directive render @ runtime and had tried making directive works first time not when using multiple times . need making directive app.directive('mysection', function() { return { restrict: 'e', transclude:true, templateurl: function(elem,attrs) { return "sections/"+attrs.templateurl +".html" } } }); and in html writing <mysection template-url="headersection"><mysection> <mysection template-url="headersection"><mysection> try markup <mysection template-url="headersection"></mysection> <mysection template-url="headersection"></mysection> note close tag

inheritance in java does not work the way I expected -

i have following class: public class x { public void a() { b(); } private static void b() { system.out.println("111111111"); } } now have following inherited class z: public class z extends x { private static void b() { system.out.println("22222222"); } } now if do z myclass = new z(); z.a(); i get: 111111111 result. (also, eclipse tells me b() in inherited class never called). why? , how can run inherited b method? the b methods static . when call method a uses implementation of class b (because that's method a defined). class b not aware of existence of class z , cannot call method of class z . because method static, it's not overridden upon inheriting b . polymorphism works instances of class. static method not play polymorphism game , cannot overridden.

How to keep higher level headings visible in org-mode -

in org-mode, there way keep higher level headings (superheadings, ancestors) visible move around buffer? i have structure lots of headings @ same level , i'd keep higher level headings contain them, scrolling off top of window move point down list. maybe horizontal split, point in lower window, , point's 'lineage' of headings in window above. the built-in which-function-mode display name of "function" in mode line. org-mode level 1 headline. if want full lineage can add function which-func-functions change how which-function determines function name.

android - Using an image streches dialog to full height -

i want use image dialog's background makes dialog high screen. checked this , this , this answers , suggest same it's not working me. <?xml version="1.0" encoding="utf-8"?> <relativelayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:cliptopadding="true" xmlns:android="http://schemas.android.com/apk/res/android"> <imageview android:src="@drawable/wood" android:cliptopadding="true" android:scaletype="fitxy" android:adjustviewbounds="true" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_aligntop="@+id/dialog_layout_main" android:layout_alignbottom="@id/dialog_layout_main" android:layout_alignleft="@id/dialog_layout_main" android:layout

javascript - "Cross origin requests are only supported for HTTP." error when loading a local file -

i'm trying load 3d model three.js jsonloader , , 3d model in same directory entire website. i'm getting "cross origin requests supported http." error, don't know what's causing nor how fix it. my crystal ball says loading model using either file:// or c:/ , stays true error message not http:// so can either install webserver in local pc or upload model somewhere else , use jsonp , change url http://example.com/path/to/model

sql - Grant Privileges for Oracle -

i want grant update privileges user tables within schema except update primary keys. there easy way it? or should separately each table , define each column. how work? im sure there easy way it. i'm reading documentation gives me generic examples. declare myquery varchar2(1024); begin rc in (select * user_tab_cols u not exists ( select * user_constraints c ,user_cons_columns cc c.constraint_type = 'p' , c.constraint_name = cc.column_name , u.table_name = cc.table_name , u.column_name = cc.column_name )) loop myquery := 'grant update ('||rc.column_name||') on '||rc.table_name||' myuser'; --dbms_output.put_line(myquery); execute immediate myquery; end loop; end; p.s. i'm not sure "all tables" in description means . in query tables within current schema, if need tables within database change user*** all***, i.e. user_constraints all_constraints, etc

java - Eclipse JUnit 5 support -

currently, junit 5 out "stable" version. intellij supports junit 5 according website. question if eclipse supporting junit 5 well, , if not when going supported. supported mean if can run junit 5 tests without need @runwith(platformrunner.class) annotation. edit october 2017: eclipse officially supports junit 5 of eclipse oxygen1.a (4.7.1a) you can run junit 5 tests in eclipse 4.7 oxygen after installing junit 5 support (beta) oxygen 4.7 plugin can find in eclipse marketplace. after complete eclipse restart, open project properties at java build path -> libraries -> add library -> junit -> junit 5

javascript - Toggle a hidden div when a particular dropdown option is either selected or de-selected -

Image
i able find example on stackoverflow wanted. however, when implement in code , select option display hidden div, hidden div not appear , not sure why. html: <td class="mm1" width="40%"> <br /> <ul> <li> <label for="name">please select company below:</label> <select class="selectmenu" id="select"> <option selected disabled class="hideoption">please select 1 company</option> <option value="0">rmg</option> <option value="1">lmg</option> <option value="2">csc</option> <option value="3">adoc</option> </select> <div id="hidden_div" style="color:#b9b9b9; display:none"> if adoc-does<br />posit

angularjs - Babel + Typescript + NPM Modules + Webpack -

hello try require angular typescript script, , error: error ts2307: cannot find module 'angular'. here webpack config file: context: __dirname + '/client/js', entry: './script.ts', output: { filename: 'build.js', path: options.build ? 'dist' : 'dev' }, module: { loaders: [ {test: /\.ts(x?)$/, loader: 'babel-loader!ts-loader'} ] } edit: then, in script.ts file, do: import angular 'angular'; or var angular = require('angular'); gives me same result i don't have tsconfig.json file thank ! i don't have tsconfig.json file you need tsconfig.json file. see ts-loader readme : https://github.com/typestrong/ts-loader#configuration example babel checkout : https://github.com/typestrong/ts-loader/issues/93

ios - Unable to create dedicated App ID for Watch Extention -

i'm having trouble creating dedication appid watch extension. so far app , corresponding watch app worked perfectly. had app id configured using bundle id similar following format: xx.yyyyy.appname , , watchkit app & extension using wildcard appid relevant (and suggested) bundle id of xx.yyyyy.appname.watchkitextension , xx.yyyyy.appname.watchkitapp , great. i found out need change current behaviour of apple watch app share data parent app, , in order had enable app groups capabilities, found i'm not able watchkitextension (apparently app group capabilities required explicit app id rather wildcard app id). realising don't have dedicated app id went member centre , tried make 1 unsuccessfully. following apple's guidelines i'm trying create app id same prefix of xx.yyyyy.appname following .watchkitextension . this results in following error message: an app id identifier 'xx.yyyyy.appname.watchkitextension' not available. please enter

C# No Arguments Being Passed to Main -

i have been trying arguments passed main method in c#. want capture file path double clicked. have files custom extension , when runs open program. part works. static string file = ""; [stathread] static void main(string[] args) { application.enablevisualstyles(); if (args.length > 0) file = args[0]; application.run(new form1()); } public form1() { initializecontrols(); } i tried way, not different. static string file = ""; [stathread] static void main() { application.enablevisualstyles(); string[] args = environment.getcommandlineargs(); if (args.length > 0) file = args[0]; application.run(new form1()); } public form1() { initializecontrols(); } its worth mentioning have in partial class. don't know if effects directly or not. i don't need args if can file double clicked feel way, , curious. wh

php - Close backend with AccessControl -

i can trying simple code. i have accesscontroller having behaviors(): class accesscontroller extends backendcontroller { public function behaviors() { return [ 'access' => [ 'class' => accesscontrol::classname(), 'rules' => [ [ 'allow' => true, 'roles' => ['@'], ], ] ], ]; } /*public function init() { parent::init(); if( yii::$app->getuser()->getisguest() ) { return $this->redirect('/auth'); } return true; }*/ public function actions() { return [ 'wysiwygupload' => [ 'class' => wysiwygupload::classname(), ] ]; } } as understand, if didn't declare 'only' key, mean to all actions , controllers. but nothing happen: no 1 error, nothing your controller accesscontroller work yourapp/backend/a

python - Grouping the values of all columns by index of a pandas dataframe -

Image
i want build distribution of total no. of videos user has watched. watch signified 1 else 0. users index of data frame. assume data this: a b c user1 1 1 0 user2 0 1 0 user3 1 0 1 i want each use count of 1 in row. i doing doesn't seem work. dont want use applymap function seem slow. d.groupby(d.index).sum(axis=1) gives error axis not recognized if have duplicates in index, can use groupby double sum : print (df) b c user1 1 1 0 user1 1 1 1 user2 0 1 0 user3 1 0 1 print (df.groupby(df.index).sum().sum(1)) user1 5 user2 1 user3 2 dtype: int64 if there no duplicates, use sum - psidom comment : df.sum(axis=1) edit: import matplotlib.pyplot plt df.sum(axis=1).plot.hist() plt.show()

stl - C++ - how to tell whether a key exists in map of maps -

i have following structure: std::map<int, std::map<int, int>> my_map; i want check whether key my_map[3][5] exists. is there easier/shorter way except like: if (my_map.find(3) != my_map.end()) { std::map<int, int>& internal_map = my_map[3]; if (internal_map.find(5) != internal_map.end()) { // ... ... } } you improve little via: std::map<int, std::map<int, int>>::iterator = my_map.find(3); if (it != my_map.end()){ if (it->second.find(5) != internal_map.end()) { } } in current solution, finding key twice , slower finding once , store in iterator.

Dev c++ expected `;' before "to", expected `)' before ';' token -

#include <cstdlib> #include <iostream> using namespace std; int main(int argc, char *argv[]) { int size = 10; int numbers[size]; int i; int j; int temp; for((i = 0) (size - 2)) { for((j = 0) (size - 2)) { if(numbers[j] < numbers[j + 1]) { temp = numbers[j] numbers[j] = numbers[j+1] numbers[j+1] = temp } } } cout << "sorted list"; cout << "==========="; for((i = 0) (size - 1)) { cout << "number ", + 1, ": ", numbers[i] } system("pause"); return exit_success; } i keep getting: line 18 & 34: expected ;' before "to" line 32: expected )' before ';' token i can't figure out why. appreciated! you have missed ; in code (and few others). try

java - How to extract the 4 digit numbers using a regex -

i want extract numbers after company_id: part , store in variable. string looks following. string company ="{\"company_id\":4100\"data\" \"drm_user_id\":572901936637129135\"company_id\":3070,\"data\",\"company_id\":4061,\"data\"}" in case, regex extract numbers 4100 , 3070 , 4061 . have many other numbers on string, did not include them save space. numbers want ones 4 digits , come after company_id: part. tried following pattern pattern = pattern.compile("(\\d{4})"); matcher matcher = pattern.matcher(company); however, returns first digit , not other two. you can retrieve company ids using regex \"company_id\":(\\d{4}) . makes sure numbers after "company_id" element. captures in group. string company ="{\"company_id\":4100\"data\" \"drm_user_id\":572901936637129135\"company_id\":3070,\"data\",\&qu

Python-Django cannot interpret the id in an URL and give "<built-in function id>" instead of redirecting on the rigth page -

i have simple app creates events , add attendees them built django 1.8. work on virtualenv python3. when create event, i'm redirected detail page of event , have possibility add attendees. when add one, django cannot redirect me page of event, cause cannot interpret id , gives me <built-in function id> . my app event : models.py class event(models.model): name = models.charfield("event title", max_length=255) organizer = models.foreignkey(user) attendees = models.manytomanyfield(user, verbose_name="attendees", blank=true, through="eventattendees", related_name="%(app_label)s_%(class)s_attendees") def get_absolute_url(self): return reverse('event:detail', kwargs={'pk':self.pk}) def delete_url(self): return reverse('event:delete', kwargs={'pk':self.pk}) def update_url(self): return reverse('event:update', kwargs={'pk':self.pk}) def __str__(self):

javascript - Bars not displayed in d3 bar graph -

Image
i trying run example of simple d3 bar graph, http://bl.ocks.org/mbostock/3885304 . following output i cannot see bars , background of svg color of bars.

c++ - How to define a 2D array of structures in the private parts of a class? -

i want define 2d array of structures in class in c++, how should it, here example approach struct tt class swtlvn{ private: int a,b; tt yum[a][b]; }; can done in way? aos used member functions of class/ultimatey defined object cant defined inside member function. having defined externally going hassle no can do. edit: struct tt{ int a,b,c; tt(){} tt(int aa,int bb,int cc){a = aa; b = bb; c = cc;} }; without knowing more, should use similar to: class foo { public: foo(int _a, int _b) : a(_a), b(_b) { yum.resize(a); (size_t = 0; < a; i++) { yum[i].resize(b); } } typedef std::vector<std::vector<tt> > ttvector2d; ttvector2d yum; };

Makefile and wildcard targets -

i have directory many files. run command against these files (ie. md5sum). instead of keep recomputing checksum store checksum. compute checksums in parallel manner (make -j) something like: md5sums: $(addsuffix .md5sum,$(wildcard *.foo)) %.md5sum: % md5sum $< > $@ that's best can limited description available.

selenium - Clicking on checkbox based on span value in WebDriver -

i select checkbox based on "costco wholesale corporation" value in: <td role="gridcell" style="" title="" aria-describedby="entity-search-grid_selected"> <input type="checkbox" name="chkbox" class="itmchk" value="110504"> </td> <td role="gridcell" style="font-weight: bold;" title="costco wholesale corporation" aria-describedby="entity-search-grid_name"> <div class="tree-wrap tree-wrap-ltr" style="width:18px;"> <div style="left:0px;" class="ui-icon ui-icon-triangle-1-s tree-minus treeclick"></div> </div> <span class="cell-wrapper">costco wholesale corporation</span> </td> i have tried following code: driver.findelement(by.xpath("//td[span[text()='costco wholesale corporatio

Set an URL in laravel from environment variable -

i have form in html, in action, set page want send data: <form action="wherever.com" method="post" target="_blank" style="display: inline;"> the problem laravel, in .env file set this: wherever_form="http://wherever.com" ok, want set env variable in action, have tried this: action="env('wherever_form')" also this: action="env(wherever_form)" and this: action="{{env('wherever_form')}}" i know can env variable, don´t find how it, in laravel documentation found this: $env = env('app_env'); // return default value if variable doesn't exist... $env = env('app_env', 'production'); this not enough me. someone can me? i think .env file setup ok: wherever_form="http://wherever.com" and also: <form action="{{env('wherever_form')}}" method="post" target="_blank" style=&qu

android - Widget in separate process -

i trying run widget in separate process. have mentioned different process name in manifest file widget. doesn't help. widget code doesn't executed. don't know if possible or not , proper way of executing in separate process. please if have done this. thanks.

java - Jmap does not report full memory usage of the JVM -

Image
i trying diagnose oom exception in process. using jmap , find not report full memory usage of jvm. this output of jmap -histo:live (truncated): num #instances #bytes class name ---------------------------------------------- 1: 36143828 1156602496 java.util.concurrent.concurrenthashmap$node 2: 36122540 1155921280 java.util.uuid 3: 195 268602800 [ljava.util.concurrent.concurrenthashmap$node; 4: 4207 11351968 [b 5: 38497 3231200 [c 6: 37708 904992 java.lang.string adding above numbers memory usage in low 2gb's grafana dashboard showing memory usage of 16gb! where missing memory (almost 12gb) going? how can details?

http status code 403 - Another typical 403 Forbidden error for new website in apache -

today i've added new website on server runs apache 2.4 (all sites being added before apache 2.4 working old directives). new site gets 403 error, tried change directives "require granted" "order allow,deny allow all" works other sites on server still not working. directives new site (not working): http://pastebin.com/smjqnbxn directives old sites (working): http://pastebin.com/m7nbmsje

ios - Xcode submit to app store issue -

Image
i'm trying upload new version of app, got error. but if select "validate..." button, it's ok :( up point , application stored successfully. i don't know reason of error got alternative. export .ipa file , try uploading via application loader (xcode -> open developer tool -> application loader)

c# - Optional Random ordered nested grouping in linq -

i in position can't think of answer regarding optional grouping in linq. basically,i want generate report comes screen having filters. these filters(mostly grouped) optional , can rearranged.it's like filters: 1.clients projects tasks duration or 2.projects clients tasks duration or 3.task duration etc. with possible combinations. data should like 1.clienta projecta taska 26hrs 45mins taskb 43hrs 23mins projectb taskx...... 2.projecta clienta taska 26hrs 45mins... 3.taska 26hrs 45mins taskb 6hrs 35mins i have data.but unable write logic generalized. i thinking enum hold filters (viewmodel)selected enum.client,enum.project... and if (clientgroupchecked) foreach(var clientgroup in list){ //group list client here if(projectgroupchecked) foreach(var projectgroup in clientgroup){

I'm trying to write a code for counter using vhdl -

this vhdl code synchronous type counter. i'm still new in vhdl, i'm having problem in writing testbench simulate code. can give me suggestions on how write testbench? thank you library ieee; use ieee.std_logic_1164.all; use ieee.std_logic_unsigned.all; entity cnt4 port( clk, rst : in std_logic; q : out std_logic); end cnt4; architecture ex1 of cnt4 signal cnt : std_logic_vector(1 downto 0); begin process(clk, rst) begin if rst = '1' cnt <= "00"; elsif clk'event , clk = '1' if cnt = 3 cnt <= "00"; q <= '1'; else cnt <= cnt + 1; q <= '0'; end if; end if; end process; end ex1; this testbench i've tried write far library ieee; use ieee.std_logic_1164.all; use ieee.std_logic_unsigned.all; entity testbench end testbench; arc

gradle - Building a Android 6 Messaging app out of AOSP tree -

i'm trying build messaging app android 6.... i've imported packages/app/messaging android studio... , created following build.gradle file: buildscript { repositories { mavencentral() } dependencies { classpath 'com.android.tools.build:gradle:1.3.+' } } apply plugin: 'com.android.application' android { compilesdkversion 23 buildtoolsversion "23.0.2" sourcesets { main { manifest.srcfile 'androidmanifest.xml' java.srcdirs = ['src'] resources.srcdirs = ['src'] aidl.srcdirs = ['src'] renderscript.srcdirs = ['src'] res.srcdirs = ['res'] assets.srcdirs = ['assets'] } // move tests tests/java, tests/res, etc... instrumenttest.setroot('tests') // move build types build-types/<type> // instance, build-types/deb

python - Sklearn - How to predict probability for all target labels -

i have data set target variable can have 7 different labels. each sample in training set has 1 label target variable. for each sample, want calculate probability each of target labels. prediction consist of 7 probabilities each row. on sklearn website read multi-label classification, doesn't seem want. i tried following code, gives me 1 classification per sample. from sklearn.multiclass import onevsrestclassifier clf = onevsrestclassifier(decisiontreeclassifier()) clf.fit(x_train, y_train) pred = clf.predict(x_test) does have advice on this? thanks! you can removing onevsrestclassifer , using predict_proba method of decisiontreeclassifier . can following: clf = decisiontreeclassifier() clf.fit(x_train, y_train) pred = clf.predict_proba(x_test) this give probability each of 7 possible classes. hope helps!

vb6 - Overflow in visual basic 6 -

i have game server, , problem on error overflow 6. debug: if spell(spellnum).end > 0 tempplayer(index).end = getplayerstat(index, endurance) setplayerstat index, endurance, getplayerstat(index, endurance) + spell(spellnum).end sendstats index end if debug highlighted: tempplayer(index).end = getplayerstat(index, endurance) what kind of return on line: getplayerstat(index, endurance) you can check type of return , allocation? when have problems overflow trying put number "long" (high value) in variable of type "integer" or "single" example.

How to get values in Excel from the column where value equals to the specific number? -

Image
i have 2 sheets, in first - data. in second want show values want. like: if value column "b" of 1st sheet = 1, show values column c , d in 2nd sheet. here need select values equals, example "503" in column l, , show them in 2nd sheet. how can this? or here's little code snippet of comparing 2 sheets cells, same of different (up you) , if match, place them in sheet 2's column l1 : sub test() dim value1 string dim value2 string value1 = thisworkbook.sheets(1).range("a1").value 'sheet 1 value value2 = thisworkbook.sheets(2).range("b1").value 'sheet 2 value if value1 = value2 thisworkbook.sheets(2).range("l1").value = value1 'or 2 else msgbox ("values not match!" + vbnewline + vbnewline + "'" + value1 + "'" + "does not match '" + value2 + "'.") end if end sub if want tweak liking, change sheet 1's value, or sheet 2's, call.

javascript - Dynamically, check radio button with for loop -

i'm trying create 5 star radio picker. this 1 of radio buttons: <input onclick="check(3)" type="radio" name="three" id="num_3_star" value="3"> after method gets called , "3" passed on javascript function: function check(stars) { for(i = 0 ; < stars; i++) { document.getelementbyid("num_" + stars + "_star").checked = true; } } when run code, not perform checked = true, though if remove loop, works fine. any ideas why loop preventing checking radio boxes? this entire code: <script> function check(stars) { for(i = 0 ; < stars; i++) { document.getelementbyid("num_" + stars + "_star").checked = true; } } </script> <form> <input onclick="check(1)" type="radio" name="one" id="num_1_star" value="1"> <input onclick="check

android - How to open a view in a fragment with an onClick method? -

i have floating action button in layout, , open view when clicked. read this answer way handle click events this: public class alltasksfragment extends fragment implements onclicklistener { @override public view oncreateview(layoutinflater inflater, viewgroup container, bundle savedinstancestate) { view rootview = inflater.inflate(r.layout.fragment_all_tasks, container, false); floatingactionbutton fab = (floatingactionbutton) rootview.findviewbyid(r.id.fab); fab.setonclicklistener(this); return rootview; } @override public void onclick(view rootview) { switch (rootview.getid()) { case r.id.fab: setcontentview(r.layout.fragment_new_task); break; } }} but, because setcontentview method can't used in fragments, android studio returns error: cannot resolve method setcontentview(int) . what can use instead of setcontentview bring view through onclick method? or have approach in different

c# - clicking messagebox.show() hides showdialog() window -

i have following code in wpf: private void btnticketprice_click(object sender, routedeventargs e) { ticketprice tp = new ticketprice(); tp.showdialog(); } in new window form have following code: private void btnsave_click(object sender, routedeventargs e) { messagebox.show("sometext"); } on clicking messagebox button form ( ticketprice ) closing; how show messagebox without closing form? if i'd change tp.showdialog(); tp.show(); , works correctly. have problem tp.showdialog(); xaml of button <button x:name="btnsave" horizontalalignment="left" margin="619,362,0,0" verticalalignment="top" width="165" height="66" iscancel="true" tabindex="4" click="btnsave_click"> <stackpanel orientation="horizontal"> <textblock text="save " horizontalalignment="center" vertica

php - Create an exe Installer for a website Wamp -

what need create installer website, have website developed in codeigniter , database in mysql, , running in wamp php 5.5 is possible create exe installer can this? 1.- install wamp, if not installed 2.- copy mywebsite folder www wamp, example c:\wamp\www\ 3.- create database database.sql clients ask me kind of installer,but don't know if possible, idea or , appreciated or software create installers , thanks investigate wix installer. http://wixtoolset.org/ it's start creating complex msi\exe setup packages , install wizards on windows can install other applications , files part of package. what describe seems fit within wix.

java - Activate flashlight when battery is lower than 10% in android API 21 and above -

i'm trying create android flashlight app , i'm done. i'm facing 1 problem though. when battery below 10% app starts flashlight doesn't come on. minsdk api 21 (lollipop) maxsdk api 23 (m) below permissions , features included in androidmanifest.xml. <!--for controlling camera flashlight--> <uses-permission android:name="android.permission.camera" /> <uses-permission android:name="android.permission.flashlight" /> <uses-feature android:name="android.hardware.camera" /> <uses-feature android:name="android.hardware.camera.autofocus" /> <!--/--> how around problem.

r - Sum of longest string of non-zero values -

i have dataframe containing daily rainfall values @ 76 stations 1964-2013. each row different month particular station. here snippet of dataframe- station year month days 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 usc00020750 1964 1 31 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 25 0 23 51 36 0 0 0 0 0 0 0 0 usc00020750 1964 2 29 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 48 0 0 0 3 0 0 0 0 0 0 inf inf usc00020750 1964 3 31 0 46 51 0 0 36 41 46 0 0 0 0 43 0 0 0 0 0 0 0 0 53 99 140 36 0 0 0 0 0 0 usc00020750 1964 4 30 5 69 23 30 0 18 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 33 13 0 0 0 15 0 inf usc00020750 1964 5 31 0 0 0 0 0 0 43 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 51 8 0 0 0 0 usc00020750 1964 6 30 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

matlab - how to plot each profile with a distance from the other in a 2D plot? -

i want plot http://www.nature.com/nprot/journal/v9/n6/fig_tab/nprot.2014.090_f7.html or 1 http://file.scirp.org/html/11-2200285/ff6819f9-5db9-4121-852d-a8d5c302a5a4.jpg have 2d matrix. i tried plot did not work figure; hold on = 1:size(x,1) plot(x(i,:)+10) end since not specify not work, having difficulties answer question directly (i not have enough reputation comment). the following code results in image ones link. maybe forgot multiply y-shift iteration number i. n = 200; x = 1:n; m = 5; x = sin(kron(x,ones(m,1))); figure; hold all; i=1:n plot(x(i,:)+i*5); end

Whats the name of this path-finding algorithm? -

Image
the pictures show graph of nodes arranged pixel grid straight rows , columns. every node (except ones on edge) have 8 edges, go closest 8 nodes around it. picture on right shows a* search simple distance travelled + euclidean distance goal heuristic. now, path given picture on right isn't enough. instead want path if connect start node , goal node shortest possible string. algorithm getting called? finding euclidean shortest paths based on 2d grid discretization of traversable space can performed theta* algorithm. the other (more commonly employed) approach based on standard 4-way or 8-way pathfind (the picture on left), followed "string pulling" optimization. common algorithm known "funnel algorithm" . note neither of these approaches guaranteed produce globally shortest path. also, these assume you're set on representing world grid; if instead represent set of convex polygons, other algorithms more appropriate.

c# - System.Data.Entity.Spatial.DbGeography Distance with elevation -

i'm want find distance between 2 points on planet (using wgs84) , system.data.entity.spatial.dbgeography seemed shout, i'm not getting expected result distance function when points have elevation: var geoga = dbgeography.pointfromtext("point(179.04 89.77 100)", 4326); var geogb = dbgeography.pointfromtext("point(179.04 89.77 200)", 4326); var distance = geoga.distance(geogb); //distance 0, not 100 i expecting distance able take elevation account - missing obvious here? i'm sure must trivial, know little maths behind all, i'm not qualified make statement. my intuition tells me, use pythagoras here, i'm not 100% sure that's correct. in sql server libraries z (elevation) more tag or pure user defined property. so not used in calculations. makes similar m has meaning specific dataset. if elevation matters math perspective have add/minus after geography distance results. take care subtract higher elevation. you add

c# - Random number generator only generating one random number -

i have following function: //function random number public static int randomnumber(int min, int max) { random random = new random(); return random.next(min, max); } how call it: byte[] mac = new byte[6]; (int x = 0; x < 6; ++x) mac[x] = (byte)(misc.randomnumber((int)0xffff, (int)0xffffff) % 256); if step loop debugger during runtime different values (which want). however, if put breakpoint 2 lines below code, members of "mac" array have equal value. why happen? every time new random() initialized using clock. means in tight loop same value lots of times. should keep single random instance , keep using next on same instance. //function random number private static readonly random random = new random(); private static readonly object synclock = new object(); public static int randomnumber(int min, int max) { lock(synclock) { // synchronize return random.next(min, max); } } edit (see comments): why need lock her

c++ - why malloc always failed allocate memory (roughtly 9GB but I have 16GB physical memory)? -

Image
i believe have enough memory (16g) allocation in ubuntu (64 bit application). still return null. following memory information running free command. total used free shared buffers cached mem: 16376100 3295024 13081076 41936 88852 1073808 -/+ buffers/cache: 2132364 14243736 swap: 15998972 0 15998972 screenshot: based on comment, figured out. that's because when calculate memory size, sum overflowed. another case use int n_dataset = 2453688725; overflowed, n_dataset negative number.

ios - Scrollable custom view on pan gesture -

i new ios, trying create scrollable custom view. basically on tapping on of icons in screen, custom view should pop botton. should have button expand full screen or on pan gesture should expanded full screen. here created wf better understanding. enter image description here edit: changed cutom view action sheet in question. action sheets don't have level of customization. you'll have make custom view functionality.

iframe - Does Google have an equivalent of the Mozilla Developer Network site for Chrome? -

i hit issue iframe sandboxing behaved differently in firefox vs chrome getusermedia() , , while trying figure out, read https://developer.mozilla.org/en-us/docs/web/html/element/iframe , matched firefox's behavior. couldn't find equivalent documentation chrome, had experiment until worked. does google/chrome have such documentation? the short answer no. you can find useful information on https://developers.google.com/web/updates/ , although it's more of blog new chrome features (and deprecations), rather approaching comprehensive, organized documentation. https://developer.chrome.com/home links https://www.html5rocks.com/ , https://webplatform.github.io/ under "open web docs". the former again more of blog/magazine have useful articles, such https://www.html5rocks.com/en/tutorials/security/sandboxed-iframes/ (although didn't answer original question). the latter has been discontinued on year.

deployment - how to deploy angular 2 project to heroku? -

i tried deploy tutorial: tour of heroes heroku, answers found use angular2 seed, angular2 webpack or angular2 cli. tried of them , still can't figure out how deploy it. can give me detailed instruction of deploying angular 2 app? thank you. there's 1-click deploy on angular universal starter project. i tried clone , re-deploy , got stuck because need set config vars npm_config_production=false i'm still struggling how deploy production build vs. development build, it's example thats , running

android - remoteMessage.getMessageType returns null in onMessageReceived -

public class firebasemessagingservice extends com.google.firebase.messaging.firebasemessagingservice{ string tag = "firebasemessagingservice"; @override public void onmessagereceived(remotemessage remotemessage){ log.i(tag," input string :"+ string.valueof(remotemessage.getdata())); /** * parse remote input , pass id, action, frequency , payload eventhandler. * **/ string messagetype = remotemessage.getmessagetype();// messagetype null if(messagetype.equalsignorecase("data")){ log.i(tag, " data notification received"); } else if(messagetype.equalsignorecase("notification")){ log.i(tag, " push notification received"); } } i'm not sure getmessagetype() supposed return. seem unlikely returns either data or notification , since a single message can contain both notification , data information .

Variable substitution from external resource in logback groovy configuration -

logback's xml configuration allows define variables in external resources <property resource="foo.properties" /> spelled out in http://logback.qos.ch/manual/configuration.html#variablesubstitution . i'm in process of converting logback configuration in groovy (i.e. logback.xml -> logback.groovy) , not finding easy way achieve this. i able achieve same behavior normal java/groovy code properties props = new properties(); props.load(new fileinputstream("foo.properties")) def filepath = props.getproperty("filepath) but have hoped logback have supplied shorthand in form of logback-specific extension. does know of shorter way of accessing variables defined in external files , resources? besides this, i'm finding groovy configuration approach more concise , intuitive xml, , appreciate chance avoid dealing xml.

R programming ggvis histogram verses hist - How to size the buckets, and define X axis spacing (ticks) -

Image
i learning use ggvis , wanted understand how create equivalent histogram produced hist. specifically, how set bin widths , upper , lower bounds of x in ggvis histograms? missing? question: how ggvis histogram output match hist output? let me provide example: require(psych) require(rcurl) require(ggvis) if ( !exists("impact") ) { url <- "https://dl.dropboxusercontent.com/u/8272421/stat/stat_one.txt" mycsv <- geturl(url, ssl.verifypeer = false) impact <- read.csv(textconnection(mycsv), sep = "\t") impact$subject <- factor(impact$subject) } describe(impact) hist(impact$verbal_memory_baseline, main = "distribution of verbal memory baseline scores", xlab = "score", ylab = "frequency") ok, lets try , reproduce ggvis... output not match... impact %>% ggvis( x = ~verbal_memory_baseline, fill := "white") %>% layer_histograms(width = 5) %>% add_axis("x", ti

ssh - How to view the logs of a spark job after it has completed and the context is closed? -

Image
i running pyspark , spark 1.3 , standalone mode , client mode . i trying investigate spark job looking @ jobs past , comparing them. want view logs, configuration settings under jobs submitted, etc. i'm running trouble viewing logs of jobs after context closed. when submit job, of course open spark context. while job running, i'm able open spark web ui using ssh tunneling. and, can access forwarded port localhost:<port no> . can view jobs running, , ones completed, this: then, if wish see logs of particular job, can using ssh tunnel port forwarding see logs on particular port particular machine job. then, job fails, context still open. when happens, still able see logs above method. but, since don't want have of these contexts open @ once, when job fails, close context. when close context, job appears under "completed applications" in image above. now, when try view logs using ssh tunnel port forwarding, before ( localhost:<por

java - XML Parsing in hadoop/pig -

i want extract data large xml, ex. via xpath, , process (data select, grouping). simpler way, described in this question ? ex., via apache avro? or, maybe, better in pig ?

generics - Getting or implementing String.Zero and bool.Zero generically for use with monoids -

i trying refactor existing code into more monodic approach . existing code contains interfaces ixinterface , numerics int , bool . numerics have zero default, interfaces have property gettor, bool , string not. 1 way out wrap bool , string in interface, cumbersome. i figured if f# language manages extend types numerics, perhaps can strings , bools particular situation. module myzero = let inline get_zero () : ^a = ((^a) : (static member get_zero : unit -> ^a)()) type system.string static member get_zero() = system.string.empty type xr<'t when 't : (static member get_zero : unit -> 't)> = | expression of (someobj -> 't) | action of (int -> 't) | value of 't | empty member inline this.execute(x: someobj) : 't = match | value(v) -> v | expression(ex) -> ex x | action(a) -> x.getlocation | empty -> get_zero() static member map f x=

javascript - How to create a function containing custom var -

i have written following function sync input fields: $(".dp1").on('change', function(e){ var datevalue = $($(this)[0]).val(); $.each($('.dp1'), function(index, item){ $(item).val(datevalue); }); }); $(".dp2").on('change', function(e){ var datevalue = $($(this)[0]).val(); $.each($('.dp2'), function(index, item){ $(item).val(datevalue); }); }); $(".rooms").on('keyup', function(e){ var datevalue = $($(this)[0]).val(); $.each($('.rooms'), function(index, item){ $(item).val(datevalue); }); }); $(".persons").on('keyup', function(e){ var datevalue = $($(this)[0]).val(); $.each($('.persons'), function(index, item){ $(item).val(datevalue); }); }); as function exact same 1 every time, guess there better way combine one. thinking of like my_custom_function(my_custom_value){ var datevalue = $($(this)[

ios - iTunes review URL not working in iOS9? -

i've been using url on ios 8 direct users app rating url, stops working on ios 9 "itms-apps://itunes.apple.com/webobjects/mzstore.woa/wa/viewcontentsuserreviews?id=984230464&onlylatestversion=true&pagenumber=0&sortordering=1&type=black+mouton" i'm getting error message: request produced error. [newnullresponse] any solution? this working on ios 9: nsstring *reviewurl = @"itms-apps://itunes.apple.com/webobjects/mzstore.woa/wa/viewcontentsuserreviews?id=<#your_app_id_here#>&onlylatestversion=true&pagenumber=0&sortordering=1&type=purple+software";

php - Laravel5.2 Unwanted VerifyCsrfToken -

i set fresh l5.2 , route files after changes looks that: <?php /* |-------------------------------------------------------------------------- | application routes |-------------------------------------------------------------------------- | | here can register of routes application. | it's breeze. tell laravel uris should respond | , give controller call when uri requested. | */ route::get('/', function () { return view('welcome'); }); route::group(['middleware' =>'api', 'prefix' => '/api/v1'], function () { route::post('/api/v1/login', 'api\v1\auth\authcontroller@postlogin'); }); when go postman , make post: http://kumarajiva.dev/api/v1/login get: tokenmismatchexception in verifycsrftoken.php line 67 but me kernel file looks that: protected $middlewaregroups = [ 'web' => [ \app\http\middleware\encryptcookies::class, \illuminate\cookie\middleware\addqueue

c# - WPF Error in routine -

i had subroutine code (see below) working fine until hour ago while testing. notifyofpropertychange(() => testresults); triggers error: "cannot convert lambda expression type 'string' because not delegate type" i have googled around, , solutions suggest adding "using system.linq". have done "using system.data.entity". both of these greyed out in visual studio suggesting not used, , error still persists. i'm new using wpf linked subroutines, i'm not entirely sure doing, said been working fine, , have similar program there no error. both have same references , usings, , other program doesn't have "using system.linq" i'm sure stupid i'm missing. thanks public string testresults { { return _testresults; } set { _testresults = value; notifyofpropertychange(() => testresults); } } looks implement interface inotifypropertycha

security - Caching and Replay Proxy Server in Deployment -

Image
i have logging server receives data stateless clients on single network (inaccessible outside world). i'd make sure logs received server, if internet connection goes down. to easiest solution set proxy server, , have client log both logging server , proxy server. proxy server tries log logging server, , if fails caches request later. this: notes: all requests idempotent. the clients stateless (logs can not cached on clients) all parts of system, except intermediate "internet" step, configurable. the proxy server not need read or modify data. the logging server response not used client. i cannot make significant changes client or logging server (cassandra great application, though). my questions: there off shelf software can serve proxy? if not, think when writing this? there concerns scheme? your proxy looks simple persistent queue. have add/configure connector logging server. but without queue whole process looks 2 db queries , and 2 rest

java - Android Studio and openimaj -

i trying build android studio project using dependency openimaj java library. apply plugin: 'com.android.application' android { compilesdkversion 22 buildtoolsversion "22.0.1" defaultconfig { applicationid "com.example.mapinguari.myapplication" minsdkversion 15 targetsdkversion 22 versioncode 1 versionname "1.0" } buildtypes { release { minifyenabled false proguardfiles getdefaultproguardfile('proguard-android.txt'), 'proguard-rules.pro' } } } dependencies { compile filetree(dir: 'libs', include: ['*.jar']) compile 'com.android.support:appcompat-v7:22.2.0' compile 'org.openimaj:openimaj:1.3.1' } is module build file. reports no errors when syncing ide. however when try construct of classes in 1 of source files android studio not recognize of classes openimaj dependency. an