Posts

Showing posts from April, 2014

ios - NSFetchedResultsController not refreshing when updated from child context -

i feel i've run issue before , plan on digging old code, has got solution this? for reason, isn't triggering nsfetchedresultscontroller pointed @ parent context update: [[nsnotificationcenter defaultcenter] addobserverforname:nsmanagedobjectcontextdidsavenotification object:nil queue:nil usingblock:^(nsnotification *note) { if ([[note object] iskindofclass:[nsmanagedobjectcontext class]] && [[note object] parentcontext]) { nsmanagedobjectcontext *parentcontext=[[note object] parentcontext]; [parentcontext performblockandwait:^ { [parentcontext mergechangesfromcontextdidsavenotification:note]; } ]; } } ]; basically, if make bunch of changes child nsmanagedobjectcontext , save context, triggers this. however, data shown nsfetchedresultscontroller prior context merge. if quit app , restart it, shows correct data. kind of annoying, missing , can't remember what. i tried this: https://github.com/f

each - Jquery toggle elements when button is clicked -

i want show album name , category element when corresponding button pressed song. how do this? jquery have @ moment. help. $('.song-list-btn').each(function(i, obj) { $(this).on('click', function () { }); }); foreach (var item in model) { <button class="song-list-btn" type="button"> <span class="fa fa-bars" aria-label="song details menu"></span> </button> @html.editorfor(model => item.albumname, new { htmlattributes = new { @class = "form-control details", @placeholder = "album name" } }) @html.validationmessagefor(model => item.albumname, "", new { @class = "text-danger" }) @html.editorfor(model => item.category, new { htmlattributes = new { @class = "form-control details", @placeholder = "category name" } })

android - parse.com not working after proguard -

Image
i'm using parse.com features in app, works great on debugging mode. generate signed apk in release mode, have killing wait 10 seconds @ beginning of opening app. it's because of parse.com trying initialize , contact servers, apparently not successful. and also, parse.com stops working know so, since no data uploaded account. there should problem proguard of course since difference between debug , release mode, enabling proguard, in case. i have triend keep com.parse following code in proguard rules: #keep parse classes -keepattributes annotation,sourcefile,linenumbertable -dontwarn com.parse.** -keep class com.parse.* { *; } -keep class com.parse.** { *; } any appreciated! edit: i found out huge memory leak happening @ parse.initialize() after proguard ... still have no idea why though! of course memory leak not present while proguard off try following if have apache http-core , http-mime along parse library: -keep class org.apache.** { *; } -k

decimal - vb.net Convert.ToDecimal Not working -

i writing program reads gps coordinates. gps coordinates in string format so: 42,9659 15,3167 i want convert these strings decimals. on development pc works fine, put software on pc doesn't convert decimal. outputs value without comma, so: 429659 153167 heres code: gpslatdecimalstring = gpsdata(2).substring(2, gpsdata(2).length - 2).replace(".", ",") gpslongdecimalstring = gpsdata(4).substring(3, gpsdata(4).length - 3).replace(".", ",") 'lat: 25.69953 'long: 28.23881 gpslatdecimal = system.convert.todecimal(gpslatdecimalstring) gpslongdecimal = system.convert.todecimal(gpslongdecimalstring) it seems coordinates in form xxxxx(point)yyyyy , problem in pc os configured different cultures. do not try replace point comma, use instead appropriate iformatprovider in call convert.todecimal gpslatdecimalstring = gpsdata(2).substring(2, gpsdata(2).length - 2) gpslongdecimalstring = gpsdata(4).substring(3, gpsdata

javascript - What elements can ng-disabled be applied to? -

i thought apply ng-disabled <a> element. it's looking can't. works on <button> element. know elements can apply ng-disabled to? you not disable anchor tag. ng-disabled or disabled attribute work on button/input s element, if want disable anchor tag should have call ng-click function on & on basis of either redirect or don't anything. markup <a href="" ng-click="redirect(isvalid, url)"> anchor button </a> code $scope.redirect = function(isvalid, url){ if(isvalid) $window.open(url, "_blank") }

apache pig - How to improve performance of PIG job that uses Datafu's Hyperloglog for estimating cardinality? -

i using datafu's hyperloglog udf estimate count of unique ids in dataset. in case have 320 million unique ids may appear multiple times in dataset. dataset : country, id. here code : register datafu-1.2.0.jar; define hyperloglogplusplus datafu.pig.stats.hyperloglogplusplus(); -- id uuid, example : de305d54-75b4-431b-adb2-eb6b9e546014 all_ids = load '$data' using pigstorage(';') (country:chararray, id:chararray); estimate_unique_ids = foreach (group all_ids country) generate 'total ids' label, hyperloglogplusplus(all_ids) reach; store estimate_unique_ids '$output' using pigstorage(); using 120 reducers noticed majority of them completed within minutes. handful of reducers overloaded data , ran forever. killed them after 24 hours. i thought hyperloglog more efficient counting real. going wrong here? in datafu 1.3.0, algebraic implementation of hyperloglog added. allows udf use combiner , improve performance in skew

javascript - jQuery - Stop listening for scroll down -

so using code perform tasks when user scrolls: function myfunction(){ var position = $(window).scrolltop(); $(window).scroll(function() { var scroll = $(window).scrolltop(); if(scroll > position) { // scrolling downwards hypedocument.showscenenamed('section 2', hypedocument.kscenetransitioncrossfade, 1.1); } position = scroll; }); return false; } but prevent down scrolling on 1 page. there anyway can whilst allowing scroll on other pages? tried using $(window).off("scroll"); blocks scrolling in both directions. this disable scrolling: $('html, body').css({ 'overflow': 'hidden', 'height': '100%' }); to restore: $('html, body').css({ 'overflow': 'auto', 'height': 'auto' });

javascript - Getting started with GSAP -

i'm trying first tween gsap , , nothing's happening, when i've tried use example code. i have php file following code: <head> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script> <style> #green { width: 100px; height: 100px; background-color: #0d9c02; } </style> </head> <body> <div id="green"></div> <script type="text/javascript" src="js/greensock/plugins/cssplugin.min.js"></script> <script type="text/javascript" src="js/greensock/tweenlite.min.js"></script> <script> $(document).ready(function(){ var logo = document.getelementbyid("green"); tweenlite.to(logo, 1, {left:"600px"}); }); </script> </body> all though static green square. must missing fundamental - what?? thanks. simple solution: needed position: relative;

c# - How do you create a custom AuthorizeAttribute in ASP.NET Core? -

i'm trying make custom authorization attribute in asp.net core. in previous versions possible override bool authorizecore(httpcontextbase httpcontext) . no longer exists in authorizeattribute . what current approach make custom authorizeattribute? what trying accomplish: receiving session id in header authorization. id i'll know whether particular action valid. i'm asp.net security person. firstly let me apologise none of documented yet outside of musicstore sample or unit tests, , it's still being refined in terms of exposed apis. detailed documentation here . we don't want writing custom authorize attributes. if need we've done wrong. instead should writing authorization requirements . authorization acts upon identities. identities created authentication. you in comments want check session id in header. session id basis identity. if wanted use authorize attribute you'd write authentication middleware take header , turn authentica

javascript - Still failing to figure out what I'm doing wrong about making a PHP function handle an AJAX request in WordPress -

after literally hours of trying hook function handler ajax requests through wordpress's api, still coming short. i've gone basic trying basic test <?php add_action( 'wp_ajax_member_update', 'member_update' ); function member_update ( ) { echo $_post['testvariable']; } ?> <script type="text/javascript"> jquery(document).ready(function($) { var data = { 'action': 'member_update', 'testvariable': 1234 }; $.post(ajaxurl, data, function(response) { alert('got server: ' + response); // expected: 1234 }); }); </script> and returning status code 200 , response 0. missing? i'm following the documentation far can tell. if setting add_action code in page, action won't called since using ajaxurl , goes wp-load.php . should define action in theme's functions.php code , make

html - css width on li inline not working -

i'm trying make width of <li> elements 200px wide seems taking exact width of text. #m_home_main_links li { display: inline; list-style-type: none; margin: 1%; text-align: center; background-color: orange; color: #198eff; width: 200px; } <div id="m_home_main_links"> <ul> <a href="/"> <li>mp3</li> </a> <a href="/"> <li>videos</li> </a> <a href="/"> <li>categories</li> </a> </ul> </div> you need make li display: inline-block them respect width setting , still behave inline element: #m_home_main_links li { display: inline-block; list-style-type: none; margin: 1%; text-align: center; background-color: orange; color: #198eff; width: 200px; }

java - How to clear premgen memory space -

i using mat analyze memory. size: 14.4 mb classes: 7k objects: 350.9k class loader: 116 i've got above report using mat memory analyzer. can't find way clear classes, objects. there way remove object , clean premgen memory. can clean premgen memory or have increase xms, xmx , launcher.xxmaxpermsize size in eclipse.ini file , make sure object nullify after use. as far know there no function clears permgen. on default, jvm holds loaded classes indefinitely. can change behaviour using - xx:+cmsclassunloadingenabled , - xx:+useconcmarksweepgc parameters. if use cmsclassunloadingenabled parameter gc sweep permgen , remove classes no longer used.

dependency injection - Should you manually add a css file in a gulp project? -

i have tried many times skeleton.css in index.html gulp-angular project still can't find way to. used bower install install skeleton-css , added respective folder in bower-component folder i have tried adding manually index.html in .tmp folder whenever gulp serve , whatever code added disappears: before running gulp serve <!-- build:css({.tmp/serve,src}) styles/app.css --> <!-- inject:css --> <link rel="stylesheet" href="app/skeleton.css"> <link rel="stylesheet" href="app/index.css"> <!-- endinject --> <!-- endbuild --> after running gulp serve <!-- build:css({.tmp/serve,src}) styles/app.css --> <!-- inject:css --> <link rel="stylesheet" href="app/index.css"> <!-- endinject --> <!-- endbuild --> i know pretty nooby question , has way injection works in gulp can't seem understand i'm quite new task automation environment, ideas mig

dojo - What is the trick to changing currency of CurrencyTextBox -

i have currencytextbox set currency default currency. user can change making selection in currency drop down on same form. thought change currency attribute on textbox dynamically nothing happens. symbol not change. there trick make work? i've seen related posts had destroy , recreate widget. seems there might better way? i'd set currency of unitcostid widget user's selected currency on fly. result currency symbol change match newly selected currency. new currencytextbox ({ id: "unitcostid", name: "price", currency: "usd", required: true, value: "", placeholder: "enter price" }, "unitcostnode"); ---------------------------------------------------- new select({ id: "currencyoptionsid", name: "currency_code", value: "usd", options: currencyoptions, required: true, onchange: f

java - Stack size verification and StackOverflowError -

in java, each thread have stack memory allocated defined -xss parameter , there default value. now, overridden default stack size running below code java -xss1k test . last output: 18479 18480exception in thread "main" java.lang.stackoverflowerror questions: why values till 18479 printed? expecting far less values because mentioned stack size of 1kb , storing int on each stack frame. with 1kb or 1024 bytes of stack size, 256 (1024/4) int values storable. no? because each recursive call 1 stack frame added , int stored on it. so, 256 stack frames size of 4 bytes each added there should have been stackoverflowerror. my understanding global scoped counter not contribute in way stack consumption because live in old gen space. confirm? public class test { private static int counter = 0; public static void main(string[] args) { getmestackoverflowexception(); } private static void getmestackoverflowexception(){ int x = 123;

php - HTACCESS Trailing Slash + Empty GET Var -

i'm quite new htaccess command line. running few problems 1. when no get[] variable inputted, page redirects error page, in php code have default function cover this. how prevent happening , still load code. 2. how redirect page bad link clean link. example: adminpage.php -> admin/view/... i've looked @ discussion redirects, not seem working me: redirect *.php clean url 3. when there not trailing slash @ end of link empty get[] var, fails load , redirects error page. example: /index/r/2 -> /index/r how prevent this. i've looked @ discussion trailing slashes, helps basic missing slashes, not when get[] variable missing too.. htaccess: add/remove trailing slash url # follow symbolic links options +followsymlinks # turn rewrite engine on rewriteengine on rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule ^(.*)/$ /$1 [l,r=301] rewriterule ^index/r/(\w*)$ /index.php?r=$1 rewriterule ^index/r/(\w*)/(\w*)$ /index.ph

Is there a way to download the crosswalk runtime after the app has been installed on android? -

compiling app crosswalk through cordova increase size of app approximately 20 mb . so, thinking if downloading , running code on crosswalk runtime after application installed work. if works download , use crosswalk runtime on android platforms (< android 4.4.3) only. , use webview on remaining platforms. want avoid building 2 different apps same code different platforms.

css - Add border depending on last elements -

i have parent div#main contains unknown number of divs in rows. every row has 3 divs display: inline-block . now, because of that, last row can contain 1, 2 or 3 divs , depending on number. if last row has 1 div, want add border-left , border-right it. if last row has 2 divs, want add border-right first div in row, or border-left second div . and if last row has 3 divs, want add border-left , border-right to second div (the middle one). (you'll full picture when @ snipper, or fiddle) i managed solve issue using js, i'm looking pure css solution , if there one. $('.main').each(function(){ var div_length = $(this).find('div').length; if((div_length % 3) === 0){ div_last_items = div_length; } else if((div_length % 3) === 1){ div_last_items = div_length - 1; $(this).find('div:nth-last-child(1)').addclass('active-borders'); } else if((div_length % 3) === 2){ div_last_items = div_length

jQuery Validate won't clear server-inserted error messages on KeyUp -

we using jquery validate plugin simple field validation. works expected when using default, client-side validation. however, of these fields require server-side validation. problem occurs when manually creating error labels on server in html. when doing so, error label displays expected, behavior wrong. essentially, once error label displayed, won't removed on keyup event of field. removed when press submit button, , first press of submit button hides error label , sets input field valid. have press submit button second time have form submit. appears jquery validate knows error label , it's connected input field, else wouldn't hidden when pressing submit button. things i've tried: setting generated="true" on error label (no change) removing server-side label generation , returning error code creates label on client side validator object, yet behavior same (have press submit button first remove label , second time submit form): var validator

regex - Scala extracting only certain characters -

i taking in line line in scala string, , want able remove characters don't belong arbitrary collection of letters s. would val pattern = s.r? , how parse line remove characters not in s? you can use filternot remove character in collection. scala> val vowels = set("a","e","i","o","u") vowels: scala.collection.immutable.set[string] = set(e, u, a, i, o) scala> val line = """i taking in line line in scala string, , want able remove characters don't belong arbitrary collection of letters s.""" line: string = taking in line line in scala string, , want able remove characters don't belong arbitrary collection of letters s. scala> line.filternot(x => vowels.contains(x.tostring)) res4: string = m tkng n ln ln n scl s strng, nd wnt t b bl t rmv ll chrctrs tht dn't blng t sm rbtrry cllctn f lttrs s.

java - Asynchronously load images into ViewPager -

i'm trying make slideshow using viewpager. want access dropbox download images , load them fragment. use async task inside fragment fetch image , onpostexecute load image imageview. problem image doesn't shown. suppose asynctask can't update fragment content or when return rootview no longer updated. can please suggest me solution? appreciate help! screenslideshowactivity2 public class slideshowactivity2 extends fragmentactivity { private static final int num_pages = 5; private viewpager mpager; private pageradapter mpageradapter; list<dropboxapi.entry> content; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_slide_show_activity2); content = albumadapterdropbox.choosenalbum.getcontent(); mpager = (viewpager) findviewbyid(r.id.pager); mpageradapter = new screenslidepageradapter(getsupportfragmentmanager()); mpager.setadapter(mpageradapter); } @ove

c++ - Weird behaviour of Z-Buffer -

Image
i'm using deferred shading method render scene, have problem skybox technique due weird behaviour of z-buffer. i've created additional framebuffer , attached 5 textures, 1 of being used depth buffer. first pass geometry pass, fills textures needed data, second pass renders final objects textures , lightning applied main framebuffer, last pass renders skybox. problem skybox being ignored (z-buffer check fails, invisible). when rendering skybox, map secondary framebuffer gl_read_framebuffer , main framebuffer (screen) gl_draw_framebuffer, depth buffer of secondary framebuffer can used, set depth function gl_lequal. , if change depth function gl_greater (or gl_always) skybox can seen, being rendered on top of objects. the vertex shader: #version 330 layout (location = 0) in vec3 position; uniform mat4 m; uniform mat4 v; uniform mat4 p; out vec3 texcoord0; void main() { vec4 mvp_pos = p * v * m * vec4(position, 1.0); gl_position = mvp_pos.xyww; texcoord0 =

xmlhttprequest - Chrome & CORS with 302 redirects and withCredentials=true -

i having trouble chromium-based browsers , cors requests include 302 redirects. more specifically, having trouble chromium versions 34-42 inclusive; 43 , later works, , seems 33 , earlier versions worked (i didn't test far past 33, 28 worked). my xhr request uses withcredentials=true, access-control-allow-origin="*" not allowed; server must reply access-control-allow-origin header echoes incoming request's origin header. after receiving first 302, chromium 43 , later sends "origin: null" part of redirected request, , accepts 'access-control-allow-origin: null" in response (as firefox). the chromium series of 34-42 send host name origin requests, , several issues time indicate cors redirects only supported access-control-allow-origin set "*", , "the original xhr must not have allow-credentials set true", example: https://code.google.com/p/chromium/issues/detail?id=154967 i hoping misconception, , there app devel

scala - How prevent spray run router at start up? -

consider code below: import akka.actor.{actorsystem, props} import akka.io.io import spray.can.http object main extends app { implicit val system = actorsystem() val handler = system.actorof(props[demoserviceactor], name = "handler") io(http) ! http.bind(handler, interface = "localhost", port = 8080) } import akka.actor.actor import spray.routing.httpservice class demoserviceactor extends actor demoservice { def actorreffactory = context def receive = runroute(demoroute) } trait demoservice extends httpservice { implicit def executioncontext = actorreffactory.dispatcher def demoroute = { path("test") { { println("ping") complete("test complete") } } } } when main runs print console ping . why? how fix this?

regex - REGEXP_LIKE to matchtwo words in a sentence in Oracle 11g -

sentence :"standard domain warning encountered in process" i want identify sentences have words standard , warning in using regexp_like. search has case insensitive. i want replace following code regexp_like: select * table upper(sentence) 'standard%warning%' you can specify 'i' match parameter case insensitivity: select * table regexp_like (sentence, '\bstandard(?=\b).*\bwarning\b', 'i')

jquery - Keep a div spaced exactly X amount of pixels away from another -

Image
i'm trying keep sidebar div 30px grey box always, during resize. problem i'm running whitespace:nowrap. seems mess left:79% rule. however, if remove text wraps. https://jsfiddle.net/yzm83d6d/ #sidebar-miniright { width:100%; white-space:nowrap;} .sidebar-right { position: fixed; top: 50%; left:79%; /* safari */ -webkit-transform: rotate(-270deg); /* firefox */ -moz-transform: rotate(-270deg); /* ie */ -ms-transform: rotate(-270deg); /* opera */ -o-transform: rotate(-270deg); transform: rotate(-270deg);} wrap div around gray box , sidebar position:relative . center align gray box with: width:100%; margin: 0px auto; display: block; apply sidebar: position: absolute; right:-30px; a piece of advice, css learnt better playing it.

sql - Complicated reorder of MySQL tables -

i should complicated tables reorder. ****the main table looks like:**** id - data 1 - ... 2 - ... 3 - ... 6 - ... 9 - ... 12 - ... as can see, there "empty" ids (no 4, 5 between 3 , 6 etc). ****table should like**** id - data 1 - ... 2 - ... 3 - ... 4 - ... 5 - ... 6 - ... 7 - ... etc (without empty ids) why want make it: server database, includes millions ids. server crashes when maintaining such big numbers. if reorder ids , there won't empty ones, max id in table lower , prevent server crashing. the complicated thing - table has foreign key references (only id column references atleast) in 4-5 different tables. my thought is - reorder main table ids without empty ones , create new temp table (oldid, newid) structure , replace oldid's newid's in other related tables. any ideas how query like? take half hour execute query it's least problem.

ios - Execute JavaScript when tapping on notification -

i'm using phonegap pushplugin cordova implement notifications on ios. i managed far registering device , sending notifications successfully. when tap on notification, cannot execute piece of javascript open relevant page in application. window.onnotificationapn = function(event) { if ( event.alert ) { navigator.notification.alert(event.alert); //call javascript here? } if ( event.sound ) { var snd = new media(event.sound); snd.play(); } if ( event.badge ) { pushnotification.setapplicationiconbadgenumber(successhandler, errorhandler, event.badge); } } i tried adding javascript under if(event.alert) not executed. data javascript code should using sent part of notification payload. doing wrong?

python - Writing bits to a binary file -

i have 23 bits represented string, , need write string binary file 4 bytes. last byte 0. following code works (python 3.3), doesn't feel elegant (i'm rather new python , programming). have tips of making better? seems for-loop might useful, how do slicing within loop without getting indexerror? note that when extract bits byte, reverse bit-order. from array import array bin_array = array("b") bits = "10111111111111111011110" #example string. it's 23 bits byte1 = bits[:8][::-1] byte2 = bits[8:16][::-1] byte3 = bits[16:][::-1] bin_array.append(int(byte1, 2)) bin_array.append(int(byte2, 2)) bin_array.append(int(byte3, 2)) bin_array.append(0) open("test.bnr", "wb") f: f.write(bytes(bin_array)) # writes [253, 255, 61, 0] file you can treat int, create 4 bytes follows: >>> bits = "10111111111111111011110" >>> int(bits[::-1], 2).to_bytes(4, 'little') b'\xfd\xff=\x00'

bash - jq or xsltproc alternative for s-expressions? -

i have project contains bunch of small programs tied using bash scripts, per unix philosophy. exchange format looked this: meta1a:meta1b:meta1c ast1 meta2a:meta2b:meta2c ast2 where : -separated fields metadata , ast s s-expressions scripts pass along as-is. worked fine, use cut -d ' ' split metadata asts, , cut -d ':' dig metadata. however, needed add metadata field containing spaces, breaks format. since no field uses tabs, switched following: meta1a:meta1b:meta1c:meta 1 d\tast1 meta2a:meta2b:meta2c:meta 2 d\tast2 since envision more metadata fields being added in future, think it's time switch more structured format rather playing game of "guess punctuation". instead of delimiters , cut use json , jq , or use xml , xsltproc , since i'm using s-expressions asts, i'm wondering if there's nice way use them here instead? for example, looks this: (echo '(("foo1" "bar1" "baz1" "quux 1"

java - Parameter 'directory' is not a directory for a parameter which is a directory -

i'm getting strange error parameter supply method complains it's not directory in fact directory files in it...i don't understand what's wrong... toplevel: public static file mainschemafile = new file("src/test/resources/1040.xsd"); public static file contentdirectory = new file("src/test/resources/input"); public static file outputdirectory = new file("src/test/resources/output"); decisiontablebuilder builder =constructor.newinstance(log, contentdirectory, outputdirectory); // here error occurs builder.compile(mainschemafile); the class i'm using: public class decisiontablebuilder { public void compiler(file schemafile) { ... // it's complaining contentdirectory, goes fileutils class collection<file> flowchartfiles = fileutils.listfiles(contentdirectory, mapextension, true); ... } } here apache fileutils class: public class fileutils { private static void validatelistfile

How to call the default behavior's method in Polymer 1.0? -

in polymer 1.0 have behavior script defines properties , methods: <script> databehavior = { properties: { data: { type: array, value: null, observer: 'datachanged' } }, datachanged: function(newvalue, oldvalue) { console.log('default stuff'); } }; </script> and components uses behavior: <dom-module id="my-module"> <template> </template> <script> polymer({ is: "my-module", behaviors: [databehavior], datachanged: function(newvalue, oldvalue) { // how call datachanged method databehavior? // this.super.datachanged(); <- don't works! console.log('custom stuff'); } }); </script> </dom-module> when change data property method executed my-module, make "custom stuff". if remove datachanged method in my-module execute "default stuff". how can execute both default behavior's met

string - How to find source of scala.MatchError? -

i have parser program in scala sending string , breaking string , parse. getting following error on don't know part of program wrong: exception in thread "main" scala.matcherror: xxxx/xml/test3d.xml (of class java.lang.string) what possibilities need check , best way solve these kind of errors? there exact place exception occurred , described file name , line number in file. example, @ stack trace: exception in thread "main" scala.matcherror: 7 (of class java.lang.integer) @ stackoverflow.m$.delayedendpoint$stackoverflow$m$1(functions.scala:35) @ stackoverflow.m$delayedinit$body.apply(functions.scala:30) @ scala.function0$class.apply$mcv$sp(function0.scala:40) here can see exception cause on line 35 in functions.scala file. second line in stack trace line exception thrown. check line! matcherror occurs whenever object doesn't match pattern of pattern matching expression.

ruby on rails - ActiveRecord condition override and default_scope -

there anyway around override default_scope or previous scope condition? (beside restructure model not use default_scope or use unscoped) and knowns if there reason behind why works way does? feels not expected or intuitive result. sample: class product < activerecord::base default_scope -> { visible } scope :visible, -> { where(visible: true) } scope :hidden, -> { where(visible: false) } end when this: product.hidden the generated sql tries match 2 values: where "products"."visible" = 't' , "products"."visible" = 'f' the same goes without default_scope: class product < activerecord::base scope :visible, -> { where(visible: true) } scope :hidden, -> { where(visible: false) } end when this: product.visible.where(visible: false) or when this: product.visible.hidden the generated sql tries match 2 values: where "products"."visible" = 't' , &qu

How to debug a MySQL error in PHP? -

i have code don't have problem somehow mysql query part (marked arrow ------> ) stopping code. the mysql command fine , mysql_connection working, can ping it. i'm working time that, can't find error, , since code stopping can't fetch error message. <?php //including mysql_connection include("../mechanics/mysql_con.php"); ?> <html> <head> <link rel="stylesheet" type="text/css" href="../mechanics/segments_container.css"/> </head> <body> <div class = "container"> <div class = "titlebar"> members </div> <div class = "inner_container"> <center> <table style="color:#cccccd;width:100%;"> <tr> <td style="min-width:50px;text-align:center;"><b>avatar</b></td> <td style=&quo

Print Java variable onto JSP page -

i having trouble printing java variable created in java bean on jsp page. tried calling method java bean jsp receiving syntax error , using current knowledge figure out. public class studentloginbean { @managedbean( name="studentloginbean" ) public string username; public string getusername() { return username; } public void setusername(string username) { this.username = username; } this tried. <% string username = studentloginbean.getusername("username"); %> <div class="margintable" data-pubid="<%=username%>" data-count="5"></div> kindly add scope of bean viewscoped, sessionscoped etc @viewscoped @managedbean( name="studentloginbean" ) hope work. thanks

java - Number of CLOSE_WAIT with lsof -

i lsof | grep close_wait | wc -l on ubuntu 14.04 lts i got pid , tid displayed. there 70 close_waits on java proc x number of threads. however, if do lsof -i | grep close_wait |wc -l i got 1, java process (no tid). does mean can't reliably figure out fs leak doing lsof -i? have use "lsof"? as sidebar, know why elb not closing connection? java 9645 9863 ubuntu 133u ipv4 19375 0t0 tcp ip-10-20-187-89:51548->ec2-100-200-86-25.compute-1.amazonaws.com:https (close_wait) java 9645 9864 ubuntu 133u ipv4 19375 0t0 tcp ip-10-20-187-89:51548->ec2-100-200-86-25.compute-1.amazonaws.com:https (close_wait) java 9645 9865 ubuntu 133u ipv4 19375 0t0 tcp ip-10-20-187-89:51548->ec2-100-200-25.compute-1.amazonaws.com:https (close_wait) java 9645 9902 ubuntu 133u ipv4 19375 0t0 tcp ip-10-20-187-89:51548->ec2-100-20

html - How do I show a BUTTON border outside of it's parent DIV area? -

i tried using box-shadow instead, want know if there's easy, efficient way around this. css div { text-align: left; background: #f5f5f5; width: 500px; padding: 10px 10px 0 10px; margin: 10px; } button { border: 0; border-bottom: 5px 0 0 #f00; background: #f5f5f5; width: 100px; padding: 10px 0; } html <div> <button>test_1</button> </div> if goal button 5px lower parent div , can add css: button { transform: translatey(5px); } fiddle

mysql - SQL query, treat NULL as zero -

this question has answer here: mysql: typecasting null 0 1 answer i'm learning sql (using mysql) , have simple question. have table salary , bonus information on employees, , i'd sum two, have mysql return value 0 when @ least 1 of summands null , instead of returning null . what's easiest way this? mysql> select salary, bonus employee_pay_tbl; +----------+---------+ | salary | bonus | +----------+---------+ | 30000.00 | 2000.00 | | null | null | | 40000.00 | null | | 20000.00 | 1000.00 | | null | null | | null | null | +----------+---------+ mysql> select salary + bonus employee_pay_tbl; +----------------+ | salary + bonus | +----------------+ | 32000.00 | | null | | null | | 21000.00 | | null | | null | +----------------+ you can use coalesce . accepts nu

html - PHP mail function doesn't complete sending of e-mail -

<?php $name = $_post['name']; $email = $_post['email']; $message = $_post['message']; $from = 'from: yoursite.com'; $to = 'contact@yoursite.com'; $subject = 'customer inquiry'; $body = "from: $name\n e-mail: $email\n message:\n $message"; if ($_post['submit']) { if (mail ($to, $subject, $body, $from)) { echo '<p>your message has been sent!</p>'; } else { echo '<p>something went wrong, go , try again!</p>'; } } ?> i've tried creating simple mail form. form on index.html page, submits separate "thank submission" page, thankyou.php , above php code embedded. code submits perfectly, never sends email. please help. although there portions of answer apply usage of the mail() function itself, many of these troubleshooting steps can applied php mailing system. th