Posts

Showing posts from April, 2014

python - mpi4py: Communicating between spawned processes -

i have 1 process running program called t1.py spawns 3 other processes, of run t2.py. want broadcast value spawned process rank of 0 2 other spawned processes. however, when bcast called, program blocks. idea why happens? , how fix it? t1.py from mpi4py import mpi import sys sub_comm = mpi.comm_self.spawn(sys.executable, args=['t2.py'], maxprocs=3) print 'hi' t2.py from mpi4py import mpi comm = mpi.comm.get_parent() print 'ho ', comm.get_rank() = comm.bcast(comm.get_rank(), root=0) print output hi ho 2 ho 0 ho 1 if want childs talk each other, can use mpi.comm_world : a = mpi.comm_world.bcast(mpi.comm_world.get_rank(), root=0) by printing mpi.comm_world.get_rank(), ' of ',mpi.comm_world.get_size() , can check childs' mpi.comm_world limited childs. now, let's investigate reason why comm.bcast(...) failed if comm obtained comm=mpi.comm.get_parent() . indeed, looking @ size , ranks of communicator, seems simi...

variable not showing up in bash script when using an array -

i have script prepare files submit trough qsub cluster, creating array based on file , using elements in array create qsub files. however, can't append variables $rawdata/$i_1.fastq.gz part. script: > cat create.sh #!/bin/bash rawdata="/home/jfertaj/data/fastq" # make array of each sample id mapfile -t myarray < array.txt in "${myarray[@]}" cat > pbs.script.$i << eof #!/bin/bash kallisto quant -t 16 -b 100 -o /home/jfertaj/data/results_kallisto/output_bootstrap_$i $rawdata/$i_1.fastq.gz $rawdata/$i_2.fastq.gz eof done exit 0; when run bash script , created files see this: ... kallisto quant -t 16 -b 100 -o /home/jfertaj/data/results_kallisto/output_bootstrap_intp_993 /home/jfertaj/data/fastq/.fastq.gz /home/jfertaj/data/fastq/.fastq.gz i have tried including "$i" shows on resulting files: "intp_993"_1.fastq.tz . there way fix it? replace $rawdata/$i_1.fastq.gz $rawdata/$i_2.fastq....

angularjs - condition for ng-model -

help me please ng-model. have input field when selecting substituted values array 'posters'. yhe value selected filter appear in list. list displayed default 'the grund tour'. when enter in form of value not in array - in list displays empty field, need displayed or value of array or default value (if form entered value not of array). have no idea how it. think may possible apply condition ng-model make work values of array my code html: <div class="container" ng-controller = "formcontroller"> <div class="container__item container__form"><!-- 1 --> <form action="" class="form"> <input type="text" class="form__input" placeholder="search..." autocomplete="on" list="posters" ng-model="postertitle" > <datalist id="posters" > <option ng-repeat="poster i...

c - Tries Data Structure - Print All Values -

i want print values in trie data structure, code parts of dictionary program. void search(struct dictionary **current) { if((*current)->is_end==1){ printf("\n"); getchar(); } for(int i=0; i<26; i++){ if((*current)->children[i]!=null){ printf("%c",i+(int)'a'); search(&(*current)->children[i]); } } } i want push values. "false" "fail" but when run code, program shows: fail lse the parts "fa" of "false" doesn't showing because recursion doesn't start beginning again if is_end has been marked. you don't need restart recursion begining every time reach terminal node. can keep buffer current prefix when traverse trie , print entire content every time is_end true.

parsing - How to validate a message in pcap? -

Image
i have requirement expand required tree in decoded parameters of pcap file , validate message in it. example: open "transmission control protocol" shown in screenshot , and validate message "this ack segment in frame: 278". need develop automation script in java validating messages in pcap files . using jnetpcap lib. appreciate inputs!. you can't, without protocol analysis yourself. pcap file doesn't include such massages. the message "this ack segment in frame: 278" generated wireshark after tcp session analysis itself. frame number 278 assigned wireshark. pcap file contains packets' data.

Inserting a row with Android Content Provider -

i have next content provider insert row in table agenda, do: contentvalues values = new contentvalues(1); values.put("msg", "test"); context.getcontentresolver().insert(dataprovider.content_uri_agenda, values); and works well. but now, i´d use uri agenda_insertwithconflict insert row. please, how can modify line : context.getcontentresolver().insert(dataprovider.content_uri_agenda, values); to it? here provider: public class dataprovider extends contentprovider { public static final string tagprovider = "net.techabout.medappointment.provider"; public static final uri content_uri_agenda = uri.parse("content://"+tagprovider+"/agenda"); public static final string table_agenda = "agenda"; private dbhelper dbhelper; private static final int agenda_allrows = 5; private static final int agenda_insertwithconflict=7; private static final urimatcher urimatcher; static { ...

compiler errors - Xcode 8.1 swift 3 take forever to compile this code -

i have class in project use swift 2.3. when migrated project swift 3, xcode took forever compile , saw stuck @ class. can not build whole project because of class. there way modify class project can built, took xcode forever compile piece of code. if removed several properties myclass, xcode compile again. has idea on how solve problem? import foundation class myclass: nsobject { var id: string = "" var uid: string = "" var uname: string = "" var fname: string = "" var txt: string = "" var hay: float = 0 var flag = false var long: double = 0 var lat: double = 0 var altitude: double = 0 var course: double = 0 var speed: double = 0 var lname: string = "" var city: string = "" var country: string = "" var sublocal: string = "" var subarea: string = "" var thumb: string = "" var trash = false va...

osx - Using Windows Word macro in Mac Word -

i have written macro (assigned button) in word in windows, , want use in word in mac, however, button not working in mac anymore, , have run macro visual basic editor. hints? private sub commandbutton_click() selection.tables(1).columns(1).select selection.find .style = "style2" icount = 0 while .execute icount = icount + 1 wend msgbox (icount) end end sub unfortunately, cannot link macro button in word mac. button object exists in userforms- not directly in word document. (oddly enough, exist in excel.) has been major frustration me want allow users kick off script without visiting "macros" area. can access macros from menu item: tools -> macro -> macros, or view ribbon in 2016. note: make available macros area, have make public. you can link macro key command, run macros menu, or have run on document_new() or document_open(). here's microsoft's official way run mac...

excel - Search for complete data in column "k" -

i created report userform using advance filter , search works fine. want show complete data , uncompleted data check box. this search code: private sub commandbutton1_click() 'dim variables dim crit range dim findme range dim datash worksheet 'error handler on error goto errhandler: 'set object variables set datash = sheet1 'hold in memory , stop screen flicker application.screenupdating = false '/////////////////////////////////////////// 'if header selected add criteria if me.cmdheader.value <> "all_columns" if me.textbox1 = "" datash.range("bu9") = "" else datash.range("bu9") = "" & me.textbox1.value & "" end if end if '////////////////////////////////////////// 'if columns selected if me.cmdheader.value = "all_columns" 'find value in column set findme = datash.range("b9:bk30000").find(what:=me.textbox1, lookin:...

sql server - sp_execute for multiple dynamic T-SQL statements ak a batch -

ideally i'd execute several sql statements single exec sp_executesql statement. example use 1 if exists determine if second statement run: drop proc ai_importdataaddlistposn go create proc ai_importdataaddlistposn(@paramtablename nvarchar(255), @debug int ) begin declare @sql nvarchar(4000) set @sql = n'if not exists(select * syscolumns inner join sysobjects on syscolumns.id = sysobjects.id sysobjects.name = ''' + @paramtablename + ''' , syscolumns.name = ''listposn'');' + 'alter table [' + @paramtablename + '] add listposn int identity(1,1)' if @debug = 1 print @sql exec sp_executesql @sql end go exec ai_importdataaddlistposn deptformove, 1 i realise example not test existence of table first, simplified example not real problem. aware of sql injection , how combat it. i'm reasonably happy both statements sql i thought ";" may act statement terminator i aware of sql in...

angularjs - filtering in angular by select and checkbox -

want filter out values both select box , in checkbox achieved in select box can't able checkbox my plunker demo example here . use single object checkboxes, , can use comparator function in filter, this: $scope.checkmake = function(value) { //assume no filter applied value shown. var result = true; (var in $scope.selected) { if ($scope.selected[i] === true) { //if here, know filter applied, //check see if passed value 1 of selected //checkboxes result = $scope.selected[value]; break; } } return result; }

subprocess - Executing cmd commands from python program -

from subprocess import * s=popen(['c:\python27\scripts\pyssim',"'c:\users\p\desktop\1.png'",'c:\users\p\desktop\2.png'],stderr=pipe,stdout=pipe,shell=true) out,err=s.communicate() print out the python program above executes shows no output. nothing printed on shell. while running command on cmd gives output "1". your command failing because parameters being passed not think are; keep in mind backslashes treated start of escape sequences in python string literals. specifically, \1 , \2 being treated octal character escapes, rather digits. if looked @ contents of err , find file not found error. possible solutions: double of backslashes, escape them. put 'r' in front of each string literal, make them 'raw strings' don't specially interpret backslashes. not applicable in case, can use forward slashes instead - of windows happily accept them instead of backslashes, 1 exception being command line (w...

javascript - I have react tabs code working perfectly but I need to change the html structure -

i have react tabs code working need change html structure match below one. possible bring tab content after <a> tag maintain html structure? https://jsfiddle.net/9e767txs/9/ <div classname="sports-tab-container"> <ul> <li role="presentation" classname="sports-setup-ico first-time-active ft-active-tab"> <a href="javascript:;" classname="sports-tab-header"> <h2>sports player</h2> <p classname="sports-subtitle">days 1 , 2</p> </a> <div classname="sports-tab-content"> <p classname="sports-large-text ft-day1 ft-day2">lorem ipsum dummy text of printing , typesetting industry. lorem ipsum has been industry</p> </div> </li> <li role="presentation" classname="sports-invest-ico"> <a href="javascript:;" classname=...

asp.net - Assigning property values to a checkbox mvc c# -

hoping can give me point in right direction this. so have working "product" form employees fill in , results show on table. i've added "approved" check box form, again result of being checked or not displayed in table. however, employee can edit record of checks , unchecks box in database. i've added checkedby , checkboxdate "product" database table , model. i'm wondering right way go or if should have own table, model, properties etc checkbox? my suggestion have separate table 4 columns - updatedby (saves made update), updatedate(i.e. when update made may system date), component(which part or page name updated) , section(which value or control updated). use table such future change across product.

Query object on java persistence and hibernate -

what's difference between query object on: - javax.management - javax.persitence - org.hibernate should use, , why ? first of all, based on tags of question, javax.management.query not relevant you, deals mbeans, , not db queries. now regarding javax.persistence.query vs org.hibernate.query. that depends of goals. if plan stay hibernate in project, use org.hibernate.query, provides more useful methods standard interface. if plan switch provider, eclipselink, should use standard interface both, javax.persistence.query. https://docs.jboss.org/hibernate/orm/3.2/api/org/hibernate/query.html http://docs.oracle.com/javaee/6/api/javax/persistence/query.html

Project Locations in Visual Studio 2015 -

i have asp.net core app using class library projects e.g. domain, repositories, etc. these class libraries used in cloud app runs worker role why want keep them separate , development should follow own course , not depend on asp.net core app. with said, asp.net core project should aware of changes made class library projects why want link them solution asp.net project. what's best way structure these project folders? folder structure follows: my projects folder --- myaspnetcoreproject (has own solution) --- mybackendproject (has own solution contains following projects) ----- domainproject ----- repositoriesproject when try "add existing project" link backend projects asp.net core project, following message: the project attempting add source control may cause other source control users have difficulty opening solution or getting newer versions of it. avoid problem, add project location below binding root of other source controlled projec...

c# - Are expression trees thread-safe? -

i want cache expressions generated dynamically (with linqkit) in order pass them where clause part of entity framework query. so have like private static expression<func<t, bool>> _expression; // gets value @ runtime public iqueryable<t> apply(iqueryable<t> query) { return query.where(_expression); // here _expression has value } is safe multiple threads call apply , execute queries in parallel? expression<tdelegate> class thread-safe? docs give standard "any public static (shared in visual basic) members of type thread safe..." expression trees immutable. however, can refer things do change, e.g. using system; using system.collections.generic; using system.linq; using system.linq.expressions; public class test { static void main() { int multiplier = 3; iqueryable<int> values = new list<int> { 1, 2 }.asqueryable(); expression<func<int, int>> expressi...

c# - Putting contents of a .txt file into a List in -

i have .txt file looks this: 1,bob,male //first row 2,jim,male //second row 3,mary,female //third row i want put these items generic list in c#, storing each column "id", "name", "gender" , treating each row different item of list. how go doing this? have no idea start. i've looked @ i/o operations , understand how access file, don't know how create variable name each column , store each row new entry. create class represent data. lets call person person have 3 properties id(int) , gender(string) , name(string) create list<person> listofperson = new list<person>() ; read file line line using loop -> check file.readlines method create new instance of class in loop person person = new person(); take line file, call string.split(','); set person properties string[] create splitting p.id = arr[0] , on add person class list<person> i answer text should try , learn how in future !

html - Aligning bottoms of divs to same level -

is there way comment divs bottom same level of buttons bottom line? this how works. quick jsfiddle .button_div { width: 54px; height: 20px; float: left; } .comments { width: 320px; margin-right: -100px; height: 340px; background-color: #818181; float: left; } .comment_cont { float: right; } and how want look. accomplished negative top margin , approach don't work me, because height of comment div may change. you can use display: flex align-items: flex-end on parent element. .comments { width: 320px; height: 340px; background-color: #818181; } .comment_cont { float: right; display: flex; align-items: flex-end; } <div class="comment_cont"> <div class="button_div"> <button>button</button> </div> <div class="comments"></div> </div>

Apache: Changing Allow and deny to Require -

i required change what's written below use require directive instead, unsure if doing correctly. still in learning phases, , unsure how works. <directory /usr/local/apache/htdocs/mywebsite> order allow, deny deny allow atlanticferries.com </directory> my rewritten version is: <directory /usr/local/apache/htdocs/mywebsite> <requireall> require host atlanticferries.com </requireall> </directory> i have thought of writing using requirenone instead: <directory /usr/local/apache/htdocs/mywebsite> <requirenone> require not host atlanticferries.com </requirenone> </directory> if written require, how done? thank you! requireany , requirenone tags more complex situations in more require directives involved. what need is: <directory /usr/local/apache/htdocs/mywebsite> require host atlanticferries.com </directory> or deny: <directory /usr/local/apache/htdocs/mywebsite> req...

parse.com - Parse Push's not delivered cloud code only -

i'm running parse-server on ubuntu , can't seem push notifications working when sent in cloud code. push's work when using rest api call (passing master key) don't work when cloud code calls them. what's interesting cloud code parse.push() method returns success , no error message. my hypothesis configuration problem, , parse.push() method referencing somethign have incorrectly configured on server. here cloud function. call works when sent via rest. , success callback in cloud called. parse.push.send( { // where: pushqueryclient, channels: ["user_tkp7gurgzc"], data: { alert: pushtextclient } }, { success:function(){ console.log("push sent"); }, error: function(error){ console.log("push failed"); console.dir(error); }, usemasterkey: true}); i think have issue usemasterkey parameter. please try use code in order send push noti...

The partial name (sets/3/0) is not a valid Ruby identifier -

i trying render decently-complex series of partials in app , getting following error message: the partial name (sets/3/1) not valid ruby identifier; make sure partial name starts underscore, , followed combination of letters, numbers , underscores. this partial rendered generators#show action, using following code: <% @random_partial = 'sets/' + bucket.to_s + '/' + rand(2).round.to_s %> <%= render partial: @random_partial %> bucket number (between 1 , 7, not that matters) , random number choose random partial in bucket . file structure looks this: generators |--exercises |--_cardio0.html.erb |--_cardio1.html.erb |--_weight0.html.erb |--_weight1.html.erb |--sets |--1 |--_0.html.erb |--_1.html.erb |--2 |--_0.html.erb |--_1.html.erb |--3 |--_0.html.erb |--_1.html.erb |--4 |--_0.html.erb |--_1.html.erb |--5 |--_0.html.erb |--_1.html.erb ...

c++ - I'm trying to create a function that toggles between a 24 hour clock and a 12 hour clock using Boolean expressions -

in program creating, need able toggle option main menu change 24 hour clock 12 hour clock , vice versa. understand need swap bool values in order create toggle, have no idea how so. here function below: void printtime(int h, int m, bool mode) { if (mode = 0) { mode = 1; cout << "24-hour mode turned on" << endl; } else { mode = 0; cout << "12-hour mode turned on" << endl; } } to able change variable outside function's scope should pass reference. void printtime(int h, int m, bool& mode) { mode = !mode; //toggle mode std::cout << (mode ? "24" : "12") << "-hour mode turned on" << std::endl; } then can change value in different scope; int main() { bool mode24 = true; printtime(2, 4, mode24); //changes mode24 false printtime(2, 4, mode24); //changes mode24 true return 0; }

make space between link button CSS -

does know how can place space between buttons(buttons act links)? cant realy find answer anywhere.... css code: .btn { -webkit-border-radius: 0; -moz-border-radius: 0; border-radius: 0px; -webkit-box-shadow: 6px 1px 18px #666666; -moz-box-shadow: 6px 1px 18px #666666; box-shadow: 6px 1px 18px #666666; font-family: arial; color: #ffffff; font-size: 14px; background: #447494; padding: 6px 25px 6px 10px; text-decoration: none; .btn:hover { background: #079ce6; text-decoration: none; } i want space beteen buttons sample snippet play around included below. it should depend on how markup structured. in below sample new class added highlight situation, remove class , add property .btn : .btn { -webkit-border-radius: 0; -moz-border-radius: 0; border-radius: 0px; -webkit-box-shadow: 6px 1px 18px #666666; -moz-box-shadow: 6px 1px 18px #666666; box-shadow: 6px 1px 18px #666666; font-family: arial; color: #ffffff; font-size: 14px; back...

Nested JSON in ODATA SAPUI5 mockup -

i using nested json file mockup data in odata sapui5 application, cannot access nested data. json content [{ "testcase": { "specification": "srs pr 28717 – deposit in brazilian reais", "execution": { "description": "desc", "bca_cn_acct_01": { "header": { "section": "field / section name", "data": "data enter / value select", "action": "activity / check / comment" }, "frame": { "id": 1, "title": "create account: initial screen", "data": [{ "key": "contract start", "value": "02/16/2000", "action": "" ...

Running custom zsh function for tmux status bar not displaying output -

i'm wrote function called test_status trying incorporate in tmux status bar. give background, tests output file called .guard_result either success or failure , test_status function reads file , echoes 💚 if tests passing , ❤️ if failing. the news running test_status works fine, i'm having trouble getting work tmux. missing here? # ~/.oh-my-zsh/custom/aliases.zsh function test_status { if [ ! -f "./.guard_result" ]; echo "?" return 1 fi result="$(cat ./.guard_result)" if [[ $result == *"success"* ]] echo "💚"; elif [[ $result == *"fail"* ]] echo "❤️"; fi } this function works... here tmux configuration (which doesn't show result): # ~/.tmux.conf set -g status-right "#(test_status) #[fg=colour245]%d %b %y #[fg=white]:: #[fg=colour245]%l:%m %p" i know must missing simple... help! tmux passes shell commands /bin/sh not zsh . , if ...

Chrome Developer Tools. Classes not found in bootstrap.css file, and shows in the grid.less virtual file -

to correctly replace property, must correctly understand origin , perform override. my results show in "chrome developer tools, ctrl + shift + i" class .container not found in bootstrap.css file. not show actual source. why? how fix? it shows stored in grid.less file. why file? request non-existent file in folder name. @include requests can not found in bootstrap. demo search classes: .container { padding-right: 15px; padding-left: 15px; margin-right: auto; margin-left: auto; } result: grid.less:10 in ... css/bootstrap-3.3.7-dist/css/less/mixins/grid.less .container-fixed(@gutter: @grid-gutter-width) { margin-right: auto; margin-left: auto; padding-left: floor((@gutter / 2)); padding-right: ceil((@gutter / 2)); // line 10 on grid.less &:extend(.clearfix all); } chrome developer tools reading css map provided bootstrap. you can either remove bootstrap.css.map resources or disable css maps in chrome developer t...

pointers - What does this C function declaration mean? -

schedule_accept(int fd, int (*handler)(int, fdeventhandlerptr, acceptrequestptr), void *data) apologies seeming avoid searching answer here don't know constructs in order search intelligently them. i'm interested in second parameter means? my best guess it's int (that refers memory location) composed(?) of tuple of 3 referred types. correct? if interested in 1 of these (and i'm right in description in first place) how refer it? int (*handler)(int, fdeventhandlerptr, acceptrequestptr) defines parameter named handler pointer (hence * ) function, returns int (hence "outer" int ) , takes 3 arguments, namely 1 int , 1 fdeventhandlerptr , 1 acceptrequestptr .

sql - How to define that an attribute is optional? -

i'm programming sql server 2014 management studio. i want build in program optional attribute. e.g create table [picture] ( title varchar(20), signature varchar(20), <--- should optional alttext varchar(20) ) typically, default "optional" -- if data signature column not provided, have value of null . however, specify explicitly (if, instance, database configuration default not null ), signature field expressed so: signature varchar(20) null

javascript - Get element offset relative to document without getBoundingClientRect (Webkit bug) -

positioning tooltip / popup case of using getboundingclientrect() or jquery's offset() function (which internally uses getboundingclientrect) offset relative document or window, if zoom in on webkit browsers, these functions start returning unexpected / wrong results because getboundingclientrect function implemented weirdly in webkit. has been issue forever , reason has never been fixed. question: how can (if possible) calculate exact pixel offset of element relative document without using getboundingclientrect() values don't change on zoom? i able solve in https://jsbin.com/vaculorita/1/edit?css,js,output i'm not sure jquery's offset trying combination of switching absolute positioning , manually using getboundingclientrect works me. html <div id="tooltip">tooltip</div> <input type="text" id="username"> css #username { margin-left: 54px; margin-top: 21px; } #tooltip { position: absolut...

gstreamer - Attempting to determine astronomy values in a parameter file -

recently inherited quite few old quickbasic programs perform various astronomical calculations. i'm attempting understand these programs , rewrite of them in python. not have deep background in astronomy. a number of programs take parameter file input, year.dat. below 5 years of these files (each column represents 1 file). need in figuring out various data values. year.dat year 2001 2008 2009 2010 2011 delta t 66 65 66 66 67 tilt 23.43909 23.43818 23.43805 23.43799 23.43786 dow 1 2 4 5 6 gst 6.71430 6.66860 6.71839 6.702509 6.68659 x1 105.690 330.340 310.959 291.631 272.303 bs 84 90 88 87 86 fs 301 300 298 304 303 x2 357.765 356.959 ...

jsf 2.2 - Using Glassfish JDBC realm with primefaces -

i've set jdbc realm on gf 4.1 server , configured web.xml , glassfish-web.xml etc. idea when user trying access restricted resource, primefaces "login" dialog shown necessary input fields. after having logged in, user should redirected desired page. whenever scenario happens parameter (?key=login) send page on basis supposed display login-dialog executing method in backing bean. when following line included in backing bean requestcontext.getcurrentinstance().execute("pf('logindialog').show();"); the "logindialog" isn't rendered (included). have 2 questions: why isn't dialog rendered in index.xhtml? , bad approach together? here web.xml: <login-config> <auth-method>form</auth-method> <realm-name>testrealm</realm-name> <form-login-config> <form-login-page>/index.xhtml?key=login</form-login-page> <form-error-page>/loginerror.xhtml</form-error-...

khan academy - Javascript programming on Khanacademy. How come the buttons on the bottom half does not work? -

i working on calculator after setting buttons bottom half of buttons not react top half. please help. link project: https://www.khanacademy.org/computer-programming/calculator/6690221911506944 this because of call btnx.draw.handlemouseclick() inside of mouseclicked function. if change following, work expected: mouseclicked = function() { btn7.handlemouseclick(); btn8.handlemouseclick(); btn9.handlemouseclick(); btndiv.handlemouseclick(); btn4.handlemouseclick(); btn5.handlemouseclick(); btn6.handlemouseclick(); btn1.handlemouseclick(); btn2.handlemouseclick(); btn3.handlemouseclick(); btnsub.handlemouseclick(); btn0.handlemouseclick(); btnc.handlemouseclick(); btnadd.handlemouseclick(); btnequal.handlemouseclick(); btnx.draw.handlemouseclick(); }; update: looks updated code calculator app, , removed btnx.draw.handlemouseclick function call - seems work. if answer helped you, please accept it.

escaping - raw string vs regular string help concerning escape characters c# -

i'm working in c# huge string (tab separated) containing many book titles , other columns of information relating each book have characters such \,(,),#,;,/,*,etc... appears messing code time time. i'm searching \t in order pull information original huge string. did research , found out using @ symbol raw strings ignore escape characters. problem don't know how go example. strpackageinfo = system.io.file.readalltext(@strfilename); to raw string. next concern if treat string raw string, when searching '\t' tabs grab information, won't find tabs? better way approach appreciated.

How can I declare an array with a variable, but without using malloc() in C? -

so have create 2d array going used print histogram. know array going 52 elements wide, height of array going equal max + 1 , different every time function in gets called. ideally, line accomplish following function: char histplot[max+1][52] = ""; as writing code, however, learned c, or @ least compiler, not allow array declared without constant value. professor of class i'm writing code not clear on whether or not use malloc() assignment. assuming cannot using malloc() , there way can create array histplot[][] have height of max + 1 ? edit: i've accepted there no real way accomplish i'm trying without using malloc() or similar function. did manage find solution doesn't involve functions or 2d array @ all, thank replied! some systems provide alloca function. (however, not standard c.) outside of that, there's no real way dynamically sized array. i can offer following more or less silly workarounds: use calloc or realloc alloca...

archive - Posts by month in Jekyll -

i trying create archive page of posts website. able have pages each list of posts month in format: www.mywebsite.com/2016/11 display posts november 2016. can have page each month have posted dynamically created each time post in new month? don't want have manually create new page each month. i can group posts year so: <ul> {% post in site.posts %} {% assign currentdate = post.date | date: "%y" %} {% if currentdate != date %} <li id="y{{currentdate}}">{{ currentdate }}</li> {% assign date = currentdate %} {% endif %} <li><a href="{{ post.url }}">{{ post.title }}</a></li> {% endfor %} </ul> thanks help. you can modify date filter integrate month, e.g. date: "%b %y" . that's used layout , separate <ul> each month. from documentation , month-only values date filter are: %b : abbreviated month name. %b : full month name. %m : month of year...

node.js - Remove some properties from array of javascript objects -

i remove properties array of javascript objects. here array of objects. obj_array = [{ "data_id": 1, "data_name": "jim", "data_bb_typ": 2, "data_mac": "5474", }, { "data_id": 3, "data_name": "fro", "data_bb_typ": 33, "data_mac": "8e30", }, { "data_id": 2, "data_name": "jimb", "data_bb_typ": 2, "data_mac": "45e8", }, { "data_id": 4, "data_name": "kht1", "data_bb_typ": 35, "data_mac": "58d0", }, { "data_id": 6, "data_name": "sens", "data_bb_typ": 34, "data_mac": "d004", } ] i have string array...

php - How to get returned text from model to a controller on Laravel 5.3 -

how grab / returned text model function controller ?? i'm using laravel 5.3 framework example : //my model class mymodel extends model{ function myfunction(){ if($a == $b){ $text = "a = b"; return $text; } else if($a != $b){ $text = "a ! b"; return $text; } else{ $text = "some text"; return $text; } } } and in controller : //my controller class mycontroller extends controller{ public function test(){ $obj = new mymodel; $data = $obj->myfunction(); var_dump($data); // want returned myfunction() } } please me :d thanks attention :) your code working fine me.you have assign value $a , $b in model public function myfunction($a,$b){ if($a == $b){ return "a = b"; } else if($a != $b){ return "a ! b"; } else{ return ...

oop - How to pass values from one class's method to another class's method in Typescript? -

i'm new object oriented programming , assuming should easy concept seasoned oo programmers, i'm struggling it. in angular2 app have httpservice class shown below: http.service.ts @injectable() export class httpservice { constructor(private http: http) { } addleaf(parentid, label, name){ var headers = new headers(); headers.append('content-type', 'application/json'); return this.http.post('http://localhost:8000/addleaf/', {'parentid':parentid,'label':label, 'name':name}, { headers: headers }) .map(res => res).subscribe(); } i try call method within class below: leaf.ts import { httpservice } './http.service'; export class leaf{ name: string; ... http: http; // unsure these 2 lines private httpservice: httpservice = new httpservice(this.http) constructor(input){ this.name = input.name; ... add(){ //what should go here? this....

angularjs - Access a collection from html in karma unit test -

i have quick question. i'm sorry, i'm c++ developer , manager having me fill in on angular team temporarily, though have no previous experience in it. i'm writing karma tests , in html i'm testing have like: ng-repeat phone in phonelist the controller modifies phonelist . controller called ctlr . (not sure if matters). i need know how put element phonelist within karma test. i've tried like: var phonelist = dom.find("#phonelist"); phonelist.push(someobjectivecreated); expect(dom.find("#phonelist).length).tobe(1); length still 0. know i'm doing isn't right anyway because have no idea i'm doing. if can figure part out have other karma test examples sort of copy need. hate karma tests. what doing wrong? hope enough information. thanks!

r - ggplot2 bar plot: hjust depending on bar and label size -

Image
being new r, produced simple horizontal bar plots using ggplot2 , coord_flip() . notably, insert values of x variable @ left side of bar default (or @ right side if label not fit) using following command: geom_text(aes(x=type, y=count, ymax=count, label=count, hjust=ifelse(count>1000, 1.5, -0.3)), size=3.5, position = position_dodge(width=0.8)) the problem that, depending on data-sets, x values can vary (e.g. dataset_1 x values can between 1 200; dataset_2 x values can between 10,000 100,000; ...), causes label of shortest bar misplaced ifelse statement using (see brown bar in figure below). in case cannot use constant count>1000 condition datasets. figure a: i modify manually value of hjust=ifelse(count>1000,... statement each dataset. wondering if possible automatically move label outs of bar if not fit between axis , top of bar without modifying value of ifelse condition each dataset, in figure b below. figure b : edit wor...

winforms - C# DirectoryNotFoundException was unhandled in Windows 10 machine -

c# application.exe not working in win10,but worked on win7. tried debug in win10 shows me error correct in win7. using system; using system.windows.forms; using system.io; namespace windowsformsapplication2 { public partial class form1 : form { public form1() { initializecomponent(); string fullcomputername = environment.machinename; //create folder path string createfolderpath = @"c:\\users\\" +fullcomputername+"\\documents\\cheques"; //create file inside of folder string createtxtfile= createfolderpath + "\\chequefordeposit.txt"; try { if(!directory.exists(createfolderpath)) { return; } directory.createdirectory(createfolderpath); } catch { } { } if(!file.exists(createtxtfile)) { file.create(createtxtfile); }//the error here } } } when check in win7 pc, creates folder , text file. not in win...

bash - Need regex to remove a character in a datetime string in csv file -

i have csv file has following string: "2016-10-25t14:07:49.298-07:00" which replace with: "2016-10-25", "14:07:49" i matched original string regular expression: ([0-9]{4}-[0-9]{2}-[0-9]{2})[t]([0-9]{2}\:[0-9]{2}\:[0-9]{2})\.[0-9]{3}-07\:00 but need help with awk , assuming t , . unique $ echo '"2016-10-25t14:07:49.298-07:00"' | awk -f'[t.]' '{print $1 "\", \"" $2 "\""}' "2016-10-25", "14:07:49" -f'[t.]' assign t or . field separator then print first , second field required formatting

elasticsearch - Deleting a type in Elastic Search using curl -

i trying delete type in elastic search using curl script in bat file echo running curl script curl -xdelete "http://localhost/testing/" -d'' pause the response got no handler found uri . looked documentation of elastic search , says use delete query https://www.elastic.co/guide/en/elasticsearch/reference/5.0/docs-delete-by-query.html how can modify curl script use new api es 2.3 thanks if want use delete-by-query api delete documents of given type, can this: curl -xdelete "http://localhost/testing/_query?q=_type:typename" however, you're better off deleting index , recreating can modify mapping type see fit. curl -xdelete "http://localhost/testing/" curl -xput "http://localhost/testing/" -d '{"settings": {...}, "mappings": {...}}'

File contains no section headers when install edx platform -

i meet problem when install edx platfrom on ubuntu 12.04 server. error below: think problem filename contain chacter /n. dont know how fix it. please me ! task: [edxlocal | create databases] ******************************************* failed: [localhost] => (item=reports) => {"failed": true, "item": "reports", "parsed": false} become-success-gsjhenekpiixbpukbagryuruzhmsypqf traceback (most recent call last): file "/root/.ansible/tmp/ansible-tmp-1478348558.69-130063355639050/mysql_db", line 2117, in <module> main() file "/root/.ansible/tmp/ansible-tmp-1478348558.69-130063355639050/mysql_db", line 302, in main mycnf_creds = load_mycnf() file "/root/.ansible/tmp/ansible-tmp-1478348558.69-130063355639050 /mysql_db", line 241, in load_mycnf config.readfp(open(mycnf)) file "/usr/lib/python2.7/configparser.py", line 324, in readfp self._read(fp, filename) file ...

c# - Prism TDD Unsubscribe() -

i'm using tdd , want write unit test unsubscribe() method available in pubsubevent. because there no interface inherit parent class, has no interface, don't know how test it. my service , method, test: public class frameservice: iframeservice { private readonly ieventaggregator _eventaggregator; public void unsubscribeevents() { _eventagregator.getevent<frameaddedevent>() .unsubscribe(frameaddedeventhandler); // how unit test this? } } the frameaddedevent class, inherit pubsubevent prism library: public class frameaddedevent: pubsubevent<frame> { } declaration in prism's library: public class pubsubevent<tpayload> : eventbase { public subscriptiontoken subscribe(action<tpayload> action); } my test (using mstest , moq) first part of code line. need unittest assert on unsubscribe() [testclass] public class frameservicetest { private mock<ieventagregator> _eventa...

algorithm - How is Amazon SQS visibility timeout implemented? -

i wondering how efficient implementation of sqs visibility timeout looks like. messages put in queue , worker sweeps on , removes reached timeout threshold? i implement storing timestamp says when make visible. during receivemessage() , not return messages timestamp < now in management console, show timestamp < now messages in flight when timestamp >= now , nothing! while there lot of timestamp comparisons, no worse checking status code. plus, there's no need clear timestamp when time has past, "efficient" in no 'sweep' processes required. amazon sqs highly distributed across multiple servers , multiple availability zones, efficient avoid possible data update since need replicated amongst servers.

html - Php image resize in output -

i have php function resize image according need , size wish display. problem how set display resized image in html image element without setting php content type image? if set content type image display image in whole page , if remove it output long unknown characters, how do want? <?php function croppedthumbnail($imagename, $imgwidth, $imgheight){ // set maximum height , width $width = $imgwidth; $height = $imgheight; // content type //header('content-type: image/jpeg'); // new dimensions list($width_orig, $height_orig) = getimagesize($imagename); $ratio_orig = $width_orig/$height_orig; if ($width/$height > $ratio_orig) { $width = $height*$ratio_orig; } else { $height = $width/$ratio_orig; } // resample $image_p = imagecreatetruecolor($width, $height); $image = imagecreatefromjpeg($imagename); imagecopyresampled($image_p, $image, 0, 0, 0, 0, $width, $height, $width_orig, $height_orig); // output imagejpeg($image_p, $imagename, 100); return $imagename;...

html - Thumbnal images not aligningn horizontally -

<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/> <div class="container-fluid"> <div class="row"> <div class="col-md-4"><br><br><img src="images\smartphone.png" class="img-circle" alt="" width="243" height="241" align="middle"><br><h4 style="color:#1e7145" align="center">smart phone</h4></div> <div class="col-md-4"><br><br><img src="images\oldphone.png" class="img-circle" alt="" width="243" height="241" align="middle"><br><h4 style="color:#1e7145" align="center">basic phone</h4></div> <div class="col-md-4"><br><br><img src="images\tab.pn...