Posts

Showing posts from September, 2015

clojurescript - Clojure newbie struggling with protocols -

clojurescript - Clojure newbie struggling with protocols - i attempting build out concept of cursor in clojurescript, backed atom. cursor recursive zipper mechanism editing immutable nested associated datastructure. i newbie @ clojure, can help me spot errors? (defprotocol cursor (refine [this path]) (set [this value]) (value [this])) (defn- build-cursor* [state-atom paths] (reify cursor (set [this value] (swap! state-atom (assoc-in @state-atom paths value))) (refine [this path] (build-cursor* state-atom (conj paths path))) (value [this] (get-in @state-atom paths)))) (defn build-cursor [state-atom] (build-cursor* state-atom [])) (comment (def s (atom {:a 42})) (def c (build-cursor s)) (assert (= (value c) {:a 42})) (set c {:a 43}) ;; warning: wrong number of args (2) passed quiescent-json-editor.core/set @ line 1 <cljs repl> (assert (= (value c) {:a 43})) (def ca (refine c :a)) ;; warning: wrong number of args (2) passed quiescent-js

java - jena.query.ResultSet: hasNext() evaluates false but should contain something -

java - jena.query.ResultSet: hasNext() evaluates false but should contain something - i seek query dbpedia 3.9 datasets on virtuoso (local, 7.0.0). query works fine on sparql endpoint, when using jena, resultset virtuoso query execution not contain nil (hasnext() false). had here , here, still have pb. below code using. have thought of what's wrong? thanks. import virtuoso.jena.driver.virtgraph; import virtuoso.jena.driver.virtuosoqueryexecution; import virtuoso.jena.driver.virtuosoqueryexecutionfactory; import com.hp.hpl.jena.query.querysolution; import com.hp.hpl.jena.query.resultset; import com.hp.hpl.jena.rdf.model.rdfnode; import com.hp.hpl.jena.rdf.model.resource; public static void testdbpedialex(resource dbpedia) { string query = " prefix lexvo: <http://lexvo.org/ontology#> \n" + " prefix rdf: <http://www.w3.org/2000/01/rdf-schema#> \n\n" + " select ?lexlabel { \n" + "

angularjs - Simulate Network Delay Jasmine Unit Test with $httpBackend -

angularjs - Simulate Network Delay Jasmine Unit Test with $httpBackend - i have angularjs directive uses ng-mouseenter trigger phone call backend data. if phone call backend goes longer time, loading indicator presented. i'd test loading indicator gets presented when network phone call taking longer specified period of time. is there way simulate delay $httpbackend? the code triggers these actions (inside directive): scope.triggerpopover = function () { if (angular.element('.my-element-style').length === 0) { scope.detailprom = $timeout(function () { makerestcall(attrs.assetid || ''); }, 200); //waits length before makes phone call backend //we want loading icon come little bit later, because seem flicker //when calls fast scope.loadingprom = $timeout(function () { showloadingpopover(); }, 500);

Batch File: How to delete files sort by date if there are subfolders in the folder? -

Batch File: How to delete files sort by date if there are subfolders in the folder? - here 1 example: there 4 files: c:\test\1002.bak -- created on oct 2nd,2014 c:\test\1009.bak -- created on oct 9th,2014 c:\test\subfolder\1001.bak -- created on oct 1st,2014 c:\test\subfolder\1008.bak -- created on oct 8th,2014 i want batch file delete older files sorted date, files including subfolders. it should sorted like: c:\test\subfolder\1001.bak c:\test\1002.bak c:\test\subfolder\1008.bak c:\test\1009.bak but if run below command, result has been separated subfolder. instance, "dir /a-d /od /s > result.txt" result.txt: volume in drive c has no label. volume serial number aadb-db05 directory of c:\test 2014/10/02 11:40 4,220,416 1002.bak 2014/10/09 07:02 1,453,321,216 1009.bak 2014/10/09 18:44 0 result.txt 3 file(s) 1,457,541,632

excel formula - Multiple Or Conditions in a Countifs Statement -

excel formula - Multiple Or Conditions in a Countifs Statement - is possible have multiple or conditions in countifs statement? i trying write statement counts number of records relationship either 'contractor' or 'supplier' , if severity either 'serious' or major. first or status work, first status in sec or statement beingness picked up. here have written: =(countifs(data!f:f,{"contractor","supplier"},data!e:e,{"serious","major"})) =sumproduct((data!f:f="contractor")+(data!f:f="supplier"),(data!e:e="serious")+(data!e:e="major")) the (data!f:f="contractor") produce array of true/false size of column f, true column f "contractor". the (data!f:f="supplier") produce array of true/false size of column f, true column f "supplier". the above 2 arrays "added" - converts them 1/0s instead , adds 2 arrays toget

c++11 - C++ shared_ptr and Java native Object ownership -

c++11 - C++ shared_ptr and Java native Object ownership - while exposing functionalities c++ library java faced problem regarding c++ shared_ptr pointers. case object jlong handle related object lives whithin java portion subsequent structures access object using smart pointers. the problem got is: when smart pointer gets destroyed or reset underlying object gets deleted well. java reference points still object. i tried lot did not manage maintain ownership on java-side. there best practices or solutions problem ? if want hold object long java keeps reference it, here useful pattern: jlong java_xxx_getnativeref(...) { std::shared_ptr<myobject> *pnew = new std::shared_ptr<myobject>; *pnew = whatever-you-do obtain std::shared_ptr<myobject>; homecoming reinterpret_cast<jlong>(pnew); } java_xxx_releasenativeref(..., jlong nativeref) { std::shared_ptr<myobject> *psp = reinterpret_cast<std::shared_ptr<myobject> *&g

vb.net - SSRS deploy report by rs.exe set "Limit report processing.." propeties -

vb.net - SSRS deploy report by rs.exe set "Limit report processing.." propeties - any body know how set propeties processing options -> study timeout -> limit study processing next number of seconds: study deploy rs.exe utility vb scripts parameter? have vs script deploy reports rs server, cant find name of method set needed properties. have found list of methods http://msdn.microsoft.com/en-us/library/reportservice2010.reportingservice2010_methods.aspx cant' find 1 can help me set time-out. dim definition [byte]() = nil dim warnings warning() = nil dim rsreportspath string = "/" + rsfolder dim is_error boolean public sub main() rs.credentials = system.net.credentialcache.defaultcredentials is_error = false 'create parent folder seek rs.createfolder(rsfolder, "/", nothing) console.writeline("parent folder created: {0}", rsfolder) grab e exception console.writeline(e.

cocoa touch - iOS 8 bug with navigation stack / rotation? -

cocoa touch - iOS 8 bug with navigation stack / rotation? - i have 3 uiviewcontrollers: vc1 , vc2, , vc3 appear in succession on uinavigationcontroller . vc1 has next rotation properties: - (bool)shouldautorotate { homecoming yes; } - (bool) shouldautorotatetointerfaceorientation:(uiinterfaceorientation)tointerfaceorientation { homecoming (tointerfaceorientation == uiinterfaceorientationportrait); } - (nsuinteger)supportedinterfaceorientations { homecoming uiinterfaceorientationmaskportrait; } - (uiinterfaceorientation)preferredinterfaceorientationforpresentation { homecoming uiinterfaceorientationportrait; } while vc2 , vc3 have next rotation properties: - (bool)shouldautorotate { homecoming yes; } - (bool) shouldautorotatetointerfaceorientation:(uiinterfaceorientation)tointerfaceorientation { homecoming (tointerfaceorientation != uiinterfaceorientationportraitupsidedown); } - (nsuinteger)supportedinterfaceorientations { ho

Sharepoint 2013 Community portal showing "There are currently no communities in this view" -

Sharepoint 2013 Community portal showing "There are currently no communities in this view" - i created community portal site , couple of community sites. maintain on getting "there no communities in view." on community portal. tried re-index search , did total crawl , didn't help. test query within content search webpart (webtemplate:community) not returning result @ all. there step need perform after creating community sites search crawls these sites? it search service application indexes. set crawling rules , content via central administration --> manage service applications --> search service applications. reset index , re-crawl. sharepoint sharepoint-2013

java - How to replace boolean field with a constant value using ASM -

java - How to replace boolean field with a constant value using ASM - i want transform field of class constant. i'm using asm 5.0.3. here test class have: public class bytecodeutilstest { @beforeclass public static void beforeclass(){ string replacefieldclassname = "com.mypackage.classwithfieldtoreplacewithconstant"; string replacefieldclassnameaspath = replacefieldclassname.replace('.', '/') + ".class"; // standard code redefine class (inspired asm faq http://asm.ow2.org/doc/faq.html, sec. 5) classloader contextclassloader = thread.currentthread().getcontextclassloader(); inputstream stream = contextclassloader.getresourceasstream(replacefieldclassnameaspath); byte[] classbytes; seek { classbytes = ioutils.tobytearray(stream); // here interesting part byte[] patchedclassbytes = bytecodeutils.patch(classbytes, "_fieldtoreplace", true); reflection.invoke(contextclasslo

swift - Share Extension: Grab thumbnail in custom view controller like SLComposeServiceViewController -

swift - Share Extension: Grab thumbnail in custom view controller like SLComposeServiceViewController - i'm trying grab thumbnail image website can paste on custom uiviewcontroller share extension. know slcomposeserviceviewcontroller free, have create customized view controller. there way existing apis? thanks. try code, thumbnail file url: nsurl *path = self.url; nsdictionary *options = [nsdictionary dictionarywithobject:[nsnumber numberwithbool:no] forkey:(nsstring *)kqlthumbnailoptioniconmodekey]; cgimageref ref = qlthumbnailimagecreate(kcfallocatordefault, (__bridge cfurlref)path, cgsizemake(600, 800 /* or whatever size want */), (__bridge cfdictionaryref)options); nsimage *thunbnail = [[nsimage alloc]initwithcgimage:ref size:nszerosize]; swift ios8-share-extension

perl - XML::Twig and save order of attributes -

perl - XML::Twig and save order of attributes - i editing xml files using xml::twig below code : my $twig = xml::twig->new( pretty_print => 'indented', twig_handlers => { vendor => sub { $_->set_att( 'id' => $_->{'att'}->{'att1'} ); $_->set_att( 'id' => $_->{'att'}->{'att2'} ); $_->set_att( 'id' => $_->{'att'}->{'att3'} ); $_->set_att( 'id' => $_->{'att'}->{'att4'} ); }, }, ); $twig->parsefile('myfile'); $twig->flush; the problem code not save xml attributes in same order in edited file. for illustration line input xml : <device overwrite="true" string="true" block="false"> is replaced line in output xml : <device block="false" string="true" overwr

c - Using Scanf for Storing Input in 2d Arrays -

c - Using Scanf for Storing Input in 2d Arrays - i want scan input , save in square 2d array. the first 2 digits saved in seperate variables, first digit target number (irrelevant here), sec digit gets saved in variable m, i.e. m = 5 in case. m number of rows/colums of square matrix. rest of input should saved in array. particular input, segmentation-fault , random numbers printed on screen. used printf statements trace things go wrong, , noticed index i in first loop jumped 2 11 in 1 scenario, other input jumped 33. help! hope not missing obvious mistake. input: (each row seperated previous pressing enter.) 42 5 0 3 7 9 10 9 13 20 5 20 12 11 33 0 12 17 39 22 3 18 my code: #include <stdio.h> #include <stdlib.h> int main (int argc, char* arv[]){ int target; // later processing, irrelevant here int m; // m = #rows , #columns of array int array[m][m]; scanf("%d %d", &target,

ios - How to get CGPoint where a gesture is happening in Objective C -

ios - How to get CGPoint where a gesture is happening in Objective C - i have added gesture recognizer because want x coordinate of touch (working on sound trimmer, need x coordinate handles of trimmer). i have uigesturerecognizer *recognizer; cgpoint leftcontrolpoint = [recognizer locationinview:self.view]; nslog(@"this touch %@", nsstringfromcgpoint(leftcontrolpoint)); however, nslog gives me {0,0}. any thought what's going on? thanks can do? the proper way wire gesture recognizer this: // in method, -viewdidload: uitapgesturerecognizer *tap = [[uitapgesturerecognizer alloc] initwithtarget:self action:@selector(didtapview:)]; [self.view addgesturerecognizer:tap]; then: - (void)didtapview:(uitapgesturerecognizer *)sender { cgpoint leftcontrolpoint = [sender locationinview:self.view]; nslog(@"this touch %@", nsstringfromcgpoint(leftcontrolpoint)); }

c# - How to Bind to index in ItemsControl from DataTemplate in silverlight -

c# - How to Bind to index in ItemsControl from DataTemplate in silverlight - i have silverlight application using itemscontrol. within of itemscontrol have datatemplate defined following: xaml <itemscontrol grid.row="1" grid.columnspan="5" x:name="dgodds"> <itemscontrol.itemtemplate> <datatemplate> <grid x:name="groot"> <grid.columndefinitions> <columndefinition width="200"/> <columndefinition width="200"/> <columndefinition width="200"/> </grid.columndefinitions> <textbox x:name="of1" grid.column="0" text="{binding oddfactor, mode=twoway}" fontweight="bold" verticalalignmen

java - Viewing console output when web application is running on Amazon Web Services -

java - Viewing console output when web application is running on Amazon Web Services - i know simple question, im new amazon web services , need help can get. when run web application locally can debug inserting print statements within code see if statement executed or not (i @ console output). now, getting errors in code when upload application aws. not these errors when run application locally, need debug. there way see output of print statements when application running on amazon instance? can ssh instance local computer. possible utilize same debugging technique when code running remotely? thanks. yes possible. see in console should automatically logged in catalina.out file. file should located under : $catalina_home/logs/ . notice multiple files like: catalina.yyyy-mm-dd.log . that's because tomcat uses apache commons logging dailyrollingfileappender. from tomcat official website: when running tomcat on unixes, console output redirected file named catali

PHP: xml_parser "Mismatched tag"-error when parsing HTML (auto-closing tags as )? -

PHP: xml_parser "Mismatched tag"-error when parsing HTML (auto-closing tags as <img>)? - i want parse html using phps. used xml_parser it, can't cope auto-closing tags <img> . for example, next html snippet produces 'mismatched tag' error when reaches closing tag </a> : <a> <img src="url"><br> </a> obviosly, reason is: xml_parser() doesn't know tags <img> , <br> not need closed (as self-closing automatically). i know rewrite html <img src="url"/><br/> create parser happy. however, want parser correctly process html correctly instead above variation valid html. so either need tell parser - within onopeningtag - if tag auto-closing. possible somehow? alternative tell parser list of self-closing tag names. however, didn't find function that. might case 'html' isn't supported parser. a acceptable solution might disable tag mismatch check

python - Why are variables assigned to empty brackets before use? -

python - Why are variables assigned to empty brackets before use? - def substitute(clues,words): subst_words = [] # <== here in range(len(words)): word = words[i] j in range(len(clues)): word = word.replace(clues[j][1],clues[j][0]) subst_words.append(word) homecoming subst_words why subst_words assigned empty pair of brackets before use? stupid question know unsure... additionally how apply tuple in substitution of list, if @ possible? the variable beingness initialized list. uninitialized variables can lead resource bugs if had not been declared not accessible. if had been declared initialized none, not able utilize append function on it. also, beingness declared in outermost scope of function. meaning curly braces nested farther within function have access variable. had been declared within loop illustration not able access outside of loop. python variables

javascript - Owl Carousel Outer Arrow Navigation -

javascript - Owl Carousel Outer Arrow Navigation - i'm trying implement owl carousel lazyload images portfolio site , having issues positioning navigation buttons. ideally i'd add together these on outside of carousel positioned halfway image. have seen couple of examples operational cannot fathom out. can please help? i have added jsfiddle here: http://jsfiddle.net/iameuanmackay/448htq9b/ the code i'm using is: <div class="col-xs-8 col-xs-push-2 col-md-push-3 col-lg-6 col-lg-push-3" style="padding-left:45px"> <div class="owl-demo"> <img class="owl-lazy" data-src="http://megmackayphoto.com/beta/lib/img/full/people_02.jpg" alt=""> <img class="owl-lazy" data-src="http://megmackayphoto.com/beta/lib/img/full/people_02.jpg" alt=""> <img class="owl-lazy" data-src="http://megmackayphoto.com/beta/lib/img/full/pe

sql - Unique constraint calling user defined function -

sql - Unique constraint calling user defined function - i have 2 tables: create table primarytable ( value nvarchar(50) not null primary key type not null ) create table secondarytable ( value nvarchar(50) not null, synonym nvarchar(50) not null, constraint pk_secondarytable primary key (value, synonym) ) so, there can many synonyms each value. want deny adding more synonyms if synonym+gettypeforvalue(value) not unique. so e.g. primarytable: ------------- value | type -------------|--------- toyota f-150 | carmake gmc canyon | carmake secondarytable: --------------- value | synonym -------------|--------------- toyota f-150 | toyota pickup gmc canyon | gmc pickup is ok, but primarytable: ------------- value | type -------------|---------------- toyota f-150 | carmake gmc canyon | carmake secondarytable: --------------- value | synonym -------------|----- toyota f-150 | pickup gmc canyon | pickup should not ok (syno

jquery - zeroclipboard edit data before copy to clipboard -

jquery - zeroclipboard edit data before copy to clipboard - i need utilize zeroclipboard re-create table clipboard. need edit table, adding columns, before move clipboard again. i utilize code nil happened: <code> var clienttarget = new zeroclipboard( $("#target-to-copy"), { moviepath: "zeroclipboard.swf", debug: false } ); clienttarget.on( "aftercopy", function (e) { var editedtable=; clipboard.setdata( "text/plain", editedtable);*/ }); </code> run illustration on localhost server. if want yo edit info before re-create have utilize beforecopy event: suppose can modify table within too. jquery zeroclipboard

c# - Unity 2D Jagged Array , Array index is out of range -

c# - Unity 2D Jagged Array , Array index is out of range - i have 2d array giving me array index out of range, problem. cause of problem , how can solve ? edit: yep, sorry that. include want here: so im trying create jagged array which. have number of platforms , numofplatforms want go through them, , each platform has size randomxsize . , now, want mark point in each platform every 0.5, thats why made (randomxsize - 0.5) but don't know how many times need made randomxsizesegments = randomxsize * 2; to calculate how many 0.5 each randomxsize . so in other words, if first platform '0' has randomxsize of 3 i want array randomxsizesegments looking this randomxsizesegments[1][0] = 3 randomxsizesegments[0][1] = 2.5 randomxsizesegments[0][2] = 2 randomxsizesegments[0][3] = 1.5 randomxsizesegments[0][4] = 1 randomxsizesegments[0][5] = 0.5 randomxsizesegments[0][6] = 0 and if sec platform '1' has randomxsize of 7 want array randomxsizese

projection matrix - OpenGL 3D Transformation: z-Aspect ratio -

projection matrix - OpenGL 3D Transformation: z-Aspect ratio - i'm doing 3d perspective projection in opengl (webgl), doing myself uniform-matrices. everthing working fine, have aspect ration of 3:2 (600px x 400px) , distorts geometry rendered. in 2d used prepare in model matrix dividing x , y through 1 / width , 1 / height respectively. now have z worry , pretty clueless how / transform z not distort on 3:2 aspect ratio. the model matrix not seem offer chance , don't know / in projection matrix. edit: projection matrix: @_pmatrix = [ 1, 0.0, 0.0, 0.0, 0.0, 1, 0.0, 0.0, 0.0, 0.0, -(f + n) / (f - n), -1, 0.0, 0.0, -2.0 * n * f / (f - n), 0.0 ] column major order edit 2: weird distortions on n < 1 you're missing *left*, *right*, *top*, *bottom* in projection matrix. 2*n ----- 0 0 0 r-l 2*n 0 ----- 0 0 t-b r+l t+b -(f+n) ----- ----- ------ -1

sql server - How does work SQL with order by 0? -

sql server - How does work SQL with order by 0? - how work? select * table1 order case when field1 not null 0 end, id desc i can replace 0 other integer values still right result. as jurergen d pointed out, reduces possibilities in order by 2 candidates: null , n . whether n 0, 6, 562, or 391842, in status 1 ( null ) show before in status 2 (n). if, "correct result", mean "things null in field1 show first", number, positive or negative, work n. some sample data: can helpful see order by clause doing, i'm going duplicate case statement in select . declare @table1 table (id int identity(1,1), field1 int, fieldsomethingelse varchar(10)) insert @table1 (field1, fieldsomethingelse) values (1, 'some') insert @table1 (field1, fieldsomethingelse) values (2, 'thing') insert @table1 (field1, fieldsomethingelse) values (765, 'or') insert @table1 (field1, fieldsomethingelse) values (null, 'another')

java - Re-Initializing a Variable as a Constant -

java - Re-Initializing a Variable as a Constant - i new java. want know whether there way re-initialize declared global variable constant later after using variable ... because after doing work declared variable want utilize in switch case statement... class { int x; int y; public static void main(string args[]) { a = new a(); system.out.println(a.x); a.y = 3; a.x = 5; switch (a.y) { case a.x:// } } } this illustration need... print statement mentions, need variable x. later want utilize in switch case statement. don't want utilize x after switch case statement... please help me... i want know whether there way re-initialize declared global variable constant later after using variable... no, there isn't. (java doesn't have global variables; looking @ code, x , y instance info members. closest thing java has global variables public static [aka "class"] i

How to connect with sql server using php in xampp -

How to connect with sql server using php in xampp - i have xampp install in computer , xampp php version 5.5.15 want connect sql server (which install in computer sql server 2005) download php driver , re-create paste 2 php file "php_pdo_sqlsrv_55_ts.dll" , "php_sqlsrv_55_ts.dll" in "c:\xampp\php\ext" folder , format php.ini file extension=php_pdo_sqlsrv_55_ts.dll , extension="php_sqlsrv_55_ts.dll" problem when restart apache server (from xampp command panel) it's display 2 error message 1 httpd.exe error "http.exe error msvcp110.dll missing computer" 1 "xampp error php startup unable load dynamic library specific module not found" beside error trying connect sql server using code code homecoming undefined sqlsrv_connect function error my code simple <?php $servername='santunu23-pc\sqlexpress'; $connectioninfo=array ('database'=>'db2662_cslbeseelec'); $myuser='santunu23&

jsf 2 - My website is retruning 404 not found error -

jsf 2 - My website is retruning 404 not found error - my jsf website(http://discountbox.in) returning 404 not found error since night of times. friends able see website. when access via mobile able access site. what can cause this, of this. have deployed application in tomcat , not using apache @ all. working year, since day having issue. this caused dns registered on own router. your client (pc) in same network server , aforementionned router needs access website via local ip (something 192.168.x.x). jsf-2 dns tomcat6 http-error

Split Python Function is not working as expected -

Split Python Function is not working as expected - if have file (users.txt) next info formatted: x y z(t) x y z(t) how can write python function reads in file (users.txt) , uses split function break each line of file 3 variables: who x where y when_and_time z(t) and print s screen such format who on @ when_and_time or variables x on y @ z(t) what have far is: user_info = open("~/users.txt").read() line in user_info: positions = line.split(',') = positions[0] = positions[1] when_and_time = positions[2] print(who + " on " + + " @ " + when_and_time) # press come in @ point it gives me prompt more commands, @ point press come in 1 time again , receive following: traceback (most recent phone call last): file "<stdin>", line 4, in <module> indexerror: list index out of range what doing wrong?? the issue here you're doing split(",") , split strin

How in Nginx to do rewrite without changing URL in address bar -

How in Nginx to do rewrite without changing URL in address bar - i've been trying rewrite in nginx: domain.com/one/two -> onetwo.domain.com. url user sees should not changed in address bar. this code not work correctly - changes url in address bar rewrite ^/one/two/ http://onetwo.domain.com/ last; what solution must there? thanks. this isn't possible, because you're changing hostnames. browser security tied it, webserver configuration. you can rewrite urls within same hostname, changing hostnames requires redirect or using frame. nginx

Create a Sequence Diagram using the Obeo Uml-Designer Eclipse Plugin -

Create a Sequence Diagram using the Obeo Uml-Designer Eclipse Plugin - i have been working way through obeo uml-designer plugin eclipse , it's been quite learning curve! right now, utilize help in creating sequence diagram. i'd add together existing actor diagram create lifeline. can't seem drag model explorer. actor button under existing elements in palette brings empty list. i think may need create instance of actor, don't know how that. :-( if add together new actor diagram, can set type selecting actor "semantic > represents" dropdown in properties. however, still shows instance null, in "null : myactor". any help appreciated. thanks! rob i tried 4.0.1 version, , able utilize existing actor or create new one. i create actor utilize case diagram , when click on "existing elements -> actor" tool, opens wizard lists actors. if select 1 of them, creates lifeline selected actor , if have on properties

How to put character from variable into array in C? -

How to put character from variable into array in C? - i want set character variable character array in c. want print reversed array afterwards can see that's not issue now. this code i've got far: as stdin i'm using txt-file "< input.txt" command line argument, , has 57 characters. #include <stdio.h> #include <stdlib.h> int main() { int counter = 0; char character_array[57]; int = 0; int j = 0; char character = 0; // while eof not encountered read each character while (counter != eof) { // print each character printf("%c", counter); // go on getting characters stdin/input file counter = getchar(stdin); // set each character array character_array[j] = { counter }; j = j + 1; } // print array elements in reverse order (i = 58; > 0; i--) { character = character_array[i]; printf("%c", character); } homecoming 0; } my ide says @ line 35 after fi

python - SyntaxError: invalid syntax on commit -

python - SyntaxError: invalid syntax on commit - import sqlite3 import numpy conn = sqlite3.connect('lotto.db') cur = conn.cursor() def fun(a,b,c,d,e,f): list = [a, b, c ,d, e, f] print(list) homecoming numpy.mean(list) numbers = cur.execute("select * combinations6") numbers.fetchall() row in numbers: cur.execute("update combinations6 id = ? set average = ?", (row, fun(row[0],row[1],row[2],row[3],row[4],row[5])) conn.commit() conn.close() having problem getting iterate on each row getting syntax errors , when run calculates average of first row , inputs rows of database what doing wrong iterate on each row , calculate average , input database? pretty new python in advance help. the problem isn't in python, it's sql syntax. where clause comes after set : cur.execute("update combinations6 set average = ? id = ?", (fun(row[0],row[1],row[2],row[3],row[4],row[5]), row) don't forget sw

Issue with Inner and Left Join -

Issue with Inner and Left Join - i writing query combines columns 2 different tables. reading info csv file , doing info reconcilliation. fields follows allow phone call both tables creditors , takers. creditors db has credit name, trade_acct_number, 2 distinct identifiers called trade_id , action_id. takers table on other hand has corresponding trading_account_num , it's 2 distinct identifiers trade_id , action_id. here conditions; records matched on trading_acct_numbers. based on trading_account_num farther filter info based on trade_id , action_id. trade_id's 8 characters long; if there match on lastly 6 characters of trade_id reflect data; else check action_id. here current query (written in sql server ce) select cr.credit_name, tk.trade_acct_num, cr.credit_reg_num, tk.trade_id, tk.action_id [taker] tr inner bring together [creditor] cr on tr.trade_acct_num = cr.trade_acct_num substring([trade_id],3,8) = substring([trade_id],3,8) or tr.action_id = cr

complete form validation using javascript-php -

complete form validation using javascript-php - i trying validate password using regex , function. in same form have few other fields(viz. name,email,password,confirm password,username,mobile no, street, city, country(select tag), gender(radio button). questions or rather confusions are: do need check if field empty(on both client side , server side) in spite of using 'required' attribute? i have created new function each of field trying validate(just passcheck() makes code unnecessarily lengthy. here re-usability of code not done. in other way can implement validation accomplish it. bit boring implement similar kind of logic or methods 1 time again , 1 time again minor changes. javascript variable can not have same name of function name contains variable.? why? because when trying utilize same name,code didn't worked. when checked same code on jsfiddle.net showed me error variable. whats purpose of using php functions mysql_real_escape_string() non text fi

javascript - IE8 Unexpected Identifier error in compiled JST -

javascript - IE8 Unexpected Identifier error in compiled JST - i have number of templates compiling using grunt jst plugin. discovered compiled string causing "unexpected identifier" error in ie8, , have yet figure out why. this["jst"]["/tpl/general/pagination.tpl.html"] = function(obj) {obj || (obj = {});var __t, __p = '', __e = _.escape, __j = array.prototype.join;function print() { __p += __j.call(arguments, '') }with (obj) { var page = page || 1, prevpage = 1, nextpage = 1, limit = limit || 12, total = total || limit, pages = math.ceil(total/limit), attributes = attributes || []; page = parseint(page); (page > 1)? prevpage = page - 1: false; (page < pages)? nextpage = page + 1: false;;__p += '\r\n\r\n'; if(total > limit){ ;__p += '\r\n\t<div class="pagination" '; for(var = 0; < attributes.length; += 1){ print("data-"+attributes[i].name+"='"+attributes[i].value+&q

ios - Disable UITableViewCell selection by touch but enable by method call -

ios - Disable UITableViewCell selection by touch but enable by method call - what best way of preventing user selecting cell within uitableview, allowing programme phone call selectrowatindexpath: on table view? i want controls in uitableviewcell remain interactive (i.e. allow touchesbegan: called on uitableviewcell). if [tableview setallowsselection:no] , calling selectrowatindexpath: not anything. i realized when phone call selectrowatindexpath: programmatically, delegate method willselectrowatindexpath: not called. however, if user taps cell, called. method can homecoming nil prevent selection. - (nsindexpath *)tableview:(uitableview *)tableview willselectrowatindexpath:(nsindexpath *)indexpath { homecoming nil; } this ensure programmatic calls selectrowatindexpath: select row , taps select row not. ios objective-c uitableview touches

amazon cloudsearch - Ruby AWS Cloud Search Gem for indexing and searching compound queries for api version 2013-01-01 -

amazon cloudsearch - Ruby AWS Cloud Search Gem for indexing and searching compound queries for api version 2013-01-01 - anyone know of ruby gem amazon cloud search? next criteria: 1) back upwards cloud search api version 2013-01-01 2) supports queries multiple constraints (ie. search movies title starting "star", , rating of 5 or above, , made before 1980, etc.) 3) supports indexing info search domain. note have looked @ of these: https://github.com/spokesoftware/aws_cloud_search - doesn't meet criteria 1 https://github.com/wellbredgrapefruit/asari - doesn't meet criteria 3 https://github.com/awslabs/cloudsearchable - doesn't meet criteria 1 https://github.com/willian/cloud_search - doesn't meet criteria 1 or 2 if there isn't such gem meets criteria, write own. have taken @ new aws-sdk-core-ruby gem aws team? https://github.com/aws/aws-sdk-core-ruby i using communication dynamodb , s3, , pairs services' apis. check

Maximum profit array c++ multiple sell -

Maximum profit array c++ multiple sell - given array of size n represents prices of object on n days . each day have either purchase single object or can sell amount of objects have earn money.assume can purchase object. , can sell if have objects. maximize total turn a profit have take particular day selling , buying. for illustration .. n=10 arr={5,0,9,2,9,0,2,7,4,7} , lets total no of objects have n=0; , total turn a profit p= 0 on day 1 don't have object in case have purchase 1 .. n=1 , p=-5 , on day 2 can purchase sec 1 no amount spend n=2 , p=-5 on day 3 can sell both objects , earn money n=0 , p=13 can proceed farther , maximum turn a profit earned 35 please help me question. have seen problems have take days sell , purchase ..but seem help me because here have either purchase or sell each day ..please give me thought how proceed if maintain average of price, purchase when below average, , sell when above average. you have maintai

html - "overflow: hidden;" for percentage sized table cells -

html - "overflow: hidden;" for percentage sized table cells - i want table filling whole window, 2 rows each filling half of height of table(as window), , keeping layout while window beingness resized. can when contents don't overflow, when contents in 1st row desires height larger calculated height percentage, row doesn't maintain percentage more, instead, stays desired height , pushes 2nd row out of window. tried "overflow: hidden;" rows, that's not way works. how can then? <!doctype html> <html> <head> <style> html,body{height:100%;} table{height:100%;} table>tbody>tr{height:50%;overflow:hidden;} </style> </head> <body> <table> <tr> <td>abc<br />abc<br />abc<br />abc<br />abc<br />abc<br />abc<br />abc<br /></td>

msbuild - Unexpected error in Teamcity -

msbuild - Unexpected error in Teamcity - i trying create build agent (msbuild) in teamcity, failing. after start build process, receive error: [assemblyinfo] c:\teamcity\buildagent\work\dbfd279ad4b719e0\projectpath\project.proj(146, 5): error msb4018: unexpected error @ assemblyinfo-task. system.formatexception: input string has wrong format. at system.version.versionresult.setfailure(parsefailurekind failure, string argument) at system.version.tryparsecomponent(string component, string componentname, versionresult& result, int32& parsedcomponent) at system.version.tryparseversion(string version, versionresult& result) at system.version.parse(string input) at system.version..ctor(string version) at msbuild.extensionpack.framework.assemblyinfo.updatemaxversion(string& maxversion, string newversion) in c:\code\msbuildextensionpack\solutions\main\framework\framework\assemblyinfo\assemblyinfo.cs:line 1206. at msbuild.

c++ - Multiple monitors and handles -

c++ - Multiple monitors and handles - trying run loop through physical monitors handles confusing me, have pseudo code runs along lines of: int tempcounter=0 for(counter = number of monitors;counter > 0;counter--){ rect temprect; hdc temphdc; resolution of dc handle (counter) -> temprect; arraylist[tempcounter] = temprect; virtual work area of dc handle (counter) -> temprect; arraylist[tempcounter++] = temprect; tempcounter++; } getsystemmetrics(80) count of monitors, reliable plenty use, or exceptions might fail? i know there not much there, looking on msdn kept me going around in circles, , not competent @ programming. it can simple this: #include <windows.h> #include <stdio.h> bool callback monitorenumproc( hmonitor hmonitor, hdc hdcmonitor, lprect lprcmonitor, lparam dwdata ) { printf("%dx%d\n", lprcmonitor->right, lprcmonitor->bottom); } int main(int argc, char*

java - Neo4j: making one JAR package from app with Neo4j libraries (duplication 'META-INF/...' files) [RESOLVED] -

java - Neo4j: making one JAR package from app with Neo4j libraries (duplication 'META-INF/...' files) [RESOLVED] - i understand, source of issue. i've saw topic here. and here possible solution. but lastly 1 doesn't work me. have problem making 1 jar bundle (with maven) of app neo4j libraries within. when utilize jar in project - works fine, when seek launch web-interface - above mentioned issue. app throws exception next lines: 01:19:49.727 [main] info o.e.jetty.server.serverconnector - started serverconnector@7e75bf2d{http/1.1}{0.0.0.0:7474} oct 13, 2014 1:19:59 com.sun.jersey.spi.container.containerresponse write severe: message body author java class java.lang.string, , java type class java.lang.string, , mime media type application/json not found and info in in web-interface doesn't displayed, expected. it realy of import bundle 1 jar next app distribution. thanks i've resolved issue. in case in add-on this 's

django - How to maintain LDAP to login my own html? -

django - How to maintain LDAP to login my own html? - here current situation: created login.html page come in username , password in form. in views.py post info , utilize username , password authenticate against ldap server (mechanism works). if username/password wrong, redirected login page error message. otherwise, redirected landing page have message like: "hello lastname, firstname". modify setting.py this: authentication_backends=( "django_auth_ldap.backend.ldapbackend", "django.contrib.auth.backends.modelbackend", ) auth_ldap_server_uri = 'ldap://126.1.100.1:1234' auth_ldap_bind_dn = 'cn=ooxx,ou=example,dc=example,dc=com' auth_ldap_bind_password = "123456" auth_ldap_user_search = ldapsearch("ou=example,dc=example,dc=com", ldap.scope_subtree "(samaccountname=%(user)s)") when run python manage.py shell >>> django.contrib.auth import authenticate, login >>> us

ios - Weird measurment speeds: writing to disc -

ios - Weird measurment speeds: writing to disc - i've got .zip file in bundle. i'm reading via: nsfilemanager *filemanager = [[nsfilemanager alloc] init]; filemanager.delegate = self; nsstring *documentspath = [nssearchpathfordirectoriesindomains(nsdocumentdirectory, nsuserdomainmask, yes) firstobject]; nsarray *bundlezipfile = [[nsbundle mainbundle] pathsforresourcesoftype:@"zip" indirectory:nil]; nsstring *filepath = [bundlezipfile firstobject]; nsdata *file = [filemanager contentsatpath:filepath]; if ([filemanager fileexistsatpath:filepath] && file) { dispatch_async(dispatch_get_global_queue(dispatch_queue_priority_default, 0), ^(void) { nsdictionary *attributes = [filemanager attributesofitematpath:filepath error:nil]; double filesizeinbytes = [attributes[nsfilesize] doublevalue]; nsdate *startdate = [nsdate date]; [filemanager copyitematpath:filepath topath:copy1filepath error:nil]; double timepassed

objective c - How do I use Twine with my Xcode Project? -

objective c - How do I use Twine with my Xcode Project? - twine looks great, documentation bit lacking, , there no sample ios project. i'm wondering how incorporate tool project. specifically: is recommended keys arbitrary codes (e.g. path_not_found_error ) or english language words/sentences apple recommends (e.g. unable find path ). the article introduces twine mentions how english language words/sentences fall short when single word mean 2 different things (e.g. list noun vs. verb), mentions drawbacks of using keys: if forget include one, user see key name ( path_not_found_error ) rather english language counterpart ( unable find path ). say i'm writing code , want include new string. steps in order so? when next apple's recommendation, can type nslocalizedstring(@"sample text", nil) , , done. process in order working twine? in their examples, show categories such [[general]] , [[errors]] . how categorize string? in their examples, show tags. the

How can I make a element display on the hover of its parent using CSS? -

How can I make a <p> element display on the hover of its parent <div> using CSS? - .divtwochild { font-size: 24pt; margin-left: 500px; margin-top: 40px; width: 400px; display: inline-block;} .divtwochild:hover, .divtwochild { display: block;} .divtwotext { font-size: 30pt; font-family: open sans; font-weight: bolder; text-align: right; display: none;} the html <p> element in <div> element. want display <p> element when parent <div> hovered. you can select based off hover status of parent, such .parent { /* whatever */ } .child { /* whatever */ display:none; } .parent:hover .child { /* whatever */ display: initial; } http://jsfiddle.net/g6ur51xj/ css

Initialize sized, static string lists in C -

Initialize sized, static string lists in C - i want create string lists discoverable size , not sure if have right method/syntax. here attempt: typedef struct { unsigned int size; char** list; } strlist; static strlist listmediatype = { .size = 7, .list = { "book", "map", "booklet", "pamphlet", "magazine", "report", "journal" }, }; is right approach? note not want hardcode size construction because want utilize same type define many different lists. example, imagine next function: void printlist( strlist* plist ){ for( int x = 0; x < plist->size; x++ ) printf( "%s\n", plist->list ); } it can done c99 compound-literals , slight change: http://coliru.stacked-crooked.com/a/4497d2645ad21b74 typedef struct strlist{ unsigned int size; char** list; } strlist

php - sending POST values javascript -

php - sending POST values javascript - don't know why doesn't work....oh yeah, i'm newb still. have form posts info db, , works fine if utilize post. doesn't work if pass javascript function ajax , submit it. work w/ 'get' beingness submitted function, not work 'post'. 'post' connect db fine, values form blank db gets updated w/ new record has it's fields blank. here's fiddle, set php code css supposed go: http://jsfiddle.net/duckofdeath/6var7103/. here link page, feedback script gets sent tot page @ top: http://www.modernmediaworld.com/diaboli/register3.php function checkform(){ function checkform(){ if (window.xmlhttprequest) { // code ie7+, firefox, chrome, opera, safari xmlhttp=new xmlhttprequest(); } else { // code ie6, ie5 xmlhttp=new activexobject("microsoft.xmlhttp"); } xmlhttp.onreadystatechange=function() { if (xmlhttp.readystate==4 && xmlh

css - Can I style an element using its grandparent's properties, but then set its parent to be different? -

css - Can I style an element using its grandparent's properties, but then set its parent to be different? - i'm trying style background colour of element using background colour belonging grandparent, set parent have different colour. possible? i thought having parent set inherit , element set inherit 'cascade' downwards work, , free alter background colour of parent, hasn't worked. below stripped-down version of i'm trying accomplish. class="snippet-code-css lang-css prettyprint-override"> div { background-color: #e00; } span.foo { background-color: inherit; } span.bar { background-color: inherit; } span.foo { background-color: #777; } class="snippet-code-html lang-html prettyprint-override"> <div> <span class="foo"> hello <span class="bar"> world </span> </span> </div> you can't want using

swift - iOS:is that available to control or choose the way to receive message from network? -

swift - iOS:is that available to control or choose the way to receive message from network? - for example, want forcefulness device receive info network 3g/4g service when wifi connected. developers have permission/api command network device use?is there document in apple developer library? reachability class utilize this. search google. reachability *reachability = [reachability reachabilityforinternetconnection]; [reachability startnotifier]; networkstatus status = [reachability currentreachabilitystatus]; if (status == reachableviawifi) { } ios swift