Posts

visual studio 2010 - Result is getting 0 when using Operator Overloading in C# -

hi have below program , new c#, using system; using system.collections.generic; using system.linq; using system.text; namespace unaryoperatoroverload { public class unaryoperator { private int number1; private int number2; private int result; public unaryoperator() { } public unaryoperator(int number1, int number2) { number1 = number1; number2 = number2; } public static unaryoperator operator +(unaryoperator opr) { unaryoperator obj = new unaryoperator(); obj.result = obj.number1 + obj.number2; return obj; } public void showdata() { console.writeline("the sum of 2 numbers : " + result); } } public class program { static void main(string[] args) { unaryoperator opr = new unaryoperator(20, 30); opr.showdata(); console.readline(...

objective c - UnwindToList from IOS Tutorial does not activate -

i have followed "start developing ios apps today" tutorial. the application has built expected. following block has not worked. o link buttons unwindtolist: action 1) in project navigator, select main.storyboard. 2) on canvas, control-drag cancel button exit item in add-to-do-item scene dock.if don’t see exit item in scene dock instead see description of scene, click zoom in image: ../art/zoom_in_2x.png button on canvas until see it.a menu appears in location drag ended. 3) choose unwindtolist: shortcut menu.this action added xyztodolistviewcontroller.m file. means when cancel button tapped, segue unwind , method called. 4) on canvas, control-drag done button exit item in thexyzaddtodoitemviewcontroller scene dock. 5)choose unwindtolist: shortcut menu. all other directions on tutorials have worked. build compiles without error. when app runs in simulator user clicks done or cancel, focus not move todolist scene. stays on add item screen. any ideas on ha...

Google+ sign in, PHP one-time-code/server-side flow without "Silex/twig" -

Image
example code google+ sign-in server-side apps // create state token prevent request forgery. // store in session later validation. $state = md5(rand()); $app['session']->set('state', $state); // set client id, token state, , application name in html while // serving it. return $app['twig']->render('index.html', array( 'client_id' => client_id, 'state' => $state, 'application_name' => application_name )); question: how server-side work without silex/twig ? i use client library(php) please test codes works fine index.php <?php session_start(); $data['state'] = md5(uniqid(rand(), true)); $_session['state'] = $data['state']; ?> <html itemscope itemtype="http://schema.org/article"> <head> <!-- begin pre-requisites --> <script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"...

ios - Apple Mach O Linker Error -

hope guys know how fix one. need add framework link binary can't find 1 add. ld /users/chrismac/library/developer/xcode/deriveddata/sum-cyzxwtuyfesisgfvermcafpbmtgv/build/products/debug-iphonesimulator/sum.app/sum normal i386 cd /users/chrismac/documents/sum export iphoneos_deployment_target=7.1 export path="/applications/xcode.app/contents/developer/platforms/iphonesimulator.platform/developer/usr/bin:/applications/xcode.app/contents/developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin" /applications/xcode.app/contents/developer/toolchains/xcodedefault.xctoolchain/usr/bin/clang -arch i386 -isysroot /applications/xcode.app/contents/developer/platforms/iphonesimulator.platform/developer/sdks/iphonesimulator7.1.sdk -l/users/chrismac/library/developer/xcode/deriveddata/sum-cyzxwtuyfesisgfvermcafpbmtgv/build/products/debug-iphonesimulator -f/users/chrismac/library/developer/xcode/deriveddata/sum-cyzxwtuyfesisgfverm...

qt - How does QTcpSocket write data to client? -

Image
i wanna make simple qt app can perform task image below: i have learnt fortune server examples , want app combination of fortune server , fortune client. dialog.cpp void dialog::on_btnlisten_clicked(bool checked) { if(checked) { listener = new serversock(this); if(!listener->listen(qhostaddress::localhost,ui->boxport->value())) { qmessagebox::critical(this,tr("error"),tr("cannot listen: %1").arg(listener->errorstring())); ui->btnlisten->setchecked(false); return; } else { qdebug() << "server listening port" << listener->serverport(); ui->btnlisten->settext(tr("listening")); this->setwindowtitle(tr("listening , running")); } } else { listener->close(); listener->deletelater(); ui->tmblisten->settext(t...

c# - StackOverflowException in GetChildRows -

datarow[] arr; arr = (datasset.tables["director"].rows[1]).getchildrows("fk_filmdir"); visual studio throws stackoverflowexception second row , don't why,it should return 2-3 datarows. what's wrong code? le: public void showchildren() { int id = listboxparent.selectedindex; list_film = new list<string>(); datarow[] arr; arr = (ds.tables["director"].rows[id]).getchildrows("fk_filmdir"); foreach (datarow r in arr) { string s = ""; s = r[0] + " " + r[1]+ " " +r[3]; list_film.add(s); } listboxchildren.datasource = list_film; listboxchildren.refresh(); daf.update(ds, "film"); ds.acceptchanges(); } this function , exception occurs @ refresh()

.net - c# references a uses b that inherits from c -

i have classes a,b,c this: //class in console application has reference class library has class b public class { public void usebobject() { b binstance=new b(); // error c defined in assembly not referenced must add reference contains c... } } //class library reference library contains c class public class b : c { public string name{get;set;} } my question if b has reference c , has reference b why need have reference c? not make sense no? assume class c defined below, defines property called propertyinc public class c { public string propertyinc {get;set;} } then when use c's public members through b's instance this. public void usebobject() { b binstance=new b(); binstance.propertyinc = "whatever"; } how come compiler know propertyinc ? did gave clue type is? or how compiler chance know whether such property exist ? well, argue compiler can find using assembly reference of asselblyb(assembly b lives) ...