Posts

Showing posts from September, 2014

excel - Move Attachment Script -

i have vba script have used move attachments emails folder consumption ssis package. however, want alter script renames attachment saves folder. here current script. public sub saveattachmenttodisk(itm outlook.mailitem) dim objatt outlook.attachment dim savefolder string savefolder = "\\vswi-sql\databases\datawarehouse\universal_dw\cs\cs_imports" each objatt in itm.attachments objatt.saveasfile savefolder & "\" & objatt.displayname set objatt = nothing next end sub i not familiar vba enough comfortably make correction, have feeling it's alteration last few lines. the attachment received named "workbook_4x5ofxqg7.xls", broadcasted report our netweaver system. want save "hris_cs_complaints.xls". you have change line objatt.saveasfile savefolder & "\" & objatt.displayname in particular case: objatt.saveasfile savefolder & "\" ...

Determine parent shell from perl -

from perl know name (and possibly path) of shell started perl process. $env{shell} not give (it gives login shell - current perl process might started different shell). the best answer have found far is: http://www.perlmonks.org/?node_id=556926 deals terribly different platforms (the output of 'ps' differs wildly platform platform). i tried looking @ %env, contains exported variables. so there better way? background this used gnu parallel: every job started through shell. give least surprise user, shell should same shell gnu parallel started from. way tcsh-user able run tcsh commands gnu parallel , same bash/zsh/*sh user. currently $shell used, gives login shell , not current shell surprising users, run different shell login shell. can cause problems if gnu parallel used in script written tcsh-user, run bash-user. if gnu parallel not started shell, default $shell (same now). how this: #!/usr/bin/env perl use strict; use warnings; use feature ...

c++ - Souriau method for Characteristic Polynomial -

does know souriau method finding characteristic polynomial of n × n matrix? found out first coefficient, obvious, how can find out other coefficients? after need inverse matrix know how. #include <iostream> #include <fstream> using namespace std; double trace(double a[5][5],int n){ int i; double trace=0; for(i=0;i<n;i++) trace+=a[i][i]; return trace; } double prod(double a[5][5],double b[5][5],int n) { double c[5][5]; int i,j,k; cout << "\nprod:\n"; for(i=0;i<n;++i){ for(j=0;j<n;++j){ c[i][j]=0; for(k=0;k<n;++k) c[i][j]=c[i][j]+(a[i][k]*b[k][j]); cout << c[i][j] << " "; } cout << "\n"; } return c[i][j]; } double theta(double a[5][5], int n){ int i; double theta[5]; theta[1]=-trace(a,n); for(i=0;i<n;i++) cout << ...

java - Cannot deploy WebService with NetBeans and Glassfish server -

i'm working on java netbeans webservice. i'm deploying webservice successfully, when press test web service. error in attached image. in glassfish server output it's throw exceptions dont't know how solve them. img1 img2 this glassfish server output: info: invoking wsimport http://localhost:8080/applestoreserver/shoppingws?wsdl info: parsing wsdl... info: [warning] schema_reference: failed read schema document 'shoppingws?xsd=1', because 'http' access not allowed due restriction set accessexternalschema property. info: line 7 of http://localhost:8080/applestoreserver/shoppingws?wsdl#types?schema1 warning: standardwrappervalve[shoppingws]: servlet.service() servlet shoppingws threw exception java.lang.assertionerror: org.xml.sax.saxparseexception; systemid: bundle://218.0:1/com/sun/tools/xjc/reader/xmlschema/bindinfo/binding.xsd; linenumber: 52; columnnumber: 88; schema_reference: failed read schema document 'xjc.xsd', bec...

c# - TFS Build - Generate Website (no webproject) -

i have many projects want build using tfs build. have no problems windows forms , webforms projects. but when try use tfs build build asp.net website (the classic one), have these problems: i don't have options compile project test configuration (only debug or release). i can't build asp.net website because it's not web project. i want know if there's way publish website's precompiled files same shared location have other projects. i think might need bit more detail here, or maybe i'm clueless :-) test configuration - i'm assuming you've set test build configuration? if so, i'm not sure off top of head what's going on, i've seen people forget create build configuration. we've had no problem our websites, moved build output or wherever specify in website properties pages if mean want use webdeploy publish, you're out of luck website - web projects that. little team build customization, , should able emulate...

combining two csv files python -

i have data stored in 2 different csv files. want dump file b @ end of file , want remove header i.e, first line of file b. can combine 2 files using open('final.csv', 'a') includes header of file b. appreciated. i'm assuming want know how skip header when reading file, since don't specify how 2 files appended (in-memory, on file system, ... ?). after opening file, can use next() on file object skip ahead 1 line, so: with open("file_b", "r") fb: next(fb) # skip 1 line line in fb: # whatever want remaining lines, e.g. append them # file_a alternatively, because had "numpy" question tag earlier, can use numpy's loadtxt() function, has parameter called skiprows can used want. open file_b so: with open("file_b", "r") fb: all_lines_except_header = numpy.loadtxt(fb, skiprows=1) this parse csv file, however. if you're interested in lines , not in individu...

c# - How to bind data from mutiple tables to datagridview using Entity Framework and use CRUD operations? -

can 1 please give example of how bind result datagridview taken multiple tables (from join query) in entity framework. can bind data datagridview when call context.savechanges(); nothing has updated in database. how correctly bind data datagridview update,insert,delete functions. this tried. public class databindingprojection { public string dono { get; set; } public int apmntid { get; set; } public string servicedesc { get; set; } public string cusid { get; set; } public string empid { get; set; public bool isdelivered { get; set; } } context = new hhcsentities(); var query = d in context.deliveryorders join in context.appointments on d.apmntid equals a.apmntid join s in context.servicecategories on d.serviceid equals s.serviceid join e in context.employees on d.empid equals e.empid select new databindingprojection { dono = d.dono, apmntid = a.apmntid, ...

smtp - Questions about email reverse DNS check -

our email server blocked, need find way solve this. outbound smtp ip, when send emails email server, if send them smtp relay on other server, ip receive side check reverse dns? email server ip or relay server ip? the receiving mail server reverse dns check on mail server received message from. so, if mail server sends message through relaying mail server, sends message receiving mail server, receiving mail server reverse dns check on relaying mail server. the reverse dns check works so: receiving mail server receives incoming connection 209.85.160.179. receiving mail server reverse dns lookup on ip, (in case) resolve mail-yk0-f179.google.com. confirm sending mail server in fact in google.com domain (and 209.85.160.179 not run spammer or spoofer setup ptr record 209.85.160.179 points mail-yk0-f179.google.com), receiving mail server forward dns lookup on mail-yk0-f179.google.com, make sure fqdn in fact resolve 209.85.160.179 (a spammer not able setup dns record fqdn in...

JSTree Types plugin not working with Rel attribute -

here how configure jstree plugin: $(function () { $("#folderstreecontainer").jstree({ "core": { "animation": 150 }, "themes": { "rtl": true, "theme": "classic", "dots": false, "icons": true }, "types": { "types": { "normal": { "icon": { "image": "\content\css\jstree\default\folder.png" }, }, "legend": { "icon": { "image": "\content\css\jstree\default\legend.png" }, } } }, "plugins": ["html_data", "themes", "types"] ...

javascript - How to change the width of a Pin Widget in Pinterest -

i want add pin widget website. want pins width 300px , default pins coming in 237px . couldn't find option change width of pin widget on pinterest website. how can change width of pin widget? the code generated widget builder given below: <a data-pin-do="embedpin" href="http://www.pinterest.com/pin/469007748667270308/"></a> <!-- please call pinit.js once per page --> <script type="text/javascript" async src="//assets.pinterest.com/js/pinit.js"></script> this coming in 237px , want width 300px . in widget builder don't seem able this. can switch small large , maybe adjust height. solution put pinterest on end of row of buttons have space needed right. pinterest has lot less sophisticated javascript share button facebook, twitter, or google+. pinterest minimalism , midwest housewifes , dreams , aspirations.

PowerShell automation of Hyper-V and SCVMM -

i have new project need automate series of actions on virtual machines using powershell. seems there waaaayyyy too information out there. vast majority of blog postings , articles seem either (1) generic cmdlet reference pages or (2) overly simplistic sample scripts specific. what looking starter articles cover following the basic object architecture , relationships between objects. example, looking information on vm's disk(s) , accident discovered have go virtualharddisk property of virtualdiskdrives property of virtualmachine object. why 3 levels down? difference between virtualdiskdrive , virtualharddisk? the difference between hyper-v cmdlets , cmdlets come system center, , when use 1 on other. there overlap? i understand posting broad hope can point specific starting point learn from.

c++ - Boost asio priority and strand -

i want use boost asio message queue. want different operations on different objects. operations have priority. if there operation oft type none of type b should executed. understanding priority example in boost dokumentation does. need is, if there 1 operation running in 1 object, not want execute operation in same object. can done boost asio? the latter has nothing priority queuing , operation serialization. you can achieve using active object pattern. example of active object using asio in post: boost::asio , active object you can "simply" combine pattern pattern priority queuing saw in example.

c# - dynamically changing picture box -

i dynamically create several picture box, , eventhandler. when user click on picturebox, program should delete tрis item. (the item user selected) i try for (int = 1; <= sunduki; i++) { picturebox pbobj = new picturebox(); pbobj.location = new system.drawing.point(i * 100, 101); pbobj.name = "picturebox" + i.tostring(); pbobj.size = new system.drawing.size(108, 80); pbobj.tabindex = i; pbobj.backgroundimage = image.fromfile(@"syndyk1.jpg"); pbobj.backgroundimagelayout = imagelayout.zoom; pbobj.click += new system.eventhandler(pb_click); pb.add(pbobj); controls.add(pb[pb.count - 1]);} and in pb_click private void pb_click(object sender, eventargs e) { pb[this].visible = false; } but have error. (pb list picturebox) the sender argument object has been clicked, in case picturebox object. private void pb_click(o...

html - Using Firebug dev tools -

Image
i using firebug , keep getting spaces arrows , don't know how rid of them. believe coming form line spacing visual studio not sure. does know how rid of them? the arrow indicates tab. turn off display open html panel's options menu , uncheck option show whitespace . to automatically remove trailing whitespace in visual studio there extension called codemaid , takes care of that can read in an answer thread .

c++ - Auto Hiding CDockablePane on creation -

i have 3 dockable panes, each containing 1 image. 1 on left, 1 on right , 1 not visible. problem is, have 1 on right hidden default let 1 on left take entire space. have searched through doc find should call following on pane, nothing happens. toggleautohide(); i don't know missing... here creation code in case helps: // image docking panel creation if (!m_wndrawimage.create(_t("raw image"), this, imgrect, true, id_view_rawimgwnd, dwpanestyle| cbrs_right, afx_cbrs_regular_tabs, afx_cbrs_resize)) { trace0("failed create image tab window\n"); return -1; } if (!m_wndrefimage.create(_t("reference image"), this, imgrect, true, id_view_refimgwnd, dwpanestyle| cbrs_right)) { trace0("failed create image tab window\n"); return -1; } if (!m_wndcalibimage.create(_t("calibrated image"), this, imgrect, true, id_view_calibimgwnd, dwpanestyle| cbrs_right)) { trace0("failed create image tab window\n"); ...

java - When Powermock annotations is live the e-mail sending is fail with exception -

there interesting case, maybe should report bug: when try send without annotations, works charm, when i added these lines: @runwith(powermockrunner.class) @preparefortest() (is there experience it? anybody? ) (preparefortest()) empty content, e-mail sending run fail: javax.mail.messagingexception: not connect smtp host: 192.168.51.1, port: 465; nested exception is: java.io.ioexception: can't create mailsslsocketfactory @ com.sun.mail.smtp.smtptransport.openserver(smtptransport.java:2055) @ com.sun.mail.smtp.smtptransport.protocolconnect(smtptransport.java:697) @ javax.mail.service.connect(service.java:364) @ javax.mail.service.connect(service.java:245) @ javax.mail.service.connect(service.java:194) @ reignsoft.email.emailsender.sendmail(emailsender.java:110) @ reignsoft.email.emailsender.sendmail(emailsender.java:59) @ reignsoft.email.emailsendertest.testsendmail(emailsendertest.java:225) @ sun.reflect.nativemethodaccessorimpl...

jQuery each to iterate through inputs and store values in array -

i have multiple hidden inputs name image_values: <input class="imagevalues<?=$category->cat_id;?>" name="image_values[]" type="hidden" value="<?=$step->img_pos.":".$option->image_path;?>" /> i want iterate through each of them , store values in array, trying below, isnt going inside each @ all, doing wrong?: var imagevalues = ''; jquery("input[name='image_values']").each(function(){ imagevalues = jquery(this).val(); }); thanks you can use map() that. return jquery collection of returned in function. .get() converts normal array. you need include square brackets in selector, , escape them: var imagevalues = jquery("input[name='image_values\\[\\]']").map(function(){ return this.value }).get()

ios - How to get large picture size from Facebook graph API for news feed -

i stuck getting picture facebook graph api news feed small size. url https://fbcdn-photos-b-a.akamaihd.net/hphotos-ak-xpf1/t1.0-0/10363492_10202184985725870_7374705736674502849_s.jpg . not sure how picture size o.jpg finally, figured out. here did. nsstring *query = [nsstring stringwithformat:@"select pid, object_id, src_big, src_big_width, src_big_height photo object_id = %@", wallpost[@"object_id"]]; //begins select........ nsmutabledictionary * params = [nsmutabledictionary dictionarywithobjectsandkeys: query, @"q", nil]; [fbrequestconnection startwithgraphpath:@"/fql" parameters:params httpmethod:@"get" completionhandler:^(fbrequestconnection *connection, id result, ...

c - Linked List Assistance -

i'm working on linked list in c insert , print functions. however, getting segmentation fault insert, , when try fix end 1 print function. appreciated. typedef struct node { struct node *next; double value; } nodet, *nodetp; int listsize = 0; int insert(nodet *firstele, int value) { nodetp temp; if((temp = (nodetp)malloc(sizeof(nodet))) == null) { return 0; } // first node in list. if(listsize == 0) { firstele->value = value; firstele->next = null; } // finds end node , adds new node list. else { while(temp != null) { temp = temp->next; } temp->value = value; temp->next = firstele; firstele = temp; } listsize++; return 1; } int print(nodet list) { printf("ele...

oracle10g - Oracle: New database vs new user.schema? -

backstory: had database dropped in lap when company, began working last october, won contract. developers gave me little turn over, digging in memory when maintained oracle db in 2002. skills extremely dated, please gentle. oracle 10.2.0.0.0 windows server 2003 my customer wants me create blank copy of existing application/database future effort. 1st idea clone existing database , remove data. however, seem remember working on project years ago led me believe clone existing user/schema , not have whole other database maintain. there high possibility new application never used, , i'd least amount of work possible. current database small. suggestions appreciated. you can export database rows=n parameter: exp username/password@db owner=abc rows=n this export except data. then if want import it, can change users if needed: imp username/password@db fromuser=abc touser=xyz

javascript - AngularJS Error: $injector:unpr Unknown Provider -

i'm trying build own service following example in documentation factory methodology. think i've done wrong because continue unknown provider error. code app including declaration, configuration , factory definition. edit i've added of files troubleshoot edit full details of error below issues appears getsettings, it's looking getsettingsprovider , cannot find it error: [$injector:unpr] http://errors.angularjs.org/1.2.16/$injector/unpr? p0=getsettingsprovider%20%3c-%20getsettings @ error (native) @ http://localhost/sw/selfservice/bower_components/angular/angular.min.js:6:450 @ http://localhost/sw/selfservice/bower_components/angular/angular.min.js:35:431 @ object.c [as get] (http://localhost/sw/selfservice/bower_components/angular/angular.min.js:34:13) @ http://localhost/sw/selfservice/bower_components/angular/angular.min.js:35:499 @ c (http://localhost/sw/selfservice/bower_components/angular/angular.min.js:34:13) @ d (http://l...

android - uploading high quality image on parse.com -

whenever upload image database on parse.com, size gets reduced. have tried possible ways fix issue. tried saving image in sdcard , there, of proper size when try view in data browser of parse, shows me small image, of 50x50px. how can fix this? my saving sd card code: private void saveimage(bitmap imgmap,imageview imgview) { calendar ci= calendar.getinstance(); filenamestr="sdcard/sudhaar/"+ci.get(calendar.year)+"-"+(ci.get(calendar.month)+1)+"-"+ci.get(calendar.day_of_month)+"_"+ci.get(calendar.hour_of_day)+"-"+ci.get(calendar.minute)+"-"+ci.get(calendar.second)+"-"+ci.get(calendar.millisecond)+".jpg"; try { fileoutputstream imgout=new fileoutputstream(filenamestr); imgdata.compress(bitmap.compressformat.jpeg,100,imgout); imgout.close(); } catch (filenotfoundexception e) { toast.maketext(getapplication...

maven - Failure to find com.oracle.state-management:state-management-parent:pom:1.0.0-SNAPSHOT -

i can't remember did cause problem. when try run mvn clean install , following output: mvn clean install [info] scanning projects... [info] [info] using builder org.apache.maven.lifecycle.internal.builder.singlethreaded.singlethreadedbuilder thread count of 1 [info] [info] ------------------------------------------------------------------------ [info] building search maven webapp 1.0 [info] ------------------------------------------------------------------------ [warning] pom org.slf4j:slf4j-api:jar:12.1.2 missing, no dependency information available [info] ------------------------------------------------------------------------ [info] build failure [info] ------------------------------------------------------------------------ [info] total time: 0.895 s [info] finished at: 2014-05-29t21:55:34+02:00 [info] final memory: 6m/154m [info] ------------------------------------------------------------------------ [error] failed execute goal on project search: not resolve dependencie...

Using Scala pattern matching to find whether a List contains a value -

i've seen range of different matches can against list using pattern matching. possible use pattern matching identify if (and ideally which) element in list contains value x? this: def contains(text: list[char], chr: char): boolean = text match{ case *pattern matching chr value in text* => true case _ => false } just trying learn can , can't do. (i know can use text.contains(chr), btw) thanks, peter what have seen use matching on list recurse, in case probably: def contains(text: list[char], chr: char): boolean = text match{ case head :: tail => head.equals(chr) || contains(tail, chr) case nil => false } i don't think can use match kind of operations because of how unapply method of list defined, theoretically if know length of list write like case x1 :: x2 :: x3 // , on but guess can see not practical nor ideal param-matching.

php - How to stop HTML text in textarea to be interpreted as code -

i have textarea users can edit. after edit save text in php variable $bio. when want display this: <?php $bio = nl2br($bio); echo $bio; ?> but if user example types html command "strong" in text site output text bold. nothing want. how can print/echo $bio on screen text , not html code? thanks in advance! replace echo $bio; echo htmlspecialchars($bio); http://php.net/htmlspecialchars

c++ - memory mapping a text file of floats separated by space to a vector of floating point numbers -

i have text file several thousands of floating point numbers separated space.i trying use memory mapping copy data text file vector of floating point numbers in visual studio 2010 using c++.following code made read text file memory.code reading random numbers makes no sense. can 1 me fixing , copying data vector of floats #include<boost\iostreams\device\mapped_file.hpp> #include<iostream> int main() { boost::iostreams::mapped_file_source file; int numberofelements = 1000000; int numberofbytes = numberofelements*sizeof(float); file.open("replaytextfile.txt",numberofbytes); if(file.is_open()) { float* data = (float*)file.data(); for(int = 0;i <numberofelements;i++) std::cout<<data[i]<<", "; file.close(); } else { std::cout<<std::cout<<" couldnt map file"<<std::endl; } system("pause"); return 0; } this looking @ underlying representation of input text, taking sizeof(float) bytes of , att...

javascript - Gets redirected to default app route when deleting comment using Angular JS and Laravel -

i developing application using laravel , angularjs users may write , delete comments. on home screen, user able view , delete of his/her comments , when list should updated. my problem when press delete button redirected login page default route. $routeprovider.otherwise({ redirectto : '/login' }); i'm using laravels resource controller route::resource('comment', 'commentcontroller'); when go home page again comment deleted. my comment service uses delete comment: app.factory('commentservice', function($http) { return { destroy: function(id) { return $http.delete('comment/' + id); } }; }); in home controller have created function delete comment. app.controller('homecontroller', function($scope, $location, authenticationservice, commentservice) { $scope.deletecomment = function(id) { commentservice.destroy(id).success(function() { commentservice.get().success(function(data) { ...

python - PIL selftests fine and can import __imaging, but still "Imaging is not installed" error -

i'm running os x 10.7.5 , have been trying weeks pil working. it installs , compiles fine, passes selftest, , can import __imaging without errors. however, when try , use scikit-image reading , writing functionality, depends on pil, still classic "the imaging c module not installed" error. does have idea how debug this? stumped. try pillow . it's fork of pil , has fixed many bugs , actively developed , unlike pil. mac os x installation instructions can found here : note: do not need install of external libraries pillow’s basics work. we not provide binaries os x, you’ll need xcode install pillow. (xcode 4.2 on 10.6 work official python binary distribution. otherwise, use whatever xcode used compile python.) the easiest way install prerequisites via homebrew . after install homebrew, run: $ brew install libtiff libjpeg webp little-cms2 if you’ve built own python, should able install pillow using: $ pip ins...

javascript - Node.js check if path is directory error -

i'm trying use this answer allow me check if given file path directory, following error: fs.js:679 return binding.lstat(pathmodule._makelong(path)); ^ error: enoent, no such file or directory '.ds_store' @ object.fs.lstatsync (fs.js:679:18) i figured maybe couldn't handle hidden files well, so, after failing find more elegant solution, checked if first character in file name '.'. however, program crashed on file: fs.js:679 return binding.lstat(pathmodule._makelong(path)); ^ error: enoent, no such file or directory 'readme.md' @ object.fs.lstatsync (fs.js:679:18) why fs.lstatsync() seem error such common files, , how can make work (correctly evaluate if given path directory)?

MySQL search method through PHP -

quick question on method search mysql database php. right now, have function supposed search , return results. have 2 databases, 1 being user , 1 being profile. user stores username, email, password. while profile stores user first name, last name, address, birth day. right now, i'm not sure how go this, have far. i want able search both tables , return list of results via table i've got covered, don't know how intricacies down. function contain either null or value of variable. right now, sketch up: if(!empty($username)): $append .= "where"; $append .= "username = ".$username.""; endif; if(!empty($email)): $append .= "where"; $append2 .= "email= ".$email.""; endif; if(!empty($firstname)): $append .= "where"; $append2 .= "firstname = ".$firstname.""; endif; if(!empty($lastname)): $append .= "where"; $append2 .= "lastname= ".$lastname.""; endif; ...

breeze - BreezeJS + Asp.Net Web Api Security -

i have been looking @ breezejs , want try searched lot , still cannot understand how security handled while using breeze. here know: according post on ideablade forums (creators of breezejs), need single api controller of our entities. api controller contain 1 metadata method, 1 method each entity, 1 save method, 1 delete method. way need 1 entitymanager on client side configured 1 service endpoint. my questions: my understanding of "single controller entities" correct? if understanding correct how can apply security on our controller? if want user role access entities, cannot put authorize filter on controller or method. may want user have read-only access while other users having read-write access on entity. may want return aggregated data user while restricting access full details. please help. thanks.

Objective C: 18 is not greater than -1? -

i have peculiar problem here. i'm building spider grab hyperlinks webpage , put them table , i'm using nsranges parse html document, i've run issue. i have following line of code: nslog(@"%lu", [datastring rangeofstring:@"contents.asp?year1" options:0 range:nsmakerange(index, datastring.length - index)].length); this echoes 18 log, should, if put boolean statement, seeing if length greater -1: nslog(@"%d", ([datastring rangeofstring:@"contents.asp?year1" options:0 range:nsmakerange(index, datastring.length - index)].length > -1)); this echoes 0, or false. 18 greater -1, what's problem? if switch < -1 , returns true. have type-casting unsigned long? here's the definition of nsrange : typedef struct _nsrange { nsuinteger location; nsuinteger length; } nsrange; notice both fields of type nsuinteger , unsigned type. in fact, nsuinteger unsigned long . since there no wider integer ...

java - Instance of an extended class given a collection of super class -

i looking advice on how approach following scenario: let's have array of type , in array there objects of various types extend said type. example: have super class pet, make pet array, , put various objects of dog, cat, , fish classes , put them in array. now, each type of pet has own fields , methods, naturally. this issue comes play. want loop through array , search specific object , call 1 of methods. building off previous example, want search dog name of "benny". once find it, want call benny's gethairlength method. however, if i'm iterating through collection of various pet types, cannot call pet[index].gethairlength since not pets have method(only dogs do). any tips? 1) can cast "pet" (superclass) "dog" (subclass). whether should question, "can". 2) if you're getting classcastexception ... you've done wrong. you're saving wrong object or wrong type. we'd need see code troubleshoot. 3) ...

tcp ip - TCP/IP back to back read and write taking too long -

i trying transfer messages using tcp/ip. found if 1 party acts sender , other party acts receiver, transfer fast. if 2 parties switch roles more often, becomes slow. to specific, operation takes 6 ms: **server:** (int = 0; < 5000; i++){ read(connfd, s1, 128); read(connfd, s2, 128); } **client:** (int = 0; < 5000; i++){ write(sockfd, s1, 128); write(sockfd, s2, 128); } and operation takes 98 ms: **server:** (int = 0; < 5000; i++){ read(connfd, s1, 128); write(connfd, s2, 128); } **client:** (int = 0; < 5000; i++){ write(sockfd, s1, 128); read(sockfd, s2, 128); } is there way reduce delay?

wolfram mathematica - What does the <> symbol mean in InterpolatingFunction? -

what <> (less followed greater than) mean in mathematica? example: interpolatingfunction[{-6,6},{0,6}],<>[x,y] i confused in such kind of expressions. have received such kind of output in ndsolve . mathematica expressions come head , several arguments. example, output of operation might give output list[1,2,3,4,5]. however, mathematica knows list , output formatted {1,2,3,4,5} instead. a function interpolation give special type of object (an interpolating function) has many components. unlike list, of components irrelevant, can ignore them. mathematica hides them using <> don't have @ them. f = interpolation[randominteger[10, 10]] output: interpolatingfunction[{{1, 10}}, "<>"] all shows head, interpolatingfunction , , first argument domain(s) of function. there 1 variable, there 1 domain {1,10} list of domains {{1,10}} . all other arguments there, can find them. can evaluate f by: f[2.3] output: 0.7385 (your output...

php - Undefined index warning on PDO::fetchAll index -

i'm having awful time trying track down cause of since there many different potential causes "undefined index" warning. notice: undefined offset: 0 in d:\xampp\htdocs\inc\php_main.php on line 71 the line $singleresult = $result[0]; line 71. i'm positive $result[0] set, i've verified both print_r , isset check. missing something? i'm sort of hoping need sanity check here. :) function execute ($sql, $bindingsarray) { $pdostmt = $this->db->prepare($sql); $pdostmt->execute($bindingsarray); $result = $pdostmt->fetchall(pdo::fetch_assoc); print_r($result); if (isset($result[0]) && isset($result[1])); { $singleresult = $result[0]; return $singleresult; } return $result; } your variable not set , don't notice because if line wrong: if (isset($result[0]) && isset($result[1])); { ^ problem $singleresult = $result[0]; re...

java - How can sub-classing affects all instance of original object? -

i trying learn decorator pattern wiki states the decorator pattern alternative subclassing. subclassing adds behavior @ compile time, , change affects instances of original class; decorating can provide new behavior @ run-time individual objects. i have doubt, if create 1 class original original=new original(); how come subclassing subclass extends original affect original reference of object of class original, should remain intact?

ios7 - Beginner's iOS issue (from tutorials) -

this may seem stupid first time trying write ios code , using tutorial tells me add code , explains did few lines later. able create basic square on screen , next few lines make sure square drops bottom of simulator. added , compared code square doesn't drop code should. here wrote. uiview *square = [[uiview alloc] initwithframe:cgrectmake(100,100,100,100)]; square.backgroundcolor = [uicolor graycolor]; //uicollisionbehavior* _collision; [self.view addsubview:square]; uidynamicanimator* _animator; uigravitybehavior* _gravity; _animator = [[uidynamicanimator alloc] initwithreferenceview:self.view]; _gravity = [[uigravitybehavior alloc] initwithitems:@[square]]; [_animator addbehavior:_gravity]; can tell me doing wrong? or code incorrect someway? there other simpler way begin ios development thanks it works: @interface dpviewcontroller () { uidynamicanimator* _animator; uigravitybehavior* _gravity; uicollisionbehavior* _collision; } your mista...

regex - Replace string in file using VB.net - case insensitive -

given following partial file example : <sellgrey>true</sellgrey> <sellwhite>false</sellwhite> <sellgreen>false</sellgreen> <sellblue>false</sellblue> what best method case-insensitive search , replace, while keeping proper case on output. for example: <sellgrey>true</sellgrey> or <sellgrey>true</sellgrey> would searching for, replacement, : <sellgrey>false</sellgrey> lastly, please not hung on "tags" file malformed xml reading/writing xml bugger things up. please @ strings -- case-insensitive string search , replace, on line line basis. thanks in advance. since didn't provide detail tags, used dictionary proper casing. dim input string = "<sellgrey>true</sellgrey>" dim pattern string = "<(?<tag>.+)>(?<value>(true|false))</.+>" 'building dictionary specify how proper case dim tagformatter new d...

HTML CSS - Stacking Divs Vertically -

i trying stack links in left-most column vertically. i've tried several things having no luck. any ideas? http://jsfiddle.net/adruz/112/ .box { background: #e8e8e8; border-radius: 8px; padding: 10px; -moz-box-shadow: 0 0 30px black; -webkit-box-shadow: 0 0 30px black; box-shadow: 0 0 30px black; font-family: georgia; } .col1 { float:left; width:25%; height: 500px; } .col2 { float:right; width: 70%; height:500px; } .orange-heading { color: #0000ff; font-size: 40px; } .title_link { font-size:20px; clear:left; } i tried using <br> tag , worked fine. also there mistake on links instead of class had put clas desired font size not set! http://jsfiddle.net/elc8c/ i hope have helped!

angularjs - to give multiple values to thymeleaf attribute -

i have requirement give multiple values thymeleaf attribute. in view page, combination of angular, thymleaf spring mvc. <div id="ziplookup" ng-controller="addressmanagementctrl" data-th-attr="data-data=*{primary.zipcode}, *{primary.county}, *{primary.city}, *{primary.street1}, *{primary.street2}"> which throwing error templateprocessingexception: not parse assignation sequence. "data-data=*{primary.postcode},*{primary.county},*{primary.city},*{primary.street1},*{primary.street2} " it clear syntax incorrect, can 1 suggest me correct way implement this. intention after document parse, should this: data-data='{ "zipcode": "90292", "state": "ca", "county": "--", "city": "marina", "addressline1": "...", "addressline2": "..." }' here zipcode, state,county,city,addressline1,addressline2 propert...

c++ - Assigning structs including pointers -

consider following simple program. defines 2 variables a , b mystruct , initializes a . how can copy a b new pointers b ? if use assignment operator, firstmember of b assigned firstmember of a , whenever change value of b.firstmember[i] , value of a.firstmember[i] change. know can done function, there simpler way? assuming mystruct can have lots pointers, writing function doesn't seem good. typedef struct mystruct { int * firstmember; int secondmember; } mystruct; int main() { mystruct a; mystruct b; initialize(a); // initializes such a.firstmember[0] != 5 b = a; b.firstmember[0] = 5; cout<<a.firstmember[0]; // prints 5 return 0; } this falls "rule of 3" . once start managing raw pointers inside class, want define custom contructor, destructor, , assignment operator reason.

Javascript encoding not valid for JSON -

are encodings json , javascript different? have javascript snippet embedded in json. moment special character present in javascript (e.g. '(' represented \x28 in js snippet) causes json invalid. in example above, if update '(' represented '(' instead of '\x28' result in valid json. first representation hex. while second valid html. i'm not familiar encoding types. could me understand encoding need use on javascript in order ensure results in correct format json? i've included rough example below. special characters '\x28rt' denotes '(rt'. in js gets encoded \x28rt. valid json needs ''rt { "class":"mytype", "id":"testid", "javascript":"function testmethod() {var v2 = function (a, b, e) {return e(a, b);};}var v1 = 'somevalue';if (v2((v1), ('\x28rt'), function (a, b) {if (a == undefined || == null) {return false;}return === b;})) {ale...

Google Android Building A Camera App Tutorial -

i'm going through 'building camera app' tutorial - http://developer.android.com/guide/topics/media/camera.html#custom-camera as relatively new android, find bit confusing / unclear @ times. i'm trying understand code supposed go: private boolean isrecording = false; // add listener capture button button capturebutton = (button) findviewbyid(id.button_capture); capturebutton.setonclicklistener( new view.onclicklistener() { @override public void onclick(view v) { if (isrecording) { // stop recording , release camera mmediarecorder.stop(); // stop recording releasemediarecorder(); // release mediarecorder object mcamera.lock(); // take camera access mediarecorder // inform user recording has stopped setcapturebuttontext("capture"); isrecording = false; } else { // initialize video camera if (preparevideorecorder(...

regex - Regexp matching separated proxy ip and port -

Image
i trying scrape proxy address websites. never learn regex in deep. there few common formats , here's regex using regex ip = new regex(@"(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})(?:\t*)(?: *)(?::*)(\d{2,5})"); different website uses different format, 8.8.8.8\t\t 80, 8.8.8.8:80, 8.8.8.8 \t80 this regex able capture of address mismatch 123.123.123.123 ip 123.123.123.1 , port 23 if ip address not followed port separated 1 of 3 elements i want 3 common element \t,space,: 0 or more @ least 1 of 3 appears. i think of negative lookahead noob make use. any suggesion? if ok addresses 123.123.123.123 : :: : 80 , can use following: (\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})[ \t:]+(\d{2,5}) if want match addresses 123.123.123.123 : 80 , 123.123.123.123 80 , 123.123.123.123:80 (max 1 : ), can lookahead. (\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})(?=[^\d])\s*:?\s*(\d{2,5}) or can use or operation: (\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})(?:\s+|\s*:\s*)(\d{2,5}) ...

javascript - load bootstrap modal on redirect -

i have bootstrap modal allows users sign in. want users have not authenticated have sign modal pop on whatever page at. session controller def new respond_to |format| format.html format.js end end session/new.js.erb $("#modal-window").html("<%= escape_javascript(render 'sessions/new') %>"); if user hit controller want them see signin modal. figured try redirect them new_session_path . didn't work , got missing template error. def new if current_user @image = image.new else redirect_to new_session_path end end if send html request, should html back. rails looking html template , isn't finding one. i recommend using before_action controllers or actions want restrict. require making html template sign in. before_action :verify_user, only: [:new] def verify_user redirect_to new_session_path , return unless current_user end (or redirect_to root_path or somewhere , ...

Lambda functions in generic C# method -

i'm trying better understand lambda expressions generic methods, have code opening connection , getting information session use. my goal pass in object of type t can data fixture inside lambda expression. protected t getdatafromfixture<t>(int fixture_id, ttfixture fixture, func<t, t> lambda) { var fixtures = session.allfixtures; fixture = fixtures.containskey(fixture_id) ? fixtures[fixture_id] : null; if (fixture != null) { return lambda(t); } return default(t); } question is: how pass through lambda function openconnectionwithfixtureobject can access fixture object , return type t something like.. string total; ttfixture fixture; openconnectionwithfixtureobject<stattotallist>(_fixtureuid, fixture, (stattotalsforoverview) => { total; = fixture.mytotal(); }); i don't think logic far off, i'm unfamiliar func<t,tresult> , generics . assistance appreciated! i don't think ...

PHP Variables and its checking for null with some discipline -

i want hints php here variables $error; $a=$_post["sdf"]; $b=$_post["dsf"]; $c=$_post["ssdfsdfdf"]; $d=$_post["ssdfsddf"]; $e=$_post["sdfsdfdf"]; $f=$_post["sfsdfsdf"]; $g=$_post["sdsdff"]; $g=$_post["sdsdfsdff"]; i want check whether variables empty or not , dispaly message this if(empty($a)){ $error.="hey missed $a "; // $a value } now have repeat codes ... imagine have more 40 variables can hints short code i tried switch statement it's not working ..i want display error message of variable missing... regards $required = ["sdf", "dsf", "ssdfsdfdf"]; //etc. etc. $arr = []; //loop through , santize input. foreach($_post $key => $value) { //sanitize input here //store in array $arr[$key] = $value; } //check empty foreach($arr $key => $value) { if(in_array($key, $required) { if(empty($value)) ...

python 2.7 - Hashing sections of a PE file using pefile module -

i have written script in python uses pefile module parse pe files. 1 of features of script ability generate md5 , sha256 hash each section contained within pe file. looking code pefile module there class called sectionstructure. within class there methods allow return of both md5 , sha256 hash of pe section's data. not sure how access these methods within script , seeking advice of more seasoned developers assist this. can please point me in right direction in getting functionality work? share script upon request. the list pe.sections contains section object each pe section. iterate on , use methods get_hash_md5() , get_hash_sha256() . example: import pefile pe = pefile.pe('/path/to/file') sect in pe.sections: print sect.name print sect.get_hash_md5() print sect.get_hash_sha256() print

dom - Liferay pop up iframe issue -

using liferay.util.openwindow, creating portlet in portlet rendered after rendering of second portlet have perform calculations based on size of iframe liferay pop window. problem facing when access element(iframe) using document.getelementbyid give me null. strange thing @ time iframe present in dom,after when second portlet rendered can access iframe element. how should access iframe element? any appreciated. if using liferay 6.1 use aui dialog windows http://www.liferaysavvy.com/2013/12/open-liferay-portlet-in-aui-dialogpopup.html https://www.liferay.com/web/raymond.auge/blog/-/blogs/embedding-portlets-in-themes-on-liferay