Posts

Showing posts from April, 2010

signal processing - Incrementing a variable inside a function on MATLAB -

my goal being able graph following: x(n)= delta(n)+delta(n-1)+delta(n-2)+….+delta(n-10)+delta(n-11) i have written code: n = -15:15 e(m) = dirc(n(m)); k = 1 m = 1 : length(n) while k < 12 e_1(m) = dirc(n(m)-k); k = k + 1 end e(m) = e(m) + e_1(m) end subplot(4,4,5); stem(n,e,'m','markersize',3,'linewidth',1) xlabel('n') ylabel('\delta[n]') title ('(e)') and wrote function dirc follows: function output = dirc(input) output = 0; if input == 0 output = 1; end end the error index exceeds matrix dimensions as can see, terminating function, i'd able graph eventually: x(n)= delta(n)+delta(n-1)+delta(n-2)+…. you're not showing m in second line, that's probable source of problems. also, you'll have pre-allocate vector e if want increment values in loop, can give out-of-bounds errors. as rest of code, can replace dirc(input) input==0 , resulting logical valu

python - Memory usage OneVsRest sklearn -

i'm having trouble memory usage using sklearn's onevsrest class in loop crossvalidation (we cannot use sklearns crossvalidation methods different reason not related question). the setup classifier this: clf = make_pipeline(tfidfvectorizer(), onevsrestclassifier(sgdclassifier(loss='log', n_iter=5, penalty=none, alpha=1e-7, average=true)) using memory_profiler module, memory usage looks this: line # mem usage increment line contents ================================================ (...) 231 1092.8 mib 911.7 mib clf.fit(x_train, y_train) (...) next loop: 231 2001.8 mib 897.4 mib clf.fit(x_train, y_train) next loop: 231 2892.5 mib 890.5 mib clf.fit(x_train, y_train) next loop: 231 2928.1 mib 35.6 mib clf.fit(x_train, y_train) next loop: 231 2977.6 mib 49.5 mib clf.fit(x_train, y_train) next loop: 231 3009.2 mib 31.6 mib clf.fit(x_tra

Git ignore dir but unignore files in dir -

Image
yes, duplicate question. answers far not working me. i'm running git v 2.6.4 on osx. here's .gitignore : /src/artwork/dist /dist/* !/dist/dandelion.yml for line 2, i've tried /dist/** , running git status still not show /dist/dandelion.yml . note /dist git repo, , i'd avoid using git add -f if have to. me forcing means you're doing wrong. why not adding .gitignore each folder want include file. since have multiple dist folders should place .gitignore specific rules per folder. if understood correctly folder structure: | |-dist . . |-src |- artwork |- dist what have done far: # ignore dist folder under src/artwork /src/artwork/dist # ignore dist folder under root folder /dist/* # not ignore dandelion.yml under root/dist folder !/dist/dandelion.yml note /dist git repo, why not adding submodule? save need add desired files .gitignore & make more sense if inner repo. submodule

multiprocessing - Only allow Android apps to be installed on devices with multi-core processors -

Image
is possible make android application available/installable on devices multi-core processors? know app can made android versions , hardware specifications such front facing camera. one way programmatically solve number of cores on device calling runtime.getruntime().availableprocessors() , finish activity if device doesn't meet requirements, not correct approach. so, how do on google-approved kind of way? if going publish on google play store, using android console provided google, can exclude devices. devices not able install app. option on apk section. means have make list of devises without multicore processors. there "supported devices" list can edit. sadly no "cores count" filter.

javascript - Match parts of code -

i'm trying match parts of code regex. how can match var, a, =, 2 , ; from "var = 2;" ? i believe want regexp: /\s+/g to break down: \s selects non-whitespace characters, + makes sure selects multiple non whitespace characters (i.e. 'var'), , 'g' flag makes sure selects all of occurrences in string, , instead of stopping @ first 1 default behavior. this helpful link playing around until find right regexp: https://regex101.com/#javascript

finite automata - Moore Machines with n states -

i working on end of chapter question regarding how many different moore machines there n states. n = number of states, m = number of input letters, , q = number of output characters, correct there n*q^m possible machines? reasoning each state, each input has possibility lead 1 of give output characters. a moore machine consists of: set of states s (n) start state s0 input alphabet sigma (m) output alphabet (q) transition function (s x sigma -> s) output function (s -> a) the number of states , input/output-characters given. for start state there n possibilities. for transition function , there |s| ^ (|s| * |sigma|) = n^(n*m) different variants. finally, there |a| ^ |s| = q^n output functions this yields in total n^(n*m+1) * q^n different moore machines.

twig - Add "Return to" to FOSUserBundle login form -

the title says everything. code have enter where? if dont understand title, mean give template this <a href="{{ path('fos_user'_security_login', {}|merge({'redir': 'blog_default_index'})) }}">link</a> and output should be... (example) <a href="http://localhost/login?redir=http://localhost/blog/index" and think controller need like... /* * @route('/login', defaults={"redir" = "blog_default_index"}) */ please help. have no idea try build href in 2 steps: <a href="{{ path('fos_user_security_login') }}?redir={{ path('blog_default_index') }}">link</a> alternatively if add _target_path hidden input login form, user redirect path: <form> ... <input type="hidden" name="_target_path" value="{{ path('blog_default_index') }}" /> </form>

css - How to remove the blue color in selected tab pane -

Image
i'm working on javafx project, have fxml interface put tab pane, when select tab , border of selected button colored in blue, style want let white color add no border. my image here has blue outline. to image my css code styling tab pane: .tab { -fx-background-color: #fbfbfb; -fx-border-width: 0 0 1 0; -fx-border-color: #c2c2c2 #c2c2c2 #c2c2c2 #c2c2c2 } .tab:selected { -fx-background-radius: 0; -fx-background-insets: 0; -fx-background-color: #fbfbfb; -fx-border-width: 0 0 3 0; -fx-border-color: #c2c2c2 #c2c2c2 #ff9500 #c2c2c2 } .tab-pane *.tab-header-background { -fx-background-color: #fbfbfb, #fbfbfb, #fbfbfb; -fx-border-width: 1 0 1 0; -fx-border-color: #c2c2c2 #c2c2c2 #c2c2c2 #c2c2c2 } to find default ‪stylesheet of tabpane‬, looked file ‎jfxrt‬.jar in computer, , open in archiver winrar ‪‎caspian‬.css @ com/sun/javafx/scene/control/skin/caspian.css. knowledge, can see there causes issue. caspian

java - Serializing/Deserializing a standalone integer using protocol buffers -

up now, i've been using protocol buffers serialize , deserialize objects using code-generated classes. now attempting serialize , deserialize single 64-bit integer. problem is, i'm getting different results in java , c#. here's how i'm doing in java.... private static byte[] convertlongtobytearray(long value) throws ioexception { int size = codedoutputstream.computeint64sizenotag(value); byte[] buffer = new byte[size]; codedoutputstream codedoutputstream = codedoutputstream.newinstance(buffer); codedoutputstream.writeint64notag(value); codedoutputstream.flush(); codedoutputstream.checknospaceleft(); return buffer; } and here's how i'm doing in c#, using protobuf.net: public void serializelongvalue() { long n = 9876; byte[] memorybuffer = null; using (memorystream destination = new memorystream()) { protobuf.serializer.serialize(destination, n); destination.flush(); memorybuffer = d

design - Is too much white space in source code frowned upon? -

i using white space in code organize functions , make more readable. idea if can organize visually easily, can organize mentally easy. understand company might ask format code way, suppose asking in more general sense. example: function cons_js ( css_cons ) { var _cons_js = document . createelement ( 'textarea' ); css_cons ? _cons_js . setattribute ( 'style', css_cons ) : _cons_js . setattribute ( 'style', css_cons_def() ); document . body . appendchild ( _cons_js ); _cons_js . setattribute ('spellcheck', false ); . html = _cons_js; return this; } you're correct different organizations have different styles. projects ask conform style guide style of codebase project uniform. however, if you're writing code project use, feel free whatever want long syntact

php - MySQL will not insert transaction -

i trying transaction execute. can normal query execute not transaction. these queries: $queries[] = "start transaction"; $queries[] = "insert `customer_register` ( `c_email`,`web_customer_id`,`c_realname`,`c_password` ) values ( 'support@mail.com','1','name','test' )"; $queries[] = "commit"; method commit transaction: private function commit_transaction($queries) { foreach($queries $query) { if($this -> db -> blank_query($query)) { continue; } else { $this -> db -> blank_query("rollback"); return false; } } return true; } method execute query: public function blank_query($query) { $result = mysqli_query($this -> link, $query); if(mysqli_errno($this -> link)) { if(!empty($this -> note)) { $this -> note -> pushnotification('error', "error executing blank query&qu

html - WordPress/Bootstrap mobile menu disappears on scroll -

i have issue on particular website - http://www.stonecrestre.com - i've been scratching head days trying solve. on mobile when toggle menu open disappears start scroll down. weird thing doesn't happen in chrome inspector, can scroll , down menu fine. any guidance helpful. thank you! :d you need change position: relative; to position: fixed; in css name header.

c# - How do you pass an object from the model to the view while specifying which variable of the object? -

so pretty fresh .net, c#, , mvc. the issue having have created employee object in home controller under index(): public actionresult index(string name, string id, decimal? hourlypayrate, int? hoursworked) { var emp = new employee(name, id); if(name == null || id == null || !hourlypayrate.hasvalue || !hoursworked.hasvalue) { return httpnotfound(); } else { return view(emp); } } i wanting pass view employee's name display title. here current view: @model practice.models.employee @{ viewbag.title = ; } <div class="jumbotron"> <h1>asp.net</h1> <p class="lead">asp.net free web framework building great web sites , web applications using html, css , javascript.</p> <p><a href="http://asp.net" class="btn btn-primary btn-lg">learn more &raquo;</a></p> </div> i'm not sure if i&

calculus - Surface integration in MATLAB -

i'm facing problem in calculating surface integration. defined function below calculates surface integration discrete dataset using trapezoidal rule. < trapz2d.m > function out = trapz2d(x,y,f) x = x(:); y = y(:); nx = length(x); ny = length(y); dx = diff(x); dy = diff(y); ds = dy*dx.'; df = (f(1:ny-1,1:nx - 1) + f(2:ny,1:nx-1) + f(1:ny-1,2:nx) + f(2:ny,2:nx))/4; out = sum(sum(ds.*df)); end i calculated surface integration using function , dataset in link below, , compare value obtained "trapz" matlab built-in function. < surfinteg.m > clc close clear format long load('dataset.mat') i1 = trapz(y, trapz(x,pz3,2)); i2 = trapz2d(x,y,pz3); disp([i1; i2]) >>>1.0e-12 * 0.307618158054522 - 0.000000000004792i 0.307618158054522 - 0.000000000004792i i1 = trapz(y, trapz(x,pz1,2)); i2 = trapz2d(x,y,pz1); disp([i1; i2]) >>>1.0e-27 * -0.135645057561047 + 0.013248760976931i -0.129

html - How to pass content in to different template parts in Wordpress (split screen) -

i have created split screen template want use across various pages. want content different on both sides in of these templates. instance on 'about us' there nav menu on left , content on right. on 'services' there content on left , right of split screen. so how can change content added in space according page on? using acf if makes difference. how pass in different content each side of these template parts? or there way? i considering adding split screen each page, isn't dry. split screen template html below: <section id="content"> <section class="left-split"> <div class="left-split-content"> // left side content here </div><!-- left split content --> </section><!-- left split --> <section class="right-split" data-spy="scroll" data-target="#myscrollspy" data-offset="70"> <div class=&qu

java - How to pass argument in firefoxprofile? -

to avoid hardcoding of pathname download folder, using xml file store pathname. here code: public class driver { //public static webdriver driver=new firefoxdriver(ffprofile()); public static webdriver driver=new firefoxdriver(ffprofile(downloadpath)); // method handle firefox browser profile //public static firefoxprofile ffprofile() public static firefoxprofile ffprofile(string downloadpath) { firefoxprofile profile = new firefoxprofile(); //string downloadpath="c:\\users\\xxxx\\downloads"; profile.setpreference("browser.download.folderlist", 2); profile.setpreference("browser.download.dir", downloadpath); profile.setpreference("browser.download.manager.alertonexeopen", false); profile.setpreference("browser.helperapps.neverask.savetodisk", "application/vnd.ms-excel,application/msword, application/csv, application/ris, text/csv, image/png, ap

security - Azure Event Hubs: How to grant SAS tokens to Javascript publishers (running in browser)? -

i building website analytics solution based on azure event hubs. have javascript code embedded in each web page publishes events directly event hub via azure event hubs rest api . the rest api requires each call authenticated via sas token. questions - have code server side endpoint provide publishers temporary tokens before can start publishing? are there alternative approaches? does rest api provide "authenticate" end point out of box? (couldn't find here ) or, how terrible, security wise have token hard coded client-side code? or, technically feasible security-wise worse option 2 , hard-code event hub's shared access key in client-side code , use (unofficial) azure servicebus javascript sdk generate sas token on fly? event hub rest api not provide authentication end point. have code generation of sas tokens per client (browser or device) on server side (may part of authn/z routines?). refer reddog.servicebus nuget package generate sas tok

php - cant get data from database with mysqli -

i can not figure out why code not working. im trying create temp table , pull data filter data out. cant seem echo data echos column name. here code: if (!$conn) { echo "<a href='getschedule.php'><button>go back</button></a>"; die("connection failed: " . mysqli_connect_error()); }else{ echo "connected successfully<br><br>"; } $seasontemp = "create temporary table seasontemp ( id int not null, firstname varchar(255), lastname varchar(255), number varchar(255), address varchar(255), plan_start date not null, plan_comp int(11), plan_skip int(11), trim_start date, trim_comp int(11), trim_skip int(11), spray_start date, spray_comp int(11), primary key(id) )"; mysqli_query($conn, $seasontemp) or die ("sql error : ".mysqli_error($conn)); $insertseason = "insert seasontemp (id, plan_start, plan_comp, plan_skip, trim_start, trim_comp, spray_start, spray_comp) select id, pl

Parsing xml file with xpath and xquery using eXist-db -

i need fetch <title> element following xml using xquery (i'm using exist-db). <?xml-stylesheet href="shakes.xsl" type="text/xsl"?> <!--!doctype play public "-//play//en" "play.dtd"--> <clinicaldocument xmlns="urn:hl7-org:v3"> <play> <title>the tragedy of hamlet, prince of denmark</title> </play> </clinicaldocument > when try xquery below not getting expected output. xquery version "3.0"; doc("/db/apps/demo/data/hamlet.xml")/clinicaldocument/play/title i think problem related xmlns attribute present in <clinicaldocument> tag: <clinicaldocument xmlns="urn:hl7-org:v3"> how can modify xquery retrieve desired xml element? declare prefix mapped xml default namespace, , use prefix reference elements in namespace, : declare namespace d = "urn:hl7-org:v3"; doc("/db/apps/demo/data/hamlet

ios - Alamofire “Info.plist” couldn’t be opened because there is no such file -

i'm using alamofire in project. i'm not using cocoapods. drag , dropped in project shown in alamofire github tutorial. now i'm facing issue while compiling project it's showing: "alamofire “info.plist” couldn’t opened because there no such file". i've tried deleting derived data , shown in web. please give me solution this. don't drag , drop alamofire.xcodeproj project navigator of application's xcode project. add alamofire.xcodeproj right click on project , in project , rest follow in alamofire github tutorial. if drag , drop xcode project, it's not copying files that.

php regex to match algebraic equation within a dynamic string -

i have strings following 3<em>a +</em> 2<em>b</em> 2<em>a </em> - 2<em>b</em> and want convert them following 3 a + 2 b 2 a - 2 b strings may or may not have <em></em> tags basically need parse algebraic equations dynamic string. following cases code should consider: 2<em>a </em>- (<em>a </em>- 2<em>b)</em> <em>a&nbsp;</em>- 2<em>b</em> <em>a </em>+&nbsp;2<em>b</em> 3<em>a +</em>&nbsp;2<em>b</em> (<em>p</em>&nbsp;+ 2) (<em>p</em>&nbsp;- 3) <em>not algebraic equation. tags should not truncated.</em> i tried match above strings using regex, could'nt. php code: $string = "3<em>a +</em> 2<em>b</em>"; $pattern = '#(\d{0,9}<em>a.*</em>)#'; preg_match($pattern, $string, $matches); echo

asp.net mvc - How to pass multiple parameter from view to controller in .Net MVC -

i need pass 2 parameters id , date view controller side on click event. may basic question not able so. i tried code code <a href='/abc/details/id?=@website_id, date?=@date' class="" id="prev" >prev</a> and how parameter @ controller side. i don't want use "ajax" or javascript if possible first of either need create custom route or enable mapmvcattributeroutes in routeconfig file adding below line of code. routes.mapmvcattributeroutes(); then in controller above defined action add below. [route("/abc/details/{id}/{date}")] if want make nullable then. [route("/abc/details/{id?}/{date?}")] your action method below. [route("/abc/details/{id?}/{date?}")] public actionresult details(int id, string date) use @html.actionlink instead of hard coding links. if wanted go custom route add above default route . routes.maproute( "mycustomroute",

ibm mobilefirst - java.lang.IllegalStateException: Cannot change identity of an already logged in user in realm -

i getting following error while login cannot change identity of logged in user in realm 'adapterauthrealm'. application must logout first. fwlse0101e: caused by: java.lang.illegalstateexception: cannot change identity of logged in user in realm 'adapterauthrealm'. application must logout first. my code follows adapter.js function submitauthentication(username, password){ serversession = storesession(username); if (username!=""){ var useridentity = { userid: username, displayname: username, attributes: { foo: "bar" } }; wl.server.setactiveuser("adapterauthrealm", useridentity); return { authrequired: false }; } return onauthrequired(null, "invalid login credentials"); } function onlogout(){ wl.server.setactiveuser("adapterauthrealm", nul

How to sort associative arrays by value of a given key and maintain key in php? -

this question has answer here: how sort array of associative arrays value of given key in php? 15 answers given array $inventory = array( "sdfsdfsdsx65fsdf1"=>array("type"=>"fruit", "price"=>3.50), "sdfsdfsdsx65fsdf2"=>array("type"=>"milk", "price"=>2.90), "sdfsdfsdsx65fsdf3"=>array("type"=>"pork", "price"=>5.43) ); i want output below $inventory = array( "sdfsdfsdsx65fsdf3"=>array("type"=>"pork", "price"=>5.43), "sdfsdfsdsx65fsdf1"=>array("type"=>"fruit", "price"=>3.50), "sdfsdfsdsx65fsdf2"=>array("type"=>"milk", "price"=>2.90) ); $inven

java - How to access web layer(Controllers) from the DAO Layer? -

i had cancel running queries. in dao set entity.session in servletcontext when start query , remove when query finished. check in controller if session present in servletcontext , if present cancel query calling session.cancelquery() session object in servletcontext . this working fine in dev environment, in pre-prod testing entire code not run inside tomcat container. web part runs in tomcat whereas data layer runs java application. hence not find servletcontext in dao class , gave me classnotfound exception so decoupled web layer in dao. set hibernate.session in controller when calls dao calculate() . created problem, session exists if there no calculations going on , in actual there post or precalculations. , mechanism cancel query doesn't work. so need way access controller dao set session. have used static method in controller , set session think again not practice. dao initial code: public calculate(){ session session = mentitymanager.unwrap(session.cla

php - How to Update 1,000,000 data in my sql database in less time? -

i need update , insert around 1 million data in mysql data base, when using following code takes more time. please suggest how can update , insert data fastly? include('db.php'); include('functions.php'); $functions=new functions(); set_time_limit(0); $column="rank"."_".date("y-m-d"); $count=$functions->get_row("select count(id) ct alexa_filename status=1"); if($count->ct==100){ $alexas=$functions->get_result("select distinct (`sitename`),`$column` `top-2m` `status`=0 limit 100" ); if(!empty($alexas)){ foreach($alexas $alexa){ $site_name=$alexa->sitename; echo $site_name; $rank=$alexa->$column; $table=$functions->find_table_name($site_name); $count=$functions->get_row("select count(site_name) ct `$table` site_name='$site_name'"); if($count->ct==0){

hadoop - Flume interceptor in Python -

i have absolutely no experience of working in java. can let me know if there way code flume interceptor in python? following java implementation: https://thisdataguy.com/2014/02/07/how-to-build-a-full-flume-interceptor-by-a-non-java-developer/ no, flume not have python interceptor or concept of streaming data out process, similar mapreduce streaming or spark streaming. 1 of reasons flume event little more complex has concept of headers , body. difficult stream event python

php - Displaying Farsi legend and tooltip of highchart in Farsi moodle page correctly -

i use highchart in farsi(persian) moodle site. when use chart in farsi page, it's legend , tooltip show badly image in link: use highchart in farsi moodle page farsi data what must do?? when use highchart same data in english moodle site, chart show as: use highchart in english moodle page farsi data part of code call highchart this: <div id="container0" style="min-width: 400px; height: 400px; margin: 0 auto; margin-top: 2em" align="center"> </div> my highchart code: highcharts.setoptions({ colors: color_items_array}); var chart; $(document).ready(function() { chart = new highcharts.chart({ chart: { renderto: conta, type: type, marginright: 130, marginbottom: 25 }, title: {

logback - Intellij 14 console not respecting ANSI colors -

i have defined color highlighting in logback appender configuration: <encoder> <pattern>[%thread] %highlight(%-5level) %cyan(%logger{15}) - %msg %n</pattern> </encoder> however, logs in idea intellij 14 console still black , white ansi color not escaped: [main] [39mdebug[0;39m [36mo.o.x.xmlconfigurator[0;39m - loading configuration xml document i use osx 10 (yosemite). how can fix it?

javascript - Jquery Image on Hover make input type file -

Image
while hover icon shows on image. want display icon this and while click, should allow browse files <input type ='file'> how can this? i tried putting file tag all, didn't worked. how can this? .profile-img-container { position: absolute; width:50%; } .profile-img-container img:hover { opacity: 0.5; z-index: 501; } .profile-img-container img:hover + { display: block; z-index: 500; } .profile-img-container { display: none; position: absolute; margin-left:43%; margin-top:40%; } .profile-img-container img { position:absolute; } <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <link href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css" rel="stylesheet" /> <link href="http://maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" rel="stylesheet" /> <sc

javascript - Associate row of datatable to bootstrap switch (using another column field) -

i'm using datatables , bootstrap switch plugins enable , disable users. when click on switch call web service throught ajax , rest web services switch status of user database. problem know whitch user selected datatables row , pass web service. table initialitanion: if ( ! $.fn.datatable.isdatatable( '#userstable' ) ) { usertable = $('#userstable').datatable({ responsive: true, //disable order , search on column columndefs: [ { targets: 1, orderable: false, searchable: false, } ], //fix problem responsive table "autowidth": false, "ajax": "table", "columns": [ { "data": "username" }, { data: "enabled

which java version to install Windows x86,Windows x64 so that it will run on both 32 bit and 64 bit -

when go download page of java there 2 version java windows x86 windows x64 how find out version suitable installation ? if os windows 32 bit download windows x86 version. if os windows 64 bit download windows x64 version. java platform independent. if use platform independent libraries when developing; app run on both 32 , 64 bit.

java - What locale does DecimalFormat and DateFormat use by default? (why is it different to Locale.getDefault()?) -

when debugging application, if found decimalformat , dateformat set use nl_nl default, system locale seems en_us . i found first evaluating: new decimalformat().symbols.locale new simpledateformat().locale and second: locale.getdefault() system.getproperty("user.country") system.getproperty("user.language") what happening there? how can set formatters use locale default? (i'm writing unit tests , set specific locale without touching application code) as of java 7, the default locale comes in 2 categories : "display" , "format". both set according environment. can found calling locale.getdefault(category) . besides system properties mentioned in question: "user.country" "user.language" the following can present when running jvm: "user.country.format" "user.language.format" "user.country.display" "user.language.display" the reason seems some os'

bash - running command in loop by properties file Shell script -

i want run git command to create new branch, command is: git checkout -b branch1.00 branch1.00 now want run command when instead of "branch1.00" have parameter (lets call $branch ) , parameter take it's value .properties file (lets call file prop.properties ) , run command on values in file. so if prop.properties file that: branch=branch1.00 branch=branch2.00 branch=branch3.00 branch=branch4.00 the git command run 4 times that: git checkout -b branch1.00 branch1.00 git checkout -b branch2.00 branch2.00 git checkout -b branch3.00 branch3.00 git checkout -b branch4.00 branch4.00 any idea how that? this while loop job: while ifs='=' read -r _ b; git checkout -b "$b" "$b" done < prop.properties if there no branch= prefix use: while read -r b; git checkout -b "$b" "$b" done < prop.properties this run these commands: git checkout -b branch1.00 branch1.00 git checkout -b branch2.

javascript - Scrolling to an element without ID in a window opened by window.open -

at top of page, have menu couple of items, , when click them, scroll point of in page div placed, using line of code: $('html, body').animate({scrolltop:$(divid).position().top - 160 }, 'slow'); where $(divid) contains classname of div. (i using drupal possibility of adding id not there). this works fluently, have same menu in page. when click link, navigate page div placed in, can't scroll div. after lot of research came piece of code $('#block-views-footer-menu-block-2 .views-row-6 a').click(function(e){ e.preventdefault(); var newwindow = window.open('/aanbod', '_self'); $(newwindow.document).ready(function(){ to_position('.field-paragraphs:nth-of-type(6)'); }); }); where to_position() contains first line of code in post. however, to_position() function fires before new window loaded. way, moment to_position() function fired, '.field-paragraphs:nth-of-type(6)' not known yet, funct

java - SwingWorker, done() is executed before process() calls are finished -

i have been working swingworker s while , have ended strange behavior, @ least me. understand due performance reasons several invocations publish() method coallesced in 1 invocation. makes sense me , suspect swingworker keeps kind of queue process calls. according tutorial , api, when swingworker ends execution, either doinbackground() finishes or worker thread cancelled outside, done() method invoked. far good. but have example (similar shown in tutorials) there process() method calls done after done() method executed. since both methods execute in event dispatch thread expect done() executed after process() invocations finished. in other words: expected: writing... writing... stopped! result: writing... stopped! writing... sample code import java.awt.borderlayout; import java.awt.dimension; import java.awt.graphics; import java.awt.event.actionevent; import java.util.list; import javax.swing.abstractaction; import javax.swing.action; import javax.swing.

c# - How to Cast A Variable Using Generic Type Parameter and 'as' Operator -

i have following generic static class being used in fluent api. takes input parameter , returns wrapper class containing parameter cast generic type.: public static foo<tout> inputas<tout>(object parameter) { var castparameter = parameter tout; if(castparameter == null) { throw new exception("invalid cast"); } return new foo<tout>(castparameter); } the problem castparameter == null check returns null . correct way cast object using tout generic parameter new type? well, if parameter tout returns null , runtime type of parameter isn't tout . don't forget operator resolution done @ compile-time, if have cast operators defined, not invoked here. if need that, can use dynamic : public static foo<tout> inputas<tout>(dynamic parameter) { return new foo<tout>((tout)parameter); } this allow runtime operator resolution, , call cast operator if 1 available. example, allow pass

asp.net - Selenium Firefox Pop-up blocker leads to fail the test case execution -

Image
we using selenium firefox webdriver automate our test cases. i'm automating sdl tridion manual activities creating component, creating page, tridion out-of box search etc.... when run test cases page creation test case, firefox's pop blocker ending blocking window supposed open. leads failing test case, other test cases working fine(fyi : i'm running local) on top of selenium project have built 1 asp.net web application , application has been configured in iis successfully. when run project hitting server url, test cases got executed successfully.(note: no firefox pop-up blocker issue) but couln't execute selenium project our local, because of firefox driver pop-up blocker issue. i have tried couple of things didn't work out, , mentioned here 1. given url of site in firefox setting's(options->content->add exceptions->url of site) 2. setting preference in firefox profile below [testfixturesetup] public void init() { t

php - my query doesn't work -

i making login script connected database "undefined variable: dbusername in f:\xamp\register\login\functions.php on line 21" i have further checked , saw query doesn't work can guys me? if (isset($_post['sub'])) { include_once("connect.php"); $username = strip_tags($_post['username']); $password = strip_tags($_post['password']); $sql = "select id, username, password login username = '$username' limit 1"; $query = mysqli_query($dbcon, $sql); if ($query) { $row = mysqli_fetch_row($query); $userid = $row[0]; $dbusername = $row[1]; $dbpassword = $row[2]; } if ($username == $dbusername && $password == $dbpassword) { $_session['username'] = $username; $_session['id'] = $userid; header('location: login.php'); } else { echo "incorrect username or password."

delphi - Load/Save .ini file -

i wrote code let's me save variables .ini file custom filename. filename depends on text in editbox1. no problem there. issue how load variables custom filename selecting file load file window (windows explorer). dataini:=tinifile.create(getcurrentdir+'\save folder\' + editbox1.text +'.ini'); sample save variable dataini.writestring('info','firstname',editfirstname.text); dataini.writestring('info','middlename',editmiddlename.text); dataini.writestring('info','familyname',editfamilyname.text); sample load variable editfirstname.text := dataini.readstring('info','firstname',editfirstname.text); editmiddlename.text := dataini.readstring('info','middlename',editmiddlename.text); editfamilyname.text := dataini.readstring('info','familyname',editfamilyname.text); so example editbox1.text = 'myfile1', how load variables saved in myfile1.ini selecting myf

machine learning - How different does each output unit have to be? -

Image
i'll use example of classifying pumpkins. take example of cinderella pumpkin versus gourd pumpkin intuitively, may seem wise classify these images 2 different outputs, cinderella-pumpkin , gourd-pumpkin , due how different look. my question is, if take training set of images includes both cinderella pumpkins , gourd pumpkins , classify both of them under category of pumpkin , performance of network worse if instead separated them 2 categories? threshold when 2 objects different should put separate categories? or take more extreme example sake of clarity, if took pictures of cats , pictures of pineapples , classified them under same category, how ability of network affected in classifying each respective object in comparison if 1 created cat output , pineapple output? it depends on inherent similarity of training observations. don't set threshold: use power iteration clustering (or other unsupervised classification) guide me on there significant divi

delphi - How to recreate exceptions of recurring appointment in the proper order? -

i have following issue: assume recurring event on 15, 19, 23, 27... february in exchange '19' occurrence moved 21 next, '15' occurrence moved 20. moves past original start date (19) of 2nd occurrence now if want recreate recurring event in exchange first create master event, i.e. automatically regular occurrences, , must modify of these create exceptions in same order . if don't , first create '15->20' occurrence, fail, because modified date past regular '19' occurrence. exchange give me modified occurrence crossing or overlapping adjacent occurrence error. but how determine order? in simple test case getitem call master event not give me modifiedoccurrences in order in created: <t:modifiedoccurrences> <t:occurrence> <t:itemid id="aamka[snip]pqaaea==" changekey="dwa[snip]bix"/> <t:start>2016-02-20t09:00:00z</t:start> <t:end>2016-02-20t10:30:00z&l

Block annoying numbers on freeswitch -

i use freeswitch , block annoying numbers. far tried modify inbound_call.xml <extension name="annoying1"> <condition field="destination_number" expression="^5022xxxx$"> <action application="log" data="notice jest rozmowa przych (testowo muzyczka).: ${destination_number}"/> <action application="answer"/> <action application="playback" data="/home/mwalko/przywitanie.wav"/> <action application="hangup"/> </condition> </extension> it doesn't work, should change "destination_number"? how can recognize if example 5022xxxx calls? seems "destination_number" points number called, not calling one. destination_number contains digits entered caller, try out caller_id_number . keep in mind, can faked.

Standby and sleep modes in a mobile phone -

consider below case. 1) mobile phone booted. @ moment can said in run mode power consumption more. 2) if no activity done, after sometime screen goes dim. 3) after further inactivity, screen goes off. a) question is, can mobile phone in standby mode , sleep mode in above steps 2 , 3 respectively? another question is, suppose playing music , leave mobile sometime. in case mobile phone goes through 2 , 3 steps mentioned above. difference earlier scenario music being played in second scenario. in case, can mobile phone in standby , sleep mode respectively in 2 & 3 steps when music being played. if no activity there linux, cpuidle threads gets scheduled scheduler least priority process , brings cpu various low power states, other peripheral governed various other concepts of os. if screen goes dim can lead 2 possibilities : partial wake load , system down (some power save) linux suspend called (echo mem > /sys/power/stae) , full device suspended, (huge powe

private key - pkcs11-tool doesn't recognise RSA key -

pkcs11-tool fails import rsa private key, though it's parsed correctly openssl. fails with: error: openssl error during rsa private key parsing aborting. the key in dsa format , i'm trying import using: pkcs11-tool --module ... -y privkey --slot ... -w some/path.der -l --id ... the rsa private key may encoded in der in 2 ways. either has heading defining key is, or may list of fields (as defined pkcs#1 rsaprivatekey sequence). openssl command handles both forms transparently in cases, d2i_rsaprivatekey not. expects rsaprivatekey sequence directly available. the required file can generated either der or pem format file. it's done using openssl rsa -in ... -outform der -out ... the wrapped format looks in openssl asn1parse output: 0:d=0 hl=4 l=2370 cons: sequence 4:d=1 hl=2 l= 1 prim: integer :00 7:d=1 hl=2 l= 13 cons: sequence 9:d=2 hl=2 l= 9 prim: object :rsaencryption 20:d=2 hl=2 l= 0 pr

Correct syntax of let ... in and where clauses in Haskell -

i trying declare local variables (is right term in case of haskell?) in haskell using , let-in clauses. whenever clauses longer single line parse errors: > letexample :: int -> int > letexample 0 = 0 > letexample n = > let 1 = 1 > 4 = 4 > 8 = 8 > in one*four*eight when trying load above code ghci following error: letexample.lhs:4:33: parse error in let binding: missing required 'in' failed, modules loaded: none. i following error when trying load code below: whereexample:5:57: parse error on input ‘=’ failed, modules loaded: none. code: > whereexample :: int -> int > whereexample 0 = 0 > whereexample n = 1 * 4 * 8 > 1 = 1 > 4 = 4 > 8 = 8 what right way of using let , in above cases? the posted code mixes tabs , spaces. frequent cause of indentation problems. the

php - ErrorHandling in Yii -

Image
i have developed web application using yii, can't rich error handling solution. this code config/main.php 'components'=>array( 'errorhandler'=>array( // use 'site/error' action display errors 'erroraction'=>'site/error', ), ), sitecontroller public function actionerror() { if($error=yii::app()->errorhandler->error) { if(yii::app()->request->isajaxrequest) { echo $error['message']; } else $this->render('error', array('error'=>$error)); } } then not work showing how can reach solution? this problem solved itself. how solved problem add error function on inside accessrules function and comment config/main.php /* array( 'class'=>'cweblogroute', 'enabled'=>defined('yii_debug'), ), */ that's hope

swift - RxSwift: Zip Observables only if requirements are met -

imagine user profile allows editing of fields name , surname , age , avatarimage . when user clicks save , requests sent each value has been changed. now please think of functions signatures those: func rx_updateusername(name: string) -> observable<updateusernameresponse> func rx_updatesurname(surname: string) -> observable<updatesurnameresponse> func rx_updateage(age: int) -> observable<updateageresponse> normally zip requests this: let namereqobservable = rx_updateusername("gandalf") let surnamereqobservable = rx_updatesurname("the white") let agereqobservable = rx_updateage(123) let zippedrequests = observable.zip(namereqobservable, surnamereqobservable, agereqobservable, resultselector: { (usernameresponse, surnameresponse, areresponse) in return (usernameresponse, surnameresponse, areresponse) }).subscribenext(...) what should when want perform requests values changed? have tried .combinelatest() ?