Posts

Showing posts from July, 2012

why on mapred-site.xml hadoop 2 there is an mapreduce.jobtracker.address property -

yarn hadoop second generation not use jobtracker daemon anymore, , substitute resource manager. why, on mapred-site.xml hadoop 2 there mapreduce.jobtracker.address property? in order running hadoop mapreduce application eclipse , there plugin eclipse yarn , because find plugins spesified jobtracker. in advance. hadoop 2 compatible run on yarn cluster mr cluster . just in case 1 needs run hadoop 2 compiled code on non-yarn cluster 1 has specify jt url:port . hadoop 2 in binary compatible on both mr/yarn cluster .

html - Spacing for underline/border - setting a specific width -

Image
i creating navigation menu in has specific active state. essentially, underline, greater spacing , specific width. have begun creating navigation border-bottom attribute , height. solves spacing underneath navigation , line, however, how can set width of border underneath writing appears so: essentially have this: <nav class="nav" role="navigation"> <ul id="main-menu" class="pos-ul clearfix"> <li class="first item"><a href="/" class="active">home</a></li> <li class="item"><a href="/administration.html">administration</a> </li> .nav > ul > li { position: relative; float: left; margin-left:19px; font-size: 20px; line-height: 66px; color:#fff; font-family:frutigerltpro-roman; font-weight:normal; height:46px; border-bottom:2px solid #fff; } which works, except width of line? possib

ios - How to load data in UITableView cell from structure -

Image
i trying load data structure table view cell, created custom cell 3 label in it. have 3 text field in view controller , add button want when fill these 3 text field , press add store these 3 values in structure , reload data of table view. structure in other file. here code structure in datamaster.swift struct jobdata { var companyname:array<string> = ["ram"] var job:array<string> = ["shyam"] var desc:array<string> = ["dfdf"] } code addbutton function @ibaction func addbuttontapped(sender: anyobject) { var company = txtcompname.text var job = txtjob.text var description = txtdesc.text data.companyname.append(company) data.desc.append(description) data.job.append(job) self.jobtableview.reloaddata() print(data.companyname) txtcompname.resignfirstresponder() txtjob.resignfirstresponder() txtdesc.resignfirstresponder() } th

php - Why use letters infront of each value in mysqli query? -

so have been wondering while now. why use letters infront of each value in query this? in database, each of these values without letter infront. $sql = " select c.client_id, c.client_name, c.contactperson, c.internal_comment, if null(r.region, 'alle byer') region, c.phone, c.email, uu.fullname changed_by, (select count(p.project_id) projects p p.client_id = c.client_id , (p.is_deleted != 1 or p.is_deleted null) ) numprojects clients c left join users uu on c.db_changed_by = uu.id left join regions r on c.region_id = r.region_id (c.is_deleted != 1 or c.is_deleted null) "; i have tried looking up, can't find anywhere. when in sql need use more 1 table query, can this: select person.name, vehicle.id person, vehicle; or can smaller, , put this select p.name, v.id person p, vehicle v; its reduce query lenght, , useful you

c# - StackExchange.Redis Lazy connection configuration -

i'am trying implement redis cache service stackexchange.redis library. my redis client: public class redisclient { private static lazy<connectionmultiplexer> lazyconnection = new lazy<connectionmultiplexer>(() => { return connectionmultiplexer.connect(string.format("{0},{1}", configurationmanager.appsettings.getstringordefault("redis_masters", "someip1:6379"), configurationmanager.appsettings.getstringordefault("redis_slaves", "someip2:6379"))); }); public static connectionmultiplexer getconnection { { return lazyconnection.value; } } } and try connection in way: using (var redis = redisclient.getconnection) { ... } i exception: "it not possible connect redis server(s); create disconnected multiplexer, disable abortonconnectfail.

ios - swift: weak cannot be applied to an outlet -

Image
i using libzbar scanning qrcode in swift getting these errors. . first error weak referencing , second undeclared type. @ first thought haven't included zbarreaderview.h after checking file inspector found files correctly added i have added zbarreaderview in objective-c , works fine. have viewed sample project adding embeddedreader (objectivec). so want know why getting error , how remove error? solution: to import set of objective-c files in same app target swift code, rely on objective-c bridging header expose files swift. xcode offers create header file when add swift file existing objective-c app, or objective-c file existing swift app. it looks didn't create bridging header. follow apple docs create 1 , import zbarreaderview.h in bridging header.

Jquery Validation Plugin groups depends custom function -

i'm trying minimum price , maximum price fields work correctly using jquery validator plugin. neither field required , users can enter number in either 1 but, when both have values, want make sure minimum field smaller or equal maximum field. it works when click submit button not inline editing. here have html: <form id="myform" method="post"> <div class="control-group" style="padding-bottom: 40px;"> <input id="shopping_request_min_price" name="shopping_request[min_price]" placeholder="at least...." /> <input id="shopping_request_max_price" name="shopping_request[max_price]" placeholder="no more than..." /> <div id="price_msg"></div> <input type="submit" /> </div> </form> this have script: $('#myform').validate({ groups: { minstrict:

java - Spring @Autowired for setter methods vs non-setter methods -

according @autowired javadoc: marks constructor, field, setter method or config method autowired spring's dependency injection facilities. 1 constructor (at max) of given bean class may carry annotation, indicating constructor autowire when used spring bean. such constructor not have public. fields injected right after construction of bean, before config methods invoked. such config field not have public. config methods may have arbitrary name , number of arguments; each of arguments autowired matching bean in spring container. bean property setter methods special case of such a general config method . such config methods not have public. in case of multiple argument methods, 'required' parameter applicable arguments. in case of collection or map dependency type, container autowire beans matching declared value type. in case of map, keys must declared type string , resolved corresponding bean names. note actual injection perfor

Creating Asana tasks from Google Apps Script -

i trying create tasks in asana using google apps scripts. manage read (get method) kind of information asana, when try post creating new task in specific workspace , project, creates task using default values ignoring json data pass. this code i've been using: function createtask (taskname, wsid, projectid, asigneeid) { var encoded = utilities.base64encode(asanakey + ":"); var options = { "method" : "post", "headers" : { "accept": "application/json", "content-type": "application/json", "authorization": "basic " + utilities.base64encode(asanakey + ":") }, "body" : { "data" : { "name" : "\"" + taskname + "\"" , "asignee" : asigneeid, "projects" : [pr

visual studio 2012 - How to know control ID based on searched InnerText/Name -

public class uirow0jqxgrid1pane : htmldiv { public uirow0jqxgrid1pane(uitestcontrol searchlimitcontainer) : base(searchlimitcontainer) { #region search criteria this.searchproperties[htmldiv.propertynames.id] = "row0jqxgrid1";//this id dynamic. need search based on provided innertext this.searchproperties[htmldiv.propertynames.name] = null; this.filterproperties[htmldiv.propertynames.innertext] = "xxxx"; this.filterproperties[htmldiv.propertynames.title] = null; this.filterproperties[htmldiv.propertynames.class] = null; this.filterproperties[htmldiv.propertynames.controldefinition] = "id=\"row0jqxgrid1\" role=\"row\" style=\"height: 25px; ;\""; this.filterproperties[htmldiv.propertynames.taginstance] = "696"; this.windowtitles.add("test"); #endregi

iOS Publishing a like on object not working - Facebook -

using sample code facebook documentation, not working fbsdkgraphrequest *request = [[fbsdkgraphrequest alloc] initwithgraphpath:@"/{object-id}/likes" parameters:nil httpmethod:@"post"]; [request startwithcompletionhandler:^(fbsdkgraphrequestconnection *connection, id result, nserror *error) { // handle result }]; it gives * error = { code = 100; message = "(#100) parameter url required"; type = oauthexception; }; };* facebook gives 2 different implementation 'liking' custom object. 1 here : https://developers.facebook.com/docs/graph-api/reference/v2.3/object/likes#publish and other 1 here. https://developers:facebook.com/docs/reference/opengraph/action-type/og.likes#create its code in second link works nsdicti

angularjs - Use Angular-Datatable in Umbraco 7 custom section -

i trying use angular datatable server side processing in umbraco custom section. problem when use line: angular.module('umbraco', ['datatables']) if include datatables dependency following error: angular.min.js?cdv=886402897:63 error: argument 'umbraco.maincontroller' not function, got undefined @ error (native) @ cb (http://localhost:65055/umbraco/lib/angular/1.1.5/angular.min.js?cdv=886402897:17:114) @ xa (http://localhost:65055/umbraco/lib/angular/1.1.5/angular.min.js?cdv=886402897:17:187) @ $get (http://localhost:65055/umbraco/lib/angular/1.1.5/angular.min.js?cdv=886402897:53:310) @ http://localhost:65055/umbraco/lib/angular/1.1.5/angular.min.js?cdv=886402897:44:274 @ n (http://localhost:65055/umbraco/lib/angular/1.1.5/angular.min.js?cdv=886402897:7:74) @ k (http://localhost:65055/umbraco/lib/angular/1.1.5/angular.min.js?cdv=886402897:44:139) @ e (http://localhost:65055/umbraco/lib/angular/1.1.5/angular.min.js?cdv=88

java - JUnitParamsRunner with input file - string parameter issue -

i want move junit test parameters separate csv file. use junitparamsrunner that: @runwith(junitparamsrunner.class) public class testclass { ... @test @fileparameters("src/test/resources/input.csv") public void testmethod(int assertresult, string inputmark) throws interruptedexception { .... my csv file that 2,"xxx" 2,"xxx" 2,"xxxx,xxx-1" 4,"xxxx xxxxx-xx" when run test parameter "xxxx,xxx-1" gives me java error because of wrong number of arguments (i think because of comma inside). how can pass string parameters special symbols in cvs file in scenario? provide custom mapper parse csv data: @runwith(junitparamsrunner.class) public class testclass { @test @fileparameters(value = "src/test/resources/input.csv", mapper = custommapper.class) public void testmethod(int assertresult, string inputmark) {} public static class custommapper extends identitymapper { @overr

ssh - Java JSchException: Auth cancel -

i seeing issue when attempting ssh box using jsch. have tested connection using cygwin , connects seamlessly. have generated keypair , placed public key in authorized_keys file on remote server. below extract logs info: next authentication method: publickey info: authentications can continue: keyboard-interactive,password info: next authentication method: keyboard-interactive info: authentications can continue: password info: next authentication method: password info: disconnecting xx.xx.xx.xx port 22 com.jcraft.jsch.jschexception: auth cancel code used established connection properties config = new properties(); config.put("cipher",",aes256-cbc"); config.put("mac.c2s", "hmac-sha2-256"); config.put("kexs", "diffie-hellman-group1-sha1,diffie-hellman-group14-sha1,diffie-hellman-group-exchange-sha1,diffie-hellman-group-exchange-sha256"); config.put("stricthostkeychecking", "no"); session session =

networking - how can I connect to a docker from the outside host machine (mac) -

i new dockers. i have ran docker container mongo running (using boot2docker ) docker run --name some-mongo -p 27017:27017 -d mongo inside docker: root@8e9b742c127a:/# mongo mongodb shell version: 3.0.2 connecting to: test server has startup warnings: 2015-05-12t08:49:56.130+0000 control [initandlisten] 2015-05-12t08:49:56.130+0000 control [initandlisten] ** warning: /sys/kernel/mm/transparent_hugepage/enabled 'always'. 2015-05-12t08:49:56.130+0000 control [initandlisten] ** suggest setting 'never' 2015-05-12t08:49:56.130+0000 control [initandlisten] 2015-05-12t08:49:56.130+0000 control [initandlisten] ** warning: /sys/kernel/mm/transparent_hugepage/defrag 'always'. 2015-05-12t08:49:56.130+0000 control [initandlisten] ** suggest setting 'never' 2015-05-12t08:49:56.130+0000 control [initandlisten] > show dbs local 0.078gb > docker ps container id image command created

php - highchart point is not in right location -

Image
i'm making line chart highcharts , data retrieve mysql. code: <?php $query = "select distinct idchip datatable "; $result = mysql_query( $query ); $rows = array(); $count = 0; while( $row = mysql_fetch_array( $result ) ) { $table = array(); $query2 = "select datetime,temperature datatable idchip=".$row['idchip'].' '; $query3 = "select datetime datatable idchip=".$row['idchip'].' group datetime asc'; $timeresult = mysql_query($query3); while($datatime = mysql_fetch_array($timeresult)) { $newtime .= $datatime['0'].','; $newcates .= "'".$datatime['0']."',"; } $total= explode(",", $newtime); array_pop($total); $count = 0; $dataresult = mysql_query($query2);

How do i create instance-able objects inside of static objects in javascript? -

i know can make static objects inside of static objects, example: aaa: { bbb: {} ccc: {} } but want make objects can have instantiated, that: aaa: { bbb = function(yyy): { this.variable // 1 belong aaa(parent object) instead of instance of bbb } ccc = function(ooo) { } } can done? statics definition don't have 'this' reference addressing particular instance. can achieve you're trying this: aaa: { bbb: (function() { aaa.variable = 'something'; })(), ccc: { } } note value of bbb here return value of (self executing) function (null). seems bit of odd way of doing things though, suggest reorgainising if possible

c - Will MessageBox() "eat" my user-defined message? -

i have ui thread , thread, want send user-defined message using postmessage() other trhead ui thread. if ui thread displays message box, , send user-defined message, message loop of message box retrieve user-defined message ui thread message queue, , hence user-defined message lost?! postmessage() not problem. messagebox() runs own message loop make message box modal, makes call dispatchmessage() , function makes sure correct window procedure gets called message posted/sent window. you make mistake if calling postthreadmessage() instead. never safe if receiving thread displays dialogs or enters modal loops. raymond chen wrote couple of blog articles that: thread messages eaten modal loops why messages posted postthreadmessage disappear? a possible corner-case posting message requires message loop process message instead of window procedure. shortcut keystroke.

Can I use google drive sdk with authentication info from google sign-in sdk on iOS? -

we have login module uses google sign-in sdk. google sign-in gives gidauthentication object after login succeed. now want access user's google drive google drive sdk needs gtmoauth2authentication provide authentication info. can use gidauthentication construct gtmoauth2authentication drive sdk? manually assign accesstoken value seems not working(drive scope added). yes can! use following steps: follow steps add google signin described in: https://developers.google.com/identity/sign-in/ios/start-integrating . make sure enable google drive api project. when initialising sign-in object, don't forget add google drive api scope: func application(application: uiapplication, didfinishlaunchingwithoptions launchoptions: [nsobject: anyobject]?) -> bool { // initialize sign-in var configureerror: nserror? gglcontext.sharedinstance().configurewitherror(&configureerror) assert(configureerror == nil, "error configuring google services:

android - Calculate latitude longitude for added height -

Image
i want draw line chart on android google map. have gps coordinates of path , want show speed of car on map height of line. see image this, for each gps (lat,lng) point want add height , calculate corresponding gps(lat,lng) point. want show in 3d view have change points when camera position changed first step calculate gps points added height. for example arraylist<latlng> basepoints = new arraylist<latlng>(); basepoints.add(new latlng(53.262688, -2.500792)); basepoints.add(new latlng(53.262758, -2.500897)); basepoints.add(new latlng(53.262789, -2.501087)); basepoints.add(new latlng(53.262798, -2.501229)); basepoints.add(new latlng(53.262785, -2.501414)); basepoints.add(new latlng(53.262760, -2.501594)); basepoints.add(new latlng(53.262707, -2.501811)); basepoints.add(new latlng(53.262655, -2.501943)); arraylist<latlng> toppoints = new arraylist<latlng>(); toppoints.add(new latlng(53.262939, -2.500779)); toppoints.add(new latlng(53.262975, -2.50091

IF statement in MySQL trigger -

this query code in mysql trigger. if 1=2 select 'yes'; else select 'no'; end if; but has following error: if '1'='2' select 'yes' error code: 1064. have error in sql syntax; check manual corresponds mysql server version right syntax use near 'if '1'='2' select 'yes'' @ line 1 0.000 sec what solution?

python - Flask Templates couldn't load css -

i followed tutorial develop templates flask http://blog.miguelgrinberg.com/post/the-flask-mega-tutorial-part-ii-templates my file tree next one: /static /js bootstrap.min.js jquery_1.11.3.js /css bootstrap.min.css /images /templates index.html /python_venv server.py server.py code: @app.route('/subdomain/') def getprevisionpoblacion(): return render_template('index.html') and css link inside index.html code following: <script src="/static/js/bootstrap.min.js"></script> <link rel="stylesheet" href="/static/css/bootstrap.min.css"/> <script src="/static/js/jquery_1.11.3.js"></script> nginx config: location /subdomain/{ root /apps/subdomain/static; uwsgi_pass unix:///tmp/subdomain.sock; include uwsgi_params; } when check on chrome, index didn't load css files.

javascript - How to apply a fixed backgound in fullpage.js -

i not asking how make background image, know how that. asking how apply fixed background stays same throughout site without moving. scrolling up/down move through slides content. current code sets background image first slide , subsequent slides white. this have far: html: <div id="fullpage"> <div class="section" id="section0" data-anchor="thissection0"> <h1>section0</h1> </div> <div class="section" id="section1" data-anchor="thissection1"> <h1>section1</h1> </div> <div class="section" id="section2" data-anchor="thissection2"> <h1>section2</h1> </div> </div> css #fullpage { background-image: url('images/bg1.jpg'); } script $(document).ready(function(){ $("#fullpage").fullpage({ anchors: ['thissection0&

Python looping in list with if condition not working -

i trying loop in list called sizelist , check condition. code not returning right values. knows problem might be? overavg = 0 overtre = 0 avgsize = np.mean(sizelist) in sizelist: if >= avgsize: overavg += 1 treshold = raw_input("enter size treshold: ") t in sizelist: if t >= treshold: overtre += 1 print overavg print overtre key, value in pktdict.iteritems(): sizevalue = [value] sizelist.append(sizevalue) working code: for key, value in pktdict.iteritems(): sizevalue = value sizelist.append(sizevalue) avgsize = np.mean(sizelist) in sizelist: if >= avgsize: overavg += 1 treshold = int(raw_input("enter size treshold: ")) t in sizelist: if t >= treshold: overtre += 1 print overavg print overtre you need convert input size int , otherwise comparing lexical value rather numerical. also, comment see list has list of size 1 in each field, need flatten (or initi

Slow Performance when ORDER BY in SQL Server -

i'm working on project (microsoft sql server 2012) in need store quite data. table contains 1441352 records in total. the structure of table follows: recordidentifier (int, not null) glncode (pk, nvarchar(100), not null) description (nvarchar(max), not null) vendorid (nvarchar(100), not null) vendorname (nvarchar(100), not null) itemnumber (pk, nvarchar(100), not null) itemuom (pk, nvarchar(128), not null) my table indexed on following fields: nonclustered - glncode, ascending nonclustered - itemnumber, ascending nonclustered - itemuom, ascending nonclustered - vendorid, ascending clustered - unique (the above 4 columns together). now, when i'm writing api return records in table. api exposes methods , it's executing query: select top (51) [glncode] [glncode], [vendorid] [vendorid], [itemnumber] [itemnumber], [itemuom] [itemuom], [recordidentitifer] [recordidentitifer], [description] [description], [vendorname

curl - bash variable subtitution in command until block -

i have trouble short code , can not resolve why it's not working, r="12345" until $(curl --output /dev/null --silent --head --fail http://www.example.com/$r ); printf '.' sleep 5 done the error near $r in $(); . i have wait end of curl request other stuff. can please me resolving this?

See Events in calendar, using PHP and Javascript, -

in matter, have problem when site online(live), works locally when online (live) not show events <script type="text/javascript" language="javascript"> events = new array( <? php $get_event = $db - > execute("select * events fromdate>= date(now()) , removed='n'"); // $get_event=$db->execute("select * events fromdate>='".$_session['session_start_date_s_front']."' , removed='n'"); $ttl_event = $get_event - > recordcount(); $gp = 1; while (!$get_event - > eof) { $xx = dates_range($get_event - > fields['fromdate'], $get_event - > fields['todate']); $ttl_dte = count($xx) - 1; ($i = 0; $i < count($xx); $i++) { $d_e = explode('-', $xx[$i]); if ($gp == $ttl_event && $i == $ttl_dte) { ?> ["d", "<?php ech

sql server - Get multiple id on multiple value in string with sql? -

i have 1 table like tbl --------------------- id users name --------------------- 1 2,3 acc1 2 4 acc2 3 2,4,1 acc3 4 4,1 acc4 in table want id , name users i.e user [2] have id , name suppose pass user [2] result id 1 , 3 , name acc1 , acc3. use like function select id, name yourtable (user = '2' or user '2,%' or user '%,2' or user '%,2,%')

python - Scapy - sniffing 2 interfaces out of three -

i'm using scapy 2.2.0 , python 2.6 sniff on windows 7. know can supply iface parameter sniff function. example: sniff(count=5,iface = 'eth0', prn=lambda p:p.show()) if don't supply parameter, sniffs in interfaces. there way choose 2 out of 3 interfaces? this: (it doesn't work) sniff(count=5, iface='eth0, eth14', prn=lambda p:p.show()) you use threads in python , sniff each interface in different thread: https://docs.python.org/2/library/threading.html

c# - Multi-Tenant physical isolation -

we have multi-tenant asp.net mvc 4 web application each tenant having own repository of files (a folder in file-system). took shared database, shared schema approach , identify tenants subdomain. what best way ensure tenant can access repository folder , no other folder in file-system? check in application business logic, if make mistake...? when running application, tenants run under same user (which defined in iis application pool). do need serve each tenant separate user - using impersonation? need impersonate each time request made server - in order fill it? i've heard has performance drawbacks , not prefered way, is? we have windows service fills requests in background (for tenants), sent through msmq. service needs change identity every time gets request? edit: in addition, need type of isolation if uploads file infected virus - affect tenant's files, , not every tenant on server. use ant-virus software, need separation in case antivirus software not iden

R: Average pairs of columns in a matrix -

i have large matrix made of many columns. new matrix same number of rows , half number of columns averaging every nearby 2 columns (for example column 1 2, column 3 4, etc). i'm using loop, wondering whether there smarter way achieve this. here's vectorized solution: m <- matrix(1:96,8); m; ## [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] ## [1,] 1 9 17 25 33 41 49 57 65 73 81 89 ## [2,] 2 10 18 26 34 42 50 58 66 74 82 90 ## [3,] 3 11 19 27 35 43 51 59 67 75 83 91 ## [4,] 4 12 20 28 36 44 52 60 68 76 84 92 ## [5,] 5 13 21 29 37 45 53 61 69 77 85 93 ## [6,] 6 14 22 30 38 46 54 62 70 78 86 94 ## [7,] 7 15 23 31 39 47 55 63 71 79 87 95 ## [8,] 8 16 24 32 40 48 56 64 72 80 88 96 (m[,seq(1,ncol(m),2)]+m[,seq(2,ncol(m),2)]

c# - Entity Framework code first one-to-zero relationship -

i trying one-to-zero relationship between table staff , department. public class staff { public int id { get; set; } // other fields [foreignkey("departmentid")] public int departmentid { get; set; } public virtual department department { get; set; } } public class department { [key] public int id { get; set; } public string name { get; set; } public virtual staff staff{ get; set; } } when run code, gives error: the property 'departmentid' cannot configured navigation property. property must valid entity type , property should have non-abstract getter , setter. collection properties type must implement icollection t valid entity type. change model ,now can use departmentid foreign key public class department { [key] public int departmentid { get; set; } public string name { get; set; } public virtual staff staff{ get; set; } }

sql - When to write NOT NULL when creating a MySQL table column -

what's difference or benefit of writing "not null" in mysql field creation... for example if i'm creating table this... create table if not exists game( id int(11) not null auto_increment, name varchar(128) not null, description varchar(200) not null, primary key(id) ) here, id , name has value not null fine. that. but, description optional field so, can blank. so, in situation, should put not null or not ? null , blank field not same thing (unless, under circumstances, you're brain-dead dbms cough oracle cough ). null means unknown or not applicable whereas blank field means, well, known , blank. it depends entirely on how want handle field itself. example, let's consider middle initial of name. if not wish distinguish between 'unknown' , 'does not have one', set column not null , use blank value represent both - ease queries somewhat. however, if want mail clients without middle names (for whatever bizarre reason

javascript - FullCalendar Refresh issue with JSON php file -

i have issue fullcalendar , want when save through button call ajax , save changes database , refresh events. so problem following: - php file contain events reading db events not displaying @ all.:( following json_event.php file $driver_booking = q("select * booking vehicle_id = ".$_request['ch']); $array = array(); foreach($driver_booking $bookings) { $driver = getrow("driver", $bookings['driver_id']); //return date_time only.... $date_from = date("y-m-d",$bookings['datetime_from']); $time_from = date("h:i:s",$bookings['datetime_from']); //return date_time only..... $date_to = date("y-m-d",$bookings['datetime_to']); $time_to = date("h:i:s",$bookings['datetime_to']); if($bookings[&#

c++ - Construct logic statements through parsing a file -

i have been presented problem of reading input file contains logic statements, , required construct truth table determine whether ask matches any/all models determined. example of data may expect read in is: (p & z => x) => ((p | d) & z) please don't caught in example , whether makes sense, made show different compositions may presented with. multiple such statements can separated semicolons. i have sorted out semicolon splitting without dramas, , have vector of strings containing each separate statement, each string presented above. without parenthesis being involved, believe determining statements rather straight forward, involvement required compute different sections before others. eg: (p | d) = result , (result & x) i have seen people discussing concept of using stack determine if open brackets closed properly, not believe appropriate situation not allow me determine statements inside set of parenthesis. the current idea have use stac

json - Converting data sent from the client with RESTeasy -

i developing rest services, in j2ee environment, using resteasy library. if have @post rest method: @post @path("/filter") @produces(mediatype.application_json) @consumes(mediatype.application_form_urlencoded) public list<order> findorders( @formparam("orderfiltercriteria") orderfiltercriteria orderfiltercriteria, @formparam("readcontext") orderreadcontext readcontext, @formparam("querycontrol") querycontrol querycontrol, @formparam("fetchpattern") fetchpattern fetchpattern, @formparam("loadpattern") loadpattern loadpattern) { ... } supposing client sends these data through form, , supposing these json string, how can convert (server-side) these json strings in correct way? example, json string "readcontext" field, how can converted orderreadcontext object? i using widlfly 8.2 deploy. in advance. from @formparam documentation: the type t

how to add zeros after numbers to get a fix length in EXCEL -

i have 3 numbers in excel. a1. 498 a2. 899 a3. 5209 i want numbers followings: b1. 49800 b2. 89900 b3. 52090 i still finding solutions via online of resource discussing leading zeros. please, kindly give me ideas? thanks. i hope formula may of use: =a1 & rept("0"; 5 - len(a1)) thought not set format of cell (which doubt can done changing value of cell adding zeros) the formula works if dealing numbers text, may need convert them text in formula (text(a1; "0") instead of a1)

css - Need help to fix bootstrap carousel height -

i using vanilla bootstrap 3 carousel. custom css use this: .carousel-caption { position: relative; left: auto; right: auto; margin-top: -50px; background-color: #000; opacity: 0.8; } the annoying issue when images of different heights, carousel height expands , causes text below jump, not desirable. have tried differnt css tricks, adding: .carousel-inner{ width:100%; max-height: 600px !important; } and other suggestions found on other answers none worked me. appreciate help.

javascript - ng-repeat dynamic array name -

is possible achieve dynamic array name, friends+$index . example: ng-repeat="friend in {{'friends'+$index}}" the aim loop through different arrays: friends1 & friends2. tried everything, combination, without success. never came across appropriate answers. thanks in advance. you can this. http://jsfiddle.net/jigardafda/gw7f1qq0/1/ html <div ng-app="myapp"> <div ng-controller="myctrl"> <div ng-repeat="(name, value) in frndslist"> {{name}} <div ng-repeat="item in value.list"> {{item}} </div> </div> </div> </div> js var myapp = angular.module('myapp',[]); myapp .controller('myctrl', function ($scope, $rootscope) { $scope.frndslist = { 'friend1': { name: 'x1 frnd', list: [

How to consume JSON response with spring restemplate properly? -

i have spring mvc rest service return json value, have 8 row, here json [ {"no":"1","date":"2015-03-30","grandtotal":699618,"diskon":699618}, {"no":"2","date":"2015-03-30","grandtotal":1867949,"diskon":1867949}, {"no":"3","date":"2015-03-27","grandtotal":2190909,"diskon":2190909}, {"no":"4","date":"2015-03-26","grandtotal":8616120,"diskon":8616120}, {"no":"5","date":"2015-03-26","grandtotal":1095455,"diskon":1095455}, {"no":"6","date":"2015-03-24","grandtotal":938961,"diskon":938961}, {"no":"7","date":"2015-03-24","grandtotal":5603848,"diskon":5603848}, {"no"

javascript - Declaring dependency inside RequireJS module -

i have 2 separate requirejs module files below in mainviewmodel.js, have myfilters.init(myfilterpanelviewmodel); in pages/myfilters.js, have define(['viewmodels/myfilterpanelviewmodel'], function(myfilterpanelviewmodel ) { var myfilters = { "init": function(myfilterpanelviewmodel){ } }; return myfilters; }); my question calling init method mainviewmodel.js, passing instance of myfilterpanelviewmodel so in myfilters.js module, should need have declared dependency or since passing myfilterpanelviewmodel init function, same not required declared dependency inside myfilters.js ? in code show in question indeed omit 'viewmodels/myfilterpanelviewmodel' dependency , code should work fine, provided call init function value same module loaded dependency 'viewmodels/myfilterpanelviewmodel' .

javascript - Why is JSON all uppercase -

i aware functions conventionally expressed in camel case ie function myfunctionname(){ return false; } and constructors first letter capitalized ie function person(name){ this.name = name; } but why json spelt in capitals in function: json.stringify(somevalue); i know may bit of pointless question can't seem find answer online. thanks this because an acronym javascript object notation . in general, acronym conventions js seem less-defined / less-followed other aspects. e.g., labkey guidelines classify four-letter acronym requiring regular js rules.

java - How do i encrypt password in three layers , SHA1, base64 encode and salt -

i want encrypt , decrypt password high security . first, string password converted sha1 , want add base64 encode , lastly add salt it. is doable in java? i have sample code encode in base64 , sha1 not sure how combine them all. here snippet: string password = "password"; base64encoder encoder = new base64encoder(); encryptedpassword = encoder.encode(password.getbytes()); using sha1: messagedigest md = messagedigest.getinstance("sha-1"); md.reset(); md.update(password.getbytes()); system.out.println(new string(md.digest())); please suggest . these things have think of when playing around salts: generate long random salt using csprng. prepend salt password , hash standard cryptographic hash function such sha256. you need append generated salt (generated cryptographically secure pseudo-random number generator ) password , hash sha-1. since sha-1 hash algorithm, can't decode it. if nee