Posts

Showing posts from September, 2014

java - List all activated notifications in a ListView -

i can't delete notifications havent' created know but....can list notifications (the text mainly) put them in listview or control ? thanks if you're targeting api level 18+, can use notificationslistenerservice this. note need special bind_notification_listener_service permission. <service android:name=".notificationlistener" android:label="@string/service_name" android:permission="android.permission.bind_notification_listener_service"> <intent-filter> <action android:name="android.service.notification.notificationlistenerservice" /> </intent-filter> </service> you can use notificationlistenerservice.getactivenotifications() method current notifications. if want support on api level 17 or less can use accessibility api read notifications, it's more complicated.

c# - Use visual Studio designer with custom build tool -

i have winforms application , want create class hierarchy like: myform : myothernonabstractform : system.windows.form as i'm using custom build tool not integrated vs, i'm unable view myform in designer (as i'm unable build inside vs). is there workaround having designer-view myform without building solution in vs? add resulting dll reference, doesn't seem workaround ...

angularjs - Why does my highchart only expand horizontally to fill its containing div, and not vertically? -

fiddle i'm using highcharts-ng. in fiddle above, i've created simple case shows problem i'm having - when chart enclosed in div, expands horizontally fill it, not vertically. why this? there way can make expand vertically well? so won't let me post without code, here's what's in above fiddle: html: <div ng-app="myapp"> <div ng-controller="myctrl"> <div id="chartcontainer" > <highchart id="chart1" config="chartconfig"></highchart> </div> </div> css: #chartcontainer { background-color: #af3456; width:777px; height:500px; padding:10px; } javascript: //see: https://github.com/pablojim/highcharts-ng var myapp = angular.module('myapp', ["highcharts-ng"]); myapp.controller('myctrl', function ($scope) { $scope.chartconfig = { series: [{ data: [10, 15, 12, 8, 7] }], }

java - libGDX - how to use 3D object indicating direction in 3D space? -

i use libgdx 3d game. in game 3d arrow should indicate direction in 3d space. player moving, direction of 3d arrow updated every frame. i want place arrow in direction, camera looking 3 units before camera , arrow visible. therefore added camera direction current camera position , used translation part arrow. direction calculated substracting arrow position target. all works fine, arrow displayed @ right position , moves. problem is, sometimes points target, , not . here code: vector3 targetposition = new vector3(1, 1, 10); vector3 cameraposition = gamecontroller.getcamera().position.cpy(); vector3 cameradirection = gamecontroller.getcamera().direction.cpy(); vector3 = gamecontroller.getcamera().up.cpy(); vector3 arrowposition = cameradirection.scl(3).add(cameraposition); vector3 arrowdirection = targetposition.cpy(); arrowdirection = arrowdirection.sub(arrowposition).nor(); matrix4 transformationmatrix = new matrix4(); // calculate orthogonal vector up.crs(arrowdirecti

numpy - Delete columns of matrix of CSR format in Python -

i have sparse matrix (22000x97482) in csr format , want delete columns (indices of columns numbers stored in list) you can use fancy indexing obtain new csr_matrix columns have in list: all_cols = np.arange(old_m.shape[1]) cols_to_keep = np.where(np.logical_not(np.in1d(all_cols, cols_to_delete)))[0] m = old_m[:, cols_to_keep]

ios - Tableview hidden under navigation bar (but only for one tab) -

Image
i using xcode 5 storyboard , auto layout. views are: root navigation view tab view controller (its default view navigation view) two tab views in both tab views, put uitableview on it, , set standard ib stuff. both tab view controllers identical in code in terms of setup (they both derive uiviewcontroller). for tableview however, things weird. first table view has right setting, cells start "below navigation" , can scroll up. second table view starts cells "under navigation" - seems insets wrong. but why wrong second tab view, , not first? did not funky either, , i've pored on code multiple times sure both tableview controllers identical (except in cell contents). (on second image, notice bit of green under "carrier" status bar). i faced same problem once. try toggling "under top bars" in view controller's attributes inspector. this worked me. hope too. thanks.

ruby on rails - Visit method not found in my rspec -

my java web application running on tomcat @ http://localhost:8080/ writing first spec, home_spec: require 'spec_helper' describe "home" "should render home page" visit "/" page.should have_content("hello world") end end and running: rspec i get: f failures: 1) home should render home page failure/error: visit "/" nomethoderror: undefined method `visit' #<rspec::core::examplegroup::nested_1:0x242870b7> # ./spec/home/home_spec.rb:7:in `(root)' finished in 0.012 seconds 1 example, 1 failure failed examples: rspec ./spec/home/home_spec.rb:6 # home should render home page shouldn't work because have included capybara in spec_helper? how know visit correct url? if url localhost:3030 or localhost:8080? my gemfile: source 'http://rubygems.org' gem "activerecord" gem "rspec" gem "capybara" gem "ac

crowdsourcing - How do I redirect Crowdflower users to my website? -

i have specific problem: create crowdflower job, in participant redirected website (let's http://www.xxx.yy ), complete task , after finishes, he'll redirected crowdflower , paid. possible that? i imagined have api, user token, sent website , after completion of job api call mark task finished. however, can't find in documentation such thing ( http://success.crowdflower.com/customer/portal/articles/1288323 ). the reason need redirect users website need more freedom cml (crowdflower markup language used creating tasks) offers: i need able embed swf file the swf file should chosen randomly aray of files (approx. 10) i need able measure how long s/he spends on website , act based on time store data database all these things can done pretty using javascript , php, don't think can done in cml, that's why need redirect them website. can you, please, give me advice how this?

javascript - Issue on Using One Switch Botton to Toggle Functions in jQuery -

i using 2 buttons slide , down page @ this sample as: <div id="map"><button type="button" class="btn btn-default green goinfo">go info</button></div> <div id="info"> <button type="button" class="btn btn-default green gomap">go map</button></div> can please let me know how can reduce buttons do same job? : <button type="button" class="btn btn-default slider">switch view</button> jquery jquery('body').css('overflow','hidden'); var viewheight = $('#map').height(); $('.goinfo').fadein(); $(window).scroll(function () { if ($(this).scrolltop() < 100) { $('.goinfo').fadein(); } else { $('.goinfo').fadeout(); } }); $(window).scroll(function () { if ($(this).scrolltop() > 100) { $('.gom

javascript - C# WebBrowser turn off jquery popups -

i have application uses webbrowser control navigate page page, on pages leaving popup asking me if that's want do.. stops whole further execution until press "leave" or "stay".. how can disable them? what i've tried far these actions: a) setting window.onbeforeunload = null; b) setting alert, confirm, prompt empty function c) settin suppresserrormessages true but so, still nasty message in end. i relied on answer: how update dom content inside webbrowser control in c#? but far without success. alerts seem jquery alerts because have custom texts (instead of ok cancel, have stay leave).. any hugely appreciated!! the webbrowser control uses ie internally , ie has prompt if you've filled out form asking if want leave page (thereby losing content you've filled out) perhaps that's you're seeing? i'm shooting hip here try clearing inputs before navigating.

node.js - node orm hasone relationship -

i'm trying use simple hasone relationship node orm module: var shop = db.define('shops', { id: { type: "serial", key: true }, name: string }); var offer = db.define('offers', { id: { type: "serial", key: true }, name: string }); offer.hasone('shop', shop); then shop of selected offer; in doc written hasone relationship sets new method, getshop in case: offer.find(1, function (err, firstoffer) { if (err) throw err; firstoffer.getshop(function(err, shop) { res.send(shop); }); }); but crashes saying firstoffer has no method 'getshop'... can explain i'm doing wrong? i think confusing find get. please change code (note in first line): offer.get(1, function (err, firstoffer) { if (err) throw err; firstoffer.getshop(function(err, shop) { res.send(shop); }); }); when find returns array (it can return empty array), calling getshop array.

asp.net - Getting TextBox's Text on Next Page if Visible is false (Cross-Page Postback) -

i have aspx page contains 2 tables (each textbox controls in it). when page first rendered, first table shown (second table's visible property set false ). user fills out textboxes , clicks continue button. now, first table's visible = false; , second table's visible = true; , user fills out second table. submit button clicked. postbackurl of button set new page in i'm trying , display entered in last page using request.form["ctrlname"]; the problem is... first table's visibility set false server never rendered it. shouldn't data still in viewstate? how retrieve data first table not rendered? obviously cant use request.form["table1ctrlname"]; data textbox in table1, isn't there way of querying incoming viewstate directly data? you can use previouspage property on next page. example: page-1 (aspx): <asp:panel id="pnl1" runat="server"> first text box: <asp:textbox id

jquery - Javascript regex .test() "Uncaught TypeError: undefined is not a function" -

just trying use javascript's regex capabilities .test() function. var nameregex = '/^[a-za-z0-9_]{6,20}$/'; if(nameregex.test($('#username').val())) { ... } the error on line if(nameregex.test($('#username').val())) { debugger breaks there , says "uncaught typeerror: undefined not function" . seems .test() not defined? shouldn't be? as stands, nameregex isn't regex string , string doesn't have test functon why getting error. remove quotes around regex. literal form of regex. var nameregex = /^[a-za-z0-9_]{6,20}$/; //remove quotes

linux - echo $HTTP as plain text -

i trying create bash file modify files have problem 1 command. when use sudo echo "$http["url"]" >> file.conf error permission denied. want file have $http["url"] inside, $http not variable in bash text. if put inside of single quotes, should work echo '$http["url"]'

java - I want to load a browser component and want to fire a URL -

i want load browser component using swing. below full requirement want create 1 desktop application load browser component , fire 1 url user 1 jsp page deployed in server. googled , found 1 code below link problem jsp page loaded without css or have applied while making jsp page http://www.java-tips.org/java-se-tips/javax.swing/how-to-create-a-simple-browser-in-swing-3.html i verified css applied firing url in browser. tried using jxbrowser api giving me licensing error.may paid version(i not sure) appriciated. thanks in advance you cal load browser eclipse.swt.browser.browser class check url : http://www.java2s.com/tutorial/java/0280__swt/usingbrowsertoloadawebsite.htm

objective c - NSMenu click in OS X -

how can detect when menu in menu bar clicked? mean when whatever clicked example "file" menu not concrete position in menu. i tried connect ibactions menu items in interface builder code, not work main menu item "file" submenus within menu first of all, trying achieve in big picture? perhaps knowing when menu bar has been clicked not best approach. you might able achieve you're interested in observing nsmenudidbegintrackingnotification notification, it's hard tell. example, fire keyboard-initiated tracking, too.

javascript - Random generated colors and saving them in CSS -

i'm won't able explain 100% because if figure out. i'm trying code chat room. want use javascript randomly generate color , assign someone's name. assign once , when type new message defaults. how make color sticks? have far: $(document).ready(function() { $('.username').each(function () { var hue = 'rgb(' + (math.floor((256-199)*math.random()) + 200) + ',' + (math.floor((256-199)*math.random()) + 200) + ',' + (math.floor((256-199)*math.random()) + 200) + ')'; $(".username").css("color", hue); }); }); try using $(this) instead of $(".username") inside each function: $('.username').each(function () { var hue = 'rgb(' + (math.floor((256-199)*math.random()) + 200) + ',' + (math.floor((256-199)*math.random()) + 200) + ',' + (math.floor((256-199)*math.random()) + 200) + ')'; $(this).css("color", hue); });

big o - Big O complexity of this loop -

if have int i; for(i = 1; < n; *= 2) //n size of array passed function { //o(1) code here } what big o complexity? "i *= 2" bit confusing me. tried operation counting i'm more confused. it looks o(log(n)), because iterate not on whole sequence, use power-of-two steps.

html - Broken positioning of a <ul> menu element -

Image
i trying position website navigation on right of header. however, existing code messy , can't work. i talking navigation @ website's header - https://softuni.bg/ notice how it's broken , positioned below header. i want this: the main problem of in tag, has width. however, if logged in user, item in menu , falls on second line.. all appreciated! try code in id #loginbtn>li>a your code: #loginbtn>li>a { background: #ff9c00; border-radius: 0; padding-left: 12px; padding-right: 15px; position: absolute; top: 0; right: 0; } modified coad: #loginbtn>li>a { background: #ff9c00; border-radius: 0; padding-left: 12px; padding-right: 15px; position: absolute; top: 0; left: 0; /* modifide line */ margin-left: 250px; /* modifide line */ }

python - Memory Leak in Matplotlib save fig with PDFPages -

edit: update i used objgraph print out back reference graphs 'reference' items appeared in memory leak. seems pdfpages holding onto of images iterate thorough them , save them each page (so perhaps inherent pdfpages module). think i'm going modify code write small pdf file on each iteration , use pypdf merge these files desired larger pdf file. edit: running python 2.7.3 matplotlib 1.3.1. have tried printing out gc.garbage , returns empty list, doesn't appear there uncollectable objects. have tried using both pdf , agg backends, memory leak still present in both of these. tried closing axes ( ax1 , cbaxes1 ) , explicitly using del on of variables (which had effect of removing +3 list after closing increasing +2 list after saving +5 list). i trying create multiple heatmaps via pcolormesh , save them single page in pdf , repeat process create multiple pages figures in pdf file (i've dropped down 1 figure per page sake of example). there seems memory

grouping archive by year and month using php and mysql -

i want create archive list this: 2014 march feb jan post 1 post 2 2013 november post 1 i using pdo. table m using having postdate datetime. postslug used clean url. coding using is: <h1>archives</h1> <hr /> <ul> <?php $stmt = $db->query("select posttitle, month(postdate) month, year(postdate) year blog_posts_seo order postdate desc"); while($row = $stmt->fetch()){ $posts = $row['posttitle']; $year = $row['year']; $monthname = date("f", mktime(0, 0, 0, $row['month'], 10)); $slug = 'a-'.$row['month'].'-'.$row['year']; echo "<li>$year</li>"; echo "<ul><li><a href='$slug'>$monthname</a></li>"; echo "<ul><li><a href='#'>$posts</a></li></ul></ul>"; } ?> </ul> the result im getting

c++ - Android NDK app not able to hit any breakpoint -

i using https://www.youtube.com/watch?v=kjsc-lkugm8 tutorial try debug simple ndk app. have done in video except: i on os x 10.9.3 instead of windows. i don't use android:debuggable=true (cause eclipse considers error) in androidmanifest.xml instead have set ndk path preferences->android->ndk , in project properties -> c/c++ build unchecked use default build command , set there ndk-build ndk_debug=1 app_optim=debug . i don't use x86 emulator samsung duos s device android 4.0.4 but breakpoiin used in video in not being hit in case. trying debug simple ndk test project 4th day. have investigated lots of material: android native development kit cookbook bunch of forums , tutorials videos but can not hit single damn breakpoint. please if ever. the following excerpt tutorial wrote our internal android development team. bulk of derived blog: http://mhandroid.wordpress.com/ important notes: i use linux (ubuntu 12.04) environment andr

c++ - Using SFINAE to select function based on whether a particular overload of a function exists -

this question has answer here: is possible write template check function's existence? 21 answers i have been trying choose between 2 templated functions based on whether overload operator<<(std::ostream&, const t&) exists. example: template <typename t, typename std::enable_if</* ? */, int>::type = 0> std::string stringify(const t& t) { std::stringstream ss; ss << t; return ss.str(); } template <typename t, typename std::enable_if</* ? */, int>::type = 0> std::string stringify(const t& t) { return "no overload of operator<<"; } struct foo { }; int main() { std::cout << stringify(11) << std::endl; std::cout << stringify(foo{}) << std::endl; } is possible? , if so, how solve problem? there's no need enable_if , use expression sf

Spring Integration 4 - samples - Gradle -

having watched spring integration overview presentation , i'd try out spring integration sample projects. use gradle instead of maven . i'm confused pom.xml files throughout sample projects. how 'noise' , how critical project built well? project convertible gradle , or maven unavoidable? actually current version of spring integration samples project has been converted gradle: https://github.com/spring-projects/spring-integration-samples

web services - Download video using php webservice -

i pretty new in php make sense.i trying make web-service in php .i have iphone app calling web-service.i want download video url in database on calling web-service. here php script retrieving url: $q=" select url videos id = '".$_request['id']."' "; $result=mysql_query($q); while( $rows =mysql_fetch_assoc($result) ) { $url=$rows['url ']; //here want code download file $myarray1=array("url "=>$url ); } i using script @ following link download file : http://phpsnips.com/579/php-download-script-for-large-file-downloads#.u4wp_iicliu ... not working.i have searched codes on google don't understand how use scenario...

excel - PowerPivot - How to calculate trend by comparing two periods? -

i'would create kpi compare results 2 periods. my data source looks following example : user | nb sales | date bob | 10 | 01/01/2014 tim | 20 | 01/01/2014 bob | 5 | 01/02/2014 ... so compare number of sales current previous week. don't know how process it. = calculate(sum('sales [nb sales]'), weeknum('sales [date]') = ) i seen on microsoft there dax function parallelperiod() compare periods don't know if should use it. should use formula calculated column or calculated value (bottom part). this kpi should indicate if employee sold more or less products previous week. thanks, i handle in 3 measures: [sales] = sum(sales[nb sales]) [sales prior week] = calculate([sales], dateadd(sales[date], -7, day)) [sales wow] = ([sales] / [sales prior week])-1 you should using separate, linked, date table calendar stuff!

angularjs - Drafts & Publishing in Firebase -

building cms , trying find out best way handle drafts firebase. example, site administrators edit documents, published publicly site. at first seemed perfect solution have "public" property set true , enforce via security rule follows: { "rules": { "documents": { "$id": { ".read": "data.child('public').val() == true" } } } } (as documented here: https://www.firebase.com/docs/security/rule-expressions/data.html ) but apparently documentation flawed because in example can hit /documents , give me documents regardless of 'public' == true. prevent have change to: { "rules": { "documents": { ".read": false, "$id": { ".read": "data.child('public').val() == true" } } } } ideally i'd able expose simple rest api endpoint /documents/ returned public documents child

javascript - Validate for a button click/selected in Magento using the built-in validation -

i know magento validation javascript library pretty powerful, trying make magento recognise 3 buttons , have user forced select 1 before can proceed, possible using current javascript library in magento. this isn't problem in case rather input buttons using standard button (probably not best way approach tbh) <li class="fields"> <div class="field"> <button class="button organisation_type" value="1" type="button"><span><span><?php echo $this->__('org a') ?></span></span></button> <button class="button organisation_type" value="2" type="button"><span><span><?php echo $this->__('org b') ?></span></span></button> <button class="button organisation_type" value="3" type="button"><span><span><?php echo $this->

android - notification on lock/home button press, on click back to tab fragment -

once again.... i'm following tutorial androidhive tab layout swipe able views ... have tab layout in 1 of sub activities. mainactivity list view clicking on 1 of items in list view, opens tab layout/activity. in last tab, have count down timer of 20 seconds, users have lock phone or press home button notification (at status bar) demo. tab fragment, how reopen app tapping on notification @ status bar bring them third tab/fragment? i have been searching none of answer seems looking for. hope out there guide me along want learn more. thank you! thanks answer , sample notification tutorial , able want. needed set singletop activity in manifest if don't want activity called twice.

php - nested if loop partially working -

what trying display row values. suppose if field 'head_office' dont have value 'h.o' want display values of last row. tried cant find solution. here code: (i have blocked php part) <?php $mysql_host = 'localhost'; $mysql_user = 'root'; $mysql_password = '123'; $mysql_database = 'sdbms'; $setup_page = './myinstitute.php'; $db = mysql_connect($mysql_host, $mysql_user, $mysql_password); mysql_select_db($mysql_database, $db); if(isset($_request['id'])){ $id=$_request['id']; $sql = "select * institute id =$id"; $result = mysql_query($sql, $db); $row = mysql_fetch_array($result); } else if(!isset($_request['id'])){ $sql = 'select * institute head_office ="h.o"'; $result = mysql_query($sql, $db); $row = mysql_fetch_array($result); } else{ $sql="select * institute"; $result = mysql_query($sql, $db); $n = mysql_num_

groovy - Regex 'find' returns 2 entries -

i have requirement list files in url , using jsoup based on question file names in format - mb-2014-04-13-07_12_22.log.2 question why variable 'file' inside .each method has 2 entries same value (mb-2014-04-13-07_12_22.log.2) whereas 'println filename' correctly prints once? def (doc,files, dirs) = [jsoup.connect(logfolder).get(),[],[]] doc.select("body pre a").each { a-> def filename = a.attr('href') println filename (filename =~ /(.*?\.log(.*?)\.(\d?))/).each{file-> def fileurl = logfolder+file[0]; println fileurl; } } what gain from: filename =~ /(.*?\.log(.*?)\.(\d?))/ is object of type matcher groovy> println (filename =~ /(.*?\.log(.*?)\.(\d?))/) java.util.regex.matcher[pattern=(.*?\.log(.*?)\.(\d?)) region=0,28 lastmatch=] and file pointing list of groups of regex: [mb-2014-04-13-07_12_22.log.2, mb-2014-04-13-07_12_22.log.2, , 2]

MYSQL choosing value used of column with different values when Grouping -

sample mysql table: carnum,cartype,carname 1,sportscar,mustang 2,sportscar,mustang gt 3,sportscar,mustang gt when run query: select carname, cartype cars group cartype i get: mustang,sportscar what want is: mustang gt,sportscar is there way make group use recent carname (mustang gt) rather first 1 (mustang)? tried sorting in various ways had no luck. thanks much. try 1 select carname, cartype cars carnum in( select max(carnum) cars group cartype );

python - pybbm error with URLS.py -

i got error after installing pybbm , running server file "/users/nathann/code/ipals/env/lib/python2.7/site-packages/pybb/urls.py", line 4, in <module> django.conf.urls.defaults import * importerror: no module named defaults and not sure since apart of pybb , , not code. this pip freeze : django==1.6.3 markdown==2.4 pillow==2.4.0 south==0.8.4 bbcode==1.0.16 behave==1.2.4 django-annoying==0.8.0 django-common==0.1.51 django-rosetta==0.7.4 enum34==1.0 parse==1.6.4 parse-type==0.3.4 polib==1.0.4 pybb==0.1.10 pytils==0.3 requests==2.2.1 six==1.6.1 wsgiref==0.1.2 this because using django 1.6.3. according django 1.4 changelog : until django 1.3, functions include(), patterns() , url() plus handler404, handler500 located in django.conf.urls.defaults module. in django 1.4, live in django.conf.urls. in other words, need upgrade pybbm latest version: pip install --upgrade pybbm

arrays - How would I call images from a folder to use in my slideshow using php -

i can't seam find answer specific issue. i have slideshow already, don't need create one. know need create array , run each loop images in slideshow. all need know how create array using contents of folder, in case images. can't find clear answer anywhere. use glob function: <?php foreach(glob('*.jpg') $image) { echo $image; // print file name; }

ruby - Unpermitted parameters for nested form many-to-many relationship Rails 4 -

i have simple blog app, want able create post , create new tag in same form, using nested form. post , tag have many-to-many relationship, via join table: class posttag < activerecord::base belongs_to :post belongs_to :tag end here's tag model: class tag < activerecord::base has_many :post_tags has_many :posts, :through => :post_tags validates_presence_of :name validates_uniqueness_of :name end post model accepts nested attributes tags: class post < activerecord::base has_many :post_tags has_many :tags, :through => :post_tags accepts_nested_attributes_for :tags validates_presence_of :name, :content end on posts controller, permit tags_attributes: def post_params params.require(:post).permit(:name, :content, :tag_ids => [], :tags_attributes => [:id, :name]) end in form new post, want able either associate existing tags (via checkboxes) or create new 1 via nested form using fields_for: .... <div clas

javascript - Modal will not fade away after calling .modal('hide') -

first time working modal's , fade not working correctly, disappear upon cancelling, not disappear after confirming delete. here modal w/ button <span class="item-delete-button"> <button class="btn btn-danger col-lg-3 col-lg-offset-3" data-toggle="modal" data-target="#@item.id" onclick="deletestart(this)"> <span style="margin-right: 5px" class="glyphicon glyphicon-trash"></span>delete </button> </span> <!-- modal --> <div class="modal fade" id="@item.id" tabindex="-1" role="dialog" aria-labelledby="mymodallabel" aria-hidden="true"> <div class="modal-dialog"> <div class="modal-content"> <div class="modal-header"> <button type="button" class=&quo

c# - Cannot implicitly convert type 'System.Web.Mvc.RedirectToRouteResult' to 'System.Web.Mvc.JsonResult' -

how can redirect action jsonresult actionresult m getting error. error "cannot implicitly convert type 'system.web.mvc.redirecttorouteresult' 'system.web.mvc.jsonresult'". code json result: public jsonresult addtruckexpensestransactionchild(string totaldays, string amount) { string mess = objactive.save(); if (mess == "1") { return redirecttoaction("gettruckexpenseschild", new { id="", sid="" }); } return json(mess, jsonrequestbehavior.allowget); } actionresult: public actionresult gettruckexpenseschild(string id, string sid) { truckexpensestransactionclass transaction = new truckexpensestransactionclass(); if (sid != null) { transaction.transactionchild = objactive.showtransactionchild(id, sid); return view(transaction); } else {

servlets - Change ASP to Java technology? -

i need on how propose new website. don’t know how start , hope can guide me( if better make applet , servlet, use other technology, etc. ) . i have website in asp, reads text files on server in same directory web . there n files (may 300 plain text files generated external application ) . website read them, generates menu data contain . depending on selected menu options , read specific files , pass information flash movies generate statistical graphs. flash movies old , cause problems in browsers. can’t loaded on platforms example. , asp technology obsolete. we want change technology , create web reads series of text files hosted on server , pass these parameters graphic (we use javascript libraries, example morris). interested java. recommend?. if java , can done applets ? or should use servlets?? or there easier way it? i use amcharts ( http://www.amcharts.com/ ) generate our charts. build data using classic asp ... pass array in js , use amcharts tools, powerfu

rspec - unable to setup capybara in Rails -

i learning how integration testing on simple app in rails using capybara. however got error when running 'rspec spec': bundle exec rspec spec /home/alex/.rvm/gems/ruby-2.0.0-p451@railstutorial_rails_4_0/gems/capybara-2.3.0/lib/capybara/dsl.rb:1: warning: loading in progress, circular require considered harmful - /home/alex/.rvm/gems/ruby-2.0.0-p451@railstutorial_rails_4_0/gems/capybara-2.3.0/lib/capybara.rb /home/alex/.rvm/gems/ruby-2.0.0-p451@railstutorial_rails_4_0/bin/ruby_executable_hooks:15:in `<main>' /home/alex/.rvm/gems/ruby-2.0.0-p451@railstutorial_rails_4_0/bin/ruby_executable_hooks:15:in `eval' /home/alex/.rvm/gems/ruby-2.0.0-p451@railstutorial_rails_4_0/bin/rspec:23:in `<main>' /home/alex/.rvm/gems/ruby-2.0.0-p451@railstutorial_rails_4_0/bin/rspec:23:in `load' /home/alex/.rvm/gems/ruby-2.0.0-p451@railstutorial_rails_4_0/gems/rspec-core-3.0.0/exe/rspec:4:in `<top (required)>' /home/alex/.rvm/gems/r

How to turn an array into an object with two values? javascript -

i want put array object 2 keys (key, val). code. var arr = ["hello", "44", "thanks", "32"]; console.log(arr); console.log(arr.length); var obj = {}; (var = 0; < arr.length; i++) { obj.key = arr[i]; } console.log(obj); this result have. obj[0] = {key: "hello", val: "44"}; obj[1] = {key: "thanks", val: "32"}; thanks allot! so, want loop every 2 item instead of 1, , take current item , next one. maybe : obj = []; (var = 0; < arr.length; i=i+2) { obj.push({key:arr[i], val:arr[i+1]}); }

c# - Split random integer into 4 random bytes -

can split random unsigned integer 4 random unsigned bytes values (0-255) uniformly distributed? if so, how? i tried in c# seems 0 used more other numbers. byte[] bytes = bitconverter.getbytes(u); which seems doing this: byte[] array = new byte[4]; fixed (byte* ptr = array) { *(int*)ptr = value; } return array; here of random integers: http://pastebin.com/sdwbqkjk if u consists of random bits only, including significant bit or byte, code work as-is. on clr uint has 4 bytes, each of 8 bits long. work. it doesn't work source of random numbers faulty. print 100 of them in hex format ( tostring("x8") ) console. see there lot more zeroes should be. fix source of random numbers.

replace - Replacement character in SQL database -

i have table in database containing 50000 records, in column slno around 20000 rows contain / , want replace character - . example : 34158/256 output 34158-256 please me. thanks in advance if understand correctly, can replace() function. update : update t set slno = replace(slno, '/', '-') slno '%/%'; (the where optional here, makes logic explicit.) you can in select statement as: select replace(slno, '/', '-') table t;

php - How to detect the last insert ID within a transaction in Yii using DAO? -

that's source code, need detect id (see marked position between 2 queries below). $connection = yii::app()->db; $transaction=$connection->begintransaction(); try { $q = "insert `sometable1` .... "; $connection->createcommand($q)->execute(); // single row inserted // here!! how last insert id query above $q = "insert `sometable2` .... id = last_insert_id_from_first_query "; $connection->createcommand($q)->execute(); $transaction->commit(); } catch (exception $e) { // react on exception $trans->rollback(); } what suitable way that? $lastinsertid = $connection->getlastinsertid();

MySql Finding a tree structure using Reference Keys -

we have parent table stores user details. since doing soft delete. due legal commitments, forced hard delete user details. so problem main table referenced many places. able find referenced tables following query in mysql use information_schema; select table_name, column_name,constraint_name key_column_usage referenced_table_name = 'projectuser' , referenced_column_name = 'userid' , table_schema = 'testproduct'; it success got tables around 45. real problem is, possible child table of "projectuser" may referenced somewhere else. for example, 1 of child table useraddress used foriegn key other table. how can query bring tables, reference projectuser, , child tables , grand child tables? there no query that's going out of mess. can write program successively run queries build structure, not able in 1 query. 1) use mysqldump, write parse dump , build tree 2) use tool visualize schema such (schemaspy)[ http://schemaspy

android - retrofit and orm library throw StackOverflow -

i try use 2 libraries: square/retrofit - rest client satyan/sugar - db orm retrofit use gson , class public class book{ string name; public book(string name) { this.name = name; } } ok, retrofit succesfully data server , put in our book class. now want save data. use orm need extend parent class public class book extends sugarrecord<book>{ string name; public book(string name) { this.name = name; } } but after extend parent class, retrofit cannot parse json. so error: java.lang.runtimeexception: error occured while executing doinbackground() ... caused by: retrofit.retrofiterror: java.lang.stackoverflowerror @ retrofit.restadapter$resthandler.invokerequest(restadapter.java:390) ... caused by: java.lang.stackoverflowerror @ com.google.gson.internal.$gson$types.resolve($gson$types.java:375) ... how make friends 2 libraries use 1 object class? or how specify retrofit, did not touch book's class parent?

linux - C++ templates in GCC -

this question has answer here: where , why have put “template” , “typename” keywords? 5 answers i have problems porting windows application linux (gcc). i have following code in windows (visual studio 2010 compiling well): have template class, contains structure. template<typename bidtype> class pst_bc_block : public pst_entries_block<bidtype> { public: ... struct tag_bc { word id; word type; dword value; }; ... } when i'm trying this: pst_bc_block<bidtype>::tag_bc tag_value; tag_value.id = 6; gcc can't resolve id member. p.s. windows types defined , vs comple well. tag_bc template-dependent type . try : typename pst_bc_block<bidtype>::tag_bc tag_value; edit: encounter trouble if forgot redefine windows' word, dword , such.

javascript - Dynamically hide/show textboxs when a checkbox clicked -

after bit of jq research, updated question because upset some, rightly, hands-up! when checkbox clicked content of corresponding should visible , vice verse. how can it? thanks jq: $(document).ready(function(){ $('div.accessories div.acc-wrapper input:checkbox').click(function(event) { if($(this).prop('checked')) { $('div.accessories div.acc-wrapper div.field').show(); } else { $('div.accessories div.acc-wrapper div.field').hide(); } }); }); html: <div class="accessories"> <div class="acc-wrapper"> <label>row 1</label> <input type="checkbox" id="cname_1" name="abc" value="1" /> <br /> <div class="field" style="display:none;"> <label>name</label> <input type=&

java - Why do getNewValue() and getOldValue() are deprecated in ListEvent class in Glazed Lists? -

i observe list changes in eventlist listevent in glazed lists. surprisingly, methods getnewvalue() also getoldvalue() deprecated without no compos explanation. why? how know, elements added or removed then? it's not ideal because deprecation reserved old code/approaches being retired. in instance have better annotate "experimental" because developer trying "be careful, new , may change. don't rely on yet." see description in docs (i've emphasised key line): in future, listevent provide more information list changes more self-contained: for deletes, provide deleted element getoldvalue() inserts, provide inserted element getnewvalue() updates, provide old , new element getoldvalue() , getnewvalue() the methods marked deprecated , should not used yet, because implementation work in progress . i don't think javadoc has annotation experimental code, developer has chosen use deprecation warn users of libra

angularjs json data not loading through $httpBackend -

i making $http call service , responding json data using $httpbackend. load fails , below error message in console. works after refresh page few times. syntaxerror: using //@ indicate sourcemappingurl pragmas deprecated. use //# instead jquery.min.js:1 error: http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js being assigned //# sourcemappingurl, has 1 "error: unexpected request: lookup/program-categories no more request expected $httpbackend@http://<hostname>.amazonaws.com/ostnfe/app/vendor/angular-mocks/angular-mocks.js:1179 sendreq@http://<hostname>.amazonaws.com/ostnfe/app/vendor/angular/angular.js:8181 $http/serverrequest@http://<hostname>.amazonaws.com/ostnfe/app/vendor/angular/angular.js:7921 qfactory/defer/deferred.promise.then/wrappedcallback@http://<hostname>.amazonaws.com/ostnfe/app/vendor/angular/angular.js:11319 qfactory/defer/deferred.promise.then/wrappedcallback@http://<hostname>.amazonaws.com/ostnfe/app/vendor/angula

asp.net mvc - Kendo UI Grid update event is not firing -

i have kendo ui inline grid. read , populate grid properly. when press edit , changes in column , press update update event not firing. , not calling controller method. hope can me point out doing wrong here. following grid binding. datasource = new kendo.data.datasource({ transport: { read: function (options) { $.ajax({ type: 'post', url: "./getingredients", datatype: "json", success: function (result) { options.success(result); } }); }, update: function (options) { $.ajax({ type: 'post', url: "./updatedata", datatype: "json", contenttype: "application/json; charset=utf-8" }); },