Posts

Showing posts from September, 2013

What's the theory of action listener in java? -

i mean how implement real time action, multi threads or what? look, if add action listener jbutton , , put following codes in main function, while(true){ system.out.print("a"); } and print b 100 times in action listener of jbutton. after clicking button, expected see 100 constant b printed, , after there string of a. result turns out expected wrong. so want ask, exact relationship between action listener , main function? 2 threads or something? i looking forward answer, thanks! basically action listener , main function not related directly, create jbutton , add action listener, perform whatever function want perform. main fuction not involved in unless so. everytime create button thread created , runs independently.

android - tab as like fileexploler -

Image
how can put tab @ above.. i want type of tab when click item show on above,can give snippet or links.. , please tell brief if available how can this.. show in figure red rectangle there android tools or library.... or directly can code?? thanks in advance rectangle describe want belove image .. i have made simple project you. should make more beautiful wasn't focusing on that, on code. first add these values color.xml <resources> <color name="buttongrey">#7a7a7a</color> <color name="layoutholderstartcolor">#f7f7f7</color> <color name="layoutholderendcolor">#e1e1e1</color> </resources> next create background button holder , name gradient_button_holder.xml <shape xmlns:android="http://schemas.android.com/apk/res/android"> <gradient android:startcolor="@color/layoutholderstartcolor" android:endcolor="@color/

node.js - trying to send basic nodemailer email -

i'm trying insert test code hard-coded email data directly nodemailer server.js file started basic working example. see "test code" section @ following url: http://jsbin.com/sibubi/1/edit?html,js,console server.js loads without issue without test code. however, error occurs when "test code" section included. complains "unsupported configuration" , suggests downgrade copied test code nodemailer website. idea issue might , how fix? here's error: http://jsbin.com/kehofe/1/edit package.json "nodemailer": "~1.4.0", "nodemailer-smtp-transport":"~1.0.3" install them your controller code var nodemailer = require('nodemailer'); var smtptransport = require('nodemailer-smtp-transport'); var transport = nodemailer.createtransport((smtptransport({ host: your_host, secureconnection: false, // use ssl port: 587, // port secure smtp auth: { user: your_username, pass

javascript - how to show dynamically nested child array object of an object while nested level is not restricted -

i have array of object each object have children property object, object have children property object include children property object , on ............ some object have children , don't have children (i.e children: array[0]) want display them dynamically on single page using dynamic routes. example first show object list if object have child child see on same page using different route on button click (i.e., ng-click) how possible array of object [object, object, object] hierarchy example more clarification 0: object 1: object children: array[3] 1: object 2: object 2: object children: array[3] 1: object children: array[3] 1: object 2: object 3: object 3: object 4: object parent id given in each object. you can use angular ui tree directive. https://jimliu.github.io/angular-ui-tree/ if want create custom d

security - Harm of passing session id as url parameter -

Image
so noticed 1 of internet banks websites passing session id url parameter. ( see image below ) i didn't see anywhere ';' in url, in case after 'private;'. 1) use of ';'? 2) , why internet bank, needs securest place in internet passing session id url parameter? at first, thought doing because of users disallow use of cookies, again, if allow it, use cookies, if not - url, allow use of cookies, thats not case. 3) guess should have other security measures? be? 4) , 1 can possibly if knows others valid session id? know, can quite log others peoples session if know id, because not hard edit cookies , easier pass session id url parameter, if have like: session_id($_get[sessionid]); thanks! 1) should ask whoever designed application red box covering. url can want; convention of key=value&key2=value2 - convention. in case, it's java, , commonly uses convention of ;jsessionid=.... sid. 2) it's not that big of deal. norm

c# - How to change default WCF service binding? -

in wcf have few services. 1 of them must have bigger limit message size must create binding , change configuration. but... can't see configuration of services in web.config - nothing. default? can change service binding? in wcf 4.0+ concept of default bindings , endpoints introduced. if create new wcf service application, example, out of box no changes default endpoint listening @ uri of service using basichttpbinding (the default binding http ). if need larger values default values binding configuration, have 2 choices: make default binding configuration section. done omitting name attribute binding, this: <system.servicemodel> <bindings> <basichttpbinding> <binding maxreceivedmessagesize="528880" /> </basichttpbinding> </bindings> <system.servicemodel> note there no name attribute (the other attributes have been omitted purposes of illustration). configuration specified used defaul

Add Google Play service to an Android library project in Android studio -

Image
i have library project foolib uses google play service (location service). when using eclipse, have google-play-services-lib (also library project) in workspace , include in foolib, , working fine. migrating android studio , not figure out way include google play service in library project. here have done far: installed google player service, google repository in sdk manager. (i using latest android studio 1.0.1) 2. added compile 'com.google.android.gms:play-services:6.5.+' build.gradle file foolib under dependencies. sync gradle file. here guild.gradle file apply plugin: 'com.android.library' android { compilesdkversion 21 buildtoolsversion "21.1.2" defaultconfig { minsdkversion 8 targetsdkversion 21 } buildtypes { release { minifyenabled false proguardfiles getdefaultproguardfile('proguard-android.txt'), 'proguard-rules.txt' } } } dependencie

php - MODX FormIt overriding POST values -

i trying modify posted phone number using custom hook, reason value isn't changed. here hook: require '/components/vendor/autoload.php'; $phoneutil = \libphonenumber\phonenumberutil::getinstance(); $phone = $hook->getvalue('phone'); $country = $hook->getvalue('country'); $numberproto = $phoneutil->parse($phone, $country); $formated = $numberproto->getnationalnumber(); $code = $numberproto->getcountrycode(); $formatedphone = '+'.$code.$formated; $hook->setvalue('phone', $formatedphone); return true; so, taking phone field, populate code , set value back. can see, works fine (by dumping data) until $hook->setvalue('phone', $formatedphone); what's problem here? so, fine actually. looking @ post data via network tab, real posted data fine.

javascript - Getting undefined for function call in Express render() -

this question has answer here: why variable unaltered after modify inside of function? - asynchronous code reference 6 answers i'm new node , express, , running trouble getting data 1 function, pass function var. presume because not handling callback , async stuff properly, appreciate steer. the code should explanatory. attempting retrieve json data url, , pass router.get function's render() method. however, nothing ("undefined") gets sent instead. when run getdata() function separately, however, returns correct data, stated, presume because i'm not handling async stuff correctly. function getdata(cid){ var request = require("request"); var cid ='xxxxxx' // hard code temp var baseurl = "someurl.com" var apikey = "xxxxxx" var curl = baseurl+cid+'?api_key='+apikey request({ u

c# - wpf Custom panel xaml name is not declared in namespace -

i made custom panel, customcanvas class enxtending canvas class in namespace canvase. , add xmlns:local="clr-namespace:canvase" and <stackpanel> <local:customcanvas x:name="customcanvas" maxheight="1555"> </local:customcanvas> </stackpanel> then show name "customcanvas" not declared in namespace "clr-namespace:canvase" so, don't see wpf design view, wysiwyg. please help make sure platform target project (project properties -> build) set cpu.

Use Username instead of Email for identity in Asp.net mvc5 -

whenever create new application visual studio 2013 express web , using individual accounts authentication , hit register button notice implements 'email' instead of 'username' , same in loginviewmodel uses email sign in instead of username. how can change use username instead of default email without trouble? know how convert default 'guid' string type 'id' (integer type). the linked question in accepted answer descibes how use email instead of username, op wanted username instead of email looking in identity 2.0 in mvc project. in case else gets here google search easy this. if @ register post action setting username email address. so......... add username registerviewmodel , add register view. <div class="form-group"> @html.labelfor(m => m.username, new { @class = "col-md-2 control-label" }) <div class="col-md-10"> @html.textboxfor(m => m.username, new { @cla

xml - How to open large files with PhpStorm 8? -

i'm dealing large sql or xml files (can 3gb) open in editor. message: file <the name of file> large phpstorm editor i have 32gb of ram , windows 7 pro - 64bits . can override limit? like said, idea.max.intellisense.filesize did me too, haven't tried such huge files, files 300mb size.

PayPal micropayment -

i m planning integrate micropayment in asp.net website. need use paypal achieve this. the cost of service deliver low, $1 per month. i'd know more paypal service kind of cheap transactions. how paypal hold each $1 payment ? found this explaining paypal conditions micropayment. feedback on ? plus, how paypal handle currency conversion ? service worldwide, want users able buy product not using dollars, euros or currency. thanks in link quoted fees section expandable , can see micropayments pricing: 5% + $0.05 signing doesn't require vetting or contract changes. contact customer service , file request team enables micropayments. should done within few days. currency conversion , cross-border transacitons in page: international sales: pricing table above applies domestic payments in dollars. there's additional 2.5% charge currency conversion , 1% charge receive payments country. if decide charge buyers in usd only, able choose if wish card issuer or

c - Processing WM_PAINT -

i have read many examples on internet i'm still stuck. i'm trying process wm_paint message sent application. in application, draw in same dc, named g_hdc . works perfectly. when wm_paint received, try draw content of g_hdc dc returned beginpaint . guess g_hdc contains last bitmap drawn. want restore it. case wm_paint: paintstruct ps; int ret; hdc compatdc; hdc currentdc; hdc paintdc; hbitmap compatbitmap; hgdiobj oldbitmap; paintdc = beginpaint(g_hwnd, &ps); currentdc = getdc(g_hwnd); compatdc = createcompatibledc(paintdc); compatbitmap=createcompatiblebitmap(paintdc, config_window_width, config_window_height); oldbitmap=selectobject(compatdc, compatbitmap); ret = bitblt(compatdc, ps.rcpaint.left, ps.rcpaint.top, ps.rcpaint.right - ps.rcpaint.left, ps.rcpaint.bottom - ps.rcpaint.top, currentdc, ps.rcpaint.left, ps.rcpaint.top, srccop

ruby on rails - Cannot load gem during gem pristine -

i using rails on local host , have been confronted following message. warning: you're using rubygems 1.8.23 spring. upgrade @ least rubygems 2.1.0 , run `gem pristine --all` better startup performance. sounds fair enough, when run suggested command, hangs on installing cairo gem following message. cached gem cairo-1.12.8 not found, attempting fetch... error: while executing gem ... (gem::exception) cannot load gem @ [/usr/share/rubygems-integration/1.9.1/cache/cairo-1.12.8.gem] in /home/me/ what might going on here? you need update rubygems 2.1.0 or newer versions. newest version 2.4.5 updated dec. 3rd 2014. try link update. https://rubygems.org/gems/rubygems-update

java - how to implement a global state with guice? -

i want create global state (data object, not service object). i have created class mydataobject . i want avoid regular global state, but prefer using guice dependency injection. however tutorials show how set di service object registration interface. how can use guice injection need? edit i have tried: public class appinjector extends abstractmodule { @override protected void configure() { bind(e2eresult.class).toinstance(new e2eresult()); } } with: @test public void sendsearchrequest() throws exception { ... e2eresult = injector.getinstance(e2eresult.class); timerutils.settimeout(criticalblocktimeoutmilli); timerutils.startstopwatch(); ... long timeelapsed = timerutils.stopstopwatch(); e2eresult.runtime = timeelapsed; ... } and: public static void main(string... args) throws classnotfoundexception, ioexception { injector injector = guice.createinjector(new appinjector()); resul

java - Maven: Running created Jar-File with depedencies -

this question has answer here: how can create executable jar dependencies using maven? 33 answers i've written little java command line tool, want run (for example) java -jar myjarfile.jar de.my.path.mainclass arg0 arg1 arg2 for building jar-file , managing depedencies using maven. found out, maven not include depedencies of pom-file in jar-file. so, when run jar-file, classnotfoundexceptions.. execute jar-file need libraries in classpath. how can manage maven? thank help!! put maven assembly plugin in pom.xml: <plugin> <artifactid>maven-assembly-plugin</artifactid> <executions> <execution> <phase>package</phase> <goals> <goal>single</goal> </goals>

c# - Why when uploading file format 20%.jpg i'm getting exception? -

the reason % if i'm uploading 20 files , jpg no problems if 1 of files names example 20%.jpg or 50%.jpg can't upload them. i can edit , see images on hard disk can't upload them. now example test in files index 0 have: d:\5%.jpg txf , fn both contain: d:\5%.jpg this top part of method upload files ftp server: the exception happen when i'm calling method createdirectory in method. private void stringarrayuploadfiles(object sender, doworkeventargs e) { try { foreach (string txf in files) { string fn = txf; backgroundworker bw = sender backgroundworker; fileinfo fileinfo = new fileinfo(txf); f.targetfolder = fileinfo.directoryname; f.targetfolder = path.getdirectoryname(txf); f.targetfolder = path.getfullpath(txf).replace(":", "").replace("\\", &quo

html - Once more: adjusting div to another divs height (dynamically)? -

so here question once again adjusting divs height another. found lot of questions , answers this, can't seem make work. therefore asking once again. the problem: have 2 divs , heights differ. i'd have height of div x adjusted heighest (other) div. i'd happen without javascript, since i'd compatible resizing browser screen , don't want need use resize function time detect screen size (hope makes sense). so here code: http://jsfiddle.net/frlt1vmn/ <style> #container2 { margin: 10px auto; width: 927px; } #leftcol2{ float: left; width: 195px; background: #fcf; z-index:-1; padding:0; margin:0; } #rightcol2{float:right; width:732px; background: #cff; z-index:1; padding:0; margin:0; } </style> <div id="container2"> <div id="rightcol2"> how adjust divs automatically height of other. </div> <div id="leftcol2"> <p>in example div heigher.</p> <p>

sql - MYSQL | Query to Get Leaves Allocated and Leaves Taken for Employee and should show the category of leave -

Image
trying solve mystery morning , banging head on brick wall. let me give background. employees allocated leaves in different category e-g sick etc etc.. now if employee want take leave submit application approved someone. now here comes part want records , show on page, want employee took how many leaves , how many leaves assigned him/her have show leaves in category base, depends on category assigned. it confusing put schema screenshots. this query have tried far.. problem in query getting total leaves taken total general, mean counts category leaves. should show how many leaves employee has taken in category select e.employee_id, e.full_name, le.no_of_leaves allocatedleaves, mllt.leave_type leavetypename, mllt.`ml_leave_type_id` leavetypeid, ifnull(la.totalleavestaken,0) totalleavestaken, (le.no_of_leaves - ifnull(la.totalleavestaken,0)) balance employee e inner join leave_entitlement le on e.employee_id = le.employee_id , month(le.`date_approved`) = 11 left jo

java - retrieve button-name on jsp page servlet -

i developing jsp application using eclipse. trying detect button pressed while submitting form ajax call. request.getparameter(button-name) returns null within dopost method of servlet. below code jsp, ajax call(jquery) , servlet. //jsp <body> <form id="formcreateuser"> <div> <table> <tr> <th colspan="4"><label>new user information</label></th> </tr> <tr> <td><label>name : </label> <input type="text" name="txtname" id="txtname" /></td> <td><label>surname : </label><input type="text" id="txtsurname" name="txtsurname" /></td> </tr> <tr> <

django - Need to upload both JSON and image file with Curl -

i have django rest api, has model logo tag in it, file ( imagefield ). how should curl command way. tried way, never worked me: curl -vx post http://127.0.0.1:8000/client/ -d test.json --header "conten-type: application/json" -f "logo=@downloads/trello.png" unfortunately json not support uploading binary files, limited multipart requests. if not need send nested data, , not locked json, i'd recommend using that. a workaround create new view uploading files, separate view requires json. won't work in situations, , require 2 step process, isolates issue. the other option create (or find) custom field support json uploads, typically using base64 encoded strings.

javascript - How to call function of one controller from other controller in angularjs? -

i want call listing function of testcontroller usercontroller. mark(//) place want call function in following code. doing in angularjs function usercontroller($scope, $http) { $scope.signup = function() { $http.post('<?php echo site_url('angularjs/addtotable'); ?>', {'uname': $scope.username, 'pswd': $scope.userpassword, 'email': $scope.useremail} ).success(function(data, status, headers, config) { // here want call listing function of testcontroller ... }); } } function testcontroller($scope, $http) { $scope.listing = function() { $scope.users = []; $http.get('<?php echo site_url('angularjs/get_list'); ?>').success(function($data) { $scope.users = $data; }); } } if

qt - QML drops binding after assignment `undefined` -

i have pyqt5 property proper notify -function: class friendswidgetbackend(qobject): messagecompanionchanged = pyqtsignal() def __init__(self, parent=none): qobject.__init__(self, parent) self._current_message_companion = none @pyqtproperty('qvariant', notify=messagecompanionchanged) def message_companion(self): return qvariant(self._current_message_companion) @message_companion.setter def message_companion(self, message_companion): self._current_message_companion = message_companion self.messagecompanionchanged.emit() everything works until i'll assign variable undefined - when refuses update variable in qml after emiting messagecompanionchanged signal. i've tried set breakpoint - updates application start until undefined assignment: item { id: rootitem property qtobject friendswidgetbackend onvisiblechanged: { if (!visible) { friendswidgetbackend.message_c

c - Which user can use setpgid() function? -

i worked out function setpgid() when executing function result permission denied. logged in root user time print error message permission denied. user can use function. can explain me? #include<stdio.h> #include<unistd.h> #include<stdlib.h> main() { printf("parent pid=%d\tpgid=%d\n",getpid(),getpgid(getpid())); pid_t pid,pgid; pgid=getpgid(getpid()); if((pid=fork())==0) { printf("befor sessionchild pid=%d\tpgid=%d\n",getpid(),getpgid(getpid())); sleep(5); pid_t p; printf("child pid=%d\tpgid=%d\n",getpid(),getpgid(getpid())); if((p=fork())==0){ sleep(2); setsid(); printf("child2 pid=%d\tpgid=%d\n",getpid(),getpgid(getpid())); setpgid(getpid(),pgid); perror("error"); printf("after setting group id c

glass mapper - Image not rendered in Sitecore GlassMapper -

i using glassmapper in sitecore webforms, , want render image, image not rendering. here code: <% using (beginrenderlink(x => x.logolink, iseditable:true)) { %> <%=renderimage(x=>x.sitelogo) %> <% } %> are sure, using appropriate model use as: <%= renderimage(x => x.image, iseditable: true) %> if not able fix issue, try also <%= glasshtml.editable(model, x=> x.image, x=> glasshtml.renderimage(x.image)) %> <%= editable(x=> x.image, x=> glasshtml.renderimage(x.image)) %>

jquery var and $(var).css -

i have code: $(document).ready(function() { $('.fa-crosshairs').click(function() { $('*').click(function() { var currentclass = $(this).attr('class'); }); }); $('#1color').click(function() { $('body').css({ "background-color": "black" }); }); }); i need currentclass var, use instead of $('body').css, dont know how have it. the point 1 element clicking, , then, change css when click on ('#1color') declare variable globally. here's example of how this. $(document).ready(function() { var elem; $('.fa-crosshairs').click(function() { elem = this; }); $('input').click(function() { $( elem).css({ "background-color": "teal", "color": "white" }); }); }); <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"><

EL variable resolution in JSF: is there a way to control when it happens? -

i face following problem. have jsf application , facelet write el expressions, this: <h:outputtext value="#{mybean.foo}"> as long mybean , variable, has life long enough, there's no problem evaluate mybean.foo @ given time, if mybean variable references bean within short period of time, when mybean.foo evaluated might late, jsf complains mybean resolves null . well-known, problem is not clear me expect in different situations. concrete example n. 1: if try following primefaces orderlist: <p:orderlist value="#{bean.myvalue}" var="item"> <p:column> <p:commandlink action="#{bean.dosomething(item)}" /> </p:column> </p:orderlist>` this not going work, because when dosomething called, item variable no longer defined (although object references still alive) , hence it's resolved null . it's known issue . same pattern works fine <p:datatable> , instance. anyway, i'm no

c# - How to paint additional things on a drawn panel? -

i'm reading lot c# drawing , reading msdn tutorial on gdi+ using graphics handlers. i want able paint graph, nodes have in list can't use auto-placing, need nodes in specified place , have specific appearance , on, changing on time, that's why stopped looking graph libraries. it works great when painted first time when want painted after else happens in code (not after clicking control), can't it. example: if (somethinghappens) { // repaint panel adding things } all got either nothing new happens or earlier painting disappears. i found examples on onpaint overriding , drawings disappearing when minimalized. when need paint additional when happens in application, have override or different? i looked q&a include information need. frankly, it's fundamental question, how deal drawing forms control. msdn topics overriding onpaint method , custom control painting , rendering provide detail on right way this. i'm surprised wasn't able

datastax enterprise - How can I run a standalone hiveserver2 with internal authentication? -

i have datastax dse (4.5) cluster uses internal authentation (using org.apache.cassandra.auth.passwordauthenticator ). possible me run standalone hiveserver2 ? how? far haven't found in datastax documentation. this page not have example of running hiveserver2. you can start dse hive --service hiveserver2 --hiveconf cassandra.username=cassandra --hiveconf cassandra.password=cassandra then use beeline connect it beeline> !connect jdbc:hive2://localhost:10000?cassandra.username=cassandra;cassandra.password=cassandra org.apache.hive.jdbc.hivedriver

matlab - Basic solve with symbolic variable returns said variable -

i cannot basic symbolic expressions solve in matlab. have symbolic toolbox installed (checked ver). code: syms x xsol = solve(10*x == 1, x) the expected solution x=1/10. somehow matlab returns x, doesn't solve @ all. tried multiple examples documents , haven't progressed. thinking there might wrong symbolic toolbox installation? if has idea wrong, please let me know! edit: i'm using matlab 2014a way

javascript - Aspect programming using Backbone -

i looking detailed example code aspect oriented programming implemented using backbone.advice mixin. i have looked @ following links not intutive , finding difficult integrate backbone mv* application. https://github.com/rhysbrettbowen/backbone.advice also can tell me whether using advice can access original parameters passed method around advice gets applied. edit: answering questions here in original thread q: looking for? trait based composition , conflict resolution method modifiers before, after, around or real aspect-oriented programming? a: have few views which inherited common view, view contents own implementation render, apply advice i.e. after every render custom stuff etc. i looking detailed example code ... unfortunately i'm not able point somewhere on that. might able provide rest. ... ... aspect oriented programming implemented using backbone.advice mixin. having source code, "backbone.advice" not provide functionalit

winapi - Show More Details Option in Windows Vista Progress Dialog -

Image
i use iprogressdialog interface in order create progressdialog windows-vista style this: dialogs shown while copying, pasting , moving files in windows explorer offer additional button "more details" provides further information current progress. is there possibility display , work button regarding iprogressdialog interface? best regards second screenshot screenshot of ioperationsprogressdialog dialog. iprogressdialog not have feature want.

android - verify error:num=20:unable to get local issuer certificate -

i using openssl client command connect verisign server. using following command. openssl s_client -connect 69.58.181.89:443 is gives following error. verify error:num=20:unable local issuer certificate after modifying command following, can avoid error on laptop (mac os), not on android device. (the missing certificate included in ca-bundle.crt file) openssl s_client -cafile ca-bundle.crt -connect 69.58.181.89:443 what can issue openssl client, not pick certificate crt file? can please give idea solve this?

java - How to return from JUnit test to main method if part of test takes too long -

i try run junit main() method: public static void main(string... args) throws classnotfoundexception, ioexception { //... logger.debug("classname " + classname + "methodname " + methodname); request request = request.method(class.forname(classname), methodname); return new junitcore().run(request); } i have e2e test 10 commands (say). run junit , want limit run time of commands 3-5 x millis (where x determined @ run time). if runs longer x want return main() , print something. i have tried system.exit() closes whole application. tried: public void settimeout(string criticalblocktimeoutmilli) { if (criticalblocktimeoutmilli != null) { timertask timertask = new timertask() { @override public void run() { e2eresult e2eresult = e2eresult.getinstance(); e2eresult.status = e2estatus.timeout; //system.exit(2); } }; new timer().s

parallel iterations in for loop in shell -

i trying run command across lines in text file. using loop below. for line in `cat $logdir/details.lst` #queue state dump #the following amqldmpa command dumps queue state every 10 seconds 1 minute. amqldmpa -m $qmgr -c -u 1 -q $line -d 3 -n 6 -s 10 -f $logdir/$line.txt done now there close 20 lines in details.lst file. how can run command against these lines @ same time in parallel? how can out of loop after lines have been executed in command? please help. that's wrong way iterate on lines of file. use while loop. put each amqldmpa in background assuming shell bash, use wait builtin while ifs= read -r line; amqldmpa --options... & done < "$logdir/details.lst" wait echo "all jobs done" you lose exit statuses of backgrounded jobs way though.

java - Why / where am I getting stuck in an infinite loop -

i trying take text file, , break text file words. attempting store each word node in binary tree. after doing try print binary tree. reason when run code getting caught in infinite loop don't understand or why if can see getting caught great thanks public class tester { public static void main(string[] args) throws filenotfoundexception { tester run = new tester(); run.it(); } public void it() throws filenotfoundexception { btree thetree = new btree(); string str = this.readinfile(); int position = 0; string newword = this.breakintowords(str, position); while(newword != null){ thetree.add(newword); newword = this.breakintowords(str, position); } thetree.print(); } public string readinfile() throws filenotfoundexception { string myfile = ""; int numwords = 0; scanner myscan = new scanner(new file("dracula.txt")); while(myscan.hasnext() == true) { myfile += mysca

c# - Authorizing partial web methods -

i using asmx web services (not wcf) , implemented simple http module basic authentication. works fine authorizing files (web.config deny/allow) , user.isinrole filled. however, want authorize partial web methods. purpose, found principalpermission.demand atributes. however, allways throws exception although passed valid login credentials. web config: <system.webserver> <modules> <add name="authenticationmodule" type="authenticationmodule"/> </modules> </system.webserver> <system.web> <authentication mode="none"/> <authorization> <allow users="*" /> </authorization> </system.web> client: commonservice.commonservices service = new commonservice.commonservices(); service.credentials = new networkcredential(username, pass); service.preauthenticate = true; service.helloworldforeveryo

HTML & Javascript, how can I make a button appear in a function? -

i'm still new html , js, want make function makes button appear on webpage... i've tried couple of things this: html: <span id="buttonappear"></span> js: function buttonfunction(){ document.getelementbyid("buttonappear").innerhtml = "<button onclick="secondfunction()">some text here</button>"; } but of course, didn't work. i'd love hear way make happen. in advance! it should appear. have slash innerhtml or use single quotes not mess when mixing them: function buttonfunction(){ document.getelementbyid("buttonappear").innerhtml = '<button onclick="secondfunction()">some text here</button>'; }

java - Trying to get value out of a select option in the same form -

i'm trying value out of select option. doesn't seems able since it's on form. how do ? mean having taking value out of option select. <strong>select product :</strong> <select name="stockid"> <c:foreach var="row" items="${stocks1.rowsbyindex}"> <option selected><c:out value="${row[0]}"/></option> </c:foreach> </select> </p> <%!int query = 0; %> <% if(request.getparameter("stockid") != null){ connection connection = drivermanager.getconnection( "jdbc:derby://localhost:1527/healthdb", "nbuser", "nbuser"); preparedstatement statement = connection.preparestatement("select stockqty stocks stockid = ?"); statement.setstring(1,request.getparameter("stockid")); resultset resultset = state

ios - Unable to get rid of the cancel button -

i using search display controller, , in cases not need cancel button yet in searchbarshouldbeginediting setting showscancelbutton no , or setshowscancelbutton:animated: does no work what can rid of button ? easy solution in swift3 - need make customsearchbar without cancel button , override corresponding property in new customsearchcontroller : class customsearchbar: uisearchbar { override func setshowscancelbutton(_ showscancelbutton: bool, animated: bool) { super.setshowscancelbutton(false, animated: false) }} class customsearchcontroller: uisearchcontroller { lazy var _searchbar: customsearchbar = { [unowned self] in let customsearchbar = customsearchbar(frame: cgrect.zero) return customsearchbar }() override var searchbar: uisearchbar { { return _searchbar } }} in myviewcontroller initialize , configure searchcontroller using new custom subclass: var videosearchcontroller: uisearchcontroller = ({ // display

android - What is the proper way to create a link for mobile devices? -

so have interesting problem can't seem figure out what's going on. purchased mobile theme 1 of favorite places. theme works great except 1 area. there icon on top right allows user tap , shows social media sharing icons, user should able tap icon of choice , share on proper social site. in browser, links seem work fine, when use droid or tablet, although show/hide social icons works fine, ability tap icon , share link not however. here code section: <div class="sharedialog sharedialogmenu"> <div class="sharedialogarrow"></div> <div class="sharedialogcontent"> <ul class="sharedialogiconlist"> <li><a href="mailto:?subject=subject&body=content"><div class="sharedialogmail"></div>mail link</a></li> <li><a href="http://m.facebook.com/sharer.php?u=<?php echo urlencode(curpageurl()); ?>" target="

css3 - CSS: Background size contain and positioning in IE/Safari -

hello there bit confused behaviour on responsive css background image in ie11/safari 5 works in chrome , firefox: #contentheader_logo_inner { background:url('images/logo.svg') right top no-repeat; background-size: contain; display:inline-block; max-width:200px; width:100%; height:100%; } the thing svg background image contained within dynamically scaled div (which has width/height in percent), in ie , safari displayed left instead of right when scaling. is there solution this? your code: #contentheader_logo_inner { background:url('images/logo.svg') right top no-repeat; background-size: contain; /* thats wrong */ display:inline-block; max-width:200px; width:100%; height:100%; } change: #contentheader_logo_inner { background:url('images/logo.svg') right top no-repeat; background-size: 100% 100%; /* full size background */ background-origin: content-box; /* placing background word

jboss7.x - Not able to set options in JAVA_OPTS in JBoss openshift -

i want change server running timezone. want add timezone option in java_opts. (-duser.timezone=gmt). have tried edit '/var/lib/openshift/548c33cce0b8cd44d3000083/jbossas/bin/standalone.conf' in jboss cartridge of openshift, failed because of permission denied. i have referred 1 solution mentioned in https://forums.openshift.com/how-to-pass-jvm-options-to-jboss-7as . add "export java_opts="$java_opts -duser.timezone=gmt" in 'pre_start_jbossas' file in action_hooks folder , push it. did same , working fine. timezone options correctly added in java_opts @ time of server start up. problem here is, @ time of cartridge restart, timezone option not present in java_opts. please provide solution. use java_opts_ext instead. remember put trailing , leading spaces, like: export java_opts_ext=" -duser.timezone=gmt "

c - Repercussions of storing a 5 digit integer as a 16bit float -

i working data can have large number values , data important. the highest number seen "89,482". going use unsigned int. however using these numbers in usigned int format causing headaches, namely manipulating them in opengl shaders. basically things lot simpler if use float instead. however don't understand repercussions of storing number floating point. in opengl case don't have choice of storing single channel 32 bit floating point texture, 16bit. for 16bit float wikipedia states: precision limitations on integer values integers between 0 , 2048 can represented integers between 2049 , 4096 round multiple of 2 (even number) integers between 4097 , 8192 round multiple of 4 integers between 8193 , 16384 round multiple of 8 integers between 16385 , 32768 round multiple of 16 integers between 32769 , 65519 round multiple of 32 integers equal or above 65520 rounded "infinity". so quite mean i

jena - SPARQL Queries with SimpleTcProvider -

i'm new jena, clerezza, , osgi you'll forgive ignorance... i'm trying use apache stanbol make general enhancement engine takes string parameter sparql query , works on enhancements produced enhancement chain far. use jenasparqlengine , simpletcprovider create tcmanager can execute sparql queries strings on metadata of content item. works fine read queries, when try use update queries parser exceptions. i'm guessing have use (jena) updateaction perform update operations. can still use simpletcprovider? should use fuseki? if have examples appreciated! found it. works singletdbdatasettcprovider.

objective c - What is the best way to avoid duplicate symbols in project that will use my iOS framework and one of the dependencies? -

Image
here quotation other post : i'm working in ios project includes static library created company. library include old version of afneworking , don't have source files. now need use more recent (and less bugged) version of afneworking, cannot include same class twice in project (of course) because "duplicate symbols" my problem i'm preparing ios framework , i want avoid kind of situation in future. i'm not talking afnetworking, other quite popular ios framework. in addition applied custom changes in original framework code . the 1 way avoid "duplicate symbols" , "class x implemented in both y , z. 1 of 2 used" comes mind add prefix original framework classes, right solution? update 1: i tried apply john's solution no joy. have created simplified project ( here link repo ) 2 classes frameworkclass present in framework target only, , sharedclass present in both framework , application targets, maybe can see if i'

node.js - Sequelize Migration Error -

i'm using sequelize 2.0.0-rc3 , there's error i'm encountering; seems i'm writing migration correctly i'm getting error trying run it. i'm using postgresql on backend. seems working fine; new, isolated issue. document table , id column exists (created in previous migration, discovered it's not auto-incrementing id's; tried creating migration add auto-incrementing). var p = require('bluebird'); module.exports = { up: function (migration, datatypes, done) { var promises = []; promises.push( migration.changecolumn( 'document', 'id', { type: datatypes.integer, primarykey: true, autoincrement: true, allownull: false } )); p.all(promises).then(done.bind(null, null)).catch(function (err) { console.error('migration failed: