Posts

Showing posts from April, 2010

rest - What is the correct way to process nested resources in a RESTful API? -

consider i'm using following restful api endpoints: /users/: show users /users/$user_id/: show specific user /users/$user_id/posts/: show posts user /users/$user_id/posts/$post_id/: show specific post user constraint in data model: post has user. by "processing nested resources" mean handling crud operations. should implement crud operations (post, put, patch, delete) on /users/$user_id/posts/ endpoint or should create endpoint /posts/ , handle crud operations there, while keeping first endpoint read-only? sorry if question exists in maybe form on so. :-) there's "fud" around restful apis. thanks in advance tips/clarifications! kind regards, k. you should implement operations on existing /posts/ , /posts/$post_id/ endpoints. there's reason make multiple endpoints represent same resources. why make them figure out can on /users/$user_id/posts/$post_id/ have go /posts/$post_id/ delete? sometimes, people implement as

html - List Items moving when window is zoomed out? -

i've been struggling couple of days. can fix problem, fixing way doesn't give me desired effect. when zoom out, 1 of list items drops next line. how can stop happening? here's fiddle, if zoom out you'll see "three" drops next line http://jsfiddle.net/j5u2q/ if remove borders .middle , increase padding it's exact same width, problem doesn't present itself? there's problem borders? #banner li.middle {padding: 0 16px; border-left: 1px solid #959595; border-right: 1px solid #959595;} thanks, try adding min-width , max-width containers. same height if need be. borders add margining element well, making many defined pixels (or zoomed in pixels) larger on each side. working fiddle

c++ - Disable OpenCV VideoWriter output -

when create video opencv's videowriter class, outputs in terminal : output #0, avi, 'video.avi': stream #0.0: video: mpeg4, yuv420p, 512x384, q=2-31, 12582 kb/s, 90k tbn, 24 tbc i'd disable have no idea how this. "mute" console while. ref . #include <iostream> #include <fstream> int main ( int argc, char** argv ) { std::streambuf* cout_sbuf = std::cout.rdbuf(); // save original sbuf std::ofstream fout("temp"); std::cout<<"a\n"; std::cout.rdbuf(fout.rdbuf()); // redirect 'cout' 'fout' std::cout<<"b\n"; std::cout.rdbuf(cout_sbuf); // restore original stream buffer std::cout<<"c\n"; return 0; } console output: a c

c - Segmentation fault error for a matrix assignment -

this code creation of grid similar of game "mines": #include <stdio.h> #include <stdlib.h> int main(){ int nr, nc, ** mtx, i, j; //matrix costruction file * instr; instr = fopen("brasa.dat","r"); if(instr == null){ printf("\nproblem while opening file.\n"); return 1; } fscanf(instr, "%d%d", &nr, &nc); mtx = (int**) malloc(nr * sizeof(int*)); if(mtx == null){ printf("\nmemory allocation error.\n"); return 1; } else{ for(i = 0; < nr; i++) mtx[i] = (int*) malloc(nc * sizeof(int)); if(mtx[i] == null){ printf("\nmemory allocation error.\n"); return 1; } } //filling matrix for(i = 0; < nr; i++){ for(j = 0; j < nc; j++) mtx[i][j] = 0; } while(!feof(instr)){ fscanf(instr,&qu

c# - Parser Error Message: Could not load type 'webmarketing' -

Image
after finishing web application , publishing online no matter try keep getting following error, keep in mind runs locally should... parser error message: not load type 'webmarketing'. i ran through solution though supposedly i'm doing same solution, yet i'm still facing same issue... asp.net parser error cannot load code behind here code behind: using system; using system.collections.generic; using system.linq; using system.web; using system.web.ui; using system.web.ui.webcontrols; namespace webmarketing { public partial class masterpage : system.web.ui.masterpage { protected void page_load(object sender, eventargs e) { string admin = (string)session["admin"]; if (string.isnullorempty(admin)) { logout.visible = false; } else { } } } } i had same problem before change codebehind codefile , wor

sql server - Visual Studio 2013 View has an unresolved reference to object -

i want add database project solution, database references other databases, not want include in solution. the visual studio collects 84 errors. i thought that, easiest solution ignoring build errors , warning database project, did not find , solution. is database project useless, if develope lot of applications lot of databases, in relation somewhere? what can now? easiest thing extract dacpac of referenced databases , indclude them db references. won't attempt build/publish them default, let continue. i had use sqlpackage.exe extract dacpac couldn't through ssms or vs interfaces if there many dependencies. wrote process on blog: http://schottsql.blogspot.com/2012/10/ssdt-external-database-references.html

Left join of subquery not working in SQL Server -

i'm having lot of trouble adding subquery in left join, when run combined query separate parts each piece works, when try run whole thing fails , i've tried fix syntax , change lettering , adding parentheses nothing seems help, query below: select * (select sales_doc_type, doc_date, sales_doc_num, sales_person_id, customer_name, shipping_method, total, subtotal, xintfreight, xsalesmancost, source, xcommisionpaid, payment_terms [vispr].[dbo].[spv3salesdocument] sales_doc_type = 'invoice' , sales_person_id = 'xx01' union select sales_doc_type, doc_date, sales_doc_num, sales_person_id, customer_name, shipping_method, total, subtotal, xintfreight,

javascript - Delete a DOM element and its associated jquery plugin and data -

first, i'm using jquery plugin on element, lets $('#myelement').useplugin(); . second, want destroy original element , plugin variables etc may still exist in js. third, create new #myelement , redo $('#myelement').useplugin(); . i'm having trouble step #2. when $('#myelement').remove() , there residual strange behavior when recreate element , instantiate plugin. fyi: plugin i'm having trouble with: http://mindmup.github.io/editable-table/ . if create table, make editable, works fine. but if delete table, recreate table, make editable, strange behavior fields editable, when hit "enter", value not save , error uncaught typeerror: cannot read property 'trigger' of undefined . i modify line in plugin: https://github.com/mindmup/editable-table/blob/master/mindmup-editabletable.js#l115 to: $(window).on('resize.mindmup', function () { now, when want remove event, remove namespace. $(window).of

r - Multiple boxplots of vector with breaks (and variable widths) -

i have vector of numeric samples. have calculated smaller vector of breaks group values. create boxplot has 1 box every interval, width of each box coming third vector, same length breaks vector. here sample data. please note real data has thousands of samples , @ least tens of breaks: v <- c(seq.int(5), seq.int(7) * 2, seq.int(4) * 3) v1 <- c(1, 6, 13) # breaks v2 <- c(5, 10, 2) # relative widths this how might make separate boxplots, ignorant of widths: boxplot(v[v1[1]:v1[2]-1]) boxplot(v[v1[2]:v1[3]-1]) boxplot(v[v1[3]:length(v)]) i solution single boxplot() call without excessive data conditioning. example, putting vector in data frame , adding column region/break number seems inelegant, i'm not yet "thinking in r", perhaps best. base r preferred, take can get. thanks. try this: v1 <- c(v1, length(v) + 1) a01 <- unlist(mapply(rep, 1:(length(v1)-1), diff(v1))) boxplot(v ~ a01, names= paste0("g", 1:(length(v1)-1)))

jsf - f:facet - there is a list of predefined names attributes? -

i have searched across web no luck, know there predefined names, such 'header' , 'footer' associated datatable, 'first' inside head tag run first metatag. there other predefined names should aware of? thanks, -m you cannot find predefined names list facets. because facets relatiad components. every components supports different facets. e.g. h:datatable supports header , footer. primefaces datatable supports header, footer , emptymessage facets. best way find supportted facets should source code of component renderers. primefaces datatablerenderer , mojarra tablerenderer

ios - add UIImage from a URL to a promotion screen in a rubymotion app -

i've had bit of trouble following docs add image promotion screen. pulling post object server contains image url. show post body image if 1 exists in post. recent attempt yields error *** terminating app due uncaught exception 'nsinvalidargumentexception', reason: '-[__nscfstring bytes]: unrecognized selector sent instance 0xa813810' when running code: class postscreen < basescreen attr_accessor :post def on_load self.title = "#{self.post['person']['name']}'s post" end def will_appear super add uilabel.new, { text: self.post['body'], font: uifont.systemfontofsize(16), left: 20, top: 100, width: 280, height: 300, text_alignment: nstextalignmentcenter, linebreakmode: uilinebreakmodewordwrap, numberoflines: 0 } if self.post['images'].length > 0 add uiimageview.new, { image: uiimage.alloc.initwithdata(self.post

visualization - Visualising logistic regression using the effects package in R -

Image
i using effects package in r plot effects of categorical , numerical predictors in binomial logistic regression estimated using lme4 package. dependent variable presence or absence of virus in individual animal , predictive factors various individual traits (eg. sex, age, month/year captured, presence of parasites, scaled mass index (smi), site random variable). when use alleffects function on regression, plots below. when compared model summary output below, can see slope of each line appears zero, regardless of estimated coefficients, , there strange going on scale of y-axes ticks , tick labels appear overwritten on same point. here code model , summary output: library(lme4) library(effects) virus1.mod<-glmer(virus1~ age + sex + month.yr + parasites + smi + (1|site) , data=virus1data, family=binomial) virus1.effects<-alleffects(virus1.mod) plot(virus1.effects, ylab="probability(infected)", rug=false) > summary(virus1.mod) generalized linear mi

php - select where clause in mysql when dynamic multiple values coming -

i able query when single value coming $mpfid . getting multiple values dynamically drop down. how query when multiple $mpfid values coming. $mpfid= ['2','9','1','3']; here have added 4 values in array based on user selection may come 1 or more. $mpfid= ['2','9','1','3']; function getpfrelatedreleaseidfromsprint($mpfid) { $getquery="select * sprint `platform_id`='".$mpfid."'"; $result=mysql_query($getquery,$this->dbcon); return $result; } please me how query when multiple values coming you can use in in where clause : select * sprint `platform_id` in ('" . implode("','",$mpfid) . "')

i want to get writen values in datagridtextcolumn on clicking button in WPF here is my code -

xaml code: <datagrid margin="37,188,-121,0" name="dgcompanies" canuseraddrows="false" canuserdeleterows="false" autogeneratecolumns="false" grid.columnspan="2" selectionchanged="dgcompanies_selectionchanged"> <datagrid.columns> <datagridtextcolumn header="name" width="220" binding="{binding name, mode=twoway}" /> <datagridtextcolumn header="address" width="220" binding="{binding address, mode=twoway}" /> <datagridtemplatecolumn header="action" width="*" visibility="visible"> <datagridtemplatecolumn.celltemplate> <datatemplate> <button name="btnupdatecompany"

android - Why my app is not available to some devices via Market? -

my app not available below listed devices samsung gt d-5330 samsung gt 7262 android:minsdkversion="8" android:targetsdkversion="19" did u added <!-- donut-specific flags allow run on dpi screens. --> <supports-screens android:anydensity="true" android:largescreens="true" android:normalscreens="true" android:smallscreens="true" android:xlargescreens="true" /> in manifest??

mysql - Php error my code doesn't work -

this question has answer here: mysqli_fetch_array()/mysqli_fetch_assoc()/mysqli_fetch_row() expects parameter 1 resource or mysqli_result, boolean given 33 answers i trying query database using php. getting following error. error: mysql_fetch_array() expects parameter 1 resource, boolean given in. i cannot find mistake did. can point out mistake have did in code? <?php $cn = new mysql(); $cn->query("select * users name 'test'"); class mysql { public function connect() { static $a = 0; if ($a==0) { $a = mysql_connect("localhost:3306","root","vistaxp64"); mysql_select_db("gecms"); } return $a; } public function query($query) { $con=$this->connect(); $qdata=mysql_query($query,$con)or die(mysql_error()); $qresult=mysql_fetch_array($qdata,mysql_as

javascript - Very strange behavior with if data-bind and file upload -

i noticed strange things happening on page use knockout power. here's situation: <div class="col-md-4"> <h3 class="">upload document</h3> <form id="document-form"> <span class="form-group"> <input type="file" name="files" value="upload" multiple="" id="input-file" style="display: none;" data-bind="event:{change: uploadfiles}" /> <label for="input-file" class="btn btn-default">select files</label> </span> </form> </div> this little area post file server whenever user added files. code uploadfiles looked this. //formnode passed viewmodel @ time of instantiation, , //the dom node represents <form></form> element self.uploadfiles = function() { self.showloading(true

java - Scale Action Bar background image proportionally -

Image
im using actionbar in android app, , customize each of tabs, put background image behing actionbar, looks following: on phone looks fine, on other phones it's squashed. how can scale actionbar proportionally based on background's ratio? there solution this? had determine height in fix dpi because if leave out, actionbar not showing up. style code following right now; <style name="myactionbar" parent="android:theme.holo.light"> <item name="android:backgroundstacked">@drawable/tab_bg</item> <item name="android:adjustviewbounds">true</item> <item name="android:scaletype">fitend</item> <item name="android:height">87dp</item> </style> update: i not know mr.t's xml code. im using basic android actionbar, , have 1 xml named menu.xml, if put code it, no effect. i tried style actionbar following, still, if not specify android:heigh

No "Function.method" in JavaScript? -

i reading book douglas crockford, , uses construct of function.method('inherits', function(parent){ this.prototype=new parent(); return this; }); if leave alone meaning of it, can't around syntax. try run in chrome, , uncaught typeerror: undefined not function test3.html:18 (anonymous function) as happens if try ( jsfiddle ) function.method("test", function () { return "test"; }); there seems post says line working, can't make work. why can be? the reason line working in the post refer to because function.prototype has been extended method: function.prototype.method = function (name, func) { this.prototype[name] = func; return this; }; if run above code , run code have, work - or can change .method .prototype[name_here] = , work same. a note on best practices if going extend prototypes in day , age better use object.defineproperty ensure method not enumerable.

javascript - jQuery Bootstrap validation not working -

i have used bootstrapvalidator.js validate page, cannot validate page. validator download link is: https://github.com/nghuuphuoc/bootstrapvalidator . possible error? im using netbeans ide. <%@page contenttype="text/html" pageencoding="utf-8"%> <html> <head> <meta name="viewport" content="width=device-width"> <link rel="stylesheet" href="https://netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css"> <link rel="stylesheet" href="validator/dist/css/bootstrapvalidator.min.css"/> <script type="text/javascript" src="validator/src/js/bootstrapvalidator.js"></script> <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/2.0.3/jquery.min.js"></script> <script type="text/javascript" src="https://netdna.bo

html - How can I prevent hover styles when element is focused -

i've created element, , when hover on it, border color changes original. there color border changes when border focused. html: <input id="colorchange" type="text"> css: #colorchange {border: thin solid white;} #colorchange:hover {border: thin solid grey;} #colorchange:focus {border: thin solid black;} the problem want border stay black when element focused, if user hovering on it. unfortunately, when hover on element when focused, element becomes gray, though want stay black. how can this? try #colorchange input[type='text']:focus{border: thin solid black;}

r - How to compare communities in two consecutive graphs -

i have same graph represented @ 2 different times, g.t0 , g.t1 . g.t1 differs g.t0 having 1 additional edge maintains same vertices. i want compare communities in g.t0 , g.t1 , is, test whether vertices moved different community t0 t1. tried following library(igraph) m <- matrix(c(0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0),nrow=4,ncol=4) g.t0 <- graph.adjacency(m) memb.t0 <- membership(edge.betweenness.community(g.t0)) v(g.t0) # vertex sequence: # [1] 1 2 3 4 memb.t0 # [1] 1 2 2 3 g.t1 <- add.edges(g.t0,c(1,2)) memb.t1 <- membership(edge.betweenness.community(g.t1)) v(g.t1) # vertex sequence: # [1] 1 2 3 4 memb.t1 # [1] 1 1 1 2 but of course problem indexing of communities start 1. in example seems vertices have moved different community, intuitive reading vertex 1 changed community, moving 2 , 3. how approach problem of counting number of vertices changed communities t0 t1? actually not easy question. in general need match communities in 2 graphs,

android - Show popup on application start only -

i want show pop every time application starts. pop should not appear again on moving previous activity. pop must appear again every time application starts. this using everytime application starts first run set false. public static firstrun; firstrun = getsharedpreferences("preference", mode_private).getboolean( "firstrun", true); if (firstrun) { //show popup. // save state getsharedpreferences("preference", mode_private).edit() .putboolean("firstrun", false).commit(); } you can pass string using bundle putextra method splash screen check on main activity if(getintent.getextra.containskey("string passed splash screen")) show pop other wise normal behaviour of application.

sql - Having count in SELECT clause -

find names of cities hosts both sales , transport departments for oracle database have table i.) deptloc //deptloc city dname --------------------- newyork newyork computer london science london sales london transport for sql select statement select city deptloc deptloc.dname='sales' or deptloc.dname='transport' group city having count(*)=2; the output display no rows selected. my output should be dname -------- london for things this, try use simple join same table. first, have index on table (city, dname).. then select d.city deptloc d join deptloc d2 on d.city = d2.city , d2.dname = 'transport' d.dname = 'sales' it may strange, think it. outer portion clause cares cities have 1 of qualifiers. why count cities dont have that. so, join. since know first qualifier on sales covered, re-join dept loc table again, on same city

java - Inserting multiple rows in mysql Db and retrieving same rows after successfully in one query store procedure -

table t1. want write such store procedure take array of string. insert string 1 one in t1 using loop. after 1 insertion should store id of inserted row in temp variable. , after insertion should return inserted id's. i calling stored procedure java. can 1 me solve problem?. thnaks in advance.

css - Edit search results template in Wordpress -

i have created page template nice layout using lovely custom fields plugin client can update content. i created loop on page template displays relevant information nicely; here loop made: <?php $args = array( 'post_type' => 'cripps_staff', 'posts_per_page' => 300 ); $loop = new wp_query( $args ); while ( $loop->have_posts() ) : $loop->the_post(); echo '<div class="col-md-3 spacetop">'; echo '<a href="'.get_permalink().'">'; echo get_post_meta($post->id,'image',true); echo '</a>'; echo '<h2 class="staffname">'; echo get_post_meta($post->id,'staff_name',true); echo '</h2>'; echo '<h2 class="staffrole">'; echo get_post_meta($post->id,'staff_role',true); echo '</h2>'; echo '<h2 class="staff

android - Change Fragment dynamic -

i have 2 questions. first, can me someone, why not works? try change fragment, nothing. see first fragment. mainactivity: ... if (savedinstancestate == null) { fm.begintransaction() .add(r.id.firstfragment, new firstfragment()).commit(); } findviewbyid(r.id.button1).setonclicklistener(new onclicklistener() { @override public void onclick(view v) { switchfragment(r.id.firstfragment, new firstfragment()); } }); findviewbyid(r.id.button2).setonclicklistener(new onclicklistener() { @override public void onclick(view v) { switchfragment(r.id.secondfragment, new secondfragment()); } }); } private void switchfragment(int fragid, fragment frag){ fragmenttransaction ft = getsupportfragmentmanager().begintransaction(); ft.replace(fragid, frag); ft.commit(); } fragments in main.xml: <fragment android:id="@+id/firstfragment" androi

ruby on rails - An Hash with aggregation framework -

i using rails mongoid, syntax language. my mongodb objects these: { "_id" : "asset01_*00001", "total" : 124 ...}, { "_id" : "asset01_*00002", "total" : 99 ...}, {...} the project operator is: {"project" => {"_id" => 1, "pair" => {"$add" => {"$_id" => "$total"}} }} and group operator is: {"$group" => { "invoice" => { "$push" => "$pair"} }} but throws following error: the $add operator not accept object operand i know meaning of error, have alternative problem? the result is: { "_id" => 1, "pair" => {"asset01_*00001" => 124, "asset01_*00002" => 99 ... } a hash of {asset_id => number} thanks you want transform field values keys in results. unfortunately that's not possible, there a feature request it can

php - Laravel Controller load files due to ClassLoader and incorrect composer files -

ok, newbie @ laravel. used composer download laravel. created directory structure like... vendor\laravel\laravel\app vendor\laravel\laravel\bootstrap vendor\laravel\laravel\public vendor\laravel\framework\.... vendor\laravel\laravel\composer.json along many other vendor , laravel directories. and initial composer.json file in root directory. i moved contents of vendor\laravel\laravel directory top level have directory structure like... app\... bootstrap\... public\... vendor\laravel\framework\... composer.json vendor\ many other directories... i updated index.php directory referred new locations of bootstrap\autoload.php , bootstrap\start.php directories. i can load index.php , laravel image map signifying working. so, go , modify routes.php be... route::controller('home', 'homecontroller'); and try load home directory. error... "include(d:\dev\wamp\www\ltest3\vendor/laravel/laravel/app/controllers/basecontrol

Add link to text in neos beta 1.0.2 -

i new typo3 neos. using neos version 1.0.2 when try add links custom content types link not proper , appears thing below.for external urls works fine. node://06fbba05-82f1-e0b4-0e5e-4549e7aa4d11 how can add target blank external urls , mailto link emails? thank in advance. you need apply converter text changes internal presentation of link real link. examples in: packages/application/typo3.neos.nodetypes/resources/private/typoscript/root.ts2 basically if custom node type has property "text", do: text.@process.converturis = typo3.neos:converturis in typoscript prototype. i think mailto: should work typing mailto:foo@bar.com link box. setting different targets not supported out of box, done custom processor.

jsf - how to show hide a h:panelgroup while click on a radio button -

i working on problem want show , hide fields under same <td> depending upon user option. condition when user clicks on customer radio button have show input fields related customer , when clicks on seller option radio button have show him seller related information. default displaying panelgroup containing information related customer code follows <h:panelgroup id="customnerpanel" rendered="#{salebean.salevo.persontype == 1}"> input fields related customer goes here </h:panelgroup> <h:panelgroup id="sellerpanel" rendered="#{salebean.salevo.persontype == 2}"> input fields related seller goes here </h:panelgroup> now problem on page load shows me customer panel correct, when change radio button seller radio button should hide custoimer panel , show me seller panel rerendering both panels on change of radio buttons. radiobuttons related code follwos: <h:selectoneradio id="radiochangetenurebutton&q

Excel 2007 VBA script to look up intranet? -

Image
please bare me, not proficient @ programming or using excel formulae... the problem have 2 suppliers gyros have on particular machine. different suppliers have gyros on different parts of machine want interrogate historic failures of different ones can make recommendation use 1 or other. the company intranet allows me extract shift information can gather following information: i want through different shifts "6-2", "2-10", "10-6" everyday back, 6 months or so. i automate this. want find every occurrence of word "gyro","giro","gyros","giros","gyroes","giroes","gyro's" , "giro's" , copy text in box. example below: i want store information on excel workbook, along date , shift time top of page. possible?

php - Laravel 4.1 shared host weird behaviour -

i having troubles deploying laravel shared hosting. have point out have been doing kind of deployment many times , never encountered error this. new hosting company using , first laravel application ever on gues problem them. here error getting: https://www.premiumrewardsclub.com/new/ and heres phpinfo: https://www.premiumrewardsclub.com/phpinfo.php the paths correct think, otherwise getting file not found error, third day of debugging app not 100% sure rule out paths error. saying. i couldn't find useful after days of research on error, please if has clues this, point me in direction because out of ideas.. thank you! edit: if thats of help, have come conclusion application gets bootstrapped dies here: $framework = $app['path.base']. '/vendor/laravel/framework/src'; require $framework.'/illuminate/foundation/start.php'; dd($app['path.base']); returns bool(false); the strange thing return value of dd($app);

javascript - can't getting textarea value using AngularJs -

<tr class="labels"> <td nowrap="nowrap">address</td> <td nowrap="nowrap"><label for="tbaddress"></label> <textarea name="tbaddress" id="tbaddress" cols="39" rows="5" ng-model="$parent.tbaddress"></textarea> </td> </tr> <tr> <td>&nbsp;</td> <td align="right"> <input type="submit" name="button" id="button" value="submit record" class="btns" /> <input type="reset" name="button2" id="button2" value="cancel" class="btns" /> </td> </tr> i'm not able textarea value using angularjs. input text fields getting through controller except textarea . doing wrong ? alert($scope.tbaddress); var thisdata = { 'name': $scop

java - Purpose of having custom annotations -

some projects using of custom annotations below. example below. please explain me when should take decision have custom annotations. role of @target & @retention annotation attributes is better use import java.lang.annotation.target , import java.lang.annotation.retention or hibernate specific annotations below @entity @table(name = "creditcard") @creditcardentity public class creditcard implements java.io.serializable {} import java.lang.annotation.elementtype; import java.lang.annotation.retention; import java.lang.annotation.retentionpolicy; import java.lang.annotation.target; import org.hibernate.validator.validatorclass; @target( { elementtype.type }) @retention(retentionpolicy.runtime) public @interface creditcardentity {} } if plan use same annotations on more 1 place in code, it's idea use custom annotations. example, in case, if use @entity @table(name = "creditcard") in place, it's idea unite them under 1 annotati

java - MySQLSyntaxErrorException: Error in SQL Syntax -

Image
please have @ following code public int insert(int index, string hashword) { string str=""; int result=0; int returnresult=0; try { con.setautocommit(false); preparedstatement ps = con.preparestatement("insert key_word (key,hashed_word) values(?,?)"); ps.setint(1, index); ps.setstring(2, hashword); result = ps.executeupdate(); con.commit(); if(result>0) { returnresult = 1; } else { returnresult = -1; system.out.println( index+" failed update"); } } catch(sqlexception s) { returnresult = -1; s.printstacktrace(); try { con.rollback(); system.out.println(index+" exception occured. update failed"); }

Error in starting the neo4j Server (Neography, Ruby) -

the server stopped work , on restarting gave following error. couldn't find related online. idea wrong , how resolve this? org.neo4j.server.logging.logger log severe: org.neo4j.server.serverstartupexception: starting neo4j server failed: active marked 1 no data/graph.db/nioneo_logical.log.1 exist @ org.neo4j.server.abstractneoserver.start(abstractneoserver.java:218) @ org.neo4j.server.bootstrapper.start(bootstrapper.java:87) @ org.neo4j.server.bootstrapper.main(bootstrapper.java:50) caused by: java.lang.illegalstateexception: active marked 1 no data/graph.db/nioneo_logical.log.1 exist @ org.neo4j.kernel.impl.transaction.xaframework.xalogicallogfiles.determinestate(xalogicallogfiles.java:138) @ org.neo4j.kernel.impl.recovery.storerecoverer.recoveryneededat(storerecoverer.java:65) @ org.neo4j.server.preflight.performrecoveryifnecessary.run(performrecoveryifnecessary.java:56) @ org.neo4j.server.preflight.preflighttasks.run(preflight

python - Filtering on data with a cast string->float type -

a few issues here think code relatively straight forward. the code follows: import pandas pd def establishadjustmentfactor(df): df['adjfactor']=df['adj close']/df['close']; df['chgfactor']=df['adjfactor']/df['adjfactor'].shift(1); return df; def yahoofinanceaccessor(ticker,year_,month_,day_): import datetime = datetime.datetime.now() month = str(int(now.strftime("%m"))-1) day = str(int(now.strftime("%d"))+1) year = str(int(now.strftime("%y"))) data = pd.read_csv('/users/mydir/downloads/' + ticker + '.csv'); data['date']=float(str(data['date']).replace('-','')); data.set_index('date') data=data.sort(['date'],ascending=[1]); return data def calculatel

WSO2 BAM summary tables for API manager not being populated -

i have installed api manager , bam products view api manager statistics. looking @ bam tables, can see data populated apirequestdata , apiresponsedata none of summary data tables being populated. the am_stats_analyzer_xxx script scheduled run. have tried running insert script manually. when ran manually following query, didn't populate apirequestsummarydata table either. however, when executed "select portion" of query, did bring result set. insert overwrite table apirequestsummarydata select api, api_version,version, apipublisher, consumerkey,userid,context,max(requesttime) max_request_time,sum(request) total_request_count,hostname, year(from_unixtime(cast(requesttime/1000 bigint),'yyyy-mm-dd hh:mm:ss.sss' )) year, month(from_unixtime(cast(requesttime/1000 bigint),'yyyy-mm-dd hh:mm:ss.sss' )) month,day(from_unixtime(cast(requesttime/1000 bigint),'yyyy-mm-dd hh:mm:ss.sss' )) day,concat(substring(from_unixtime(cast(requesttime/1000 bigint

statistics - How to generate observations from a linear model in R -

Image
i have been trying verify ols estimators consistent under usual assumptions. could please tell me how generate observations linear model afterwards can run regression on data , verify desirable properties of ols? thank in advance, not clear if want?? # sample data: x1 , x2 uncorrelated df <- data.frame(x1=sample(1:100,100),x2=sample(1:100,100)) # y = 1 +2.5*x1 - 3.2*x2 + n(0,5) df$y <- with(df,1 + 2.5*x1 -3.2*x2 + rnorm(100,0,5)) fit <- lm(y~x1+x2, data=df) summary(fit) #... # residuals: # min 1q median 3q max # -9.8951 -2.6056 -0.4384 3.6082 9.5044 # coefficients: # estimate std. error t value pr(>|t|) # (intercept) 1.954 1.263 1.548 0.125 # x1 2.516 0.016 157.257 <2e-16 *** # x2 -3.237 0.016 -202.306 <2e-16 *** # --- # signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 # residual standard error: 4.611 on 97 degrees of freedom # multiple r

php - MySQL Database saving 0 values -

i have form take statistics course registration @ university , 1 of fields "studentid" connecting form database seems successful , primary field auto increment working fine , entering student id , submitting form fails every time , new record added "0" value ... this html code <div class="content"> <form action="connect-mysql.php" method="post" enctype="text/plain" id="form3" name="form3" method="post"> <table width="100%" border="0"> <tr> <td width="50%" bgcolor="#e3e3e3"><center> student id : </center></td> <td width="50%" bgcolor="#e3e3e3"> <span id="sprytextfield1"> <label for="studentid"></label> <input name="studentid" type="text"

relativelayout - Android View/Layout Masking -

i have application has requirement entire relativelayout (which custom view extending it) needs masked using custom image. there many views in layout need accessed touches , dynamic. i have masked region drawing shapes using answer question: @override protected void dispatchdraw(canvas canvas) { path path = new path(); int count = canvas.save(); path.addcircle(400, 200, 300, path.direction.cw); canvas.clippath(path); super.dispatchdraw(canvas); canvas.restoretocount(count); } however, need use image source mask source instead of shape can author. have used porterduff toolkit alter bitmap: bitmap resizedbitmap = bitmap.createscaledbitmap(mmask, this.getwidth(), this.getheight(), false); bitmap result = bitmap.createbitmap(this.getwidth(), this.getheight(), bitmap.config.argb_8888); //create bitmap same height canvas mcanvas = new canvas(result); paint paint = new paint(paint.anti_alias_flag); paint.setxfermode(new porterduff

database - Python & Postgres: would psycopg2.connect lock the table? -

i running python script etl(extract, transform, load) , put psql queries in 1 transaction. here's transaction: conn = psycopg2.connect(...) try: cur = conn.cursor() #q1 cur.execute("create temp table tt (like t including defaults)") #q2 cur.execute("copy tt '/file.csv' delimiter ',' csv header ") #q3 cur.execute("...") #q4, update t based on data tt conn.commit() except: conn.rollback() i know table locked when running q4, i'm not sure if table locked during whole transaction(from connect commit)? is there way test if table locked? don't have of data right (about 100 rows).. thanks much! i know table locked when running q4, i'm not sure if table locked during whole transaction(from connect commit)? locks taken when first required, , released @ transaction commit, not before. so in case, don't access t until q4 , that's when lock taken. update takes row exclusiv

c++ - Modify QStatusBar in QMainWindow without deleting it -

i'm confronted big problem actually, had qtabwidget contains multiple qwidget-herited object named tab , change qstatusbar in function of qtabwidget index qmainwindow delete qstatusbar (which in tab object) each time change tabs , causes application crash. here code mainwindow.h #ifndef tab_h #define tab_h #include <qtwidgets> class tab : public qwidget { public: tab(int id); qstatusbar *sbar; private: }; #endif // tab_h mainwindow.cpp #include "mainwindow.h" #include "tab.h" mainwindow::mainwindow() { tabs = new qtabwidget(); resize(800, 600); connect(tabs, signal(currentchanged(int)), this, slot(currentchanged(int))); for(int = 0; < 20; i++) { tabs->addtab(new tab(i), qstring("%1").arg(i)); } setcentralwidget(tabs); } mainwindow::~mainwindow() { } void mainwindow::currentchanged(int) { tab *thistab = static_cast<tab*>(sender()); setstatusbar(new qstatusbar()); } tab.h #ifndef tab_h #de

native - How can I package a binary in Maven so that other projects can depend on it at compile time? -

i want build maven artifact contains executable native binaries other maven projects can depend on artifact , refer binaries @ build time. i've looked @ maven-assembler-plugin , appears promising, i'm not sure how going end end. if tell package dir i'll still need way tell clients depend on artifact , have cause binaries pulled in , put in well-defined location. some specifics might help. want put various platform versions of thrift compiler artifact. want clients depend on artifact , use maven-thrift-plugin execute binary thrift compiler appropriate platform generate java code built java compiler. the maven-assembly-plugin should sufficient package native binaries archive. clients can use unpack goal of maven-dependency-plugin unpack archive given directory, e.g. current target . then need maven plugin knows how run native binaries , pick them given directory.

linux - wget within the server not working -

i can download file outside server using wget, wget http://domainname.com/test.php http request sent, awaiting response... 200 ok length: unspecified [application/octet-stream] saving to: `test.php' but when try download same file within server, http request sent, awaiting response... 404 not found 2014-04-26 03:24:32 error 404: not found. i can understand domain resolves ip , goes default path & showing 404. is there option wget stop domain resolves ip.

Sum of null columns in SQL -

i have table a, b , c allow null values. select a, b, c, + b + c 'sum' table if a, b , c values 10, null , null , sum column shows nothing in it. is there way fix this, , display sum 10? other converting null s zeros? you use sql coalesce uses value in column, or alternative value if column null so sum ( coalesce(a,0) + coalesce(b,0) + coalesce(c,0))

asp.net mvc - Dynamic state city drop down list in mvc -

i have gone half mad trying figure out wrong code,so need here, code works fine ,actually code dynamically gets forms 2 dropdownlists ,one state , 1 city when select state corresponding cities populated db in city dropdownlist!,the state dropdownlist populated states city dropdownlist populated undefined options!,this basic problem facing,i pasting code also,maybe figure out wrong it! homecontroller public class homecontroller : controller { // // get: /home/ dataclasses1datacontext dd = new dataclasses1datacontext(); public actionresult index() { viewbag.state = dd.tb_statecities.select(m => new selectlistitem { text = m.state }).distinct().tolist(); return view(); } public actionresult city(string state) { var v = dd.tb_statecities.where(m => m.state == state).select(m => m.city).tolist(); return json(v, jsonrequestbehavior.allowget); } } index.cshtml <script src="~/scripts/jquery-1

asp.net - Cannot store List objects into viewstate -

i trying store temporary list data can let user edit them before save database. public list<scheduleentry> newscheduleentry { { string persistentname = "list_scheduleentry"; if (viewstate[persistentname] == null || !(viewstate[persistentname] list<scheduleentry>)) { viewstate[persistentname] = new list<scheduleentry>(); } return viewstate[persistentname] list<scheduleentry>; } } public list<scheduleentry> listview_coursescheduleentry_getdata() { return newscheduleentry; } this not first time use technic not working. there no exception , can see listview_coursescheduleentry_getdata run until return statement. but if change viewstate session (no other change) , works fine. unfortunately should not use session here, since page transaction. is possible viewstate's base64 encoding string broken list data? in contrast values stored in session memory, classes

ios - UIPickerview display more options (rows) -

i couldn't find anywhere... i have option expand bit uipickerview show more 5 (almost 7) rows displays. numberofrowsincomponent 20-30 in case if able show user more, nicer i can't that? from uikit documentation : appearance of picker views (programmatic) you cannot customize appearance of picker views.

bluetooth - Bluez on Raspberry Pi: No such device -

i trying install , run bluez on raspberry pi. using cambridge silicon radio bluetooth device. set when check device using "hcitool dev", not showing device. when search showing "no such device". "lsusb" detects device , bluetooth running. please help. went through many links couldn't find solution problem.

java - Why am I getting a NullPointerException when I try to get data from a getter? -

edit: ok here full code since guys asking : import javax.swing.*; import java.awt.*; public class panel extends jpanel { private jtextfield username_field; private jtextfield skype_field; private jtextfield raidcall_field; private jtextfield teamspeak_field; private jcombobox server_combobox; private jcombobox levels_combobox; private jcombobox mytier_combobox; private jcombobox mydiv_combobox; private jcombobox partner_tier_combobox; private jcombobox partner_div_combobox; private jcombobox myrole_combobox; private jcombobox partner_role_combobox; private jradiobutton normal,ranked; private string region; private string tier; private string division; private string skype; private string raidcall; private string teamspeak; private string partner_role; private int mode; public panel(appui.panels panel){ string star = "<span style='color:#ff0000;'>*</span>"; switch (panel) { case northpanel : setbackground(color.gethsb