Posts

Showing posts from April, 2014

html5 - PHP form to email -

i have created form on our website online submission of claims our work. have 2 pages associated form. have end .php page thank submission , code post e-mail our business address. when form filled out, , submitted, not recieving e-mail. pretty new coding , first attempt @ creating form. thought had necessary code , .php this. appreciate input on how make form come through in e-mail. form page appears such: -<!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <!-- instancebegin template="templates/main_page.dwt" codeoutsidehtmlislocked="false" --> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <!-- instancebegineditable name="doctitle" --> <title>assignment submission</title> <!--[if lte ie 9]> <style

What is the Eclipse shortcut for Open Declaration? -

i don't using mouse , 1 of few times have use maybe if knows shortcut when show declaration of method clicking mouse while press ctrl , helpful :) when cursor on method press f3 , eclipse take declaration . by default it's bound f3 , can rebind different key, go windows >> preferences >> keys, , change open declaration binding...

c - mmap an address very unlikely to be used by any other part of the program -

for reason, want allocate block of memory mmap using fixed address, is, map_fixed . want use address unlikely used other part of program (heap, stack etc). such address range work 64 bit system? linux attempt load elf executables @ address specified in executable, anywhere in 64-bit address space. unless give linker special options, however, build executables load @ low addresses (generally 0x0000000000400000 ), , use memory reasonable densely (there gaps between read-only , read-write sections), default heap coming afterwards. linux uses addresses in range 0x00007fff00000000 - 0x00007fffffffffff stack , 0x00007f0000000000 - 0x00007ffeffffffff shared libraries. reserves 0x8000000000000000 - 0xffffffffffffffff kernel. so means below 0x00007f0000000000 , above end of heap free, range 0x0000800000000000 - 0x7fffffffffffffff . likely, because allocations above defaults changeable if configure kernel or linker different.

qt - What is the signal for when a widget loses focus? -

in dialog, when tab key pressed, focus changes widget. in qt, there signal when widget loses focus? can use check if input valid or not? if not, can set focus , ask user re-input? there's no signal if want know when widget has lost focus, override , reimplement void qwidget::focusoutevent(qfocusevent* event) in widget. called whenever widget has lost focus. give focus widget, use qwidget::setfocus(qt::focusreason) . to validate input in qlineedit or qcombobox can subclass qvalidator , implement own validator, or use 1 of existing subclasses, qintvalidator , qdoublevalidator , or qregexpvalidator . set validator qlineedit::setvalidator(const qvalidator*) , qcombobox::setvalidator(const qvalidator*) respectively. if want validate contents of modal dialog box, 1 way override qdialog::exec() implementation this: int mydialog::exec() { while (true) { if (qdialog::exec() == qdialog::rejected) { return qdialog::rejected; } if (validate()) {

java - How to make layout to be 80% of the width of the screen? -

how can make layout example 80% or 90% of width of screen, no matter screen size or dpi? tried " 80% of height then. edit: <?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" android:background="@drawable/background" > <button android:id="@+id/bnivoi1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center" android:layout_margintop="80dp" android:background="@drawable/button_nivoi_back" /> <linearlayout android:layout_width="match_parent" android:layout_height="wrap_content" android:weightsum=&qu

struts2 + jfreechart + jsp : lost request parameters in action which generates Jfreechart -

1)i called action generates jfreechart using next jsp(using tiles) code : <s:url var="chart" action="resultchart"/> <img src="<s:property value="%{chart}"/>"/> 2)struts.xml <package name="chart" extends="jfreechart-default" namespace="/"> <action name="resultchart" class="com.examples.actions.chartaction"> <result name="success" type="chart"> <param name="width"> 1200 </param> <param name="height"> 600 </param> </result> </action> </package> 3)to generate chart - use request parameters previous action : public class chartaction extends actionsupport implements requestaware { private static final long serialversionuid = 1l; private map request; private jfreechart chart; public string execute()

javascript - MouseMove event repeating every second -

http://jsfiddle.net/mrky9/ my computer (and far, no other computer among coworkers) exhibiting issue in chrome, ie, , safari (but not in firefox). simple mousemove code, such following (already running on fiddle above) catches mousemove events, long mouse in div, catches mousemove event every second - though i'm no longer moving mouse. var number = 0; $("#foo").on("mousemove", function() { this.innerhtml = number++ }); this seems browser-based problem, since doesn't exhibit on firefox. (nor occur on windows itself. when counter going up, if leave keyboard , mouse alone, screen saver kicks in.) before concluding it's not system issue, tried replacing mouse , switching usb port it's plugged into. not surprisingly, none of solutions resolve issue. i haven't figured out how test in other javascript in browser. questions : has encountered before? there need catch it? have code far less trivial fiddle rely on knowing when mouse

c# - How can I authenticate static resources in virtual directory? -

i want authenticate user access virtual directory contains (mp4, swf, mp3, images, html , other static files). virtual directory used web application exists in different server. means below case: server a: contains web application user can access using username , password , saved in session state. server b: contains virtual directory contains static files. i want give access virtual directory files if user logged in , authenticated in server a. how can achieve , best practice ti achieve that?? ps: make aspx page or .ashx handler authenticate user , make response.write file have problem streaming concept , face problem in swf files embed element doesn't work fine when gave src=handler.aspx?file=a001.swf storing authentication state in session state, of session state set sql server (instead of inproc). http://msdn.microsoft.com/library/ms178586.aspx might useful. this way, server can perform authentication function , store authentication status session obje

How to change themes in android smoothly? -

in application using splash screen application start theme @android:style/theme.black.notitlebar.fullscreen . after 2 seconds app goes on main activity uses theme: @style/theme.sherlock.light.darkactionbar . one in full screen, other 1 not. transition between both not smooth , takes while (~1 seconds) main activity adjust status bar. there trick avoid this? as far know, there no api level solution this. suggest using transitiondrawable example changing background color and/or propertyaimation changing view's properties background color or text color. can call settheme() function of activity apply new theme. careful settheme() must called in oncreate() function before setcontentview .

java - Android Threads, Handlers, handleMessage: Updating UI thread from runnable threads within external class files -

firstly quite new android please bare me :) background: trying convert java (non gui) program run on android. simplicity lets program has following files: dsgen.java, sinfer.java, main.java in main() method, objects each of classes dsgen , sinfer initialized , passed new threads , started. each of classes dsgen , sinfer implement runnable public void run() method , both run methods output text system.out.println(). thread 1. generates 100 values of random data thread 2. makes calculations on 100 values of generated data (outputs 100 results) in android version of program know ui thread handles ui updates. in mainactivity.java file trying declare handler receive messages "thread 2 output data" can used update textview in mainactivity ui thread. app starts executing when press start button on android ui. problem: when run app textview not update until processing has ended. noticed not output updated textview , 40/100 calculations make textview. the actual code

In Amazon SWF, can I abuse a Decision task to actually perform the work -

i need amazon swf distribute work, make sure it's done asynchronously, make sure it's store in reliable way , it's automatically restarted. however, workflow logic need extremely simple: it's single task executed. i implemented way it's supposed done: request workflow execution decider founds out , schedules activity workers finds out activity request, performs results , returns results decider notices result , copies on in workflow completion it seems me can have decider work – – , complete workflow execution immediately. take care of a lot of code. (the activity might fail, timeout, etc. things need cater for.) so question: can have decider performs work , completes 'workflow' immediately? yes. actually, think came interesting use case: using minimal workflow centralized locking mechanism one-off actions in distributed system - such cron jobs executed single host in fleet of many (the hosts have first undergo election , whichev

c++ - when I use a function pointer variables disappear -

ok playing around in spare time trying build function libraries fun, , i'm teaching myself function pointers. tried making binary_search function looks oldest item in array of items. know algorithm works, can't past bug. reason when code entered function pointer stops executing , dies.... did testing , moment code enters strvoidcmp , 2 void * s i'm feeding null... #include <stdio.h> #include <string.h> #include <math.h> #include "algorithms.h" void generate_array(char (*partial_list)[10]){ size_t j = 0, = 0; for(j = 0; j < 20; j++){ for(i = 0; < 10; i++){ partial_list[i][j] = 0; } } for(i = 0; < 11; i++){ memcpy(partial_list[i], "is there", 9); } for(i = 0; < 9; i++){ memcpy(partial_list[i], "not there", 10); } } void lmerror(char *msg){ fprintf(stderr, msg); fflush(stderr); } int binary_search_top(void **list, const

Windows Server Backup: New Disk & Keeping Backup History -

i have been doing backups couple of years on win server 2008r2 using windows server backup. 'drive' attached via iscsi , has been working fine. well, have new san devise , want backup using iscsi instead of old location--everything working fine far mounting drives--but specifically, there way can copy on backup history new drive? need remove old drive system , use new drive. can don't know how without losing years of incremental backup history. if add both drives backup schedule, copy history first drive on second? thanks!

cell - Lua Separation Steering algorithm groups overlapping rooms into one corner -

i'm trying implement dungeon generation algorithm ( presented here , demo-ed here ) involves generating random number of cells overlap each other. cells pushed apart/separated , connected. now, original poster/author described using separation steering algorithm in order uniformly distribute cells on area. haven't had experience flocking algorithm and/or separation steering behavior, turned google explanation (and found this ). implementation (based on article last mentioned) follows: function pdg:_computeseparation(_agent) local neighbours = 0 local rtwidth = #self._rooms local v = { x = self._rooms[_agent].startx, y = self._rooms[_agent].starty, --velocity = 1, } = 1, rtwidth if _agent ~= local distance = math.dist(self._rooms[_agent].startx, self._rooms[_agent].starty, self._rooms[i].startx, self._rooms[i].starty) if distance

Deploying a .NET C# Console App -

Image
all, i created c# console app in vs2010 (.net4). hits database , sends out emails. works fine when run vs deploying app remote server has me befuddled. need install app on (1) remote windows server. should easy, right? looking @ publish settings, don't see build locally without creating installer (from cd-rom or dvd-rom) , other 2 options don't apply either, @ least descriptions. so here did far: the vs2010 publishing options given follows: step #1 picked option 3 step #2 place generated files on remote server step #3 ran setup installer step #4 error question am approaching correctly? if not, need do? thanks notice error: the application requires assembly office version 12.0.0.0 installed in global assembly cache (gac) first. refer this answer , this msdn question contains answer have quoted below: we solved going applications files dialog under publish tab of project's properties , changing office.dll assembly inclu

string - TextView multiple lines using \n not working - Android -

here textview need have multiple lines on <textview android:id="@+id/date1" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_below="@id/title" android:textcolor="#343434" android:textsize="14sp" android:layout_margintop="1dip" android:layout_torightof="@id/list_image" android:layout_marginleft="4dp" android:maxlines="3"/> this textview gets used in listview have text being set via adapter.class. looking @ individual xml file used set style textview when add string \n in it works fine try , using class not work , says things along lines of "this text\nthis more." textview's text set line in adapter.class date1.settext(song.get(customizedlistview.key_date1)); customizedlistview.class sets listview , gives adapter it's strings required set text. know why using set strings vi

excel - VBA With two columns if column 1 is a duplicate and column 2 is not give error -

example data: pin name voltage v3v 3.3 v3v 3.3 v3v 3.3 v3v 4 vin 58 vdr 6.5 vdrext 6.5 v3v 3.3 desired output: bus name voltage v3v 3.3 vin 58 vdr 6.5 vdrext 6.5 i having hard time figuring out best way this. use dictionary, collection, or 2 arrays this? need error if pin name duplicate has different voltage rest of same pin names. do have list of correct values each name? compare them using formula.

Insert variables from powershell script into HTML -

i have html code , i'd insert variables powershell script into. when insert html in script script thinks part of script itself. i'm trying create signatures company takes in user name, email, phone, ect , inserts info html. i've got variables set having hard time inserting them html. it sounds want "here-string" this: $my_html = @' <html> <head></head> <body> <p>hi, name {0}, can email me @ {1} or call me @ {2}.</p> </body> </html> '@ -f $name, $email_addr, $phone_num $my_html | out-file c:\my_html.html -encoding ascii this technique combines use of here-strings allow use character including quote characters , string formatting put targets in string replaced arguments giving -f operator. pipe string file open in browser.

ios - How to restrict a moveable view by Pan gesture -

i have uiimageview moveable via pan gesture. uipangesturerecognizer *pan = [[uipangesturerecognizer alloc] initwithtarget:self action:@selector(handlepan:)]; [self.photomask addgesturerecognizer:pan]; i restrict area can moved on screen. rather user able drag view right side of screen, want restrict margin of sort. how can this? also, how handled when rotated? edit --- #pragma mark - gesture recognizer -(void)handlepan:(uipangesturerecognizer *)gesture { nslog(@"pan gesture"); gesture.view.center = [gesture locationinview:self.view]; } this current method handle pan. need continue move imageview center point , restrict movement when close edge of screen 50 example. one possible solution in handlepan method, check location of point on screen, , commit change if within bounds wish restrict to. for ex. -(void) handlepan:(uigesturerecognizer*)panges{ cgpoint point = [panges locationinview:self.view]; //only allow movement within 100

Python 3 Print Variables -

is there better way print set of variable in python3 ? in php useally did this: echo "http://$username:$password@$server:$port" but in python 3 looks ugly , longer type +'s print('http://'+username+':'+password+'@'+server+':'+port) is there in python "$" symbol ? thank you. python doesn't support string interpolation, can string formatting: 'http://{}:{}@{}:{}'.format(username, password, server, port) or keyword arguments (best used if have arguments in dictionary): 'http://{username}:{password}@{server}:{port}'.format( username=username, password=password, server=server, port=port ) you abuse locals() little, wouldn't suggest doing way: 'http://{username}:{password}@{server}:{port}'.format(**locals())

sql server - SQL Select set of records from one table, join each record to top 1 record of second table matching 1 column, sorted by a column in the second table -

this first question on here, apologize if break rules. here's situation. have table lists employees , building assigned, plus training hours, ssn id column, have table list employees in company, ssn, including name, , other personal data. second table contains multiple records each employee, @ different points in time. need select records in first table building, recent name second table, plus allow result set sorted of columns returned. i have in place, , works fine, slow. simplified version of tables are: table1 (ssn char(9), buildingnumber char(7), traininghours(dec(5,2)) (7200 rows) table2 (ssn char(9), fname varchar(20), lname varchar(20), sequence int) (708,000 rows) the sequence column in table 2 number corresponds predetermined date enter these records, higher number, more recent entry. common/expected each employee has several records. several may not have recent(i.e. '8'). my sproc is: @buildingnumber char(7), @sortfield varchar(25) begin declare

html - Zoom reset in Firefox not resetting properly -

is zoom reset in firefox 22 broken? when measure html elements ruler, wider supposed be. firebug's layout displays proper width. when zoom reset, doesn't reset proper zoom level. have zoom out couple of times more. why zoom reset behave way? if you're using windows, firefox 22 introduces support pixel density you've set on system level in windows control panel > appearance > display. you can still go on con firefo config typing about:config firefox address bar, , layout.css.devpixelsperpx . double-click change value 1.0 . reference: http://support.mozilla.org/it/questions/963759#answer-451851

Please explain rails has_many through association -

i'm trying understand rails associations i've following tables , i've define relations, can 1 please me understand. tables products, productdistributors, , distributors. every product has distributor, distributor carries multiple products i defined these class product < activerecord::base has_one :product_distributor has_one :distributor, through: :product_distributor end class productdistributor < activerecord::base belongs_to :products belongs_to :distributors end class distributor < activerecord::base has_many :product_distributors has_many :products, through: :product_distributors end is correct? if not, how can correct it? i feel problem lies in distributors class name because it's plural. when has_many :distributors , rails default link distributor class, in case class name distributors . adding class_name option relationship declarations should work: class product < activerecord::base has_one :pro

Regex path matching in chaotic input -

i have chaotic log output looks below (yes weird new lines exist @ place. :) c:\testing\testpath\testfile.txt \\1.2.3.4\c$\test\testpath1\testpath2\k \\1.2.3.4\c$\test\testpath1\testpath2\ c:\ro\row\rou\line.txt:line 234 failed grant assetid=33683041 userid=44129434: recipient owns asset @ corp.userasset.awarduserasset(int6 4 assetreferenceid, int32 userid, boolean preventduplicates, boolean& awardednewasset) in d:\workspace\trunk\assemblies\scl\ccl\bll\userasset.cs:line 723 @ corp.userasset.awarduserasset(int64 assetreferenceid, int32 userid, boolean preventduplicates) in d:\workspace\trunk\assemblies\scl\ccl\bll\userasset.cs:line 710 @ corp.website.badge.award.processrequest(httpcontext context) in d:\workspace\trunk\web\corpwebsite\badge\award.ashx.cs:line 111 @ system.web.httpapplication.callhandlerexecutionstep.system.web.httpapplication.iexecutionstep.execute() @ system.web.httpapplication.executestep(iexecutionstep step, boolean& completedsynchronously) what ou

android - Multiple fonts associated with same TextView -

is there way set different fonts different states in textview? let's want helvetica regular normal state, , helvetica bold pressed? i know how link custom font text view, not sure how same multiple fonts , single textview? specifically, there way achieve behaviour through xml? update : i'm not looking workarounds, having html in textview, or replacing textview webview. if it's not possible achieve, i'd rather have 1 font check link may you: http://shuklaxyz.blogspot.com/2012/05/custom-fonts-for-webview-and-textviewv.html also : custom fonts , xml layouts (android) also: custom truetype font xml only and : http://polwarthlimited.com/2013/05/android-typefaces-including-a-custom-font/ hope help.

php - mystery number stuck in cache? -

when first ran code, worked fine , uploaded 2 test records different numbers. left day or 2 , when upload test data, enters first number ever entered, in. record deleted. ???? <?php require_once('auth.php'); require_once('config.php'); ?> <!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="content-type" content="text/html; charset=iso-8859-1" /> <title>member index</title> <link href="loginmodule.css" rel="stylesheet" type="text/css" /> <script type="text/javascript" src="js/jquery.js"></script> <script type="text/javascript" src="js/subnav.js"></script> </head> <body>

php - Migrating a joomla install - getting blank page with no errors -

apache server, migrating iis - have error reporting on, have access server logs, neither reporting errors pages still come blank both @ http://204.12.74.110/index.php http://204.12.74.110/administrator/index.php any assistance appreciated. did checked php version? check if resources same in new server. for joomla 2.5.x, 1.7.x , 1.6.x software recommended minimum php 5.3 + 5.2.4 + mysql 5.0.4 + 5.0.4 + microsoft iis 7 7 and joomla 3.x can check link: http://www.joomla.org/technical-requirements.html

How to send and receive JSON data between two servers via php -

obviously not using right keywords in searches or not understanding others have written in blogs or forums, et al. looking information on passing data between 2 servers. data preferably contained within json array. if know of has written blog encompassing chance read it. otherwise offer thoughts? more detailed: user visits page php function called , data "packaged up" in json array , post command other server. second server after receiving post processing , "package up" data , return in json array. user presented results. with following receiving http 200 response. no data. site 1: $data_string = json_encode(array('user_id'=>123)); $ch = curl_init('http://site2.dev/retrieve'); curl_setopt($ch, curlopt_customrequest, "post"); curl_setopt($ch, curlopt_postfields, $data_string); curl_setopt($ch, curlopt_returntransfer, true); curl_setopt($ch, curlopt_httpheader, array( 'content-type: application/json',

java - Google Library issues -

Image
i have been learning program couple of months on own now, , have been trying add google places onto app creating. i getting error googleheaders , there error seen in screenshot below. i had cut , paste 2 sections of libraries in screenshot in order able see it. added these libraries after installing google plugin supposed easy download necessary libraries, cleared errors these last errors dealing with. right-click jar in project(put in folder called lib. may need make folder). select build path->add build path. it's done automatically , gracefully. this adds entry .classpath file. eclipse find jar , use imports compile-time , run-time information.

python-like string indexing in C++ -

is there (possibly, using macros) way substring of string using python-like expression f(i:j)? or, more specifically, resolve i:j expression pair of indices , j? ideas? edit: yes, need :. or ;. basically, simple function or macros can't do. want see if possible or not. edit: basically, want see if applicable. arrays well, maybe. question more of "can turn i:j j", guess. doesn't matter these std:strings or c-strings. i hate myself answering, ... #include <iostream> #include <string> #define f(x) substr(true?x, false?x) int main () { std::string s = "hello, world"; std::string y = s.f(1:4); std::cout << y << "\n"; } warning: hiring manager. if ever discover use technique, never hire you.

sql - Oracle Analytic functions - resetting a windowing clause -

i have following data set. create table t1 ( dept number, date1 date ); table created. insert t1 values (100, '01-jan-2013'); insert t1 values (100, '02-jan-2013'); insert t1 values (200, '03-jan-2013'); insert t1 values (100, '04-jan-2013'); commit; my goal create rank column resets each time department changes. closest column can use "partition by" clause dept, won't give me desired result. sql> select * t1; dept date1 ---------- --------- 100 01-jan-13 100 02-jan-13 200 03-jan-13 100 04-jan-13 select dept, date1, rank () on (partition dept order date1) rnk t1 order date1; dept date1 rnk ---------- --------- ---------- 100 01-jan-13 1 100 02-jan-13 2 200 03-jan-13 1 100 04-jan-13 3 the desired output follows. last rnk=1 becuase jan-04 record first record after change. dept date1

php - correct syntax to echo variable inside iframe -

i know missing simple. want display iframe if $video-code exists. can see wrong this? working in wordpress. error on echo line. i've tried adding .'$video-code'. url. it displaying iframe correctly, variable displaying text in url. if call variable elsewhere in page without if statement, displays correctly. thanks help! <?php $key = 'video-code'; $themeta = get_post_meta($post->id, $key, true); if($themeta != '') { echo '<iframe id="player" width="560" height="315" frameborder="2" src="http://www.youtube.com/embed/$video-code" ></iframe>'; }?> you can concatenate $key , so: echo '<iframe id="player" width="560" height="315" frameborder="2" src="http://www.youtube.com/embed/' . $key . '" ></iframe>';

stack overflow - scala implicit causes StackOverflowError -

how implicit val cause stackoverflowerror? (pared down original code, still cause error) object complicit { // class name, default, , conversion function implicit val case class cc[a](name: string, defaultvalue: a)(implicit val convert: string => a) { def getfrom(s: string): a= try { convert(s) } catch { case t: throwable => println("error: %s".format(t)) // see stackoverflowexception defaultvalue } } // works fine object works { val cc1= cc("first", 0.1)(_.todouble) } // causes java.lang.stackoverflowerror due implicit object fails { // !!! stackoverflowerror here implicit val stringtodouble: string => double= { _.todouble } val cc2= cc("second", 0.2) } def main(args: array[string]) { // works println("%s %f".format(works.cc1.name, works.cc1.getfrom("2.3"))) // fails println("%s %f".format(fails.cc2.name, f

extjs4.1 - ExtJS: Second Modal Window causing error: Uncaught TypeError: Cannot read property 'addCls' of null -

i getting error: "uncaught typeerror: cannot read property 'addcls' of null" in following scenario. i have requirement of 2 modal windows. first modal window has grid. when double click on grid in first modal window, should open second modal window. below code used: saleorderemployeegrid.on('celldblclick', function(tableview, td, cellindex, record, tr, rowindex, e, eopts){ loadactivitywindow(); }); } function loadactivitywindow() { jobslotactivitywin = new ext.window({ id :'jobslotactivitywinid', modal : true, layout : 'fit', width : 900, height : 500, closeaction :'destroy', plain : true, model : true, stateful : false, title :'create job slot', items : [soactivitypanel], buttons : [{ text : 'close', han

r - Reorder data frame values -

i have data frame (titled emg ), has values (which, example, go u), organized this: a d g j m p s b e h k n q t c f l o r u instead, want organized this a b c d e f g h j k l m n o p q r s t u i can't use transpose, because transpose whole data frame. there way reorder values horizontally instead of vertically? thanks if columns of same type , can unlist data frame, create matrix filled row (not default column) , re-coerce data.frame. eg as.data.frame(matrix(unlist(emg),nrow=3,byrow=true)) ## v1 v2 v3 v4 v5 v6 v7 ## 1 b c d e f g ## 2 h j k l m n ## 3 o p q r s t u

c++ - non-blocking recv returns 0 when disconnected -

i'm trying 'catch' when disconnect happens. don't what's wrong. recv() returns 0, errno set 0 , ioctl returns 0. searching 6 hours on web without success. can tell me what's wrong? regards. bool network::setblocking(bool blocking) { // sets blocking or non-blocking mode. int flags = blocking ? 1 : 0; return ioctl(this->sockfd, fionbio, &flags) ? false : true; } networkstatus network::status() { // returns socket status. struct timeval tv; fd_set fd; int result = 0; tv.tv_sec = 3; tv.tv_usec = 0; fd_zero(&fd); fd_set(this->sockfd, &fd); result = select(this->sockfd + 1, &fd, 0, 0, &tv); if(result == -1) { return network_error; } else if(result) { return network_readyread; } else { return network_timeout; } } int network::bytesavailable() { // returns number of bytes available. int bytes = 0; if(i

libcurl - django error with use curl download CURLOPT_RESUME_FROM_LARGE -

i use django ,just download file server. , use curl download file in client. when add curlopt_resume_from_large resume broken transfer,error come. don't know server error or client error. client download code: file* ptmpfile = fopen((m_download_filepath_pre+tmpfilename).c_str(), "ab+"); fseek(ptmpfile, 0l, seek_end); int currentsize = ftell(ptmpfile); curl_easy_setopt(curl, curlopt_file, ptmpfile); curl_easy_setopt(curl, curlopt_header ,0); curl_easy_setopt(curl, curlopt_nobody, 0); curl_easy_setopt(curl, curlopt_connecttimeout,60); curl_easy_setopt(curl, curlopt_noprogress ,0); curl_easy_setopt(curl, curlopt_progressfunction ,my_progress_func); curl_easy_setopt(curl, curlopt_progressdata ,sdownload); curl_easy_setopt(curl, curlopt_resume_from_large, currentsize); myserver error: exception happened during processing of request ('127.0.0.1', 50232) traceback (most recent call last): file "/library/f