Posts

Showing posts from July, 2011

ios - How do I access the dealloc method in a class category? -

ios - How do I access the dealloc method in a class category? - i need perform action in dealloc method of category. i've tried swizzling doesn't work (nor great idea). in case asks, reply no, can't utilize subclass, category. i want perform action on delay using [nstimer scheduledtimerwithtimeinterval:target:selector:userinfo:repeats:] or [self performselector:withobject:afterdelay:] , cancel on dealloc. the first issue nstimer retains target, don't want. [self performselector:withobject:afterdelay:] doesn't retain, need able phone call [nsobject cancelpreviousperformrequestswithtarget:selector:object:] in dealloc method or crash. any suggestions how on category? i stumbled on solution haven't seen before, , seems work... i have category that--as 1 does--needs state variables, utilize objc_setassociatedobject , this: memento *m = [[[memento alloc] init] autorelease]; objc_setassociatedobject(self, kmementotagkey, m, objc_assoc...

c++ - is this code safe? cast a std::vector to std::vector -

c++ - is this code safe? cast a std::vector<Derived*> to std::vector<Base*> - basically i've class a , class b : public a . and i'd cast std::shared_ptr<std::vector<a*> std::shared_ptr<std::vector<b*> the problem std::vector<b> doesn't inherit std::vector<a> , , smart_ptr neither. horrible cast: std::shared_ptr<vectora> vector_a = * ((std::shared_ptr<vectora>*)&vector_b); the code compiles , runs there, safe? http://liveworkspace.org/code/3dqtz1$0 strictly speaking dereferencing operations should succeed. both vectors pointer containers, casting 1 another, whilst unacceptable production code, still utilize same dimensions , alignment. c++ provides rich abstractions avoid these shenanigans though, improve populate vector of derived objects pointers base of operations class. c++ inheritance casting

mysql - I want to find the person with the 22nd highest salary -

mysql - I want to find the person with the 22nd highest salary - i using mysql, have 50 records in employee table. want find person 22nd highest salary. use limit , specifying both offset , row count. to 22nd ranked person in order of highest salary, do: select person employee order salary desc limit 21, 1 notice utilize of 21 here. because offset of initial row (1st highest salary) 0. hence 22nd highest salary offset of 21 (the 21st row in 0-based counting, or "skip 21 rows"). to person(s) 22nd highest salary, need 1 more level of indirection. try: select person employee salary = ( select distinct salary employee order salary desc limit 21, 1 ) mysql

c# - Prevent graceless crash from occurring in application calling library via P/Invoke -

c# - Prevent graceless crash from occurring in application calling library via P/Invoke - i have c# application app a calls, via p/invoke, c++ (qt) dll app b . let's assume cannot, means, edit app b , know app b throwing out of memory exception under set of conditions can replicate not accurately test before passing input app a app b . exception not pose threat app a , ignored if app b "reset" in manner, when app b crashes calls abort() in turn causes app a 's runtime terminate. how can prevent app b 's inevitable, unpredictable, , mundane crash impacting app a ? notes: an implemented unhandledexceptionhandler ignored when error thrown. app b crashes due bug in qtwebkit feasibly handled app b via deleting oversize object , returning null. app a not study out of memory , machine has more plenty memory perform app b 's operation several times over, regardless of bug, memory apparently not allocated app b whatever reason. you can...

Android, java, Xml Parsin Using Dom -

Android, java, Xml Parsin Using Dom - how can parse tag using dom? <gd:where starttime="jan 4 2012" endtime="jan 5 2012"/> i wants starttime , endtime tag. try using this getattributevalue(null,"starttime") java android xml xml-parsing

c++ - What happens if compiler inlines a function which is called through a function pointer -

c++ - What happens if compiler inlines a function which is called through a function pointer - let have function in programme , somewhere in code, function called through function pointer. happens if compiler happened inline function, or compiler realize there function pointer assigned function , hence avoid inlining it. when pointer function taken, compiler generate out-of-line body function. still possible inline function @ other phone call sites. note function marked inline must have definition available in tus refer it, , these definitions must identical. means it's safe inline function @ phone call sites , maintain out-of-line @ others. c++ c compiler-construction

c++ - How does linker deal with virtual functions defined in multiple headers? -

c++ - How does linker deal with virtual functions defined in multiple headers? - suppose have base.h class base of operations { virtual void foo() {...} }; derived1.h class derived1 : public base of operations { virtual void foo() {...} }; derived2.h class derived2 : public base of operations { virtual void foo() {...} }; header derived1.h included in multiple source files , derived1 class used through base interface. since foo virtual , used polymorphic can not inlined. compiled in multiple obj files. how linker resolve situation? member functions defined within class definition implicitly inline (c++03 7.1.2.3). whether function body gets inlined @ point of calling immaterial. inline allows have multiple definitions of function long definitions same(which disallowed 1 definition rule)(c++03 7.1.2.2). standard mandates linker should able link (one or)many of these definitions.(c++03 7.1.2.4). how linker this? the standard ...

binary - Multiple bitwise operators in one line -

binary - Multiple bitwise operators in one line - ok, i'm trying shove these smaller numbers 1 32 bit number, in 1 line. since 101, b 001, , d 011, thought or shifts homecoming me 101001011, or 331. cout returns 1. int main() { int a, b, c, d; = 5; b = 1; d = 3; c = 0; c = ( 0 || << 8 || b << 5 || d << 2 ); cout << c; system("pause"); } you using logical "or"s. result "true". utilize single pipes "|" c = ( 0 | << 8 | b << 5 | d << 2 ); binary operators bit-manipulation

c# - Float Formatting -

c# - Float Formatting - i need format float value string given below 1.0e11 -- 1.0e11 1.21 -- 1.21 when tried tostring("0.00") got next values: 1.0e11- "10000000000.00" 1.21 - 1.21 how can convert float value string exponential value, if has exponential? string.format("{0:e4}", myfloat); or myfloat.tostring("e4"); // 4 number of decimal places reference: http://blogs.msdn.com/b/kathykam/archive/2006/03/29/564426.aspx c#

Change direction of Corona/LUA object -

Change direction of Corona/LUA object - hi object moving right left how can alter downwards ? function movebadc1(self,event) if self.x < -50 self.x =300 self.y = 300 self.speed = math.random (2,6) self.inity = self.y self.amp = math.random (20,100) self.angle = math.random (1,360) else self.x = self.x - self.speed self.angle = self.angle + .1 self.y = self.amp * math.sin(self.angle)+self.inity end end regards kevin to alter right left, down, supposing want other behavior remain same, alter 3 next lines: self.x = self.x - self.speed self.angle = self.angle + .1 self.y = self.amp * math.sin(self.angle)+self.inity to self.y = self.y + self.speed self.angle = self.angle + .1 self.x = self.amp * math.sin(self.angle)+self.initx lua corona corona-storyboard

.net - Use LINQ to Process Elastic Search Results -

.net - Use LINQ to Process Elastic Search Results - what most-efficient method using linq process elasticsearch results? i came across json.net's jobject class. is json returned elasticsearch structured in fashion lends proper linq queries via jobject class? this finish solution on how utilize linq process json query-results elasticsearch engine. connection library - plainelastic.net first off, using plainelastic.net 1 single purpose: connecting elasticsearch server. library lean , contains concise get, post, , set functions. comes play below client connection object. result.tostring() provides json response elasticsearch server. slap dll bin , add together reference. json processor - json.net i using great feature of newtonsoft json.net facilitate linq queries. library has class jobject provides nestable, queryable construction execute linq against. see line below grab hitcount see how nice grab individual value, and, of course, check out linq quer...

c++ - When is it fair to purposefully cause undefined behaviour? -

c++ - When is it fair to purposefully cause undefined behaviour? - the standard library habitually allows undefined behaviour if break requirements on template types, give erroneous function arguments, or other breach of contract. considered practise allow in user libraries? when fair so? consider writing operator[] container: template <typename t> t& container<t>::operator[](int i) { homecoming internal_array[i]; } if i indexes outside bounds of internal_array , nail undefined behaviour. should allow happen or bounds checking , throw exception? another illustration function takes int argument allows restricted domain: int foo(int x) { if (x > 0 && x <= 10) { homecoming x; } } if x not within domain, execution reach end of function without return statement - gives undefined behaviour. should library developer sense bad allowing or not? when fair purposefully cause undefined behaviour? assuming you...

iis - Javafx2 web application can not access some files -

iis - Javafx2 web application can not access some files - i have unusual problem here. have application written in javafx 2. works standlone application.but when seek run on browser, errors. using html file generated netbeans , signed jar files , including libraries(all clients have permission read , write). if double click html file, works again. if seek run localhost (using iis), cant find files if in exact places. interesting part that: can find files , works fine, dont know why works times , not work while not alter anything. clients should acces programme browsers. when seek access site other machines works partially. when tries access files server gets errors again(it can not read file). shortly, application cant find files while running other machines , while running localhost, can find files , cant find sometimes.(i using latest version of aplications, tools, libraries etc.) in advance. it iis. when utilize apache tomcat works fine. iis web javafx-2

iphone - UIImage animations don't work in a view pushed without animation -

iphone - UIImage animations don't work in a view pushed without animation - i've got view controller view contains uiimageview animation: //animationviewcontroller::viewdidload event: var ctlanimations = new uiimageview(); ctlanimations.animationimages = list.toarray(); //<--list contains uiimages ctlanimations.animationduration = 1.0 * list.count; ctlanimations.startanimating(); this.add(ctlanimations); this works perfectly: when force animationviewcontroller onto navigation stack, displays , animates uiimage . but need show animationviewcontroller custom animated transition: var transition = catransition.createanimation (); transition.duration = 0.3f; transition.timingfunction = camediatimingfunction.fromname(camediatimingfunction.easeineaseout); transition.type = catransition.transitionfade; this.view.layer.addanimation (transition, "fade"); //viewcontroller beingness pushed animated=false, because have custom animation base.pushviewcontr...

php - Multi-byte strings and look-around weird bug -

php - Multi-byte strings and look-around weird bug - why next code behaves differently different multi-bye strings? echo preg_replace('@(?=\pl)@u', '*', 'Ù…'); // prints: '*Ù…' ✓ echo preg_replace('@(?=\pl)@u', '*', 'ض'); // prints: '*ض' ✓ echo preg_replace('@(?=\pl)@u', '*', 'غ'); // prints: '*�*�' ✗ echo preg_replace('@(?=\pl)@u', '*', 'ص'); // prints: '*�*�' ✗ see: http://3v4l.org/fvab1 you need include modifier letters ( lm ). see next script iterating on whole standard arabic unicode block: <?php function uchar_2($dec) { $utf = chr(192 + (($dec - ($dec % 64)) / 64)); $utf .= chr(128 + ($dec % 64)); homecoming $utf; } $issues = 0; $count = 0; ($dec = 1536; $dec <= 1791; $dec++) { $char = uchar_2($dec); if (preg_replace('@^(?=\plm)$@u', '*', $char) !== $char) { ...

javascript - Increment a var by one every 24 hours from a specific date -

javascript - Increment a var by one every 24 hours from a specific date - i've never used javascript before (or other programming language) sorry asking question because im sure it's simple. what want set date in javascript, increment 1 every 24 hours. 3 days after date set, 3 displayed in html (not date itself). , after 100 days, 100 displayed. thank you. you have create 2 date objects, 1 representing initial date, , 1 representing right now. then, calculate difference: // calculate days since dec 1st 2012 var initialdate = new date(2012, 11, 1); // attention: month zero-based var = date.now(); var difference = - initialdate; var millisecondsperday = 24 * 60 * 60 * 1000; var dayssince = math.floor(difference / millisecondsperday); alert(dayssince); // 80 http://jsfiddle.net/pmyfc/ javascript date increment

GWT & Eclipse: UiBinder - Field has no corresponding field in template file -

GWT & Eclipse: UiBinder - Field has no corresponding field in template file - with following: class="lang-java prettyprint-override"> public class promotiontablecomposite<t extends promotion> extends composite { @uifield(provided=true) protected celltable<t> displaytable; @uifield(provided=true) protected simplepager pager; and class="lang-xml prettyprint-override"> <!doctype ui:uibinder scheme "http://dl.google.com/gwt/dtd/xhtml.ent"> <ui:uibinder xmlns:ui="urn:ui:com.google.gwt.uibinder" xmlns:g="urn:import:com.google.gwt.user.client.ui" xmlns:c="urn:import:com.google.gwt.user.cellview.client"> <g:docklayoutpanel unit="em"> <!-- datagrid. --> <g:center> <c:celltable ui:field='displaytable'/> </g:center> <!-- pager. --> <g:south size="3"...

c - Selection Sort troubles with keeping pointers in correct spots post sort -

c - Selection Sort troubles with keeping pointers in correct spots post sort - i'm trying execute selection sort sort goals scored. have 3 categories; goals, assists, names. can correctly sort goals , maintain players goal's , assists in right spots after sort, when seek move names right spot after sort moves first letter of name. here's code. help! void sortplayersbygoals(int* goals, int* assists, char** names, int size) { int lh, rh, i, tempg, tempa, tempn; for(lh = 0; lh < size; lh++) { rh = lh; for(i = lh; < size; i++) { if(goals[i] > goals[rh]) { rh = i; } tempg = goals[lh]; tempa = assists[lh]; tempn = *names[lh]; goals[lh] = goals[rh]; *names[lh] = *names[rh]; assists[lh] = assists[rh]; goals[rh] = tempg; *names[rh] = ...

Processing the output of another XSLT Stylesheet -

Processing the output of another XSLT Stylesheet - i have xslt stylesheet produces output in xml. want processes output stylesheet. there way tell latter stylesheet "run , use" results former? there not, far know, standard way tell xslt processor run stylesheet on given input , output. in cases can process input against 1 set of templates , save result in variable, apply different set of templates value of variable, this: <xsl:template match="/"> <xsl:variable name="temp"> <xsl:apply-templates mode="first-pass"/> </xsl:variable> <xsl:apply-templates select="$temp" mode="second-pass"/> </xsl:template> this assumes you're running xslt 2.0. in xslt 1.0 need processor supports node-set extension (many do), , you'll need alter reference $temp exslt:nodeset($temp). as perceive, won't work if 2 stylesheets both utilize default mode , operate on overla...

c# - FileSystemWatcher used to watch for folder/file open -

c# - FileSystemWatcher used to watch for folder/file open - i have browsed around cannot find info on seeking, if there post goes on apologize. i seeking help code monitor specific folder when folder opened person or when file under said folder opened. @ point can see when user opens , modifies files if open file view it, not throw event when add together lastaccessed. info or help appreciated. folder name c:\junk code in c# 4.0: [permissionset(securityaction.demand, name = "fulltrust")] public static void run() { filesystemwatcher watcher = new filesystemwatcher(); watcher.path = @"c:\"; watcher.notifyfilter = notifyfilters.lastaccess | notifyfilters.lastwrite | notifyfilters.filename | notifyfilters.directoryname; watcher.filter = "junk"; // add together event handlers. watcher.changed += new filesystemeventhandler(onchanged); watcher.created += new filesy...

ios - iPhone SDK: Call tableview function anywhere -

ios - iPhone SDK: Call tableview function anywhere - i wanted know if there way phone call tableview function anywhere throughtout program. mean want phone call function: - (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath { anywhere in code. there anyway of using self function or or if possible @ all? thanks. you sure can. have able pass nsindexpath object it, this: uitableviewcell *cell = [self.tableview cellforrowatindexpath:indexpath]; once cellforrowatindexpath returns cell object, can access properties, etc. like: cell.backgroundview.alpha = 0.0; also, if using custom uitableviewcell, can custom cell returned type casting call: mycustomcellclass *cell = (mycustomcellclass *)[self.tableview cellforrowatindexpath:indexpath]; iphone ios xcode uitableview

excel vba - RunTime Error 53 : File Not Found -

excel vba - RunTime Error 53 : File Not Found - an error thrown line: set fileobj = ofs.getfile( ... ) the error runtime error 53 : file not found error when run macro in excel 2007 vba update .txt file based in sharepoint site. here total code: sub logreport(reportname string) 'call appendtxt("//myaviall/teamsites/aviallreportingsolutions/airplane_usage_log/airplane_act.txt", unamewindows & ";" & reportname & ";" & & ";" & versionnum) dim ofs, ts, fileobj 'get text stream set ofs = createobject("scripting.filesystemobject") set fileobj = ofs.getfile("//myaviall/teamsites/aviallreportingsolutions/airplane_usage_log/airplane_act.txt") set ts = fileobj.openastextstream(8, -2) 'forwriting, tristateusedefault) ' write file ts.writeline unamewindows & ";" & reportname & ";" & & ";" & versionnu...

Excel Macro is not closing CSV files when process is done -

Excel Macro is not closing CSV files when process is done - i running next script , seems not closing , files when script run . how can edit script can close script . sub loopfiles() dim myfilename string, mypath string application.screenupdating = false application.displayalerts = false mypath = "c:\macro\" myfilename = dir(mypath & "*.xlsx") chdir "c:\macro\csv" until myfilename = "" workbooks.open filename:=mypath & myfilename activeworkbook.saveas filename:=left(myfilename, instr(1, myfilename, ".xlsx") - 1), fileformat:=xlcsv, createbackup:=false myfilename = dir loop application.screenupdating = true application.displayalerts = true end sub add line: activeworkbook.close false in space have demonstrated below. do until myfilename = "" workbooks.open filename:=mypath & myfilename activeworkbook.saveas...

web applications - Creating consistent dimensions betwen Android Browser and Desktop? -

web applications - Creating consistent dimensions betwen Android Browser and Desktop? - i have web page works on regular computer, , handles resizing downwards / can re-size window size like, , app still useful. can zoom in ctrl+ if like, , app's layout automatically alter accommodate. now let's talk smartphone. use <meta name="viewport" content="width=device-width"/> unfortunately, android phone has double dpi of regular computer. simple solution me zoom in, have scroll time. i set in position:fixed;width:100% div , creates rather choppy experience, because scrolling still accessible. that brings me lastly solution me write own scaling code increment size of relevant content smartphone users. so, how should this? 1 way check user-agent, , utilize alter css. there 2 reasons don't that, 1. sniffing user-agent , 2. assuming ~200dpi, while between phones. if there way observe dpi, much prefer route. can this? have improve idea...

orm - ordered many-to-many association hibernate mapping -

orm - ordered many-to-many association hibernate mapping - i'm creating class diagram in visual paradigm "orm persistable" types "a" , "b", holds ordered list of b. i'm trying configure many-to-many association in class diagram, association navigable a->b , order of b instances in list given order added list @ runtime. when visual paradigm creates hibernate mapping files should result in association table "a2b" in erd fields "a_id", "b_id", "order_idx", , hibernate mapping type "a" defining list property "bs" list-index "order_idx" of association table, in: <class name="a" table="a"> <id name="id" column="id" /> <list name="bs" table="a2b"> <key column="a_id" /> <list-index column="order_idx" base="1" /> <many-to-many class="b...

android - Actual Image size for 7 inch tablets and mobiles -

android - Actual Image size for 7 inch tablets and mobiles - i have activity grid view 4 images. application focus on above android version 3 , both tablets , mobile. want know actual image size want design fit screens. example,what best image size 7 inch tablet? in developer document said, based on dip , need actual each image size fit on grid view(4 images) in 7 inch tablet. in case have create different layouts of mainlayout. illustration . 5.1 phones such galaxy note have create new folder name layout-large , 7.0 10.1 tablets have create new folder called layout-xlarge after creating these both folder paste main xml within them , , you'll see how layout @ 5.1 , tablets. best way came cross create images , layouts fits on screens. hope helps you. android android-image android-gridview

java - Calling Oracle stored procedure with DATE input doesn't set the HH:MM:SS -

java - Calling Oracle stored procedure with DATE input doesn't set the HH:MM:SS - i'm trying phone call oracle stored procedure in java ee web application (java) using spring 'callablestatementcreator'. 1 of inputs stored procedure date. my attributevalue java.util.date , correctly holds both dd-mm-yyyy , hh:mm:ss. when using next code: callablestmt.settime(6, new java.sql.time(attributevalue.gettime())); the result column in db (the stored procedure writes in db) set 1970-01-01 , right hh:mm:ss pass input. worked in previous version of application (where used jdbc lib 10.x.x.x) if use callablestmt.setdate(6, new java.sql.date(attributevalue.gettime())); the dd-mm-yyyy set correctly hr set 00:00:00. so, what's right way phone call , pass attribute stored procedure? also, debug tips? oracle database 11g enterprise edition release 11.2.0.2.0 - 64bit production oracle jdbd lib: ojdbc6-11.2.0.3 try using timestamp : callablestmt....

tokenize - How to build a tokenizer in PHP? -

tokenize - How to build a tokenizer in PHP? - i'm building site larn basic programming, i'm going utilize pseudolanguage in users can submit code , need interpret it. i'm not sure how build tokenizer in php. having snippet such one: a = 1 b = 2 c = - b if(a > b) { buy(a) } else { buy(b) } how go separating code tokens? -- this i'm trying now: $tokens = array(); // first token (define string) $token = strtok($botcode, '='); $tokens[] = $token; // loop while($token) { $token = strtok('='); $tokens[] = $token; } however haven't been able figure out how utilize strtok list of regular expresions... similar strtok accepts arrays needles substr , strrpos seems me should possible strtok it's designed this. info or pointing in right direction thanked do not wait magic strtok. similar preg_split. i think want build own lexer. utilize article writing simple lexer in php or something else. ...

javascript - d3.js: nested selection with two one dimensional arrays -

javascript - d3.js: nested selection with two one dimensional arrays - i want create table 2 1 dimensional arrays d3. let's assume input arrays are: array1 = ['a','b','c']; array2 = ['d','e','f']; i want table this ad ae af bd bf cd ce cf should utilize nested selection? or should utilize 1 phone call selectall().data() , followed phone call each() ? (in real life, operation each matrix cell won't simple 'a'+'d' , don't think should matter answer.) one approach create new 2d array 2 arrays create suitable standard nested selection pattern (see: http://bost.ocks.org/mike/nest/): var arr1 = ['a', 'b', 'c'], arr2 = ['d', 'e', 'f']; // prepare 2d array var info = arr1.map(function(v1) { homecoming arr2.map(function(v2) { homecoming v1 + v2; }) }); d3.select("body").append("table...

c# - AutocompleteBox validation -

c# - AutocompleteBox validation - i have autocomplete box in silverlight , bound collection. working fine. want user can't come in values not in collection. for example: collection contain value "head". if user enters headx or other that, validation should fired. how this? regards arun try this <sdk:autocompletebox grid.column="3" grid.row="3" height="18" width="150" istextcompletionenabled="true" tabindex="9" horizontalalignment="left" text="{binding elementname=resedit,path=datacontext.selecteddemotext,mode=twoway}" itemssource="{binding elementname=resedit,path=datacontext.demolist,mode=oneway}" itemtemplate="{staticresource demotemplate}" valuememberpath="democode" lostfocus="autocompletebox_lostfocus" margin="0,0,21,0" padding="0"> </sdk:autocompletebox> ...

html - php - plus one to xml node value -

html - php - plus one to xml node value - this question has reply here: a simple programme crud node , node values of xml file 3 answers i have xml file held on server below. have html file button when pressed must plus 1 (+1) 1 of xml node values. im not clued on php help great. need simple script stored on server take in html request , add together 1 chosen xml node value. <?xml version="1.0" encoding="utf-8"?> <object1> <value>10</value> </object1> <object2> <value>6</value> </object2> try this: $objectx = "2"; // value $_post or $_get ... $xmlfilename = 'my.xml'; // you're xml file $xmlfile = file_get_contents($xmlfilename); // saving xml contents in variable $objects = new simplexmlelement($xmlfile); $objectx = "object".$objectx; /...

.net - Group by on List Items on millions -

.net - Group by on List Items on millions - im writing query azure table storage pull info of 40 millions record, receive info @ client end when convert tolist(), throws out of memory exception. can 1 tell me how load 40 millions of info memory, have store 40 millions record , perform grouping operation on 40 1000000 records, please suggest proper way handle out of memory exception . .net

sql server 2008 - Is this is the best way to write SQL for this report? -

sql server 2008 - Is this is the best way to write SQL for this report? - we have orders info , need generate weekly - custom date range of 7 days report using sql . study display weekly count of orders. user select end date , need create 12 daterange units based on date. illustration user selects 1/24/2013 need 12 points/units as: point12 = end date - 7 days point11 = end date - 14 days point10 = end date - 21 days point9 = end date - 28 days . . point1 = end date - x days our solution: we planning create temporary table table have 12 rows. each row have info (we calculate startdate , enddate each point): point startdate enddate totalorders point12 2013-01-24 2013-01-30 point11 2013-01-17 2013-01-23 after count of orders each row. is solution problem or can optimized? edit: the weekly daterange custom date range of 7 days . given sqlserver, suggest using table variable, rather temporary table. a...

rdf - Restrict SPARQL query to a certain kind of Class -

rdf - Restrict SPARQL query to a certain kind of Class - i have sparql query select resources has location "california" within dbpedia database: select distinct ?subj { ?subj dbpprop:location dbpedia:california . } limit 100 now problem filter results, ?subj sub-class of class, e.g. dbpedia:public_company . i tried sth. this: select distinct ?subj { ?subj dbpedia:public_company . ?subj dbpprop:location dbpedia:california . } limit 100 but results in empty result set. how can restrict ?subj type of class? your query right way restrict instances of class. if empty result set, means there no instances found. briefly looked around in dbpedia , didn't encounter instances of dbpedia:public_company . perchance have typo in class name. rdf sparql owl rdfs

Excel 2013 Pivot table won't change current page until navigated to manually -

Excel 2013 Pivot table won't change current page until navigated to manually - we have little piece of vba code worked ages. essentially: me.pivottables("apivot").pivotfields("afield").currentpage = "some text" this worked until excel 2013, line fail unspecific error: runtime error 5: invalid procedure phone call or argument. by trial , error figured in excel 2013 cannot navigate pivot table page code until user has navigated page manually using excel interface. user navigates page, navigating page code succeed (until close workbook). in order code able navigate page, first need user go through of them manually. a workaround changing value of underlying cell instead: me.pivottables("apivot").pivotfields("afield").currentpage.labelrange.value = "some text" we forced utilize workaround, feels hackish. exactly in excel 2013 causes behaviour? there bit 1 needs first in order navigate page (poke...

How to deal with PHP + MySQL timezones and MySQL GROUP BY [date] queries? -

How to deal with PHP + MySQL timezones and MySQL GROUP BY [date] queries? - i'm working drupal 7, php, , mysql, , trying head around timezone issues when querying mysql database. drupal handles dates pretty out of gate: dates stored utc timestamp int's in db, , timezone conversion happens on per-user basis via timezone setting in each user profile, using php 5's built-in timezone capabilities (so each time php script run script's timezone set current user's timezone). so fine , dandy , painless long stick php. things start tricky when bring in mysql, since there doesn't appear way synchronize current php script timezone given mysql query. seems best practice dictates handling timezone conversion in php: ever querying database raw timestamps, , converting in php necessary. this seems reasonable in cases (even if bit slower @ times), but supposed mysql grouping [date] queries? instance, i'm building module handle analytics, , want things like: ...

iphone - Why am I getting this Parse Issue in X Code? -

iphone - Why am I getting this Parse Issue in X Code? - i'm learning objective-c , app development, i'm using canned framework (buzztouch) develop simple apps. currently, i'm getting parse issue: 'thetitle' used name of name of previous parameter rather part of selector here's line of code: -(void)showalert:(nsstring *)thetitle:(nsstring *)themessage:(int)alerttag; what doing wrong , how can avoid in future? sorry if easy question, i'm trying larn how of works. compare two: your code: -(void)showalert:(nsstring *)thetitle:(nsstring *)themessage:(int)alerttag; now, @ this: -(void)showalert:(nsstring *)thetitle themessage:(nsstring *)themessage alerttag:(int)alerttag; the problem in way have declared method: here detailed info on declaring methods: mac developer library. take @ section titled methods , messaging. iphone objective-c

java - Large Database display on listview -

java - Large Database display on listview - i have listview displays 500+ words , meaning. problem when load listview takes lot of time.. want add together listener such onscrolllistener when user load listview load 100 words when user scroll downwards add together more words.. used simplecursoradapter code this: inside oncreate() method: dbhelper = new worddbadapter(this); dbhelper.open(); //clean info dbhelper.deleteallwords(); //add info dbhelper.insertsomewords(); //generate listview sqlite database displaylistview(); outside oncreate() method: @suppresswarnings("deprecation") private void displaylistview() { cursor cursor = dbhelper.fetchallwords(); // desired columns bound string[] columns = new string[] { worddbadapter.key_word, worddbadapter.key_rowid, }; // xml defined views info bound int[] = new int[] { r.id.word, r.id.imgstar, }; // create adapter using...

c++ - How to concatenate strings in a header? -

c++ - How to concatenate strings in a header? - i want define bunch of constants in dedicated header file. since prefixes occur quite frequently, want define them 1 time , add together them whenever it's needed. my question is: how can concatenate prefix string without space? example: #define prefix "pre_" #define keyword "keyword" #define both prefix+keyword desired result both: pre_keyword obviously + in both prefix+keyword will not work. how can these tokens concatenated? just #define both prefix keyword would it. adjacent literals automatically concatenated, so "pre_" "keyword" would become "pre_keyword" c++ header

MYSQL insert after sub query with count -

MYSQL insert after sub query with count - i'm trying insert info table when subquery count > 0. this have far. insert users_friends (userid, friendid) values (77, 100) (select count(id) users email = 'a@g.com') > 0 both queries work independently fyi. this should simple prepare hopefully. cheers sqlfiddle demo if there records 'a@g.com' sqlfiddle demo if there not records 'a@g.com' insert users_friends (userid, friendid) select 77, 100 users email = 'a@g.com' limit 1; another way be: insert users_friends (userid, friendid) select 77, 100 dual exists ( select * users email = 'a@g.com' ) ; mysql insert subquery nested-queries

java - Confuguring log4j for multiple projects in the same app. server -

java - Confuguring log4j for multiple projects in the same app. server - we have bunch of projects deployed in same jboss app. server. each project has own log4j.properties in web-inf directory. the thought each project have own logfile writes logs. any ideas on how can achieved. first of don't mention jboss version you're using. you've take in mind jboss versions prior as7 include own log4j version (libraries , configuration file: conf/jboss-log4j.xml), default jboss ignore log4j.properties file you've in each of projects. that said, have 2 approaches configure log file each application: centralized way: configure in jboss, through conf/jboss-log4j.xml. way won't need modify applications, or modify applications take own log4j libraries (you'll have include them in ear/war), not jboss ones. for first approach you'll have define appender each of applications, , categories application packages, in conf/jboss-log4j.xml file. example, con...

Is there a fix for asp.net validation client javascript expando attributes JavaScript errors -

Is there a fix for asp.net validation client javascript expando attributes JavaScript errors - ie8, in ie8 mode , ie8 standards, moaning next ternary statement var ctl00_contentplaceholderbody_qvalidator_combobox_12335_1_1_-1 = document.all ? document.all["ctl00_contentplaceholderbody_qvalidator_combobox_12335_1_1_-1"] : document.getelementbyid("ctl00_contentplaceholderbody_qvalidator_combobox_12335_1_1_-1"); ie9 doesn't these variables , associated expando attributes rendered via asp.net client side validation api , have no command on them. ideas? edit: to include block believed expando attributes cause of problem... var ctl00_contentplaceholderbody_qvalidator_textbox_12718_1_1-1 = document.all ? document.all["ctl00_contentplaceholderbody_qvalidator_textbox_12718_1_1-1"] : document.getelementbyid("ctl00_contentplaceholderbody_qvalidator_textbox_12718_1_1-1"); ctl00_contentplaceholderbody_qvalidator_t...

c# - asp:hyperlink not rendering correct HTML on server -

c# - asp:hyperlink not rendering correct HTML on server - i'm working on project in asp.net webforms on .net 2.0 , running problem can't seem find cause for. have next code in aspx file: <table> <tr> <td> <asp:hyperlink id="supportlink" runat="server">customer back upwards docket</asp:hyperlink> </td> </tr> <tr> <td> <asp:hyperlink id="entitlementslink" runat="server">edit entitlements</asp:hyperlink> </td> </tr> </table> and when run locally in debug mode, works great. links appear , html rendered such: local rendered html <table> <tr> <td> <a id="ctl00_contentmain_supportlink" href="viewcustomer.aspx?customerid=659...

javascript - How to display binary data as image - extjs 4 -

javascript - How to display binary data as image - extjs 4 - here binary valid .jpeg image. http://pastebin.ca/raw/2314500 i have tried utilize python save binary info image. how can convert info viewable .jpeg image extjs 4? i tried this, doesn't work. data:image/jpeg;base64,+ binary info need convert in base64. js have btoa() function it. for example: var img = document.createelement('img'); img.src = 'data:image/jpeg;base64,' + btoa('your-binary-data'); document.body.appendchild(img); but think binary info in pastebin invalid - jpeg info must ended on 'ffd9'. update: need write simple hex base64 converter: function hextobase64(str) { homecoming btoa(string.fromcharcode.apply(null, str.replace(/\r|\n/g, "").replace(/([\da-fa-f]{2}) ?/g, "0x$1 ").replace(/ +$/, "").split(" "))); } and utilize it: img.src = 'data:image/jpeg;base64,' + hextob...

algorithm - Transforming a logical condition with AND and OR -

algorithm - Transforming a logical condition with AND and OR - i have complex condition, ands , ors, illustration : (c1 or c2) , (c3 or c4 or c5) this equivalent : (c1 , c3) or (c1 , c4) or (c1 , c5) or (c2 , c3) or (c2 , c4) or (c2 , c5) this status can exploded in list of conditions contains , : c1 , c3 c1 , c4 c1 , c5 c2 , c3 c2 , c4 c2 , c5 is transformation possible ? , algorithm ? conditions stored in memory trees, eg : or / \ , c1 / ! \ c2 c3 c4 i think should seek "move" or upwards tree, using distributivity : (a or b) , c = (a , c) or (b , c) . is approach ? take @ disjunctive normal form (or conjunctive one). both uses not and , or not too. note: if restricted or s , and s (and cannot utilize other boolean function), can't express boolean function because of post's functional completeness theorem ( and , or both truth-preserving , don't form basis). hence maybe there formula, can't transforme...

javascript - What does / in the regular expression mean? -

javascript - What does / in the regular expression mean? - i came across legacy code trying exact matches against strings using javascript regex. i trying understand why using / before , after match string. example var match = thinger.match(/stringtomatch/); what character do? /regex here/ means of declaring regular look in javascript. the / character delimiter regular look declaration much single or double quote delimiter string declaration. see mdn regular look reference page written description. regex can declared either of these 2 ways in javascript: var re = /match string here/i; var re = new regexp("match string here", "i"); the advantages of using /regex here/ method are: you can freely utilize quotes in match without having escape them, though have escape / in reg when using method it's less typing , more compact the advantages of using new regexp("regex here") method are: you can utilize jav...

sql server - Comparing Quarterly Sales from Q4 to Q1 -

sql server - Comparing Quarterly Sales from Q4 to Q1 - say have table named sales looks this: year quarter sales 2012 4 5000 2013 1 6111 2013 2 7222 and i'm trying compare sales increment quarter quarter, want end this: q1 q2 sales difference 4 1 1111 1 2 1111 i'm having problem coming way compare q4 of previous year q1 of next year. i've set sqlfiddle similar table here, along solution works quarters within same year. how about: select a.year, a.quarter q1, isnull(b.quarter, c.quarter) q2, isnull(b.sales, c.sales) - a.sales [sales increase] sales left bring together sales b on a.quarter = b.quarter - 1 , a.year = b.year left bring together sales c on a.quarter = 4 , c.quarter = 1 , a.year = c.year - 1 sql fiddle (though changing 2014 q5 q1...) sql-server sql-server-2008

Why does Rails want to return "head :no_content" for JSON PUT requests? -

Why does Rails want to return "head :no_content" for JSON PUT requests? - after run rails generate scaffold user generated controller function in rails 3.2.11 updating user looks this: def update @user = user.find(params[:id]) respond_to |format| if @user.update_attributes(params[:user]) format.html { redirect_to @user, notice: 'user updated.' } format.json { head :no_content } else format.html { render action: "edit" } format.json { render json: @user.errors, status: :unprocessable_entity } end end end the line i'm curious returning head :no_content successful json update request. i've done googling, guessing sort of restful property, not homecoming updated object, couldn't find claimed case. why default, versus returning json representation of user object post-update? good question, apparently purpose homecoming http status code 200 empty body, see this discussion. maybe brevit...

adding an attribute to xml tags before exporting the file from excel 2010 to use with mantis -

adding an attribute to xml tags before exporting the file from excel 2010 to use with mantis - i'm using mantis , need import bugs written on excel spreadsheet mantis,so created schema(file.xsd) , mapped info schema , exported bugs xml file compatible mantis.the problem need add together attribute(id) tags in produced xml file, there way step (e.g add together column in excel instance) during file preparation, mean before exporting file? here illustration of info exported , info want like: the exported data: <?xml version="1.0" encoding="utf-8"?> <mantis version="1.2.12" urlbase="http:xxx/mantis/" issuelink="#" notelink="~" format="1"> <issue> <id>29</id> <project>project 1</project> <reporter>engy</reporter> <priority>urgent</priority> <severity>block</severity> <reproducibility>alw...

Selenium does not replay my test -

Selenium does not replay my test - i have simple selenium test created using seleniumide. open google.co.uk , search "one", click link finds, go home page, search "two" click link. records fine when replay it stops @ 2nd command next in red [error]element css=b not found here script xml recorded it. <?xml version="1.0" encoding="utf-8"?> <!doctype html public "-//w3c//dtd xhtml 1.0 strict//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head profile="http://selenium-ide.openqa.org/profiles/test-case"> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <link rel="selenium.base" href="https://www.google.co.uk/" /> <title>new test</title> </head> <body> ...

sql server - SQL Import With Identity Trouble -

sql server - SQL Import With Identity Trouble - i have database created using sql export tool, see didn't write out primary keys , constraints. unfortunately, it's re-create have data. i've created blank database construction proper keys in place , trying import info new database using import info wizard in sql 2012. in mappings settings, i've selected enable identity insert. but, maintain running error after error. i tried utilize sql compare tool in visual studio 2012, thinking generate alter table scripts create primary keys , constraints on database holding data, can seem generate create table scripts. obviously, doing drop table , data. ultimately, want database keys , constraints , info together. i've exhausted knowledge , not quite sure how proceed @ point. i'm hoping of guru's have tricks sleeve help me out. help sincerely appreciated in advance. the "enable insert identity" works me. perhaps next time impor...

javascript - NodeJS HTTPS request to Intersango.com -

javascript - NodeJS HTTPS request to Intersango.com - there wrong request i'm making , can't figure out. seems in order according api spec. here code: var request = require('https').request; var opts = { host: 'intersango.com', method: 'get', path: '/api/ticker.php', port: 443, accept: '*/*', headers: { 'user-agent': 'mozilla/5.0 (x11; linux i686; rv:10.0) gecko/20100101 firefox/10.0' } }; var req = request(opts, function (result) { result.setencoding('utf8'); var buffer = ''; result.on('data', function(data) { buffer += data; }); result.on('end', function() { console.log('<- received ' + buffer.length + ' bytes'); var info = json.parse(buffer); console.log(data); }); }); req.on('error', function(e) { console.log('warning: probl...

Windows authentication from a Java Spring application -

Windows authentication from a Java Spring application - i'm deploying java application built spring on windows network. network uses active directory users login desktops active directory user names. now, i'm trying add together feature when user opens browser access application (which deployed on same network) application automagically picks username , authenticates them. during research came across blog post: http://blog.springsource.org/2009/09/28/spring-security-kerberos/ however, think approach might not required in scenario since i'm deploying application same windows network. question what ways access user token web app can authenticate users? we utilize ntlmhttpfilter. you configure filter in web.xml, tell domain controllers live, , pretty much works. net explorer provide credentials without taking action, firefox (and suppose chrome) prompt login. java authentication spring-mvc active-directory spring-security

Increment individual IPs from IPv6 string (php) -

Increment individual IPs from IPv6 string (php) - what simple, elegant way list first x number of ipv6 ips ipv6 string. for example, listips("2600:f333:10:c000::0", 4) echos 2600:f333:10:c000::1 2600:f333:10:c000::2 2600:f333:10:c000::3 2600:f333:10:c000::4 here's sample of code may have worked ipv4, converted int: $input = "2600:f333:10:c000::/51"; $max = 4; list($block, $cidr) = explode("/", $input); $first = inet_pton( $block ); echo inet_ntop($first) . "\n"; ($i = 1; $i < $max; $i++) { //todo: die if has exceeded block size based on $cidr echo inet_ntop($first + $i) . "\n"; //doesn't work, packed binary? } here's illustration programme written in c (since don't know c++). it's fast, i'm not happy it. maybe can help me improve it. edit: obviously, wrote before turned php-only question. turning php left exercise reader (ew). class="lang-c prettyprint-override...

css - Why do the Preboot mixins no longer compile after Less 1.3.1? -

css - Why do the Preboot mixins no longer compile after Less 1.3.1? - i using codekit compile less files , ever since jumped less 1.3.1 (back around oct '12) no longer compile past preboot (http://www.markdotto.com/bootstrap) mixins. it doesn't preboot maintained anymore , github link goes 404. does in mixin code jump out beingness issue whatever alter less did? is similiar preboot maybe more actively maintained? css less

c++ - Contradictory behavior in C to C# array marshalling -

c++ - Contradictory behavior in C to C# array marshalling - i have 2 illustration same code. can retrieve info of 1 c# , failed have right info other. here are: works good c++ part: __declspec(dllexport) void** enumeratedevices(int *disize){ array<deviceinfo> diarray; framewoek::enumeratedevices(&diarray); *disize = diarray.getsize(); deviceinfo dp[255]; (int = 0; < diarray.getsize(); i++) dp[i] = diarray[i]; void* p = dp; homecoming &p; } c# part: [dllimport("wrapper.dll")] static extern intptr enumeratedevices(out int devicessize); public static deviceinfo[] enumeratedevices() { int devicessize; intptr arraypointer = enumeratedevices(out devicessize); intptr[] array = new intptr[devicessize]; marshal.copy(arraypointer, array, 0, devicessize); deviceinfo[] arrayobjects = new deviceinfo[devicessize]; (int = 0; < devicessize; i++) ...