Posts

Showing posts from June, 2011

php - Regex to check if a character occurs more than X times in a string -

what regex check if character occurs more 2 times in string? example: "aab" allowed, not "aaa" or "aaba". is there way make match on valid inputs (when there less 3 repeating characters) preg_match() function returns 1 valid input (with less 3 repeating characters) , else 0? thanks! this regex find character repeats 3 times (or more because have hit 3 more). (.)\1{2} regex demo: https://regex101.com/r/wmupww/1 php usage: foreach(array('aaa', 'aab') $string) { if(preg_match('/(.)\1{2}/', $string)) { echo $string . ' doesnt match :(' . "\n"; } else { echo $string . ' matches'. "\n"; } } php demo: https://eval.in/672382

Laravel 5.3 -- Trying to check a checkbox in a dynamic list -

i have collection on user object named prefs contains collection named auctions. when dump user, can confirm such prefs: { auctions: { a320: false, a330: true, a340: true, b737cl: true, b737ng: true, b747: true, b757: true, b767: true, b777: true, regional: true, expendables: true, miscellaneous: true } } i trying check checkboxes in list of categories dynamically created (an admin can add more needed) following: <input type="checkbox" id="{{$cat->cat}}" name="categories[]" value="{{$cat->id}}" {{($user->prefs->auctions->$cat->cat ? 'checked' : '')}}> i getting errorexception in 17b600b2cf36de6dc2af6eb299cce5a13d6e20e0.php line 33: undefined property: illuminate\support\collection::$auctions (view: /users/jgravois/documents/code/_work/uaminc.com/resources/views/member...

Oracle sql query returning all of the values instead limiting the values -

full disclosure part of homework question have tried 6 different versions , stuck. trying find 1 manager every time query runs. i.e put department id in , 1 name pops out. currently, names, multiple times. have tried nesting '=' not nesting, union, intersection, etc. can manager id basic query, can't name. current version looks this: select e.ename .emp e d.managerid in (select unique d.managerid works w, .dept d, emp e1 d.did=1 , e1.eid=w.eid , d.did=w.did ); i realize basic mistake not seeing - ideas? its not clear mean 1 menager time. should different menagers time or same? lest go throw query: you select empolyes table emp manager_id in next query dataset you managers dep=1 . rest of tables , conditions not influent on result dataset. i theing did primary key table dept , if query may rewritten select e.ename emp e d.managerid in (select unique d.managerid dept d d.di...

arduino - How do I send AVRDUDE serial commands? -

when run avrdude in verbose mode, see sequence of serial commands duplicate in program. problem when send 0x30, 0x20 3 times, don't 0x14, 0x10 expect. i'm assuming there must type of mode select toggles between program , programmer. how gain access this?

ember.js - Ember livereload not working when scss file updated in pod structure -

i have following structure: app/ pods/ components/ user-login/ component.js style.scss template.hbs template files , component files livereload correctly, however, when save changes style files in atom changes not applied on webpage- applied when kill , rerun: ember server and reload webpage. have installed following: ember-cli-styles-reloader and have tried adding: "livereload": true, "watcher": "polling" to: .ember-cli and tried adding these options to: ember-cli-build.js inside app variable. what missing? there better option believe, , recommend way: first install ember-cli-sass-pods addon uses ember-cli-sass (will install automatically) , generate style scss files pods directories. to install ember install ember-cli-sass-pods then add var app = new emberapp(defaults, { // must add watched folder ember-cli-build.js sassoptions: { includepaths: ['a...

java - Unsure if I should split my subclasses -

i have text file reads in information of various employees. i've created 2 array list based on years of employee object. employee has 2 subclasses, salesman , executive. i'm wondering how should split commas if there's 2 subclasses, since can't call super class here's employee class public class employee { private string name; private double monthlysalary; public employee(string line) { string[]split=line.split(","); name=split[0]; monthlysalary=double.parsedouble(split[1]); } public string getname() { return name; } public void setname(string name) { this.name = name; } public double getmonthlysalary() { return monthlysalary; } public void setmonthlysalary(double monthlysalary) { this.monthlysalary = monthlysalary; } public double annualsalary() { return monthlysalary*12; } public string tostring() { string str; str="name: "+name; str+="\nmonthly salary: "+monthlys...

Play audio when checkbox is checked with javascript -

i'm trying make short audio file play when html checkbox checked. i'm missing elementary. here code: <body> <input type="checkbox" id="cena" onchange="myfunction()"></input><label for="cena"></label> </label><script> function myfunction(){ var audio = new audio('rusbtaudio.mp3'); audio.play(); } </script> </body> rusbtaudio.mp3 in same folder html file. <input> element self-closing. use .load() , canplay event. substitute new audio() new audio() <body> <input type="checkbox" id="cena" onchange="myfunction(this)" /> <label for="cena"></label> <script> var audio = new audio('rusbtaudio.mp3'); audio.oncanplay = function() { if (document.getelementbyid("cena").checked) this.play() } function myfunction(el) { if (el.checked) { ...

ruby on rails - Unintended Schema changes every time I commit -

every time commit code has migration, reason, bunch of schema changes didn't write, came previous prs. for example, i'll write migration add column on user...but after running migration, schema file include 10 changes previous old code isn't in current branch @ all. how fix this? the schema file reflect database schema. think had changed schema @ previous old code didn't recover(rollback) it, deleted , start coding new migration. the thing shloud eliminating diff between code , datebase. solution: checkout old branch , rollback schema change running rake db:migrate:down version=20161106xxxxxx . or in current branch, run rake db:rollback step=n rollback schema change done current branch then checkout co old branch execute rake db:rollback step=m rollback schema change old branch. checkout current branch, , run rake db:migrate , , not see changes in schema file. reference: http://edgeguides.rubyonrails.org/active_record_migrations.htm...

c++ - In ubuntu mount virtual device programaticly for arduino SD card -

the idea simple. have arduino device communicate computer through serial port. arduino has connected sd card , annoying extract card every time need edit files in it. print out info functions serial.print(...) , recive computer serial.read(...) question howcan mount virtual device , set communication commands read , write on card without extracting every time? i'm not affraid learn , have experience in c/c++ language. tell me should start looking. thanks.

matlab - Sequential forward selection using many sets -

i trying perform methodology regression , not classification. know if can me so? i have x matrix 2000 variables , y follows: x = rand(100,2000); y = rand(100,1); what want split x 100 subsets perform sequential forward selection or similar , each set, select best features , report r values. does know how it?

drop down menu - Spotfire DropDown list to filter entire page? -

Image
i have been desperately trying figure out how take column, customer name, , able make drop down list filters entire pages visualizations when have specif customer selected filters everything. i think i'm going down right path creating property type string , setting unique values in customer name column, cant seem figure out next. if have set individually each visualization fine, cant seem work. can me figure out? i'm on spotfire 7.0 if matters. thanks thank in advance. @tplee - in order apply filter visualization selected drop down, have insert below case statement in 'limit data using expression' section of visualization properties shown below. right click on visualization , go properties. click on edit shown in picture , insert below case statement , click 'ok'. note: 'yourcolumnname' column name data table using , ${customername} property control name case when "${customername}"=[yourcolumnname] true when ...

html - Change background color of column based on header text with colspan -

i trying solve similar problem answered here: https://stackoverflow.com/a/9541558/1933036 . i style cells in table based on specific header. resolved in above link, works single headers. header has colspan of 2 or more cause code not work. have demonstrated in forked version of working solution heading spanning multiple columns: https://jsfiddle.net/icarnaghan/apj2ady4/1/ . same code follows. <table border="1"> <thead> <tr> <th>header 1</th> <th colspan="2">header 2</th> </tr> </thead> <tbody> <tr> <td>row 1, cell 1</td> <td>row 1, cell 2</td> <td>row 1, cell 3</td> </tr> <tr> <td>row 2, cell 1</td> <td>row 2, cell 2</td> <td>row 2, cell 3</td> </tr> </tbody> </table> var txt = 'header 2'; var column = $('table tr th').filter(f...

android - Expand/collapse two CardViews inside a LinearLayout BUT keep both CardViews inside the screen boundaries -

it's been quite many hours working on , can't come solution. i have linearlayout contains 2 cardviews. each cardview contains 2 relativelayouts. 1 relativelayout visible, has fixed height , clickable. second relativelayout can expanded/collapsed. xml structure goes this: <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical"> <android.support.v7.widget.cardview android:id="@+id/cardview_one" android:layout_width="match_parent" android:layout_height="0dp" android:layout_weight="1"> <linearlayout android:layout_width="match_parent" android:layout_height="match_parent" android:or...

angular - AngularFire .subscribe => console.log returning undefined after use of map or flatMap -

i'm pretty new angularfire, firebase, rxjs etc.. can tell me why following returns 'undefined' console.log? this.af.database.object('/teams/' + this.id) .map((data) => { data.teamname = teams[data.team]; }) .subscribe((data) => { console.log(data) }) teams enum. red = 1, blue = 2... i know problem lies in .map if remove , log x or log enum lookup both work fine.. this works fine (and resolves red): this.af.database.object('/teams/' + this.id) .subscribe((x) => { console.log(teams[x.team]); }) as (resolving firebase observable): this.af.database.object('/teams/' + this.id) .subscribe((x) => { console.log(x); }) i've tried flatmap on list rather map on object. any appreciated. because returns both get , map methods observable, not json. in .map((data) => { data...

javascript - Conditionally add attribute directive to the ng-repeat -

i know if possible add attribute directive elements inside of ng-repeat. have tried checking css class or id without luck. example code class itemnavigation { constructor(navigationservice ) { this.navigationservice = navigationservice; } } angular.module('core') .directive('itemnavigation', function ($timeout) { return { bindtocontroller: true, scope: { itemid: '=' }, controlleras: '$ctrl', restrict: 'a', link: function(scope, elem, attrs, ctrl) { $timeout(() =>{ elem.bind('click', function() { let noredirect = $(this).hasclass('no-redirect'); // approch doesnt work never finds class if(!noredirect) return ctrl.navigationservice.gotoitemdetails(ctrl.itemid) }) }) ; }, controller: itemnavigation }; }); example of html <tr ng-repeat="item ...

C# When explicit delegate declaration is required when working with events -

this question has answer here: creating delegates manually vs using action/func delegates 8 answers all know delegate function pointer. when work event declare delegate know in kind of situation have declare delegate when working events public delegate void onbuttonclickdelegate(); here refering code sample show can use in built delegate eventhandler instead of declare delegate explicitly. public class argsspecial : eventargs { public argsspecial (string val) { operation=val; } public string operation {get; set;} } public class animal { // empty delegate. in way sure value != null // because no 1 outside of class can change it. public event eventhandler<argsspecial> run = delegate{} public void raiseevent() { run(this, new argsspecial("run faster")); } } animale animal= new animal(...

javascript - give a value to input when move then save it by ajax - php / jquery -php -

Image
i want create shopping cart , i'm finish. use ajax dynamic search , ajax add cart , use jquery refresh specific div when click face problem.my problem quantity problem. use session store value //this session update code $con = mysqli_connect("localhost", "root" , "","atest"); session_start(); require("functions.php"); cart_session(); $id=$_post['id']; //echo $arr['cart']; if(isset($_session[$arr["cart"]][$id])){ $_session[$arr["cart"]][$id][$arr["quantity"]]++; //redirect("http://localhost/my/work/sellingcart/index.php",true); }else{ $sql_s="select * product_1 p_id={$id}"; //echo $sql_s; $query_s=mysqli_query($con,$sql_s); if(mysqli_num_rows($query_s)!=0){ $row_s=mysqli_fetch_array($query_s); $_session[$arr...

java - HTTP Status 500 - Error instantiating servlet in eclipse maven -

Image
i trying run simple servlet in maven using eclipse. getting error 500. please see doing wrong. main concern how run servlet in maven not familiar maven . index.jsp <html> <body> <h2>hello world!</h2> <form action="mylog" method="post"> loginid:<input type="text" name="name"/><br/> <input type="submit" value="login"/> </form> </body> </html> mylog.java (servlet class) import java.io.ioexception; import java.io.printwriter; import javax.servlet.servletexception; import javax.servlet.http.httpservlet; import javax.servlet.http.httpservletrequest; import javax.servlet.http.httpservletresponse; public class mylog extends httpservlet { private static final long serialversionuid = 1l; public mylog() { super(); // todo auto-generated constructor stub } protected void doget(httpservletreques...

css - Unexpected resulting box height (computed box height smaller than line height) -

i'm setting: font-size: 13px; line-height: 1.53846; multiplying those, gives 19.99998 inspecting dev tools tells computed line height 20px - great. rendered/computed height of box 19px div { font-size: 13px; line-height: 1.53846; } <div>bla</div> why?

c++ - How to copy a non null terminated string to dynamic memory -

first off, not duplicate . question how dynamic memory. reason distinct because delete[] hanging. so, here's have: class packetstrret { public: packetstrret(char p_data[], int p_len) : len(p_len) { data = new char[p_len]; memcpy(data, p_data, p_len * sizeof(char)); } ~packetstrret() { delete[] data; data = nullptr; } char* data; int len; }; and yes, i'm aware code not using best practices. i'll clean later. the problem i'm having in dtor. delete hanging forever. data being passed in ctor not dynamic memory, need make dynamic things don't go out of scope. p_len holds correct amount of data, there's no problem there. from i've read, memcpy seems culprit here. how copy string not null-terminated dynamic memory, , still able delete later? thanks. the problem not delete, comes before , ok if there didn't occur problems. class packetstrret { // use raii std::...

Java Swing - What's the proper way of doing a stage based GUI? -

Image
i'm developing menu of application , know what's proper way of coding "stage based menu". mean stage based menu that, user clicks button, entire interface changes next "stage". here pictures designed in photoshop in order explain idea: first picture first stage , second picture second. each round looking thing jbutton so far got main menu (fist picture) made on eclipse using windowbuilder, made jpanel , instantiate on window class. my idea have event listener listen clicks on each button , once triggered, have jpanel variable on frame change next "stage". so wondering if proper way of doing or there better ways? you use card layout make easy swap panels. check out section swing tutorial on how use card layout more information , examples.

javascript - Import JSX in Reflux Store not working -

i have module trying import reflux store. /* ../util/itemutil.jsx */ var itemutil = { isitemowner(user, item) { return (user.id === item.user.id) } } export default itemutil; but when trying import reflux store import itemutil 'util/itemutil' var itemstore = reflux.createstore({ check(user, item) { itemutil.isitemowner(user,item) /* above statement fails undefined */ } })

php - If first $_GET field is empty but second has a value, echo to fill in missing value -

i want "please fill in form below:" @ first, before input, afterwards if input age no name, want say: "please enter name:" , if input name no age then: "please enter age:" if submit nothing then: "error: please enter name , age continue" here code have: if( $_get["name"] && $_get["age"] ) { echo "<p>welcome ". $_get['name']. " ... "; echo "you ". $_get['age']. " years old.</p>"; exit(); } elseif ( $_get["name"] == false ) { echo "<p>please fill in form below:</p>"; } elseif ( $_get["age"] == false ) { echo "<p>please fill in form below:</p>"; } elseif ( $_get["name"] == false && $_get["age"] ) { echo "<p>please fill in name:</p>"; } elseif ( $_get["age"] == false && $_get[...

string - Assigning TextView to selected Listview items -

i have string array has multiple strings in listview, e.g. {apples, oranges, banana, ...etc}. want if user choses more 1 item, oranges & banana, text added oranges , banana. added intent, send activity. code this: if(selected.get(i).equals("oranges"){ textview torange = (textview) findviewbyid(r.id.t1); torange.settext("oranges sour"); } if(selected.get(i).equals("banana"){ textview tbanana = (textview) findviewbyid(r.id.t1); tbanana.settext("banana healthy"); } intent c = new intent(main.this, myfruits.class); bundle b = new bundle(); b.putstring("torange", tpnp.gettext().tostring()); b.putstring("tbanana", tcheckers.gettext().tostring()); c.putextras(b); startactivity(c); now want activity myfruits.class display 2 textviews, i.e. "oranges sour" , "bananas healthy"

python - mongoengine using Authentication Database -

i not sure how connect mongodb database uses authentication database mongoengine. on command prompt need mongo hostname:27017/myapp -u "test" -p "test" --authenticationdatabase admin , don't see i'd pass argument mongoengine use admin database auth connect myapp database models? i believe it's explained in pymongo guide: https://api.mongodb.com/python/current/examples/authentication.html >>> pymongo import mongoclient >>> client = mongoclient('example.com') >>> db = client.the_database >>> db.authenticate('user', 'password', source='source_database') and found pull request added mongoengine: https://github.com/mongoengine/mongoengine/pull/590/files it looks add authentication_source argument connect connect(authentication_source='admin') . it'd nice if better documented. http://docs.mongoengine.org/apireference.html?highlight=authentication_source ...

python - Tensorflow Linear Regression - Exponential Model Not Fitting Exponent -

i'm trying fit exponentially decaying model (y=ax^b + c)to data have yet value other 0 for b. have 2 "working" sets of code right now, 1 steps through each x,y pair, , other attempts use entire [x,y] array, i'm not sure have implemented correctly. i'd correctly fit curve. linear model works fine i'm not sure going south. data here - pastebin #!/usr/bin/python import numpy np import tensorflow tf import sys import matplotlib.pyplot plt k=0 xdata= [] ydata = [] # open data , read in, ignore header. open('curvedata_full_formatted.csv') f: line in f: k+=1 if k==1:continue items = line.split(',') xdata.append(float(items[0])) ydata.append(float(items[1])) # model linear regression y = a*x^b+c # x - data fed model - 1 feature x = tf.placeholder(tf.float32, [none, 1]) # - training variable - 1 feature, 1 output = tf.variable(tf.zeros([1,1])) # b - training variable - 1 output b = tf.variable(...

Function not Running inside an "if" statement Python 3 -

i'm attempting write escape room game in python. when run code pycharm process ends "process finished exit code 0." is there wrong in defining of functions? here code (its bit lengthy): choice = none def main_choice(): print("1. examine door") print("2. examine painting") print("3. examine desk") print("4. examine bookshelf") choice == input("make choice: ") def door(): print("1. try open door") print("2. take closer look") print("3. go were.") door_choice = input("what now? ") if door_choice == "1": print("the door heavy open bare hands.") door() if door_choice == "2": print("there red light above door, seems have no purpose.") print("you notice 9 key keypad next door. looks accept 3 digit code.") keypad_code = input(...

Python list.append output values differ from list.extend -

saw question on site piece of python code driving nuts. small, straightforward-looking piece of code, looked @ it, figured out trying do, ran on local system, , discovered why driving original questioner nuts. hoping here can me understand what's going on. the code seems straightforward "ask user 3 values (x,y,z) , sum (n); iterate values find tuples sum n, , add tuples list." solution. outputs is, instead of tuples sum n, list of tuples count of equal count of tuples sum n, contents of "[x,y,z]". trying wrap head around this, changed append call extend call (knowing un-list added tuples), see if behavior changed @ all. expected same output, "x,y,z,x,y,z..." repeatedly, instead of "[x,y,z],[x,y,z]" repeatedly, because read , understand python documentation, that's difference between append , extend on lists. got instead when used extend correct values of tuples summed n, broken out of tuple form extend. here's problem co...

python - (Help) TypeError: 'str' object cannot be interpreted as an integer -

traceback (most recent call last): file "<pyshell#0>", line 1, in <module> get_odd_palindrome_at('racecar', 3) file "c:\users\musar\documents\university\courses\python\assignment 2\palindromes.py", line 48, in get_odd_palindrome_at in range(string[index:]): typeerror: 'str' object cannot interpreted integer i want use value index refers how do that? it seems error 'index' variable string, not int. convert using int(). index = int(index) in range(string[index:]): now, string[index:] string. need convert too: >>> string = "5" >>> range(string) traceback (most recent call last): file "<stdin>", line 1, in <module> typeerror: range() integer end argument expected, got str. >>> range(int(string)) [0, 1, 2, 3, 4] >>> that's assuming string[index:] contains number. if that's not case, can like: # 'index' ...

Updating the UI from a background thread in Android -

edit: suggested helpful add code so, asynctask code pasted below... i'm learning android , have ui few buttons. want animate ui, changing color of buttons, in sequence. i shouldn't main thread of course, , doesn't work anyway. code manipulating ui runs ui doesn't update until end of sequence. so created thread , tried run through sequence background thread however, error trying manipulate ui components background thread. main thread can touch ui components. then discovered asynctask. figured was, run through sequence in doinbackground(). every time needed update ui i'd call publishprogress() cause onprogressupdate() called main thread access ui components without error. every time call publishprogress() follow systemclock.sleep(500) let time pass until next animated ui update. what found though doinbackground() run through 4 ui state changes in 2 seconds (500 ms each) ui not update each call publishprogress(). instead doinbackground() completes , onp...

windows - Pinch Zoom Becomes Pan Gesture on MapControl -

i developing windows 10 uwp app. app has mapcontrol: <maps:mapcontrol x:name="map" /> i add multiple instances of usercontrol xaml control usermapicon.xaml : <usercontrol x:class="taq.views.usermapicon" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="using:taq.views" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:ignorable="d" d:designheight="20" d:designwidth="20"> <grid> <ellipse width="10" height="10" fill="black"></ellipse> </grid> </usercontrol> to map c# code: // ... var umi = new usermapicon(); map.children.add(umi); // ... several times purposes. so, can imagine there map...

How do I install Rails on Windows 10? -

this question has answer here: installing ruby on rails on windows 7 - quick , easy [closed] 2 answers i have normal machine running windows 10. what's simplest way install ruby on rails on it? i've found few different guides online give different instructions. i'm looking "official" way, if there one. historically it's been pretty complicated, on windows 10 it's simple. go here , , download preferred edition of ruby. it's straightforward installation process. @ end check ruby , rails versions make sure everything's installed. i'm not sure if "official" way, works , it's simple.

java - Resolving NoClassDefFoundError -

Image
this question has answer here: why getting noclassdeffounderror in java? 14 answers i trying learn spring. typed project on running it gives me error exception in thread "main" java.lang.noclassdeffounderror: org/apache/commons/logging/logfactory @ org.springframework.context.support.abstractapplicationcontext.<init>(abstractapplicationcontext.java:145) @ org.springframework.context.support.abstractrefreshableapplicationcontext.<init>(abstractrefreshableapplicationcontext.java:84) @ org.springframework.context.support.abstractrefreshableconfigapplicationcontext.<init>(abstractrefreshableconfigapplicationcontext.java:59) @ org.springframework.context.support.abstractxmlapplicationcontext.<init>(abstractxmlapplicationcontext.java:58) @ org.springframework.context.support.classpathxmlapplicationcontext.<init>(classpathxmlapplica...

asp.net core - Referencing .Net framework dll which needs to read configuration data -

i have created asp.net core (.net framework) website references .net framework dll. dll needs read configuration data calling applications web.config or application.config file. how can in asp.net core application? have tried adding configuration settings web.config in asp.net core application not being picked in dll. after bit more research noticed although asp.net core (.net framework) project uses appsettings.json settings still contains web.config file. added settings dll needs web.config , added 'copytooutput' setting (below) project.json file. "buildoptions": { "emitentrypoint": true, "preservecompilationcontext": true, "copytooutput": "web.config" }, now dll can retrieve settings needs. 1 downside may end doubling configuration settings (adding them appsettings.json , web.config) if both asp.net core , dll require them. haven't tested deploying azure etc. welcome comments. ...

Jekyll - Highlighter on Aviator Theme? -

im unsure highlighting system being used on: https://github.com/cloudcannon/aviator-jekyll-theme it uses code like: ``` json [ { "id": 1, "title": "the hunger games", "score": 4.5, "dateadded": "12/12/2013" }, { "id": 1, "title": "the hunger games", "score": 4.7, "dateadded": "15/12/2013" }, ] ``` but code like: ``` c++ ``` doesnt seem work. cant find css or js references confusing me heavily. aviator uses default jekyll syntax highlighter - rouge . haven't tried if use cpp instead of c++ might work.

postgresql - postgres min/max group by day of week from date range -

hi have tables has one-to-one relation report_sites id | date 1 | 2016-11-02 10:00:00 2 | 2016-11-02 11:00:00 3 | 2016-11-02 12:00:00 4 | 2016-11-03 17:00:00 5 | 2016-11-03 16:00:00 report_services id | min_serving_time | max_serving_time | report_site_id 1 | 00:00:30.094 | 00:15:30.662 | 1 2 | 00:00:07.566 | 00:07:49.72 | 2 3 | 00:00:07.787 | 00:26:27.587 | 3 i want select min(min_serving_time) max(max_serving_time) date range group weekday this weekday | min | max sunday | 00:00:05 | 00:08:55 monday | 00:01:51 | 00:05:21 tuesday | | i can count rows of weekdays how aggregate value select count(extract(dow report_sites.date) = 1 or null) monday, count(extract(dow report_sites.date) = 2 or null) tuesday, count(extract(dow report_sites.date) = 3 or null) wednesday, count(extract(dow report_sites.date) = 4 or null) thursday, count(extract(dow report_sites.date) = 5 or null) friday report_sites in...

Google Chrome initial loading of AngularJS application -

i have angularjs application reachable under url: my appl and has strange behaviour: write url of application url input , press enter, google chrome takes 20 seconds load without opened developer tools (f12), if open developer tools takes 5 seconds, ok. other browsers opera, firefox ie takes 5 seconds initial load of application. my question if has explanation strange behaviour? the problem slow response time because have many file loading. application loads html file ng-include , doesn't start loading file before scripts loaded. suggest bundling scripts 1 file. cut loading time @ least in half. plugin bundles libraries bower 1 file https://www.npmjs.com/package/gulp-bundle-assets . also practice putting static html in html file later replaced content want <body ng-include='app/core/aposoft.html'> <div> app initializing </div> </body> with html let user know app loading, can style better css. put scripts below </body...

php - Laravel checkbox validation (O or 1) -

i validating checkbox here user must select one. <label class="col-md-3 control-label" for="checkboxes">can resume </label> <div class="col-md-4"> <label class="checkbox-inline" for="checkboxes-0"> <input type="checkbox" name="canres[]" id="checkboxes-0" value="1"> yes </label> <label class="checkbox-inline" for="checkboxes-1"> <input type="checkbox" name="cannotres[]" id="checkboxes-1" value="0"> no </label> </div> and on server side in controller method validating : $validator = validator::make(input::get(), [ 'canres' => 'required', 'cannotres' => 'required' ]); the validation fails because 1 checked , other required want 1 checked....

jquery - How to save a variables value out of the loop in PHP? -

<?php //connecting database define('db_host', 'localhost'); define('db_name', 'visitor_list'); define('db_user','root'); define('db_password',''); $con=mysql_connect(db_host,db_user,db_password) or die("failed connect mysql: " . mysql_error()); $db=mysql_select_db(db_name,$con) or die("failed connect mysql: " . mysql_error()); //inserting record database $dat1 = date("d"); $moth1 = date("m"); $year1 = date("y"); $sql2 = 'select * list1 order card_no desc limit 1;'; $retval = mysql_query($con,$sql2 ); while($row = mysql_fetch_array($retval, mysql_assoc)) { /*echo "{$row['card_no']}";*/ $in= $row['card_no']; $in++; } $ap_ty = $_post['ap_ty']; $per = $_post['per']; $no_vis = $_post['no_vis']; $nm_vis = $_post['nm_vis']; $co_nm = $_post['co_nm']; $ad = $_post['ad'];...

asp.net mvc - MVC Login with Entity Framework with multiple connections -

i have project entity framework multiple connections database, connection depends each user. my problem when try connect @ same time different users. can't connect different databases @ same time, 1 connection overrides other connection , users see data other user. what can make these connections saved per each user? anyone can help? in advance!

c# - Pass div content to controller -

example: <div id="result"> action </div> @ajax.actionlink("vote", "vote", new { id = model.catalog_id, vote = result }, new ajaxoptions { httpmethod = "post", onsuccess = "location = location", confirm = "are sure vote?" }) div result change when user selects different radio button value. want pass latest radio button value controller insert data. possible? using ajax method call can solve problem

android - Would it work to add Firebase to my Cordova app using the "web app" approach only? -

i know there cordova plugin add firebase analytics (and others), , set each platform (ios/android/browser/..etc) separately. but wondering, cordova apps html+js files! website structured app. work if add snippet in index.html (which firebase made web apps)?? it takes sometime before seeing results, rather long term impact of approach, have of tried it? for firebase storage , firebase database, can make work html + js. 2 functionalities have tested in android application using web approach. however, receiving push notifications need use plugin.

java - log4j1.7 -extra ,daily rolling and weekly zipping of files for archiving -

Image
<appender name="debug_appender" class="org.apache.log4j.rolling.rollingfileappender"> <param name="threshold" value ="debug" /> <param name="append" value ="true" /> <param name="datepattern" value ="yyyy-mm-dd-hh-mm-ss" /> <param name="file" value="c:/cameldata/logs/mason-debug.log"/> <rollingpolicy class="org.apache.log4j.rolling.timebasedrollingpolicy"> <param name="filenamepattern" value="c:/cameldata/logs/mason-debug.%d{yyyymmdd.hhmm-ss}.log"/> <param name="filenamepattern" value="c:/cameldata/logs/mason-debug.%d{yyyy-mm-dd-hh-mm}.zip"/> <param name="timebasedtriggerpolicy" value="2"/> </rollingpolicy> <param name="maxfilesize" value =...

sql server - Match the reference number using left to right and len in sql -

how match referece number left right using sql server 2010 table1 reference1 abc123456 table2 reference2 efabc123456 acdererere abc12345693843 we want compare reference1 reference2 form left right expected behaviour table2 reference2 efabc123456 - not match acdererere - not match abc12345693843 - match (its matching complete reference left right reference1 ) how make query logic tried query left(@pi_ref, len(table1.refno)) = table1.refno rtrim(ltrim(table1.refno)) this query working complete referecen number not left right please assit table2.refno table1.refno + '%'

How can I create my custom palette in AnyLogic -

i'am starting project on want study information process flow inside company work with. have create different agent-type represents different departments , information exchanged between them. to maintain project ordered know if possible, , if yes how, creating palette host agent-type. create palette "departments" , "information". thanks andrea please consider anylogic first. open (help/anylogic help/) , search "creating library", details there you. able export library (for other users use it), need prof license, though.

Android attach Fragment to viewPager on Fragment dont work -

in 1 of activities have fragment that, in have 1 viewpager want use fragment that, attaching fragments don't work adapter. code updated @override public view oncreateview(layoutinflater inflater, viewgroup container, bundle savedinstancestate) { view view = inflater.inflate(r.layout.fragment_food_list, container, false); ... foods_slider.setadapter(buildadapter()); return view; } private pageradapter buildadapter() { return(new foodslistslideradapter(getchildfragmentmanager())); } foodslistslideradapter class: public class foodslistslideradapter extends fragmentpageradapter { public foodslistslideradapter(fragmentmanager fm) { super(fm); } @override public fragment getitem(int fragmentid) { switch (fragmentid) { case 0: return foodlistpartone.newinstance(0); case 1: return foodlistparttwo.newinstance(1); case 2: ...

python - How to use timeit module -

i understand concept of timeit not sure how implement in code. how can compare 2 functions, insertion_sort , tim_sort , timeit ? the way timeit works run setup code once , make repeated calls series of statements. so, if want test sorting, care required 1 pass @ in-place sort doesn't affect next pass sorted data (that, of course, make timsort shine because performs best when data partially ordered). here example of how set test sorting: >>> import timeit >>> setup = ''' import random random.seed('slartibartfast') s = [random.random() in range(1000)] timsort = list.sort ''' >>> print min(timeit.timer('a=s[:]; timsort(a)', setup=setup).repeat(7, 1000)) 0.334147930145 note series of statements makes fresh copy of unsorted data on every pass. also, note timing technique of running measurement suite 7 times , keeping best time -- can reduce measurement distortions due other processes runnin...

Is it possible to trigger a function in a flink job? -

i have flink streaming job stateful public class limitevaluationmapfunction implements mapfunction . this class has hashmap private map<string, metriccheck> checkmap stores records database lazy loading. (loads record database in message arrives key not in map ). is possible trigger cleanup on map without restarting flink job? in general possible send user triggers flink functions?

class - Returning 0 with classes + switch -

while messing around using switches , class, understand them, come problem im not understanding. in code im trying do, it's work out life path, if don't know life paths are, adds numbers of birthdate work out, eg if born on 13th of august, in 1980 13 = 1 + 3 = 4, 8 = 8, 1980 = 1 + 9 + 8 + 0 = 18 = 1 + 8 = 9, 4 + 8 + 9 = 21 = 2 + 1 = 3, life path 3. but im using cases switch statements inside, find right numbers use, looking in day class(you'll see below), i'll run code, , it'll go write case, when returning value of day, returns 0. wanted know how fix this. thanks. #include <iostream> using namespace std; int day(int day) { cout << "please enter day of month born" << endl << "if born on number sixth, please enter 06" << endl << endl; cin >> day; switch (day) { cout << " day : "; case(01): cout << "01 = 1" << endl; ...