Posts

Showing posts from July, 2010

c# - How to fix ExecuteNonQuery error -

an exception thrown on executenonquery , how can fix it? string sqlquery = "insert transaction(id,item_name,quantity,price,t_date) values (?,?,?,?,?)"; using (oledbconnection conn = new oledbconnection("provider=microsoft.ace.oledb.12.0;data source=|datadirectory|\\kcdb.accdb")) using (oledbcommand cmd = new oledbcommand(sqlquery, conn)) { conn.open(); cmd.parameters.addwithvalue("@id", id); cmd.parameters.addwithvalue("@item_name", item.tostring()); cmd.parameters.addwithvalue("@quantity", quantity); cmd.parameters.addwithvalue("@price", price); cmd.parameters.addwithvalue("@t_date", dt.tostring()); cmd.executenonquery(); } for guiding you, need exception , because there different reasons of failure. can see in code there casts in assigning value parameters, when parameter of datetime type should pass datetime value not string. think should change cmd.parameters.addwithvalu

php - Save and Show Google Maps image -

i have website (guidemanche.com) loads static maps images directly googlemaps. works fine if connected internet. if disconnected, or in case of site copy on cd, no more image. so, dl image created, store on server , display in page jpg file. doesn't work , have black image. my code is: <?php $url="http://maps.google.com/maps/api/staticmap?center=[(#latitude|scannav)],[(#longitude|scannav)]&zoom=14&size=450x400&maptype=hybrid&format=jpg&markers=color:blue|label:w|[(#latitude|scannav)],[(#longitude|scannav)]&sensor=false"; $filename="googleimg/#id_article.jpg"; if (!$handle = fopen($url, 'r')) { echo "impossible d'ouvrir le fichier ($filename)"; exit; } $contents = stream_get_contents($handle); fclose($handle); $handle2=fopen($filename, 'w'); // ecrivons quelque chose dans notre fichier. if (fwrite($handle2, $contents) == false) { echo "impossible d'écrire dans le fichier ($filename)&qu

c++ - CVcapture From 2 WebCams -

Image
i taking input camera. more clear added photo: 2 cameras connected on same usb port with opencv following : #define camleft 2 #define camright 0 #define win_l "win_l" #define win_r "win_r" int main(int argc, const char * argv[]) { videocapture capleft(camleft); bool opened = capleft.isopened(); if(!opened /*|| !capright.isopened()*/) // check if succeeded return -1; mat edges; namedwindow(win_l,1); for(;;) { mat framel; mat framer; capleft >> framel; // new frame camera cvtcolor(framel, edges, cv_rgb2rgba); imshow(win_l, edges); if(waitkey(30) >= 0) break; } return 0; } so creating window named "win_l" stands window left , process video capture. works well. upgraded code support camera this: int main(int argc, const char * argv[]) { videocapture capleft(camleft); videocapture capright(camright); bool opened = capleft.isopened(); if(!opened

php - Can't use method return value in write context in -

if try this: $title = $this->fullsearchform->get('title')->getvalue(); if(!empty($title)) { echo "ok"; } evrything ok. but below case if(!empty($this->fullsearchform->get('title')->getvalue())) { echo "ok"; } i error can't use method return value in write context in my php debian stable whezzy php 5.4.4-14+deb7u8 (cli) (built: feb 17 2014 09:18:47) answer in context, should using: if( $this->fullsearchform->get('title')->getvalue()) { echo 'ok'; } because empty checks if variable set , not falsy, function's return value "set" it's check falsiness. empty operates on variables, not functions.

php - Zend Framework: Using controller method in view to call model method -

i've got little problem here. have category_id every product in db. have category table in db categories , id. need put in view together. i've made add, edit , delete action, show action, category showed rest of product description. have problem index action. in show did this: public function getproducttable() { if (!$this->producttable) { $sm = $this->getservicelocator(); $this->producttable = $sm->get('product\model\producttable'); } return $this->producttable; } public function getcategorytable() { if(!$this->categorytable){ $this->categorytable = $this->getservicelocator() ->get('product\model\categorytable'); } return $this->categorytable; } public function showaction() { $id = (int) $this->params()->fromroute('id', 0); if (!$id) { return $this->redirect()->toroute('product', array( 'action

html - pass php variable value to javascript variable -

i trying pass values in variable of php retrieved .csv file javascript variable. variable of javascript null values. can 1 me value in java script variable. php tags <?php $i=0; $handle = fopen("./uploads/csv_temp.csv", "r"); while (!feof($handle) ) { $line_of_text = fgetcsv($handle, 1024, ","); $json['json_'] = $line_of_text[0]; $a= $json['json_']; // $a= $line_of_text[0]; // echo $json['json_']; $json = json_encode ( $a, json_force_object ); echo $a; } ?> <html> <head></head> <body> <script> var abc= " <?php echo $a; ?> "; </script> </body> </html> it looks need call json_encode on $json['json'] before pass $a, encode after have passed array $a <?php $i=0; $handle = fopen("./uploads/csv_temp.csv", "r"); while (!feof

PHP methods as functions // change scope -

i have class such as class myclass { function mymethod(){ include(something); } function callme(){ } } i want call callme() from include rather than $this->callme(); i hope makes sense? something this? class myclass { public function mymethod(){ include(something); } public function callme(){ } } some other php file: include 'myclass.php'; $myclass = new myclass(); $myclass->callme();

When did Git stop automatically treating nested repositories as simple subdirectories and is this behavior supported in any way anymore? -

so know git submodules , subtrees. used able have nested full git repositories treated nothing simple filesystem subdirectories? for example, given: topdir/ file1 file2 subdir1/ file1 file2 subdir2/ file1 file2 subdir3/ .git/ file1 file2 previously, executing: $ git init && git commit -a . in topdir result in files of subdir3 being committed raw or literal subdirectory (i.e. not submodule), '.git' directory in subdirectory ignored in super- or top-level repository. entering subdir3 make subdir3/.git current repository. with 1.8.2.1.501, there not seem way behavior back. running above command results in subdir3 being considered submodule but, perversely not added index. have explicitly git submodule add add files under main repo. when did change happen? is there way old behavior back, i.e., have subdirectory treated regular directory, , not git submodule or subtree?

php - HTML dependent drop down menu -

i have 2 drop down list in htmk page taking values database. i want second dropdown menu dependent on value selected on first drop down menu. i trying insert value of first drop down menu mysql query of second drop down menu wondering how can done.can pls me out our suggest better way implement this. <?php include './connection.php'; $query1 = "select * cities"; $result1 = mysql_query($query1); echo '<select name="city" id="city">'; echo '<option value="">select...</option>'; while($row1 = mysql_fetch_assoc($result1)) { echo '<option value="' . $row1['name'] . '">'; echo $row1['name']; echo '</option>'; } echo '</select>'; $query2 = "select * cities_areas city="<value selected in first dropdown list>"; $result2 = mysql_query($query2); echo '<select name="area" id="ar

Detect full screen in android from service -

i have service creates system overlay window (always on top) facebook messenger. need hide window when application in full screen mode. however, don't know how detect service. this how add view in service: windowmanager windowmanager = (windowmanager) getsystemservice(window_service); windowmanager.layoutparams params = new windowmanager.layoutparams( windowmanager.layoutparams.wrap_content, windowmanager.layoutparams.wrap_content, windowmanager.layoutparams.type_phone, windowmanager.layoutparams.flag_not_focusable, pixelformat.translucent); windowmanager.addview(myview, params); i've had same problem while ago (see: receiving hidden status bar/entering full screen activity event on service ). i've solved adding view window manager , control y position of view check if status bar visible or not.

php - Laravel Eloquent ORM Conditional Relation -

i can't seem figure out. i have 3 tables: user, experience, level (simplified) user: {id, string:name} experience: {id, user_id, int:amount} level: {id, string:level, int:experience} //user class public function experiences(){ return $this->hasmany('experience', 'user_id'); } there no database relations between experience , level. how level, this: public function level(){ return $this->experiences()->has('level.experience', '<', $this->experiences()->sum('amount'))->first(); } i know how write join, i'd rather have eloquent me. example data: user: {1, 'userone'} experience: {1, 1, 10} level: {1, 'levelone', 5} this user have level "levelone" - because sum of experience 10, , above level_id 1 minimum experience 5. so have done, solve problem. my user model: public static function getlevel($experience){ $level = level::where('experience

java - JDBC connection pool to MySQL on OpenShift -

first of all, i'm computer science student, , i'm not computer science world yet (i.e. i've little experience doing stuff on own). sorry not having knowledge possible on it. then, in 1 of classes learnt how create web application java (jsp, beans, etc.) plus client-side stuff (html, css, javascript, ect.). i work on netbeans ide. to connect mysql database, use connection pooling in way: 1) add mysql jdbc driver jar 2) dbconnect.java java class method returns connection: public static connection getconnection() { /* jndi query locate datasource object */ context initcontext; try { initcontext = new initialcontext(); context envcontext = (context) initcontext.lookup("java:/comp/env"); // jndi standard naming root datasource ds = (datasource) envcontext.lookup("jdbc/aname"); /* ask datasource connection */ connection conn; try { conn = ds.getconnection(); re

scroll - Floating menu bars sticks to top when scrolling up, the one replaces the other jquery -

the other day found javascript code, , i'm not @ javascript need help. issue make website kind of instagram app. have made example pictures. http://i.imgur.com/tidi2ct.jpg imagine picture left first, middle second, , right third. at website have top logo, , when header 1 reaches top stays @ top. found code this, need when scroll, header 2 pushes header 1 away or moves in front of header 1. this code found, doesn't work when have more 1 bars should fixed @ top when reaches top. thanks $(window).scroll(function(e) var scroller_anchor = $(".scroller_anchor").offset().top; if ($(this).scrolltop() >= scroller_anchor && $('.scroller').css('position') != 'fixed') { $('.scroller').css({ 'background': 'white', 'position': 'fixed', 'top': '0px' }); $('.scro

css - How to change pictures without leave the webpage in html? -

i'm making html page, in have several small button pictures array vertically on left side, , huge picture on right side. when click left side button pictures, right side huge picture should change correspond button. i know use can show pictures in different areas. i've no idea how change picture clicking picture. how it? i know how change now! reviewing own html code written months before, i've got idea. you can add target attribute in <'a'> label point iframe target! can click picture or txt change content in iframe. for example: <a href="/html/pink.html" target="iframe">pink world</a> when click "pink world" text, you'll change content of iframe content of pink.html under /html document. just simple!

java - How to count position of empty row? -

i've got flat file this: [doc] date=14.01.15 symbol=muka [content] [pos1] name=muka2,0 0,9l ml [doc] date=14.01.15 symbol=muka [content] [doc] date=14.01.15 symbol=muka [content] [pos1] name=muka2,0 0,9l ml i want delete [doc] statement content empty. i'm trying checking line have string "[content]" , next line empty. want number of line (number of row line empty after "[content]") , add list. [doc] empty [content] part have 4 lines. when [content] position can substract 4 , delete lines between position , position -4. the file after execution have this: [doc] date=14.01.15 symbol=muka [content] [pos1] name=muka2,0 0,9l ml [doc] date=14.01.15 symbol=muka [content] [pos1] name=muka2,0 0,9l ml i'm trying function: public void countdesiredlines() throws ioexception { bufferedreader reader = new bufferedreader(new filereader( "d:\\temp.txt")); int lines = 0; boolean zawiera = false; while (reader.rea

ruby on rails - Validation error involving numericality -

i working validations first time , i'm trying validate amount_spent , no_of_purchases field takes in integers , not strings. 200 valid 'two-hundred' wouldn't be. however, when try test, string part fails i'm unsure why. here snippet of rspec test file: it 'requires # of purchases' customer = customer.new(valid_customer.merge(no_of_purchases: '')) customer_2 = customer.new(valid_customer.merge(no_of_purchases: 0)) customer_3 = customer.new(valid_customer.merge(no_of_purchases: 'twenty')) expect(customer).to_not be_valid expect(customer.errors[:no_of_purchases]).to include "can't blank" expect(customer_2).to be_valid expect(customer_3).to_not be_valid expect(customer_3.errors[:no_of_purchases]).to include "is not number" end 'requires amount spent' customer = customer.new(valid_customer.merge(amount_spent: '')) customer_2 = customer.new(valid_customer.merge(no_of_purchases: 0))

c# - Selected item is null when listview looses focus -

i'm having problem listview in wpf. have: <listview style="{dynamicresource virtualisedmetrolistview}" selecteditem="{binding selectedcode}" ....... > <i:interaction.triggers> <i:eventtrigger eventname="selectionchanged"> <toolkit:eventtocommand command="{binding selectionchangedcommand}" passeventargstocommand="true"></toolkit:eventtocommand> </i:eventtrigger> </i:interaction.triggers> <listview.resources> <solidcolorbrush x:key="{x:static systemcolors.highlightbrushkey}" color="transparent" /> <solidcolorbrush x:key="{x:static systemcolors.highlighttextbrushkey}" color="black" /> </listview.resources> <listview.cachemode>

jquery - Javascript animation speed -

i have stolen code below try work out how can build similar. not see can adjust speed of animation. i.e. code image moving left right, moving slowly. <canvas id="canvas" width=1200 height=300></canvas> <script> window.requestanimframe = (function(){ return window.requestanimationframe || window.webkitrequestanimationframe || window.mozrequestanimationframe || window.orequestanimationframe || window.msrequestanimationframe || function( callback ){ window.settimeout(callback, 1000 / 120); }; })(); var canvas = document.getelementbyid("canvas"), cx = canvas.getcontext("2d"); function card(x,y){ this.x = x || -300; this.y = y || 0; this.img=new image(); this.init=function(){ // makes mycard available in img.onload function // otherwise "this" inside img.onload refers img var self=this; this.img.onload = function() { self.draw(); loop(

javascript - Angualrjs factor is not working -

i have js var app = angular.module('myapp', []); app.factory('data', function () { return {message: "i data service"} }) app.controller('firstctrl', function ($scope, data) { $scope.data = data; }) app.controller('secondctrl', function ($scope) { }) and html <!doctype html> <html ng-app="myapp"> <head> <title>index</title> <script src="scripts/angular.js"></script> <script src="scripts/index.js"></script> </head> <body> <div ng-controller="firstctrl" > <input type="text" ng-model="message"/> <h2>{{message}}</h2> </div> <div ng-controller="secondctrl" > <input type="text" ng-model="message"/> <h2>{{message}}</h2> </div> </body> </html>

c++ - Count numbers in range divisible by K with a sum of digits in range -

i have such task: let's call number "lucky" if divisible k , sum of digits lays in [p, q]. count quantity of "lucky" numbers in [a, b]. 1 ≤ a, b < 10^11, 1 ≤ p, q ≤ 99, 1 ≤ k ≤ 10^11. time each test - 5 seconds here code #include <iostream> #include <fstream> using namespace std; int sum; long long k; int number[10]; int digits[10]; int p; int q; long long a; long long b; int delta; bool flag = false; long long memory[100000][100][10][2]; long long pow (int a, int b) { long long res = 1; for(int = 0; < b; i++) res *= a; return res; } int sumofdigits(long long number) { int sum = 0; while(number != 0) { sum += number % 10; number /= 10; } return sum; } long long tolong(int digits[], int n) { long long sum = 0; for(int = 0; < n; i++) { sum *= 10; sum += digits[i]; } return sum; } long long function(long long remainder// remainder of di

Where to write java code in Android app -

i started learning how create android app , i'm stuck methods in mainactivity.java. don't know write java code because app crashing. package com.cidecode.loveometer; public class mainactivity extends actionbaractivity { @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); if (savedinstancestate == null) { getsupportfragmentmanager().begintransaction() .add(r.id.container, new placeholderfragment()) .commit(); } } @override public boolean oncreateoptionsmenu(menu menu) { getmenuinflater().inflate(r.menu.main, menu); return true; } @override public boolean onoptionsitemselected(menuitem item) { int id = item.getitemid(); if (id == r.id.action_settings) { return true; } return super.onoptionsitemselected(item); }

java - Virtual deployment directory in jboss in domain mode -

i trying deploy multiple .war files present in external deployment directory. i tried using standalone mode below configuration in standalone.xml, <subsystem xmlns="urn:jboss:domain:deployment-scanner:1.1"> <deployment-scanner path="javaproject" relative-to="my.deployment.dir" scan-interval="5000"/> </subsystem> and path element, <paths> <path name="my.deployment.dir" path="c:\projectdeployment\standalone\server\project"/> </paths> with above configuration, can deploy war files present under javaproject directory in standalone mode (without using cli , webconsole of jboss). so here question, if want use similar method using domain mode changes have make in domain.xml? if possible need copy , paste newly build war file in external deployment directory , jboss pick-up changes , restart needed. thanks in advance. this not supported in domain mode. need deploy via

How should I handle Python list properties with respect to getters/setters? -

it understanding 1 aspect of pythonic way use direct member variable access of classes until 'getters/setters' needed. code available on ideone class person(): def __init__(self, name, age=none, friends=none): self.name = name self.age = age if friends none: self.friends = [] else: self.friends = friends me = person('mr. me') = person('ms. you') me.age = 42 me.friends.append(you) because of @property decorator approach access member variable age can 'converted' 'getter/setter' interface in future without rewriting line sets 42. last line add you friends list? is possible person class intercept append() call , take other actions? perhaps in future decide add feature you notified have been added me 's friends list. of course, once ask question brain turns on , comes solution. let me know if or not. instead of intercepting .append() call in person , cre

c# - Get static value from another class -

i have static string in class: public static class someclass { public static string mystring = "hello world"; } in t4 template file want invoke static variable conditional purposes in order generate someclass2. thought this: <# someclass.mystring #> i tried multiple approaches, nothing seemed work. getting error someclass.mystring not exists. how can achieved? as daniel spotted, trying self reference t4 template same project never built, someclass doesn't exist in (non existent?) assembly (if reference it) you comment out t4 code build project , can reference or alternatively put "helpers" in different project/assembly can reference from t4-project using 't4 assembly directive' or put helpers inside t4 template public static class fooorbar { public static string { { return " <#= myhelpers.getstring(true) #> "; } } } <#+ public static class myhelpers { public static string getstring(bool what

javascript - ajaxify-html5.js reload only part of the page? -

i found following script online makes website load content ajax. everything works fine, reload music player has stay when clicking link. // ajaxify // v1.0.1 - 30 september, 2012 // https://github.com/browserstate/ajaxify (function(window,undefined){ // prepare our variables var history = window.history, $ = window.jquery, document = window.document; // check see if history.js enabled our browser if ( !history.enabled ) { return false; } // wait document $(function(){ // prepare variables var /* application specific variables */ contentselector = '#content,article:first,.article:first,.post:first', $content = $(contentselector).filter(':first'), contentnode = $content.get(0), $menu = $('#menu,#nav,nav:first,.nav:first').filter(':first'), activeclass = 'active selected current youarehere', activeselector = '.active,.selected,.current,.youarehere',

java - Having an issue with method function -

so basic overall function of code take in the array , sort in ascending order. no errors within code believe wrong. have made test cases , have failed , have feeling in recursivesort method doing wrong. have done multiple debugging walk through , cant find problem? public class recursivesorter { private int[] sortedarray; private int[] array; public recursivesorter() { array = new int[1]; } public recursivesorter(int[] a) { array = a; } public void setarray(int[] a) { array = a; } public int[] getsortedarray() { return sortedarray; } public int[] getoriginalarray() { return array; } public int[] sort() { sortedarray = array; recursivesort(sortedarray.length - 1); return sortedarray; } public int[] recursivesort(int endindex) { if (endindex >= 0) { int m = getmaxindex(endindex, sortedarray); swap(m, endindex, sorte

c++ - Generating Random Numbers Within a Specified Range Using Crypto++ -

how generate random numbers within specified range using crypto++ autoseededrandompool random number generator. how generate random numbers within specified range ... use integer , multi-precision. contructor of interest: integer (randomnumbergenerator &rng, const integer &min, const integer &max, randomnumbertype rntype=any, const integer &equiv=zero(), const integer &mod=one()) see integer class reference details. ... using crypto++ autoseededrandompool autoseededrandompool derived randomnumbergenerator , able use it. see autoseededrandompool class reference details.

node.js - jquery ui -how to submit ajax dialog? -

i don't understand code..i using jquery ui dialog now,i using server node.js. data db. using detail view making dialog. view page output db data click submit not work why? my error message:typeerror: cannot read property 'name' of undefined my code. $("#detail-form").dialog({ autoopen : false, height : 600, width : 600, modal : true, buttons:{ submit:function(data){ $.ajax({ url:'/edit', datatype:'json', type:'post', data: $("#detail-form").serialize(), success:function(data){ alert('성공'); alert('data'); //location.href='/'; }, error:function(request,status,error){ alert("code:"+request.status+"\n"+"message:"+request.responsetext+"

email - Django logged errors not sent by mail -

in django website, log errors using logging module: logger.error('error') i want these errors sent mail. however, no mails being sent. i use configuration see mail send in console (and when error 500, see mail in console): email_backend = 'django.core.mail.backends.console.emailbackend' i have tried logging configuration: logging = { 'version': 1, 'handlers': { 'mail_admins': { 'class': 'django.utils.log.adminemailhandler', } }, 'loggers': { 'django': { 'handlers': ['mail_admins'], }, } } but no see mails in console when error logged. see error message. what can able send logged errors mail? thanks.

php - search engine friendly blog urls -

hey in process of making blog site, have decided make own rather use 3rd party, cannot figure out how make url's seo friendly atm /blogpost.php?id=15 want /the-title there way without htaccess? atm using make urls' echo '<a href="blogpost.php?id='.$row['id'].'">'; then using _get id , information database, replace id name gives me /blogpost.php?title=the-title thanks help. in htaccess put (if using apache) rewriteengine on #ignores real files rewritecond %{request_filename} !-f #ignores real directorys rewritecond %{request_filename} !-d #ignores symlinks rewritecond %{request_filename} !-l #forwards request onto index.php orignal querystring still intact rewriterule (.+) index.php?url=$1 [qsa] then thing after / forwared $_get['url'] in index.php. in index.php can have bootstrap class explode /. can load appropriate class based on first element in array. for example if url /articles it load articl

python - Alembic migration stuck with postgresql? -

i wrote migration script works fine on sqlite, if try apply same postgres stuck forever. simple ps can see postres stuck on "create table waiting". there best practice? if it's stuck on lock, need see it's waiting for. it'd pretty odd create table stuck on lock, it's not impossible. get stuck process id get process id of waiting backend. can find in ps , or select ing pg_stat_activity , looking processes waiting true, find command you're interested in: select * pg_stat_activity waiting; figure out lock it's waiting on take @ lock stuck pid waiting on querying pg_locks : select * pg_locks pid = <the-waiting-pid> , not granted; you can combine both these steps with: \x select * pg_locks l inner join pg_stat_activity s on (l.pid = s.pid) waiting , not granted; then through results, or use like filter on s.query field find query you're trying identify locking issues for. find holds lock you can query pg_lo

gradlew - How to use gradle zip in local system without downloading when using gradle-wrapper -

i'm trying build gradle project gradle-wrapper ( gradlew ). when build ./gradlew build , outputs text downloading http://services.gradle.org/distributions/gradle-1.11-bin.zip and got gradle-1.11-bin.zip downloaded separately , don't want downloading again when build. so, shall put gradle-1.11-bin.zip in project or system don't have download again? gradle/wrapper/gradle-wrapper.properties following. distributionbase=gradle_user_home distributionpath=wrapper/dists zipstorebase=gradle_user_home zipstorepath=wrapper/dists distributionurl=http\://services.gradle.org/distributions/gradle-1.11-bin.zip and i've tried copying gradle-1.11-bin.zip gradle/wrapper/dists didn't solve problem. from gradle-wrapper documentation, found in section 61.1. configuration if don't want download happen when project build via gradlew, add gradle distribution zip version control @ location specified wrapper configuration. relative url suppor

Outputted pdf not filling with the content in iTextsharp and C#.net, creating with Zero bytes -

i working replace specific word inside pdf document using itextsharp , c#.net, while debugging getting proper value outputted pdf getting 0 bytes(empty),its not filling content. replacepdftext("mumbai",stringcomparison.currentcultureignorecase,application.startuppath + "\\test.pdf","d:\\test_words_replaced.pdf"); //do public void replacepdftext(string strsearch, stringcomparison sccase, string strsource, string strdest) { pdfstamper psstamp = null; //pdf stamper object pdfcontentbyte pcbcontent = null; //read pdf content if (file.exists(strsource)) //check if file exists { pdfreader pdffilereader = new pdfreader(strsource); //read our file psstamp = new pdfstamper(pdffilereader, new filestream(strdest, filemode.create)); //read underlying content of pdf file pbprogress.value = 0; //set progressbar minimum value pbprogress.maximum = pdffilereader.numberofpages; /

"java.sql.SQLException: General error" even if the insert worked -

i'm doing program , if insert instructions work correctly , in db (microsoft access) ok, following code throws exception, doesn't @ all: insert presupuesto (id_cliente,id_presuspuesto,reserva) values (1,234, false) insert presupuesto (id_cliente,id_presuspuesto,reserva) values (1,234, false) java.sql.sqlexception: general error @ sun.jdbc.odbc.jdbcodbc.createsqlexception(unknown source) @ sun.jdbc.odbc.jdbcodbc.standarderror(unknown source) @ sun.jdbc.odbc.jdbcodbc.sqlexecdirect(unknown source) @ sun.jdbc.odbc.jdbcodbcstatement.execute(unknown source) @ sun.jdbc.odbc.jdbcodbcstatement.executeupdate(unknown source) @ datos.accesobd.insertapresupuesto(accesobd.java:137) @ aplicaciones.capaaplicacion.insertapresupuesto(capaaplicacion.java:81) @ interfaces.nuevopresupuesto$2.actionperformed(nuevopresupuesto.java:103) @ javax.swing.abstractbutton.fireactionperformed(unknown source) @ javax.swing.abstractbutton$handler.actionper

ios - Is there a way to tap into the CoreAnimation completion curve mathematics for custom animations? -

for various reasons, animating manually using cadisplaylink : - (void)update:(cadisplaylink *)sender; { // linearly interpolate proportion animated based on elapsed time cgfloat proportion = ... [self updateanimationforproportion:proportion]; } i want uiviewanimationoptioncurveeaseinout instead of linear calculation. is possible callback coreanimation instead of implementing mathematics manually? or better, possible using ios7 physics based animation? [uiview animatewithduration:0.5 delay:0.0 usingspringwithdamping:0.5 initialspringvelocity:0.5 options:0 animations:^{ ... } completion:nil]; nope not possible seems. if helps looking use ease curves in ios, took list of handy ease curves jquery.easing.1.3 , ported them useable in c simple header file (,c++,objective-c,etc): https://gist.github.com/metec/10012959

python - What is the network size limit in PyBrain? -

i have constructed neural network in pybrain, ran in problem of network being big. so exact limits in pybrain? how can construct network 750000 inputs, 3 outputs , working ammount of hidden nodes(currently works 35-40 hidden nodes, feel lot little)? are there other ways construct image recognition(in case basic, not identical(random solid colors , sizes) shape recognition - square, circle , equilateral triangle) using mlp n input nodes n = image.width * image.height * 3 ? with many nodes if there no computation errors amount of time network need perform single training epoch enormous. don't believe there specific limit network size in pybrain other common sense , computer capabilities. also idea of neural network simplify complex problems. have shrink input data. , mean shrink lot, purpose 100 input nodes more enough. i recommend source material choosing input data, , network architecture: localized precipitation forecasts numerical weather prediction mod

Rails ActiveRecord How to make foreign key in second table? -

simple question: how can make 'rateable_id' foreign key bboys table? db schema: activerecord::schema.define(version: 20140331112614) create_table "bboys", force: true |t| t.string "name" t.string "crew" t.string "country" t.datetime "created_at" t.datetime "updated_at" t.string "avatar_file_name" t.string "avatar_content_type" t.integer "avatar_file_size" t.datetime "avatar_updated_at" end create_table "rates", force: true |t| t.integer "rater_id" t.integer "rateable_id" t.string "rateable_type" t.float "stars", null: false t.string "dimension" t.datetime "created_at" t.datetime "updated_at" end thank you! check gem foreigner , can you. don't know want. try write more descriptio

Eclipse plugin development made easy -

i work on existing eclipse plugin enhance little. new area me , check if there eclipse plugin can make life little easy showing previews small changes @ development time, detect code representing in ui etc instead of run or debug 'eclipse application'? ok future reference if looking it. found tool called visualeditor retired/archived , tool replaced windowbuilder (built google) , fantastic. try here!

regex - Regular Expression to match few characters from a string -

i trying find string within string. however, trying match if 1 or more character not matching. let me explain example : let's have string 'abcdefghij' . if string match 'abcd' , i write strfind('abcdefghij', 'abc') now, have string 'adcf'. notice that, there mismatch in 2 characters, consider match. any idea how ? i know, not optimal code. example : a='abcdefghijk'; b='xbcx' c='abxx' d='axxd' e='abcx' f='xabc' g='axcd' h='abxd' ='abcd' all these strings should match a . hope example makes more clear. idea is, if there mismatch of 1 or 2 characters also, should considered match. you this: a = 'abcdefghij'; % main string b = 'adcf'; % string found tolerance = 2; % maximum number of different characters tolerate na = numel(a); nb = numel(b); pos = find(sum(a(mod(cumsum([(1:na)' ones(na, nb - 1)], 2) - 1, na) + 1) == repm

Downloading file/files in Java. Multithreading, this works? -

first, needs know i'm relatively new java coding. more precise i'm new object oriented programming. to question. i trying create download class updates progress bar given show progress. , possibly else decide give in future update. the issue that, in head, shouldn't work. can want on "main" method , gui still responsive , quick. in experience in past programming, not possible unless thread gui. why this? since works, ok way? class main package atomicelectronics; import java.io.ioexception; import atomicelectronics.physical.atomframe; import atomicelectronics.utility.download; public class initial { static atomframe atomlauncher; public static void main(string[] args) { atomlauncher = new atomframe(); atomlauncher.start(); system.out.println(integer.max_value); download thedownload = new download(); thedownload.fileprogressbar(atomlauncher.progressbar); try { thedownload