Posts

Showing posts from July, 2014

regex - replacing all behind my matched string - gsub -

i'm new string manipulations in r. have case in i'm using several matched replacements in foor loop, , has rely on gsub. now have string (illustrative example), "today great day" in want use pattern "today is" only, , replace "my value" but metacharacters need select rest of string? my try gsub("today is+.", "my value", myobject) now selects 1 value after "today is", how can make run way? use capture-class grouping parens in pattern, , refer them \\<n> in replacement, , think need swap order of .+ in pattern: > gsub("(today is)(.+)", "my value\\2", "today great day") [1] "my value great day"

python - Removing a node from a linked list with "del" doesn't work -

the problematic part in function remove . after del called, relevant node not removed linked list. did misunderstand del ? class node: def __init__(self, val): self.val = val self.next = none def add(self, val): if not (self.next): self.next = node(val) else: self.next.add(val) def remove(self, val): if self.val == val: if self.next: self.val = self.next.val self.next = self.next.next else: del self # doesn't remove node linked list else: if self.next: self.next.remove(val) else: print "no such val found %d" % val def __str__(self): output = [] while self not none: output.append(str(self.val)) self = self.next return " -> ".join(output) head = node(1) head.add(2) print head head.remove(3...

Need only numbers and not Name resolution with Source Port in Wireshark -

using wireshark display packet information, name resolved source , destination port -> 1 0.000000 121.14.142.72 0.32.59.21 tcp 62 ms-wbt-server 48983 where last 2 values-> ms-wbt-server , 48983 source port , destination ports. instead want see port number , not name resolution. does know if setting possible in wireshark? there 2 ways of doing that. the first turn off transport-layer name resolution. that's view -> name resolution -> enable transport layer in gtk+ version , view -> name resolution -> resolve transport layer in qt version; if it's checked, select it, disable (and un-check) it. prevent port numbers being resolved names everywhere in wireshark. the second use "src port (unresolved)" , "dst port (unresolved)" rather "source port" , "destination port" port number column. affect column display, you're showing in example above.

javascript - AngularJS: Insert HTML into View from string preserving style attributes -

i'm trying insert html code string angular view, style attributes being removed html in controller: $scope.htmlstring = '<div style="height:40px;"></div><div style="height:40px;"></div><div style="height:40px;"></div>' view: <div ng-bind-html="htmlstring"></div> the result i'm getting html without style attributes. <div></div><div></div><div></div> i have tried using ng-bind-html-unsafe directive no success. i appreciate help. see fidddle $scope.str = $sce.trustashtml(html); <div ng-bind-html="str"></div>

ios - How to programmatically take a screenshot and share it to a social network? -

i attempting programmatically take screenshot , share social media network when button clicked, however, cannot quite figure out how so. appreciate -(void)touchesbegan:(nsset *)touches withevent:(uievent *)event { /* called when touch begins */ uitouch *touch = [touches anyobject]; cgpoint location = [touch locationinnode:self]; sknode *node = [self nodeatpoint:location]; if ([node.name isequaltostring:@"twitter"]){ [self.button play]; twitter = [[slcomposeviewcontroller alloc] init]; twitter = [slcomposeviewcontroller composeviewcontrollerforservicetype:slservicetypetwitter]; [twitter setinitialtext:@""]; uiviewcontroller *twit = self.view.window.rootviewcontroller; [twit presentviewcontroller: twitter animated: yes completion:null]; } }

Are alias and reference the same thing in C++? -

i'm not asking difference between pointer , reference. bit confused difference between reference , alias. as far i'm concerned, reference data type while alias word describing utility of data type ? thanks! aliasing refers way refer same data through different names. references , pointers 2 ways of achieving behavior.

java - Loop in JavaFX-Launcher preventing JavaFX application thread from starting -

if put endless loop in javafx-launcher thread , application never start. know runs on different thread , why happen? just create new project , override init() , add forever loop. // mine not forever boolean go = true; @override public void init() throws exception { // todo auto-generated method stub super.init(); // 'while' comes after line while(go){} // comment guy , ayt } @override public void stop() throws exception { // todo auto-generated method stub go = false; super.stop(); } does mean javafx-launcher thread should exit before application ui can start -(i.e javafxapplication thread), or missing something? if javafx-launcher should alternative launching application needs before app starts, why can't concurrent, because if want in successions place code before super.init() method? direct explanation of happening the documentation application start method explicitly states happening: the start method called...

maven - How important is checking the check style errors in JAVA code? -

we trying deploy code using jenkins our qa , our maven goals include -p analysis in used find check style errors. now, problem got lot of check style errors , need push code qa immediately. can build jenkins removing -p analysis in goals ignores check style errors? can ignore check style errors , push code? cause problems in future? please suggest me correct method. thanks! this team , internal culture. using automated tool enforce consistent style can avoid style debates during code reviews , can prevent developers reformating files liking. (here's question discussing other benefits of maintaining consistent style: research advantages of having standard coding style ) you can disable check push code now, long term want fix errors (whether style definition or code) , keep checks on. behoove ensure when developers build locally same errors code doesn't checked in fail check.

php - setting iframe ID via fancybox2 to allow webdriver switchTo()->frame(id) -

i'm using fancybox2 create iframes can't see way of setting id of iframe gets created, preventing me using php-webdriver , selenium test contents of iframe. simplified version of code: <a href="iframe.html" class="various fancybox.iframe">iframe</a> <script> $(document).ready(function() { $(".various").fancybox() }); </script> which works, using chrome's inspector, iframe (this time) generated id of fancybox-frame1443817733402 , appears random. means when try use php-webdriver switch frame (having clicked link create iframe), can't predict frame's id pass in: $frame_id = 'fancybox-frame1443817733402'; // can't predict in advance $driver->switchto()->frame($frame_id); the iframe generated class of fancybox-iframe calls $iframe = $driver->findelement(webdriverby::class("fancybox-iframe")) return nothing. i've tried using fancybox2's afterload callb...

java - Spring ContextConfiguraion failed to load Application Context -

this question has answer here: error on creating first hello world application using spring mvc 2 answers i have simple test, so: @runwith(springjunit4classrunner.class) @contextconfiguration(classes = testing.class) public class test { @autowired public string str; @test public void works(){ assertnotnull(str); } } the configuration class is: @configuration public class testing { @bean public string getstring(){ return "hi"; } } but error: 2015-10-02 14:18:23,761 error [main] [test.context.testcontextmanager.preparetestinstance()] - caught exception while allowing testexecutionlistener [org.springframework.test.context.support.dependencyinjectiontestexecutionlistener@4df828d7] prepare test instance [com.glassdoor.search.jobs.spring.test@b59d31] java.lang.illegalstateexception: failed load app...

android - I want to when the word of "a" set in the TextView (txt61) ,INVISIBLE the (edt9) and (text) -

why setvisibility doesn't work in code.i want when word of "a" set in textview (txt61) ,invisible (edt8) , (text12) textview text=(textview)findviewbyid(r.id.text); textview text12=(textview)findviewbyid(r.id.text12); final textview txt61=(textview)findviewbyid(r.id.txt61); final edittext edt9=(edittext)findviewbyid(r.id.edt9); final edittext edt8=(edittext)findviewbyid(r.id.edt8); final edittext edt7=(edittext)findviewbyid(r.id.edt7); final edittext edt6=(edittext)findviewbyid(r.id.edt6); string f=txt61.gettext().tostring(); if(f.equals("a")){ edt8.setvisibility(view.invisible); text12.setvisibility(view.invisible); } if(f.equals("b")){ edt9.setvisibility(view.invisible); text.setvisibility(view.invisible); }

How to add Custom Interceptor in Spring data rest (spring-data-rest-webmvc 2.3.0) -

i working on spring data rest services & facing issue in custom interceptors. earlier used spring-data-rest-webmvc 2.2.0 & added interceptor in following way. public requestmappinghandlermapping repositoryexporterhandlermapping() { requestmappinghandlermapping mapping = super .repositoryexporterhandlermapping(); mapping.setinterceptors(new object[] { new myinterceptor() }); return mapping; } it worked fine me. when upgraded spring-data-rest-webmvc 2.3.0 version, noticed handlermapping hidden behind delegatinghandlermapping. hence tried add interceptor in following way. in 1 of config class have extended repositoryrestmvcconfiguration class & override method. public class appconfig extends repositoryrestmvcconfiguration { @autowired applicationcontext applicationcontext; @override public delegatinghandlermapping resthandlermapping() { repositoryresthandlermapping repositorymapping = new repositoryresthandlerm...

Bootstrap nested multi-collapse accordion, remove active state -

i have multi-collapse accordion , trying put multi-collapse accordion within 1 of panels. when toggle panel , nested accordion appears, panels in active state. i nested accordion not in active state (blue ‘ – ‘ ) have panels in gray color ‘ + ‘ icon visible. here example code thanks suggestions. <div class="panel-group multi-collapse" id="accordion1"> <div class="panel panel-default"> <div class="panel-heading"> <div class="panel-title"> <a data-toggle="collapse" data-parent="#accordion1" href="#collapse1">news 1</a> </div> </div> <div id="collapse1" class="panel-collapse collapse in"> <div class="panel-body"> <!-- here nested accordion --> <div class="panel-group multi-collap...

ios - BUG - TableView with strange size and not showing scroll indicators -

i not remember first time saw bug. if started ios 9 framework or not. the problem when have uitableview first child of uiviewcontroller in storyboard tableview apparently have bigger content size , not show scroll indicators. when put transparent uiview first child, problem disappear. the same issue occurs uitableviewcontrollers. , there no trick because de tableview main view of viewcontroller. anyone got bug or know how fix it? i trying resolve problem in order prevent future problems because storyboard in "macgyver mode". looks frame of table view bigger screen size. that's why no scrolling indicators appear. when add transparent view superview of table view, you're somehow influencing resizing of table view. try inspecting frame of table view , play around layout constraints. update: i've taken po's code , found out (on iphone 6 simulator) table view has frame = (0 0; 375 667) , contentsize: {600, 0}. answer why no scrolling indicato...

Error: "TypeError: list indices must be integers, not str" in Python -

i trying import data file , using in function getting error: door_position_pattern_actual = door_position[d] typeerror: list indices must integers, not str code references: reactive_sampling_period_in_seconds = 10 * 60 door_position = list() while 1: line = f.readline() vals = f.readline() vals= vals.rstrip() data1 = [] v in vals.split(","): data1.append(v.lstrip()) if(entry[1]=="doorposition"): door_position = list(data1) def door_positin_fnc_actual(self, time_in_seconds): time_period_in_10mins = 6 index = int(math.floor(time_in_seconds%(144*reactive_sampling_period_in_seconds)/(reactive_sampling_period_in_seconds))) d in door_position : door_position_pattern_actual = door_position[d] return door_position_pattern_actual[index] output references: print(door_position) ['(1', '1', '1', '0', '1', '0', '1', '1', '1...

How to use with Neo4j with Java simply using JDK Tools? -

i'm trying use neo4j embedded in java application small project of mine. this, i'm using jdk tools, so, there's no eclipse, net beans or intellij idea. i've tried follow tutorial supplied neo4j ( include neo4j in project ) , i'm somehow doing wrong, since doesn't work. to sum up, i've got small .java file, let's it's composed of bare necessities work , import of org.neo4j import org.neo4j; // or org.neo4j.*, or else starts public class application { // bare necessities work } i'm trying compile simple code javac using -classpath specify find neo4j libraries, it's showed in tutorial javac -g -cp "c:/path/to/libs/neo4j community/jre/lib" application.java but each time, compilation fail @ line of import, saying package doesn't exist. , of course, once line erased, compilation succeed. i've tried move libs inside project's folder, , i've tried download neo4j kernel jar , put inside neo4j's fold...

Decrypt from AES-ECB ciphertext created with php/mcrypt using node.js -

i have encrypted message using mcrypt_rijndael_128, ecb mode, , base64, i've tried decrypting using crypto( https://www.npmjs.com/package/crypto ) following code: var text = ''; var decipher = crypto.createdecipheriv("aes-128-ecb","somekeyherewithlength32ooooooooo", ''); text += decipher.update(data, "base64"); text += decipher.final(); the error i've been getting is: invalid key length 32. what should length of key be? when attempt use 16 instead error thrown is: 'typeerror: error:06065064:digital envelope routines:evp_decryptfinal_ex:bad decrypt' if client requires use ecb key of length 32, how can make case valid? aes subset of rijndael fixed block size 128 bit whereas rijndael supports block sizes of 128, 192 , 256 bit. 128 in mcrypt_rijndael_128 means block size. 128 in aes-128-ecb on other hand means key size. both aes , rijndael support key sizes of 128, 192 , 256 bit. if have 32 character k...

url rewriting - Combination of IIS rewrite rules - redirect to changed domain name, remove hostname prefix redirect to ssl -

my iis website accessed http://mywebsite.com , have 3 objectives related url rewriting: redirect website's new name, mynewwebsite.com remove www prefix if exists (eg www.mywebsite.com -> mywebsite.com or www.mynewwebsite.com --> mynewwebsite.com redirect ssl so in summary want redirect inbound requests https://mynewwebsite.com/ anything *. the input cases must accounted are http://mynewwebsite.com/ anything * http://www.mynewwebsite.com/ anything * http://mywebsite.com/ anything * http://www.mywebsite.com/ anything * https://mywebsite.com/ anything * https://www.mywebsite.com/ anything * https://www.mynewwebsite.com/ anything * my rewrite rules follows: <rewrite> <rules> <rule name="do stuff" enabled="true"> <match url="(.*)" ignorecase="false" /> <conditions logicalgrouping="matchany"> <add input="{https}" pattern="off"...

sql - Server 500 error when php script is run -

i testing php script inserting database in sql server. weird bug , did research couldn't determine causing it. error getting 500 internal server error. have tried printing out error no avail. if( $conn ) { echo "connection established.<br />"; $fname=$_post['firstname']; $lname=$_post['lastname']; $sql = "insert testtable (userfirstname, userlastname) values (?, ?)"; $params = array("$fname", "$lname"); $stmt = sqlsrv_query( $conn, $sql, $params); if( $stmt === false ) { echo sqlsrv_errors(); } else { echo "data transmitted successfully.<br />" } } the script above breaks. weird thing when comment out if($stmt === false) etc, script runs fine , data gets inserted. if( $conn ) { echo "connection established.<br />"; $fname=$_post['firstname']; $lname=$_post['lastname']; $sql = "insert testtable (userfirstname, userlastna...

haskell - Reactive Banana: consume parametrized call to an external API -

starting previous question here: reactive banana: how use values remote api , merge them in event stream i have bit different problem now: how can use behaviour output input io operation , display io operation's result? below code previous answer changed second output: import system.random type remotevalue = int -- generate random value within [0, 10) getremoteapivalue :: io remotevalue getremoteapivalue = (`mod` 10) <$> randomio getanotherremoteapivalue :: appstate -> io remotevalue getanotherremoteapivalue state = (`mod` 10) <$> randomio + count state data appstate = appstate { count :: int } deriving show transformstate :: remotevalue -> appstate -> appstate transformstate v (appstate x) = appstate $ x + v main :: io () main = start $ f <- frame [text := "appstate"] mybutton <- button f [text := "go"] output <- statictext f [] output2 <- statictext f [] set f [layout := minsize (...

ruby - Rails 4 + ActionMailer: ":from" is filled with incorrect email address -

i fighting setting "from" information shown in email in header. it still shows incorrect email address. in mailer class, manually set default email address: class notificationmailer < actionmailer::base default content_type: "text/html", :from => 'default@email.com' i specified in method sending email(s): def welcome_email(user) @user = user mail(to: @user.email, subject: "welcome!", from: 'default@email.com') end but when receive email, it's my-personal-email@gmail.com . searched through rails app email address set , it's here: config/initializers/setup_email.rb : actionmailer::base.delivery_method = :smtp actionmailer::base.smtp_settings = { :address => "smtp.gmail.com", :port => 587, :domain => "logistadvise.com", :user_name => "my-personal-email@gmail.com", :password => "mypassword", :authentication => "plain...

log4js node - How can I control how many days are rolled in 'dateFile' appender with the default '-yyyy-MM-dd' pattern? -

is there option control maximum number days roll? at first thought controlled "backups" option, quick @ rollingfilestream.js seems indicate manages indexes, not related date rolling pattern. as of post, there no mechanism control maximum number of days roll "datefile" appender: https://github.com/nomiddlename/log4js-node/issues/323 the manager of github project has agreed useful feature - maybe resolution made available in future.

mysql - How to insert record which has foregin key referenced to primary key of another table in PHP Script? -

here code- <?php session_start(); $con = mysqli_connect("localhost", "root", "", "placement") or die("failed connect mysql: " . mysqli_error()); // connecting mysql database // variable declaration $statename = mysqli_real_escape_string($con, $_post["txtstatename"]); $description = mysqli_real_escape_string($con, $_post["txtdescription"]); $countryname = mysqli_real_escape_string($con, $_post["selectcountryname"]); $countryid = "select countryid tbl_country_master countryname='$countryname'"; // insert query $sql = "insert tbl_state_master(statename, description, countryid) values ('$statename', '$description', '$countryid')"; if(!mysqli_query($con, $sql)) { die('error: ' . mysqli_error($con)); } else { header("location: frmaddstate.php?msg=1"); }...

c++ - Structure having an array of pointers in c -

i implementing multibit trie in c. getting segmentation fault error. when run program. don't know going wrong? the node of multi bit trie that: struct mtnode{ /* nodes array 8 elements. each element pointer child node.*/ mtnode* nodes[8]; // 2^stride = 2^3 = 8 int nexthop; }; each node initialized following: typedef mtnode node; node *init_mtnode(){ node *ret = (node*) malloc(sizeof(node)); int size = (int)pow(2,stride); (int i=0; i<size ; ++i) { ret->nodes[i] = null; } ret->nexthop = -1; return ret; } is wrong in init_mtnode method? there multiple possible reasons: you don't check malloc() null , unlike new throw exception, malloc() return null if error happens. you calculate value of size , loop size times, array can hold 8 pointers. try this typedef mtnode node; node *init_mtnode() { node *ret; int size; ret = static_cast<node *>(mall...

networking - Working code for uploading mp3 to server on android -

i have searched on code uploading mp3 or similar file php server , have tested on 10 samples none has been successful far. codes have checked out either full of bugs or use outdated libraries. i appreciate if has working code sample. possibly 1 uses volley or similar library. appreciate or code points me in right direction. thanks you can use loopj android asynchronous http client lib uploading file php server. download lib file given link , put project's libs folder , use code uploading file. public void postfile(){ requestparams params = new requestparams(); params.put("filetitle","myfile1"); params.put("file", new file("file path here")); // e.g environment.getexternalstoragedirectory().getpath() + "/test.mp3" asynchttpclient client = new asynchttpclient(); client.post("http://www.yourweserviceurlhere.com", params, new asynchttpresponsehandler() { @override publ...

git - Removing .gitignore files from previous commits in GitHub -

i added file .gitignore, repository contains previous commits include file. commits here on out no longer track ignored file using git rm --cached config/secrets.yml is there quick git command go through of previous commits , remove file showing in commit history? it’s not easy. have go through each commit , remove file. , keep in mind modify history, careful if collaborating others. here guide github on how remove sensitive data: https://help.github.com/articles/remove-sensitive-data/ the resulting command should be: git filter-branch --force --index-filter \ 'git rm --cached --ignore-unmatch config/secrets.yml' \ --prune-empty --tag-name-filter cat -- --all

ruby - Generate different combinations of arrays using positive integers as elements -

given integer n , different integer k (both positive) want generate possible different arrays of size k containing integers in interval [0..n] . example n = 2 , k = 2 want generate array of arrays contains [0,0] , [0,1] , [1,0] , [0,2] , [1,1] , [2,0] , [1,2] , [2,1] , [2,2] . result should be result = [[0,0], [0,1], [1,0], [0,2], [1,1], [2,0], [1,2], [2,1], [2,2]] the order of elements doesn't matter. use array#repeated_permutation : (0..2).to_a.repeated_permutation(2).to_a # => [[0, 0], [0, 1], [0, 2], [1, 0], [1, 1], [1, 2], [2, 0], [2, 1], [2, 2]]

adding condition of a subprogram in a different subprogram? python -

im beginner in python , ive been coding piece 2 players asked reach number (25 in case) , asked alternate between 2 players. ive put player in different subprogram , im alternating in different subprogram. ive tried many ways none seem work. def get_input_from_player(player): ''' same get_input, except time, prompt includes player supposed supply input. :param player: player, either 1 or 2 :return: integer, either 1,2 or 3 ''' ''' same in d(), time, make sure user can't enter number put total on 25. :return: none ''' = true total = 0 while a: ask_user = input ("player " + str(player) +" enter number (1, 2 or 3):") if ask_user == 1 or ask_user == 2 or ask_user == 3: print "valid input" total = ask_user + total if total < 25: print total else: =...

elixir - How to render html template in javascript template in Phoenix Framework -

let's have 2 files, create.js.eex , post.html.eex , want render contents of post.html.eex template inside create.js.eex template. this: $("#something").append("<%= safe_to_string render "post.html", post: @post %>"); the example above doesn't work because need escape quotes , other things in string gets returned , can't find way it use escape_javascript: $("#something").append("<%= escape_javascript render("post.html", post: @post) %>"); you can render_to_string , escape that, there doesn't seem need -- , since returns string, html-escape markup. actually, exact example in docs: https://hexdocs.pm/phoenix_html/phoenix.html.html#escape_javascript/1

javascript - Using Span for Triggering Bootstrap Dropdown -

i have several icons in header used font , wrapped <li style="margin-top: 15px"> <span class="myicons" id="messages" style="font-size: 5px">m</span> </li> i want use trigger bootstrap dropdown in documentation, uses button , div and, couldn't figure out how trigger when clicked on font. should try using jquery , try trigger dropdown open on click on #messages ? you not have use <button> 's , <div> 's - important thing have data-toggle="dropdown" on triggering element : <ul class="dropdown"> <!-- markup --> <li style="margin-top: 15px" data-toggle="dropdown"> <span class="myicons" id="messages" style="font-size:5px">m</span> </li> <!--// markup --> <ul class="dropdown-menu"> <li><a href="#">actio...

scala - Declaring Actor state variables as mutable ones -

i new akka framework , concurrency concepts. , akka docs, understood 1 message in actor mailbox processed @ time. single thread processing actor's state @ time. , doubt that, declaring actor state/data variable mutable - 'var'(only when 'val' doesn't fit), not cause inconsistent actor states in case of concurrency. using scala development. in following master actor, details of workers stored in mutable variable 'workers'. problem concurrency? class master extends persistentactor actorlogging { ... private var workers = map[string, workerstate]() ... } i think doing fine. said, 1 of fundamental guarantees of akka actors single actor handling 1 message @ time, there not inconsistent actor states. akka actors conceptually each have own light-weight thread, shielded rest of system. means instead of having synchronize access using locks can write actor code without worrying concurrency @ all. http://doc.akka.io/do...

c - Incorrect code to check if a word can be made of smaller given words (word break) -

incorrect code check if word can made of smaller given words (word break).this code wrote above mentioned problem, online judge declares incorrect, possible reasons? , how should modify code? #include <stdio.h> #include <stdlib.h> #include <string.h> /* node structure */ typedef struct node { int letter[26]; struct node* next[26]; int is_word; } node; /* create node */ node* getnode(void) { node* p = malloc(sizeof(node)); int i; (i = 0; < 1004; i++) { p->letter[i] = 0; p->next[i] = null; } p->is_word = 0; return p; } /* make dictionary */ void fill_dictionary(char word[], node* start) { int len = strlen(word), i; node* temp = start; (i = 0; < len; i++) { if (temp->letter[word[i] % 'a'] == 0) { temp->letter[word[i] % 'a'] = 1; temp->next[word[i] % 'a'] = getnode(); temp = temp->next[word[i] % '...

c++ - Can't figure out this memory bug (crash after program finishes) -

entire program: http://pastebin.com/x7gfsy5v i made parser takes lines .txt file , places them in binary search tree based on value. id first string, values following strings separated / example txt: abcd/foo/bar// #id/value/value2 abce/foo2// #id/value the first line call: //parser sequencemap a; #has id , value member variables a.writeacronym(id); #abcd a.writevalue(value); #foo insertnode(a, root); #abcd/foo put tree a.writevalue(value2); #bar insertnode(a, root); #abcd/bar put tree creating tree doesn't cause crash, , works should. it's when try accessing minimum value of tree when crashes. still shows correct minimum value though. here's function gets minimum value, doubt root cause of problem. but running in main() crashes program: string printmin(node * x) { if (x == nullptr) return nullptr; //this isn't ever called, parse tree before calling fucntion if (...

javascript - How to load all dependency of urijs by rquirejs config? -

Image
i want include library use https://github.com/medialize/uri.js/tree/master i have added bower.json { "name": "my-project", "version": "1.0.0", "dependencies": { "urijs": "~1.16.1" } ... } when load project in browser, got these error: these scripts part of urijs project. can find them here: https://github.com/medialize/uri.js/tree/master/src i able resolve requirejs configuration alone minimal change (i.e. not need specify each dependent script indiviudally). easiest way define dependency? is possible? if so, how? at end can resolve creating final artefact , hosted outcome in forked project. hoping more elegant and/or simpler solution. looks uri.js sets universal module loader should work requirejs. doesn't have reference every script in config. make requirejs config file readme.md: require.config({ paths: { urijs: 'where-you-put-uri.js/src' } }); r...

vb.net - Implement IEquatable Get distinct objects -

this not working me. couldn't find answer on msdn or elsewhere after having spent time on it. missing? public class printerinfo implements iequatable(of printerinfo) public printername string public printerdesc string 'default equality comparer class vb.net public overloads function equals(byval other printerinfo) boolean _ implements iequatable(of printerinfo).equals return other.printername = me.printername end function end class public readonly property printerinfolist(byval normal normalcopier) list(of printerinfo) dim plist1 list(of printerinfo) = getlist plist1.sort() return plist1.distinct.tolist end end property i list fine want distinct items. tried implement equality comparer it's not working. i'm getting multiple duplicates. need distinct values? msdn: enumerable.distinct(of tsource) msdn: iequalitycomparer(of t) interface this seems similar don't understand it i...

javascript - Set Firefox Preferences in Nightwatch -

how set firefox preferences in nightwatch? equivalent in java nightwatch. firefoxprofile profile = new firefoxprofile(); profile.setpreference("intl.accept_languages", "de"); webdriver driver = new firefoxdriver(profile); i have working in chrome, again can't figure out how in firefox. "desiredcapabilities": { "browsername": "chrome", "javascriptenabled": true, "acceptsslcerts": true, "chromeoptions" :{ "prefs": { "intl.accept_languages":"fr" } } } thanks the solution create firefox profile nightwatch test. 1) create new firefox profile: in terminal, execute command : " firefox -p " create profil name " webdriver ". 2) configure new profile go config page url : about:config search name " intl.accept_languages " , update value. exit firefox now. 3) configure nightwatch use new profile ...

c++ Function creates a 2-d array and returns a pointer to the 2-D array -

i new c++ , learning use pointers , arrays. having hard time piece of code compiling , appears doing should, except output of pointer in main function appears memory address, must missing in way calling or returning pointer. (i hope got terminology right) in main function, created pointer variable , initialized null (professor recommended initializing vars) int** ptr1=null; next set pointer equal function, creates array ptr1 = makearray1(); here code function. int** makearray1() { const int row = 2; const int col = 3; int** array1 = new int* [row]; //this creates first row of cols (int = 0; < row; i++) { array1[i] = new int[col]; //loop create next col of rows } (int = 0; < row; i++) { (int j = 0; j < col; j++) { cout << endl << "please enter integer in first matrix: "; cin >> array1[i][j]; } } cout ...

mysql - Get max value of a row in table -

hi trying row values having maximum of column name table main id|days|week 1 |1 |1 2 |2 |4 3 |5 |1 4 |2 |3 5 |1 |4 6 |4 |1 7 |1 |2 8 |6 |2 result needed id|days|week 2 |2 |4 3 |5 |1 4 |2 |3 8 |6 |2 i using inner join group week .but expected result returning wrong values without more info can , know not answer can expand on it. select min(id),max(days) ,week main group week you mention join. please post query.

recurring billing in php application using braintree payment gateway? -

if can implemented braintree payment gateway in php me recurring billing in php application using braintree payment gateway my code follows: <?php function braintree_text_field($label, $name, $result) { echo('<div>' . $label . '</div>'); $fieldvalue = isset($result) ? $result->valueforhtmlfield($name) : ''; echo('<div><input type="text" name="' . $name .'" value="' . $fieldvalue . '" /></div>'); $errors = isset($result) ? $result->errors->onhtmlfield($name) : array(); foreach($errors $error) { echo('<div style="color: red;">' . $error->message . '</div>'); } echo("\n"); }c ?> <head> <title>braintree payment - debt relief</title> </head> <body> <?php if (isset($_get["id"])) { $result = braintree_transparentredirect::confir...

ruby - Override instance variable of parent controller in child controller -

i have 3 controllers inherit applicationcontroller . child controllers are: homecontroller index the home controller has 1 method, index , , renders form. templatescontroller templates save_page_name preview the templatescontroller has 3 methods. templates lists templates , preview opens preview of selected template. save_page_name endpoint of form submitted home#index . designscontroller home about template#preview renders view iframe contains design#home . every method in designscontroller requires value set form fetch data from. (data being fetched api.) now. want create globally accessible variable designcontroller . i.e. want make value come form global. have put code in parent controller here code: class applicationcontroller < actioncontroller::base protect_from_forgery with: :exception before_action :page_name def page_name @page_name = '' end end and intend on overriding in template#save_page_name : def...