2018-10-22         Alston

dynamic name for associative array in bash

I need to perform the same operations on several different associative arrays in bash. Thus, I'd like to use functions to avoid code duplication. However, I'm having troubles accessing the data inside the function. Here's a minimalistic example:#!/bin/bash# this function works finefunction setValue() { # $1 array name # $2 array index # $3 new value declare -g $1[$2]=$3}# this function doesn'tfunction echoValue() { # $1 array name # $2 array index echo ${$1[$2]}}declare -A arr1=( [v1]=12 [v2]=31 )setValue arr1 v1 55echoValue arr1 v2I've tried ${$1[...

 bash                     3 answers                     47 view
 2018-10-22         Alston

Actions on Google Account Linking - Google accounts cannot be used as Auth endpoint urls per our Account Linking policy

I'm trying to setup account linking in dialogflow agent using this documentation, I've created my credentials from the Google cloud platform. when I'm trying to put that credentials data to Actions on Google console, it gives an error as shown in below picture.I've put these Authorization URL and token URL from my credential JSON.The error says: Google accounts cannot be used as Auth endpoint urls per our Account Linking policyLearn moreI want to know about the following:What this error means.how to solve this issue. The error is exactly what it says - if you are setting...

 oauth                     1 answers                     42 view
 2018-10-22         Alston

how to get initial parameters during updating a form in Django with TemplateView

I have the following class based TemplateView, I want my TemplateView to be like UpdateView.But I am not very sure where to set the form with the instance parameters. I try it in get_context_data but didn't work. Any ideas ? class ProfileUpdateView(generic.TemplateView): template_name = "profile/update_profile.html" def dispatch(self, *args, **kwargs): if self.request.user.is_authenticated(): return super(ProfileUpdateView, self).dispatch(*args, **kwargs) else: return HttpResponseRedirect('/profiles/login') def get_context_data(...

 django                     1 answers                     78 view
 2018-10-22         Alston

NodeJS Mock 3rd party service

I have an example endpoint, when a request is submitted to it, I do another request to a third party service which turns out to be malfunctional at times. I want to simulate this service being malfunctional so my tests can be relevant.Here is some example codeit('should handle malfunctional 3rd party service', done => { Frisby.post(Endpoints.randomEndpoint, { email: 'johndoe@gmail.com', firstName: 'John', lastName: 'Doe' }) .expect('status', 400) .expect('jsonTypes', Common.Types.ErrorModel) .done(done);});On my server side, I have something like..app.post(...

 node.js                     2 answers                     30 view
 2018-10-22         Alston

Calling a custom function in Rasa Actions

I am facing a problem in developing a chatbot using rasa .I am trying to call a custom function in rasa action file. But i am getting an error saying "name 'areThereAnyErrors' is not defined"here is my action class. I want to call areThereAnyErrors function from run method. Could someone please help how to resolve this?class ActionDayStatus(Action):def areThereAnyErrors(procid): errormessagecursor = connection.cursor() errormessagecursor.execute(u"select count(*) from MT_PROSS_MEAGE where pro_id = :procid and msg_T = :messageT",{"procid": procid, "messageT": 'E'})...

 chatbot                     1 answers                     26 view
 2018-10-22         Alston

Merge two projects

I have two individual projects in codename one both are running fine, now I want to merge these two projects into one. I know how I can combine code and class files but I want know how I can combine theme.res file of two projects as there are at least 15-17 form in one theme.res file and it's difficult to create all again. Please suggest if there is any way I can combine two theme.res files or I can use two theme.res files in one project.e.g.Project 1: name: test1 having theme.res file with 12 FormProject 2: name: test2 having theme.res file with 18 FormNew project: name:Me...

 codenameone                     1 answers                     96 view
 2018-10-22         Alston

Xamarin.iOS UIDocumentPickerViewController

I have a question regarding iOS document picker.I have included iCloud container / enabled the iCloud for our provisioning. Also added the needed Cloudkit requirements for the Xamarin.iOS itself. However, I have a problem launching the popover menu to show the browse file menu for iOS.var documentPicker = new UIDocumentPickerViewController(allowedUtis, UIDocumentPickerMode.Import);documentPicker.DidPickDocument += DocumentPicker_DidPickDocument;documentPicker.WasCancelled += DocumentPicker_WasCancelled;documentPicker.DidPickDocumentAtUrls += DocumentPicker_DidPickDocumentAt...

 xamarin.forms                     1 answers                     9 view
 2018-10-22         Alston

Displaying a long string in a spinner without cutting

In my current app, if the string is too long and doesn't fit into screen it gets cut. How to display rolling text for long strings in a spinner(i have seen that in some apps)? A Spinner extends AdapterView (like ListView does) which is backed by an Adapter class.So much like you can customise each row in a ListView, you should be able to do the same for your Spinner by overriding a method like Adapter.getView().There you could return a simple TextView with the ellipsize property. [XXX]If you are using a textview look at the ellipsize property with the marquee option. ...

 android                     2 answers                     33 view
 2018-10-22         Alston

How to merge two columns using sql?

This question is an exact duplicate of: How to merge two columns in sql and display it into a separate record 3 answers Use UNION ALL:select foo from tablenameunion allselect bar from tablename [XXX]Use UNIONSELECT foo as new_col FROM MyTableUNIONSELECT bar FROM MyTableOr UNION ALL if you're intrested in duplicates. [XXX]SELECT foo FROM tUNION ALLSELECT bar FROM t [XXX]Use Union all Select foo from a Union all Select bar from a [XXX]what about...select foo f...

 mysql                     5 answers                     92 view
 2018-10-22         Alston

Sql = how to calculate the return vector with a time series of prices?

I have a table which has columns of price and date, ordered by the ascending dates. I need to calculate from this a return vector where return = price ( i) / price ( i- 1). The time is not time based, which means that one record can be at 9h34, the next at 9h35, then 9h40 etc...I have found the following topic:SQL Syntax for calculating results of returned databut in Oracle I can't use order by in a subquery, could you please help me? In Oracle, you could use the lag analytic function:select price / (lag(price) over (order by i)), ...from PriceHistoryHere, lag(pr...

 sql                     1 answers                     5 view
 2018-10-22         Alston

To Fortify, what constitutes validating an integer?

I'm using Fortify static code analyzer with a C#/.NET project. I'm taking an integer parameter, a year, from user input and starting a process with that: int y = int.Parse(Year.SelectedValue); //Year is a DropDownList if (y >= 2017 && y <= DateTime.Today.Year) Process.Start(new ProcessStartInfo(Server.MapPath("~/bin/SomeProgram.exe"), "/x:" + y.ToString()));Fortify doesn't like that, throws a "Command Injection" issue: Data enters the application from an untrusted source. In this case the data enters at get_SelectedValue() in c...

 c#                     1 answers                     52 view
 2018-10-22         Alston

change connection/database at runtime (Entity Framework)

I created an application, that reads some variables from machine tool and uploads them to local SQL server. There are two vpossibilities where to run the applicationdirectly on Machine tool (there is iPC with SQL server)on my own PCIn my app.config I have 2 connection strings: <connectionStrings><!--<add name="Entities" connectionString="metadata=res://*/TosEntityModel.csdl|res://*/TosEntityModel.ssdl|res://*/TosEntityModel.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=WIN-652OQC8T8TT;initial catalog=TOSVariableDatabase....

 c#                     1 answers                     76 view
 2018-10-22         Alston

apt-get update in a dockerfile destroys app consistency?

In the dockerfiles I have seen, and the in the best practices for writing a docker file: https://docs.docker.com/engine/reference/builder/#copy, when apt-get is used to install some packages, apt-get update is always run first. I have a concern on this because the app we build in the corresponding docker container would depend on these installed packages, if there is some inconsistency in the newest version of the installed packages, the software we build will not work right any more. Why we do not specify a version of the packages, but use apt-get update instead? From t...

 dockerfile                     1 answers                     13 view
 2018-10-22         Alston


I try to go over the tutorial/presentation at http://learnwindowsazure.sourceforge.net/, and I cannot reproduce the steps related to node.When I run Add-AzureNodeWebRole command I get Add-AzureNodeWebRole : service root is invalid or emptyAlso when running the previous command, New-AzureService", there aren't any files created in the folder.What would this exactly mean? you need to run the cmdlet New-AzureServiceProject not New-AzureService. [XXX]

 node.js                     1 answers                     86 view
 2018-10-22         Alston

Difference between const auto & and auto & if object of reference is const

// case 1const int i = 42;const auto &k = i;// case 2const int i = 42;auto &k = i;Do we need the const keyword before auto in this scenario? After all, a reference (k) to an auto-deduced type will include the top level const of the object (const int i). So I believe k will be a reference to an integer that is constant (const int &k) in both cases.If that is true, does that mean that const auto &k = i; in case 1 is replaced by the compiler as just const int &k = i; (auto being replaced with int)? Whereas in case 2, auto is replaced with const int? auto...

 c++                     5 answers                     102 view
 2018-10-22         Alston

How to access view inside activity from adapter in android?

Does anyone knows how to access adapter imageView inside activity to hide the view. Please specify any example. I hope this will work for you.By using SharedPreferences we can easily hide the view from activity or fragment.Save flag in SharedPreferences i.e true from activity.If you are using Recyclerview then in onBindViewHolder method check conditionif(flag==true){ holder.yourView.setVisibility(View.GONE);}else{ holder.yourView.setVisibility(View.VISIBLE);} [XXX]Go to onBindViewHolder of the adapter and take the id of your imageview and code like thisholder.mI...

 android                     3 answers                     72 view

Page 1 of 145  |  Show More Pages:  Top Prev Next Last