Sunday, 15 July 2012

ios - Transfer Multiple Images via NSInputStream/NSOutputStream -



ios - Transfer Multiple Images via NSInputStream/NSOutputStream -

i have 2 nsinputstream , nsoutputstream connected each other via network. want transfer core info objects , associated images 1 device other device. have converted core info objects json , transferred other side of stream , populated core info json. there images associated each recorded. images on disc, there path stored in core info objects. now, have have finish info @ hand when writing output stream. have xml (that contains json) ready. 1. how transfer images (nsdata *) along xml (also nsdata *) ? how differentiate @ reading end (nsinputstream) between xml , images? 2. also, have transfer multiple images, how tell @ nsinputstream end bytes of image have finished , the bytes of next image have started ? 3. how know image (name) has been transferred ? thanks

convert nsdata (of each uiimage) nsstring representation, set nsstring objects nsdictionary , serialize dictionary. in way when transfer info on can reverse process extract images knowing key points image. way should able transfer multiple images.

hope helps.

cheers

ios image nsstream nsinputstream nsoutputstream

ipad - Monotouch Crash: Replace UINavigationController A with B and Push UiViewControllers on B -



ipad - Monotouch Crash: Replace UINavigationController A with B and Push UiViewControllers on B -

we have been using xamarin while , causing weird crash while developing latest ipad app. next problem:

the ipad app uses story board 2 navigation controllers (say , b) each has rootviewcontroller (say a1 , b1), default navcontroller , showed on app start up. there 2 buttons on a1 , pressing button 1 loads navcontroller b.here steps code execute when button 1 on navcontroller clicked.

in button event handler , phone call public function in appdelegate following:

get storyboard id , instantiate navcontroller b using storyboard.instantiateviewcontroller. remove navcontroller superview (using uiview.view.removesuperview()) assign above reference of b appdelegate window's root view controller (which loads rootview controller b1 of navcontroller b).

it works fine till above step (i can see rootviewcontroller's uiview load on ipad).

the next step trying force uiviewcontroller after instantiating it.(because target 2 show sec screen in hierarchy) (storyboard.instantiateviewcontroller(identifier).this should ideally show me pushed view controller.but app crashes after step.!! weird!!!!. next simplified code:

public void setnavcontrollerb(uinavigationcontroller nava, uistoryboard storyboard) { nava.view.removefromsuperview(); this.window.rootviewcontroller = (uinavigationcontroller)storyboard.instantiateviewcontroller("vc0"); // 'vc0' identifier navigationcontroller b rootviewcontroller "vc1" // works great till above step uiviewcontroller vc2 = (uiviewcontroller)storyboard.instantiateviewcontroller("vc2"); ((uinavigationcontroller)this.window.rootviewcontroller).pushviewcontroller(vc2, true); //the above executes out exception, crashes later. }

pleaseeeee help!!!!!!

if modifying stack in uinavigationcontroller beyond force or pop, need replace entire stack of controllers:

mynavcontroller.setviewcontrollers(new uiviewcontroller[] { controller1, controller2 }, true);

if seek force or pop before previous force or pop completes, crash , warning in console output.

ps - don't think should need phone call removefromsuperview anywhere in situation, should modify uinavigationcontroller's stack or replace rootviewcontroller on window.

ipad uinavigationcontroller monotouch uistoryboard

c# - Moq verify that the same method is called with different arguments in specified order -



c# - Moq verify that the same method is called with different arguments in specified order -

here's method need unit test:

void do(ienumerable<string> items, textwriter tw){ foreach(var item in items) { tw.writeline(item); } }

how can configure mock of textwriter verify arguments passed same method (writeline) in order ?

[test] public void test(){ var mock = new mock<textwriter>(); mock.setup( ??? ); //check writeline called 3 times, //with arguments "aa","bb","cc", in order. do(new[]{"aa", "bb", "cc"}, mock); mock.verify(); }

you can utilize callback verify passed parameter each call:

[test] public void test(){ var arguments = new[]{"aa", "bb", "cc"}; var mock = new mock<textwriter>(); int index = 0; mock.setup(tw => tw.writeline(it.isany<string>())) .callback((string s) => assert.that(s, is.equalto(arguments[index++]))); do(arguments, mock.object); mock.verify(); // check arguments passed assert.that(index, is.equalto(arguments.length)); }

c# unit-testing moq

Azure: How do I disable the deployment an just create a package file? -



Azure: How do I disable the deployment an just create a package file? -

we have couple of cloud services , continuous delivery test environment via team build. production environment, have our own deployment powershell script. script needs .cspkg file deployment.

my problem haven't found way allow team build create .cspkg file not publish azure. i've used azurecontinousdeployment.11.xaml template , insists on publishing package. i've tried set "deployment settings name" empty string. build runs without errors, way, no bundle created.

is there way stop somewhere in between? maybe alter in .azurepubxml file accomplish that?

environment: vs2012, team foundation service (visualstudio.com)...

i have custom build template xaml invoke msbuild task (microsoft.teamfoundation.build.workflow.activities.msbuild) on azure project (.ccproj file) "publish" target.

(despite having same name ui command pushes bundle azure, "publish" target means "generate bundle without pushing anywhere".)

deployment azure visual-studio-2012

c# - Linq to SQL - how to make a select with conditions and return IQueryable -



c# - Linq to SQL - how to make a select with conditions and return IQueryable -

i can not find answers how implement next scenario (i not know methods). utilize c#, .net fw4.5, linq sql , design pattern repository.

if want select devices, utilize code:

/// <summary> /// devices /// </summary> /// <returns></returns> public iqueryable<device> getdevices() { homecoming mydatacontext.devices; }

if want select device id, utilize code:

/// <summary> /// device id /// </summary> /// <param name="id"></param> /// <returns></returns> public device getdevice(int id) { homecoming mydatacontext.devices.singleordefault( d => d.intdeviceid == id); }

but how can implement next situation?

select devices, conditions (and homecoming iqueryable<device>)

you can utilize :

public iqueryable<device> getdeviceusingpredicate(expression<func<device,bool>> predicate) { homecoming mydatacontext.devices.where(predicate).asqueryable(); }

to utilize generics:

public iqueryable<t> getdeviceusingpredicate(expression<func<t,bool>> predicate) { homecoming mydatacontext.gettable<t>().where(predicate).asqueryable(); }

c# linq-to-sql repository-pattern

c++ - Wchar_t to string Convertion -



c++ - Wchar_t to string Convertion -

i want convert strfilenotifyinfo[1].filename(wchar_t) string can see filepath. can't create work.

here code:

while(true) { if( readdirectorychangesw( hdir, (lpvoid)&strfilenotifyinfo, sizeof(strfilenotifyinfo), false, file_notify_change_last_write || file_notify_change_creation, &dwbytesreturned, null, null) == 0) { cout << "reading directory change" << endl; } else { cout << ("file modified: ") << strfilenotifyinfo[1].filename << endl; cout << ("loop: ") << ncounter++ << endl; } }

use wcout when working wide character data.

std::wcout << l"file modified: " << strfilenotifyinfo[1].filename << std::endl;

c++ string wchar readdirectorychangesw

android - FragmentStatePagerAdapter doesn't call its fragments -



android - FragmentStatePagerAdapter doesn't call its fragments -

i have fragmentstatepageradapter in fragment pager. within pager have 2 fragments switch between them. happening when first come fragment done correctly, when go , homecoming there 1 time again on base of operations fragment called oncreate, oncreateview , on, on fragments in pager not called anything, getitem on adapter not called , pager view blank. on fragments have setretaininstance(true) needed due rotation behaviour handling. can help me guys that?

android fragment pager