Posts

Showing posts from May, 2015

list - AngularJS ng-repeat and scope populated within http call results in empty html elements -

i have defined array within scope: $scope.foo = []; i make $http call, , populate variable success event in controller. in template have unordered list such: <ul> <li ng-repeat="i in foo">{{i}}</li> </ul> the outcome unordered list has many li elements $scope.foo, contents of empty: <li ng-repeat="i in foo" class="ng-scope"></li> <li ng-repeat="i in foo" class="ng-scope"></li> <li ng-repeat="i in foo" class="ng-scope"></li> . . . i can see array has been populated. furthermore li element count matches array length (as expected), the contents of li empty . all documentation can find looks populating unordered list. changed jquery call angular $http.post call since problems scoping arise that. why contents of li elements empty? if made $scope.foo = []; use foo not range. example: <li ng-repeat="i in foo" class=...

jquery - Set and Get uniqueID for each file -

im use jqueryfileupload . how can uniqueid each file??? $('#multifileinput').fileupload({ dropzone: $("#dropzone"), url: "./fileupload.ashx", datatype: 'json', submit: function (e, data) { $.each(data.files, function (i, file) { alert("uid file " + file.name + " - " + file.uid); } } }); i had fix code in jquery-fileupload-5.42.3.js: _getsinglefileinputfiles: function (fileinput) { /* ----==== code ====-----*/ if (!$.fileuploadid) $.fileuploadid = 1; $.each(files, function (index, file) { file.uid = "fileuploadid" + $.fileuploadid++ ; }); return $.deferred().resolve(files).promise(); } can have access without code changes source jqueryfileupload? var myincrement = 0; $('#multifileinput').fileupload({ dropzone: $("#dropzone"), url: "./fileupload.ashx", datatype: 'json', submit: function (e, data) { $.each(data.files, ...

osx - Image Generation from TrueType font in Swift/Cocoa -

i'm trying generate nsimage ttf font using swift in cocoa (not uikit) , i'm struggling context creation @ moment. my base code came project: https://github.com/reeonce/ionicons.swift it's designed uikit, tried translating cocoa. here's original code: extension uiimage { public class func imagewithionicon(icon: ionicons, height: cgfloat, color: uicolor) -> uiimage { let font = uifont(name: "ionicons", size: height)! let iconsize = (icon.rawvalue nsstring).sizewithattributes([nsfontattributename: font]) uigraphicsbeginimagecontextwithoptions(iconsize, false, 0.0) (icon.rawvalue nsstring).drawatpoint(cgpointzero, withattributes: [nsfontattributename: font, nsforegroundcolorattributename: color]) let image = uigraphicsgetimagefromcurrentimagecontext() uigraphicsendimagecontext() return image } } and here have @ moment: extension nsimage { public class func imagewithionicon(icon:...

php - Count of same records from two columns using if condition -

i have table question_attempts . table having 2 columns rightanswers , youranswer . i want count of records rightanswer = youranswer . entire code actually. $quizsections = mysql_query("select * quiz_sections"); while($quizsectionsrslt = mysql_fetch_array($quizsections)){ $quizsectionsid = $quizsectionsrslt['id']; $quizsectionsheading = $quizsectionsrslt['heading']; $quizsectionsquizid = $quizsectionsrslt['quizid']; $quizsectionsfirstslot = $quizsectionsrslt['firstslot']; echo $quizsectionsheading."<br />"; $quizslots = mysql_query("select * quiz_slots `quizid`=$quizsectionsquizid limit ".($quizsectionsfirstslot-1).", 10"); while($quizslotsrslt = mysql_fetch_array($quizslots)){ $quizslotids = $quizslotsrslt['questionid']; $questions = mysql_query("select * question_attempts `questionid`=$quizslotids"); $num_rows = mysql_num_rows($quizslots); while($answe...

objective c - How can I get city name without current location(lat-long) in iOS? -

i have gps class returns lat, long. , i'm trying city name or address coordinates geocoder. works well. but, possible city name or without geocoder or (lat-long)? i have completed task use api: http://ip-api.com/json this give current location ip address call json , got whatever required.

angularjs - opening a new tab loses the arraylist in local storage javascript stack overflow -

my application work tries store data on local storage works fine when not opening new tab or window, when open new tab, array loses previous stored data , stores current data. please suggest doing wrong here. my code this: getcurrreqidlist = []; localstorage.setitem('getcurrreqidlist', json.stringify(getcurrreqidlist)); var retrieveddata = localstorage.getitem('getcurrreqidlist'); var getfinalreqidlist = json.parse(retrieveddata); if(getfinalreqidlist.length > maxcurrentconnectionlength) { console.log('hello'); getfinalreqidlist.shift(); getcurrreqidlist.shift(); localstorage.setitem('getcurrreqidlist',json.stringify(getfinalreqidlist)); } the post bit confusing, bet have lines getcurrreqidlist = []; localstorage.setitem('getcurrreqidlist', json.stringify(getcurrreqidlist)); running every time load page, initializing store. when open new tab, loads page , override local storage value empty array. y...

How do I find duplicates within two columns in a csv file, then combine them in Python? -

i working large dataset of protein-protein interactions, have in .csv file. first 2 columns interacting proteins, , order not matter (ie a/b same b/a, duplicates). there third column, source these interactions published. duplicate pairs can same source, or different sources. for duplicates 2 or more sources, how can combine them, in third column have of sources listed 1 interaction? (i.e. interaction a/b, duplicates a/b , b/a). here example of columns: interactor interactor b source b mary (2005) c d john (2004) b mary (2005) b steve (1993) d c steve (1993) in case, need interactor interactor b source b mary (2005), steve (1993) c d jo...

asp.net - Control different views for website through query parameters -

i building asp.net mvc application has left navigation pane showing categories, , remaining page uses context of selected category actions. when navigate website http://website/home/index?category=1& hidecategories=true want hide navigation pane across actions till browser tab closed. want show navigation pane otherwise. how can achieve while supporting following scenarios, i want open 2 browser tabs side side 1 browser tab hiding categories pane while other browser tab showing navigation pane. if want isolation between tabs, per browser tab storage , can use session storage. using javascript can save value session storage this: sessionstorage.setitem("hidecategories", "true"); then can access value this: var x = sessionstorage.getitem("hidecategories"); if(x === "true"){ //some logic hide categories } you can set value per browser tab, can have 1 tab nav hidden , 1 tab not. data stored in sessionstorage no...

c# - How to retrieve my shipments from FedEx using order number or reference number or invoice number -

i stuck fedex api integration in asp.net website, cannot find proper documentation api on website. what trying is: our client has tool create shipment using fedex api. now need show tracking detail on our website (which diff client's software). so, need update track number of shipment in database. how can shipment detail along tracking number fedex using order number or reference number or invoice number ? post request like: https://www.fedex.com/trackingcal/track?action=trackpackages&location=en_us&version=1&format=json&data= {"trackpackagesrequest":{"apptype":"wtrk","uniquekey":"","processingparameters":{},"trackinginfolist":[{"tracknumberinfo":{"trackingnumber":"trcking_number","trackingqualifier":"","trackingcarrier":""}}]}} replace tracking_number . have queried tracking number , should minor ...

javafx - Ambient and PointLight on SubScene influences all other SubScenes -

Image
problem in javafx default light on every 3d scene. it's pointlight shining top of scene. i've tried show in program different possibilities of light, ran in trouble. if add subscene default, pointlight , ambientlight, works aspected. if add 1 more subscene combined light of ambient , point, i'll result showing in screenshot 2. seems other subscene lost light , fall it's default light. maybe hit bug? systems tested os: windows 8.1 x64, windows 7 x64 graphics: amd 4200 hd, intel hd 3000 java: 1.8.0_45 jdk/jre x86 (32-bit), 1.8.0_60ea x64 stage 3 subscenes - default, point, ambient stage 4 subscenes - default, point, ambient, (point,ambient) example here minimal, complete, , verifiable example import javafx.application.application; import javafx.scene.*; import javafx.scene.control.label; import javafx.scene.layout.hbox; import javafx.scene.paint.color; import javafx.scene.paint.phongmaterial; import javafx.scene.shape.*; import javafx.stage.s...

call json location ajax google maps -

i have json data loction {"name":"tiesna","latitude":"123456","longitude":"9876543","posisi":"cirebon","waktu":"2015-07-01 21:49:52"}{"name":"jastin","latitude":"-1234567","longitude":"987654","posisi":"susukan","waktu":"2015-07-01 23:11:52"} i want call google maps location var locations = [ ['bondi beach', -33.890542, 151.274856, 4], ['coogee beach', -33.923036, 151.259052, 5], ['cronulla beach', -34.028249, 151.157507, 3], ['manly beach', -33.80010128657071, 151.28747820854187, 2], ['maroubra beach', -33.950198, 151.259302, 1] ]; var map = new google.maps.map(document.getelementbyid('map'), { zoom: 50, center: new google.maps.latlng(-39.92, 151.25), maptypeid: google.maps.maptypeid.roadmap }); var infowindow = new...

iphone - No sound inside iOS video -

i have ios app on app store 2 instructional videos. videos play fine on devices except on ipad, in case there no audio. video plays fine on iphone (via webview inside native app), pc, mac, , ipad safari -- not inside ipad app itself, displays web content through embedded native webview. here 1 of videos: http://www.mapsandtreasures.com/howtoplay_ios.php here html tag video: <video src="videos/play.mov" poster="videos/play.png" controls="true" width="800" height="472"></video> the direct url mov file this: http://www.mapsandtreasures.com/videos/play.mov any reason why video (including audio) play no problems on such wide variety of devices, not in ipad app via webview? ( especially given same app plays videos fine on iphone. )

web applications - How to set counter in mysql? -

i have been creating web-application, wanted create counter keep track of pages viewed. so, want create counter in mysql. scenario this.. if row isn't created, create row if row created, set counter. is possible? or should run 2 queries so. query 1: run query select table doesn't exist. if returns null, doesn't have data entry. query 2: so, create entry that, using counter. query 3: if data created, increment counter. but there way in single call mysql? i think want insert . . . on duplicate key update . so, have pagesviewed table sort of page identifier , counter. do: insert pagesviewed(pageid, counter) select $pageid, 1 on duplicate key update counter = counter + 1; this requires unique index on pagesviewed(pageid) .

scala - Getting F-bounded polymorphism to work on a base trait with type parameters? -

trait a[t, this[_] <: a[t, this]] case class b[t]() extends a[t, b] <console>:8: error: type arguments [t,b] not conform trait a's type parameter bounds [t,this[_] <: a[t,this]] case class b[t]() extends a[t, b] this seems odd me, because seems should work? guidance welcome... thank you it seems may have misplaced constraint on second parameter: trait a[t, this[_ <: a[t, this]]] case class b[t]() extends a[t, b] you try: trait a[t, u <: a[t, u]] case class b[t]() extends a[t, b[t]] if want mixin multiple such traits, unfortunately can't use generics (you can't extend same trait twice different generic parameter). can, however, use abstract type member express f-bound, , mixin multiple such traits: trait step { self => type self <: step { type self <: self.self } val name: string def next: self } trait foolike extends step { val foomarker = "foo" } case class foo(name: string) extends...

PHP, make the page automatically detect changes made by the admin -

just wanna ask opinions regarding scenario want achieve, have admin site , members area. now, if admin deleted id of current user logged-in on members area page, members_area.php automatically refresh , redirect them login page. possible using php, don't want use javascript/jquery achieve :) please feel free comment if think question not clear. this work on next refresh initiated user . if want auto refresh have use javascript validate credentials time time or listen push notifications (websockets)

c# - How can I remove the blank spaces after a Page Footer in Crystal Reports? -

Image
i have report shows banner on first page , hidden afterwards. however, on second page, there large amount of blank space left size of banner. there way remove this? i using page footer , page footer b. page footer contains banner images , page footer b contains "page n of n". page footer supressed after page 1 while page footer b show after page 1. what's best way this? cr reserve white space when conditionally suppressed. have seen talked many times. try website work-arounds. http://kenhamady.com/cru/archives/128

Execution time limit exceeded with PHP random number generator -

i'm trying make program prints random number every 3 seconds, mistake "maximum execution time of 30 seconds exceeded", sorry have no experience in php , know functions clear memory, appreciate . ejemplo(); function ejemplo() { $c=null; $c=mt_rand(60,200); sleep(3); clear(); ejemplo(); } you can use explicit flushing load random number every 3 seconds: <?php ob_implicit_flush(true); ejemplo(); function ejemplo() { $c = mt_rand(60,200); ob_end_flush(); echo $c . "<br>\n"; ob_start(); sleep(3); ejemplo(); } however, can't clear output once it's outputted (without using javascript). another method use javascript: var refresh = function() { document.getelementbyid("number").innerhtml = math.round(math.random() * 140) + 60; }; refresh(); setinterval(refresh, 3000); <div id="number"></div>

java - Making ImageGallery of private Images in S3 Client android -

i trying create imagegallery of s3 bucket in android application. images private won't having specific link each image. for such private images , amazon has link generator, s3client.generatepresignedurl(constants.s3_bucket_name, key, expiration); it generates url let's 1 hour or 2 min expiration set us. now easy memory caching , stuff, can either use volley or picasso or many other such easy loading libraries. however there catch. want cache these images in memory. have dynamic link. how can make picasso or other library use dynamic link cache? as per information, libraries use url "key" cache, correct? if how can save these images can use these images later when offline, again, have dynamic link url changing every instant maybe need save them key passing s3client. what solution. latest picasso version adopts setting network policies. probably, need set networkpolicy.offline picasso.request builder: picasso.with(this) .loa...

java - How to Configure JaxWsPortProxyFactoryBean to consume SOAP 1.2 webservice -

i need consume soap1.2 (.net hosted) webservice using jaxwsportproxyfactorybean the following snippet of spring configuration file: <bean id="documentuploadservicejaxwsclient" class="org.springframework.remoting.jaxws.jaxwsportproxyfactorybean" lazy-init="true"> <property name="serviceinterface" value="org.tempuri.idocumentuploadservice" /> <property name="namespaceuri" value="http://tempuri.org/" /> <property name="servicename" value="documentuploadservice" /> <property name="portname" value="securebinding" /> <property name="endpointaddress" ref="documentuploadserviceendpointstring" /> <property name="customproperties" ref="internetproxyproperties" /> <property name="handlerresolver" ref="handlerresolver"/> </bean> i ...

c++11 - C++ How to create a std::unique_ptr from a class that takes parameters on constructor -

i need create std::unique_ptr class has constructor takes 1 parameter. can´t find references on how it. here code example cannot compile: #include <iostream> #include <string> #include <sstream> #include <memory> class myclass { public: myclass(std::string name); virtual ~myclass(); private: std::string myname; }; myclass::myclass(std::string name) : myname(name) {} myclass::~myclass() {} class otherclass { public: otherclass(); virtual ~otherclass(); void myfunction(std::string data); std::unique_ptr<myclass> theclassptr; }; otherclass::otherclass() {} otherclass::~otherclass() {} void otherclass::myfunction(std::string data) { std::unique_ptr<myclass> test(data); <---------- problem here! theclassptr = std::move(test); } int main() { otherclass test; test.myfunction("this test"); } the errors related way i´m initializing std::unique...

javascript - How to delete a property from an Emberjs Object? -

plain old javascript object properties can deleted so... var foo = {bar: 'baz'}; delete foo.bar how delete (not set null) property in ember object? var foo = ember.object.create({bar: 'baz'}); the same normal object: delete foo.bar

excel - Finding all instances where a matchword is used in a csv file using python -

i have csv file has numerous columns here image of excel file looks http://i.stack.imgur.com/ab6tp.png i need through thousands of rows, in column labeled hit definition virus name "grapevine" in it. each word name "grapevine", need compile how many times mentioned, range of length (column labeled query length, [2]), , summation of reads(column total reads, [4]). input: http://i.stack.imgur.com/ab6tp.png output: grapevine 1 6 234-234234 45634 grapevine 2 7 123-65432 12341 with open(argv[1], 'r') f: line in csv.reader(f): contig_name = line[0] contig_length = line[3] read_count = line[4] hit_def = line[6] try: pattern = r'.\[(.*?)\].' hit_sub = re.search(pattern, hit_def).group(1) print hit_sub except attributeerror: hit_sub = hit_def target....

How to get string on path in php? -

i got path variable in array. $url = "http://$_server[http_host]$_server[request_uri]"; $a = parse_url($url); print_r($a); $a's output=> array ( [scheme] => http [host] => localhost [path] => /countersistemi/hero/earthshaker/ ) i want earthshaker in array. try: echo basename($a['path']);

javascript - CKEditor bullets and numbers formatting -

i have ckeditor in mode inline, , 1 of problems i'm having bullets , numbers (lists) not attached color and/or font size. lock example in image: http://i.imgur.com/m65q2mg.png in config.js define font size have configuration: config.fontsize_defaultlabel = 'size'; config.fontsize_sizes = '8/8px;9/9px;10/10px;11/11px;12/12px;14/14px;16/16px;18/18px;20/20px;22/22px;24/24px;26/26px;28/28px;36/36px;48/48px;72/72px;96/96px;120/120px;144/144px;168/168px;192/192px;216/216px;240/240px;264/264px;288/288px;312/312px'; config.fontsize_style = { element: 'span', attributes: {'class':'font-#(size)'}, overrides: [ { element: 'span', attributes: { 'class': null } } ] }; is there way around ? in ckeditor's folder have config.js file. there can set toolbar have sections, buttons... a sample toolbar config: config.toolbargroups = [ { name: 'clipboard', groups: [ 'clipboard...

jquery - render a partial form using the javascript variable in views rails -

this code selected drop down value... var rolename = $("#server_role_ids").find(':selected').text(); this code calling partial form js writing statically name of form. in case "web" $('#role_form').html('<%= escape_javascript(render :partial => "web") %>'); but want dynamically call partial form using rolename variable, below particular selected form: $('#role_form').html('<%= escape_javascript(render :partial => "" + rolename) %>'); if rolename "something" call "something" partial form. i know stuff if (rolename == "web") else if (rolename == "relay") , that. want dynamically write without if else statements. need guys. the things tried ajax i tried implementing ajax, don't know whether right way it. please let me know. new.html.erb javascript... $.ajax({ url : "/servers/new", type : "post", data...

java - how do you find the max row in a 2d array -

create 2-d array m : ask user input row , column sizes keyboard (use scanner). n 9, if user input column size bigger n+4 ask user reinput column size fill arrays elements double numbers in range of (3.0 , 13.0) using of random object pass above array m , call following 2 methods in findmaxrow(double[][]array) , find , print largest sum of columns in 2d array in returnavg(m) , print out avg of array m comment: so, made the code find max colm can't figure out how find max row. need able find max row figuring out how since code finds cllm , not max row. here code:import java.util.scanner; public static void main(string[] args) { scanner input = new scanner(system.in); random rand = new random(); system.out.print("number of rows? "); int rows = input.nextint(); system.out.print("number of columns? "); int columns = input.nextint(); while (columns > 7) { // check column > n+5 n = 2 in case system....

javascript - Twitter Bootstrap issue with IE11 when set with Browser Profile Enterprise -

Image
i'm stuck issue web page built bootstrap 3. company ie configured load intranet pages in enterprise profile mode in machines. others users default profile set in ie11 desktop. with configuration layout broke completely. but when changed profile desktop web page works if kind of document mode (edge, ie10, 9, 8 7). also i'm using conditional style control fix layout problems , ie 8 polyfills respond , html5shiv libraries. there way detect if ie11 in enterprise profile using html5, js or css3? how user agent ie emulates in profile? someone has found layout trouble modern html5/bootstrap web sites intranet or ie11 in enterprise mode? i'm guessing isn't possible turn mode off in company. thanks help. .right:{<style><div></div></style>} (yes/no). .right{color: #fffff ; background: #dvsdsadga; } (yes/no). <button>share public yes/no touch button</button>

c++ - Should my schizophrenic console/gui Qt5 program use QApplication or QCoreApplication? -

my program either open gui or not depending on commandline parameters. right instantiating qapplication main event loop, noticed program aborts when run headless machine (missing xorg/xcb) unless specify environment variables trick believing there xorg running. when instead instantiate qcoreapplication don't have access activewindow(). code requiring activewindow() never run in cases when program run headless (that purose of commandline parameters). so asking is, possible make qapplication run without problems on headless machine, , not show gui? what other options? no, not possible. can create qcoreapplication or qapplication in dependent command line args.

jquery - Change Twitter widget height with Javascript? -

i'm trying alter height of twitter widget (feed embed) height in @ breakpoints in order conform responsiveness of site. here's have: $(document).ready(function() { function twitterresize() { if($('#twitter-widget-0').length()) { $('#twitter-widget-0').each(function() { if(jquery(window).width() < 768) { $(this).height(400); } if(jquery(window).width() >= 768 && jquery(window).width() < 1200) { $(this).height(497); } if(jquery(window).width() >= 1200) { $(this).height(516); } }); } }; twitterresize(); $(window).resize(twitterresize); }); this preventing widget loading @ all. have tried changing height="" html attribute via js prevented loading well. need i'm trying not resort api, take me while. i appreciate if...

ruby on rails - RSpec, Factory Girl and Capybara: no items saved -

i have mountable rails engine rspec: rspec.configure |config| config.use_transactional_fixtures = false config.before(:suite) databasecleaner.clean_with(:truncation) end config.before(:each) |example| databasecleaner.strategy= example.metadata[:js] ? :truncation : :transaction databasecleaner.start end config.after(:each) databasecleaner.clean end end simple factory: factorygirl.define factory :post, :class => myengine::post title 'title' end end capybara feature: require 'spec_helper' describe 'post', :type => :feature let(:post) { factorygirl.create :post } 'index action should have post' visit posts_path expect(page).to have_text(post.title) end end and post model doesn't have validations. but when running tests shows there no posts created. also activerecord logs: insert "my_engine_posts" ... release savepoint active_record_1 rollback transaction ...

Rails validation test not passing -

in our rails app, have following models: class user < activerecord::base has_many :administrations, dependent: :destroy has_many :calendars, through: :administrations end class administration < activerecord::base belongs_to :user belongs_to :calendar end class calendar < activerecord::base has_many :administrations, dependent: :destroy has_many :users, through: :administrations end we tried validate administration model following administration_test.rb test file: require 'test_helper' class administrationtest < activesupport::testcase def setup @user = users(:noemie) @administration = administration.new(user_id: @user.id, calendar_id: @calendar_id) end test "should valid" assert @administration.valid? end test "user id should present" @administration.user_id = nil assert_not @administration.valid? end test "calendar id should present" @administration.calendar_id = nil ...

java - Jenkins Project Can't Find Packages; build-project target fails -

my project compiles , runs on local machine, on jenkins build-project target fails compile due being unable find packages. can see jars think need in ./bin/ folder, anticipate there classpaths or build-project target causing issue. build.xml -> build-project: <target depends="init" name="build-project"> <echo message="${ant.project.name}: ${ant.file}" /> <javac debug="true" debuglevel="${debuglevel}" destdir="bin" includeantruntime="false" source="${source}" target="${target}"> <src path="src" /> <classpath refid="sierramadretestscripts.classpath" /> </javac> </target> error message excerpt on jenkins: build-project: [echo] sierramadretestscripts: /data/builds/jenkins/workspace/build.xml [javac] compiling 1 source file /data/builds/jenkins/workspace/bin [javac] /data/builds/jenkins/workspace/...

sharepoint - Is there a way to disable the "Save" option on a downloadable file, and only allow the "Open/Run" option? -

i have infopath form sits on sharepoint site. when file clicked in sharepoint directory, user given option save or open file (sometimes dependent on browser). saving file frowned upon because want ensure user using latest version of infopath form sharepoint location. in general web sense, there way disallow user (or @ least attempt prevent user) saving file, , opening it? i'm not talking automatically downloading file when click it, know security problem, , reason why open/save prompt exists in first place. can prompt allows them "open" downloaded file shown instead? and if not in general web sense, can accomplished somehow using sharepoint black magic? know single-clicking file in sharepoint (depending on list or directory you're looking at) can result in file being opened in native application without prompt user whatsoever. hmmm, i'm not sure if try creating hyperlink form using format: https://sharepoint/yoursite/_layouts/formserver.aspx?...

ruby on rails - Is there a gotcha in the behavior of GlobalID based ActiveRecord objects? -

it's entirely possible doing wrong but! here's story. have standard, beginners'-level, ror setup (4.2) activejob jobs. one of jobs calls method on record that's been passed in intended modify record. pretty normal far. looks this: class genericscraperjob < activejob::base def perform(record) # perform job record data record.update_myself! end end and update_myself! method looks this: class recordindb < activerecord::base def update_myself! thisis_a_column = newvalue self.save! end end now here's mystery - when run tests, , check fixture_instance.thisis_a_column newvalue , test passes. when start app, , see happens in database, not updated expected. but if self.thisis_a_column = newvalue , works correctly everywhere. i sure reloaded fixture... did this: fixture_instance = recordindb.find(fixture_inst.id) it if binding inside activerecord instance changes, depending on when instantiated. inside tests, l...

text mining - WordCloud of transaction activities in R -

i trying generate wordcloud transaction activities in order show people spend money. transaction activities following: description amount albertson 20 albertson 30 albertson 35 cvs 10 cvs 40 walmart 15 walmart 44 ... i can generate wordcloud description's frequency. how can wordcloud sorted sum(amount) of each category? thanks! btw here code require(tm) require(wordcloud) require(rcolorbrewer) data_corpus <- corpus(vectorsource(data)) data_corpus <- tm_map(data_corpus, content_transformer(tolower), mc.cores=1) data_corpus <- tm_map(data_corpus, removepunctuation, mc.cores=1) data_corpus <- tm_map(data_corpus, function(x)removewords(x,stopwords()), mc.cores=1) data_corpus <- tm_map(data_corpus, removenumbers, mc.cores=1) pal2 <- brewer.pal(8,"dark2") png("25-34.png", width=1280,height=800) wordcloud(data_corpus, scale=c(6,.2),min.freq=50,max.words=inf, r...

sql - Are these 2 SELECT statements identical? Weird use of ISNULL -

i'm familiar isnull function in sql server, have never used in way. came across code in db support: select * employee deptid = 58 , gender = isnull('m', gender) it looks me same select * employee deptid = 58 , gender = 'm' i tried playing around nulls see if 2 statements return different results same. know if there benefits or scenarios first select preferred on second? i'm on sql 2014. maybe syntax useful on previous versions? thanks these statements, exact way put, same. using gender = isnull('m', gender) not different gender = 'm' isnull might make sense in scenario: declare @gender char(1) select * employee deptid = 58 , gender = isnull(@gender, gender) , return rows non-null gender if @gender have been set null , , rows given gender otherwise. if using statement, make sure have recompile on each invocation, plans null , non-null value might quite different. this can tested creating...

java - MySQL tomcat JDBC Connection pool testOnBorrow check does not get a response -

my application using tomcat jdbc connection pool connect remote mysql database following connection pool configurations, maxactive: 80 maxwait: 60000 minidle: 5 testonborrow: true validationquery: select 1 validationinterval: 30000 validationquerytimeout: 10 most of time works fine application seems stuck when executing testonborrow on connection pool. discovered enabling java flight recorder , showed following stack trace, java.net.socketinputstream.read(byte[], int, int, int) java.net.socketinputstream.read(byte[], int, int) com.mysql.jdbc.util.readaheadinputstream.fill(int) com.mysql.jdbc.util.readaheadinputstream.readfromunderlyingstreamifnecessary(byte[], int, int) com.mysql.jdbc.util.readaheadinputstream.read(byte[], int, int) com.mysql.jdbc.mysqlio.readfully(inputstream, byte[], int, int com.mysql.jdbc.mysqlio.reuseandreadpacket(buffer, int) com.mysql.jdbc.mysqlio.reuseandreadpacket(buffer) com.mysql.jdbc.mysqlio.checkerrorpacket(int) com.mysql.jdbc.mysqlio.sendcomm...

node.js - error that the header can not be reset -

i have main file called server.js in has method in post call request of url var gotoother = require('./gotoother.js'); app.post ('/gotoother/', function (req, res) { var data = { "error": 1, "zone" "" }; sms.gotoother (req, res, msgsms; }); i have file called gotoother gotoother.js exports.gotoo therurl = function (req, res, next, msgsms) { var data = { "error": 1, "sms": "" }; var url = "http://www.google.com.br"; req.redirect ({ uri: url, method: "post" }, function (error, response, body) { console.log (error); //console.log(body); date ["error"] = 0; date ["sms"] = "successfully sent"; res.json (data); next (); }); }; i read texts , did not understand happening , remade several times read between them tried recreate new post method sends calls url continued giving error h...

ibm mq - WebSphere MQ call failed with compcode '2' ('MQCC_FAILED') reason '2270' ('MQRC_NO_DESTINATIONS_AVAILABLE') -

i getting error message when trying post message queue using alias name. working fine when using queue manager name , issue not occurring alias names. alias name , queue name defined. please let me know in scenarios error message can occur. the ibm documentation indicates occurs when queue no longer available , describes solution as: check queue definition , queue status determine why instances of queue removed cluster. i check on queue definitions again.

php - What image resampling technique is used in imagecopyresampled()? -

i'm trying figure out what's algorithm behind imagecopyresampled() ? bicubic interpolation, cubic interpolation or other ? it's not in documentation , can't seem find anywhere!

parsing - PHP Parse/Syntax Errors; and How to solve them? -

Image
everyone runs syntax errors. experienced programmers make typos. newcomers it's part of learning process. however, it's easy interpret error messages such as: php parse error: syntax error, unexpected '{' in index.php on line 20 the unexpected symbol isn't real culprit. line number gives rough idea start looking. always @ code context . syntax mistake hides in mentioned or in previous code lines . compare code against syntax examples manual. while not every case matches other. yet there general steps solve syntax mistakes . references summarized common pitfalls: unexpected t_string unexpected t_variable unexpected '$varname' (t_variable) unexpected t_constant_encapsed_string unexpected t_encapsed_and_whitespace unexpected $end unexpected t_function … unexpected { unexpected } unexpected ( unexpected ) unexpected [ unexpected ] unexpected t_if unexpected t_foreach unexpected t_for unexpected t_while unexpected t_do ...

python - pandas and rpy2: Why does ezANOVA work via robjects.r but not robjects.packages.importr? -

like many, i'm hoping stop straddling r , python worlds , work in python using pandas, pyr2, numpy, etc. i'm using r package ez ezanova facility. it works if things hard way, why doesn't work when them easy way? don't understand resulting error: file "/users/malcomreynolds/analysis/r_with_pandas.py", line 38, in <module> res = ez.ezanova(data=testdata, dv='score', wid='subjectid', between='block', detailed=true) file "/usr/local/lib/python2.7/site-packages/rpy2/robjects/functions.py", line 178, in __call__ return super(signaturetranslatedfunction, self).__call__(*args, **kwargs) file "/usr/local/lib/python2.7/site-packages/rpy2/robjects/functions.py", line 106, in __call__ res = super(function, self).__call__(*new_args, **new_kwargs) rpy2.rinterface.rruntimeerror: error in table(temp[, names(temp) == wid]) : attempt set attribute on null see below full reproducible code (requires pyt...

matrix - Using Sage as a Python library (Windows) -

i'm writing code heavy on linear algebra, matrix operations. because matrices i'm using large, i'm running out of memory when use sympy library. think can want in sage, purposes can't run code in vm. has on host os. without going far install ubuntu or something, there way add sage use library in python code? python version 3.4, os windows 7. thanks. sage can use own python, if makes sense. on windows there lot of problems components of sage compiling (non-python components, of course) why there not 'native port', though cygwin should work okay if option you. hear it's not difficult set ubuntu partition on windows machine, though have no personal experience this. (by way, it's possible octave choice you, based on description, or r, component of sage.)

java - Hibernate & JPA 2.1, How to retrieve the name of a subgraph from entity graph -

i try name of subgraph (defined in annotation of entity class), hibernate implementation subgraphimpl has no getter name. is there other possibility name of subgraph programmatically? there class called namedsubgraph, how namedsupgraph subgraphimpl? what try develop entity graph validator, checks using reflection if needed attributes nodes defined (checking fields of entity class reflection). possible exclude , include attribute nodes partial entity graphs. but need subgraph name identify correct subgraphs in entity graph should validated. example: a working example available on github account four entity classes: person, address creditcard , debitcard person.java: @entity @namedentitygraphs({ @namedentitygraph( name = person.eg_profile_full, attributenodes = { @namedattributenode(value = "wallet", subgraph = wallet.eg_profile_full) } ...

c++ - Why is the value of "C" changing in the following code? -

the output i'm getting given code "0" though initialized value of c "1"...can explain it... why value of "c" changing in following code?? #include <iostream> using namespace std; int c=1; // global initialized 'c' 1.. long long f(long long n){ if(n==6){ return 2; } else{ c=c+1; f(n-2); } } int main() { long long n,ans,p; cin>>n; ans=f((2*n)-2); cout<<c; //printing out value of 'c' return 0; } because value of c being changed in below code : else{ c=c+1; f(n-2); }

android - Google Keep list note from inside your app -

Image
in app, writing functionality share shopping list google keep. this, use intent.action_send action , set package 1 of google keep. everything works great, wondering if possible add parameter intent telling google keep must displayed list checkboxes, possible add event-specific extra's when creating calendar event. now, displayed plain text. here code: try { intent keepintent = new intent(intent.action_send); keepintent.settype("text/plain"); keepintent.setpackage("com.google.android.keep"); keepintent.putextra(intent.extra_subject, "shopping list " + recipe.getname()); keepintent.putextra(intent.extra_text, "flower\nyeast\nbutter\nalmonds"); startactivity(keepintent); } catch (exception e) { dialogs.toastshort(this, "google keep not installed on device"); } now, result: what, want result - without user has select "show checkboxes" in actionba...