Posts

c++ - ofstream is writing date and time only -

i trying write text file after code executes can see time , date written in file rather actual data need written file. what strange when run program can see data stored in memory until close windows console not storing data file. i have code uses ifstream , has close @ end not sure if might keeping file open. when writing file program writes @ last position of cursor rather end of file. here code write file. void createperson (person persons[], int* count) { char fullname[100]; char personaddress[200]; int marks1; int marks2; int marks3; int marks4; int marks5; int personnumber; string persongender; ofstream outfile("testfile.txt", std::ios_base::app); if(outfile.fail()){ cerr << "file cannot opened" << endl; } cout<<"enter person's number: "<<endl; cin>>personnumber; cout <<"enter person's full name: "<<endl; cin.ignore(); ...

JavaDoc generation in Android Studio: NullPointerException -

when trying generate javadoc in android studio, acts , shows countless errors concerning non-existing packages , unknown symbols (mostly android-related stuff). finally error message: standard doclet version 1.7.0_55 building tree packages , classes... java.lang.nullpointerexception @ com.sun.tools.javadoc.typemaker.gettype(typemaker.java:83) @ com.sun.tools.javadoc.typemaker.gettype(typemaker.java:44) @ com.sun.tools.javadoc.classdocimpl.superclasstype(classdocimpl.java:496) @ com.sun.tools.doclets.internal.toolkit.util.util.getallinterfaces(util.java:459) @ com.sun.tools.doclets.internal.toolkit.util.util.getallinterfaces(util.java:497) @ com.sun.tools.doclets.internal.toolkit.util.classtree.processtype(classtree.java:194) @ com.sun.tools.doclets.internal.toolkit.util.classtree.buildtree(classtree.java:146) @ com.sun.tools.doclets.internal.toolkit.util.classtree.<init>(classtree.java:91) @ com.sun.tools.doclets.internal.toolkit.abstra...

java - Best way to hack the return type on an implemented method? -

i'm implementing service through maven dependency takes data , spits out @ virtual location, provided conforms strict type requirements. however, i've swapped out 1 of fields (let's call field buzz , implementation of buzzer ) , wondering if can make work rest of service. the service call factory requires type buzz , diff between buzz , buzzer few added member fields. there hack can make factory accept buzzer ? looking through code, service not seem dependent on hashcode of buzz being correct. edit: examples class buzz { public string id public string name public string title public iterable<profile> profiles public myconstructor(string id, string name, string title, iterable profile) { this.var = var; } } and class buzzer { public string id public string name public string title public profile profiles public myconstructor(string id, string name, string title, profile profiles) { this.var = var; }...

Multithreading in SPIN model checker -

how parametrize spin model number of threads? using standard spin model checker. have options set number of parallel threads? checked reference didn't find useful you can dynamically spawn promela process using run operator. can iterate as: #define try_count 5 byte index = 0; :: index == try_count -> break :: else -> index++; run theprocess() od you can define file like: active [try_count] proctype foo () { printf ("pid: %d\n", _pid); assert (true) } init { assert (true) } and run spin simulation: $ spin -dtry_count=4 bar.pml pid: 2 pid: 0 pid: 1 pid: 3 5 processes created or verification $ spin -dtry_count=4 -a bar.pml $ gcc -o bar pan.c $ ./bar hint: search more efficient if pan.c compiled -dsafety (spin version 6.3.2 -- 17 may 2014) + partial order reduction ...

sql server - Generate XML from Query with a certain XSD definition? -

i have following query select a,b,c,d,e,f,g,h view1 = '....' and want generate following xml. possible use sql server for xml it? or there other approach can implemented in sql server? <root> <a>....</a> <!-- appear once --> <b id="1"> <type c="..." d="..."> <subtype> <element e="..." f="...."> <g>...</g> <h>...</h> </element> ..... </subtype> .... <type> ..... </b> <b>..... yes for xml path can used desired result declare @test table ( int, b int, c int, d int, e int, f int, g int ) insert @test values (1,2,3,4,5,6,7) insert @test values (1,3,4,4,5,6,7) select (select top 1 @test a=1 ) 'a/text()', ( select b '@id', (select c '@c', d '@d', ...

windows - New to batch programming. Help on setting new variables -

i trying perform below. if try setting accname variable letter rather /p facing syntax error. can tell me why cannot use other variable letter please? @echo off echo -create set /p program= want do?: goto %program% :create set /b accname= please type in username: echo %accname% > usernames.txt pause /p not variable letter, rather switch tells "prompt user enter new value of program variable". without /p , set program= want do?: , set value of variable program string what want do?: . and syntax error because there's no /b switch set command. for full syntax of set command, use set /? .

powershell - Where does Pester's Invoke-Pester reside? -

according this documentation should possible measure code coverage using pester. ps c:\path\to\codecoverage> invoke-pester .\coveragetest.tests.ps1 -codecoverage .\coveragetest.ps1 invoke-pester : term 'invoke-pester' not recognized name of cmdlet, function, script file, or operable program. check spelling of name, or if path included, verify path correct , try again. @ line:1 char:1 + invoke-pester .\coveragetest.tests.ps1 -codecoverage .\coveragetest.ps1 + ~~~~~~~~~~~~~ + categoryinfo : objectnotfound: (invoke-pester:string) [], commandnotfoundexception + fullyqualifiederrorid : commandnotfoundexception after reading this documentation clear pester module needs imported before running invoke-pester ps c:\path\to\codecoverage> import-module "c:\programdata\chocolatey\lib\pester.3.1.1\tools\pester.psm1" ps c:\path\to\codecoverage> invoke-pester .\coveragetest.tests.ps1 -codecoverage .\coveragetest.ps1 executing tests in ...