Posts

Showing posts from July, 2012

matlab - Making a struct from a string containing matrices and its names -

i have text file containing uint8 data this: [0, 18, 121] bl [0, 19, 12] gt [24, 19, 22] apa [0, 18, 1] bl [24, 19, 22] apa bpa [1, 2, 3] apa what want struct, a , fields containing data as: a.bl= [0, 18, 121; 0, 18, 1 ]; a.gt = [0, 19, 12]; a.apa = [24,19,22]; a.apa_bpa = [24,19, 22] or a.apabpa= [24, 19, 22] so above example shows find multiple instances of matrix , stack them one. if there space in name, remove space or replace underscore. until now, have: a = importdata('file.txt'); which creates cell array (20,000 x 1 original data) containing data. know names of matrices text file have. tried differentiate matrices following gives me cell containing matrices , name: a(~cellfun(@isempty, strfind(a,'bl'))) how proceed? or simpler solution problem more speed? i use textscan instead of importdata in case, since you're dealing mixed data types: fid = fopen('file.txt'); data = textscan(fid, '[%d%d%d%s',

c# - Outlook meeting schedules in UTC not EST -

This summary is not available. Please click here to view the post.

php - How to decrypt SSN field from DB that is encrypted using Crypt::encrypt in Laravel? -

i trying create web service passing id, username, ssn input parameters , retrieve required information of particular user in json response. i can create db query gather user data , filter query result based on id, username. but, ssn encrypted using crypt::encrypt() , stored in database. have decrypt value , match user entered ssn in input parameter. i tried using crypt::decrypt() in clause of db query didn't work out. how decrypt ssn in such situation? my original query is: $ssn = 123456789; $res = db::table('users') ->where('users.ssn', '=', $ssn) ->select('users.ssn ssn') ->get(); i tried decrypt ssn db: $res = db::table('users') ->where('crypt::decrypt(users.ssn)', '=', $ssn) ->select('users.ssn ssn') ->get(); wiki

reactjs - Relay container with no data -

i'm building app first real foray react, relay , graphql, using relay modern. the basic case is, have login form component doesn't need data; say, component renders form, , has corresponding mutation, doesn't need query anything. it seems providing relay style query fragment necessity when calling createfragmentcontainer , in turn ensures this.props.relay not null in context of component. right now, i'm using standard (non-relay) react component login form, result i'm unable access relay environment pass through mutation. my question - there way pass "empty" relay fragment? or there better idiom recommended in case? you use normal component create mutation file mutation in it. run relay compiler create graphql fragment mutation , call on mutation in form submit. mutation need environment. here relay modern docs: https://facebook.github.io/relay/docs/mutations.html you need store result of mutation somewhere , append auth token ne

html - Transform scale on anchor elements not working in flexbox -

Image
i using flexbox navigation bar @ top of page. have included code part because project entire site. anchor tags on site styled same, same transform: scale(1.2) characteristic on hover. works everywhere except in nav. nothing seems scale @ inside of nav. additionally on codepen, flexbox doesn't seem respect justify-content: space-around , making anchors appear more squished on actual site. codepen: https://codepen.io/colesam/pen/yxlpvw a { color: #646c84; font-weight: 500; line-height: 1.7vw; transition: 0.2s; } a:hover { color: #ffaf54; cursor: pointer; transform: scale(1.2); text-decoration: none; } a:focus { color: #646c84; text-decoration: none; } a:focus:hover { color: #ffaf54; cursor: pointer; } .active-indicator { background: #ffaf54; border-radius: 25px; height: 2px; margin-top: -2px; margin-bottom: 5px; margin-left: auto; margin-right: auto; opacity: 0; transition: 0.2s; width:

javascript - For each array value check if it is in a json array. If it is skip json array for next iteration -

sorry if title little confusing. not sure how else put it... i have array of dates: var daterange = ["2017-08-21", "2017-08-22", "2017-08-23", "2017-08-24", "2017-08-25", "2017-08-26", "2017-08-27"]; i have json array of data contains date. var jsonarray = [ { date: "2017-08-21", edit: false, text: "some text" }, { date: "2017-08-23", //notice skipped 2017-08-22 edit: false, text: "some text" }, ... ]; so want check jsonarray each date in daterange , , if daterange isn't present of jsonarray 's dates, something. the way doing doing indexof each date in daterange realized instance "2017-08-23" compared "2017-08-21" triggered, don't want this, "2017-08-23" present in array... does make sense? thanks help! i dont know if got want c

Webix add tooltip to specific elements in treetable -

this example, click here has column votes set of number value. , want add tooltips elements has more 400 votes. how achieve this? you need add tooltip property in treetable configuration: tooltip: (obj, common) => { return (obj.votes > 400 && common.column.id === "votes") ? "your text here" : "" } demo snippet here: https://webix.com/snippet/2ffa6713 in example tooltip shown on votes column. wiki

jquery - Why date format is not changed in datepicker? -

Image
i have used jquery-ui-1.7.2 datepicker in code. want change date in 'yy-mm-dd' format. doesn't change , takes default value. here code: <div id='mydate'> <input type="text" id="monthinput" class="form-control" name="water.month" value="${water?.month}" /> </div> and jquery: var = new date(); var prevmonthfirstdate = new date(now.getfullyear() - (now.getmonth() > 0 ? 0 : 1), (now.getmonth() - 1 + 12) % 12, 1); var prevmonthlastdate = new date(now.getfullyear(), now.getmonth(), 0); $('#monthinput').datepicker({ altformat: 'yy-mm-dd', dateformat: 'yy-mm-dd', startdate: prevmonthfirstdate, enddate: prevmonthlastdate }); what should do? use dateformat property instead of altformat $('#monthinput').datepicker({ dateformat: 'yy-mm-dd'

iis - Rewrite Rule Spaces -

i created rewrite rule in iis because of russian spammers rule doesn't seem work correctly because of space between 2 parts search , wondering how overcome this <rule name="russian referral spam" stopprocessing="true"> <match url=".*" /> <conditions> <add input="{http_user_agent}" pattern="windows+2002|windows+2003|windows+2004|windows+2005|windows+2006|windows+2007|windows+2009" /> </conditions> <action type="redirect" url="https://stackoverflow.com" redirecttype="permanent" /> </rule> before, never included spaces between windows , fake version: windows 2002|windows 2004... and pickup on windows in useragent , redirect them. adding + rule backslash before it's not affecting russian spammers. how change above rule searches 'windows 2002|windows 2004|windows 2005|windows 2006... if in url add %20 here few real examples of russian spam u

php - Sort Multi-dimensional Array by Value -

possible duplicate: how sort multidimensional array in php how can sort array value of "order" key? though values sequential, not be. array ( [0] => array ( [hashtag] => a7e87329b5eab8578f4f1098a152d6f4 [title] => flower [order] => 3 ) [1] => array ( [hashtag] => b24ce0cd392a5b0b8dedc66c25213594 [title] => free [order] => 2 ) [2] => array ( [hashtag] => e7d31fc0602fb2ede144d18cdffd816b [title] => ready [order] => 1 ) ) try usort : if still on php 5.2 or earlier, you'll have define sorting function first: function sortbyorder($a, $b) { return $a['order'] - $b['order']; } usort($myarray, 'sortbyorder'); starting in php 5.3, can use anonymous function: usort($myarray, function($a, $b) { return $a['order

docker - Build failed: please ensure the remote branch exists (128) -

not sure if question goes here or serverfault, here goes. i’m building couple of automated build rules on docker hub . these rules: | branch | master | /java/tomcat | latest | | tag | /tomcat(.*)/g | /java/tomcat | | the first rule builds no problem, second rule fails message subject: build failed: please ensure remote branch exists (128) it’s trying branch named tomcat wrong. doing wrong? looks pretty bug me. fyi: have asked same question in forum got no answer. wiki

.net - Web API.. 401 (Unauthorized) Chrome CORS -

i have 2 sites running. classic webapi server , angular4 client. have cors working on server. know cors not work chrome unless start chrome security off localhost. , when works fine. but understood when moved off localhost site (the site use port number. looks http://mytest:8080/info ) chrome work fine. have same problem 401 (unauthorized). it works on ie no problem , if run chrome security off works well. update: fixed this: on server did custom headers (in web.config) <customheaders> <add name="access-control-allow-headers" value="x-aspnet-version,x-powered-by,date,server,accept,accept-encoding,accept-language,cache-control,connection,content-length,content-type,host,origin,pragma,referer,user-agent" /> <add name="access-control-allow-methods" value="get,post,put,delete,options" /> <add name="access-control-allow-credentials" value="true" /> </

asp.net web api - How do I bind querystring parameters to an object with different property names? -

i have controller action following signature. add more parameters becoming more difficult manage i'm looking using single request object. public async task<ihttpactionresult> getsearchresults( [fromuri(name = "p1")] string p1longname = null, [fromuri(name = "p2")] list<string> p2longname = null, [fromuri(name = "p3")] int? p3longname = null) {} public async task<ihttpactionresult> getsearchresults([fromuri]searchrequest parameters) the problem, how should handle different parameters names, querystring parameter vs object property? tried adding attribute [datamember(name = "p1")] p1longname property of class didn't work. use request object resulting parameter binding , then, in action method, map class real property names seems add layer of unnecessary complexity. how request object bind querystring parameters using different names? wiki

java - camel stream closed error in rest service csv reader -

i have read csv file, when invoke camel rest service url (with springboot): http://localhost:8080/camel/csv this route builder: @component public class camelcontextconf extends routebuilder{ static final logger logger = logger.getlogger(camelcontextconf.class); @override /** * http://localhost:8080/camel/csv */ public void configure() throws exception { restconfiguration().component("servlet"); rest("/csv").get().to("direct:csvprocessor"); csvdataformat csv = new csvdataformat(); csv.setdelimiter(";"); csv.setskipheaderrecord(true); from("direct:csvprocessor") .to("file:src/main/resources/?filename=sample-data.csv&noop=true") //.split(body().tokenize("\\n")) .unmarshal(csv) .to("bean:mycsvhandler?m

floating point - Lack of precision of the toFixed method in javascript -

Image
i have test number.prototype.tofixed method in chrome(v60.0.3112.101) console , found sth puzzled me. why 1.15.tofixed(1) return "1.1" not "1.2"? why 1.05.tofixed(1) return "1.1" not "1.0"? , on... i research in ecmascript specification . note 1 tofixed returns string containing number value represented in decimal fixed-point notation fractiondigits digits after decimal point. if fractiondigits undefined, 0 assumed. i know what's fixed point notation .but can't explain puzzles above. give clear explaination? btw, think details arithmetic under specification should improved. saying 1.105 instance, relative arithmetic following: let n integer exact mathematical value of n ÷ 10^f - x close 0 possible. if there 2 such n, pick larger n. according pick larger n , 111 should taken consideration not 110, contradicted reality. i'll try best clarify points around question. first of fixed-point no

machine learning - Freezing a tensorflow graph -

i have trained model in tensorflow , saved time time using tf.train.saver() . want .pb file file checkpoint have. in checkpoint folder have following files: checkpoint model.cpkt-39.data-00000-of-00001 model.cpkt-39.index model.cpkt-39.meta how can protobuf file checkpoint? also, can specify include in protobuf , not, particluar op ? wiki

How to customize Mapzen search control using my own html/css? -

how can customize l.mapzen.geocoder take own html/css styled search box positioned @ center (just 1 in mapzen demo)? <div id="form-wrapper"> <form class="form-horizontal"> <div class="col-lg-offset-3 col-lg-6"> <div class="input-group"> <input type="text" class="form-control input-sm"> <span class="input-group-btn"> <button class="btn btn-default btn-sm" type="submit"><span class="glyphicon glyphicon-search"></span></button> </span> </input> </div> </div> </form> </div> i wanted let stay @ center map adjusts location background. its basic use let users check if location chose correct , after button click input redirected python django view. here how mapzen demo cr

python - Write the function startEndVowels(word) that returns True if the word starts and ends with vowels -

for below program getting output as: true false none false expected should : true false true false what wrong code? def startendvowels(word): vowels = "aeiou" x = word[0] y = word[-1] z = len(word) if z >1: if x in vowels: if y in vowels: return true else: return false elif z == 1: if word in vowels: return true elif x == " ": return false print startendvowels("apple") print startendvowels("goole") print startendvowels("a") print startendvowels(" ") you use startswith , endswith method accept tuple of possible prefixes/suffixes: def startendvowels(word): vowels = tuple("aeiouaeiou") return word.startswith(vowels) , word.endswith(vowels) the reason why function didn't work because didn't check capitalization. either need include upper case vowels to

php - How to make Bootstrap work in Options Theme using Settings Api -

i not able make bootstrap work in settings api options on wordpress theme. i added in action admin_enqueue_scripts along other js wp_register_style( 'custom_wp_admin_css', get_template_directory_uri() . '/css/bootstrap.min.css', false ); wp_enqueue_style( 'custom_wp_admin_css' ); and i've tried many articles, still can not solve. thanks wiki

sql server 2000 - Dynamic sql statement to generate multiple large case statements -

i staging data legacy sql server 2000 system i'm limited on how can write following query. came query viable solution doesn't use temp tables after posted question yesterday. i need sql server 2000 compatible alternative cte query i need write type of query many tables , there instances have upwards of 20 nested case statements. there way can use dynamic sql generate these queries? otherwise i'm not sure it's going can maintain. here's example. thank you! select cst.* ,modifieddatetime = case when dateadd(second, coalesce(chd.modifiedtime, ''), coalesce(chd.modifieddate, '')) > dateadd(second, coalesce(cms.modifiedtime, ''), coalesce(cms.modifieddate, '')) , dateadd(second, coalesce(chd.modifiedtime, ''), coalesce(chd.modifieddate, '')) > dateadd(second, coalesce(cpm.modifiedtime, ''), coalesce(cpm.modifieddate, ''))

angular - Angualr2/4 -Unable to generate highchart -

i new using angular 2/4 , highchart npm called (angular2-highcharts ) can found here ( https://github.com/gevgeny/angular2-highcharts )) angular 4. i able install angular-highchart npm. when tried various suggestion incorporate highchart generate charts using angular2-highcharts failed. limited psuedo examples not helpful tired according forum suggestion here angular2-highchart https://github.com/gevgeny/angular2-highcharts/issues/176 , not of help. and getting bunch of errors when tried mentioned in forum links. how can create various(pie, line, candle) charts using highchart angular 4? here code below: uw-chart.ts import { component, oninit } '@angular/core'; import { router } '@angular/router'; import { uwservice } '../../service/uw.service'; // import { underwritermodel } "app/underwriter/model/underwriter.model"; import { loanmodel } "app/underwriter/model/loan.model"; import

firebase - Swift classes added after pods installed do not register modules -

i'm making in app involves firebase, , when add firebase project, pre-existing classes work fine. however, after adding firebase, whenever create new swift class (such new uiviewcontroller class) , import firebase modules in it: import uikit import firebase //works in files created before pods installed... //...but not files created after class newviewcontroller: uiviewcontroller { override func viewdidload() { super.viewdidload() // additional setup after loading view. } override func didreceivememorywarning() { super.didreceivememorywarning() // dispose of resources can recreated. } } the import statement throws "no such module firebase". classes added before still register import though. doing wrong, , how can fix this? try this. clean derived data. do fresh pod install do clean build , build(cmd+b) now add import statement in class - import firebase , should start working.

sql - Transposing Rows to Columns and having values flow down in TSQL -

Image
i using tsql. if have following results: and want transpose this: how can achieve this? i have following query: with q ( select * tableone id = 1 union select m.* tableone m join on m.parentid = q.id ) select * q this gives me of items underneath specified node including specified node. it easy if add scripting data , not image. note tbl name of table, called 3 times. try this: select a.fieldvalue company, b.fieldvalue department, c.fieldvalue job tbl inner join tbl b on a.parentid null , a.id=b.parentid inner join tbl c on b.id= c.parentid if not bring desired results please add data text , let me know, modify query wiki

c++ - What purpose to use union in struct? -

i'm struggling uart snippet codes embedded uart program. then came across can't undersatnd when analysing code. q1. in case of using "union" in "struct". benefit , purpose use this? #define __io volatile typedef struct { union { __io uint32_t rr; __io uint32_t tr; __io uint32_t dl; __io uint32_t rr_tr_dl; }; union { __io uint32_t dh; __io uint32_t ir; __io uint32_t dh_ier; }; } uart_typedef; q2. in case of using "union" in "struct" in "struct". benefit , purpose use this? typedef struct { union { struct{ __io uint32_t ctrlr0; __io uint32_t ssi_comp_version; union { __io uint32_t dr; __io uint32_t dr0; }; __io uint32_t dr1; __io uint32_t rsvd_2; }; uint8_t reserved[0x1000]; }; } ssi_typedef; the first case "aliasing" of field names. uart_typedef type

Display images from folder in table using php,html? -

Image
i want display images in table form. here code: <?php $files = glob("images/*.*"); ($i = 0; $i < count($files); $i++) { $image = $files[$i]; $supported_file = array( 'gif', 'jpg', 'jpeg', 'png' ); $ext = strtolower(pathinfo($image, pathinfo_extension)); if (in_array($ext, $supported_file)) { echo basename($image); echo '<img src="' . $image . '" alt="random image" ,width=100px, height=100px /><br>'; } else { continue; } } ?> something picture. if want in table add table tag , it <table> <tr> <th>image name</th> <th>image</th> </tr> <?php $files = glob("images/*.*"); ($i = 0; $i < count($files); $i++) { $image = $files[$i]; $supported_file = array( 'gif', 'jpg', 'jpeg', 'png'

Convert MySQL to SQlite -

is possible convert mysql sqlite free tool on windows? there mysql2sqlite.sh script on github as described in header, script can used this: ./mysql2sqlite.sh mydbase | sqlite3 database.sqlite alternatives an updated version https://github.com/dumblob/mysql2sqlite a simpler script posted @ the mysql forums wiki

Hyperledger Composer REST API does not generate transaction interfaces -

i created business network , tested in playground. works fine. can create transactions, assets , participants. when try , create rest interface composer-rest-server, participant , asset rest interface created, transactions not. information why not welcome? can provide listing of npm list -g --depth=0 thanks. using v0.11.3 of hyperledger composer. what you're seeing unusual, i've tried marbles sample network , see transaction trademarbles marble : asset named marble show/hide list operations expand operations player : participant named player show/hide list operations expand operations system : general business network methods show/hide list operations expand operations trademarble : transaction named trademarble show/hide list operations expand operations post /trademarble create new instance of model , persist data source

performance - Fastest pair class in Java -

i'm writing external sort in java, using n-way merge algorithm this question. involves adding , polling pairs of integers , java.util.priorityqueue . currently, i'm using abstractmap.simpleimmutableentry pairs, that's slower previous non-priority-queue approach (even though it's asymptotically faster)! there faster pair class available, or should write own? need pairs of integers can sorted first one, apart thing matters speed. clarify, code isn't unreasonably slow (it's not surprising priority queue approach isn't faster, given while asymptotic complexity goes o(mn) o(m log n), n quite small), feel making fast possible. wiki

curl - PHP form to moneris through google recaptcha -

i have simple php form sends information moneris through google recaptcha verification. that means cannot write "https://esqa.moneris.com/hppdp/index.php">" need google recaptcha verification. is there way if can submit form in php code takes users page https://esqa.moneris.com/hppdp/index.php form values. i using curl displaying result url website https://esqa.moneris.com/hppdp/index.php not working want users go above url post information. my curl code not working $url = 'https://esqa.moneris.com/hppdp/index.php'; $fields = array( 'ps_store_id'=>urlencode('gdtj4tore1'), 'hpp_key'=>urlencode('hpajl6hnusec'), 'charge_total'=>urlencode('1.00'), ); foreach($fields $key=>$value) { $fields_string .= $key.'='.$value.'&'; } rtrim($fields_string,'&'); // google recaptcha $recaptcha_secret = "secret key"; $response = file_get_contents("

java - Change Calligraphy default font not in application class -

i have multi language application , using calligraphy setting font. i want change calligraphy default font when user changes app locale. use support library v26 provides support fonts in xml wiki

java - How to implement proper ancestral navigation for application with several activities one of which can swap content fragments? -

i have 1 main activity drawer layout , content represented fragments. have kind of main fragment, initialized in oncreate() method , added content holder. in part navigation pretty clear - swap out fragments when click nav items. from 1 of fragments, in have list of items, can go child activity represents item details. decided implement child activity, because navigation in part isn't represented navdrawer, button. the question - how can navigate child activity main activity proper fragment in place? problem when go main activity created scratch, wrong fragment in place (the main one). , want 1 went details activity. if still isn't clear, looks this. mainactivity(mainfragment) -> mainactivity(secondfragment) -> detailsactivity -> mainactivity(mainfragment) and want this. mainactivity(mainfragment) -> mainactivity(secondfragment) -> detailsactivity -> mainactivity(secondfragment) looks should done automatically, due bug doesn't wor

swift3 - iOS Charts, wavy lines -

Image
let's straight point: started use ios charts daniel gindi, can't reproduce wavy lines in line chart (and please notice image picked form repository of ios charts!) all this, simple straight lines no curves and code in viewdidload used showing that: let ys1 = array(1..<10).map { x in return sin(double(x) / 2.0 / 3.141 * 1.5) } let ys2 = array(1..<10).map { x in return cos(double(x) / 2.0 / 3.141) } let yse1 = ys1.enumerated().map { x, y in return chartdataentry(x: double(x), y: y) } let yse2 = ys2.enumerated().map { x, y in return chartdataentry(x: double(x), y: y) } let data = linechartdata() let ds1 = linechartdataset(values: yse1, label: "hello") ds1.colors = [nsuicolor.red] ds1.drawcirclesenabled = false ds1.drawvaluesenabled = false data.adddataset(ds1) let ds2 = linechartdataset(values: yse2, label: "world") ds2.colors = [nsuicolor.blue] ds2.drawcirclesenabled = false ds2.draw

javascript - Jquery add property values to css -

i'm new jquery. want task on drop-down menu below: if (scrnwidth <= 761) { if (display block) { //defaultly testi has display:none property. testi = make testi display } else{ return false; } } that task not working me. how add css properties?? didn't found errors. here's code: jquery('.menu_toggler').click(function () { var scrnwidth = jquery(window).width(); var display = jquery('.mobile_menu_wrapperr'); var testi = jquery('.main_header'); if (scrnwidth <= 761) { if (display.css("display") === "block") { testi = testi.css("display" == "none"); } else{ return false; } } }); thanks in advance. syntax incorrect testi = testi.css("display" == "none"); correct syntax testi = testi.css("display","none

c# - MahApps Metro DialogCoordinator: Display Dialog to span UserControl only (instead of entire window)? -

i'm epxloring different ways best show dialog windows in application. mahapp metro's idialogcoordinator seems quite useful, couldn't quite adjust use case yet. say i'm creating usercontrol (view), viewmodel needs able display dialogues. these dialogues should, when displayed, overlay/span usercontrol only, not entire window in usercontrol hosted. is there way achieve this? default behavior seems span on entire window, , haven't found way change yet. so far, i've been using dialog coordinator in straightforward way, doing following in view: <usercontrol xmlns:dialog="clr-namespace:mahapps.metro.controls.dialogs;assembly=mahapps.metro" dialog:dialogparticipation.register="{binding}"> and set set instance in view's constructor by, viewmodel.initialize(dialogcoordinator.instance); which i'd call in viewmodel via idialogcoordinator _dialogcoordinator; // set viewmodel.initialize() calle

c# - Unity: PlayerLife variable doesn't update visibly in Inspector or HUD, but still functional in Background -

the playerlife variable doesn't update visibly in inspector or on-screen health text, player still dies because playerlife drops below zero. i've determined player prefab attached zombie gameobject solely player prefab rather in-scene active player . how make zombies reference in-scene active player rather basic player prefab, script? (also, won't allow me manually drag active player zombie) call hierarchy playerlife public class player : monobehaviour { public raycasthit hit; public int gundamage = 1; public zombie zombie; private float hitforce = 100f; public float playerlife; private vector3 flarelower = new vector3(0, -0.5f, 0); void start() { spawnpoints = playerspawnpoint.getcomponentsinchildren<transform>(); playerlife = 200; } void update() //t-toggle { if (input.getbutton("fire1")) { lazerbeam(); } if (respawn != lasttoggle)