Posts

Showing posts from May, 2010

Python 3 Strange Metaclass Behaviour -

i playing metaclasses in python 3: class m(type): def __new__(cls, clsname, bases, attrs): name, attr in attrs.items(): if callable(attr): attrs[name] = attr return type.__new__(cls, clsname, bases, attrs) class c(metaclass=m): def f(self, x): print(x) if __name__ == '__main__': c = c() c.f(1) c.f(2) nothing special far, hook creation of class, , substitute method with... well, itself, no wonder works. with: class m(type): def __new__(cls, clsname, bases, attrs): name, func in attrs.items(): if callable(func): attrs[name] = lambda *args, **kwds: func(*args, **kwds) return type.__new__(cls, clsname, bases, attrs) it sometime works, , doesn't: user$ python test.py 1 2 user$ python test.py traceback (most recent call last): file "./meta.py", line 23, in <module> main() file "./meta.py", line 19, in main in

asp.net mvc - Having trouble building an MVC application with MSBuild -

i've installed cruisecontrol on staging server , i'm trying compile solution using msbuild. 1 of projects mvc web application running .net 4.5. have, of course, installed .net 4.5 on machine. have deployed site staging site on same server, , runs fine. ... when try build on command line msbuild project.csproj following error: (corecompile target) -> controllers\admincontroller.cs(12,36): error cs0246: type or namespace name 'controller' not found (are missing using directive or assembly reference?) [f:\cruisecontrol\workingdirectory\project.csproj] it seems msbuild can't see of mvc objects such controller. they're on machine, , asp.net can see them or website wouldn't run. i'm running msbuild c:\windows\microsoft.net\framework64\v4.0.30319 directory. it seems need install mvc on build server. had been under impression part of framework now, guess it's still separate install.

How to wrap each object of a Collection in Java? -

i have class foo made equivalence wrapper class wrappedfoo change equals() contract in parts of program. i need convert foo objects wrappedfoo objects , vice versa in many places. need convert collection s of foo s , wrappedfoo 1 another. there way can achieve in generic way? basically want method this: public static collection<wrappedfoo> wrapcollection(collection<foo> collection) the problem don't know kind of collection implementation used , wish keep same implementation resulting collection . using reflection api, (notice 0 in method name): public static collection<wrapperfoo> wrapcollection0(collection<foo> src) { try { class<? extends collection> clazz = src.getclass(); collection dst = clazz.newinstance(); (foo foo : src) { dst.add(new wrapperfoo(foo)); } return dst; } catch(exception e) { e.printstacktrace(); return null

java - CXF client deserializes a SOAP message to null with WS addressing -

i have cxf client uses mapaggregator , mapcodec in , out interceptors call soap web service uses ws addressing. i'm logging soap messages. seems message returns correctly (the logger logs correct response), cxf deserializes null instead of expected response class. why happening? the problem resolved removing mapaggregator , mapcodec in interceptors.

java - Extending SupportMapFragment - how to instantiate new fragment? -

in documentation mapfragment , supportmapfragment create new fragment calling newinstance() instead of using new supportmapfragment() . my app project extends supportmapfragment , , tried call mymapfragment.newinstance() on fragment class, resulting in map showing expected none of overridden methods such oncreateview() , onactivitycreated() being called. took me while before tried instantiating fragment using new mymapfragment() instead - , voíla, overridden methods started getting called! i didn't override newinstance() in class, , in hindsight it's obvious newinstance() returns instance of supportmapfragment , not instance of extended class (duh!). but question - why is there newinstance() method , why documentation use it, when seems work using new supportmapfragment() ? what's difference of using 1 or other? haven't been able find source code supportmapfragment, so... in case believe newinstance method static factory method empty const

asp.net - Interacting with QuickBooks Online V3 API -

i'm writing web application (that not published intuit on app center thing) interact quickbooks online (qbo) syncing purposes, using vb.net , asp.net. i'm having hard time understanding how or start. understand this: user accesses web application , "connect quickbooks" button (that intuit requires in-app authorization) displayed. before button clicked send http request oauth request credentials using consumer credentials. once user clicks button redirected quickbooks online (qbo) can sign in , authorize access company, giving authorized request credentials. qbo redirects site indicating have authorized request credentials in send http request access credentials. once have access credentials free interact qbo v3 api. using access credentials can construct http requests send particular http method xml/json in body perform corresponding crud operation in qbo , qbo sends response indicate whether successful or not. when application done interacting qbo make

migration - Trying to find the DNN Platform community version that matches my DNN Professional install -

i trying migrate dnn 7.* community edition (for dev server only), , trying find out community edition version matches professional version. hoping find table map professional community versions, haven't been able find anything. knows can find information? the numbers professional edition match community (platform) edition exactly. if on dnn pe 7.0.6, dnn 7.0.6

javascript - Pass external var to jquery function -

html file: <head> //include jquery </head> <body> //html stuff <script type="text/javascript"> var prd = 'something'; </script> <script type="text/javascript" src="script.js"></script> </body> script.js $('#select span').click(function(){ var id = this.id; var path = '/scripts/test/sqlgetdata.php?id='+id+'&p='+prd; path = encodeuricomponent(path); post(path); }); function post(path){ //stuff } the var prd not avaiable on function include in var path . i've alse tried: $('#select span').click(function(prd) is possible solve without callback? thank you it's passed event.data $('#select span').click({prd: prd}, function(e){ var id = this.id; var prd = e.data.prd; // here var path = '/scripts/test/sqlgetdata.php?id='+id+'&p='+prd; path = en

scala - PlayFramework: Error during sbt execution: java.lang.NoClassDefFoundError: scalax/io/Seekable -

i have downloaded play 2.2.2.rc2 however, when run play command output get. doing wrong? java.lang.noclassdeffounderror: scalax/io/seekable @ java.lang.classloader.defineclass1(native method) @ java.lang.classloader.defineclass(classloader.java:800) @ java.security.secureclassloader.defineclass(secureclassloader.java:142) @ java.net.urlclassloader.defineclass(urlclassloader.java:449) @ java.net.urlclassloader.access$100(urlclassloader.java:71) @ java.net.urlclassloader$1.run(urlclassloader.java:361) @ java.net.urlclassloader$1.run(urlclassloader.java:355) @ java.security.accesscontroller.doprivileged(native method) @ java.net.urlclassloader.findclass(urlclassloader.java:354) @ java.lang.classloader.loadclass(classloader.java:425) @ java.lang.classloader.loadclass(classloader.java:358) @ java.lang.classloader.defineclass1(native method) @ java.lang.classloader.defineclass(classloader.java:800) @ java.security.secureclassload

php - Getting Facebook Friends Picture Error -

hi have script , im having problem getting facebook friends profile picture. "warning: imagecreatefromjpeg(array) [function.imagecreatefromjpeg]: failed open stream: no such file or directory in /home2/my1date1/public_html/judeapps/fans/img.php on line 31" this index.php code. <?php session_start(); require_once 'src/facebook.php'; set_time_limit ( 120 ); $app_id = "661337633905378"; $app_secret = "958db3fad7cffbb395ae3314e069d743"; $redirect_uri = "http://apps.facebook.com/ivalentines_daysss/"; $facebook = new facebook(array( 'appid' => $app_id, 'secret' => $app_secret, 'cookie' => true )); @$code = $_request['code']; if($code) { $access_token = $facebook->getaccesstoken(); $user_id = $facebook->getuser(); $signed_request = $facebook->getsignedrequest(); $user_country = $signed_request["user"]["country"]; $country = $user_country;

string - Java Tic Tac Toe Error -

as per specifictaions, must make functioning tic tac toe game using gridworld. have completed of class, there method stuck on. i'm not sure how check if there winner diagonally or vertically. below method. public string getwinner() { grid<piece> grid = getgrid(); if(grid == null) { return "no winner"; } string winner = ""; (int r = 0; r<grid.getnumrows(); r++) { piece row0 = grid.get(new location(r,0)); piece row1 = grid.get(new location(r,1)); piece row2 = grid.get(new location(r,2)); if(row0 == null || row1 == null || row2 == null) { continue; } if(row0.getname().equals(row1.getname()) && row0.getname().equals(row2.getname())) { winner = row0.getname()+ " wins horizontally!"; break; } } //check vertical winner //check diagonal winner if(isworldfull() && wi

java - How to pass an ArrayList from one jsp to another using session -

i'm trying pass arraylist handle.jsp main.jsp, doesn't let me it. keeps saying "type mismatch: cannot convert object arraylist". main.jsp: <%@ page import="java.util.arraylist" %> <html> <body> <h1>hobby manager</h1> <% arraylist<string> hobbies = session.getattribute("hobbies"); out.println(hobbies.size()); out.println(session.getattribute("hobbies")); %> <h2>add new hobby!</h2> <form action="handleaddhobby.jsp" method="get"> new hobby wishing add? <input type=text name=hobbyname /> <br/> <input type=submit name=addhobby value="add hobby" /> </form> </body> </html> handle.jsp: <%@ page import="java.util.arraylist" %> <html> <body> <% arraylist<string> hobbies = new arraylist<string>()

include A python file that exisist in the project -

im totaly new python in absolute beginner stage. know alot php mind think in php way when trying stuff python. i have python project contains a: test.py includes(folder) - math.py the test.py contains code: import mysqldb db = mysqldb.connect(host="127.0.0.1", user="root", passwd="", db="python") tkinter import * root = tk() root.title("test") root.geometry("500x500") window = frame(root) window.grid() label = label(text="") label.grid() def click(): cur = db.cursor() query = cur.execute("select * names") result = cur.fetchall() label["text"] = result[0] b1 = button(window, text = "click me!",command=click) b1.grid() root.mainloop() how include math.py file can use class inside. know in php it's: include("indcludes/math.py"); but how make same thing in python, if posible @ ;) ty time.

python - Scipy leastsq: fitting a square grid to experimental points in 2D -

i'm trying use scipy leastsq find best fit of "square" grid set of measured points coordinates in 2-d (the experimental points approximately on square grid). the parameters of grid pitch (equal x , y), center position ( center_x , center_y ) , rotation (in degree). i defined error function calculating euclidean distance each pairs of points (experimental vs ideal grid) , taking mean. want minimize function thorugh leastsq error. here function definitions: import numpy np scipy.optimize import leastsq def get_spot_grid(shape, pitch, center_x, center_y, rotation=0): x_spots, y_spots = np.meshgrid( (np.arange(shape[1]) - (shape[1]-1)/2.)*pitch, (np.arange(shape[0]) - (shape[0]-1)/2.)*pitch) theta = rotation/180.*np.pi x_spots = x_spots*np.cos(theta) - y_spots*np.sin(theta) + center_x y_spads = x_spots*np.sin(theta) + y_spots*np.cos(theta) + center_y return x_spots, y_spots def get_mean_distance(x1, y1, x2, y2)

objective c - One TableViewController with 2 sections linking to 1 DetailView? -

so in project have 1 historytableviewcontroller contains 2 sections. 1 section peopleyouowe , other section group of peoplewhooweyou. how able hook 1 tableviewcontroller , link detail view display different data according sections? try below approach using prepareforsegue - creat tableview outlet named mytableview - (void)prepareforsegue:(uistoryboardsegue *)segue sender:(id)sender { // new view controller using [segue destinationviewcontroller]. // pass selected object new view controller. nsindexpath *path = [self.mytableview indexpathforselectedrow]; if (path.section == 0) { if ([segue.identifier isequaltostring:@"peopleyouowe"]) { peopleyouowe *peopleyouowevc = segue.destinationviewcontroller; // can data of cell array[path.row] } } else if (path.section == 1) { if ([segue.identifier isequaltostring:@"peoplewhooweyou"]) { peoplewhooweyou *peoplewhooweyou = segue.destinationviewcontrol

android - Indeterminate Horizontal ProgressBar BELOW ActionBar using AppCompat? -

i have been looking answers on how place indeterminate horizontal progress bar below action bar using appcompat. i'm able horizontal progress bar appear, @ top of action bar. want under/below action bar kind of how gmail (except without pull refresh). i used following code have progress bar appear: supportrequestwindowfeature(window.feature_progress); setcontentview(r.layout.main_activity); setsupportprogressbarindeterminate(boolean.true); setsupportprogressbarvisibility(true); but places horizontal progress bar @ top of action bar. know how place progress bar below action bar? i faced similar problem , solved creating own progressbar , aligning manipulating gettop() of content view. so first create progressbar. final layoutparams lp = new layoutparams(layoutparams.match_parent, 20); //use dp resources mloadingprogressbar = new progressbar(this, null, android.r.attr.progressbarstylehorizontal); mloadingprogressbar.setindeterminate(true); mloadingprogressba

java - spring annotation for entity that links other entities -

i writing calendar functionality spring mvc application. have calendar.jsp provides view of appointments , in turn associated providers , customers . my underlying mysql database has tables appointments , providers , , customers . calendar abstraction user interface. calendar class not have associated table in database, calendar class have list of appointments , list of providers , etc. use @entity annotation appointments , providers , , customers . what spring annotation should use calendar class? i need able reference calendar.providers , calendar.appointments , etc. calendar.jsp . here a link example of similar class uses roo annotation . i prefer avoid using roo. nice able use base spring framework distribution. app uses spring , hibernate. avoid adding unnecessary complexity. maybe i've missed here sure you're not overcomplicating things? if want expose populated calendar instance in jsp, after populating add model in contr

c - Interpreting data from fread() -

so attempting pass .txt file through code have echo characters individually output. running script like ./a.out < testwords.in > myout.out the crux bit here: size_t bytes = fread(buffer. sizeof(char),sizeof(char),stdin); fwrite(buffer,sizeof(char),bytes,stdout); fflush(stdout); which works fine. but how can interpret characters 1 1 in if statement? example if (bytes == '\n') doesn't trigger on new lines. edit: getc(stdin) more efficient way accomplish task. i don't know how define efficiency, code might run faster if fread() large buffer. see line of @bluepixy . see speed comparison between fgetc/fputc , fread/fwrite in c and line if (bytes == '\n') quite strange since pixels in buffer ... bytes number of elements read. sure meant if(buffer[i]=='\n') #include <stdio.h> #include <string.h> #include <stdlib.h> int main() { int count=0; int i; char buffer[1000]; size_t bytes=1;

html - Check if HtmlString is whitespace in C# -

i've got wrapper adds header field whenever has value. field string holds html tinymce textbox. requirement : header should not display when field empty or whitespace. issue : whitespace in html rendered <p>&nbsp; &nbsp;</p> , technically it's not empty or whitespace value i can't !string.isnullorwhitespace(model.contentfield.value) because have value, albeit whitespace html. i've tried convert value onto @html.raw(model.contentfield.value) it's of type htmlstring , can't use string.isnullorwhitespace . any ideas? thanks! you can use htmlagilitypack , this: htmldocument document = new htmldocument(); document.loadhtml(model.contentfield.value); string textvalue = htmlentity.deentitize(document.documentnode.innertext); bool isempty = string.isnullorwhitespace(textvalue);

ios - Changing a Label depending on the return of another cell -

i want cell.cellmatchstatus.text display string depending on value stored inside cell.cellmatchstatusimage - (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath { static nsstring *cellidentifier = @"liveident"; liveviewcell *cell = [tableview dequeuereusablecellwithidentifier:cellidentifier forindexpath:indexpath]; livematchobject *item = [_tabledatalivematch objectatindex:[indexpath row]]; if ([item iskindofclass:[livematchobject class]]) { cell.cellhometeamname.text = item.homename; cell.cellawayteamname.text = item.awayname; cell.cellhometeam.image = item.hometeamlogo; cell.cellawayteam.image = item.awayteamlogo; cell.cellhometeamscore.text = item.homegoals; cell.cellawayteamscore.text = item.awaygoals; cell.celldate.text = item.matchdate; cell.cellmatchstatusimage.image = item.matchstatus; // returns 1 of 3 options, postponed, running or finished if ([cell.c

php - Sum of left join tables -

i have 3 tables in mysql database. jobrequest - jobno, vehicleno labour - date, jobno4, amount2 materialcost date, jobno2, amount3 when user select jobno jobrequest table, want display total of labourcost , materialcost..... here code $result = mysql_query(" select jobrequest.jobno,jobrequest.vehicleno, sum(amount2) amount2, sum(amount3) amount3, jobrequest left join materialcost on jobrequest.jobno = materialused.jobno2 left join labour on jobrequest.jobno = labour.jobno4 ( jobrequest.jobno = '$item1') "); select jobrequest.jobno, jobrequest.vehicleno, sum(amount2) amount2, sum(amount3) amount3 jobrequest left join materialcost on jobrequest.jobno = materialused.jobno2 left join labour on jobrequest.jobno = labour.jobno4 ( jobrequest.jobno = '$item1') group jobrequest.jobno, jobrequest.vehicleno

Accessing variable in controller method CAKEPHP -

students hasmany payments , payments belongsto student. when creating payment, have indicate student creating payment for. want able access id of student when payment being created, in order manipulate within add() method. i have add() method in controller. here current code add(). public function add() { if ($this->request->is('post')) { $this->payment->create(); if ($this->payment->save($this->request->data)) { $this->session->setflash(__('the payment has been saved.')); return $this->redirect(array('action' => 'index')); } else { $this->session->setflash(__('the payment not saved. please, try again.')); } } $students = $this->payment->student->find('list'); $this->set(compact('students')); } payment form code <?php echo $this->form->create('payment'); ?&g

sql server - Adding a unique number for multiple same records in sql -

i have 1 big table named pub column ndc has multiple records of them occurs frequently. first want create sequence number distinct ndc. example in (1) original in (2) distinct ndc. (1) ndc: b c d a c v b (2) ndc: b c d v sequence number distinct ndc in example (0,1,2,3,4) after want create new column represent original ndc column numbers. each of ndcs presented unique number. looking @ (1) ndc, needed column newcolumn 0 1 2 3 0 0 2 4 1 for sure while doing calling whole table. don't want insert each record alone cause distinct ndc number large. in summary instead of having these strings in ndc column want have numbers same ndcs have same unique number in whole table. try this:- ;with cte (select distinct ndc yourtable ),cte2 (select ndc, rn =row_number() on (order ndc ) - 1 cte ) update t set t.newcolumn = c.rn yourtable t inner join cte2 c on t.ndc = c.ndc; sql fiddle

Ruby Rails update all atrribute using param -

currently im using code update 1 attribute, there way can update 'title' @ once ? using update_all maybe ? title= params['myform']['title'] @book.update_attribute(:title, title) thanks! yes there way: modelname.update_all(:title => title) more details here .

expandablelistview - Java Illegal Argument Exception android -

i having kind of error, after searching possible resources still not work. error: java.lang.illegalargumentexception: view android.widget.expandablelistview{416b0bc8 vfed.vc. ......id 0,0-480,0 #7f080005 app:id/lvexp} not drawer heres code: expandablelistadapter listadapter; expandablelistview explistview; list<string> listdataheader; private drawerlayout drawer; private linearlayout linear; button btn; hashmap<string, list<string>> listdatachild; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); preparelistdata(); btn = (button)findviewbyid(r.id.button1); linear = (linearlayout)findviewbyid(r.id.linear); explistview = (expandablelistview) findviewbyid(r.id.lvexp); drawer = (drawerlayout)findviewbyid(r.id.drawer_layout); btn.setonclicklistener(new view.onclicklistener() { @override public void onclick(view arg0) {

tabcontrol - How to hide tab pages in a tab control -

i learner in c# , have small doubt. in windows form page, have tabcontrol contains 3 tabpages.i have combobox outside tabcontrol 3 items listing names of tab pages. what want select name of first tabpage combobox, , tabpage should displayed hiding other tabpages. visibility property not applicable tabpages. how can this? thanks in advance. according hiding , showing tabpages in tabcontrol debasmit samal : visiblity property has not been implemented on tabcontrol, , there no insert method also. workaround on this private void hidetabpage(tabpage tp) { if (tabcontrol1.tabpages.contains(tp)) tabcontrol1.tabpages.remove(tp); } private void showtabpage(tabpage tp) { showtabpage(tp, tabcontrol1.tabpages.count); } private void showtabpage(tabpage tp , int index) { if (tabcontrol1.tabpages.contains(tp)) return; inserttabpage(tp, index); } private void inserttabpage(tabpage tabpage, int index) { if (index < 0 || index > tabc

android - jumping location on google maps by gps. (inaccurate distance) -

Image
my app should display distance , location in real time when user walked, there errors output. distance did not start when start increase lot until slows down bit. red marker , blue dot should according 1 example i've seen separate in app. both of them point current location right? both red marker , blue dot jumps around in short time not moving away true location. believe lead inaccuracy of distance well. please see output more details java code public class mainactivity extends fragmentactivity implements locationlistener{ protected locationmanager locationmanager; private googlemap googlemap; button btnstartmove,btnpause,btnresume,btnstop; static double n=0; long s1,r1; double dis=0.0; thread t1; edittext usernumberinput; boolean bool=false; int count=0; double speed = 1.6; double lat1,lon1,lat2,lon2,lat3,lon3,lat4,lon4; double dist = 0; textview distancetext; float[] result; private static final long minimum_distance_change_for_updates =1; // in meters private stat

java - Given a series of variables (A, B, C ...), How to form the Sql String Ex "A=? and B=?...." but only taking into account for Non-Empty variables? -

i have need form sql string searching data. i have long list of variables such as: string id, string fname, string city, int custtype, .... , table in db have these columns (id, fname, lname, city...) i want search data based on info provided variables, non-empty variables should used in sql string. ex1 if variables following: string id="22"; string fname=""; string lname="tom"; string city=""; int custtype=0; then string sql="select * customer "; string where=" id=? , lname=?"; sql+=where; //then call db ex2 if variables following: string id=""; string fname=""; string lname="tom"; string city="ny"; string postcode="211"; then string where=" lname=? , city=? , postcode=?"; if there 1 variable not empty & others empty no need and , ex string where=" lname=?" i thinking put varibles list, varibles have int

jquery - Unable to use Syncfusion JavaScript components in LightSwitch HTML -

i have bought syncfusion essential studio enterprise $599. using lightswitch silverlight components no issues seem having strange issues when using javascript components. this of content of default.htm file brand new (and empty) lightswitch html client modifications required syncfusion: <!doctype html> <html> <head> <meta charset="utf-8" /> <meta http-equiv="x-ua-compatible" content="ie=10" /> <meta name="handheldfriendly" content="true" /> <meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1, user-scalable=no" /> <meta name="apple-mobile-web-app-capable" content="yes" /> <title>application1.htmlclient</title> <script type="text/javascript"> // work around viewport sizing issue in ie 10 on windows phone 8 if (navigator.use

authentication - ASP.NET MVC 5: Custom Login URL based on localized route parameter -

in asp.net mvc 5 specify login path url in method configureauth(...) called application_start() : app.usecookieauthentication(new cookieauthenticationoptions { authenticationtype = defaultauthenticationtypes.applicationcookie, loginpath = new pathstring("/account/login") }); i need someway specify login path according localized route parameter. one way have in mind redirect user in application_authenticaterequest() desired login page in case request.isauthenticated false. not sure whether idea or not. using owin, can't assume application_authenticaterequest iis programming model. should assume owin's programming model. anyway, on cookieauthenticationoptions, there's provider property. on there's applyredirect event ca handle. in there alter redirect url.

node.js - Getting CERT_UNTRUSTED while executeing command on terminal -

i have node (v0.10.22) , npm (1.3.14) installed on system. i trying execute below command. echo "require('https').request({host: 'host.net'}, function(res){console.log(res.statuscode)}).end()" | npm_debug=https node and getting error on terminal below events.js:72 throw er; // unhandled 'error' event ^ error: cert_untrusted @ securepair.<anonymous> (tls.js:1362:32) @ securepair.eventemitter.emit (events.js:92:17) @ securepair.maybeinitfinished (tls.js:974:10) @ cleartextstream.read [as _read] (tls.js:462:15) @ cleartextstream.readable.read (_stream_readable.js:320:10) @ encryptedstream.write [as _write] (tls.js:366:25) @ dowrite (_stream_writable.js:221:10) @ writeorbuffer (_stream_writable.js:211:5) @ encryptedstream.writable.write (_stream_writable.js:180:11) @ write (_stream_readable.js:583:24) the above command working fine node (v0.6.12) not node (v0.10.22) i tr

c# - How to change date Culture of a dateTime in DataTable or from GridView? -

i have fields in database , 2 of them datetime field, retrieving via 'datatable' in gridview in below code c# code var connection = new mysqlconnection(_testmysqlconstring); string query1 = myquery; var cmd1 = new mysqlcommand(query1, connection); connection.open(); var datatable1 = new datatable(); var da1 = new mysqldataadapter(cmd1); da1.fill(datatable1); grdinvitationtenderslist.datasource = datatable1; grdinvitationtenderslist.databind(); asp code <asp:gridview id="grdlist" runat="server" allowsorting="true" autogeneratecolumns="false" datakeynames="r_number" onrowcommand="grdlist_rowcommand" > <alternatingrowstyle backcolor="white" /> <columns> .... <asp:boundfield datafield="tender_number" headertext="t_number" readonly="true" sortexpression="t_number" visibl

android - Augmented Reality 3D Model rendering -

Image
in above image i'm using opencv detect circle shape. next want display 3d circle objects rendered on such circular shapes. previously have used metaio sdk, marker based detection , 3d object rendering quite well. since opencv explains image processing, various operators sobel/canny, hough transform, gaussian filtering etc quite properly, used me markerless detection. i able detect square, quadrilateral, triangle. stuck @ next part of application i.e. 3d model rendering. e.g. since shape detected circle show 3d model below. please if can can share insight how can achieved? possible integrate metaio , opencv close meeting requirement? my application used on both android , ios devices. thanks in advance. when going through opencv tutorial, bumped across following url... 1 draws polygon has 3d effects... http://docs.opencv.org/doc/tutorials/imgproc/shapedescriptors/point_polygon_test/point_polygon_test.html#point-polygon-test the 3d modelling can done u

ruby on rails - How to add an anchor at the end of paginate url in will_paginate -

this question has answer here: how paginate combined anchor id 1 answer hello have problem while using will paginate gem.i want pagination opened under anchor tab "volunteers". the link pagination generates "/project_name?page=2" want include anchor tab in link.like link should "/project_name?page=2#volunteers" . how can link every time user clicks on next page? in projects_controller.rb def show @volunteers=@volunteers.paginate(:page => params[:page], :per_page => 3 ) end in show.html.slim =will_paginate @volunteers i got solution can add anchor links page redirects desired tab.in view replace will_paginate @volunteers will_paginate @volunteers,:container => false,:params => {:anchor => "volunteers"} this generate new url '/projects?page=2#volunteers'.

How do I commit a bugfix to a previous tag in Mercurial? -

let's i've got 2 mercurial branches: (1) default , (2) stable . push bugfixes stable , new functionality default . every , when enough functionality has been added default , default gets merged stable . stable gets tagged decent tag. sake of simplicity, let's use tags 1.0, 1.1, 1.2, 1.3 etc. now, let's release stable tag 1.3. go on development, , later on release 1.4 , 1.5. comes attention major bug exists in 1.3 (and 1,4 + 1.5), , need fix one. how best go 1.3, fix bug, , make sure bug gets applied 1.4 , 1.5? as i'm talking tags, , not branches, possible @ all? top of head, i'd somehow need roll stable's 1.3 tag, fix bug , push bug 1.3 (and forward-port bugfix 1.4 , 1.5). however, rolling tag same rolling revision. possible roll previous tag/revision , apply changes "point in time"? how best solve this? however, rolling tag same rolling revision. possible roll previous tag/revision , apply changes "point in time&qu

Android Async Task Do in Background Error -

am trying create activity connects database on local host, after user fills form form submitted localhost using asyntask.do in background method. getting error , not quite sure wrong, please need help. this logcat `01-30 06:03:10.451: e/androidruntime(1332): fatal exception: asynctask #1 01-30 06:03:10.451: e/androidruntime(1332): java.lang.runtimeexception: error occured while executing doinbackground() 01-30 06:03:10.451: e/androidruntime(1332): @ android.os.asynctask$3.done(asynctask.java:278) 01-30 06:03:10.451: e/androidruntime(1332): @ java.util.concurrent.futuretask$sync.innersetexception(futuretask.java:273) 01-30 06:03:10.451: e/androidruntime(1332): @ java.util.concurrent.futuretask.setexception(futuretask.java:124) 01-30 06:03:10.451: e/androidruntime(1332): @ java.util.concurrent.futuretask$sync.innerrun(futuretask.java:307) 01-30 06:03:10.451: e/androidruntime(1332): @ java.util.concurrent.futuretask.run(futuretask.java:137) 01-30 06:03:10

android - Linking code layout with xml layout file -

i created activity 9 grey blocks on background using following code: paint paint = new paint(); paint.setcolor(color.black); paint.setstrokewidth(5); canvas.drawline(width/3, 0, width/3, height, paint); canvas.drawline((2*width)/3, 0, (2*width)/3, height, paint); canvas.drawline(0, height/3, width, height/3, paint); canvas.drawline(0, (2*height/3), width , (2*height)/3, paint); log.d("game","in draw"); imageview imageview = new imageview(this); imageview.setimagebitmap(bitmap); layout = new relativelayout(this); relativelayout.layoutparams params = new relativelayout.layoutparams(layoutparams.wrap_content, layoutparams.wrap_content); layout.setid(1); params.addrule(relativelayout.center_in_parent); layout.addview(imageview, params); layout.setbackgroundcolor(color.black); log.d("game","before content view"); // show layout in our activity. setcon

forms - "The data has been changed" error when editing underlying record in Access VBA -

i have form in access have 2 unbound multi-select listboxes, code move items between them. each of fields in table shown in listboxes boolean values - if value true name of field shows in lstselected , , if false shows in lstunselected . the listboxes have rowsourcetype of value list, , value list generated programatically looking @ underlying record , constructing string field names boolean values true lstselected , false lstunselected . on form have 2 buttons, cmdmovetoselected , cmdmovetounselected . when click on cmdmovetoselected changes boolean value of underlying field selected items in lstunselected listbox false true executing sql string, rebuilds value lists both of listboxes. i have of working fine. if me.lstunwanted.requery , me.lstwanted.requery moves , shows correctly, , underlying fields edited correctly, when click on else on form error: the data has been changed. another user edited record , saved changes before attempted save changes.

Adapting C++ std/boost iostreams to provide cyclic write to memory block -

background: i'm trying optimize logging system uses memory-mapped files. need provide std::ostream-like interface logging system can write memory. have identified std::strstream (which deprecated though) , boost::iostreams::basic_array_sink fit needs. now want have logging cyclic, meaning when output pointer near end of memory block should start on @ beginning again. question best point start in order implement specific behaviour. i'm rather overwhelmed std::iostreams class hierarchy , don't grasp internal workings now. i'm uncertain whether should/need derive ostream, streambuf, or both? these made being derived from, anyway? or using boost:iostreams, need have write own sink? edit: following attempt compiles , produces expected output: class rollingstreambuf : public std::basic_streambuf<tchar> { public: typedef std::basic_streambuf<tchar> base; rollingstreambuf(base::char_type* baseptr, size_t size) { setp(baseptr, bas

javascript - Why the fiddle is not working and there is a time lag behind in following case? -

my fiddle link follows: http://jsfiddle.net/fvyys/2/ the function call follows: load_timer('0', '6', '9', 0, '0', '', '0'); actually issue fiddle not working. expected behaviour of code timer should decrease second second , reaches zero(i.e. example timer should start @ 00:06:09 , end @ 00:00:00). it's not working here in fiddle. code working in application don't know why code not working in fiddle. 1 more issue noticed in application timer lagging sometime behind. can please me in regard? if need further information i'll provide same. in advance. your code has following structure : var counter = delay; function loop() { counter--; displaytime(delay, counter); if (counter > 0) { settimeout( loop, 1000 ); } } 2 things : displaytime() execution takes time : example, if takes 0.2 seconds complete, loop executed every 1.2 seconds (instead of every second) settimeout(

php - How to refresh different div in same page -

i using php , mysql database website. in website have four different menu. in each menu have single div has refresh after clicking it. here refresh mean call php file has functionality insert,delete , display specific contain database. my code refreshing whole page instate of div refresh. here sample code: my mainpage.php <div> <ul id="headermenu" class="menu"> <li rel="menu1"><a href="" >about</a></li> <li rel="menu2"><a href="" class="">display</a></li> <li rel="menu3"><a href="" class="">settings</a></li> </ul> </div> <div id="menu1" class="menu_content"> <div class="right-pane"> <div class="details"> <?php include('about.php'); ?> </div>