Posts

Showing posts from September, 2014

android - How to disable all the buttons in the layout for a certain amount of time, java.NullPointerException -

secondscreen.java public class secondscreen extends activity implements view.onclicklistener { //drawables int res[] = new int[] {r.drawable.brownbars,r.drawable.centeredorangedot, r.drawable.dots, r.drawable.greenlines, r.drawable.lightbulb, r.drawable.orangedots, r.drawable.orangelines, r.drawable.tree, r.drawable.yellow, r.drawable.yellowwithred, r.drawable.brownbars,r.drawable.centeredorangedot, r.drawable.dots, r.drawable.greenlines, r.drawable.lightbulb, r.drawable.orangedots, r.drawable.orangelines, r.drawable.tree, r.drawable.yellow, r.drawable.yellowwithred}; int lay1, lay2, shufflecount = 0, gamecount = 0; imagebutton first, second; linearlayout layout; imagebutton b1; imagebutton b2; imagebutton b3; imagebutton b4; imagebutton b5; imagebutton b6; imagebutton b7; imagebutton b8; imagebutton b9; imagebutton b10; imagebutton b11; imagebutton b12; imagebutton b13; imagebutton b14; imagebutton b15; imagebutton b16; imagebutton b17; imagebutton b18; imagebutton b

IOS Swift - Manually trigger textfield events -

how trigger events manually given uitextfield object? textfieldshouldbeginediting(_:) textfielddidbeginediting(_:) textfieldshouldendediting(_:) textfielddidendediting(_:) in current scenario. there logic goes above callbacks. , there times when manually update textfield textfield.text = <new text> and textfielddidbeginediting to trigger, (hopefully) textfield.trigger("textfielddidbeginediting") while approach might not entirely right way, above solution works me. although, if can word question differently, be: how can run logic (code) when uitextfields value (text) changed via ui or via textfield.text = <new value> to elaborate on answer , reasoning: i don't think possible trigger kind of events "by hand" - neither should able to. cause possibly more problems solves. e.g. should happen caret example, should displayed in textfield? therefore suggest extract logic second method , call method current code , handle

foreach - Pass .each loop reference object in Ruby on Rails -

i writing code in ruby on rails creating dynamic rows in table involves .each loop. want pass .each loop reference object gives me error. following code: <% pworkflows.workflow_executions_list.each |wf| %> <tr> <td><%= wf.execution_status %></td> <td> <% if(wf.start_timestamp != nil) %> <%= wf.start_timestamp.localtime; %> utc <% end %> </td> <td><%= wf.close_status %></td> <td><%= wf.execution.run_id %></td> <td><%= button_to "details",{ :controller => "pages", :action => "mainpage",:rulesetinstance=>rinsid, :ndetails=>wf} %></td> </tr> <% end %> :ndetails=>wf gives error. wf not being recognized correct syntax send. please suggest way. the error being: undefined local variable or method `id' #<comrulemanagement::workflowexecutionobject:0x00003d

javascript - JQuery Change Property of Data Table -

hi there have data table created in jquery shown.. <html> <head> <link rel="stylesheet" href="ui/jquery-ui.min.css"> <script src="ui/external/jquery/jquery.js"></script> <script src="ui/jquery-ui.min.js"></script> <script src="datatables-1.10.7/media/js/jquery.js"></script> <script src="datatables-1.10.7/media/js/jquery.datatables.js"></script> </head> <body> <script> $(document).ready(function() { var table = $('#example').datatable( { scrolly: 300, paging: false }); var settings = table.fnsettings(); console.log(settings) }); </script> </body> </html> i trying modify property scrolly have different value such 400. after initialisation. however, variable settings apparently null. thanks in advance. the reason being returned null value because jquery datatables can&#

javascript - Adding a fade in/fade out effect to innerHTML -

i have function loads in json file , changes contents of several divs on page. part works correct, wanted make sexy. when button calls function clicked, new text replaces old text. wanted old text fade out, change text, , fade in new text. here code function loadnextpassage() { //fading out effect $("#passage-title").fadeout(); $("#title").fadeout(); $("#pre-post").fadeout(); $("#passage").fadeout(); $("#media").fadeout(); //load new json file , change elements $.getjson("passage-2.3.2.json", function( data ) { document.getelementbyid("passage-title").innerhtml = data["passagenumber"]; document.getelementbyid("title").innerhtml = data["title"]; document.getelementbyid("pre-post").innerhtml = data["prereading"]; document.getelementbyid("pre-reading-content").innerhtml = data["prereading"

python - Binary integer programming with PULP using vector syntax for variables? -

new python library pulp , i'm finding documentation unhelpful, not include examples using lists of variables. i've tried create absolutely minimalist example below illustrate confusion. import pulp identifiers = ['a','b','c','d','e'] prices = dict( zip( identifiers, [100.0, 99.0, 100.5, 101.5, 200.0 ] ) ) n = len( identifiers ) x = pulp.lpvariable.dicts( "x", indexs = identifiers, lowbound=0, upbound=1, cat='integer', indexstart=[] ) prob = pulp.lpproblem( "minimalist example", pulp.lpmaximize ) prob += pulp.lpsum( [ x[i]*prices[i] in identifiers ] ), " objective sum of prices of selected items " prob += pulp.lpsum( [ x[i] in identifiers ] )==2, " constraint choose 2 items " prob.solve() ident in identifiers: if x[ident]==1: print ident + " in basket " the output is: a in basket b in basket c in basket d in basket e in basket the op

html - Centered text being pushed over CSS -

i'm going make question applicable viewers. question: how can keep centered div centered relative header, , have div @ same time side , not pushing centered div over? whenever add header, centered title being pushed over. don't understand why happening since css supposed relative parent. css code: #logout_link { margin-right:0; text-align:right; float:right; } #centered { text-align:center; } php/html code: <div id='header'> <div id='centered'>centered title</div> <div id='logout_link'> logout </div> </div> try one. <style> #header{ width:100%; overflow:hidden; } #logout_link { margin-right:0; text-align:right; float:right; width:20%; } #centered { text-align:center; width:80%; float:left; } </style> <div id='header'> <div id='centered'>centered title</div> <div id='logout_link'> logo

objective c - Application is not showing in full screen in xcode 6 simulator using SHViewPager? -

Image
i using shviewpager library swipe between viewcontroller? application not showing in full screen? right side blank? can regarding? using same code provided in example test still appear blank on right side.

ios - xcode command line test with argument passed at launch -

i have small problem implementing xcodebuild command test @ ci. have tests related specific device language, in xcode can set "arguments passed on launch" -applelanguages (language). can pass argument using xcodebuild? my script looks xcodebuild -workspace myapp.xcworkspace -scheme "myapptests" -sdk iphonesimulator -destination 'platform=ios simulator,name=iphone 6,os=9.0' test thanks! xcodebuild build app. can use command run app specific language. xcrun simctl launch <deviceid> <appid> -applelanguages "(pt-br)" hera sample steps buil , run app: xcodebuild -sdk iphonesimulator8.4 -arch i386 install dstroot=yourappfolder xcrun instruments -w "iphone 6 (8.4 simulator)" xcrun simctl install booted yourappfolder/applications/yourapp.app xcrun simctl launch booted com.yourdomain.yourapp -applelanguages "(pt-br)"

javascript - Promises are not working in componentDidMount -

i new react.js . in componentdidmount function, calling 4 functions parallelly using q module. in every function, making api . once got responses 4 services,i want trigger 1 more function. have written following logic. var q=require("q"); componentdidmount: function () { var self=this; this.setstate({loader:true}); q.all([this.getsegmentinfo(),this.getsignedurl(),this.getoverrallmyntrametricinfo(),this.getsegmentmetricinfo()]).then( function(result){ self.makedataformetrics(); },function(error){ utils.togglemessage(true,"sorry services failed.. try again","verror"); } ); } the problem was, after got response services. dependent callback not triggering. all parallel functions looks like getsignedurl:function(){ var promiseinfo1=q.defer(); //making service using ajax return promiseinfo1.promise; } can me, why dependent function not triggering. thanks.

file processing - Handle Commas While Reading Text in Python -

my code trying read log files throughout specified directory in rootdir , write pieces of information log file outputfile the issue i'm having searchobj_archive_date.group() , fullpath , zdiscsvar , zcopiesvar , , searchobj_year_3or6.group() aren't being read file lines within log files. happens 10% of total outputted lines of text, i'm confused why it's happening of time, instead of e:\filepath\text.txt | 5/23/2015 12:00 | c:\anotherfilepath\text.txt | 23 | 23 | 5year , e:\filepath\text.txt | | | | | any insight why error occuring appreciated. code below: after doing researched, found what's causing error whenever line has comma , in it. stops reading line @ comma , skips next line, know workaround this? an example of input text that's giving me problems: 11/23/2015 12:34:58 adding file d:\fp\fp1\fp2\text, text, text.txt normally these lines don't have commas, know of way handle commas when reading in lines of text? import os imp

Password promt not displayed in PowerShell ISE -

Image
i have executable android sdk: keytool.exe call following: keytool.exe -list -keystore mykeystore.ks when executed in cmd, executable promts keystore password. when executed in powershell ise - nothing happens. why password promt not displayed inside powershell? looks powershell ise not support user promt (see comments). pitty, since have been tool

amazon web services - Spot Instances Support DCOS -

is possible change dcos template use spot instances? have looked around , there not seem information regarding this. okay, given dcos template , launchconfiguration slaves looks this: (i've shortened somewhat) "masterlaunchconfig": { "type": "aws::autoscaling::launchconfiguration", "properties": { "iaminstanceprofile": { "ref": "masterinstanceprofile" }, "securitygroups": [ ... ], "imageid": { ... }, "instancetype": { ... }, "keyname": { "ref": "keyname" }, "userdata": { ... } } } to started, need add spotprice property in there. value of spotprice is, obviously, maximum price want pay. you'll need more work around autoscaling, alarms , time of day. here's new launchconfiguration spot price of $1.00 per hour: "masterlaunchconfig": { "type": "aws::autoscaling:

javascript - Binding event to body tag -

i want bind event whole page - html or body tag. how can that? this want achieve @ first: document.addeventlistener('mousemove', function() { alert('a'); }); so doing whatever action mouse on website gives me alert. but doesn't work, , console doesn't output anything. whole code: <!doctype> <html> <head> <title>fdsjfkdsf</title> </head> <body> fdjfkjdsf <script type="text/javascript"> document.addeventlistener('mousemove', function() { alert('a'); }); </script> </body> </html> i have tried: document.getelementsbytagname('html')[0].addeventlistener('...'); window.addeventlistener('...'); but none works. how can solve this? the first example provided works fine me in chrome. check if getting errors in console. example: https://jsbin.com/fepoguceyu/edit?html,o

Python reflect image along each sides of the triangle -

Image
i have created triangle positioned in centre of screen. from pil import image, imagedraw gray = (190, 190, 190) im = image.new('rgba', (400, 400), white) points = (250, 250), (100, 250), (250, 100) draw = imagedraw.draw(im) draw.polygon(points, gray) how duplicate image , reflect along each sides of triangle @ different random points. example... plan: first find random point on edge of big triangle put smaller one, , rotate fits on edge. suppose can access points of triangle triangle.edges[0].x, triangle.edges[0].y, triangle.edges[1].x, etc we can find arbitrary point first selecting edge, , "walk random distance next edge": r = randint(3) # random integer between 0 , 2 first_edge = triangle.edges[r] second_edge = r == 2 ? triangle.edges[0] : triangle.edges[r + 1] ## next lines kind of pseudo-code r = randfloat(1) random_point = (second_edge - first_edge)*r + first_edge our next problem how rotate triangle. if have done algebra might

multithreading - Concurrent message processing in RabbitMQ consumer -

i new rabbitmq please excuse me if question sound trivial. want publish message on rabbitmq processed rabbitmq consumer. my consumer machine multi core machine (preferably worker role on azure). queuebasicconsumer pushes 1 message @ time. how can program utilize core can process multiple message concurrently. one solution open multiple channels in multiple threads , process message on there. in case how decide number of threads. another approach read message on main thread , create task , pass message task. in case have stop consuming messages in case there many message (after threshold) in progress. not sure how implemented. thanks in advance your second option sounds more reasonable - consume on single channel , spawn multiple tasks handle messages. implement concurrency control, use semaphore control number of tasks in flight. before starting task, wait semaphore become available, , after task has finished, signal semaphore allow other tasks run. you haven&#

regex - Dynamically inserting characters into a StringBuilder and Java Matcher -

i have following scenario: i have 1 liner flat file. line structured such has a header , corresponding data. looks this: header1 data data data data data header2 data data header3 data header4 data .... i have convert 1 liner format, each header on separate line, along data. so, should this: header1 data data data data data header2 data data header3 data the "header" follows consistent pattern in length , type of characters use. so, figured java regex pattern , matcher way go. i using stringbuilder , since has insert() method, using insert line separator. the problem having there line @ end of newly created file (the 1 line separator inserts) consists of several headers i.e don't seem broken new lines. seems reason fact matcher.find() stumbles upon match has start index outside of matcher's region execution exits code new line inserted. this behavior inconsistent. have flat files short (about 50 lines), problem not appear. have flat files 20k

angularjs - cordovaSocialSharing in ionic not working -

i'm using plugin cordovasocialshare of ngcordova make sharing on social networks in application. problem don’t have actions returned, , when analyzing adb logs, returns me following error: i / chromium (3635): [info: island (20306)] "typeerror: can not call method 'cansharevia' of undefined / chromium (3635): scope @ $ scope.shareviawhatsapp. (file: ///android_asset/www/js/app.js: 22: 31) look @ code: html <ion-option-button class="button-dark button-facebook" ng-click="shareanywhere()"> <i class="icon ion-social-facebook icon-facebook"></i> </ion-option-button> angularjs $ionicplatform.ready(function(){ $scope.shareviawhatsapp = function(message, image, link) { $cordovasocialsharing.cansharevia("whatsapp", message, image, link).then(function(result) { $cordovasocialsharing.shareviawhatsapp(message, image, link); }, function(error) { alert("cannot share

php - PHPSlim + angular-file-upload -

Image
i use angular-upload-file server side built php slim framework. on fileuploader config have : $scope.uploader = new fileuploader({ url: 'upload/upload.php' }); then in backend, related wiki : if ( !empty( $_files ) ) { $temppath = $_files[ 'file' ][ 'tmp_name' ]; $uploadpath = dirname( __file__ ) . directory_separator . 'uploads' . directory_separator . $_files[ 'file' ][ 'name' ]; move_uploaded_file( $temppath, $uploadpath ); $answer = array( 'answer' => 'file transfer completed' ); $json = json_encode($answer); echo $json; } else { echo 'no files'; } the problem when put code without using php slim works fine, when try wrap phpslim , get request instead of post: with such code : $scope.uploader = new fileuploader({ url: 'api/upload/img' }); and api : $app->post('/upload/img', function(){ if ( !empty( $_files ) ) { $temppath = $_

What are the steps and elements/requirements to develop a web service? -

i've read lot of threads regarding web service app, want know idea case here. we developing web service can update our local server's db , @ same time remote server's db via (internet) pl: c#, vs2012 db(local): sql2008r2 db(remote): n/a i going explain using architecture , not programming language. case norm in current soa , microservices architectures. service governing 1 function , has rest apis clients crud , rest apis store in data store behind service. services generate events crud , send message bus other client/service interested in state change can listen messages , act upon it. so can "remote server's db via internet" part asynchronously. hope helps.

c# - Python for .NET: Using same .NET assembly in multiple versions -

my problem: have assembly in 2 versions , want use them @ same time in python project. the .net libs installed in gac (msil), having same public token: lib.dll (1.0.0.0) lib.dll (2.0.0.0) in python want that: import clr clr.addreference("lib, version=1.0.0.0, ...") lib import class myclass1 = class() myclass1.operation() *magic* clr.addreference("lib, version=2.0.0.0, ...") lib import class myclass2 = class() myclass2.operation() myclass2.operationfromversion2() *other stuff* # both objects should accessibly myclass1.operation() myclass2.operationfromversion2() is there way that? appdomains or bindingredirect? note: of course myclass1.operationfromversion2() can fail... well found solution: python .net supports reflection! instead of clr.addreference("lib, version=1.0.0.0, ...") you have use assembly1 = clr.addreference("lib, version=1.0.0.0, ...") with assembly can use reflection stuff in c#. in example ha

linux - notify-send not working (in script) executed from udev -

i want notification in desktop particular usb device inserted.hence following udev rule. kernel=="sd*",subsystems=="usb",action=="add",run+="/home/username/desktop/notify_script" notify_script follows #!/bin/sh su username -c 'notify-send "usb inserted"' echo usb_inserted >> /home/username/desktop/test_file problem : the above script works if executed root command line but, notify-send in script not working if executed udev. question: how make notify-send work udev? or there other way can achieve notification ? possible invoke gui udev? thank you. the main problem is, udev-rule not run in xorg-related environment per default, not knowing display use. therefore fail, if want echo terminal gnome-terminal example. script, shall executed on udev-rule-match, must prior ui-related execution first export display. done via export display=:0 i assume, problem, , notify-send run against wa

cordova - Error using visual studio2015 for remote debugging on ios (lazy symbol binding failed: Symbol not found: _map_fd) -

when first time start remote agent visual studio ios debugging, installs homebrew , packages ( documentation ). while doing so, getting following error: error installing homebrew packages: error: command failed: /bin/sh -c (brew list ideviceinstaller | grep ideviceinstaller > /dev/null || brew install ideviceinstaller) && (brew list ios-webkit-debug-proxy | grep ios-webkit-debug-proxy > /dev/null || brew install ios-webkit-debug-proxy) error: no such keg: /usr/local/cellar/ideviceinstaller warning: have outdated version of /usr/bin/install_name_tool installed. cause binary package installations fail. can happen if install osx-gcc-installer or railsinstaller. restore it, must reinstall os x or restore binary os packages. warning: keg marked linked already, continuing anyway dyld: lazy symbol binding failed: symbol not found: _map_fd referenced from: /usr/bin/install_name_tool expected in: /usr/lib/l

javascript - HTML jQuery smooth scroll to element and add class -

i have in html this: <!doctype html> <html> <head> <meta charset="utf-8"> <title>stackoverflow please</title> </head> <body> <br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br> <div id="scrollhere">scroll here!</div> <br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br> </body>

javascript - Insert html div in js and take selector from it -

i have html content of dialog button: <div id="dialogid" class="someclass" style="somestyle"> <p>some content buttons</p> </div> i need insert using js , take div id selector showing ui dialog: ajs.dialog2("#dialogid").show(); ajs.$("#somebuttonid").click(function closewindow() { ajs.dialog2("#dialogid").hide(); }); } how can this? thanks. $('body').append('<div id="dialogid" class="someclass" style="somestyle"><p>some content buttons</p></div>'); $('#somebuttonid').on('click',function(){ $('dialogid').hide();//to close dialog //$('dialogid').show();//to show dialog }) check code

aws sdk - How to create image from snapshot using aws sdk java -

we can create image existing snapshot using aws management console. however, if want same thing using aws sdk java - not find api supporting this. seems, can create image instance, not snapshot using sdk java shown below: we can use withinstanceid(java.lang.string instanceid) method of createimagerequest class, there no supporting method snapshot id image creation. can please let me know how create image snapshot using sdk java? you want use importimage : importimageresult importimage(importimagerequest importimagerequest) throws amazonserviceexception, amazonclientexception import single or multi-volume disk images or ebs snapshots amazon machine image (ami).

Homebrew upgrade to Python 2.7.10_2 causes packages to fail with 'image not found' -

following update of homebrew using brew update brew upgrade --all that results in updating of python 2.7.10_2, pip (and many other scripts) fails cffi.ffiplatform.verificationerror: importing '/usr/local/lib/python2.7/site-packages/cryptography/_cryptography_cffi_a269d620xd5c405b7.so': dlopen(/usr/local/lib/python2.7/site-packages/cryptography/_cryptography_cffi_a269d620xd5c405b7.so, 2): library not loaded: /usr/local/lib/libssl.1.0.0.dylib referenced from: /usr/local/lib/python2.7/site-packages/cryptography/_cryptography_cffi_a269d620xd5c405b7.so reason: image not found what can restore or adjust python configuration works again? did homebrew destroyed it? traceback (most recent call last): file "/usr/local/bin/eb", line 7, in <module> ebcli.core.ebcore import main file "/usr/local/lib/python2.7/site-packages/ebcli/core/ebcore.py", line 43, in <module> . import globals, base, io, hooks file "/usr/local/lib/

How is an HTTP multipart "Content-length" header value calculated? -

Image
i've read conflicting , ambiguous replies question "how multipart http request content length calculated?". wonder: what precise content range "content-length" header calculated? are crlf ("\r\n") octet sequences counted 1 or 2 octets? can provide clear example answer these questions? the following live example should answer questions. perform multipart request google's oauth 2.0 playground google's oauth 2.0 playground web page excellent way perform multipart http request against google drive cloud. don't have understand google drive -- i'll work you. we're interested in http request , response. using playground, however, allow experiment multipart , answer other questions, should need arise. create test file uploading i created local text file called "test-multipart.txt", saved somewhere on file system. file 34 bytes large , looks this: we're testing multipart uploading! open goog

node.js - Sails JS - Sessions -

each time page reloaded, run function: init: function(req, res) { console.log("session: "); console.log(req.session); if (req.session.player_id !== undefined) { player.getplayer(req.session.player_id); } else { req.session.player_id = sails.uuid.v4(); req.session.save(); console.log("session saved"); player.createplayer(req.session.player_id); console.log("creating player: " + req.session.player_id); } } the problem every time run console.log("session: "); console.log(req.session); the player_id isn't there, , each time page reloaded, if-statement returns false. console.log("creating player: " + req.session.player_id); returns correct value, can't figure out why session doesn't follow user on each page reload? it appears solution simple this: res.send(req.session); if add end of else-statement, session store

sql - How do I remove all tables and not the schema in Postgresql? -

i have schema assigned user (jason). can't remove schema don't have permissions so. there nice way remove each tables, data, in schema , make if had freshly created schema. same effect as: drop schema jason cascade; create schema jason; but without dropping schema. try this: select 'drop table if exists "' || tablename || '" cascade;' pg_tables schemaname = 'jason'; from stackoverflow.com/questions/3327312/drop-all-tables-in-postgresql and run commands returned!

authentication - deny user="*" not working properly means even not logged into specified page -

<location path="admin"> <system.web> <authorization> <allow roles="208"/> <deny users="*"/> </authorization> </system.web> </location> if use this <deny users="?"/> access folder pages. please me.

java - How to find even or odd in array? -

how can find or odd in array? int size; int[] myarray = new int[10]; scanner input = new scanner(system.in); system.out.print("how many numbers enter:"); size = input.nextint(); for(int c = 0; c < size; c++) { system.out.print("enter number:"); myarray[c] = input.nextint(); } input.close(); for(int c = 0; c < size; c++) { system.out.println(myarray[c]); } if(size%2) { system.out.print("sadsadsad"); } } } use modulus operator check if number or odd. if divide number 2 , reminder 0 number even , otherwise odd . for(int i=0; < numbers.length; i++){ if(numbers[i]%2 == 0) system.out.println(numbers[i] + " number."); else system.out.println(numbers[i] + " odd number."); }

asp.net - can't install google map control in ASP with NuGet -

when click install in nuget packages manager screen looks flashes split second , nothing, if in installed packages there no packages installed. add line web.config file <add tagprefix="artem" namespace="artem.google.ui" assembly="artem.google" /> since package not installed can't use artem map control. have created new project , installed fine in current project need change not allowing me installed. things have done far: 1. browsed packages file in project , deleted googlemapcontrol.6.1 folder. 2. removed line web.config folder. 3. removed reference artem.google in project. 4. cleared package cache had google maps file in it.- manage nuget packages - settings - packagemanager - general - clear package cache. then tried reinstall manage nuget packages - google map control. click install , looks installs ok has green tick next it, try , add : <div> <artem:googlemap id="googlemap2" runat="server"><

android - How can display ListView using an ArrayAdapter class and runOnUiThread method in my MainActivity? -

i new android please bare me , in advance advice. when try run app following error: java.lang.classcastexception: com.protogeo.moves.demos.apps.mainactivity$6 cannot cast android.content.context @ com.protogeo.moves.demos.apps.storylineadapter.<init>(storylineadapter.java:28) @ com.protogeo.moves.demos.apps.mainactivity$6.run(mainactivity.java:285) my main activity code looks this: public class mainactivity extends fragmentactivity implements onclicklistener{ ... public void updateresponse(final string message) { runonuithread(new runnable() { @override public void run() { //medittextresponse.settext(message); storylineadapter adapter = new storylineadapter(this, r.layout.item_storyline, summary); // medittextresponse.setadapter(adapter); medittextresponse.setadapter(adapter); ... my arrayadapter code looks this: public class storylineadapter extends arrayadapter<summarydata>{

javascript - paramaterising $http response handling function in AngularJS -

i trying pass query string function paramater along "$http" data returned using angular (see code below). i'm sure it's basic i've spent 2 days on looking through stack overflow, proangularjs book, w3c online javascript , angular documentation, code academy angularjs... , , stuck. if remove 'select' function call , querystring paramater function definition works fine need pass query string paramater function ... code below... <html> <head> <title>hhldsummaryproj </title> <script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular.min.js"> </script> <script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular- route.min.js"></script> <script> var summaryapp = angular.module("summaryapp", ['ngroute']); summaryapp.config(['$routeprovider', function($routeprovider) {

php - MySQL Return everything if a letter or word is matched? -

this using right now: select * title title.posttitle '%$search%' if searches how make apple pie returns right thing. if searches make apple pie returns nothing reason. how can make if letter or word matches returns record? if posttitle contains $search value produce response. in point of view searching string holding multiple words not best practice. break string words (example using javascript) var string = "my sample sentence"; var words = str.split(" "); and search if contains words select * title (title.posttitle '%words[0]%') , (title.posttitle '%words[1]%') ...etc storing data in 1 format db search (all lowercase or uppercase)

forms - Doing a post request to a spring 2.0 controller -

i have form on html page this: <form id="profileform" method="post" action="myapp/profile/save.do"> <input type="text" name="profilelist[0].name" value="jane"/> <input type="text" name="profilelist[1].name" value="john"/> <input type="text" name="profilelist[2].name" value="alice"/> </form> when submit form, post request send spring dispatcher servlet, calls controller: public class save extends simpleformcontroller { @override protected object formbackingobject(httpservletrequest request) throws exception { //this method runs fine. profilefbo profilefbo = new profilefbo(); return profilefbo; } @override protected modelandview onsubmit(httpservletrequest request, httpservletresponse response, object command, bindexception errors) throws exception { //this

php - Add padding to a cell in TCPDF -

i have make invoices tcpdf. have logo on top of pdf , title of company has come right next it. now i'm doing this: $pdf->image(__dir__.'/../../../assets/img/logo.png', 15, 10, 10, 0); $pdf->cell(110, 0, 'company', 0, 0, 'l', 0, '', 3); but "company" on top of logo now. there way add padding left on cell? try using: $pdf->image(__dir__.'/../../../assets/img/logo.png', 15, 10, 10, 0, null, null,'t'); documentation

oracle - How to build a dynamic PLSQL query to fetch records? -

i trying create stored procedure in oracle , make dynamic query work bunch of records. have read many examples far can't work unless this: create or replace procedure givemeresultset( v_par1 in char, v_par2 in char, v_par3 in char, v_par4 in varchar2, v_par5 in varchar2, v_par6 in varchar2, cur_typ out sys_refcursor) begin open cur_typ 'select * complex_query'; --close cur_typ; end; and executing way: var c refcursor; execute givemeresultset(null,null,null,null,null,null,:c); print c; this way header names , records query, not closing cursor fetching results. if close nothing @ all. guess leaving open cause kind of memory leak problem @ point. i have seen similar cases in oracle documentation this: sql_stmt := 'select * emp'; open emp_cv sql_stmt; loop fetch emp_cv emp_rec; exit when emp_cv%notfound; -- process record end loop; close emp_cv; but have no clue goes on "proces

Android Studio's Emulator not starting -

i've installed android studio on windows 8.1 , emulator won't start when try run apps. i have found following error when trying run following error occurs 575-575/? i/pga﹕ attempting create new socket connectionn pid = 575, tid = 575

c# - How to export excel from clicking chart legend? -

i have created few charts dynamically , export data excel using closedxml. created custom item on legend , when click it, page posts , event handler raised properly. couldn't save window pop up, hence not being able save excel file. me please? i using c# on asp.net framework 4.5. here's simplified version of code. protected void page_load(object sender, eventargs e) { add_chart(); } public void add_chart() { system.web.ui.datavisualization.charting.chart add_chart1 = new system.web.ui.datavisualization.charting.chart(); //create chart here //add chart htmltablecell add_chart1.click += chart_legend_click; } protected void chart_button_click(object sender, imagemapeventargs e) { string sheetname = "trial"; string filename = "trial.xlsx"; var workbook = new xlworkbook(); var worksheet = workbook.worksheets.add(sheetname); httpresponse httpresponse = response; httpresponse.clear(); httpresponse.conte

buffer - Canonical term for "simultaneous data-latching" -

i have module (in case on fpga) several input values (registers) updated sequentially (if @ all), copied in parallel in single, atomic step guarantee coherency during following data processing steps. there common term this? " double-buffering " comes close, refers 2 buffers in parallel swapped, while i'm copying them "forward". " simultaneous data-latching " i'm using @ moment, sounds unfamiliar... illustration store_1 store_all do_stuff | | | +-+-+ +-+-+ +-+-+ value_1 --> |reg| --- int_1 --> |reg| --> input_1 --> | m | +---+ +---+ | o |

c# - Accepting multiple similar entities in a Method - Elegant solution -

i have 2 data entities, similar, design like: public class entity1 : base { public int layerid; public list<int> groups; } difference entity1 has collection of integer groups public class entity2 : base { public int layerid; } these entities filled input ui using json, need pass them processing method, gives same output entity. method has logic handle if list<int> groups null , need create method capable of handling each of input in elegant manner. cannot use entity1 , since 2 different functional inputs different business process, using entity1 direct replacement mis-representation instead of creating overload of function, can think of following options: use object type input , typecast in function internally i think can use dynamic types, solution similar above, not clean solution in either case, along switch-case mess. what doing processing method this: public ouputentity processmethod(entity 1) { // data processing } i have created c

Creating a bunch of objects in C++ -

i have quite simple situation don't know how resolve : parsing file addresses (city, street , street number), , have following class : class address { std::string city; std::string street; std::string number; }; i create object each address find in file, can't know how many there since file can change. there way create array of objects ; or more suitable solution ? note : parser works fine, there set values in objects. you can use std::vector such purpose: http://en.cppreference.com/w/cpp/container/vector #include <vector> struct address { std::string city; std::string street; std::string number; }; bool parseaddress(address& address) { //todo: implement //todo: return "true" if address has been parsed } int main() { std::vector<address> addresses; address current; while(parseaddress(current)) { addresses.push_back(current); } return 0; }

java - Thymeleaf multiple submit button in one form -

i have fragment of html page 1 form , 2 button: <form action="#" data-th-action="@{/action/edit}" data-th-object="${model}" method="post"> <button type="submit" name="action" value="save">save</button> <button type="submit" name="action" value="cancel">cancel</button> </form> and controller: @requestmapping(value="/edit", method=requestmethod.post) public modelandview edit(@modelattribute somemodel model, @requestparam(value="action", required=true) string action) { if (action.equals("save")) { // here } if (action.equals("cancel")) { // thing } return modelandview; } this work good, if have more button, must add more if statement check action string. there way can create one action each button in form? you can create separate m

Convert XML elements to XML attributes using XSLT -

i working on project , team mate generated xml file not compatible code , want convert xml file using xslt. want convert xml <frame> <frameno>0</frameno> <objectlist> <object> <confidence>0.95</confidence> <box> <h>775</h> <w>202</w> <xc>509</xc> <yc>8.6</yc> </box> </object> <object> <confidence></confidence> <box> <h>966</h> <w>220</w> <xc>1779</xc> <yc>1080</yc> </box> </object> </objectlist> </frame> to xml file <frame number="0"> <objectlist> <object confidence = "0.95"> <box h="775" w="202" xc="509"

New Landingpage using PayPal ExpressCheckout -

Image
i using expresscheckout in several shops. since couple of weeks there problem landingpage. instead of landingpage guest payment options or price-information stupid login page shown. please take @ image made. it worked before , sandbox still old landingpage. because there no price-information many customers cancel checkout process now. you can't avoid new version of landing page, if have of parameters set in request way should see button says "pay debit or credit card" instead of "create account". here's screenshot of get. you'll notice pricing has been moved drop-down.

vb.net - List all folders that are in any 3rd subdirectory from current -

i need make array list, displaying folders in 3rd subfolder current one. folder1/sub1folder/sub2folder/sub3folder it has recursive. need array of strings contains strings above. know how recursively folders, not know how limit search 3rd subfolder. thanks! here's stab @ it. tested , works me: dim resultlist list(of string) = directorysearch(basedirectorypath, 0) function directorysearch(directorypath string, level integer) list(of string) level += 1 dim directories string() = io.directory.getdirectories(directorypath) dim resultlist new list(of string) if level = 3 each subdirectorypath in directories dim result string = getfinalresult(subdirectorypath) resultlist.add(result) next else each subdirectorypath in directories dim partialresultlist list(of string) = directorysearch(subdirectorypath, level) resultlist.addrange(partialresultlist) next end if

regex - Regular Expression in Python using re.split and pattern -

i have string this: string ='arcelormittal invests =e2=82=ac87m in new process cuts emissions=20' i want take out =e2=82=ac , =20 but when use, pattern ='(=\w\w)+' a=re.split(pattern,string) it returns ['arcelormittal invests ', '=ac', '87m in new process cuts emissions', '=20', ''] you may use re.findall >>> s = 'arcelormittal invests =e2=82=ac87m in new process cuts emissions=20' >>> re.findall(r'(?:=\w{2})+', s) ['=e2=82=ac', '=20'] >>> use re.sub if want remove chars. >>> re.sub(r'(?:=\w{2})+', '', s) 'arcelormittal invests 87m in new process cuts emissions'

java - DDD, domain entities/VO and JPA -

i'm starting ddd , can image brain boiling. my question related domain objects (entities, vo, ...) represents domain concepts/logic , how persist/retrieve them. the blue book says repository way represent collections on domain objects , responsible communicate infrastructure layer. read @ post infrastructura layer must use hibernate, jpa or whatever. then see spring-data-jpa example http://spring.io/guides/gs/accessing-data-jpa/ , become crazy. the slogan spring-data-jpa create repositories , previous samples seems merge jpa annotations domain object (the customer ). is sample right? or right? if i'm right , domain , infrastructure must separated, means store customer must have: a customer class in domain layer (that represents customer , has logic operations) a customerrepository un domain layer (that retrieves or stores customers infrastructure layer) a customer class in infrastructure layer, annotated @entity some customerreposityjpa know how store