Posts

Showing posts from March, 2013

groovy - Base64Encode for AWS not matching Amazon Example -

i seem failing @ first hurdle in quest amazon s3 browser-based uploads. using amazon's example shown here : http://docs.aws.amazon.com/amazons3/latest/api/sigv4-post-example.html using groovy/java, i'm unable encode example post policy , produce same encoding amazon. { "expiration": "2015-12-30t12:00:00.000z", "conditions": [ {"bucket": "sigv4examplebucket"}, ["starts-with", "$key", "user/user1/"], {"acl": "public-read"}, {"success_action_redirect": "http://sigv4examplebucket.s3.amazonaws.com/successful_upload.html"}, ["starts-with", "$content-type", "image/"], {"x-amz-meta-uuid": "14365123651274"}, {"x-amz-server-side-encryption": "aes256"}, ["starts-with", "$x-amz-meta-tag", ""], {"x-amz-credential": &

printing - How to print out a line in a textfile into 2 different lines on console Java -

public static faq_alisa_qna[] oipreadquestion(){ string questiona1,thisuser; int indexquestion; string [] entrydetails; faq_alisa_qna [] entries = new faq_alisa_qna[100]; //read file = "activities.txt". file file = new file ("readoip.txt"); int count = 0; try{ scanner sc = new scanner(file); //do while there next line in file. while(sc.hasnextline()){ string line = sc.nextline(); entrydetails = line.split(";"); // index = entrydetails[0]; indexquestion = integer.parseint(entrydetails[0]); thisuser = entrydetails[1]; questiona1 = entrydetails[2]; //object store values of entry. faq_alisa_qna = new faq_alisa_qna(); // a.index = integer.parseint(index); a.indexquestion

mongodb - mongo: ERROR: child process failed, exited with error number 100 -

i created replica set of 3 instances on mongodb. each member of replica set instantiated using config file. when tested it, went well, , executed without errors. the next step, generating error in title enable internal authentication. in order that, followed mongo documentation found in page: [a] https://docs.mongodb.com/v3.0/tutorial/enable-internal-authentication/ first, generated keyfile using 2 lines of code below openssl rand -base64 755 > <path-to-keyfile> chmod 400 <path-to-keyfile> i couldn't exeucte lines without being root did using root. then added keyfile inside instance's config file. # , how store data. storage: dbpath: /mon/data1/ journal: enabled: true #engine: #mmapv1: #wiredtiger: #where write logging data. systemlog: destination: file logappend: true path: /var/log/mongodb/mongod1.log #network interfaces net: port: 27018 bindip: 127.0.0.1 processmanagement: fork: true security: keyfile: /etc/keyfiles re

c# - How to implement MVVM with the WPF treeview? -

i haven't worked wpf or mvvm pattern before. want create simple document management system , using aforementioned technologies. i've modeled hierarchical file system in database , want display in treeview. eer-diagramm can see each directory can have multiple sub-directories , multiple files in it. i've read tutorials on topic , if understood them correctly should create model classes directory , file in data database stored directly. example: public class directory { private int id; public int id { { return id; } set { id = value; } } private string name; public string name { { return name; } set { name = value; } } private int parent; public int parent { { return parent; } set { parent = value; } } private datetime datecreatedon; public datetime datecreatedon { { return datecreatedon; } set { datecreatedon = value; } } } then

C++ : Connecting a member of a class to its definition -

i'm new c++, have more experience in ocaml , python. want learn c++ making program playing "morpion solitaire". beginnings bit difficult. in following code : typedef enum {north, northeast, east, southeast} direction; char deltax[4] = { 0, 1, 1, 1}; char deltay[4] = { 1, 1, 0, -1}; class coords { private: char x,y; public: coords(char xx,char yy){ x = xx; y = yy; }; char get_x() const { return x;} char get_y() const { return y;} }; class line { private: coords orig; direction dir; coords newcross; public: line(char x1, char y1, direction d, char x2, char y2) { orig = coords(x1,y1); dir = d; newcross = coords(x2,y2); }; coords nthpoint(char n) { char x,y; x = orig.get_x() + n*deltax[dir]; y = orig.get_y() + n*deltay[dir]; return coords(x,y); }; }; the compiler tells me : nico@gaston:~/travail/cplusplus/morpion++$ g++ -c morpion.cc morpion.cc: in constructor ‘line::line(char, char, direct

php - MacOS X Yosemite Apache localhost ERR_CONNECTION_REFUSED -

i'm trying hand @ html , php. goal create password protected site gets gif-images server , displays them in table. nothing fancy. work tried php. test locally (i don't have server anyway) set localhost described here: https://ole.michelsen.dk/blog/setup-local-web-server-apache-php-osx-yosemite.html . everything worked well, no problems whatsoever. tried setup password protection local site. created .htaccess file , saved in site-directory content: authtype basic authname "restricted area" authuserfile htpasswd require valid-user then created .htpasswd in same directory , manually inserted user/password generated here: http://www.web2generators.com/apache-tools/htpasswd-generator . i saved both files , refreshed page. prompted enter username , password entered. since message in browser localhost refused connection "err_connection_refused". now can't access localhost anymore. same error occurs. tried restart apache. tried restarting computer.

licensing - Licence for Excel Add-In -

i've worked colleagues on excel add-in sell our customers. linked cloud database. licensing system coded in vba, that's pretty weak , potential hackers getting around vba protection able disable licence checking (code protection not such problem such). we have been thinking of developing .dll file check licences, lack of expertise in field. do have suggestions? others can post .net licencing solutions.... from years microsoft component object model (com) have licence system. 1 writes code in c++ , clients use com instantiate component. com licence mechanism implement iclassfactory2 instead of iclassfactory here link https://msdn.microsoft.com/en-us/library/windows/desktop/ms680095(v=vs.85).aspx now may "but code in vba!?". well, vba not secure, workbooks can broken into. problem source shipped inside. compiling .net solution better executable intermediate language (il) can reverse engineered source. same problem java, 'byte code&#

Google drive python api: export never completes. -

summary: i have issue google-drive-sdk python not detect end of document being exported. seems think google document of infinite size. background, source code , tutorials followed: i working on own python based google-drive backup script (one nice cli interface browsing around). git link source code its still in making , finds new files , downloads them (with 'pull' command). to important google-drive commands, followed official google drive api tutorials downloading media. here what works: when document or file non-google-docs document, file downloaded properly. however, when try "export" file. see need use different mimetype. have dictionary this. for example: map application/vnd.google-apps.document application/vnd.openxmlformats-officedocument.wordprocessingml.document when exporting document. when downloading google documents documents google drive, seems work fine. mean: while loop code status, done = downloader.next_chunk() eventual se

Ruby While Loop -

i created program in ruby: print "grandma: something: " while user_input = gets.chomp #loop while getting user input case user_input when user_input.upcase puts "no, not since! " + rand(1930..1950).to_s break when user_input = 'bye' puts "good bye!" break else puts "huh?! speak up, now!" print "grandma: something: " end end this user input , when user type upcase or bye exit program. now issue here need change program when bye 3 times in row time exit program , not once. how can modify program that? you need counter that's initialized outside loop, , you'll break once counter reaches 3. i've fixed case expression well. if case on user_input , don't need compare user_input in when . this should trick: print "grandma: something: " bye_count = 0 while user_input = gets.chomp case user_input when user_input.upcase puts "no, not

Visualize RDF in Cytoscape.js? -

i visualize rdf graph using convoluted process of sparql query -> csv export -> import cytoscape desktop -> export json -> import cytoscape.js. there way of directly visualizing rdf graphs in cytoscape.js, example plugin similar rdfscape cytoscape desktop? write small module using node.js. load data database (probably using module from npm ), , convert data cytoscape.js json format in node.js module. (you can load data directly cytoscape.js on node.js headlessly if want.) this should automate conversion process.

c# - OData EnableQuery is not working in production -

i have odata function return collection of entity set(user) below [httpget, odataroute("gettopusers(userid={userid})")] [enablequery(allowedqueryoptions = allowedqueryoptions.top)] public ihttpactionresult gettopusers(int? userid) { ilist<user> users = new list<user>() { new user() { id=1, name ="first" }, new user() { id=2, name ="second" }, new user() { id=2, name ="third" } }; return ok(users); } but when invoked function productionurl/gettopusers(userid={userid})?$top=1 it return users meaning not applying top query same working in development environment. am missed anything? idea helpful. i updated packages of microsoft.aspnet.odata => 5.9.1 microsoft.aspnet.webapi.odata => 5.7.0

git - Ionic framework version mission -

when typed ionic-info , missing ionic framework version else showing. know why so. related or not, apps built on teammates machine worked (he had ionic framework version) when same app built on mine, showed white screen ionic info should give system info regarding environment , cli $ ionic info your system information: cordova cli: 5.1.1 gulp version: cli version 3.9.0 gulp local: local version 3.9.0 ionic cli version: 1.6.1 ionic app lib version: 0.3.3 ios-deploy version: 1.7.0 ios-sim version: 3.1.1 os: mac os x yosemite node version: v0.12.5 xcode version: xcode 6.4 build version 6e35b but although ionic framework version doesn't affect running of application in cases must plugin issues or read article how debug white screen of death in ionic app https://gonehybrid.com/how-to-debug-the-white-screen-of-death-in-your-ionic-app/ can check getting errors in console? you can debug in chrome or in safari

css - Margin sizes changing per page when printing html (IE 8-11) -

Image
i have user generated report page printed off, has bizarre bug 1 internet explorer. page set tables within series of divs appear on website @ same sizes , formats, when printing ie each page "shrinks" little more. may margins growing, relative font size , proportions of table seem accurate in shrink pages. have tried disabling shrink fit option, did not help. has run similar bug? have been searching while of related problems' fixes have not helped. looked in page, think causing shrinking of page space @ end of page.

Stored procedure to insert data into Postgresql -

i have following stored procedure or function defined in postgresql database: create or replace function insert_val(int) $body$ begin in 1..10 loop insert test (val) values($23); end loop; end; $body$ language 'plpgsql' volatile; i want insert data inside of loop, error: syntaxfehler bei »begin« is maybe missed in function? i don't understand error message since it's not in english, can see few problems in code create or replace function insert_val(in val int) returns void $body$ begin in 1..10 loop insert test (val) values($23); end loop; end; $body$ language 'plpgsql' volatile; you missing return type, missing as , have forgotten name in argument.

python - theano.scan: Non-unit value on shape on a broadcastable dimension -

i developing simple program uses theano.scan function loop through array of vectors (in end, intend develop lstm layer program). problem error non-unit on shape of broadcastable dimension when compiling function. believe updates param cause because long put there compile function, error occur. here code: import theano import theano.tensor t utils import * import numpy np class lstm: def __init__(self, x, in_size, out_size): self.x = x self.in_size = in_size self.out_size = out_size self.w_x = init_weights((in_size, out_size), "w_x") def _active(x, pre_h): x = t.reshape(x, (1, in_size)) pre_h = t.dot(x, self.w_x) return pre_h h, updates = theano.scan(_active, sequences=x, outputs_info = [t.alloc(floatx(0.), 1, out_size)]) self.activation = h if __name__ == "__main__": x = t.matrix('x') in_size = 2 out_size = 4 lstm = lstm(x

InvocationTargetException for ClassLoaders.callStaticFunction Java Eclipse -

Image
i have created program convert text xml using reversexsl api. this program executed application calling static method ( static int transformxsl ). i able execute , produce output running eclipse. however, when ran program (jar) using application stuck somewhere , couldnt find anything. then, debugged "debug as...-> remote java application" in eclipse application , found "invocationtargetexception" @ classloaders.callstaticfunction. below static method called application. public class mytest4 { public mytest4() { } public static int transformxsl(string deffile, string inputfile, string xslfile, string outputfile) { system.out.println("dheeraj's method called"); // start time filewriter fw=null; try { fw = new filewriter("d://countime.txt"); } catch (ioexception e1) { // todo auto-generated catch block e1.printstacktrace(); } bufferedwriter output=new buffere

javascript - Webpack does not compress the files enough -

this webpack config use development , production modes; let debug = process.env.node_env !== 'production'; import webpack "webpack"; import livereloadplugin "webpack-livereload-plugin"; import webpacknotifierplugin "webpack-notifier"; import validate "webpack-validator"; import failplugin "webpack-fail-plugin"; import autoprefixer "autoprefixer"; let loaders = [ {test: /\.tsx?$/, loader: 'ts', exclude: /(node_modules)/}, { test : /\.js?$/, exclude: /(node_modules)/, loader : 'babel', // 'babel-loader' legal name reference query : { presets : ['es2015'], cachedirectory: true } }, { test : /\.(eot|ttf|wav|mp3|png|jpg|jpeg|gif|svg|woff|woff2)$/, loader: 'url-loader', }, { test : /\.scss$/, loaders: [ "style-loader",

java - Remove unused resources from Android app on compile time -

i trying remove unused graphical resources app in compile time. know android studio can me manually remove unused ones, need able remove them in compile time; way, can run proguard remove unused classes, , remove images referenced classes. right can this, gets me unused image shrunk 1x1 black dot: android { buildtypes { release { minifyenabled true shrinkresources true } } } i can't have files there (even shrunk). there way make proguard remove images (instead of shrink them) or rename them? maybe use other tool? edit: clarification, need resources rendered "unused" proguard removed or renamed. proguard (or new jack compiler) shrink , obfuscate bytecode. resource shrinking tool subsequently removes or replaces unused resource files. proguard's commercial extension dexguard shrinks, optimizes, , obfuscates bytecode, android manifest, resources, resource files, asset files, , native libraries. far i

python - Error NoReverseMatch -

i keep running in noreversematch error on django 1.10, while earlier versions have no problems it. rendered template: {% extends "loginbase.html" %} {% block content %} <h1>login:</h1> <form class="form-horizontal" role="form" method="post" action="{% url 'django.contrib.auth.views.login' %}"> {% csrf_token %} {% if form.errors %} <p>your username , password didn't match. please try again.</p> {% endif %} urls.py url(r'^login/$', views.login, {'template_name': 'login.html', 'authentication_form': loginform}, name='login'), any ideas on problem might be? in django 1.10, you can no longer reverse urls using python dotted path , e.g. ' django.contrib.auth.views.login '. you have name='login' in url pattern, url(r'^login/$', views.login, {...}, name='login'), so use in url tag: {% u

To compare the two tables in Oracle database -

i have 2 table below: table_1 customer order ---------------------- david pizza david cola jack milkshake michael pizza michael milkshake alan cola alan pizza table_2 customer order ---------------------- david pizza david cola jack milkshake michael pizza michael milkshake alan milkshake alan pizza i have code (i wrote request instead of order): t (select customer ,row_number() over(partition customer order "order" desc) order_no ,"order" ,count(*) over(partition customer) order_cnt table_1) select customer, order1, order2, order3, order_cnt "counts of orders" t pivot (max("order") order_no in(1 order1, 2 order2,as order3)) order customer; it making this: table_1 customer order1 order2 order3 counts of orders ----------------------------------------------------------- david pizza

mysql - Foreign key constraint not being implemented -

i trying create foreign key between following 2 tables: student: id (pk, not null, unique, ai) student_number (not null, unique) ... (other columns no constrains) and project: id (pk, not null, unique, ai) student_number(not null) ... (other columns no constrains) the syntax using : alter table project add constraint fk_project_student foreign key (student_number) references student (student_number) on delete cascade on update cascade; however following: error 1452 (23000): cannot add or update child row: foreign key constraint fails in case ask, there no team projects, simple 1 -to - many relationship. you have records not meet foreign key constraint. find them using select project.student_id project left join student on project.student_number = student.student_number student.student_number null

ios - Amazon Cognito - Convert Guest user identity as Authenticated user -

i using amazon cognito service in xamarin ios application have feature user login guest , using facebook account. facebook login feature working great, want add option guest user convert guest account facebook authenticated account. i have added user history dynamodb table according user identity id both guest , facebook authenticated user. when guest account converted facebook authenticated account, need identity id same. possible? currently have sync guest information without calling credential.addlogin(provider,token); this creates unauthenticated identity , stores info. i thought without clearing identity cache, if try login using facebook, identity merged authenticated identity. not happening. how can achieve this? have seen this page ? specifically, have tried doing this? cognitoawscredentials credentials = new cognitoawscredentials ( "identity_pool_id", // cognito identity pool id regionendpoint.useast1 // region ); ... credential

javascript - how to remove text boxdiv on click button -

<img id="plusicondiv" class="rose" src="images/pluseicon.svg" /> <div id="plusicondivbox"class="insidediv " style="margin-top:-53px;" > <img class="mynasicondiv" src="images/mynas.svg" /> </div> i have 2 icons 1 plusbutton anther mynasbutton want add image , textbox onclick plusbutton icon , when click mynasbutton remove corresponding textbox , image. $(function () { $('.rose').on('click', function () { var textbox = '<input type="text" class="textbox"/>'; var = $(this).attr("id");alert(a) $('#'+a+"box").append(textbox); var img = '<img class="mynasicondiv" src="vectorimages/mynas.svg"

php - Laravel 4.2 validation: required_unless -

recently have been learning laravel , came accross validator problem solved using validator rule required_unless laravel 5.2 : $validator = validator::make( array( 'social_id' => $social_id, 'login_by' => $login_by ), array( 'social_id' => 'required_unless:login_by,manual', 'login_by' => "in:manual,google,facebook, stack_exchange, myspace" ) ); problem use laravel 4.2 , validation rule not implemented jet. is there other validating rule use or other way? if not, how write custom validation rule , put it? edit: do: $validator = validator::make( array( 'social_id' => $social_id, 'login_by' => $login_by ), array( 'social_id' => 'required_if:login_by,google,facebook, stack_exchange, myspace', 'login_by' => "in:manual,google,facebook, stack_exchange, myspace" ) );

and clause in cql cassandra -

i have created table schema create table iplocation ( "idiplocation" uuid, "fromip" bigint, "toip" bigint, "idcity" uuid, "idcountry" uuid, "idprovince" uuid, "isactive" boolean, primary key ("idiplocation", "fromip", "toip") ) and inserted records in it! want fetch record this select * iplocation "toip" <= 3065377522 , "fromip" >= 3065377522 allow filtering; but giving me error of a column of clustering key can restricted if preceding 1 restricted equal relation. need restrict fromip before restrict toip. but if want just select * iplocation "toip" <= 3065377522 allow filtering; it still says column of clustering key can restricted if preceding 1 restricted equal relation. need restrict fromip before restrict toip. i cant figureout whats problem? your misusing partition key co

MATLAB struct conversion error -

i have 5 different structure , want calculate variables of them. that, wrote following code: for i=1:5 [structurei(i), reqtab(i), jt(i), b(i)]=checkall(e); end the values structurei, reqtab, jt , b calculated in function , structurei= 1x4 matrix, reqtab= 4x2 matrix, jt=2x1 matrix, b=4x4 matrix when run code calculates varibles in function checkall. however, when turns parent code, gives , error "conversion double struct not possible." how can solve problem? thanks in advance. you cannot assign directly double struct, instead have write specific field field_name assign to: [structurei(i).field_name, reqtab(i), jt(i), b(i)] = checkall(e); if of these variables (i.e. reqtab , jt , b ) structures, off course need specify field in each 1 of them, using . notation. however, mentioned in comments, iterations of loop same (no usage of i within it), why need loop? make 5 copies?

maven - Android:gradle I am unable to publish aar to local repository -

i creating library project in android studio. android studio implicitly supports gradle build terminologies. i want publish library project local maven repository can use in other projects. (i have option create library in same application want distribute library) i took this link link able publish below 3 files maven-metadata-remote.xml maven-metadata-remote.xml.sha1 resolver-status.properties i still not able publish aar file local maven repo 1. has thing application's build.gradle? 2. missing build aar file in library's build.gradle file? (though aar file getting built in outputs folder) this library's build.gradle apply plugin: 'com.android.library' android { compilesdkversion 23 buildtoolsversion "23.0.3" defaultconfig { minsdkversion 15 targetsdkversion 23 versioncode 1 versionname "1.0" } buildtypes { release { minifyenabled false

php - Mysql data backup converted to string -

note: main thing want know how stop converting integers , bits string using php. dont want use mysqldump many servers not giving access shells , had tested it. thats why, using php i taking backup of datbases on live server reference link https://davidwalsh.name/backup-mysql-database-php problem when open file backup, saw whole data converted in string. so, lets have null in date field, gets converted making date 0000-00-00, bit value 0 converts 1. i used mysqldump , has issues put on other question: mysqldump working on local not on godaddy server the function using follows: function export_database($host,$user,$pass,$name, $tables, $backup_name=false ) { $mysqli = new mysqli($host,$user,$pass,$name); $mysqli->select_db($name); $mysqli->query("set names 'utf8'"); foreach($tables $table) { $result = $mysqli->query('select * '.$table); $fields_amount

c# - How to show multiple fields in combo box when using linq to sql? -

i have database of rice types , prices. has 3 fields: fld_ricetype , fld_riceid , fld_riceprice . want show database in combobox. used code below: cmbrice.displaymember = "fld_ricetype"; cmbrice.valuemember = "fld_riceid"; cmbrice.datasource = rnlq.tbl_rices.orderby(c => c.fld_ricetype).select(c => c); i want change cmb.displaymember show fld_ricetype + fld_riceprice . how can this? fld_ricetype nvarchar(50) fld_riceprice varchar(50) i not sure if work try orderby(c => c.ricetype).select(c => new { riceid = c.riceid, ricetype = c.ricetype, riceprice = c.riceprice, displayvalue = c.ricetype + ": " + c.riceprice }) and ofcourse use displayvalue displaymember

nhibernate - how to model one to many relationship in domain driven design -

i'm using domain driven design , use nhibernate orm i have entity named certificate , entity named condition , intermediate table saving 1 many relationship between these 2 entity. a condition can has many certificates as condition , certificates separate agreagate roots, , based on domain driven rules can not hold agregate in , agregateid can placed inside it. putting below code in condition agregate can not true private list<certificate> _certificatelist; . . . public ireadonlycollection<certificate> certificatelist { { return _certificatelist.asreadonly(); } } and below code seems not true too private list<certificateid> _certificateidlist; . . . public ireadonlycollection<certificateid> certificateidlist { { return _certificateidlist.asreadonly(); } } would me model relationship? thanks it depends on business rules, if there no rules spanning certificates of same condition reference conditionid within certificate , re

Loading mysql data to a html form and updata with php -

i extremely new both mysql , php (mostly mysql), , i'm not sure got of basics, cause i'm more of learning-by-doing-person. code made of different explanations around web, , of might wrong. i'm trying data database, put html form, edit it, , update database new data. far data gets loaded form correctly, , lot of troubleshooting i've come conclusion upload works out should, except fields empty. guess problem must in getting data form, update query. this code <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta content="text/html; charset=utf-8" http-equiv="content-type" /> <title>untitled 1</title> </head> <body> <?php require 'connect.php'; $result = $db->query("select * test") or die ($db->error); while($row = mysqli_fetch_array($result)) { $name = $row['name']; $school = $row['school']; $email = $row['email']; $gra

ruby - signup form -- Rails + foundation -

im using foundation-rails , creating signup form. this im using create password field in div. <%= text_field_tag "password", "", placeholder: "password", required: true, type: "password" %> <small class="error">invalid</small> for confirm password field, setting similarly, in div: <%= text_field_tag "password_confirmation", "", placeholder: "reenter password" , required: true, type: "password" %> <small class="error >invalid</small> i want use foundation's data-equalto="password" password confirmation make sure same password entered. im unable add rails(it not work). any ? you can add html option need: <%= text_field_tag "password", "", placeholder: "password", required: true, type: "password", data: { equalto: "browser" } %>

rally - InvalidRallyTypeNameError -

am trying access rally through rally api key, , able connect rally. when tried list of user stories under project, getting invalidrallytypenameerror. here code connect rally rally=rally(server="rally1.rallydev.com", apikey="myapikey", workspace='myworkspace',projectc='helloworld') to list of stories under project response=rally.get("project", fetch=false, limit=10) //here getting error please let me know, getting wrong. to user stories in project hit hierarchicalrequirement endpoint , scope project. here curl example, zsessionid set apikey, , 678 placeholder project's objectid: curl --header "zsessionid:_abc123" -h "content-type: application/json" https://rally1.rallydev.com/slm/webservice/v2.0/hierarchicalrequirement?project=/project/678 regardless of language or api tookit choice, have query on hierarchicalrequirement object. toolkits may allow using 'userstory' or 'story'

c# - Change output type in Visual Studio 2012-2015. -

i used using visual studio 2008 , 2010. need change output type of web service project class library. in order .dll of asmx. when use vs2008, do: right click project in solution explorer click properties select application in properties window click on output type combobox , change class library. however, above procedure not work anymore in vs 2012 or vs 2015. there other way generate dll asmx file? thank you!

Chef not run if on same version -

i have cookbook installs software package source. version 1.0.0, when run chef-client cookbook installed on itself. not want happen. want cookbook run if cookbook not installed or version has changed, example 1.0.1. how can make happen? thanks this not how chef works. cookbook executed, if included in run list. however, isn't problem, long cookbook idempotent (only changes things aren't in desired state). edit: in order make code idempotent, here's small tutorial using guards : assuming have following resource, installs software called xyz /usr/local/xyz-1.0.0 (for version 1.0.0): execute "compile-xyz" command "./configure && make && make install" pwd node['xyz']['download_path'] end you can prevent executing adding not_if argument checking presence of /usr/local/xyz-1.0.0 : execute "compile-xyz" command "./configure && make && make install" pwd n

ios - how to remove duplicates from array of dictionary for a specific key -

{ distance = "0.03159804520191554"; rid = 374824705969; uuid = "1838346268_374823983610_2016-08-08t07:32:08.679gmt"; }, { rid = 374824705969; uuid = "1838346268_374823983610_2016-08-08t07:32:08.679gmt"; }, { rid = 374824706065; uuid = "1838346268_374823983610_2016-08-08t07:32:22.680gmt"; } this got array of dictionaries. want remove duplicates rid=374824705969 without using loops.can 1 me. in advance. try these one: nsarray *array = @[ @{ @"rid" : @374824705969, @"uuid" : @"1838346268_374823983610_2016-08-08t07:32:08.679gmt" }, @{ @"rid" : @374824705969, @"uuid" : @"1838346268_374823983610_2016-08-08t07:32:08.679gmt" }, @{ @"rid" : @374824706065, @"uuid" : @"1838346268_374823983610_2016-08-08t07:32:22.680gmt" }]; nsmutableset *keys =

asp.net - Muti-bar column Chart with Legend from Datatable -

i trying plot mutibar column chart legend. code. code seems working not adding legend in appropriate format. i'm adding screenshots of data table , output coming code. legend should showing different types of priorities showing "legend text" everywhere. output datatable //plotting matrix chart chartmatrix.visible = true; loadchartdata(dthourvsprioritymatrix); chartmatrix.series["priority"].charttype = seriescharttype.column; chartmatrix.series["priority"]["drawingstyle"] = "emboss"; //chartmatrix.chartareas["chartarea1"].area3dstyle.enable3d = true; chartmatrix.series["priority"].isvalueshownaslabel = true; // create new legend called "legend". chartmatrix.legends.add(new legend("legend")); // set docking of legend chart default chart area. chartmatrix.legends["legend"].dockedtochartarea = &q

c# - Refreshing multiple datagridviews with single button click -

not sure if question has been asked before, here goes.. have front end app coded in c# windows forms. on second form have 2 datagridviews gets populated 2 different sql server pre-defined views i need refresh both datagrids @ same time single button click button click looks this.. private void refreshbtn_click(object sender, eventargs e) { sqlconnection myconnection = new sqlconnection("removed illustration only"); string query = "select * daily_orders order orderno desc"; sqlcommand cmd = new sqlcommand(query, myconnection); sqldataadapter da = new sqldataadapter(cmd); datatable dt = new datatable(); da.fill(dt); datagridview1.datasource = dt; } how understand is, c# opens new connection, queries db , returns filling datagridview1 required data. same click event request data sql view , populate datagridview @ same time. visually both grids aligned vertically on same form, 1 on of other. ma

php - Is an Eloquent Model the same as a MVC model (in laravel)? -

i saw post ( the difference between eloquent model , model? ) doesn't explicitly answer question me. i may not using right terminology here... i understand eloquent "...an activerecord implementation working database..." says in documentation. not clear me difference between these eloquent models, , models 1 refers them in mvc sense. does sound logical if in particular laravel application there many models, of eloquent models, , of models in mvc sense. eloquent models quite lean , pure classes, allowing interaction database layer. mvc models, comparison may contain sorts of business rules & logic both types created php artisan make:model although eloquent model 1 might want create migration @ same time. all models stored in same place, unless otherwise organised. it's not if there externally visible location or naming convention indicate eloquent model, or mvc model. ...is right? there models. of them have extended functionality usi

Horizontal Recyclerview inside Dialog android -

Image
i working on android app , want show dialog when click on button. want show images in dialog box scrolled horizontally. so, have used recyclerview horizontal scroll orientation it's linear layout manager. images shown 1 image @ time, watch second image in dialog box, need scroll horizontally. want images shown till wrap_content width , start scrolling horizontally. please check below code create dialog box : dialog reactionsdialog = new dialog(mcontext, r.style.theme_customdialog); reactionsdialog.requestwindowfeature(window.feature_no_title); reactionsdialog.setcancelable(true); reactionsdialog.getwindow().setbackgrounddrawable(contextcompat.getdrawable(mcontext, r.drawable.shape)); recyclerview reactionsrecyclerview = new recyclerview(mcontext); reactionsdialog.setcontentview(reactionsrecyclerview); reactionsdialog.show();

apache - How to replace question mark and equal to symbol with slash in url using .htaccess -

i want replace question mark , equal symbol slash in url using .htaccess, have tried .htaccess rules , replacing fine web page not opening , giving error 'internal server error'. tried rules actual url: http://www.example.com/hotel_details?id=2 require url: http://www.example.com/hotel_details/id/2 options +followsymlinks rewriteengine on # remove index.php expressionengine urls rewritecond %{the_request} ^get.*index [nc] rewritecond %{request_uri} !/system/.* [nc] rewriterule (.*?)index/*(.*) /$1$2 [r=301,ne,l] # remove .php extenstion urls rewritecond %{request_filename} !-d rewritecond %{request_filename}\.php -f rewriterule ^(.*)$ $1.php # replace ? , = / rewritecond %{the_request} ^[a-z]{3,}\s/+([^.]+)\?([^=]+)=([^\s&]+) [nc] rewriterule ^ /%1/%2/%3? [l,r=301] all above code working fine instead of replace ? , = / .

windows - Callback for running an external application in C++ -

i'm working on kinect v2 application @ point execute external unity mini game works kinect v2 well. i'm using shellexecute function i'm not sure how implement callback notify main application once unity application has been closed. need because want pause kinect manager in main application once unity running own 1 (otherwise can imagine 2 kinect managers run @ same time). code right looks like: if (button->gettag() == "something") { button->setactive(false); // todo pause kinect manager shellexecute(nullptr,l"open",l"unityapplication.exe",nullptr,nullptr,sw_shownormal); // todo know once unity applications has been closed // todo resume kinect manager } use shellexecuteex instead of shellexecute , passing flag see_mask_nocloseprocess in fmask field of shellexecuteinfo structure, , either waitforsingleobject or registerwaitforsingleobject on process handle returned in hprocess field of shellexecuteinf

java - Astyanax not respecting configured socket timeout -

this setup: 4 nodes cassandra 1.2.19 astyanax 1.56.49 i setting configuration like astyanaxcontext<keyspace> context = new astyanaxcontext.builder() .forcluster(service.getclustername()) .forkeyspace(service.getkeyspacename()) .withastyanaxconfiguration(new astyanaxconfigurationimpl() .setdiscoverytype(nodediscoverytype.none) .setcqlversion("3.0.0") .setdefaultreadconsistencylevel(consistencylevel.getastyanaxvalue()) .setdefaultwriteconsistencylevel(consistencylevel.getastyanaxvalue()) ) .withconnectionpoolconfiguration(new connectionpoolconfigurationimpl("b2bconnectionpool") .setport(service.getport()) .setmaxconnsperhost(5) .setseeds(stringutils.join(hosts, ",")) // increase default timeout heavy operations (milliseconds) .setsockettimeout(15000) .setsslconnectioncontext(sslcontext) .setauthenticationcredentials(creden