Posts

Showing posts from July, 2015

c# - Calculate all the values in textfile -

i have make program allows admin calculate total revenues each business type. i have stored gained revenues each type in separate text files ie. .mobile.txt , .kiosk.txt , .daily.txt the content each type in text file this 10 60 30 so far code i've generated, still doesn't work private void report_load(object sender, eventargs e) { list<double> kiosk = new list<double>(); list<double> daily = new list<double>(); list<double> mobile = new list<double>(); foreach (string line in file.readalllines(@".kiosk.txt")) { kiosk.add(double.parse(line)); } foreach (string line in file.readalllines(@".mobile.txt")) { mobile.add(double.parse(line)); } foreach (string line in file.readalllines(@".daily.txt")) { daily.add(double.parse(line)); } double sum_kiosk = kios

pandas - How to lookup values for multiple columns in one dataframe from another -

i have dataframe (df1) movie titles: movie1 movie2 desired dinosaur planet screamers favorite brunette immortal beloved strange relations chump change clifford lady chatterley invader zim and dataframe (df2) vector representations of each movie: id year title genre word vector 1 2003.0 dinosaur planet documentary [-0.55423898, -0.72544044, 0.33189204, -0.1720... 2 2004.0 isle of man sports & fitness [-0.373265237, -1.07549703, -0.469254494, -0.4... 3 1997.0 character foreign [-1.57682264, -0.91265768, 2.43038678, -0.2114... 4 1994.0 & dance sports & fitness [0.3096168, -0.57186663, 0.39008939, 0.2868615... my goal sum movie1 + movie2 in df1 , find closest matches in df2 using cosine similarity , see if matches desired result in in df1. this, need find vector representation of each movie in df1 , sum first 2 columns. i'v

c# - Int not getting displayed as string in JSON Object -

i trying loop through list of json objects , convert them indexed json. below code have written: private string itemsasjson(list<string> jsonitemlist) { string itemasjson = ""; (int = 0; < jsonitemlist.count; i++) { string index = i.tostring(); itemasjson += "{ " + index + " : " + jsonitemlist[i] + "},"; } return itemasjson; } but object below here: { 0: { "item_type": "batch", "item_id": "82", "bill_item_name": "a z", "quantity": "1", "inventory_id": "82", "individual_price": "2.90", "batch_no": "", how convert 0 in above text string ("0")? the best answer use json parser library, json.net , , not parse json manually. if reason decide proceed method, can add quotes aroun

r - Subset rows according to a range of time (incl. minutes) -

my question follow-up on question raised here user wet feet: this modified dataset: date_time loc_id node energy kgco2 1 2009-02-27 00:11:08 87 103 0.00000 0.00000 2 2009-02-27 01:05:05 87 103 7.00000 3.75900 3 2009-02-27 02:05:05 87 103 6.40039 3.43701 4 2009-02-28 02:10:05 87 103 4.79883 2.57697 5 2009-02-28 04:05:05 87 103 4.10156 2.20254 6 2009-02-28 05:05:05 87 103 2.59961 1.39599 7 2009-03-01 03:20:05 87 103 2.59961 1.39599 i trying rows fall within specific time interval, e.g. 02:05:00 03:30:00. 3 2009-02-27 02:05:05 87 103 6.40039 3.43701 4 2009-02-28 02:10:05 87 103 4.79883 2.57697 7 2009-03-01 03:20:05 87 103 2.59961 1.39599 applying solution in linked question ( hour lubridate package), however, doesn't suffice since have consider minutes of interval. use interval function lubridate package include minutes, since dataframe covers different dates, wouldn't help. i particularly curio

go - Parsing a time with the format HHMMSS00 -

i'm working data multiple sources , 1 of these sources sage erp system. i trying reference 2 files in sage in particular, audit date , audit time ( audtdate , audttime ). i need parse , store datetime in microsoft sql server database. currently, trying figure out best way parse this. an example of data might below: +----------+----------+ | audtdate | audttime | +----------+----------+ | 20170228 | 5013756 | +----------+----------+ audtdate yyyymmdd format , audttime hhmmss00. so tried below test: func main() { value := "20170228 5013756" layout := "20060102 15040500" t, _ := time.parse(layout, value) fmt.println(t) } this doesn't work, returns 0001-01-01 00:00:00 +0000 utc when run. if change time 050137 , layout 150405 works fine: func main() { value := "20170228 050137" layout := "20060102 150405" t, _ := time.parse(layout, value) fmt.println(t) } one way can think of

python - Auto Serial no in my lost and found sheet -

i have sheet in serial format 24/08/2017 serial no 24 , possible next serial no 25/08/2017 using formula as mentioned in comment, if serial number irrespective of date, can following, with s serial number, , / differentiates number increment , rest of serial number, can use string replace! >>> s '100/08/2017' >>> s.replace(s.split('/')[0],str(int(s.split('/')[0])+1),1) '101/08/2017' if serial number in date format, can use datetime module of python, >>> datetime import datetime,timedelta >>> #serial_no = datetime.now().strftime('%d/%m/%y') >>> serial_no = "16/08/2017" >>> print serial_no 16/08/2017 >>> print (datetime.strptime(serial_no, "%d/%m/%y").date()+timedelta(days=1)).strftime('%d/%m/%y') 17/08/2017 wiki

php - Calculations with javascript -

i found script , kind of need learn right now. similar code i want data php , date calculation! but dont understand how yet! $(window).load(function(){ $('div#cont-sum-fields').on('change', 'input', function() { // var total = (parseint($( "#cont-sum-1" ).val()) + parseint($( "#cont-sum-2" ).val())) * parseint($( "#cont-sum-3" ).val()) ; var printsmall = 6; //var pricesmall = <? echo $priceaud[4][2];?>; // output 6.0 var total = (parseint($( "#cont-sum-1" ).val()) + parseint($( "#cont-sum-2" ).val())) * pricesmall) ; $('#cont-sum-fields').find('#total-cont-sum').val(total); find('pricesmall').val(pricesmall); }); }); <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <div id='cont-sum-fields'> (<input type="number" id=

javascript - how to use sphere-collider aframe -

hi trying use sphere-collider in aframe game, took sphere collider source , exported component, moving objs using timer , changing position using .object3d.position.y=some-position , after attaching event listener e.detail.el should emit collided object emitting objects. using wrong or there issue collider modified. please take @ code below understand modified. original source:- link aframe.registercomponent('sphere-collider', { schema: { objects: {default: ''}, state: {default: 'collided'}, radius: {default: 0.05}, watch: {default: true} }, init: function () { /** @type {mutationobserver} */ this.observer = null; /** @type {array<element>} elements watch collisions. */ this.els = []; /** @type {array<element>} elements in collision state. */ this.collisions = []; this.handlehit = this.handlehit.bind(this); }, //........ code long read rest open link above.. }); any appreciated, new

Android Intent filter for url with redirect -

how setup intent filter url redirection? https://mail.mailserverxxx.com/m/redirect?url=http://foosubdomain.foodomain.com/#object?id=e1162d22-222b-4522-2210-c222102d6022 this filter not work url above. <intent-filter> <action android:name="android.intent.action.view"/> <category android:name="android.intent.category.default"/> <category android:name="android.intent.category.browsable"/> <data android:scheme="http"/> <data android:scheme="https"/> <data android:host="foosubdomain.foodomain.com"/> </intent-filter> this filter works url above. not needed. need filter host in redirect part foosubdomain.foodomain.com <intent-filter> <action android:name="android.intent.action.view"/> <category android:name="android.intent.category.default"/> <category android

ruby on rails - Searchkick search data working in test but not in browser -

i experiencing weird behavior elasticsearch wrapper ruby gem searchkick , , i'd love help! the issue the expected behavior should able search full name space in it. works in test, not in browser. the code account.rb class account searchkick word_start: [ :first_name, :last_name, :name, # <======================== key line :email, :phone, :company, ], callbacks: :async def self.index_search(query:) search( query || '*', fields: [ :first_name, :last_name, :name, # <======================== key line :email, :phone, :company, ], match: :word_start, where: { test_account: false }, order: { created_at: :desc }, limit: 20, misspellings: false, ) end def search_data { first_name: first_name, last_name: last_name, name: "#{first_name} #{last_name}", # <======================== key line

python - Having trouble parsing a .CSV file into a dict -

i've done simple .csv parsing in python have new file structure that's giving me trouble. input file spreadsheet converted .csv file. here example of input: layout each set can have many layouts, , each layout can have many layers. each layer has 1 layer , name. here code using parse in. suspect it's logic/flow control problem because i've parsed things in before, not deep. first header row skipped via code. appreciated! import csv import pprint def import_layouts_schema(layouts_schema_file_name = 'c:\\layouts\\layout1.csv'): class set_template: def __init__(self): self.set_name ='' self.layout_name ='' self.layer_name ='' self.obj_name ='' def check_layout(st, row, layouts_schema): c=0 if st.layout_name == '': st.layer_name = row[c+2] st.obj_name = row[c+3] layer = {st.layer_name : st.obj_name}

c++ - ncurses getch() weird output? -

i have installed ncurses.h lib , started experimenting getch() function.when built , run code seems alright me @ first, console printed out weird character: '�'(if doesn't show , shows space here screen shot: https://prnt.sc/gbrp7b ) console starts spamming if type character, shows in output still '�' spams. here code: #include <iostream> #include <fstream> #include <ncurses.h> using namespace std; int main(){ char input; while(true){ input = getch(); cout << "you entered : " << input << endl; //break; } return 0; } so thought of trying use if statement try , stop spamming code doesn't recognise character: it gives error: error: character large enclosing character literal type for code: #include <iostream> #include <fstream> #include <ncurses.h> using namespace std; int main(){ char input; while(true){ input = getch(

android - Is glClear(GL_COLOR_BUFFER_BIT) necessary when I already glDisable(GL_BLEND)? -

in understanding, if disable gl_blend , no blending happens @ all. don't need glclear(gl_color_buffer_bit) . i working on gles20 android programming. have added line below. gles20.gldisable(gles20.gl_blend); if don't add glclear(gl_color_buffer_bit) , other devices work except nexus 4. on nexus 4, on 1 pass (other passes work normally), partial area rendered. if add glclear(gl_color_buffer_bit) , nexus 4 works well. if gl_blend disabled, fragment of draw buffer overwritten, if drawn to. if disable blending , write on every fragment of draw buffer in every frame, useless clear draw buffer, because each fragment set during drawing process. glclear(gl_color_buffer_bit) nothing else write every fragment constant color set glclearcolor . note, have ensure, every fragment written in each frame. example if gl_depth_test enabled you'll have glclear(gl_depth_buffer_bit anyway. wiki

mongodb - Why Mongo query for null filters in FETCH after performing IXSCAN -

according mongo documentation , the { item : null } query matches documents either contain item field value null or not contain item field. i can't find documentation this, far can tell, both cases (value null or field missing) stored in index null . so if db.orders.createindex({item: 1}) , db.orders.find({item: null}) , expect ixscan find documents either contain item field value null or not contain item field, , documents. so why db.orders.find({item: null}).explain() perform filter: {item: {$eq: null}} in fetch stage after performs ixscan ? possible documents need filtered out? { "queryplanner" : { "plannerversion" : 1, "namespace" : "temp.orders", "indexfilterset" : false, "parsedquery" : { "item" : { "$eq" : null } }, "winningplan" : { "stage&quo

c# - how to change change the colour of dropdown in Asp.net? -

i have dropdown cbovendor want data in dropdown in red coming else part in below code .but problem binding data after if-else. .aspx <asp:dropdownlist id="cbovendor" runat="server" appenddatabounditems="true" autopostback="true"> <asp:listitem value="0">- select vendor -</asp:listitem> </asp:dropdownlist> c# code if (checkbox1.checked == true) { cbovendor.datasource = dal.certificationda.getfullaccreditedvendors(vendid); cbovendor.datatextfield = "suppliername"; cbovendor.datavaluefield = "supplierid"; } else { cbovendor.datasource = supplier.getsuppliersforsite(userwrapper.getcurrentuser.getvalidlocations.wsm_ref_buildings.findbybuildingid(cbobuilding.selectedvalue).siteid); cbovendor.datatextfield = "suppliername"; cbovendor.datavaluefield = "supplierid"; } cbovendor.databind(); after binding data can loop through list

jenkins - Erorr : The Java EE server classpath is not correctly set up -

Image
i trying create .war file using cmd: ant.bat -file build.xml getting same error in jenkins also. i using netbeans ide 8.0.2 how can fix error , solution. thanks. wiki

nginx - enable async AND rotating access log -

for reasons, have write access.log mounted fileshare. to let rotate, extracted current year , month , set log path to access_log /media/log/nginx/$year_$month_access.log log_format; this resulted performance issue (because of mounted fileshare), had enable buffering. buffering can't use variables in access_log directive anymore: access_log /media/log/nginx/access.log log_format buffer=32k flush=30m; so on month, access.log got big. is there way have both: async and rotating access.log? (ideally via nginx.conf only, no cronjob or so) wiki

php - Laravel GoogleMaps store routes -

i'm hoping i'm asking isn't impossible.. or stupid (it either or both lol). essentially im in process of learning laravel , started making app i'm rather interested in building. part of functionality using googlemaps have routes can plot , saving routes within account. does have tips/ideas on how make sort of functionality work? any great :) chris wiki

ubuntu - kubeadm kubedns error. could not access external network or other pods -

when using self hosted kubeadm in ubuntu, not access other pods , external network within k8s pod able access using regular docker containers. i tried different types of pod network including calico, weave , flannel. i followed debugging instructinos here without success, below logs. $ kubectl exec -ti busybox -- nslookup kubernetes.default server: 10.96.0.10 address 1: 10.96.0.10 nslookup: can't resolve 'kubernetes.default' $ kubectl exec busybox cat /etc/resolv.conf nameserver 10.96.0.10 search default.svc.cluster.local svc.cluster.local cluster.local options ndots:5 $ kubectl pods --namespace=kube-system -l k8s-app=kube-dns name ready status restarts age kube-dns-2425271678-9zwtd 3/3 running 0 12m $ kubectl logs --namespace=kube-system $(kubectl pods --namespace=kube-system -l k8s-app=kube-dns -o name) -c kubedns i0823 16:02:58.407162 6 dns.go:48] version: 1.14.3-4-gee838f6 i0823 16:02:58.40895

java - Will a class be loaded completely on static member dependency? -

this question has answer here: what “when class loaded” mean? 3 answers public class extends b { public static final int const = 6; ... logic ... } public class c { private int addnumber(int x) { return x + a.const; } } i wonder if junit test class c load field class a, depends on or if logic class extension (class b) loaded. how jvm working in case ? thanks ! on first reference class a, class loaded. given extends b, class b loaded well. static initializers , static fields in b executed/initialized in order specified in b, in a, , return code extracting const field. wiki

javascript - Delete from form = new DataForm -

i need delete .append() form create form = new dataform(); want add several images in database , throw these ajax, without delete cache, code this, there mistake ? var imagen_src = $("#imagen_evidencia").prop('files')[0]; $("#imagen_evidencia").val(''); var form = new formdata(); form.append('file', imagen_src); arreglo = json.stringify(arreglo_spam_cdc); type = json.stringify(tipo); fecha = json.stringify(today); form.append('tipo', type); form.append('fecha', fecha); form.append('arreglo_spam_cdc', arreglo); $.ajax({ type: 'post', url: '../admin/insertar_spam.php', datatype: 'json', data: form, contenttype: false, cache: false, processdata: false, success: function(data) { console.log(data); var id_name = arreglo_spam_cdc[0]['id_facebook']; console.log(id_name); mostrar_cdc(id_name); }

vba - Excel Macro - Remove rows and then relabel a cell value -

Image
what i'm trying remove rows cell value in specific column matches defined remove. after done re-sequence value in column group. using example below: want @ column b , remove rows have value of or c. want renumber after dot (.) in column reset itself. before macro code fig. 1 after value , c removed fig. 2 final list after column renumbered fig. 3 i figured out how remove rows using code, stuck on next: sub deleterowbasedoncriteriga() dim rowtotest long rowtotest = cells(rows.count, 2).end(xlup).row 2 step -1 cells(rowtotest, 2) if .value = "a" or .value = "c" _ _ rows(rowtotest).entirerow.delete end next rowtotest end sub this easier looping top down (using step 1 instead of step -1). i've tried stay true original coding , made this: sub deleterowbasedoncriteriga() dim rowtotest long dim startrow long dim integer startrow = 2 'clear rows have "a" or "c" in colum

delphi 6 - how to use the function "copy" to assign a UTF-8 value to a variable -

Image
i use following code assign text sql parameter: quinsert.parameters.parambyname('veh_type').value := copy(s,11,1); sometimes text in .txt file reading in utf-8, has characters using 2 bytes. how can change following code accept utf-8 data? procedure tprepareform.button1click(sender: tobject); var f : textfile; s : string; : integer; isansistring : boolean; begin quinsert begin close; sql.clear; sql.add('insert v_info_2018'); sql.add('(record_type, plate_group, plate_no, v_type, v_type_cn,'); sql.add('v_type_pt, v_type_pt, v_brand, engine_no, ct_tax_amount'); sql.add('inspect_date, record_date'); sql.add('values (:record_type, :plate_group, :plate_no, :v_type, :v_type_cn, :v_type_pt, :v_type_pt,'); sql.add(':v_brand, :engine_no, :ct_tax_amount,'); sql.add(':inspect_date, :record_date'); end; := 0; assignfile(f,edmastername.text); reset(f); while not eof(f)

python 3.x - PYQT5 QSqlQuery Error -

def seleccionar(self): self.db =qsqldatabase.adddatabase(self.db_type) self.db.sethostname(self.db_ip) self.db.setdatabasename(self.db_name) self.db.setusername(self.db_usname) self.db.setpassword(self.db_password ) estado=self.db.open() if estado==false: qmessagebox.warning(self,"error",self.db.lasterror().text(),qmessagebox.discard) else: try: self.table.setcolumncount(4) self.table.sethorizontalheaderlabels(["pid","server_ip","server_id","server_pwd"]) row=0 sql="select * stt_server" query=qsqlquery(sql) #error while query.next(): self.table.insertrow(row) pid=qtablewidgetitem(str(query.value(0))) server_ip=qtablewidgetitem(str(query.value(1))) server_id=qtablewidgetitem(str(query.value(2))) server_pwd=qtablewidgetitem(str

argparse - How to handle ampersand as part a command line argument in python -

i have program in python 2.7 accepts command line parameters using argparse , if try enter string containing ampersand lose characters after ampersand. for example: i have simple python program test input of command line arguments , prints out entered single command line parameter. essentially: print args.where when run program argument this: $ python args.py -a http://www.website.com?optionone=one&numbertwo=two the text printed screen is: http://www.website.com?optionone=one i have similar results when using sys , printing using argv how can full string entered? this problem shell. put argument in quotes. wiki

Extract variables values from command output Bash Shell -

in bash shell have command prints variable name , values such as: hello mate variables: my_var1= value of first var my_var2= subvar1=27, subvar2=hello1 have day! the value of variables in output can contain characters =,commas,;,:.., expect find new line @ end of each variable value. need create short script reads values of my_var1 , my_var2. need end 2 variables follows: my_var1 = value of first var my_var2 = subvar1=27, subvar2=hello1 i have basic installation of centos 7, , can't install additional stuff in machine. how can achieve it? i assume variable names beginning of lines, = sign (excluded) leading , trailing blanks removed (you cannot have blanks in variable names). if want print output show, can use like: while read line; if [[ $line =~ ^[[:blank:]]*([^[:blank:]]+)[[:blank:]]*=(.*)$ ]]; var="${bash_rematch[1]}" val="${bash_rematch[2]}" echo "$var = $val" fi done < <( my_comm

c# - Object initializer with conditional statement -

how can simplify conditional statement inside object initializer code more readible? if addnew true, new item added dictionary, otherwise have 1 item. ... var channel = new channelconf { name = "abc" headers = !addnew ? new dictionary<string, string> { [constants.key1] = id } : new dictionary<string, string> { [constants.key1] = id, [constants.key2] = port } } ... you call method initialize headers : ... new channelconf { name = "abc" headers = getnewdictionary(addnew) } ... private dictionary<string, string> getnewdictionary(bool addnew) { dictionary<string, string> output = new dictionary<string, string> { [constants.key1] = id }; if (addnew) { output.add(constants.key2, port); } return output; } alternately, leave way , reduce number of lines: ... var channel = new channelconf { name = "abc"

CSS inside PHP statement -

i have php statement inside body 1 page not take property of body <body id="page-top" class="single" <?php $actionid = $this->context->action->id; $pages =yii::$app->params['page']; if(!in_array($actionid,$pages) ? 'style="padding-top:10px;"' :'') ?>> everything working not css. have inserted in wrong place? 'style="padding-top:10px;"' :'') did forgot echo before 'style="padding-top:10px;"' ? also use if , ? -operator. use 1 of them :) <body id="page-top" class="single" <?php $actionid = $this->context->action->id; $pages =yii::$app->params['page']; echo (!in_array($actionid,$pages)) ? 'style="padding-top:10px;"' : ''; ?> > wiki

python - Django - using a form from another app - issue creating a redirect -

i have contact app in project. use contact form app in home page created in views.py: from django.views import generic contact.forms import contactform class homepage(generic.templateview): template_name = "home.html" def get_context_data(self, *args, **kwargs): context=super(homepage, self).get_context_data(*args, **kwargs) context['form'] = contactform return context when submit form on home page redirects blank page, instead of either home page, or thank page. here definition in views.py of contact app: def contact(request): form_class = contactform if request.method == 'post': form = form_class(data=request.post) if form.is_valid(): contact_name = request.post.get('contact_name', '') contact_email = request.post.get('contact_email', '') form_content = request.post.get('content', '') templ

css - Pseudoelement RGBA arrow color doesn't match parent -

i'm creating pseudoelement arrow under div ( #telegram-join ), both of have background/border colors rgba values ( rgba(255, 255, 255, 0.25) ), arrow being affected differently , appears darker div . because it's smaller? how can match them? thanks! html <div id="telegram-join" class="bg-combo"> <h1><i class="fa fa-telegram"></i> chat on telegram</h1> </div> css: .bg-combo { display: flex; align-items: center; justify-content: center; margin: 0 auto; border-radius: 8px; padding: 5px 10px; width: fit-content; background-color: white; background-color: rgba(255, 255, 255, 0.25); text-align: center; } .bg-combo h1 { display: inline-block; font-size: 2em; line-height: 1.5; text-transform: uppercase; } .bg-combo h1 { margin-right: 10px; } #telegram-join { position: relative; margin: 15px auto 25px; } #telegram-join :after { position: absolute; top: 100%; left:

javascript - How to call async function to use return on global scope -

i'm struggling function call, when call function if statement work when call outside doesn't, if statement checks button pressed i'm trying remove function button , call app starts. we @ fetchjokes() inside jokecontainer.addeventlistener('click', event => { this current code: const jokecontainer = document.queryselector('.joke-container'); const jokesarray = json.parse(localstorage.getitem("jokesdata")); // fetch joke count api endpoint async function sizejokesarray() { let url = 'https://api.icndb.com/jokes/count'; let data = await (await fetch(url)).json(); data = data.value; return data; } // use api endpoint fetch jokes , store in array async function fetchjokes() { let url = `https://api.icndb.com/jokes/random/${length}`; let jokesdata = []; let data = await (await fetch(url)).json(); data = data.value; (jokeposition in data) { jokesdata.push(data[jokeposition].joke); } return localstorage.s

javascript - jQuery allow selected characters only keypress function -

hi tried use code limit user's input. problem cannot use return key or enter in keyboard in input box. how can solve problem. im using code: $("input").keypress( function(e) { var chr = string.fromcharcode(e.which); if ("bcdegkmnqupvxy36789".indexof(chr) < 0) return false; }); to achieve need can add condition if statement checks return keycode: 13 : $("input").keypress(function(e) { var chr = string.fromcharcode(e.which); if ("bcdegkmnqupvxy36789".indexof(chr) < 0 && e.which != 13) return false; console.log('allowed'); }); <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <input type="text" name="foo" /> wiki

angular - How to find out which ngl-lookup was clicked on? -

i'm generating ngl-lookup's in loop. each ngl-lookup have drop down define source of lookup function. example, if user selects drop down value "cat", want display in ngl-lookup cats names. second ngl-lookup list, if user selects "dog", dogs names should displayed. i trying provide object id lookup function i'm not getting query i'm entering search field. also, once i've chosen value suggestion list, perform additional logic. any idea on how solve angular 4? this doesn't work: <div *ngfor="let myobject of myobjects"> <ngl-lookup [lookup]="lookup(myobject.id)" [(pick)]="onpick(myobject.id, selectedvalue)" debounce="0" placeholder="search"> </ngl-lookup> </div> angular component: lookup(query: string, objectid: number): string[] { if (!query) { return null; } let myobject = this.myobjects.find(x => x.id

javascript - Debug syntax error in giant Eval statement -

we have angular application works fine in chrome when runs in internet explorer, bombs because of syntax error in eval statement. how determine line in eval statement culprit? "use strict"; eval("/* unused harmony export createsignalrconfig */\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"a\", function() { return appmodule; });\n/* unused harmony export httploaderfactory */\n/* unused harmony export appinitializerloaderfactory */\n/* harmony import */ var __webpack_imported_module_0__angular_http__ = __webpack_require__(91);\n/* harmony import */ var __webpack_imported_module_1__angular_common_http__ = __webpack_require__(57);\n/* harmony import */ var __webpack_imported_module_2__angular_material__ = __webpack_require__(40);\n/* harmony import */ var __webpack_imported_module_3__angular_core__ = __webpack_require__(1);\n/* harmony import */ var __webpack_imported_module_4__angular_platform_browser_animations__ = __webpack_

getch - how to use my_getch in c++? -

i created getch-liked function using windows.h-getkeystate , working when in loops same char lots of times. sould do? i using gcc 4.9.2 code blocks windows 10 . my code : #include <windows.h> #include <iostream> bool pressed(int key){return getkeystate(key)&0x8000;} int my_getch(){ while(true){ bool shift=pressed(vk_shift); for(char a='a'; a<='z'; a++) if(pressed(a)) return shift||getkeystate(vk_capital)?a:a-'a'+'a'; if(pressed(vk_oem_3)) return shift?'~':'`'; if(pressed(vk_oem_4)) return shift?'{':'['; if(pressed(vk_oem_6)) return shift?'}':']'; if(pressed(vk_oem_5)) return shift?'|':'\\'; if(pressed(vk_oem_1)) return shift?':':';'; if(pressed(vk_oem_7)) return shift?'"':'\''; if(pressed(vk_oem_comma)) return shift?'<':','; if(pressed(vk_oem_period)) return shift?'>':'.'; if(pressed

R ShinyApp -- Reactive input fields are null on first pass filling log with errors -

i'm new r , shiny , use help. we're writing shinyapp reads 3 data sources uses 10 filter fields limit input. 10 fields dynamic; user can choose filter in 1 field , value filter should take in second field. when input fields read in reactive function filters validated , because null throwing "warning: error in if: argument of length zero" warnings cluttering console output. there standard way of handling this? filter selection looks like: filtered.d1.off <- reactive({ if(is.null(input$filter0101)){ input$filter0101 <- "unknown"} if(input$filter0101 %in% ranges){ which(basedata.off()[[input$filter0101]] >= input$filterselect0101[1] & basedata.off()[[input$filter0101]] <= input$filterselect0101[2]) }else{ which(basedata.off()[[input$filter0101]] %in% input$filterselect0101) } }) filtered.d2.off <- reactive({ browser() if(length(input$filterselect0102) == 0){ filtered.d1.off(

php - Laravel - Check for another URL prefix if exists -

how can skip wildcard route check route before returning 404? route::get( '{user}', function( $user ){ // checking existing user if( $user = user::getuser( $user ) ) return view( 'templates.user', [ 'user' => $user ] ); // should check prefixes before return 404 return abort( 404 ); }); route::get( 'foopage', function(){ return view( 'templates.foo' ); }); from code above, if access /foopage returns 404 because of no username 'foopage' exist. but it's supposed show view( 'templates.foo' ) move statement route::get( 'foopage', function(){ return view( 'templates.foo' ); }); above user route statement. route::get( '{user}', function( $user ){ ... }); this because laravel prioritise order of routes defined , if foopage route defined below user routes, consider foobar user route , try go down path. wiki

javascript - Impossible to get cookie on a request -

i'm making express js server cookie. never worked cookie first time :) when user login send cookie him : res.cookie('pseudo', list[i].pseudo, { maxage: 1000 * 60 * 60 * 24 * 30 * 12 * 3000, httponly: true }); res.cookie('email', list[i].email, { maxage: 1000 * 60 * 60 * 24 * 30 * 12 * 3000, httponly: true }); when use reqest /getcookie seeing cookie have : { token: 'exampletoken', pseudo: 'test', email: 'test@test.test' } my code seeing cookie : var = function (req, res) { var cookies = require('cookies'); console.log(req.cookies); } module.exports = about; but when used index page no output know why ? :'( here index code : var index = function (req, res) { var cookieparser = require('cookie-parser'); var fs = require('fs'); require('remedial'); marqueur = {}; marqueur.ps