Posts

Showing posts from June, 2012

spring - Adding detail in a WS SoapFault : my custom ExceptionResolver is not used -

i'm building web service using spring boot (1.2.4.release) , i'm quite new framework. especially, i'm trying customize soapfault content when exception thrown (adding "detail" tag). i followed article : http://www.stevideter.com/2009/02/18/of-exceptionresolvers-and-xmlbeans/ here exception: package foo.bar.exception; import org.springframework.ws.soap.server.endpoint.annotation.faultcode; import org.springframework.ws.soap.server.endpoint.annotation.soapfault; @soapfault(faultcode = faultcode.server) public class serviceexception extends exception { private static final long serialversionuid = -1804604596179996724l; private string tempfaultdetail; public serviceexception(){ super("serviceexception"); } public serviceexception(string message) { super(message); } public serviceexception(string message, throwable cause) { super(message, cause); } public serviceexception(string me...

php - Are ajax requests guaranteed to hit the server in order? -

from the docs : the first letter in ajax stands "asynchronous," meaning operation occurs in parallel , order of completion not guaranteed. i interpret mean then/done/always/fail callbacks not guaranteed fire in order requests went out. makes sense if you're calling different api endpoints , take longer others. what want know if you're making ajax requests same api endpoint, guaranteed reach server in order? i've written code autosaves draft type, , want know if i'm guaranteed saving latest copy of draft, or if it's possible older ajax request come in after newer 1 , php code cause newer draft overwritten older one. doesn't matter in order requests return ; order they're received matters. i can conceive of way fix this, want know if it's necessary. requests can arrive in order network(s) involved decide deliver packets in. e.g. request #1 @ timepoint 0.000 takes route a request #2 @ timepoint 0.123 takes route b...

java - Reading and storing names in an array from user input -

i'm in midst of creating program takes in 10 names user input, stores them in array , prints them out in upper case. know there's been similar threads/questions asked none of them helped me. per, appreciated. my code: import java.util.scanner; public class readandstorenames { public static void main(string[] args) throws exception { scanner scan = new scanner(system.in); //take 10 string values user system.out.println("enter 10 names: "); string n = scan.nextline(); string [] names = {n}; //store names in array (int = 0; < 10; i++){ names[i] = scan.nextline(); } //sequentially print names , uppercase them (string : names){ system.out.println(i.touppercase()); } scan.close(); } } the current error i'm getting (after 3 inputs may add): enter 10 names: tom steve phil exception in thread "main" java.lang.arrayindexoutofboundsexception: 1 @ readandstorenames.main(re...

What does `--rm` do when running a docker image with data volumes? -

while going through docker documentation on running images mounted volumes following command has --rm flag set on it. $ docker run --rm -it -v ~/.bash_history:/.bash_history ubuntu /bin/bash what --rm flag do? as in docs : --rm=false: automatically remove container when exits (incompatible -d) the container being run automatically removed finishes work. volumes should stay untouched.

continuous integration - Teamcity automatic build configuration -

i wasnt able find creating or exporting build configuration teamcity import in instance of teamcity. possible? it valuable have such thing xml build or pipeline configuration. there 2 reasons that: make intependent , easyly moved teamcity instance. have scriptable instance create script/xml create , setup jobs me automatically. if possible somehow please advise. teamcity 9.0 introduced support for: moving projects between teamcity servers , and storing project settings in git , mercurial if want script creation of build configurations, take @ teamcity rest api .

binary search - MySQL order by Alphanumeric (Numers, Capital letters and then lower case) -

how in mysql sort numbers, capital letters , lastly lower case letters? this current table: 24rps8wyitpwhnamp 25xa2rpbh28cjqcnk 27wktqifnuxbfxzgg 288vdizsy4g6ybdmt 28a2hedvgvgpbnwku 28a2hedvgvgpbnwku 2a5ttwymbxmjety99 2a5ttwymbxmjety99 2a5ttwymbxmjety99 2a5ttwymbxmjety99 2b7a4tgcgbynq8jjm 2b7a4tgcgbynq8jjm 2ewfrnrxke4k472dj 2fw2jjeorjn6ddckv and want this: 24rps8wyitpwhnamp 25xa2rpbh28cjqcnk 27wktqifnuxbfxzgg 288vdizsy4g6ybdmt 28a2hedvgvgpbnwku 28a2hedvgvgpbnwku 2b7a4tgcgbynq8jjm 2b7a4tgcgbynq8jjm 2fw2jjeorjn6ddckv 2a5ttwymbxmjety99 2a5ttwymbxmjety99 2a5ttwymbxmjety99 2a5ttwymbxmjety99 2ewfrnrxke4k472dj i found this: http://www.essentialsql.com/use-sql-server-to-sort-alphanumeric-values/ but can't use patindex function in mysql..

OData POST doesn't set last property of object using a Asp.Net ApiController -

i have following xml document, submitted ( post ) system.web.http.apicontroller. the code of controller ( post ) pretty basic: <responsetype(gettype(representative))> function postrepresentative(byval model representative) ihttpactionresult if not modelstate.isvalid return badrequest(modelstate) end if representativerepository.add(model) unitofwork.commit() ' db.representative.add(representative) ' db.savechangesasync() return createdatroute("defaultapi", new {.id = model.id}, model) end function and here document i'm submitting in post <?xml version="1.0" encoding="utf-8"?> <representative xmlns="http://schemas.datacontract.org/2004/07/omnisoft.domain.slave" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance"> <id>8</id> <commission>10</commission> <email /> ...

mysql - PHP insert image upload url in database -

i have 2 way insert image upload url in mysql database: one:(only filename) 1410468094_shutterstock_130757219.jpg two:(full url) http://localhost/nws/uploads/files/1/shutterstock_130757219.jpg which way better? file name best cause if anytime change folder name or location .

ios - Keyboard is not open on button click -

i want show keyboard when tap on button, case keyboard has accessory view , textfield. in short, want open keyboard accessory view textfield. right way it..? i searched lot, none of solutions helped me achieve this. please me. here code : viewcontroller.m @interface viewcontroller () <uitextfielddelegate> { uitextfield *txtnote; } @implementation viewcontroller - (void)viewdidload { [super viewdidload]; uiview *accview = [self createaccessoryview]; [txtnote setinputaccessoryview:accview]; } - (uiview *)createaccessoryview { uiview *accessoryview = [[uiview alloc]initwithframe:cgrectmake(0, 0, self.view.frame.size.width, 45)]; [accessoryview setbackgroundcolor:[uicolor lightgraycolor]]; [accessoryview setautoresizingmask:uiviewautoresizingflexiblewidth | uiviewautoresizingflexibleleftmargin]; cgfloat x = self.view.frame.size.width-65; txtnote = [[uitextfield alloc] initwithframe:cgrectmake(0, 5, x-5, 35)]; txtnote.delegate = ...

java - JTS Geometry.intersects() method produces infinite loop -

i'm trying check whether multipolygon intersects polygon in list, using jts library. however, method stucks in infinite loop , end out of heap space error. the method works fine pairs apparently don't intersect. infinite loop starts when first pair that's intersect appears. here coordinate sequence of 2 problematic geometry objects, (geojson format): edit 1 - adding code: multipolygon: [ [ [ [ 24.899993263111575, 60.168590212519007, 0.0 ], [ 24.8921845577913, 60.170930189360085, 0.0 ], [ 24.906727352467691, 60.177129472862902, 0.0 ], [ 24.912750145776748, 60.178210672366426, 0.0 ], [ 24.915824674917332, 60.1759297188066, 0.0 ], [ 24.916581969097017, 60.175298383750082, 0.0 ], [ 24.921993683436096, 60.17592332951083, 0.0 ], [ 24.924298430649159, 60.176277074203171, 0.0 ], [ 24.925777801589089, 60.176578177900481, 0.0 ], [ 24.927069958749666, 60.176812746915481, 0.0 ], [ 24.934606301659603, 60.17770118209701, 0.0 ], [ 24.93829154797028, 60.17943631088842, 0.0 ],...

MYSQL PHP PDO Fill table with database data -

Image
i want give out every line in database. seems working returns first column. note: there values empty fields in database! $columns = "ticket, last_modified_date, requester"; heres code: function getticket($columns){ echo($columns); global $db_host, $db_name, $db_user, $db_pass; $db = new pdo("mysql:host=$db_host;dbname=$db_name;charset=utf8", "$db_user", "$db_pass"); $result = $db->prepare("select $columns tickets"); if ($result->execute()){ echo("<b>successfully!</b><br><br>"); $rows = $result->fetchall(pdo::fetch_assoc); $col_names = explode(',', $columns); foreach($rows $row){ echo("<tr>"); foreach($col_names $col_name){ if (!isset($row[$col_name])){ continue; } echo("<td>".$row[$col_name]."</td>"); } echo("</tr>"); } } else{ echo(...

c++ - Throwing exception and it's messages -

i'm new using clion , try write simple program understand how works. i'm on windows 8 + cygwin program is: int main() { throw std::exception(); } i got in console output: c:\....\bin.exe process finished exit code 0 where messages program aborted or else? there nothing, , how should detect if program aborted throwing exception? this done because don't have try , catch , happens stack unwitted.in function if don't have catch goes down stack until reaches main , if there no catch terminate.if function throw exception without catch terminate imediately , go caller function.if caller function main , don't have catch program terminate.it goes down stack , without catch somewhere in chain of functions terminate program.

Dismissing a custom incoming call screen on Android when the call is answered or the phone stops ringing -

i want have custom incoming call screen shows when there incoming call, , dismissed if call answered or phone stops ringing. i've searched several posts on stackoverflow show me how can implement that, , far there , after checking pros , cons of each approach in terms of how fast screen gets shown, i've settled on windowmanager approach. whenever call wm.removeview(ly) stack below 07-08 20:36:41.002 27547-27547/com.testtelephoney.customincomingcall e/androidruntime﹕ fatal exception: main process: com.testtelephoney.customincomingcall, pid: 27547 java.lang.illegalargumentexception: view=android.widget.linearlayout{7e63aae v.e..... ......i. 0,0-0,0} not attached window manager @ android.view.windowmanagerglobal.findviewlocked(windowmanagerglobal.java:402) @ android.view.windowmanagerglobal.removeview(windowmanagerglobal.java:328) @ android.view.windowmanagerimpl.removeviewimmediate(windowmanagerimpl.java:84) @ com.testtelephoney.customi...

MongoDB Delete records where group by count -

i have lot of records contains duplicate addresses. basically, want delete records has number of duplicate addresses more 50 less 300. this how records want delete: db.directories.aggregate( [ { $group: { _id: { address: "$address" }, total: { $sum: 1 } } }, { $match: { total: { $gt: 50, $lt: 300 } } }, { $sort: { total: -1 } } ], { allowdiskuse: true }); you can use cursor method foreach() iterate cursor returned aggregate() method , delete documents using remove() method, in following example: var pipeline = [ { $group: { _id: { address: "$address" }, total: { $sum: 1 } } }, { $match: { total: { $gt: 50, $lt: 300 } } }, { $sort: { total: -1 } } ]; var options = { allowdiskuse: true }; db.directories.aggregate(pipeline, options).foreach(function (doc){ var query = {"address": doc._id.address}; db.directories.remove(query); });

Three.js Camera Quaternion offset for gyro input -

i'm using deviceorientationcontroller.js three.js whch uses quaternions camera orientation. when user touches device overrides gyro input , uses touch input instead. when user releases touch snaps absolute gyro input quaternion opposed offsetting gyro accommodate new camera orientation. i need take initial quaternion value camera orientation , offset gyro input reflect starting position.

java - What decides whether a static or object method should be called -

just general query came accidentally giving variable of 1 class name matched class both had method of same name, 1 of static. given following: public class { public static string dothis(string string){ return "class"; } public static string dothis(string string, string string2){ return "class method 2"; } } and this public class b { public string dothis(string string){ return "object"; } } is following call object , not static method once object instantiated? system.out.println(a.dothis("..."));//outputs class b = new b(); system.out.println(a.dothis("..."));//outputs object n.b. following instantiation appears impossible call static methods in class a, i.e. b = new b(); system.out.println(a.dothis("...")); system.out.println(a.dothis("...","..."));//won't compile the above won't compile complaining erroneous tree type, edi...

excel - VBA Reptitive MDX query to Analysis Services -

i have report run same mdx query each week, , paste results in worksheet generate report. know how connect olap cube in excel, don't manipulating pivot table match query. i'd use vba connect cube , and return results of specific query in worksheet values paste, or table. can save mdx query in seperate sheet. possible? i'm new vba, i'm not sure started. example code great. i think previous question pretty need: any mdx query within excel vba? i adapted code in previous question-answer wrote following seems return number ok: sub getfromcube() dim strconn string strconn = _ "provider=msolap.6;" & _ "data source=imxxxxxx;" & _ '<<<name of server here "initial catalog=adventureworksdw2012multidimensional-ee;" & _ '<<<name of adv wrks db here "integrated security=sspi" dim pubconn adodb.connection set pubconn = new adodb.conn...

java - Reason for casting a static final short to a short? -

i came across didn't understand earlier , wondering if may able shed light on it. there class file many static final variables, they're case same type in declaration , wonder why. so example have: public static final short a_const_value = (short)12; thanks. there no problem in line public static final short a_const_value = (short)12; or public static final short a_const_value = 12; if literal specifying within range of short -32,768 32,767. if line public static final short a_const_value = 32768; , compile error "possible loss of precision found: int, required : short" instead if write public static final short a_const_value = (short)32768; value of a_const_value type casted short , it's value -32768 ie cycle back. so long literal within range of short, don't need typecast.also literal assigning a_const_value not datatype numeric value , should lie within range -32,768 32,767 because a_const_value short dataype. nuts n bolts of pri...

how to set jms message custom header using xpath in camel route -

i using camel route builder move 1 activemq jms message 1 queue setting custom header, using xpath read node value xml. nothing has been set. please suggest if know answer. from("activemq:com.queue1") .setheader("ordernumber").xpath("/orderrequest/authnumber") .to("activemq:com.queue2") .end(); xml <?xml version="1.0" encoding="utf-8" standalone="yes"?> <ns3:orderrequest xmlns:ns2="http://www.company.com/services/entity/v1" xmlns:ns3="http://www.company.com/services/dataobject/v1"> <authnumber>a81585</authnumber> </ns3:orderrequest> xml namespaces requires name spaces setup correctly. you need setup namespace handler this: namespaces ns = new namespaces("ns3", "http://www.company.com/services/dataobject/v1"); .... xpath("/ns3:orderrequest/ns3:authnumber...

(How) Can I control audio Line-In on an Android x86 computer? -

i have computer installed android x86 4.4-r2 , have control (i.e. mute/unmute) 1 of both line input channels. computer has h81m-itx motherboard , line-in channel need control rear connector (blue jack). cannot locate line input channel control in android sdk, probably, guess, because not intended run on else controlled hardware known audio inputs , outputs. i need mute/unmute channel android app. what's straightforward way? code framework or run external process, i.e. alsa_amixer right parameters?

java - Slow (non-quick) documentation in IntelliJ? -

Image
can browse available javadocs intellij? for example, configured library in maven , has javadoc available on maven repository. it lazy download hand, unpack , open browser. is possible automatically , browse class name? without coding first. the "how download documentation" question answered in other question . there's not way directly browse attached javadocs, thee pseudo way it. first i'll mention in code, can use quick documentation shortcut ( ctrl + q or ⌃ , j on mac) browse open documentation class/method cursor position. once quick documentation window open, can click blue arrow , type shift + f1 (not sure mac) open documentation in browser. if documentation in jar file, , have not done previously, idea offer extract javadocs jar file. if want browse javadoc class or method have not yet used, there way it. use go class action ctrl + n ( ⌘ , o ) or go symbol (i.e. field, method, etc) ctrl + alt + shift + n ( ⌘ , ⌥ o ) "search"...

javascript - Modal Window in Angularjs -

i have simple modal show on top of page, , can't seem right angularjs. using chrome plugin angular debugger, has lost track of scope. please me regain scope @ least, or better yet how use modal angular-ui-bootstrap module. class_details.js var app = angular.module('classdetails', ['ui.bootstrap']) .config(['$httpprovider', function($httpprovider) { $httpprovider.defaults.xsrfheadername = 'x-csrftoken'; }]) .controller('classdetailscontroller', ['$scope', '$modal', '$http', function($scope, $modal, $http) { $scope.username = 'bob'; $scope.board = {name: "welding", id: 1}; $scope.categories = [{name: "tests", id: 123, weight: 13}] $scope.openmodal = function(category) { $modal.open({ animation: false, templateurl: 'modal-template.html', controller: 'modalcontrol', resolve: { ...

gorm - Issues with GRAILS UUID and PSQL -

i trying use uuid2 generator on grails 2.4.4, psql version 9.4.4. current model setup is. class classa { uuid id static mapping = { id generator:'uuid2', name:'uuid2', type:'pg-uuid' tableperhierarchy false } } and class classb extends classa { static constraints = { } static mapping = { } } but when perform run-app error. error context.grailscontextloaderlistener - error initializing application: error evaluating orm mappings block domain [classb]: null message: error evaluating orm mappings block domain [classb]: null any ideas did wrong? rename uuid id uuid uuid2 or remove name: uuid2 . far know name in mapping assign id generator 1 of properties. enter link description here

css - Limit TD text length -

Image
i've grid generated backgrid. and want limit text length, each td must on 1 line. width property on td has no effect. thanks help. depending on how define 'limit', can prevent wrapping, , control overflow: td{ white-space:nowrap; overflow:hidden; text-overflow:ellipsis; } this keep contents 1 line, ellipsis being appended end if textual content exceeds allowed width of td

ios - Slide Menu in ViewController? -

Image
i want slide menu facebook right barbutton animation view in viewcontroller. app delegate setting routeviewcontroller. but want change current view controller slideout menu. this example in right side: you can try use interactivesidemenu library purpose. set visiblecontentwidth 0 transitionoptionsbuilder . here example: override func menutransitionoptionsbuilder() -> transitionoptionsbuilder? { return transitionoptionsbuilder() { builder in builder.visiblecontentwidth = 0 } you can find more details here .

arrays - remove list of specific characters from string php -

this question has answer here: methods remove specific characters string? 3 answers $string = "' ! ; • ,\ karsho: ; • ;}"; here want remove following characters, $remove = array("'","!",";","•",",","\","}","{","[","]"); this input. want above array characters $string . want string like, karsho: you can use code $string = "' ! ; • ,\ karsho: ; • ;}"; echo $new_str = str_replace(str_split('\\/!;•,}:*?"<>|'), ' ', $string);

Openshift with Geoserver and PostGIS DB configured...now what? -

i've set geoserver , postgis db on openshift. can confirm have data in db because can connect qgis , add layers....now trying create simple map 1 layer can not find tutorials on this... below code works local instance of data create simple map...what url use layers created on openshift? can't seem find them. <!doctype html public "-//w3c//dtd xhtml 1.0 strict//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>ogr2layers</title> <style> #map{width:400px;height:400px;} </style> <script src="http://www.openlayers.org/api/2.13/openlayers.js"></script> <script type="text/javascript"> var map, selectscontrols function init(){ var option = { projection: new openlayers.projection("epsg:900913"), displayprojection: new openlayers.projection("epsg:4326") }; map...

ruby - Rails will not install on my Mac -

whenever attempt install rails on mac works fine after when attempt see version of rails have, terminal says not have rails installed. here's see in terminal: admins-mbp-5:~ programming$ sudo gem install rails building native extensions. take while... error: error installing rails: error: failed build gem native extension. /system/library/frameworks/ruby.framework/versions/2.0/usr/bin/ruby extconf.rb checking if c compiler accepts ... yes checking if c compiler accepts -wno-error=unused-command-line-argument-hard-error-in-future... no building nokogiri using packaged libraries. ----- file "/usr/include/iconv.h" missing in build environment, means haven't installed xcode command line tools properly. install command line tools, try running `xcode-select --install` on terminal , follow instructions. if fails, open xcode.app, select menu "xcode" - "open developer tool" - "more developer tools" open developer site, downloa...

swift - How to use a two dimensional array to store classes? -

i want create map in swift (two-dimensional) containing class on each field (groundtype, height, visible etc). have found nothing how reallize this... examples have simple int or boolean content. that can access like: let currentfield = field[x,y].height() could help? here example creating 5 x 3 multidimensional array hold classes of type field : class field { init (groundtype: string, height: double, visible: bool) { self.groundtype = groundtype self.height = height self.visible = visible } var groundtype: string var height: double var visible: bool } // two-dimensional array array of arrays. use array constructor // twice create 5 3 multidimensional array var fields:[[field?]] = array(count: 5, repeatedvalue: array(count: 3, repeatedvalue: nil)) fields[4][2] = field(groundtype: "mountain", height: 4300.23, visible: true) if let height = fields[4][2]?.height { println(height) }

wikipedia api - Classic ASP xmlDOM not turning any result? -

this code dont respond result. dont know why? can me? <% set xmldom = server.createobject("microsoft.xmldom") xmldom.async = false xmldom.setproperty "serverhttprequest", true xmldom.load("https://tr.wikipedia.org/w/api.php?format=xml&maxage=600&smaxage=1200&action=opensearch&search=fizik&limit=10") set itemlist = xmldom.selectnodes("item") each itemattrib in itemlist newsdate = itemattrib.selectsinglenode("description").text %> <%=newsdate%> <% next set xmldom = nothing set itemlist = nothing %> sorry bad english.

ios - MKAnnotation Not Conform to Protocol -

i new ios programming , having problem extending locationa class conform mkannotation protocol. the locationa class is: import mapkit class locationa { let name: string let identifier: string let latitude: cllocationdegrees let longitude: cllocationdegrees init (name: string, identifier: string, latitude: cllocationdegrees, longitude: cllocationdegrees) { self.name = name self.identifier = identifier self.latitude = latitude self.longitude = longitude } } the extended version is: import mapkit extension locationa: mkannotation, nsobject { var coordinate: cllocationcoordinate2d { return cllocationcoordinate2d(latitude: latitude, longitude: longitude) } var title: string! { return identifier } var subtitle: string! { return name } } it appears have implemented attributes required protocol still getting "not conform protocol" error. advice appreciated! ...

ssis - How to change date time MDS format? -

we working microsof ssis ,when loading data in mds ( master data services ) , facing following issue the date concatenated time. example [1]: date time yy : mm : dd : 00 : 00 :00 what want following format (the date without time part) date yy : mm : dd we have used date mask not working expected . how resolve issue ?

android - Service not Register After Changing in package name -

after change package name there error occur like. i tryng change package name. package name change there error service not register. , application cant able run properly. application cant able destroy launcher activity. 06-26 16:45:19.806 27366-27366/my.instaupdate.otr.app.im e/androidruntime﹕ fatal exception: main process: my.instaupdate.otr.app.im, pid: 27366 java.lang.runtimeexception: unable destroy activity {my.instaupdate.otr.app.im/my.instaupdate.otr.app.im.app.welcomeactivity}: java.lang.illegalargumentexception: service not registered: my.instaupdate.cacheword.cachewordactivityhandler@14403580 @ android.app.activitythread.performdestroyactivity(activitythread.java:3758) @ android.app.activitythread.handledestroyactivity(activitythread.java:3776) @ android.app.activitythread.access$1400(activitythread.java:148) @ android.app.activitythread$h.handlemessage(activitythread.java:1346) ...

Add two xml entries with the same name - InstallShield -

Image
i want add 2 entries xml file installshield. when try it, 1 added entry. there workaround this? when read tree in left pane xpath query (join levels of tree / ), each element want installshield create must not found. can cause adding predicate looks attribute. alternately can adding 1 based on position(), but, depending on xml file, position() can rather fragile. in practice, means should replace 1 instance of name add add[@name='bsentities'] , other whatever name contains (your question doesn't show that), unless of course names same. if are, find else makes them unique. worst case it's matter of position, use, say, add[1] , add[2] .

javascript - How can I make this jQuery play nice with browser "back" buttons? -

i'm not @ jquery or javascript in general, i've managed cobble something. please bear me, , forgive ignorance. fiddle 1 $(document).ready(function () { $('#searchresults tr').click(function (event) { if (event.target.type !== 'checkbox') { $(':checkbox', this).trigger('click'); } }); $("input[type='checkbox']").change(function (e) { if ($(this).is(":checked")) { $(this).closest('tr').addclass("active"); } else { $(this).closest('tr').removeclass("active"); } }); }); basically i've set jquery allow users click anywhere in table row, select check box in first column of row. , when box gets checked, adds css class whole row. works in reverse, unchecking checkbox, , removing css class. works great far. where fails when selects few rows , submits form, navigating next page in website, realizes they've made mistake , hit brow...

How to handle hash value type in Perl XS -

i need process hash value depends on value type. here code problem: i32 keys = hv_iterinit(hash); (i32 = 0; < keys; i++) { char *key = null; i32 key_length = 0; sv *value = hv_iternextsv(hash, &key, &key_length); // svrok(value); if (svtype(svrv(value)) < svt_pvav) { // handle scalar printf("key %s has scalar value\n", key); } else if (svtype(svrv(value)) == svt_pvav) { // handle array printf("key %s has array value\n", key); } else if (svtype(svrv(value)) == svt_pvhv) { // handle hash printf("key %s has hash value\n", key); } } if don't use commented line, have problem scalar values. example following hash {a => "b", c => {d => "e"}} produce output: key c has hash value key d has scalar value so here questions: do have reference returned hv_iternextsv() or returns scalar? why don't see scalar value output key a . update. my mistake i...

javascript - Access HTML Parent, Child, Sibling elements in Angular JS -

$scope.delete = function(){ here want t.number }; <li class="item" ng-repeat="t in items"> <div class="row"> <div class="col col-10"><i></i></div> <div class="col col-70"> <span class="number">{{t.number}}</span> <p class="date">{{t.date}}</p> </div> <div class="col col-20"> <i class="ion ion-ios-paper" ng-click="details()"></i> <i class="ion ion-trash-a" ng-click="delete()"></i> </div> </div> </li> please guide me how access html ...

c++ - Sending Two or more chars using SendInput -

to send char, can use sendinput. how can use send more 1 char? i tried code not send anything: input in; in.type=input_keyboard; in.ki.wscan=0; in.ki.time=0; in.ki.dwextrainfo=0; in.ki.wvk=0x53+0x54; sendinput(2,&in,sizeof(input)); so, right way? the first parameter of sendinput() specifies how many input structures passing in. passing in 1, telling sendinput() passing in 2. you cannot specify 2 separate virtual keys in single input . need declare array of multiple input s, 1 each virtual key, , don't forget include 2 input s each virtual key - 1 keydown event , 1 keyup event. so, in example, need 4 input s send 2 virtual keys, shown in @user4581301's answer. now, regarding keyeventf_unicode , don't use virtual keys it, use actual unicode codepoints instead, specified using utf-16 codeunits, 1 per input . means if want send unicode codepoint requires utf-16 surrogate pair, need 2 input s, 1 high surrogate , 1 low surrogate. caveat not me...

python - Error summing values in a dictionary -

i following error when trying sum values dictionary. expect sum (i.e. 15), error thrown instead. is bug? ipython qtconsole 3.1.0 python 2.7.10 |continuum analytics, inc.| (default, may 28 2015, 17:04:42) d = {'1': 1, '2': 2 , '3': 3, '4': 4, '5': 5} >>> sum(d.values()) --------------------------------------------------------------------------- typeerror traceback (most recent call last) <ipython-input-36-4babd535f17a> in <module>() ----> 1 sum(d.values()) typeerror: 'int' object not callable you have named variable sum in code points int trying call not sum function. add del sum try code again. example of why should not shadow builtin function names. in [24]: sum = 4 in [25]: sum((1,2)) --------------------------------------------------------------------------- typeerror traceback (most recent call last) <ipython-inp...

xaml - How can you make a WPF Expander stretch vertically within a vertical StackPanel -

given xaml below, possible make adjustment when either of expander items expanded, textblock content stretches vertically fill remaining space? (note xaml purposely simplified, solution must satisfy simple example , data bound itemssource scenario). the stackpanel stretches fill space (since contained within grid ), assume there conflict within stackpanel measuring code not allow infinitely large content elements. i'm not sure if possible resolve elegantly, may require manually overriding measuring code , determining optimal expanded height content container. <grid> <stackpanel> <expander header="item 1"> <textblock background="lightcoral" text="content 1 should stretched vertically when expanded"/> </expander> <expander header="item 2"> <textblock background="lightblue" text="content 2 should stretched vertically when expan...

php - Printing a field value in an array -

i'm using tutorial found here display directions based on google maps directions api in drupal. have 2 fields in node - originfield , destinationfield. each of them contains name of city. the problem can't print field value inside of $params array. here whole tpl.php code: <?php /** * @file * returns html node. * * complete documentation file available online. * @see https://drupal.org/node/1728164 */ ?> <?php // print works: print $node->field_originfield['und'][0]['value']; // parameters used request $params = array( 'origin' => 'tokyo, japan', // can't find way output originfield's value here 'destination' => 'kyoto, japan' // can't find way output destinationfield's value here ); // join parameters url string foreach($params $var => $val){ $params_string .= '&' . $var . '=' . urlencode($val); } ...

How to add configuration file to android studio in windows? -

google have changed docs generating registration id , gcm in general. docs incomplete , include non functional code, 1 of adding configuration file project . stuck @ step. $ move path-to-download/google-services.json app/ invalid windows command. can correct syntax me please? ok, figured out. here correct answer. first don't copy , paste line(sounds first time read it). windows don't need dollar sign , use backslashes not forward slashes. do not forget write path name in quotes, else give "the syntax of command incorrect." exception move "c:\yourdownload folder here\google-services.json" "app\"

node.js - Connect assets with handlebars? -

the typical way include connect assets file != css("main") that .jade though. using handlebars , have no clue how can add file? i using node-sass well. just guessing, works (see blog post ): var connectassets = require("connect-assets")(); app.use(connectassets); var hbs = require('hbs'); hbs.registerhelper('css', function() { var css = connectassets.options.helpercontext.css.apply(this, arguments); return new hbs.safestring(css); });

csv - Match user from list against filenames -

i have long winded script gets user csv file, matches user against csv filename specific directory. the user matched against csv file in format <data><samaccountname><text>.csv the aim here ad user list, scan folder csv files in , match against user. there restore user ad attributes. the issue here output of last user twice, have rem out export @ end can see on screen first. clear-host #get username users list , match against csv file name. $fdate = (get-date).tostring("yyymmdd") $project = "<folderpath>" #project name used setup folders , reports etc $projectroot = "<path>\" # backup folder $restorepath = $projectroot + $project #combined path restoring $userslistfile = $projectroot + '\userlist.csv' #userlist $results = @{} # storage csv files $psobject = new-object psobject $report = @() #for export-csv $results = gci $restorepath -filter '*.csv' $i = 0 foreach ($file in $results) { $i += 1 ...

javascript - How to create an interactive (clickable) animation for responsive website? -

anyone have suggestions object animations can show text on hover or click? looking on: trying make these crystals objects interactive. sample mockup website here. surround animations div, bind jquery mouseover , mouseout events add , remove css class contains desired text. this: html: <div class="crystaldiv"> <!-- contains image of crystal. can have many want --> </div> css: .crystalhover:after{ content:"whatever text"; position: absolute; /* use top, bottom, left, right position - relative crystal div*/ } javascript: $('.crystaldiv').on('mouseover',function(e) { $(this).addclass('crystalhover'); }); $('.crystaldiv').on('mouseout',function(e) { $(this).removeclass('crystalhover'); }); // can same thing click event if want

Twitter json data in Hadoop -

i have done twitter data streaming hdfs. twitter-agent configuration: #setting properties of agent twitter-agent.sources=source1 twitter-agent.channels=channel1 twitter-agent.sinks=sink1 #configuring sources twitter-agent.sources.source1.type=com.cloudera.flume.source.twittersource twitter-agent.sources.source1.channels=channel1 twitter-agent.sources.source1.consumerkey=<consumer-key> twitter-agent.sources.source1.consumersecret=<consumer-secret> twitter-agent.sources.source1.accesstoken=<access-token> twitter-agent.sources.source1.accesstokensecret=<access-token-secret> twitter-agent.sources.source1.keywords= morning, night, hadoop, bigdata #configuring channels twitter-agent.channels.channel1.type=memory twitter-agent.channels.channel1.capacity=10000 twitter-agent.channels.channel1.transactioncapacity=100 #configuring sinks twitter-agent.sinks.sink1.channel=channel1 twitter-agent.sinks.sink1.type=hdfs twitter-agent.sinks.sink...