Posts

Showing posts from June, 2013

html5 - Customize JQuery Mobile ListView with Box Shadow and Border -

html5 - Customize JQuery Mobile ListView with Box Shadow and Border - i trying apply box shadow , border images in jquery mobile listview. want result attachment below. have not been able apply straight img attribute. here css using box shadow. .effect2 { position: relative; } .effect2:before, .effect2:after { z-index: -1; position: absolute; content: ""; bottom: 15px; left: 10px; width: 50%; top: 80%; max-width:300px; background: #777; -webkit-box-shadow: 0 15px 10px #777; -moz-box-shadow: 0 15px 10px #777; box-shadow: 0 15px 10px #777; -webkit-transform: rotate(-3deg); -moz-transform: rotate(-3deg); -o-transform: rotate(-3deg); -ms-transform: rotate(-3deg); transform: rotate(-3deg); } .effect2:after { -webkit-transform: rotate(3deg); -moz-transform: rotate(3deg); -o-transform: rotate(3deg); -ms-transform: rotate(3deg); transform: rotate(3deg); right: 10px; left: auto; } html <ul data

c# - App.config needs dynamic value -

c# - App.config needs dynamic value - my app config has line of code. <add baseaddress = "http://localhost:8733/design_time_addresses/wcfservicelibrary1/service1/" /> however require having localhost equivalent of system.net.dns.gethostname() . ideas on how can done? i can suggest utilize string.format : <add baseaddressformat = "http://{0}:8733/design_time_addresses/wcfservicelibrary1/service1/" /> and in code: var baseaddress = string.format(configurationmanager.appsettings["baseaddressformat "], system.net.dns.gethostname()); or can hide string.format phone call behind global app configuration class property. like: public class myconfig { public string baseaddress { { homecoming string.format(configurationmanager.appsettings["baseaddressformat "], system.net.dns.gethostname()); } } } c# .net wcf

ruby on rails - Rendering Mailers view in a controller view -

ruby on rails - Rendering Mailers view in a controller view - i want preview mailer view (newsletter) before beingness sent i have newsletter_mailer.rb , newsletter mailer method, has corresponding newsletter.html.erb view i know rails 4.1 has mailer preview, on development. is there way utilize use view template without using partials? (since need inject in iframe since email doctype, body, etc) ruby-on-rails actionmailer preview

cordova - App extension on iOS8 limits -

cordova - App extension on iOS8 limits - recently, i've been making simple research ios 8 share extension understand how scheme works , find out restrictions of features. realize nowadays documentation https://developer.apple.com/library/ios/documentation/general/conceptual/extensibilitypg/index.html preliminary document. i've got few questions general limits / possibilities of ios8 app extansions: is apple specifies size limit shared data? can 100% sure app can launch specified app extension? will phonegap back upwards app extensions? for sec question can't 100% sure app can launch on specified app extension totally controlled user can command on documents want show app extension follow declaring supported info types share or action extension to create customize document type write predicates under key nsextensionactivationrule example:for pdf,image , excel documents made next predicates maximum amount of document 1. <key>nsextensio

c# - Isolate class to be instantiated only by a specific class: best practices -

c# - Isolate class to be instantiated only by a specific class: best practices - ok, working 2 layers of class: somekind of "manager" class task take object, link items attached it, , homecoming caller, , "data" class task phone call database on specific request. here's illustration of how work. here's "manager" class: public class cardmanager { private static readonly carddata mcarddal = new carddata(); public list<carddisplay> listcardstoshow(int _pagenumber, string _querystring, string _rarity, string _type, string _color, out int _totalcount) { list<carddisplay> listtoreturn = mcarddal.listcardstoshow(_pagenumber, _querystring, _rarity, _type, _color, out _totalcount); linklistcarddisplaydata(listtoreturn); homecoming listtoreturn; } /// <summary> /// method links card set each cards of list. /// </summary> /// <param name="_listtoreturn&q

haskell - What is the general case of QuickCheck's promote function? -

haskell - What is the general case of QuickCheck's promote function? - what general term functor construction resembling quickcheck's promote function, i.e., function of form: promote :: (a -> f b) -> f (a -> b) (this inverse of flip $ fmap (flip ($)) :: f (a -> b) -> (a -> f b) ). there functors such operation, other (->) r , id ? (i'm sure there must be). googling 'quickcheck promote' turned quickcheck documentation, doesn't give promote in more general context afaics; searching 'quickcheck promote' produces no results. (<*>) :: applicative f => f (a -> b) -> f -> f b (=<<) :: monad m => (a -> m b) -> m -> m b given monad more powerful interface applicative, tell a -> f b can more things f (a -> b) . tells function of type (a -> f b) -> f (a -> b) can't injective. domain bigger codomain, in handwavey manner. means there's no way can perchance

java - Debugging parse error -

java - Debugging parse error - i getting parse error @ line 1 column 29. if (xpath:{path file location}.equals("xname")) { workflow.setvariable("variable); workflow.setvariable("variable); ([column1] ,[column2] ,[column2]) values (xpath:{} ,'xpath:{}' ,'xpath:{}' ) ); } what need prepare this? if had guess, i'd it's due misspelled "locaiton" in path. java xml xpath workflow

java - Multiple event listener and adapter -

java - Multiple event listener and adapter - i creating custom event listener tree. have created listener interface here public interface treeactionlistener extends eventlistener { public void onaddnode(treeeventobject eventobject); public void onremovenode(treeeventobject eventobject); public void onrenamenode(treeeventobject eventobject); public void oncreatenode(treeeventobject eventobject); } also i've created custom event object named treeeventobject here code public class treeeventobject extends eventobject { private object datatopass =null; /** * constructs prototypical event. * * @param source object on event occurred. * @throws illegalargumentexception if source null. */ public treeeventobject(object source, object datatopass) { super(source); this.datatopass = datatopass; } public object getpasseddata() { homecoming this.datatopass; } } and mentioned in jdk pattern

ruby on rails - presence validation causes "undefined method `map' for nil:NilClass" error -

ruby on rails - presence validation causes "undefined method `map' for nil:NilClass" error - i want people define course of study name before writing spotlight. did adding next code spotlight model class spotlight < activerecord::base validates :name, presence: true end before adding validation write spotlights without name. if seek next error message: undefined method `map' nil:nilclass extracted source (around line #29): </div> <div class="field"> <%= f.label :name, "opleiding" %><br> <%= f.collection_select(:name, @colli, :name, :name, {prompt: 'selecteer een opleiding'}, {id: 'collis_select'}) %> </div> <div class="field"> <%= f.label :teaser %><br> what going on here? collection select base of operations ajax phone call fill other fields. view <%= form_for(@spotlight) |f| %> <%

javascript - cancel button to close fancybox 2.x -

javascript - cancel button to close fancybox 2.x - i've created confirmation windows form using fancybox 2.x. working, form submits , load fancybox windows proper confirmation information. @ bottom of confirmation page have submit button , cancel button. i'm using code load fancybox window when submit button clicked. $("#contact-form").live('submit', function(e) { $.ajax({ type: "post", cache: false, url: "/form_datas/confirm/", data: $("#contact-form").serialize(), datatype: 'text', success: function(data) { $.fancybox(data, { width:600, closebtn: false, openeffect: 'none', closeeffect: 'none', oncancel: fancyclose(), onclose

sql - How to store variables for the next time a program runs -

sql - How to store variables for the next time a program runs - i have programme reports how many times client has visited between our of day. in case, programme runs each day, find out how many customers came in between hours of 6 , 7. problem i'm running need maintain running tally of number of customers visted between hours. need output like: today: 5 total: 5 today: 5 total: 10 today 5 total 15 i can store info in xml file, have 16 different locations i'm tracking that's lot of writing, , reading xml file, assume there improve way handle this? need programme load value of "total" today, plus previous days. i fill values this: firsthour = ds.tables(0).rows(i).item(x) secondhour = ds2.tables(0).rows(i).item(x) percentage = math.round(ds2.tables(0).rows(i).item(x) / ds.tables(0).rows(i).item(x) * 100, 2) firsthourtotal = ds.tables(0).rows(i).item(x) secondhourtotal = ds2.tables(0).rows(i).item(x) obviously, need fi

c++ - Why use new and delete at all? -

c++ - Why use new and delete at all? - i'm new c++ , i'm wondering why should bother using new , delete? can cause problems (memory leaks) , don't why shouldn't initialize variable without new operator. can explain me? it's hard google specific question. for historical , efficiency reasons, c++ (and c) memory management explicit , manual. sometimes, might allocate on call stack (e.g. using vlas or alloca(3)). however, not possible, because stack size limited (depending on platform, few kilobytes or few megabytes). memory need not fifo or lifo. happen need allocate memory, freed (or becomes useless) much later during execution, in particular because might result of function (and caller - or caller - release memory). you should read garbage collection , dynamic memory allocation. in languages (java, ocaml, haskell, lisp, ....) or systems, gc provided, , in charge of releasing memory of useless (more exactly unreachable) data. read weak references.

raspberry pi - shell script that takes a string input by the user and outputs the number of characters in it? -

raspberry pi - shell script that takes a string input by the user and outputs the number of characters in it? - please can show me shell script takes string input user , outputs number of characters in it? have tried numerous times can't right. use wc function that: echo -n abc | wc -c or echo -n abc | wc -m the -n supresses final newline count character. check manual wc. shell raspberry-pi

Mamp mysql server does not start on Yosemite ios8 -

Mamp mysql server does not start on Yosemite ios8 - this follow of issue: problems apache mamp 3 , yosemite i have followed recommendation (upgrading mamp latest version) mysql server still not start: using default ports 8888 , 8889. when setting different port (e.g., 80) both servers not run...xamp works fine instead. i had same problem running mamp, found updating envvars_ file under mamp/library/bin _envvars , changing apache port 8888 , mysql port 3306 got working me. i hope helps! mamp osx-yosemite

javascript - isolating specific values in external .js array -

javascript - isolating specific values in external .js array - i'm trying populate selection list external javascript array. works i'm trying populate values using id column, failing. i'm using check-boxes , 'if' statement see box checked, , populate appropriate array values based on selection. i'm using 'if' within loop match id value in array, , add together matching values selection. however, seems disregarding status , reading entire array in selection list. obvious error code novice. function populateislandlist () { var form = document.forms["island_form"]; var islands = form.islands; if (islands[0].checked){alert("works"); (i = 0; < pislands.length; i++) if (pislands[i][1] = 1){ document.forms["location"].islands.options[i] = new option(pislands[i][0], i)}}; if (islands[1].checked){alert("works"); (i =

html - how to replace data("id") in jquery -

html - how to replace data("id") in jquery - i had nestable want alter data-id="12" to may max data-id equals 17 and want alter data-id value data-id="39" here code: class="snippet-code-html lang-html prettyprint-override"> <!--before--> <div class="dd" id="nestable"> <ol class="dd-list" id="depth1_ol"> <li data-id="12"><div class="dd-item">item 12</div></li> </ol> </div> <!--after--> <div class="dd" id="nestable"> <ol class="dd-list" id="depth1_ol"> <li data-id="39"><div class="dd-item">item 39....</div></li> </ol> </div> how can this?? your question bit unclear i'm assuming need alter data-id attribute. well, alter value using jquery can using data met

dynamic - C - Malloc char array access violation error -

dynamic - C - Malloc char array access violation error - i'm not sure why malloc allocating much space. here's snippet of problem code: char * hamming_string = null; void enter_params(){ printf("enter max length: "); scanf_s("%d", &max_length); hamming_string = (char *) malloc(max_length * sizeof(char)); // test what's going on hamming string for(int = 0; < strlen(hamming_string); i++){ hamming_string[i] = 'a'; } printf("hamming string = %s", hamming_string); } i set max_length 2 , i'm seeing 12 a's. in function, going have user input hamming string using scanf_s("%s", &hamming_string); kept getting access violation void check_code(){ int actual_length, parity_bit, error_bit = 0, c = 0, i, j, k; printf("enter hamming code: "); scanf_s("%s", &hamming_string); // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ this scanf_s() phon

jquery - How to reorder dom elements -

jquery - How to reorder dom elements - i wondering how order jquery array object dom elements asc ? reorder dom class name "ticketvalue" whoes values 1000, 500 , 200 etc. dom elements below. class="snippet-code-html lang-html prettyprint-override"> <a class="draw-ticket-wrap"> <span style="display: none;" class="ticketvalue">1000</span> <span style="display: none;" class="ticketid">7</span> <span style="display: none;" class="tickettotalnumberoftickets">125</span> <span style="display: none;" class="tickettitle">$1,000 order</span>

objective c - How to align components to grid? -

objective c - How to align components to grid? - i'm working on application users can set own controls on view. i'm working on details want controls aligned sort of grid. how can draw grid? how can create sure controls aligned automatically grid (to closest corner?) thanks in advance! anyone can help? for still interested in answer: i first drew horizontal , vertical line: -(void)drawgrid { for(int y=self.gridsize;y<self.templateeditview.frame.size.height;y+=self.gridsize){ uiview *hline = [[uiview alloc] init]; [hline setbackgroundcolor:[[uicolor blackcolor] colorwithalphacomponent:0.1f]]; hline.frame = cgrectmake(0, y, self.templateeditview.frame.size.width, 1); [self.templateeditview addsubview:hline]; } for(int x=self.gridsize;x<self.templateeditview.frame.size.width;x+=self.gridsize){ uiview *vline = [[uiview alloc] init]; [vline setbackgroundcolor:[[uicolor blackcolor] colorwithalphacomponent:0.1f]]; vline.

python - Is it ok to suggest the user home directory as default installation folder? -

python - Is it ok to suggest the user home directory as default installation folder? - i making installer py2exe packaged app. py2exe catches strerr , set in log file created in same folder executable. so, installing app "program files" cause problem because app not have right create file in there. i not want edit manifest inquire uac app either. so, thinking configure installer utilize user home directory default installation folder. but user home meant documents , photos , such. (edit) want maintain executable, because want users locate log file , send me debugging. so, bad practice? improve way around? py2exe catches strerr , set in log file created in same folder executable you can override py2exe's default behavior , place log file in specific folder. see py2exe error logging details. suggest placing log files in appdata/local folder. what appdata folder? the appdata folder contains app settings, files, , info specific

ios - Unicode character(s) that look like iOS7 left-pointing navigation chevron -

ios - Unicode character(s) that look like iOS7 left-pointing navigation chevron - what unicode characters closely approximate size (as big or larger capital letter) , shape of ios7+ backwards-pointing navigation bar chevron? i'm looking hacky way utilize unicode characters simulate "navigate back" chevron view doesn't have "go back" navigation. a regular < (less-than sign) not because it's not tall plenty , not vertically centered. ‹ (european left quote) more vertically centered it's not tall enough. ᐸ (u+1438) best i've found far because it's tall capital letter, angle 52° while ios arrow 90°, looks different , takes lot of horizontal real estate. are there other improve options full-height chevrons have less acute angle ᐸ (u+1438) ? it doesn't have perfect, close plenty purchase time until our team can implement custom view using real images. try these: left pointing angle bracket u+2329 〈 home vert

static members - Class constant not accepted by php 5.4 -

static members - Class constant not accepted by php 5.4 - i have class constant const date_regex = '@^(19|20)\d\d[- /.](0[1-9]|1[012])[- /.](0[1-9]|[12][0-9]|3[01])$@'; which want utilize in static array part of string: public static $rules = [ 'startdate' => ['required','regex:' . self::date_regex], ]; both of lines part of same class. on dev machine (php 5.6) works fine, on staging server (php 5.4) throws next error: syntax error, unexpected '.', expecting ']' how can rewrite php 5.4 compatible? php 5,4 not allow expressions in class properties declaration. such feature has been introduced php 5.6 http://php.net/migration56.new-features#migration56.new-features.const-scalar-exprs php static-members class-constants

Batch script to copy all files but those in a list -

Batch script to copy all files but those in a list - i looking write script re-create files contained in list. new @ found opposite of want... @echo off set src_folder=c:\source\ set dst_folder=c:\destination /f "tokens=*" %%i in (list.txt) xcopy /s/e/u "%src_folder%\%%i" "%dst_folder%" i backing folder total of files need skip few unimportant me. i thought work. must have made error... @echo off set src_folder=c:\source\ set dst_folder=c:\destination\ xcopy /s/e/u "%src_folder%\%%i" "%dst_folder%" /exclude /f "tokens=*" %%i in (c:\list.txt) try xcopy .... /exclude:list.txt see xcopy /? from prompt documentation batch-file

ios - Xcode: Autolayout not working correctly -

ios - Xcode: Autolayout not working correctly - i've got weird bug in application. when load app on simulator or idevice , go pagecontrol page layout doing weird things. i utilize pagecontrol pages calendar view, if load see this that's good, when scroll downwards (or up) layout changes bit if scrolling done , i'm on next page layout readjust , in it's state so don't know has gone wrong of knows grateful! i'm using auto-layout in page , on every simulator size same problem. if using auto-layout position vertical line, suggest base of operations it's position off of left side of cell rather right side of label left of cell. ios xcode swift autolayout pagecontrol

scala - How to use sequence from scalaz to transform T[G[A]] to G[T[A]] -

scala - How to use sequence from scalaz to transform T[G[A]] to G[T[A]] - i have code transform list[future[int]] future[list[int]] using scalaz sequence. import scalaz.concurrent.future val t = list(future.now(1), future.now(2), future.now(3)) //list[future[int]] val r = t.sequence //future[list[int]] because using future scalaz, may have implicit resolution magic me, wonder if type class custom class not predefined 1 future, how can define implicit resolution accomplish same result case class foo(x: int) val t = list(foo(1), foo(2), foo(3)) //list[foo[int]] val r = t.sequence //foo[list[int]] many in advance you need create applicative[foo] (or monad[foo] ) in implicit scope. what asking won't work, since foo not universally quantified (so expected type r doesn't create sense foo[list[int]] , since foo doesn't take type parameter. lets define foo differently: case class foo[a](a: a) object foo { implicit val fooapplicative = new

windows - boot2docker bash command line is very slow -

windows - boot2docker bash command line is very slow - followed few tutorials online regarding installing boot2docker iso release v1.3.0 on windows 7 enterprise machine. same steps work fine on mac!!! we've number of custom docker files want link , manage our development environment. however, when run boot2docker desktop can take either 3 seconds or min load, when command line can lag 20-30 seconds behind user typing. i've tried reinstalling, cleaning path, increased memory, played different boot2docker init settings i'm unable resolve issue command line lag! has experienced issue? thanks. j havent managed find solution. removed dot files, fresh install...same problem. however, there 1 time started there no lag on command line. work around utilize ssh using default user/pass, @ to the lowest degree can progress with. thanks help. j windows bash docker boot2docker

jquery - how to make droppable recognise when the draggable leaves? -

jquery - how to make droppable recognise when the draggable leaves? - i seek create drag , drop game need order draggables. may alter position of 1 time dropped draggable. so need 1. droppable recognise when draggable dropped on , disabled 2. droppable recognise when dropped draggable has left , droppable again. i have far first part. sec can't manage... $(".boxsentence").each( function(){ $(this).droppable({ activeclass: "highlight", drop: $(this).addclass("noborder occupied"); $(this).droppable("disable"); numoccupied++; } }); i have tried "out", works other way. if has ideas, appreciate it. i don't know if nice method.... think, found way. i made other object droppable (obj2) , when drop draggable it's previous location (obj1) onto it, triggers activation of obj2 $(".obj2").droppable({ drop: function(event,ui){ $(".obj1").droppable("enable"); numoccupied

sorting - Sort a list of tuples by their second element and absolute value -

sorting - Sort a list of tuples by their second element and absolute value - how sort list [("apple",3),("apple",-2),("pear",1)] by sec element in tuple, , absolute value, [("pear",1),("apple",-2),("apple",3)] here's paraphrased approach: import data.list import ghc.exts sortwith (abs . snd) [("apple",3),("apple",-2),("pear",1)] you can apply problem requiring sort container transformed keys. in case abs . snd function used transforming ("foo", -5) 5 , sorted new keys. sorting haskell tuples

match groups of words and digits regex in any order -

match groups of words and digits regex in any order - suppose have next string: "7 apples , 13 oranges" /(\d+).*?(apples)/i the above regex match 7 apples if alternate order , numbers "45 oranges , 9 apples".it match first digit 45 rather digit corresponding apples, want. how can write regex match , homecoming match groups of digits + apples if write sentence in next 2 orders: "7 apples , 13 oranges" "13 oranges 52 apples" ie, i'd match 7 apples, match groups of 7 , apples , 52 apples match groups 52 , apples. where got wrong in /(\d+).*?(apples)/i ? .*? though lazy matching matches digit next apple which means string "13 oranges 52 apples" it matches 13 till apple @ end of string, since . matches anything see link illustration : http://regex101.com/r/ul5ex0/2 how correct? since symbol seperating digit , apple space, can utilize \s character instead of . as (\d+)\s(apples)

java - Android - only calling a method every 15 minutes max, and using saved data otherwise -

java - Android - only calling a method every 15 minutes max, and using saved data otherwise - i'm writing app method accessing info online. however, maximally allowed query website @ 1 time every 15 minutes. if 15 minutes has not elapsed, want utilize info recent query. best practices checking lastly time method called? just utilize cache 20 min expiration , should go. prefer existing 1 implementing own, 1 field it's trivial - time when retrieve resource , add together 20 minutes. if current time after can again, date cachedat = null; string cachedcontent = null; string getcachedthing() { if (cachedcontent != null && cachedat != null && new date().before(cachedat)) { homecoming cachedcontent; } getthing(); homecoming cachedcontent; } private void getthing() { // resource. calendar cal = calendar.getinstance(); cal.add(calendar.minute, 20); cachedat = cal.gettime(); cachedconte

html - Break JavaScript When run document.forms[0].submit(); -

html - Break JavaScript When run document.forms[0].submit(); - onchange="document.forms[0].action = 'policytypeselection.do?method=policytypeselection'; document.forms[0].submit(); optioncheck(this);"> optioncheck(this); java script : function optioncheck(frm) { var i, len, optionval, helpdiv, btnstatus, selectoptions = document.getelementbyid("options").submit(); // loop through options in case there // multiple selected values (i = 0, len = selectoptions.options.length; < len; i++) { // selected alternative id optionval = selectoptions.options[i].id; // find corresponding help div helpdiv = document.getelementbyid("help"); statussecond = document.getelementbyid("second"); statusfirst = document.getelementbyid("first"); // move on if didn't find 1 if (!helpdiv) { continue; } // set css classes show/hide help

javascript - charts.js update global variables -

javascript - charts.js update global variables - having issues getting below work. im not sure if eve possible read few posts regarding re-creating graph in charts.js unsure if thats whats needed here. simple illustration pass values function donutdata variable. <!doctype html> <html> <head> <title>doughnut chart</title> <script src="../chart.js"></script> <style> body{ padding: 0; margin: 0; } #canvas-holder{ width:30%; } </style> </head> <body> <div id="canvas-holder"> <canvas id="chart-area" width="500" height="500"/> </div> <div id="demo">dd</div> <button onclick="myfunction(20,30,50)">click me</button> <script> var doughnutdata = {}; function myfunction(a,b,c) {

c++ - StartServiceCtrlDispatcher don't can access 1063 error -

c++ - StartServiceCtrlDispatcher don't can access 1063 error - i write on c++ service , have error, , don't can fixed it. my service main function int main (int argc, tchar *argv[]) {dword f; for(int i=0;i<113;i++) f = getlasterror(); servicepath = lptstr(argv[0]); outputdebugstring(_t("my sample service: main: entry")); //installservice(); service_table_entry servicetable[] = { {service_name, (lpservice_main_function) servicemain}, {null, null} }; // startservice(); if(!startservicectrldispatcher(servicetable)) { f = getlasterror(); //addlogmessage("error: startservicectrldispatcher"); } else if( memcmp(argv[argc-1],"install",7)) { installservice(); } else if( memcmp(argv[argc-1],"remove",6)) { removeservice(); } else if( memcmp(argv[argc-1],"start",5)) { startservice(); } else if( memcmp(argv[argc-1],"stop",4))

javascript - Weird behaviour of Fisheye Distortion plugin -

javascript - Weird behaviour of Fisheye Distortion plugin - hi utilize fisheye distortion plugin force-directed graph in d3.js, when want apply plugin, behaviour of graph weird. new in d3.js , not @ computer graphics. complete sample in jsfiddle var fisheye = d3.fisheye.circular() .radius(200) .distortion(2); // graph - variable represents whole graph graph.svg.on("mousemove", function() { fisheye.focus(d3.mouse(this)); d3.select("svg").selectall("circle").each(function(d) { d.fisheye = fisheye(d); }) .attr("cx", function(d) { homecoming d.fisheye.x; }) .attr("cy", function(d) { homecoming d.fisheye.y; }) .attr("r", function(d) { homecoming d.fisheye.z * 4.5; }); d3.select("svg").selectall("line").attr("

exponential function with large argument in matlab -

exponential function with large argument in matlab - this question has reply here: how compute exponent in matlab without getting inf? 3 answers i've got 1 problem longer time , i'd grateful if help me somehow... i have code in matlab (version r2012a) compute exponential functions using matlab's fuction exp . means have this: y = exp(x); however, when "x" larger number, result ("y") infinity; when "x" smaller number, result 0. said on mathworks' website: numerical exceptions may happen, when absolute value of real part of floating-point argument x large. if ℜ(x) < -7.4*10^8, exp(x) may homecoming truncated result 0.0 (protection against underflow). if ℜ(x) > 7.4*10^8, exp(x) may homecoming floating-point equivalent rd_inf of infinity. my problem quite obvious - "x" pretty big receiv

RabbitMQ in Docker - user creation not persisted -

RabbitMQ in Docker - user creation not persisted - i've got problem user user1 not persisted in container have created using next dockerfile. reason this? rabbitmq specific issue? e.g. have explicitly specify user must persisted from dockerfile/rabbitmq # define mount points. volume ["/data/log", "/data/mnesia"] # define working directory. workdir /data run (rabbitmq-start &) && \ sleep 10 && \ rabbitmqctl add_user user1 password1 && \ rabbitmqctl set_user_tags user1 administrator && \ rabbitmqctl set_permissions -p / user1 ".*" ".*" ".*" && \ sleep 10 && \ rabbitmqctl stop && \ sleep 10 # define default command. cmd ["rabbitmq-start"] # expose ports. expose 5672 expose 15672 i know it's old question, struggled hours problem today , solved me: issue seems due default hostname changing @ every new container docker, , rabbit

mongodb - Mongo aggregate query pulling out last 7 days worth of data (node.js) -

mongodb - Mongo aggregate query pulling out last 7 days worth of data (node.js) - i have big collection of info i'm trying pull out of mongo (node js) in order render graphs. i need pull lastly 7 days worth of info out of few one thousand users. specific piece of info on each user formatted so: { "passedmodules" : [{ "module" : objectid("53ea17dcac1d13a66fb6d14e"), "date" : isodate("2014-09-17t00:00:00.000z") }, { "module" : objectid("53ec5c91af2792f1112554e8"), "date" : isodate("2014-09-17t00:00:00.000z") }, { "module" : objectid("53ec5c5baf2792f1112554e6"), "date" : isodate("2014-09-17t00:00:00.000z") }] } at moment have messy grouping of queries working, believe possible exclusively mongo? basically, need pull out entries 7 days ago until now, in d

linux - ELB, Proxy Protocol and iptables -

linux - ELB, Proxy Protocol and iptables - i have setup server front-ended aws elb. filter traffic based on source ip address using iptables possibly. have enabled proxy protocol on elb. possible utilize iptables in conjunction proxy protocol? cheezo. i'm not sure if possible, guess using aws security grouping easier solution. also, aws web application firewall might give hand. take @ https://aws.amazon.com/waf/ , see if helps. cheers, linux amazon-web-services iptables

r - How can I pass NA when attempt to select fails with "attempted to select less than one element"? -

r - How can I pass NA when attempt to select fails with "attempted to select less than one element"? - i have 2 info frames, , b, both have "state" , "year" columns (as others). i'm trying transfer value varx b a. used this: for(i in seq_along(a)) {a$varx[[i]]<-b$varx[[which(b$state==a$state[[i]] & b$year==a$year[[i]])]]} i error: error in b$varx[[which(b$state == a$state[[i]] & b$year == : effort select less 1 element the problem seems there rows in a without corresponding row in b , can't select element. how can either homecoming na in cases (so a$varx[i]=na ), or clean cases there's no corresponding rows in b ? loop not choice. see working example: a=data.frame(state=c("a","b","a"),year=c("2012","2013","2014"),varx=c(1,2,3)) ################### state year varx 1 2012 1 2 b 2013 2 3 2014 3 ###################

intellij idea - SonarQube plugin with Android Studio -

intellij idea - SonarQube plugin with Android Studio - has succeeded in getting either sonarqube community intellij plugin or 'official' sonarqube intellij plugin show results of static code analysis in android studio projects? the sec of these requires maven first of these supposed agnostic. somehow managed run sonarrunner on project in past can't manage now. there's not much point in getting working 1 time again if can't see results in ide. short answer: yes can using sonarqube community intellij plugin long answer: assuming have build.gradle like: apply plugin: "sonar-runner" sonarrunner { sonarproperties { // can set on command line -dsonar.analysis.mode=incremental property "sonar.host.url", "http://your.sonar.server:9000" property "sonar.analysis.mode", "incremental" property 'sonar.sourceencoding', 'utf-8' property 'so

Show random string after shake in iOS via Swift -

Show random string after shake in iOS via Swift - i observe shake motion via codes: override func motionended(motion: uieventsubtype, withevent event: uievent) { if motion == .motionshake { self.shakelabel.text = "text" } } } ok, working. need, when action shake motion, random item in 3 strings. cannot find solution. prepare array of texts, , this: let texts = ["text1", "text2", "text3"] self.shakelabel.text = texts[int(arc4random_uniform(uint32(texts.count)))] after shake in 3 times, show random text var shakecount = 0 allow shaketexts = ["text1", "text2", "text3"] override func motionended(motion: uieventsubtype, withevent event: uievent) { if motion == .motionshake { shakecount++ if shakecount >= 3 { self.shakelabel.text = shaketexts[int(arc4random_uniform(uint32(shaketexts.count)))] } } } ios swift

javascript - How to apply ng class with a condtion statement -

javascript - How to apply ng class with a condtion statement - this question has reply here: angularjs ngclass conditional 7 answers i'm new angular js , wondering how create ng class apply based on set of conditions. illustration want have set of dates using ng repeat , alter colour of date if date greater current date. question how go this? ng-class="{'testclass': val == 10}" this add together class testclass element when val equals 10 javascript css angularjs angularjs-directive

Spring JDBC SqlRowSet retrieve with non-unique column label -

Spring JDBC SqlRowSet retrieve with non-unique column label - spring's sqlrowset has string getstring(string columnlabel) but if query joins 2 tables have same column name, result set have non-unique column labels. for example: select a.name, b.name bring together b on a.id=b.id and after running query , populating sqlrowset object, call. for example: sqlrowset.getstring("name") will homecoming me a.name, or b.name? trying specific, using: sqlrowset.getstring("a.name") will throw error if have non-unique names, either need assign unique labels using as clause, or need retrieve columns index instead. using as (note as - in database systems - optional): class="lang-sql prettyprint-override"> select a.name aname, b.name bname bring together b on a.id=b.id class="lang-java prettyprint-override"> sqlrowset.getstring("aname") by index. retrieve a.name : class="lang-j

php - Check for failed to open stream -

php - Check for failed to open stream - i have piece of code given below: if(strpos(strtolower($preview_url),"https://play.google.com/")!==false) { $dom = new domdocument; libxml_use_internal_errors(true); $dom->loadhtmlfile($preview_url); libxml_clear_errors(); $xp = new domxpath($dom); $image_src = $xp->query("//*[@class='cover-image']"); $cover_image_src = $image_src->item(0)->getattribute('src'); echo $cover_image_src."-- id --".$id."\n"; $update_offer_sql = "update aw_offers_v2 set name = '$name', description = '$description', payout_type = '$payout_type', payout = '$payout', expiration_date = '$expiration_time',

machine learning - CV error larger then test set prediction error -

machine learning - CV error larger then test set prediction error - i'm using scikit-learn's randomforestregressor build model 1 of data-sets, along gridsearchcv determine model hyperparameters. evaluate predictive capability of model splitting total data-set train , test sets 80/20 split. model selection using grid search performed on train set , best model used predict on test set. i'm consistently seeing cv r^2 score best grid searched model lower r^2 score when using model predict independent test data. persists across multiple random train/test splits. behavior seems pretty odd me, , i'm not sure if i'm doing wrong, if behavior normal, or if it's possible info quirky. the pertinent code below (i'm using pca on input features part of modeling pipeline). input info consists of 3 features (after pca), target info consists of 5 features, , data-set contains 100 samples. # split info train , test sets x_train, x_test, y_train, y_test = tr

jquery - Multiple vertical background colors in CSS3 -

jquery - Multiple vertical background colors in CSS3 - problem: trying create solution allow me have 5 multiple background colors fill out webpage regardless of width. have managed 5 div tags wonder if it's possible using css3? the outcome is: i have searched stackoverflow , web without results, or bad @ searching. you utilize linear-gradients accomplish this. example here html, body { height: 100%; } body { background-image: linear-gradient(90deg, #f6d6a8 20%, #f5ba55 20%, #f5ba55 40%, #f09741 40%, #f09741 60%, #327ab2 60%, #327ab2 80%, #3a94f6 80%); } just add together vendor prefixes additional browser support body { background: -moz-linear-gradient(90deg, #f6d6a8 20%, #f5ba55 20%, #f5ba55 40%, #f09741 40%, #f09741 60%, #327ab2 60%, #327ab2 80%, #3a94f6 80%); background: -webkit-linear-gradient(90deg, #f6d6a8 20%, #f5ba55 20%, #f5ba55 40%, #f09741 40%, #f09741 60%, #327ab2 60%, #327ab2 80%,

php - how to merge same value rows in mysql -

php - how to merge same value rows in mysql - i have table looks this: table:orders orderid productid quantity storeid orderdate 01 1 5 1 05-10-2014 02 2 2 4 05-10-2014 03 1 1 3 05-10-2014 04 3 1 3 05-10-2014 now want retrieve above table "orders" info looks : retrieve result productid quantity storeid orderdate (product merge) (sum) (count) (date*) 1 6 2 05-10-2014 2 2 1 05-10-2014 3 1 1 05-10-2014 as per above "retrieve result" want merge table "orders" info productid thanks in advance if understood correctly, need group by . grouping them productid , select sum of quantities select sum(quantity), count(storeid), ... orders grouping productid php mysql

javascript - Calculate difference between 2 dates considering Daylight Saving Time -

javascript - Calculate difference between 2 dates considering Daylight Saving Time - given start date, , number of days, need display end date = start date + number of days. so did this: var enddate=new date(startdate.gettime()+one_day); everything works fine, except 25 , 26 oct gives 1 day less. ex.: 2014-01-01 + 2 days = 2014-01-03 2014-10-25 + 2 days = 2014-10-26 (here case need treat). this difference appear because of clock going 1 hour. practically 2014-10-27 00:00:00 becomes 2014-10-26 23:00:00 . a simple solution compute @ hr (example 3 am). want display note when happens. for example, if user inputs 2014-10-25 , show popup saying [something]. now here real problem... can't seem find algorithm says when clocks goes in year x. example... in 2014 day 26 october. in 2016 30 oct (https://www.gov.uk/when-do-the-clocks-change). why? date looks random be, don't think is. so... when clock go back/forward? edit: answers/comments helpful relate

javascript - How to add eval value to onclick js function argument in asp datalist (Front-Side) -

javascript - How to add eval value to onclick js function argument in asp datalist (Front-Side) - i trying add together javascript function checkbox included in datalist take id of command parameter. i want on asp page not @ onitemdatabound method. tried 1 not working. ideas? <asp:checkbox id='chkdatabase' runat="server" cssclass="normalbold" text='<%# eval("name") %>' onclick='javascript:showme("<%# eval("id") %>")' ></asp:checkbox> part of datalist code: <asp:datalist runat="server" id="ddldatabases" cssclass="ddldatabases" cellspacing="0" cellpadding="0" repeatlayout="table" onitemdatabound="ddlcount_itemdatabound"> <itemtemplate> <div style=" float: left; width:150px;padding:20px; " > <asp:checkbox id='chkdatabase' runat="server &q

Titanium: Tabgroup navbar -

Titanium: Tabgroup navbar - how rid of (marked in pink): i dont see anywhere in code? code: titanium.ui.setbackgroundcolor('#000'); var tabgroup = titanium.ui.createtabgroup({top:0, tabsatbottom: true}) var win1 = titanium.ui.createwindow({ title:'tab 1', backgroundcolor:'#393a3a', navbarhidden: true }); var tab1 = titanium.ui.createtab({ icon:'images/ic_search.png', title:'tab 1', window:win1 }); var win2 = titanium.ui.createwindow({ title:'tab 2', backgroundcolor:'#393a3a', navbarhidden: true }); var tab2 = titanium.ui.createtab({ icon:'images/ic_news.png', title:'tab 2', window:win2 }); tabgroup.addtab(tab1); tabgroup.addtab(tab2); tabgroup.open(); you can alter value of tags or combination of tags <statusbar-hidden>true</statusbar-hidden> <fullscreen>true</fullscreen> <navbar-hidden>true</navb

mfc - How to call windows file already exist dialog when a file or directory already exists -

mfc - How to call windows file already exist dialog when a file or directory already exists - i working on college project. need phone call windows file exists dialog when tried create new directory or file. if file exists needs prompt windows file exist default dialog. thank you mfc

Excluding a Grails build scope dependency -

Excluding a Grails build scope dependency - using grails 2.4.3, how can exclude dependency that's defined in build scope? examplegrails bundled library spock-core-0.7-groovy-2.0.jar ; when adding standard global dependency exclusion: ... grails.project.dependency.resolution = { // inherit grails' default dependencies inherits('global') { excludes 'spock-core' } ... spock excluded dependency scopes except build scope. is issue don't want in .war file? if can remove so: grails.war.resources = { stagingdir -> delete(file:"${stagingdir}/web-inf/lib/spock-core-0.7-groovy-2.0.jar") } grails build dependencies

javascript - jQuery - load url value -

javascript - jQuery - load url value - i'm looking @ implementing country selector http://baymard.com/labs/country-selector one alter i'm stuggling create is: instead of showing alert pop-up 1 time submitted, i'd when forms value="[url]" load page when submitted. currently script: <script> (function($){ $(function(){ $('select').selecttoautocomplete(); $('form').submit(function(){ alert( $(this).serialize() ); homecoming false; }); }); })(jquery); </script> i've tried number of different solutions end losing typing fuctionality , reverting standard drop downwards links working. ideas on how both working? here's snippet of html: <form> <select style="padding:10px; width:200px;" name="country" id="country-selector" autofocus autocorrect="off" autocomplete="off"> <option value="http://manchest