text:
Q: Importing local changes of a package without pushing code in Golang I' am learning Golang now-a-days and a total newbie. I have a question regarding packages.
Consider the following scenario:
Imagine I have a package github.com/ilatif/A in which I' am importing another package github.com/ilatif/B, like:
import "github.com/ilatif/B"
Now since both github.com/ilatif/A and github.com/ilatif/B are my packages and I' am working locally on them, is there a way to pull changes from github.com/ilatif/B package without pushing code to GitHub? As per Golang's documentation, I need to push the code to its relevant repo but I was wondering if there is such a way to pull local changes of my own package without pushing it to upstream first.
Thanks

A: Go Module Solution
I could successfully use Golang with modules by using replace in the file go.mod.
https://thewebivore.com/using-replace-in-go-mod-to-point-to-your-local-module/

*

*As soon as you save the go.mod file with the replace statement, Goland recognizes the updated module.

Example

*

*Using replace MODULE_URL => /PATH/TO/MODULE/DIR

*

*No need to specify the version

module github.x.com/services-x/x

go 1.13

require (
    github.com/briandowns/spinner v1.8.0
    github.com/golang/protobuf v1.3.1
    github.com/jinzhu/copier v0.0.0-20190625015134-976e0346caa8
    github.com/marcellodesales/cloner v0.0.0-20191126082454-c952bef1e067
    github.com/mitchellh/go-homedir v1.1.0
    github.com/mitchellh/mapstructure v1.1.2
    github.com/sirupsen/logrus v1.2.0
    github.com/spf13/cobra v0.0.5
    github.com/spf13/viper v1.4.0
    github.com/thoas/go-funk v0.4.0
    gopkg.in/src-d/go-git.v4 v4.13.1
    gopkg.in/yaml.v2 v2.2.2
)

replace github.com/marcellodesales/cloner => /Users/mdesales/dev/github.com/marcellodesales/cloner


text:
Q: "\ /" in path error of ndk-build in Win7 Why does the \ / backslash frontslash occur in the path when I run ndk-build in my projects folder? Is that valid syntax?
I'm following the example in the book "Learning Android" by O'REILLY Marko Gargenta chapter 15. How to use the ndk-build command is not explaind "just do it!" And of course precisely that part fails mysteriously.
There is an Android.mk file in the jni folder. But I fail to target it for ndk-build.
I use ADT and NDK in Eclipse on Windows 7. The \ / backslash frontslash in the error message below cannot be quoted here, I mark its place with !!!BACKSLASHFRONTSLASH!!!
C:\Users\John\workspace\TestProject\>C:\adt-bundle-windows-x86_64-20131030\android-ndk-r9c\ndk-build Android NDK: Your APP_BUILD_SCRIPT points to an unknown file: C:\Users\John\workspace\/jni/Android.mk
C:/adt-bundle-windows-x86_64-20131030/android-ndk-r9c/build/core/add-application.mk:187: *** Android NDK: Aborting...    .  Stop.

redpajama_set_name: RedPajamaStackExchange


text:
Q: dumb SQL Q: Count from a query I'm sure this will probably get knocked as a duplicate but I cannot for the life of me figure out what is going on in an SQL query. Currently I am running two separate queries to 1). gather the table content I want and 2). run the same query just instead count...
First thing is first It's postgres. In the query it is paginated by the limit clause so I think I'm off to a bad start but I'm asking a dumb question already might as well commit to it.
SELECT *
        FROM test_case_versions v
            INNER JOIN test_cases t ON v.version_id = t.current_version
            LEFT OUTER JOIN categories_full c ON c.category_id = t.category_id
            INNER JOIN test_case_labels tcl ON tcl.test_case_id = t.test_case_id
            INNER JOIN labels l on l.label_id = tcl.label_id
        WHERE c.product_id = " . $user->product_id . "
            AND label_name ILIKE '$search2'
        ORDER BY t.test_case_id ASC
        LIMIT " . SEARCH_RESULTS_PER_PAGE . " OFFSET $offset";

So that statement gets me a result_set but only hands me back 100 results out of lets say 15000 because of the limit clause below.
Is there any way BEFORE I run my limit clause to count the total results or is this not possible?
Any help would be greatly appreciated

A: Something like this might work.
SELECT *
  FROM (SELECT v.*,
               t.*,
               c.*,
               tcl.*,
               l.*,
               COUNT(*) OVER() AS cnt
          FROM test_case_versions v
         INNER
          JOIN test_cases t
            ON v.version_id = t.current_version
          LEFT
          JOIN categories_full c
            ON c.category_id = t.category_id
         INNER
          JOIN test_case_labels tcl
            ON tcl.test_case_id = t.test_case_id
         INNER
          JOIN labels l
            ON l.label_id = tcl.label_id
         WHERE c.product_id = " . $user->product_id . "
           AND label_name ILIKE '$search2'
       ) AS TMP
 ORDER
    BY test_case_id ASC
 LIMIT " . SEARCH_RESULTS_PER_PAGE . " OFFSET $offset";

A: I get this question a lot, and my answer is always the same: why would you have to know the EXACT number of rows? Do you EVER look at the number of hits when you look up something in Google, and if you do, do you think it is an exact number?
The whole purpose of paging results, is that you limit the burden on the server (and on the network), it kind of defeats that purpose if you do a count of all the records.


text:
Q: How to set font strikethrought in PowerPoint, Office 365? I run PowerPoint in Office 365.
How to set font StrikeThrough in PowerPoint with C#?
StrikeThrough doesn´t exist under PowerPoint Cell, TextFrame, TextRange and Font (StrikeThrough exist for Word and Excel).
Here is my code and I want t to add StrikeThrough as well in PowerPoint:
for (int r = 0; r < powerpointTable.Table.Rows.Count; r++)
{
    for (int c = 0; c < powerpointTable.Table.Columns.Count; c++)
    {
         string cellData = "XXX";
         PowerPoint.Cell cell = powerpointTable.Table.Cell(r + 1, c + 1);
         PowerPoint.TextFrame txFrm = cell.Shape.TextFrame;
         PowerPoint.TextRange range = txFrm.TextRange;
         range.Font.Color.RGB = ColorTranslator.ToOle(Color.Black);
         range.Font.Bold = MsoTriState.msoFalse;
         range.Font.Italic = MsoTriState.msoFalse;
         range.Font.Underline = MsoTriState.msoFalse;
         range.Text = cellData;
    }

}

powerpointTable is my table I PowerPoint and I using
PowerPoint = Microsoft.Office.Interop.PowerPoint;


text:
Q: obiee 11g installation stuck at 14 of 15 steps I'm installing OBIEE 11.1.1.9.0 on my windows server 2019 standard Evaluation,
I'm stuck at 14th of 15 steps please find the screen shot below for that

it stuck at 26% for more than 2 hours and the elapsed time is keep on increasing
my server hardware free space is
> 16 ram and 25-30 GB hard disk free memory
and OS is windows 10

A: You're talking about installing on Windows 2019 and then you say Windows 10. That's contradictory but actually doesn't matter because neither is supported. OBI 11.1.1.9 is ages old and only ever supported up to Windows 2012R2.
https://www.oracle.com/technetwork/middleware/bi/bi-11gr1certmatrix-11-1-1-9-0-2541437.xls

A: If you are using a virtual machine make sure that the number of CPU cores you are using is >= 2, this is one of the issues that makes the installation freeze.


text:
Q: There exists digraph of order 2 or bigger having every two distinct vertices of different indegree and outdegree The claim is that  there exists digraph with order two or bigger such that for every two distinct vertices they have unequal outdegree and indegree
This is obviously true for small orders but how to show that generally?

A: See the full graph withoot cycles.
indegee and outdegree of ith vertice is $i-1$ and $n-i-1$

A: Build them recursively:

*

*the order 2 graph is just one directed edge, and the set of out/indegree are $(0,1), (1,0)$.

*Once you have an order $n$ graph that satisfies the condition, add one node and connect it with an edge to every other node, directed such that the new node is the starting point. It's easy to see that the out/indegree are
$$(0,n),(1,n-1),(2,n-2),\dots,(n-1,1),(n,0)$$


text:
Q: SSL alternative for secure handshake?
*

*I'm curious if there's any way that a server can validate a client without knowing that the client is entirely "friendly" code that isn't monitoring 1) the user's input or 2) network requests.

The only way I could conceive of this is if browsers have a built-in, secure, isolated shell / scope that can hash and send data (which can be verified with a complimenting server unhashing / lookup script).

*Is there any browser-supported (non-DOM) input/hashing method that can also be installed on the server to identify the authenticity or user input? I want to avoid Chrome Extensions and potential keylogging in general, but I'm not sure any browser supports this feature.

Thanks

EDIT
I think some form of 2-step auth in a separate window would be the closest, but I don't have SSL, and I don't like the presentation of random "popup" windows

A: If I understand your question correctly you are asking for a proof that the data entered into a form are neither manipulated nor generated by malicious software. But you (as operator of the server) don't have control of the client.
This is impossible as long as you don't have control of the client because it is impossible to distinguish user generated data from software generated data on the network level, and that's all you get at the server. Even the output generated by a browser extension can be faked.

I think some form of 2-step auth would be the closest

2FA is relevant for authentication of the client only and provides no way of making user generated data tamper resistant.

SSL alternative for secure handshake?

SSL only protects the transport and does not prevent modification of the user input within a malicious browser extension or similar. It also does not protect against malicious man in the middle on the clients machine (i.e. Superfish or similar).


text:
Q: Fastify - TypeError: Cannot read property 'length' of undefined When i created a new API with fastify, while testing it, it was throwing
TypeError: Cannot read property 'length' of undefined

      at next (node_modules/fastify/lib/route.js:407:32)
      at preParsingHookRunner (node_modules/fastify/lib/route.js:438:3)
      at runPreParsing (node_modules/fastify/lib/route.js:389:5)
      at Object.routeHandler [as handler] (node_modules/fastify/lib/route.js:349:7)
      at Router.lookup (node_modules/find-my-way/index.js:356:14)

The control doesn't even pass to the routes and when i checked the file mentioned in the stack trace, it seems to be related with preParser

A: The error message specifically indicates that the property length is being called on an undefined value. This could be due to an issue with the data being passed to the preParsing hook, or a problem with the code inside the hook itself.

A: It was apparently a JSON Schema issue.
In one of the routes, I had the schema like this,
{
  type: "object",
  required: ["fileType"],
  properties: {
    fileType: {
      type: {
         type: "string",
         enum: ["a", "b", "c", "d", "all"]
      }
    }
  }
}

Which is wrong, and it should be,
{
  type: "object",
  required: ["fileType"],
  properties: {
    fileType: {
      type: "string",
      enum: ["a", "b", "c", "d", "all"]
    }
  }
}


text:
Q: Creating a dynamic SQL Query from Python I am using the below set of parameters to create a dynamic sql query and running it from python.
target_column = 'connect_status'
table_name = 'public.main_table'

query_params = {'month_date' : '201801',
                'churn_date' : ['201802','201803','201804'],
                'disco_target' : '1-3 Month Disco'
                }

for churn in query_params['churn_date']:
    sql_data_sample = str("""select * from {1}
                                where dt = %(month_date)s
                                and churn_date = %(churn)s
                                and {0} IN (%(disco_target)s,'No Disco') order by random() limit 5000
                                ;""").format(target_column,table_name)
    print (sql_data_sample)

    df_data_sample = pd.read_sql(sql_data_sample,con = cnxn,params = query_params)

However this gives an DatabaseError:
Execution failed on sql 'select * from public.main_table
                                where dt = %(month_date)s
                                and churn_date = %(churn)s
                                and connect_status IN (%(disco_target)s,'No Disco') order by random() limit 5000
                                ;': 'churn'

Can someone please help me to correct this?

A: The problem is because churn is not available in query_params. Modify your code to
for churn in query_params['churn_date']:
    try:
       sql_data_sample = str("""select * from {1}
                            where dt = %(month_date)s
                            and churn_date = %(churn)s
                            and {0} IN (%(disco_target)s,'No Disco') order by random() limit 5000
                            ;""").format(target_column,table_name)
        print (sql_data_sample)

        query_params['churn'] = churn
        df_data_sample = pd.read_sql(sql_data_sample,con = cnxn,params = query_params)
    except (Exception, psycopg2.DatabaseError) as error:
        print(error)

A: Your string format expression references data in your query_params but query_params isn't referenced in the format function's parameters. Have a look at your month_date and disco_target usage.

A: #Use this python to write the dynamic update query for postgreSql
def updateQuery(self,tableName,setFields,setValues,whereFields,whereValues):

    querySetfields = None
    queryWhereFields = None

    # Loop for set fields
    for i in range(len(setFields)):
        if querySetfields is None:
            querySetfields=setFields[i]+"='"+setValues[i]+"'"
        else:
            querySetfields=querySetfields+","+setFields[i]+"='"+setValues[i]+"'"

    # Loop for whereFields
    for i in range(len(whereFields)):
        if queryWhereFields is None:
            queryWhereFields=whereFields[i]+"='"+whereValues[i]+"'"
        else:
            queryWhereFields=queryWhereFields+","+whereFields[i]+"='"+whereValues[i]+"'"

    #Form the complete update query
    query="UPDATE "+tableName+" SET "+querySetfields+" WHERE "+queryWhereFields

    return query


text:
Q: Outlook reply to all gets sent to me, but my address appears nowhere I'm using Outlook 2016 for a few days now. When I reply-all to any email containing more than one address, the email is also sent to me, or at least a copy appears on my inbox.
Please note, my address does not appear on the To, Cc or Bcc while I'm composing the reply.
I've searched for a solution everywhere, but I've only found instances where people reply-all and the sender's address is wrongly appearing on the To/Cc/Bcc.
If it helps, I'm using IMAP and this behavior did not occur while using Outlook 2010.


text:
Q: Showing only most recent record grouped by substrings of two columns I am trying to only show the most recent record based on the criteria of substrings from two columns.
SELECT convert(varchar, DateTime, 100) AS "Date and Time"
    ,Text2 AS Area
    ,Substring(Text1, 1,Charindex('/', Text1)-1) AS Device
    ,(Substring(Text1, Charindex('/', Text1)+1, LEN(Text1)) + Substring(PText6, Charindex(' ', PText6)+1, LEN(PText6))) AS Interlock
    ,Substring(PText7, 1,Charindex(':', PText7)-1) AS Username
FROM a_databse.dbo.a_view AS data
WHERE PText6 LIKE '%BypIn%' AND DateTime = (SELECT MAX(DateTime) FROM
a_database.dbo.a_view WHERE Text1 = data.Text1 AND Interlock = data.Interlock AND PText6 LIKE 'Set%')

In the last line
Interlock = data.Interlock

Needs to be replaced to allow the proper grouping, since the column name "Interlock" isn't valid. However it will only accept true column references such as:
Text1 = data.Text1

but using substrings:
Substring(PText6, Charindex(' ', PText6)+1, LEN(PText6)) = data.Substring(PText6, Charindex(' ', PText6)+1, LEN(PText6))

will throw errors:
Cannot find either column "data" or the user-defined function or aggregate "data.Substring", or the name is ambiguous

A: You need to copy-paste all expressions properly e.g. data.SUBSTRING(PText6, ...) should be SUBSTRING(data.PText6, ...). But you can simplify your query using CROSS APPLY:
SELECT CONVERT(varchar, DateTime, 100) AS "Date and Time"
     , Text2 AS Area
     , data_vars.Device
     , data_vars.Interlock
     , data_vars.Username
FROM a_databse.dbo.a_view AS data
CROSS APPLY (
    SELECT SUBSTRING(Text1, 1, CHARINDEX('/', Text1) - 1) AS Device
         , SUBSTRING(Text1, CHARINDEX('/', Text1) + 1, LEN(Text1)) + SUBSTRING(PText6, CHARINDEX(' ', PText6) + 1, LEN(PText6)) AS Interlock
         , SUBSTRING(PText7, 1, CHARINDEX(':', PText7) - 1) AS Username
) AS data_vars
-- all columns inside data_vars are now accessible inside WHERE, GROUP BY, SELECT and ORDER BY
WHERE PText6 LIKE '%BypIn%' AND DateTime = (
    SELECT MAX(DateTime)
    FROM a_database.dbo.a_view
    WHERE Text1 = data.Text1 AND Interlock = data_vars.Interlock AND PText6 LIKE 'Set%'
)


text:
Q: Using .sh file to return the number of files in a directory I have written the script below but it returns 0 for the number of files in the directory now matter how many files are in the directory.
source ~/Alan/assign/changeDir.sh
num=$(( ls | wc -l ))
echo $num

changeDir.sh script is the following
function my_cd() {
cd ~/Alan
}

All I need is a number to be returned in order for it to be used later in the same script. I would very much appreciate guidance on this. Thanks

A: To find the number of names in a single directory, expand the * glob in it and count the number of generated words:
shopt -s nullglob    # to make the * glob expand to nothing
                     # if there is no matching names
set -- *
num=$#

printf '%s\n' "$num"

The special value $# is the number of positional parameters.  The set command sets the positional parameters.
Would you want to count regular files only, and include hidden names, then use
shopt -s nullglob dotglob

for name in *; do
    if [ ! -f "$name" ] || [ -L "$name" ]; then
        # skip non-regular files and symbolic links
        continue
    fi
    files+=( "$name" )
done

num=${#files[@]}

printf '%s\n' "$num"

To do that recursively into subdirectories, also set the globstar shell option and use **/* as the globbing pattern.
(in the zsh shell, it would be enough with set -- **/*(.DN); print $#)
The issue with your
num=$(( ls | wc -l ))

is twofold:

*

*$(( ... )) is an arithmetic expansion. You probably want a command substitution here, $( ... ).

*The wc -l will not count files.  It will count the number of newline characters outputted by ls.  A file with one or more newlines in its name will be counted as multiple files by wc -l. You can test this by creating such a file using touch $'hello\nworld'.

A: If you want to count files including hidden files (.*) , but have subdirectories excluded, you can use:
find . -maxdepth 1 -type f -printf '.' | wc -c

All benefits of find may be used.

A: I think the problem is a wrong syntax in your command substitution.
The command
num=$(( expression ))

will interpret the content of the parentheses as an arithmetic expression and assign the numerical result to num. It will not return the output of running that which is written inside the parentheses as code. Rather, ls, wc and l will be interpreted as shell variables, and the operation "$ls OR $wc minus $l" be performed, which results in zero as none of these "variables" are initialized.
What you are probably trying to do would be written as
num="$(ls | wc -l)"

However, even so, parsing the output of ls is not a good idea in general. Rather, look at some of the answers to this similar question where "robust" solutions are presented that will also work when filenames contain special characters.


text:
Q: Hyperlink on text adds url to output I am using latex to build my resume.
I am trying to hyperlink an entire paragraph.
I am refering the official overleaf documenattion for using hyperlinks.
They mention to use the \href{url}{text} to combine hyperlink with text.
Unfortunately, I have some additional tags that I want to combine my hyperlink with.
\cvachievement{\faTrophy}{paragraph_title}{paragraph_description}

What I tried:
\href{url}{

    \cvachievement{\faTrophy}{paragraph_title}{paragraph_description }
}

But this also adds the URL to the final output. How do I fix this?

A: There is no working (complete) example to test what I'm saying. Also I'm not entirely sure what errors you get (if any).
BUT, have you tried to add the \href into the brackets?
For instance:
\providecommand{\achieved}[3]{\cvachievement{\faTrophy}{\href{#3}{#1}}{\href{#3}{#2}}}

You just call it with \achieved{paragraph_title}{paragraph_description}{url}.
Hope that helps.


text:
Q: Android Studio use gradle offline I had to install Android studio on offline machine.
After I create a project, I get bunch of errors, referred to Gradle. How can I make it build offline?
P.S. I'm completely new to Android and java. Help me, please.


text:
Q: Installing Chocolatey Remotely and Get Packages Remotely I am trying to install chocolatey using Jenkins to a Windows Machine that i would like to provision with some chocolatey packages.
It seems that the install log looks pretty good to me.
[10:20:21][Step 4/4]  [0;36mnotice: /Stage[main]/Chocolatey/Exec[ChocolateyInstall]/returns: Downloading http://chocolatey.org/api/v2/package/chocolatey/ to C:\Users\_BUILD~1\AppData\Local\Temp\chocolatey\chocInstall\chocolatey.zip [0m
[10:20:21][Step 4/4]  [0;36mnotice: /Stage[main]/Chocolatey/Exec[ChocolateyInstall]/returns: Extracting C:\Users\_BUILD~1\AppData\Local\Temp\chocolatey\chocInstall\chocolatey.zip to ... [0m
[10:20:21][Step 4/4]  [0;36mnotice: /Stage[main]/Chocolatey/Exec[ChocolateyInstall]/returns: Installing chocolatey on this machine [0m
[10:20:21][Step 4/4]  [0;36mnotice: /Stage[main]/Chocolatey/Exec[ChocolateyInstall]/returns: Creating ChocolateyInstall as a User Environment variable and setting it to 'C:\Chocolatey' [0m
[10:20:21][Step 4/4]  [0;36mnotice: /Stage[main]/Chocolatey/Exec[ChocolateyInstall]/returns: We are setting up the Chocolatey repository for NuGet packages that should be at the machine level. Think executables/application packages, not library packages. [0m
[10:20:21][Step 4/4]  [0;36mnotice: /Stage[main]/Chocolatey/Exec[ChocolateyInstall]/returns: That is what Chocolatey NuGet goodness is for. [0m
[10:20:21][Step 4/4]  [0;36mnotice: /Stage[main]/Chocolatey/Exec[ChocolateyInstall]/returns: The repository is set up at 'C:\Chocolatey'. [0m
[10:20:21][Step 4/4]  [0;36mnotice: /Stage[main]/Chocolatey/Exec[ChocolateyInstall]/returns: The packages themselves go to 'C:\Chocolatey\lib' (i.e. C:\Chocolatey\lib\yourPackageName). [0m
[10:20:21][Step 4/4]  [0;36mnotice: /Stage[main]/Chocolatey/Exec[ChocolateyInstall]/returns: A batch file for the command line goes to 'C:\Chocolatey\bin' and points to an executable in 'C:\Chocolatey\lib\yourPackageName'. [0m
[10:20:21][Step 4/4]  [0;36mnotice: /Stage[main]/Chocolatey/Exec[ChocolateyInstall]/returns:  [0m
[10:20:21][Step 4/4]  [0;36mnotice: /Stage[main]/Chocolatey/Exec[ChocolateyInstall]/returns: Creating Chocolatey NuGet folders if they do not already exist. [0m
[10:20:21][Step 4/4]  [0;36mnotice: /Stage[main]/Chocolatey/Exec[ChocolateyInstall]/returns:  [0m
[10:20:21][Step 4/4]  [0;36mnotice: /Stage[main]/Chocolatey/Exec[ChocolateyInstall]/returns: d----         2/13/2013  10:20 AM            bin                                [0m
[10:20:21][Step 4/4]  [0;36mnotice: /Stage[main]/Chocolatey/Exec[ChocolateyInstall]/returns: d----         2/13/2013  10:20 AM            lib                                [0m
[10:20:21][Step 4/4]  [0;36mnotice: /Stage[main]/Chocolatey/Exec[ChocolateyInstall]/returns: d----         2/13/2013  10:20 AM            chocolateyinstall                  [0m
[10:20:21][Step 4/4]  [0;36mnotice: /Stage[main]/Chocolatey/Exec[ChocolateyInstall]/returns: Copying the contents of 'C:\Users\buildaccount\AppData\Local\Temp\chocolatey\chocInstall\tools\chocolateyInstall' to 'C:\Chocolatey'. [0m
[10:20:21][Step 4/4]  [0;36mnotice: /Stage[main]/Chocolatey/Exec[ChocolateyInstall]/returns: Creating 'C:\Chocolatey\bin\chocolatey.bat' so you can call 'chocolatey' from anywhere. [0m
[10:20:21][Step 4/4]  [0;36mnotice: /Stage[main]/Chocolatey/Exec[ChocolateyInstall]/returns: Creating 'C:\Chocolatey\bin\cinst.bat' so you can call 'chocolatey install' from a shortcut of 'cinst'. [0m
[10:20:21][Step 4/4]  [0;36mnotice: /Stage[main]/Chocolatey/Exec[ChocolateyInstall]/returns: Creating 'C:\Chocolatey\bin\cinstm.bat' so you can call 'chocolatey installmissing' from a shortcut of 'cinstm'. [0m
[10:20:21][Step 4/4]  [0;36mnotice: /Stage[main]/Chocolatey/Exec[ChocolateyInstall]/returns: Creating 'C:\Chocolatey\bin\cup.bat' so you can call 'chocolatey update' from a shortcut of 'cup'. [0m
[10:20:21][Step 4/4]  [0;36mnotice: /Stage[main]/Chocolatey/Exec[ChocolateyInstall]/returns: Creating 'C:\Chocolatey\bin\clist.bat' so you can call 'chocolatey list' from a shortcut of 'clist'. [0m
[10:20:21][Step 4/4]  [0;36mnotice: /Stage[main]/Chocolatey/Exec[ChocolateyInstall]/returns: Creating 'C:\Chocolatey\bin\cver.bat' so you can call 'chocolatey version' from a shortcut of 'cver'. [0m
[10:20:21][Step 4/4]  [0;36mnotice: /Stage[main]/Chocolatey/Exec[ChocolateyInstall]/returns: Creating 'C:\Chocolatey\bin\cwebpi.bat' so you can call 'chocolatey webpi' from a shortcut of 'cwebpi'. [0m
[10:20:21][Step 4/4]  [0;36mnotice: /Stage[main]/Chocolatey/Exec[ChocolateyInstall]/returns: Creating 'C:\Chocolatey\bin\cwindowsfeatures.bat' so you can call 'chocolatey windowsfeatures' from a shortcut of 'cwindowsfeatures'. [0m
[10:20:21][Step 4/4]  [0;36mnotice: /Stage[main]/Chocolatey/Exec[ChocolateyInstall]/returns: Creating 'C:\Chocolatey\bin\ccygwin.bat' so you can call 'chocolatey cygwin' from a shortcut of 'ccygwin'. [0m
[10:20:21][Step 4/4]  [0;36mnotice: /Stage[main]/Chocolatey/Exec[ChocolateyInstall]/returns: Creating 'C:\Chocolatey\bin\cpython.bat' so you can call 'chocolatey python' from a shortcut of 'cpython'. [0m
[10:20:21][Step 4/4]  [0;36mnotice: /Stage[main]/Chocolatey/Exec[ChocolateyInstall]/returns: Creating 'C:\Chocolatey\bin\cgem.bat' so you can call 'chocolatey gem' from a shortcut of 'cgem'. [0m
[10:20:21][Step 4/4]  [0;36mnotice: /Stage[main]/Chocolatey/Exec[ChocolateyInstall]/returns: Creating 'C:\Chocolatey\bin\cpack.bat' so you can call 'chocolatey pack' from a shortcut of 'cpack'. [0m
[10:20:21][Step 4/4]  [0;36mnotice: /Stage[main]/Chocolatey/Exec[ChocolateyInstall]/returns: Creating 'C:\Chocolatey\bin\cpush.bat' so you can call 'chocolatey push' from a shortcut of 'cpush'. [0m
[10:20:21][Step 4/4]  [0;36mnotice: /Stage[main]/Chocolatey/Exec[ChocolateyInstall]/returns: Creating 'C:\Chocolatey\bin\cuninst.bat' so you can call 'chocolatey uninstall' from a shortcut of 'cuninst'. [0m
[10:20:21][Step 4/4]  [0;36mnotice: /Stage[main]/Chocolatey/Exec[ChocolateyInstall]/returns:  [0m
[10:20:21][Step 4/4]  [0;36mnotice: /Stage[main]/Chocolatey/Exec[ChocolateyInstall]/returns: PATH environment variable does not have 'C:\Chocolatey\bin' in it. Adding. [0m
[10:20:21][Step 4/4]  [0;36mnotice: /Stage[main]/Chocolatey/Exec[ChocolateyInstall]/returns: Processing ccygwin.bat to make it portable [0m
[10:20:21][Step 4/4]  [0;36mnotice: /Stage[main]/Chocolatey/Exec[ChocolateyInstall]/returns: Processing cgem.bat to make it portable [0m
[10:20:21][Step 4/4]  [0;36mnotice: /Stage[main]/Chocolatey/Exec[ChocolateyInstall]/returns: Processing chocolatey.bat to make it portable [0m
[10:20:21][Step 4/4]  [0;36mnotice: /Stage[main]/Chocolatey/Exec[ChocolateyInstall]/returns: Processing cinst.bat to make it portable [0m
[10:20:21][Step 4/4]  [0;36mnotice: /Stage[main]/Chocolatey/Exec[ChocolateyInstall]/returns: Processing cinstm.bat to make it portable [0m
[10:20:21][Step 4/4]  [0;36mnotice: /Stage[main]/Chocolatey/Exec[ChocolateyInstall]/returns: Processing clist.bat to make it portable [0m
[10:20:21][Step 4/4]  [0;36mnotice: /Stage[main]/Chocolatey/Exec[ChocolateyInstall]/returns: Processing cpack.bat to make it portable [0m
[10:20:21][Step 4/4]  [0;36mnotice: /Stage[main]/Chocolatey/Exec[ChocolateyInstall]/returns: Processing cpush.bat to make it portable [0m
[10:20:21][Step 4/4]  [0;36mnotice: /Stage[main]/Chocolatey/Exec[ChocolateyInstall]/returns: Processing cpython.bat to make it portable [0m
[10:20:21][Step 4/4]  [0;36mnotice: /Stage[main]/Chocolatey/Exec[ChocolateyInstall]/returns: Processing cuninst.bat to make it portable [0m
[10:20:21][Step 4/4]  [0;36mnotice: /Stage[main]/Chocolatey/Exec[ChocolateyInstall]/returns: Processing cup.bat to make it portable [0m
[10:20:21][Step 4/4]  [0;36mnotice: /Stage[main]/Chocolatey/Exec[ChocolateyInstall]/returns: Processing cver.bat to make it portable [0m
[10:20:21][Step 4/4]  [0;36mnotice: /Stage[main]/Chocolatey/Exec[ChocolateyInstall]/returns: Processing cwebpi.bat to make it portable [0m
[10:20:21][Step 4/4]  [0;36mnotice: /Stage[main]/Chocolatey/Exec[ChocolateyInstall]/returns: Processing cwindowsfeatures.bat to make it portable [0m
[10:20:21][Step 4/4]  [0;36mnotice: /Stage[main]/Chocolatey/Exec[ChocolateyInstall]/returns: Chocolatey is now ready. [0m
[10:20:21][Step 4/4]  [0;36mnotice: /Stage[main]/Chocolatey/Exec[ChocolateyInstall]/returns: You can call chocolatey from anywhere, command line or powershell by typing chocolatey. [0m
[10:20:21][Step 4/4]  [0;36mnotice: /Stage[main]/Chocolatey/Exec[ChocolateyInstall]/returns: Run chocolatey /? for a list of functions. [0m
[10:20:21][Step 4/4]  [0;36mnotice: /Stage[main]/Chocolatey/Exec[ChocolateyInstall]/returns: You may need to shut down and restart powershell and/or consoles first prior to using chocolatey. [0m
[10:20:21][Step 4/4]  [0;36mnotice: /Stage[main]/Chocolatey/Exec[ChocolateyInstall]/returns: If you are upgrading chocolatey from an older version (prior to 0.9.8.15) and don't use a custom chocolatey path, please find and delete the C:\NuGet folder after verifying that C:\Chocolatey has the same contents (minus chocolateyinstall of course). [0m
[10:20:21][Step 4/4]  [0;36mnotice: /Stage[main]/Chocolatey/Exec[ChocolateyInstall]/returns: Ensuring chocolatey commands are on the path [0m
[10:20:21][Step 4/4]  [0;36mnotice: /Stage[main]/Chocolatey/Exec[ChocolateyInstall]/returns:  [0m
[10:20:21][Step 4/4]  [0;36mnotice: /Stage[main]/Chocolatey/Exec[ChocolateyInstall]/returns:  [0m
[10:20:21][Step 4/4]  [0;36mnotice: /Stage[main]/Chocolatey/Exec[ChocolateyInstall]/returns:  [0m

However when I try to install a simple package remotely using a puppet client it complains about a .NET Framework 4.0 error.
[10:20:24][Step 4/4]  [0;36mnotice: /Stage[main]/Hg/Exec[hg]/returns: Chocolatey (v0.9.8.20) is installing  and dependencies. By installing you accept the license for  and each dependency you are installing. [0m
[10:20:24][Step 4/4]  [0;36mnotice: /Stage[main]/Hg/Exec[hg]/returns: Execution of NuGet not detected. Please make sure you have .NET Framework 4.0 i [0m
[10:20:24][Step 4/4]  [0;36mnotice: /Stage[main]/Hg/Exec[hg]/returns: nstalled and are passing arguments to the install command. [0m
[10:20:24][Step 4/4]  [0;36mnotice: /Stage[main]/Hg/Exec[hg]/returns: At C:\Chocolatey\chocolateyinstall\functions\Run-NuGet.ps1:52 char:10 [0m
[10:20:24][Step 4/4]  [0;36mnotice: /Stage[main]/Hg/Exec[hg]/returns: +     Throw <<<<  $noExecution [0m
[10:20:24][Step 4/4]  [0;36mnotice: /Stage[main]/Hg/Exec[hg]/returns:     + CategoryInfo          : OperationStopped: (Execution of Nu...nstall comm  [0m
[10:20:24][Step 4/4]  [0;36mnotice: /Stage[main]/Hg/Exec[hg]/returns:    and.:String) [], RuntimeException [0m
[10:20:24][Step 4/4]  [0;36mnotice: /Stage[main]/Hg/Exec[hg]/returns:     + FullyQualifiedErrorId : Execution of NuGet not detected. Please make sur  [0m
[10:20:24][Step 4/4]  [0;36mnotice: /Stage[main]/Hg/Exec[hg]/returns:    e you have .NET Framework 4.0 installed and are passing arguments to the i   [0m
[10:20:24][Step 4/4]  [0;36mnotice: /Stage[main]/Hg/Exec[hg]/returns:   nstall command. [0m
[10:20:24][Step 4/4]  [0;36mnotice: /Stage[main]/Hg/Exec[hg]/returns:   [0m
[10:20:24][Step 4/4]  [0;36mnotice: /Stage[main]/Hg/Exec[hg]/returns: executed successfully [0m

A: Do you have .NET 4.0 installed on the machine?


text: Q: Preserve Folder Structure State With CocoaPods Is it possible to preserve the folder structure expand/collapse state upon running pod install / update? Whenever I run the command to update my Pods with my project open, it will collapse all my folders. I'm running XCode 6.1.1.


text:
Q: Managing the output rate for a queue triggered service I have a service which is triggered by messages from three queues (which are populated by different topics), and writes the processed results to another system (say DB service) synchronously. The incoming messages are of type insertion, update and deletion of data for the customers of our system. So ordering of the handling of the messages is important, i.e. if we get messages like:
Timestamp 1: (Queue1, Update single entity message)
Timestamp 2: (Queue2: Delete all data message)

And if the services processes queue1 message after processing queue2 message, then we would reach an undesirable state, since we would be storing data for the customer even though the latest activity from them was to ask for deleting all of their data.
To complicate matters, the service where we write our results throttles our calls, allowing only a fixed number of transactions by a customer per second. This leads our service to regularly send incoming messages to the dlq after five failures, which further messes up the order in which we write our results to the DB service.
I'm trying to solve the problem of the messages frequently ending up in the dlq, and considering the following approaches:
Approach 1: If a message is throttled, sleep for some time and retry writing again. I'd need to increase the retry count for the synchronous calls and increase the timeout after which the service makes the message available in the queue again.
Pros:

*

*Good chance of processing a message once the service handles it.

Cons:

*

*Messes up the ordering of the messages. Though this would still be better than the current scenario of message being in the dlq and being manually redriven after a couple of days.

*If threads are waiting, holding a message, it would slow down the processing of the incoming events, and I would need to scale up the system to have a similar throughput rate.

*If the DB service is operating a fraction of its capacity, multiple retries may brown out the service.

Approach 2: Token bucket: When the service wants to read a message, it needs to have a token available. Once it gets the token, reads, processes the messages, and writes to the DB service. Once it is done successfully writing to the DB service, it puts back the token. Since there are a fixed number of tokens, lining up with the throttle rate of the DB service, the rate of the incoming messages is controlled, which eventually controls the output rate of the service.
Pros:

*

*Good chance of processing a message once the service handles it.

Cons:

*

*Messes up the ordering of messages, for a horizontally scaled up service.

*Additional complexity for maintaining the token bucket logic.

*Need to scale up to match the current throughput rate.

*

*What other approaches can be used to limit the output rate? Is there a common design pattern for these kinds of services to overcome such issues?

*Where can I read up more about these sort of problems and approaches to solve them?

*Is the architecture of my system fundamentally flawed (processing write and delete which need ordering in a horizontally scaled queue based system), and should I work on fixing the architecture instead of trying out ways to solve the side effects of the architectural issues?


text:
Q: How to find matrix common members of matrices in Numpy I have a 2D matrix A and a vector B. I want to find all row indices of elements in A that are also contained in B.
A = np.array([[1,9,5], [8,4,9], [4,9,3], [6,7,5]], dtype=int)
B = np.array([2, 4, 8, 10, 12, 18], dtype=int)

My current solution is only to compare A to one element of B at a time but that is horribly slow:
res = np.array([], dtype=int)
for i in range(B.shape[0]):
    cres, _ = (B[i] == A).nonzero()
    degElem = np.append(res, cres)
res = np.unique(res)

The following Matlab statement would solve my issue:
find(any(reshape(any(reshape(A, prod(size(A)), 1) == B, 2),size(A, 1),size(A, 2)), 2))

However comparing a row and a colum vector in Numpy does not create a Boolean intersection matrix as it does in Matlab.
Is there a proper way to do this in Numpy?

A: We can use np.isin masking.
To get all the row numbers, it would be -
np.where(np.isin(A,B).T)[1]

If you need them split based on each element's occurence -
[np.flatnonzero(i) for i in np.isin(A,B).T if i.any()]

Posted MATLAB code seems to be doing broadcasting. So, an equivalent one would be -
np.where(B[:,None,None]==A)[1]


text:
Q: Custom HTML Error Wrappers for Form Elements I would like to find a way to customize the default error html

To take my own classes:

        Input with error

          <input class="xlarge error" id="errorInput" name="errorInput" size="30" type="text">
          Small snippet of help text

I have found this railscast from 2007 which uses Rails 2, I believe. http://railscasts.com/episodes/39-customize-field-error. It seems like Rails 3 might have a more friendly way to customize this html?
Also, it doesn't show a way to just add an error class directly to the input like I want.

A: The method explained in the link you posted is still used today with the vanilla form builders in Rails.
So, if you wanted to wrap your input like you mention, create a method overriding the ActionView::Base.field_error_proc in your environment.rb file for example, like so:
ActionView::Base.field_error_proc = Proc.new do |html_tag, instance|
  if instance.error_message.kind_of?(Array)
    %(
#{html_tag}
      #{instance.error_message.join(',')}</div).html_safe
  else
    %(
#{html_tag}
      #{instance.error_message}</div).html_safe
  end
end

In the above code, I'm wrapping my input (the #{html_tag}) in a
..
 that's the default used by ZURB Foundation. I'm also using a ...</small tag (which is also the foundation default) to display the messages below the input.
However, I recommend using a form builder gem like simple_form. It cleans up your view code quit a bit and allows for the level of customization you require.
Check out the railscast on it here.
Good luck!


text:
Q: Select an option based on text in drop-down with Laravel Dusk I want to choose a drop-down option based on its text,what should i do?
This is my Html code :
<select name="category">
   <option>Appliances</option>
   <option>Sporting Goods</option>
   <option>Cosmetics</option>
</select>

And this is my selector in dusk :
->select('category','Appliances')

A: You can use XPath:
$selector = "//select[@name='category']/option[text()='Appliances']";
$browser->driver->findElement(WebDriverBy::xpath($selector))->click();

A:
To select a value in a dropdown selection box, you may use the select method. Like the type method, the select method does not require a full CSS selector. When passing a value to the  select method, you should pass the underlying option value instead of the display text:

So give a value to your select fields.
<select name="category">
   <option value="Appliances">Appliances</option>
   <option value="Sporting Goods">Sporting Goods</option>
   <option value="Cosmetics">Cosmetics</option>
</select>

Then use
->select('category','Appliances')

A: <select class="form-select" name="product_category_id_productList_add" id="product_category_id_productList_add">
     <option value="" disabled selected>-- Select Product Category --</option>
       @foreach($product_category_data as $data)
        <option value="{{$data->id}}">{{$data->name}}</option>
       @endforeach
</select>

->select('product_category_id_productList_add', '11')


text:
Q: Disable keyboard when When the user clicks on a UITextField I am showing a UIDatePicker for the input with the code below. But when i do this the datepicker and the normal text keyboard show at the same time. How would i disable the keyboard from displaying?
- (IBAction)selectDateBegin:(id)sender {

if ([self.view viewWithTag:9]) {
    return;
}
CGRect toolbarTargetFrame = CGRectMake(0, self.view.bounds.size.height-216-44, 320, 44);
CGRect datePickerTargetFrame = CGRectMake(0, self.view.bounds.size.height-216, 320, 216);

UIView *darkView = [[UIView alloc] initWithFrame:self.view.bounds];
darkView.alpha = 0;
darkView.backgroundColor = [UIColor blackColor];
darkView.tag = 9;
UITapGestureRecognizer *tapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(dismissDatePicker:)] ;
[darkView addGestureRecognizer:tapGesture];
[self.view addSubview:darkView];

UIDatePicker *datePicker = [[UIDatePicker alloc] initWithFrame:CGRectMake(0, self.view.bounds.size.height+44, 320, 216)] ;
datePicker.tag = 10;
[datePicker addTarget:self action:@selector(changeDate:) forControlEvents:UIControlEventValueChanged];
[self.view addSubview:datePicker];

UIToolbar *toolBar = [[UIToolbar alloc] initWithFrame:CGRectMake(0, self.view.bounds.size.height, 320, 44)];
toolBar.tag = 11;
toolBar.barStyle = UIBarStyleBlackTranslucent;
UIBarButtonItem *spacer = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:nil action:nil];
UIBarButtonItem *doneButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone target:self action:@selector(dismissDatePicker:)];
[toolBar setItems:[NSArray arrayWithObjects:spacer, doneButton, nil]];
[self.view addSubview:toolBar];

[UIView beginAnimations:@"MoveIn" context:nil];
toolBar.frame = toolbarTargetFrame;
datePicker.frame = datePickerTargetFrame;
darkView.alpha = 0.5;
[UIView commitAnimations];}

A: -(void)textFieldDidBeginEditing:(UITextField *)sender
{
     [self.textFieldName resignFirstResponder];
   //
   //  Code ...continue,......for display DatePicker
   //
}

A: Create a separate UIView for your datepicker (with navigation bar having OK and Cancel button) container and then assign it to textfield.inputView property. For more details refer UITextField Class Reference.
This will load your datepicker view instead of default keyboard.
You will find many more examples on net for the same.
Hope this is what you are looking for.


text:
Q: Avoiding select while referring to column by number To start, I am a relative novice at VBA writing (used to using macro record).
I am trying to avoid using Select but only way I know how to loop through columns is using a number reference ... why I am using Cells.  But, can't seem to remove the select if using Cells.
Current code (works but trying to remove the select step):
For i = 1 To 300

Dim ValCol As Long
ValCol = 9 + i

    Sheet19.Select
    Range(Cells(2, ValCol), Cells(23, ValCol)).Copy

    'lRow = Sheet25.Cells(Sheet25.Rows.count, "A").End(xlUp).Row + 1
    Sheet25.Range("J" & lRow & ":J" & lRow + 21).PasteSpecial Paste:=xlPasteValues

 Application.CutCopyMode = False

Next


text:
Q: onMouseMove + onMouseDown to call function I have a real problem over here. I want a function to get called only when an object is clicked and when when the mouse is moved over the object. Here is a (syntax-retarded) example to get your understanding:

I was thinking of a way to solve this. What if I make a onMouseDown that trigger a function that will change the name of my onMouseMove - function, and use a "filler" or a "substitute" function? Let me explain:

Regds..


text:
Q: Can't get source code from an evaluated lambda function I came across this interesting fact and I am wondering how to come over it. By using inspect  it is easy to get the source code of a lambda. But as soon as you return the very same lambda from an eval statement the get source function fails.
import inspect

f = lambda a: a*2
f2 = eval("lambda a: a*2")

inspect.getsource(f), inspect.getsource(f2)

/usr/lib/python3.7/inspect.py in getsource(object)
    971     or code object.  The source code is returned as a single string.  An
    972     OSError is raised if the source code cannot be retrieved."""
--> 973     lines, lnum = getsourcelines(object)
    974     return ''.join(lines)
    975

/usr/lib/python3.7/inspect.py in getsourcelines(object)
    953     raised if the source code cannot be retrieved."""
    954     object = unwrap(object)
--> 955     lines, lnum = findsource(object)
    956
    957     if istraceback(object):

/usr/lib/python3.7/inspect.py in findsource(object)
    784         lines = linecache.getlines(file)
    785     if not lines:
--> 786         raise OSError('could not get source code')
    787
    788     if ismodule(object):

OSError: could not get source code

Is there a way to come over this and get the source of evaluated code?

A:
Functions don't remember their source code - all they know is the
  filename and line numbers they came from. If the function definition
  wasn't in a physical file that is still available, then it is utterly
  impossible for inspect.getsource() to work. You'd need a decompiler,
  instead.

thx, jasonharper


text:
Q: How to copy files from source to target with a unattended bash script? I want to copy files from a source to a target unattended via bash script. I do have options to use sftp, ftp over SSL, rsync, WebDAV, CIFS
I do not have the option to install a SSH key pair on the target side (Strato HiDrive), so scp and sftp won't work, do they?
I have read about a scp -W option to store the Password in a file, but can't find some detailed information about…
any ideas?

A: I think you have two questions here.
Q1 is how should you keep a copy of your files on a remote server. The answer to that is rsync over ssh.
Q2. how to supply a password to ssh when you can't put your key on the remote server. This is answered here:
how to pass password for rsync ssh command
Hope that helps.


text:
Q: #ifdef x64 does not work for windows resource file Recently, I have been trying to get a DLL to have a different InternalName and OriginalFilename based on what platform it is compiled as. If the DLL is set to Release|x64 it should have one name, and if set to Release|x86 it should have another. I use to just have 2 different projects, but felt it was easier to just create an ifdef. The problem is no matter what I do, the InternalName and OriginalFilename ALWAYS end up being the x86 name.
Below I have a small snip from my Resource.h file where I store the ifdef.
The snippet below that is from the dlls .rc file where that detail is defined.
#ifdef WIN64
    // 64 bit windows
    #define DLLNAME                     "MyDLL.dll"
#else
    // 32 bit windows
    #define DLLNAME                     "MyDLL_WIN32.dll"
#endif // _WIN64 or _WIN32

BEGIN
    BLOCK "StringFileInfo"
    BEGIN
        BLOCK "040904b0"
        BEGIN
            VALUE "CompanyName", "Software Company Inc."
            VALUE "FileDescription", "Some DLL"
            VALUE "FileVersion", "1.0.0.1"
            VALUE "InternalName", DLLNAME
            VALUE "LegalCopyright", "Copyright (C) 2019.  All rights reserved."
            VALUE "OriginalFilename", DLLNAME
            VALUE "ProductName", "Some DLL"
            VALUE "ProductVersion", "1.0.0.1"
        END
    END
    BLOCK "VarFileInfo"
    BEGIN
        VALUE "Translation", 0x409, 1200
    END
END

Here are the Preprocessor Definitions I have set.

Any help for what I am doing wrong would be great.

A: If you check the properties on the .RC file, you'll see that it does not inherit the preprocessor definitions used for the C++ compiler.
You'll have to explicitly add the WIN64 definition to the .RC file's options for each configuration that needs it.


text:
Q: Unable to connect mysql database from php  <?php
 $servername = "192.168.179.130";
 $username = "root";
 $password = "";
 $dbname = "rawcdr";
 // Create connection
 $conn = new mysqli($servername, $username, $password, $dbname);
 if ($conn->connect_error) {
    die("Connection failed: " . $conn->connect_error);
 }

The above code gives a warning Warning: mysqli::mysqli(): (HY000/2002) A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. in C:\xampp\htdocs\new_table\index.php on line 59.
The host is a different server (CentOS 7), and i have checked its reach ability.
I have also provided special privilege in mysql server by:
GRANT ALL PRIVILEGES ON *.* TO 'root'@'192.168.%' IDENTIFIED BY PASSWORD '';

Also started the firewall service by:
service firewalld start

Checked the port 3306 is open by following command:
netstat -nlp | grep 3306

A: Of course the first thing to check is that the firewall on the remote machine is not blocking access on port 3306.
But:
The root user account on a MYSQL Server is by default configured so that this account can only be used from the machine running the MySQL Server instance. So by default you cannot use root to access the server remotely.
And that is as it should be. It is afterall the SuperUser account.
EG
`root`@`localhost`

So you are going to have to create a new user on the remote MYSQL Server instance that is allowed to connect from either any remote host dangerous or a specific remote host (your PC's ip address). This new account should also be setup to be allowed access with the required privilages on the database you are trying to access.
CREATE USER 'ayax'@'192.168.1.200' IDENTIFIED BY 'new_password'

Or if its 5.7 server dont forget the new password expire
CREATE USER 'ayax'@'your-ip-address' IDENTIFIED BY 'new_password'
    PASSWORD EXPIRE NEVER;

If your ip address is allocated by a DHCP server and can change from day to day something like this would be more flexible
CREATE USER 'ayax'@'192.168.1.%' IDENTIFIED BY 'new_password'

A: Try this :
$conn = mysqli_connect('192.168.179.130', 'my_user', 'my_password', 'my_db');

if (!$conn) {
  die('Connect Error (' . mysqli_connect_errno() . ') '
          . mysqli_connect_error());
}


text:
Q: Textbook on absolute continuity Can someone please recommend a textbook that gives a substantial treatment of absolute continuity and is accessible (written for students; sticks to the real numbers instead of turning to more abstract generalizations)?

A: A way more substantial (but still accessible) treatment than the one in Royden's book can be found in Leoni's A First Course in Sobolev Spaces.

A: The Wikipedia page on absolute continuity frequently uses Royden, H.L. (1988), Real Analysis (third ed.) as a reference. I think newer editions of this book are co-authored by Fitzpatrick, as Google searching the reference brought me to this pdf. See page 119 in the book numbering, page 130 in the pdf. I hope this helps.


text:
Q: swift json nested parsing I'm trying to parse json and store it in a object but 'Availability' doesn't store anything. Maybe the struct is created wrong? It seems right since it's a array. Maybe there is a library I use? I can store the first struct Article but ArticleOne is always empty.I have to add more comments since stack thinks my post is mostly code.

A: The properties of the struct you are using - ArticleOne - has to be adjusted to the values in the json:
struct ArticleOne: Codable {
    let DemoVehicleAvailabilityId: Int
    let DemoVehicleId: Int
    let AvailabilityDateTime: String
    let IsOnHold: Bool
    let IsBooked: Bool
    let BookedDateTime: String
    let BookedBy: String?
    let IsAvailableForDemo: Bool
    let RiderReferenceId: Int
    let IsCheckedIn: Bool
    let CheckinDateTime: String
    let HoldUntill: String
    let UpdatedDT: String
    let ReservedByName: String?
    let ReservedByEmail: String?
    let ReservedByMobileNumber: String?
    let IsReservationConfirmed: Bool
    let ReservationConfirmDateTime: String
    let IsThisTimeSlotActive: Bool
    let History: [T]
}

T is the type of the elements in History.


text:
Q: Two foreign key referencing to same primary key being used as a composite key[ERD] I want to draw an ERD, showing the relationship between two tables. Below are their sql queries.
CREATE TABLLE USERS(userid INT PRIMARY KEY, name VARCAHR(20));

CREATE TABLE RATING(userid INT REFERENCES USERS(userid), userid2 INT REFERENCES USERS(userid), number int, PRIMARY KEY(userid, userid2));

A: Find the screen shot of your ER Diagram:

Some more information/tips:
I am not sure, which RDMS you are using, but if you have access to SQL Server Management studio an ER diagram can be created quickly by below steps:

*

*Go to Sql Server Management Studio >

*Object Explorer >

*Databases >

*Choose and expand your Database.

*Under your database right click on "Database Diagrams" and select "New

*Database Diagram".

*It will a open a new window. ...

*Select the tables "Users" and "Rating" Click add (1 time for each table). Then click close

*Wait for it to complete.


text:
Q: MS Access: Environmental variables in saved import file path I've tried searching for an answer to this question, but I haven't been able to find something that addresses it specifically. I have a database with a saved file import that will be used by multiple people. I wanted to do something like %USERPROFILE%\Desktop instead of C:\Documents and Settings\user\Desktop so that the path to desktop can vary as needed. All computers are Windows XP. I would like to avoid vba if possible.
I realize I could store the files on a server to be imported, but the import is slow across the network. If I am incorrect in my assumption and it is not faster to import the file from the desktop, I'll go ahead and make the server side folder instead.

A: You can use this VBA expression
Environ("USERPROFILE") & "\Desktop"

to get the value of this shell expression
%USERPROFILE%\Desktop


text:
Q: Use handle_click in ggvis to create an interactive filter in Shiny I have a basic Shiny app that uses a ggvis() graphic.  The app is given below.
I see in the documentation for ggvis() there is a handle_click(vis, on_click = NULL) function which can be passed.  Further, the on_click is a callback function with arguments data, location and session.
What I would like to do is allow a user to click on one of the bars in the graph (one bar per month) and have it set input$monthSelect to the month of the bar they clicked on.  If I were adding a tooltip, I could create a function which would take in the data from the layer being hovered over and I could reference data$x_ to get the month.
An example of this function is:
update_selection = function(data){
    if(is.null(data)) return(NULL)
    updateSelectInput(session
                     ,"monthSelect"
                     ,selected=data$x_)
  }

and I add it to the ggvis through ggvis() %>% handle_click(update_selection(data)) but I get an error Error in func() : could not find function "fun".
How can I make a reactive graph?
library(ggvis)
library(dplyr)
library(tidyr)
library(ReporteRs)
data = cocaine
data = within(data,
  {
    month[month==1] = "January"
    month[month==2] = "February"
    month[month==3] = "March"
    month[month==4] = "April"
    month[month==5] = "May"
    month[month==6] = "June"
    month[month==7] = "July"
    month[month==8] = "August"
    month[month==9] = "September"
    month[month==10] = "October"
    month[month==11] = "November"
    month[month==12] = "December"
  }
)

server = function(input, output, session){

  selectedState = reactive(input$stateSelect)

  plotData = reactive({
    data %>%
      group_by(state,month) %>%
      summarise(avgPotency = mean(potency)) %>%
      ungroup() %>%
      spread(month,avgPotency) %>%
      mutate(January = ifelse(is.na(January),0,January)
             ,February = ifelse(is.na(February),0,February)
             ,March = ifelse(is.na(March),0,March)
             ,April = ifelse(is.na(April),0,April)
             ,May = ifelse(is.na(May),0,May)
             ,June = ifelse(is.na(June),0,June)
             ,July = ifelse(is.na(July),0,July)
             ,August = ifelse(is.na(August),0,August)
             ,September = ifelse(is.na(September),0,September)
             ,October = ifelse(is.na(October),0,October)
             ,November = ifelse(is.na(November),0,November)
             ,December = ifelse(is.na(December),0,December)
      ) %>%
      filter(state==selectedState()) %>%
      gather("month","AvgPotency",-state)
  })

  stateVis = reactive({
    plotData() %>%
      ggvis(x=~month,y=~AvgPotency)
  })
  stateVis %>% bind_shiny("cocaineCounts")

  selectedMonth = reactive(input$monthSelect)
  tableData = reactive({
    data %>%
      filter(state==selectedState() & month==selectedMonth())
  })
  output$cocaineTable = renderUI({
    MyFTable = FlexTable(tableData(),
                         header.cell.props = cellProperties( padding = 2 ),
                         body.cell.props = cellProperties( padding = 2 ))
    return(HTML(as.html(MyFTable)))
  })

}

ui = shinyUI(
  fluidPage(
    column(6,
            selectInput("stateSelect",label="Select a State:",choices = unique(data$state),selected=1)
           ,selectInput("monthSelect",label="Select a Month:",choices = c('January','February','March','April','May','June','July','August','September','October','November','December'),selected=1)
           ,ggvisOutput("cocaineCounts")
    )
    ,column(6,
            uiOutput(outputId = "cocaineTable")
    )
    )
  )

shinyApp(ui = ui, server = server)

A: The function needs to be updated to accept three arguments:
update_selection = function(data,location,session){
    if(is.null(data)) return(NULL)
    updateSelectInput(session
                     ,"monthSelect"
                     ,selected=data$x_)
  }

and handle_click() needs to be passed as ggvis() %>% handle_click(update_selection)
So the complete, working app is:
library(ggvis)
library(dplyr)
library(tidyr)
library(ReporteRs)
data = cocaine
data = within(data,
  {
    month[month==1] = "January"
    month[month==2] = "February"
    month[month==3] = "March"
    month[month==4] = "April"
    month[month==5] = "May"
    month[month==6] = "June"
    month[month==7] = "July"
    month[month==8] = "August"
    month[month==9] = "September"
    month[month==10] = "October"
    month[month==11] = "November"
    month[month==12] = "December"
  }
)

update_selection = function(data,location,session){
    if(is.null(data)) return(NULL)
    updateSelectInput(session
                     ,"monthSelect"
                     ,selected=data$x_)
  }

server = function(input, output, session){

  selectedState = reactive(input$stateSelect)

  plotData = reactive({
    data %>%
      group_by(state,month) %>%
      summarise(avgPotency = mean(potency)) %>%
      ungroup() %>%
      spread(month,avgPotency) %>%
      mutate(January = ifelse(is.na(January),0,January)
             ,February = ifelse(is.na(February),0,February)
             ,March = ifelse(is.na(March),0,March)
             ,April = ifelse(is.na(April),0,April)
             ,May = ifelse(is.na(May),0,May)
             ,June = ifelse(is.na(June),0,June)
             ,July = ifelse(is.na(July),0,July)
             ,August = ifelse(is.na(August),0,August)
             ,September = ifelse(is.na(September),0,September)
             ,October = ifelse(is.na(October),0,October)
             ,November = ifelse(is.na(November),0,November)
             ,December = ifelse(is.na(December),0,December)
      ) %>%
      filter(state==selectedState()) %>%
      gather("month","AvgPotency",-state)
  })

  stateVis = reactive({
    plotData() %>%
      ggvis(x=~month,y=~AvgPotency) %>%
        handle_click(update_selection)
  })
  stateVis %>% bind_shiny("cocaineCounts")

  selectedMonth = reactive(input$monthSelect)
  tableData = reactive({
    data %>%
      filter(state==selectedState() & month==selectedMonth())
  })
  output$cocaineTable = renderUI({
    MyFTable = FlexTable(tableData(),
                         header.cell.props = cellProperties( padding = 2 ),
                         body.cell.props = cellProperties( padding = 2 ))
    return(HTML(as.html(MyFTable)))
  })

}

ui = shinyUI(
  fluidPage(
    column(6,
            selectInput("stateSelect",label="Select a State:",choices = unique(data$state),selected=1)
           ,selectInput("monthSelect",label="Select a Month:",choices = c('January','February','March','April','May','June','July','August','September','October','November','December'),selected=1)
           ,ggvisOutput("cocaineCounts")
    )
    ,column(6,
            uiOutput(outputId = "cocaineTable")
    )
    )
  )

shinyApp(ui = ui, server = server)


text:
Q: JRE ignores TLSv1.1 preference I'm running Oracle's JRE version 1.8.0_291-b10 under macOS 11.4 and I'm unable to use a local JNLP which gets a JAR through TLSv1.1.
When running the JNLP using javaws -wait ~/Downloads/test.jnlp I'm getting javax.net.ssl.SSLHandshakeException: The server selected protocol version TLS11 is not accepted by client preferences [TLS13, TLS12, SSL20Hello] despite enabling all protocols in the control panel:

I also tried forcing the JVM (in case something's wrong with settings) by running javaws -J-Dhttps.protocols=TLSv1.1 -wait ~/Downloads/test.jnlp but that gets me javax.net.ssl.SSLHandshakeException: No appropriate protocol (protocol is disabled or cipher suites are inappropriate).
It seems like JRE cannot make TLSv1.1 connections no matter what. Is there any way to force it? Updating the application is out of question as this is a closed-source abandonware which normally requires IE6 & Windows XP to run.

A: You can find info here. Its probably a little outdated, but contains necessary configuration. Summary:

*

*Add -Djdk.tls.client.protocols=TLSv1.1

*Create file enableTLS1.1.security with follows content (you can also copy that property from /jre/lib/security/java.security and remove TLSv1.1)

jdk.tls.disabledAlgorithms=SSLv3, TLSv1, RC4, DES, MD5withRSA, DH keySize < 1024, EC keySize < 224, 3DES_EDE_CBC, anon, NULL, include jdk.disabled.namedCurves

*-Djava.security.properties=<path to enableTLS1.1.security>
Instead of 2) and 3) you can also remove TLSv1.1 from jdk.tls.disabledAlgorithms properties within /jre/lib/security/java.security, but it is not good practice


text:
Q: How send bson via Spring @response body I am using @Responsebody String to send JSON.
part of my code is below.(I am sorry for open it all)
@RequestMapping(value = "/getSomeList", method = RequestMethod.GET ,
            headers="Accept=application/json", produces = "text/plain;charset=UTF-8")
    public @ResponseBody String getThumbList(
            @RequestParam("con_id") String con_id) throws Exception{
return json;

}

And actually it sends Json. But my client requests Bson type. How can I change Json to Bson without editing global format(my json is actually just string and I heard that spring can not response bson. Is that right?).

A: You need to register a HttpMessageConverter that can convert to BSON.
<mvc:annotation-driven>
     <mvc:message-converters>
          <bean class="MyBsonHttpMessageConverter"/>
     </mvc:message-converters>
</mvc:annotation-driven>

Unfortunaly Spring has no Bson Http Message Converter, so you have to implement your own. (Or have more luck then me while google for one).

A: This is an old question, but it is nigh the only thing I can find on the web on this topic.
So here's how to do it. Assuming you're using Jackson as your JSON library in Spring.

*

*Add a dependency to Michel Krämer's bson4jackson library

*Create a class like so:

import com.fasterxml.jackson.databind.ObjectMapper;
import de.undercouch.bson4jackson.BsonFactory;
import de.undercouch.bson4jackson.BsonGenerator;
import org.springframework.http.MediaType;
import org.springframework.http.converter.json.AbstractJackson2HttpMessageConverter;
import org.springframework.http.converter.json.Jackson2ObjectMapperBuilder;

import javax.annotation.Nonnull;

public class MappingJackson2BsonHttpMessageConverter
    extends AbstractJackson2HttpMessageConverter
{
    public MappingJackson2BsonHttpMessageConverter(@Nonnull Jackson2ObjectMapperBuilder builder) {
        super(bsonObjectMapper(builder), MediaType.parseMediaType("application/bson"));
    }

    @Nonnull
    private static ObjectMapper bsonObjectMapper(@Nonnull Jackson2ObjectMapperBuilder om){
        BsonFactory f = new BsonFactory();
        f.configure(BsonGenerator.Feature.ENABLE_STREAMING, true);

        return om.factory(f).build();
    }
}

*Add it as a @Bean to your configuration, or annotate it with @Component and make sure it's in your @ComponentScan's path.

That's it. Now, if you declare your MVC endpoint with @RequestMapping(produces = "application/bson") (in some form or another), the output will be the BSON encoding of your ResponseEntity's body.
This works with Jackson-annotated Objects which you'd normally serialize to JSON; and all the configuration you did to the Jackson ObjectMapper through Spring, modules or annotations will apply.
It also works for input as well as for output.
It also works with Feign clients.
I assume it also works with Spring's RestTemplate.


text:
Q: When Using the "Efficient Adapter", holder is sometimes null I'm using a mixture of the "Efficient Adapter" and the EndlessAdapter from CommonsGuy, and sometime the holder in getView() is null.
@Override
public View getView(int position, View convertView, ViewGroup parent) {

    ViewHolder holder;

    if (convertView == null) {
        convertView = inflater.inflate(R.layout.queue_item, null);

        holder = new ViewHolder();
        holder.text = (TextView) convertView.findViewById(R.id.queueItemText);
        holder.image = (ImageView) convertView.findViewById(R.id.queueItemImage);
        convertView.setTag(holder);
    } else {
        holder = (ViewHolder) convertView.getTag();
    }

    if (holder != null) {
        holder.text.setText(queueItems.get(position).getTitle().getName());
    } else {
        Log.e(context.getString(R.string.app_name), "holder is null for some reason ...");
    }

    return convertView;
}

I've put the rest of the code for both of my classes here, as it's rather large to paste inline.
Once the whole data set is loaded, scrolling up & down causes rows to disappear and re-appear too.

A: Make sure you are using the latest EndlessAdapter, as it was updated a few weeks ago as I recall.
If that does not help, and if you can give me a full project (not just a couple of classes) that replicates the problem, I can try to fix it. Please contact me via the cw-android Google Group, which is the primary home for support for EndlessAdapter and my other components.


text:
Q: Smarty variables concatenation I have something like this:
<select class="form-control" name="activ">
 {if {$smarty.session.admin['access']['pages:list:activ']} == '1'}
   <option value="1">{#L_YES#}</option>
   <option value="0">{#L_NO#}</option>
 {else}
   <option value="0">{#L_NO#}</option>
 {/if}
</select>

I need to change ['pages:list:activ'] to ['{$smarty.get.module}:list:activ']
How can I do that?

A: You have multiple options here..
For one, PHP will not parse variables when you are using single quotes.
So
$a = 'string';
echo '$test with something';

Will output:
$test with something

But if you use:
$a = 'string';
echo "$test with something";

or
echo "{$test} with something";

It will output:
string with something

But for Smarty this will not work if you use . or -> in the name, because you will have to use backticks around the variable, like this (note the double quotes around it):
{if {$smarty.session.admin['access']["`$smarty.get.module`:list:activ"]} == '1'}

For more info see: Smarty Embedding Vars in Double Quotes

You can also use cat modifier and assign the concatenated value to a var:
{assign var = "moduleList" value = $smarty.get.module|cat:":list:activ"}
{if {$smarty.session.admin['access'][$moduleList]} == '1'}


text:
Q: grails Cannot issue a redirect(..) here. A previous call to redirect(..) when url parameter contains angle bracket the exception is:
 Cannot issue a redirect(..) here. A previous call to redirect(..) has already redirected the response.. Stacktrace follows:
org.codehaus.groovy.grails.web.servlet.mvc.exceptions.CannotRedirectException: Cannot issue a redirect(..) here. A previous call to redirect(..) has already redirected the response.
the request url: http://localhost:8080/auth/index?param1=<
and then throws
ceptions.GrailsRuntimeException: javax.servlet.ServletException: org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.codehaus.groovy.grails.exceptions.GrailsRuntimeException: javax.servlet.ServletException: org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.codehaus.groovy.grails.exceptions.GrailsRuntimeException: javax.servlet.ServletException: org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.codehaus.groovy.grails.exceptions.GrailsRuntimeException: javax.servlet.ServletException: org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.codehaus.groovy.grails.exceptions.GrailsRuntimeException: javax.servlet.ServletException: org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.codehaus.groovy.grails.exceptions.GrailsRuntimeException: javax.servlet.ServletException: org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.codehaus.groovy.grails.exceptions.GrailsRuntimeException: javax.servlet.ServletException: org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.codehaus.groovy.grails.exceptions.GrailsRuntimeException: javax.servlet.ServletException: org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.codehaus.groovy.grails.exceptions.GrailsRuntimeException: javax.servlet.ServletException: org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.codehaus.groovy.grails.exceptions.GrailsRuntimeException: javax.servlet.ServletException: org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.codehaus.groovy.grails.exceptions.GrailsRuntimeException: javax.servlet.ServletException: org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.codehaus.groovy.grails.exceptions.GrailsRuntimeException: javax.servlet.ServletException: org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.codehaus.groovy.grails.exceptions.GrailsRuntimeException: javax.servlet.ServletException: org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.codehaus.groovy.grails.exceptions.GrailsRuntimeException: javax.servlet.ServletException: org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.codehaus.groovy.grails.exceptions.GrailsRuntimeException: javax.servlet.ServletException: org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.codehaus.groovy.grails.exceptions.GrailsRuntimeException: javax.servlet.ServletException: org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.codehaus.groovy.grails.exceptions.GrailsRuntimeException: javax.servlet.ServletException: org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.codehaus.groovy.grails.exceptions.GrailsRuntimeException: javax.servlet.ServletException: org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.codehaus.groovy.grails.exceptions.GrailsRuntimeException: javax.servlet.ServletException: org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.codehaus.groovy.grails.exceptions.GrailsRuntimeException: javax.servlet.ServletException: org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.codehaus.groovy.grails.exceptions.GrailsRuntimeException: javax.servlet.ServletException: org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.codehaus.groovy.grails.exceptions.GrailsRuntimeException: javax.servlet.ServletException: org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.codehaus.groovy.grails.exceptions.GrailsRuntimeException: javax.servlet.ServletException: org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.codehaus.groovy.grails.exceptions.GrailsRuntimeException: javax.servlet.ServletException: org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.codehaus.groovy.grails.exceptions.GrailsRuntimeException: javax.servlet.ServletException: org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.codehaus.groovy.grails.exceptions.GrailsRuntimeException: javax.servlet.ServletException: javax.servlet.ServletException: Servlet execution threw an exception
    at grails.plugin.cache.web.filter.PageFragmentCachingFilter.doFilter(PageFragmentCachingFilter.java:198)
    at grails.plugin.cache.web.filter.AbstractFilter.doFilter(AbstractFilter.java:63)
    ... 54 more
Caused by: org.codehaus.groovy.grails.exceptions.GrailsRuntimeException: javax.servlet.ServletException: org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.codehaus.groovy.grails.exceptions.GrailsRuntimeException: javax.servlet.ServletException: org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.codehaus.groovy.grails.exceptions.GrailsRuntimeException: javax.servlet.ServletException: org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.codehaus.groovy.grails.exceptions.GrailsRuntimeException: javax.servlet.ServletException: org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.codehaus.groovy.grails.exceptions.GrailsRuntimeException: javax.servlet.ServletException: org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.codehaus.groovy.grails.exceptions.GrailsRuntimeException: javax.servlet.ServletException: org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.codehaus.groovy.grails.exceptions.GrailsRuntimeException: javax.servlet.ServletException: org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.codehaus.groovy.grails.exceptions.GrailsRuntimeException: javax.servlet.ServletException: org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.codehaus.groovy.grails.exceptions.GrailsRuntimeException: javax.servlet.ServletException: org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.codehaus.groovy.grails.exceptions.GrailsRuntimeException: javax.servlet.ServletException: org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.codehaus.groovy.grails.exceptions.GrailsRuntimeException: javax.servlet.ServletException: org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.codehaus.groovy.grails.exceptions.GrailsRuntimeException: javax.servlet.ServletException: org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.codehaus.groovy.grails.exceptions.GrailsRuntimeException: javax.servlet.ServletException: org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.codehaus.groovy.grails.exceptions.GrailsRuntimeException: javax.servlet.ServletException: org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.codehaus.groovy.grails.exceptions.GrailsRuntimeException: javax.servlet.ServletException: org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.codehaus.groovy.grails.exceptions.GrailsRuntimeException: javax.servlet.ServletException: org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.codehaus.groovy.grails.exceptions.GrailsRuntimeException: javax.servlet.ServletException: org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.codehaus.groovy.grails.exceptions.GrailsRuntimeException: javax.servlet.ServletException: org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.codehaus.groovy.grails.exceptions.GrailsRuntimeException: javax.servlet.ServletException: org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.codehaus.groovy.grails.exceptions.GrailsRuntimeException: javax.servlet.ServletException: org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.codehaus.groovy.grails.exceptions.GrailsRuntimeException: javax.servlet.ServletException: org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.codehaus.groovy.grails.exceptions.GrailsRuntimeException: javax.servlet.ServletException: org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.codehaus.groovy.grails.exceptions.GrailsRuntimeException: javax.servlet.ServletException: org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.codehaus.groovy.grails.exceptions.GrailsRuntimeException: javax.servlet.ServletException: org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.codehaus.groovy.grails.exceptions.GrailsRuntimeException: javax.servlet.ServletException: org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.codehaus.groovy.grails.exceptions.GrailsRuntimeException: javax.servlet.ServletException: org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.codehaus.groovy.grails.exceptions.GrailsRuntimeException: javax.servlet.ServletException: org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.codehaus.groovy.grails.exceptions.GrailsRuntimeException: javax.servlet.ServletException: org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.codehaus.groovy.grails.exceptions.GrailsRuntimeException: javax.servlet.ServletException: org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.codehaus.groovy.grails.exceptions.GrailsRuntimeException: javax.servlet.ServletException: org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.codehaus.groovy.grails.exceptions.GrailsRuntimeException: javax.servlet.ServletException: org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.codehaus.groovy.grails.exceptions.GrailsRuntimeException: javax.servlet.ServletException: org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.codehaus.groovy.grails.exceptions.GrailsRuntimeException: javax.servlet.ServletException: org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.codehaus.groovy.grails.exceptions.GrailsRuntimeException: javax.servlet.ServletException: org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.codehaus.groovy.grails.exceptions.GrailsRuntimeException: javax.servlet.ServletException: javax.servlet.ServletException: Servlet execution threw an exception
    ... 56 more

A: You need to encode the URL if it contains special characters which has special meaning in programming language like groovy.
Encode URL as follows
import java.net.URLEncoder;
String url = "http://localhost:8080/auth/index?param1=<";
String encodedUrl = URLEncoder.encode(url, "UTF-8");
println encodedUrl
redirect(url: encodedUrl)

A: Use the return keyword if you use redirect it is not the last statement in the method.
Grails by default uses the last statement as the return statement. If you redirect and it is the last statement, it works automagically. But this is not the case if you use return in an if-statement and return is not the last statement. In these case you have to explicitly use the return keyword.
def someAction(){
     if(someCondition == true){
          redirect action: "anotherAction"
          return                  // this prevents the execution of the code below
     }else{
        // do something else
     }

     redirect action: "myAction"  // this will throw an error if the condition above matched and it redirected without return keyword
}


text:
Q: .NET WCF Can't Decode "Chunked" response I am calling an axis web service from WCF.  The request works just fine but I get back null values.  Using Fiddler I was able to determine that the response is coming base as Transfer-Encoding: chunked.  This means that there are control characters in in the response BEFORE the xml.  WCF does NOT throw an error.  It just moves on and the object that is supposed to be returned by the Method is null.  Can anyone tell me how to tell WCF how to correctly handle an HTTP 1.1 chunked encoded message?
Here is a link to someone asking a similer question:
http://www.biztalkgurus.com/forums/t/10860.aspx
Soap Response:
HTTP/1.1 200 OK
Date: Wed, 06 May 2009 15:34:41 GMT
Server: Apache
Set-Cookie: JSESSIONID=01A43C26DB5E284B70F1F6D466D5CD5D; Path=/arsys
Keep-Alive: timeout=15, max=100
Connection: Keep-Alive
Transfer-Encoding: chunked
Content-Type: text/xml;charset=utf-8

ba7
<?xml version="1.0" encoding="utf-8"?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><soapenv:Body><ns0:HelpDesk_QueryList_ServiceResponse xmlns:ns0="urn:Port" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <ns0:getListValues>
        <ns0:Assigned_Group>CHQ-TSR-WEL</ns0:Assigned_Group>
        <ns0:Assigned_Group_Shift_Name/>
        <ns0:Assigned_Support_Company>IT Support</ns0:Assigned_Support_Company>
        <ns0:Assigned_Support_Organization>WH</ns0:Assigned_Support_Organization>
        <ns0:Assignee>David</ns0:Assignee>
        <ns0:Categorization_Tier_1>ADD</ns0:Categorization_Tier_1>
        <ns0:Categorization_Tier_2>HARDWARE</ns0:Categorization_Tier_2>
        <ns0:Categorization_Tier_3>DESKTOP/LAPTOP/NOTEBOOK</ns0:Categorization_Tier_3>
        <ns0:City/>
        <ns0:Closure_Manufacturer/>
        <ns0:Closure_Product_Category_Tier1/>
        <ns0:Closure_Product_Category_Tier2/>
        <ns0:Closure_Product_Category_Tier3/>
        <ns0:Closure_Product_Model_Version/>
        <ns0:Closure_Product_Name/>
        <ns0:Company>IT Support</ns0:Company>
        <ns0:Contact_Company>IT Support</ns0:Contact_Company>
        <ns0:Contact_Sensitivity>Standard</ns0:Contact_Sensitivity>
        <ns0:Country/>
        <ns0:Department>WEL</ns0:Department>
        <ns0:Summary>Old PC to be Cascaded
</ns0:Summary>
        <ns0:Notes> User Name:
Make: Dell
Model: Latitude D600
Serial Number:
Location: </ns0:Notes>
        <ns0:First_Name>James</ns0:First_Name>
        <ns0:Impact>3-Moderado/Limitado</ns0:Impact>
        <ns0:Incident_Number>INC000000009017</ns0:Incident_Number>
        <ns0:Internet_E-mail></ns0:Internet_E-mail>
        <ns0:Last_Name>Goodrich</ns0:Last_Name>
        <ns0:Manufacturer/>
        <ns0:Middle_Initial/>
        <ns0:Organization>--</ns0:Organization>
        <ns0:Phone_Number>+326</ns0:Phone_Number>
        <ns0:Priority>Medium</ns0:Priority>
        <ns0:Priority_Weight/>
        <ns0:Product_Categorization_Tier_1>HARDWARE</ns0:Product_Categorization_Tier_1>
        <ns0:Product_Categorization_Tier_2>DESKTOP/LAPTOP/NOTEBOOK</ns0:Product_Categorization_Tier_2>
        <ns0:Product_Categorization_Tier_3>CASCADE PC</ns0:Product_Categorization_Tier_3>
        <ns0:Product_Model_Version/>
        <ns0:Product_Name/>
        <ns0:Region></ns0:Region>
        <ns0:Reported_Source/>
        <ns0:Resolution>New PC
Make:
Model:
Serial Number:
Ship to:
Shipping Carrier:
Tracking Number:</ns0:Resolution>
        <ns0:Resolution_Category/>
        <ns0:Resolution_Category_Tier_2/>
        <ns0:Resolution_Category_Tier_3/>
        <ns0:Service_Type>User Service Request</ns0:Service_Type>
        <ns0:Site>Salt Lake City</ns0:Site>
        <ns0:Site_Group/>
        <ns0:Status>Assigned</ns0:Status>
        <ns0:Status_Reason/>
        <ns0:Urgency>3-Medium</ns0:Urgency>
        <ns0:VIP>No</ns0:VIP>
    </ns0:getListValues>
</ns0:HelpDesk_QueryList_ServiceResponse></soapenv:Body></soapenv:Envelope>
0

A: I don't think you will be able to get that to work as IIS (or the client depending on what side you are on) should strip that out before it gets to you, same as you should not have to manually de-gzip a request.
In this case it seems that chunked is not well supported by server software.


text:
Q: I am getting a error when calling a mailer_helper method for a mailer method in a Rails 3.2.13 app Following this post and this post I put together the following.
In app/helpers/mailer_helper.rb:
module MailerHelper
  def sys_addy
    @sys_addy = current_site == "site1" ? "me@site1.com" : "me@site2.com"
  end
end

Attempt 1 placing the helper method call above the method - app/mailers/user_mailer.rb:
class UserMailer < ActionMailer::Base
  helper :mailer
  sys_addy
  default :from => @sys_addy

  def notice_email
    ...
  end
end

Attempt 2 placing the helper method call inside the method - app/mailers/user_mailer.rb:
class UserMailer < ActionMailer::Base
  helper :mailer

  def notice_email
    sys_addy
    ...
    mail( ...:from => @sys_addy )
  end
end

In both cases I got:
NameError (undefined local variable or method `sys_addy'

Thanks for your help.

A: I think the problem is you are trying to define it as a symbol. Try calling it like Class like below in your User Mailer:
class UserMailer < ActionMailer::Base
   include MailerHelper
   helper :mailer

  def notice_email
    sys_addy
    ...
    mail( ...:from => @sys_addy )
  end
end

Update : use both (include & helper) or try with below :
add_template_helper(MailerHelper)

This way, you can access this method in your views as well.
Hope, it will help.Thanks

A: I think you can use the following:
class UserMailer < ActionMailer::Base
  include MailerHelper
  helper :mailer

But the problem with this solution is that the Helper can't know the result of current_site (I guess it is stocked in the User's session?).
A workaround is to use Thread.current in order to store data dynamically (can be updated):
Thread.current[:site] = site

This solution is not that safe, make sure to secure the access to this variable and also never put user's input in the Thread.current.


text:
Q: How to Store a pdf document in Filenet Im new to IBM filenet. I just got the webservice url of the CMIS filenet.
My requirement is to store a PDF document got from one system using apache camel route to filenet. Tried importing the wsdl in SOAP UI and i can see set of APIs like createDocument, createFolder etc., Is there a simple way of testing these APIs. First at least i want to simple test in java at least to store a document in filenet. Please help me out in understanding.

A: To add any kind of document you need to check-in that document to any specific folder of FileNet ObjectStore.
For this all you need a document path or its byteArray, to create fileinputstream, which you want to insert in ObjectStore.
Code to create document,

*

*Create Connection to your content engine

*Ref code may it will help you

public static void insertDocument(Connection conn, String domainName) {
    // Get domain.
    Domain domain = Factory.Domain.fetchInstance(conn, domainName, null);
    ObjectStoreSet osColl = domain.get_ObjectStores();

    // Get each object store.
    Iterator iterator = osColl.iterator();
    while (iterator.hasNext()) {
        // Get next object store.
        ObjectStore objStore = (ObjectStore) iterator.next();

        // Get the display name of the object store.
        String objStoreName = objStore.get_DisplayName();
        System.out.println("Object store name = " + objStoreName);

        // Create a document instance.
        Document doc = Factory.Document.createInstance(objStore, ClassNames.DOCUMENT);

        // Set document properties.
        doc.getProperties().putValue("DocumentTitle", "New Document via Java API");
        doc.set_MimeType("text/plain"); // if its your pdf then set mimetype for PDF

        doc.save(RefreshMode.NO_REFRESH);

        // Check in the document.
        doc.checkin(AutoClassify.DO_NOT_AUTO_CLASSIFY, CheckinType.MAJOR_VERSION);
        doc.save(RefreshMode.NO_REFRESH);

        // File the document.
        Folder folder = Factory.Folder.getInstance(objStore, ClassNames.FOLDER, new Id("{42A3FC29-D635-4C37-8C86-84BAC73FFA3F}")); // id of folder to which you want to store document.
        ReferentialContainmentRelationship rcr = folder.file(doc, AutoUniqueName.AUTO_UNIQUE, "New Document via Java API",
                DefineSecurityParentage.DO_NOT_DEFINE_SECURITY_PARENTAGE);
        rcr.save(RefreshMode.NO_REFRESH);
    }
}

A: In order to troubleshoot the CMIS, I usually follow the general steps that I compiled for you below. saying this, I would highly advise you to create unit tests for each of your operations as you go and I promise it will save you a lot of time and effort

*

*Start Fiddler [a].

*Start CMIS Workbench. 0.8.0 [b] and later automatically proxies
requests, at least on Windows 7.

*Logon to a repository

*Optionally navigate to a folder.

*Create Document. Leave the Generate content field at 0 bytes if
creating a doc without a content stream. Select Email or other type.

*Go to Fiddler and find the POST (status code will be 201).

The request should have Content-Type: application/atom+xml;type=entry, and the properties, cmis:name and cmis:objectTypeid, in the cmisra:object element.
a. http://www.fiddler2.com/fiddler2/
b. http://chemistry.apache.org/java/download.html


text:
Q: Java Swing custom text JEditorPane I have a list of Objects (the model) that are constantly appended to (similar to a log file) and I'd like to display as rich text in a JEditorPane (the view). How can I glue them together?
http://java.sun.com/docs/books/tutorial/uiswing/components/generaltext.html#document doesn't seem to give enough information to use.

A: One simple solution would be to convert each object in the model to HTML and append the strings to create an HTML document that can be set on the JEditorPane.

A: You can use DefaultStyledDocument together with AttributeSet:
SimpleAttributeSet attr = new SimpleAttributeSet();
StyleConstants.setBold(attr , true);
StyleConstants.setForeground(attr, Color.RED);
document.insertString(document.getLenght(),"yourstring", attr))

A: Building a custom Abstract Document is painful. You're better off with an intermediary model that listens to changes in both your Object Model and the document (with a DocumentListener) and updates either the model or view, depending. This works pretty well if you're working in user time (as opposed to updating the Object model 1,000 times per second).

A: OK, so the simplest approach was to extend JTextPane. The extended class created and managed the underlying list. On format change (eg new colours) the list completely reformats the data. The only real problem was that the auto-scrolling is not 100% reliable, Both:
Container parent = getParent();

// get the parent until scroll pane is found
while (parent != null && !(parent instanceof JScrollPane)) {
    parent = parent.getParent();
}

if (parent != null) {
    JScrollPane scrollPane = (JScrollPane)parent;
    scrollPane.getVerticalScrollBar().setValue(scrollPane.getVerticalScrollBar().getMaximum());
}

and
scrollRectToVisible(new Rectangle(0, getHeight() - 2, 1, 1));

Provide inconsistent results with the text pane sometimes not scrolling all the way.


text:
Q: Spring server.session.timeout not working I am trying to increase User session to say 60 min. Can't figure it out. Same issue with SpringBoot versions 1.4.2 and 1.5.7: always default to 30 min.
Tried to change application.properties like this:
...
server.session.timeout=34444600 // very long time
...

Not working. Probably because I am using Spring JDBC sessions (sessions saved in DB).
Then, when I set the timeout when I enable JDBC HTTP Session:
/**
 * This Spring configuration is responsible for creating a Servlet
 * Filter that replaces the HttpSession
 * implementation with an implementation backed by Spring Session.
 */
@EnableJdbcHttpSession(maxInactiveIntervalInSeconds = 60000)
public class HttpSessionConfig {
// empty: nothing needed.
}

Notice maxInactiveIntervalInSeconds above with a very long timeout. This does not work either.
How do I increase the session timeout?


text:
Q: springmvc validate httpsession containing userobject I need to validate HttpSession (for Spring MVC Application) in a better way for my current Project.
Here is the Scenario:
1) Once user is successfully validated, userObject object is added to httpSession class
HttpSession session = req.getSession(true);
session.setAttribute(AppConstants.LOGGEDIN_PARAM, userDetail);

2) Then for each request, userObject is retrieved from HttpSession Class to validate user Session
@RequestMapping(value = "/apply", method = RequestMethod.GET)
public String getTourApplyPage(HttpServletRequest req, ModelMap map) {
    UserDetailTO userDetail = (UserDetailTO) req.getSession().getAttribute(AppConstants.LOGGEDIN_PARAM);
    Long employeeId = userDetail.getUserType() == 1 ? userDetail.getEmployeeId():userDetail.getUserId();
    if (employeeId == 0) {
        req.setAttribute(AppConstants.MSG_PARAM, "Invalid employee Id.");
        return userDetail.getUserType() == 1 ? AppConstants.PIS_MESSAGE : AppConstants.ADMIN_PIS_MESSAGE;
     }
     ...
}

There can be better approaches to set userDetail object inside HttpSession but I had a restriction to not change this implementation (Point 1).
Can it possible to change getting a better implementation for getting a userDetail object from HttpSession (Point 2)?

A:
Is it possible to write a better implementation for getting a userDetail object from httpSession?

Working at such a high level of abstraction, as controllers are at, you don't necessarily need to inject neither an HttpServletRequest nor an HttpSession.
You can make your controller session-scoped and inject a session-scoped bean there. The bean can hold a userDetails and a message for failed validations.
@RestController
@Scope("session")
public class Controller {

    @Autowired
    private SessionDetails details;

    @PostMapping(path = "/validate")
    public void validate() {
        details.setUserDetails(...);
    }

    @GetMapping(path = "/apply")
    public String apply() {
        final UserDetailTO userDetails = details.getUserDetails();
        ...
    }

}

@Component
@Scope("session")
class SessionDetails {
    private String message;
    private UserDetailTO userDetails;
    // getters & setters
}


text:
Q: How to call an API,say X(which consists of urls) inside of webrequest api of google chrome to block that set of url fetched from the X? I want to call an API,or lets say for now a JSON file residing in the same folder as that of background.js
Here is my background.js file
const x='*://xyz.com/';
const filter = {
 urls: [
   x,
 ],
};

const opt = ['blocking'];

window.chrome.webRequest.onBeforeRequest.addListener(
function(details){

/fetching data from blacklist_urls.json*/

fetch('blacklist_urls.json')
      .then(
        function(response) {
          if (response.status !== 200) {
            console.log('Looks like there was a problem. Status Code: ' +
              response.status);
            return;
          }

          // Examine the text in the response
          response.json().then(function(data) {
            console.log(data);
            console.log(x);
          });
        }
      )
      .catch(function(err) {
        console.log('Fetch Error :-S', err);
      });

/end of fetching data from blacklist_urls.json*/

console.log('page blocked - ' + details.url);

return {
  cancel: true,
  };
},
filter,
opt
);

Here the url xyz.com is being blocked correctly.But the blacklisturls.json file is not being fetched.


text:
Q: How to resolve an ok 200 error when integrating slack incoming webhook with angular 4.2.4? As soon as I click the button to submit the message to slack, I receive the following error message. The message is however successfully sent to the slack channel. The error comes into play upon the subscribe method. I tried removing the subscribe method, but since observable can't run without it, I had to use it.
Error Message:
HttpErrorResponse {headers: HttpHeaders, status: 200, statusText: "OK", url: "https://hooks.slack.com/services/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", ok: false, …} .
error:{error: SyntaxError: Unexpected token o in JSON at position 0 at Object.parse (<anonymous>) at XMLHt…, text: "ok"} .
headers:HttpHeaders {normalizedNames: Map(0), lazyUpdate: null, lazyInit: ƒ} .
message:"Http failure during parsing for https://hooks.slack.com/services/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" .
name:"HttpErrorResponse"
ok:false
status:200
statusText:"OK"

Angular4 Code:
const payload = JSON.stringify({"text": "Hihi",});
  const headers = new HttpHeaders().set('Content-type', 'application/x-www-form-urlencoded; charset=UTF-8');
  this.http.request(
    'POST',
    "https://hooks.slack.com/services/TOKEN",
    {
      'body': payload,
      'headers': headers,
    }
  ).subscribe();

A: Nevermind, all I needed to do was to add in a responsetype. Thanks All!