Posts

Showing posts from April, 2014

sql - One to One relationship many tables -

i new using databases , trying design new database think need one-to-one relationship spread across many tables. to demonstrate design, let's building schedule database example. start creating table person one-to-many relationship create table person ( person_id serial not null, name varchar, primary key (person_id) ); next, create table of events contains many portion of person relationship create table events ( event_id serial not null, type varchar, name varchar, person_id integer, time timestamp without time zone, primary key (event_id), foreign key(person_id) references person (person_id) ); now lets have 2 different types of events have different information them, meal , homework create table meals ( event_id integer not null, food varchar, utensils varchar, primary key (event_id), foreign key(event_id) references events (event_id) ); create table homework ( event_id integer not null, su

excel - Concatenate and fill but not continuously -

Image
i have excel sheet need concatenate couple of cells , add number. want like: a1 a2 a3 a4 b1 b2 b3 a5 but instead, get: a1 a2 a3 a4 b5 b6 b7 a8 is there way achieve want? thank you does work you? added helper column. wiki

pyqt - Multiple Page on Python and QML -

i’m beginner on programming in python , qml , i'm doing project project need have many ui forms i’m using qml create these ui lets have form a,b,c , when application load need open form , form contain button click , open form b , form close, form b have button click open form c , form b close… plis me on these project main.py import sys pyqt5.qtcore import qobject, qurl, qt pyqt5.qtwidgets import qapplication pyqt5.qtqml import qqmlapplicationengine if __name__ == "__main__": app = qapplication(sys.argv) engine = qqmlapplicationengine() ctx = engine.rootcontext() ctx.setcontextproperty("main", engine) ctx2 = engine.rootcontext() ctx2.setcontextproperty("main", engine) engine.load('form1.qml') win = engine.rootobjects()[0] def pagec(): engine.load('form3.qml') win2 = engine.rootobjects()[0] button1 = win2.findchild(qobject, "form3") button1.clic

Swift Firebase UISearchController Index Out Of Range -

i have tableview lists of "places" firebase. have uisearchcontroller search through these "places". problem when tap on uisearchcontroller don't type , select "place" index out of range error. if typing or not activated uisearchcontroller, segues fine. when active , don't type when error. throws error on "let user = filteredusers[indexpath.row]" override func prepare(for segue: uistoryboardsegue, sender: any?) { super.prepare(for: segue, sender: sender) if segue.identifier == "businessprofiles" { // gotta check if we're searching if self.searchcontroller.isactive { if let indexpath = tableview.indexpathforselectedrow { let user = filteredusers[indexpath.row] let controller = segue.destination as? businessprofilesviewcontroller controller?.otheruser = user } } else { if let indexpath = tableview.indexpath

php - How to retrieve data from database using AJAX based on a select tag? -

let's imagine have 2 select tags <select id='combobox_1'> <option value='1'>description of fist record</option> <option value='2'>description of second record</option> </select> <select id='combobox_2'></select> and 2 tables on database table_1 combox_1_db_id pk combox_1_db_description table_2 combox_2_db_id pk combox_1_db_id fk combox_2_db_description now want send ajax request php value of option selected in combobox_1 fill records database combobox_2 based on combobox_1_id. js $('#combobox_1').on('change', function() { var option_value = $('#combobox_1').find('option:selected').val(); $.ajax({ url: '/get_records', method: 'get', datatype: 'json', success: function(data) { $(data).each(function() { var option = $('<option />'); option.attr

php - Cloudflare returning ipv4 address and desktop application returning ipv6 -

when user downloads application, cloudflare forwards http_cf_connecting_ip. however, when application run. against same php script, cloudflare returns ipv6 address in http_cf_connecting_ip var. how can cloudflare or server consistent ip? wiki

openpyxl - Why is my python code inserting empty lines in excel -

i supposed make 1 excel file out of two. went ok except making new file. give smart people code, please me it. wrong? after insert rows in file want + empty rows randomly around file. checked arrays before getting szuk.f_same() problem have in writing file part... can't find it. again... please me guys .. wb = openpyxl.workbook() ws = wb.create_sheet("wyniki",0) h = 0 in range(0,len(dat1[0])): # znajdz odpowiadajace!!! = szuk.f_same( [ dat1[0][i], dat1[1][i], dat1[2][i] ], dat2 ) j in range(0,len(a[0])): #print( '\n \n h=' + str(h) + ' \n \n \n j=' + str(j) ) k in range(0,len(a)): cel = f(k+1) + str(j+1+h) wb[wb.get_sheet_names()[0]][cel].value = a[k][j] print(a[k][j]) h+=1 wb.template = false wb.save('gotowe.xlsx') this funk used order data: def f_same( wzor, dane, por_wzor = [ 0, 2 ] , por_dane = [ 0 , 1 ] ): if( len(por_wzor) len(por_dane) ):

pandas - Python pivot table for large file in chunks: memory error -

using bunch of dataframe chunks this, version , assay form unique identifier: version assay resp_rob_sigmas 0 a123 f 0.56 1 b234 g 0.78 2 c345 r 0.9 3 d456 f 1.0 4 d456 g 0.3 i'm creating pivot table needs this: f g r a123 0.56 na na b234 na 0.78 na c345 na na 0.9 d456 1.0 0.3 na pre-chunking , pre-unzipping, data frame 13 gb, pivot table explodes in size during creation causing memory error. current code looks this: import pandas pd import zipfile # number of lines read @ time csv chunk_size = 10 ** 5 merged_df = pd.dataframe([]) folder = zipfile.zipfile(op_directory + "/file.zip") # reading csv in chunks, dropping columns, dropping rows null responses. chunk in pd.read_csv(folder.open("file.csv"), chunksize=chunk_size): df = pd.dataframe(chunk) # operations on df ... ... merged_df = merge

sql - Optimize select query on huge database -

i developing sql query using join based on 2 tables, table 1 , table 2. rdbms sql server. both tables have common id column, based on join formed. there datetime column in both columns. objective : want retrieve rows table2 table2.datetime within range of 1 minute of table1.datetime . note : not have write permission database indexing not option me. i got query right. working correctly; however, database huge. if want retrieve data last 15 days, takes forever. is there better way it? here query select a.column1, a.column2, a.column3, a.column4, a.column5, a.column6, a.column7, a.column8, a.column9, a.column10, a.column11, b.column1, b.column2, b.column3, b.column4, b.column5 table1 a, table2 b a.commoncolumn = b.commoncolumn , b.datetime between dateadd(minute, -1, a.datetime) , dateadd(minute, 1, a.datetime) , a.datetime between getdate() - 15 , getdate() try filter data first reduce nu

vb.net - Better way to read data from a network stream -

i'm relatively new vb , have written program receives message packets server. the packets start same 4 bytes , length of package 5th byte. packets end same 4 bytes , vary in size. using networkstream.read() not suitable missing data packets sent if read in middle of message a sample of packets byte array {161, 178, 195, 212, 10, 0, 94, 77, 60, 43} this simplified byte arrays each packet can on 7000 bytes long. what looking best way full packet server sends can decode it. here read function public function read(tcpclient tcpclient) dim readbytes(15000) byte networkstream = tcpclient.getstream() if networkstream.dataavailable networkstream.read(readbytes, 0, readbytes.length) end if return readbytes end function wiki

sql server - The type name could not be resolved parameter name:window type -

Image
when try open sql server management studio 2012 have following error: the type name not resolved parameter name:window type screenshot: can 1 me why error appear, , solution? wiki

c# - use Line chart from highchart -

i going use line chart highchart library in .netcore c# project. new matter. following highcharts.net instruction looks easy. have copied <highchart:linechart id="hcvendas" runat="server" width="500" height="350" /> in about.cshtml , left below code in controller: public iactionresult about() { //defining axis hcvendas.yaxis.add(new yaxisitem { title = new title("faturamento") }); hcvendas.xaxis.add(new xaxisitem { categories = new[] { "1994", "1995", "1996", "1997", "1998", "1999", "2000", "2001", "2002" } }); //new data collection var series = new collection<serie>(); series.add(new serie { data = new object[] { 400, 435, 446, 479, 554, 634, 687, 750, 831 } }); //bind hcvendas.datasource = series; hcvendas.databind(); if (user.isinrol

python - calculate document weight using machine learning -

lets have n number of documents(resumes) in list, , want weigh each document(resume) of same category job description.txt reference. want weigh document per below. question there other approach weigh document in kind of scenario? in advance. plan of action : a) resumes (eg. 10) related same category (eg. java) b) bag of words docs for: c) each document features names using tfidf vectorizor scores d) have list of featured words in list e) compare these features in "job discription" bag of words f) count score document adding columns , weigh document what understood question looking grade resumes(documents) seeing how similar job description document. 1 approach can used convert documents tfidf matrix including job description. each document can seen vector in word space. once have created tfidf matrix, can calculate similarity between 2 documents using cosine similarity. there additional things should removing stopwords, lemmatizing , encoding. ad

c# - What is an IndexOutOfRangeException / ArgumentOutOfRangeException and how do I fix it? -

i have code , when executes, throws indexoutofrangeexception , saying, index outside bounds of array. what mean, , can it? depending on classes used can argumentoutofrangeexception an exception of type 'system.argumentoutofrangeexception' occurred in mscorlib.dll not handled in user code additional information: index out of range. must non-negative , less size of collection. what it? this exception means you're trying access collection item index, using invalid index. index invalid when it's lower collection's lower bound or greater or equal number of elements contains. when thrown given array declared as: byte[] array = new byte[4]; you can access array 0 3, values outside range cause indexoutofrangeexception thrown. remember when create , access array. array length in c#, usually, arrays 0-based. means first element has index 0 , last element has index length - 1 (where length total number of items in array) code doesn&

Add header to Excel document using Microsoft Graph API -

i'm looking way edit headers in excel document online. start looking @ graph api, don't see way so. is there documentation regarding issue? the microsoft graph api not not support changing header or footer of excel document. i recommend adding suggestion uservoice site . wiki

c# - Pinning Metro Apps To Taskbar Windows 10 Powershell -

the following code pin metro app start given aumid if change -match 'pin start' unfortunately changing match 'pin taskbar' not work. going on here? function pin-taskbar { param( [string]$aumid, [switch]$unpin ) try{ if ($unpin.ispresent){ ((new-object -com shell.application).namespace('shell:::{4234d49b-0245-4df3-b780-3893943456e1}').items() | ?{$_.path -eq $aumid}).verbs() | ?{$_.name.replace('&','') -match 'unpin taskbar'} | %{$_.doit()} return "app '$aumid' unpinned taskbar" }else{ ((new-object -com shell.application).namespace('shell:::{4234d49b-0245-4df3-b780-3893943456e1}').items() | ?{$_.path -eq $aumid}).verbs() | ?{$_.name.replace('&','') -match 'pin taskbar'} | %{$_.doit()} return "app '$aumid' pinned taskbar" } }catch{ write-error &

azure - Microsoft APIs authorizations management with App Registration Portal -

when create application through azure ad admin portal , when go "application registrations", can manage authorizations several apis (graph, sharepoint online, skype business online, power bi, onenote...) however, when create application using microsoft application registration portal , seems possible add graph api authorizations ( user.read , etc.) is possible use microsoft application registration portal manage application access other apis graph ? the app reg portal portal registering azure ad v2.0 apps (combines microsoft accounts + azure ad accounts behind 1 endpoint). right now, v2 not support getting access tokens web apis other graph. the feature set on v2.0 continue expand , in parallel portal expose these supported features (including other apis other graph). wiki

delphi - No scrollbars appear in an autoscrollable form -

------------------------- original question ------------------------- greetings delphi developers! in delphi 2006 non mdi application, create non-sizeable, autoscrollable, autosizeable form. excerpt form's unit: uses grid; tgridfrm = class(tform) public grid : tgrid; constructor create(aowner : tcomponent; asize : tpoint); end; implementation constructor tgridfrm.create(aowner: tcomponent; asize : tpoint); begin inherited create(aowner); borderstyle := bssingle; // users not allowed resize form windowstate := wsnormal; borderwidth := 0; autosize := true; autoscroll := true; constraints.maxwidth := screen.width - 1; constraints.maxheight := screen.height - 1; grid := tgrid.create(asize.x, asize.y, self); end; now, tgrid custom control own canvas of course. excerpt unit: tgrid = class (tcustomcontrol) public noofcellsx, noofcellsy, cellsize : integer; procedure setzoom(z : integ

How to install and configure Jenkins Openstack Heat v1.3 Plugin? No HOT player? -

i downloaded , installed latest version of plugin ( https://wiki.jenkins.io/display/jenkins/openstack+heat+plugin ). see installed when go jenkins -> manage jenkins -> manage plugins -> installed. problem after installing plugin, not presented of options shown in screen shots provided documentation in link above. there additional configuration required can build -> add build step show heat orchestration template (hot) player? thank time , responses. wiki

python - Trouble passing arguments into os.system() -

i want run python script 5 times. output each run image, , want 5 images saved @ end. using os.system() command, , end following error: typeerror: system() takes @ 1 argument (3 given) here code: import os = 1 while < 6: run = os.system ('python main.py', 'input laska.png', 'output laska_save' + str(i) + '.png') = + 1 not sure problem here might be. want output argument laska_save1, laske_save2 ... laska_save5 . increment happens 5, once everytime after called script runs. any guidance appreciated. you should call 1 string follows: os.system('python main.py input laska.png output laska_save{}.png'.format(i)) the os.system documentation says take string argument, must create full string command before passing function. wiki

Handle Failed Subscriptions On Laravel-Spark -

i'm using laravel-spark version 4.0.0 , want handle failed subscriptions on laravel- spark ,this feature provided laravel - cashier package mentioned in documentation : failed subscriptions : what if customer's credit card expires? no worries - cashier includes webhook controller can cancel customer's subscription you. noted above, need point route controller: route::post( 'stripe/webhook', '\laravel\cashier\http\controllers\webhookcontroller@handlewebhook' ); https://laravel.com/docs/5.4/billing#handling-failed-subscriptions want handle case on laravel spark , seems didn't handle failed subscription on version. suggestions start ? wiki

xamarin.ios - How to get to an MvxViewController from a regular UiViewController? Is it possible? -

i new mvvmcross, samples find seems rely on var start = mvx.resolve<imvxappstart>(); start.start(); to instantiate mvxviewcontrollers. but app starts non-mvxviewcontroller, , don't want turn start viewcontroller mvxviewcontroller. i instantiate mvxviewcontroller , push navigation stack, this: var vc = mvx.resolve<somemvxviewcontroller>(); navigationcontroller.pushviewcontroller(vc, true); is possible? wiki

mysql - How to send multiple json response in php back to ajax -

<?php session_start(); $conn =new mysqli("localhost","root","","registration"); $userid=isset($_post['userid'])?$_post['userid']:''; //$re['success']=false; $sql="call regtask2('$userid')"; $res=mysqli_query($conn,$sql); $array = array(); if($res) { while($row = mysqli_fetch_assoc($res)) { $array[]=$row ; $re['success']=true; $re['userobj']['firstname'] = $row['firstname']; } } else { $re['success']=false; } if(isset($_session['username'])) { $sem=isset($_post['sem'])?$_post['sem']:''; $fname=isset($_post['fname'])?$_post['fname']:''; $year=isset($_post['date'])?$_post['date']:''; $query = mysqli_query($conn,"select * studentdetails inner join studentmarks on studentdetails.studentid=studentmarks.studentid fi

visual studio 2015 - Keyboard shortcut Ctrl+\ not working when it is the first one of a combination -

i'm trying view error list pressing default vs shortcut ctrl+\, ctrl+e. however, after typing ctrl+\ nothing happening. when type ctrl+e message (ctrl+e) pressed. waiting second key of chord... when assign reverse combination view error list (ctrl+e, ctrl+), work expected. this applies other shortcuts starting ctrl+. each time ctrl+\ first 1 of combination, nothing happening... anyone ideas wrong ctrl+\? wiki

c# - ControlToValidate doesn't work -

Image
i'm trying add requiredfieldvalidator behind <input> . the following code: <form id="form1" runat="server"> <div> <input type="text" id="mid" /> <asp:requiredfieldvalidator id="requiredfieldvalidator1" runat="server" errormessage="requiredfieldvalidator"></asp:requiredfieldvalidator> <br /> </div> </form> then, i'm trying assign controltovalidate mid, id of input text. however, there isn't available in controltovalidate: then, type mid in , run program, <form id="form1" runat="server"> <div> <input type="text" id="mid" /> <asp:requiredfieldvalidator id="requiredfieldvalidator1" runat="server" errormessage="requiredfieldvalidator" controltovalidate="mid">&l

ios - Cleanest way to present UIKeyCommands from custom UIControl -

i'm in process of writing custom uicontrol , need able present uikeycommands it. now, way have implemented exposing bool called shouldshowkeycommands . when true, show corresponding commands: - (void)moverowdown:(id)sender { [self.control setselectedatindex:[self.control selectedindex]+1]; } - (void)moverowup:(id)sender { [self.control setselectedatindex:[self.control selectedindex]-1]; } - (void)selectaction:(id)sender { [self.control performselectedindex]; } - (nsarray *)keycommands { if (self.control.shouldshowkeycommands) { nsarray *commands = @[ [uikeycommand keycommandwithinput:uikeyinputdownarrow modifierflags:uikeymodifiercommand action:@selector(moverowdown:) discoverabilitytitle:@"go down 1 button"], [uikeycommand keycommandwithinput:uikeyinputuparrow modifierflags:uikeymodifiercommand action:@selector(moverowup:) discoverabilitytitle:@"go 1 button"],

Android Studio: Failed to load dx.jar -

when run module in android studio error: error:android dex: [gradledevbuild] failed load dx.jar i have searched endlessly solution online related eclipse, there nothing when comes android studio. the path dex.jar c:\androidsdk\build-tools\26.0.0\lib\dex.jar exists, i've moved out of folder , notified moved aware of is. have tried copying root directory , platform-tools folder did nothing. this full list of errors seem stemming dx.jar error. error:android dex: [gradledevbuild] failed load dx.jar error:android dex: [gradledevbuild] java.lang.classnotfoundexception: com.android.dx.command.dxconsole error:android dex: [gradledevbuild] @ java.net.urlclassloader.findclass(urlclassloader.java:381) error:android dex: [gradledevbuild] @ java.lang.classloader.loadclass(classloader.java:424) error:android dex: [gradledevbuild] @ java.lang.classloader.loadclass(classloader.java:357) error:android dex: [gradledevbuild] @ org.jetbrains.android.compiler.tools.androiddxrunner.loaddex

java - Getting Error while overriding excel(xls) file (The requested operation cannot be performed on a file with a user-mapped section open) -

workbook workbook = new hssfworkbook(); // //other stuff here fileoutputstream outputstream = new fileoutputstream(location); workbook.write(outputstream); outputstream.close(); first time code works fine, need override file same name when user request so. when program enters in loop again, give following error: the requested operation cannot performed on file user-mapped section open and when try open file manually, give me pop showing file locked. wiki

python - if a == b or a == c: vs if a in {b, c}: -

in code used have comparisons if == b or == c or == d: frequently. @ point discovered these shortened if in {b, c, d}: or if in (b, c, d): if values aren't hashable. however, have never seen such construction in else's code. because either: the == way slower. the == way more pythonic. they subtly different things. i have, chance, not looked @ code required either. i have seen , ignored or forgotten it. one shouldn't need have comparisons because one's code sould better elsewhere. nobody has thought of in way except me. which reason, if any, it? for simple values (i.e. not expressions or nan s), if == b or == c , if in <iterable of b , c> equivalent. if values hashable, it's better use in set literal instead of tuple or list literals: if in {b, c}: ... cpython's peephole optimiser able replace cached frozenset() object, , membership tests against sets o(1) operations. wiki

Applying Function to Structure in Matlab -

currently, here code: % specify folder files live. myfolder = 'c:\users\irwin\desktop\matlab\scintillator_project\advanced'; % check make sure folder exists. warn user if doesn't. if ~isdir(myfolder) errormessage = sprintf('error: following folder not exist:\n%s', myfolder); uiwait(warndlg(errormessage)); return; end % list of files in folder desired file name pattern. filepattern = fullfile(myfolder, '*.spe'); thefiles = dir(filepattern); k = 1 : length(thefiles) basefilename = thefiles(k).name; fullfilename = fullfile(myfolder, basefilename); fprintf(1, 'now reading %s\n', fullfilename); end i have structure in each entry contains .spe file. apply function readspe ( https://www.mathworks.com/matlabcentral/fileexchange/35940-readspe ) each entry in structure convert them .spe format 3d array. please help! thanks :) wiki

angularjs - Angular 1/Javascript - alternative to lodash omit and delete operator -

i have child component have delete properties object. normally using lodash should work code : this.current.obj = omit(this.current.obj, ['sellersupportweb', 'sellersupportagency', 'sellersupportagent']) just current.obj model not mount parent component but if delete properties object operator delete works delete this.current.obj.sellersupportagency delete this.current.obj.sellersupportweb delete this.current.obj.sellersupportagent is there not alternative same job delete , omit ? i not know if can help, work omit i'm calling parent object (parent component) on child component on it, i'm looking solution since current.obj for (const [index] of this.current.parent.items.entries()) { this.current.parent.items[index] = omit(this.current.parent.items[index], ['sellersupportweb', 'sellersupportagency', 'sellersupportagent']) } if understand correctly, want modify object shared between component

ASP.NET MVC using DbSet with database using dot notation -

i trying implement worldwideimporters sample database in asp.net mvc application. everything working using test sql database single table "persons". however when using worldwideimporters every table sorted categories: application.cities , application.countries or sales.orders , sales.customers. where write model this: public class datacontext : dbcontext { public datacontext(dbcontextoptions<datacontext> options) : base(options) { } public dbset<person> persons { get; set; } } public class person { [key] public int personid { get; set; } [required] public string firstname { get; set; } } and controller this: public class peronscontroller : controller { private readonly datacontext _context; public peronscontroller(datacontext context) { _context = context; } // get: orders public async task<iactionresu

php - mysqli::__construct(): MySQL server has gone away -

i can't connect server. here mistakes gives me: warning: mysqli::__construct(): mysql server has gone away in c:\xampp\htdocs\www\php-project\logic\db_connection.php on line 3 warning: mysqli::__construct(): error while reading greeting packet. pid=8632 in c:\xampp\htdocs\www\php-project\logic\db_connection.php on line 3 warning: mysqli::__construct(): (hy000/2006): mysql server has gone away in c:\xampp\htdocs\www\php-project\logic\db_connection.php on line 3 fatal error: maximum execution time of 30 seconds exceeded in c:\xampp\htdocs\www\php-project\logic\db_connection.php on line 3 this connection file: define("host", "localhost:81"); define("db_user", "root"); define("db_password", ""); define("db_name", "bulitfactory_person_cv"); $db_connection = new mysqli(host, db_user, db_password, db_name); if ($db_connection->connect_error) { die("conn

tomcat8 - Integrating spring config server with "legacy" tomcat -

i'm trying deploy spring boot application packaged war file tomcat 8. have properties come config server. config server can simple spring boot executable jar file, connected git. i can't see find way tell "classic" tomcat (non-spring-boot) configuration in external config server. there's no "bootstrap.yml" tomcat i'm aware of? any assistance great. thanks. the problem web.xml still used legacy implementation of contextloaderlistener. not needed if war packaged spring boot application. actually, caused problems. when removed it, let configuration picked spring boot itself. see response here dave syer: https://github.com/spring-cloud/spring-cloud-config/issues/715 wiki

c# - How to merge multiple object of child class to single parent object -

Image
i have created 4 classes inside single parent class. since child classes have individual properties need assign different values , need merge objects of child class parent class me in creation , pass single object inside method argument. what have not child classes, nested classes. want neither. want this: public class person { public string name { get; set; } public int age { get; set; } } public class { public person b { get; set; } public person c { get; set; } public person d { get; set; } public person e { get; set; } } internal static class program { private static void method(a a) { console.writeline(a.e.name); } internal static void main() { var = new { b = new person { name = "peter", age = 31 }, c = new person { name = "paul", age = 78 }, d = new person { name = "mary", age = 24 }, e = new person { name = "jane

Image copied and pasted from high resolution screen small and surrounded by empty space -

in several of windows programs, copy , paste metafiles or bitmap images word, powerpoint, or rich textbox print controls. images typically scale fit page, or if pasted content box in powerpoint, figure sizes more or less fit content box while preserving aspect ratio. purchased windows 10 laptop 3840x1060 display. now, when copy image , paste it, image small, , pasted image surrounded empty space. means have manually crop images , resize them. i've tried doing in code, haven't had luck. example, resizing bitmap image fit size of printed page means image , bordering empty space fit page. i use clipboardmetafilehelper link: http://support.microsoft.com/kb/323530 to put metafiles onto clipboard. i'm using visual studio 2008 (yes, know it's quite out of date, don't think that's problem!) i can solve problem degrading display resolution, seems wasteful. have advice me? wiki

bash - How to show the result of command read in emacs's shell mode? -

version info: gnu emacs 25.1.1 gnome terminal 3.20.2 the command read -ei "hi" show result hi in gnome-terminal(bash), not show result hi in emacs's shell mode(m-x shell). from paul's answer: read -ei "hi" , c-m in gnome-terminal(bash) show: [d@localhost desktop]$ read -ei "hi" hi read -ei "hi" , c-m in emacs's shell mode show: [d@localhost desktop]$ read -ei "hi" what expect see in emacs's shell mode: [d@localhost desktop]$ read -ei "hi" hi so how show result of command read in emacs's shell mode? try adding echo: read -ei "hi" && echo $reply wiki

Pivoting and adding new column in SQL Server Management Studio 2016? -

i have database looks this: indexid questionid answergiven 1 3 phone 1 7 agree 2 8 agree 2 5 yes 2 3 chat 3 6 null 3 3 phone 4 3 web 4 7 disagree and want write script pull out question #3 own column called contactchannel, this: indexid questionid contactchannel answergiven 1 7 phone agree 2 8 chat agree 2 5 chat yes 3 6 phone disagree 4 7 web disagree i'm new sql, suspect has pivoting , sub-queries, , know can vary database ideas ssms 2016? you can use query following: select t1.indexid, t1.questionid, t2.answergiven contactchannel, t1.answergiven mytable t1 left join mytable t2 on t1.indexid = t2.indexid , t2.questionid = 3 t1.questionid <> 3; the query in ansi sql , shoul

python - Why is NotImplementedType not a type subclass? -

i noticed strange when inspecting built-in type notimplementedtype . >>> types import notimplementedtype >>> issubclass(notimplementedtype, type) false >>> type(notimplementedtype) <type 'type'> how can these 2 things true? how can notimplementedtype not subclass of type yet derived type ? classes not subclass of type , including types.notimplementedtype . type metaclass of classes. for example, custom classes , built-in types not subclasses of type either : >>> class foo: pass ... >>> issubclass(foo, type) false >>> issubclass(int, type) false only other metaclasses subclasses of type ; abcmeta metaclass: >>> abc import abcmeta >>> issubclass(abcmeta, type) true this analogous intances , classes; instances not subclasses of class; use isinstance() : >>> issubclass(foo(), foo) traceback (most recent call last): file "<stdin>", line 1, in &l

typescript - Angular 2 - Can't find module angular/core -

Image
i'm coming here , asking question has been answered in post, solutions don't work. so, i'm creating new angular2 app quickstart folder of angular website. i've done npm install , okay, have node_modules folder @ root. but, when i'm doing ng serve , error got : error in angular/src/app/app.component.ts (1,27): cannot find module '@angular/core'. error in angular/src/app/app.component.ts (8,14): experimental support decorators feature subject change in future release. set 'experimentaldecorators' option remove warning. error in angular/src/app/app.module.ts (1,31): cannot find module '@angular/platform-browser'. error in angular/src/app/app.module.ts (2,26): cannot find module '@angular/core'. error in angular/src/app/app.module.ts (16,14): experimental support decorators feature subject change in future release. set 'experimentaldecorators' option remove warning. error in angular/src/main.ts (1,32): cannot find modul

asp.net - Run Application_Start immediately when application pool/Application restarts in IIS -

Image
what want application_start in global.asax (or other piece of code) runs automatically whenever application pool/application restarts in iis. application_start gets triggered on first request don't want wait first request, want whenever web api deployed , started. so, there way via code (not @ iis level) can achieve above? i'm not absolutely sure can try set "start mode = running" application pool. edit 1: should enforce iis directly load/reload application pool , triggering application_start of global.asax edit 2 just make clear, meant. go application pools right click application pool go advanced settings change ondemand alwaysrunning yes not code based. of know have configure application pool achieve want. maybe want check (contains samples code based app pool configuration): application pool defaults wiki

bash - Please explain the implied -print action in the find command -

i fell trap of believing if find in bash prunes files , finds remaining files (not directories), output remaining files. it didn't work expected. here's simplified example. i've directory structure follows: a ├── 1.log ├── 1.tgz ├── 1.txt ├── b │   ├── 2.log │   ├── 2.tgz │   └── 2.txt ├── c │   ├── 3.log │   ├── 3.tgz │   └── 3.txt └── d └── e ├── 4.log ├── 4.tgz └── 4.txt let's want find files aren't *.log or *.tgz . (i realise that's left *.txt files there's obvious way find those, that's not going case, please indulge me.) my original command was: find \( -name '*.log' -o -name '*.tgz' \) -prune -o -type f i expected work, listed files: a/1.log a/b/2.tgz a/b/2.txt a/b/2.log a/d/e/4.log a/d/e/4.txt a/d/e/4.tgz a/1.txt a/1.tgz a/c/3.tgz a/c/3.txt a/c/3.log according the man page find : if whole expression contains no actions other -prune or -print, -print performed on file

javascript - Identify when Leaflet Draw cancel button is clicked -

problem i'm using leaflet draw application, , have 'remove' button active. remove button has 3 options: save cancel clear all i want function foo() called if user clicks save , however, want function bar() called should click cancel . live demo solution i know achieved giving id, , adding event listener, it's not clean think should be. ideal solution leaflet draw own methods detecting when buttons pressed seems me 1 level higher. example: draw:deletestop type of edit is. 1 of: remove triggered when user has finished removing shapes (remove mode) , saves. - leaflet docs this allows me call foo() after user has selected any of 3 options, rendering have finished dealing remove button interaction. i cannot find way in docs able listen leaflet draw firing event on individual buttons being pressed. the handler cancel/disable function stored part of l.control.draw instance. so, you can modify handler right after instantia

c# - Reactive Extensions .MaxBy -

why var = observable.interval(timespan.fromseconds(1)) .publish(); a.subscribe(o => { console.writeline("test"); }); a.connect(); fire, not var = observable.interval(timespan.fromseconds(1)) .maxby(o=>o) .publish(); a.subscribe(o => { console.writeline("test"); }); a.connect(); i trying use maxby in different scenario can't above work. this more complex example var _telemetrybatchobservable = observable.fromeventpattern<devicestatestreameventarg>( ev => devicestatestreamevent += ev, ev => devicestatestreamevent -= ev) .synchronize() .groupby(o => o.eventargs.deviceid) .select(o => o.maxby(i => i.eventargs.datetimeoffset)) .selectmany(o => o.select(i => i)) .selectmany(o => o.select(i => i)) .buffer(timespan.frommilliseconds(5000), 100) .publish(); max , maxby emit single value, when source observable terminated. if have non-termi

javascript - I can't change my database with ajax and a button -

i'm new ajax , jquery, might simple problem. i'd update database clicking on button within browser, using codeigniter framework. my javascript looks this: function endonboard(){ $.ajax({ url: "http://localhost:8888/users/onboard", success: function(data) { } }); } my html looks button this: <button onclick="endonboard();">end</button> and new php page onboard.php this: <?php $query_onboard = $this->db->query("update users set firstsignup = 42 user_id=". $this->user_id); ?> wiki

python - Import with and without main scope -

i have 2 files, app.py , database.py in same directory. have following code snippets: app.py import database db = "demo_database" print(database.show_database_information()) database.py from app import db database_username = "root" database_password = "password" def show_database_information(): information = {} information["filename"] = db information["username"] = database_username information["password"] = database_password return information when try run app.py got following error: traceback (most recent call last): file "k:\pyprac\circular_call\app.py", line 1, in <module> import database file "k:\pyprac\circular_call\database.py", line 1, in <module> app import db file "k:\pyprac\circular_call\app.py", line 3, in <module> print(database.show_database_information()) attributeerror: module 'database' has no attr

javascript - Describing Binary Tree with ImmutableJS & custom setIn function -

i trying immutable tree structure in light of immutable-js. people/exemple saw using either map or list immutable structure, feels cheating, , not having classic tree structure. wondering best way adapt classic tree make immutable. in case asking why, need tree immutable in order fluxjs store work fine. , no, changing flux lib not possible solution ;) so here little classes have written in order describe tree. export default class parsetree { constructor ( ) { this.root = null } setin( pathtonodetomodify, newvalue ) { //code here } } export class leaf { constructor( value ) { this.data = value; this.children = null; } } export class node { constructor( isparallel, children = [] ) { this.data = map( { id : createuniqueid(), isparallel : isparallel }); this.children = children; } } question 1 - how feel way of building tree ? as can