Posts

c# - MS-Access Query Syntax -

Image
i have background of mysql. working on ms-access c#. tried following sql queries throws exception queries 1: string strsql = "select * employees orderby employeeid desc limit 1;"; oledbdataadapter adapter = new oledbdataadapter(strsql, conn); adapter.fill(dt); string strsql = "select * employees orderby employeeid asc limit 1;"; oledbdataadapter adapter = new oledbdataadapter(strsql, conn); adapter.fill(dt); common exception 1: additional information: syntax error in clause. queries 2: string strsql = "select * employees employeeid = (select min(employeeid) employees employeeid < '" + int64.parse(this.txtboxid.text) + "');"; oledbdataadapter adapter = new oledbdataadapter(strsql, conn); adapter.fill(dt); string strsql = "select * employees employeeid = (select min(employeeid) employees employeeid > '" + int64.parse(this.txtboxid.text) + "');"; oledbdataadapter adapter = new oledbdataadap...

d - Writing functions conforming template defined function prototypes -

to sheer delight discovered d has made progress , runs on windows 64 bit. has visual studio integration seems work far can see after few hours of playing new toy. so, started play d language , bloody newbie in d. in code below goal define function prototypes in template , write functions sub-functions of main() conform prototypes. compiler complains , right cannot find out how right (probably simple syntax problem). the compiler errors are: main.d(90): error: function main.actor!(int, int).worker (duration timeout, bool function(int) timeouthandler, bool function(int, int) messagehandler, int context) not callable using argument types () main.d(90): error: function main.main.w1ontimeout (int context) not callable using argument types () main.d(90): error: function main.main.w1onmessage (int context, int message) not callable using argument types () building debug\consoleapp1.exe failed! import std.stdio; import core.time; import std.socket; import st...

python - PyStruct - No matching signature find -

i'm trying use code here: https://github.com/pystruct/pystruct/blob/master/examples/multi_label.py i have x_train shape (2591, 256) , y_train shape (2591, 175) . when run this: tree = chow_liu_tree(y_train) tree_model = multilabelclf(edges=tree, inference_method="max-product") tree_ssvm = oneslackssvm(tree_model, inference_cache=50, c=.1, tol=0.01) print("fitting tree model...") tree_ssvm.fit(x_train, y_train) i got this: traceback (most recent call last): file "classifiers.py", line 173, in <module> tree_ssvm.fit(x_train, y_train) file "/usr/local/lib/python2.7/dist-packages/pystruct/learners/one_slack_ssvm.py", line 448, in fit x, y, joint_feature_gt, constraints) file "/usr/local/lib/python2.7/dist-packages/pystruct/learners/one_slack_ssvm.py", line 348, in _find_new_constraint x, y, self.w, relaxed=true) file "/usr/local/lib/python2.7/dist-packages/pystruct/models/base.py", line 9...

Replace strings in php -

i have string consists of tags <p> </p> , want replace them <br /> , whenever try using str_replace() not so. is there solution it? other possible way it? $string="<p> 1 para </p> <p> second </p>"; using: str_replace("</p> <p>","<br />",$string> nothing gets replaced. are looking this? <?php $string = "<p> 1 para </p> <p> second </p>"; $searcharray = array( '<p>' , '</p>' ); $replacearray = array( '' , '<br />' ); var_dump( str_replace($searcharray, $replacearray, $string) ); ?> output string(47) " 1 para <br /> second <br />"

c++ - Boost Build: Use a feature or a variable -

i have db integration test i'm running using boost build. test needs commandline args (db username, password). what's best way set via boost build in way that's configurable user (via environment variables, bjam commandline, user-config.jam)? i know can variables: import os ; local db_pass = [ os.environ db_pass ] ; run dbtest : test.cpp : --dbpass $(db_pass) ; this can set via commandline ( bjam -s db_pass=pass ) or via environment variable. on other hand, boost build tends of configuration via feature mechanism. define new feature , configuration data right place way. what's pros , cons of each approach? 1 should take? if features: how that? nb: actual test within jamfile that's used jamroot, not directly in root file. i use suggestion of variables. provide great deal of flexibility. don't see how "feature" in case things.

How to create a layout like Twitter profile page in Android -

Image
i developping app has page there must header followed multiple recycler views within viewpager. however, not know how "hide" header when scrolling down. the following layout not work : - recyclerview - header - slidingtablayout - viewpager - recyclerview because verticaly scrollable view cannot put inside verticaly scollable view. possible create type of layout in way because twitter did : so how 1 achieve create type of layout? theorical solution suggestion if had layout : - linearlayout - header - slidingtablayout - viewpager - recyclerview and when recyclerview scrolled, move manually every element upwards header progressively "hidden" , viewpager higher, work? because verticaly scrollable view cannot put inside verticaly scollable view that not true, can put scrollable view scrollable view. hard manage scrolling events , of times not necesseary. should not nest scrollable views. howe...

python - How to make two classes sharing a same attribute? -

i have defined class posseses attribute score matrix. let's var instance of class. i have class needs access 1 particular cell of matrix var.score . : class myclass: def __init__(self, r, c): self.cell = var.score[r][c] ... # make operations on self.cell except if self.cell modified, modification should reflect on var.score[r][c] . goal of creating self.cell , not using var.score[r][c] clarity , avoiding dragging r , c along following definition of class. i've seen solutions using wrapper mutable objects list didn't satisfied me. best solution implement ? you use property: class foo(object): def __init__(self, r, c): self.r = r self.c = c @property def cell(self): return var[self.r][self.c] @cell.setter def cell(self, val): var[self.r][self.c] = val then: >>> var = [[1, 2], [3, 4]] >>> x = foo(0, 1) >>> x.cell 2 >>> x.cell = 8 >...