Posts

Showing posts from August, 2015

xaml - What is the best control to use for a single value bar graph (one value from 0 - 10)? -

Image
i want know how can draw simple bar graph plots 1 value. going use canvas there specific graph control can used? looks slider control. <slider horizontalalignment="left" verticalalignment="top" width="369" minimum="10" maximum="10" value="{binding yourpropertyhere, mode=oneway}" />

php - correct path files to use in constants so it can be used on any server -

i have small project guess applies size. since have 2 classes think autoload overkill , not relevant here. what trying achieve if need transfer server or folder compatible , wont need me having edit bunch of links throughout site working. so have file constants called config.php put in classes folder define('const_int_path', $_server['document_root']); define('const_root_path', 'http://www.mysite.com'); define('const_project_path', const_root_path.'/website'); define("const_image_path", const_project_path.'/images/'); define("const_classes_path", const_project_path.'/classes/'); define("const_include_path", const_project_path.'/includes/'); define("const_js_path", const_project_path.'/js/'); define("const_css_path", const_project_path.'/css/'); so root of project i.e var/www equivilant www.mysite.com , subfolder of website var/www/websit

objective c - UIView continuous animation that repeats using a different frame iOS -

i doing animation on uiview , having repeat, working so: [uiview animatewithduration:6.0f delay:0.0f options:uiviewanimationoptionrepeat | uiviewanimationoptioncurveeasein animations:^{ self.imgtopcloud.frame = cgrectmake(-self.imgtopcloud.frame.size.width, self.imgtopcloud.frame.origin.y, self.imgtopcloud.frame.size.width, self.imgtopcloud.frame.size.height); }completion:nil]; this animates outside of view's bounds. now, when that, want imgtopcloud 's frame start right @ end of view this: //now start @ right self.imgtopcloud.frame = cgrectmake(self.view.frame.size.width, self.imgtopcloud.frame.origin.y, self.imgtopcloud.frame.size.width, self.imgtopcloud.frame.size.height); the issue is, when animation starts repeat, brings imgtopcloud 's original starting frame, not new 1 want. tried putting new frame in completion block of animatewithduration message, no dice. any ideas? don't repeat animation. instead, in completion block of animation, n

regression - getting complex-valued Jacobian Matrix using NonLinearModel.fit in matlab -

i trying use nonlinearmodel.fit() function in matlab regress 2 variables. however, getting following error: error using internal.stats.getscheffeparam>validateparameters (line 182) if non-empty, jw must numeric, real matrix. error in internal.stats.getscheffeparam (line 110) [j,vf,vp,jw,intopt,tolsvd,tole,vq,usingj] = validateparameters(j,vf,vp,jw,intopt,tolsvd,tole,vq,allowedintopt); error in nlinfit (line 340) sch = internal.stats.getscheffeparam('weightedjacobian',j(~nans,:),'intopt','observation','vq',vq); error in nonlinearmodel/fitter (line 1121) [model.coefs,~,j_r,model.coefficientcovariance,model.mse,model.errormodelinfo,~] = ... error in classreg.regr.fitobject/dofit (line 219) model = fitter(model); error in nonlinearmodel.fit (line 1484) model = dofit(model); error in getmatrix (line 101) nlm = nonlinearmodel.fit(regressormatrix',temp2',modelfun,beta0); my re

How do I set-up XCTest unit testing with a Cocos2d-v3 / SpriteBuilder project? -

i using new spritebuilder (was cocosbuilder) , cocos2d-v3 build interactive book. normal practice code using unit tests , want project incorporate xctest. so far have gone test navigator in xcode, hit '+' @ bottom , added test target per apple's documentation. xcode created test target , sample test class (just .m file failing unit test). i commented out textexample, , hit command+u test - , failed compile...monumentally. bazillions of errors , warnings. is there simple way solve this? here did got me through (i'm still not convinced it's ideal i'm importing unnecessary files unit testing. please me out if know better way). i followed instructions in entry on stackoverflow: http://www.cocos2d-iphone.org/forums/topic/adding-cocos2d-2-0-to-existing-iphone-project/ and got working. steps in there included adding cocos , spritebuilder files directly project, adding them compile sources, , adding number of header , user search paths. the fina

saving matlab image with contours plot on it -

i want save image contours drawn on in original dimension. say have 250x250 image, , draw contours (also 250x250) on it, can't seem save @ original dimension of image. right here's have iptsetpref('imshowborder','tight'); himg = imshow(myimage); hold on; contour(contour1, [0 0], 'b','linewidth',4); contour(contour2, [0 0], 'y','linewidth',2); hold off; if save image saveas(himg, filename); i super large 1200x900 image white borders on left , right, how change settings output file has same dimension input image without ugly white borders around it?' i can't use papersize because image handle cannot access figure functions, , gca options don't affect window size remove side borders

Homebrew installed to home directory - how to link to libs in autoconf? -

not sure if belongs on here or superuser, here goes: i have homebrew installed in $home/opt/homebrew dir (i'm pretty religious isolation user accounts - yes, i'm 1 of people). in case, homebrew doesn't install /usr/local/. works fine because added homebrew head of personal path in .bashrc. i'm using autoconf. i'm c newb. have configure.ac checks apache portable runtime. --install generate ./configure fine. when run ./configure, doesn't find - because it's not looking homebrew installed it. i assume have provide arguments ./configure script setting includedir , libdir. doesn't work. right way link these homebrew libs? for posterity: in configure.ac , use pkg_check_modules macro. assumes, of course, have pkg-check installed, via homebrew. pkg_check_modules(glib2, glib-2.0, [], [ac_msg_failure([glib-2.0 not installed])]) the macro above sets group of variables use in autoconf , automake files prefixed glib2 . i use in m

php - Find num value in array keys -

//i have array that: $roms = array ( [1] => 2 [2] => 4 [6] => 2 [7] => 7 ) //i have data table bellow: id room total_room 1 1b/1b 7 2 2b/2b 12 6 3b/ 2b 32 8 3b/3b 7 //when query result $total_rooms = 0 ; foreach( $query->result() $row ) { if ( $row->id , array_keys($rooms) ) : $total_rooms[] = array_values( $rooms ); // array values else: $total_rooms[] = $row->total_room; // table endif; } //i want result that: $total_rooms = 2; // array value $total_rooms = 4; // array value $total_rooms = 2; // array value $total_rooms = 7; // not array value : becos no id in keys but code not work me! can me? your if statement , following line little weird, try this: if(array_key_exists($row->id, $rooms)) : $total_rooms[] = $rooms[$row->id]; // array else:

Android Studio GridLayout Compatibility for older Androids -

i'm getting error when trying emulate app on 2.3 avd: 03-10 01:06:56.500 407-407/com.ak.ak0 e/androidruntime﹕ fatal exception: main java.lang.runtimeexception: unable start activity componentinfo{com.ak.ak0/com.ak.ak0.mainactivity}: android.view.inflateexception: binary xml file line #21: error inflating class gridlayout @ android.app.activitythread.performlaunchactivity(activitythread.java:1647) @ android.app.activitythread.handlelaunchactivity(activitythread.java:1663) @ android.app.activitythread.access$1500(activitythread.java:117) @ android.app.activitythread$h.handlemessage(activitythread.java:931) @ android.os.handler.dispatchmessage(handler.java:99) @ android.os.looper.loop(looper.java:123) @ android.app.activitythread.main(activitythread.java:3683) @ java.lang.reflect.method.invokenative(native method) @ java.lang.reflect.method.invoke(method.java:507) @ com.android.internal.os.z

python - Calculating and Plotting 2nd moment of image -

i trying plot 2nd moments onto image file (the image file numpy array brightness distribution). have rough understanding 2nd moment sort of moment of inertia (ixx,iyy) tensor not sure how calculate , how translate 2 intersecting lines centroid @ intersection. tried using scipy.stats.mstats.moment unsure put axis if want 2 2nd moments intersects @ centroid. also returns array not sure values in array signify, , how relate going plot (because scatter method in plotting module takes in @ least 2 corresponding values in order plotted) ? thank you.

javascript - Tumblr Masonry with PXU Photoset Issue -

i have issue pxu photoset extended not loading when use masonry tumblr theme. know causes it, sadly have no clue how fix it. the thing found reduced flickering while masonry loaded, hide container css (display:none) , unhide when loading masonry script. it seems had odd side-effect of pxu photoset script not rendering images (they're cut off , jump real size when resizing window). so use code call masonry, imagesloaded , infinite scroll: $(document).ready(function(){ var $container = $('#container'); $container.imagesloaded(function(){ $container.show(); $container.masonry({ itemselector: 'article', gutter: 50, isfitwidth: true, }); }); $container.infinitescroll({ navselector : '#pagination-infinite', // selector paged navigation nextselector : '#pagination-infinite a.next', // selector next link (to page 2) itemselector : 'arti

compiler construction - How to compile nested css rules using javascript -

i need little making own css-compiler in javascript. how can make compiler compiles nested rules example: html{ background: #2e2e2e; body{ height: 200px; width: 100%; background: #fff; a{ color: rgb(0, 0, 255); &:hover{ color: rgb(200, 0, 255); } } } } into this: html{ background: #2e2e2e; } html body{ height: 200px; width: 100%; background: #fff; } html body a{ color: rgb(0, 0, 255); } html body a:hover{ color: rgb(200, 0, 255); } thanks help! if vote down, please tell me why. i start mentioning building own css-compiler no joke. serious thing. should use sass, less, or stylus. if missing feature need, should build plugin them, rather try implement own engine. having said that, answer question may reworkcss . project people use make own css-compiler.

java - What is the practical use of Bytearrayoutputstream -

i have understood bytearrayoutputstream api. question bit different. interested in understanding real life scenario use ? reasons, seem feel fileio useful, trying understand use-case of bytearrayoutputstream. if you're generating transient data, it's nicer use byte array store data instead of worrying of cases in might have clean file later. file.deleteonexit() leaks memory , fails in event of system crash. temporary data, it's nice benefit automatic garbage collection. in context of clustered web applications session replication allows share data in user session. if user's session moved node, data still available web application. isn't case files on disk.

javascript - Bootstrap Modal with Select2 Focus issue -

Image
i have select2 selects on bootstrap 3 modal. for 3 components code follows $('#primarymodal').on('shown.bs.modal', function () { $(".icdlookup").select2({ .../ }): }; the problem have having in picture below. if make selection on select2 , focus out input focus still remain on select2 box. i've solved problem applying following fix (just put in js code): //fix modal force focus $.fn.modal.constructor.prototype.enforcefocus = function () { var = this; $(document).on('focusin.modal', function (e) { if ($(e.target).hasclass('select2-input')) { return true; } if (that.$element[0] !== e.target && !that.$element.has(e.target).length) { that.$element.focus(); } }); };

erlang - Factorial calculation between two integers -

the function supposed calculate sum of integers between 2 integers n , m n <= m. sum(n, m) -> if n+1 =< m -> n + sum((n+1), m); n =< m -> n; n > m -> 'n must <= m' end. is there better way this? can put second statement inside first? some comments , proposition -module (ex). -compile([export_all]). %% comments on proposal sum1(n, m) -> if %% if statement not popular in erlang since not realy if in java or c n+1 =< m -> n + sum1((n+1), m); n =< m -> n; n > m -> 'n must <= m' %% don't this, creates useless atoms limited %% in number , cannot destroyed during vm life end. %% second solution, tail recursive sum2(n,m) when n > m -> {error,"n must <= m"}; %% instead use guard return tuple %% standard atom + string reason sum2(n,m) -&g

python - Fail to deploy Django + Apache2 on Fedora 19 -

first this: cd /var/www/html django-admin.py startproject mysite then create /var/www/html/mysite/django.wsgi: import os, sys sys.path.append('/var/www/html/mysite') os.environ['django_settings_module'] = 'mysite.settings' import django.core.handlers.wsgi application = django.core.handlers.wsgi.wsgihandler() then append /etc/httpd/conf/httpd.conf by: <virtualhost 222.200.189.79:80> servername 222.200.189.79:80 documentroot /var/www wsgiscriptalias / /var/www/html/mysite/django.wsgi <directory /var/www/html/mysite> order deny,allow allow </directory> </virtualhost> finally restart apache: sudo httpd -k restart but until can see welcome page of apache when visit: http://localhost even more, "not found" error when visit: http://localhost/admin though url "^admin/" has been defined in

python 3.x - Sorting the grouped data as per group size in Pandas -

i have 2 columns in dataset, col1 , col2. want group data per col1 , sort data per size of each group. is, want display groups in ascending order of size. i have written code grouping , displaying data follows: grouped_data = df.groupby('col1') """code sorting comes here""" name,group in grouped_data: print (name) print (group) before displaying data, need sort per group size, not able do. you can use python's sorted : in [11]: df = pd.dataframe([[1, 2], [1, 4], [5, 6]], index=['a', 'b', 'c'], columns=['a', 'b']) in [12]: g = df.groupby('a') in [13]: sorted(g, # iterates pairs of (key, corresponding subdataframe) key=lambda x: len(x[1]), # sort number of rows (len of subdataframe) reverse=true) # reverse sort i.e. largest first out[13]: [(1, b 1 2 b 1 4), (5, b c 5 6)] note: iterator g ,

Mule - JUnit FunctionalTestCase getConfigResources(), what return statement should I use? -

from mule in action second edition ebook, i'm seeing following code snippet chapter 1 public class productregistrationfunctionaltestcase extends functionaltestcase { protected string getconfigresources() { return "./src/main/app/product_registration.xml"; } ... and, seeing below chapter 12 public class transformingbridgetestcase extends functionaltestcase { protected string getconfigresources() { return "functional-test-connectors.xml,jms-transforming-bridge.xml"; }... i have 2 questions regarding getconfigresources() return statement. (1) why ./src/main/... not required example in chapter 12? (2) how work behind scene having 2 xml in return statement chapter 12 example? getconfigresources() should return comma separated list of resources can loaded classpath. return value parsed configurationbuilder attached functionaltestcase, , mulecontext instantiated using resources. need use full src/main... path

php - POST method and arrays -

this first php project. have created website users can upload picture , view pictures of other users, 1 person @ time (similar old hotornot.com). code below works follows: i create array (called $allusers) containing members except user logged in ($user). i create array (called $usersiviewed) of members $user has either liked (stored in likeprofile table) or disliked (stored in dislikeprofile table). first column of likeprofile , dislikeprofile has name of users did liking/disliking, second column contains name of member liked/disliked. i use array_diff strip out $usersiviewed $allusers. list of users $user can view (ie, people have not liked or disliked in past). problem when click button, updates likeprofile table name of next person in array (i.e., not person who's picture looking @ person who's picture appears next). additionally, if refresh current page, person who's profile appears on current page automatically gets 'liked' me. appreciate advice on th

MySQL replication slave error 22 -

i'm having trouble mysql replication on slave side error 22, charset error. the error stated cannot found charset '#45' find odd since query used stating default character set latin1 collate latin1_swedish_ci , did checked on charset\index.xml , did exists. master : server version: 5.5.30-log slave : server version: 5.1.66-log current replication status: mysql> show slave status \g; *************************** 1. row *************************** slave_io_state: waiting master send event master_host: 10.10.2.21 master_user: repl master_port: 3306 connect_retry: 60 master_log_file: mysql-bin.000024 read_master_log_pos: 1065715871 relay_log_file: mysqld-relay-bin.000029 relay_log_pos: 86980698 relay_master_log_file: mysql-bin.000024 slave_io_running: yes slave_sql_running: no

java - Quickbooks Desktop: Billable status is not applicable for the specified Account type -

i have attempted submit following request content quickbooks desktop using v3 qb rest api <?xml version="1.0" encoding="utf-8"?> <ns0:purchase xmlns:ns0="http://schema.intuit.com/finance/v3" domain="qb"> <ns0:txndate>2014-03-10</ns0:txndate> <ns0:privatenote>report qbd</ns0:privatenote> <ns0:line> <ns0:description>60000 advertising , promotion</ns0:description> <ns0:amount>10.00</ns0:amount> <ns0:detailtype>accountbasedexpenselinedetail</ns0:detailtype> <ns0:accountbasedexpenselinedetail> <ns0:customerref name="toeic">qb:17</ns0:customerref> <ns0:accountref name="advertising , promotion">qb:7</ns0:accountref> <ns0:billablestatus>notbillable</ns0:billablestatus> <ns0:taxcoderef>non</ns0:taxcoderef> </ns0:accountbasedexpenselinedetail>

iterating through json in javascript -

i have iteration trough json cannot make work. $.post('getdatafromdatabase.php', function(data) { var output="<ul> start "; (var in data.results) { output+="<li>" + data.results[i].id + " " + data.results[i].latitude + "--" + data.results[i].longitude+"</li>"; } output+=" end </ul>" + data; document.getelementbyid("bounds").innerhtml += output; }); the "start" , "end" print. after "end" printing "data" out works, know getting data database , looks this: {"results":[{"id":"1","latitude":"47.49882200000000","longitude":"19.05680300000000"}, {"id":"2","latitude":"47.49273300000000","longitude":"19.03345700000000"},{"id":"3","latitude":"47.47765

javascript - How to make the dc.js charts responsive -

is there way make dc.js charts responsive? i'm struggling lot make charts fit desktop size. i'm using twitter bootstrap 3. store width of div variable , pass chart width. not make chart responsive. on first load charts width according size of screen. but face challenge in it, have different file dc.js chart. and i'm calling through iframe . when call through iframe width 0 divs, , no charts appear in webpage. but when reload iframe alone, charts appearing. i tried load frame when click on particular navigation item. didn't work me. someone me overcome issue. i've set plunker dc.js demo have rerendering when resized, , getting width of container element determine size. embedded in iframe , working as-is. suggest playing plunker fit css, i'm making simplest possible iframe setup. i'm imagining did similar this, i"m not sure went wrong. helps. responsive dc chart in iframe given standard page iframe: <body> &

Posting to Google Plus from Android app -

Image
hi have problem when i'm trying post info android app google plus, code have share following: public void shareongoogleplus(activity activity, string caption) { plusshare.builder builder = new plusshare.builder(activity); // set call-to-action metadata. builder.addcalltoaction( "create_item", /** call-to-action button label */ uri.parse("http://plus.google.com/pages/create"), /** call-to-action url (for desktop use) */ "/pages/create" /** call action deep-link id (for mobile use), 512 characters or fewer */); // set content url (for desktop use). builder.setcontenturl(uri.parse("https://plus.google.com/pages/")); // set target deep-link id (for mobile use). builder.setcontentdeeplinkid("/pages/", null, null, null); // set share text. builder.settext(caption); activity.startactivityforresult(builder.getintent(), 0) } this method called when butto

Magento get product collection via custom observer -

i have custom observer in magento 1.8.1.0 called on product view page when current product having upsell products. have verified (using mage::log()) observer working, when try following: public function updateupsells(varien_event_observer $oobserver) { $icurrentcategory = mage::registry('current_category')->getid(); $oupsellcollection = $oobserver->getcollection(); foreach ($oupsellcollection->getitems() $key => $oupsellproduct) { $acategoriesids = $oupsellproduct->getcategoryids(); if (!in_array($icurrentcategory, $acategoriesids)) { $oupsellcollection->removeitembykey($key); } } } on echo $oupsellcollection; got nothing returned ? is know how upsell products collection ? proper way ? $upsellcollection = $_product->getupsellproductcollection();

Device tree bindings? -

do have go through device tree bindings documentation of linux kernel when start working on it. there no standard set of fields in device tree followed distros/kernel sources? secondly need guidance regarding adding nodes devices on gpio bus using device tree. have consulted http://devicetree.org/device_tree_usage . stackoverflow-query here should point documentation on device tree. , yes idea go through documentation before dive using it. as gpio devices (i assume have gpio controller in place in dts/dtsi file in place), there should plenty under arch/arc/boot/dts . pick 1 :)! eg: gpio1_8 mmc dts , gpio1 controller dtsi

jquery - How do I use a DIV element for content I want to vertically scroll with the browser's scroll bar? -

question: how can create div controlled browser's scroll bar precisely developers of website below have done border effect around affected element? -- example: http://tinyurl.com/flywheeeel -- additional information i understand concept of fixed positioning, element order , overlay manipulation curtain reveal effect depend on, can not grasp how replicate layout , behavior of above website. since scroll function becomes available when content flows beyond viewport area, can think ordered element or background element exceeds viewport area activating scroll function. perhaps thought explain trailing form too.

javascript - Add a default parameter AddEventListener function call -

i creating js function takes id specific values , add event listener of them. of them listen click event , when it's clicked should call function has 2 arguments. these parameter values unique each id. for (var = 0; < globalarray.length; i+=3){ document.getelementbyid(globalarray[i]).addeventlistener("click", loadtable(globalarray[i+1], globalarray[i+2]), false); } here have globalarray first element id , second , third ones first , second arguments respectively. how can thing. each time calls, not adding eventlistener. but not call function, adds event listeners gets ready trigger 'some' function whenever "demobutton" button clicked. document.getelementbyid("demobutton").addeventlistener("click", some); use anonymous function when called call loadtable function respective arguments. for (var = 0; < globalarray.length; i+=3){ document.getelementbyid(globalarray[i]).addeventlistener("click"

javascript - How should I invoke Spin.js in AMD mode by using TypeScript? -

Image
i have implement loading effect using spin.js. below code: /// <amd-dependency path="spin" /> export class spinnerutil { private target: htmlelement; private spinner: spinner; public constructor(target: htmlelement) { this.target = target; } public spin() { var target = this.target; if (target.childelementcount == 0) { this.spinner = new spinner().spin(target); } } public stop() { this.spinner.stop(); $(this.target).empty(); } } i invoked in typescript file this: initialization: require.config({ baseurl: 'javascripts', paths: { 'jquery': '../libraries/jquery/jquery-2.1.0', 'spin': '../libraries/spin/spin-1.3.3' }, invoking: import sp = require('utilities/spin'); var spinnerid = 'spinnerview' + this.viewid; this.$el.find('#spinnerview').attr('id', spinnerid); var target: htmlelement

business intelligence - how to use the Pentaho data integration for reporting -

in project using pentaho data integration , saiku-server reporting. now new business intelligence thing , confused functioning performed software. senior coder here dont tell me thats why asking here. i confused functioning provided these tools pentahoo pan kitchen spoon saiku there scripting generates these 4 files cube.json sims.json schema.json path.json now don't know software using json files pentahoo , saiku spoon or what. can give me idea pentaho data integration 1 of open source tool provided pentaho suit. spoon used create transformation using gui interface. if want run transformations , jobs use kitchen or spoon. (mainly used running things using command line) saiku 1 of server, pentaho has server (pentaho bi server) , in can add saiku pluggin displaying cubes designed in pentaho schema workbench. for more understanding google terms mansion in answer.

Does smtp in IIS refer to smtp service or smtp server? -

in control panel there option turn on features not installed default. when turn on iis feature has option called smtp email. refer smtp service or smtp server? have looked answer. there no concrete answer. it's service others refers server. can please me confusion?? the smtp service under iis simple relay agent. cannot use mail server, there no real interface retrieving (reading) emails service. you typically use smtp service sending buffer outgoing emails generated server (e.g. website). configure smtp service relay outgoing emails (e.g. smarthost) , can have website generate emails local smtp service. way website not affected if network or other server problems affect mail sending, smtp service queues emails generate , can automatically retry deliveries etc.

jquery if no change made to the input field after 10 seconds, show this Div -

i have button changes form on click. how change after 10 seconds if nothing inputted (if form still empty)? update: $(document).ready(function(){ $("#btn").click(function (){ $.ajax({ success: function(html){ if(html){ $('#btn').replacewith('<input class="offer_pay_form" type="text"><input type="submit" value="submit"></span>'); } } }); }); use this settimeout(function(){ if($("input").val()=="") { alert("you havent input yet"); }},10000); demo instead of replacing. try way <input type="button" id="btn" /> <div id="container"></div> script $(document).ready(function () { $("#btn").click(function () { $.ajax({ success: function (html)

java - why getting “No Persistence provider for EntityManager” when running with jnlp while standalone jar works fine -

Image
environment win 8.1 mysql server: localhost netbeans 7.4 java: 1.7.0_51 (j2se) jre: 1.7.0_51-b31 eclipselink(jpa 2.1) there several posts asking “no persistence provider entitymanager named…” error. developing j2se (not j2ee). however, problems seem silly troubles me 2days. need other software standalone program work? why oaky when run program under netbeans ide? sort of environment setting issue failed try? working snapshot , eclipselink message! i use netbeans write code, , runs okay. now, decided copy whole standalone package out “d:\netbeanswork\projcosttracking\dist”. have change security setting medium in java control panel. then, double-clicked on projcosttracking.jnlp launch. well, see. this persistence.xml <?xml version="1.0" encoding="utf-8"?> <persistence version="2.1" xmlns="http://xmlns.jcp.org/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:schemalocation=&qu

c# - Parallel calls of two methods using threads - One executing before one finished -

i using multi threading in c# application upload images. the flow is, first resizing images. second uploading them. code : upload button click private void button_click_1(object sender, routedeventargs e) { resizeimagesatlocal(); uploadimagetocloud(); } private void resizeimagesatlocal() { var worker = new backgroundworker { workerreportsprogress = true }; worker.dowork += worker_resizeimages; worker.progresschanged += worker_resizeprogresschanged; worker.runworkerasync(); } private void worker_resizeprogresschanged(object sender, progresschangedeventargs e) { resizeprogress.value = e.progresspercentage; } private void worker_resizeimages(object sender, doworkeventargs e) { ... } private void uploadimagetocloud() { var worker = new backgroundworker(); worker.workerreportsprogress = t

javascript - Adding a progress bar - dc.js -

i wanted add progress bar dc.js charts. i'm doing visualization on huge data. , when open browser open html elements loads first without graph on web page. it looks horrible when html elements visible. and after while charts show up. any suggestions how add progress bar me. thanks in advance.

smtps - How to remove default disclaimer in javamail -

when sending emails via javamail, following appended bottom of each message: this email , files transmitted confidential , intended solely use of individual or entity whom addressed. if have received email in error please notify system manager. message contains confidential information , intended individual named. if not named addressee should not disseminate, distribute or copy e-mail. please notify sender e-mail if have received e-mail mistake , delete e-mail system. if not intended recipient notified disclosing, copying, distributing or taking action in reliance on contents of information strictly prohibited. how 1 prevent this? (note: problem extremely frustrating research on web due fact disclaimer of form attached many indexed documents! :-( javamail not doing that, outgoing smtp server appending each message, set it. to confirm, can use gmail's servers ( with personal account ) , see not added messages.

perl - DBIC- select specific columns in "prefetch" while maintaining has_many relationship -

i have 2 tables 'artist' has_many 'cd' . i want fetch 'artist' , 'cds' , use hashrefinflator (json format) use 'hashrefinflator'. [ { "artist_name": "dummy", "artist_id": "1", "cds": [{ "cd_id": "1, "cd_desc": "dummy", }], }, ] 1. when use $schema->resultset('artist')->search({}, { prefetch => 'cds', }); result "extra" column cd table . want able select specific column 'cd'. when use $schema->resultset('artist')->search({}, {'+select' => [ 'columns need' ], '+as' => [ &

api - Android Map is not showing -

i following tutoial http://www.androidhive.info/2012/08/android-working-with-google-places-and-maps-tutorial/ i 100% sure did same, app works fine my problem can not see map , i've worked google map before , 100% sure api key map. you generating key google map version 2 , using code on google map version 1. both totally different follow tutorial explains how integrate google map version 2 in application not version 1.

symfony - How do I invalidate cache for a controller url? -

i want invalidate http cache in symfony2. use following method: protected function invalidatecache($url) { $ch = curl_init(); curl_setopt($ch, curlopt_url, $url); curl_setopt($ch, curlopt_customrequest, 'purge'); curl_setopt($ch, curlopt_returntransfer, true); curl_setopt($ch, curlopt_header, true); curl_exec($ch); $status = curl_getinfo($ch, curlinfo_http_code); curl_close($ch); return $status == 200; } that works, no problem. when use esi include controller() function (not path()) like: {{ render_esi(controller('acmedemobundle:default:index')) }} how url generated controller function? or how can invalidate cached response of esi request? so here how it: don't. the reason why wanted use controller() function instead path() because symfony protect url controller() unauthorised requests. should use path() , prefix urls "esi/" , protect url in security.yml. //app/config/security.yml security:

javascript - "Cannot load unregistered resource /.extlib/dijit/nls/de/pickers.js" -

a given xpages application throws quite errors regarding non-existence of /.extlib/dijit/nls/de/pickers.js i don't know why resource not exist nor why referenced @ all, don't know referenced if was, , don't know whether general problem of xpages in domino 9 or if predecessor in job entered code throws error. so, should error stack tell me: "error: unable load /xsp/.ibmxspres/.extlib/dijit/nls/de/pickers.js status: 404 @ error (native) @ new _505 (http://domino/xsp/.ibmxspres/dojoroot-1.8.1/dojo/dojo.js:15:134185) @ _389 [as handleresponse] (http://domino/xsp/.ibmxspres/dojoroot-1.8.1/dojo/dojo.js:15:94245) @ xmlhttprequest._395 (http://domino/xsp/.ibmxspres/dojoroot-1.8.1/dojo/dojo.js:15:94545) @ xhr (http://domino/xsp/.ibmxspres/dojoroot-1.8.1/dojo/dojo.js:15:96613) @ object.$ddfg_ [as xhr] (http://domino/xsp/.ibmxspres/dojoroot-1.8.1/dojo/dojo.js:15:114193) @ function.$ddfh_ (http://domino/xsp/.ibmxspres/dojoroot-1.8.1/dojo/doj

assembly - READING CHARACTER FROM CURSOR -

i working on video application in assembly. use code video mode mov ah,0 mov al,13h int 10h then i'm writing using print (because i'm using emu8086) mov ah,02h mov dh,1 mov dl,1 int 10h mov ax,0h mov ax,[bp] mov ah,0 call print_num then i'm trying read character in dh, 1 dl,1 should char matrix with mov ah,02h mov dh,1 mov dl,1 int 10h mov ah,08h int 10h sub al,'0' but i'm getting al = 00 before sub al,'0' , al = d0h after line when should 4 or 5 depending matrix what doing wrong? or can't char in video mode? so, appears you're selecting mode 13h, believe 320x200x8bpp? bios getchar routines function in text modes. don't contain logic map pixels graphics modes characters. you'd have write yourself.

ruby on rails - EVM plugin in redmine is not working when the banner is enabled -

i'm redmine user.when banner enabled evm plugin not working.the log below.any 1 please suggest solution working plugin without disabling banner started "/redmine/admin/plugins" 10.222.185.22 @ 2014-03-10 06:42:05 +0000 processing admincontroller#plugins html current user: admin (id=1) rendered admin/plugins.html.erb within layouts/admin (10.8ms) rendered admin/_menu.html.erb (12.7ms) rendered plugins/redmine_banner/app/views/banner/_project_body_bottom.html.erb (0.1ms) rendered plugins/redmine_banner/app/views/banner/_body_bottom.html.erb (8.2ms) rendered plugins/redmine_banner/app/views/banner/_after_top_menu.html.erb (9.2ms) rendered layouts/base.html.erb (45.6ms) completed 200 ok in 93ms (views: 80.7ms | activerecord: 3.3ms) started "/redmine/settings/plugin/redmine_banner" 10.222.185.22 @ 2014-03-10 06:42:09 +0000 processing settingscontroller#plugin html parameters: {"id"=>"redmine_banner"} current user: adm

c++ - Why does the ternary operator const my strings? -

i writing code graphical lcd driven atmega328, using arduino build chain stino ide. have function formats , displays number label. function: void displaynumber(float value, char* label) i realise both parameters const ed, maintain compatibility other code, this. if call function follows: displaynumber(externaltemp, "max"); it works fine. understand string literals behave strangely in can't modified (undefined behaviour) not declared const char* char* . if try using ternary operator pass argument function: displaynumber(externaltemp, animate10s?"max":"min"); i compiler error: invalid conversion 'const char*' 'char*' why ternary operator const ing string? the compiler used avr-gcc/avr-g++ version 4.3.2, 1 bundled arduino beta 1.5.6-r2. there (or until recently) deprecated conversion string literal char * (without const have), lets simple call work. the ternary expression not string literal, conv

service - Error initializing callout mediator : The system is attempting to engage a module that is not available: -

i using callout mediator in wso2 proxy service named sample proxy. have given axis2.xml , axis client repository location while creating callout mediator. while saving proxy getting following error unable add proxy service :: error trying add proxy service esb configuration : sampleproxy :: error initializing callout mediator : system attempting engage module not available: addressing-error trying add proxy service esb configuration : sampleproxy :: error initializing callout mediator : system attempting engage module not available: addressing cany 1 me on please are trying perform blocking call via callout mediator ? if so, don't have change configuration in esb. please refer sample 430: callout mediator synchronous service invocation

php - Symfony 2.4 CRUD please; Controller not found -

i'm (almost) new symfony , i'm using 2.4 got problem giving me lots of headaches. several days have not been able fix issue. i use app/console commands build base code; entities crud: doctrine:generate:entity (to build models), code relations, etc doctrine:generate: entities (to generate setters, getters, etc) doctrine:schema:update --force (to update database models) generate:doctrine:crud (to make controllers, forms, etc....) at last, since choose declare routing via annotations, import bundle's routing.yml file controller routes like: autocondatecrbundle_controllers: resource: "@autocondatecrbundle/controller" type: annotation this, far i'm aware, makes available routes inside generated controllers @ crud generation. however, no matter route try test, symfony keeps telling me: fileloaderloadexception: cannot import resource "/var/www/autocondat-ecr/src/autocondat/ecrbundle/controller" "/var/www/autocondat-ecr/src/aut

installation - Create setup with InstallShield -

i want create setup winform .net application installshield 2010.i know steps , have created setup works fine. but application need several resources run , want know if there standard way add these resources setup instead of adding them same folder .exe files have done in setup? note beginner in installshield please give me complete tutorial of working software if have. to add files , folders using files explorer: in view list under specify application data , click files . in feature list, select feature want file associated. in destination computer’s folders pane, right-click destination computer , click predefined folder want use. if need create further folder hierarchy, right-click predefined folder, click add , , provide name folder. repeat necessary. in destination computer’s folders pane, click folder want place file. in source computer’s folders pane, navigate folder containing file want add. select , drag file want add source computer’s files pane

python - How to build a neural network with pybrain? -

i new pybrain , having lot of problem in building neural network. documentation not clear me , did not find lot of examples in web. i neural network 1 input, 1 hidden layer, 1 output. x--->f1(x),f2(x),...,b---->g(z) it should simple example. hidden layer has different function , bias unit. example can consider f1=f2=sigmoid , g custom function. this have done far not sure @ doing right. and have no idea of how add bias unit on hidden layer. class glayer(neuronlayer): def _forwardimplementation(self, inbuf, outbuf): outbuf[:]=g(inbuf) def _backwardimplementation(self, outerr, inerr, outbuf, inbuf): inerr[:]=derivative(g,inbuf)*outerr print "build network" #layer inlayer=linearlayer(1) hlayer=sigmoidlayer(2) outlayer=glayer(1) net=feedforwardnetwork() net.addinputmodule(inlayer) net.addmodule(hlayer) net.addoutputmodule(outlayer) #connection in_to_hidden = fullconnection(inlayer, hlayer) hidden_to_out = fullconnection(hlayer

android - Grid View Auto fit is not showing full images -

Image
why grid view showing images this? my code: <gridview android:id="@+id/grid_view" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_below="@+id/sbsz" android:numcolumns="auto_fit" android:columnwidth="90dp" android:horizontalspacing="10dp" android:verticalspacing="10dp" android:gravity="center" android:stretchmode="columnwidth" > </gridview> image adapter: @override public view getview(int position, view convertview, viewgroup parent) { linearlayout linearlayout=new linearlayout(mcontext); imageview imageview = new imageview(mcontext); text=new textview(mcontext); linearlayout.setorientation(linearlayout.vertical); imageview.setimageresource(mthumbids[position]); imageview.setscaletype(imageview.scaletype.fit_xy); imageview.s

How to pivot two values in mysql? -

i've following table structure: +-------+----------+------+------------+------------+ | agent | product | type | value_2013 | value_2014 | +-------+----------+------+------------+------------+ | john | product1 | | 10 | 11 | | john | product1 | c | 14 | 13 | | mike | product1 | | 11 | 20 | | mike | product2 | c | 13 | 15 | +-------+----------+------+------------+------------+ type or c need transform (pivot) in table agent, product, type, value_2013_a, value_2013_c, value_2014_a, value_2014_c ... ... i've write following sql query not works. take first type select agent,product, case when type='c' value_2013 else 0 end value_2013_c, <-- take value,ok! case when type='c' value_2013 else 0 end value_2013_a, <-- not take value case when type='a' impap else 0 end value_2014_a, <-- take value, ok! case when type='a' impac else 0

implementing trackball rotation in opengl with FLTK: how to 'remember' successive rotations -

i'm working on fltk project (my first attempt @ guis , opengl: please bear me!) , have fl_gl_window displays various things depending on other widgets. 1 of options display contents of screen in 3d , have use able rotate in 3d mouse. in principle fine (i use fl::event functions in window handler achieve mouse/window positions , updated x,y,and z rotation angle applied in given order), way doing unintuitive (because of non-commuting rotations etc etc) implementing trackball (similar 1 here: http://www.csee.umbc.edu/~squire/download/trackball.c ). understand how works , can rotate expected along correct axis first mouse drag. but... the problem is, far can tell, in order work (ie multiple mouse drags) modelview matrix has maintained in order rotate object relative displayed orientation glrotatef applied every mouse drag. now, way have learned basic opengl fltk have draw() function called whenever changes, (as far can tell in fltk , me) has start scratch every time window has co

android - ViewPager- fetching images from parse.com -

i need fetch images , texts parse database. can drawable folder problem parse. here images stored in drawable folder how can download images parse & store in folder. shall use path urls of images? please help. public class mainactivity extends activity { // declare variables viewpager viewpager; pageradapter adapter; string[] rank; string[] country; string[] population; int[] flag; underlinepageindicator mindicator; @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); // view viewpager_main.xml setcontentview(r.layout.viewpager_main); flag = new int[] { r.drawable.china, r.drawable.india, r.drawable.unitedstates, r.drawable.indonesia, r.drawable.brazil, r.drawable.pakistan, r.drawable.nigeria, r.drawable.bangladesh, r.drawable.russia, r.drawable.japan }; // locate viewpager in viewpager_main.xml viewpager = (viewpager) findviewbyid(r.id.pager); // pass results viewpa

postgresql - Django select_related with join on multiple fields -

i have complex database in django. makes extensive use of partitioned tables. have had problems before django , partitioned tables far have found satisfactory solutions of problems. my newest problem concerns foreign key relationship between 2 partitioned tables. have model called event submodel called monitorevent houses additional information type of events. the, question, important fields of models are: class event(models.model): id pk, (automatically added) ts timestamp class monitorevent(event): event_ptr_id fk -> event (automatically added) ts_copy timestamp both tables partitioned month using timestamp. timestamp, not part of pk, since django not allow multi-field pks. (i have tried using joined pk fields without success stackoverflow question ) therefore need copy of timestamp in subclass allow partitioned table of subclass. now problem: select events , monitorevents executing: event.objects.all().select_related('monitorevent') (i wo