Posts

Showing posts from May, 2013

java - How to display a picture on JFrame? -

i'm doing exercise i'm supposed write program simulates race between 2 cars. i've created jframe , added 2 rectangles supposed tracks. but can't insert cars. have googled , tried solutions doesn not work out. here code. public class race extends jcomponent { private imageicon image; public void paint(graphics g) { g.setcolor(color.gray); g.fill3drect(30, 150, 530, 55,true); g.setcolor(color.gray); g.fill3drect(30, 250, 530, 55, true); g.setcolor(color.black); g.fill3drect(90, 130, 12, 189, true); } public static void main(string[] a) { jframe window = new jframe(); window.setpreferredsize(new dimension(600, 400)); window.getcontentpane().setbackground(color.green); window.setresizable(false); window.setdefaultcloseoperation(jframe.exit_on_close); window.getcontentpane().add(new race()); window.pack(); window.setvisible(true); } } where , how can add 2 pictures? thanks this how add image jf

javascript - Scale element when print web page with IE/Edge -

i customizing styles on web page better printing experience. i using print media query hide header, footer , nav pane. since size of container may change, trying dynamically scale main container fit paper , keep container's aspect ratio. works in chrome mediaquerylistener (calculate scaling factor based on current container size , paper size, , generate "@media print {.containerclass{transform: scale(0.3)}}" . append body). blocked on how in ie (always :-( ). i looking @ onbeforeprint , onafterprint , thought me. but turned out onafterprint happened after onbeforeprint before print dialog, means not technically after print . , when onbeforeprint gets called, media query hasn't been applied page yet. here problem, scale factor calculation based on paper size , current container size. paper size available when in print mode. seems cannot detect if current page in print mode in ie. do guys know how achieve in ie/edge?

javascript - How many dependencies to I need to list in nested require calls? -

i have question. have module following : define(['jquery', 'amodule', 'anothermodule'], function () { .... } lets assign above module name 'mymodule' in requirejs config file. in other file this: require(['myconfigfile'], function () { require['mymodule'], function(module) { } } do need require modules part of 'mymodule' definition in nested require statement well? no, requirejs 'translate' 'jquery', 'amodule', 'anothermodule' . in other words, first load modules 'jquery', 'amodule', 'anothermodule' before loading 'mymodule'

How to commit backlog item to a sprint using Hansoft SDK -

Image
i trying add backlog items sprint using hansoft sdk. there function "hpmfunctiontask get linkedtosprint" gets id of sprint task linked. unfortunately there no function set sprint of task, in sdk. is there way commit item sprint? in gui looks this: thank you, ondras. i have got answer hansoft support. to add backlog item sprint have create proxy item: hpmtaskcreateunified proxytaskcreate = new hpmtaskcreateunified(); proxytaskcreate.m_tasks = new hpmtaskcreateunifiedentry[1]; hpmtaskcreateunifiedreference parent = new hpmtaskcreateunifiedreference(); hpmtaskcreateunifiedreference previous = new hpmtaskcreateunifiedreference(); parent.m_blocalid = false; parent.m_refid = sprint.uniqueid.m_id; // task reference id of sprint previous.m_blocalid = false; previous.m_refid = sprint.uniqueid.m_id; // task reference id of sprint proxytaskcreate.m_tasks[0] = new hpmtaskcreateunifiedentry(); proxytaskcreate.m_tasks[0].m_bisproxy = true; proxytaskcreate.m_tasks

Is this C# 'closure' still valid across a parameter reference? -

let's take simple case .net smtpclient, can following (ignoring credentials, ssl , exception handling): async task sendmail() { var m = new mailmessage(...); var s = new smtpclient(host, port); s.sendcompleted += (s, e) => { m.dispose(); s.dispose(); }; await s.sendmailasync(m); } all fine; func dispose()ing called whenever async sending finishes. m , s within containing scope declared, no problem there. but had following: smtpclient setupmailclient(mailmessage mail) { var smtpclient = new smtpclient(host, port); smtpclient.sendcompleted += (s, e) => { mail.dispose(); smtpclient.dispose(); }; return smtpclient; } async task sendmail() { var m = new mailmessage(...); var s = setupmailclient(m); await s.sendmailasync(m); } now, calling await sendmail() still safe? closure still valid? pass in reference mailmessage 'mail' - copy of reference, valid in context of setupmailclient(). overthinking it, or still safe

mariadb - how do I correlate time in mysql logs? -

i can't seem make sense of how correlate time in mariadb logs: 151004 15:34:36 [note] error reading relay log event: slave sql thread killed 151004 15:34:36 [error] error reading packet server: lost connection mysql server during query ( server_errno=2013) 151004 15:34:36 [note] slave i/o thread killed while reading event 151004 15:34:36 [note] slave i/o thread exiting, read log 'mariadb-bin.000078', position 376 151004 15:36:47 [note] slave sql thread initialized, starting replication in log 'mariadb-bin.000078' @ position 376, relay log './db4-relay-bin.000042' position: 537 151004 15:36:47 [note] slave i/o thread: connected master 'jf_slave@db2.example.com:3306',replication started in log 'mariadb-bin.000078' @ position 376 151007 4:24:12 [note] error reading relay log event: slave sql thread killed 151007 4:24:12 [error] error reading packet server: lost connection mysql server during query ( server_errno=2013) 151007 4:24:12 [no

Plotting Hours in X axis MATLAB -

i need plot tp vs time . have following data extracted excel: y-axis x axis 28.72 13:02:55.58 28.21 13:08:49.53 23.32 13:14:43.48 28.85 13:20:34.48 28.84 13:26:28.51 28.37 13:32:22.51 28.75 13:38:16.49 26.85 13:44:10.55 25.99 13:50:03.51 27.65 13:55:55.54 5.99 14:01:48.51 11.28 14:07:26.52 16.15 14:13:10.56 15.19 14:18:57.49 24.32 14:24:44.50 26.13 14:30:36.49 27.92 14:36:29.53 17.96 14:42:22.54 10.08 14:48:10.54 14.73 14:53:54.52 18.12 14:59:41.48 i have tp in mbps on y-axis , time in hh:mm:ss format on x-axis. how can set tick marks on x-axis use time? use datetick datetick('x',hh:mm:ss) %// use required dateformat, see docs

elixir - OTP: Start GenEvent under Supervisor With Name -

i'm trying create genevent process specific name (for question, i'm going {:global, :x} ). if create genevent normally, e.g. genevent.start_link([name: {:global, :x}]) , can access genevent @ name. that's good. want create genevent under supervision tree. this, put genevent supervision.spec worker spec., , that's when things blow up. iex(1)> {:ok, sup} = supervisor.start_link([], strategy: :one_for_one) {:ok, #pid<0.127.0>} iex(2)> supervisor.start_child(sup, supervisor.spec.worker(genevent, [name: {:global, :x}], [])) {:error, {{:exit, {:function_clause, [{genevent, :start_link, [name: {:global, :x}],

Passing AngularJS object to JSF-call -

i'm using angularfaces , want pass angular js object jsf bean method. i'm iterating on table , want put specific buttons every iteration: <table ng-table="tableparams"> <tr ng-repeat="user in $data"> <td data-title="'user id'">{{user.id}}</td> <td data-title="'name'">{{user.name}}</td> <td data-title="'hide user'"> <p:commandbutton value="hide" id="hideuser" action="#{bean.hideuser({{user.id}})}""> <f:param name="myid" value="{{disponent.dispnr}}" /> </p:commandbutton> </td> </tr> </table> the important line is: <p:commandbutton value="hide" id="hideuser" action="#{bean.hideuser({{user.id}})}"> i tried several ways, e.g. <p:commandbutton value=

python - Try to install mongodb with dijango? -

i trying configure mongodb database django. tried lot of tutorials still, not able configure. i followed following tutorials commands. http://2buntu.com/articles/1451/installing-django-and-mongodb-in-your-virtualenv/ http://django-mongodb-engine.readthedocs.org/en/latest/topics/setup.html http://docs.mongodb.org/manual/tutorial/write-a-tumblelog-application-with-django-mongodb-engine/ i added following code setting.py class. databases = { 'default': { 'engine' : 'django_mongodb_engine', 'name' : 'product' } i tried different version too, still not run command. python manage.py runserver i got following error. $ python manage.py runserver traceback (most recent call last): file "manage.py", line 8, in <module> django.core.management import execute_from_command_line importerror: no module named django.core.management this current installed project packages. $ pip list django-mongodb-

Go templates with eq and index -

go templates have unexpected results when using eq index me. see code: package main import ( "os" "text/template" ) func main() { const mytemplate = ` {{range $n := .}} {{index $n 0}} {{if (index $n 0) eq (index $n 1)}}={{else}}!={{end}} {{index $n 1}} {{end}} ` t := template.must(template.new("").parse(mytemplate)) t.execute(os.stdout, [][2]int{ [2]int{1, 2}, [2]int{2, 2}, [2]int{4, 2}, }) } i expect have output 1 != 2 2 = 2 4 != 2 but 1 = 2 2 = 2 4 = 2 what should change able compare array members in go templates? eq prefix operation: {{if eq (index $n 0) (index $n 1)}}={{else}}!={{end}} playground: http://play.golang.org/p/kefxh6s7n1 .

javascript - How to use external custom element (plugin) in Aurelia app? -

i've defined custom element in github repo. jspm install 'd said element in app. what correct way of importing element in other app? when call aurelia.use.plugin('aurelia-custom-element') in app config, says can't find aurelia-custom-element.js . aurelia-custom-element.html: <template> <div>hello world, aurelia custom element!</div> </template> aurelia-custom-element.js: import {customelement, bindable} 'aurelia-framework'; @customelement('aurelia-custom-element') export class aureliacustomelement { } index.js: export * './aurelia-custom-element'; export function configure(config){ config.globalresources('./aurelia-custom-element'); } what put aurelia.use.plugin('[here]') should match jspm installed. for example, if github repo containing plugin https://github.com/uavalos/mega-plugin , execute jspm install github:uavalos/mega-plugin install plugin. load plugin you

ios - Proper way to find the closest beacon -

when didrangebeacons method called, closest beacon beacons.first? or beacon in list of beacons has lowest accuracy value? both correct? thanks while list of beacons in didrangebeacons:inregion: callback sorted accuracy field (which measures distance in meters), there number of problems relying on this: sometimes beacons have accuracy value of -1 if no rssi (signal strength) samples available in past second. gives incorrect results if relay on automatic sorting. sometimes beacons drop out of list if aren't detected in last second. common problem in noisy bluetooth environments , infrequently transmitting beacons. a more robust way know closest beacon implement algorithm ignores accuracy values of -1 , tolerant of temporary dropouts (say 5 seconds) in beacon detections. or course, beginning. can fancier adding kinds of other filters tune exact use case. without on complicating things, here's swift code use basics: let expirationtimesecs = 5.0 public v

php - Deadlock when updating table in MSSQL -

i need delete external links "content" column. <?php require_once('phpquery-onefile.php'); $connectioninfo = array( "database"=>"database", "uid"=>"user", "pwd"=>"pass"); $conn = sqlsrv_connect( 'server', $connectioninfo); if( $conn ) { }else{ echo "connection not established.<br />"; die( print_r( sqlsrv_errors(), true)); } $query = "select articleid, content articles content '%href%';"; $stmt=sqlsrv_query($conn,$query); if (!$stmt) { die(print_r(sqlsrv_errors(), true)); } while( $row = sqlsrv_fetch_array( $stmt, sqlsrv_fetch_assoc) ) { $cont_old = $row['content']; $ch = false; $dom = phpquery::newdocumenthtml($cont_old, 'cp1251'); foreach ($dom->find('a') $a) { $a = pq($a); if (strpos($a->attr('href'), '/biblio/') === false) { $ch = t

ember.js - View doesn't update after pushing new POJO ember -

i've read ember works fine pojos in place of ember data, i'm giving shot, i'm having little trouble. i'm creating app using nw.js , linvodb database. fetching db easy , works great: // route/index import ember 'ember'; export default ember.route.extend({ model: function() { var gui = require('nw.gui'); var linvodb = require('linvodb3'); linvodb.defaults.store = {db: require('medeadown')}; linvodb.dbpath = gui.app.datapath; var file = new linvodb('file', {} ); var tags = new linvodb('tag', {}); var media = new promise(function(resolve, reject) { var query = file.find().sort({ctime: -1}).live(); file.on('livequeryupdate', function() { resolve(query.res); }); }); var tags = new promise(function(resolve, reject) { var query = tags.find().sort({name: 1}).live();

.net - Rackspace Cloud Files Get Objects In Container C# -

i have been looking @ documentation, testing examples , getting familiar rackspace cloud files api. got basic code down, got api key, got username, basic stuff. 1 thing confuses me, problem appears not documented. so trying objects, including folders , files in container. have tried example: ienumerable<containerobject> containerobjects = cloudfilesprovider.listobjects("storage",null,null,null,null,null,false,ci); foreach(containerobject containerobject in containerobjects) { messagebox.show(containerobject.tostring()); } this doesn't return result looking for, seems not return anything. i using openstack provided running in nuget console: install-package rackspace . i trying create file backup program me , family. a common problem not specifying region. when rackspace cloud account's default region not same region container lives, must specify region, otherwise won't see results listed. quite misleading... here sample console a

minimize WPF application into Taskbar -

i using this wpf notifyicon , works fine: <tb:taskbaricon name="taskbaricon" iconsource="icon.ico" tooltiptext="hello world"> </tb:taskbaricon> but when minimize application can see application open , not icon in task bar . how hide application when minimize ? subscribe statechangingevent add code in window's constructor statechanged += (s, e) => if (windowstate == windowstate.minimized) hide();

eclipse - MAMP directory removed when putting project into GIT -

i have php application in mamp directory. when put eclipse workspace in git (using egit) mamp directory deleted. contents moved git subdirectory. how retrieve working copy of project? i'm working on os x 10.7.5 (cannot upgrade @ time) git version 2.1.2

c++ - Qt application: Failed to load platform plugin “windows” -

Image
i've seen lots of threads scattered internet particular error message. have seen have answers seem presuppose user has heard of called qt , wants qt. got message while running texworks. texworks worked me years until being paid maintenance on computer decided delete files , recite boilerplate notices me in robot voice. i have never heard of called qt in other connection , have no interest in called qt. trying texworks function way did. possible give answer question of not presuppose came interest in, , knowledge of, called qt? first, detect .dll files missing. download , run dependency walker . open (or drag on main window) application's .exe file. in first level of dependency tree there shown .dll files of application a .dll yellow question mark icon missing. should either copy missing .dll files application folder or add folder .dll files path environment variable.

javascript - Printing expression values inside comments in Jade template -

need print value of parameter inside jade template comment. value passed-in correctly; following works expected: if type !== "surveyfree" ul.polloptions answer, idx in answers li +printanswer(answer, idx) else textarea(cols="50", rows="4", placeholder="type in answer") however, attempts print out value of type variable inside comment have failed. i've tried following forms: // "type = " + type // #{"type = " + type} // span= #{"type = " + type} // span= type = #{type} and many others, nothing works (everything gets printed typed in). i'd output: <!-- type = challenge --> or <!-- type = survey --> all appreciated! maybe way you: !='<!-- comment varaible: ' + variable + '-->'

node.js - saving the already installed package with NPM in windows -

i have installed "mongodb" package via npm in windows without --save option. can update package.json dependency list mongodb without reinstalling ? is there workaround in windows same question available in link npm saving installed packages .

c# - What is the best way to implement both swipe and click over a Relative Layout in android? -

Image
creating relative layout , want add click swipe(touch , move pointer on layout move in real time) , detect left , right swipe. have tried following code far. public bool ontouch(view v, motionevent e) { if (gesturedetector.ontouchevent(e)) { //this click return true; } else { int initialtouchx = 0, initialtouchy = 0; int newx = 0; var x = v.left; switch (e.action) { case motioneventactions.down: { _viewx = e.getx(); _viewy = e.gety(); initialtouchx = (int)e.rawx; initialtouchy = (int)e.rawy; break; } case motioneventactions.move: { var left = (int)(e.rawx - _viewx); newx = left;

console - Closing input in CLIPS -

i making program in clips , trying when rule executed, user can't add more facts clips console. wondering if there command either closing input of console without closing or preventing add more facts, tried close, exit , halt not looking for. knows? thank no, there's no built-in functionality disabling entry of commands @ command prompt. typically end users don't directly interact program entering commands assert facts @ command prompt. rules prompt user input , assert facts based on input. entering commands @ command prompt typically used debugging , development. deployed application wants deny user access command prompt embed application within c program , use api calls load , start execution of program.

bash - search and replace with sed not working -

i use sed search , replace, doesn't seem working. guess i'm making stupid mistake can't spot. here file.txt: pfpr03 pa1448770 pfpr03 pa1448780 pfpr03 pa1448790 pfpr03 pa1448800 pfpr03 pa1448810 pfpr03 pa1448830 pfpr03 pa1448840 pfpr03 pa1448850 pfpr03 pa1448860 pfpr03 pa1448870 i want change pa1448770 pa14_48770, ie. adding underscore after pa14. here few examples of i've tried, none of them affecting file @ all: sed 's/^pa14/pa14_/g' file.txt sed 's/^pa14([0-9]*)/pa14_\1/' file.txt any appreciated, it because ^ means line start. use \b word boundary: sed 's/\bpa14/pa14_/g' file pfpr03 pa14_48770 pfpr03 pa14_48780 pfpr03 pa14_48790 pfpr03 pa14_48800 pfpr03 pa14_48810 pfpr03 pa14_48830 pfpr03 pa14_48840 pfpr03 pa14_48850 pfpr03 pa14_48860 pfpr03 pa14_48870 ps: on osx (bsd) sed use: sed 's/[[:<:]]pa14/pa14_/g' file

asp.net web api - Swagger WebApi create json on build -

is there way create swagger json during build task of web api? want use json feed code generator , generate typescript definition file. any more welcome! you can use nswag command line tools this: nswag.exe webapi2swagger /assembly:"path/to/assembly.dll" /output:"path/to/swagger.json" this generates swagger specification controllers in given dll. for more information read page .

Bootstrap Carousel not working properly - displays all elements -

i have following code:- <div id="postcarousel" class="carousel slide" data-ride="carousel"> <div class="carousel-inner"> <div id="house-type-wrapper"> <h2><?php echo the_field('development_title'); ?> house types</h2> <div id="latest-development"> <?php if ( $properties_query->have_posts() ) : $i = 0; while ( $properties_query->have_posts() ) : $properties_query->the_post(); $i++; if ( $i == 1 ) { echo '<div class="item active row">'; } echo '<div id="column-wrap">'; echo '<div class=

How to get the item that has the highest number of occurence in a mysql table -

i have table of products shown below: id name quantity 1 shoe 2 2 pen 1 3 shoe 1 4 glass 3 5 pen 4 6 shoe 2 i want item occurs more in table , number of rows occupies or how many times repeated in table. in case of above table, shoe occurs highest number of times i.e. 3 times. need mysql query can permit me (return 3 in above case). please take performance consideration, since query perform on table having 10 million records. thank you! select name,count(*) products group name order count(*) desc limit 1 this may work

git - How can I delete ignored folder from Bitbucket? -

i need removing files git, pushed bitbucket , need remove them. detailed explanation i created project , git push origin master full folder. after 2 weeks did changes , want remove image folder repository (where stored images users). added path .gitignore file (/public/images/). push changes bitbucket. problem is, on bitbucket repository still folder /public/images/ , when deploy on production, there /public/images/ folder in each version. need delete bitbucket repository, , don't know how. thought when add ignore line in git, automaticaly destroyed repository. if understood question want remove folder no longer appears in latest commit. .gitignore cause git ignore files isn't tracking. remove need git rm . something git rm -r /public/images should stage removal of folder can committed , pushed other change.

asp.net - Copy css/js files with msdeploy on one-click deployment -

i deployed asp.net mvc 5 application using one-click deployment in visual studio. meanwhile need copy css/js files centralized folder, can used different applications of solution. it seems msdeploy has some options solve this. where/how can pass parameters msdeploy using visual studio 2015? one of options is: we need class inherits task. copy files. public class copyfilestofolder : task { [required] public string folderpathforsource { get; set; } [required] public string outputfolder { get; set; } public override bool execute() { //do copy here return true; } } for example youproject want deploy. we need edit yourproject.csproj file: register dll copyfilestofolder class , add target msdeploy <project toolsversion="12.0" defaulttargets="build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <usingtask taskname="copyfilestofolder" assemblyfile=".

html - Flex- change position of child's child? -

i wish sit @ top, b sit in middle , c sit @ bottom. jsfiddle <div class="container"> <div class="a">a</div> <div class="sub-container"> <div class="b">b</div> <div class="c">c</div> </div> </div> css: .container{ display: flex; flex-direction: column; justify-content: space-between; height: 100%; position: fixed; } i need keep same markup - how can change position of div not immediate child of flex container? edit: it should this a b c the css display module level 3 introduces display: contents : the element not generate boxes, children , pseudo-elements still generate boxes normal. purposes of box generation , layout, element must treated if had been replaced children , pseudo-elements in document tree. you can use "ignore" subcontainer, , display inner items if belonged

java - List initialization approach -

this question has answer here: why should interface java class preferred? 9 answers what difference between these 2 initialization of list : list<integer> aa = new arraylist<>(); arraylist<integer> aaa = new arraylist<>(); polymorphism the first uses polymorphism assign object reference variable type interface list . preferable. in oop, practice assign objects variables of general superclass or interface. if calling code needs methods defined part of list , , not additional methods defined in arraylist , go list . this gives code freedom switch different implementation of list , class other arraylist , without breaking calling code. this basic java 101 concept should mastered sooner rather later on java education.

opengl - How to flip Y-axis in GLSL shader before gl_FragColor = texture2D(*,*); -

i need flip textures upside-down in shaders before applying perspective transformations. modified verttexcoord in vert.glsl , don't know use in swap.glsl . way gl_fragcolor = texture2d(texture, verttexcoord ); does not work, because need texture modified in perspective. vert.glsl: #define processing_color_shader uniform mat4 transform; uniform mat4 texmatrix; attribute vec4 vertex; attribute vec4 color; attribute vec2 texcoord; varying vec4 vertcolor; varying vec4 verttexcoord; void main() { gl_position = transform * vertex; vertcolor = color; verttexcoord = texmatrix * vec4(texcoord, 1.0, 1.0); } swap.glsl: #ifdef gl_es precision highp float; #endif // general parameters uniform sampler2d from; uniform sampler2d to; uniform float progress; uniform vec2 resolution; uniform float reflection; uniform float perspective; uniform float depth; varying vec4 vertcolor; varying vec4 verttexcoord; const vec4 black = vec4(0.0, 0.0, 0.0, 1.0); const vec2 boundmi

ios - How to get the cover photo from Facebook + Swift + Parse -

i have log in system in app swift 2.0 integrated facebook, i'm able user informations , profile_picture. i'm wondering how cover image user logged : let requestparameters = ["fields": "id, email, first_name, last_name, name, gender, cover"] let userdetails = fbsdkgraphrequest(graphpath: "me", parameters: requestparameters) userdetails.startwithcompletionhandler { (connection, result, error:nserror!) -> void in if(error != nil) { print("\(error.localizeddescription)") return } if(result != nil) { let userid:string = result["id"] as! string let userfirstname:string? = result["first_name"] as? string let userlastname:string? = result["last_name"] as? string let useremail:string? = result["email"] as? string let username:string? = result["name"] as

c - Getting segmentation fault while scanning an integer value -

though strange, getting segmentation fault while scanning integer value. here program : #include <stdio.h> #include <stdlib.h> #include <string.h> int main() { int t,n,i,j; char c; int grid[1000][1000],right[1000][1000],down[1000][1000]; scanf("%d",&t); printf("hello\n"); while(t--) { scanf("%d",&n); memset(right, 0, sizeof(int) * 1000 *1000); memset(down, 0, sizeof(int) * 1000 *1000); for(i=0;i<n;i++) { for(j=0;j<n;j++) { scanf("%c",&c); printf("char = %c\n", c); if(c == '.') grid[i][j] = 1; else grid[i][j] = 0; } } for(i=0;i<n;i++) { for(j=0;j<n;j++) { printf("%d",grid[i][j]); }

ios - Objective-C UIKit UIAlertViewDelegate not called -

i begin learn objective-c uikit , ran problem.uialertviewdelegate not called.can tell me why? thank you! #import <foundation/foundation.h> #import <uikit/uikit.h> @interface alertlearn : nsobject <uialertviewdelegate> -(void) showalerttest; - (void)alertview:(uialertview *)alertview clickedbuttonatindex:(nsinteger)buttonindex; @end #import "alertlearn.h" #import <uikit/uikit.h> @implementation alertlearn -(void) showalerttest{ uialertview * alertview = [[uialertview alloc] initwithtitle:@"alert" message:@"alert test" delegate:self cancelbuttontitle:@"cancel" otherbuttontitles:@"ok", nil]; [alertview show]; } - (void)alertview:(uialertview *)alertview clickedbuttonatindex:(nsinteger)buttonindex{ nslog(@"clickedbuttonatindex = %ld",buttonindex ); nsstring *buttontitle = [alertview buttontitleatindex:buttonindex]; nslog(@"clickedbuttonatindex title = %@",buttontitle

JMS - Using Topics on WebSphere Application Server 7 -

i have sender , receiver particular topic. i'm running sender , receiver servlets on 7.0. topic , topic connection factory being setup on was. i'm not able receive message send. works fine when try queue instead of topic. below code use. public class commonservlet extends httpservlet{ private static final long serialversionuid = 1l; private static boolean initialized = false; private static initialcontext initialcontext = null; private connectionfactory connectionfactory = null; private destination destination = null; protected final void initialize(){ try{ if( initialized == false ){ // jndi initial context initialcontext = new initialcontext(); // flag initialized initialized = true; } } catch( throwable t ){ system.out.println( t.getmessage() ); } } /** * @return */ protected final dest

java - JCombobox with custom DefaultListCellRenderer as a DefaultCellEditor: returns string value instead of custom object -

i have jtable model implements abstracttablemodel . model holds custom requisitionitem objects have section object in 1 of field. when inserting new record table, add new row new requisitionitem initialized non-null empty values. section column, have custom renderers table , combobox follows for table; requestitemstable.getcolumnmodel().getcolumn(3).setcellrenderer(new defaulttablecellrenderer(){ public void setvalue(object value) { if (value==null) { settext(""); } else { section section = (section) value; settext(section.getname()); } }}); for combobox; sectioncombobox.setrenderer(new basiccomboboxrenderer() { @override public component getlistcellrenderercomponent(jlist list, object value, int index, boolean isselected, boolean cellhasfocus) { super.getlistcellrenderercomponent(list, value, ind

how to set height of a layout with java in android studio -

as can see in code below, want change height of answerbar linear layout answerbar.setheight(55) try this: answerbar.setlayoutparams(new linearlayout.layoutparams(desiredwidth, 50)); or: answerbar.getlayoutparams().height = 50; answerbar.requestlayout();

kdtree - Balancing kd-tree any existing algorithm -

i'm trying implement kd-tree have problem 1 operation - balancing. existing way balance kd-tree? example: after inserting new element i'd have still balanced tree the usual approach seems to collect new elements in list, , every , rebuild tree changes completely. fully rebalancing k-d-tree infeasible. there tradeoff solutions. but usually, if want balanced tree, go r*-tree instead.

Deleting duplicates a linked lists Java -

i trying implement method deletes duplicates linked list. i've managed take care of tail. in other words, if tail's data duplicate, program wouldn't throw exception error . now, i'm trying take care of head such if head 's data duplicate, want set head = head.next duplicate no longer in linked list. method deleteduplicates not handle head . have suggestions fix problem? class node { private node next = null; private int data; public node(int d) { data = d; } void appendtotail(int d) { node end = new node(d); node n = this; while(n.next != null) { n = n.next; } n.next = end; } void print() { node n = this; while(n != null) { system.out.println(n.data); n = n.next; } } node deleteduplicates(node head, int d) {

ios - tableView jumping scrolling after reloadData -

my tableview scrolling jumping when reload tableview new data. here code cellforrowatindexpath : func tableview(tableview: uitableview, cellforrowatindexpath indexpath: nsindexpath) -> uitableviewcell { let section = indexpath.section let index = indexpath.row let info = data[sections[section]]![index] conversationmessage if info.from == .me { var cell: conversationdialogmetablecell = tableview.dequeuereusablecellwithidentifier("mecell", forindexpath: indexpath) as! conversationdialogmetablecell cell.backgroundcolor = uicolor.clearcolor() cell.selectionstyle = .none cell.messagelabel.text = info.text return cell } else if info.from == .other { var cell: conversationdialogothertablecell = tableview.dequeuereusablecellwithidentifier("othercell", forindexpath: indexpath) as! conversationdialogothertablecell cell.backgroundcolor = uicolor.clearcolor() cell.select