Posts

Showing posts from April, 2015

java - IllegalArgumentException: Entity must be managed to call remove -

controller page has following code bigdecimal id=new bigdecimal(request.getparameter("empid")); employee.setempno(id); flag = factory.removeemployee(employee); transactionfactory class public final class entitytransactionfactory implements transactionfactory{ @persistencecontext private entitymanagerfactory factory; private entitymanager manager; @resource private usertransaction transaction; private static final transactionfactory transaction = new entitytransactionfactory(); private entitytransactionfactory() { } public static transactionfactory getinstance() { return transaction; } /** * @return factory */ @override public entitymanagerfactory getfactory() { factory= persistence.createentitymanagerfactory("samplebeanpu"); return factory; } /** * @return manager */ @override public ent...

javascript - make jquery tab using ngRoute angularjs doesn't work -

i try add item in tab 1, navigate next tab, when come back, things got reset. http://plnkr.co/edit/etxaz2esi9ftcousrdcp?p=preview what best approach build jquery tab using angular? ngshow , hide not friendly makes view complicated , messy. i suggest using bootstrap components written angularui team. can find great set of twitter bootstrap components including tabs control. example: <div ng-controller="tabsdemoctrl"> <p>select tab setting active binding true:</p> <p> <button class="btn btn-default btn-sm" ng-click="tabs[0].active = true">select second tab</button> <button class="btn btn-default btn-sm" ng-click="tabs[1].active = true">select third tab</button> </p> <p> <button class="btn btn-default btn-sm" ng-click="tabs[1].disabled = ! tabs[1].disabled">enable / disable third tab</button> </p> ...

ruby on rails - each_with_index only showing last option -

i'm using gruff prawn insert image graph, have bar graph displaying properly, labels showing last label. see image here example . using prawn (0.15.0) , gruff (0.5.1) prawn def initialize(result) super() @result = result show_graph end def show_graph lint = @result.map {|v| v.lint/227 } g = gruff::bar.new('540x200') g.data(:lint, lint, '#00463f') @result.each_with_index |v, i| g.labels = {i => v.variety.variety_name} end g.y_axis_label = 'yield (bales/ha)' g.marker_font_size = 16 g.marker_count = 5 g.theme = {:marker_color => '#333333', :font_color => '#333333', :background_colors => %w(#ffffff #ffffff)} g.minimum_value = 0 g.hide_legend = true g.write("#{rails.root}/app/assets/images/chart.png") image "#{rails.root}/app/assets/images/chart.png" end controller @result = result.where('trial_id' => params[:trial_id]).order('lint desc') the error make redifin...

jquery - How can i disabled partially a input? -

i have part in input disabled. input field subdomain, want this xxxxxx.mydomain.com only x must editable, not domain, possible? you can use this: $('input').on('focus',function(){ return $(this).val($(this).val().split('.')[0]).select(); }); $('input').on('change focusout',function(){ return $(this).val($(this).val() + '.mydomain.com'); }); demo

java - Indexing a dataset with labels in weka arff files -

i trying indexing dataset in arff files label indexes. ve got dataset of mxn dimension nth column dedicated dataset labels. when trying create arff file using weka's class attribute in order construct proper arff file. int numatts = data[0].length; fastvector atts = new fastvector(numatts); (int att = 0; att < numatts-1; att++) { atts.addelement(new weka.core.attribute("attribute" + att, att)); } string qwer ="class"; double [] labels = {1, 2, 3m}; weka.core.attribute object = new weka.core.attribute(qwer); atts.addelement(object); my problem how construct last attribute labels indexing in arff file in order take string name "class" , values {1,2,3}. as seen instance in adding attributes dataset , following code should enough: atts.addelement(new attribute("class",labels)); where labels of ty...

asp.net - how to check grid view data row have value and if have value then formate with date time -

i have grid view. shows records product table contains here want using combine logic : <asp:label id="label3" runat="server" text='<%#(string.isnullorempty((databinder.eval(container.dataitem, "releasedate", "{0:dd / mm / yyyy}")) ? " - " : eval("releasedate", "{0}"))%>'></asp:label> this logic not works , not putting - if data row have no value. please me... you forget + sigh add both of them made edit see if work runat="server" text='<%#(string.isnullorempty(databinder.eval(container.dataitem, "releasedate", "{0:dd / mm / yyyy}")) ? " - " : eval("releasedate", "{0}"))%>'></asp:label>

FFMPEG incorrect image extension fails coding -

i have problem using ffmpeg on images. problem quite lot of images on internet has incorrect extension ( png files names .jpg , jpg files named .png) makes ffmpeg fail. i couldn't find documentation on internet how can fixed? can force somehow ffmpeg try in other codec types not ones extension suggests? to reproduce need download png internet , rename it's extension .jpg and if use simplest command ffmpeg -i image.jpg fails with: ffprobe.exe -i tux.jpg -report ffprobe version n-61663-g19139d8 copyright (c) 2007-2014 ffmpeg developers built on mar 20 2014 22:06:17 gcc 4.8.2 (gcc) configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libcaca --enable-libfreetype --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg -...

objective c - How to get GPU temperature programmatically in OSX? -

i trying gpu temperature on mac's osx platform programmatically i tried google solutions can't find , find cpu temperature , gpu usage in percentage. is there api or library allows retrieve sensors data ? can please tell me start ? or maybe provide example? https://developer.nvidia.com/cuda-faq q: how can information on gpu temperature application? on microsoft windows platforms, nvidia's nvapi gives access gpu temperature , many other low-level gpu functions under linux, "nvidia-smi" utility, included standard driver install, displays gpu temperature installed devices. edit while looking further "nvidia-smi" utility has been provided linux based system, found have provided c based api fetch gpu temperature. https://developer.nvidia.com/nvidia-management-library-nvml https://developer.nvidia.com/nvidia-system-management-interface https://developer.nvidia.com/sites/default/files/akamai/cuda/files/cudadownloa...

javascript - How can I add space in the label of a graph made with dimple.js? -

i doing barplot dimple.js. code following: var data = [{x:1, y:10}, {x:2, y:15}, {x:3,y:27}] var svg; var chart; var svg = dimple.newsvg("body", 800, 600); var chart = new dimple.chart(svg, data); chart.defaultcolors = [ new dimple.color("#ff0000", "blue"), // set red fill blue stroke new dimple.color("#00ff00"), // set green fill darker green stroke new dimple.color("rgb(0, 0, 255)") // set blue fill darker blue stroke ]; x = chart.addcategoryaxis("x", "x"); chart.addmeasureaxis("y", "y"); chart.addseries("country", dimple.plot.bar); x.addorderrule("x"); chart.draw(); it works fine when have 3 (or few) data points, when have more 2 hundred data points, x axis becomes cluttered units. there way show units in x label every n points? (so instead of showing 1,2,3... shows 1, n+1, 2*n+1,...) ? you can modify after draw d3. here method remove ...

c# - Unity3D: How to determine the corners of a gameobject in order to position other gameobjects according to it? -

Image
my question if there way know coordinates of corners of gameobject. have 3 vuforia ar targets , gameobject, cube in case. what need achieve, when move targets around, corners of cube follow targets, eg. cube wide space between targets. right how it, checks distance between targets , sets scale of cube according it. results in cube being expanded set position, makes positioning of targets awkward in real life. here's couple of pictures showing now, taken during execution: here code attached cube-object: using unityengine; using system.collections; public class show : monobehaviour { float distancex; float distancez; // use initialization void start () { renderer.enabled = false; } // update called once per frame void update () { if (gameobject.find ("target1").renderer.enabled && gameobject.find ("target2").renderer.enabled && gameobject.find ("target3").renderer.enabled && gameobject.find ...

requirejs - Load JavaScript and CSS files in folders in AngularJS -

i have angularjs application , in future, developers in other teams develop modules installed parts of it. defined folder structure below. www/ index.html app.js modules/ modulesa/ -- copied when module installed modulea.js modulea.css modulea.partial.html modulesb/ -- copied when module b installed moduleb.js moduleb.css moduleb.partial.html now have problem. when user installed module a, how let angularjs (and application) load js , css under folder? there library can load js , css folder can put code in index.html likes <script src="/modules/**/*.js"></script> <link src="/modules/**/*.css"/> otherwise, have add placesholders in index.html , change content when user installed module, <script src="/app.js"></script> <!-- $$_js_$$ --> <link src="/app.css"/> <!-- $$_css_$$ --> angularjs doesn't support want, tak...

machine learning - How to use python to tokenize and chunk tagged sentences line by line -

i'm linguistist , want use python tokenize sentences in csv document line line , tell tag , token position in tag(b-beginning or i-inside) example below. "id", "sentence" "1", "<person>claire</person>lived in<location>london uk</location>for<time>2 years</time>" "2", "<location>uk</location> in<location>europe</location>" ........... ........... dataframe = pd.read_csv(document) sentences = dataframe['sentence'] line in sentences : #print token position tag >> claire b-per person lived null null in null null london b-loc location uk i-loc location null null 2 b-tim time years i-tim time uk b-loc location null null in null null europe b-loc location

qt - Draw text on scrollbar -

i wondering if possible draw text inside scrollbar. more specifically, inside "grab-able block" of scroll widget. i'm using pythonqt, can't make own widgets. need default widgets. way purely in qt? a more graphical representation of need: (vanilla: 'x's 'grabbale handle') ------------------------------------------------------- |......xxxxxxxxxxxx......................................| ------------------------------------------------------- (target) ------------------------------------------------------- |......xx custom text here! xx.......................| ------------------------------------------------------- thanks! edit : removed claustrophobic pythonqt requirement :) http://www.qtcentre.org/threads/15032-qscrollbar-subclass-constructor-ignores-orientation-qt4-4 you want similar qscrollbar subclass. mainwindow.cpp #include "mainwindow.h" #include <qscrollarea> #include ...

algorithm - Supposed easy edge detection in MATLAB -

Image
i have following image: , i'd detect contour of note intuitionally seen easy, when try it, isn't easy. for quick prototyping started using matlab first (but later want in java i'd not use many special algorithms in matlab rather try use basic image proessing algorithms (prewitt / sobel / canny / adaptive thresholds / hough trafo) available in language (e.g. opencv etc).. the easy code start (but thought should quite outside-edge looks strong compared inside ones): i = double(rgb2gray(imread('img.jpg'))); bw = edge(i, 'canny'); imshow(bw) i thought matlab doing choice of threshold in canny filter when using automatical-mode. doesn't: http://i.imgur.com/lekpgso.png when setting threshold scalar manually (to .4 e.g.) still way many gradients text inside , outside borders way incomplete/patchy: http://i.imgur.com/p68cviu.png i tried using prewitt filter (in x , y direction): i = double(rgb2gray(imread('img.jpg'))); f1 = double(fspe...

java - Android JSON parsing of multiple JSONObjects inside JSONObject -

i have json string coming server , looks this { "categories": { "0": { "term_id": "247", "name": "content curation" }, "1": { "term_id": "50", "name": "content marketing" }, "2": { "term_id": "2", "name": "curation" }, "3": { "term_id": "246", "name": "inbound marketing" }, "4": { "term_id": "47", "name": "marketing" }, "5": { "term_id": "4", "name": "news curation" }, "6": { "term_id": "36", "name": "seo" }, "8": { "term_id": ...

objective c - Why taking location can't be done in a bling of an eye? -

Image
when accessing locationmanager.location, why takes more blink of eye? basically accessing [cllocationhandler currentlocation] why have mach_msg_trap showing if it's waiting something. wait what? i not asking next updated location. asking last updated location.

php - How to place strings into an array through a search and then output it? -

$states = "mississippi alabama texas massachusetts kansas"; $statesa = explode(' ',$states); $statesarray = array(); foreach($statesa $state) { if(preg_match( '/xas$/', trim($state))) $statesarray[0] = trim($state); } foreach($statesa $state) { if(preg_match('/^k.*s$/i', trim($state))) $statesarray[1] = trim($state); } foreach($statesa $state) { if(preg_match('/^m.*s$/', trim($state))) $statesarray[2] = trim($state); } foreach($statesa $state) { if(preg_match('/a$/', trim($state))) $statesarray[3] = trim($state); } foreach($statesa $state) { #problem here if(preg_match('/^m/', trim($state))) $statesarray[4] = trim($state); } foreach ( $statesarray $element => $value ) print( "element $element of array $value <br />"); the task output word begins letter m in variable state. have "mississippi alabama texas massachusetts kansas" in $states . when try print out, massachusetts gets printed o...

c# - Audio playing stopped when i resize a WaveForm to form size -

i have problem audio application. i'm using naudio library. when play sound without using "samplesperpixel" method on waveviewer control, works perfectly, when want assign value method. sound, when play starts unexpected time , finish 4sec. later. here code: namespace audiomixer { public partial class form1 : form { public form1() { initializecomponent(); } int bytespersample; int samples; int samplespixel; private naudio.wave.wavestream pcm = null; private naudio.wave.blockalignreductionstream stream = null; private naudio.wave.directsoundout output = null; private void openfiletoolstripmenuitem_click(object sender, eventargs e) { openfiledialog dialog = new openfiledialog(); dialog.filter = "audio file (*.wav;*.mp3)|*.wav;*.mp3;"; if (dialog.showdialog() != dialogresult.ok) return; disposewav...

Retrieve Data from Different Tables (SQL Server) -

i have 4 tables in sql server database following schema: attendance create table [dbo].[attendance] ( [attendanceid] uniqueidentifier default (newid()) not null, [courseid] uniqueidentifier not null, [studentid] uniqueidentifier not null, [subjectid] uniqueidentifier not null, [semester] int not null, [month] nvarchar (50) not null, [count] int not null, constraint [pk_attendance] primary key nonclustered ([attendanceid] asc), constraint [fk_attendance_student] foreign key ([studentid]) references [dbo].[student] ([studentid]) ); course create table [dbo].[course] ( [courseid] uniqueidentifier default (newid()) not null, [name] nvarchar (50) not null, constraint [pk_course] primary key nonclustered ([courseid] asc) ); student create table [dbo].[student] ( [studentid] uniqueidentifier default (newid()) not null, [courseid] uniqueidentifier not null, [name] nvarchar (100) not null, [rollno] int ...

java - Where to create the ArrayList inside my cycle? -

Image
i've cycle retrieve data local database on android phone , i'm quite sure problem within listbackupcontacts array. this database structure: my objective backupcontacts , metadata database. public arraylist<backup> getallbackupcontacts() throws unsupportedencodingexception { final sqlitedatabase db = getreadabledatabase(); final string selectquery = "select * " + backup_table_name + ", " + backupcontacts_table_name + " " + backup_table_name+"."+backup_id + " = " + backupcontacts_table_name+"."+backupcontacts_id_backup_fk; final cursor cursor = db.rawquery(selectquery, null); arraylist<backup> listbackupstoreturn = new arraylist<backup>(); arraylist<backupcontact> listbackupcontacts = new arraylist<backupcontact>(); // shall create arraylist inside cycle? if(cursor.movetofirst()) { integer aux = 0; do{ final integer id...

c++ - QT SLOT: Pointer to Member Function error -

i'm working on qt project , have troubles slots. want pass pointer member function argument of slot. this, declared slot in class when so, moc error. don't know if want achieve possible. an exemple of syntax class named mainframe: void slotanswerreceived (qstring answer, void (mainframe::*ptr)(qstring)); i don't have connect anywhere, nothing using function, , error have on line above. thank help. cannot find solution on web (but found article explaining signal , slot in depth if interested). declare typedef pointer-to-member type. declare , register metatype typedef. only use typedef - remember moc uses string comparison determine type equality, has no c++ type expression parser. an example follows. @ time a.exec() called, there 2 qmetacallevent events in event queue. first 1 c.callslot , second 1 a.quit . executed in order. recall queued call (whether due invokemethod or due signal activation) results in posting of qmetacallevent each recei...

asp.net mvc 4 - 'Model' conflicts with the declaration in view page MVC4 -

when i'm trying this, i'm getting weird error. <tr> <td> @html.labelfor(model=>model.company_name) </td> <td> @html.textboxfor(model=>model.company_name) </td> </tr> <tr> <td> @html.displaynamefor(m=>m.lob_name) </td> <td> @html.dropdownlistfor(x=>x.lob_name,model.lobdata) //error here saying 'model' conflicts declaration'system.web.mvc.webviewpage<tmodel>.model' //similarly when comment above line error shifting down @html.dropdownlistfor(x=>x.lead_source,model.leadsourcedata) found here model should model i.e @html.labelfor(model=>model.company_name)

Installing Linux Kernel Modules without plus + (on ARM) -

installing linux kernel modules of version 3.4.79 , foulder 3.4.79+ . how can install without + ? doing make arch=arm install_module_path=dest modules_install this worked me: sed -i "s|config_localversion_auto=.*|config_localversion_auto=n|" .config && make localversion=

c++ - Error handling in Boost Spirit symbol table -

assuming have symbol table this: struct jass_types : qi::symbols<char, jass_type> { now want fill customly declared type parent type: identifier %= char_("a-za-z") >> -(*char_("a-za-z_0-9") >> char_("a-za-z0-9")) ; type %= lit("type") >> identifier >> lit("extends") >> identifier[type_symbols.find(_1)] the structure followed: boost_fusion_adapt_struct( wc3lib::jass::jass_type, (std::string, identifier) (wc3lib::jass::jass_type*, parent) ) how have write code stores 0 attribute "parent" if identifier after "extends" not found in symbol table , how react missing symbols properly? my idea make like: boost::variant<wc3lib::jass::jass_type*,std::string> parent and fill either pointer or identifier depending on fact if type found in symbol table or not have detect typeinformation of parent afterwards. option store 0 parent mentoined , create ...

java - How to make a servlet output several messages progressively -

i'm using jsp , servlets write web application. goal of app provide simple form in jsp page, used feed parameters execute java program (in servlet). output of program should appear @ bottom of same jsp page. lot of sites explain how to this, main issue java program takes several minutes run, , prints out lot of messages before completing. if append messages servlet's httpservletresponse, wait several minutes before showing messages @ once. there way progressively print out messages on original jsp page if java console? you can make using ajax. in ajax call servlet,then take necessary informations servlet , print in ajax success part. this may you.

java - How to write the Criteria queries dynamically? -

hi writing criteria query fetch employees. using generic type parameter method. user can pass class dynamically class want. employee class want add restriction dynamically if employee true want fetch record, otherwise record should not fetch. if user gives record without restriction, has fetch records. public static <t> list getrowcount(class<t> classname) { session ses = hibernateutil.getsessionfactory().opensession(); system.out.println("classname" + classname); list<setpaginationrecords> s1 = new arraylist<setpaginationrecords>(); try { criteria crit1 = ses.createcriteria(classname); crit1.setprojection(projections.rowcount()); list l1 = crit1.list(); iterator it1 = l1.iterator(); if (it1.hasnext()) { object o = it1.next(); totalnumberofrecords = integer.parseint(o.tostring()); } } } this calling method. list<setpaginationrecords> pagina...

javascript - parent child checkbox selection -

<input type="checkbox" name="all[]" id="<?php echo $record_id;?>" value="<?php echo $record_id; ?>" onclick="childchecked(this, this.form.elements['prnt'])"> above code creates dynamic child checkboxes each row fetching data database <input type="checkbox" name="all[]" id="<?php echo $record_id;?>" value="<?php echo $record_id; ?>" onclick="allchecked(this, this.form.elements['prnt'])"> and above parent checkbox javascript code: function checkall(){ var main_check=document.getelementbyid("check"); var all_check=document.getelementsbyname('all[]'); if(main_check.checked){ for(var i=0;i<all_check.length;i++){ all_check[i].checked=true; } }else{ for(var i=0;i<all_check.length;i++){ all_check[i].checked=f...

Get all SmartForm items from Ektron 9 in a Taxonomy -

i'm using ektron cms version 9.0 i have smart form content allocated taxonomies e.g. might have 5 smart form content items (all of same) type allocated taxonomy, , 3 different taxonomy: i need content of smart form type taxonomy: public ienumerable<t> getlistofsmartformfromtaxonomy<t>(long taxonomyid, bool isrecursive) t : class { // todo } what have working, based on links below, this: public ienumerable<taxonomyitemdata> getlistofsmartformfromtaxonomy(long taxonomyid) { taxonomyitemcriteria criteria = new taxonomyitemcriteria(); criteria.addfilter(taxonomyitemproperty.taxonomyid, criteriafilteroperator.equalto, taxonomyid); taxonomyitemmanager taxonomyitemmanager = new taxonomyitemmanager(); list<taxonomyitemdata> taxonomyitemlist = taxonomyitemmanager.getlist(criteria); return taxonomyitemlist; } but gets item's titles , ids, not smart form data itself. as ektron newbie, don't know how items of 1 smart for...

c# - Error when using Entity Framework partial class -

i using partial class add methods context object. namespace addresscleansing { public partial class service { internal void save() { result result = new result(); if (string.isnullorempty(accountcode)) { string newaccountcode; result = createaccount(out newaccountcode); } } } } when attempt load web page (and not 1 uses code) there's compilation error: description : error occurred during compilation of resource required service request. please review following specific error details , modify source code appropriately. compiler error message : cs1061: 'addresscleansing.service' not contain definition 'accountcode' , no extension method 'accountcode' accepting first argument of type 'addresscleansing.service' found (are missing using directive or assembly reference?) the app using code first entity framework.

javascript - JQuery draggable dynamic with document.createElement -

i want able create div on fly , make div draggable using jquery. if use jquery selector element becomes draggable. if create div , call draggable() on div not work. error console states "boolean not function". var loadimage = { handlefileselect: function(evt) { var files = evt.target.files; // filelist object // files filelist of file objects. list properties. var output = []; (var = 0, f; f = files[i]; i++) { output.push('<li><strong>', escape(f.name), '</strong> (', f.type || 'n/a', ') - ', f.size, ' bytes, last modified: ', f.lastmodifieddate ? f.lastmodifieddate.tolocaledatestring() : 'n/a', '</li>'); loadimage.getbinary64datafromfile(f); } document.getelementbyid('list').innerhtml = '<ul>' + output.join('') + '</ul>'; }, getbinary64datafromfile: function(file...

python - Binding events to widget not working -

i have function, foo , it's supposed bind event def foo: x in widget_list: widget.config(command = lambda: self.function(widget_list.index(x)) def function(index): here.... print index the widget list contains buttons, , whenever click corresponding buttons, they're supposed print idle index, happens buttons click end printing last index of widget_list. i'm guessing while iterates, argument of function changes last index preserved. there anyway bind previous indexes button? the simplest fix make sure lambda using current value of x : widget.config(command = lambda x=x: self.function(widget_list.index(x)) this forces x default parameter function, , default value value of x @ time lambda defined.

javascript - How to describe a returned promise in a function annotation? -

when writing javascript code, annotate functions like described here , like: /** * add 2 values * @param {number} * @param {number} b * @returns {number} sum of , b */ function add(a, b) { return + b; } now when write asynchronous function returning promise be: /** * add 2 values * @param {number} * @param {number} b * @returns {promise} sum of , b */ function add(a, b) { return new promise(function (resolve, reject) { resolve(a + b); }); } but description of return type ( promise ) misses information on type promise return when resolved. how denote returned promise resolve number ? i think promise.<number> best (similar array.<number> ), haven't found common practice in regard. what want generics . while jsdoc doesn't officially support yet it's correct way handle it. the correct way thus: promise.<number> . documenting promise.<number, error> pointless in opinion since promise rejects error - otoh...

java - Unable to obtain the correct product of numbers when used with Math.pow() -

i trying write recursive function gets string , returns integer form of it. know can done in java using integer.parseint . part of exercise doing. for following code, when enter "963" input, returns output "6291". so, checked if array getting passed , was. to check multiplication, split , printed product each time, gave 5700, 540 , 51, correctly sum 6291. (which should have been 900 + 60 + 3 = 963). i'm unable figure out wrong in program. import java.io.*; import java.lang.*; class recconvert { static double i=0; static double sum=0; public static void main(string[] args) throws ioexception { bufferedreader b = new bufferedreader(new inputstreamreader(system.in)); string input = b.readline(); int number = recursiveconvert(input); system.out.println("the number "+number); } static int recursiveconvert(string input) { char[] chararray = input.tochararray(); if(i < c...

Remote Backup MySQL database with routines unsuccess -

Image
mysqldump -u root --password=123456 -h 110.4.43.111 --databases db_shuttlebus --routines --lock-tables=true --result-file=d:\server-backup.sql everything has backuped, routines not backuped, why? wrong command? in routines have function, can't backuped. update delimiter ;; /*!50003 create*/ /*!50020 definer=`root`@`localhost`*/ /*!50003 procedure `generateroutefare`( proute_id int ) begin -- set sql_safe_updates=0; -- delete tbl_rate route_id = proute_id; insert tbl_rate (route_id,from_locationid,to_locationid,normal_rate,discounted_rate) select a.route_id, a.route_locationid from_loc_id, b.route_locationid to_loc_id, 0,0 tbl_route inner join tbl_route b on a.route_id = b.route_id , a.route_seq < b.route_seq , a.route_id = proute_id inner join tbl_location la on la.location_id = a.route_locationid inner join tbl_location lb on lb.location_id = b.route_locationid not exists(select rate_id tbl_rate tbl_rate....

Java exception handling concept. why do compiler allow to write exceptions in throws section even if it can not be thrown? -

i investigate java exception handling , faced following behaviour. non me. consider code snippet: snippet 1 public void g(){ try { } catch (filenotfoundexception e) {//any checked exception } } it compile error message unreachable catch block filenotfoundexception. exception never thrown try statement body snippet2 public void g() throws filenotfoundexception{ } it compiles fine. therefore, on results of first code snippet, compiler can calculate if method possible or impossible throws exception. and can make conclusion made especially. don't why. point of question - why compiler allow write exceptions in throws section if can not thrown? i want understand full concept. p.s. understand behavior corresponds documentation question understanding of exception handling concept in java. the compiler allows because throws clause of method part of signature of method, rather part of implementation . possible impleme...

node.js - Populate issue with mongodb? -

i trying populate stories stored in stories array reference story id not stories when know there... , reason stories of user in db make sense... here how reference in mongoose schema: stories: [{ type: schema.types.objectid, ref: 'story' }], this populate query not return correct results: user.find({_id: query}).populate({ path: "stories", select: "_id name location date_updated date_created picture", options: {limit: limit, skip: skipcount } }).exec(function(err, users) { if(err) console.log(err); console.log(users); res.json(users); }); query userid being passed , limit , skipcount being set accordingly (skip 0, limit 100. trying stories in user's stories array...

mysql - SQL Delete on inner join on MISSING data -

my question identical sql delete inner join ; want delete on non equal! my problem in brief: there 2 tables, bus_stops, bus_routes ; bus_routes {id, bus_route_id,..other columns..} bus_stops {id, bus_route_id,..other columns..} some routes had been deleted, bus stops remaining, need delete them too. means, need delete bus_stops, have no associated bus route! it means like: delete bs.* bus_stops bs inner join bus_routes br on bs.bus_route_id <> br.bus_route_id but above code not work. you should use left join , below query work: delete bs.* bus_stops bs left join bus_routes br on bs.bus_route_id = br.bus_route_id br.bus_route_id null

c - I can't use <nameofmystructure>* this as an argument to a function -

this code i'm having trouble with: typedef const char* sun_date_t; typedef const char* sun_time_t; typedef struct sun_t { int luminosity; /* private */ sun_date_t date; sun_time_t time; sun_time_t sunrise; sun_time_t sunset; pthread_t tid; pthread_mutex_t mutex; } sun_t; void sun_parse_data (sun_t* this, file* f){.....} as see, define structure , after try pass pointer "sun_t", compiler says need write ',' or '....' before 'this'. ideas how solve it? you must compiling c++ since this keyword in c++ in c not not idea use this variable name in case want port code later on. the code compiles fine c program: see live see same error when attempt compile c++ program: see live : error: expected ',' or '...' before 'this'

c++ - How to expose the implementation only to a specified set of classes in the pimpl idiom? -

let's have class a has inner class a::impl . class allowedtoaccess should able a::impl& class a , no other class should able or know class a::impl exists. class a_1 { public: class impl; impl& impl(); const impl& impl() const; private: std::unique_ptr<impl> m_impl; }; class a_2 { private: friend class allowedtoaccess; class impl; std::unique_ptr<impl> m_impl; }; class a_3 { private: friend class allowedtoaccess; class impl; class implcontainer { friend class a_3; std::unique_ptr<impl> impl; } m_implcontainer; impl& impl(); // return *m_implcontainer.impl; const impl& impl() const; // return *m_implcontainer.impl; }; here code illustrate ideas. a_1 pros: m_impl secured. cons: classes not supposed know a::impl know (although don't know a::impl about). a_2 pros: classes not supposed know a::impl not know it. cons: m_impl not secured ( a...

git - Project Setup for Github/Openshift/Spring MVC -

this general question, i'm sure has been asked before, resources i'm finding suffer typical coder problem of assuming know things don't know. i'm trying use openshift deploy spring mvc project github repo. don't know github link supposed contain. i assumed github repo should contain code of project, i'm linking of development code to. however, when applying result 404 page no additional information. does github repo require war? need set in specific way? i've been able deploy project war server, know code working properly, can't seem find documentation on expectations project design openshift has github repo. am doing right? problem github contents, or elsewhere? you should try creating default project whichever java server cartridge using, , @ structure. it's standard maven project, there difference in pom.xml knows how deploy war file compiles.

scope - Local variables in Python nested functions -

okay, bear me on this, know it's going horribly convoluted, please me understand what's happening. from functools import partial class cage(object): def __init__(self, animal): self.animal = animal def gotimes(do_the_petting): do_the_petting() def get_petters(): animal in ['cow', 'dog', 'cat']: cage = cage(animal) def pet_function(): print "mary pets " + cage.animal + "." yield (animal, partial(gotimes, pet_function)) funs = list(get_petters()) name, f in funs: print name + ":", f() gives: cow: mary pets cat. dog: mary pets cat. cat: mary pets cat. so basically, why not getting 3 different animals? isn't cage 'packaged' local scope of nested function? if not, how call nested function local variables? i know running these kind of problems means 1 'doing wrong', i'd understand happens. the nested function loo...

windows - Kill a java process using its Name and not PID -

in java program want kill process named "dummybroker"(which java program). kill using taskkill needs pid of process. how can fetch pid specific java process , kill it? you should take @ link : killing process using java and use : runtime.getruntime().exec("taskkill /f /im <processname>.<extension>") otherwise can maybe use combinaison of tasklist and split find containing line , find pid .

Git basic understanding -

if managing project , have 2 developers working me , starting track project today. project located publicly on www.somedomain.com . then create centralized repository would: //ssh + cd directory want track, git init --bare myrootdirectory.git then developers working on project clone repository onto local machine , use wish, making changes , developing projects on local machine. bit confused. how developers commit code onto central repository, if used --bare , wouldn't prevent them doing that? what happens after project component has been tested developer , track on centralized repository used --bare on? also, changes developers make on local machine commit, available on local machine, or on centralized repository well? read there link between centralized repository , local 1 on developers machine, why asking. i appreciate clarification, in advance! the answer 2 git repositories, (one bare, , 1 not), linked hooks. can read more in this article , i'll ...