Posts

Showing posts from April, 2015

ElasticSearch: greater between two aggregations -

i'm new elasticsearch , trying greater value between 2 aggregations, possible? need greater between avg_field1 , avg_field2. i thinking in try use script: max , didn't find example of usage.. don't know if it's possible. my aggregations now: { "aggs" : { "group_by_frame" : { "histogram" : { "field" : "index_histogram", "interval" : 100 }, "aggs" : { "avg_field1" : { "avg" : { "field" : "field1" } }, "avg_field2" : { "avg" : { "field" : "field2" } } } } } please see answer here: elastic search sum of aggregated values basically cannot aggregate on different aggregations.

r - Fastest way to map a new data frame column based on two other columns -

i have data frame looks this: id|value 01| 100 01| 101 01| 300 #edited case left out 02| 300 03| 100 03| 101 04| 100 and add new column looks @ both id , values assigned each id. for example: if id has both value 100 , 101 add category a. if id has value of 300 add category b. if id has 1 value (either 100 or 101, not both) assign category c. result: id|value|category 01| 100 | 01| 101 | 01| 300 | b #edited case left out 02| 300 | b 03| 100 | 03| 101 | 04| 100 | c i understand can loop through , assign category, question whether there faster vectorized way? a couple of options data.table we number of elements per 'id' '100', '101' , add them together. output 0, 1, or 2 corresponding none, single element, or both present. can converted factor , change labels 'a' '2', 'b' '0' , 'c' '1'. library(data.table) setdt(df2)[, indx:=sum(unique(value)==100)+sum(unique(value)==101), ...

google chrome - GAS not working on windows machine -

i created application using gas , html service. works on safari , chrome on mac, using different logins google apps account, same accounts, not run on of browsers in windows machine. regards, arjun code load page function doget(e) { logger.log( utilities.jsonstringify(e) ); if (!e.parameter.page | e.parameter['page'] == 'index'){ var template = htmlservice.createtemplatefromfile('index'); var htmloutput = template.evaluate() .setsandboxmode(htmlservice.sandboxmode.iframe); return htmloutput; } return htmlservice.createtemplatefromfile(e.parameter['page']).evaluate(); } the page not loading <style type="text/css"> #header { height:100px; background:green; font-size:300%; color: black; align-content: centre; } body { padding: 50px; } .animate { transition: 0.1s; -webkit-transition: 0.1s; } .action-button { position: relative; padding: 10px 40px; margin: 0px 10px 10px ...

php - Composer: Prefer VCS Repository over Packagist -

i'd use adldap/adldap library in php based project. while maintainer of package has not added package packagist, have included composer.json file. so, normally, i'd add following my composer.json , , go day. "repositories": [ { "type": "vcs", "url": "https://github.com/adldap/adldap" }], "require": { /* other packages */ "adldap/adldap":"4.04" }, however, won't work, because adldap/adldap claimed by different project in packagist , , composer assumes want packagist package. (making things more complicated, packagist package fork of original project, , fork isn't accepting upstream changes). is there way tell composer prefer version configured vcs repository? or stuck forking package myself, changing name, , pointing composer fork? (or 1 of other forks maintained work around issue?) the problem package that, "v4.0.4" version branch doesn...

cq5 - AEM6. XML import to JCR(Oak) -

during migration site cq5.4 aem6 i've faced problem in importing xml data jcr. on cq5.4 used "content loader tool"(http(s)://[host]:[port]/crx/loader/index.jsp ) load xml jcr. starting cq5.6.1 tool deprecated , gone. aem6 doesn't have also, same several crx:xml* primary node types(crx:xmlcharacterdata, crx:xmldocument, crx:xmlelement, crx:xmlnode). i've tried re-import data programmatically, below sample groovy script importxml(); def importxml(){ fileinputstream inputstream = new fileinputstream("c:/data.xml "); // xml file session.importxml("/content/xmlnode", // destination jcr node inputstream , javax.jcr.importuuidbehavior.import_uuid_create_new); session.save(); } but import result, lost sibling data. imported data has 1 node on each layer in jcr. reason oak doesn't support same name siblings (sns). http://docs.adobe.com/docs/en/aem/6-0/deploy/upgrade/introduction-to-oak.html http://j...

javascript - PHP / JQUERY - display each sub array of json -

i have post script below, current script output this. ["error1","error2","error3"] ["good1","good2","good3"] i want output each error in separate paragraph , each in paragraph php script $error[] = "error1"; $error[] = "error2"; $error[] = "error3"; $good[] = "good1"; $good[] = "good2"; $good[] = "good3"; $data["error"] = json_encode($error); $data["good"] = json_encode($good); die(json_encode($data)); jquery script function _request() { $("form").submit(function(e) { e.preventdefault(); $.ajax( { url: $(this).attr("action"), type: "post", data: $(this).serializearray(), datatype: 'json', ...

windows 7 - Powershell to Script to Add Part of a Grandparent Folder to Child Item Names -

at work, maintain large (500+) file system of company's clients. each client has own folder, subfolders years, , account files in each year folder. on client's folder, their name , six-digit identifier number. facilitate upcoming audit, asked attach 6 digit identifier number on grandparent folder each of child item account files. there way specify portion of grandparent's folder add child item? if so, script? p.s. apologize, new coding, i'm actively trying learn powershell. sounds need learn regular expressions . $grandparent = 'c:\bobby 123456\2014\bobby 15-5555' if ($grandparent -match 'c:\\(?<name>.*)\s(?<idcode1>\d{6})\\(?<year>\d{4})\\.*\s(?<idcode2>\d{2}-\d{4})'){ $matches.name $matches.idcode1 $matches.year $matches.idcode2 "{0} {1} {2}" -f $matches.name,$matches.idcode2,$matches.idcode1 } here favorite reference regex .

regex - Lexer Rule To avoid more than one occurrence of a character -

i want write lexer rule antlr4 check few user ids. need check string doesn't contain dot @ beginning, may have dot in middle dot can't occur consecutively. can me idea? if dot cannot occur @ end either, use (with perhaps different definition of valid : valid: [a-za-z0-9] userid: valid ('.'? valid)* if wanted allow dot @ end, add that: userid: valid ('.'? valid)* '.'?

winforms - Readonly richtextbox changing color of keyword C# -

Image
i have rich text box using display example of hello world program , want keywords such 'using' 'namespace' 'class' 'static' 'void' 'string' display blue. i have got 'using' display blue when user starts type or types 'using' want richtextbox read not allowing user input here code: private void rtb_textchanged(object sender, eventargs e) { string find = "using"; if (rtb.text.contains(find)) { var matchstring = regex.escape(find); foreach (match match in regex.matches(rtb.text, matchstring)) { rtb.select(match.index, find.length); rtb.selectioncolor = color.blue; rtb.select(rtb.textlength, 0); rtb.selectioncolor = rtb.forecolor; }; } } i having trouble figuring out how readonly rtb. how edit code display blue text on initialize in readonly rtb th...

javascript - Equal Space between the legends in d3 -

Image
i newbie in using d3 library, trying have equal space between legends. in current stage of work -attached- not provide equal spaces. i know how able fix. here code have far: var margin = { top: 20, right: 50, bottom: 30, left: 60 }; self.drawlegends = function () { var legenddata = [{ "color": "blue", text: "normal distribution" }, { color: "green", text: " ave a" }, { color: "red", text: "ave b" }] var legends = self.svg.selectall("g legends").data(legenddata); var legendbox = legends.enter() .append("g") .attr("transform", function (d, i) { return "translate(" + parsefloat((i + 1) * (($("#chart").width() - margin.left - margin.right) / 4)) + ",-10)" }) var circles = legendbox.append("circle") .attr("r", 5) .attr(...

uinavigationcontroller - UITabBarController in UISplitViewController with Storyboard -

Image
i have uisplitviewcontroller uitabbarcontroller master. uitabbarcontroller contains 1 uinavigationcontroller uitableviewcontroller root (it main menu of app). after tapping on cell in main menu , in uisplitviewcontroller 's detail part uitableviewcontroller should presented (let's call detail view ). in landscape mode works ok. but in portrait, whet tap on cell in main menu , detail view presented modally, , not pushed, supposed to. also, when rotating landscape portrait, main menu presented instead of detail view , , after click on main menu 's position show detail view , presented modally no possibility rotate or go back. removing uitabbarcontroller , setting uinavigationcontroller uisplitviewcontroller 's master works want (in landscape mode have menu | detail views side side , in portrait mode controllers behave on regular uinavigationcontroller ). uitabbarcontroller gone. what i've tried: every possible segue type - none of them ...

How to encrypt a pdf file in Fedora 21 -

is possible password protect pdf file in fedora 21? used pdftk purpose no longer available , surprisingly cannot find alternative. mcpdf here replace pdftk mcpdf drop-in replacement pdftk. it fixes pdftk’s unicode issues when filling in pdf forms, , command line interface itext pdf library pdftk compatible syntax. from readme on github

Python: Accessing elements of multi-dimensional list, given a list of indexes -

i have multidimensional list f, holding elements of type. so, if example rank 4, elements of f can accessed f[a][b][c][d] . given list l=[a,b,c,d] , access f[a][b][c][d] . problem rank going changing, cannot have f[l[0]][l[1]][l[2]][l[3]] . ideally, able f[l] , element f[a][b][c][d] . think can done numpy, types of arrays i'm using, numpy not suitable, want python lists. how can have above? edit: specific example of i'm trying achieve, see demo in martijn's answer. you can use reduce() function access consecutive elements: from functools import reduce # forward compatibility import operator reduce(operator.getitem, indices, somelist) in python 3 reduce moved functools module, in python 2.6 , can access in location. the above uses operator.getitem() function apply each index previous result (starting @ somelist ). demo: >>> import operator >>> somelist = ['index0', ['index10', 'index11', ['...

html - Font inheriting from transition -

i'm trying make transition stuff -25 degrees want transit "box", not font. thing don't understand how make :before/:after. whenever try via css ignores setting i've made specific container. .option:hover { font-style: normal !important; background-color: green; cursor: pointer; box-sizing: border-box; transition-property: background; transition-duration: .4s; left: 0; top: 0; -webkit-transform: skew(-25deg); } http://jsfiddle.net/3fndahd2/ the thing skew whole div, includes inside. there's no way exclude anything. there 2 ways around this: apply opposite skew inner elements, i.e. have additional container text skewed other way around in order straight again. wouldn't this, because may lead blurry result or artifacts. use css3 pseudo-elements: create element using ::before , give full parent size , skew one. it's outside text, that's not affected transform. in addition, use z-index place behind parent div. jsfiddle

java - Issue with my app after Android 5.0.1 update. "SurfaceView" turns into transparent mode -

Image
i use slidemenu in app. “menu” in 1 fragment , “surfaceview” in another. when opening “menu”, preview disappears during camera movement , surfaceview turns transparent mode. using setzorderontop(true) - surfaceview doesn’t disappear, overlaps lot of elements, should on it. untill android 5.0.1 update fine. can give me advice? comment out hardware acceleration in managelayers method of slidingmenu. seems solution since surfaceviews don't work. com.jeremyfeinstein.slidingmenu.lib.slidingmenu edit function managelayers: //final int layertype = layer ? view.layer_type_hardware : view.layer_type_none; final int layertype = view.layer_type_none;

javascript - Change amchart bullet placement using inputs -

say have amchart linewithscrollandzoom graph. want allow user change bullet point location on y-axis letting them click bullet point, can use dropdown input or other input form allow them change y-axis value. bullet point , corresponding lines change based on bullet point moved. is possible?

powershell - Check for user in a group in a different domain -

i stuck piece of code. have 2 ad domains users , groups in them. trying run script check if user member of group disable ev access , if not member of group add them ev enable group. i have working 1 domain can't work across 2 domains have. want script check domain1 , add group in domain1 if doesn't find user check domain2 , add group in domain2. below extract of code have struggling recognise domain controller looks in right domain user. foreach ($u in $users){ foreach($domain in $domainlist) { $dom =get-addomain $domain.name $dm = $dom.distinguishedname $dname = $dom.name $domname = $dom.dnsroot $addc = get-addomaincontroller -discover -domain $domname $dc = $addc.hostname $user = get-aduser $u.name -server $dc $enablegroup = "cn=evenable,ou=users , computers," + $dom $disablegroup = "cn=evdisable,ou=users , computers," + $dom if ((get-aduser $u.name -server $dc -properties memberof).memb...

git - How can I, in one command, create or update a remote? -

i don't know whether remote called origin exists. command git remote add origin gti@gtihub......git throws error fatal: remote origin exists i need add origin remote if not exists, , update if exists. how can in 1 command? (for information, use git version 1.7.3.4.) also, difference between: git remote add origin gti@gtihub......git git remote set-url origin gti@gtihub......git git remote set-url --add origin gti@gtihub......git does 1 of commands want? [...] difference between [...] git remote add <name> <url> adds remote named <name> repository @ <url> . git remote set-url <name> <url> sets url remote called <name> <url> . git remote set-url --add <name> <url> adds new (push) url remote called <name> ; that's not want do. the first command throws error if remote called <name> exists, whereas last 2 commands throw error if no remote called <name...

bash - Shell script strange echo behavior -

i want print content have obtained split of array in way : string="abc test;abctest.it" ifs=';' read -a array <<< "$string" name="${array[0]}" url="${array[1]}" echo -ne "\n$url,$name" >> "$outputdir/$filename" but output file doesn't contain url part i think problem "." don't know how fix it if try echo $url it's work! thanks i've tried printf , hardcoded filename nothing! printf '%s %s\n' "$url" "$name" >> test.txt it seems when try concatenate thing after variable $url part of variable deleted or overwritten output file for example if try printf '%s %s\n' "$url" "pp" >> test.txt what simple cat test.txt : pptest.it but content of variable $url must abctest.it it's strange to complement chepner's helpful answer : if output doesn't look expect ...

epl - End of File detection in ESPER -

i using esper read events csv file. how can make query output when reading csv file finished. for example want output every 30 min or @ end of file select id stream output every 30 min or [ eof reached ] thanks in advance regards the "adapter.start()" finishes when csv file done , code can send eof event engine. declare context ends on eof event , there "output every 30 minutes , when terminated" option.

Flatten Nested XML/hierarchy using XSLT Transformation -

i have nested hierarchial xml structure flattened using xsl transformation. following scenario. <company> <managers> <manager> <name>matt</name> <id>1</id> <manager> <name>joe</name> <id>11</id> <manager> <name>dave</name> <id>111</id> </manager> </manager> </manager> <manager> <name>mike</name> <id>2</id>> </manager> </managers> </company> result: matt 1 joe 11 dave 111 mike 2 a better alternative via @mathias mueller, <?xml version="1.0" encoding="utf-8" ?> <xsl:transform xmlns:xsl="http://www.w3.org/1999/xsl/transform" version="1.0"> <xsl:output method="text" encoding="utf-8"/> <xsl:te...

asp.net mvc 4 - MVC4 model binding and int/decimal overflow -

let's created model property int? type. public class mymodel { [range(-100, 100, errormessage="too large")] public int? myvalue { get; set; } } in view use text box in form post server. @using (html.beginform()) { <p>enter value</p> <div>@html.textboxfor(m => m.myvalue)</div> <div>@html.validationmessagefor(m => m.myvalue)</div> <input type="submit" value="submit" /> } here controller code public class homecontroller : controller { public actionresult index() { var model = new mymodel(); return view(model); } [httppost] public actionresult index(mymodel model) { return view(model); } } now if enter extremely large number in text box, e.g 111111111111111111111111111111111111111111111111111111111111111111111111111111 , sure large integer data type. on post back, got message the value ...

Font Awesome support for screen readers and accessibility -

according font awesome home page : font awesome won't trip screen readers, unlike other icon fonts. i know recommended add aria-hidden="true" attribute font icons screen readers can ignore them. my question is, font-awesome "won't trip screen readers" (i had on github site , can't find anything) , still need add aria-hidden="true" attribute? they plain talking out of nether regions of anatomy. icon font other image? icon fonts not have text alternatives when presented purely icon. on os x safari, read out unintelligible characters , not description of icon is...so...how should diplomatically.... font awesome's icons not accessible!!! just illustrate, here markup "buyselladds" icon <i class="fa fa-buysellads"></i> i can see no description of icon. can you? how can possibly accessible?

built in - Implementing `__dir__` in Python: Does it need to return a list and does the list need to be sorted? -

i have class implements __dir__ method. however, not entirely nitty gritty details of dir api. a : required __dir__ returns list? implementation using set avoid listing attributes twice, need convert list before returning? documentation guess has list: if object has method named dir (), method called , must return list of attributes. however, not returning list break functionality @ point? b : result need sorted? documentation bit ambiguous here: the resulting list sorted alphabetically. does mean, calling built-in dir automatically sorts data returned __dir__ or mean dir expects sorted data __dir__ ? edit: btw, question encompasses python 2 (2.6 , 2.7) , 3 (3.3, 3.4). under python 2.7.3, answers are: a: yes, must list: >>> class f: ... def __dir__(self): ... return set(['1']) ... >>> dir(f()) traceback (most recent call last): file "<stdin>", line 1, in <module> typeer...

c# - WebControl's constructor does not have correct attribute value -

i want constructor of webcontrol able access value of isspecial (from html). however, it's false . assume it's false in constructor because doesn't read value until after constructor method over. there way have knows correct value of isspecial in constructor? c#: [defaultproperty("text")] [toolboxdata("<{0}:webcontrolexample runat=server></{0}:webcontrolexample>")] public class webcontrolexample: webcontrol, inamingcontainer { private readonly int[] goodies; public webcontrolexample() { if (this.isspecial) { goodies = new int[24]; } else { //always reaches here goodies = new int[48]; } } private bool isspecial= false; public bool isspecial { set { this.isspecial= value; } } } html: <xyz:webcontrolexamplerunat="server" id="webcontrolexample" isspecial=...

group by - Datatable compute c# filter string -

i have problem code: _dtreturn.rows[i][_calculatedfield.outputcolumnname] = _dtsource.compute(_calculatedfield.enmfunction.tostring() + "(" + _calculatedfield.columnname + ")", _filterstring); the string generate seguent: _dtreturn.rows[i][_calculatedfield.outputcolumnname] = _dtsource.compute("sum(affidate)","lottoimportazione = 44438 , regione = 'sicilia'"); the code generate exception : from google translate: "an unhandled exception of type ' system.data.dataexception ' in system.data.dll additional information : invalid use sum () function , type of aggregation : boolean ." eccezione non gestita di tipo 'system.data.dataexception' in system.data.dll ulteriori informazioni: utilizzo non valido della funzione sum() e del tipo di aggregazione: boolean. can me?

css - How do I get this code to center a div id? -

#border-search { position: relative; display: block; margin-left: 10px auto !important; margin-right: 10px auto !important; width: 100% !important; } here js fiddle https://jsfiddle.net/matsuiny2004/7dms170p/ add text-align:center; css. here fiddle https://jsfiddle.net/7dms170p/2/

Why don't Scala traits allow constructor parameters? -

i'm new scala, coming java, , reading traits. 1 thing gets mentioned traits don't (can't? won't?) have constructor parameters. curious know if there reason this. coming long ago maths/computer-science background was wondering if inevitable consequence because of language design decision, or if conscious decision avoid inheritance/mix-in problem or another? was hoping might know because feels there might interesting behind fact. the other answers describe language; suspect question may "why designed in way". i believe arises out of awkwardnesses , verboseness arise when extending multiple traits, overrides , types, , various mix-in strategies. the cake pattern results in various traits providing missing bits each other in way totally invisible - design - in mixing class. , mixing can bi-directional, using self-types . construction of class traits can messy business compiler. scala trades simplicity of compiler design , implementation...

php - Basic SQL query design issue -

i'm trying create query equivelant of (does not work). select * `categories` c , select * `items` , select count(i.id) items , select sum(i.price) price; i not using sqlserver, , i'm using pdo through php database connectivity. here's tables. category +----+------------+ | id | category | +----+------------+ | 1 | first_cat | | 2 | second_cat | +----+------------+ items +----+----------+------+-------+ | id | category | name | price | +----+----------+------+-------+ | 1 | 1 | foo | 1.99 | | 2 | 1 | bar | 2.00 | | 3 | 2 | oof | 0.99 | | 4 | 2 | rab | 1.99 | +----+----------+------+-------+ based on these tables expecting these query results: +----+------------+-------+-------+--+ | id | category | items | price | | +----+------------+-------+-------+--+ | 1 | first_cat | 2 | 3.99 | | | 2 | second_cat | 2 | 2.98 | | +----+------------+-------+-------+--+ any help? the query have...

php - Inconsistent strtotime conversions -

when doing conversion on date using strtotime, i'm getting inconsistent results. array[0] holds date converted: original -> converted -> converted array ([0] => 30.01.15) -> 1422576000 -> gmt: fri, 30 jan 2015 00:00:00 gmt array ([0] => 23.01.15) -> 1427925675 -> gmt: wed, 01 apr 2015 22:01:15 gmt when using dashes, instead of dots, get: array ([0] => 30-01-15) -> 1894665600 -> gmt: tue, 15 jan 2030 00:00:00 gmt array ([0] => 23-01-15) -> 1673740800 -> gmt: sun, 15 jan 2023 00:00:00 gmt it works in first instance, using dots, in second using dots todays date? ideas might causing inconsistency? according php manual, date , time must provided in supported date/time format: http://php.net/manual/en/datetime.formats.date.php the "dot" notation not seem supported date values, php tries parse time, here's why got "strange" behaviour. to better explain different behave: in first run 30 cannot int...

objective c - JSON Mapping any inner objects using Mantle -

if getting response this { "objects" : [ { "a" : val1, "b" : val2, }, { "a" : val1, "b" : val2, } ] } then how objects array in response? the solutions have found follows: 1) can create model class objectsresponse representing above json , have nsarray property called objects. , can use mtl_jsonarraytransformerwithmodelclass to map json response objects property , access error using objectsresponse's object. 2) directly use method [mtljsonadapter modelsofclass: [object fromjsonarray:[response objectforkey:@"objects"]]] error:&error] is there direct way using mantle object mapping other these? thanks

c# - Error: System.InvalidOperationException in ASP.NET WebAPI -

Image
i'm trying enter data database , access_token on end of successful call. when make call passing parameters: everything goes fine, user gets registered , saved database, , access_token returns user: but, when add signs +, = or \ in deviceid value exception , nothing saved in database: { "message": "an error has occurred.", "exceptionmessage": "error getting value 'readtimeout' on 'microsoft.owin.host.systemweb.callstreams.inputstream'.", "exceptiontype": "newtonsoft.json.jsonserializationexception", "stacktrace": " @ newtonsoft.json.serialization.dynamicvalueprovider.getvalue(object target)\r\n @ newtonsoft.json.serialization.jsonserializerinternalwriter.calculatepropertyvalues(jsonwriter writer, object value, jsoncontainercontract contract, jsonproperty member, jsonproperty property, jsoncontract& membercontract, object& membervalue)\r\n @ new...

java - Custom Map Marker -

i have map view markers. i'm wanting know if can add couple of other string values markers such phone number , website. don't want these show in info window when marker tapped. when info window tapped goes detail activity selected marker. marker title , snippet passed extras detail activity , i'd pass 2 additional strings extras well. here create markers: for(int = 0; < lat.length; i++) { marker marker = map.addmarker(new markeroptions() .position(new latlng(lat[i], lon[i])) .title(market[i]) .snippet(address[i]) .icon(bitmapdescriptorfactory.defaultmarker(bitmapdescriptorfactory.hue_azure))); list.add(marker); } and here start detail activity. map.setoninfowindowclicklistener(new googlemap.oninfowindowclicklistener() { @override public void oninfowindowclick(marker marker) { // show details intent intent = new intent(getact...

java - Spring Data MongoDB: how to implement multi-tenancy in CrudRepository -

this question has answer here: making spring-data-mongodb multi-tenant 2 answers i designed db support multi-tenancy: every document has reference tenant . i'm using spring data mongodb implement data access logic , need handle document retrieval tenant in repositories. is there common approach implement it? need override every method of crudrepository match documents tenant or there facilities achieve this? i decided implement multi-tenancy @ service layer suggested markus w mahlberg in comment. at repository level created findbytenantidandid query check if entity/document id belongs proper tenant. i have custom implementation of userdetails interface, storing tenantid logged user. retrieve logged user @ service layer via securitycontextholder .

ios - Launching web url with Session -

i developing html web page. creating session id in that. i want use same session id opening web site through ios app well. nsstring *urlstring = @"http://www.myserver.com:8080/test/testpage"; nsurl *url = [nsurl urlwithstring:urlstring]; nsurlrequest *urlrequest = [nsurlrequest requestwithurl:url]; [webview loadrequest:urlrequest]; is possible launch web url using session id appended in ios? if not understanding in wrong way, want add parameters request, in case sessionid. in case should this: nsurl *url = [nsurl urlwithstring: @"http://www.myserver.com:8080/test/testpage"]; nsstring *body = [nsstring stringwithformat: @"sessionid=%@", @"val1"]; nsmutableurlrequest *request = [[nsmutableurlrequest alloc]initwithurl: url]; [request sethttpmethod: @"post"]; [request sethttpbody: [body datausingencoding: nsutf8stringencoding]]; [webview loadrequest: request]; on other way around, can use example...

java - Can i get value of local variable dynamically from array of local variable name -

can value of local variable array of it's name iterating array.below code sample same. public class testlocalvar { public static void main(string[] args) { string[] arrlocalvar = {"vara", "varb", "varc", "vard"}; string vara = "i a"; string varb = "i b"; string varc = ""; string vard = ""; for(string localvarname : arrlocalvar){ system.out.println("localvarvalue -->"+localvarname); //here can value of local variable? } system.out.println("## loop end ##"); //printing values out side of loop system.out.println("vara :"+vara+" ,varb :"+varb+ ", varc :"+varc+ " ,vard :"+vard); }} this doing validating local variables dynamically iterating it's string type name array. thanks in advance. local variables not accessible through reflecti...

Can you extend Message processors with JavaScript in Mule ESB? -

i interested hear how of java code can writen in javascript in mule project. when want custom message processor can extend java class, can same javascript? i unclear trying evaluate here. depends on choice of scripting language. mule supports several scripting languages , can using scripting components can using java. regards, rupesh sinha

jquery .val() to change attribute selected state -

i'm using jquery update select option when value returned via ajax call. i've put simplest form , whilst visible value changes, 'selected' attribute stays jquery(document).ready(function($) { $("#fetchcap").on('click',function (e) { $('#used_car_colour').val('grey'); }); }) <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> <input type="button" class="button button-primary" name="fetchcap" id="fetchcap" value="fetch"> <select name="used_car_colour" id="used_car_colour"> <option class="colour-option" value="">none</option> <option class="colour-option" value="black" selected="">black</option> <option class="colour-option" value="brown">brown</option...

xcode - libcrypto.a symbol(s) not found for architecture i386 -

xcode 6.3 beta i'm using libcrypto.a in project. my app can compile , run on ipod touch5 (armv7). but when try run app on iphone5 simulator, i'm getting error: "_closedir$unix2003", referenced from: _openssl_dir_end in libcrypto.a(o_dir.o) "_fputs$unix2003", referenced from: _write_string in libcrypto.a(ui_openssl.o) _read_string in libcrypto.a(ui_openssl.o) "_opendir$inode64$unix2003", referenced from: _openssl_dir_read in libcrypto.a(o_dir.o) "_readdir$inode64", referenced from: _openssl_dir_read in libcrypto.a(o_dir.o) ld: symbol(s) not found architecture i386 then checked architectures libcrypto.a i'm using support using command: lipo -info libcrypto.a and result: architectures in fat file: libcrypto.a are: i386 armv7 armv7s arm64 any advice appreciated, :) create new m file anywhere. , define missing function here: #include <stdio.h> #include ...

objective c - Constant crop aspect ratio using PEPhotoCropEditor library in iOS -

i'm using pephotocropeditor library in 1 of ios project. able having constant aspect ratio (1:1) following code. - (void)openeditor { pecropviewcontroller *controller = [[pecropviewcontroller alloc] init]; controller.delegate = self; controller.image = self.imageview.image; uiimage *image = self.imageview.image; cgfloat width = image.size.width; cgfloat height = image.size.height; cgfloat length = min(width, height); cgrectmake(cgfloat x, cgfloat y, cgfloat width, cgfloat height) controller.imagecroprect = cgrectmake((width - length) / 2, (height - length) / 2, length, length); // restricted square aspect ratio controller.keepingcropaspectratio = yes; controller.cropaspectratio = 1.0; uinavigationcontroller *navigationcontroller = [[uinavigationcontroller alloc] initwithrootviewcontroller:co...

java - How to load log4j2 configuration file from JNDI -

i migrating web applications log4j 1.12 log4j2. due company policies our log4j.xml file locations configured urls in application server , applications have them jndi. implemented servletcontextlistener allowed initialize log4j infraestructure way: public void contextinitialized(servletcontextevent servletcontextevent) { ... urllogconfig = (url) context.lookup("java:comp/env/"+loglocation); ... //urllogconfig -> file:///somepath/log4j.xml domconfigurator.configureandwatch(urllogconfig.getpath()); } public void contextdestroyed(servletcontextevent servletcontextevent) { servletcontext servletcontext = servletcontextevent.getservletcontext(); servletcontext.log("log4jconfigurationlistener - shutting down log4j"); logmanager.shutdown(); } however, log4j2 api changes can no longer used. log4j2 provides lo4j2-web.jar module uses log4jservletcontainerinitializer initialize library. ends calling log4jwebinitializerimpl.getconfigu...

jsf - Validate regex for PrimeFaces Password -

i have password , repeat password fields,but want validate passwords depending on validate regex pattern along matching both password fields too. <p:outputlabel for="password" value="password" /> <p:password id="password" redisplay="true" value="#{newuserbean.newuserdto.password}" match="repeatpassword" label="password" required="true" requiredmessage="password required, cannot empty" validatormessage="password , repeat password fields must same" feedback="true" promptlabel="password should contain atleast 8 characters ,1 number , 1 special character" > </p:password> <p:outputlabel for="repeatpassword" value="repeat password" /> <p:password id=...

php - Share quiz results on Facebook -

i have spent hours researching seems tricky many developers out there. have small php quiz, outputting results form in following way: if (maxa) { echo ' <img src="imgs/result4.jpg"/> <div class="results2"> <p class="title">you bean</p> <p class="details">description</p> </div>'; } the question is, how add share button @ bottom of this, share result on facebook, description , picture. note there 4 available results. i have made public app, , inserted following in head: <script> window.fbasyncinit = function() { fb.init({ appid : '1382290368762081', xfbml : true, version : 'v2.3' }); }; (function(d, s, id){ var js, fjs = d.getelementsbytagname(s)[0]; if (d.getelementbyid(id)) {return;} js = d.createelement(s); js.id = id; js.src = "//connect.facebook.net/en_us/sdk.js"; fjs.parentnode.insertbefore(js, fjs); }(docum...

tcl - When i am executing it it says can't read s0 not such variable. Please -

proc ok { } { exec echo "list of tokens requested killed user" >killed_file; #the information dumped in file named killed_file global s0 s1 s2 s3 s4 s5 if {$s0} {exec echo "$s0 choice a" >>killed_file} if {$s1} {exec echo "$s1 choice b" >>killed_file} if {$s2} {exec echo "$s2 choice c" >>killed_file} if {$s3} {exec echo "$s3 choice d" >>killed_file} if {$s4} {exec echo "$s4 choice e" >>killed_file} if {$s5} {exec echo "$s5 choice f" >>killed_file} destroy .top } executing says can't read s0 no such variable , same other variables. presumably variables s0 s5 have not been set. if want skip them when not exists can use command info exists name test this. using strange method write file. more straightforward alternative (not tested) be: proc ok { } { #the information dumped in file named killed_file set kf [open killed_f...

php - Using str_replace for digit when grater than ten -

this question has answer here: trying replace parts of string start same search chars 3 answers here code- $input=10; $number = array('0','1','2','3','4','5','6','7','8','9','10'); $text = array('a','b','c','d','e','f','g','h','i','j','k'); $print = str_replace($number, $text, $input); what i'm expecting replace '10' 'k'. replacing 10 'ba' how use str_replace in above condition? $input=10; $number = array('10','0','1','2','3','4','5','6','7','8','9'); $text = array('k','a','b','c','d','e','f','g','h...

javascript - angular-slick attributes with capital case -

i making carousel angular-slick ( https://github.com/vasyabigi/angular-slick ). some of slick settings carousel not seem work when used attributes of slick-directive. these attributes have 1 or more capital case letters. i had change these attributes lower case letters in slick.js , in angular model slick.js. instance custom button next , previous had change prevarrow , nextarrow prevarrow , nextarrow can use in following way: <slick prevarrow='.btn-prev' nextarrow='.btn-next' arrows="true" data="windows"> <div ng-repeat="window in windows" class="slick-slide"> <a><img ng-src={{window.imageurls[0]}}></a> </div> </slick> <div class="slider-controls"> <button class="btn-next">customnext</button> <button class="btn-prev">customprev</button> </div> changing code in libraries not seem r...

sql - error using two cursors in plsql code -

i have 2 tables error_description , error_column. error_description has below data : "error processing column a_type" "error processing column a_type" "error processing column a_type" error_column has below data: "abc",123334,"jdjjd" "jdjd",2344,"djjd" "djjd",234,"kkfkf" at last data should : error processing column a_type -"abc",123334,"jdjjd" error processing column a_type - "jdjd",2344,"djjd" so on ... "a_type" column name error_column table i trying achieve using cursors . declare cursor c_log select * error_description error_data_log like'error%' order error_data_log; r_log error_description %rowtype; v_error varchar2(1000); cursor c_dsc select * error_column; r_dsc error_column%rowtype; begin open c_log; loop fetch c_log v_error; open ...