text:
Q: Fixing/Correcting OS X home folder file permissions Long story short, I managed to muck up the file permissions within my home directory in OS X (Lion).  While I'm familiar enough with linux file permissions and more than comfortable changing them, I am unable to get the right combination of permissions and/or commands to change them appropriately.
Before I continue however, I must mention that I have a slightly different setup to a standard install.  My hard drive is partitioned into two drives, System and User.
My home folder is located at in Users/[username] on the User drive, ie. when both drives are correctly mounted, it is accessible at /Volumes/User/Users/[username].  In /User/, I have a symlink [username] which points to //Volumes/User/Users/[username] and this has worked just as I wanted.
I tried the following two articles found here and here only t myself locked out of my own home directory.  In the meantime I changed them to full global access so that I can use them but I would like to get around to fixing that.

A: First, make sure you own your home folder (note: I'm assuming you're running this from your own user account, and that you're an admin):
sudo chown -R $USER:staff ~

Then, give yourself proper access and nobody else any access (we'll make some exceptions later). Note that this is 2 commands to make sure that execute access gets added to the directories, but not plain files:
chmod -R 600 ~
chmod -R u+rwX ~

Now, grant read access to others for the directories they're supposed to have access to. If you don't have a sites folder, you can leave that off the second command:
chmod og+rX ~
chmod -R og+rX ~/Public ~/Sites

Apple likes to have access control entries to keep you from messing with "important" parts of your home folder.  Again, if you don't have Sites you can leave that off (do not leave out Library; it's invisible, but it's there):
chmod +a "group:everyone deny delete" ~ ~/Desktop ~/Documents ~/Downloads ~/Library ~/Movies ~/Music ~/Pictures ~/Public ~/Sites

Finally, fix your Drop Box:
chmod og=wX ~/Public/Drop\ Box
chmod +a "user:$USER allow list,add_file,search,delete,add_subdirectory,delete_child,readattr,writeattr,readextattr,writeextattr,readsecurity,writesecurity,chown,file_inherit,directory_inherit" ~/Public/Drop\ Box

Note that this procedure will not properly "fix" the permissions on files inside your various folders, but that doesn't really matter since it gives you full access to them and nobody else can get into the folders anyway...

A: To Reset file permissions and Access Control Lists (ACLs) of your user's home directory to their default settings do this:

*

*Boot into the Recovery mode by holding down the Command and R keys
during boot.

*Open the terminal (under the Utilities menu)

*Type resetpassword into the terminal and hit Return.

*In the Reset Password utility window choose the correct volume, and on the bottom you'll see an area labeled 'Reset Home Folder Permissions and ACLs'. Click the Reset button in that area.

*Close windows, quick OS X Utilities, restart.

A: Repair Disk Permissions by opening Disk Utility, selecting the drive, then clicking Repair Disk Permissions

A: After much effort and searching:
While not perfect, I just used the Get Info window on the home folder. It showed "read/write" for the user,* "read only" for admin, and "no access" for everyone. Looked good enough to me.
I then ran the option in the gear menu to apply to all enclosed items.
Restored access to everything! Less than a minute (on my SSD).
Hallelujah!                                    *standard, not admin

A: Run this
cd $HOME
{ sudo chflags -R nouchg,nouappnd ~ $TMPDIR.. ; \
sudo chown -R $UID:staff ~ $_ ; \
sudo chmod -R -N ~ $_ ; \
sudo chmod -R 755 ~ $_ ; \
sudo chmod 700 Desktop Documents Downloads Dropbox Library Movies Music Pictures Sites $_ ; \
sudo chmod 777 Public ; \
sudo chmod 733 Public/Drop\ Box ; \
} 2> /dev/null

A: MacOs Catalina here on zsh.
On fixing executables, this worked for me.
find ~ -type f -print0 | \
  xargs -0 file | \
  grep executable | \
  awk '{ print $1  }' | \
  tr -d ':' | \
  xargs chmod -v a+x

This automates @Gordon Davisson's comment suggestion in the approved answer above.
For those getting sudo chown -R $USER:staff ~ yielded zsh: bad substitution error. I suspect this is because of bad context with zsh. The shell switches to the super user (root?) and which would yield an invalid $USER and ~ result. My lazy fox was to copy/paste the results. If you want a one-liner, this may give desired results by expanding the results before handing off to sudo:
sudo chown -R $(echo $USER):staff $(echo ~)

I tested and no bad substitution error was returned.


text:
Q: Software for taking notes on programming What type of software is good for taking notes on programming?  For example, if I want to jot down different methods/functions that are useful for different things.  Ideally, the software would have  syntax highlighting.
The software would need to support Mac OS X.  I will most probably be using this for Objective-C/iPhone development and Ruby on Rails development.
I want something that can shift between ordinary text and coding syntax.  For example if I was to type:

In order to create a rectangle in Objective-C with a name square use: (CGRect *) square...........

I would like the objective-C code to have syntax highlighting but not the rest of the text.
Thanks!
P.S. I use textmate generally for coding.

A: Try Evernote. http://www.evernote.com/

A: I like notepad 2
http://www.flos-freeware.ch/notepad2.html

A: For a pc, if you want a fairly simple notepad like app with syntax highlighting, I'd pick TextPad... You can associate syntax files and "customize" as needed.  For a mac I'd pick BBEdit...

A: I usually just use an editor for simple notes. If I'm on Linux, I usually choose gedit. If I'm on something else, Scite is nice. I think it's very specific to what your needs are. Are you looking for a document editor which happens to be able to do syntax highlighting also?

A: I found that either a mind-mapping tool or a text editor with an outlining support are very suitable for this sort of notes. On OS X I'm using FreeMind, everywhere else - Emacs org mode.

redpajama_set_name: RedPajamaStackExchange


text:
Q: TSQL Parse String with 4 delimiters I am trying to parse this string :
'200|50|jo.th@xxx.com|09\23\2016|07:00:00'
into 5 columns and I am getting frustrated.
The delimiter is pipe |
The fields are not fixed so I need to use charindex in order to find the location of the delimiter ?
Please help
Thanks

A: Another option is as follows.  This can be baked into a TVF or even a Cross Apply
Declare @String varchar(max) = '200|50|jo.th@xxx.com|09\23\2016|07:00:00'

Select Pos1 = xDim.value('/x[1]','varchar(max)')
      ,Pos2 = xDim.value('/x[2]','varchar(max)')
      ,Pos3 = xDim.value('/x[3]','varchar(max)')
      ,Pos4 = xDim.value('/x[4]','varchar(max)')
      ,Pos5 = xDim.value('/x[5]','varchar(max)')
      ,Pos6 = xDim.value('/x[6]','varchar(max)')
      ,Pos7 = xDim.value('/x[7]','varchar(max)')
      ,Pos8 = xDim.value('/x[8]','varchar(max)')
      ,Pos9 = xDim.value('/x[9]','varchar(max)')
 From (Select Cast('<x>' + Replace(@String,'|','</x><x>')+'</x>' as XML) as xDim) A

Returns

Edit - To Use in a Cross Apply - Easy to expand/contract

Declare @YourTable table (ID int,SomeString varchar(max))
Insert Into @YourTable values
(1,'200|50|jo.th@xxx.com|09\23\2016|07:00:00'),
(2,'400|99|james.th@xxx.com|11\15\2016|09:00:00')

Select A.ID
      ,B.*
 From  @YourTable A
 Cross Apply (
                Select Pos1 = xDim.value('/x[1]','varchar(max)')
                      ,Pos2 = xDim.value('/x[2]','varchar(max)')
                      ,Pos3 = xDim.value('/x[3]','varchar(max)')
                      ,Pos4 = xDim.value('/x[4]','varchar(max)')
                      ,Pos5 = xDim.value('/x[5]','varchar(max)')
                      ,Pos6 = xDim.value('/x[6]','varchar(max)')
                      ,Pos7 = xDim.value('/x[7]','varchar(max)')
                      ,Pos8 = xDim.value('/x[8]','varchar(max)')
                      ,Pos9 = xDim.value('/x[9]','varchar(max)')
                 From (Select Cast('<x>' + Replace(A.SomeString,'|','</x><x>')+'</x>' as XML) as xDim) A
             ) B

Returns

A: So first I'd locate the position of each delimiter and then use this to split your string. Something like this;
DECLARE @TextString nvarchar(100); SET @TextString = '200|50|jo.th@xxx.com|09\23\2016|07:00:00'
DECLARE @FirstDelimiter int
DECLARE @SecondDelimiter int
DECLARE @ThirdDelimiter int
DECLARE @FourthDelimiter int

SET @FirstDelimiter = CHARINDEX('|',@TextString)
SET @SecondDelimiter =  CHARINDEX('|',@TextString,@FirstDelimiter+1)
SET @ThirdDelimiter =  CHARINDEX('|',@TextString,@SecondDelimiter+1)
SET @FourthDelimiter =  CHARINDEX('|',@TextString,@ThirdDelimiter+1)

Final Query;
SELECT
@TextString Main_String
,SUBSTRING(@TextString,1,@FirstDelimiter-1) First_String
,SUBSTRING(@TextString,@FirstDelimiter+1,(@SecondDelimiter-@FirstDelimiter)-1) Second_String
,SUBSTRING(@TextString,@SecondDelimiter+1,(@ThirdDelimiter-@SecondDelimiter)-1) Third_String
,SUBSTRING(@TextString,@ThirdDelimiter+1,(@FourthDelimiter-@ThirdDelimiter)-1) Fourth_String
,SUBSTRING(@TextString,@FourthDelimiter+1,LEN(@TextString)-@FourthDelimiter) Fifth_String

Result Set;
Main_String                                 First_String    Second_String   Third_String    Fourth_String   Fifth_String
200|50|jo.th@xxx.com|09\23\2016|07:00:00    200             50              jo.th@xxx.com   09\23\2016      07:00:00

A: I use the following to get delimnated values into a set of tables rows (usually for passing in multiple values in a stored procedure parameter which can then be joined on), pivoting can transform it into columns.
(Compatible with SQL Server 2005 and later)
DECLARE @Input varchar(MAX)
DECLARE @Delim char(1)

SET @Input = '200|50|jo.th@xxx.com|09\23\2016|07:00:00'
SET @Delim = '|'

DECLARE @VALUES TABLE (ColNo INT, [Param] varchar(MAX))

DECLARE @ChrInd INT
DECLARE @Piece varchar(MAX)
DECLARE @ColNo INT
SET @ColNo = 1
SELECT @ChrInd = 1

WHILE @ChrInd > 0
    BEGIN
        SELECT @ChrInd = CHARINDEX(@Delim,@Input)

        IF @ChrInd > 0
            SELECT @Piece = LEFT(@Input,@ChrInd - 1)
        ELSE
            SELECT @Piece = @Input

        INSERT INTO @VALUES(ColNo, [Param]) VALUES(@ColNo, @Piece)
        SELECT @Input = RIGHT(@Input,LEN(@Input) - @ChrInd)

        IF LEN(@Input) = 0 BREAK

        SET @ColNo = @ColNo + 1
    END

--SELECT AS ROWS
SELECT * FROM @VALUES

--SELECT AS COLUMNS
SELECT * FROM
(
    SELECT ColNo, [Param] FROM @VALUES
) src
PIVOT(
    MAX([Param])
    FOR ColNo IN ([1],[2],[3],[4],[5])
) AS pvt

Results
ColNo       Param
--------------------------------------------------------------------------
1           200
2           50
3           jo.th@xxx.com
4           09\23\2016
5           07:00:00

1         2         3               4           5
--------- --------- --------------- ----------- ----------
200       50        jo.th@xxx.com   09\23\2016   07:00:00


text:
Q: Return multiple rows of data from INDEX, MATCH, MAXIFS - Google Sheets Sample Data: https://docs.google.com/spreadsheets/d/1CeksKcxsf10j_hnp7W1MoofBU-sGRp-d8oD_mrj14IY/edit?usp=sharing
Long story short, I used the INDEX, MATCH, and MAXIFS functions to return data from another sheet that matched certain criteria:
=index('Reading Journal'!A:A, match(maxifs('Reading Journal'!E:E, 'Reading Journal'!AB:AB, "January"), 'Reading Journal'!E:E, 0))
But it's only showing the first row of matching data and I'd like it to return all rows that match the criteria.
In the spreadsheet, the cell in question is C21 in the sheet 'January Stats' returning data from the 'Reading Journal' spreadsheet. I'd like for the formula to return the TITLE(s) [column A] with the highest RATING [column E] of all the data marked "January" under MONTH READ [column AB]. So if multiple entries have the same highest rating for the month, I'd like it to return all of them.
I can't tell if it might be possible with an Array or Query formula but I'm learning these on the fly and it's making my eyes cross.

A: try:
=TEXTJOIN(", ", 1, FILTER('Reading Journal'!A:A,
 'Reading Journal'!E:E=MAXIFS('Reading Journal'!E:E,
 'Reading Journal'!AB:AB, "January"), 'Reading Journal'!AB:AB="January"))


text:
Q: Need solution to expose details in table without destroying layout I'm currently looking for a solution allowing me to display a lot of log output in a compact, easy to read way. The goal is to hide as many information as possible until they become of interest since we need to display thousands of lines of log output.
I already succeeded in keeping our tables from going to a width of 2800px with introducing divs inside td's. Now I want to expose the full information to the user once he hovers over the div, but without destroying the layout of the table and without needing to have all information two times in the code, since the html already nears 3-4 MByte.
It's okay to use Javascript and/or JQuery but I'm new to it and am currently stuck.
Here is a small simplified example of the html code.

        <title>expose full details</title>

        PASS
        2012-10-10 09:30:31

c:\myfiles\are\not\stored\here\testscript.py:line434

Here is a very long log output that might continue for 10-20 lines

        FAIL
        2012-10-10 09:30:32

c:\myfiles\are\not\stored\here\testscript.py:line439

Here is another very long log output that might continue for 10-20 lines

Every hint is appreciated!
Thanks!

A: I think you should probably allow these divs to scroll if they are huge:
#codelines, #loglines {overflow: auto; width: 250px; max-height: 500px }

overflow:auto will only display a scroll bar if necessary, so it looks much better than overflow:scroll. Letting them scroll a 500px (or 800, whatever) box of logging is much nicer than having a giant webpage with additional info hidden way down.
EDIT:
If you really want this to only be available on hover you could use this:
#codelines:hover, #loglines:hover { overflow: hidden; width: 250px; max-height: 500px }
#codelines:hover, #loglines:hover {overflow: auto}

I've never really seen that done though.

A: Reread this I had a typo in code something put an extra quote in, and I said clarified the id and class a bit, I misspoke in there and said style when I mean class...
First off you need to be aware of a few things.
id="somename" should be a unique value throughout an entire document, if you want to group items to style them the same use class="somename" and reference it with a . instead of a # in your CSS.
You were not clear exactly where you want the data to be displayed, I believe this is what you were looking to do, you can use absolute positioning of the #fullline code to put it where you want. I read a comment you made about wanting to do this tooltip style which you could do with absolute positioning (dynamically adjusted in the showdtl section, but from what it sounds like you are wanting to do a static placement of the text would be best. I changed the width of the full line so you can see it properly expands as needed.
fullline being a unique id in your code I left alone, to illustrate usage of class and id.
I just tossed this together, it works but I'm sure it will require a bit of tweaking on your end to get the desired result.

      <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
      <title>expose full details</title>

              PASS
              2012-10-10 09:30:31

c:\myfiles\are\not\stored\here\testscript.py:line434

Here is a very long log output that might continue for 10-20 lines

              FAIL
              2012-10-10 09:30:32

c:\myfiles\are\not\stored\here\testscript.py:line439

Here is another very long log output that might continue for 10-20 lines


text:
Q: AWS Lambda: error creating the event source mapping: Configuration is ambiguously defined
There was an error creating the event source mapping: Configuration is ambiguously defined. Cannot have overlapping suffixes in two rules if the prefixes are overlapping for the same event type.

I created an event earlier from the GUI console 6-7 days ago and it was working fine. The next day the event just missing, i cant see it anymore at the Lambda console GUI. But every S3 objects still seems triggering the lambda function not a problem.   If i cant see, it is not good; So i deleted the Lambda function, waited for 5-10 seconds before creating another new function. And now, i receive the same above when i try to create the event sources like this:

When i click "Submit" the event sources tab says "You do not have any event sources for this function", Lambda does not get triggered; it means the entire application flow is now broken  :(
The problem is almost the same as: "https://forums.aws.amazon.com/thread.jspa?messageID=670712" But somehow i cant reply to that thread, so i created a new thread here instead. anyone encounter this issue?
In fact, i try to response to the existing AWS forum thread: https://forums.aws.amazon.com/thread.jspa?messageID=670712&#670712
but i keep getting this funny error: "Your message quota has been reached. Please try again later.". And i wasnt even posting anything, how can i use up my quota?

A: The issue must be that the s3 bucket is already linked with the suffix/prefix you are trying to link. Remove the link in S3 and try again.

A: What I suspect is your S3 bucket may still be "linked" to the lambda function.
Maybe check your S3 bucket for events and remove them there, then try creating the lambda events again?
i.e. S3 bucket-> properties-> Events
After 6 years nice to see some people still befitting from this answer,
Here is a shamless plug to youtube video I uploaded 2022-12-13.
https://www.youtube.com/watch?v=rjpOU7jbgEs

A: When you setup a lambda function and setup a trigger related to S3. The notification gets updated in the properties sections of that S3 bucket.
The mentioned error occurs when the earlier lambda function is deleted and you're trying to setup same kind of trigger again. This time the thing to note is, the S3 notification is still not deleted when you deleted the lambda function.
Goto S3 bucket > Properties > Event notifications
and delete the old setting and then setup new trigger in the new lambda function trigger.

A: Here is a link to a youtube video profiling this issue and demonstrating the solution:
https://www.youtube.com/watch?v=1Tfmc9nEtbU
Just as Ridwaan Manuel, you must remove the events by going to S3 bucket-> properties-> Events as the video shows.
Steps to reproduce this issue:

*

*Create a bucket and create a folder called "example/"

*Create Lambda Function

*Add S3 trigger to the lambda using the bucket from (1) with default settings

*Save the trigger

*Click Save and notice error

*Refresh the page and notice that the triggers disappeared

*Add the same bucket again and notice the ambiguous reference error


text:
Q: Bounties with no deadline Today I discovered that a number of Stack Exchange sites maintain a list of bounties with no deadline.  As this is unsupported by Stack Exchange, this is done outside the normal bounty system in an unofficial manner.  Each of these sites maintains a thread in the site's Meta titled "List of bounties with no deadline" or "List of bounties with no deadlines".
A Google web search returns the following such threads:

*

*Code Golf

*French Language

*Language Learning

*Literature

*Puzzling

*Science Fiction & Fantasy
The Literature page does a decent job summarizing the intent and usage:

One of the problems on Stack Exchange sites is that questions don't always receive good answers. While unanswered questions are easy to find, this is not the case with questions that have one or more answers that don't meet the criteria of the question asker (or of other users on the site).
For this reason, I am drawing some inspiration from other sites, such as Programming Puzzles & Code Golf and Puzzling:
This is a list of unofficial, deadline-less (hence not searchable) bounties offered by users on various challenges on the main site.
The list need not be limited to questions that already have an answer. You can offer bounties both for your own questions and for other people's questions.
Disclaimer: There is no guarantee that the user will award the bounty for you in case you fulfil its requirement. Especially if the user isn't an active member anymore. The only guarantee is his/her written word.

Guidelines for updating

*

*To add a bounty, create an answer that contains a link to the question that needs a (better) answer and the bounty you are willing to award.

*Answers can be commented on, allowing someone to notify the bounty's creator that the bounty may have been earned.

*If a bounty has been awarded, delete the entry or move it to another section of the answer, with a title such as "Awarded".

Given that six different sites have adopted this approach, there is a demonstrated desire for this feature in certain Stack Exchange sites.  That being said, I'm sure there are good reasons for the current bounty system that I suspect would make this a less ideal fit for other sites.
Should official built-in support for bounties with no deadline, or a similar feature that meets the same needs, be added to the Stack Exchange network?  These should be viewable/searchable in some manner.  Possibly this should be opt-in by the site, if this would be beneficial to some types of sites but harmful to others.


text:
Q: IdentityServer4 encodes # in LoginUrl I am building a frontend for IdentityServer4 using AngularJS with ui-router, but if I set UserInteraction.LoginUrl to /index.html#!/login the # gets urlencoded, breaking angular.
I have been trying to fix this, but I cannot find any relevant posts or documentation.
For Angular, the query string unfortunately has to come after # for $location to work, so removing #!/login from the url is not a valid solution.

A: As a somewhat hacky workaround, adding a minimalist login.html with this script works;
<script>
    window.location.href = window.location.href.replace('login.html', 'index.html#!/login');
</script>

But this is obviously not the ideal solution, as the client then has to make an extranous round trip to the server just to get redirected twice.

A: in my solution i basically used the below for User interactions. The actual SPA application was loaded because i was using usefileserver which also internally serves the default file "/Account/index.html" - I created account folder inside of wwwroot
Once the index.html is loaded, the angular route takes care of the rest
 services.AddIdentityServer(setupAction =>
    {
        setupAction.UserInteraction.LoginUrl = "/Account#Login";
        setupAction.UserInteraction.LogoutUrl = "/Account#Logout";
        setupAction.UserInteraction.ErrorUrl = "/Account#Error";
    })

I did not get any encoding issues


text:
Q: Facing an error with BigDecimal question in java The problem is :
You've received a stream that represents a set pf laboratory samples. B before the inout data is passed on further processing, you are required to perform some pre((-)) processing on it, what you must do is:

*

*Eliminate all null and negative values(noises).

*Divide the data into triple((-)) groups of three samples and retain only complete triples.

*Eliminate all triples whose average is higher that 30.

*Join all triplets again.

*Use SampleNormalizer to normalise the values. Unfortunately, due to poor design it returns optional<optional> and is it a bit buggy: it may return nulls(empty optionals), which you must eliminate. SampleNormalizer's normalise method accepts a single Big Decimal.

*Return a stream

You mustn't return null.
The thing is I am supposed to solve this in java 8
`.   import java.util.*;
import java.math.BigDecimal;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.stream.Stream;

import static java.math.BigDecimal.ZERO;
import static java.util.stream.Collectors.averagingDouble;
import static java.util.stream.Collectors.groupingBy;

class SamplePreprocessor {`your text`

    private final SampleNormalizer normalizer;

    SamplePreprocessor(SampleNormalizer normalizer) {
        this.normalizer = normalizer;
    }

    Stream<BigDecimal> preprocess(Stream<BigDecimal> input) {
        input = input.filter(bd -> bd != null && bd.compareTo(ZERO) > 0);

        // Step 2: Divide the data into triple groups and filter out the ones whose average is higher than 30

        input = input.collect(groupingBy(new AtomicInteger()::getAndIncrement, averagingDouble(BigDecimal::doubleValue)))

                .values()

                .stream()

                .filter(avg -> avg.doubleValue() <= 30)

                .flatMap(group -> Stream.of(group.toArray(new BigDecimal[3])))

                .map(Arrays::asList)

                .filter(list -> list.size() == 3)

                .map(list -> list.stream().reduce(BigDecimal.ZERO, BigDecimal::add).divide(BigDecimal.valueOf(3)));

        // Step 3: Use SampleNormalizer to normalize the values

        input = input.map(normalizer::normalize)

                .filter(Optional::isPresent)

                .map(Optional::get);

        // Step 4: Return the preprocessed stream of BigDecimal values

        return input;

    }
}
`

ERROR
Compiler output:
Starting a Gradle Daemon (subsequent builds will be faster)

Task :compileJava
/task/src/main/java/com/codility/SamplePreprocessor.java:27: error: no suitable method found for groupingBy(new Atomic[...]ement,Collector<BigDecimal,CAP#1,Double>)
input = input.collect(groupingBy(new AtomicInteger()::getAndIncrement, averagingDouble(BigDecimal::doubleValue)))
^
method Collectors.<T#1,K#1,D#1,A#1,M>groupingBy(Function<? super T#1,? extends K#1>,Supplier,Collector<? super T#1,A#1,D#1>) is not applicable
(cannot infer type-variable(s) T#1,K#1,D#1,A#1,M
(actual and formal argument lists differ in length))
method Collectors.<T#2,K#2,A#2,D#2>groupingBy(Function<? super T#2,? extends K#2>,Collector<? super T#2,A#2,D#2>) is not applicable
(cannot infer type-variable(s) T#2,K#2,A#2,D#2
(argument mismatch; invalid method reference
method getAndIncrement in class AtomicInteger cannot be applied to given types
required: no arguments
found: T#2
reason: actual and formal argument lists differ in length))
method Collectors.<T#3,K#3>groupingBy(Function<? super T#3,? extends K#3>) is not applicable
(cannot infer type-variable(s) T#3,K#3
(actual and formal argument lists differ in length))
where T#1,K#1,D#1,A#1,M,T#2,K#2,A#2,D#2,T#3,K#3 are type-variables:
T#1 extends Object declared in method <T#1,K#1,D#1,A#1,M>groupingBy(Function<? super T#1,? extends K#1>,Supplier,Collector<? super T#1,A#1,D#1>)
K#1 extends Object declared in method <T#1,K#1,D#1,A#1,M>groupingBy(Function<? super T#1,? extends K#1>,Supplier,Collector<? super T#1,A#1,D#1>)
D#1 extends Object declared in method <T#1,K#1,D#1,A#1,M>groupingBy(Function<? super T#1,? extends K#1>,Supplier,Collector<? super T#1,A#1,D#1>)
A#1 extends Object declared in method <T#1,K#1,D#1,A#1,M>groupingBy(Function<? super T#1,? extends K#1>,Supplier,Collector<? super T#1,A#1,D#1>)
M extends Map<K#1,D#1> declared in method <T#1,K#1,D#1,A#1,M>groupingBy(Function<? super T#1,? extends K#1>,Supplier,Collector<? super T#1,A#1,D#1>)
T#2 extends Object declared in method <T#2,K#2,A#2,D#2>groupingBy(Function<? super T#2,? extends K#2>,Collector<? super T#2,A#2,D#2>)
K#2 extends Object declared in method <T#2,K#2,A#2,D#2>groupingBy(Function<? super T#2,? extends K#2>,Collector<? super T#2,A#2,D#2>)
A#2 extends Object declared in method <T#2,K#2,A#2,D#2>groupingBy(Function<? super T#2,? extends K#2>,Collector<? super T#2,A#2,D#2>)
D#2 extends Object declared in method <T#2,K#2,A#2,D#2>groupingBy(Function<? super T#2,? extends K#2>,Collector<? super T#2,A#2,D#2>)
T#3 extends Object declared in method <T#3,K#3>groupingBy(Function<? super T#3,? extends K#3>)
K#3 extends Object declared in method <T#3,K#3>groupingBy(Function<? super T#3,? extends K#3>)
where CAP#1 is a fresh type-variable:
CAP#1 extends Object from capture of ?
/task/src/main/java/com/codility/SamplePreprocessor.java:51: error: incompatible types: inference variable R has incompatible bounds
.map(Optional::get);
^
equality constraints: BigDecimal
lower bounds: Optional
where R,T are type-variables:
R extends Object declared in method map(Function<? super T,? extends R>)
T extends Object declared in interface Stream
2 errors

Task :compileJava FAILED

FAILURE: Build failed with an exception.

*

*What went wrong:
Execution failed for task ':compileJava'.

Compilation failed; see the compiler error output for details.

*

*Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

*Get more help at https://help.gradle.org
Deprecated Gradle features were used in this build, making it incompatible with Gradle 5.0.
See https://docs.gradle.org/4.8.1/userguide/command_line_interface.html#sec:command_line_warnings
BUILD FAILED in 9s
1 actionable task: 1 executed
Exit code: 1


text:
Q: Mongo query with $geoWithin and $near together My use case is I want to get all records within a city and nearby some location should come first.
Lets say I have following records:
{"name" : "A", "location" : {"point" : [latlngs1]}}, //LatLng1 is in cityA
{"name" : "B", "location" : {"point" : [latlngs2]}}, //LatLng2 is in cityB
{"name" : "C", "location" : {"point" : [latlngs3]}}, //LatLng3 is in cityA
{"name" : "D", "location" : {"point" : [latlngs4]}}  //LatLng4 is in cityA

I wished to get all records within CityA with nearby latlng5.
Say distance bw location points
[latlng5, latlng1] --> 10 unit
[latlng5, latlng3] --> 5 unit
[latlng5, latlng4] --> 8 unit

So Result should be like this:
{"name" : "C"},
{"name" : "D"},
{"name" : "A"}

With my research I found that $geoWithin is best to apply bounded query, so I can find records within a city using $geoWithin.

db.TEST.aggregate( [ { $match: {"location.point" : {$geoWithin: {$box:
  [[northEastLngLat],[SouthWestLngLat] ] } } }, {$project:
  {name: 1}}]).pretty();

This brings records: A,C and D
Now for nearby places first I found $geoNear would fit here.
So Query is like:

b.TEST.aggregate([ {"$geoNear" : {near: [latlng5], distanceField:
  "distance", spherical: true}}, {$match: {"location.point" :
  {$geoWithin: {$box: [[northEastLngLat],[SouthWestLngLat] ]}}},
  {$project: {name: 1}}]).pretty();

But this produces no output. I tried changing latlngs for $near sometimes for few cases it produce 1 result and for other 0 results.
What is wrong in my query. Please help.
Thank You

A: You should try this it will fetch all records within 10 km
 db.city.find({
   location :{
     $near : {
  $geometry : {
     index : "Point" ,
     coordinates : [19.1, 72.89]
    },
 $maxDistance : 10000
}
 }
     })

It will return all records and make sure you have index on location


text:
Q: Is it possible to use Jasmine without Karma for testing Angular/Node based Nw.js apps? I've read ton's of tutorials, but I must admit that this testing stuff is still very confusing to me. I have a Nw.js app which (of course) uses NodeJS and also Angular. I've installed the Jasmine test framework globally via npm and wrote an example test which starts with the following lines, and placed it in the spec sub-directory:
describe ( 'Test for my controller', function () {
    beforeEach ( module ('module_under_test') );

    ... and so on ...

});

When running the test by typing jasmine on the cmd line (from the root folder of the app), I get the following error message:
TypeError: module is not a function

I know that I have to include the Angular library somehow. But where? In a normal browser application, it is included in the HTML <script> tag, but I don't have this possibility. I also know that I could write a HTML file, which shows the Jasmine result page after tests have finished, but I would prefer to start Jasmine on the cmd line.
First I thought about adding the angular library to the "helpers" entry in jasmine.json. But it didn't work. The documentation of this file is unfortunately very poor. In the Angular documentation and tutorials it is always mentioned to use Karma. But my understanding is that Karma is only useful for testing with browsers, since it spawns an own webserver. This does not make sense in my case.
Would be great if somebody could give me a hint, thanks!


text:
Q: Displaying elements of a struct array by using a function So I need to display a table with all of the categories such as housing, transportation, etc along with the other information in each of the arrays that I've initialized. I can't seem tot figure out how to display individual array elements using the "displayTable" function. When I say "cout << housing[0] << "   " << utilities[0]" and so on I keep getting a build error. I've tried different syntax as well but I just can't figure it out. It's for an assignment in one of my classes. Any help is much appreciated!
#include <iostream>
#include <iomanip>

using namespace std;

struct Category
{
    string category;
    double maxAmount;
    double amountSpent;
};

void displayTable(Category housing[3], Category utilities[3],
              Category transportation[3], Category food[3],
              Category entertainment[3], Category miscellaneous[3])
{
  cout << setprecision(2)
       << housing[0];
}

int main()
{
    int menuChoice;

    Category housing = {"Housing", 500.00, 0.00};
    Category utilities = {"Utilities", 150.00, 0.00};
    Category transportation = {"Transportation", 50.00, 0.00};
    Category food = {"Food", 250.00, 0.00};
    Category entertainment = {"Entertainment", 150.00, 0.00};
    Category miscellaneous = {"Miscellaneous", 50.00, 0.00};

    do
    {

    } while (menuChoice != 3);

    return 0;
}

A: I think you don't study well the array etc. With the string housing[0] you access the first element of an array named housing however in this case there is not array in the code. Maybe you want to create a function that take an element of the type Category and print the value of its field. Something like this:
displayCategory(Category aCategory){
    cout<<"Category = "+aCategory.category+"\n"+"maxAmount ="+aCategory.maxAmount+"\n"+"amountSpent = "+aCategory.amountSpent+"\n";
}

Then you maybe want to create an array of Category so instead of declare a variable for every category you could do this:
Category arrayOfCategory[6];
arrayOfCategory[0] = {"Housing", 500.00, 0.00};
arrayOfCategory[1] = {"Utilities", 150.00, 0.00};
arrayOfCategory[2] = {"Transportation", 50.00, 0.00};
arrayOfCategory[3] = {"Food", 250.00, 0.00};
arrayOfCategory[4] = {"Entertainment", 150.00, 0.00};
arrayOfCategory[5] = {"Miscellaneous", 50.00, 0.00};

now if you want a function that print all the category in arrayOfCategory simply using the first function displayCategory we can create this function:
displayTable(Category *anArrayOfCategory, int dimOfTheArray){
    for(int i = 0; i < dimOfTheArray; i++)
        displayCategory(anArrayOfCategory[i]);
}

A: You should treat Category as a struct, not as an array
The simplest way is to access members in the following way
void displayTable(Category housing, Category utilities,
              Category transportation, Category food,
              Category entertainment, Category miscellaneous)
{
  cout << setprecision(2)
       << housing.maxAmount;
}

A: void displayTable(Category housing[3], Category utilities[3],
          Category transportation[3], Category food[3],
          Category entertainment[3], Category miscellaneous[3])
{
    std::cout << setprecision(2) << housing[0];
}

housing[0] is of type Category, which you made. How should std::cout know what to print if you give it your own custom type?
You can print the members of your struct one by one like so:
std::cout << setprecision(2) << housing[0].maxAmount;

or implement a custom << operator inside your type:
struct Category
{
    std::string category;
    double maxAmount;
    double amountSpent;

    friend std::ostream& operator<< (std::ostream& stream, const Category& category) {
        stream << category.maxAmount;
    }
};

and then your original code should work fine.
(Obviously you need to add the other members to the output as well, and maybe add some headers/titles, commas etc. for human readability, but the principle should be clear.)


text:
Q: Android Questions App Answer==MyAnswer not null I make android questions app. I can not find the right answer. Answer list.
Right answer: String answer = quizList.get(position).getAnswer();
Button Click:
    buttonA.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {

            if (answer =="A"){

                lblsignboard.setText("Ok");

            }
            else
            {

                lblsignboard.setText("No");

            }
        }
    });

Answer = "A", but this code does not work. Always gives the answer is no.

A: When you are comparing strings in java,always use .equals
Because the function (.equals) checks the actual contents of the string, the == operator checks whether the references to the objects are equal.
and now furthur using equalsignorecase you need not to worry about search string is in caps or small.
buttonA.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            if (equalsIgnoreCase("a")){
                lblsignboard.setText("Ok");
            }else{
                lblsignboard.setText("No");
            }
        }
    });

A: You can use this way too, to keep you code working even the answer key is of different case. Use either equals("A") or equalsIgnoreCase("a").
 buttonA.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            if (answer.equals("A") || equalsIgnoreCase("a")){
                lblsignboard.setText("Ok");
            }else{
                lblsignboard.setText("No");
            }
        }
    });

A: In Android we make use of two things to compare strings:
1. equals : this is used when you want to compare even case of the string.
2. equalsIgnoreCase: This is just for content comparison.
Here is the small illustration as how it works:
   String myString = "heLLo";

    if(myString.equals("hello"))
    {
     System.out.print("equals");
    }
    else if(myString.equalsIgnoreCase("hello"))
    {
        System.out.print("equalsIgnoreCase");
    }

Here equalsIgnoreCase will be printed.

A: Strings can only compare by .equals method not by ==. Also you have to check string is null or not because .equals method may invoke
nullpointerexception and you app may crash.
    buttonA.setOnClickListener(new View.OnClickListener() {
    @Override
    public void onClick(View v) {
      if(answer!=null &&(answer.equals("A")||equalsIgnoreCase("a"))) {
            lblsignboard.setText("Ok");
      } else {
            lblsignboard.setText("No");
      }
    }
});

A: String can compare is .equals or .eqalignorecase not a '==' sign.'==' using a int value compare.
String answer=item.get(position).getAnswer();
    if(answer!=null && (answer.equals("A")||equalsIgnoreCase("a")){
            Log.e("Comapare","----------Success");
    }else{
        Log.e("Comapare","----------not compare");
    }


text:
Q: file_get_contents doesn't write to a log file I am trying to write content to a log file using form input data. This doesn't seem to work on a server that's is using php version 5.3.14 but when i put the same code on a server that uses 5.3.27 its working. Does any one have an idea on how to fix this?
Below is my code that i am using for my form action. incoming.log is the file that i am trying to write to and is found in the folder path live/lms on the server. Please not that i am not getting any errors.
<?php

$system_path = '/live/lms/';
$fh = fopen($system_path . "incoming.log", "a");
fwrite($fh, "\nReceived:\n" . date("Y-m-d H:i:s") . "\n" . file_get_contents("php://input"));

fclose($fh);
?>

A: Not exactly an answer, but advise:
You should add more error handling ...and structure the script in a way so you can add more error handling.
For starters (work in progress):
<?php
$system_path = '/live/lms/';
$fhSource = fopen('php://input', 'rb');
if (!$fhSource) {
    trigger_error('fopen input: '. print_r(error_get_last(), true), E_USER_ERROR );
}

$fhTarget = fopen($system_path . "incoming.log", 'a');
if (!$fhTarget) {
    trigger_error('fopen output: '. print_r(error_get_last(), true), E_USER_ERROR );
}

$cb = stream_copy_to_stream($fhSource, $fhTarget);

var_dump($cb);

fclose($fhSource);
fclose($fhTarget);


text:
Q: Dual booting windows and Ubuntu. Windows 7 wont load! I decided to dual boot Ubuntu 11.10 and windows 7, after i restarted it I did not get the choice between Windows and Ubuntu. So I downloaded Startup manager and realized that windows was not on it. so I check fdisk -l and got this
  Device Boot         Start         End      Blocks   Id  System
  /dev/sda1   *        2046    42000383    20999169    5  Extended
  Partition 1 does not start on physical sector boundary.
  /dev/sda5            2048    42000383    20999168   83  Linux

I am not sure what I am supposed to do to get windows started.

A: there are no windows partitions, I think You erase windows partitions during ubuntu installations.
How did You install dual boot with windows?


text:
Q: VBA code _ Update one Pivot Item in a field within several pivot table I am woking on Year to date basis, so forprevious year, I am updating the weeks selected (From week 1 to current week (see below) table by table.
Is there a way to update in the same way other pivot table in the same sheet but not them all or should y just pate the action below for each table.
Dim Pi As PivotItem
Dim Pf As PivotFields
Dim Pt As PivotTable

Set Pt = Sheets("FarmSheetPivot"). PivotTables("Farm_2012")
    With Pt.PivotFields("ReportWk")

For Each Pi In .PivotItems
If (Pi.Value) <= Range("b1") Then
                            Pi.Visible = True
                            Else
                            Pi.Visible = False
    End If
Next
End With

End Sub

Tks a lot


text:
Q: 100% width issue in CSS I just purchased this template. The template is cool working good in all browsers but when I load the template and then if I resize the browser there comes a horizontal scroll bar with white space. This is the only issue with the template. There is no one to give assistance regarding this issue. I believe I am good at CSS but as this template is having alls of lines I couldn't sort out where the issue is. I tried running Firebug to detect the issue but I couldn't. Can anyone help me by checking the CSS of this template using Firebug and suggest me the CSS code that will not show a horizontal scroll bar with white space.
Thanks.
Issue screenshot.

A: Add this in your head section
<meta name="viewport" content="width=device-width, initial-scale=1.0">


text:
Q: Number of $\mathbb{F}_q$-rational points on a smooth variety From the proof of Weil's conjectures it follows that
$|q^k - \# X(\mathbb{F}_{q^k})| = O(q^{k(n - \frac{1}{2})})$, where
$X$ is a smooth variety over $\mathbb{F}_q$ and $n = \dim X$ (see for example http://www-math.mit.edu/~poonen/papers/Qpoints.pdf). How the constant in $O(\ldots)$ can be estimated?
Every estimation  (even very rough) is interesting.


text:
Q: How to equals Kotlin & Java BasicTypes I want to getTypeByClass() in my Android Application. This function is exchange the class to string.
    public fun getTypeByClass(type: Class<*>): String {
        return if (type == String::class.java) {
            "TEXT"
        } else if (type == Long::class.java) {
            "INTEGER"
        } else {
            "NULL"
        }
    }

   System.err.println(getTypeByClass(Long.class));

The output is NULL,but i need INTEGER.
And i decompile the class
return Intrinsics.areEqual(type, String.class) ? "TEXT" : (Intrinsics.areEqual(type, Long.TYPE) ? "INTEGER" : "NULL");

Long::class.java is corresponding Long.TYPE

A: You can use is operator. Refer this for type checks and cast in kotlin
https://kotlinlang.org/docs/reference/typecasts.html

A: KOTLIN
Kotlin Playground: Edit, Run, Share Kotlin Code Online
 /**
 * You can edit, run, and share this code.
 * play.kotlinlang.org
 */

fun main() {
    println("Hello, world!!!")
    var var1 = 10L as Long
    println(getTypeByClass(var1::class.java))
}
fun getTypeByClass(type: Class<*>): String
{
        return if (type == String::class.java) {
            "TEXT"
        } else if (type == Long::class.java) {
            "INTEGER"
        } else {
            "NULL"
        }
 }

JAVA
    /******************************************************************************

                            Online Java Compiler.
                Code, Compile, Run and Debug java program online.
Write your code in this editor and press "Run" button to execute it.

*******************************************************************************/

public class Main
{
    public static void main(String[] args) {
        Long x = 10L;
        String s = "";
        System.out.println(getType(s));
    }
    public static String getType(Object object)
    {
        if(object.getClass().equals(Long.class) || object.getClass().equals(Double.class) || object.getClass().equals(Integer.class) || object.getClass().equals(Float.class))
        {
            return "INTEGER";
        }
        else if(object.getClass().equals(String.class))
        {
            return "STRING";
        }
        return "UNKNOWN";
    }
}


text:
Q: outbound-gateway along with outbound-channel-adapter got error While playing with the code from spring-integration-samples project and trying to implement following flow:
read_file->backup_file->transform_file->write_file

*

*'read_file' is file:inbound-channel-adapter

*'backup_file' is 'service-activator' calling java service (doing copy file)

*'transform_file' are 2 transformers

*'write_file' is file:outbound-channel-adapter that is writing the processed file

Everything is working good until the moment when I did try to implement 'backup_file' step as a file:outbound-gateway
I got the error:

Error while loading fileCopyDemo-file due to No qualifying bean of type 'org.springframework.integration.file.FileWritingMessageHandler' available: expected single matching bean but found 2: org.springframework.integration.file.config.FileWritingMessageHandlerFactoryBean#0,org.springframework.integration.file.config.FileWritingMessageHandlerFactoryBean#1

Here is my config:
<!--read_file-->
<int-file:inbound-channel-adapter auto-startup="true" id="filesIn" channel="filesBackup"
        directory="${int.uvrp.original}"
        filter="compositeFileFilter" >
        <int:poller id="poller" max-messages-per-poll="10" cron="*/10 * * * * *" default="true" />
</int-file:inbound-channel-adapter>

<!--backup_file-->
<int-file:outbound-gateway id="backupGate" request-channel="filesBackup" reply-channel="filesProcessing" directory="file:${int.archive}" />

<!--transform_file-->
<int-file:file-to-bytes-transformer input-channel="filesProcessing" output-channel="bytes" />
<int:transformer input-channel="bytes" output-channel="filesStore" ref="myTransformer1" method="transform" />

<!--write_file-->
<int-file:outbound-channel-adapter id="filesOut" channel="filesStore" directory="${int.processed}" delete-source-files="true"/>

Any ideas?

A: Thanks for the hint. I have created the project from scratch, copied the configuration file and everything is working as expected.


text:
Q: here maps API for Batch Reverse Geocode Locations returns SuccessCount 0 on completed jobs everytime What we are trying to achive
Get Geocoordinates for Multiple Addresses as per https://developer.here.com/documentation/batch-geocoder/dev_guide/topics/quick-start-batch-geocode.html
Environment
We are using the latest HERE Batch Geocoder API as of today (July 27 2021) https://developer.here.com/documentation/batch-geocoder/dev_guide/topics/api-reference.html
We are using the official Endpoint https://batch.geocoder.ls.hereapi.com/6.2/jobs/ and we are using apiKey, i.e. we are not using app_id/app_code as authentication method.
Our POST looks like this in our Postman project:
https://batch.geocoder.ls.hereapi.com/6.2/jobs?apiKey={{here-rest-api-key}}&indelim=%7C&outdelim=%7C&action=run&outcols=displayLatitude%2CdisplayLongitude%2Ccity%2Cstate%2Ccountry&outputcombined=true&maxresults=500&gen=8&header=true
Problem
Upon sending the Batch request, the API endpoint responds with SUCCESS (no credential errors):
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<ns2:SearchBatch xmlns:ns2="http://www.navteq.com/lbsp/Search-Batch/1">
    <Response>
        <MetaInfo>
            <RequestId>0FXztndLCKfpPFuOjGiGruNKcKXHIxpZ</RequestId>
        </MetaInfo>
        <Status>accepted</Status>
        <TotalCount>0</TotalCount>
        <ValidCount>0</ValidCount>
        <InvalidCount>0</InvalidCount>
        <ProcessedCount>0</ProcessedCount>
        <PendingCount>0</PendingCount>
        <SuccessCount>0</SuccessCount>
        <ErrorCount>0</ErrorCount>
    </Response>
</ns2:SearchBatch>

This is the POST request Body:
recId|searchText|country
0001|Invalidenstraße 116 10115 Berlin|DEU
0002|Am Kronberger Hang 8 65824 Schwalbach|DEU
0003|425 W Randolph St Chicago IL 60606|USA
0004|One Main Street Cambridge MA 02142|USA
0005|200 S Mathilda Ave Sunnyvale CA 94086|USA
0006|45492 Via Jaca Temecula CA|USA
0007|Marchant Pereira 1171 Providencia|CHL
0008|Los Alamos 1294 Santiago Centro|CHL
0009|Avenida Las Condes 12461 Las Condes|CHL
0010|Avenida Tulum 40 Cancun|MEX

After some seconds, Upon checking the Job Status, we get this result:
https://batch.geocoder.ls.hereapi.com/6.2/jobs/0FXztndLCKfpPFuOjGiGruNKcKXHIxpZ?action=status&apiKey={{here-rest-api-key}}
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<ns2:SearchBatch xmlns:ns2="http://www.navteq.com/lbsp/Search-Batch/1">
    <Response>
        <MetaInfo>
            <RequestId>0FXztndLCKfpPFuOjGiGruNKcKXHIxpZ</RequestId>
        </MetaInfo>
        <Status>completed</Status>
        <JobStarted>2021-07-27T18:52:52.000Z</JobStarted>
        <JobFinished>2021-07-27T18:52:55.000Z</JobFinished>
        <TotalCount>10</TotalCount>
        <ValidCount>10</ValidCount>
        <InvalidCount>0</InvalidCount>
        <ProcessedCount>10</ProcessedCount>
        <PendingCount>0</PendingCount>
        <SuccessCount>0</SuccessCount>
        <ErrorCount>10</ErrorCount>
    </Response>
</ns2:SearchBatch>

Which means that our request was valid, it processed 10 records, the 10 records are valid, but... we still got 0 SuccessCount and 10 ErroCount (no item was succesfully reverse geocoded).
When we Get Job Result https://batch.geocoder.ls.hereapi.com/6.2/jobs/{{here-id-job}}/result?apiKey={{here-rest-api-key}} we get the results with empty fields:
recId|SeqNumber|seqLength|displayLatitude|displayLongitude|city|state|country
0001|0|0|||||DEU
0002|0|0|||||DEU
0003|0|0|||||USA
0004|0|0|||||USA
0005|0|0|||||USA
0006|0|0|||||USA
0007|0|0|||||CHL
0008|0|0|||||CHL
0009|0|0|||||CHL
0010|0|0|||||MEX

I've tried different Body requests, and in every scenario I get 100% ValidCount but 100% ErrorCount.
As per their pricing, Batch Requests are supported in Free Accounts. https://developer.here.com/pricing?planId=Freemium-Basic&fromFree=true&period=monthly#plan-details
Anybody has had this issue? Where are we missing something?

A: For those who might have the same issue, we solved the problem by using a different Field delimiter in the input data (indelim).
All examples and Guide on HERE for Batch use | (pipe, URL encoded: %7C) but one of our devs pointed out that pipe usually means trouble in API data exchanges.
So we changed indelim to %3B (we also changed the outdelim to %3B for consistency), so this is what our POST URL looked like:
https://batch.geocoder.ls.hereapi.com/6.2/jobs?apiKey={{here-rest-api-key}}&indelim=%3B&outdelim=%3B&action=run&outcols=displayLatitude%2CdisplayLongitude%2Ccity%2Cstate%2Ccountry&outputcombined=true&header=true

And we changed the POST Body from:
recId|searchText|country
1|425 W Randolph St, Chicago Illinois 60606|USA
2|31 St James Ave Boston MA 02116|USA
3|10115 Berlin Invalidenstrasse 117|DEU

to:
recId;searchText;country
1;425 W Randolph St, Chicago Illinois 60606;USA
2;31 St James Ave Boston MA 02116;USA
3;10115 Berlin Invalidenstrasse 117;DEU
...

And it worked like a charm!
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<ns2:SearchBatch xmlns:ns2="http://www.navteq.com/lbsp/Search-Batch/1">
    <Response>
        <MetaInfo>
            <RequestId>JOBID</RequestId>
        </MetaInfo>
        <Status>completed</Status>
        <JobStarted>2021-07-28T17:37:38.000Z</JobStarted>
        <JobFinished>2021-07-28T17:37:45.000Z</JobFinished>
        <TotalCount>428</TotalCount>
        <ValidCount>428</ValidCount>
        <InvalidCount>0</InvalidCount>
        <ProcessedCount>428</ProcessedCount>
        <PendingCount>0</PendingCount>
        <SuccessCount>428</SuccessCount>
        <ErrorCount>0</ErrorCount>
    </Response>
</ns2:SearchBatch>

Hope this helps to someone using the HERE Batch Geocoder API :).


text:
Q: Singleton NSMutableDictionary property won't allow setObject:forKey I have a complete noob question for you. I'm obviously rusty with obj-c. I have a simple shopping cart class implemented as a singleton and just want it to store a single NSMutableDictionary. I want to be able to add objects to this dictionary from anywhere in the app. But for some (I'm sure simple) reason it's just returning null. No error messages.
ShoppingCart.h:
#import <Foundation/Foundation.h>

@interface ShoppingCart : NSObject

// This is the only thing I'm storing here.
@property (nonatomic, strong) NSMutableDictionary *items;

+ (ShoppingCart *)sharedInstance;

@end

ShoppingCart.m:
// Typical singelton.
#import "ShoppingCart.h"

@implementation ShoppingCart

static ShoppingCart *sharedInstance = nil;

+ (ShoppingCart *)sharedInstance
{
    @synchronized(self)
    {
        if (sharedInstance == nil)
            sharedInstance = [[self alloc] init];
    }
    return(sharedInstance);
}

@end

And in my VC I'm trying to set it with:
- (IBAction)addToCartButton:(id)sender
{
    NSDictionary *thisItem = [[NSDictionary alloc] initWithObjects:@[@"test", @"100101", @"This is a test products description"] forKeys:@[@"name", @"sku", @"desc"]];

    // This is what's failing.
    [[ShoppingCart sharedInstance].items setObject:thisItem forKey:@"test"];

    // But this works.
    [ShoppingCart sharedInstance].items = (NSMutableDictionary *)thisItem;

    // This logs null. Specifically "(null) has been added to the cart"
    DDLogCInfo(@"%@ has been added to the cart", [[ShoppingCart sharedInstance] items]);
}

Thanks

A: You are never creating a NSMutableDictionary object named items.
You could create it in the init of ShoppingCart.
-(id)init
{
    if(self = [super init]) {
        _items = [NSMutableDictionary dictionary];
    }
    return self;
}

or in sharedInstance
+ (ShoppingCart *)sharedInstance
{
    @synchronized(self)
    {
        if (sharedInstance == nil)
            sharedInstance = [[self alloc] init];
            sharedInstance.items = [NSMutableDictionary dictionary];
    }
    return(sharedInstance);
}

A: I might also add it's better (arguably) to set up your shared instance like so:
static ShoppingCart *instance = nil;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
    instance = [[self alloc] init];
    instance.items = [NSMutableDictionary dictionary];
});

return instance;


text:
Q: mapping keys of Object in javascript I would like to change key names in such object:
const data = {
key1: 'value1',
key2: 'value2',
key3: 'value3',
key4: 'value4',
}

with those keys from map:
const map = {
'key1': 'change1',
'key4': 'change4'
}

Using code below:
const replacedKeysInData = Object.keys(data).map((key) => {
const keyFromMap = map[key] || key;
return { [keyFromMap]: data[key] }
})
console.log(replacedKeysInData);

I get:
[
{ change1: 'value1' },
{ key2: 'value2' },
{ key3: 'value3' },
{ change4: 'value4' }
]

The point is that I would like to have it in one object:
{
change1: 'value1',
key2: 'value2',
key3: 'value3',
change4: 'value4'
}

I suppose it is simple, how can I do it?
Thanks

A: you are using map which returns an array. I created an empty object and added the keys in a forEach

const data = {
key1: 'value1',
key2: 'value2',
key3: 'value3',
key4: 'value4',
}
const map = {
'key1': 'change1',
'key4': 'change4'
}

const replacedKeysInData ={}
Object.keys(data).forEach((key) => {
const keyFromMap = map[key] || key;
replacedKeysInData[keyFromMap] = data[key]
})
console.log(replacedKeysInData);

A:

const data = {
  key1: 'value1',
  key2: 'value2',
  key3: 'value3',
  key4: 'value4',
}

const map = {
  'key1': 'change1',
  'key4': 'change4'
}

const replacedKeysInData = Object.entries(data).map(val => {
  if (Object.keys(map).includes(val[0])) {
    return [map[val[0]], val[1]]
  } else {
    return val
  }
});

const newData = Object.fromEntries(replacedKeysInData);

console.log(newData)

A: It doesn't have to be anything complicated. Just iterate over the object, swap keys, and delete the original.

const data={key1:"value1",key2:"value2",key3:"value3",key4:"value4"},map={key1:"change1",key4:"change4"};

for (const key in data) {
  if (map[key]) {
    data[map[key]] = data[key];
    delete data[key];
  }
}

console.log(data);


text:
Q: shorting the 9/12V AC at transformer?

*

*1st sense IR - no relay ON

*2nd sense IR - 9 VAC relay ON

*3rd sense IR - 12 VAC relay ON

Mean while if operate the switch there is a chance shorting the 9V/12 VAC at transformer?
Relay datasheet:https://datasheetspdf.com/pdf-file/657851/TIANBOGANGLIANELECTRONICS/HJR-3FF-S-Z/1

A: You have not used proper switch symbols in your drawing but I guess you mean that you are considering wiring them as shown in Figure 1a. This will be a problem as there is a danger of short-circuiting the 9 VAC to the 12 VAC transformer tap.

simulate this circuit – Schematic created using CircuitLab
The SC5-S-DC5V relay appears to have a change-over contact so you can wire them as shown in Figure 1b. This prevents short-circuit of the transformer.


text:
Q: Accessing Appfabric cache from another machine I have a computer(X1) where a web application built in VS 2010 runs and Appfabric is installed and used in this app. I have another computer(X2) where also Appfabric is installed. Both computers are connected in a workgroup.
For example, currently I have created a cache "NamedCache1" in X1 and using this to store value and referencing it from my app in X1. I have created a cache "NamedCache2" in X2 and I want to use this cache "NamedCache2" in my app. How can I acieve this?

A: The question is a bit vague as to where you are in configuring AppFabric. I'll assume you've run through the steps at one of the many Google results to configure AppFabric caching, such as the one by Scott Hanselman. If you look at his CacheUtil class at that link, you can modify it to access two caches.
using Microsoft.ApplicationServer.Caching;
using System.Collections.Generic;

public class CacheUtil
{
    private static DataCacheFactory _factory = null;
    private static DataCache _NamedCache1 = null;
    private static DataCache _NamedCache2 = null;

    public static DataCache GetNamedCache1()
    {
        if (_NamedCache1 != null)
            return _NamedCache1;

        //Define Array for 2 Cache Hosts
        List<DataCacheServerEndpoint> servers = new List<DataCacheServerEndpoint>(2);

        //Specify Cache Host Details
        //  Parameter 1 = host name
        //  Parameter 2 = cache port number
        servers.Add(new DataCacheServerEndpoint("X1", 22233));
        servers.Add(new DataCacheServerEndpoint("X2", 22233));

        //Create cache configuration
        DataCacheFactoryConfiguration configuration = new DataCacheFactoryConfiguration();

        //Set the cache host(s)
        configuration.Servers = servers;

        //Set default properties for local cache (local cache disabled)
        configuration.LocalCacheProperties = new DataCacheLocalCacheProperties();

        //Disable tracing to avoid informational/verbose messages on the web page
        DataCacheClientLogManager.ChangeLogLevel(System.Diagnostics.TraceLevel.Off);

        //Pass configuration settings to cacheFactory constructor
        _factory = new DataCacheFactory(configuration);

        //Get reference to named cache called "default"
        _NamedCache1 = _factory.GetCache("NamedCache1");

        return _NamedCache1;
    }

    public static DataCache GetNamedCache2()
    {
        if (_NamedCache2 != null)
            return _NamedCache2;

        //Define Array for 2 Cache Hosts
        List<DataCacheServerEndpoint> servers = new List<DataCacheServerEndpoint>(2);

        //Specify Cache Host Details
        //  Parameter 1 = host name
        //  Parameter 2 = cache port number
        servers.Add(new DataCacheServerEndpoint("X1", 22233));
        servers.Add(new DataCacheServerEndpoint("X2", 22233));

        //Create cache configuration
        DataCacheFactoryConfiguration configuration = new DataCacheFactoryConfiguration();

        //Set the cache host(s)
        configuration.Servers = servers;

        //Set default properties for local cache (local cache disabled)
        configuration.LocalCacheProperties = new DataCacheLocalCacheProperties();

        //Disable tracing to avoid informational/verbose messages on the web page
        DataCacheClientLogManager.ChangeLogLevel(System.Diagnostics.TraceLevel.Off);

        //Pass configuration settings to cacheFactory constructor
        _factory = new DataCacheFactory(configuration);

        //Get reference to named cache called "default"
        _NamedCache2 = _factory.GetCache("NamedCache2");

        return _NamedCache2;
    }
}


text:
Q: Is it possible to get stories from facebook using API I'm looking to get the stories from facebook as shown in the image below

I can see the instagram offering story api here https://developers.facebook.com/docs/instagram-api/reference/ig-user/stories/ but is there similar resource to get the facebook stories instead?


text:
Q: Golang removing all text between two specific strings Is it possible from go/golang to just delete everything contained in between two strings?
I have a input.txt file which has the following structure:
#start-kiwi
this text
is important
#end-kiwi

#start-banana
this text
needs to be
completely removed
#end-banana

#start-orange
this text
is also important
#end-orange

From go code I am trying to delete everything in between the markers #start-banana and #end-banana (included both) so the desired result would be:
#start-kiwi
this text
is important
#end-kiwi

#start-orange
this text
is also important
#end-orange

I am using go 1.19 and I have already tried these methods:
string.Contains(strings.Replace(input.txt, "#start-banana", "")
string.Contains(strings.Replace(input.txt, "#end-banana", "")

But it seems like it is not working all right. Is there any preferred method of achieving this? RegEx? With strings library?
Thanks in advance.

A: You can use the index in order to delimit the portion of text that have to be deleted:
package main

import (
    "fmt"
    "strings"
)

func main() {
    data := `
#start-kiwi
this text
is important
#end-kiwi

#start-banana
this text
needs to be
completely removed
#end-banana

#start-orange
this text
is also important
#end-orange`

    start := "#start-banana"
    stop := "#end-banana"
    startIndex := strings.Index(data, start)
    stopIndex := strings.Index(data, stop) + len(stop)
    res := data[:startIndex] + data[stopIndex:]
    res = strings.ReplaceAll(res, "\n\n", "\n")
    fmt.Println(res)
}

The result will be the following:
#start-kiwi
this text
is important
#end-kiwi

#start-orange
this text
is also important
#end-orange

A: You can also use regular expressions:
package main

import (
    "fmt"
    "regexp"
)

func main() {

    s := removeBetween(text, "#start-banana", "#end-banana[\n\r]?")

    fmt.Println(s)
}

// removeBetween removes all characters (including new lines) between the start and end markers
func removeBetween(str, start, end string) string {

    anyIncludingEndLine := fmt.Sprintf(`%s[\r\n\s\w]*%s`, start, end)

    return regexp.MustCompile(anyIncludingEndLine).ReplaceAllString(str, "")
}

var text = `
#start-kiwi
this text
is important
#end-kiwi

#start-banana
this text
needs to be
completely removed
#end-banana

#start-orange
this text
is also important
#end-orange
`


text:
Q: Deleting lines with different patterns in a file I need to delete lines with different patterns,
For example
sed '/Paris/d' file.txt |  cat -s
sed '/London/d' file.txt |  cat -s
sed '/Rome/d' file.txt |  cat -s
sed '/Pais/d' file.txt |  cat -s

How to do it using an array of name of cities and only type one time the command sed?

A: You can use sed in the following way:
sed '/paris\|london\|rome\|pais/Id' cities

The I indicates not to match the case
The d means delete every matching line in the pattern space.

A: using awk:
awk '{if(match(tolower($0),/(paris|london|rome)/)==0) print $0}' file > file

tolower will convert entire line to lowercase
match returns starting position of substring if matched else 0
awk will print only the line which dosen't contain Paris,London,Rome  and save it to same file


text:
Q: How do I use @ViewChild with an external ng-template (Angular 11) THE PROBLEM
So I have two Angular components, a parent and a child. The parent passes a custom template to the child component, which then hydrates the template with its own data using ngTemplateOutlet.
This works well for the most part. Unfortunately, I run into issues when trying to access the DOM elements of this parent template from the child.
If I try to access

 from the default child template using @ViewChild('container',{static: false}), it gets the element without issue. When I do the same using the custom template passed in by app.component, I get the error "cannot read property 'nativeElement' of undefined".
What else do I have to do to access the DOM of my template?
Here's a Stackblitz
App.Component (Parent)

import { Component } from "@angular/core";

@Component({
  selector: "my-app",
  templateUrl: "./app.component.html",
  styleUrls: ["./app.component.css"]
})
export class AppComponent {}
<child [customTemplate]="parentTemplate"></child>

<ng-template #parentTemplate let-context="context">

HELLO FROM CONTAINER

    <button (click)="context.toggleShow()">Toggle Display</button>

Container contains the text: {{context.getContainerText()}}

</ng-template>

child.component (Child)

import {
  Component,
  ElementRef,
  Input,
  TemplateRef,
  ViewChild
} from "@angular/core";

@Component({
  selector: "child",
  templateUrl: "./child.component.html",
  styleUrls: ["./child.component.css"]
})
export class ChildComponent {
  @Input() public customTemplate!: TemplateRef<HTMLElement>;
  @ViewChild("container", { static: false })
  public readonly containerRef!: ElementRef;

  templateContext = { context: this };
  canShow: boolean = false;

  toggleShow() {
    this.canShow = !this.canShow;
  }
  getContainerText() {
    return this.containerRef.nativeElement.textContent;
  }
}
<ng-container *ngTemplateOutlet="customTemplate || defaultTemplate; context: templateContext">
</ng-container>

<ng-template #defaultTemplate>

GOODBYE FROM CONTAINER

    <button (click)="toggleShow()">Toggle Display</button>

Container contains the text: {{getContainerText()}}

</ng-template>

MY QUESTION
How do I use @ViewChild to access this div from an outside template that updates with any changes in the DOM? (Note: Removing the *ngIf is NOT an option for this project)
What's causing this? Are there any lifecycle methods that I can use to remedy this issue?
MY HUNCH
I'm guessing that ViewChild is being called BEFORE the DOM updates with its new template and I need to setup a listener for DOM changes. I tried this and failed so I'd really appreciate some wisdom on how best to proceed. Thanks in advance :)
EDIT:
This solution needs to properly display

 regardless of whether you're passing in a custom template or using the default one.

A: ViewChild doesn't seem to pick up a rendered template - probably because it's not part of the components template initially. It's not a timing or lifecycle issue, it's just never available as a ViewChild
An approach that does work is to pass in the template as content to the child component, and access it using ContentChildren. You subscribe to the ContentChildren QueryList for changes, which will update when the DOM element becomes rendered
You can then access the nativeElement (the div). If you wanted you could add listeners here to the DOM element, and trigger cd.detectChanges afterwards, but that would be a bit unusual. It would probably be better to handle DOM changes in the parent element, and pass the required values down to the child using regular @Input on the child
@Component({
  selector: "my-app",
  template: `
    <child>
      <ng-template #parentTemplate let-context="context">

Parent Template

      </ng-template>
    </child>
  `,
  styleUrls: ["./app.component.css"]
})
export class AppComponent {}

@Component({
  selector: "child",
  template: `
    <ng-container *ngTemplateOutlet="customTemplate"> </ng-container>
  `,
  styleUrls: ["./child.component.css"]
})
export class ChildComponent implements AfterContentInit {
  @ContentChild("parentTemplate")
  customTemplate: TemplateRef<any>;

  @ContentChildren("container")
  containerList: QueryList<HTMLElement>;

  ngAfterContentInit() {
    this.containerList.changes.subscribe(list => {
      console.log(list.first.nativeElement.innerText);
      // prints 'Parent Template'
    });
  }
}


text:
Q: How to know if google account is deleted/suspended in frontend website I have integrated Google oAuth in React Website.

*

*Once the user is signed in using Google oAuth backend generates jwt token for the user and stores in localstorage for further communications with api server

Now I delete the gmail account so how does the frontend or backend knows the status of the account since the user is already logged in on frontend with valid jwt.


text:
Q: API for mathematical calculations on the cloud Is there any service that provide a public API to perform mathematical calculations (such as linear algebra decompositions etc)?
Thanks

A: I've created a Java Google Appengine based service here mobmath.appspot.com. You can find the project page here: Symja project. The Linear Algebra functions are implemented with the commons math library (Examples).
There exist a project for Python here: Sympy project the online interface can be found here: live.sympy.org.

A: Wolfram Alpha has an API, but it isn't free to use.


text:
Q: Why doesn't the FileNameSetter button work in my DialogInput? I am new to Mathematica, so it's probably a small error but I can't figure it out.
Here is the code :
DialogInput[{TextCell["Choose your folder:"], InputField[Dynamic[x]],
  FileNameSetter[Dynamic[x], "Directory"],
  DefaultButton[DialogReturn[x]]}]

When I click on the browse button, nothing happen. Then, when I click on OK, the file system browsing window appears.

A: Another way to get around the fact that the kernel will block until DialogReturn is evaluated is to use Method -> "Preemptive":
DialogInput[{TextCell["Choose your folder:"],
  InputField[Dynamic[x]],
  FileNameSetter[Dynamic[x], "Directory", Method -> "Preemptive"],
  DefaultButton[DialogReturn[x]]}]

A: Mathematica "freezes" until you press the dialog return. This is by design for DialogInput as far as I know. So instead use CreateDialog
CreateDialog[{TextCell["Choose your folder:"], InputField[Dynamic[x]],
   FileNameSetter[Dynamic[x], "Directory"],
  DefaultButton[]}]


text:
Q: Grunt qunit is failing I have configured my qunit task is grunt as below:
 // Unit Test Configuration
    qunit: {
        ac: {
            files: ['test/**/*.html']
        }
    }
    grunt.registerTask('ac', ['jshint:ac', 'qunit:ac']);

jsHint is running fine. But with qunit i am getting error:
Running "qunit:ac" (qunit) task
Warning: Cannot use 'in' operator to search for 'src'

A: Change files: ['test/**/*.html'] to src: ['test/**/*.html']. The files property is intended for multiple src/dest pairings. See http://gruntjs.com/configuring-tasks#files-object-format
For example:
qunit: {
  ac: {
    files: [{
      src: ['test/**/*.html']
    }, {
      src: ['test2/**/*.html']
    }]
  }
}

A more simple config if you just want test/**/*.html would be:
qunit: {
  ac: ['test/**/*.html']
}


text:
Q: Char, Malloc, and Struct Arrays Im still learning C and I have a question regarding char arrays, malloc and structures. I have the following structure.
Function prototype
typedef struct example1{
 char *name[20];
 int ex_id;
 int count;
}example;

In main.c
example *info;
info=(example *)malloc(sizeof(example));
info->name=(char *)malloc(sizeof(char));

printf("Enter ID: ");
scanf("%d", &info[info->count].ex_id);

printf("Enter Name of ID: ");
scanf("%s", info->name[info->count];
getchar();

So my problem is I can't seem to malloc char *name[20] inside my structure. What I want to do with this variable is dynamically store the number of names with a fix strength length of 20 characters. So basically what I want to store is something like this.
info->name[0]="name1";
info->name[1]="name2";
etc...

A: char *name[20]; this is an array of char*.  But
info->name=(char *)malloc(sizeof(char));

You are allocating just one byte that the char* array elements point to. Allocate 20 bytes for each of the index, as you mentioned:
for (i=0;i<20;i++)
{
    info->name[i]=(char *)malloc(sizeof(char)*20);
}

Also, you are treating your struct pointer info as an array:
scanf("%d", &info[info->count].ex_id);

You can't do this, because: info->count is not initialized & holds garbage value.
And, you have allocated space for just one object of your struct by:
info=(example *)malloc(sizeof(example));

which makes &info[info->count] valid only when info->count=0, for the rest you have not allocated any space.


text:
Q: I want a way to reduce java GUI code suppose I want to design Java GUI frame with 30 radio box on it . Are there any way to add them without write many lines of code may about 60 line ?

A: for (int i=1; i <30; i++){
//radio check box adding code here
}

A: Declare all radio button names in an array and do the iteration like following,

String[5] radioString = {"P","Q","R","S","T"};   //declare as much as you want
for(String radioName : radioString){
      JRadioButton rectangular = new JRadioButton(radioName);
}


text:
Q: Copy/Paste Chart in Range without SELECT I have a bar chart that shows data for each row. I plan to have 1 chart for each row in column L. Macro recorder gives me long  and inefficient code, which I would like to  combine in one line (marked as comment), which unfortunately does not work. I would also like to avoid, if possible, any cycles e.g. For.
    ActiveSheet.ChartObjects("Chart 4").Activate
    ActiveChart.ChartArea.Copy
    Range("L7").Select
    ActiveSheet.Paste
    Range("L8").Select
    ActiveSheet.Paste

    'ActiveSheet.ChartObjects("Chart 4").Copy Destination:=ActiveSheet.Range("L7:L8")

'Later I have a code to adapt each graph to the row it is in

A: You can use following code if you dont want to use select statement...
ActiveSheet.ChartObjects(1).Chart.ChartArea.Copy

Or this one;
ActiveSheet.ChartObjects(1).Chart.Parent.Copy
ActiveSheet.Paste ActiveSheet.Range("L7")


text:
Q: Procedure invocation failed: Read timed out I am developing a MobileFirst Platform adapter. When i click on "Call MobileFirst Adapter" it gives me "Procedure invocation failed. Read timed out" error. Please see the complete log and let me know what is wrong
    [ERROR   ] FWLSE0099E: An error occurred while invoking procedure  [project         SecApp]MyRestAdapter1/HttpRequestFWLSE0100E:  parameters: [project SecApp]
    Http request failed: org.apache.http.conn.HttpHostConnectException: Connect to Javatechig.com:80 [Javatechig.com/198.1.121.188] failed: Connection timed out: connect
   FWLSE0101E: Caused by:  [project SecApp]org.apache.http.conn.HttpHostConnectException: Connect to Javatechig.com:80 [Javatechig.com/198.1.121.188] failed: Connection timed out: connectjava.lang.RuntimeException: Http request failed: org.apache.http.conn.HttpHostConnectException: Connect to Javatechig.com:80 [Javatechig.com/198.1.121.188] failed: Connection timed out: connect
at com.worklight.adapters.http.HTTPConnectionManager.execute(HTTPConnectionManager.java:271)
at com.worklight.adapters.http.HttpClientContext.doExecute(HttpClientContext.java:201)
at com.worklight.adapters.http.HttpClientContext.execute(HttpClientContext.java:185)
at com.worklight.adapters.http.HTTP.execRequest(HTTP.java:155)
at com.worklight.adapters.http.HTTP.invoke(HTTP.java:141)
at com.worklight.integration.model.ProcedureInvoker.invokeProcedure(ProcedureInvoker.java:54)
at com.worklight.integration.model.Procedure.invoke(Procedure.java:166)
at com.worklight.integration.services.impl.DataAccessServiceImpl.callProcedureInternal(DataAccessServiceImpl.java:676)
at com.worklight.integration.services.impl.DataAccessServiceImpl.callProcedure(DataAccessServiceImpl.java:622)
at com.worklight.integration.services.impl.DataAccessServiceImpl.access$100(DataAccessServiceImpl.java:69)
at com.worklight.integration.services.impl.DataAccessServiceImpl$3.execute(DataAccessServiceImpl.java:504)
at com.worklight.core.auth.impl.AuthenticationServiceBean.accessResource(AuthenticationServiceBean.java:76)
at com.worklight.integration.services.impl.DataAccessServiceImpl.invokeProcedureInternal(DataAccessServiceImpl.java:501)
at com.worklight.integration.services.impl.DataAccessServiceImpl.invokeDynamicProcedure(DataAccessServiceImpl.java:579)
at com.worklight.integration.services.impl.DataAccessServiceImpl.invokeDynamicProcedureWithEnclosingProcedureProperties(DataAccessServiceImpl.java:563)
at com.worklight.integration.js.JavaScriptIntegrationLibraryImplementation.invokeDynamicProcedure(JavaScriptIntegrationLibraryImplementation.java:145)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.mozilla.javascript.MemberBox.invoke(MemberBox.java:126)
at org.mozilla.javascript.NativeJavaMethod.call(NativeJavaMethod.java:225)
at org.mozilla.javascript.optimizer.OptRuntime.callN(OptRuntime.java:52)
at org.mozilla.javascript.gen._integration_js_1._c_anonymous_12(/integration.js:103)
at org.mozilla.javascript.gen._integration_js_1.call(/integration.js)
at org.mozilla.javascript.Interpreter.interpretLoop(Interpreter.java:1473)
at org.mozilla.javascript.Interpreter.interpret(Interpreter.java:815)
at org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:109)
at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:394)
at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3091)
at org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:107)
at com.worklight.integration.js.JavaScriptManager.callFunction(JavaScriptManager.java:267)
at com.worklight.integration.js.JavaScriptManager.invokeFunction(JavaScriptManager.java:241)
at com.worklight.integration.js.JavaScriptManager.invokeFunction(JavaScriptManager.java:211)
at com.worklight.integration.services.impl.AdapterManagerImpl.invokeFunction(AdapterManagerImpl.java:125)
at com.worklight.integration.js.JavaScriptProcedureInvoker.invoke(JavaScriptProcedureInvoker.java:42)
at com.worklight.integration.model.ProcedureInvoker.invokeProcedure(ProcedureInvoker.java:54)
at com.worklight.integration.model.Procedure.invoke(Procedure.java:166)
at com.worklight.integration.services.impl.DataAccessServiceImpl.callProcedureInternal(DataAccessServiceImpl.java:676)
at com.worklight.integration.services.impl.DataAccessServiceImpl.callProcedure(DataAccessServiceImpl.java:622)
at com.worklight.integration.services.impl.DataAccessServiceImpl.access$100(DataAccessServiceImpl.java:69)
at com.worklight.integration.services.impl.DataAccessServiceImpl$3.execute(DataAccessServiceImpl.java:504)
at com.worklight.core.auth.impl.AuthenticationServiceBean.accessResource(AuthenticationServiceBean.java:76)
at com.worklight.integration.services.impl.DataAccessServiceImpl.invokeProcedureInternal(DataAccessServiceImpl.java:501)
at com.worklight.integration.services.impl.DataAccessServiceImpl.invokeProcedure(DataAccessServiceImpl.java:155)
at com.worklight.adapters.rest.JSAdapterInvoker.invokeAdapter(JSAdapterInvoker.java:35)
at com.worklight.adapters.rest.JSAdapterRestWrapper.getFeeds1Get(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.wink.server.internal.handlers.InvokeMethodHandler.handleRequest(InvokeMethodHandler.java:63)
at org.apache.wink.server.handlers.AbstractHandler.handleRequest(AbstractHandler.java:33)
at org.apache.wink.server.handlers.RequestHandlersChain.handle(RequestHandlersChain.java:26)
at org.apache.wink.server.handlers.RequestHandlersChain.handle(RequestHandlersChain.java:22)
at org.apache.wink.server.handlers.AbstractHandlersChain.doChain(AbstractHandlersChain.java:63)
at com.worklight.wink.extensions.WorklightWinkHandler$1.run(WorklightWinkHandler.java:50)
at com.worklight.wink.extensions.WorklightWinkHandler$1.run(WorklightWinkHandler.java:45)
at com.worklight.adapters.rest.JAXRSAdapterRequestInterceptor.accessTheResourceWithIdentity(JAXRSAdapterRequestInterceptor.java:98)
at com.worklight.adapters.rest.JAXRSAdapterRequestInterceptor.access$000(JAXRSAdapterRequestInterceptor.java:38)
at com.worklight.adapters.rest.JAXRSAdapterRequestInterceptor$1.run(JAXRSAdapterRequestInterceptor.java:84)
at com.worklight.adapters.rest.JAXRSAdapterRequestInterceptor$1.run(JAXRSAdapterRequestInterceptor.java:81)
at com.worklight.core.auth.impl.OAuthValidatorFilter$1.run(OAuthValidatorFilter.java:143)
at com.worklight.core.auth.impl.OAuthValidatorFilter$1.run(OAuthValidatorFilter.java:134)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.Subject.doAs(Subject.java:396)
at com.worklight.oauth.validation.ValidationFilterHelper.filterRequest(ValidationFilterHelper.java:60)
at com.worklight.core.auth.impl.OAuthValidatorFilter.securedAccessToResource(OAuthValidatorFilter.java:134)
at com.worklight.core.auth.impl.OAuthValidatorFilter.filterRequest(OAuthValidatorFilter.java:101)
at com.worklight.adapters.rest.JAXRSAdapterRequestInterceptor.handleRequest(JAXRSAdapterRequestInterceptor.java:81)
at com.worklight.wink.extensions.WorklightWinkHandler.handleRequest(WorklightWinkHandler.java:45)
at org.apache.wink.server.handlers.RequestHandlersChain.handle(RequestHandlersChain.java:26)
at org.apache.wink.server.handlers.RequestHandlersChain.handle(RequestHandlersChain.java:22)
at org.apache.wink.server.handlers.AbstractHandlersChain.doChain(AbstractHandlersChain.java:63)
at org.apache.wink.server.internal.handlers.CreateInvocationParametersHandler.handleRequest(CreateInvocationParametersHandler.java:54)
at org.apache.wink.server.handlers.RequestHandlersChain.handle(RequestHandlersChain.java:26)
at org.apache.wink.server.handlers.RequestHandlersChain.handle(RequestHandlersChain.java:22)
at org.apache.wink.server.handlers.AbstractHandlersChain.doChain(AbstractHandlersChain.java:63)
at org.apache.wink.server.internal.handlers.FindResourceMethodHandler.handleSubResourceMethod(FindResourceMethodHandler.java:183)
at org.apache.wink.server.internal.handlers.FindResourceMethodHandler.handleRequest(FindResourceMethodHandler.java:110)
at org.apache.wink.server.handlers.RequestHandlersChain.handle(RequestHandlersChain.java:26)
at org.apache.wink.server.handlers.RequestHandlersChain.handle(RequestHandlersChain.java:22)
at org.apache.wink.server.handlers.AbstractHandlersChain.doChain(AbstractHandlersChain.java:63)
at org.apache.wink.server.internal.handlers.FindRootResourceHandler.handleRequest(FindRootResourceHandler.java:95)
at org.apache.wink.server.handlers.RequestHandlersChain.handle(RequestHandlersChain.java:26)
at org.apache.wink.server.handlers.RequestHandlersChain.handle(RequestHandlersChain.java:22)
at org.apache.wink.server.handlers.AbstractHandlersChain.doChain(AbstractHandlersChain.java:63)
at org.apache.wink.server.internal.handlers.HeadMethodHandler.handleRequest(HeadMethodHandler.java:53)
at org.apache.wink.server.handlers.RequestHandlersChain.handle(RequestHandlersChain.java:26)
at org.apache.wink.server.handlers.RequestHandlersChain.handle(RequestHandlersChain.java:22)
at org.apache.wink.server.handlers.AbstractHandlersChain.doChain(AbstractHandlersChain.java:63)
at org.apache.wink.server.internal.handlers.OptionsMethodHandler.handleRequest(OptionsMethodHandler.java:46)
at org.apache.wink.server.handlers.RequestHandlersChain.handle(RequestHandlersChain.java:26)
at org.apache.wink.server.handlers.RequestHandlersChain.handle(RequestHandlersChain.java:22)
at org.apache.wink.server.handlers.AbstractHandlersChain.doChain(AbstractHandlersChain.java:63)
at org.apache.wink.server.internal.handlers.SearchResultHandler.handleRequest(SearchResultHandler.java:33)
at org.apache.wink.server.handlers.RequestHandlersChain.handle(RequestHandlersChain.java:26)
at org.apache.wink.server.handlers.RequestHandlersChain.handle(RequestHandlersChain.java:22)
at org.apache.wink.server.handlers.AbstractHandlersChain.doChain(AbstractHandlersChain.java:63)
at org.apache.wink.server.internal.log.ResourceInvocation.handleRequest(ResourceInvocation.java:92)
at org.apache.wink.server.handlers.RequestHandlersChain.handle(RequestHandlersChain.java:26)
at org.apache.wink.server.handlers.RequestHandlersChain.handle(RequestHandlersChain.java:22)
at org.apache.wink.server.handlers.AbstractHandlersChain.doChain(AbstractHandlersChain.java:63)
at org.apache.wink.server.internal.log.Requests.handleRequest(Requests.java:76)
at org.apache.wink.server.handlers.RequestHandlersChain.handle(RequestHandlersChain.java:26)
at org.apache.wink.server.handlers.RequestHandlersChain.handle(RequestHandlersChain.java:22)
at org.apache.wink.server.handlers.AbstractHandlersChain.doChain(AbstractHandlersChain.java:63)
at org.apache.wink.server.handlers.AbstractHandlersChain.run(AbstractHandlersChain.java:48)
at org.apache.wink.server.internal.RequestProcessor.handleRequestWithoutFaultBarrier(RequestProcessor.java:207)
at org.apache.wink.server.internal.RequestProcessor.handleRequest(RequestProcessor.java:154)
at org.apache.wink.server.internal.servlet.RestServlet.service(RestServlet.java:119)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:668)
at com.worklight.adapters.rest.JAXRSSandbox.handleRequest(JAXRSSandbox.java:255)
at com.worklight.adapters.rest.RESTAdaptersServiceServlet.doService(RESTAdaptersServiceServlet.java:69)
at com.worklight.adapters.rest.RESTAdaptersServlet.service(RESTAdaptersServlet.java:64)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:668)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1275)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:766)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:472)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain.invokeTarget(WebAppFilterChain.java:135)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:74)
at com.ibm.ws.webcontainer.filter.WebAppFilterManager.doFilter(WebAppFilterManager.java:975)
at com.ibm.ws.webcontainer.filter.WebAppFilterManager.invokeFilters(WebAppFilterManager.java:1097)
at com.ibm.ws.webcontainer.servlet.CacheServletWrapper.handleRequest(CacheServletWrapper.java:81)
at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:912)
at com.ibm.ws.webcontainer.osgi.DynamicVirtualHost$2.run(DynamicVirtualHost.java:262)
at com.ibm.ws.http.dispatcher.internal.channel.HttpDispatcherLink$TaskWrapper.run(HttpDispatcherLink.java:938)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
at java.lang.Thread.run(Thread.java:662)
    Caused by: org.apache.http.conn.HttpHostConnectException: Connect to Javatechig.com:80 [Javatechig.com/198.1.121.188] failed: Connection timed out: connect
at org.apache.http.impl.conn.HttpClientConnectionOperator.connect(HttpClientConnectionOperator.java:140)
at org.apache.http.impl.conn.PoolingHttpClientConnectionManager.connect(PoolingHttpClientConnectionManager.java:318)
at org.apache.http.impl.execchain.MainClientExec.establishRoute(MainClientExec.java:363)
at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:219)
at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:195)
at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:86)
at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:108)
at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:184)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:72)
at com.worklight.adapters.http.HTTPConnectionManager.execute(HTTPConnectionManager.java:269)
... 129 more
    Caused by: java.net.ConnectException: Connection timed out: connect
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:351)
at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:213)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:200)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
at java.net.Socket.connect(Socket.java:529)
at org.apache.http.conn.socket.PlainConnectionSocketFactory.connectSocket(PlainConnectionSocketFactory.java:72)
at org.apache.http.impl.conn.HttpClientConnectionOperator.connect(HttpClientConnectionOperator.java:123)
... 138 more

A: You're getting a timeout...

*

*Make sure you're attempting to connect to the correct address

*Try to increase the timeout specification for the procedure in the adapter XML file

*Make sure there is no firewall or alike in the way that prevents the connections or delays it

*You can also inspect the network traffic in Wireshark

A: Assuming you tested the service in soapui and the backend is working within the timeout defined in adapter xml. The below could be the issue.
If you use the "Call MobileFirst Backend Service" that should work fine.
I was having the same issue. Looks like it's an issue with Mobilefirst client "Invoke MobileFirst Adapter". If you print the response in the adapter JS, you would notice that in that the Test client just gives up on the adapter printing Read timed out. But the adapter is still working and will print the response in a few seconds in the log.
This clearly seems to be the issue with test client which is timing out and not the adapter itself.
var result =invokeWebService(request, headers, soapAction);
WL.Logger.warn(result);

Hope this helps. I wasted a whole day figuring this out. Oh well IBM. :)


text:
Q: msaccess report print preview goes into endless loop MsAccess - Office Professional 2019
My reports have suddenly started behaving in a strange way. All work perfectly in report view mode and, up to today, have been fine in print preview mode. Now print preview is going mad! There are 3 variations:

*

*Some reports are ok.

*Some reports go into an endless loop and the only way out is to kill access.

*Some reports present with a very narrow single column report with no info (screen dump attached). If I click through the pages each page shows up the same and when I get to the last page it goes into an endless loop and I have to kill access. (Possibly this is the same as 2 above if the report is more than 1 page).

A: SOLVED!
Print preview appears to default the assumed printer for formatting to last printer (driver) used by the pc. In my case I had not printed anything since producing some plant labels on a Brother p-touch a few days before - maximum width 125mm!!!. Hence the long and very narrow page.
I printed something to a 'proper' printer from another application and hey presto - everything worked again.


text:
Q: How do I reload Jquery jtable with change in URL on select event Consider I am showing toppers of each subject from  a DB using Jtable.I have integrated this with Spring MVC.
$('#TableContainer').jtable({
    //title: 'Members',
    selectOnRowClick:true,
    selecting: true, //Enable selecting
    paging: true, //Enable paging
    pageSize: 10, //Set page size (default: 10)
    sorting: false, //Enable sorting
    actions: {
        listAction: myurl+'LoadMarks?subject='+subject,
    },

    fields: {
        ExamDate: {
            title: 'Exam Date',
        },
        StudentID: {
            title: 'Student',
        },
        Marks: {
            title: 'Marks Awarded',
        }
    }
});

At page load I am using $('#TableContainer').jtable('load');
Now I need to make this dynamic by providing user a dropdown and on change of dropdown I need to reload jQuery jTable with respective columns.
If using  $('#TableContainer').jtable('reload'); the url is getting called but I need to change ListAction variable (URL) and reload the page.
I need to change url and  load/reload jTable
Thanks In advance :)

A: Finally Found the Answer
I needed to destroy the Jtable.
But,$('#TableContainer').jtable('destroy'); does not work you can do it by.
refer link
$('#TableContainer').jtable({
});
$('#TableContainer').jtable('destroy');
then you need load JTable


text:
Q: How can i display the distance of a line drawing randomly? I'm trying to draw to filled circles, centered at random locations, with a line connecting the circles. The distance between the to centers is displayed on the line and whenever your resize the frame, the circles are redisplayed in new random locations.
I'm stuck in how to display the distance?
Any help is appreciated and thx for advance.
This's the code (what i managed to do):
public class Test extends JFrame {

    public Test() {
        add(new LineConnectingTheTwoCircles());
    }

    // Panel class
    class LineConnectingTheTwoCircles extends JPanel {
        //Default constructor
        LineConnectingTheTwoCircles() {
        }
        /* Override paintComponent (getting access to the panel's Graphics
           class) */
        @Override
        protected void paintComponent(Graphics g) {
            super.paintComponent(g);
            int radius = 15;
            // getting coordinates of circle 1
            int x1 = (int) (Math.random() * (getWidth()));
            int y1 = (int) (Math.random() * (getHeight()));
            // getting coordinates of circle 2
            int x2 = (int) (Math.random() * (getWidth()));
            int y2 = (int) (Math.random() * (getWidth()));
            // Setting color and drawing a filled circles (1 & 2)
            g.setColor(Color.BLUE);
            g.fillOval(x1 - radius, y1 - radius, 2 * radius, 2 * radius);
            g.drawString("1", x1 - 25, y1);
            g.setColor(Color.RED);
            g.fillOval(x2 - radius, y2 - radius, 2 * radius, 2 * radius);
            g.drawString("2", x2 - 25, y2);
            connectingTheTwoCircles(g, x1, y1, x2, y2);
        }

        // Connecting the two circles from the center
        private void connectingTheTwoCircles(Graphics g, int x1, int y1,
                int x2, int y2) {
            //Distance between the circles centered
            double D = Math.sqrt((Math.pow((y2 - y1), 2))
                    + (Math.pow((x2 - x1), 2)));
            //Getting the coordinates for the line l
            int x11 = x1;
            int y11 = y1;
            int x21 = x2;
            int y21 = y2;
            g.setColor(Color.BLACK);
            g.drawLine(x11, y11, x21, y21);
        }

        public double getDistance(double x1, double y1, double x2, double y2) {
            return Math.sqrt((Math.pow((y2 - y1), 2))
                    + (Math.pow((x2 - x1), 2)));
        }
    }

    public static void main(String[] args) {
        // Frame declaration
        Test frame = new Test();
        /*
         * Invoking some methods, to set a title on the title bar, to specifier
         * the size of the frame to centre it on the screen, to tell the program
         * to terminate when the frame is closed and finally to display it
         */
        frame.setTitle("This is a test");
        frame.setSize(300, 300);
        frame.setLocationRelativeTo(null);
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.setVisible(true);
    }
}

A: Try next code draws distance at line center
  double distance = getDistance(x11, y11, x21, y21);
  g.drawString(distance+" ",
                x11> x21 ? x21 + (x11-x21)/2 : x11 + (x21 - x11)/2 ,
                y11> y21 ? y21 + (y11-y21)/2 : y11 + (y21 - y11)/2 );


text:
Q: registering large amount of custom icons to mat-icon i was wondering if there's a fast and clean way to register a whole directory to the mat-icon register mechanism.
so far what i've done is saving my icons name in a list then iterating over the list to register them, but i'm not happy about the fact that i have to add to my list new icon name every time i'm adding an icon.
here's my code:
const ICONS_TO_ADD = {
  'general': ['follow', 'email', 'calendar', 'recommendation', 'follow_reg', 'follow_reg_on']
};

export class AppComponent {

  constructor( private matIconRegistry: MatIconRegistry, private domSanitizer: DomSanitizer,) {
    this.addIcons();
  }

  private addIcons() {
    for (const dirName of Object.keys(ICONS_TO_ADD)) {
      ICONS_TO_ADD[dirName].forEach(fileName => {
        const res = this.matIconRegistry.addSvgIcon(
          `${dirName}_${fileName}`,
          this.domSanitizer.bypassSecurityTrustResourceUrl(`../assets/svg/${dirName}/${fileName}.svg`)
        );
      });
    }
  }
}

A: You could write a custom task to automatically generate that list from directory listing. Ideally in a file containing only this list so you can easily overwrite.
Then run that task before building