Expect regexp telnet

Uncategorized
Question: I am a newcomer not having a great experience with expect commands. I have to monitor Linux servers on which I do not have the right to install the SSH keys, SNMP Agent and other NRPE. I created or rather resumed a script expect:#! / Usr / bin / expect -f Set force_conservative 1; Set timeout 6 Set env (TERM) Spawn ssh root @ myIp Expect "password: $" Send "mypassword r" #set var 0 Expect "$" Send "ps -ef |grep apache r" Sleep 5 Send "exit r" Expect eof #interact In this script, send test command checks on the remote server whether the "apache" process is running. How do I get the result of this command on my Nagios server so that I get notified by mail? Thank you…
Read More

Summarize multiple rows in crosstab

matrix
Question: My crosstab has ERP users for the Row, and all available security roles as the Column. Roles appear on the top of the report vertically, and users on the left side horizontally. Suppose every user has different and multiple roles for ERP. I myself have three. So in the report, under summarized values, I just want to have a character 'Y' appear in front of my name and under my roles. How can I configure this? Answer: Read more
Read More

Appear ListBox items on TextBlock On Button Click One By One

Uncategorized
Question: I want whenever user click on "Game button" item of "list box" should show in "text block" if user click on "Game button" again then it show next item of a "list box" in "text block". private void GameButton_Click(object sender, EventArgs e) { } Answer: You need an index to get current content in the list and then bind the data to MainScreenTextBlock. In XMAL Code Behind List list { get; set; } string showText { get; set; } int index = 0; private void GameButton_Click(object sender, RoutedEventArgs e) { showText = (list[index] as Model).GamesList; if(index < list.Count - 1) index++; } list is the ItemsSource of your listBox. Read more
Read More

Cython import ImportError: ./h_feature.so: undefined symbol: _ZN9haystack27featureD1Ev

Uncategorized
Question: I have read the relevant posts on the site for a whole day. But seems like this is an general error caused by different reasons. So I still post my question here. Any comments would be appreciated!!! I was trying to wrap a c++ code which with one h_feature.h and one h_feature.cpp file with only one h_feature.pyx file. Below is my h_feature.pyx file:from libcpp cimport bool cdef extern from "h_feature.h" namespace "h2": cdef cppclass feature:feature() except + feature(char* modelDir, bool) except + bool load_feature_extractor(char* modelDir, bool) cdef cppclass Image: # this is a struct in .h file, but i write it as class in pyx file here pass cdef class PyImage:cdef Image* image cdef class PyFeature:cdef feature* c_feature def __cinit__(self, bytes modelDir, bint useGPU = 0):self.c_feature = new feature(modelDir,…
Read More

Filter out empty strings in ST4

Uncategorized
Question: Consider the following example: This gives the result:foo,,bar But I need:foo,bar Is there any way to filter out empty string values before formating with separator in ST4? (In real code the values come from another template, which has condition and returns empty result for undesired data from model, and I don't whant to move the condition out of that template to keep templates incapsulated/isolated.) Answer: I've found the workaround with two auxilary things. But it is so creepy... DropEmpty ::= ["" : [], default : key] Separated(l, sep) ::= "" MyTemplate() ::= > This gives:foo,bar,goo Read more
Read More

External Provider Login in ASP Core, Identity Server 4 and Angular 2

Uncategorized
Question: I have an ASP Core App setup with Identity Server 4 that provides token based authentication for an Angular 2 SPA. To Login, username and password is sent via a Http Post to the "/connect" endpoint of identity server. I want to extend the login process to include External Providers (Google, Facebook & all) but all the resources i can find online speak of an "Account Controller" which is inside of an MVC app, which i do not have. I have been able to setup the client side of this process (retrieve the id_token of a user from Google, on the Angular SPA), but i don't know how to continue . Where do i send the Oauth id_token ? Do i use the Extension Grants ? How ? Please…
Read More

Is there a SAS Enterprise Guide equivalence for Python? [on hold]

python
Question: I do coding in both SAS and Python. I found SAS enterprise guide to be a great way for visualizing and organizing between datasets and programming files. Is there something similar (a platform where you can visually understand the connection/flow between files/datasets, and be able to drag the icons at will) for Python. To clarify, I am not trying to execute SAS code in Python or other way around. I am asking about the coding environment. Answer: Read more
Read More

Do I need to use DI and IoC everytime ModelView uses Model in MVVM?

Uncategorized
Question: I'm new to .NET MVVM structure of application and have just basic knowledge of it's principles, like decoupling, bindings, commands and etc. I'm using MVVM Light framework to simplify common MVVM issues like messaging and service location. One thing I don't understand: do I need to call SimpleIoC every time I using Model classes from ViewModel? Example: I have simple View, a ViewModel corresponding to it and a Model with one class Settings. MainWindow.xaml MainWindowModel.cs public class MainWindowModel: INotifyPropertyChanged { public event PropertyChangedEventHandler PropertyChanged; public ICommand DoSomeCommand { get; private set; } protected void RaisePropertyChangedEvent(string propertyName) { PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); } public MainWindowModel() { DoSomeCommand = new RelayCommand(DoSome); } public void DoSome() { var data = Settings.Instance; //singleton //... do some with data ... Debug.Log($"{data.Prop1}, {data.Prop2}, {data.Prop3}"); } }…
Read More

Can’t step into wcf function with C#

asp.net-mvc
Question: I'm still a bit new to WCF. I followed a tutorial on Pluralsight. In my solution, I have: WCF project "MyCodeLibrary" Console app "ConsoleHost" --host for the service, MVC project. The mvc project references the wcf project. In my mvc project, I have mylibservice.svc that contains: There is no code behind on this file. If I start the consolehost app, everything works fine, but I can't step into the wcf code. I have a breakpoint in my contoller on the line that calls the service function, but I get "Unable to automatically debug "MyCodeLibrary". The remote procedure could not be debugged. This usually indicates that debuggin has not been enabled on the server." I have on the service and the mvc project. My code to call the function is:WebChannelFactory…
Read More