Posts

Showing posts from September, 2010

ubuntu - Shift key doesn't work in my emacs -

i run emacs in gnome-terminal -nw option, works except key shortcuts include shift key. example, when execute c-m-s-v (scroll-other-window-down), c-m-v keys recognised emacs in turn scrolls other window up. i tried these key shortcuts in gui emacs, works properly. i guess there must wrong gnome-terminal or other terminal emulators, such iterm on mac os encountered same problem. how enable shortcuts include shift key in gnome-terminal? the vt100 , terminals derived not recognize concept of shifted control key.

html - Width: x% changing depending on content size -

i need change % width on category images within site whenever screen gets smaller. or images super small on smaller resolution. what want achieve this: http://www.twitch.tv/directory i've tried using code. (but isnt working) .category-list-item { float: left; @media screen , (max-width: 769px) {width: 20%;}; @media screen , (min-width: 480px) {width: 25%;}; @media screen , (max-width: 480px) {width: 33.33%;}; padding: 1em; would super greatful help! / martin as rekire says, messed syntax, , need set full rules. also, there shouldn't semicolons after rules. , lastly, 2 final rules cover posibilities, width being greater or smaller 480px, first rule never apply. i have changed have style lower res, higher res, , default applied in between .category-list-item { background-color:red; } @media screen , (min-width: 769px) { .category-list-item { background-color: green; } } @media screen , (max-width: 480px) { .category-list-item { ba

listview - Register and delete ITEM access database - Delphi -

i sending database, items of listview, after sending have delete item sent. signing performed normally, problem time delete items. generates following error: access violation @ address 0073f82e in module "project1.exe". read of address 00000008 what have not generate error. because occurs when try delete files (registration in database occur until item generates error). if lstbxdados.items.count <= 0 begin exit; end; //try adoconnection1.connected := true; try adocommand1 begin commandtext := 'insert ip (ti_ip, url_ip, ima_ip, desc_ip,id_ip, data_ip, cat_ip,cad_ip) values ( :a, :b, :c, :d, :e, :f, :g, now() )'; := 0 lstbxdados.items.count - 1 begin parameters.parambyname('a').value := trim(lstbxdados.items.item[i].subitems[0]); parameters.parambyname('b').value := trim(lstbxdados.items.item[i].subitems[1]); parameters.parambyname('c').value := t

java - Detecting Mouse Wheel Stops -

i building simple program , need boolean false when user's mouse wheel becomes stopped after having been scrolling. code below more information. public class wheelhandler extends mouseadapter { public void mousewheelmoved(mousewheelevent e) { moved = e.getwheelrotation(); scrolling = true; } scrolling = false; // how make run when wheel becomes stopped? } rolling series of discrete movements, you're going have decide how time between discrete movements means "stopped", , use swing timer check time increment. need decide on arbitrary time slice (below it's int timer_delay = 100 or 100 msec), start timer when user moves mouse wheel, , cancel same timer when use wheel again before slice up. for example: import java.awt.dimension; import java.awt.event.actionevent; import java.awt.event.actionlistener; import java.awt.event.mouseadapter; import java.awt.event.mousewheelevent; import javax.swing.*; @suppresswarnings(&

ios - Adding an alert to login screen Swift -

for reason i'm having trouble adding alert sign in screen when user gets password , username wrong. far have alert when there 1 text field filled in when click sign in button if both text fields populated no alert shows. can me that? @ibaction func loginbuttontapped(sender: anyobject) { if (self.useremailtextfield.text == "" || self.userpasswordtextfield.text == "") { var alert = uialertview() alert.title = "sign in error" alert.message = "you must enter username , password" alert.addbuttonwithtitle("dismiss") alert.show() return; } func checklogin(username: string, password: string ) -> bool { if ((username == useremailtextfield) && (password == userpasswordtextfield)) { return true } else { return false } } if (checklogin(self.useremailtextfield.text, self.userpasswordtextfield.text)) { sel

How to post data to a controller method with Jquery Ajax that is in an external file? -

i trying use post data database ajax have in external file. know works in view function submitclientinformationdata() { var datatosubmit = clientinformationdata(); $.ajax({ type: "post", url: "@url.action('addclientinformation')", datatype: "json", contenttype: "application/json; charset=utf-8", data: json.stringify(datatosubmit), success: function (data) { }, complete: function (e) { } }); } but when add external js file, gets called never reaches controller method. took @ this , tried mentioned in here, button instead , looks this <input id="btnsaveclientinfo" type="button" data-save-action-url="@url.action("addclientinformation")" value="save" class="btn btn-primary" /> but never got method have in controller view. so in short, have ajax call in external file , have button in

c++ - Winsock remote device discovery -

i new winsock , wish use bluetooth project. i wrote simple code taking online resources find remote devices it should print name of remote devices instead prints hex value think...i dont know is the code is #include "stdafx.h" #include<iostream> #include<winsock2.h> #include<ws2bth.h> #include<bluetoothapis.h> #include<stdlib.h> using namespace std; #define success 0 #pragma comment(lib, "ws2_32.lib") #pragma comment(lib, "irprops.lib") int main() { wsadata data; int result; result = wsastartup(makeword(2, 2), &data); if (result != success) { cout << "error occured while initialising winsock..."; exit(result); } cout << "winsock initialisation successful\n"; wsaqueryset queryset; memset(&queryset, 0, sizeof(wsaqueryset)); queryset.dwsize = sizeof(wsaqueryset); queryset.dwnamespace = ns_bth; handle hlookup;

Cannot use several code completion in Android Studio on TextView, ListView, etc -

the android studio doesn't give me suggestion need (everytime press ctrl + space). can't use import function (alt + enter) import textview, arrayadapter, listview, etc. i appreciate help. here screenshot http://i.stack.imgur.com/1k7ka.png

html - Hyperlink multi-level sub-directories through index.php? structure -

i'm trying create hyperlink structure can access multi-level sub folders. now, can access hyperlinks one-level (php) directory, such index.php?content=about (whereas 'about' about.php). what want create filing system larger website multi-level sub-directories following example, index.php?blog/category/process/ . don't know if there symbol replaces html symbol / (slash directory) php directories. tried different ways of accessing files inside multi-level sub-directories, such putting ? (question mark). hypothetically experimental. if use slash, such in form ' blog/category/process/filename.php ', 404 not found error. there following php script inside function.php, gets content url, if there no content, sets default , if there content, sanitizes data against hacking: function loadcontent($where, $default='') { $content = filter_input(input_get, $where, filter_sanitize_string); $default = filter_var($default, filter_sanitize_string); $content

Spark executor lost because of time out even after setting quite long time out value 1000 seconds -

hi have written spark job seems working fine hour , after executor start getting lost because of timeout see following in log statement 15/08/16 12:26:46 warn spark.heartbeatreceiver: removing executor 10 no recent heartbeats: 1051638 ms exceeds timeout 1000000 ms i dont see errors see above warning , because of executor gets removed yarn , see rpc client disassociated error , ioexception connection refused , fetchfailedexception after executor gets removed see again getting added , starts working , other executors fails again. question is normal executor getting lost? happens task lost executors working on? spark job keeps on running since long around 4-5 hours have cluster 1.2 tb memory , no of cpu cores. solve above time out issue tried increase time spark.akka.timeout 1000 seconds no luck. using following command run spark job please guide new spark. using spark 1.4.1. in advance. ./spark-submit --class com.xyz.abc.mysparkjob --conf "spark.executor.extrajavaopt

c++ - Package compilation dynamic library loading error -

i wrapping small c++ program in r using rcpp, , checked beforehand c++ code compiling directly g++ 4.8.4 without warnings or errors. there no external librairies, stl used. when compile package in rstudio devtools, obtain following error: updating perseusr documentation loading perseusr error in dyn.load(dllfile) : unable load shared object '/home/leonid/documents/programmation/perseusr project/perseusr/src/perseusr.so': /home/leonid/documents/programmation/perseusr project/perseusr/src/perseusr.so: undefined symbol: _z9lexicoposlllrst6vectorilsailee calls: suppresspackagestartupmessages ... -> load_all -> load_dll -> library.dynam2 -> dyn.load execution halted exited status 1. it seems compilation fine , there problem loading of dynamic libraries. in undefined symbol, lexicopos name of function in c++ code. any ideas on how solve problem? if home-grown attempt fails, suggest start created example: call rcpp.package.skeleton() , comp

jquery - Change display content based on dropdown selection -

so have dropdown offers 2 different view of same information , wanted know how wire dropdown selection change div being displayed user while hiding other. here have far.. <select data-bind="options: displays, value: selecteddisplay, optionstext: 'displayoption'"></select> the display options have are: 'display 1' , 'display 2' then have 2 div 's each display option. <div id="display1">.....</div> <div id="display2">.....</div> by default having display1 displayed while having display2 hidden until user selects different display 1 not in use hidden. this have view model: self.displays = ko.observablearray(); self.selectedview = ko.observable(); var sampledata = { displays: [ { display1: 'display 1' }, { display2: 'display 2' } ] }; you want apply vi

java - Random strings with given length unit testing -

i have program generating pseudo random numbers(only lowercase, uppercase , digits allowed). /** * * @return - returns random digit (from 0 9) * */ int randomdigits() { return (int) (math.random() * 10); } /** * * @return - returns random lowercase (from "a" "z") */ char randomlowercase() { return (char) ('a' + math.random() * 26); } /** * * @return - returns random uppercase (from "a" "z") */ char randomuppercase() { return (char) ('a' + math.random() * 26); } /** * * @return - returns random number between 1 , 3. * */ char randomchoice() { return (char) ((char) (math.random() * 3) + 1); } /** * * @param length * - length of random string. * @return - returns combined random string. elements builder side * side. * * use randomchoice method randomly upper, lower , * digits. */ public string stringbuilder(int length) { stringbuilder

Converting App Engine frontend versions to modules -

i've "abused" front-end "version" concept in app engine (java), implement modules before introduced. have configuration consisting of: module1-dot-myapp.appspot.com, module2-dot-myapp.appspot.com, module3-dot-myapp.appspot.com, etc., based on version concept (more commonly used numbers: 1-dot-myapp, etc.). specifically, code in versions identical, each practically used different purposes. separation allows different clients use different api versions, separate deployment schedule, staging versions, logs separation, etc. my question is, under theses conditions, best way convert application "real" modules? such "module1" actual module (still mapped same url - module1-dot-appspot.com)? note: answer comes somehow similar exercise in python gae runtime, there aditional java-specific stuff @ well. first things @ (possible show stoppers) app-level configs - need merged in different old app versions (if exist) , shared modules (

spring - Can't generate database scema during test -

im using jhipster generate app , tests working wonderfully :). i added entities , updated manually. used mvn liquibase:diff generate changelogs , application runs when launch in dev mode (running in tomcat on postgres db). when try run tests missing table exception 1 of entity added. i think has liquibase not initialising schema of h2 embedded instance can't point out why. thanks in advance help, lucas

javascript - How to call a java program from node.js? -

i have node.js script , java program in same folder (.class , .java , .js). want call java program node.js script. in terminal can call java program this java -cp java-json.jar:. plutomake "tests/android.png" i saw thread how call java program nodejs and trying same thing, here node.js code var child = spawn('java', ['-cp java-json.jar:. plutomake', 'tests/android.png']); this seems run without crashing, nothing happens. java program creates image, if through node, doesn't work. know whats wrong? thanks the array of arguments pass should have 1 element per argument. you’re incorrectly combining few of them. var child = spawn('java', ['-cp', 'java-json.jar:.', 'plutomake', 'tests/android.png']); checking output , exit code prove useful: child.on('close', function (exitcode) { if (exitcode !== 0) { console.error('something went wrong!'); } }); // i

Rails params permit I am getting error -

i trying create form putting hidden value generating array : "comment"=>{"comment"=>"sss", "feed_id"=>"354"}, "commit"=>"comment"} but when trying use in controller permit produce error controller query : @feeds= feed.find(params["comment"]["feed_id"]) this @feeds work great when trying use permit params showing error actioncontroller::parametermissing (param missing or value empty: feed): to permit using query : def feed_params #params.require(:feed).permit(comment: :feed_id) params.require(:feed).permit(comment: [ :feed_id, :comment ]) #params[:market_place] end when adding here in controller : @feeds= feed.find(feed_params) i getting error actioncontroller::parametermissing (param missing or value empty: feed): and form : <%= form_for(@comment,:remote => true) |f| %> <%= f.text_area :comment, class:"form

protocol buffers - protobuf common.h "No such file" -

i trying install caffe, , running frustrating error. when run make following: cxx .build_release/src/caffe/proto/caffe.pb.cc in file included .build_release/src/caffe/proto/caffe.pb.cc:5:0: .build_release/src/caffe/proto/caffe.pb.h:9:42: fatal error: google/protobuf/stubs/common.h: no such file or directory compilation terminated. make: *** [.build_release/src/caffe/proto/caffe.pb.o] error 1 i using google protocol buffer 2.6.1 ( https://developers.google.com/protocol-buffers/docs/downloads ), , have indeed added directory path. common.h file there in directory (i see own eyes), somehow unable detect it. have no clue do, , solutions this issue don't seem work me. any insight appreciated. suspect neglecting step somewhere, rather new linux. thank much. path tells shell search commands. not tell compiler search headers. tell compiler find headers in particular directory, need use -i flag. example: g++ -i/path/to/protobuf/include -c my-source.cc you need c

node.js - React-Router Webpack exclude server logic from bundling to client side javascript -

i making isomorphic react application, stuck of figuring out how exclude server-side logic bundling client side javascript using react-router , webpack. so webpack has entry points "client.js" clientside bundle javascript. import react "react"; import router "react-router"; import routes "../shared/routes"; router.run(routes, router.historylocation, (handler, state) => { react.render(<handler/>, document.getelementbyid('react-app')); }); "client.js" contains react-router routes definition. and server side, have epxress , route set * (all requests route here) "server.js" import routes "../shared/routes"; app.get('/*', function (req, res) { router.run(routes, req.url, (handler, state) => { let html = react.rendertostring(<handler/>); res.render('index', { html: html }); }); }); since both client , server share same ro

javascript - Calendar Keep Selected Date After Passing PHP Variable -

i use calendar code below minor modification made, anyway when select date, calendar highlights date selected great when pass selected date , redirect url, calendar looses selected date , no longer highlighted on next page, since passing variable, how can edit calendar code , pass selected variable selected date known , highlighted on calendar in next page (same calendar). g_globalobject = new jsdatepick({ usemode:1, isstripped:true, target:"div3_example" }); g_globalobject.setonselecteddelegate(function(){ var obj = g_globalobject.getselectedday(); if (obj.month.tostring().length < 2) { var date = obj.year + "-0" + obj.month + "-" + obj.day //alert(date); window.top.location.href = '..index.php?pdate=' + date; }else { var date = obj.year + "-" + obj.month + "-" + obj.day //alert(dat

Find out if file pointer is at EOF in Python -

i trying find out whether file pointer @ eof in example code: (edited) f = open("test.dat") somefunctiondoingstuffon_f(f) if f == eof: # keep important in case print "eof reached" else: print "not eof" but not know if there available in python. i have edited question adding somefunctiondoingstuffon_f(f), because might not know happened f before hand. excludes approaches. based on martijns comment can use tell don't see how going make difference: import os r.f.seek(0, os.seek_end) n = r.f.tell() r.f.seek(0) while r.f.tell() < n: line = r.f.readline() print(line) print("not @ eof") print("at eof") where r.f file object class in previous question cannot use tell in same way using islice. or using using if's more logic in question: import os r.f.seek(0, os.seek_end) n = r.f.tell() r.f.seek(0) while true: if r.f.tell() != n: line = r.f.readline() p

java - How do you implement recursion for comments? -

i'm trying parse reddit comments, , stuck on how of comment replies in 1 call. a reddit comment object begins array ["data"]["children"] . loop through that, , ["children"]["replies"]["data"]["children"] array gives of sub-comment replies. can grab more comments (if available) ["replies"]["data"]["children"] array. right now, have hard-coded retrieves 3 levels deep. how make dynamic keeps on retrieving until there no more comments? here code have far not dynamic: jsonobject data = commentsobj.get("data").asobject(); jsonarray children = data.get("children").asarray(); final treenode root = treenode.root(); (int i=0; < children.size(); i++) { jsonobject obj = children.get(i).asobject(); jsonobject dataobj = obj.get("data").asobject(); string author = fetchwithhandling(dataobj, "au

javascript - Sails.js create Index(root) Controller -

i wondering if there way have index controller index action. root login page , wanted detect if users session authenticated , if redirect them page. is there specific notation how controller named? have tried indexcontroller.js , maincontroller.js. can't seem find in documentation this. sails.js ver: 0.11.0 you need make controller , action yourself. there, set policy define access. to make controller, run sails generate controller index in console. then, open api/controllers/indexcontroller.js , make this: module.exports = { index: function (req, res) { // add code display logged in view } }; set config/routes.js this: module.exports.routes = { 'get /': 'indexcontroller.index', }; afterwards, define policy has authentication logic. alternatively, can use included session authentication located @ api/policies/sessionauth.js assuming login action sets req.session.authenticated = true; . see the docs on policies more info.

divide - How python calculate this division? -

this question has answer here: negative integer division surprising result 5 answers how python calculate division? >>>-3/10 -1 looks python rounds answer lower value. >>> -3/4 -1 >>> -3/4. -0.75 >>> -3/10. -0.3 >>> -3/10 -1 this guess.

unix - Multiple python scripts and root permissions -

i'm inexperienced when comes unix privileges. have python script starts other python scripts , other programs tcpdump . processes started via subprocess.popen, of programs opened in terminals (via x-terminal-emulator -e option). some of scripts/programs need started root, however. have tried split whole functionality in smaller scripts , use sudo when it's necessary. problem setup requires me enter root password 3 or 4 times everytime start whole thing. what looking way enter password once when start original script, grant actual root permissions @ specified places in scripts. can me out? :) one way of doing start root, fork sub-processes , drop privileges in (sub-)processes don't need privileges. for example, see here there other suggestions in same post.

algorithm - Maximum product prefix string -

the following demo question coding interview site called codility: a prefix of string s leading contiguous part of s. example, "c" , "cod" prefixes of string "codility". simplicity, require prefixes non-empty. the product of prefix p of string s number of occurrences of p multiplied length of p. more precisely, if prefix p consists of k characters , p occurs t times in s, product equals k * t. for example, s = "abababa" has following prefixes: "a", product equals 1 * 4 = 4, "ab", product equals 2 * 3 = 6, "aba", product equals 3 * 3 = 9, "abab", product equals 4 * 2 = 8, "ababa", product equals 5 * 2 = 10, "ababab", product equals 6 * 1 = 6, "abababa", product equals 7 * 1 = 7. the longest prefix identical original string. goal choose such prefix maximizes value of product. in above example maximal product 10. below po

android - Programmatically create a list of TextViews and ImageViews -

i have parent relativelayout in xml id relative_layout_bottom in want create list of textviews aligned left of parent , list of imageviews aligned right of parent programmatically. have map of , want iterate on creating layouts. can't seem figure out how work. this how imagine it: relativelayout relativelayout = findviewbyid(r.id.relative_layout_bottom) each <textview, imageview> in map { create textview add left of relativelayout create imageview add right of relativelayout } edit: better have 2 vertical linearlayouts? <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingbottom="@dimen/activity_vertical_margin" android:paddingleft="@dimen/activity_horizontal_margin" android:paddingright="@dimen/act

javascript - How to show a canvas scene inside a specific div? -

i show scene inside existing div on page. canvas gets appended @ top. have tried using getelementbyid did not work me. what missing here? thank in advance! <div id="preview"></div> <script> if ( ! detector.webgl ) detector.addgetwebglmessage(); var screen_width = window.innerwidth; var screen_height = window.innerheight; var floor = -250; var container; var camera, scene, controls; var renderer; var mesh; var texturecube; var cameracube, scenecube; var loader; var mousex = 0, mousey = 0; var windowhalfx = window.innerwidth / 2; var windowhalfy = window.innerheight / 2; init(); animate(); function init() { container = document.createelement( 'div' ); document.body.appendchild( container ); // camera camera = new three.perspectivecamera( 25, screen_width / screen_height, 1, 10000 ); camera.position.set( 185, 40, 170 ); control

stdout - Implementing backspace while reading character by character in python? -

as in link : http://code.activestate.com/recipes/134892/ how shall implement backspace on stdout? '\b' escape sequence backspace. >>> print('123xx\b\b45') 12345

node.js - npm install of browser-sync errors -

first, error: error: can't find "msbuild.exe". the environment: node -v v0.12.7 node-gyp -v v2.0.1 npm -v 2.11.3 i've gotten past in past specifying --msvs_version=2013...it not working now. i've tried these other solutions no avail. node-gyp configure --msvs_version=2013 node-gyp build #and npm config set msvs_version 2013 --global

mysql - How to index a table for a query with "order by if"? -

is possible create index facilitate order in following query there if condition, follows?: select a, b, c, d, e mytable order if(published, 0, 1), rank, title i've tried creating index on mytable(published, rank, title) , index on mytable(rank, title), testing query explain shows no index employed. "published" tinyint , either 0 or 1; "rank" tinyint, of values in range; "title" varchar(255). many (i'm working code i've inherited developer...) in particular example, looks query re-written as: select a, b, c, d, e mytable order published desc, rank, title in particular, wouldn't work arbitrary transformation functions, work in example.

Parse.com Only one device session for a user. Android -

i'm building app has parse @ backend. i've realized user can log in account in multiple devices. there way restrict 1 device @ 1 time? if can kindly explain method. in advance. you need monitor application web environment (webservice example) login must disconnect other devices connected same user. you can analyze imei made last login request , send command other devices of same user remove access.

activemq - Creating AMQ network of broker clusters on JBoss Fuse 6.2, without fabric -

i want create (2) broker clusters connected network of brokers in jboss fuse 6.2; each cluster has 2 master/slave pairs. it's small cluster, don't intend use fabric/zookeeper; statically configured, no auto discovery. questions is possible use fabric profiles build topology, avoid using fabric @ runtime? can use git, or similar, centrally managing container config files, again, without fabric? we tried creating profiles using fabric:mq-create , command not available unless fabric first created, defeats purpose. no fabric profiles requires using fabric. can use git store files, cannot have jboss fuse automatic use such fabric. need use git manually. the amq broker in jboss fuse standard apache activemq can configure manually/static network of brokers. not easy if haven't done before. see jboss a-mq documentation covers broker: http://www.jboss.org/products/amq/overview/ for example at: https://access.redhat.com/documentation/en-us/red_hat_jboss_

java - Code assistance in IntelliJ IDEA for implicit variables in Twirl Template -

i building web app in java using play! framework , twirl template engine, using intellij idea. in template there number of implicit variables available(flash, session, requestheader). can reference of these variables , app compile , run expected. however, these variables have not been explicitly declared, idea shows error(eg. cannot resolve symbol flash) , not provide code assistance. while not huge problem fix if possible. i have searched quite bit solution, , jetbrains blog has post on how velocity templates, if me same twirl templates thankful! jackson i have found solution problem, refer qualified name within code, ie. access flash variable use @play.mvc.http.context.implicit.flash this can imported @ top of template, can refer @flash in code. this should not necessary- play! aware of these variables without explicitly importing them, idea's sake. strangely enough, found after creating new project through idea did provide expected behaviour- use @flash w

windows - DLL locked - Visual Studio 2010 C++ -

i’m logged onto machine , current problem involves custom build step has trouble copying .dll bin directory because windows says cannot access file because it’s being used process. i’m able reproduce on several other projects. sequence of events build release successfully, test, checkout sha when doing git bisect, , attempt build release sha without doing git clean -xfd (intentionally, because i’m trying cache reusable data possible). weird thing tried use process explorer (procexp) , tasklist /m <locked_dll.dll> search whatever holding onto dll, , unable find holding onto dll. i’m on non-admin account, , i’m not sure if causing windows hide processes me. rebooting machine helps, that’s not acceptable solution since i’m trying automate things. i’m able delete .dll, , when try build project in vs, it’ll complain still can’t access dll when trying copy on bin folder. ideas? i’m going keep researching issue, of right now, i’m sort of stumped. edit: seems duplicate questio

android - Navigation Drawer Layout overlapping with main layout -

how main layout line directly underneath drawerlayout? main layout listed below , made of listviews. right overlapping. below first shows drawerlayout. after closing of drawerlayout main activity listed. <android.support.v4.widget.drawerlayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/drawer_layout" android:layout_width="match_parent" android:layout_height="match_parent"> <linearlayout android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical"> <linearlayout android:id="@+id/container_toolbar" android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical">

python - How to get a bigger font size for x-axis tick labels in scipy-generated dedrogram? -

Image
with following imports: import matplotlib mpl scipy.cluster.hierarchy import dendrogram i set font size globally (based on this other stack overflow answer ): mpl.rcparams.update({'font.size': 20}) then create dendrogram following (where m matrix created elsewhere): dendrogram(m) then show plot with: mpl.pyplot.show() the y-axis tick labels 20 points expected. however, x-axis tick labels tiny, smaller 20 points. seems matplotlib automatically scaling down font size fit density of data despite font size settings above. case when zoom in , there plenty of room show larger font. how can make x-axis ticks use larger font size? you can axes.tick_params() method: import matplotlib mpl mpl.use('agg') import matplotlib.pyplot plt scipy.cluster.hierarchy import dendrogram, linkage import numpy n = 20 n = numpy.random.normal(size=(n, 2)) z = linkage(n) # implicit interface dendrogram(z) ax = plt.gca() ax.tick_params(axis='x', which=

java - HashMap always returning null? -

for odd reason hashmap returning null value if shouldn't null. row isn't null in mysql database. i'm getting no error did debug test see it's printing out , it's returing null. auth.java private string uuid; private string name; private int bits; private string gang; private string rank; public auth(string uuid, string name, int bits, string gang, string rank) { this.uuid = uuid; this.name = name; this.bits = bits; this.gang = gang; this.rank = rank; } authmanager.java public hashmap<string, auth> auth = new hashmap<>(); public void saveuser(string uuid, string name, int bits, string gang, string rank) { this.auth.put(uuid, new auth(uuid, name, bits, gang, rank)); } establishconnection.java public void establishprofile(player p){ string uuid = p.getuniqueid().tostring(); string name = p.getname(); try { resultset query = sql.querysql("select * `profiles` `uuid`= '"

jquery - .slideToggle acting not as it should? -

when user clicks on sidebar want toggle in or out. can seem happen here code have: jquery code: $(function() { $("a#toggle").click(function(e) { e.preventdefault(); $("#aside").slidetoggle(); return false; }); }); html: <div class="wrap" id="aside"> <aside class="left-aside"> <header class="aside-header"> <h1>stuff</h1> </header> </aside> </div> <a id="toggle">sidebar</a> and css: #aside { display: none; } you should try sliding <html lang="en"> <head> <meta charset="utf-8"> <title>jquery.getjson demo</title> <style> #aside { display: none; </style> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js&quo

linux - getting error with bash script for env variables -

this question has answer here: what mean [: -ge: unexpected operator, in bash? 2 answers i using conditional in bash script if [ $use_test -eq 1 ]; echo "hello" fi where pass use_test environment variables . if pass env variable shell executes ok if don't have variable this [: -eq: unexpected operator how can fix that this 1 of matter quotes important; when $use_test not defined, statement expands to: if [ -eq 1 ]; the common fix: if [ "$use_test" -eq 1 ]; ...though imply switching string comparison, because -eq break empty string: if [ "$use_test" = 1 ]; but may consider using [[ (which bash builtin) or ${use_test:-0} (which specifies default value).

php - How to put a variable name in for loop? -

i got value using this: $count = <?php $details->shop_image_count; ?> i want use $count in for loop , not getting value of count <?php for($i=1;$i<($count);$i++){ echo '<li data-target="#shopcarousel" data-slide-to="' . $i . '"></li>'; } ?> you should use this $count = $details->shop_image_count; instead of $count = <? echo $details->shop_image_count;?>

c++ - Getting an unexpected error in my MFC application -

i trying access elements of cstring character character. i'm getting error in following lines of code: void ctotaltimecalcdlg::onbnclickedok() { // todo: add control notification handler code here cstring lstring; m_timeget.getwindowtext(lstring); messagebox(lstring[0]); cdialogex::onok(); } error: "error 1 error c2664: 'int cwnd::messageboxw(lpctstr,lpctstr,uint)' : cannot convert argument 1 'wchar_t' 'lpctstr'" @ line "messagebox(lstring[0]);" if want print first character in messagebox , don't expect convert lpctstr -> lpcwstr (unicode) -> const wchar* wchar_t . print whole cstring , or print first character. void ctotaltimecalcdlg::onbnclickedok() { // todo: add control notification handler code here cstring lstring; m_timeget.getwindowtext(lstring); if (!lstring.isempty()) messagebox(lstring.left(1)); cdialogex::onok(); } messagebox

c++ - OpenGL VBO EXC_BAD_ACCESS Crash -

i want start using vbos render models, i'm running error haven't been able resolve. i've seen occurs when people forget unbind buffer, far can tell i'm doing correctly. i'll spare print statements have determined there opengl error 1281 after call glbindbuffer(gl_array_buffer, _vboid); in drawme() function. guess 1281 indicates bad value... don't know means here. if can see going wrong, please enlighten me. i initialize _vboid 0 in construction of model object. _vboid = 0; then : void model::genbuffers() { if (_vboid == 0){ glgenbuffers(1, &_vboid); float vertexdata[numfaces*3*3]; // numfaces * 3 vertices per face * 3 dimensions per vertex /* fill */ int = 0; polyhedron::halfedge_const_handle h; (polyhedron::facet_const_iterator faceiter = polyhedron.facets_begin(); faceiter != polyhedron.facets_end(); ++faceiter) { cgal::point_3<kernel> p1,p2,p3; h = faceiter->halfedge(); p1 = h-&

Insert contact programmatically in android 4.0 is not showing in default contact list -

i'm doing android application insert contacts programmatically.i've added 1 contact using below code. adding couldn't see contact on default device contact list. device version 4.0.4. showing & on other devices.thanks in advance. code: private void createcontact(string name, string phone) { contentresolver cr = getcontentresolver(); arraylist<contentprovideroperation> ops = new arraylist<contentprovideroperation>(); ops.add(contentprovideroperation .newinsert(contactscontract.rawcontacts.content_uri) .withvalue(contactscontract.rawcontacts.account_type, "accountname@gmail.com") .withvalue(contactscontract.rawcontacts.account_name, "com.google").build()); ops.add(contentprovideroperation .newinsert(contactscontract.data.content_uri) .withvaluebackreference(contactscontract.data.raw_contact_id, 0) .withval

winforms - Unable to get IPython Notebook's url in WebBrowser -

i using system.windows.forms.webbrowser display webpages in windows forms application. url i'm trying display ipython notebook is, http://localhost:8888/tree and i'm able achieve using below code, this.webbrowser.navigate("http://localhost:8888/", false) now in page when click on new->python2 create new notebook, generates new url like, http://localhost:8888/notebooks/untitled.ipynb?kernel_name=python2 my requirement new url in windowsforms application. i've tried events navigating, navigated , new url as, http://localhost:8888/tree# and i'm not able right url. suggestions on this? thanks. i've managed overcome problem editing javascript files in ipython package. can find javascript file @ ipython installed path, ipython\html\static\tree\js\newnotebook.js in newnotebook.js edit line of code var w = window.open(undefined, ipython._target); and add '_self' in order open new url in same window. var w = window