Posts

Showing posts from July, 2013

google spreadsheet - moveTo messing up cells outside the range -

im rearranging spreadsheet using google script. first sorting , moving rows within range end of sheet. everytime moveto function cells reference moved rows changed reflect new row numbers though cells outside range , should not modified. example if im moving cell b3 , have cell f4 =b3 when move b3 cell f4 changes whatever b3 now. tried locking =b$3 still didnt work. messes conditional formatting should in place entire column using "d2:e" , changes "d2:e109" or similar. clue whats going on? function onedit(){ var sheet = spreadsheetapp.getactivespreadsheet().getactivesheet(); var allowedsheet = 1; if(sheet.getindex() == allowedsheet) { var editedcell = sheet.getactivecell(); var sortby = [1, 3, 2]; var triggercol = [1,2,3,10,11,12]; var rangestart = "a"; var rangeend = "e"; var tablerange = "a2:e"; if(triggercol.indexof(editedcell.getcolumn()) > -1) { var range = sheet.getrange(tableran...

python optparse how to set a args of list? -

i want pass data script, if __name__ == '__main__': usage = 'python pull.py [-h <host>][-p <port>][-r <risk>]arg1[,arg2..]' parser = optionparser(usage) parser.add_option('-o', '--host', dest='host', default='127.0.0.1', ┊ help='mongodb host') parser.add_option('-p', '--port', dest='port', default=27017, ┊ help="mongodb port") parser.add_option('-r', "--risk", dest='risk', default="high", ┊ help="the risk of site, choice 'high', 'middle', 'low', 'all'") options, args = parser.parse_args() in script, if want set ./test.py -r high , middle, how can set ['high', 'middle'] in optparse ? https://docs.python.org/2/library/optparse.html#standard-option-types "choice" options subtype of "string" options. choic...

ios - Template for UITableViewCell without nib files or storyboard -

i want separate code decide how cell display uitableviewcell class reuse or switch template in runtime. this: -(void)settemplate:(mytemplate *)template { [self.productname setstylefrom:template.mainlabel]; .... } and don't want use nib files or storyboard, code only. thank you. you can use prototype cell if don't want add cell through .xib or class derived uitableview cell click link prototype cell http://www.raywenderlich.com/50308/storyboards-tutorial-in-ios-7-part-1

java - Liferay WorkFlow with Kaleo : use custom class on task -

Image
i'm working kaleo designer. as can see image : "import com.mypackage.mycustomclass". is possible import custom java class , call custom methods in kaleo designer actions? basically yes, of work needs done. need extend default beanlocator inject custom classes used services. able use them either in workflow script or web content templates. follow instructions in tutorial achieve goal. found usefull in case. https://www.liferay.com/web/pmesotten/blog/-/blogs/inject-any-custom-class-or-service-into-web-content-templates

javascript - Textarea automatic line break -

i have textarea on site want paste urls. is possible create line break every time paste url? if not, can create line break when enter space? i've searched solution found solution create line breaks after form submit didn't me. fiddle here: https://jsfiddle.net/3sj2644z/ this.value = this.value + "\n"; you listen paste event on textarea , grab text in , append linebreak escape character \n , place new string value textarea. you don't use html in textarea br tag doesn't work if think so.

Linux - reading from serial port error in C (Resource temporarily unavaliable) -

i trying read data serial port using usb/rs232 converter. sending data atmega , received in minicom. trying read sth in program ends error "resource temporarily unavailable". know caused o_ndelay, removing gives me plenty of empty messages isn't good. actually, want achieve program, every second transmit char atmega , wait response. depending on response different actions. after few unanswered transmissions program indicate error communication. but i'd @ least receive properly. here code: #include <unistd.h> #include <fcntl.h> #include <termios.h> #include <errno.h> #include <stdio.h> #include <string.h> int fd; //file descriptor int bytes; // bytes read int portopen(void) { fd = open("/dev/ttyusb1", o_rdwr | o_noctty | o_ndelay); if(fd < 0) { //opening error printf("port opening error\r\n"); } else { printf("port opened\r\n"); //...

html - Media Queries not working on mobile when in second file -

i've read through bunch of topics here on stackoverflow fix problem , did not find way fix yet. thats got: i got webtemplate using bootstrap 3. included following meta-tag: <meta name="viewport" content="width=device-width, initial-scale=1"> included following css files: <link rel="stylesheet" href="css/normalize.css"> <link rel="stylesheet" href="css/bootstrap.min.css"> <link rel="stylesheet" href="css/gamebooster.css"> when use of xs classes of bootstrap seems work fine. want add padding specific boxes , change height of logo if user using mobile device. thats why i've tried following piece of code: @media (max-width: 767px) { .navbar .navbar-brand img { width: 50px !important; } } it seems work fine if shrink browser window, when try out on mobile not work @ all. curious part is: i'm using exact same media query bootstrap is, , seems work. doi...

android - Stop Scrolling for CollapsingToolbarLayout when showing a Fragment -

i have viewpager inside activity shows 2 fragments . the activity has tablayout , collapsingtoolbarlayout . collapsingtoolbarlayout nested inside appbarlayout imageview produce parallax effect. tablayout outside appbarlayout inside linearlayout viewpager . there framelayout show fragment on viewpager when user clicks button show fragment . the problem when scroll recyclerview inside fragment overlays on top of viewpager activity scrolls , parallax effect. scrolls both recyclerview inside fragment , content inside viewpager well. is there way stop scrolling collapsingtoolbarlayout , scroll content in overlay fragment when user sees fragment ? this xml hierarchy looks like: <android.support.design.widget.coordinatorlayout> <android.support.design.widget.appbarlayout> <android.support.design.widget.collapsingtoolbarlayout app:layout_scrollflags="scroll|exituntilcollapsed"> <imageview app:l...

php - How do I change part of a URL using form input? -

i working on site customers can click on various buttons , input text forms , image of product change. able see multiple views of product slider. i need able grab input form field , replace part of url product image being called input. have included jsfiddle of code using. http://jsfiddle.net/jaysenedwinward/4pu2k4m3/1/ <div id="productimage"> <img id="vignette" src="http://scene7.website.com/layer/decal&src=ir{vignette=012345&color=678910&pos=1&show}" width="300" alt="slider images"/> </div> <div id="spinner"> <input type="range" name="slider" id="slider" value="180" min="0" max="370" step="45"/> </div> in 'src' able use input different forms change numbers 'vignette', 'color'. love more slider able change value 'pos' in url too, current value of slider used in ...

Elasticsearch error when trying to register Percolator with geo_distance filter -

i'm using elasticsearch marvel/sense plugin create index of shapes dot type , register geo_distance filter in percolator: put shapes { "mappings": { "dot": { "properties": { "location": { "type": "geo_point", "fielddata": { "lat_lon": "true", "precision": "1cm" } } } } } } put shapes/.percolator/in_sight { "filtered" : { "query" : { "match_all" : {} }, "filter" : { "geo_distance" : { "distance" : "200km", "location" : { "lat" : 40, "lon" : -70 } } } } } this yields following error: { "error": "...

command line - why can't Jenkins see some System32 files? -

situation : the slave in question real windows (not vm) problem : i run following windows line command on system bcdedit.exe -set testsigning on when try run through jenkins, got message : 'bcdedit.exe' not recognized internal or external command, operable program or batch file. why? throught jenkins cannot see file dir in system32 either i found out when run bcdedit.exe , goes system32 , , because jenkins application have 32 bits, windows 7 redirect acces system32 syswow64 doesn't have bcdedit.exe . to know more redirection, see : https://msdn.microsoft.com/en-us/library/windows/desktop/aa384187%28v=vs.85%29.aspx?f=255&mspperror=-2147217396 to solve it, executed file whole path, , instead of system32, use word sysnative (explanation here sysnative) : https://social.technet.microsoft.com/forums/scriptcenter/en-us/28974b59-1b79-44fd-8bb2-a0a412e18862/script-to-disable-64bit-file-system-redirection

mysql - How can I write a query to aggregate multiple strings into one field? -

i trying merge 3 tables. first table has id , data_name, second table data_id, option_id , property, third table user_id, data_id. for example: first table +----+-----------+ | id | data_name | +----+-----------+ | 1 + veri1 | | 2 + veri2 | | 3 + veri3 | +---++-----------+ second table +----------+----------+-----------+ data_id | property | option_id | +----------+----------+-----------+ | 1 | blue | 1 | | 1 | cold | 2 | | 2 | gray | 1 | | 2 | hot | 2 | | 3 | green | 1 | | 3 | cold | 1 | +----------+----------+-----------+ third table +----------+-----------+ | user_id | data_id | +----------+-----------+ | 1 | 2 | | 2 | 3 | | 3 | 1 | +----------+-----------+ i want get: user: 1 data: veri2 properties: gray - hot how write sql this? first start clause. data stored want? from user...

ArcGIS for iOS - How to stop seeing outside map -

in project, have agsmapview taking screen starts zoomed out show entire world map. have set wrap around horizontally, works fine there. however, vertically can see empty gray grid @ top , bottom of map. user can scroll map , grid can take @ half screen, @ zoom level long you're @ edge. is there way snap edge of map edge of view it's embedded in , not show ugly grid? you should agsmapview . maxenveloppe you're looking : limits amount map can panned such anchor point (typically center) never goes outside envelope. default, full envelope of basemap layer. if set custom extent, envelope must have same spatial reference map. by way, can restyle grid backgroundcolor, gridlinewidth, gridlinecolor , gridsize. if want remove grid effect, have set gridlinewidth 0.

c# - Inaccessible due to its protection level? -

i'm still quite new coding in general, , while simple program meant test learn how constructors work, i'd still know why i'm getting error. using system; public class methodtest { int a; int b; int c; public methodtest(int i, int j, int k) { = i; b = j; c = k; } } public class methodobj { static void main() { methodtest obj = new methodtest(10, 20, 30); console.writeline("obj = " + obj.b); console.readkey(); } } i'm not entirely sure why i'm getting error. problem console.writeline, states cannot access obj.b. variables seem declared within public class, why can not accessed? tried searching solution this, questions found convoluted me answer translate own understanding. appreciated! even though variables in public class, must declared public private default. see: access modifi...

xforms - Formatting Orbeon Date input fields -

i trying format input field of type xs:date in orbeon. have tried using xxf:format attribute, datepicker can not understand date when has been modified. the idea change javascript of orbeon use xxf:unformat attribute interpret date , transform iso format. i've tried changing data.js reason none of changes can seen. am changing wrong file? edit i figured out xforms.js has function 'getcurrentvalue' being changes there visible. need figure out 1 that's calling function. edit: it calendar requests value of input when user clicks on symbol. happens @ client side, , generated html not have format/unformat attributes. want use value. can make request orbeon it? how? in case you're using xf:input bound node of type xs:date , can control formatting of date field oxf.xforms.format.input.date property. few formats supported, , if want add more, best follow pattern used supported formats. e.g. [m]/[d]/[y] [y]-[m01]-[d01]

gmail - Trying to auto forward an email to a parsing API with subject intact -

so kind of strange/specific question having google's forwarding. i'm trying automatically forward emails sent trips@my-app.com email parsing service called worldmate without having subject of forwarded email being changed. thing can done? if so, idea how? in advance! if auto-forward mail forward setting or filter subject , body should not modified. when manually forward message gmail ui, fwd: added subject , basic headers added body.

javascript - How to add click handler only when the device is in xs view? -

i have table, button in third cell of each row. button/cell hidden in xs view, using twitter-bootstrap. here's plunker of example: http://embed.plnkr.co/huu9utvychmf34uousak html: <table> <tbody> <tr repeated-item ng-repeat="item in items"></tr> </tbody> </table> js: angular.module('test', []).directive('repeateditem', function() { var lbl = $("#mylbl"); return { restrict: 'a', replace: true, controller: function($scope){ $scope.clickrow = function(){ lbl.text('this should show when button hidden (view xs)'); }; $scope.clickbutton = function(){ lbl.text('clicked button'); }; }, template: '<tr ng-click="clickrow()"><td class="table-col1">cell 1</td><td>cell 2</td><td class="hidden-xs"><button ng-click="clickbutton()">cel...

html - Apply styles for several class which ends at a number -

i have doubt this. possible apply styles several classes between interval of number? instance, have several divs class "content1", "content2", "content3", etc. in normal case, perhaps do: .content1, content2, content3{ font-size: 1em; } or: div[class^="content"]{ font-size: 1em; } but posibble this? div.content:nth-child(1-6){ font-size: 1em; } indeed, it is . use nth-of-type div[class^="content"]:nth-of-type(n+2):nth-of-type(-n+6){ font-size: 1em; } working jsfiddle

node.js - Nodejs application does not work without network connection -

we have simple node application connects sql using mssql module retrieve data. works fine, when network connection available. but, application fails connect db when there no network connection. i have checked in different sites , found dns error when loopback address comes picture. not sure actual cause. error: getaddinfo enoent (when there no network) please me in regard.

c# - How to find out the duplicate characters in a string? -

this question has answer here: how array of repeated characters string using linq? 3 answers i take string integer count int count=0; string s="wow" and using foreach loop count number of characters in specified string foreach(char ch in s) { count++ } so how can count characters repeated in string 'w'. try ) string test = "aababc"; var result = test.groupby(c => c).where(c => c.count() > 1).select(c => new { charname = c.key, charcount = c.count()});

xpath - Get text from node excluding children -

i want text node <hello> , excluding children. know /element/hello/text() supposed work, doesn't. <element> <hello><b>exclude me</b> not me <b>i'm excluded :(</b> i'm included</hello> </element> my output only: but not me . if remove first node, works supposed , second text node (i'm included) parsed. here , native processor behaves similarly. saxon works expected. might bug? i'm using xml filters in libreoffice 4.4.2.2. i want text node <hello> , excluding children. know /element/hello/text() supposed work, doesn't. /element/hello/text() work select nodes want. however, if you're using xsl:value-of text, return value first node of selected set. of them, must do: <xsl:for-each select="/element/hello/text()"> <xsl:value-of select="." /> </xsl:for-each> the above applies xslt 1.0. in xslt 2.0, <xsl:value-of select...

java - Connecto to SQL Server with c# and JDBC -

i have program in java connect sql server server = "zf-sql-mtrazdb.nis.local" dbname = "mraz" namebasedatos = "cd_lo" table = "dbo.cd_lo_data" user = "user" password = "pass" url = "jdbc:sqlserver//"+ server + "\\" + dbname + "jdatabasename=" + namebasedatos driver = "com.microsoft.sqlserver.jdbc_sqlserverdriver" now have same visual c# 2010 in windows xp how can program?? because in java use jdbc , should use jdbc ? thanks all! the connectionstring similar ole db connection string, not identical. unlike ole db or ado, connection string returned same user-set connectionstring , minus security information if persist security info value set false (default). .net framework data provider sql server not persist or return password in connection string unless set persist security info true. you can use connectionstring property connect database. following exampl...

c++ - D3D leaks, but is it because I have references in global objects? -

i getting device leak reports (and non-zero ref count dialog) d3d11 debug runtime. have 2 global classes contain smart pointers layout buffer, vertex shader, , pixel shaders. if place breakpoint on destructor of classes, can see leak reports happen before globals deleted, perhaps might expect. what's right way correct this, while still keeping global (for now)? planning add 'cleanup' function releases manually during shutdown rather relying on smart pointers, feels bit of hack. yeah bit annoying. traditionally document ignore these false positives. if want work around it, resetting smart pointers @ bottom of main job. y'know, unless other objects static storage duration rely on classes. don't, right??

html - CSS only - how to have a scrolling ul with all li on one line -

i have div fixed width. inside ul. ul has random amount of li children, varying widths. i use bootstrap. here example: <div class="parent"> <div class="child"> <ul id="inner" class="nav nav-tabs"> <li>test</li> <li>test</li> <li>test</li> <li>test</li> <li>test</li> </ul> </div> </div> <div class="parent"> <div class="child"> <ul id="inner-new" class="nav nav-tabs"> <li>test</li> <li>test</li> <li>test</li> <li>test</li> <li>test</li> </ul> </div> </div> <style> .parent { background: green; wid...

flash cs5 - my external swf file push the stage to the left -

when test movie in adobe flash cc, external swf file push stage left side of screen. import flash.display.movieclip; import fl.motion.motionevent; import flash.display.stagealign; panelnewbtn.addeventlistener(mouseevent.click, gotoagenda9); function gotoagenda9(event:mouseevent):void { gotoandstop("agenda"); loader.unloadandstop(); removechild(loader); loader = null; } var xpos:number=0; var ypos:number=0; var swf:movieclip; var loader:loader = new loader(); var defaultswf:urlrequest = new urlrequest("data/talk2/presentation - mumbai-2.swf"); loader.load(defaultswf); loader.x = xpos; loader.y = ypos; function loaded(event:event):void { var content:sprite = event.target.content; content.scalex = 0.5 ; } addchild(loader);

osx - Selenium safari driver not working in python -

safari browser gets closed after launching browser java.util.concurrent.executionexception: org.openqa.selenium.webdriverexception: java.lang.reflect.invocationtargetexception here env details selenium 2.46. mac os x 10.10.3 x86_64 safari 8.0.5 here sample python code from selenium import webdriver def test(): driver = webdriver.safari() driver.get("www.google.com") when run above function, getting following output 15:57:46.465 info - launching standalone selenium server 15:57:46.491 info - java: oracle corporation 24.45-b08 15:57:46.491 info - os: mac os x 10.10.3 x86_64 15:57:46.500 info - v2.46.0, core v2.46.0. built revision 87c69e2 15:57:46.551 info - driver provider org.openqa.selenium.ie.internetexplorerdriver registration skipped: registration capabilities capabilities [{platform=windows, ensurecleansession=true, browsername=internet explorer, version=}] not match current platform mac 15:57:46.552 info - driver class not found: com.opera.core...

java - CAS Authentication using MYSQL database. 'principal' cannot be null -

as part of learning jasig cas trying change authentication database. not working expected. authentication failed following log 2015-06-26 20:19:09 debug jdbctemplate:247 - executing prepared sql query 2015-06-26 20:19:09 debug jdbctemplate:247 - executing prepared sql statement [select password users username=? , active=1] 2015-06-26 20:19:09 debug datasourceutils:247 - fetching jdbc connection datasource 2015-06-26 20:19:09 debug basicresourcepool:1644 - trace com.mchange.v2.resourcepool.basicresourcepool@41e38895 [managed: 6, unused: 5, excluded: 0] (e.g. com.mchange.v2.c3p0.impl.newpooledconnection@27f37294) 2015-06-26 20:19:09 debug datasourceutils:247 - returning jdbc connection datasource 2015-06-26 20:19:09 debug basicresourcepool:1644 - trace com.mchange.v2.resourcepool.basicresourcepool@41e38895 [managed: 6, unused: 5, excluded: 0] (e.g. com.mchange.v2.c3p0.impl.newpooledconnection@27f37294) 2015-06-26 ...

excel formula - Right to Left Match Count Non-Blank Cells -

Image
how modify formula: =match(1,--(aa1:ah1=""),0)-1 to count right left? want count number of non-blank cells until blank cell, need starting right left. the array formula (confirmed ctrl + shift + enter ) =max(if(len(aa1:ah1)<>0,column(aa1:ah1))) should give index of column containing last non-blank cell, in row multiple intercalated blank cells. the array formula (confirmed ctrl + shift + enter ) =max(if(len(aa1:ah1)=0,column(aa1:ah1))) should give index of column containing last blank cell, in row multiple intercalated blank cells. you use values calculate desired results. i.e.: to put together: =max(if(len(aa1:ah1)<>0,column(aa1:ah1))) - max(if(len(aa1:ah1)=0,column(aa1:ah1))) should give desired result.

javascript - Catching “angular could not be found on the window” in protractor -

i have angular.js app connects sts login. when run tests need login through sts. when navigate away sts , come randomly angular not found on window error occurs. want catch error , retry login because not issue tests have written. can't find attach error handler. example returning promise can attach .catch() handle error. handle error should attach .catch() or there similar way of handling this.? as suggested @emery, trick worked me: browser.ignoresynchronization=true;

For loop Vba with 2 variable -

arrayone(1) = arraytwo(1) = b arrayone(2) = c arraytwo(2) = d arrayone(3) = e arraytwo(3) = f i need loop through 2 arrays call sub. note sub called in pair, e.g.: sub(arrayone(1), arraytwo(1)) sub(arrayone(2), arraytwo(2)) is possible initialize 2 variables? that: for x = lbound(arrayone) ubound(arrayone) , y = lbound(arraytwo) ubound(arraytwo) call sub(x, y) next x thanks one for next loop cannot use 2 indexers if sure arrays same size, can use same indexer both arrays dim integer = lbound(arrayone) ubound(arrayone) call sub(arrayone(i), arraytwo(i)) next

maven - Bridging from log4j2 to slf4j -

i'm using slf4j 1.7.x in conjunction logback in applications (it dropwizard-application). have libraries use log4j2 (not log4j), , logging goes /dev/null . can't find logj2-over-slf4j or log4j2-to-slf4j library in exising maven application, trick? you may use log4j 2 slf4j adapter route log4j2 logs slf4j implementation. right slf4j not provide adapter log4j2.

reactjs - Multiple RouteHandler for a Route -

i need show multiple nav-items based on route. example var routes = ( <route path="/" handler={wrapper}> <route handler={navitemmenu} /> <route handler={navitemsave}/> </route> ); and use this var nav = react.createclass({ render: function() { return ( <div classname="p-nav-left"> <ul classname="p-navbar-nav"> <routehandler/> </ul> </div> ); } }); i expecting show both "navitemmenu" , "navitemsave". similarly want show different items different paths. how do this? single route how create multiple handler? this isn't case of nesting, of alternate routes based on value of -- maybe prop passed in wrapper ? i'm having guess little here, maybe want? let wrapper = react.createclass({ // bunch of code omitted render() { let contents = null; if (this.props.some_value...

javascript - Adding a new input field within ng-repeat -

http://jsfiddle.net/yhv9bjrx/2/ in fiddle above, i'm trying let users add new open time when hit new item button. problem i'm having when button clicked, updates both events in ng-repeat, instead of current event on. <ul> <li ng-repeat="event in orgevents"> <h3>event id: {{event.campaigneventid}}</h3> <h2>event name: {{event.name}}</h2> <ul> <li ng-repeat="time in orgeventtimes"> <div ng-if="time.campaigneventid == 1"> event id: <input type="text" ng-model="time.campaigneventid"> open: <input type="text" ng-model="time.opentime"> </div> </li> <button ng-click="add(item)">new item</button> </ul> <hr/> </li> </ul...

Select list ignores first value when using the onchange function, PHP, JAVASCRIPT -

i'm using select list function below make select list have 5 values inside of it. values 2-5 works fine when select them, , print out values on page when select them, value 1 not print out no matter what. cannot figure out did wrong or how fix it. please take @ code: index.php function limit($count,$location) { echo "<form method = 'post' action = '$location'>"; echo "<select name = 'value' onchange='this.form.submit()'>"; while ($tempcount < $count) { $tempcount++; echo "<option value='$tempcount'>$tempcount</option>"; } echo "</select>"; echo "</form>"; } limit(5,"index.php") $value = $_post['value']; echo $value; add 1 first option < select > , and, check if $_post['value'] exists. next code both changes pointed commented arrows (//<=====) : <?php function limit($count,$location) { echo...

python - Contour plot, TypeError: Length of y must be number of rows in z -

Image
i have created function 2 arguments, func(x,y) . plot 2d contour plot, first func(x,y) vs. x , , func(x,y) vs. y . i set numpy array x-values 20 values 5e4 8e4 , , y-values 20 values 1e10 1e12 . function func(x,y) takes these 2 arrays arguments. so, set plot follows: import matplotlib import matplotlib.pyplot plt import numpy np import matplotlib.cm cm import matplotlib.mlab mlab matplotlib.rcparams['xtick.direction'] = 'out' matplotlib.rcparams['ytick.direction'] = 'out' x = np.logspace( 5e4, 8e4, num=20) y = np.logspace(1e10, 1e12, num=20) z = np.asarray([ func(x, y), x ]) plt.figure() cs = plt.contour(x, y, z) plt.clabel(cs, inline=1, fontsize=10) the shapes numpy arrays are: print x.shape print y.shape print z.shape which outputs (20,) (20,) (2, 20) my error typeerror: length of y must number of rows in z. why be? dimensions correct. from the docs contour : " x , y must both 2-d same shape z, or must bo...

ios - Why UIBarButtonItem doesn't call IBAction before segue? -

my question similar : swift: make button trigger segue new scene the issue is: i have view controller, button causes view controller appear modally. i have ctrl+click button second view controller, , created segue in ib. then ctrl+click button again source code of view controller create ibaction method. i assumed button 2 things now: a) call ibaction method , , b) perform segue. what happens segue reason. when delete segue, or remove call view controller ib, ibaction called, xcode tells me second view controller not reachable now. i want able present actionsheet user , able performsegue second view controller, based on user selected action sheet. i know can programatically call performsegue requires creation of segue , attaching physical button in ib, defeats purpose of not calling ibaction button may have. if want additional steps before calling segue attach ibaction uibutton , call perform segue within this, in code. can add segue storyboard , give i...

vba - MS Access: dictionary sorting and manipulation -

suppose want have list of item below arr["john"] = 40 arr["mark"] = 12 arr["clark"] = 53 arr["sam"] = 23 now want sort them depending on values below arr["clark"] = 53 arr["john"] = 40 arr["sam"] = 23 arr["mark"] = 12 how can this? you use dictionary microsoft scripting runtime library : dictionary in vba sorting dictionary

ngboilerplate - testing wrapped $http angularjs -

i using angularjs , have test wrapped $http ang.factory("httpservice", ["$http", "$q", function ($http, $q) { return { get: function (url) { var result = $q.defer(); $http.get(url).success(function ($data) { result.resolve($data); }).error(function ($data) { result.reject($data); }); return result.promise; } }; }]); and think test should beforeeach(module('ngboilerplate.employee', function ($provide) { httpservice = jasmine.createspyobj("httpservice", ["get", "post"]); $provide.value("httpservice", httpservice); })); beforeeach(inject(function (_$controller_, _$rootscope_, _httpservice_) { $scope = _$rootscope_.$new(); httpservice = _httpservice_; $controller = _$controller_('employeectrl', {$scope: $scope, httpservice: httpservice}); })); ps: using ngboilerplate. thanks

excel - Split string in VBA using RegEx - Not Splitting -

really new @ vba/regex have regex function defined public function splitline(line string) string() dim regex object set regex = createobject("vbscript.regexp") regex.ignorecase = true regex.global = true 'this pattern matches commas outside quotes 'pattern = ",(?=([^"]"[^"]")(?![^"]"))" regex.pattern = ",(?=([^" & chr(34) & "]" & chr(34) & "[^" & chr(34) & "]" & chr(34) & ")(?![^" & chr(34) & "]" & chr(34) & "))" splitline = split(regex.replace(line, ";"), ";") end function and reference with: dim resp string: resp = http.responsetext dim lines variant: lines = split(resp, vblf) dim sline string dim values variant = 0 ubound(lines) sline = lines(i) values = splitline(sline) stop next this isn't curerntly throwing error - there no split happening. thanks he...

returning a value in sync and await in dart -

i trying understand usage of async , await in dart. somehow having issues returning values in methods. consider code below future<int> getmrn() async { var mrnref = await firebaseclient.child('mrn'); datasnapshot ss; streamsubscription<event> onvaluesubscription = await mrnref.onvalue .listen((event) { ss = event.snapshot; return ss.val(); }); //return future<int> ss.val(); } mrn of type int should returned getmrn method. each time returned ss.val() returns null . seems ss = event.snapshot not seen in last returned value what correct way of doing this. thanks in code above, you're declaring anonymous function (event){..} callback, , return statement relates it, while intention return getmrn() . what need, complete future you're returning getmrn() inside callback. like this: future<int> getmrn() async { var mrnref = await firebaseclient.child('mrn'); completer<int>...

uiwebview - App Transport Security breaks Web View -

my app works great under ios8 no longer runs under ios9. problem despite having following in .plist file: <key>nsapptransportsecurity</key> <dict> <!--include allow connections (danger)--> <key>nsallowsarbitraryloads</key> <true/> </dict> the following code: nsurl *targeturl = [nsurl urlwithstring:_casestudylisttitleurl]; nsurlrequest *request = [nsurlrequest requestwithurl:targeturl]; [_mywebview loadrequest:request]; results in error: nsurlsession/nsurlconnection http load failed (kcfstreamerrordomainssl, -9813) this of course leads empty webview being displayed. all other nsurlsession code in app functioning correctly. i running xcode 7 beta 3 , ios 9 on test ipad. any ideas on appreciated! try solution: <key>nsapptransportsecurity</key> <dict> <key>nsexceptiondomains</key> <dict> <key>yourdomain.com</key> <dict> ...

php - Post variable via ajax to mysql db - phonegap -

i want post simple variable phonegap app mysql database. dont work. db show me empty results. mysql database looks this, tablename user rows: user (varchar 25),vip (varchar 1),call (varchar 1) at top of project inserted: <script type="text/javascript" src="js/tcplugin.js"></script> <script type="text/javascript" src="js/phoneapp.js"></script> <script type="text/javascript" src="js/start.js"></script> start.js file ajax request - other 2 working fine guess there not problem my start.js file looks this: $(document).ready( function() { var email = "john@web.de"; $.ajax({ type: 'post', url: 'http://www.blablabla.de/phone/action.php', data: { data: {"email" : email }, ...

sitecore7 - Trigger a profile in Sitecore DMS 7.5 -

i using following code in sitecore 6.5 trigger profile : var profile = sitecore.analytics.tracker.currentvisit.getorcreateprofile("<profile name>"); profile.beginedit(); profile.score("<profile key>",<profile key value want set>); profile.score("<profile key>",<profile key value want set>); profile.updatepattern(); //sets appropriate pattern based on current profile keys values have set. profile.endedit(); now not working new dms api, have idea should use instead ? use sitecore.analytics.tracker.current.interaction.profiles for purpose

php - How to retrieve 'id' column from entering other fields -

here code: <?php if(isset($submit)){ require 'db/connect.php'; $sql = "select id users username='$username' , password='$password'"; $entered_user = mysql_query($sql); $num_rows = mysql_num_rows($entered_user); $errors = array(); if( $num_rows != 1 ) { $errors[] = '-account not exist '; } elseif( $num_rows == 1 ) { while($row = mysql_fetch_array($entered_user)){ $id = $row['id']; } $errors[] = 'id number --> '.$id; } } ?> my question: how can store id number of particular account variable? cannot produce id number , output receive when entering existing account 'id number -->' without following id. db column names: id, username, password. $username, $password , $submit post variables. either change name of column in query: $sql = "select id id users username='$username' , password=...

r - Columns overlap xAxis labels -

Image
i have made graph r/rcharts/highcharts inside markdown document. produce plot includes (besides other commands) command, causes problem in rmarkdown: plot$yaxis(labels = list(formatter = "#! function() {return (this.value) + '%';} !#"), # maximum value should 100 max = 100, # subtract 5 percent minimum value # minimum value y axis. min = max(minimum - 5, 0)) which looks fine when @ in rstudio viewer: however, when use same code inside rmarkdown, columns seem start on wrong position: which caused hard setting of yaxis minimum value. code creating error in markdown same above. plot, use command: plot$show('iframesrc', cdn = true) the columns start position not seem updated.. have idea causes error?

swift - NSTextAlignment can not be represented in Objective-C -

Image
in swift class, exposed variable objective c defining @objc var textalignment: nstextalignment? { didset { if textalignment != nil { label.textalignment = textalignment! } } } and wrong ! because compiler complains not type can represented in objective-c. but followings right var textalignment: nstextalignment? { didset { label.textalignment = textalignment! } } or @objc var textalignment: nstextalignment { didset { label.textalignment = textalignment } } so looks if expose method objective-c, can not optional value. if use internally, can! because scalar value in objective-c have no way represent nil? my intention want make not compulsory. nstextalignment enum, not class - textalignment variable can't mapped optional objective c because require pointer object type. try: @objc var textalignment: nstextalignment { ... } or, if need optional, expose objective c nsnumber , ...

vb.net - ListBoxes in Visual Basic -

i have assignment user enter numbers list box. when user done entering numbers, compute average , standard deviation.(our professor not want use built in standard deviation functions) program have context menu , these guidelines creating menu: must create subroutine called setmenu. used enable , disable context menu based on contents of list. when list empty,clear disabled. when list has @ least 1 number in it,clear enabled. when nothing selected, delete item disabled. when selected, delete item enabled. need help, creating subroutine. here code: option strict on public class form1 private sub addbtn_click(byval sender system.object, byval e system.eventargs) handles addbtn.click listbox.items.add(inputbox.text) inputbox.text = "" end sub private sub computebtn_click(byval sender system.object, byval e system.eventargs) handles computebtn.click dim sum, x, number, numbersum, subtractednum integer dim average, insideroot, squaredroot double x ...

How to detect rooting and how to request super access in android programatically -

i need know if device rooted or not , want know how l can request super user access. , again want know if have been granted access. plz tell me if possible. grateful... try this: public static boolean isrooted() { boolean rooted = false; string binaryname = "su"; string[] places = {"/sbin/", "/system/bin/", "/system/xbin/", "/data/local/xbin/", "/data/local/bin/", "/system/sd/xbin/", "/system/bin/failsafe/", "/data/local/"}; (string : places) { if (new file(where + binaryname).exists()) { rooted = true; break; } } return rooted; } be careful on emulator running, appears rooted device (you can see code above). if has been useful you, please vote up

ruby - Rails: Override and also use existing gem module method -

i've gem helper module. eg gem module module hotel module menuitem def menu(session) x = default_food_menu[session] end def print_menu(menu) #printing menu end end custom class module sizzsuzzhotel module menuitem include hotel::menuitem def menu(session) # want use default menu item , specific menu related hotel! . end end module sizzsuzzhotel class order include menuitem def order(session) menu_item = menu(session) print(menu_item) end end end here want override menu , want use existing print_menu! how can achieve this? use gem module method , add few more stuffs it? if include menuitem module, both methods available, can redefine 1 of them. include menuitem def menu(session) ... here write custom menu method behaviour end def order(session) menu_item = menu(session) # => above menu method called print(menu_item) # => print method menuitem module called end

c# - ADO.NET database saves, but doesn't save -

i have program allows user fill out information, stored in local database. can execute stored procedure handles fine, when check data through visual studio changes aren't there. if run program , enter duplicate primary key, error thrown value exists. i've made sure there no duplicate files. any suggestions? stored procedure create procedure [dbo].[newuser] @username text, @password text, @attackmethod text, @statpreference text insert users values (@username,@password,@attackmethod,@statpreference) return 0 and code runs throw database. try { connection.open(); sqlcommand command = new sqlcommand("newuser",connection); command.connection = connection; command.commandtype = commandtype.storedprocedure; command.parameters.addwithvalue("@username", sqldbtype.nvarchar); command.parameters.addwithvalue("@password", sqldbtype.text); ...

android - In linearLayout i have got cutted upper part oh application -

what want achieve: both orientation looking buttons in linearlayout <scrollview android:layout_height="match_parent" android:layout_width="match_parent" xmlns:android="http://schemas.android.com/apk/res/android" android:background="#fffffce0"> <linearlayout android:layout_width="match_parent" android:layout_height="match_parent" android:background="#fffffce0" android:orientation="vertical" android:gravity="center" android:layout_gravity="center" > <button android:layout_width="match_parent" android:layout_height="90dp" android:id="@+id/bmnemo" android:layout_margintop="20dp" android:text="@string/bmnemo" android:textcolor="#ffffff" android:background="@drawable/custon_button_active" an...

javascript - Contact form not sending [html, php, js] -

Image
i'm trying send e-mail using contact form can't work. it's outputing sent m not getting any. tested sending mail simple php form , i'm getting mail fine it's not server presume. explanation highly appreciated. <form id="contact-form" action="email.php" method="post" class="clearfix"> <div class="contact-box-hide"> <div class="col-sm-6"> <input type="text" class="form-control" id="first_name" name="first_name" required placeholder="first name"> <span class="first-name-error"></span> </div> <div class="col-sm-6"> <input type="text" class="form-control" id="last_name" name="l...