Posts

Showing posts from September, 2013

ios - Presenting a view controller without changing the status bar color, like UIAlertController -

Image
when performing network operations, present modal view controller (similar mbprogresshud view controller) prevent user interaction , indicate progress. the view controller has modalpresentationstyle = .custom , animated using transitioning delegate , custom presentation controller. beyond animating transitions have no custom actions driving presentation. the problem have whenever view controller presented, turns status bar color black. override preferredstatusbarstyle make return .lightcontent view controller presented on view controller .default , don't want change there either. basically, want have same behavior uialertcontroller . i have tried configuring presentation controller move presented view controller out of status bar space: private class seuiprogresscontrollerpresentationcontroller: uipresentationcontroller { override func shouldpresentinfullscreen() -> bool { return false } private override func frameofpresentedviewinco

php - Setting Wordpress Primary Menu Programatically -

i have 2 menus created via end. need activate menu based on geo location, have aleady setup set default currency. menu names in backend main , main international. below code: function geo_client_currency($client_currency){ $userinfo = geoip_detect2_get_info_from_current_ip(); if ($userinfo->country->isocode == 'us'){ $client_currency = 'usd'; //currency code } else { $client_currency = 'inr'; } return $client_currency; } so need set main menu , main international anywhere outside us. have reviewed codex not quite sure how implement easiest way possible could easy in template file (like header.php )? <?php $userinfo = geoip_detect2_get_info_from_current_ip(); if ( $userinfo->country->isocode == 'us' ){ wp_nav_menu(array('menu_id' => 1)); //change 1 main id } else { wp_nav_menu(array('menu_id' => 2)); //change 2 main international id } ?>

sorting - Google Charts is changing my data order -

i trying create simple google charts column chart using date string x-axis. when pass in ordered hash (or array) reason google charts re-orders data based on own interpretation of how sort. example: [["dec 27", 206.17], ["28", 411.09], ["29", 411.09], ["30", 411.09], ["31", 411.09], ["jan 1", 411.09], [" 2", 411.09], [" 3", 411.09], [" 4", 411.09], [" 5", 411.09], [" 6", 411.09], [" 7", 411.09]] given data, google chart displays: x-axis example displayed google charts has else run , solved this? there way tell google charts accept data order without re-sorting? maybe share code, here column chart keeps sort same defined in array. google.load('visualization', '1.1', {'packages':['corechart']}); google.setonloadcallback(drawchart); function drawchart() { var data = google.visualization.arraytodata

javascript - passthru real request with pretender.js -

i trying pass through real webservice in acceptance test in project. pretender intercepts xhr request i'm trying tell pass through example.com according docs should able this. var server = new pretender(function(){ this.get('https://www.example.com/:catchall', this.passthrough); }); or this var server = new pretender(); server.get('https://www.example.com', server.passthrough); but in console. uncaught typeerror: pretender intercepted https://www.example.com/foo/bar encountered error: handler.handler not function(…) because handler.handler server.passthrough , server.passthrough object? > server.passthrough  object {numberofcalls: 1, async: undefined} the test passes in isolation fails when run full suite on console npm test. passes in browser. think have either race condition.

php - Why can't I connect to my psql db? -

so trying link page a.php psql db. here's dbconnection.class.php: <?php class dbconnection { var $conn function dbconnection(); { $this->conn = pg_connect("host='localhost' port='5432' dbname='tester' user='postgres' password='password'") or die("unable connect"); } } ?> and here's a.php <?php include ("dbconnection.class.php"); $dbconnection = new dbconnection(); ?> it keeps telling me have error on line 7 of dbconnection: fatal error: non-abstract method dbconnection::dbconnection() must contain body in c:\wamp\www\dbconnection.class.php on line 7 i'm not entirely sure far fixing problem open php.ini find ;extension=php_pgsql.dll , remove initial semi colon find ;extension=php_pdo_pgsql.dll , remove initial semi colon save file restart apache remove ; from end of function name class dbconnection { var $conn functio

python - variance vs coefficient of variation -

i need identify statistic let me find on digital image line has highest variation. using variance (square units, calculated numpy.var(x)) , coefficient of variation (unitless, calculated numpy.sd(x)/numpy.mean(x)), got different values, here: v1 = line(var(x)) v2 = line(cv(x)) print(v1,v2) (12,17) should not both find same line? 1 better use in case? coefficient of variation , variance not supposed choose same array on random data. coefficient of variation sensitive both variance , scale of data, whereas variance geared towards variation in data. please see example: import numpy np x = np.random.randn(10) x1= x+10 np.var(x), np.std(x)/np.mean(x) (2.0571740850649021, -2.2697110381499224) np.var(x1), np.std(x1)/np.mean(x1) (2.0571740850649016, 0.1531035017615747) which 1 choose depends on application, i'm leaning towards variance in case.

json - Returning specific date format with Jackson -

i trying return date on json object specific format: format: "lastmodified": "2015-08-04t13:09:15.000-07:00", i have custom objectmapper this: result.setdateformat(new iso8601dateformat()); but result: "lastmodified": "2015-08-04t20:09:15z" any ideas how change it? using: <dependency> <groupid>org.glassfish.jersey.media</groupid> <artifactid>jersey-media-json-jackson</artifactid> <version>2.22.1</version> <scope>runtime</scope> </dependency> and before used older version of: org.codehaus.jackson update: after adding line: result.configure(com.fasterxml.jackson.databind.serializationfeature. write_dates_as_timestamps , false); and removed: result.setdateformat(new iso8601dateformat()); i got result: "lastmodified": "2015-08-04t20:09:15.000+0000", still not want. this right format: result.setdateformat(new simp

asp.net - page redirect form classic asp to aspx -

i trying redirect existing classic asp page .aspx page. in application have sfcrecinspedt.asp classic asp page. changed in asp.net keeping name same have sfcrecinspedt.aspx , sfcrecinspedt.aspx.cs. how change code if user click on new intend of directed classic asp page should goes sfcrecinspedt.aspx page? please find below code redirecting classic asp page. <td width=60%> &nbsp; <td colspan=10 align="right"> <%lparam="ladd=add &lfromdate=" & lfromdate & "&ltodate=" & ltodate & "&lplantid=" & lplantid%> <a href="javascript:gotonewwindow('sfcrecinspedt.asp?<%=lparam%>',<%=clng(session("width"))%>,<%=clng(session("height"))%>);"> <img src="/images/newe.gif" border="0" alt="new" v

c++ - Unrecognizable template declaration/definition -

i'm trying implement heap, i've got above error on 1 of functions. here's header file: template <typename e> class heap { private: class node { e data; node * left; node * right; }; node root; int length; e * preorder(e * list, int length, node node); e * inorder(e * list, int length, node node); e * postorder(e * list, int length, node node); void clear(node node); //recursively clears nodes , frees pointers public: heap(); heap(e * list, int length); ~heap(); node * getroot(); void buildheap(e * list, int length); e * returnlist(); }; and specific function in question (although there's similar errors on others). there error on second line template <typename e> node<e> * heap<e>::getroot() { return &root; } the compiler complaining node<e> ; there no template named node in global scope. code has it's member template: temp

couchdb - What happens if I do not specify a Stale paramter on my view? -

i have couchdb view. add document. query view (whose map fn includes document added). i know specs if query view stale=ok result not include new document. know if query view stale=update_after result not include document - if call view second time (after delay allows enough processing time view) result document. but, documentation not clear on happens when not specify stale paramter. will: a) stale view without document? b) view update , result including document occur? if answer b) , there x (where x large number) documents pending, view still update before returning results or time out? or switch it's behaviour stale=update_after or stale=ok? thank time. by not specifying stale , getting default behavior update view before sending result. (ie: stale results not default, hence additional option)

ruby - Whats wrong with this if statement? Rails -

i building reputation system users points if milestones (10, 100, 1000, ...) archieved. have if statement line: if (before_points < ((10 || 100 || 1000 || 10000 || 100000 || 1000000))) && (after_points >= ((10 || 100 || 1000 || 10000 || 100000 || 1000000))) it should return true if points either less 10 or 100 or 1000 ...before, , if points more or equal either 10 or 100 or 1000 ... afterwards. it works if below 10 before, , more 10 afterwards, , not quite sure if works 100, doesnt work if points below 1000 before , more 1000 afterwards. is correct way this? better switch/case? a more compact way it... [10, 100, 1000, 10000, 100000, 1000000].any?{|n| before_points < n && after_points >= n} that expression return true if boundary crossed, or false otherwise

pm2 Startup not starting up on Ubuntu -

i having difficulty getting pm2 restart (itself , 2 node/express files, app.js & app2.js ) on server re-boot. below processes have tried: pm2 startup pm2 start app.js pm2 start app2.js pm2 startup ubuntu (also tried systemd , with/without -u username) pm2 save i ran above commands in every possible combination , nothing worked. tried running root , did not work either. my ~/.pm2/dump.pm2 file contains information not sure else look. i have attempted modify /etc/init.d/pm2-init.sh file according this issue did not help. my setup: digital ocean server ubuntu 15.10 node v5.4.1 pm2 v 1.0.0 other references tried.. http://pm2.keymetrics.io/docs/usage/startup/ https://www.digitalocean.com/community/tutorials/how-to-use-pm2-to-setup-a-node-js-production-environment-on-an-ubuntu-vps https://gist.github.com/leommoore/5998406 https://www.terlici.com/2015/06/20/running-node-forever.html https://serversforhackers.com/node-process-management-with-pm2 http://noder

html - Update <p> when selection is submitted jquery -

i trying figure out how change p#switch-on-id when user selects option clicks submit. the jquery switches p#switch-on-id when user clicks option if selects option switches without pressing submit. need switch when user clicks submit. thanks help! <p id="switch-on-submit">hello</p> <select multiple="no"> <option selected="selected">one</option> <option>two</option> <option>three</option> <option>four</option> </select> <button id="submit"> add </button> $(document).ready(function(){ $(document).on('click', '#submit', function(){ $("select").change(function(){ $("select option:selected").each(function(){ str = $(this).text(); }); $("p#switch-on-submit").text(str); }).change(); }); }); here js

Is there a tool that allows me to use a single dataset to mock and test a REST API? -

i working on testing project independent teams providing , consuming rest api. api consumer teams need mocking tool simulate api responses testing can isolate api provider. api provider team needs testing tool execute integration tests against rest service. is there tool both single dataset? limited set of requests, tool should able return known response. because has dataset of request/response pairs should able execute requests against real service , match/diff response well. i familiar tools 1 or other, i'd maintain single dataset ensure integration tests , mock synchronized. have experience such tool? looks ecosystem around api blueprint you. api blueprint work call "dataset". it's http api description language, allows write down requests , responses in form of text file. it's machine-readable, works contract. apiary consumes api blueprint file , creates rendered api documentation , mock server - returns described sample responses if obt

php - NOOB: Parse API data and output one item -

apologies how simple question is. i have link citymapper api: https://developer.citymapper.com/api/1/traveltime/?startcoord=51.513895%2c+0.021222&endcoord=51.524006%2c+-0.115490&key=8b3e89fd32441463296274661805caba when point browser there gives me: {"travel_time_minutes": 51, "diagnostic": {"milliseconds": 3036}} i trying pull out 1 item it; "51". i want display on html webpage say: "51 minutes work" i know simple, can't work out of documentation on how deal this. you can use jquery $.ajax function this. var url = 'https://developer.citymapper.com/api/1/traveltime/?startcoord=51.513895%2c+0.021222&endcoord=51.524006%2c+-0.115490&key=8b3e89fd32441463296274661805caba'; $.ajax({ method: 'get', url: url, datatype: 'jsonp', crossdomain: true, success: function(data){ $('.data').html(data.travel_time_minutes + ' minutes w

real time audio processing tool in C++ -

i trying record , calculate spectrum in real time. wonder library should use purpose. need integrate original c++ code , combine image feature. looked opensmile , seems not suit purpose. any suggestions appreciated!! here pretty comparison , evaluation of various audio feature extraction toolboxes. main conclusion based on paper mention in link below: 1) essentia: full function workflow environment high , low-level features, facilitating audio input, preprocessing , statistical analysis of output. written in c++, python binding , export data in yaml or json format. 2) marsyas: full real-time audio processing standalone framework data flow audio processing gui , cli. program includes low-level feature extraction tool built in c++, ability perform machine learning , synthesis within framework.the feature extraction aspects have been translated vamp plugin format 3) yaafe low level feature extraction library designed computational efficiency , batch processing ut

getting value from same class with AJAX/jQuery -

how can value same class? value 1 class (the first) look code: $(document).ready(function() { $('.getdata').click(function() { var name = $('.name').val(); var userid = $('.userid').val(); console.log(name); console.log(userid); var datastring = 'userid=' + name + '&name=' + name; $.ajax({ type: "post", url: "ajax.php", data: datastring, datatype: "json", success: function(data) { } }); return false; }); }); this in loop <form action='' method='post'> <input type='hidden' class='name' value='".$row["name"]."' /> <input type='hidden' class='userid' value='".$row["userid"]."' /> <button type=

java - JSON issue in Android project -

i messing around code tutorial: http://mobisys.in/blog/2012/01/parsing-json-from-url-in-android/ i downloaded source code , got set in project. launched app , pressed "get json" button , worked. the url being used in tutorial http://mobisys.in/quicknotify/get_departments.php?company_id=1 . the json comes page looks this: [{"dept":"mobile","dept_id":"1"},{"dept":"web","dept_id":"2"}] i wanted use own url changed 1 gave own. changed selectors match new link. the new url http://football.myfantasyleague.com/2007/export?type=topadds&w=12&json=1 , returns in browser: {"version":"1.0","topadds":{"week":"12","player":[{"percent":"41.65","id":"8827"},{"percent":"36.89","id":"8752"},{"percent":"25.60","id":"0

Virtual Contacts in Android -

short question regarding virtual contacts in android. is possible have android service application (background process) able provide contacts on fly contacts application. also, able provide these virtual contacts within search results. my idea extend contacts application providing dynamic contacts web during contact search. is possible. the people app on "pure google" versions of android (for example, nexus 4) doesn't support this. contacts have somewhere in contacts provider. of course, can have own account type , sync contacts somewhere on web contacts provider, , contacts treated same contacts added google contacts web app. your proposed app might less useful think. happens when device doesn't have connectivity? if sync contacts device, they're available. "cloud" great, of course; have ask if cloud-only going useful.

Wordpress homepage banner not appearing -

my homepage banner image not appearing. have done troubleshooting: 1. noticed on back-end in visual composer revolution slider block had been deleted. have re-added it, still not working 2. have checked revolution slider plugin appears ok 3. have updated plugins 4. noticed on homepage 'blog' post thumbnails aren't showing either. heading there 3 latest blog posts missing. maybe visual composer? can suggest other troubleshooting tips? website is: www.skinmade.com.au

c++ - How to pass QDataStream as parameter to signal in Qt5 -

i writing method parse network packet in form of qbytearray . extract few values using qdatastream , pass qdatastream along method further processing (to avoid overhead of making qdatastream later). here code: //datagram qbytearray qdatastream ds=new qdatastream(&datagram, qiodevice::readonly); qint64 somevalue = 0; *ds >> somevalue; emit receivepacket(ds,host, port); since using signals, passing reference not encouraged , since qdatastream q_disable_copy option left pass pointer. if decide pass pointer, how can manage memory? (deleting once) later?

android - generate a mp4 file from list of images by using jcodec library -

i using jcodec library convert list of bitmap images mp4 file. works fine generated mp4 file plays first image correctly , rest of images don't rendered properly. here encoder code private class encoder extends asynctask<file, integer, integer> { private static final string tag = "encoder"; protected integer doinbackground(file... params) { sequenceencoder se = null; bitmap[] arrayofbitmap = {bmp, bmpdef}; try { se = new sequenceencoder(new file(params[0].getparentfile(), "jcodec_enc.mp4")); (int = 0; < arraybitmap.length; i++) { se.encodeimage(arraybitmap[i]); } se.finish(); } catch (ioexception e) { log.e(tag, "io", e); } return 0; } @override protected void onprogressupdate(integer... values) { progress.settext(strin

node.js - how to get logger name inside winston custom transport function? -

i have 2 loggers: var category1 = winston.loggers.get('category1'); var category2 = winston.loggers.get('category2'); and need custom names (or default). customlogger.prototype.log = function (level, msg, meta, callback) { // need logger name here! (category1 or category2 or undefined / default) } how right way it? thanks as hotfix .. // fix logger name metadata var originalgetlogger = winston.container.prototype.get // winston.loggers.get(loggername); winston.container.prototype.get = function(loggername,options){ var logger = originalgetlogger.call(winston.loggers,loggername,options) logger.rewriters.push(function(level, msg, meta) { meta._l = loggername; return meta; }); return logger; } im overriding fn add rewriter, , rewriter im adding logger name metadata. // each log insert loggername meta var loggera = winston.loggers.get('loggernamea'); var loggerb = winston.loggers.get('loggernameb

sql - MySQL Select From Multiple Structurally Identical Tables -

let me preface saying yes aware beginner dba should know answer question, have never had formal training , can't find answer after quite bit of googling, please go easy on me :) i have database containing 88 identical (in structure, not data) tables total 20465 rows. looking way aggregate these can: select * [aggregate] id = 'some unique value'; the (working slow) solution came create view select * each table , union them together, apparent me when doing search not correct way this. example selecting ~200 records takes on minute. this not seem use case join tables have no relation 1 another, contain same kind of data. i feeling index looking for, unsure if should indexing view (my googling seems indicate not possible?) or if maybe not understanding indices properly. any tips in right direction appreciated! (even if it's link documentation). the commenter correct. use union all rather union . union all doesn't attempt deduplicate rows, u

How get ints in Jekyll? -

i trying make blog , want make id tags correspond each time loop runs (e.g. #section_1, #section_2,#section_(insert variable) ). is there way in jekyll? this should produce you're looking for: {% assign indices = "1|2|3" | split: "|" %} {% index in indices %} <div id="{{ index }}">this div {{ index }}</div> {% endfor %} you'll have know in advance how many sections want created, , add each id 1|2|3 bit in first line.

sql - Count number of user in a certain age's range base on date of birth -

i have table user has user_id , user_name , user_dob . i want count how many users under 18 year old, 18-50 , on 50. the age calculation method need improved calculate exact age more interested in finding method count so tried: select count ([user_id]) [user] (datediff(yy,[user_dob], getdate()) < 18) union select count ([user_id]) [user] (datediff(yy,[user_dob], getdate()) >= 18 , datediff(yy,[user_dob], getdate()) <=50) union select count ([user_id]) [user] (datediff(yy,[user_dob], getdate()) > 50) it gives me result like: (no column name) 1218 3441 1540 but need this range | count ---------------- under 18 | 1218 18-50 | 3441 on 50 | 1540 any suggestions how archive above format? convert birthdate range name, group on count: select case when age < 18 'under 18' when age > 50 'over 50' else '18-50' end range, count(*) count (select datediff(yy, user_dob, getdate()) age customer

java - Adding an ActionListener to a JButton from another class is giving a NullPointerException? -

i want able add acitonlistener jbutton class keep code neat. problem brings nullpointerexception when trying add it. i'm adding actionlistener through handler class defined 'h'. in display class: public class display { private handler h; //my handler object private jframe frame; private jbutton btncalculate; /** * launch application. */ public static void createdisplay() { eventqueue.invokelater(new runnable() { public void run() { try { display window = new display(); window.frame.setvisible(true); } catch (exception e) { e.printstacktrace(); } } }); } /** * create application. */ public display() { initialize(); } /** * initialize contents of frame. */ private void initialize() { frame = new jframe(); frame.setboun

java - Populating TableView in JavaFX From Data in SQLite -

i trying populate tableview data in sqlite database experiencing weird scenario cannot understand causing it. the tableview populates 2 columns , not populate rest. tablecolumns 'no' , 'date created' not populated when tableview displayed. this code displays data sqlite database in 'title' , 'description' tableview columns. please hawk eye me identify going wrong on code. have spent better part of day trying figure out going wrong not seem figure out not doing right. gladly appreciate on this. here code main class blockquote public class notedb extends application { @override public void start(stage stage) throws exception { parent root = fxmlloader.load(getclass().getresource("listnotesui.fxml")); scene scene = new scene(root); stage.setscene(scene); stage.show(); } public static void main(string[] args) { launch(args); } } blockquote fxml

javascript - Django: How to load a script for every page? -

say want include bootstrap or angular every single page in views, there more elegant way copying same line each file? you need django template inheritance . include in template base.html , , in there define block filled in children templates: <html> <!-- base.html --> ...... {% block content %} {% endblock %} <!-- include js/css here --> <script type="text/javascipt" src="{{ static_url }}jquery.js"> <link rel="stylesheet" type="text/css" href="mystyle.css"> </html> then templates extend base.html , override block content so: <!-- sub.html --> {% extends "base.html" %} {% block content %} <!-- current page html goes here --> {% endblock %} in way, have included in base.html automatically inherited , available in sub.html.

C++ -- candidate expects 1 argument, 0 on class definition -

i have used c++ , opengl while have never realy dwelled classes. trying create block class voxel game compiler giving me error block.h:13:7: note: candidate expects 1 argument, 0 provided line 13 line create class. here block header file: #ifndef block_h #define block_h #include <gl/glew.h> #include <glm/glm.hpp> #include <glm/gtc/matrix_transform.hpp> #include <glm/gtc/type_ptr.hpp> #include "shader.h" #include "camera.h" using namespace glm; class block{ public: void render(camera cam); glm::vec3 position; block(glm::vec3 position); private: void createmesh(); gluint vao, vbo; shader shader; }; #endif the complete error: world.cpp: in constructor ‘world::world(glfwwindow*)’: world.cpp:3:32: error: no matching function call ‘block::block()’ world::world(glfwwindow* window) ^ world.cpp:3:32: note: candidates are: in file included world.h:9:0,

Can I filter laravel collection using where method and some other Model's method? -

i have model called billboard. in model wrote method isdisplayable() . public function isdisplayable() { if (/* logic determine if billboard displayable */) return true; return false; } i want collection of billboards displayable. can utilize where method isdisplayable()? or should adopt other approach? if have collection, can use filter() method filter out results based on model method: $billboards = billboard::all(); $filtered = $billboards->filter(function ($billboard, $key) { // true keep; false remove return $billboard->isdisplayable(); }); if want use logic on query (before collection built), can create query scope on billboard model: public function scopedisplayable($query, $displayable = true) { if ($displayable) { // modify $query displayable items, e.g: $query->where('displayable', '=', 1); } else { // modify $query non-displayable items, e.g: $query

backand - How to make foreign key required? -

for model example given in documentation, noticed can create pet object without requiring owner . how specify in json owner required? i see required switch fields tab, switch doesn't move when click on it. [ { "name": "pets", "fields": { "name": { "type": "string" }, "owner": { "object": "users" } } }, { "name": "users", "fields": { "email": { "type": "string" }, "firstname": { "type": "string" } "pets": { "collection": "pets", "via": "owner" } } } ] currently in json required field not supported foreign-key can workaround it. i'm backand , plan add in soon, meanwhile can either: add server s

virtualhost - Must Apache virtual hosts be used when developing on localhost? -

my document root default /var/www/html . if create subdirectories inside html/ directory: html/ example/ dev/ test/ i seem have many sites can access in web browser: localhost/example localhost/dev localhost/test considering above, setting apache virtual hosts seems unnecessary. should use apache virtual hosts when developing on localhost? please why in answers provide. thanks in advance. i use virtual hosts development because prevents unintended cross contamination (i.e. using image etc belongs on site). but opinion. also separates work better.

linux - Daemonize 'child_process' that was 'fork'ed -

i trying achieve behavior similar 1 httpd has when starting nodejs. when say: service httpd start in ps , we'll see: [root@dev ~]# service httpd start starting httpd: [ ok ] [root@dev ~]# ps auxf | grep httpd root 3395 0.0 0.1 6336 304 pts/0 r+ 12:03 0:00 | \_ grep httpd root 3391 0.0 1.3 175216 3656 ? ss 12:02 0:00 /usr/sbin/httpd apache 3393 0.0 0.9 175216 2432 ? s 12:02 0:00 \_ /usr/sbin/httpd notice how httpd master , child have no terminal ( ? shown instead of pts/0 grep ). now... need ipc channel , therefore use child_process.fork no matter do, every time see terminal still attached daemon. here code welcome experiment on: c.js - controller var cp = require('child_process'); var d = cp.fork('d.js', {}); d.on('message', function() { d.disconnect(); d.unref(); }); d.js - daemon process.send('ready'); sett

footer is fixed on viewpager in android -

i have footer using viewpager. when swipe left or right footer swipe left or right. want footer fixed on each page on viewpager. idea make footer stay fixed when swipe pages. you have create master layout. has viewpager , footer , load fragments view pager. <?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent"> <!--header--> <textview android:id="@+id/headertextviewe" android:layout_height="50dp" android:layout_width="match_parent" android:text="header" android:textcolor="@android:color/black" android:textsize="24dip" android:typeface="sans" android:layout_gravity="center"

printing - How to print smile emoticon from right to left reverse using assembly -

how print smile emoticon right left in assembler #make_com# ; .com org 100h start: mov ah, 0 ; screen 80x25 mov al, 2 ; character 'smiley face' int 10h ; set screen (and clear screen) mov dx, 0 ; start position 0,0 (dh dan dl) mov cx, 1 ; print 1 character set_kursor: mov ah, 2 int 10h ; set cursor position mov ah, 10 int 10h ; print character inc dh ; right inc dl ; enter 1 row cmp dh, 25 jne set_kursor ; try ret ; finish end the code this ☺ ☺ ☺ ☺ ☺ ☺ ☺ what want reverse this ☺ ☺ ☺ ☺ ☺ ☺ ☺ inc dh ; right inc dl ; enter 1 row these comments wrong! dl register has column , dh register has row. to solve question, first put cursor @ position far enough right. chose column 30 , row 0. on each iteration d

string - Unexpected value when getting value from a map -

so have struct this: type magni struct { ... handlers map[string]func(*message) ... } and have function create new instance of struct: func new(nick, user, real string) *magni { return &magni{ ... handlers: make(map[string]func(*message)), ... } } but can't handlers map key "hey" when "hey" in variable, works if type myself. here method of struct magni , m pointer struct magni : handler := m.handlers[cmd[3][1:]] // cmd[3][1:] contains string "hey" handler2 := m.handlers["hey"] for reason, value of handler nil , value of handler2 0x401310 , not expecting handler nil . am doing wrong or expected behavior? getting value based on value of variable works: m := map[string]string{"hey": "found"} fmt.println(m["hey"]) // found cmd := []string{"1", "2", "3", "hey"} fmt.println(m[cmd[3]]) // found

angularjs - Angular ui router controlleras syntax not working -

i trying develop angular app using ui router, stuck trying controlleras syntax working correctly. my stateprovider looks this $stateprovider .state('microsite', { url: "/", templateurl: "microsite.tmpl.html", abstract: true }) .state('microsite.home', { url: "", templateurl: "home.tmpl.html", controller: 'micrositecontroller vm', data: { page_name: 'introduction' } }) .state('microsite.features', { url: "/features", templateurl: "features.tmpl.html", controller: 'micrositecontroller vm', data: { page_name: 'features' } }) .state('microsite.about', { url: "/about", templateurl: "about.tmpl.html", controller: 'micrositecontroller vm', data: { page_name: 'about' }

java - ListView not displaying text but displaying number (used SimpleAdapter) -

so i'm creating to-do app , i'm newbie @ java programming , android studio, hope can bear me. here's mainactivity containing simpleadapter display list. listview lv; arraylist<hashmap<string, string>> list; protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_listview_main_activity); lv=(listview)findviewbyid(r.id.listingtasks); dbconnector db=new dbconnector(this); list=new arraylist<hashmap<string,string>>(); list=db.display(); string[] from=new string[]{"_id","task"}; int[] to=new int[]{r.id.id,r.id.tasknamecustom1}; listadapter ad; ad = new simpleadapter(listview_main_activity.this,list, r.layout.custom,from,to); lv.setadapter(ad); the dbconnector class extends sqliteopenhelper class , contains methods insert , display records in sqlitedatabase. here's dbconnector class: public class db

.net - How to represent a C# property in UML? -

not quite attribute, not quite method. stereotypes? <<get>> <<set>> ? i'm retro-modelling existing system, need reflect not same readonly field or methods pair (regardless of il says), think i'll go stereotype, i'll accept language independant get_ set_ general solution. sanity test. properties convenient way of writing get_myvalue() , set_myvalue(value) allowing assignment rather normal method calling (using parenthesis). what accessing .net property, c# has own syntax accessing these. since under skin real get_ , set_ methods created, show methods (to make uml language independent - e.g. make uml equally applicable vb.net developer) ... or have suggested, introduce own stereotype!

java - Advice with super classes and inheritance -

i not know if on right track or not, have hit dead end. have read , reread books chapters super classes , inheritance , still lost. in assignment have to: write super class encapsulating circle; class has 1 attribute representing radius of circle. has methods returning perimeter , area of circle. class has subclass encapsulating cylinder. cylinder has circle base , attribute, length; has 2 methods, calculating , returning area , volumes. i wondering if 1 make sure on right track , give me advice on need finish lost. thank you first class: package question48; import java.awt.graphics; import java.awt.color; public class question48 { public static void main(string[] args) { } public abstract class figure { //varibles private int x; private int y; private color color; //constructor public figure() { x = 0; y = 0; color = color.black; } public figure(int startx, int starty, color startcolor) { x =