Posts

Showing posts from January, 2015

javascript - How to run script in Firefox when a tab was closed? -

at our company using web application shared licenses. unfortunately if closes tab application running in wont release license lock. wondering whether possible run/trigger scipt when firefox tab closed, automatically release licenses? think greasemonkey might able this, haven't found solution yet. there both window.onbeforeunload , window.onunload , used differently depending on browser. can assing them either setting window properties functions, or using .addeventlistener : window.onbeforeunload = function(){ // } // or window.addeventlistener("beforeunload", function(e){ // }, false); usually, onbeforeunload used if need stop user leaving page (ex. user working on unsaved data, he/she should save before leaving).

python - DISTINCT ON in django -

this question has answer here: retrieving distinct records based on column on django 1 answer how following query: ordernotes.objects.filter(item=item).distinct('shared_note') basically, need ordernotes items, distinct on shared_note . when try , get: raise notimplementederror('distinct on fields not supported database backend') notimplementederror: distinct on fields not supported database backend i using mysql , cannot change db here. workaround in django? ordernotes.objects.filter(item=item).values_list('shared_note', flat=true).distinct()

android - How efficient in terms of speed is a Filterable custom ArrayAdapter? -

i need search varchar column of sqlite database word app , show results in listview. i'm using mensa library mensa github link because of speed offers very long texts. in project i've used filterable alongwith custom arrayadapter filters listitems based on text matching. wondering whether replace mensa usage filterable approach without compromising on search efficiency because mensa library increases apk size 3.37 mb i've checked jar file of mensa library, , big because include animal.keywords testing database inside jar. rename mensa-1.0.1.jar mensa-1.0.1.zip , , open archive manager. navigate com/dell/mensa/testutils/ , delete animals.keywords file. rename mensa-1.0.1.jar , , continue using it. file should 104.5 kb now.

Azure Web App Performance Test -

noticed performance test feature on azure web apps. appreciate if can clarification on below: is possible test multiple pages? possible specify page s test? possible test login state of user performance test including backend api call etc? each test test on single url. can specify url test. only http requests can made tests. if api calls depend on tokens in url only, can tested feature.

c# - Cast expression failure on Generic -

Image
apologize in advance, such trivial question confused i have class hierarchy follows namespace mynamespace { public class classa {} public class typea<a> : classa { public p1 { get; set; } } public class subtypea<a> : typea<a> : classa { public typea<a> p2 { get; set; } public void foo() { var x = new typea<classa>(); var y = (typea<classa>) p2; } } } why can't c# cast p2 typea<classa> while p2 instance of typea<a> a of type classa ? thanks you're looking covariance , isn't supported on classes, in interfaces , delegates. design interface follows: public interface itypea<out a> : classa { p1 { get; } } public class classa { } public class typea<a> : itypea<a> : classa { public p1 { get; set; } } public class subtypea<a> : type

php - Rewrite URL by variables -

i have search form with: 1) search (all time set - it's select form selected='true') 2) input (with accept a-z,a-z,0-9) 3) , other 2 select form first you can search 3 (except point 2) , want rewrite url 3 variables. when have variables rewrite looks like: rewriterule ^servers/([a-z-]+)/([a-za-z0-9-]+)/([a-z-]+)/([a-z-]+)/?$ servers.php?query=$1&matching=$2&playing=$3&location=$4 [nc,l] i tried rewriterule ^servers/([a-z-]+)/([a-z-]+)/([a-z-]+)/?$ servers.php?query=$1&playing=$2&location=$3 [nc,l] but doesn't work. can me ? <?php if(isset($_post['searchservers'])){ $okgame = 0; $oklocation = 0; //search type filter switch($_post['searchtype']){ case 'nameorip': case 'map': $query = $_post['searchtype']; break; default: $query = "nameorip"; break; } // sentence filter if(isset($_p

rest - Should response Content-Type always be same as Accept? -

i have resource original version of entity format , later, improved version breaking changes. the caller opts later versions using accept header. pretend moment service returns json. should response application/json or format in accept header? care if cheat? for example, or bad: client request: get /people/1; accept: application/vnd.personv2+json server response: 200 { "name": "john" }; content-type: application/json the server has presented v2 person format using json, has said "just" normal application json, opposed saying format requested. no, accept marks sort of content endpoint can handle. can endpoint deal json? xml? img? html? etc... more formally: the accept request-header field can used specify media types acceptable response. accept headers can used indicate request limited small set of desired types, in case of request in-line image. the content-type response has in payload in order request initiator kno

.net - Taskbar icon not showing for winforms -

i doing testing building winforms application called class library vba. started vb.net winforms project in vs2013, created test form changed application type windows forms application class library. i referenced dll in vba editor , called form using. public viewer testpdf.form1 sub viewer() set viewer = new testpdf.form1 viewer.show end sub this works unable icon form in taskbar. have checked form properties , both showintaskbar = true , formborderstyle = sizable. alt-tab shows form , default icon shows correctly in window header. i have looked through other similar questions on stackoverflow, of suggest re-setting form properties in shown event solves issue. have tested this: private sub form1_shown(sender object, e eventargs) handles mybase.shown me.formborderstyle = windows.forms.formborderstyle.sizable me.showintaskbar = true me.bringtofront() end sub however still not solve issue. can offer advice on i'm going wrong?

php - Remove authenticated user from context Symfony -

i know instruction how remove user has been authenticated no user has been authenticated. should delete content of session or there proper way ? you can try : $this->get('security.token_storage')->settoken(null); $this->get('request')->getsession()->invalidate();

transactional - Distributed Transaction or not -

i'm implementing code access remote sql server 2005 database , updates 2 tables in transaction. confused whether distributed transaction or not? because definition, distributed transaction occurs when update data on 2 or more network computer systems. in case code in single application domain , access , updates 1 durable resource manager. can't local because database remote. please advice. distributed transactions when 1 remote system / db queries another. you querying single remote data source not distributed. do aware however, remote queries don't appear distributed may under hood. e.g. query view on remote source, , view queries 1 or more other remote db's. has caught me out few times!

python - Pyramid authentication testing with webtest -

i configured pyramid app in order have user object attached request once has been authenticated following official tutorial . far good... while works , can test using browser, don't understand why in webtest tests user not attached request. configured test class in way: from my_pyramid_app import main make_app webtest.app import testapp pyramid import testing class logintestcase(testcase): def setup(self): self.config = testing.setup() self.app = testapp(make_app({})) and in test: # submit valid login data /login , expect redirect "next" response = self.app.post('/login', data, status=302) redirect = response.follow() it works expected, user gets authenticated , redirected path specified in "next", redirect.request not contain user . why? should do? ps. documentation of webtest says: the best way simulate authentication if application looks in environ['remote_user'] see if authenticated. can se

java - Copy comments from one excel sheet to another with Apache POI -

i have cell in 1 excel sheet contains comment. created this: creationhelper factory = wb.getcreationhelper(); drawing drawing = sheet.createdrawingpatriarch(); // when comment box visible, have show in 5x70 space clientanchor anchor = factory.createclientanchor(); anchor.setcol1(cell.getcolumnindex()); anchor.setcol2(cell.getcolumnindex()+5); anchor.setrow1(row.getrownum()); anchor.setrow2(row.getrownum()+70); comment comment = drawing.createcellcomment(anchor); string text = ""; richtextstring str = factory.createrichtextstring(text); comment.setstring(str); row.createcell(0).setcellcomment(comment); now have new project, want copy comment cell of sheet, should work that: xssfrow row_master_a = null; xssfrow row_slave_a = null; for(int j = 4;j<anz_neu+4;j++){ row_master_a = sheet_master.getrow(4+anz_neu+3-j

unit testing - Spock mocks showing up as nulls -

here main class: @slf4j class consolereaderworker implements runnable { consolereader reader writer writer remotecommandselector commandselector @inject consolereaderworker(consolereader reader, writer writer, remotecommandselector commandselector) { super() this.reader = reader this.writer = writer this.commandselector = commandselector } @override void run() { try { string line while ((line = reader.readline()) != null) { commandselector.select(line).execute(writer) writer.flush() } } catch(interruptedexception ex) { log.warn("${this} interrupted with: ${exceptionutils.getstacktrace(ex)}") } } } here attempt @ spock specification class: class consolereaderworkerspec extends specification { def "when enter key pressed command selected , executed , writer flushed"() { give

r - Bring title to the top right corner -

Image
how can modify below code bring title top right corner. value <- c(0, 1, 20, 3, 3, 0, 0, 5, 2, 5, 2, 7) names.arg =c("0-15","15-19","20-24","25-29","30-34", "35-39","40-44","45- 49","50-54","55-59","60-64","65 jahre oder Älter") df <- data.frame(names.arg = names.arg, value = value) p1 <- ggplot(df, aes(x=names.arg, y=value)) + geom_bar(stat = "identity") save(p1, file = "p1.png") value2 <- c(0, 1, 20, 3, 3, 0, 0, 5, 2, 5, 2, 7) names2 =c("0-15","15-19","20-24","25-29","30-34", "35-39","40-44","45- 49","50-54","55-59","60-64","65 jahre oder Älter") df2 <- data.frame(names = names2, value = value2) p2 <- ggplot(df2, aes(x=names, y=value)) +

How to call json from php -

i have written php code should print response of json call. getting null output. have checked json call working fine restclient. here code <?php $username = "user"; $password = "password"; $postdata = array( 'username' => $username, 'password' => $password, 'msisdn' => "111111111" ); $ch = curl_init('http://ip:<port>/xxx/yyy/zzz'); curl_setopt_array($ch, array( curlopt_post => true, curlopt_returntransfer => true, curlopt_httpheader => array( 'content-type: application/json' ), curlopt_postfields => json_encode($postdata) )); // send request $response = curl_exec($ch); // check errors if($response === false){ die(curl_error($ch)); } // decode response $responsedata = json_decode($response, true); // print date response echo $responsed

Magento: How to exclude image from gallery programmatically? -

i creating products , images programmatically. thing not working "exclude gallery" feature. see http://snag.gy/qghpg.jpg details. how set in code? current code looks that: $product->addimagetomediagallery($myimage, array('image','thumbnail','small_image'), false, false); the flag called disabled think, not sure though. thanks! for example, disable images product $product = mage::getmodel('catalog/product')->load(12345); $images = $product->getmediagalleryimages(); $attributes = $product->gettypeinstance(true)->getsetattributes($product); $mediagalleryattribute = $attributes['media_gallery']; foreach ($images $image) { $mediagalleryattribute->getbackend()->updateimage($product, $image['file'], array('exclude' => true)); } $product->save();

php - How do I know which file system apache can not access on windows? -

i have typo3 application running on apache2 on windows 10 (as part of xampp). in apache error log see this: das system kann den angegebenen pfad nicht finden. das system kann den angegebenen pfad nicht finden. das system kann den angegebenen pfad nicht finden. ... das system kann den angegebenen pfad nicht finden. with no information file can not opened. string in german , stands "the system can not find specified path.". gave trying find place in php code causes problem , string not coming php or typo3. seem come apache or windows. i tried raising apache error_log level debug , didn't well. so question is: how find out path on filesystem apache tries access? update: php error log empty , enabled in php.ini - other errors arrive there. update2: looks found problem - icons handling fluid content element templates. 3 of templates had icons assigned them, , icon paths suffixed '[0]' reason version of typo3. typo3 attempts call imagemagik wrong image

javascript - dist folder generated using grunt build not working -

Image
i working on angular application created using yeoman , using grunt , bower task execution , dependency management respectively. application runs fine when run application using grunt serve when try run application deployment using grunt serve:dist getting error on console:- http://localhost:9000/dist/views/pages/login.html 404 not found and goes infinite loop. have attached browser console screenshot here can guide me error or start debugging pretty new angular, bower, grunt , node. please let me know if else needed grunt serve --verbose output e:\workspaces\scfs\sentinal>grunt serve --verbose initializing command-line options: --verbose reading "gruntfile.js" gruntfile...ok registering gruntfile tasks. initializing config...ok loading "gruntfile.js" tasks...ok + build, default, serve, server, test running tasks: serve running "serve" task loading "grunt-contrib-clean" plugin registering "e:\workspaces\scf

Python equivalent to mcrypt_create_iv in PHP -

basically converting php codeigniter's encryption method python stuck while converting php's mcrypt_create_iv library python. thanks in advance. mcrypt_create_iv() php interface os-level pseudo-random generators (it's not part of libmcrypt, contrary function name implies). python provides such interfaces via os module , need os.urandom() . for example, if need translate mcrypt_create_iv(16, mcrypt_dev_urandom) python, you'd need write os.urandom(16) . to clarify possible confusion: you may've used mcrypt_dev_random or mcrypt_rand in php, there literally no reason use either of instead of mcrypt_dev_urandom - better measurable criteria: mcrypt_rand in particular not suitable cryptographic purposes, or in other words - insecure . mcrypt_dev_random can , block until new entropy data available. don't want blocking in web application , myth /dev/random somehow better /dev/urandom because of blocking has been debunked . mcryp

html - Simple JavaScript timer -

i trying create simple javascript count down timer, have problem when displaying "minute" string "0" when has 1 digit, adds "0" every second while "seconds" not add more "0", 1 "0" when displays 1 numerical digit, how display 1 "0" minute? regards. <!doctype html> <html> <head> <meta charset="utf-8" /> <title>count down test</title> </head> <body> <p id="demo"></p> <script> var seconds = 10; //10 sec test, 60 var minutes = 5; //10 min test, 59 var hour = 1; //can set 48 hours 2days, 72 hours 3days //function display time function count() { if(hour == 0 && minutes == 0 && seconds == 0) { clearinterval(); } //reset seconds when reached 0 if(seconds == 0) { seconds = 10; //originally 60 minutes--; } if(minutes == 0) { minutes = 10; //originally

.net - On C# escape curly braces and a backslash after -

i trying format text can provide template rft text. my string declared stringformater as: var fulltitlestring = string.format( cultureinfo.currentculture, "{{\\test", title, filtername); but keep obtaining string "{\test". using single backslash results on errors @ not understand \t escaped character. doing @"{{\test" yields "{\test". have looked on msdn documentation , other questions tell use backslash escaping character, doesn't seem work. there 2 levevls of escaping here: 1. escaping string literals in c# strings, backslash ( \ ) used special character , needs escaped \ . if resulting string should \\uncpath\folder string literal should var s = "\\\\uncpath\\folder" . 2. escape format strings string.format uses curly braces place holders, need escape them braces. so let's have string title = "mytitle"; string filtername = "filte

visual studio - /t not working in C# console -

Image
when put \t in console.writelin() doesn't work if (reader.hasrows) { console.writeline("|{0}|\t|{1}|\t|{2}|\t|{3}|\t|{4}|", reader.getname(0), reader.getname(1), reader.getname(2), reader.getname(3), reader.getname(4)); while (reader.read()) { console.writeline("|{0}|\t|{1}|\t|{2} egp|\t|{3} egp|\t|{4}|", reader.getstring(0), reader.getint32(1), reader.getint32(2), reader.getint32(3), reader.getstring(4)); } } the result :: |product name| |quantity| |price per item | |total| |code| |a| |1| |0 egp| |1 egp| |12| even when use {0,10} or {0,-10} not working thank you. yes, it's work. sould imagine tabs columns markers. when put \t saying console: jump next available column mark. in header 'product name' has revased first tab column, when console process \t, jumps 2nd column. instead

Adding list item from list<> after comparing using c# -

i have list control, in adding items. have generic list of list comparing, want compare items of list control, , if found match don't wants include in list list. foreach( s s1 in s_list) { if (ex.count > 0) // if list not empmty { foreach(ex li in ex) // { if (s1.name.equals(li.tostring())) { flag=true; ex.add(s1.name); } } } else { ex.add(s1.name); } } problem is: its causing duplication in ex list, how done? i'm not sure understood trying achieve, code looks suspicious me: foreach(ex li in ex) // { if (s1.name.equals(li.tostring())) { flag=true; ex.add(s1.name); } } so, add s1.name list every time when find same element in list? way ex populated elements equal first added element. possibly job: foreach( s s1 in s_list) { boolean foundinex = false; foreach(ex li in ex) // {

java - JSP and JSTL conditionally render rows in table based on rule -

i have following in jsp page <table border=1> <thead> <tr> <th>user id</th> <th>first name</th> <th>dob</th> <th colspan=2>action</th> </tr> </thead> <tbody> <c:foreach items="${users}" var="user"> <tr> <td><c:out value="${user.userid}" /></td> <td><c:out value="${user.firstname}" /></td> <td><fmt:formatdate pattern="dd-mmm-yy" value="${user.dob}" /></td> <td><a href="usercontroller?action=edit&userid=<c:out value="${user.userid}"/>">update</

c++ - Atomic writes with respect to unexpected power offs -

i have ~100kb-long file overwritten every few minutes single writer operator << on std::ofstream . want avoid kind of "partial writing" situations might caused system being powered off while file being flushed disk. want in software as os/posix permits. my idea use overwrite-by-rename strategy, flush() data temporary filename, rename temporary filename final filename. my question if strategy, in sense atomicity on renaming guaranteed posix os (e.g. linux) or have better ideas (which not involve hardware modifications , possibly no fs flag modifications @ kernel/system level) if don't trust atomicity of rename - , can't in case of crash non-journaling filesystem - first rename original file temporary name, rename new file original name, , remove original file, temporary name. way, if crash occurs, @ least 1 of 3 filepaths not under modification.

java - How I can get the contact name from the android (CallLog.Calls.CONTENT_URI) table? -

i new android , working on application need outgoing call logs, number, call duration , name of contact. question can name , number of outgoing call calllog.calls.content_uri table of android system or need read separate table , map it. below code. in advance. private string getcalldetails() { stringbuffer sb = new stringbuffer(); // cursor managedcursor = // getcontentresolver().query(calllog.calls.content_uri, null, // null, null, null); cursor managedcursor = getcontentresolver().query(calllog.calls.content_uri, null, calllog.calls.date + ">?", new string[] { string.valueof("1451586601000") }, calllog.calls.number + " asc"); int number = managedcursor.getcolumnindex(calllog.calls.number); int type = managedcursor.getcolumnindex(calllog.calls.type); int date = managedcursor.getcolumnindex(calllog.calls.date); int duration = managedcursor.getcolumnindex(cal

ruby on rails - No route matches {:action=>"edit", :controller=>"comments", :id=>nil, :ribbit_id=>"18"} missing required keys: [:id] -

here's routes file: resources :ribbits resources :comments end here's comments_controller.rb edit action: def edit @ribbit = ribbit.find(params[:ribbit_id]) @comment = @ribbit.comments.find(params[:id]) redirect_to @user unless @user == current_user end and that's view: <% @ribbit.comments.each |comment| %> <div class="comment"> <% comment_user = comment.user%> <img src="<%= comment_user.avatar_url unless comment_user.blank?%>"> <%= comment.user.name if comment.user %> <p> <%= comment.body if comment %> </p> <%= link_to "edit", edit_ribbit_comment_path(@ribbit, comment) %> </div> <% end %> i getting error: no route matches {:action=>"edit", :controller=>"comments", :id=>nil, :ribbit_id=>"18"} missing required keys: [:id] would grateful help! issue in rabbi

Error while executing bash script -

i have file named 1.txt contains numbers, 2, 30,20,1 etc. trying compare each number in text file numeric value 20 , run command if value equal 20 , otherwise exit. my code given below. when try run bash script, getting error ---------- email.sh: line 2: [[2: command not found email.sh: line 2: [[1: command not found for f in $( cat 1.txt ); if [[$f -eq "20"]]; echo "sucess" fi done you should have space after [[ in if if [[ "$f" -eq "20" ]]; example $ if [[ "$f" -eq "20" ]]; echo "sucess"; fi sucess why? in bash [[ ]] construct called extended test command , , need separate tokens in language spaces.

javascript - Math.random and arithmetic shift -

if have following code in javascript: var index1 = (math.random() * 6) >> 0; var index2 = math.floor(math.random() * 6); the results index1 or index2 anywhere between 0 , 6 . i must confused understanding of >> operator. thought using arithmetic shift results index1 anywhere between 1 , 6 . i noticing, don't need use math.floor() or math.round() index1 if use >> operator. i know can achieve adding 1 both indexes, hoping there better way of ensuring results 1 6 instead of adding 1 . i'm aware bitwise operators treat operands sequence of 32 bits (zeros , ones), rather decimal, hexadecimal, or octal numbers. example, decimal number 9 has binary representation of 1001. bitwise operators perform operations on such binary representations, return standard javascript numerical values. update: i saw original usage in caat tutorial on line 26 , wondering whether return random number between 1 , 6 , seems ever return random number b

javascript - BigNumber usage with Webpack + Angular -

error: [$injector:unpr] unknown provider: bignumberprovider i'm starting project webpack + angular.js , want use bignumber.js can't include it. the part of webpack config: resolve: { root: [path.join(__dirname, 'assets/libs/bower_components'), 'node_modules'] }, entry: { entry: ['./app/app.js'], vendor: [ 'lodash', 'bignumber.js', 'angular' .... as it's library not include dependency in main app.js. i'm trying inject directive: app.directive('createpayment', [ '$http', ' * ', // i've tried bignumber, bignumber, binumber.js of doen't work // , there nothing in readme function($http, bignumber ? , bignumber ? ) { this can achieved utilizing provideplugin plugin webpack: webpack.config.js ... plugins: [ new webpack.provideplugin({

c# - Why "Index was out of range" exception for List<T> but not for arrays? -

when initialize array , access elements using indexer, works fine: object[] temp = new object[5]; temp[0] = "bar"; now expect same work list<t> , given can initialize passing capacity constructor: list<object> temp = new list<object>(5); temp[0] = "bar"; this last line throws following exception: index out of range. must non-negative , less size of collection why happen list<t> type, not array? since arrays lower level abstractions collections clr, why exception occur? original question awais mahmood . short answer: because 5 different things. long answer: when initializing array, set size, , size fixed. array cannot grow or shrink later on. therefore, object[] temp = new object[5]; means create new array 5 elements. hence, can access these elements right after creating array. for lists, size variable. instances of list<t> class internally use array storing items, , when add or remove ite

ruby on rails - How to change DATABASE_URL for a heroku application -

i've external database ready , want use database heroku app. i'm unable edit configuration variables. tried using gui, says, cannot overwrite attachment values database_url. while tried using cli well. used command: heroku config:adddatabase_url="postgresql://username:password@ip:port". however, throws error ........ not heroku command. after trying out these answers, came across update in 2016, here : database needs detached first, update variable of database_url. heroku addons:attach heroku-postgresql -a <app_name> --as heroku_database heroku addons:detach database -a <app_name> heroku config:add database_url=

gradle - How to Configure Spring Security Rest for Grails 3.x -

how configure spring security rest plugin grails 3.x (currently i'm using grails 3.1.0 rc2). the plugin page says "add compile :spring-security-rest:${version} buildconfig.groovy ," buildconfig.groovy has been removed grails 3.x edit: docs on plugin page have been updated so got working. first off, documentation located [here][1] more date. need add following build.gradle build.gradle dependencies { //other dependencies compile "org.grails.plugins:spring-security-rest:2.0.0.m2" } next, need run spring security quickstart grails s2-quickstart com.yourapp person role finally, need configure filter chain adding following application.groovy . application.groovy grails.plugin.springsecurity.filterchain.chainmap = [ //stateless chain [ pattern: '/api/**', filters: 'joined_filters,-anonymousauthenticationfilter,-exceptiontranslationfilter,-authenticationprocessingfilter,-securitycontext

Python multiprocessing - Why is using functools.partial slower than default arguments? -

consider following function: def f(x, dummy=list(range(10000000))): return x if use multiprocessing.pool.imap , following timings: import time import os multiprocessing import pool def f(x, dummy=list(range(10000000))): return x start = time.time() pool = pool(2) x in pool.imap(f, range(10)): print("parent process, x=%s, elapsed=%s" % (x, int(time.time() - start))) parent process, x=0, elapsed=0 parent process, x=1, elapsed=0 parent process, x=2, elapsed=0 parent process, x=3, elapsed=0 parent process, x=4, elapsed=0 parent process, x=5, elapsed=0 parent process, x=6, elapsed=0 parent process, x=7, elapsed=0 parent process, x=8, elapsed=0 parent process, x=9, elapsed=0 now if use functools.partial instead of using default value: import time import os multiprocessing import pool functools import partial def f(x, dummy): return x start = time.time() g = partial(f, dummy=list(range(10000000))) pool = pool(2) x in pool.imap(g, range(10)): p

unix - For loop not working in expect sript -

i have written expect script login server using ssh. but, when want same multiple servers using loop, doesnt work. below script: #!/usr/bin/expect match_max 5000 set expect_out(buffer) {} in `cat node_list.txt` node_ip=`echo $i| awk -f"," '{print $1}'` node_initial_pwd=`echo $i| awk -f"," '{print $2}'` spawn ssh root@$node_ip expect { "*(yes/no)?" {send "yes\r";exp_continue} "'s password:" {send "$node_initial_pwd\r";exp_continue} "*current*" {send "$node_initial_pwd\r";exp_continue} "enter*" {send "jan2016!\r";exp_continue} "retype*" {send "jan2016!\r";exp_continue} "\\\$" { puts "matched prompt"} } done node_list.txt has ip's , passwords separated comma(,). error this: mayankp@mayankp:~/scripts/new$ ./connect-to-server.sh invalid command name "i" while executing "i" ("for&qu

node.js - BPMN.IO examples not working in localhost -

i want run bpmn in localhost. after browsing whole day, tried steps install nodejs npm install bpmn-js // in cmd after don't know want do. also tried downloading bpmn example files saved in local path , opened "localhost/bpmn-js-examples-master/properties-panel/app" in chrome. and getting error in console => "uncaught referenceerror: require not defined" to solve have include require.js file index.html ( inside "localhost/bpmn-js-examples-master/properties-panel/app" ) but getting new console error => "uncaught error: module name "fs" has not been loaded yet context: _. use require([])" please, me this. from github: make sure use browserify or bundle project , bpmn-js browser. there sample project provided node environment. can use sample , build around it. important part you're missing grunt script browserifying code (this process prevents require not defined error).

ios - Multiple Automatically Renewable Subscriptions not showing -

i trying integrate multiple "automatically renewable subscriptions" in app, getting 1 of skproducts. there limitation apple on multiple "automatically renewable subscriptions"? got done - passing single productidentifier skproductrequest set. passing whole set of productidentifiers defined in itunes fixed problem. nsset *inappproductsset = [nsset setwithobjects:@"iap.prod1", @"iap.prod2", @"iap.prod3", nil]; skproductsrequest *request = [[skproductsrequest alloc] initwithproductidentifiers:inappproductsset];

javascript - Fixed element not being centered by jquery on Safari -

i have 3 elements supposed centered jquery upon page load. currently, 2 of elements centered correctly safari on desktop , mobile. #pulse_ball element not being positioned correctly; gets left style of -0.5px reason. after resize, however, 3 elements centered correctly. (on iphone) in portrait mode elements centered correctly after scroll, not in landscape mode. jsfiddle example css #pulse_ball: #pulse_ball { display: block; position: fixed; left: calc(50% - 27px); z-index: 25; top: 48%; } css #center_line: #center_line { width: 3px; background: #dbdbdb; margin: 0 auto; position: fixed; z-index: 0; } css #arrow_down: #arrow_down { display: block; width: 64px; position: fixed; bottom: 10%; left: calc(50% - 32px); } js code: centeritems(); $(window).resize(function() { centeritems(); }); function centeritems() { $("#center_line").height($("body").height()); $("#cen

javascript - Catch everything between words -

i have huge text, , catch between words "empresa". i'm trying to, second regex being ignored, , can't figure out why: /(empresa.*?empresa)/ http://regexr.com/3cm8a the problem is, can catch empresa - - empresa.. next, being ignored, because being used previous regex. so, improve catch @ all, can't figure out how. thanks!!! since need overlapping matches, need put trailing delimiter lookahead zero-width assertion (zero-width assertions not consume text, check if present or not). /empresa.*?(?=empresa|$)/g see demo note in order match characters including newline, need replace . [\s\s] . var re = /empresa[\s\s]*?(?=empresa|$)/g; var str = '------------------------------------------------------------------------------------------------------------------------------------ empresa santher-fab.papel sta therezinha folha fiscal p�gina: 1 -------------------------------------------------------------------------------------------