Posts

Showing posts from July, 2014

sprite kit - SpriteKit Swift Positioning HUD -

i'm trying position simple black box use reference hud elements game. positioning of off, y position of box. tried position hud box @ top of screen , spawn whole width, cgrectgetmaxy(screensize) positions @ bottom of screen. var hudlayer = skspritenode(color: skcolor.blackcolor(), size: cgsizemake(self.size.width, 200)) hudlayer.anchorpoint = cgpointmake(0, 1) hudlayer.position = cgpointmake(cgrectgetminx(screensize), cgrectgetmaxy(screensize)) hudlayer.zposition = 100 self.addchild(hudlayer) how did manage maxy coordinate @ bottom? i'm perplexed , have tried other methods of y-positioning (self.size.height). far, find myself having multiply cgrectgetmaxy(screensize) 3.6 top, i'd rather not. any explanation why y-coordinates incredibly off? set anchor point, should using upper-left corner position itself. issue can't make same on 4s. on 4s simulator, hud bar appears lower, despite using screensize calculate relat

php - How to echo row (datetime) with other format? -

this question has answer here: convert 1 date format in php 12 answers part of php code (mysqli) [" .$row["comment_datetime"] . "] the rest of php not put here because can create own example (query, sql connect, etc ...) the echo output: [yyyy-mm-dd hh:mm:ss] p.s: question don't duplicate because, trying echo on row-><-mysqli thanks aiken, code has been converted. use strtotime: <?php echo date('d - m - y', strtotime($row["comment_datetime"])); ?>

php - Link From Subdomain to Root Domain Laravel 4.2 -

i have 1 subdomain in app: admin.test.com , root test.com . while in admin.test.com want send email user log in test.com/login/aseqgaasd right sending link admin.test.com/login/aseqgaasd . how can use {{ url::to('login', array($code)) }} method route main domain , not sub domain? i not want use .htaccess you use named routes. example, in routes.php: route::get('login/{param}', array('as' => 'testlogin', 'uses' => 'homecontroller@login')); then, in blade template: {{ url::route('testlogin', array('param' => $code)) }} i don't know routes file looks like, need adjust fit needs. important piece 'as' => 'testlogin' since that's names route , allows referred such throughout application.

linked list - How to implement CircularLinkedList in Java without first & Last? -

a question in linkedlists book asks implement linkedlist without first , last pointers while allowing access list "current" pointer. not quite sure on right track, appreciated. here tried, insert/delete working... class link { public int idata; public link next; public link(int id) // constructor { idata = id; } public void displaylink() { system.out.print(idata + " "); } } // end class link public class circularlinkedlist { private link current; private link first; //------------------------------------------------------------- public circularlinkedlist(){ current = null; } public circularlinkedlist(link link){ current = link; } public link getcurrent(){ return current; } public link getnext(){ return current.next; } public void setcurrent(link current){ this.current = current; } public void insert(int data){ link newlink = new link(data);

javascript - Get click position on the window -

i trying position of click when user click whatever part of window. found this code in many tutorials seems not work. (function( $ ) { $( document ).ready(function() { $( window ).click(function( e ) { var offset = $(this).offset(), relativex = (e.pagex - offset.left), relativey = (e.pagey - offset.top); alert("x: " + relativex + " y: " + relativey); }); }); })( jquery ); firefox console tells me "typeerror: offset undefined" , don't understand why not work. which right way retrieve click position on window? that code close working. work correctly if replace $(this) $(e.target) . left , top offsets of click event, not window itself. (function($) { $(document).ready(function() { $(window).click(function(e) { var relativex = (e.pagex - $(e.target).offset().left), relativey = (e.pagey - $(e.target).offset(

InvalidURIError making request to Facebook Graph API with Ruby -

i'm trying response api includes fields i'm specifying in uri string keep receiving invalidurierror. i've come here last resort, having spent hours trying debug this. i've tried using uri.encode() method on well, same error. here's code: url = params[:url] uri = uri('https://graph.facebook.com/v2.3/?id=' + url + '&fields=share,og_object{id,url,engagement}&access_token=' + config['fb_access_token']) req = net::http::post.new(uri.path) req.set_form_data('fields' => 'og_object[engagement]','access_token' => config['fb_access_token']) res = net::http.new(uri.host, uri.port) res.verify_mode = openssl::ssl::verify_none res.use_ssl = true response = nil res.start |http| response = http.request(req) end response = http.request(req) output = "" output << "#{response.body} <br />" return output and error i'm receiving: uri::invalidurierror - bad uri(is

Test if variable is a specific bound function in using javascript's Function.prototype.bind() -

i trying work out how test if variable instance of specific bound function. consider following example: var func = function( arg ) { // code here } myfunc = func.bind( null, 'val' ); if( myfunc == func ) { console.log( true ); } else { console.log( false ); } unfortunately results in false. there sort of way of testing variable find out function bound to? no, there not way this. .bind() returns new function internally calls original one. there no interface on new function retrieve original one. per ecmascript specification 15.3.4.5 , returned "bound" function have internal properties [[targetfunction]] , [[boundthis]] , [[boundargs]] , properties not public. if tell higher level problem you're trying solve, might able come different type of solution. if control .bind() operation, put original function on bound function property , test property: var func = function( arg ) { // code here } myfunc = func.bind( null,

Python build one dictionary from a list of keys, and a list of lists of values -

so have list of keys: keys = ['id','name', 'date', 'size', 'actions'] and have list of lists of vales: values= [ ['1','john','23-04-2015','0','action1'], ['2','jane','23-04-2015','1','action2'] ] how can build dictionary keys matched values? the output should be: { 'id':['1','2'], 'name':['john','jane'], 'date':['23-04-2015','23-04-2015'], 'size':['0','1'], 'actions':['action1','action2'] } edit: tried use zip() , dict(), work if list of values had 1 list, i.e. values = [['1','john','23-04-2015','0','action1']] for list in values: dic = dict(zip(keys,list)) i thought initialising dic keys, building list of values on own, felt there had easier

java - setContentPane covering everything up and JButton not working properly -

Image
i making game in player attempts navigate maze, have run 2 bugs have absolutely stumped me. first problem using setcontentpane() . whenever set intended background, covers else on screen. have tried relocating every place thought be, still covered up. second question jbutton . whenever click it, changes playing speed intended, can't move afterwards. works when use method in keylistener, , have same code inside of them. have included code thought necessary, if need more, let me know. full source project can found here . package game; import javax.swing.*; import java.awt.*; import java.awt.event.*; import java.util.arraylist; import java.util.random; public class game extends jpanel implements actionlistener, keylistener { private boolean uppressed = false; private boolean downpressed = false; private boolean rightpressed = false; private boolean leftpressed = false; private int tilesize = 200; private int playersize = tilesize / 4; privat

Would change in scale factor effect sharding in MongoDB? -

the mongodb documentation says sharding should employed when 1 server/replica insufficient store data. given dataset can scaled both 100gb & 1gb , executing same queries on both datasets, can - sharding 100gb across 5 shards of 20gb each equivalent sharding 1gb across 5 shards of 200mb each. scale factor effect way sharding carried out mongo? if yes, changes observed? given dataset can scaled both 100gb & 1gb , executing same queries on both datasets, can - sharding 100gb across 5 shards of 20gb each equivalent sharding 1gb across 5 shards of 200mb each from high-level view, sharded cluster architecture similar in both of examples: 5 shards, 3 config servers, , number of mongos processes. hesitate call "equivalent" in same way moped not equivalent motorcycle, although both two-wheeled vehicles in analogy interpretation depends on viewpoint. however, it's possible start 5 shard cluster provisioned resources (ram/cpu/storage) meet ex

loopbackjs - Loopback Multitenancy Database Swap -

i'd implement multitenancy in loopback app. right now, i'm trying use middleware redefine datasources point different databases on mongodb server each request, based on domain request. code runs, doesn't seem changing datasource. instead, uses 1 defined in datasources.json. right now, doing. of models reference "my_db" , i'd have 1 database on mongo server each tenant. var datasourceobj = { my_db:{ url: process.env.mongolab_uri, connector: "mongodb", name: "my_db", database: tenant } } object.keys(datasourceobj).foreach(function(datasource) { app.datasources[datasource].adapter.settings = datasourceobj[datasource]; app.datasources[datasource].adapter.clientconfig = datasourceobj[datasource]; app.datasources[datasource].settings = datasourceobj[datasource]; app.datasources[datasource].connector.settings = datasourceobj[datasource];

php - Select from table using command prompt (not browser) in Laravel framewok -

i want select data 1 table in command prompt (not browser) using laravel framework. there know references is? please give me link, thankyou you can create artisan command. check laravel 5.0 docs: http://laravel.com/docs/5.0/commands then, can run command. example: php artisan mycommand:list laravel 4.2: http://laravel.com/docs/4.2/commands you can run artisan commands "cmd" (windows). (edit environment variables first! add php path).

java - Using another classes values from its getter method -

Image
i've spent while trying different things try homework assignment work correctly can't figure out , it's last part presume staring me in face. when enter first name , last name , press add account , confirm should add account arraylist , when press no. of accounts should show me how many accounts there in total, keeps showing 0. basicaccountlist import java.util.*; public class basicaccountlist { private arraylist < basicaccount> accounts; /** * create basicaccount. */ public basicaccountlist() { accounts = new arraylist < basicaccount>(); } /** * add account account list. * @param account accountobject added */ public void addaccount(basicaccount account) { accounts.add(account); } /** * return number of accounts held. * * @return number of accounts */ public int getnumberofaccounts() { return accounts.size(); } } basicacco

spring - SpringBootApplication Mapping With Controllers -

i new spring boot understand how spring framework works. unable understand how springbootapplication class maps/call other controller.can explain how internal mapping works? is there other guide available explanation other spring guide site? i tried few examples , liked how easy want understand complete flow instead of annotating classes. thanks in advance... a class annotated @springbootapplication isn't controller, it's configuration class kicks off component scanning in own package. controller mappings follow ordinary spring mvc rules.

c# - entity framework linq query, get top N postIDs from favorite's table based on count -

i have database keeping track of favorites looks like [id] [postid] [userid] [datefavorited] i'm attempting write entity framework query in linq 12 postids appear in database. i've looked @ documentation, i'm not putting how this. purpose "most favorited" page i feel there elegant solution, i've frustrated myself point can't think of way without feting entire table that's bad idea. in sql, be: select top 12 postid, count(*) favcount favorites group postid order favcount desc in linq, believe be: var ret = db.favorites.groupby( fav => fav.postid ).select( favgroup => new { postid = favgroup.key, count = favgroup.count() } ).orderby( row => row.count ).take( 12 ); with type of ret being ienumerable<anonymous{ postid, count }> .

How to instantiate a class that is nested inside a class from outside that .java file (Java)? -

i have 2 classes, main , spbhomehelp. here code main: public class main{ spbhomehelp homehelp; public main(){ homehelp = new spbhomehelp(); home home = new home(); } } here code spbhomehelp: public class spbhomehelp{ public spbhomehelp(){ } public class home{ public home(){ system.out.println("entered home constructor"); } } } main , spbhomehelp 2 different .java files. can declare , instantiate instance spbhomehelp. want have instance of home, class nested inside spbhomehelp, in main too. tried: home home = new home(); because home public, doesn't work. how can create instance of home in main? home instance of inner-class home type (from class spbhomehelp ). need instance of class (that is homehelp ), in order construct home instance. think you're looking like spbhomehelp.home home = homehelp.new home();

Makefile rebuilds all files even if only one changes -

i writing makefile project large number of js files in complex directory structure. when run needs perform compilation on each file , save results different directory same tree structure (right that's simulated cp ). when run make js builds should , when run make js again says there no work do. when modify 1 of files , make js re-builds entire tree instead of modified file. shell := /bin/bash builddir := build/gui/ rawjsfiles := $(shell find app -name '*.js') built_rawjsfiles := $(patsubst %, $(builddir)%,$(rawjsfiles)) $(builddir): mkdir -p $(builddir) $(rawjsfiles): $(builddir) $(built_rawjsfiles): $(rawjsfiles) mkdir -p $(@d) # compile step cp $(shell python -c "print '$@'.lstrip('${builddir}')") $(@d) .phony: js js: $(built_rawjsfiles) the line $(built_rawjsfiles): $(rawjsfiles) setting prerequisites of each file in $(built_rawjsfiles) all files in $(rawjsfiles) . to one-to-one mapping want need patt

Generate a PDF file from HTML using Parse.com cloud code -

is possible generate pdf file html using parse.com cloud code? i haven't found useful in regard, bunch of archived questions parse.com questions website never answered. the nature of project , environment forbids using 3rd party servers or saas generating pdf's, , parse.com 1 of few companies have used we're allow share our data with. the data pdf generated on user's mobile device can't requires local device installation. thanks check out wkhtmltopdf http://wkhtmltopdf.org/ you can install locally.

android - mClass name and mPackage name completely different? -

looking through runningtask, found interesting task's class name , package name differs (in base activity). 1 of application running "catchoftheday". package name is : au.com.catchoftheday.android class name is : au.com.mobileandroid.android.main_classes.mainhome.home base activity refers initial activity when application launched. checked see if class name refers other process in runningprocess, couldnt find. can please suggest me understand behaviour ?? package name : au.com.catchoftheday.android is application package name specified in manifest file class name : au.com.mobileandroid.android.main_classes.mainhome.home is java qualified path of class in app

visual studio 2012 - Asp.Net Application was not working when we deployed in IIS 8.0 -

in windows server 2012 created simple asp.net using visual studio 2012. have deployed in iis 8.0. in iis manger browse deployed simple asp.net application, working fine when sample visual studio project open. after closing visual studio project browse iis manager option, application not working. please provide solution if know it. note: page can't displayed error occur. few things need check hosting in iis. application pool framework : ensure correct framwork installed v(4.0.30319). navigate c:\windows\microsoft.net\framework\v4.0.30319 directory open command window here (ctrl + shift + rightclick) type in command prompt aspnet_regiis -i register latest framework. physical path security/permission : iis -> (select vd) -> manage application-> advanced settings -> physical path credential -> choose connect specific user -> provide systems username , password. add read/write permission iis_iusers object

java - Struts : after loging need to redirect caller page -

this question has answer here: struts 2 - redirecting correct action after authentication interceptor 2 answers i developing 1 application using strust2 , tiles. in that, there many pages user must have log in. why need this, send page link query parameter user's input require. so, send jsp page request user on mail. when user click on link first login page after success full login need redirect page sent on mail. strust.xml <!-- login --> <action name="login" class="com.drms.controller.login"> <result name="success" type="redirect">summary.action</result> <result name="error" type="tiles">maintiles</result> <result name="input" type="tiles">forward_reqtiles</result> </action

java - Android - Activity finish() results black screen -

i have alertactivity , activity . when broadcast received, both activities needs finish. below code results black screen if alertactivity on top of activity . below code in activity : private final broadcastreceiver mreceiver = new broadcastreceiver() { @override public void onreceive(context context, intent intent) { if(intent.getaction().equals("broadcast_intent")){ if(alertactvity != null) alertactivity.finish(); finish(); } } and code in alertactivity : private final broadcastreceiver mreceiver = new broadcastreceiver() { @override public void onreceive(context context, intent intent) { if(intent.getaction().equals("broadcast_intent")) finish(); } } first, activity's onstop() getting called before alertactivity 's onstop() called results in black screen, alertactivity 's finish() called before activity 's finish() . please me in regard.

javascript - how to combine, .change(function() for two different type of input and send the values to same function parameter -

i have checkbox sending value function called sendtobox() upon checked. function makes ajax call fetch data database. now want have range slider of html send value function. how do please? <script> $(".slider").change(function() { var value = $(this).val(); sendtobox(value); }); $("input[type=checkbox]").change(function() { var selectedval = $(this).val(); if($(this).is(":checked")) { var selectedtext = $(this).next().text(); sendtobox(selectedval); } else { $("th."+selectedval).remove();//controls removing boxa } }); </script> how alter above sends sendtobox(value1,value2); by passing together, i'm trying achieve this: the below function must accept 2 variables passed getsubjects.php . in php i'm retrieving value this: $r= $_get['r']; display in textbox. function sendtobox(param,param2) {

flatui - How to use android flat ui eluleci? -

does know how use flat ui android ? github-link there no proper docs plus no tutorials , want create flat buttons apply themes cant find . this sample project same library: flat ui sample project

javascript - Error Response when Redirecting from IdentityServer3 using AngulrJs and Angular Ui Router -

Image
i'm creating test app working identityserver 3 , i'm using angularjs, angular ui router , oauth-ng library creating this. app needs work openid connect authorization code flow in client side. have made quite small changes oauth-ng library. my test app connects identityserver3 , gets authentication code , state. when server redirects redirect url getting 404 error.the following message but url has authorization code , state included in it. here of code wrote. login.html - view login <oauth site="https://localhost:44333/core" client-id="codeclient" response-type="code" // <= added attribute redirect-uri="http://localhost:4443/redirect" scope="openid profile email"> </oauth> the redirect url in identityserver configured. following url returned identityserver3 https://localhost:4443/redirect?code=5d5170f227fd2b90a8d87bdae0588baa&session_state=twvyj9ondpyzan1gmdtsgmdxymk2afx

spring - java.lang.ClassNotFoundException: org.springframework.web.servlet.DispatcherServlet -

i using spring 3.1.0.release , , servlet container tomcat 7 , ide eclipse indigo , jar spring-webmvc-3.1.0.release.jar contains dispatcherservlet exists in lib folder, , yet when running application, getting exception: java.lang.classnotfoundexception: org.springframework.web.servlet.dispatcherservlet @ org.apache.catalina.loader.webappclassloader.loadclass(webappclassloader.java:1678) @ org.apache.catalina.loader.webappclassloader.loadclass(webappclassloader.java:1523) @ org.apache.catalina.core.defaultinstancemanager.loadclass(defaultinstancemanager.java:525) @ org.apache.catalina.core.defaultinstancemanager.loadclassmaybeprivileged(defaultinstancemanager.java:507) @ org.apache.catalina.core.defaultinstancemanager.newinstance(defaultinstancemanager.java:126) @ org.apache.catalina.core.standardwrapper.loadservlet(standardwrapper.java:1099) @ org.apache.catalina.core.standardwrapper.load(standardwrapper.java:1043) @ org.apache.catalina.core.sta

javascript - Generate option select on input change -

<select id="gameid"> //<option number 1-999> </select> <select id="netid"> //<option number 1-999> </select> <select id="camp_id"> <script> var = $("#gameid").val(); var b = $("#netid").val(); var c = a+b; (var = 1; i<=999; i++) { document.write("<option value='"+c+i+"'>"+c+i+"</option>"); } </script> </select> the code above generate options selection. what want there is, if val in #gameid changed, option list change too, , #netid. however, option doesn't change. stay in default value of #gameid , #netid. i don't know missing here. need help, please. [update] this code work. however, when second change on #cameid after have been select, doesn't change #campid selection anymore. change again if change on #netid. $("#gameid" && "#netid&

waveform - Can I measure distances with sound in an android app? -

i've got number of questions time, although relate same problem: wanted build rudimentary sonar in android, , have no clue how possible such thing. is can work reasonably well? what's best way (that makes sense in mobile app) compare waveforms? can reliably measure delay between sending , receiving given waveform in small-ish enclosure(say, room)? is there way (that makes sense in mobile app) discard noise created by, instance, uneven surfaces (say, open doors)? just trying oriented here, i'm really new sound processing in mobile apps. in advance!

ios - Add a discoverable BLE GATT service & characterstics -

working on corebluetooth application able discover services 8880 , characteristics 8881 & 8882.after discovering getting aa command peripheral device , in response sending 42 command peripheral.up here fine .in next phase particular device info sending 70 peripheral receive 71 out put here problem once send 70 peripheral receiving , sending 71 cannot see sended value in console.and have placed quoestion manufacturer team have have sended following details add add discoverable ble gatt service uuid (little endian) is: 0x44, 0x98, 0xff, 0xd5, 0x02, 0x4f, 0x39, 0x8e, 0xfb, 0x49, 0x6a, 0xc4, 0x4a, 0x51, 0x3c, 0xe2 add discoverable ble gatt characteristic (writable, indictable , notifiable) inside service: 0x83, 0x46, 0xf6, 0xeb, 0x31, 0xc1, 0x85, 0x84, 0x93, 0x44, 0x57, 0x03, 0xfc, 0xb8, 0x23, 0x07 after receiving aa 03, send 0x42. ios app should able setup logical connection receiving data watch. as per understanding have coded service , characteristics nil .my app can dis

swing - Java Paint Application -

i've been working on java paint application practice; however, part i'm stuck @ right how change color of pen without changing color of have drawn? i've been advised create arraylist , incorporate paintcomponent i'm confused , unsure of do. can me? didn't include tester class has buttons created already, code far. package drawing; import java.awt.*; import java.awt.event.*; import java.util.*; import javax.swing.*; public class drawing extends jpanel { private final arraylist<point> points = new arraylist<>(); private boolean drawinginprogress; private color shapecolor = color.black; public void setshapecolor(color color) { this.shapecolor = color; } public drawing(){ setbackground(color.white); drawinginprogress = false; addmouselistener( new mouseadapter(){ @override public void mouseclicked(mouseevent ev) { if(!drawinginprogress) { drawinginprogress = true; } else { drawinginprogre

Javascript : Identify whether it is a desktop Linux or Android -

unable identify whether linux desktop machine or android device using navigator.useragent or navigator.platform android device's have string linux in both. details follows device os navigator.platform -------------------------------------------------------------------- samsung galaxy s3 android 4.3 linux armv7l htc 1 android 4.4.2 linux armv7l sony xperia z android 4.2.2 linux armv7l motorola moto g android 4.4.2 linux armv7l samsung galaxy tab 3 android 4.2.2 linux i686 nexus 10 android 4.4.2 linux armv7l lenovo yoga android 4.2.2 linux armv7l navigator.useragent mozilla/5.0 (linux; u; android 2.2; en-us; sch-i800 build/froyo) applewebkit/533.1 (khtml, gecko) version/4.0 mobile safari/533.1 even tried touch events, linux desktop can have touch or can emulate touch. plea

coding style - Clean Code: Is defining an abstract class without any abstract methods a Java Practice? -

currently, have code create base class methods children classes. haven't declared abstract classes. java practice? it depends on requirement. if intend write base class getting extended can declare abstract. abstract class provides default behaviour otherwise can write interface if need declare methods.

How I specify the Fiware-Service and Fiware-ServicePath fields at Orion that set the name of MySQL database and table in Cygnus? -

so far have configured contextbroker send data cygnus in turn saves data default names in database. but if want target specific database specific table? i know have set: dbname=<fiware-service> tablename=<fiware-servicepath>_<entityid>_<entitytype> i dont know file is, , know isnt in /etc/sysconfig/contextbroker because folder doesnt exist. edit1: here updatecontext: (curl localhost:1026/ngsi10/updatecontext -s -s --header 'content-type: application/json' --header 'accept: application/json' --header 'fiware-service: fiwaredatabase' --header 'fiware-servicepath: /allsensors' -d @- ) <<eof { "contextelements": [ { "type": "television", "ispattern": "false", "id": "tv2", "attributes": [ { "name": "channel", &q

css - How to fix browser-issues in scss "automatically"? -

on developing frontend-stuff in scss , html5 have routines rely on display:inline-block, rgba, css-gradients , on. now dependent on project have, browser demands change. need deliver workable ie7 , ie10 alright too. of course can (and do) real browser checks check issues, thought having routine upfrontal check wouldn't hurt. run search within scss-files check pattern "rgba" , replace appropriate. doesn't sound neither reliable nor modern me. isn't there way generate special set of pattern-fixes each browser > run > highlight me (or better fix it) would grunt/gulp topic need investigate therefore further? thanks as deolectrix said compass , there bourbon , , less . using grunt/gulp highly recommended. many reasons concating/minifying code, or if write js can use babel write es6 javascript. for cross-browser css autoprefixer out. errors/warnings troublesome css csslint . hope helps! it's starting point, enjoy diving in.

sql server 2008 - rollback did not happen with save transaction -

i have 3 questions. first can tell me why rollback of save transaction did not happen. had entered error 1/0 after delete #t2 in second block of try..catch statement. second if example procedure t1 calls procedure t2 , there error in t2 procedure outer transaction rolled in case use xact_abort off.can commit transaction. my third question possible commit save transaction , not entire transaction. if exists(select * tempdb.information_schema.tables table_name '%#t1%') begin drop table #t1 drop table #t2 drop table #t3 drop table #t4 drop table #t5 end create table #t1(c int); create table #t2(c int); create table #t3(c int); create table #t4(c int); create table #t5(c int); insert #t1 select 1; insert #t2 select 1; insert #t3 select 1; insert #t4 select 1; insert #t5 select 1; begin transaction begin try delete #t1 --step 1 end try begin catch rollback transaction end catch if @@error = 0 begin save transaction t1 end begin try delet

php - How to apply styles in PHPExcel -

i working phpexcel & want give same style cells. have tried below code, applies style a1. $objphpexcel->getactivesheet()->getstyle('a1','b2','b3','c4')->getalignment()->setindent(1); you can't provide list of cells 'a1','b2','b3','c4' because getstyle() accepts single argument; argument can either single cell (e.g. 'a1' ) or range of cells 'a1:c4' so $objphpexcel->getactivesheet() ->getstyle('a1:c4') ->getalignment()->setindent(1); is acceptable, , recommended because it's lot more efficient setting styles range individual cells

localization - iOS App supporting only Spanish -

Image
what trying develop ios app supporting spanish. what did project.xcodeproj file removed english & aded spanish in info.plist file though option "es" not there, added "es" "localization native development region" what see story board localisation string file got created when run project on simulator, see default words display in spanish button text, view title display in english ** query: i not need other language support english spanish, on right track? as developing first time, going through https://developer.apple.com/internationalization/ main.string file need describe spanish words english words define in storyboard or controller me button, view title etc. please note: know there several question, docs & on topic sue confusions, want make sure on right track before moving further due time constraint. thank you ** your steps translate application spanish language correct. in main.strings can translate labels

python - Reading a compressed/deflated (csv) file line by line -

this question has answer here: python: read lines compressed text files 3 answers i'm using following generator iterate through given csv file row row in memory efficient way: def csvreader(file): open(file, 'rb') csvfile: reader = csv.reader(csvfile, delimiter=',',quotechar='"') row in reader: yield row` this works , able handle large files incredibly well. csv file of several gigabytes seems no problem @ small virtual machine instance limited ram. however, when files grow large, disk space becomes problem. csv files seem high compression rates, allows me store files @ fraction of uncompressed size, before can use above code handle file, have decompress/inflate file , run through script. my question: there way build efficient generator above (given file, yield csv rows array), inflating parts o

ios - Background image of opaque navigation bar is rendered incorrectly on iPhone 6 -

Image
when set background image method setbackgroundimage:forbarmetrics: it's rendered on iphone 6 if set navigation bar translucent , it's stretched normally. @implementation ohcnavigationbar - (id)initwithcoder:(nscoder *)adecoder { if(self = [super initwithcoder:adecoder]) { [self setupgradient]; } return self; } - (instancetype)initwithframe:(cgrect)frame { if(self = [super initwithframe:frame]) { [self setupgradient]; } return self; } - (void)setupgradient { uiimage *gradientimage = [uiimage imagenamed:@"navigationbarbackground.png"]; [self setbackgroundimage:gradientimage forbarmetrics:uibarmetricsdefault]; } @end you can set uinavigationbar background image non repeat mode setting edge 0. uiimage *gradientimage32 = [[uiimage imagenamed:@"bkg_top_header_default.png"] resizableimagewithcapinsets:uiedgeinsetsmake(0, 0, 0, 0)]; [[uinavigationbar appearance] setbackgroundimage:gradi

Unable to find the InitialContextFactory com.ibm.websphere.naming.WsnInitialContextFactory -

i try convert application using websphere 8.5 full profile liberty profile, got issue regarding incompatibility. unable find initialcontextfactory com.ibm.websphere.naming.wsninitialcontextfactory i know class location com.ibm.ws.ejb.thinclient_8.0.0.jar in full profile verison, not relevant 1 in liberty profile, , 1 more thing, because doing maintenance application, class @ com.ibm.websphere.naming.wsninitialcontextfactory it complied in jar file, unable change it, i totally stuck on this. idea on issue appreciated. liberty not using wsninitialcontextfactory, need refactor classes using parameter less constructor of initialcontext this: initialcontext ctx = new initialcontext(); where in application need wsninitialcontextfactory ?

c - send SMS for 1 time with arduino GPRS SIM900 if an iput is HIGH -

i faced problem send 1 sms if input high,and if low==> no sms send,if low high==> send 1 sms. code not working,just sent sms when turn gprs on,and after nothing happened. mclopez helped me,thank you,but not working :( , new code wrote delay()s,but same problem. thank helping in advance. #include <softwareserial.h> #include "timerone.h" const int di = 2; const int dt = 3; const int dgp1 = 4; const int dgp2 = 5; const long interval = 100000; // in microseconds int value1 = 0; int value2 = 0; int value3 = 0; int value4 = 0; int value1_old = 0; int value2_old = 0; int value3_old = 0; int value4_old = 0; boolean changed1 = false; boolean changed2 = false; boolean changed3 = false; boolean changed4 = false; softwareserial sim900 (7, 8); void sim900power(){ digitalwrite(9, high); delay(1000); digitalwrite(9, low); delay(5000); } void initia(){ sim900.print("at+

setuptools - Python "setup.py develop" why is my data package not available? -

i have problem can't access data package after setup.py develop. here setup: setup.py from setuptools import setup, find_packages posixpath import join, relpath, normpath import os setup( name = 'poc_datapath', version = '1.0', package_dir = { '' : 'target/python', 'resources' : 'target/res'}, packages = find_packages(where='target/python') + ['resources'], package_data = { 'resources' : [normpath(join(relpath(root.replace('\\','/'), 'target/res'),fn)) root, _, fnames in os.walk('target/res') fn in fnames if not fn.endswith(".py")] }, ) which generates sources.txt me, that: setup.py target/res/__init__.py target/res/resources1/resource.data target/res/resources2/resource.data target/python/poc_datapath.egg-info/sources.txt target/

Kinect / Primesense (Xtion) ROS Ubuntu through Virtual Machine (VMware) -

since took me quite time figure out how xtion (primesense) work on vmware thought share here you. (with kinect have problem let ros see device though vmware has connected it). roslaunch openni2_launch openni2.launch running above command gave me error: warning: usb events thread - failed set priority. might cause loss of data... i either got single frame or no frame when running "rviz" , add --> image --> image topic --> /camera/rgb/image_raw so how video frames in ubuntu primesense device while using virtual machine (vmware)? my specs windows 7 running vmware 10.0.4 build-2249910 ubuntu 12.04.5 precise in vmware ros hydro the following question pointed me in right direction: http://answers.ros.org/question/77651/asus-xtion-on-usb-30-ros-hydro-ubuntu-1210/?answer=143206#post-id-143206 in answer of blizzardroi (not selected answer) he/she mentions usbinterface should 0. reasoned since main machine windows, should set usbinterface 1,

java - How to hide the entire design of Xpages like Replace design with option (Hide formulas and LotusScripts)? -

i tested on hiding entire design of notes , xpages application replace design (hidden formula , script option). result, xpages processes don't work. if tool, please suggest in details. i did suggested in above blog post (wissel,net). encountered same last comment of (stefan zehnder). tested opening xpage in custom controls referred jar file (custom controls class in xsp package). result, cannot see them in xpage. maybe “composite-file” property in xsp-config file (in web-inf) points wrong file or class. if have idea, please kindly help. if understand question correctly, suggest looking @ responses similar question here also, following blog post stephan wissel might give ideas?

javascript - Set order of table using column in jquery -

Image
i have table : and below html of above table.i trying order table sox_color , size .like color alphabet a size 1 come first , one.should use jquery sorting plugin or custom code can me. <table class="configurable-product-table" cellspacing="0"> <tbody> <tr> <th>size</th> <th>sox_colour</th> <th>availability</th> <th>&nbsp;</th> </tr> <tr> <td>2-8 <input type="hidden" name="super_attribute_quickshop[758][140]" value="17"> </td> <td>red <input type="hidden" name="super_attribute_quickshop[758][139]" value="10"> </td> <td> <p class="availability in-stock"> <span class="f

jquery - how to link to a same page anchor in javascript -

i wanting link album covers in coverflow mighty slider anchors within same page. @ top , there various audio players corresponding each cover, each own anchor, below within page. how use link url property go anchor. anchor album danceawaythenight dan. have tried link either side of list item makes album cover disappear. the code working slider shown below. each album cover has link 1 below (at moment in pointing default link came plug-in slider) <li class=”slide” data-mightyslider=” cover:’images/albumcovers/danceawaythenight.jpg’, link: { url: ‘https://itunes.apple.com/us/album/enrique-iglesias-greatest/id295364999?uo=4’, target: ‘_blank’ } ”> you need set link-url according anchors. , link-target "_self" or "_top". <li class=”slide” data-mightyslider=” cover:’images/albumcovers/danceawaythenight.jpg’, link: { url: ‘#your-anchor-name’, target: ‘_self’ } ”>