Posts

How to read a file delimited by \ in R? -

i have file follows in text file a\b\c\d\f 399\i 2017\11\m\09 491\i 2017\01\ma\161 4\i 2014\01\m\16 in a , b , c , d , f names of variables. try use without results mv <- read.csv("p.txt", header=t, sep = "\")

c - XMLHttpRequest cannot load has been blocked by CORS policy -

Image
i trying consume wcf(rest) service in angular js application. wcf service working fine when run application in google chrome unable data database , can insert , update , delete operation. when run application not show error when lunch developer tools see following errors. ?o=3&g=ec0825c4-90a4-2692-d257-cd2c2b565912&s=1a2c77e8-0498-4a11-b8b8-d740dbec71c4&z=1403834305:2 uncaught syntaxerror: unexpected token < index:1 xmlhttprequest cannot load http://localhost:50028/studentservice.svc/getallstudent . redirect ' http://localhost:50028/studentservice.svc/getallstudent ' ' http://localhost:50028/studentservice.svc/getallstudent/ ' has been blocked cors policy: no 'access-control-allow-origin' header here angular js code ... /// <reference path="../angular.min.js" /> var app; (function () { app = angular.module("restclientmodule", []); app.controller("crud_angularjs_restcontroller", functio...

php - How can I find values in an array which match criteria, without using a for loop? -

i have array this $a = [ [ "id" => "1", "values" => [ "1", "2" ] ], [ "id" => "2", "values" => [ "1", "3" ] ], [ "id" => "3", "values" => [ "2", "4" ] ], [ "id" => "4", "values" => [ "4", "6" ] ], ]; to search , return array 'values' has 2 $result = [ [ "id" => "1", "values" => [ "1", "2" ] ], [ "id" => "3", "values" => [ ...

sql server - Implementation of K-mer/n-gram in SQL -

i want implement k-mer/n-gram algoirthm in sql server. ( https://en.wikipedia.org/wiki/n-gram ). in databases, have millions of protein sequences , want find k-mers array. as example; atataggtcgt | k=5 result 1 | atata 2 | tatag 3 | atagg 4 | taggt 5 | aggtc 6 | ggtcg 7 | gtcgt thanks attention. with respect https://en.wikipedia.org/wiki/n-gram k or n variable. user function best solution taking k or n input parameter. if object_id('dbo.ngram','if') not null drop function dbo.ngram; go create function dbo.ngram(@s nvarchar(max),@ int) returns table return value as( select 2 p,left(@s,@)g len(@s)>=@ union select p+1,substring(@s,p,@)from value len(@s)>p-2+@) select g value go t as( select s from(values('atcgaaggtcgt'),('at'))t(s) ) select s,g t outer apply dbo.ngram(s,2) i think query works you.

lua - Completely clearing a text file -

well, name self explanatory. don't know how go along , don't want risk breaking script deleting file , replacing it. can post method use? tried searching around , far no luck. posting egor skriptunoff 's comment answer. use io.open(filename,"w"):close() where filename name of file want clear. open file writing , close file, discarding contents.

php - Set maximum input number -

my question quite complex. working on loan system. have 2 tables regarding loan module: item loan when item being loaned, loaned quantity subtracted inventory(item_qty - loan_qty). problem comes @ update loan module. don't know how set maximum quantity. know need add item_qty , loan_qty, can't find way so. i've googled long time , still stuck. here code: <?php $loan_id=$_get['loan_id']; $acc_query = $con->query("select * `loan` natural join `item` loan_id = '$_request[loan_id]' ") or die(mysqli_error()); $acc_fetch = $acc_query->fetch_array(); ?> <div> <form method="post" action="update_loan.php" > <input type="hidden" name="item_id" value="<?php echo $item_id; ?>"> <input type="hidden" name="loan_id" value="<?php echo $loan_id; ?>"> <div class = "form-group"> ...

python - Updating tracker variables inside a dictionary -

i'm trying keep track of complex set of variables , update them, within dictionary. if dictionary not appropriate tool here, please let me know. a = 1 b = 1 c = 1 dict = {a: [(b, c)]} # {1: [(1, 1)]} = 1 b = 1 c = 2 dict = {a: [(b, c)]} # {1: [(1, 2)]} = 1 b = 2 c = 1 dict = {a: [(b, c), (b, c)]} # {1: [(1, 2), (2, 1)]} = 2 b = 1 c = 1 dict = # {1: [(1, 2), (2, 1)], 2: [(1, 1)]} = 1 b = 1 c += 1 dict = # {1: [(1, 3), (2, 1)], 2: [(1, 1)]} please note not viable python code, example of 4 procedures i'm trying keep track of. if changes, want new key, if b changes want new pair of values in appropriate key of a, , if c changes, want update existing pair of a: (b, c). couple more examples given existing dictionary: a = 2 b = 4 c = 1 dict = # {1: [(1, 3), (2, 1)], 2: [(1, 1), (4, 1)]} = 6 b = 3 c = 1 dict = # {1: [(1, 3), (2, 1)], 2: [(1, 1), (4, 1)], 6: [(3, 1)]} my question have no idea how syntax for: the process of updating values of c, or i...