Posts

Showing posts from March, 2014

xml - XSLT - Substitute code for string -

i'm working on xslt inside program , uses xml 1.0. so, because it's inside program can't use other languages this. in program can select options data i'm not been able xslt. code this: <!-- md_dataidentification.topiccategory--> <div class="iteminfo"> <span style="color: black; font-size: 13;"> <span style="color: black; font-size: 15; font-weight:bold;">categoria temática:<br /></span> <xsl:choose> <xsl:when test="/metadata/dataidinfo[1]/tpcat/topiccatcd[(. != '001') , (. != '002') , (. != '003') , (. != '004') , (. != '005') , (. != '006') , (. != '007') , (. != '008') , (. != '009') , (. != '010')]"> <xsl:for-each select="/metadata/dataidinfo[1]/tpcat/topiccatcd[(. != '001') , (. != '002') , (. != '003') , (. != '004')

ios - Startup code in cordova -

i very new in cordova (a few weeks), , building ios app, , trying implement code opens external url in default browser, safari. following tutorial says "use following part of startup code in cordova app": window.addeventlistener('load', function () { $(document).on('click', 'a[target="_system"],a[target="_blank"]', function (e) { e.preventdefault(); var url = this.href; window.open(url,"_system"); }); //} }, false); how add part of startup code? script tag @ top of page? tried , got no luck. here link tutorial using: http://weblog.west-wind.com/posts/2015/jul/02/external-links-in-cordova-for-ios the code showed should included script tag tried. after need add link element in html , click that. index.html this <html> <head> <script src="cordova.js"></script> <script type="text/javascript"> window.addeventlistener('loa

java - How to solve squid:UndocumentedApi on public method in package classes -

Image
i have classes, visible in package. after analysis received issues related missing documentation on public constructors/methods/types etc. is bug (false positive)? seems me change public not public constructors/methods/types senseless. i use sonarqube 5.1.1 , java plugin 3.4. about methods, fields , inner classes: having methods (or fields or inner classes) being public in package-private class implies if extended public class , public members package-private class visible outside! consequently, have considered being public, , therefore documented. example: package-private class a : package org.foo; class { public int field; public void method() {} public class inner {} } public class b : package org.foo; public class b extends { } other package , class c : package org.bar; public class c { void test() { b b = new b(); int f = b.field; // visible b.inner = b.new inner(); // visible b.method(); //

mysql - IIS 404 error from Apache php wordpress blog -

i have configured apachelounge on localhost port 8282 on windows 7 ultimate sp1. have installed php, mysql & wordpress blog test website in apache server. apache website works fine on port http://localhost:8282/testwebsite/index.php . have created blog folder @ root folder of website. have unzipped wordpress 4.2.2 in blog folder , configured correctly mysql server. all links work on website except blog link. when click on blog link redirects localhost:8282/testwebsite/blog/ localhost/testwebsite/blog/ displaying error page iis below http error 404.0 - not found resource looking has been removed, had name changed, or temporarily unavailable. detailed error information 1. module iis web core 2. notification maprequesthandler 3. handler staticfile 4. error code 0x80070002 5. requested url http://localhost:80/testwebsite/blog/ 6. physical path c:\inetpub\wwwroot\testwebsite\blog\ 7. logon method anonymous 8. logon user anonymous i dont understand wh

html - Cascading divs with triangle bottom borders -

Image
this follow-up question: center triangle @ bottom of div full width responsively again i'm stuck css project involving divs triangle borders @ bottom: i want row of cascading divs (lower tringle colored red demonstration purposes): my code looks this: html, body { padding: 0; margin: 0; color: white; } .top { background-color: #282c34; height: 500px; width: 100%; position: relative; } .bottom { background-color: #3b3e48; height: 500px; width: 100%; } .triangle { border-left: 50vw solid transparent; border-right: 50vw solid transparent; width: 0; height: 0; bottom: -40px; content: ""; display: block; position: absolute; overflow: hidden; left:0;right:0; margin:auto; } .uppertriangle { border-top: 40px solid #282c34; } .lowertriangle { border-top: 40px solid red; } <div class="top"> <div class="triangle up

r - unable to install 'XML' package dependency for 'pmml' on Ubuntu -

i trying install 'pmml' package in r using install.packages('') option source. keep getting errors both ways. trying r install.packages('pmml',dependencies=t) cannot find xml2-config error: configuration failed package ‘xml’ * removing ‘/home/pepperboy/r/x86_64-pc-linux-gnu-library/3.2/xml’ error: dependency ‘xml’ not available package ‘pmml’ * removing ‘/home/pepperboy/r/x86_64-pc-linux-gnu-library/3.2/pmml’ trying source > install.packages('pmml_1.4.2.tar.gz', repos = null, type="source") installing package ‘/home/pepperboy/r/x86_64-pc-linux-gnu-library/3.2’ (as ‘lib’ unspecified) error: dependency ‘xml’ not available package ‘pmml’ * removing ‘/home/pepperboy/r/x86_64-pc-linux-gnu-library/3.2/pmml’ warning message: in install.packages("pmml_1.4.2.tar.gz", repos = null, type = "source") : installation of package ‘pmml_1.4.2.tar.gz’ had non-zero exit status trying using r cmd install % r cmd install pm

Why does this Scala placeholder not work -

this question has answer here: scala foreach strange behaviour 5 answers given these case classes: case class featuredistance(id: long, distance: double) case class searchresult(score: float, id: long) why not compile? val distances = list[featuredistance](featuredistance(1l, 10f)) val results = distances.map(searchresult(0f, _.id)) but does: val results = distances.map(fd => searchresult(0f, fd.id)) the compilation error says: missing parameter type expanded function ((x$3) => x$3.id) is because _ scoped map function it's not visible in searchresult.apply call? after doing bit of research, found post on old scala forums contains quote: when use "_" place holder anonymous parameter of function, scope of function innermost parenthesis containing it. so, it's question of scope. suspect has problems otherwise

php - Laravel 5.0 show logged in guests and registered users -

i attempting add function site shows number of logged in guests , registered users(displaying names of registered users can figure out part). presently, have read need change /config/session.php file 'driver' use database instead of file ( 'driver' => env('session_driver', 'database'), ). found article uses sentry accomplish ( http://laravel.io/forum/03-03-2014-sentry-3-users-online ), however, prefer without requiring third party files. have, nonetheless, used information starting point utilizing model session. as issues, first off, unable session start saving in database 'sessions' table after modifying session.php, creating table , migrating it. still saving in files in /storage/framework/session/ (i can still log in , display session information using session::all() ). mysql> select * sessions; empty set (0.00 sec) second issue, don't know how create session if 1 not exist given in file, there no way create (if opens

python - Flask: Cannot Decode Incoming JSON Submitted Using Requests -

i'm having issue trying decode python dictionary sent server json. have in application: payload = {'status':[bathroomid,item,percentage,timestamp]} r=requests.post(url,none,json.dumps(payload)) here in flask server: req = request.get_json() print req['status'] when try print content of req['status'] , seems python won't recognize dictionary , internal server error. i tried printing req , , none what missing? unless set content-type header application/json in request, flask not attempt decode json found in request body . instead, get_json return none (which you're seeing right now). so, need set content-type header in request. fortunately since version 2.4.2 (released year ago) , requests has helper argument post json; set proper headers you. use: requests.post(url, json=payload) alternatively (e.g. using requests < 2.4.2), can set header yourself: requests.post(url, data=json.dumps(payload), headers={&quo

javascript - How to create below image in Extjs4? -

Image
i want develop window in extjs4 same below image, user able see root cause when click on details section. textarea section should hide/show when click on details tab. ext.create('ext.window.window', { title: 'first window', height: 200, width: 400, layout:'fit', items:{ xtype:'form', //title: 'errordetails', bodypadding: 5, width: 350, items:[{ html: 'failed submit request' }, { xtype: 'button' ,text: 'details>>' , handler : function(){ console.log('button got clicked'); } }, { xtype: 'textarea', id:'tt',

c# - Unit of Work and Repository Pattern -

i implement simple igenericrepository , iunitofwork interfaces in application i'm not sure whats best way it. as far understand, unitofwork should used writing, while repository should used reading. have encountered 1 architecture , it, found interfaces , not implementations, , i'm not sure how should implement those. public interface igenericrepository : idisposable { iunitofwork createunitofwork(); t firstordefault<t>(expression<func<t, bool>> predicate) t : class, ibaseentity; iqueryable<t> get<t>(expression<func<t, bool>> predicate = null, func<iqueryable<t>, iorderedqueryable<t>> sorter = null, params string[] includeproperties) t : class, ibaseentity; iqueryable<t> getall<t>() t : class, ibaseentity; idbcontext getdbcontext(); } public interface iunitofwork : idisposable { int commit(); bool delete<t>(t entity) t : class, ibaseentity; int deleteitems<t

javascript - CDN Fallback for Dependant Scripts -

if using following scripts: jquery jquery validation jquery validation unobtrusive bootstrap bootstrap , jquery validation require jquery , jquery validation unobtrusive requires jquery validation have interdependent scripts. fallback scripts have seen this: (window.jquery || document.write('<script src="/bundles/jquery"><\/script>')); ($.validator || document.write('<script src="/bundles/jqueryval"><\/script>')); ($.validator.unobtrusive || document.write('<script src="/bundles/jqueryvalunobtrusive"><\/script>')); ($.fn.modal || document.write('<script src="/bundles/bootstrap"><\/script>')); the problem if using ajax.aspnetcdn.com cdn , fails, first line cause jquery loaded locally next 3 lines of code execute before , error because $ undefined. is there standard way handle these types of interdependent fall-back scripts? have looked around , can&#

lazy evaluation - Laziness in Swift -

why lazy used here? extension sequencetype { func mapsome<u>(transform: generator.element -> u?) -> [u] { var result: [u] = [] case let x? in lazy(self).map(transform) { result.append(x) } return result } } this extension takes transformation function returns optional, , returns array of values weren’t transformed nil why not use self.map(transform) ? laziness necessary here? it avoids creation of intermediate array. self.map(transform) returns array containing results of transformation of all sequence elements, traversed build resulting array non-nil elements. lazy(self).map(transform) is sequence of transformed elements, iterated on non-nil elements. transformed elements computed during enumeration. (each call next() on lazy sequence produces 1 element transforming next element of original sequence.) both methods work. lazy method perform better large sequences, can depend on many fac

hadoop - Extract individual column from a HIVE table -

below select query hive table: select * test_aviation limit 5; ok 2015 1 1 1 4 2015-01-01 aa 19805 aa n787aa 1 jfk new york ny ny 36 new york 22 lax los angeles ca ca 06 california 91 0900 0855 -5.00 0.00 0.00 -1 0900-0959 17.00 0912 1230 7.00 1230 1237 7.00 7.00 0.00 0 1200-1259 0.00 0.00 390.00 402.00 378.00 1.00 2475.00 10 2015 1 1 2 5 2015-01-02 aa 19805 aa n795aa 1 jfk new york ny ny 36 new york 22 lax los angeles ca ca 06 california 91 0900 0850 -10.00 0.00 0.00 -1 0900-0959 15.00 0905 1202 9.00 1230 1211 -19.00 0.00 0.00 -2 1200-1259 0.00 0.00 390.00 381.00 357.00 1.00 2475.00 10 2015 1 1 3 6 2015-01-03 aa 19805 aa n788aa 1 jfk new york ny ny 36 new york 22 lax los angeles ca ca 06 ca

Swift: generic power function as infix operator -

below answer original question of how add power operator int numbers: infix operator ^^ { associativity left precedence 160 } func ^^ (radix: int, power: int) -> int { return int(pow(cgfloat(radix), cgfloat(power))) } how 1 generalise works double , float , , int ? you cannot "generalize" it. have implement each type separately. if in swift header, see that swift built-in operators such + . there no "general" + function; there 1 + function every numeric type. thus: infix operator ^^ { associativity left precedence 160 } func ^^ (radix: int, power: int) -> int { return int(pow(cgfloat(radix), cgfloat(power))) } func ^^ (radix: double, power: double) -> double { return double(pow(cgfloat(radix), cgfloat(power))) } // ... , on many types ...

html - Lining up percentage based divs within a horizontal bar graph? -

i trying create horizontal html bar graph , having issues wrapping head around layout. want have div background image 10, evenly spaced, vertical lines , have several divs within div percentage-based widths. functionally, working expected, having difficult time figuring out how bars line vertical lines in background image. for instance, if bar has width of 60% should align 6th vertical line. html: <div class="chart"> <div class="bar-container"> <div data-percentage="70" class="bar">product 1</div> <div data-percentage="30" class="bar">product 2</div> <div data-percentage="90" class="bar">product 3</div> </div> </div> css: .chart { width:320px; height:200px; background-image:url('http://s15.postimg.org/ku83p3fvf/bars.png'); background-repeat:no-repeat; background-size:contai

python - Memoryview on c array in cython -

error initializing memoryview variable. code: cdef int *popref = <int*>malloc(popsize * sizeof(int)) cdef int [:] popref_mv = popref and error getting: error: cdef int [:] popref_mv = popref ^ expected identifier or literal running python 2.6.6, gcc 4.4.7, cython 0.14.1 on red hat linux.

mysql - How to calculate personal number by date of birth using php -

i want make calculation of personal number date of birth. the calculation done in manner: ex. 8 (day) +12 (month) + 1 + 9 + 7 + 1 (year) = 38 = 3 + 8 = 11 = 1 + 1 = 2 (the final number) this final number must not greater nine. so: the first number comes 38 greater 9 , should make 3 + 8 the second number comes 11 greater 9 should make 1 + 1 the third number comes 2 less 9 final number. taking these calculations should let out number 2. how can php calculation? i suppose, can split date array. then $arr = array(8,12,1,9,7,1); // sum array, split sum array per digit untill more 1 digit in sum while (count($arr = str_split(array_sum($arr))) != 1) {} echo $arr[0]; // 2

sql server - How to move a trained SSAS mining structure model to a different database? -

i have many candidate models in mining model development ssas database move production ssas database, there doesn't seem way trained models without having re-train model once in new database. how can retain model content when moving across databases? think can use dmx export/import file location this, clunky , working off of sql cluster don't have clear path static location. other suggestions? if don't want full database backup disk , restore might try synchronize. incrementally copy database 1 ssas instance without landing on disk backup file first: https://msdn.microsoft.com/en-us/library/ms174928.aspx

Object doesn't support property or method 'find' in jquery -

i have references below in form <link type="text/css" rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" /> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> <script type="text/javascript" src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script> i trying find contents of title element below string. var mytext = "<head><title>bad error</title></head>"; var err = mytext.find('title'); i getting object doesn't support property or method 'find' error. my requirement want text between element <title> . use filter tag $(mytext).filter('title').text(); give title tag text.

android - How can I programmatically press phone buttons (0-9, #, * ) when a particular number calls me? -

i want write phone app, automatically press phone buttons (0-9, #, *) , end call when particular number calls me. ideally works windows phone 8.1. possible? can't find api use. however, work me if solution exists android. couldn't find way there either. any pointers api documentation? or apps this? there no such android api. there's api generating on speaker, none sending other side of call. security issue- android not allow access call audio, in either direction. this might work windows phone: windows phone phonecall dtmf btw, google term use in search dtmf. industry name beep sound keys make.

sql - MySQL Contact multiple right joined rows into one column -

if have this users id user 1 john 2 tom and states user_id state 1 ma 1 ca 2 va how result set is: id user states 1 john ma,ca 2 tom va i think has group contact, can't work. as suggested, group_concat way go - need group by users ' columns: select u.id, u.user, group_concat(s.state) users u join states s on u.id = s.user_id group u.id, u.user

iphone - Your account already has a valid iOS Development certificate -

Image
i borrowed ipad mini (mf432c/a) ios 8.0.2 department in company working on different ios app , tried build application. i received following error when attempting build on via xcode version 6.4 (6e35b) failed code sign ----. none of valid provisioning profiles include devices: 725 product dev ipad mini. xcode can attempt fix issue. after clicking fix issue has been doing decent job of auto-provisioning unknown devices lately following message: your account has valid ios development certificate you have valid ios development certificate in member center, not installed locally. if signing identity installed on mac, can export developer profile on mac , import on mac. can revoke current certificate , request new one. from relevant apple docs looks i'm missing correct signing identity build app on device. issue signing identity of developers of other application. there way bypass error , provision device own application? edit:

c - clear screen using exec() in linux -

i trying write code clear screen using fork() through exec. referring http://man7.org/linux/man-pages/man3/exec.3.html manual confuse why not placing new image @ screen( mean clearing screen). here attempt: #include <stdio.h> #include <stdlib.h> #include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <sys/wait.h> # include <curses.h> #define numargs 2 void main(int argc,char* argv[]) { pid_t pid; char * child_args[numargs] = {0,0}; if((pid=fork())==0){ exec();// clear screen } else{ wait(); } } kindly correct me if wrong can solve problem. you seems confused 2 different, unrelated things: exec*() , fork() clearing screen fork create new child process, duplicating state of current process @ same time. exec family of related functions, job replace current process another. on unix systems, clearing screen done via ansi escape codes. please not print

jar - Unable to submit Spring boot java application to Spark cluster -

i have developed web application spring boot uses apache spark querying data different datasources (like oracle). @ beginning, had planned run application without submitting using spark-submit script, looks cannot connect master cluster without submitting jar. have generated uber jar includes dependencies , sub-projects using, seems spark not spring boot applications. when try submit app, spark shows following error: exception in thread "main" java.lang.illegalargumentexception: loggerfactory not logback loggercontext logback on classpath. either remove logback or competing implementation (class org.slf4j.impl.log4jloggerfactory loaded file:/home/rojasmi1/spark/spark-1.4.0/assembly/target/scala-2.10/spark-assembly-1.4.0-hadoop2.2.0.jar). if using weblogic need add 'org.slf4j' prefer-application-packages in web-inf/weblogic.xml object of class [org.slf4j.impl.log4jloggerfactory] must instance of class ch.qos.logback.classic.loggercontext @ org.springframework.ut

jquery - Resetting data-Id for dynamically appended inputs -

so red squares http://imgur.com/lqyatdb showing i'm trying achieve want reset number after each champion start [1] might want add more fields first champion increase old number $(document).ready(function(){ championnumber = 1; spellnumber=1; $('a#addchampion').on('click',function(){ $('div#championinput').append( '<div class="champion" data-id="'+championnumber+'">\ <a href="#" class="remove">remove</a>\ <br>\ <input type="text" class="championinput" list="champions" name="champion[]" placeholder="champion '+championnumber+'">\ <datalist id="champions"></datalist>\ <a href="#" class="addspell">add spell</a>\ <br>\ <div>');

render html from javascript rails -

Image
i have rendering of partial should outputted div not displayed correctly. tried in index.js.haml : = "$('.modal-body').html('#{escape_javascript(raw render("details"))}');" = "$('.modal-body').html('#{escape_javascript(raw render("details")).html_safe}');" = "$('.modal-body').html('#{escape_javascript(raw render("details").html_safe)}');" = "$('.modal-body').html('#{raw escape_javascript(raw render("details"))}');" = "$('.modal-body').html('#{raw escape_javascript(raw render("details").html_safe)}');" = "$('.modal-body').html('#{raw escape_javascript(raw render("details")).html_safe}');" and outputing same following thing: if remove escape_javascript, ain't working anymore. thanks emu posted answer in erb found way of doing in haml: :plain $(

emacs24 - Emacs 24.5 with prelude stuck on contacting host melpa.org -

i'm running emacs 24.5 installed via homebrew. weird reason emacs gets stuck on contacting host: melpa.org:80 i tried fresh install of emacs (removed .emacs.d folder well) i'm able ping url melpa.org through terminal. any ideas on how fix this. can try switching https? have (setq package-archives '(("org" . "http://orgmode.org/elpa/") ("melpa" . "https://melpa.org/packages/") ("gnu" . "https://elpa.gnu.org/packages/"))) ;; https://glyph.twistedmatrix.com/2015/11/editor-malware.html ;; needs "brew install gnutls" , "pip install certifi", perhaps sudo (let ((trustfile (replace-regexp-in-string "\\\\" "/" (replace-regexp-in-string "\n" "" (shell-command-to-string "python -m certifi"))))) (setq tls-program (list (format &

php - Ajax request always fails -

i'm trying send variables of username , password php file js file, ajax request fails (prints fail), no idea why. js file: <script> var imported = document.createelement('script'); imported.src = 'http://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js'; document.queryselector('head').appendchild(imported); function collect() { var user = "joe"; var pass = "123"; $.ajax({ type:'post', url: 'myphp.php', data: {'username': user, 'password': pass}, success: function(){ alert("success!"); }, error: function(){ alert("fail"); } }); } </script> php file: <?php $myval = $_post['username']; echo($myval); ?> <script> var imported = document.createelement('script

laravel - selected value tag of Form::model doesn't bind property from Model -

i'm learning laravel , have issue when trying bind property of model selected values of select tag. tried leave 3rd parameter null because believe form model binding automatically take care of doesn't work. here tried: {{$article->tag_list}} // show [1,3] //it doesn't work {!! form::select('tag_list[]', $tags, null , ['class' => 'form-control', 'multiple'] ) !!} ------------- //it doesn't work {!! form::select('tag_list[]', $tags, $article->tag_list , ['class' => 'form-control', 'multiple'] ) !!} ----------- //it works {!! form::select('tag_list[]', $tags, [1,3] , ['class' => 'form-control', 'multiple'] ) !!} in model have gettaglistattribute() works fine. public function gettaglistattribute(){ return $this->tags->lists('id'); } with text input, form works fine. btw, i'm using 5.2.1 versi

c# - JQuery Validation message shows on page load -

i have following view: @model grcwebapp.viewmodels.newclubinterestsviewmodel @{ viewbag.title = "add club interests"; } <div class="col-md-10 col-offset-md-1"> <h2 class ="text-success">add club interests @html.displayfor(model => model.name)</h2> </div> @using (html.beginform("newinterests", "club", formmethod.post)) { @html.antiforgerytoken() <div class="form-horizontal"> <hr /> <div class="row"> <div class="col-md-8"> <div class="well bs-component"> @html.validationsummary(true, "", new { @class = "text-danger" }) @html.hiddenfor(x => model.clubid) <div class="form-group"> <div class="col-md-10 col-md-offset-1"> <h3>tick areas club interested/runs ev

github - Git fetch remote pulls in new branches but new branch doesn't show up -

i ran these commands, new branch fetched github doesn't show when run git branch after running git fetch origin : cacsvml-13295:smartconnect amills001c$ git fetch origin remote: counting objects: 426, done. remote: compressing objects: 100% (223/223), done. remote: total 426 (delta 269), reused 287 (delta 188) receiving objects: 100% (426/426), 113.77 kib | 76.00 kib/s, done. resolving deltas: 100% (269/269), done. github.csv.comcast.com:baymax/smartconnect * [new branch] enrichmentasync-module -> origin/enrichmentasync-module * [new branch] github_master_now -> origin/github_master_now * [new branch] master_next_localmermorycache -> origin/master_next_localmermorycache * [new tag] 0.0.4 -> 0.0.4 * [new tag] 0.0.5 -> 0.0.5 cacsvml-13295:smartconnect amills001c$ git branch github_master_now master * master_next master_with_quick_fix_for_prod mocha_deep_test priya_testing_branch is there reason why new br

android - activity main MAIN and LAUNCHER is not fired first -

i have launcher activity followed loginactivity. everytime start app loginactivity fired first rather launcheractivity. xml manifest.xml like <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.kryptapps.konel.dchat2" > <application android:allowbackup="true" android:icon="@mipmap/ic_launcher" android:label="@string/app_name" android:theme="@style/customtheme" > <activity android:name=".launcheractivity" android:label="@string/app_name" > <intent-filter> <action android:name="android.intent.action.main" /> <category android:name="android.intent.category.launcher" /> </intent-filter> </activity> <activity android:name=".loginactivity"

How to restart a single container with docker-compose -

i have docker-compose.yml file contains 4 containers: redis, postgres, api, worker during development of worker, need restart in order apply changes. there way restart container (e.g. worker ) without restarting other containers? it simple: use command: docker-compose restart worker you can set time wait stop before killing container (in seconds) docker-compose restart -t 30 worker thats !

javascript - Automatically change dynamically pulled currency with a script -

i have resellers program currencies pound, dollar, japanese yen , euro. i can set own prices display currency on users page baht. the products , prices pulled dynamically on ruby on rails , have access code cant change currency baht. my question is possible use script when page load replaces current values desired currency. i.e if had value @ $1.00 script replace $ ฿ , times 1.00 33 user see ฿33 instead of $1.00. here example of code allowed edit: <script type='text/javascript'> // <[cdata[ // populate hashes in js context: var dual_core = new array(); <% dual_core.each |dc| %> dual_core["<%= dc.specific_type %>-<%= dc.base_renewal_period %>"] = new array(); dual_core["<%= dc.specific_type %>-<%= dc.base_renewal_period %>"]["specific_type"] = "<%= dc.specific_type %>"; dual_core["<%= dc.specific_type %>-<%= dc.base_renewal_period %>"]["base_renewal_per

python - Gaussian distribution with mean and sigma in C++11 -

i trying gaussian distribution mean , sigma in c++11. have been successful @ converting python c++ have doubt way initializing random generator. need call random_device() , mt19937() inside call distribution or can call them once statically , re-use time? cost of leaving code is? # python # random.gauss(mu, sigma) # gaussian distribution. mu mean, , sigma standard deviation. import random result = random.gauss(mu, sigma) // c++11 #include <random> std::random_device rd; std::mt19937 e2(rd()); float res = std::normal_distribution<float>(m, s)(e2); there 2 parts of algorithm: uniform random number generator, and convert uniform random number random number according gaussian distribution. in case, e2 uniform random number generator given seed rd , std::normal_distribution<float>(m, s) generates object 2nd part of algorithm. the best way is: // call first time (initialization) std::random_device rd; std::mt19937 e2(rd()); std::normal_di

Spring / Jersey / Grizzly causing silent test failure in maven command-line, but succeeds in Eclipse? -

we have junit / jersey integration test failing "connection refused" when run command-line via maven. however, when run eclipse test passes. seems there error grizzly container not starting, cannot find error messages or log, fails silently. occurring while upgrading java 7 centos 6 environment java 8 centos 7 environment. below simple test reproduces error: public class crobichagrizzlyintegrationtest extends jerseytest { private webresource webresource; private static final string package_name = "xxx"; byte[] bytes; byte[] expectedresponses; public crobichagrizzlyintegrationtest() { super( new webappdescriptor.builder(package_name) .clientconfig( new defaultclientconfig()).servletpath("/") .contextparam("contextconfiglocation", "classpath:app-config.xml") .servletclass(springservlet.