Posts

Showing posts from May, 2010

javascript - Meteor : wait until all templates are rendered -

i have following template code <template name="home"> <div class="mainbox"> <ul class="itemlist"> {{#each this}} {{> listitem}} {{/each}} </ul> </div> </template> <template name="listitem"> <li class="item"> {{username}} </li> </template> and i'd execute code once of "listitem" rendered. there 100 of them. tried following template.home.rendered = function() { // called once of 'subviews' rendered? }; but doesn't wait until views loaded. what's best way of knowing when sub-view templates loaded? this how proceed : client/views/home/home.html <template name="home"> {{#if itemsready}} {{> itemslist}} {{/if}} </template> <template name="itemslist"> <ul> {{#each items}} {{&g

css - border causes div to overlap past 100% by 1 or 2px -

i have our navigation bar set 100%. bar has 1px border on it. reason, border causes nav bar stick out right 1 or 2 pixels. tried setting border 0 in firebug , sure enough, lined correctly. our site here: http://clubschoicefundraising.com/ as can see, blue nav bar @ top stick out left side. can remove "right: 0" , sticks out right side. how prevent border causing nav bar stick out? update: requested, here css nav: nav { position: absolute; right: 0; top: 70px; margin-top: 5px; font-size: 1.3em; font-weight: 600; list-style: none; width: 100%; margin: 5px auto; height: 43px; padding: 0; z-index: 10; /* background color , gradients */ background: #014464; background: -moz-linear-gradient(top, #0272a7, #013953); background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#0272a7), to(#013953)); background: -ms-linear-gradient(top, #0272a7, #013953); background: -moz-linear-gradient(top, #3c78b9, #28507b); background: -webkit-gradient(linear, 0% 0%, 0% 10

Is WSO2 JAVA 8 ready? -

i utilize wso2 esb, app server, , data services modules. being forced move off of java 7 , upgrade java 8. have information on if wso2 compatible java 8? thanks! all wso2 products based on carbon kernel 4.4.0 or higher version supports java 8. @ moment following wso2 products been released java 8 support. governance registry 5.0.1 business process server 3.5.0 machine learner 1.0.0 complex event processor 4.0.0 application server 5.3.0 enterprise store 2.0.0 enterprise service bus 4.9.0 governance registry 5.0.0 you can refer wso2 release matrix check latest wso2 product releases.

swift - Showing image from url with placeholder in UITextView with attributed string -

i'm developing lib markdown swift , works fine! there little problem, when load images in markdown put placeholder image , dispatch process load original image, this: var attachment: nstextattachment = nstextattachment() attachment.image = uiimage(named: "placeholder.png") attachment.bounds = cgrect(origin: cgpointzero, size: attachment.image.size.width > uiscreen.mainscreen().bounds.width ? cgsizemake(uiscreen.mainscreen().bounds.width, uiscreen.mainscreen().bounds.width/attachment.image.size.width * attachment.image.size.height) : attachment.image.size ) dispatch_async(dispatch_get_global_queue(dispatch_queue_priority_default, 0), { () -> void in let imagedata: nsdata = nsdata(contentsofurl: url) attachment.image = uiimage(data: imagedata) attachment.bounds = cgrect(origin: cgpointzero, size: attachment.image.size.width > uiscreen.mainscreen().bounds.width ? cgsizemake

php - how to not upload empty file inputs -

i have many file inputs in html form. of them in array. for example : <input type="file" name="attach[]"> <input type="file" name="attach[]"> <input type="file" name="attach[]"> <input type="file" name="attach[]"> how can find empty inputs in php? use in each when uploading file <?php if(!empty($_files['attach'][$i])) { //upload function } ?>

php - how to display checkin table in one row -

Image
i have table looks this. pers_id pers_name pers_date pers_date_attend_ind 431 bacon 1/14/2013 n 431 bacon 1/27/2013 n 431 bacon 1/28/2013 n 431 bacon 2/17/2013 n i'd display in php like <date 1> <date 2> <date 3> bacon n n n i'm @ loss how that. assume $rows variable looks after fetching results this: $rows = array(0 => array('pers_id' => 431, 'pers_name' => 'bacon', 'pers_date' => '1/14/2013', 'pers_date_attend_ind' => 'n'), 1 => array('pers_id' => 431, 'pers_name' => 'bacon', 'pers_date' => '1/27/2013', 'pers_date_attend_ind' => 'n'), 2 => array('pers_id' => 431, 'pers_name' => 'bacon', 'pers_date' => '1/28/2013', 'pers_date

java - GWT - Load a configuration item from context.xml -

i have gwt rpc application deployed tomcat 8, , want server code load configuration data (hostname , port service). otherwise service works fine. have read multiple suggestions cant work. a snippet tomcat context.xml (i'm aware context.xml requires me restart tomcat when changed - ok). <context reloadable="true"> <parameter name="config_hostname" value="192.168.2.199" override="false"/> <parameter name="config_port" value="8888" override="false"/> in service implementation have setup() method. in try access config by: string hostname = getservletconfig().getinitparameter("config_hostname"); string port = getservletconfig().getinitparameter("config_port"); however doesnt work. can put me on right track? ----------------------- update ------------------- i have tried putting info in web.xml this <web-app> <context-param> <param-name&

java - Issues with Image Convolution -

i implementing own image convolution method in java, supposed general can run kernals through it. works , able output things, output wrong. right side of image appears on left hand side, , image seems triplicate throughout varying intensities. occurs regardless of kernal running (i have tried 9x9 , standard 3x3) , similar things occur. have played , changed work still behaving incorrectly. for (int = 0; < (image.getwidth()-mask.length); i++) { (int j = 0; j < (image.getheight()-mask.length); j++) { int sum = 0; (int w = 0; w < mask.length; w++) { (int z = 0; z < mask.length; z++) { sum += arr[w + i][z + j] * mask[w][z]; } } if(sum < 170) { convarray[i][j] = 0; } else { convarray[i][j] = 255; }

reflection - C# create constructor while running -

Image
i started read reflection , wonder, there way create constructor while program running. example: class c , check if c got empty constructor, if not, create on , use create instance. constructor might have parameters too. how can that? thank you in .net world, need know quite things. when class doens't have constructor, compiler adds default public 1 without parameters. that means when have following class: public class person { public int age { { return 10; } } } it can instantiated like: class program { static void main(string[] args) { var person = new person(); console.writeline(person.age); } } this produce following output: as create constructor, default public, parameterless 1 not added compiler. this means when change person class following: public class person { private person() { } public int age { { return 10; } } } you're not able instantiate class using

ios - UITableView scroll to element programmatically -

i have array of 20 elements, , table view can show 5 of them. on start of view, selecting 1 item, , want show item in table view selecting it. when choose 1 of first 5, selection visible. when select 5+ element, want element visible moving content offset. how can scroll tableview specific element list inside tableview array? in function of table view delegate do that? i tried setting content offset, , scrolltorowatindexpath inside cellforrowatindexpath method, not working correctly. ideas? calling scrolltorowatindexpath: @ cellforrow not work..first need reload data of tableview , need call below after selecting item.. nsindexpath *indexpath = [nsindexpath indexpathforrow:selectedrow insection:0]; [self.tableview reloaddata]; [self.tableview scrolltorowatindexpath:indexpath atscrollposition:uitableviewscrollpositiontop animated:yes]; hope helps you..

python - tkinter and matplotlib: windows not showing until program closes under Linux -

Image
i've written program plots different data upon pressing different buttons. program works intended under windows, when tried port linux (red hat v6) i'm getting strange issue: window want plot not appear until after close main program. happens regardless of figure (figure 1,2 etc.) i'm trying plot to, or if try type plt.show() etc. the program i've written 1000 lines of code, created abbreviated program has same problem. works under windows, under linux have close root window matplotlib window appear. working code: import matplotlib.pyplot plt tkinter import * def click(): x=['0','1','2'] plt.plot(x,x) plotgui=tk() butt1=button(plotgui,text="test", command=click).grid() plotgui.mainloop() if reduced code still not show tk-toplevel window, add line of: plotgui.lift() # force wm raise tk() window plotgui.mainloop() if reduced code has problems matplotlib -wrapper, necessary more specific on

javascript - Accessing parent select value in pop-window or save into a temp table -

i have number of select below. <form method="post" name="form1" action="addpp.php" enctype="multipart/form-data" onsubmit="return validateform();"> <table width="100%"> <tr> <td> <select name="leftprocess" size="5"> <option value="1">process 1</option> <option value="2">process 2</option> <option value="3">process 3</option> </select> </td> <td> <button onclick="moveright('leftprocess','rightprocess')">>></button><br/

timer - Android: How to clear EditText on timeout? -

i want clear edittext if e.g. 5 secs has passed last edit. added textchangedlistener edittext. textchangedlistener used timer tries clear edittext in run() method. however, application crashes, because according debugger, edittext.settext("") being called "wrong thread". so, what's best way implement behavior? i have qt background , cannot believe hard in android :) qt , c++11 implementation of clearing text edit widget on timeout 3 lines of code. the problem timer runs on background thread != ui thread. quick fix, can instantiate , hander , use postdelayed method. runnable ru on ui thread, after delay

c# - NHibernateIntegration. DataException error -

i have migrated changes of website developed in .net framework 2.0 4.5.1. have been able solve build errors facing run time errors when pass login screen enter login details (as regular or admin user). this error throws: dataexception unhandled user code: exception of type 'castle.facilities.nhibernateintegration.dataexception' occurred in 'xyz.dll' not handled in user code additional information: not perform findbyprimarykey securitygroup xml mapping: <?xml version="1.0" encoding="utf-8" ?> <!--<!doctype hibernate-mapping public "-//hibernate/hibernate mapping dtd 3.0//en" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">--> <hibernate-mapping xmlns="urn:nhibernate-mapping-2.2"> <class name="xyz.securitygroup, xyz_sharedentities" table="tb_selfservicesecuritygroup"> <id name="securitygroupid" column="securitygrou

geolocation - Newest Quickblox SDK for Android: Get nearby locations does not work -

i have been using quickblox sdk android quite while. however, new sdk library made of code not working. specifically, create list of locations. try search nearby locations, providing current location , radius. getlocationsbuilder.setcurrentposition(qblocation.getlatitude(), qblocation.getlongitude()); getlocationsbuilder.setradius(point.getlatitude(), point.getlongitude(), (float) 5.0); geopoint point = new geopoint(qblocation.getlatitude(), qblocation.getlongitude()); however, result format incorrect. '{"errors":{"current_position":["should in geopoint format","should set radius"]}}' here whole code: log.d(tag, "update location " + point.getlatitude() + " " + point.getlongitude()); qblocationrequestbuilder getlocationsbuilder = new qblocationrequestbuilder(); getlocationsbuilder.setpage(1); getlocationsbuilder.setp

ios - Changing Background Moving Speed -

in gamescene background moving horizontally it's working fine want move background slow , fast according score increasing, proceed way nstimeinterval changing nothing can see change background moving slow , fast going normal, if way wrong me please. sktexture *backgroundtexture = [sktexture texturewithimagenamed:@"background10"]; nstimeinterval _move; int _gamescore; if (_gamescore>=5) { _move =0.09; }else{ _move = 0.02; } skaction *movbg = [skaction movebyx:-backgroundtexture.size.width*2 y:0 duration:_move*backgroundtexture.size.width]; skaction *resetbg =[skaction movebyx:backgroundtexture.size.width*2 y:0 duration:0]; skaction *movebackgroundforever =[skaction repeatactionforever:[skaction sequence:@[movbg,resetbg]]]; (int i= 0; i<2 + self.frame.size.width/(backgroundtexture.size.width*2 ); ++i) { skspritenode* sprite = [skspritenode spritenodewithtexture:backgroundtexture]; [sprit

linux - error when start apache2.4 -

i've installed apache2.4 on ubuntu14.04 using tutorial successfully(from source): http://httpd.apache.org/docs/2.4/install.html in step 8 in tutorial said should edit httpd.conf seems hard job! without editing file, went step 9 , run command start apache: /usr/local/apache2/bin/apachectl -k start but see error: /usr/local/apache2/bin/httpd: error while loading shared libraries: libpcre.so.1: cannot open shared object file: no such file or directory is error step 8 ? if yes, how should edit httpd.conf ? if not, should fix problem? i guess can try this, sudo rm /etc/ld.so.cache sudo /sbin/ldconfig

MongoDB: $in with an ObjectId array -

just quick question i've experienced , i'm still thinking why: mongos> db.tickets.count({ "idreferencelist" : { "$in" : [ { "$oid" : "53f1f09f2cdcc8f339e5efa2"} , { "$oid" : "5409ae2e2cdc31c5aa0ce0a5"}]}}); 0 mongos> db.tickets.count({ "idreferencelist" : { "$in" : [ objectid("53f1f09f2cdcc8f339e5efa2") , objectid("5409ae2e2cdc31c5aa0ce0a5")]}}); 2 i thought both $oid , objectid spelling formats same mongodb. know why first query return 0 results , second 1 returning 2 (the right answer)? furthermore, i'm using morphia framework uses mongodb java driver interact mongodb. i've realised there exists problem searching $in operator in objectids arrays on fields not _id executing lines of code: list< objectid > fparams = new arraylist< objectid >(); fparams.add(...); query<ticket> query = genericdao.createquery(); query.field("

html5 - how to centering the content when shrink the window in css3 -

here code navigation: <div class="wrapper"> <header> <nav class="nav"> <ul> <li><a href="#">home</a></li> <li><a href="#">company</a></li> <li><a href="#">markets/solutions</a></li> <li><a href="#">products/services</a></li> <li><a href="#">businesses</a></li> <li><a href="#">investors</a></li> </ul> </nav> </header> </div> css3: *{ box-sizing:border-box; } body{ margin:0; padding:0; font-family:verdana; font-size:12px; } .wrapper{ margin-left:auto; margin-right:auto; } nav ul{

java socket programming to send and receive file between two machines -

i trying communicate between 2 machines using socket programming. what need both machines should able send , receive files. code pasting below not showing error server side program seems running indefinitely, i.e., not terminating. got stuck on line marked comment stuck here. in code, initially, server sending file named "file.txt" , client receiving , saving file name "copy.txt". later client sending file named "file2.txt" , server receiving , saving name "copy2.txt". can please tell me error , suggest improvements? //server side code import java.net.*; import java.io.*; public class server { public static void main (string [] args ) throws ioexception { //sending file started serversocket serversocket = new serversocket(16167); socket socket = serversocket.accept(); system.out.println("accepted connection : " + socket); file transferfile = new file ("/users/abhishek/desktop/file.txt"

dependency injection - Module-specific constants in AngularJS? -

i discovered knew nothing angular modules. the value of con in following directive baz , means not matter constant defined, i.e. not module dependant. is there way have module-specific constants? angular.module('amodule', []) .constant("foo", "bar") .directive('helloworld', function (foo) { return { link: function(scope) { scope.con = foo }, restrict: 'e', scope:{ name:'bind' }, template: '<span>{{con}}</span>' } }) angular.module('stuff', []) .constant("foo", "baz") angular.module('helloapp', ['amodule', 'stuff']) no, when define angularjs artifact on module available modules if reference them in app module. if 2 modules define same constant last dependency defined wins , overrides first one. order key in context. in case value of co

android - Can i release a new APK to a specific country? -

i have apk in production already, , in pricing , distribution section of google console, of countries checked. for new release deploy apk 1 country only, possible? if change country distribution in google console , leave country want release in, mean app disappear other countries markets? yes possible. application can not downloaded device of country.

tfs - Versioning .NET builds -

Image
just wondering what's best approach versioning of .net builds? i use: tfs 2013 version control tfs gated check-ins wix 3.8 package code msi files i want set version of: assemblies (assemblyinfo.cs, or shared 1 referenced in projects) msi packages (in wix code) documentation (for example inside readme.txt file in final output of build) etc ideal version number allow tracing installed software exact source code. like: <major>.<minor>.<tfs_changeset_number> first 2 parts of version want store in simple text \ xml file in version control near solution, believe should live together. developers update file manually (for example following semantic versioning approach). each build read version file, 3d part of version calling ci tool, , update necessary files version. what's best way implement this? i've used few approaches in past: 1) nant \ msbuild wrapper version work, calls msbuild solution. called ci tool (jenkins \ teamcity

PowerShell: How do I set an Environment variable as the directory represented by another env. variable -

the title not clear enough since i'm not sure i'm using correct jargon; reason not finding solutions issue yet. i've been able use powershell append directory path using: [environment]::setenvironmentvariable("path", $env:path + ";%domino_home%", [environmentvariabletarget]::machine) however, how can set directory represented domino home? for instance, in batch file, %domino_home% literally add it's directory - e:\lotus\domino , %%domino_home%% add %domino_home%. i want able add directory (e:\lotus\domino) using powershell. thanks. easy enough, of environment variables stored in $env: variable. makes entire task easier... $env:path += ";$env:domino_home" that should append %domino_home% end of path. (worked me , environment variable vs90comntools)

java - Use an object stored in objectdb file without having it's class definition -

let's create object in java named point 2 attributes (int x & int y) , store instances in objectdb file. know how retrieve items (as objects) file how can access attributes if don't have definition of class point anymore? point definition class point { int x; int y; } then create 2 points (0,0) (1,1) , store them in objectdb file (i can provide code if needed) i retrieve point instances statement typedquery<object> query = em.createquery("select o object o", object.class); list<object> results = query.getresultlist(); supposedly have objectdb file , not point class definition how can values of x , y (even simple string values)? thanks in advance when class definition missing objectdb automatically generates synthetic class according class schema stored in database. therefore query in example returns instances of synthetic point class generated objectdb. you can access data using java reflection api (possib

cmd - How can I send a .bat file command to another IP address? -

for particular task i'm doing trying run .bat file computer, want command execute on computer. example have .bat file writes ipconfig command text file. code said file looks this: @echo off rem name: ipconfig.bat ipconfig /all > a.txt @pause now when question have comes play; want run .bat file on computer in network. have written following .bat file attempt this: @echo off rem name: sendipconfig.bat rem user variable represents tried enter i.p address laptop. set /p n=user: call ipconfig.bat > %user% @pause i have tried making file using | instead of > when try preform call statement. you can't run on different computer, there has utility on remote machine runs server. listens incoming connections, runs whatever needs executed, , returns results. server should secure , authenticated (just imagine happen if run arbitrary scripts on machine knowing ip address). on linux, done using ssh . windows, need psexec "lets execute processes on

pipeline - findstr for filename in win7 batch file -

i'm kind of struggling following search. need files misplaced in wrong folders. have following testing structure (in reality hudreds of folders): c:\test2\john\john_phone.txt c:\test2\mary\john_address.txt c:\test2\mary\mary_address.txt c:\test2\mary\mary_phone.txt c:\test2\mary\peter_address.txt the files john_address.txt , peter_address.txt misplaced in mary's folder. want check mary's folder misplaced files , list them in separate log file. example above log contain names (paths) of 2 misplaced files, deciding identifier person's name. have piece of code: @echo off cls set /p name="specify name: " ::forfiles /p "%cd%\%name%" /s /m *.* /c "cmd /c echo @path">>log.txt forfiles /p "%cd%\%name%" /s /m "| findstr /i /v "\*%name%*"" /c "cmd /c echo @path">>log.txt pause the commented line forfiles works (lists files in folder), have issue findstr: error: files of type "| find

php - put two table in same line html -

Image
how supposed put 2 table in same line ? codes below show table go new line. please me . want in html this tables . want put them in 1 line and codes <table border="1"> <tr> <td><b>#</b></td> <td><b>request id</b></td> <td><b>title</b></td> <td><b>importance</b></td> <td><b>date</b></td> <td><b>status</b></td> <td><b>view/reply</b></td> </tr> <?php $a=1; $res = mysql_query("select * request req_status = 'undone' order req_status desc,req_important asc,req_datereceive desc"); while ($row = mysql_fetch_array($res)){ ?> <tr> <td><?php echo $a; ?></td> <td><?php echo $row['req_id']; ?></td> <td><

java - Error install Maven in Eclipse -

Image
i don't know why maven install error in eclipse, following picture: thank all! look .m2 folder , file called settings.xml replace host , port own university settings. <settings xmlns="http://maven.apache.org/settings/1.0.0" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:schemalocation="http://maven.apache.org/settings/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd"> <proxies> <proxy> <id>myproxy</id> <active>true</active> <protocol>http</protocol> <host>enter proxy here!!!!</host> <port>enter port here!!!!</port> <nonproxyhosts>*.google.com|ibiblio.org</nonproxyhosts> </proxy> </proxies> </settings>

recursion in java with unexpected output -

public class testing { public static void printnum(int a) { system.out.println( a); if(a <= 3) { system.out.println("recursed"); printnum(a+1); } system.out.println( a); } public static void main(string...s) { printnum(1); } } output : 1 2 3 3 2 1 i expected program end @ last 3 not understand next '2' , '1' coming from? how , why decrementing? you've got 2 calls system.out.println(a) . you'll find easier understand if differentiate between them: public static void printnum(int a) { system.out.println("before recursion: " + a); if(a <= 3) { system.out.println("recursing"); printnum(a + 1); } system.out.println("after recursion: " + a); } basically, calls nest - nested call print: before recursion: 4 after recursion: 4 ... , return call printnum(3) , print: a

image processing - Implement Sobel Filter in Java - Normalize values -

i want implement sobel filter myself (actual no beautiful implementation). after doing convolution have no idea how calculate rgb values. assumption: grey scaled image double [][] sobel_x = { { -1, 0, 1}, { -2, 0, 2}, { -1, 0, 1} }; double [][] sobel_y = { { 1, 2, 1}, { 0, 0, 0}, {-1, -2, 1} }; for(int y=1; y<image.getheight()-1; y++) { for(int x=1; x<image.getwidth()-1; x++) { color = new color(image.getrgb(x-1, y-1)); color b = new color(image.getrgb(x, y-1)); color c = new color(image.getrgb(x+1, y-1)); color d = new color(image.getrgb(x-1, y)); color e = new color(image.getrgb(x, y)); color f = new color(image.getrgb(x+1, y)); color g = new color(image.getrgb(x-1, y+1)); color h = new color(image.getrgb(x, y+1)); color = new color(image.getrgb(x+1, y+1)); double pixel_x = (sobel_x[0][0] * a.getred()) + (sobel_x[0][1] * b.getred()) + (sobel_x[0][2] * c.get

javascript - jquery datepicker value to UTC timestamp -

i using jquery datetime picker , when user selects value need user selection converted utc timestamp pass php webservice using ajax. datepicker using shows value in 2014/09/01 11:57 format. please let me know how can convert utc timestamp in javascript. before jquery datetime picker used have html5 datetime input elements , reading there values using jquery , converting them utc timestamp , wrote custom functions. client asked use jquery datetime picker , utc thing. date.parse("2014/09/01 11:57"); or new date("2014/09/01 11:57"); this create date object. can return utc timestamp date object's gettime() or valueof() functions. there's lot of excellent javascript documentation @ mozilla developer network . docs date object here: https://developer.mozilla.org/en-us/docs/web/javascript/reference/global_objects/date

Overflow error in Python Code for Maximum Subarray Using Recursion -

my program seems not work code. i'm new python i'm not sure if language related error. i'm using python 2.7.8. = [-1, -2, 3, 4, -5, 6] def main(): a,b,c = find_maximum_subarray_recursive(a) print a,b,c def find_maximum_crossing_subarray(a, low, mid, high): #mid = math.floor((low + high)//2) left_sum = float("-inf") sum = 0 = mid max_left = 0 in range (mid, low, -1): sum = sum + a[i] if sum > left_sum: left_sum = sum max_left = right_sum = float("-inf") sum = 0 j = mid + 1 max_right = 0 j in range (mid + 1, high): sum = sum + a[j] if sum > right_sum: right_sum = sum max_right = j return (max_left, max_right, left_sum + right_sum) def find_maximum_

java - Integer.parseInt("9999999990"); -

this question has answer here: unexpected numberformatexception while parsing hex string int value 5 answers i getting numberformatexception string 9999999990 not when use 1111111110 when call integer.parseint on string. let me know wrong. string str="9999999990"; int f = integer.parseint("2147483647");// no exception here int x =integer.parseint(str); // exception thrown here integer.parseint throw exception when it's parsing can't represented int . first example 10 billion, larger largest possible int , little on 2 billion. integer.parseint(string) delegates integer.parseint(string, 10) , version takes radix, , javadocs state: an exception of type numberformatexception thrown if of following situations occurs: the first argument null or string of length zero. the radix either smaller characte

Using Branching Statements on entire list rather than individual items in R -

this follow-up question, though question here independent of one, using apply functions instead of , branching statements in r i have data frame: date close weekday dayofmonth 290 1991-02-22 365.65 friday 22 295 1991-03-01 370.47 friday 1 300 1991-03-08 374.95 friday 8 305 1991-03-15 373.59 friday 15 310 1991-03-22 367.48 friday 22 314 1991-03-28 375.22 thursday 28 319 1991-04-05 375.36 friday 5 324 1991-04-12 380.40 friday 12 329 1991-04-19 384.20 friday 19 334 1991-04-26 379.02 friday 26 339 1991-05-03 380.80 friday 3 i want create column called weekofcycle figures out week of month given date in based on day of month. using function based on aforementioned question. as.integer(cut(data$dayofmonth, c(-inf, 7, 14, 21, 28, inf))) the above line fridays, thursdays should as.integer(cut(data$dayofmonth, c(-inf, 6, 13, 20, 27, inf))) desire

scanf - How to let fscanf stop reading after a new line -

#include <stdio.h> #define max 1000 int line_counter (file *file, char buf[]); int main(int argc, char *argv[]) { file *ptr_file; char buf[max]; ptr_file = fopen("alice-eg.txt", "r"); if (!ptr_file) { return 1; } int count = 0; while (fscanf(ptr_file, "%s", buf) == 1) { printf("%s", buf); if (buf == '\n') { return count; } else { count += 1; } } printf("the number of words in line is: %d", count); return 0; } i want along lines of have no idea how make work buf pointer array of letters (correct me if i'm wrong started c , understanding of pointers still quite bad). fscanf write line file (separated enter) buff array , if read empty line buff[0] = '\n' should condition. secondly: while (fscanf(ptr_file, "%s", buf) == 1) is wrong since fscanf returns number

c++ - Visual C, WinSock HTTP Req, and Non-Windows -

i have simple question. student , learning. not proficient @ c++, set working http reqest app in c++ using winsock , wanted know after compiling http request still sent other oses don't have winsock? winsock, or @ least parts have been using introductory networking stuff, based off of, , largely compatible with, bsd socket api, available on current operating systems. if don't have experience cross-platform development it's unlikely code compile first time through on linux system, underlying techniques same. for cross-platform networking, might want consider qt, provides api work same on oses without per-platform stuff. networking api based off berkeley sockets. in general, though, there's no way of checking code works cross-platform without testing cross-platform. grab linux distribution , try out; note intended work windows disk without need repartition.

php - Returning and Compiling MYSQL data for WooCommerce Product Orders -

what trying achieve way search our woocommerce orders based on item sku in orders have been made. once sku searched, display items orders skus containing search query, , give data it. i've got close not sure going wrong here. search code: <form action="url.php" method="get"> order number <input type="text" name="ordernumber" /><br /> <form action="url.php" method="get"> sku <input type="text" name="itemsku" /><br /> <input type="submit" /> </form> and here code, setup return items based on order number searching mysql database , combining data 2 tables share common row "order_item_id": <?php $search_ordernumber = $_get["ordernumber"]; $search_sku = $_get["itemsku"]; $con=mysqli_connect("****","****","****","****"); // check connection if (mysqli_connect_errno()