Posts

Showing posts from 2010

Determining which vertex of a triangle one is computing in openGL ES vertex shader -

i'm writing webgl program draws bunch of triangles screen. i'm using indirect addressing, this: gl.drawelements(gl.triangles, list.length, gl.unsigned_short, 0); is there way vertex shader know vertex of triangle processing? (among 3 vertices in order given list, i.e., first, second or last) you can use additional integer attribute in stride alongside vertex coordinates, texture coordinates, normal, etc. check id of vertex.

How to save array of struct with vector in binary C++ -

i need save array of struct in binary file. there problem! have 3d array of vector in struct! struct : struct state { vector<bool> ***value; vector<int> ***rfcclb2bits; state() { new3darray(value , 60 , 100 , 2); new3darray(rfcclb2bits , 60 , 100 , 2); } }; and may want see new3darray function : template <class t> void new3darray(t ***&u3d, int nx , int ny , int nz) { u3d = new t ** [nx]; if (null == u3d) { cout <<"erro3"<<endl; } else { (int = 0; < nx; i++) { u3d[i] = new t *[ny]; if (null == u3d[i]) { cout <<"erro4"<<endl; } else { (int j = 0; j < ny; j++) { u3d[i][j] = new t [nz]; if (null == u3d[i][j]) { cout <<"...

Logic behind word-boundary difference between BSD grep and GNU grep -

can please explain/help me understand logic behind difference between bsd grep , gnu grep? i've added carets below matches. $ grep --version grep (bsd grep) 2.5.1-freebsd $ cat t1 admin:*:80:root $ grep '\<.' t1 admin:*:80:root ^^^^^ ^^ ^^^^ versus $ grep --version gnu grep 2.6.3 copyright (c) 2009 free software foundation, inc. license gplv3+: gnu gpl version 3 or later <http://gnu.org/licenses/gpl.html> free software: free change , redistribute it. there no warranty, extent permitted law. $ cat t1 admin:*:80:root $ grep '\<.' t1 admin:*:80:root ^ ^ ^ it seems gnu grep getting right , bsd grep isn't. thought \< supposed word boundary? note grep '\<ad' t1 seems same result in both versions, e.g.: $ cat t2 admin:*:80:root sadmin:*:81:root $ grep '\<ad' t2 admin:*:80:root ^^ what gives? thanks in advance. richard using \> specify word boundary wouldn't work bsd grep . try ...

javascript - Backbone.marionette: jQuery document.ready not running on route -

so have web application routes login button dashboard run initialize() function, contains document.ready() block. problem is, on backbone route seems document.ready() block isn't being run. here code clearify: here's event landing page view: events: 'click .pure-menu .signin': () -> application.router.navigate('dash', {trigger: true}) that routes application dashboard view: module.exports = class dashview extends backbone.marionette.itemview id: 'dash-view' template: template initialize: -> $ -> $(".gridster ul").gridster( widget_margins: [10, 10] widget_base_dimensions: [140, 140] ) where have jquery document.ready() block code run once dom loaded. i'm using gridster library, when page routes code not run, because gridster grids don't initialized. when refresh page every thing works expected. my guess when...

Can regression and IDW spatial interpolation be done in one model in R? -

i spatial modelling of variable t (temperature). use commonly used in literature - perform regression (using variables altitude etc.) , spatially interpolate residuals using idw. r package gstat seems have option: interpolated <- idw(t ~ altitude, stations, grid, idp=6) spplot(interpolated["var1.pred"]) but in documentation of idw() write: function idw performs [...] . don't use predictors in formula. and actually, result looks if regression performed, without spatial interpolation of residuals. know can manually: m1 <- lm(t ~ altitude, data = data.frame(stations)) tres <- resid(m1) res.int <- idw(tres ~ 1, stations, grid, idp=6) tpred <- predict.lm(m1, grid) spplot(spatialgriddataframe(grid, data.frame(t = tpred + data.frame(res.int)['var1.pred']))) but have many drawbacks - model not in 1 object, cannot directly summary, check deviance, residuals , importantly, crossvalidation... have done manually. so, is there way how regr...

Recommended direct solver for sparse positive definite linear system in scipy? -

i'm sorry if explained in scipy.sparse documentation. when using scipy, function recommend using solve sparse positive definite linear system of equations? want use direct method, , want columns reordered preserve sparsity as possible in cholesky factorization of coefficient matrix. ideally i'd able experiment various options reordering. does direct solver sparse positive definite systems exist in scipy.sparse? scikit.sparse way go? scipy.sparse.linalg.spsolve clear enough, seems speed must pip install scikit-umfpack or else build umfpack , amd suitesparse then rebuild scipy source, [umfpack] umfpack_libs = ... in site.cfg . otherwise scipy.sparse.linalg defaults slower superlu. is scikit.sparse way go? compared what, criteria ? if c / c++ enough you, use suitesparse directly. tool depends on you're comfortable with, , on users: one, two, many. maybe better visualization project more faster spsolve. some pretty obvious pluses , m...

c# - use many application bars in a pivot control -

i'm trying create pivot control, , eatch item of pivot control want assosiate different applicationbar. tried follow this walkthrough in msdn, seems there error in code: private void pivot_selectionchanged(object sender, selectionchangedeventargs e) { switch (((pivot)sender).selectedindex) { case 0: applicationbar = ((applicationbar)application.current.resources["countingappbar"]); break; case 1: applicationbar = ((applicationbar)application.current.resources["savingappbar"]); break; } } the error applicationbar class , it's used variable, tried create instance before switch statement, here did: private void pivot_selectionchanged(object sender, selectionchangedeventargs e) { applicationbar appbar; switch (((pivot)sender).selectedindex) { case 0: appbar = ((applicationbar...

if statement - In R using if else loop how to extract even and odd nubers -

i have data of 500 ids stored in uid column ;i want extract ids , odd ids separately , store in 2 different data respectively. how in r using if-else loop ? you don't if-else loop. use subsetting, expression based on whether id odd or even. odd <- df[df$uid %% 2 == 1, ] <- df[df$uid %% 2 == 0, ]

c++ - How to give admin rights to another account for specific application -

i created driver setup using install shield.when install , communicate administrator, working fine. but on customer site having limited access on system, driver not communicating expected. know how can provide admin privilege particular driver on account. because give admin rights applications limited account not suitable way. so please guide me in appropriate way. the proper way include manifest installer requests elevation. specifically, set requestedexecutionlevel requireadministrator (rather default, asinvoker ): <requestedexecutionlevel level="requireadministrator" uiaccess="false" /> this way, whenever user running without elevated privileges launches installer, windows knows installer requires administrative privileges , automatically asks user valid credentials. if user can provide them, installer launched administrative privileges, leaving other applications unaffected. if user cannot, installer fail launch (which fine, sinc...

git - How do I manage users on Bitbucket -

Image
i have been reading bitbucket documentation , still confused how manage users on repo. i want give developers ability pull , push branches not others, i.e. can pull , push developer-master branch, final merges live master branch admin can do. in addition this, love require own individual passwords, not password gives them access entire repository. right push requires 1 password entire repository, gives them admin access entire bitbucket repository. i did read documentation still unclear on how effectively. help! :) go settings of repo , choose 'branch management'. here can give write access specific branches users or groups want. of rest branches have write access of users , groups (who have write access in general). take example of repo named bqotd. i have 4 branches in repo: htmls, design, docs , master. wanted limit write access of our front-end developer htmls branch had this: i had give write access everyday except fed of branches other htm...

c# - TweetSharp Windows Phone NotFound -

i trying extend app include twitter user timeline functionality. using twitter api v1 , fetched user timeline properly. since api 1.1 deprecated, have been using tweetsharp. however code runs on windows phone 7 , 8 emulators, windows phone 8 device fails on windows phone 7.1 lumia 710 device notfound exception. the following code:- twitterservice service = new twitterservice(_consumerkey, _consumersecret); service.authenticatewith(_accesstoken, _accesstokensecret); listtweetsonusertimelineoptions listtweetsonusertimelineoptions = new listtweetsonusertimelineoptions(); listtweetsonusertimelineoptions.screenname = "twitter"; service.listtweetsonusertimeline(listtweetsonusertimelineoptions, (statuses, response) => { if (response.statuscode == httpstatuscode.ok)// getting status code notfound { foreach (var status in statuses) { twitterstatus tweet = status; //dispatcher.begininvoke(() => tweets.items.add(tweet)...

c# - Office add-in for word, excel and outlook -

i've created word 2010 add-in vs 2012 word add-in template , ribbon designer component. it possible use plugin in other office products, excel or outlook if add other interop dlls? how can differ office product (word, excel or outlook) used run differnt code segments in add-in? or must create each own plugin own ribbon!? please give me hints. regards if link statically office interop assemblies, need build different version each office version plan support. better alternative recommend investigate use netoffice, provides office api in version-independent form: http://netoffice.codeplex.com/

Android app stops after start on Amazon Kindle Fire HD -

i've got android app runs on various devices, not amazon kindle fire hd. stops after start , see in logs following: 08:42:16.940 201 #201 warn activitymanager unable start service intent { act=com.amazon.client.metrics.bind }: not found 08:42:17.104 201 #201 warn activitymanager force finishing activity com.example/.myactivity anybody knows , if 2 warnings related? i guess correct answer how solve issue: http://developer.android.com/reference/android/app/keyguardmanager.keyguardlock.html

c# - Detect the word after a regex -

Image
i have long text , part of text is hello , john how (1)are (are/is) you? i used detect (1) . string optionpattern = "[\\(]+[0-9]+[\\)]"; regex reg = new regex(optionpattern); but got stuck here @ continue on how detect after (1) find are . full code ( falsetru bringing me far) : string optionpattern = @"(?<=\(\d+\))\w+"; regex reg = new regex(optionpattern); string[] passage = reg.split(lstquestion.questioncontent); foreach (string s in passage) { textblock tblock = new textblock(); tblock.fontsize = 19; tblock.text = s; tblock.textwrapping = textwrapping.wrapwithoverflow; wrappanel1.children.add(tblock); } i assume if split this, remove words after (0-9), when run it removes word after () in last detection. as can see word after (7) gone rest not. how detect are after (1) ? possible replace word after (1) textbox too? use positive lookbehind lookup ( (?<=\(\d+\))\w+ ): string text = "hello ...

android - Get current location as TEXT with Google Maps API v2 -

i retrieving current location in app need text of location, or city in @ least, that. is there known way can this? this have far: package ro.gebs.captoom.activities; import android.app.activity; import android.location.criteria; import android.location.location; import android.location.locationmanager; import android.os.bundle; import android.view.window; import com.example.captoom.r; import com.google.android.gms.maps.cameraupdatefactory; import com.google.android.gms.maps.googlemap; import com.google.android.gms.maps.mapfragment; import com.google.android.gms.maps.model.latlng; import com.google.android.gms.maps.model.marker; import com.google.android.gms.maps.model.markeroptions; public class locationactivity extends activity { private googlemap map; @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); getwindow().requestfeature(window.feature_action_bar); getactionbar().hide(); set...

c# - How to hide a specific value(column) from the gridview? -

in gridview have following things shown in binding of sql gridview in page_load want load upon opening page. sqlconnection conn = new sqlconnection(); conn.connectionstring = "data source = localhost; initial catalog = majorproject; integrated security= sspi"; conn.open(); dataset ds = new dataset(); sqldataadapter da = new sqldataadapter("select memberreportid, typeofcrime, crdatetime, address, detail, incidentdate, incidenttime, property, victim, suspect memberreport", conn); da.fill(ds); gwcase.datasource = ds; gwcase.databind(); conn.close(); however, i'm trying prevent property, victim , suspect column appearing in gridview. used visible = false; in gridview totally remove gridview( of course ). i tried using boundfield shown below in gridview , set visibility false set column visiblity false <asp:gridview id="gwcase" runat="server" backcolor=...

python - Django datetime primary key doesn't constrain unique -

so, here's model: class mymodel(models.model): timestamp = models.datetimefield(primary_key=true) fielda = models.textfield() when call syncdb , django doesn't add constraint postgresql timestamp unique, though gives primary key constraint. if change timestamp just unique=true , django creates unique constraint. however, if combine unique=true , primary_key=true , django doesn't create unique constraint. my info: django-south v1.8 django 1.4 python 2.7 postgresql 9.1 edit: if save model same exact timestamp twice in 2 different runs (not same process), doesn't raise , integrityerror should. when creates unique constraint , no primary key, same code. edit 2: this code runs when have constraint "mymodel_pkey" primary key ("timestamp") in postgresql having timestamp = models.datetimefield(primary_key=true) timestamp = datetime.datetime(2013, 7, 31, 0, 0, 0).replace(tzinfo=utc) print timestamp # prints 2013-07-...

javascript - Where do I change the date in this countdown function? -

i downloaded countdown script (javascript) can't figure out how change date timer countdown to. original script: $(function(){ var = new date(); // comment out line below , change date of countdown here var in30days = new date( now.gettime() + (30 * 24 * 60 * 60 * 1000) ); // year countdown var countdownyear = in30days.getfullyear(); // month countdown 0 = jan, 1 = feb, etc var countdownmonth = in30days.getmonth(); // day countdown var countdownday = in30days.getdate(); var countdowndate = new date( countdownyear, countdownmonth, countdownday ); setupcountdowntimer( countdowndate ); spaceparallax(); hideiphonebar(); $("[placeholder]").toggleplaceholder(); setupsignupform(); }); maybe countdowndate... default built + 30 days? may change this. important part : setupcountdowntimer( countdowndate ); spaceparallax(); hideiphonebar(); $("[placeholder]").toggleplaceholder(); setupsignupform(); });

jquery - Javascript function written in script tag call from Js file -

i in trouble. have cshtml file in script tag have function call setformsvalue <script> function setformvalues(selecteditem) { $('#murworksheetid').val(selecteditem.murworksheetid); $('#patientid').val(selecteditem.patientid); $('#txtmurdate').val(selecteditem.murdate2); $('#txtpatientname').val(selecteditem["objpatientmodel.title"]); } </script> i calling method js file have imported in cshtml file. var selecteditem = entitygrid.dataitem(row); setformvalues(selecteditem); its giving error setformvalues not defined.

delphi - How to fix EStackOverflow in VirtualTreeView? -

Image
sometimes got estackoverflow exception in project. use delphi 2010 , latest version of virtualtreeview. report generated eurekalog contains infinite loop this: (this part of "call stack" section of bugreport) setnodeheight measureitemheight getnodeheight getdisplayrect invalidatetobottom setnodeheight measureitemheight getnodeheight getdisplayrect invalidatetobottom setnodeheight measureitemheight getnodeheight getdisplayrect all lines in virtualtrees.pas, internal module of virtualtreeview the event handlers attached control are: treechange treecollapsing treefocuschanging treefreenode treegethint treemeasureitem procedure ttrainingform.treemeasureitem(sender: tbasevirtualtree; targetcanvas: tcanvas; node: pvirtualnode; var nodeheight: integer); begin inherited; if sender.multiline[node] begin try targetcan...

What is the most efficient way in three.js to update a face color independently across many meshes that all share the same geometry? -

in three.js project (viewable here ) have 500 cubes, of same size , statically positioned. on each of these cubes, 5 of faces remain same color; however, color of sixth face can dynamically updated, , modification occurs across many of cubes in single frame , occurs across frames. i've been able implement scene several different ways, have not been satisfied performance of i've tried. know must not have hit upon right technique yet or maybe i'm not implementing 1 quite right. performance standpoint, best way change color of these cube faces while maintaining independence across each of cubes? here have tried far: create 500 individual cubegeometry , mesh instances. change color of geometry face described in answer here: change colors of cube's faces . far method has performed best me, 500 identical geometries seems less ideal, because i'm not able achieve regular 60fps gpu. rendering takes 11-20ms here. create 1 cubegeometry , use across 500 mesh instanc...

jQuery UI sortable not working in iPAD -

i using jquery ui sortable functionality. works fine in browsers. in touch device such ipad is not working. below code using <script src="http://code.jquery.com/jquery-1.9.1.js"></script> <script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script> <script src="js/jquery.ui.touch-punch.js"></script> <script> $(function() { $( ".documents" ).sortable(); $( ".documents" ).disableselection(); }); my html is: <div id="bodycontainer"> <ul class="documents"> <li>1</li> <li>2</li> <li>3</li> </ul> </div> please let me know solution asap. thank in advance. ok, obvious, because jquery ui library not include touch events. if develop jquery powered web site, using jquery ui functionalists of wont work in touch enable mob...

python - Is there a way to return same length arrays in numpy.hist? -

i'm trying create histogram plot in python, normalizing custom values y-axis values. this, thinking this: import numpy np import matplotlib.pyplot plt data = np.loadtxt('foo.bar') fig = plt.figure() ax = fig.add_subplot(111) hist=np.histogram(data, bins=(1.0, 1.5 ,2.0,2.5,3.0)) x=[hist[0]*5,hist[1]] ax.plot(x[0], x[1], 'o') but of course, last line gives: valueerror: x , y must have same first dimension is there way force np.hist give same number of elements x[0] , x[1] arrays, example deleting first or last element 1 of them? hist[1] contains limits in have made histogram. guess want centers of intervals, like: x = [hist[0], 0.5*(hist[1][1:]+hist[1][:-1])] and plot should ok, right?

xml - XSLT: Create new tags around other tags -

can use xslt transform following xml: <?xml version="1.0" encoding="utf-8" standalone="yes"?> <root> <p>the chemical formula water h<sub>2</sub>o. rest of paragraph not relevant.</p> <p>another paragraph without subscripts.</p> </root> to this: <?xml version="1.0" encoding="utf-8" standalone="yes"?> <root> <p><text>the chemical formula water h</text><sub>2</sub><text>o. rest of paragraph not relevant.</text></p> <p>another paragraph without subscripts.</p> </root> i.e. wrap different parts of p element contains sub elements text elements? this xslt far: <?xml version="1.0" encoding="utf-8"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/xsl/transform" version="1.0"> <xsl:template match="root|p"> <xsl:cop...

ios - App don't discover services when reconnecting after power cycling bluetooth -

when toggling bluetooth while connected corebluetooth peripheral disconnection , deletion of references peripheral in centralmanagerdidupdatestate callback. doing scan find , reconnect device , again issue discoverservices , time around callback diddiscoverservices never happens. deleting settings (general -> reset -> reset settings) or reboot works again. disconnect/reconnect normal work. how can work around or delete cache , uuid's stored ios programatically? when callback centralmanager state has changed cbcentralmanagerstatepoweredoff , need loop through peripherals , call cancelconnection: on them. you'll go. [_yourcentralmanager cancelperipheralconnection:yourperipheral];

python - Setting up Eclipse to use Lettuce -

i starting off lettuce test web application. problem unaware of how configure eclipse runs steps file. web seems pretty unaware of , hence last resort. for automated solution can @ eclipse external tools capability. documented in eclipse help workbench. follow links workbench user guide ==> concepts ==> ant & external tools ==> external tools . for interactive use, can run lettuce python console within eclipse if have pydev installed, , should if use eclipse python development.

image processing - Copy part of huge .YUV video file -

i looking win32 program copy part of large 1920x1080px 4:2:0 .yuv file (cca. 43gb) smaller .yuv files. of programs have used, i.e. yuv players, can copy/save 1 frame @ time. easiest/appropriate method cut yuv raw data smaller yuv videos(images)? similar ffmpeg command: ffmpeg -ss [start_seconds] -t [duration_seconds] -i [input_file] [outputfile] if have python available, can use approach store each frame separate file: src_yuv = open(self.filename, 'rb') in xrange(number_of_frames): data = src_yuv.read(number_of_bytes) fname = "frame" + "%d" % + ".yuv" dst_yuv = open(fname, 'wb') dst_yuv.write(data) sys.stdout.write('.') sys.stdout.flush() dst_yuv.close() src_yuv.close() just change capitalized variable valid numbers, e.g number_of_bytes 1 frame 1080p should 1920*1080*3/2=3110400 or if install cygwin can use dd tool, e.g. first frame of 1080p clip do: dd bs=3110400 count=1 if=sam...

json - AngularJS calls HTTP multiple times in controller -

Image
i developing page angular, , have init() method in controller. code follows: var filterscontroller = ['$scope', '$http', function ($scope, $http) { $scope.init = function () { $http({ method: 'get', url: '/json-tags-test', cache: true }).success(function (data, status, headers, config) { // callback called asynchronously // when response available }).error(function (data, status, headers, config) { // called asynchronously if error occurs // or server returns response error status. }); }; }]; it call simple json file. my html follows: <div class="container main-frame" ng-app="projectsapp" ng-controller="filterscontroller" ng-init="init()"> </div> for reason, call gets call twice every time load page. standard behaviour? many thanks, dash this pro...

sql - JQL Query in Jira, maxDate and MinDate -

using jira issue search, have 2 custom date fields in project. want filter returns issue earliest date field 1. want filter return issue latest date field 2. has done query similar before. dont know correct syntax , checking on atlassian documents doesnt mention max or min. you can create own jql functions using free plugin such script runner . to data jira database, find id of custom field using select * customfield then use this select pkey , summary , datevalue customfieldvalue c , jiraissue i.id=c.issue , c.customfield = 10071 , c.datevalue in (select min(datevalue) customfieldvalue customfield = 10071)

How to compile sqlite3 threadsafe in a c++ application? -

right compiling sqlite3 code following options: gcc -c -lpthread -dsqlite_threadsafe=1 sqlite3.c g++ -o test test.cc sqlite3.o -ldl -lpthread , works fine. saw in projects, define flag -dsqlite_threadsafe=1 in g++ compiler call listet. required or redundant? the sqlite_threadsafe symbol needed when compiling sqlite code itself. adding other compiler calls superfluous, not hurt.

jquery - How is the correct syntax to call a function in the document.ready() section? -

i'm pretty sure answer question not difficult: i want call function in $(document).ready(function() section of page. function called clicking on button. this: <button value="call function" action="#{functionclass.functionmethod}"/> the function call via button works fine, how 'translate' 'jquery-style'? to more precise: want call method when page loaded, not when button clicked. $(document).ready(function() { einstiegsseitecontroller.loadtranslation(); }); does not work. call function in body of anonymous function() of on , not ready : $(document).on( 'click', '.someclass', function(){ functionclass.functionmethod(); }); ready events should happen once dom has loaded. don't need event, need click event. using in on i've shown work dynamic dom (such when changing div s ajax). edit: considering edit question, function can called on dom load follows: $(document...

javascript - Returning a value from 'success' block in JS (Azure Mobile Service) -

i have rather simple getuser method i'm having trouble with. not familiar scopes , such in js giving me head ache. want fetch object database , return calling method: function getuser(uid) { var result = null; var usertable = tables.gettable('users'); usertable.where({ userid: uid }).read({ success: function (results) { if (results.length > 0) { result = results[0]; console.log('userid'+result.id); } } }); console.log('userid-'+result.id); // undefined!! return result; } also, returning inside success doesn't return getuser, function defined inside. tried "result = function(results)" stores defined function , not return value. how supposed this? i found solution elsewhere. in practice (to best of understanding), not possible within javascript asynchronous functions. need create recursion instead inside success hand...

angularjs - How to set a selected option of a dropdown list control using angular JS -

i using angular js , need set selected option of dropdown list control using angular js. forgive me if ridiculous new angular js here dropdown list control of html <select ng-required="item.id==8 && item.quantity > 0" name="postervariants" ng-show="item.id==8" ng-model="item.selectedvariant" ng-change="calculateservicessubtotal(item)" ng-options="v.name v in variants | filter:{type:2}"> </select> after gets populated <select ng-options="v.name v in variants | filter:{type:2}" ng-change="calculateservicessubtotal(item)" ng-model="item.selectedvariant" ng-show="item.id==8" name="postervariants" ng-required="item.id==8 &amp;&amp; item.quantity &gt; 0" class="ng-pristine ng-valid ng-valid-required"> <option value="?" selected="selected"></option> <option...

php - Create recurring profile programmatically in magento -

i'm working magento , want create recurring profile new gateway , problem magento supporting paypal only. correct - recurring profiles still in beta , paypal first (and only) supported payment gateway @ moment (as of 1.7). see here . to support new gateway accepts credit cards, you'll need write own payment gateway extends mage_payment_model_method_cc , implements mage_payment_model_recurring_profile_methodinterface .

cognos - how to use parameter display output as a value to calculate this value in other issue? -

i have made parameterdisplay calculate somedata timezone target , actual salestargets, report shows me value example (100%). so need use 100% multiply in thing example (100% * actual target).. how can use output in calculation? go query. drag data item toolbox. assuming prompt name prmsalestarget, in expression write ?prmsalestarget? * actualtarget. give meaningfull name data item , drag report

asp.net - LastActivityDate different than LastLoginDate in ASPNET Membership Provider -

in aspnet membership provider implementation, lastactivitydate different lastlogindate. kind of information stored in column if user not log in? thank you for new user lastlogindate , lastactivitydate equal creationdate. the lastlogindate updated when method "validateuser" called. in cases @ login. the lastactivitydate updated when method "validateuser" called when information profile requested. so in last case can happens when have example backendpage list of users including profile information see lastactivitydate same users. lastactivitydate set date , time access backendpage.

How to get the no of Days from the difference of two dates in PostgreSQL? -

select extract(day age('2013-04-06','2013-04-04'));` gives me no of days ! i.e.: 2 days but failed when have differnt month: select extract(day age('2013-05-02','2013-04-01')); so need no of days 32 days subtraction seems more intuitive. select '2013-05-02'::date - '2013-04-01'::date run query see why result 31 instead of 32 with dates ( select generate_series('2013-04-01'::date, '2013-05-02'::date, '1 day')::date end_date, '2013-04-01'::date start_date ) select end_date, start_date, end_date - start_date difference dates order end_date the difference between today , today 0 days. whether matters application-dependent. can add 1 if need to.

pointers - C++ : Polymorphism and operator overloading -

i having troubles figuring out how overload comparison operators have done when using abstract base class. main problem achieve polymorphism using base class, since it's abstract can't instantiated forced use pointer base class in order access derived class methods. i'll put code in order describe situation better : template <typename _tp> class base { private: _tp attr ; public: foo() = 0 ; friend bool operator == ( base* b1, base* b2) { return ( b1.attr == b2.attr ) ; } }; template <typename _tp> class derived_1 : public base<_tp> { /.../ } ; template <typename _tp> class derived_2 : public base<_tp> { /.../ } ; int main (void) { vector<base*<int> > * v = new vector<base*<int> > (2,0) ; v[0] = new derived_1 () ; v[1] = new derived_2 () ; if ( (*v)[0] == (*v)[1] ) { /.../ } return 0 ; } so, @ point notice (*v)[0] == (*v)[1] ...

javascript - jquery onclick function not doing what it should -

i have following jquery, on clicking #block4, .maincontent shows. works fine @ first, show , hide div. once clcik again after initial first 2 times, .maincontent div shows , disappears straight away. $('#block4').click(function(){ $(".maincontent").delay(500).fadein(); $("#block4").click(hideit) }); function hideit() { $(".maincontent").fadeout(); }; anyone know problem is? you shouldn't this. better set class or flag might need : $('#block4').click(function(){ var $cont=$(".maincontent"); if(!$cont.hasclass('visible')) $cont.addclass('visible').delay(500).fadein(); else $cont.removeclass('visible').fadeout(); }); as solution try disabling previous event : $("#block4").off('click').click(hideit); or better use .one although prefer class solution : $('#block4').one('click',function(){ $(".maincontent...

c# - Reading numbers from a text file to an array -

i want read numbers text file array. numbers in 1 line. if use x.read() ascii code of first character, if use x.readline() , row, not numbers 1 one. i want use cycle numbers 1 one. it's simple, when ascii code can convert digit want, suppose read character ( char ) file '0', '1', '2', ... or '9' , want int value, simple convert char int , subtract integer value of '0' 48. this: char ch = x.read(); int chintvalue = ((int)ch) - 48; but modern programming languages have readint , getinteger method or in io libraries provide.

php - In TCPDF how to tell if my table will be bigger than the page becouse in this case I would have to add a custom header for it -

in tcpdf how tell if table bigger page because in case have add custom header it. if use: $pdf->getaliasnumpage() compare before start table , @ beginning of each row don't seem work. $pdf->getaliasnumpage() if used second time return like: {:pnp:} hope can me this. code looks this: <? $table=""; $islasttable = 0; ($i = 0; $i<sizeof($ar); $i++) { ($j = 0; $j<3; $j++) { if (isset ($ar[$i][$j])) { if($j==0) { if ($islasttable == 1) { $table .= '</table><table border="1" style="text-align:center; vertical-align:middle; padding:5;border-bottopm:1px solid black;">'; $islasttable = 0; } else { $table .= '<table border="1" style="text-align:center; vertical-align:middle; padding:5;">'; ...

javascript - Merge two objects and overwrite the values if conflict -

i'm trying merge 2 objects , overwrite values in process. is possible underscore following? (i'm fine not using underscore want simple) var obj1 = { "hello":"xxx" "win":"xxx" }; var obj2 = { "hello":"zzz" }; var obj3 = merge(obj1, obj2); /* { "hello":"zzz", "win":"xxx" } */ use extend : var obj3 = _.extend({}, obj1, obj2); the first argument modified, if don't want modify obj1 or obj2 pass in {} .

php - Start using Migrations mid way through a Laravel app -

in midst of developing laravel 4 app, i've decided start making use of laravel's migration feature. question: should write migrations creating tables have in database? or write migrations future changes? there no complete right answer this. depends on lot of variables, style of development, how many people you're working , in kind of environment (single production db? multiple dev dbs?), requirements migrations are, etc. etc. if do decide write migrations entire db until point, you'll need make sure migrations can handle potential conflicts. making use of schema::has() , such verify tables exist prior attempting create them, , such. alternatively, can write migrations if db has clean slate, , enforce devs start empty db prior running migrations. has risks, careful. make sure have backups in case migration forgot , need modify it. so, tl;dr: using migrations entire structure part way through project bad thing? no. right application? entirely depen...

C# Writing SQL queries -

i'm trying write custom query , keep getting sqlexception unhandled `error' - incorrect syntax near '.' code: var list = dbcontext.database.sqlquery<string>("select a.assetid, a.assetname, a.seg1_code, d.shortname, e.officepercentage, e.maintenancepercentage" + "from [core].[dbo].[asset] a" + "left outer join [core].[dbo].[assetaddress] b" + "on a.assetid = b.assetid" + "left outer join [core].[dbo].[address] c" + "on b.addressid = c.addressid" + "left outer join [core].[dbo].[statelookup] d" + "on c.stateid = d.stateid" + "inner join [core].[dbo].[assetpayrollmarkupoverride] e" + "on a.assetid = e.assetid" + "order d.shortname, a.assetname").tolist(); add space before/after each of string in concatenation. var list = dbco...

objective c - iOS and JSON nesting issue -

i working on app game server company , part of app requires user see list of or game servers , whether or not online, offline, how many players on them, server name, etc. data found in json file hosted on web updated mysql database. using code below, can't seem working. now, please understand 1 of first times working json , have no choice client requested. talked partner couldn't seem debug issue himself. the error like: no visible @interface 'nsarray' declares selector 'objectforkey:' i've tried several versions of code, no success. it appreciated if please me debug code , working along commented out section near bottom updating tableviewcells server name, players online, , status (0=offline, 1=online, 2=busy, 3=suspended, -1=unable start). please note format of json file must remain , possible make minor changes. thank you, michael s. my header file: http://pastebin.com/ekuwvsmy my main file: http://pastebin.com/09ju0udu m...

Synchronizing Google App Engine DataStore with local instance via Datanucleus REST API or some other Java API -

i'd know if can guide me in aspect, know datanucleus rest api may making contents of local google app engine datastore , online 1 same, there might way easier, i'm having great difficulties understand how might done via api. application has been done in java there's no point in trying develop phyton know, it's way late now. thanks lot interest. edit: found interesting tools here: http://www.appwrench.onpositive.com , better application if done code need executed automatically once day, if know of not hard way achieve i'm telling i'll grateful if tell me so, if not i'll stick tools. i don't know datanucleus, can connect gae datastore local machines using remote api you can use remote api access production datastore app running on local machine . can use remote api access datastore of 1 app engine app different app engine app. with this, can code app synchronize data

Java Convert 7bit Charset Octets to Readable String (From PDU SMS) -

i'm receiving sms gsm modem in pdu format; tp-user-data "c8329bfd06dddf72363904" , is: "�2����r69", while sent sms "hello world!". here java code: private string frompdutext(string pdusmstext) { string endoding = pdusmstext.substring(0, 2); pdusmstext = pdusmstext.substring(18); byte bs[] = new byte[pdusmstext.length() / 2]; for(int = 0; < pdusmstext.length(); += 2) { bs[i / 2] = (byte) integer.parseint(pdusmstext.substring(i, + 2), 16); } try { string out = new string(bs, "ascii"); } catch(unsupportedencodingexception e) { e.printstacktrace(); return ""; } { return out; } } the input packed in 7-bits per character, means every 8 bytes encode 9 characters. constructing parser format can fun exercise or frustrating experience, depending on how take it. better off using library, , quick google search reveals several code examples . ...

using silverstripe data object concept in wordpress -

i new wordpress, come silvestripe development. i have developed faq accordion has tittle , description. in silverstripe create dataobject, relate desired page , output looping through records in template. <div class="accordioncontainer"> <ul> <% loop accordion %> //loop data object <li> <h2 class="accordionheader"><a href="#">$title</a></h2> <div class='accordioncontent'> <div class ="accordionblock"> $description </div> </div> </li> <% end_control %> </ul> </div> how can achieved in wordpress?? thank in advance :) although wp allows custom post types (like page types in silverstripe), looks relationships may need hand...

hide - How to display only the non chosen language in the language switcher menu in a multilingual drupal 7 website? -

hi. i'm newbie in drupal development. i'm building multilingual website in french , english using drupal 7. i'm using internationalization , entity translation modules translate contents , blocks in page. i'm using theme omega, sub-theme foundation downloaded website friendlymachine added sub-theme file modify css. i'm having language switcher block working properly. my question is: code in file can modify (and how?) display in language switcher non chosen (i.e needed) language? i.e: if i'm using website in french, option "english" displayed on language switcher menu. , vice versa. (if i'm using website in english, option "french" displayed in language switcher menu). any welcomed. thank you. hide current language link (which not link text) language switcher block css . has specific class purpose.

rounding - round in Smarty shows wrong result -

in smarty 3 template have code: {$a=8.34} {$b=8.33} {$a-$b|round:2} expected result is: 0.01 but receive this: 0.0099999999999998 does know how fix this? smarty2 applied modifier result of complete expression. smarty3 on direct prepending value. so in smarty3 have use brackets: {($a-$b)|round:2} that should solve it.

visual studio 2010 - TFS File not showing in solution, TF10187 -

i have branch in tfs, after making changes checked in , merged main branch. can see folders , files on server in source control. however, of new files , changes files not available in solution. folders added shown in solution not file inside these folders. check in main branch wanted build of course because nobody wants checked-in solution breaks build. error message: error tf10187:could not open document (path) system cannot find file specified anybody have suggestion, thanks!

ios - Delegation pattern in Obj-C - Am I doing it wrong? -

so in app have following situation: backendcommunicatingclass -> (owned by) -> modelclass -> (owned by) -> homescreenviewcontroller homescreenviewcontroller delegate modelclass. modelclass delegate backendcommunicatingclass. also on when app launches first time, have this: welcomeviewcontroller -> (owned by) -> homescreenviewcontroller homescreenviewcontroller delegate welcomeviewcontroller. when user types username , password in welcomeviewcontroller, information needs way backendcommunicatingclass, , way welcomeviewcontroller display error if needed. right have implemented passing information each class in communication chain, until gets backendcommunicatingclass. result lot of duplication of protocol methods , feel i'm doing wrong. what think? well understand not clearest solution, without seing code, , purpose of program, suggest. implement key value observing (kvo) in end view controller, observing change in home view contro...

Django 'ascii' codec can't encode character -

in django want use simple template tag truncate data. this have far: @register.filter(name='truncate_simple') def truncate_char_to_space(value, arg): """ truncates string after given length. """ data = str(value) if len(value) < arg: return data if data.find(' ', arg, arg+5) == -1: return data[:arg] + '...' else: return data[:arg] + data[arg:data.find(' ', arg)] + '...' but when use following error: {{ item.content|truncate_simple:5 }} error: 'ascii' codec can't encode character u'\u2013' in position 84: ordinal not in range(128) error on line starting data = str(value) why? try use unicode() convert value (instead of str()): data = unicode(value)

performance - Is there any standard for response times in desktop applications? -

a customer asks response times under second "dialog-based" applications. speaking our desktop applications getting data business server connected sql server. usually 1 second ok us, have got forms take longer (up 2 or 3 seconds). know standards (or source) specifies should response times user? i've found many different informations, web pages , not desktop applications. i read somewhere 3 seconds "magical" number. read "10 seconds rule" norman nielsen web pages. others speak "4 seconds" rule. i have arguments customer "third party" ("as know, accepted limit specified in iso norm xx") :-) thank you even if actual performance of dialogs can not improved, can @ techniques may improve perceived performance of application. lazy loading, or asynchronously loading parts of dialog after it's shown may improve experience user , not require exceptional effort you. feedback on progress, may improve user...

repository - Using Odata to get huge amount of data -

i have data source provider : public class dsprovider { public iqueryable<product> products { { return _repo.products.asqueryable(); } } } the repository in above example gets records (of products) db , applies filters, not sound right if had 50000 requests/sec website.how can limit repository return required info db without converting service tightly coupled request option i.e. opposite of try achieve using odata? so summarize know if possible query db on odata options supplied user request not have products , apply filters of odata. i found out after doing small poc entity framework takes care of building dynamic query based on request.

c# - Is it better to use this. before code? -

i need go online , find tutorial something. finding people put code this: this.button1.text = "random text"; then find code this: button1.text = "random text"; is better use this.whatever or not matter? this make clear, in cases have use this : differentiate between parameter , local member : //local member object item; private void somemethod(object item){ this.item = item;//must use } pass current class instance method: public class someclass { private void somemethod(someclass obj){ //.... } private void anothermethod(){ somemethod(this);//pass current instance somemethod //..... } } use in extension methods: public static class someclassextension { public static void someclassmethod(this someclass obj){ //use obj reference object calling method... } } call constructor constructor (with different signature): public form1(string s) : this() {//call form1() before executing other code in...

javascript - Trying to prevent jQueryMobile swipe gesture from bubbling, but it's not working -

i'm using jquery mobile , created resembles android holo tabs: http://note.io/18rnmrk in order swipe gesture work switching between tabs, code i've added: $("#mypage #pagetabs").on('swipeleft swiperight', function(e){ e.stoppropagation(); e.preventdefault(); }); $("#mypage").on('swipeleft', function(){ ui.activities.swipe(1); }).on('swiperight', function(){ ui.activities.swipe(-1); }); with tabs' html resembling: <div id="pagetabs"> <div class="tab"> <a href="#" data-dayofmonth="26">thu</a> </div> <div class="tab"> <a href="#" data-dayofmonth="27">fri</a> </div> <div class="tab"> <a href="#" data-dayofmonth="28" data-meridian="am">sat am</a> </div> <div class=...

Is storing XML with a standard structure in SQL Server a bad use of the XML datatype? -

we have table in our database stores xml in 1 of columns. xml in exact same format out of set of 3 different xml formats received via web service responses. need information in table (and inside of xml field) frequently. poor use of xml datatype? my suggestion create seperate tables each different xml structure talking 3 growth rate of maybe 1 new table year. i suppose matter of preference, here reasons prefer not store data in xml field: writing queries against xml in tsql slow. might not bad small amount of data, you'll notice decent amount of data. sometimes there special logic needed work xml blob. if store xml directly in sql, find duplicating logic over. i've seen before @ job guy wrote xml field long gone , left wondering how work it. elements there, not, etc. similar (2), in opinion breaks purity of database. in same way lot of people advise against storing html in field, advise against storing raw xml. but despite these 3 points ... can work , t...

ios - coredata sqlite location, Library/Application Support and iCloud -

we got rejected during review process following issues: ========== 2.23 we still found app not follow ios data storage guidelines, required per app store review guidelines. in particular, found on launch and/or content download, app stores non user-generated content in icloud backup directories, not appropriate. check how data app storing: install , launch app go settings > icloud > storage & backup > manage storage if necessary, tap "show apps" check app's storage the ios data storage guidelines indicate content user creates using app, e.g., documents, new files, edits, etc., should backed icloud. temporary files used app should stored in /tmp directory; please remember delete files stored in location when user exits app. data can recreated must persist proper functioning of app - or because customers expect available offline use - should marked "do not up" attribute. n...

Changing an object property in C# for multiple versions of .NET -

i have c# project used part of visual studio extension. to support earlier versions of vs, project set target framework .net framework 3.5. the project makes reference system.servicemodel . depending on version of visual studio running, different version of system.servicemodel used. vs2008 use .net 3.5 version dll, while vs2012 use .net 4.5 version @ runtime, regardless of project target framework. my problem property added httptransportbindingelement in .net 4, called decompressionenabled . because target .net 3.5, cannot compile changes property; however, need change value. the work around using change property @ run time, use reflection: public static void disabledecompression(this httptransportbindingelement bindingelement) { var prop = bindingelement.gettype() .getproperty("decompressionenabled", bindingflags.public | bindingflags.instance); if (null != prop && prop.canwrite) { ...

jQuery UI Slider within google maps InfoBubble -

i'm building custom infobubble holding 2 jquery ui sliders manipulate data. had no problems creating bubble , slider. unfortunately, somewhere mouse event seems prevented bubbling slider. i prepared fiddle explain behaviour: jsfiddle to reproduce error, following: 1. click on slider knob 2. move mouse outside of infobubble 3. move mouse left , right use slider 4. move mouse info window , see slider movement cease immediately. does know event gets lost , how fix situation? ok, invested quite bit of time find solution this. got working now! the problem lies within infobubble code. events being prevented bubbling map, apparently prevent ghostclicks through bubble. unfortunately prevents other listeners working properly. code snippet handling events found on line 808: /** * add events stop propagation * @private */ infobubble.prototype.addevents_ = function() { // want cancel events not go map var events = ['mousedown', 'mousemove', ...