Posts

Showing posts from February, 2015

How does Solaris SMF determine if something is to be in maintenance or to be restarted? -

i have daemon process wrote being executed smf. problem when error occurs, have fail code , need restart scratch. right sending sys.exit(0) (python), smf keeps throwing in maintenance mode. i've worked smf enough know auto-restarts services (and lets others fail , have deal them this). how classify process 1 needs auto-restart? smf setting, method of failing, what? presuming normal service manifest, suspect you're dropping maintenance because smf is restarting "too quickly" (which bit arbitrarily defined). svcs -xv should tell if case. if is, smf restarting you, , you're exiting again rapidly , it's decided give until problem fixed (and you've manually svcadm clear 'd it. i'd wondered if exiting 0 (and indicating success) may cause further confusion, doesn't appear will. i don't think oracle solaris allows tune smf considers "too quickly".

Java constructor undefined -

basically, doing java exercise in book , source code answer exercise. however, eclipse says there error @ third line bottom, saying "- constructor phonenumber() undefined". understand, specific constructor defined correctly problem? public class phonenumber { // relevant source codes posted here. // removed other bits cause i'm sure not responsible // error private char[] country; private char[] area; private char[] subscriber; public phonenumber(final string country, final string area, final string subscriber) { this.country = new char[country.length()]; country.getchars(0, country.length(), this.country, 0); this.area = new char[area.length()]; area.getchars(0, area.length(), this.area, 0); this.subscriber = new char[subscriber.length()]; subscriber.getchars(0, subscriber.length(), this.subscriber, 0); checkcorrectness(); } private void runtest() { // method body...

objective c - Limiting the visible dates in UIDatePicker -

is there way limit date range in uidatepicker? i'm aware of maximumdate , minimumdate properties i'd limit minimum year visible 2010. don't want user able see years before 2010. ideas? i don't believe possible uidatepicker, achieve own uipickerview, making sure implement uipickerviewdelegate method, pickerview:didselectrow:incomponent: in order deal bad dates, february 30th, (to mimick behaviour of uidatepicker).

ssl - How to achieve some measure of "privilege separation" with Java web-server? -

i'm trying proactive around security on jetty web-server boxes -- especial regards storing ssl key information although i'd generic solution. apache uses privilege separation starts root can read protected ssl key files (and other secure configuration) , switches common user server http requests. java has no mechanism doing this. any recommendations around how achieve same level of security in java web application? requires include: secret information should readable root. any passwords unlock keys , should not configured code same user level permissions server can't them easily. i'm running under amazon ec2 want security automatic possible -- i.e. no interactive password entering operators. one possibility use ~ldap separate secret information application , bake ldap access username/password application. i'm looking better solution. thanks information. edit: i'd hoped solutions covered ssl took account other secrets wanted limit access...

objective c - How to filter an object array using another array to define which objects to filter out -

in xcode, have database request online sql database , can stored array or nsdictionary or other type. separately, array of numbers generated in app correspond 1 of columns of database. i want filter database show objects involved generated array. once filtered, want list results in string. database online server can stored in nsarray or nsdictionary if need be, , other formats don't know about. the procedure this: database array: generated array: resultant array after filtering database: id | name id filterednames | 1a | hannah 1a hannah 2a | john 1b steve 3a | peter 2b zara 1b | steve 2b | zara 3b | kyle the resultant array "filterednames" converted string list follows: namesstring = @"hannah, steve, zara" i plan pass namesstring label follows: label.te...

Custom Screen for JIRA -

i have several steps in workflow want user able see additional fields , edit fields. there way have different screens different workflows? not transitions, steps themselves. instance, have analysis step, need add additional information issue. the behaviours plugin can make fields readonly, hidden etc based on different statuses such analysis in workflow https://marketplace.atlassian.com/plugins/com.onresolve.jira.plugin.behaviours

java - Binding HashMap<String, String> to MutableTreeNode -

i need bind hashmap mutabletreenode can display in jtree . i have following code: static map<string, string> form = new linkedhashmap<string,string>(); i guess how need implement mutabletreenode . don't know how procees key's of "form" show in mutabletreenode . public class mynode implements mutabletreenode { @override public enumeration children() { // todo auto-generated method stub return null; } @override public boolean getallowschildren() { // todo auto-generated method stub return false; } @override public treenode getchildat(int childindex) { // todo auto-generated method stub return null; } @override public int getchildcount() { // todo auto-generated method stub return 0; } @override public int getindex(treenode node) { // todo auto-generated method stub return 0; } @override public...

Can I use Firebase simple login to access Twitter API? -

it's easy simple login working twitter, , that's big bonus, wondering whether it's possible take authentication credentials , post tweet, list of people they're following, use full twitter 1.1 api. i.e. can hold of access token key , secret? thanks, dave. the firebase simple login javascript client returns both twitter access token , access token secret in response payload twitter authentication. you can access each of these via user object, under attributes accesstoken , accesstokensecret shown below: var firebaseref = new firebase('https://<my-firebase-name>.firebaseio.com'); var authclient = new firebaseauthclient(firebaseref, function(error, user) { if (user) { var accesstoken = user.accesstoken, accesstokensecret = user.accesstokensecret; } }); ... // sample jquery click event. $mybutton.on('click', function(event) { authclient.login('twitter'); });

laravel - Getting started with chef, and running composer install on deploy -

we're looking deploy few laravel4 based php apps on amazon opsworks, requires few things: grab code git download composer.phar getcomposer.com run php composer.phar install change permissions on few specific folders i'm fresh comes chef, looking place grips basics of chef, , how achieve tasks above, appreciate pointers. i'm no chef guru (i use puppet) try following: grab code git you may want execute wget command (see examples below). if want more sophisticated see http://docs.opscode.com/resource_deploy.html deploy_revision "/path/to/application" repo 'ssh://name-of-git-repo/repos/repo.git' migrate false purge_before_symlink %w{one 2 folder/three} create_dirs_before_symlink [] symlinks( "one" => "one", "two" => "two", "three" => "folder/three" ) before_restart # ruby code end notifies :restart, "service[foo]" ...

sql - Why am I getting "Ambiguous column name" in this query? -

i have following query: $sql = "select * employee emp left join tr_bls_date bls on emp.employee_id=bls.employee_id , employee_id='".$id."'"; basically, both emp , bls tables have common employee_id field. looking employee via employee's id ( $id ). doing wrong here? because there 2 tables contains employee_id , server confused search. fix problem, add source table, eg. on emp.employee_id = bls.employee_id , emp.employee_id = ? // search on table employee

python - breaking while loop with function? -

i trying make function has if/elif statement in it, , want if break while loop.. function text adventure game, , yes/no question. here have come far.. def yn(x, f, g): if (x) == 'y': print (f) break elif (x) == 'n' print (g) name = raw_input('what name, adventurer? ') print 'nice meet you, '+name+'. ready adventure?' while true: ready = raw_input('y/n ') yn(ready, 'good, let\'s start our adventure!', 'that real shame.. maybe next time') now i'm not sure if using function right, when try out, says can't have break in function. if me problem, , if me if function , calling function formatted wrong, appreciated. you can work exception: class adventuredone(exception): pass def yn(x, f, g): if x == 'y': print(f) elif x == 'n': print(g) raise adventuredone name = raw_input('what name, advent...

c# - How to prevent listView on escalating columns and bind it to ViewModel? -

Image
i have c# wpf listview generates columns base on date range.. how prevent escalating columns? how cant mange single instance on generating columns? and how can bind on view model? is issue each time click "generate" button appends columns? if case thing should adding is private void createcolumns() { myview.columns.clear(); //... } to beginning of createcolumns method.

How to display specific row in Access -

if have table primary key 'id', , have other data in columns, (let's example: name, address, phonenum) how can make query displays name, address , phonenum (the whole row) vertically specific id? if needed can post picture trying explain mean. thanks! :) for sample data in table called [clients] id lastname firstname email -- -------- --------- ----- 1 thompson gord gord@example.com 2 loblaw bob bob@example.com 3 kingsley hank hank@example.com the query select "lastname" fld, lastname val clients id=1 union select "firstname" fld, firstname val clients id=1 union select "email" fld, email val clients id=1; returns fld val --- --- lastname thompson firstname gord email gord@example.com

Dynamic gadget size (Google Apps Script) -

i have created gadget (10 treeitems content) using google apps script. after created 10 treeitems content, realise have manually set size of gadget 7000 pixels in order display content (if expand treeitems). may know there way/ possible make size of gadget flexible/dynamic based on action taken (e.g. : size of gadget change when treeitems expanded )? instead of resizing gadget, why not add tree scroll panel, don't think matter how big tree gets because users can use scroll bars view it. function doget(e) { var app = uiapp.createapplication(); var tree = app.createtree(); var scroll = app.createscrollpanel(tree).setwidth(800); //add items tree app.add(scroll); return app; }

ruby on rails - Redirect works but render fails on the same path for my comment system -

hello guys~ i'm kind of new rails here. , have controler in create action, failed creation comment direct "template missing". wonder how solve since success working alright same path ... thank much~ def create @book = book.find(params[:book_id]) @comment = @book.comments.build(params[:comment]) if signed_in? @comment.user = current_user if @comment.save flash[:success] = "comment posted" redirect_to book_path(@book) else render book_path(@book) end end routes resources :books resources :comments, only: [:create, :destroy] end use render :show . render not accept url this. accepts name of template rendering, among other things. check out documentation more examples of can pass render .

How to calculate the value of string in mysql -

Image
i have store procedure in mysql, in query string @str = 5*2+1 want calculate string , return number. in sql server can exec ('select'+ @str) , returns 11 thanks you can use following, careful sql injection when using dynamic queries: prepare stmt1 'select 5*2+1'; execute stmt1; deallocate prepare stmt1; using code example, try (be careful sql injection!) set @calc = concat('select ', '5*2+1', ' result'); prepare stmt1 @calc; execute stmt1; deallocate prepare stmt1;

c++ - casting object addresses to char ptrs then using pointer math on them -

according effective c++, "casting object addresses char* pointers , using pointer arithemetic on them yields undefined behavior." is true plain-old-data? example in template function wrote long ago print bits of object. works splendidly on x86, but... portable? #include <iostream> template< typename type > void printbits( type data ) { unsigned char *c = reinterpret_cast<unsigned char *>(&data); std::size_t = sizeof(data); std::size_t b; while ( i>0 ) { i--; b=8; while ( b > 0 ) { b--; std::cout << ( ( c[i] & (1<<b) ) ? '1' : '0' ); } } std::cout << "\n"; } int main ( void ) { unsigned int f = 0xf0f0f0f0; printbits<unsigned int>( f ); return 0; } it not portable. if stick fundamental types, there endianness , there sizeof, function print different results on big-endian machines, or on...

mysql - Issue java.lang.Exception: Lock wait timeout exceeded; try restarting transaction -

when try run code have mistake: java.lang.exception: lock wait timeout exceeded; try restarting transaction. have see inoodb status , this. how can translate language know?. how can modify time innodb variable?. thanks mysql> show engine innodb status\g | innodb | | ===================================== 130117 13:25:22 innodb monitor output ===================================== per second averages calculated last 19 seconds ---------- semaphores ---------- os wait array info: reservation count 5, signal count 5 mutex spin waits 0, rounds 40, os waits 2 rw-shared spins 6, os waits 3; rw-excl spins 0, os waits 0 ------------ transactions ------------ trx id counter 0 46088 purge done trx's n:o < 0 45663 undo n:o < 0 0 history list length 5 list of transactions each session: ---transaction 0 0, not started, process no 20582, os thread id 139811275994880 mysql thread id 39, query id 169 localhost root show engine innodb status ---transaction 0 46087, active 8 sec...

Kendo dropdown width -

hi can tell me how set width kendo dropdown? here code sample , not working. wrong in that? $("#div1").kendodropdownlist({ datasource: items, datatextfield: "name", datavaluefield: "id", width : "250px" }); the kendodropdownlist not have property width it's configuration. see here: kendo docs what can do, styling correct class. since know dropdown lies, can specify selector doesn't apply dropdowns. #mycontainer .k-dropdown { width: 250px; }

Error Initialize ManagedBean with Spring JSF 2.0 Hibernate Maven -

i working jsf 2.0 , spring, hibernate , i'm having problem initialization of managedbean. here error: severe: error rendering view[/cadastrodeprodutoadminsistemas.xhtml] com.sun.faces.mgbean.managedbeancreationexception: não é possível criar instância para·a classe: com.catalogor3e.controller.pesquisasistemasadminbean. @ com.sun.faces.mgbean.beanbuilder.newbeaninstance(beanbuilder.java:193) @ com.sun.faces.mgbean.beanbuilder.build(beanbuilder.java:102) @ com.sun.faces.mgbean.beanmanager.createandpush(beanmanager.java:409) @ com.sun.faces.mgbean.beanmanager.create(beanmanager.java:269) @ com.sun.faces.el.managedbeanelresolver.resolvebean(managedbeanelresolver.java:244) @ com.sun.faces.el.managedbeanelresolver.getvalue(managedbeanelresolver.java:116) @ com.sun.faces.el.demuxcompositeelresolver._getvalue(demuxcompositeelresolver.java:176) @ com.sun.faces.el.demuxcompositeelresolver.getvalue(demuxcompositeelresolver.java:203) @ org.apache.el.parser.astidentifier.getvalue(a...

jquery - How to solve the overlapping when appending number with two table or element? -

when click on button both table randomly,the number not following sequence on own table.this main issue on question.thank. html code: <table width="600px" id="project"> <tr> <td>1</td> <td><textarea name="pro_1" cols="100" rows="2"></textarea></td> </tr> <tr> <td>2</td> <td><textarea name="pro_2" cols="100" rows="2"></textarea></td> </tr> <tr> <td>3</td> <td><textarea name="pro_3" cols="100" rows="2"></textarea></td> </tr> <tr> <td>4</td> <td><textarea name="pro_4" cols="100...

networking - how to handle the network requst in android -

i want draw requested online,then core implement(draw logic ommitted): public abstract class abstractbasicdatahandler extends abstracthandler{ private dataprovider tp = new dataprovider(); @override protected void onreadytodraw(canvas c,int params) { byte[] data = tp.getdrawabledata(params); dorender(c, data); } protected abstract void dorender(canvas c, byte[] data); } the abstractbasicdatahandler job of data requesting,then sub class of abstractbasicdatahandler focus on rendering work this: public class anyclass extends abstractbasicdatahandler{ @override dorender(canvas c, byte[] data){ //render according data } } however question data requesting time-consumed work means data may noe returned immedirately. so experience meet kind of requirements? yes can use asynctask perform network operation in doinbackground() , perform ui operation in postexecute() .

r - Specify different types of missing values (NAs) -

i'm interested specify types of missing values. have data have different types of missing , trying code these values missing in r, looking solution can still distinguish between them. say have data looks this, set.seed(667) df <- data.frame(a = sample(c("don't know/not sure","unknown","refused","blue", "red", "green"), 20, rep=true), b = sample(c(1, 2, 3, 77, 88, 99), 10, rep=true), f = round(rnorm(n=10, mean=.90, sd=.08), digits = 2), g = sample(c("c","m","y","k"), 10, rep=true) ); df # b f g # 1 unknown 2 0.78 m # 2 refused 2 0.87 m # 3 red 77 0.82 y # 4 red 99 0.78 y # 5 green 77 0.97 m # 6 green 3 0.99 k # 7 red 3 0.99 y # 8 green 88 0.84 c # 9 unknown 99 1.08 m # 10 refused 99 0.81 c # 1...