Posts

c# - Sending and receiving plain text with TCP -

i want send string through tcp connection: tr220,2,a10000xx,3545.1743,5119.5794,001.0,1503,52:56:16,2012/09/13,0,0,0,0,0,v,000,0,0,0,,+989123456789,* i using code send text: string uri = "http://localhost:1414"; string record = "tr220,2,a10000xx,3545.1743,5119.5794,001.0,1503,52:56:16,2012/09/13,0,0,0,0,0,v,000,0,0,0,,+989123456789,*"; httpwebrequest request = (httpwebrequest) webrequest.create(uri); request.method = "post"; byte[] postbytes = getbytes(record); request.contenttype = "text/plain"; request.contentlength = postbytes.length; stream requeststream = request.getrequeststream(); requeststream.write(postbytes, 0, postbytes.length); and getbytes method: private byte[] getbytes(string str) { byte[] bytes = new byte[str.length * sizeof(char)]; system.buffer.blockcopy(str.tochararray(), 0, bytes, 0, bytes.length); return bytes; } after sending request, in other side app, string: post / http/1.1\r\ncontent-type: t...

foundation - NSString compare efficiency -

string compares can costly. there's statistic floating around says high percent of string compares can eliminated first comparing string sizes. i'm curious know whether nsstring compare: method takes consideration. know? according sources here (which 1 implementation, others may act differently), compare doesn't check length first, makes sense since it's not equality check. returns less-than/equal-to/greater-than return code, has check characters, if lengths same. a pure isequal -type method may able shortcut character checks if lengths different, compare not have luxury. it checks of length against zero, not comparisons of 2 lengths against each other.

ios - Removed pod also removed the associated Framework -

i had podfile looked this: platform :ios, '6.0' xcodeproj 'netapp.xcodeproj' pod 'afnetworking' pod 'tttattributedlabel' pod '[x]' decided remove pod '[x]' podfile, ran pod install , pod update . following warnings: systemconfiguration framework not found in project, or not included in precompiled header. network reachability functionality not available. mobilecoreservices framework not found in project, or not included in precompiled header. automatic mime type detection when uploading files in multipart requests not available. i have tried add frameworks manually both in pods , xcode-projplace . dosn't seem work, , functionality missing. how can resolve this? possible reinstall pods way? update seems wasn't removal of pod caused it. did git revert . when ran pod update (updated afnetworking ) warnings came back. just import header files in projectname-prefix.pch #ifdef __objc__ ... #impor...

jquery - phonegap page transition issue -

i making simple application in have image image map, , when click on image map page loads. using href property in tag navigate new page. of being done on single page. when click on image map transition should smooth , second page should loaded (this natural behavior should be) getting page transition choppy , second page isn't loaded, nothing displayed on screen, , elements displayed after tap couple of times on screen. i tried looking solution couldn't find anything. the earlier application had built never ad such issue, , of sudden issue came in second application. <!doctype html> <html> <head> <meta charset="utf-8"> <title>india stats</title> <link href="css/jquery.mobile-1.3.1.css" rel="stylesheet" type="text/css"> </head> <body> <div id="listpage" data-role="page"> <div data-role="header" data-position="fixed...

c++ - sizeof returns wrong value if argument is passed via function -

this question has answer here: when function has specific-size array parameter, why replaced pointer? 3 answers let me ask question test program: #include <iostream> void testsizeof(char* buf, int expected) { std::cout << "buf sizeof " << sizeof(buf) << " expected " << expected << std::endl; } int main () { char buf[80]; testsizeof(buf, sizeof(buf)); return 0; } output: buf sizeof 8 expected 80 why receve 8 instead of 80 ? upd found similar question when function has specific-size array parameter, why replaced pointer? you're taking size of char* , not of array of 80 characters. once it's decayed pointer, it's no longer seen array of 80 characters in testsizeof. it's seen normal char* . as possible reason why, consider code: char* ch = new char[42]; ...

SQL Server 2005 column not visible at asp.net mvc4 controller -

i using asp.net mvc4 , sql server 2005 develop web application. working fine got stuck @ point. updated table new column no_person , updated .edmx file. updated column showing in .edmx designer page when trying access field @ controller side not showing in pop suggestion window , getting error table not contain definition of field no_person i updated library.dll file , tried rebuild project, getting same error. any suggestion please help.

asp.net mvc 3 - how to dynamically edit the bind data in sql using mvc3 web grid -

i new mvc.. have task that, have bind data existing table in sql using asp.net mvc3(razor) web grid .. have edit data in webgrid.. dont know how edit operation going made... plzz me out... i have given bind data.. plz let me know how edit it... controller: public actionresult index() { var list = getlist(); return view(list); } public list<teacher> getlist() { var modellist = new list<teacher>(); using (sqlconnection conn = new sqlconnection(@"integrated security=sspi;persist security info=false;initial catalog=demo;data source=cipl41\sqlexpress")) { conn.open(); sqlcommand dcmd = new sqlcommand("select t_id,t_name,t_address,sub_id teacher", conn); sqldataadapter da = new sqldataadapter(dcmd); dataset ds = new dataset(); da.fill(ds); conn.close(); (int = 0; <= ds.tables[0].rows.count - 1; i++) ...