text:
Q: Git mirror setup with bare upstream repo for Gogs Given an existing bare repository on a network share, I'd like to be able to use Gogs for issue tracking (etc.) without disrupting the workflow for everyone else who's already using the bare repo.After reading up a bit, I was under the impression that a mirror would provide this functionality, and I would be able to set it up in Gogs through a Migration. When adding a Migration in Gogs by providing the path to the network bare repository and selecting "This repository will be a mirror", however, I get the following error:

Migration failed: check bare: exit status 128 - fatal: bad object HEAD

Looking at the log, I can see the following:
2016/06/13 13:19:20 [T] action.newRepoAction: myuser/the-repo-name
[git-module] git clone --mirror --quiet X:\path\to\bare\repo.git X:\path\to\gogs\repo.git
2016/06/13 13:19:30 [W] Delete repository wiki [X:\path\to\gogs\the-repo-name.wiki.git]: exit status 2

Strangely enough, I can issue git clone --mirror through git bash and have it execute successfully.
$ git clone --mirror /X/path/to/repo.git my-mirror.git
Cloning into bare repository 'my-mirror.git'...
done.

My questions are the following:

*

*Is this set up possible? That is, can I commit to the Gogs mirror and have my commits pushed upstream to the bare repo, and viceversa (commits from other users to the bare being synchronized with my Gogs mirror)?

*If so, how can I get this to work on Gogs?

Many thanks in advance!
PS: I also get the error above when attempting the Migration on a brand new bare repo, so I wouldn't think the issue lies in the bare repo itself.

A: After trying this again on the last release of gogs (v0.9.13), the issue seems to have been fixed.


text:
Q: Compile Error: User-defined type not defined Access/Excel Reference I receive the message Compile Error: User-defined type not defined in a function when declaring an Excel object. I have my reference set to Microsoft Office Object Library 14.0.
Function GetAIRR(arrAssCF, arrAssDate, Guess) As Double
    Dim objExcel As Excel.Application
    Set objExcel = New Excel.Application

    Target = objExcel.Application.Xirr(arrAssCF, arrAssDate, Guess)
End Function

A: Reference the Microsoft Excel type library (i.e. not the Microsoft Office type library).
You can browse the types and their members exposed by a type library using the VBE's Object Browser (F2). If there's no Excel library and no Application class other than the one define in the Access library, you're missing a reference.
Then...
Make the function explicitly Public, the array parameters explicitly ByRef, the non-array parameters explicitly ByVal, give them all an explicit declared type.
Public Function GetAIRR(ByRef arrAssCF As Variant, ByRef arrAssDate As Variant, ByVal Guess As Long) As Double

Guess could probably of type xlGuess, but that's ...well, a guess. Long should be good enough, but if an enum exists that could make it easier for the calling code to know what to pass for that parameter, use it.
You don't need a local Excel.Application variable - just have a With block hold that reference for you:
With New Excel.Application
    Target = .Xirr(arrAssCF, arrAssDate, Guess)
End With

Lastly, the Target variable doesn't seem to be declared anywhere, and the function isn't returning anything. Did you mean to do this?
With New Excel.Application
    GetAIRR = .Xirr(arrAssCF, arrAssDate, Guess)
End With

Note that invoking the Xirr function off Excel.Application is a late-bound call that will be resolved at run-time, and if something goes wrong with it, you'll get a type mismatch error when GetAIRR (a Double) is tentatively assigned to some Error value.
By using Excel.WorksheetFunction.Xirr instead, the call is early-bound (i.e. resolved at compile-time), and if something goes wrong with it, the function will raise an actual run-time error instead of returning one; you can handle that error with normal error handling, or you can suppress either error and return 0, if that's an acceptable thing for this function to do:
    With New Excel.Application
        On Error Resume Next
        'possible type mismatch if input is invalid
        GetAIRR = .Xirr(arrAssCF, arrAssDate, Guess)

        'or early-bound:
        'possible error 1004 if input is invalid
        'GetAIRR = .WorksheetFunction.Xirr(arrAssCF, arrAssDate, Guess)

        On Error GoTo 0
    End With

A: .Xirr is a WorksheetFunction. Use the following:
Application.WorksheetFunction.Xirr(arrAssCF, arrAssDate, Guess)

redpajama_set_name: RedPajamaStackExchange


text:
Q: How to cut files on Finder on Mac OSX 10.9 Mavericks? I can't cut files on Mac OSX 10.9 Mavericks after upgrade. I can only copy and delete them. Why? How can I fix this?

A: Press CmdC to mark a file for copying or moving, change directory, then press CmdOptV to move the previously marked file. This only requires OS X 10.8 or so.

A: TotalFinder for Mavericks enables the cut functionality.


text:
Q: Broken python dependencies on an Ubuntu 16.04 (AWS EC2) I attempted to remove all installed python on my Ubuntu 16.04 .As it stands, I now understand I should not have done that. However, just trying to reinstall python doesn't work.
When I try
$ sudo apt install -f --reinstall python3
Reading package lists... Done
Building dependency tree
Reading state information... Done
Suggested packages:
  python3-doc python3-tk python3-venv
The following NEW packages will be installed:
  python3
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
4 not fully installed or removed.
Need to get 0 B/8,710 B of archives.
After this operation, 68.6 kB of additional disk space will be used.
Setting up python3.5-minimal (3.5.2-2ubuntu0~16.04.5) ...
# Empty sitecustomize.py to avoid a dangling symlink
Could not find platform independent libraries <prefix>
Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>]
Fatal Python error: Py_Initialize: Unable to get the locale encoding
ImportError: No module named 'encodings'

Current thread 0x00007fc6b52dd700 (most recent call first):
Aborted
dpkg: error processing package python3.5-minimal (--configure):
 subprocess installed post-installation script returned error exit status 134
dpkg: dependency problems prevent configuration of python3-minimal:
 python3-minimal depends on python3.5-minimal (>= 3.5.1-2~); however:
  Package python3.5-minimal is not configured yet.

dpkg: error processing package python3-minimal (--configure):
 dependency problems - leaving unconfigured
Errors were encountered while processing:
 python3.5-minimal
 python3-minimal
E: Sub-process /usr/bin/dpkg returned an error code (1)

$ python3
Could not find platform independent libraries <prefix>
Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>]
Fatal Python error: Py_Initialize: Unable to get the locale encoding
ImportError: No module named 'encodings'

Current thread 0x00007f87215c4700 (most recent call first):
Aborted

I tried installing some of the dependencies, I noticed were missing to no avail
$ sudo apt-get -f install python3.5-minimal
Reading package lists... Done
Building dependency tree
Reading state information... Done
python3.5-minimal is already the newest version (3.5.2-2ubuntu0~16.04.5).
You might want to run 'apt-get -f install' to correct these:
The following packages have unmet dependencies:
 dh-python : Depends: python3:any (>= 3.3.2-2~)
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).

Have tried different things but at this point I am lost as to how to go about this problem
$ sudo apt-get -f install dh-python
Reading package lists... Done
Building dependency tree
Reading state information... Done
dh-python is already the newest version (2.20151103ubuntu1.1).
You might want to run 'apt-get -f install' to correct these:
The following packages have unmet dependencies:
 dh-python : Depends: python3:any (>= 3.3.2-2~)
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).

A: I had a similar issue with python3 after ubuntu upgrading from 16 to 18. But you can try to use my solve on 16. Just use  apt-get against apt
NOTE: I need python2.7 installed in my system.
I followed those steps:

*

*Uninstall all python3 packages:
sudo apt remove python3 && sudo apt autoremove

*But this doesn`t help me. So will try to define which packages still exists in the system:
apt list --installed | grep python*
//possible output:
WARNING: apt does not have a stable CLI interface. Use with caution in scripts.
libpython-stdlib/bionic,now 2.7.15~rc1-1 amd64 [installed,automatic]
libpython2.7-minimal/bionic-updates,bionic-security,now 2.7.17-1~18.04ubuntu1.2 amd64 [installed,automatic]
libpython2.7-stdlib/bionic-updates,bionic-security,now 2.7.17-1~18.04ubuntu1.2 amd64 [installed,automatic]
libpython3-stdlib/bionic-updates,now 3.6.7-1~18.04 amd64 [installed]
libpython3.5/now 3.5.2-2ubuntu0~16.04.12 amd64 [installed,local]
libpython3.5-minimal/now 3.5.2-2ubuntu0~16.04.12 amd64 [installed,local]
libpython3.5-stdlib/now 3.5.2-2ubuntu0~16.04.12 amd64 [installed,local]
libpython3.6/bionic-updates,bionic-security,now 3.6.9-1~18.04ubuntu1.3 amd64 [installed,automatic]
libpython3.6-minimal/bionic-updates,bionic-security,now 3.6.9-1~18.04ubuntu1.3 amd64 [installed,automatic]
libpython3.6-stdlib/bionic-updates,bionic-security,now 3.6.9-1~18.04ubuntu1.3 amd64 [installed,automatic]
python/bionic,now 2.7.15~rc1-1 amd64 [installed]
python-apt-common/bionic-updates,bionic-updates,bionic-security,bionic-security,now 1.6.5ubuntu0.5 all [installed]
python-minimal/bionic,now 2.7.15~rc1-1 amd64 [installed,automatic]
python2.7/bionic-updates,bionic-security,now 2.7.17-1~18.04ubuntu1.2 amd64 [installed,automatic]
python2.7-minimal/bionic-updates,bionic-security,now 2.7.17-1~18.04ubuntu1.2 amd64 [installed,automatic]

*As we can see, some of python3 packages are in the system. Will remove them.
sudo apt remove libpython3-stdlib libpython3.5 libpython3.5-minimal libpython3.5-stdlib libpython3.6 libpython3.6-minimal libpython3.6-stdlib

*Now, try to install python3
sudo apt install python3

*All should be OK

A: Maybe it's a better idea to install python from a deb package with sudo dpkg -i? You can download it from here, for example

A: You should try:
sudo apt-get update
Then try uninstalling python with below command
sudo apt purge python3.x-minimal
if it uninstall successfully then
sudo apt-get install python3.6


text:
Q: How to recover files after changing partition filesystem? I tried to install Ubuntu 12.10 but for some reason the process stopped half-way and wouldn't progress, after some time waiting I decided to reboot and to my surprise my D: partition, where I have some files stored, was entirely occupied by Ubuntu.
I assume that the filesystem of the partition was changed from NFTS to ext4, so I lost access to the files on Windows. Later I recreated the D: partition again as NFTS, with its original size, and didn't do anything else with it, hoping that none of the files would be overwritten, but the partition was empty. I expected that, as I assume during the Ubuntu installation, the partition is formatted.
However I was hoping it would be possible to recover them. I already used PhotoRec tool to try the recovery of such files but all I am retrieving is thousands of text files, apart from a few intact files randomly named.
Is there any possibility to recover those files, given the circumstances described above?

A: If indeed the filesystem was damaged or destroyed you do not hold the best cards, since the filesystem is as you surely know the link to the files in the partitions.
Still of course there might be some change to recover the files by using tools which work upon the concept that most files are recocnized by the sequence of their very first bytes. This means that even when the filesystems is missing some files can be found by searching the content for the patterns of files. This all relies on the finding of so called  magic bytes
A programme to do such a search could be the Ubuntu package magicrescue
Normaly you should have backup... so all the problem should not exists... since you would revocer your files from  the backup. Just in case you do not have backup... Do not write anymore on the partition you expect to still contain some of your data. You might by this overwrite data valueable to you.
A good procedure would be to use dd to backup the partitions content first.
Some other tools you might wanna tryout are

*

*testdisk http://www.cgsecurity.org/wiki/TestDisk (which has some ability to repair less sophisticated Filesystems like vfat/Fat32 etc) and also to search for files on lost paritions

*System Rescue CD (A ios image of a live-linux which comes with some tools for data recovery for instance testdisk) http://www.sysresccd.org/SystemRescueCd_Homepage
good luck.
PS have some more search in the Askubuntu.com. It might very well be that you have not yet found some information upon data rescue already available on the side already.
good luck
You mentioned that you :

[...] assume that the filesystem of the partition was changed from NFTS to ext4,[...]

with sudo fdisk /dev/sda -l you can find out what your partition layout looks like.


text:
Q: Joining shape to external data using ArcGIS API for JavaScript? I'm developing an application that uses Shapes only to draw the map.
I would like to "Inject" the data at the time of viewing, since my data is dynamically changing.
Anyone know of any way of doing this, or if it is possible?

A: you can create a JSON object to add attributes to clientside graphics on the fly.
API Reference - Graphic.attributes
https://developers.arcgis.com/javascript/jsapi/graphic-amd.html#attributes


text:
Q: Skip printing the first value of array in jquery data tables this is a response from the api
{"recordsTotal":13,"data":[[13,"wretwer","rgsdfg","sdfgsd",null],[12,"heyh","gffsf","sfgsdf",null],[11,"sdfgwt","hdgdhsf","sfgsf",null],[10,"ethgs","fgsdfgsfd","dfsgdf",null],[9,"ertyyh","dgfsfg","sdfgs",null],[8,"yuyet","ertg","hdghd",null],[7,"dfgs","wtwr","sdfg",null],[6,"tyueyt","etyetye","erty",null],[5,"qerqe","qwer","qwerqwer",null],[4,"d","d","ggsss",null],[3,"asdf","asdf","asdf",null],[2,"asdfasd","asdfasdf","asdfadsf",null],[1,"test","asdf","34asdfasdfasdfasdfasdf",null]]}

I want to skip printing the first value of array that is 13 or 12 ....
this is what i have got so far
'use strict';
$(document).ready(function() {
    $("#appartment-table").DataTable({
        "processing": true,
        "serverSide": true,
        "ajax": "/datatable/apartments",
        "columns": [
                    null,
                    null,
                    null,
                    null,
            {"mRender": function ( data, type, row ) {
                            return 'Edit';}
                    }
     ]
    });
});

A: You can pick which columns to show by the array indexes :
columns: [
  { data: 1 },
  { data: 2 },
  { data: 3 },
  { data: 4,
    render: function ( data, type, row ) {
       return 'Edit';
    }
  }
 ]

Will skip the first element in the arrays, 13, 12 ...Remember to adjust the columns in
 accordingly (if you are using a static thead and not let DT create it by using column.title)


text:
Q: SQL Auto-increment ID python I am writing a program where I am able to add a bread to an Oracle 11g database. The code I've got so far allows me to add the ID manually but it SHOULD auto increment when added so not needing the ID.
    BreadID = int(input("Enter the bread ID: "))
    Name = input("Please enter the name for the new bread: ")
    LoafPrice = int(input("Enter the price in pence: "))
    Calories = int(input("Enter the calories: "))
    cur.execute("INSERT INTO BREAD VALUES (:BID,:BName,:BCal,:BPrice)",{'BID':BreadID, 'BName':Name, 'BPrice':LoafPrice,  'BCal':Calories,})
    con.commit()

This is the code I have for manually adding it. I've searched online for the answer how to add auto increment but all have failed to provide me with errors and more problems.
I have seen online that just leaving the ID column out will allow auto increment but I get this 'ORA-00947: not enough values' even though I've specified the column names.
Any help is appreciated as I have been stuck on this for a while now.:)

A: I had the same issue before, try specify the column name in your SQL expression and give BreadID a NULL.
So the sql expression will look something like:
INSERT INTO BREAD (BID, BName, BCal, BPrice)
VALUES
(NULL, 'French Toast', 0, 100);

Hope it helps!


text:
Q: People went down two different length slides end up at the bottom at the same time Discussion I am having:

If there are two slides that are at the same height.  One slide is 100m long and the other slide is 200m long.  The endpoint and start point are the same displacement.  In a perfect environment with no friction, if two people went down at the same time with the same force, would they reach the bottom at the same time?

A: So this depends very strongly on the shape of the slide.
The easiest way to see this is to push it to its extreme: suppose one slide is purely vertical and has a length of 100 meters (i.e. $H = L$, then in the absence of friction getting to the bottom requires a free-fall time, which is gotten by solving $H - \frac12 g t_1^2 = 0$ to get a time $t_1 = \sqrt{\frac{2H}{g}}.$
The straight slide which is twice as long makes a $\theta = 30^\circ$ angle with the ground as it is half of an equilateral triangle. Rotating into its reference frame, we find out that gravity now points along the direction of motion with an acceleration of only $g\sin\theta$, which in this case is $\frac{g}{2}$.
So now we have to solve
 $\frac12 \left(\frac g2\right) t_2^2 = L = 2H$
yielding $t_2 = 2 ~ t_1$ in the end.
There is a related misapprehension that students have: Now furthermore consider a bent slide, which travels straight down for this distance $H$, then conserving energy it bends the rider sharply to go forward, which they also go for a distance $\frac{\sqrt 3}2 H$ before leaving the ride. They get to the same place that the straight slide above got -- but does that take the same time?
We know that the "free fall" part takes time $\sqrt{2H/g}$ and using $v = -g t$ we can calculate that their speed at the bottom is $|v| = \sqrt{2Hg}.$ Preserving kinetic energy will come if the sharp turn preserves their speed, so now we just need to calculate the time to go that extra distance. And this time is $\ell/v,$ which in this case is $$t_3 = t_1 + \frac\ell v = \sqrt{\frac{2H}{g}} + \sqrt{\frac{\frac34 H^2}{2 H g}} = \sqrt{\frac{2H}{g}}~\left(1 + \sqrt{\frac 3 {16}}\right).$$ This number $1 + \sqrt{3}/4$ is only 1.433, much smaller than the $2.0$ that we saw for $t_2$ above! Same endpoint, different shape, got there much faster.
Now take the reverse path -- go horizontal from the starting point for a distance $H\sqrt{3}/2$, then go straight down. How much time does that take? $\infty.$ Because you never have gravity "start pushing you forward"!
One way to see this directly is to see that in the presence of a potential energy field $m g h$ like gravity has, your velocity is always going to be generated by energy conservation, $|v| = \sqrt{2 g (y_0 - y)}.$ You can think of this abstractly like a topographical map of sorts, with lower heights marked with higher velocities. A path which spends more of its time in the higher-velocity part of the map of course travels faster from point A to point B in the same time, until it gets overburdened by the distance that it has to travel. (The other $t \to \infty$ path is "the person falls down the slide an indefinite length $Q$, then sharply turns horizontal so they travel the $H\sqrt{3}/2$ at super-fast-speeds, then they sharply turn up so they travel the $Q-H$ distance to get to the same endpoint. As $Q$ gets larger this path becomes more about the "falling" and "rising" than the effectively 0 time spent travelling between.)
There is a smooth curve in between which is the fastest way to get from point A to point B by gravity alone, and it is a cycloid curve. Deriving it usually is done in a "calculus of variations" course.

A: That's a good question, and the answer is no, it depends on the shape on the slide. Then the question you can ask is which shape gives the shortest travelling time on the slide ?

A: Ignoring friction, final speed at the bottom will be same for both because they loose same potential energy (assuming same mass). Therefore, acceleration down the flatter path will be less, and it will take longer time to attain final speed.
In other words, steeper the path, faster is the downward acceleration. Longer path, (irrespective of shape of the path) translates into over all flatter path, which means less acceleration and longer time.

A: Friction less environment - do you intend to say vacuum. If vacuum and if both went down the two slides of equal length, they reach the bottom at same time irrespective of their mass as the only accelaration is due to GRAVITY. Considering they both are at different lengths, the time taken will be greater if greater the height or length. Reason being the vacuum eliminated the mass but it did not change the distance to be traversed.

A: This is actually really simple. Yes! Both people will get to the end at the same time. In a perfect environment (say mass is the same, no friction force, and earth gravity), time is not a factor, and therefore both will come at the same time. The only forces acting on the people are $F_g$ and $F_n$, where $F_g = mg$ and $F_n$ really doesn't play a role so we neglect it. Now $F_g$ is a conservative force, that is, it does not take into account the path taken, just displacement. (Displacement is $d_f - d_i$.) No mention of time so far right? Since both objects have same mass and same gravity ($9.8\ \mathrm{m/s^2}$), and the displacement is the same, they both get down at the same time.

A: @ BowlOfRed. The question states would both objects come down at the same time with ideal environment, that is, not friction, same mass, and g=9.8m/s2. So think about it this way, here the only work done is going to be by gravity. W=Fdcostheta, the force would be gravity, therefore W=mgh. Since gravity is a conservative force, it does not matter what path the object is taking in the slide, because the work done by gravity depends only in the initial and final heights, not the path taken. We can go and check Fn, and yes we will have to take into consideration the vertical and horizontal angles as someone above responded. But again, he is just asking if they both get down at the same time with no friction, and since work done is only by gravity, the answer is yes.


text:
Q: Rails - children of multiple parents If I have two models - parent and child, and parent has_many children, and I have an array of parents and want to retrieve all of the children for all of those parents, is there a way I can do this in Rails without writing the SQL statement manually?
This is what I want to do:
@parents = Parent.where("[various conditions]")
@children = @parents.children

A: Child.where(:parent_id => @parents.pluck(:id))

or
@parent_ids = Parent.where("[various conditions]").pluck(:id)
Child.where(:parent_id => @parent_ids}

or u can use  join
Child.join(:parent).merge(Parent.where("[various conditions]")) #!!readonly


text:
Q: Is it possible to communicate with a facebook app by tagging it in posts? I've been trying to find a way to receive commands from my app's users, and haven't been able to find any. Ideally, I'd like the user to be able to tag the app or a page in a post or a comment, get a notification and process the command. However, there doesn't appear to be a way to retrieve tags for an application, and no matter what I try for a page, the 'tags' connection is always empty (but does return data for my test user account).
Is there any way to do this? Even with the read_stream permission, I can only see the posts made by my user, but I don't see the comments left on their friends's pages.

A: This isn't possible via an api notification. You will have to process the body of the message and look for the tags and the commands using some regex
For example Hubot does this in IRC and Twitter.
https://github.com/MathildeLemee/hubot-twitter/blob/master/src/twitter.coffee


text:
Q: How to encode the length of the string at the front of the string Imaging I want to design a protocol, so I want to send a packet from the client side to the server side, I need to encode my data.
I have a string, I want to add the length of the string at the front of the string, for example:
string: "my"
which length is 2
So what I expect is to create a char[] in c and store | 2 | my | in the buffer

In this way, after the server receives the packet, it will know how many bytes need to be read for this request. (by using C programming)
I tried to do it but I don't know how to control the empty between the length and the string, I can create a buffer which size is 10, and use sprintf() to convert the length of the string and add it into the buffer.

A: One poor way to do it is to encode the length in ASCII at the front the string - the down side is you'll need variable char elements to store the length if you ever want to send anything longer than 9 chars.
A better way to encode the strings length, since you are designing your own protocol, is to allocate a fixed number of bytes at the beginning, say 8 bytes, and cast &char[0] as a pointer to an uint64_t Basically, use array[0~7] to store an 8byte unsigned long. Align the address w.r.t. 8byte boundary for (slightly) better performance.
If the sender and receiver machine have different endianness, you'll also have to include a multi-byte long "magic number" at the head of the char array. This is necessary for both sides to correctly recover the string length from the multi-byte-long length field.

A: There are two standards used in C:

*

*str*: char * which is terminated with a '\0'.

*mem*, read/write: void * plus a length size_t.  It's the same idea for readv() and writev() but here the two variables is bundled into an array of struct iovec.  Note that sizeof(size_t) may differ between sender and render.

If you use anything else it's automatically a learning curve for whoever needs to read or interact with your code.  I wouldn't do that trade-off, but you do you.
You can, of course, encode the length into the char * but now you have to think about how you encode it (big vs little endian), fixed vs variable size.
You might be interested in SDS which hides the length.  This way only have to reimplement the functions that change the length of the string instead of all string functions.  Use an existing library.


text:
Q: At least one security token in the message could not be validated Server config:
<?xml version="1.0"?>
<configuration>
<system.serviceModel>
    <behaviors>
        <serviceBehaviors>
            <behavior name="ServiceCredentialsBehavior">
                <serviceCredentials>
                    <serviceCertificate findValue="cn=cool" storeName="TrustedPeople" storeLocation="CurrentUser" />
                </serviceCredentials>
                <serviceMetadata httpGetEnabled="true" />
            </behavior>
        </serviceBehaviors>
    </behaviors>
    <services>
        <service behaviorConfiguration="ServiceCredentialsBehavior" name="Service">
            <endpoint address="" binding="wsHttpBinding" bindingConfiguration="MessageAndUserName" name="SecuredByTransportEndpoint" contract="IService"/>
        </service>
    </services>
    <bindings>
        <wsHttpBinding>
            <binding name="MessageAndUserName">
                <security mode="Message">
                    <message clientCredentialType="UserName"/>
                </security>
            </binding>
        </wsHttpBinding>
    </bindings>
    <client/>
</system.serviceModel>
<system.web>
    <compilation debug="true"/>
</system.web>

My client config:
<?xml version="1.0" encoding="utf-8"?>
  <configuration>
<system.serviceModel>
    <behaviors>
        <endpointBehaviors>
            <behavior name="LocalCertValidation">
                <clientCredentials>
                    <serviceCertificate>
                        <authentication certificateValidationMode="PeerTrust" trustedStoreLocation="CurrentUser" />
                    </serviceCertificate>
                </clientCredentials>
            </behavior>
        </endpointBehaviors>
    </behaviors>
    <bindings>
        <wsHttpBinding>
            <binding name="WSHttpBinding_IService" >
                <security mode="Message">
                    <message clientCredentialType="UserName" />
                </security>
            </binding>
        </wsHttpBinding>
    </bindings>
    <client>
        <endpoint address="http://localhost:48097/WCFServer/Service.svc"
                  binding="wsHttpBinding"
                  bindingConfiguration="WSHttpBinding_IService"
                  contract="ServiceReference1.IService"
                  name="WSHttpBinding_IService" behaviorConfiguration="LocalCertValidation">
            <identity>
                <dns value ="cool" />
            </identity>
        </endpoint>
    </client>
</system.serviceModel>

Service:
public string TestAccess()
{
    return OperationContext.Current.ServiceSecurityContext.PrimaryIdentity.Name;
}

Client:
        ServiceClient client = new ServiceClient();
        client.ClientCredentials.UserName.UserName = "Admin";
        client.ClientCredentials.UserName.Password = "123";
        Console.WriteLine(client.TestAccess());
        Console.ReadLine();

Error:
An unsecured or incorrectly secured fault was received from the other party. See the inner FaultException for the fault code and detail.
Inner exception:
At least one security token in the message could not be validated.
How do I resolve this exception?

A: Since the error message is rather obscure, thought I would put it out there as another possible solution.
My environment uses Single Sign On (or STS if you prefer) to authenticate a user through ASP.NET MVC site. MVC site in turn makes a service call to my service endpoint by passing bearer token which it requested from STS server with Bootstrap token previously. The error I got was when I made a service call from MVC site.
In my case, this is caused by my Service's configuration as stated below. Particularly audienceUris node, it must exactly match the service endpoint:
<system.identityModel>
    <identityConfiguration>
        <audienceUris>
            <add value="https://localhost/IdpExample.YService/YService.svc" />
        </audienceUris>
        ....
    </identityConfiguration>
</system.identityModel>

HTH.

A: I think the problem is your user name and password. With default configuration user name and password is validated as windows account. If you want other validation you must either use membership provider or custom user name password validator.


text:
Q: structure x-axis date as mm/dd/yy using lattice in R I want the dates on the x-axis to appear as mm-dd-yy using lattice. Only every month needs to be shown ex: 10/1/2022, 11/1/2022 etc.
I think I may have to use format(pretty(df$date), "%d-%m-%y") based on another post but when I try I get an error:
Error in multiple && !outer : invalid 'x' type in 'x && y'
Here is my code:
library(lattice)
library(latticeExtra)

obj1 <- xyplot(Nconc + Sconc ~ date, df, type = "l", main="Title", lwd=2, col= c("red", "steelblue"))
obj2 <- xyplot(CountyCounts ~ date, df, type = "l", lwd=2, col="green")
p <- doubleYscale(obj1, obj2, use.style=FALSE, add.ylab2 = TRUE)
p

Here is a sample of my data:
structure(list(date = structure(c(1634688000, 1634774400, 1634860800,
1635033600, 1635120000, 1635206400, 1635379200, 1635465600, 1635638400,
1635811200, 1635897600, 1636070400, 1636416000, 1636502400, 1636588800,
1636675200, 1636934400, 1637020800, 1637107200, 1637280000, 1637366400,
1637625600, 1637712000, 1637971200, 1638057600, 1638144000, 1638230400,
1638316800, 1638403200), class = c("POSIXct", "POSIXt"), tzone = "UTC"),
    Nconc = c(2.63e-05, 2.4e-05, 1.83e-05, 1.47e-05, 2.11e-05,
    2.09e-05, 3.99e-05, 5.22e-05, 9.17e-06, 2.89e-05, 4.79e-05,
    1.9e-05, 3.12e-05, 1.81e-05, 5.79e-06, 4.49e-05, 7.61e-06,
    1.51e-05, 3.61e-05, 1.46e-05, 1.16e-05, 3.53e-05, 0.000232,
    3.09e-05, 1.31e-06, 1.24e-05, 4.99e-05, 7.76e-05, 0.00016
    ), Sconc = c(2.98e-05, 2.79e-05, 1.75e-05, 2.2e-05, 2.62e-05,
    2.56e-05, 4.27e-05, 5.6e-05, 1.26e-05, 3.92e-05, 6.11e-05,
    1.42e-05, 2.53e-05, 2.12e-05, 4.31e-06, 4.57e-05, 9.83e-06,
    1.07e-05, 3.65e-05, 2.51e-05, 1.23e-05, 2.63e-05, 0.000212,
    3.99e-05, 1.42e-06, 1.08e-05, 4.09e-05, 7.89e-05, 0.000113
    ), CountyCounts = c(46, 45, 47, 17, 49, 49, 29, 38, 19, 20,
    30, 25, 38, 24, 19, 27, 27, 30, 39, 17, 11, 23, 21, 19, 21,
    43, 45, 42, 28)), class = c("tbl_df", "tbl", "data.frame"
), row.names = c(NA, -29L))

A: You could add
scales = list(x = list(format = "%d-%m-%y"))

to the call creating obj1 to get the format you want. But to control the locations exactly, you will need to specify them via at, e.g.,
scales = list(x = list(at = seq(as.POSIXct("2021-11-01"), by = "1 month", length.out = 5),
                       format = "%d-%m-%y", at = ))

You could try playing with tick.number = 5 (default) to control the locations, and you might get lucky, but there are no guarantees that you will get exactly 1 tick per month that way.


text:
Q: How can I Pass arguments from AWS Lambda to AWS Step Function? I have a Lambda code written in Python 3.6
  for record in event['Records']:
        filename_from_event = record['s3']['configurationId']
        filename = record['s3']['object']['key']
        bucket = record['s3']['bucket']['name']
        filename_folder = filename[0:filename.rfind("/")]
        filename_key = filename[filename.rfind("/")+1:]
        bucket_arr=bucket.split("-")
        path_arr=filename.split("/")
        proc=path_arr[0].upper()
        env=bucket_arr[2].upper()
        source=path_arr[2].upper()
        src_orch_json=proc+"/Common/Config/"+proc+"_"+source+"_Orch.json"
        input_json = get_step_input(bucket, src_orch_json)
        response = sf.start_execution(
            stateMachineArn='arn:aws:states:abc:stateMachine:xyz',
            name='xyz_' + env + '_' + proc + '_' + source,
            input=input_json
            )

Now, my objective is to pass arguments,i.e., proc, env and source to step function during start_execution.
How I can I do this and catch the arguments within the step function so that in turn it can pass again these parameters to the sequence of steps within it?

A: presuming you have basic understanding of step functions. you should be returning a json object if you wants to pass multiple arguments to step function.

A: Within the input_json I have {"env":"dev","proc":"load"}, these two parameters must be parsed within the next step Lambda code.


text:
Q: Display only categories until click/mouseover I'm having a problem with the different categories in a Magento menu bar.  Right now they just display as a list of all categories and sub categories.  I just want to see the categories and have the sub-categories appear upon click or mouseover of the category.
The site in question is www.babydiscountshop.nl
I'm from the Netherlands and don't speak very good English, so please keep that in mind

A: I see that you were making modifications to your theme. There are two things you need to do:

*

*Ensure that you have a good category tree (categories having subcategories) and that every category and subcategory you want to see (no matter if you need to see them always or on hover or on mouse click) are visible in the menu (options Is Active and Include in the Navigation Menu should be enabled for those categories)

*Modify the CSS of your theme so only the top level categories are visible right away and the rest is visible on hover

*Add some JavaScript that enables you to show categories on click

The second point requires the following CSS rules:

*

*Second (and every deeper) level categories should be hidden (#nav ol ul {display: none})

*They should become visible on hover (e.g. #nav ol ul:hover {display: block})

In the third point, you should do the following things:

*

*For every category that has child categories, you should prevent default onclick action (this would go to a given category) and instead, show its child categories (child unordered list is a sibling of the a html element you click (change its default  display: none to display: block or something). Remember to do it only for a elements that actually have ul sibling.

*Second click on the same a node should hide its sibling ul
Refer to the default Magento rwd theme files (app/design/frontend/rwd/default) if you're unsure how to proceed.


text:
Q: Big BIG hard drive problem - Safe to power off? - Need help ASAP! I woke up today to see my computer acting a bit strangely. Brightness being stuck, stuff like that. Anyway, everything is now read-only, most importantly resulting in being unable to mount an external hard drive and the Disks utility claims 3992 bad sectors, which was 0 last time I checked. SMART data claims the drive is OK.
What should I do? If I reboot the computer, could that risk putting my files in limbo? Most files can go but some I don't have backed-up.
Please give advice quickly.
Ubuntu MATE 16.04 x64
EDIT: Also, I'd be willing to take recommendations for replacement hard drives (UK).
EDIT 2: I forgot to mention that it's a laptop and was working fine last night. Well, the ethernet wasn't. Not sure if that's linked or not. Let me know if there's any further information I can provide which may help.
EDIT 3: I'm going to bite the bullet and reboot. See if this changes anything.
EDIT 4: See my comment in response to heynnema.


text:
Q: Scale graphics with pygame_util I am building a model with pymunk and I need to use real dimensions (physical size of model is approximately 1 meter). Is there a way to scale the graphics in pygame_util so that 1 meter corresponds to 800 pixels?

A: Pymunk itself is unitless, as described here: http://www.pymunk.org/en/latest/overview.html#mass-weight-and-units
Pymunk 6.1 (and later)
With Pymunk 6.1 its now possible to set a Transform on the SpaceDebugDrawOptions object (or one one of the library-specific implementations like pygame_utils.DebugDraw) as documented here http://www.pymunk.org/en/latest/pymunk.html#pymunk.SpaceDebugDrawOptions.transform
With this new feature it should be possible to set a scaling Transform to achieve what you are asking about.
Pymunk 6.0 (and earlier)
When used with pygame_util the distances will be measured in pixels, e.g. a 10x20 box shape (create_box(size=(10,20))) will be drawn as a 10x20 pixels rectangle. This means that the easiest way to achive what you ask about is to just define that the Pymunk length unit is 0.125cm, and therefore the box shape above 1.25cm x 2.5cm.
An alternative would be to scale the surface once complete. So instead of using the screen surface in pymunk.pygame_util.DrawOptions() you use a custom surface that you scale when the space has been drawn and then blit the result to the screen. I dont think this option is a good as the first option since there might be scaling artifacts, but depending on your exact use case maybe it works.


text:
Q: Unable to upgrade Ubuntu 16.04 to 20.04 I need to upgrade ubuntu 16.04 to 20.04.
When I use graphic interface, a pop-up windows tells me that all is updated and Ubuntu tells me that 18.04 must be installed first that it is normal.
But when I click nothing happens.
When I use the command line : sudo do-release-upgrade
I have the message :

Please install all available updates for your release before upgrading.

I don't understand.
Anyone has an idea ?
Sorry for my bad english

A: Thanks you very much.
Yes, in fact, I had errors during sudo apt update. So I remove some deposits (skype and others). Now  it's ok. I can upgrade 16.04 to 18.04.

A: use sudo apt update && sudo apt upgrade && sudo apt full-upgrade and then upgrade to 18.04 and then to 20.04

A: You need to ensure your xenial or 16.04 system is fully-upgraded before you can release-upgrade.
The error message is telling you that you haven't applied all 16.04 upgrades.
I'd suggest
sudo apt update
and read the messages, ensure there are no errors (or lines are missing), then
sudo apt full-upgrade
and providing all upgrades are applied (and no sources are missing from the apt update you ran earlier), you may need to reboot, then the do-release-upgrade should work.


text:
Q: How can I find a maximum to this equation I have a function that I would like to find it's maximum
deposit_likelood <- function(a1,a2) { (0.5672 - 0.092 * a1 + 0.0044 * a2^2 }

How can I maximize deposit_likelood while a1 should be between -3 and +3 and
a2 should be between 0.5 and 0.9 ?
I tried to use the optimize() function:
optimize(deposit_likelood, interval=c(-3,3,0.5,0.9), maximum=TRUE)

but I got this error :
Error in a2^2 : 'a2' is missing

A: I was hoping you would work this out for yourself from the hints (because thats usually a better way to learn) but here you go.
Note I've had to change the function because your question didn't have a valid function in it, and also to unpack the arguments:
> deposit_likelood = function(a) {a1=a[1];a2=a[2];return (0.5672 - 0.092 * a1 + 0.0044 * a2^2) }

We give optim a start point (somewhere in your box constraints), tell it to use the method with box constraints, and specify the constraints:
> optim(c(0,.7),deposit_likelood,method="L-BFGS-B",lower=c(-3,.5), upper=c(3,.9), control=list(fnscale=-1))
$par
[1] -3.0  0.9

$value
[1] 0.846764

$counts
function gradient
       7        7

$convergence
[1] 0

$message
[1] "CONVERGENCE: NORM OF PROJECTED GRADIENT <= PGTOL"

The return value has $par as the values of a1 and a2 respectively. The $convergence code zero tells you it worked okay.


text:
Q: Zend Studio problem I installed Zend Studio on Windows 7. When i Start the Program one example project is automatically created. But When i run in browser i get this error :-
Cannot connect to the configuration database.

I think there is no Web server configured for it. Then i downloaded Apache web server and extracted the zip folder. Now how do i link this apache web server to Zend Studio? How do i start Apache Web Server from within Zend Studio? Please let me know anything is not clear.
Thanks in advance :)

A: Installing Zend Server (there is also a Community Edition) should simplify your work

A: I think that database is used for the sample project. so not setting it makes no sense.
Just for your need, try installing zend debugger made for apache and configure that.

A: Do you have a backtrace of where that error is occurring or does it pop up in a Window?

A: You can start Apache Web Server from Zend Studio by doing below steps.

*

*Open Zend Studio.

*Go to Window | Show View | PHP | Server.

*Click on New button and Select Local Apache HTTP Server.

*Click Next and fill the requested server details.

For details, you can refer: http://files.zend.com/help/Zend-Studio/content/adding_a_php_server.htm
Once the configuration process is successful you can create a PHP project (File | New | Local PHP project) with Apache web server as you PHP Server.


text:
Q: Points for a cone surface region The surface $z^2=x^2+y^2$ is a cone with center at $(0,0,0)$, the surface $z=-(x^2+y^2)^{1/2}$ is the bottom part of that cone,  now, the region $z\leq-(x^2+y^2)^{1/2}$ are the points outside of that cone, but if I pick the point $(1,1,0)$ which is outside of the cone and plug it into  the inequality I get nonsense,$0≤-(2)^{-1/2}$, what is happening here? Where am I wrong? If my inequality is wrong, can you tell me why? Thanks

A: You have a few things to clean up:
The equation of a cone: $z^2 = x^2 + y^2$
$z = \pm \sqrt {x^2 + y^2}$
The points outside the cone:
$|z| < \sqrt {x^2 + y^2}$
Show that the point $(1,1,0)$ it outside the cone...
$|0| < \sqrt {2}$
and your remaing problem
Consider:
$z > - (x^2 + y^2)^{\frac 12}$
at the point $(x,y) = (1,1)$
$z > -(2)^\frac 12 = -\sqrt 2$
Exponentiation happens before the multiplication of the $-1.$  The negative is "on the outside."


text:
Q: округление целых до ближайшего большего числа кратного 10 Есть числа, например: 2, 5, 88, 44, 121, 160, 67
Как их преобразовать, что бы на выходе получилось из этого самого множества?
10, 10, 90, 50, 130, 160, 70
То есть округлить до ближайшего десятка. Пробовал через Math.floor(), Math.ceil(), но возникла проблема с большими числами
Допустим
var x = Math.ceil(2/10), // 2 для примера как входящий параметр
    exit = x*10; // на выходе будет 10

Но с сотнями, тысячами уже никак.

A:

function fn(arr, num) {
  return arr.map(function(a) {
    return a % num ? a + num - a % num : a
  })
};
var arr = [2, 5, 88, 44, 121, 160, 67];
alert(fn(arr, 10))


text:
Q: Google Sheets - Query Malfunction Say I have Sheet 2 data as below:
|----+----|
| A1 | B1 |
|----+----|
| A2 | B2 |
|----+----|
| A3 | 3  |
|----+----|

I want to use query to show it in Sheet 1 with below command:
=query(Sheet2!A:B)

But row 1 and 2 are merged together like the following table
|-------+-------|
| A1 A2 | B1 B2 |
|-------+-------|
| A3    |     3 |
|-------+-------|

If I change the number in B3 from "3" to "B3", then it works just fine. That means if it's a number, query API will not work as expected.
Is it a query API problem or my mistake?

A: Try using the optional headers argument in QUERY. e.g:
=query(Sheet2!A:B,,1)

Alternatively use:
=index(Sheet2!A:B)

or
={Sheet2!A:B}


text:
Q: Spark read file from each node similar to Hadoop's DistribuitedCache I have a file in master node that should be read by each node. How can I make this possible? In Hadoop's MapReduce I used the
DistribuitedCache.getLocalCacheFiles(context.getConfiguration())

How Spark works for file sharing between nodes? Do I have to load file in RAM and broadcast variable? Or can I only to indicate (absolute?) path of file in SparkContext configuration and it becames instantly available for all nodes?

A: You can use SparkFiles for reading files from distributed cache.
import org.apache.spark.SparkFiles
import org.apache.hadoop.fs.Path

sc.addFile("/path/to/file.txt")
val pathOnWorkerNode = new Path(SparkFiles.get("file.txt"))

A: Look on spark-submit "files" parameter, for example, here:
Running Spark jobs on a YARN cluster with additional files


text:
Q: Xcode Crash on opening Storyboard In order to support iOS in range from iOS 7 to iOS 9, I installed both of Xcode 6 and 7.
Then I created a project for iPhone on Xcode 7.
And I opened it on Xcode 6 to test on iPhone Simulator 7.
But Xcode 6 crashed when I clicked Storyboard file.
How can I resolve it?
Or there is another way to support the iOS versions?

Error Message

Process:               Xcode [9928]
Path:                  /Applications/Xcode 6.app/Contents/MacOS/Xcode
Identifier:            com.apple.dt.Xcode
Version:               6.4 (7720)
Build Info:            IDEFrameworks-7720000000000000~8
Code Type:             X86-64 (Native)
Parent Process:        ??? [1]
Responsible:           Xcode [9928]
User ID:               501

Date/Time:             2016-01-04 01:15:21.068 +0900
OS Version:            Mac OS X 10.10.5 (14F1509)
Report Version:        11
Anonymous UUID:        F02C76F0-B69A-FE68-DD89-9946A7C82C03

Sleep/Wake UUID:       2BF55735-0241-43B3-A731-49B6D645DC4F

Time Awake Since Boot: 53000 seconds
Time Since Wake:       550 seconds

Crashed Thread:        0  Dispatch queue: com.apple.main-thread

Exception Type:        EXC_CRASH (SIGABRT)
Exception Codes:       0x0000000000000000, 0x0000000000000000

Application Specific Information:
ProductBuildVersion: 6E35b
ASSERTION FAILURE in /SourceCache/IDEInterfaceBuilderCocoaTouch/IDEInterfaceBuilderCocoaTouch-7703/InterfaceBuilder/Utilities/IBObjectMarshalling.m:45
Details:  Failed to launch Interface Builder Cocoa Touch Tool: Error Domain=com.apple.InterfaceBuilder Code=-1 "Encountered an error communicating with Interface Builder WatchKit Tool." UserInfo=0x7fb9b3128d40 {NSUnderlyingError=0x7fb9ac00c620 "Failed to communicate with Interface Builder", NSLocalizedDescription=Encountered an error communicating with Interface Builder WatchKit Tool., NSLocalizedRecoverySuggestion=Please check Console.app for crash reports for "Interface Builder WatchKit Tool" for further information., NSLocalizedFailureReason=Interface Builder WatchKit Tool (10069) failed to launch and exited with status (null), signal 5.

Dyld Error Message:
  Library not loaded: /System/Library/PrivateFrameworks/PepperUICore.framework/PepperUICore
  Referenced from: /Applications/Xcode 6.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Library/Xcode/Overlays/Interface Builder WatchKit Tool
  Reason: image not found

Application Specific Information:
dyld: launch, loading dependent libraries
DYLD_FRAMEWORK_PATH=/Applications/Xcode 6.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Library/Xcode/Overlays
DYLD_LIBRARY_PATH=
DYLD_FALLBACK_LIBRARY_PATH=
DYLD_ROOT_PATH=/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 9.0.simruntime/Contents/Resources/RuntimeRoot
}

A: The reason is a conflict between Xcode 6 and 7.
Apple reveals it in a release note for Xcode 7.
I followed the steps and the error is resolved.
"Installing the iOS 9.0 Simulator Runtime from Xcode's Download Preferences can cause Interface Builder in Xcode 6 installs on the same machine to stop functioning.
Either avoid installing the iOS 9.0 Simulator Runtime or move /Library/Developer/CoreSimulator/Profiles/Runtimes/iOS\ 9.0.simruntime to a backup location when switching to Xcode 6 and move it back for Xcode 7. (23230951)"
https://developer.apple.com/library/watchos/releasenotes/DeveloperTools/RN-Xcode/Chapters/xc7_release_notes.html

A: Got the same issue, after some investigation, it seems after a Xcode update or Mac OS update, there are 2 private frameworks removed from system library, PepperUICore.framework and SockPuppetGizmo.framework. But you can still find them in your Xcode 6 simulator SDK.
Make sure these 2 frameworks are not found in /System/Library/PrivateFramework/. Then use below command lines (Replace the Xcode 6 app path with yours) to copy the private framework from Xcode 6 simulator SDK to your /System/Library/PrivateFramework/.
sudo cp -r /Applications/Xcode6.4.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/System/Library/PrivateFrameworks/PepperUICore.framework /System/Library/PrivateFrameworks/

sudo cp -r /Applications/Xcode6.4.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/System/Library/PrivateFrameworks/SockPuppetGizmo.framework /System/Library/PrivateFrameworks/

Now open your .xib or .storyboard with Xcode 6, it should be fine.

A: Try changing the "Opens In" attribute in the storyboard inspector to have it compatible with Xcode 6 or 6.3.
Specifically this dropdown / popup menu item:

But like Kaizoku comments, don't be surprised if something else is broken (e.g. if your app is expecting symbols or functionality that only exists in iOS 9).
What may be better is to set the minimum deployment version for your app (e.g. to iOS 7) and try it out in an iOS 7 or iOS 8 simulator which you can download with Xcode 7.


text:
Q: Twitter authentication fails I would like to use the package twitteR for an analysis, but I came across a problem when I tried to authenticate with Twitter. Below are the error, and the code I use for the authentication. Anyone has any suggestions about a fix? thanks.
Error in get(name, envir = asNamespace(pkg), inherits = FALSE) :
  object '.setDummyField' not found

This is the code I use to authenticate with Twitter.
reqURL <- "https://api.twitter.com/oauth/request_token"
accessURL <- "https://api.twitter.com/oauth/access_token"
authURL <- "https://api.twitter.com/oauth/authorize"

consumerKey <- "redacted"
consumerSecret <- "redacted"

twitCred <- OAuthFactory$new(consumerKey = consumerKey,
                             consumerSecret = consumerSecret,
                             requestURL = reqURL,
                             accessURL = accessURL,
                             authURL = authURL)

twitCred$handshake()
registerTwitterOAuth(twitCred)

A: OK. I resolved the problem. Apparently, the issue was that my R version was 3.0.0, but the twitteR package has been updated for version 3.0.1. An update of the version fixed the error.
Thanks,
Valentin


text:
Q: Reading specific content from a web page? I am trying to make an app (in C#) in which I have to get some meanings from a website like wiktionary.com or dictionary.com. But I have never used Xml or worked with web pages at all.
I managed to get the response from the webpage (e.g from dictionary.com for a specific word) (which I hope is the xml format).
This is what I got for the word 'Hello'.:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Strict//EN">
<!--attributes for answers reference-->
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:fb="http://www.facebook.com/2008/fbml" xmlns:og="http://opengraphprotocol.org/schema/">
<head>
<title>
Hello | Define Hello at Dictionary.com
</title>
<meta name="description" content="Hello definition, (used to express a greeting, answer a telephone, or attract attention.) See more."/>
<meta name="keywords" content="hello, online dictionary, English dictionary, hello definition, define hello, definition of hello, hello pronunciation, hello meaning, hello origin, hello examples"/>
<link rel="canonical" href="http://dictionary.reference.com/browse/hello"/>
<meta property="og:title" content="the definition of hello"/>
<meta property="og:site_name" content="Dictionary.com"/>
<meta property="og:image" content="http://sp2.dictionary.com/en/i/dictionary/facebook/dictionary_logo.png"/>

Now I want to parse the following string out of the response.
used to express a greeting, answer a telephone, or attract attention.

I tried using XmlReader but got stuck. Can somebody please help me read this content?

A: You can easily parse HTML with HTML Agility Pack.
HtmlDocument doc = new HtmlDocument();
// replace with your own content
doc.Load("file.htm");
foreach(HtmlNode meta in doc.DocumentElement.SelectNodes("/meta[@name='description'"])
{
    HtmlAttribute att = meta["content"];
    Consol.WriteLine( att.Value );
}

A: You can use a web services like http://services.aonaware.com/, it's much more better for you and for the targeting web site :-).
http://words.bighugelabs.com/api.php is another option which has a much simpler API


text:
Q: Is there another way to create an object with a classname returned by a method? I have this method :
public function getInstance()
{
    $classname = $this->getFullyQualifiedClassName();
    return new $classname();
}

Is there a way to write this without the $classname variable, which gets used only once?

A: You could use Reflection:
$reflectionClass = new ReflectionClass('SomeClassName');
$reflectionClass->newInstanceArgs(array(1, 2, 3));

But as far as I know, that will be a lot slower than the solution you already have. In a perfect world you could just write something like this:
return new ( $this->getFullyQualifiedClassName() )(); // THIS DOES NOT WORK!!!

But unfortunately PHP's syntax isn't very flexible, and therefore you have to create that ugly variable thats troubling you.

I just realized that there is another (very ugly) way to do it: eval:
return eval("return new ".$this->getFullyQualifiedClassName()."();");

I do not suggest that you used this though, because of the security risk that comes with using eval.

A: Give your getFullyQualifiedClassName method a parameter whether return object or string.
public function getFullyQualifiedClassName($return_object = false) {
    //............
    return $return_object ? new $classname() : $classname;
}

then
public function getInstance()
{
    return $this->getFullyQualifiedClassName(true);
}

But I think this way is not better than your have a $classname in your getInstance method if your getFullyQualifiedClassName just need to return string of the class name.
Edit:
As @x3ro said, it violates the method name, another way is to use a Help method, but it still worth little. Actually the $classname is not so ugly.
public function getInstance()
{
    return Util::NewObjectFromName($this->getFullyQualifiedClassName());
}


text:
Q: Connecting to databases through VPN We want to create a web application using the usual LAMP stack. However, the app needs to also fetch data from a remote database, and that database can only be connected to if you are inside a VPN.
In the usual scenario, I run a VPN on my desktop, and then any program on my desktop can connect to the remote database.
But I don't know how to make my web server connect to a VPN. The web server has to simultaneously stay available on the open internet as well. If t hat is possible, then our web server app can fetch data from the remote database through the VPN, while service clients on the open web (and using its own local database for additional storage).
(If the answer implies that the web server needs two IP addresses, or even two NICs, that is no problem).
Thanks!

A: One server - vpn client, one - server. Mysql will listen on private vpn ip. Another server connects to this ip.
You dont need second ip or nic for that.
It is also possible with ssh tunneling only(Mysql listen localhost). Maybe this is not best variant.


text:
Q: Linux apache mod_auth_sspi installation I am running an Apache/2.4.7 Linux webserver and working on an intranet project where users of Internet Explorer need to be authenticated automatically. Their windows username has to be displayed in a greeting on the intranet homepage.
I downloaded the mod_auth_sspi module from SourceForge and unzipped the file.
I located a mod_auth_sspi.so file in mod_auth_sspi-1.0.4\bin.
I move that .so file into /etc/apache2/mod-available and added the following line to the bottom of my /etc/apache2/apache2.conf file:
LoadModule mod_auth_sspi mods-available/mod_auth_sspi.so

With all that done I attempted to reload my server and got the following error:
sudo apache2ctl restart
apache2: Syntax error on line 225 of /etc/apache2/apache2.conf: Cannot load mods-available/mod_auth_sspi.so into server: /etc/apache2/mods-available/mod_auth_sspi.so: invalid ELF header
Action 'restart' failed.
The Apache error log may have more information.

I am very new into installing and configuring Apache module.
Can anyone advice if my steps listed above are correct and what I can do to correctly get mod_auth_sspi working?
Any help would be appreciated.

A: You are trying to install a Win32 Binary into Linux... it won't work (I'm acutally facing the same Problem). As far as I see, there is no source for Linux (as development has stopped) anymore... if you find something, let me know!

A: In this link it shows how to set up in windows / linux
https://docs.moodle.org/25/en/NTLM_authentication


text:
Q: why Jupyter Notebook on IPad is too slow I installed Jypter Notebook on my ipad(8th gen) using the following steps:

*

*I installed ish on ipad from Apple Store, which installed Alpine linux with ash shell.

*Then I installed Python 3.9 on ish

*Then I used pip to install Notebook, after I covered all required dependencies

During the installation of Notebook, some packages took very long time.
After installation completed, running jupyter notebook --allow-root command was successful, there was no delay, and I got a link to the service,...
http ://localhost:8888/?token=xxxxxxxxxxxxxxxxxxxxxx
I take this link and open it in the ipad chrome, outside ish.
Loading Jupyter main page takes so much time, and it doesn't succeed from the first time.
I try to create new Notebooks, but it opens a blank page and I have to restart the service in order to see the new Notebook on Jupyter main page. Also, it takes so much time to load, and not successful from first trial.
Finally, the same goes for running code even as simple as print statement.
If there is something I can do about this, please inform me. Thanks


text:
Q: Searching partial names with Powershell I'm trying to use Get-ADComputer in Powershell to search using variables when I know part of the computer name.
If I only use a string with quotes, it works great:
Get-ADComputer -Filter {Name -Like "*mputername*"} | Select Name
If I create a string variable and THEN do the same search using the variable, it doesn't return anything.  I think it has something to do with how the variable is being expanded next to the wildcard asterisks, but I'm stumped.
Set-Variable -Name 'partialName' -Value 'mputername'
Get-ADComputer -Filter {Name -Like "*$partialName*"} | Select Name
Can anyone help me?


text:
Q: how can i find the second smallest value in array in dart? I have an assignment that needs me to find the smallest and second smallest value in an array but I can't manage to figure it out.
!New learner in dart

A: You can use Quickselect for Θ(n) time complexity:
int findKthSmallest(List<int> nums, int k) {
  if (k <= 0 || k > nums.length) {
    throw new ArgumentError("k must be positive and less than or equal to the size of nums.");
  }
  final n = nums.length - k;
  int quickSelect(int left, int right) {
    var pivot = nums[right];
    var p = left;
    for (var i = left; i < right; i++) {
      if (nums[i] >= pivot) {
        var temp = nums[i];
        nums[i] = nums[p];
        nums[p] = temp;
        p++;
      }
    }
    var temp = nums[right];
    nums[right] = nums[p];
    nums[p] = temp;
    if (p > n) {
      return quickSelect(left, p - 1);
    } else if (p < n) {
      return quickSelect(p + 1, right);
    } else {
      return nums[p];
    }
  }
  return quickSelect(0, nums.length - 1);
}

void main() {
  var nums = [5, 3, 1, 3, 2, 7, 9, 10];
  var k = 2;
  print('findKthSmallest(${nums}, ${k}): ${findKthSmallest([...nums], k)}');
}

Output:
findKthSmallest([5, 3, 1, 3, 2, 7, 9, 10], 2): 2


text:
Q: Reloading Javascript on site after pressing an image (function) I am making an mp3 player that selects random song from a list of variables. There is the code:
Title:

Album:

<audio class="audio-element" controls="true" preload="none">

            <source src="mp3file.mp3" type="audio/mpeg" />

Your outdated browser does not support HTML5.

Get Mozilla Firefox  >HERE<

</audio>

Is there an option, that after pressing a specifed image the code will refresh (it will again choose a song and show its specifics) without refreshing the whole page?

A: Put the code you want to refresh in a function.

Then set the function as a callback of onclick. As this:


text:
Q: Error in DynamoDBLocal testing: com.almworks.sqlite4java.SQLiteException: [-91] cannot load library: java.lang.UnsatisfiedLinkError I migrating from gradle project to maven project. The unit tests used to work in gradle, but now I am getting UnsatisfiedLinkError error.
My build.gradle has -
task copyNativeDeps(type: Copy) {
    from (configurations.compile+configurations.testCompile) {
        include "*.dylib"
        include "*.dll"
        include "*.so"
    }
    into 'build/libs'
}

task unitTest(type: Test) {
    // Set up dependent native libraries (sqllite) for running local DynamoDB
    dependsOn copyNativeDeps
    systemProperty "java.library.path", 'build/libs'

    useJUnit {
        includeCategories 'com.*.platform.identity.test.IUnitTest'
        excludeCategories 'com.*.platform.identity.test.IIntegrationTest'
    }
}

To get the same behaviour I added following in pom.xml -
<plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>${maven-surefire-plugin.version}</version>
                <executions>
                    <execution>
                        <id>copy</id>
                        <phase>test-compile</phase>
                        <configuration>
                            <includeScope>test</includeScope>
                            <includeTypes>so,dll,dylib</includeTypes>
                            <outputDirectory>${project.basedir}/build/libs</outputDirectory>
                        </configuration>
                    </execution>
                </executions>
                <configuration>
                    <includes>
                        <include>**/Test*.java</include>
                        <include>**/*Test.java</include>
                        <include>**/*Tests.java</include>
                        <include>**/*TestCase.java</include>
                    </includes>
                    <useFile>true</useFile>
                    <argLine>${surefireArgLine}</argLine>
                </configuration>
            </plugin>

and this in unit test -
System.setProperty("java.library.path", "build/libs");

Error Stacktrace -
2020-03-13 23:27:33,397 WARN [ ] SQLiteQueue[] [sqlite] cannot open DB[1]: com.almworks.sqlite4java.SQLiteException: [-91] cannot load library: java.lang.UnsatisfiedLinkError: no sqlite4java-osx-x86_64-1.0.392 in java.library.path
2020-03-13 23:27:33.400 ERROR 13542 --- [  SQLiteQueue[]] com.almworks.sqlite4java                 : [sqlite] SQLiteQueue[]: error running job queue

com.almworks.sqlite4java.SQLiteException: [-91] cannot load library: java.lang.UnsatisfiedLinkError: no sqlite4java-osx-x86_64-1.0.392 in java.library.path
    at com.almworks.sqlite4java.SQLite.loadLibrary(SQLite.java:97)
    at com.almworks.sqlite4java.SQLiteConnection.open0(SQLiteConnection.java:1441)
    at com.almworks.sqlite4java.SQLiteConnection.open(SQLiteConnection.java:282)
    at com.almworks.sqlite4java.SQLiteConnection.open(SQLiteConnection.java:293)
    at com.almworks.sqlite4java.SQLiteQueue.openConnection(SQLiteQueue.java:464)
    at com.almworks.sqlite4java.SQLiteQueue.queueFunction(SQLiteQueue.java:641)
    at com.almworks.sqlite4java.SQLiteQueue.runQueue(SQLiteQueue.java:623)
    at com.almworks.sqlite4java.SQLiteQueue.access$000(SQLiteQueue.java:77)
    at com.almworks.sqlite4java.SQLiteQueue$1.run(SQLiteQueue.java:205)
    at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.UnsatisfiedLinkError: no sqlite4java-osx-x86_64-1.0.392 in java.library.path
    at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1867)
    at java.lang.Runtime.loadLibrary0(Runtime.java:870)
    at java.lang.System.loadLibrary(System.java:1122)
    at com.almworks.sqlite4java.Internal.tryLoadFromSystemPath(Internal.java:352)
    at com.almworks.sqlite4java.Internal.loadLibraryX(Internal.java:124)
    at com.almworks.sqlite4java.SQLite.loadLibrary(SQLite.java:95)
    ... 9 common frames omitted

2020-03-13 23:27:33,400 ERROR [ ] SQLiteQueue[] [sqlite] SQLiteQueue[]: error running job queue
com.almworks.sqlite4java.SQLiteException: [-91] cannot load library: java.lang.UnsatisfiedLinkError: no sqlite4java-osx-x86_64-1.0.392 in java.library.path
    at com.almworks.sqlite4java.SQLite.loadLibrary(SQLite.java:97)
    at com.almworks.sqlite4java.SQLiteConnection.open0(SQLiteConnection.java:1441)
    at com.almworks.sqlite4java.SQLiteConnection.open(SQLiteConnection.java:282)
    at com.almworks.sqlite4java.SQLiteConnection.open(SQLiteConnection.java:293)
    at com.almworks.sqlite4java.SQLiteQueue.openConnection(SQLiteQueue.java:464)
    at com.almworks.sqlite4java.SQLiteQueue.queueFunction(SQLiteQueue.java:641)
    at com.almworks.sqlite4java.SQLiteQueue.runQueue(SQLiteQueue.java:623)
    at com.almworks.sqlite4java.SQLiteQueue.access$000(SQLiteQueue.java:77)
    at com.almworks.sqlite4java.SQLiteQueue$1.run(SQLiteQueue.java:205)
    at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.UnsatisfiedLinkError: no sqlite4java-osx-x86_64-1.0.392 in java.library.path
    at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1867)
    at java.lang.Runtime.loadLibrary0(Runtime.java:870)
    at java.lang.System.loadLibrary(System.java:1122)
    at com.almworks.sqlite4java.Internal.tryLoadFromSystemPath(Internal.java:352)
    at com.almworks.sqlite4java.Internal.loadLibraryX(Internal.java:124)
    at com.almworks.sqlite4java.SQLite.loadLibrary(SQLite.java:95)
    ... 9 common frames omitted
2020-03-13 23:27:33.401 ERROR 13542 --- [  SQLiteQueue[]] com.almworks.sqlite4java                 : [sqlite] SQLiteQueue[]: stopped abnormally, reincarnation is not possible for in-memory database
2020-03-13 23:27:33,401 ERROR [ ] SQLiteQueue[] [sqlite] SQLiteQueue[]: stopped abnormally, reincarnation is not possible for in-memory database

I have no idea, why its still not able to link.


text:
Q: Format for date object with am/pm I was wondering how I can just set a time such as 10:30am to a Date object from java.util.date? How would I format this? For example Date date1 = 10:30am.

A: try with the Calendar class then output using SimpleDateFormat
SimpleDateFormat format = new SimpleDateFormat("HH:mma");
Calendar calendar = Calendar.getInstance();
calendar.set(Calendar.HOUR_OF_DAY, 10);
calendar.set(Calendar.MINUTE, 30);
System.out.println(format.format(calendar.getTime()));

A: can't do that.Only format to String representations.
SimpleDateFormat simDateFormate = new SimpleDateFormat("hh:mm a");
System.out.println(simDateFormate.format(new Date()));


text:
Q: VueJS 3 -  class not applied to routes that start with the same path name I have created a simple navar where I have 3 links. All links are declared at a ROOT level of the router object. I've added a simple styling targeting the <router-link-active> class where the active link is highlighted on the navbar. This all works fine, switching between links updates the URL, changes the <router-view> as well as applies correct style to the navbar link currently on.
The issue I'm having is that whenever I click on a 4th link which is also declared on the ROOT level of the router object, starting with the same path name as currently active link, the <router-link-active> class disasters. e.g.
{ path: "/link2", component: link2 },
{ path: "/link2/sibling", component: sibling },

My understanding is because the /links2/sibling starts with the same name as /link2, the navbar item that navigates to /link2 should still be have the <router-link-active> class, even when the /link2/sibling is currently active URL.
Codesandbox
App.vue
<template>

      <router-link to="/">

Link 1

      </router-link>
      <router-link to="/link2">

Link 2

      </router-link>
      <router-link to="/link3">

Link 3

      </router-link>

  <router-view />
</template>

main.js
import App from "./App.vue";
import router from "./router.js";

const app = createApp(App);

app.use(router);

app.mount("#app");

router.js
import { createRouter, createWebHistory } from "vue-router";
import link1 from "./components/link1.vue";
import link2 from "./components/link2.vue";
import sibling from "./components/sibling.vue";
import link3 from "./components/link3.vue";

const router = createRouter({
  history: createWebHistory(),
  routes: [
    { path: "/", component: link1 },
    { path: "/link2", component: link2 },
    { path: "/link2/sibling", component: sibling },
    { path: "/link3", component: link3 }
  ]
});

export default router;

link1.vue
<template>

You are inside Link1

</template>

link2.vue
<template>

    <router-link to="/link2/sibling">
      You are inside Link 2 (CLICK ME)
    </router-link>

</template>

link3.vue
<template>

You are inside Link 3

</template>

sibling.vue
<template>

You are inside Link2 sibling

</template>

A: I think that is the natural behavior that we could expect from routing. when you click on You are inside Link 2 (CLICK ME) inside link2.vue component, the vue-router loads sibling.vue in the router-view part in your App.vue. So there is no You are inside Link 2 (CLICK ME) link in that view to see the router-link-active styles. If you want to see that styles, you must keep your link in the view and don't allow vue-router to disappear that.
For achieving such a goal you can use Nested Routes in vue-router like this. First change your router.js file to something like this:

import { createRouter, createWebHistory } from "vue-router";
import link1 from "./components/link1.vue";
import link2 from "./components/link2.vue";
import sibling from "./components/sibling.vue";
import link3 from "./components/link3.vue";

const router = createRouter({
  history: createWebHistory(),
  routes: [
    { path: "/", component: link1 },
    {
        path: "/link2",
        component: link2,
        children: [
            {
              path: 'sibling',
              component: sibling
            },
          ]
    },
//    { path: "/link2/sibling", component: sibling
//
//    },
    { path: "/link3", component: link3 }
  ]
});

export default router;

And then add a <router-view> to your link2.vue file like this:

<template>

    <router-link to="/link2/sibling">
      You are inside Link 2 (CLICK ME)
    </router-link>
    <router-view></router-view>

</template>


text:
Q: Concentric sphere and a spherical shell I have the following system:

A non-conducting sphere with radius $R$ is placed inside a spherical non-conducting shell with inner radius $2R$ and outer radius $3R$. The shell and the sphere are Concentric.
It is given that the electric potential inside the sphere is $Ar^2$ for a positive $A$ (and $0\le r\le R$). The shell is charged in a non-uniform charge density $\rho(r)=C \cdot\frac{1}{r}$ for a positive $B$ (and $2R\le r\le 3R$).
I need to find the charge density of the sphere, but I have no idea how.

I can calculate the charge of the shell and thus its electric field, but I don't know if it helps me to figure out the charge density of the sphere.

A: Since the electric field is the negative gradient of the electric potential, you could easily calculate the field. From there, calculating the charge density is straightforward using Gauss' Law or Maxwell I. For any Gaussian sphere of radius $r<R$ concentric with the system,
$$\rho(r)=\epsilon\left(\nabla \cdot \mathbf{E(r)}\right),\,0\leq r \leq R. $$
Or, you could realize that the divergence of the gradient of a scalar potential is the Laplacian of said potential and derive the charge density directly:
$$\rho(r) = -\epsilon\ \nabla^2 \ U(r), \, 0 \leq r\leq R.$$
The outer shell is irrelevant.


text:
Q: My ubuntu decided to remove itself One week ago, my ubuntu has died. That day, I decided to do smth (I can't remember, what exacly I wanted to). And to do this I was informed by system to update libc++ to newer version. As aptitude cuffed me trying to do that "global" update, I understood, that it should be done manually only. So, when I tried this:
sudo apt-get remove libc++*

I pressed Enter and went to kitchen to take a coffee. So, it was very stupid by my side, 'cause when I returned back, my jowl just fell off: when I accepted the removing of libc++, I skipped my favourite f***ing autoremove function.
It said, that it also gonna remove nearly all the system. Package-by-package. And when I saw this, it was too late "to say goodbye". Everything important already was in the underworld (sating "important" I mean aptitude, apt and dpkg). Thank God, that autoremove doesn't remove old files and documents from the hard drive, or now I have to become a corpse.
By some unknown to me super power of magics, by rebooting, dpkg recovered by ubuntu automatically (it started to set it up back). But with the other deleted packages, it was not do the same magic. And for a week till now I'm trying to recover aptitude or apt-get. And all my tryings are  vainly. I can't find packages with the same version was installed. These stupid dependencies. How can I recover these packages back into system?

A: You could try reinstall the apt package from here : http://linux.softpedia.com/get/System/Software-Distribution/apt-4598.shtml
install it through the command :
cd /path/to/the/downloaded/folder
./configure
make
sudo make install

and then reinstall the whole ubuntu-desktop package using the command :
sudo apt-get update && sudo apt-get install aptitude && sudo aptitude install ubuntu-desktop

The problem could be that you don't have the autoconf automake etc. the compile tools packages to compile apt... Give a try.

A: I would take the hard disk out of the computer and connect it to another computer, extract the information you need and then do a clean install of Ubuntu 13.10. I hope you don´t have that bad luck again.


text:
Q: How can I design a better or functional database for a video site with what I have? First time designing a database after perusing some text on the topic.
I'm trying to design a database for a video/image website with only a few contributors. I've looked over a dozen examples of other people have similar problems, and I attempted to design my own.
There are users. The users have roles that dictates what permission they have. The user can upload files (video or image) and add category/tags to them.
This is what I have so far before I begin adding a comment system which SO has a few great examples out there already.
    USER PROFILE
    email
    username
    password
    gender
    date_of_birth
    date_created
    date_modified

    ROLES
    name
    user_profile_id

    FILE
    title
    size
    date_created
    date_modified
    description
    uploaded_by
    category_id
    tag_id

    CATEGORY
    name

    TAG
    name

    IMAGE
    width
    height
    file_id

    VIDEO
    length
    quality
    file_id

Are these tables appropriate for what I'm doing? Can you suggest some alteration for better performance, or a more efficient design to prepare for future changes?
Here's a visual: http://dbpatterns.com/documents/52eddecc9785db06b8f20775/

A: It appears you forget to put the user_profile_id column in the User Profile table, as well as primary key fields for all the others? Also, given that the movie to tag relationship is many to many, you need a bridge table with movie_id and tag_id in the middle. With your current design a movie can have one tag only.


text:
Q: Where to find built Angular files Where do I find built files of Angular? The only way I know is to comb through the Angular repositories and download each library that I need. I would rather not use node_modules or require as I don't understand this method very well.
I don't want to use the QuickStart because I want to do a project that has as few files as possible.

A: As for wanting to start a new project without having to know the ins and outs of SystemJS or Webpack, look at the Angular-CLI.  Here is a neat article that shows how much simpler the CLI makes it to get started building an Angular application.
Although, the CLI won't teach you all the intricacies of Angular, it takes all the 'setup' work out of the equation.  It let's you create a new project with a simple command and be able to build it with a single command. Here is another website that takes a different approach to teaching some of the concepts in Angular2+.
These next two sites are curated lists of resources for learning Angular:

*

*http://www.angular2.com/

*https://github.com/jmcunningham/AngularJS2-Learning
Hope this helps point you in the right direction.


text:
Q: Flask WSGI Handler FileNotFoundError: [Errno 2] No such file or directory I am deploying a python web-app (dash, flask). I followed the tutorial in this link:
https://medium.com/@bilalbayasut/deploying-python-web-app-flask-in-windows-server-iis-using-fastcgi-6c1873ae0ad8
This worked fine and I got the example running. Now I want to run my own application (which works fine on my local PC in debug mode). But when I deploy it similarly to the example in the link, it gives an error that a file cannot be found.
The structure of my app is as follows:
- main.py
- bim.py
- tools.py
   - Dictionaries
   - assets

When I run the app, I get the following error message:
enter image description here
I have no idea why the app cannot find the file, as it is in the absolute location which is provided. Hope that anyone can help me with this issue.
Additional info, packages (requirements installed):
Brotli==1.0.9
click==7.1.2
dash==1.15.0
dash-core-components==1.11.0
dash-html-components==1.1.0
dash-renderer==1.7.0
dash-table==4.10.0
DateTime==4.3
Flask==1.1.2
Flask-Compress==1.5.0
future==0.18.2
gunicorn==20.0.4
itsdangerous==1.1.0
Jinja2==2.11.2
MarkupSafe==1.1.1
numpy==1.19.1
pandas==1.1.1
plotly==4.9.0
python-dateutil==2.8.1
pytz==2020.1
retrying==1.3.3
six==1.15.0
Werkzeug==1.0.1
xlrd==1.2.0
zope.interface==5.1.0

Permissions of Dictionary directory: enter image description here


text:
Q: Flex Web application Resize method(and Scale X/Y) not working on Server but works on local Flex Builder I have a quite different problem with resizing. I have a Flexbook component which uses the middle part of screen (center) with a html header menu and footer.
The problem:
The scaling works perfectly when we run in the local machine ( Flexbuilder). But when we deploy it to the server its like scaling never existed..
The requirement:
when user maximizes the window or minimizes it, the Flexbook should be resized to fit the screen.
I've used resize() method of top layer:
protected function application1_resizeHandler(event:ResizeEvent):void
{

var scaleX: Number = Application.application.width / 1024;
var scaleY: Number = Application.application.height / 762;

this.scaleX = this.scaleY = (scaleX>scaleY?scaleY:scaleX);

   for (var i:int = 0; i < this.numChildren - 1; ++i) {
if(this.getChildAt(i))
this.getChildAt(i).scaleX = this.getChildAt(i).scaleY = (scaleX>scaleY?scaleY:scaleX);
            }

}
Appreciate if anyone can explain why its happening:

*

*is there anything needed form server/html side ( parameter/options to enable scaling etc?)

*can we do something from within Flex ?

A: as far as i know, nothing is to do on server side. Which browser do you use on developer machine and server?
i would use the remote debugger in flex builder and would check the variables and if anyone calling the method.
BR
Frank


text:
Q: Expected value through Markov Chains (HMMT 2012) You are repeatedly flipping a fair coin. What is the expected number of flips until the first time that
your previous 2012 flips are 'HTHT...HT'?
Could someone tell me what's wrong with my solution using recursion and Markov Chains?
Define $n$ states corresponding to the $2013$ stages of 'HTHT...HT' (including the "$0$th" state, which is the start). Let $a_n$ denote the expected value of reaching the string at state $n$. For example, $a_3$ is the expected number of flips to reach 'HTHT...HT' given that the previous 3 flips were 'HTH.' Therefore, we want to find $a_0$.
Now we define the recursion $a_{n-1} = \frac{1}{2}(a_n+1)+\frac{1}{2}(a_{0}+1)$. From any state $a_{n-1}$, there is a $\frac{1}{2}$ chance that it will go to the next wanted element in the string, and this takes one flip. Similarly, there is a chance that it will go the wrong element, which brings the state back to state 0.
Note that $a_{2012} = 0$. $a_{2011} = \frac{1}{2}(a_0+2), a_{2010} = \frac{3}{4}(a_0+2), a_{2009} = \frac{7}{8}(a_0+2)$ From here, it's not difficult to prove with induction that $a_{2012-n} = \frac{2^k-1}{2^k}(a_0+2)$.
$a_0 = \frac{2^{2012}-1}{2^{2012}}(a_0+2)$
$a_0 = 2^{2013}-2$
Since the problems asks for the first time that the previous 2012 flips satisfy the condition, we add 1: $\fbox{$2^{2013}-1$}$
However, the correct solution is $\frac{(2^{2014} − 4)}{3}$.

A: One possible flaw, let's see how can we possibly mess up.
If we toss $HTHTT$, we messed up and we have to start from nothing. We go to state $0$.
If we toss $HTHTHH$, we messed up, but we start with a given $H$. We go to state $1$.
Hence we need not always go back to state $0$. It depends on the parity of the location that we fail.


text:
Q: Reputation requirement to create new tags is too high I'm speaking as a fairly long term user of stack overflow. I have just asked a question relating to a particular module for the laravel framework and was shocked to see that you need a rep of 1500 to create a new tag - (I was hoping to create a module specific tag).
This seems like a very high limit. I understand that a limit needs to be in place to prevent muppets from creating duplicate tags and to stop the numbers getting out of hand but this seems like quite a high bar.
Could you not ease us into it a bit maybe with a lower rep limit but with a monthly/yearly limit to the number of tags a user can create at lower reps.

A: If you think you need a new tag (on SO) you're probably wrong; chances are it already exists or shouldn't be a tag at all.  If you're really sure, you can always make a meta post requesting the tag be made.  If it should exist it will probably be made in a matter of minutes.
There are lots of problems on SO as a result of people creating tags that they shouldn't, either because it's just a duplicate of another tag (a misspelling, or a different wording of the same concept (i.e. C#4.0 vs. C#-4.0) or just something that's not appropriate for a tag.
For newer sites with a lower number of existing questions it's less likely that important and relevant tags already exist for your question, so the rep limit is lower.  On SO the sheer volume of incoming and existing questions means that the need for new tags is rather low, and the number (and impact of) incorrect new tags is rather high.  This is why the rep limit is so much higher.


text:
Q: How to read JSON data using pandas? I am trying to fit CNN for huffpost news dataset https://www.kaggle.com/rmisra/news-category-dataset. The dataset i am using is in json format. my data format is this
[
  {
    "category": "CRIME",
    "headline": "There Were 2 Mass Shootings In Texas Last Week, But Only 1 On TV",
    "authors": "Melissa Jeltsen",
    "link": "https://www.huffingtonpost.com/entry/texas-amanda-painter-mass-shooting_us_5b081ab4e4b0802d69caad89",
    "short_description": "She left her husband. He killed their children. Just another day in America.",
    "date": "2018-05-26"
  },
  {
    "category": "ENTERTAINMENT",
    "headline": "Will Smith Joins Diplo And Nicky Jam For The 2018 World Cup's Official Song",
    "authors": "Andy McDonald",
    "link": "https://www.huffingtonpost.com/entry/will-smith-joins-diplo-and-nicky-jam-for-the-official-2018-world-cup-song_us_5b09726fe4b0fdb2aa541201",
    "short_description": "Of course it has a song.",
    "date": "2018-05-26"
  }
]

And here is the code which i am trying the code source is https://www.kaggle.com/kredy10/simple-lstm-for-text-classification
import pandas as pd
import json

df = pd.read_json('News_Category_Dataset_v2.json', lines=True)

But I got these errors in the data reading code line
Traceback (most recent call last):   File "./Hpnews.py", line 37, in <module>
    df = pd.read_json('News_Category_Dataset_v2.json', lines=True)   File "C:\Users\Anaconda3\lib\site-packages\pandas\util\_decorators.py", line 214, in wrapper
    return func(*args, **kwargs)   File "C:\Users\Anaconda3\lib\site-packages\pandas\io\json\_json.py", line 608, in read_json
    result = json_reader.read()   File "C:\Users\Anaconda3\lib\site-packages\pandas\io\json\_json.py", line 729, in read
    obj = self._get_object_parser(self._combine_lines(data.split("\n")))   File "C:\Users\Anaconda3\lib\site-packages\pandas\io\json\_json.py", line 753, in _get_object_parser
    obj = FrameParser(json, **kwargs).parse()

A: You have to use the "orient" argument:
pd.read_json(..., orient="records")

See the documentation.


text:
Q: Terraform: How to Upgrade Provider without Changing Terraform Version when I try to run terraform apply, I see Error:
aws_glue_catalog_database.test: Provider doesn't support resource: aws_glue_catalog_database

Looks like my provider is old because terraform version shows provider.aws v1.6.0 and in fact I can launch glue in another folder with the same terraform version but with a newer provider.aws v2.0.0
Terraform v0.11.10
+ provider.archive v1.0.0
+ provider.aws v1.6.0
+ provider.null v1.0.0
+ provider.template v1.0.0

I tried to upgrade provider but keep the terraform version v0.11.10 the same. to do that, I run terraform init -upgrade but see the below warning:
terraform init -upgrade
Initializing the backend...
Backend configuration changed!

Terraform has detected that the configuration     specified for the backend
has changed. Terraform will now check for existing state in the backends.

Do you want to migrate all workspaces to "s3"?
  Both the existing "s3" backend and the newly     configured "s3" backend
 support workspaces. When migrating between      backends, Terraform will copy
  all workspaces (with the same names). THIS WILL     OVERWRITE any conflicting
  states in the destination.

  Terraform initialization doesn't currently migrate     only select workspaces.
  If you want to migrate a select number of     workspaces, you must manually
  pull and push those states.

  If you answer "yes", Terraform will migrate all     states. If you answer
  "no", Terraform will abort.

I decided to say "no" because the above warning scared me.
I do have a backend "s3" resource to remote store the status in s3 and have several workspaces. I do not understand why and how the backend and workspace will be changed if I upgrade provider using above command; whether it will break my system.
Does anybody know whether it is ok for me to say yes without messing things? or which terraform cmd I should run to upgrade provider without change terraform version? Thanks.

A: You're doing a major release upgrade so there is always risk I'm afraid.
Here are some links that could help you to highlight risks (if you haven't seen them already):

*

*https://www.terraform.io/docs/providers/aws/guides/version-2-upgrade.html#provider-version-configuration

*https://github.com/terraform-providers/terraform-provider-aws/blob/master/CHANGELOG.md
Before doing anything, I would recommend backing up the state files that are stored on the remote S3 bucket first. If your infrastructure is fairly static (or you have a mechanism to make it static), you could always put the old backups of the state back into S3 if it goes horribly wrong without causing an issue as no applies would have occurred during your upgrade process.
I don't know your setup but ideally you would be doing this in a development environment first which should hopefully ease your nerves about changing state files.


text:
Q: Using prototype citation grouping feature of MediaWiki Extension:Cite I use MediaWiki 1.35.1.
MediaWiki Cite extension has a prototype reference collecting feature. I'd like to use it in my wiki. According to the note below, this one is only available in the Beta-Cluster and indeed, I can use it on its sample pages. The Beta-Cluster Special:Version points to 69a5435 revision of the extension being used. However, if I download this snapshot and place it in my extension folder, this feature still doesn't work and extends attribute is still not recognized. The error I've got is
Cite error: Invalid <ref> tag; invalid names, e.g. too many

How can I enable this feature in my own wiki?

A: As it turned out, I need to set in LocalSettings.php following option:
$wgCiteBookReferencing = true;

I missed this because this is not mentioned anywhere in Help:Cite page. I've found it later in Extension:Cite page.


text:
Q: Command works in echo, not in bash. How to translate code from terminal to bash? Short version:
This unix command (from this tutorial https://techdocs.akamai.com/iot-token-access-control/docs/generate-jwt-rsa-keys):
$ echo -n '{ "alg": "RS256",   "typ": "JWT" }' | base64 | sed s/\+/-/ | sed -E s/=+$//

Prints this:
eyAiYWxnIjogIlJTMjU2IiwgICAidHlwIjogIkpXVCIgfQ

I am trying to move this to a bash script:
#!/bin/bash
HEADER='{ "alg": "RS256",   "typ": "JWT" }' | base64 | sed s/\+/-/ | sed -E s/=+$//
echo -n $HEADER

But the output is an error:
 sed: -e expression #1, char 8: unknown option to `s'

Is there something that needs to be done to make SSH scripts that work in the shell work in bash?
(I'm completely new to bash scripts)
Long version:
I need to build a bash script that creates a JWT and then calls a Rest API from a Linux server. I have never built a bash script before, but the basic format was going to be:
#!/bin/bash
HEADER= ... encoded header
SIXTYSECONDS=date -d '1 min' +%s #<-- this also works in echo, but not in bash -- supposed to be current time+60 seconds as epoch time
PAYLOAD= ... encoded payload with $SIXTYSECONDS as expiration time
SIGNATURE=... encoded signature from keycerts
JWT= $HEADER.$PAYLOAD.$SIGNATURE
... Will tackle the code to call the API once I have the JWT code down

I am following this tutorial (https://techdocs.akamai.com/iot-token-access-control/docs/generate-jwt-rsa-keys) but it doesn't help me programmatically concatenate the various JWT pieces. Also I'm not sure how to integrate the 60 second expiration.


text:
Q: Rename files using regex on linux using script I would like to rename the following files. Basically extracting the words to the left of the year, removing any non alphanumeric characters and replacing them with a space, then putting the year in parenthesis to the right.
Annabelle.2014.HC.HDRip.XViD.AC3-juggs[ETRG].avi
Dracula Untold 2014 720p HDRip x264 AC3-JYK.mkv
From.Paris.with.Love.2010.1080p.BluRay.x264.YIFY.mp4
Godzilla.2014.1080p.BluRay.x264.YIFY.mp4
If.I.Stay.2014.1080p.BluRay.x264-SPARKS.mkv
Into.the.Storm.2014.1080p.BluRay.x264.YIFY.mp4
Jessabelle.2014.HDRip.XViD-juggs[ETRG].avi
Ouija.2014.1080p.HC.WEBRip.x264.AAC2.0-RARBG.mp4
Teenage Mutant Ninja Turtles (2014) 1080p Full HDRip x264 AC3 6Ch-CPG.mp4
The.Purge.Anarchy.2014.1080p.BluRay.x264.YIFY.mp4
Transformers.Age.of.Extinction.2014.1080p.BluRay.x264.YIFY.mp4

So the output should look like:
Annabelle (2014).avi
Dracula Untold (2014).mkv
From Paris with Love (2010).mp4
Godzilla (2014).mp4
If I Stay (2014).mkv
Into the Storm (2014).mp4
Jessabelle (2014).avi
Ouija (2014).mp4
Teenage Mutant Ninja Turtles (2014).mp4
The Purge Anarchy (2014).mp4
Transformers Age of Extinction (2014).mp4

I learn by example, and I'm having a hard time figuring this out. I would show you what I've tried, but it's too embarrassing.

A: How about
sed -r 'y/./ /; s/[()]//g; s/^([^0-9]+)([0-9]+).*\s([a-z0-9]+)$/\1(\2).\3/;' inputFile

Give output as
Annabelle (2014).avi
Dracula Untold (2014).mkv
From Paris with Love (2010).mp4
Godzilla (2014).mp4
If I Stay (2014).mkv
Into the Storm (2014).mp4
Jessabelle (2014).avi
Ouija (2014).mp4
Teenage Mutant Ninja Turtles  (2014).mp4
The Purge Anarchy (2014).mp4
Transformers Age of Extinction (2014).mp4

Usage
for file in *
do
   mv "$file" "$(echo "$file" | sed -r 'y/./ /; s/[()]//g; s/^([^0-9]+)([0-9]+).*\s([a-z0-9]+)$/\1(\2).\3/;')"
done

Test
$ ls
Annabelle.2014.HC.HDRip.XViD.AC3-juggs[ETRG].avi  From.Paris.with.Love.2010.1080p.BluRay.x264.YIFY.mp4  Godzilla.2014.1080p.BluRay.x264.YIFY.mp4
$ for file in *; do    mv $file "$(echo $file | s sed -r 'y/./ /; s/[()]//g; s/^([^0-9]+)([0-9]+).*\s([a-z0-9]+)$/\1(\2).\3/;' )" ; done
$ ls
Annabelle (2014).avi  From Paris with Love (2010).mp4  Godzilla (2014).mp4

A: I tried your above code in perl program.
If necessary make use of it.
   use warnings;
   use strict;
    opendir(DIR, "$ARGV[0]");
    my @file = grep{/\.[^\.]+$/i} readdir(DIR);
    close(DIR);

    foreach my $songs (@file){
        my $song = $songs;
        $song =~ s{((?:(?!(?:\()?[0-9]{4}(?:\))?).)*)(?:\()?(2[0-9]{3})(?:\))?(.*?)(\.[^\.]+)$}{$1 ($2)$4}igm;

        $song =~ s{((?:(?!(?:\()?[0-9]{4}(?:\))?).)*(?:\()?2[0-9]{3}(?:\))?)(\.[^\.]+)$}{
            my $songname = $1;
            my $songtype = $2;
            $songname =~ s{\.}{ }igm;
            qq($songname$songtype)
        }isgem;

        rename("$ARGV[0]\\$songs", "$ARGV[0]\\$song") || die ( "Error in renaming" );

    }

OUTPUT:
Annabelle  (2014).avi
Dracula Untold  (2014).mkv
From Paris with Love  (2010).mp4
Godzilla  (2014).mp4
If I Stay  (2014).mkv
Into the Storm  (2014).mp4
Jessabelle  (2014).avi
Ouija  (2014).mp4
Teenage Mutant Ninja Turtles  (2014).mp4
The Purge Anarchy  (2014).mp4
Transformers Age of Extinction  (2014).mp4

A: Try the below rename command on the directory on which the files you want to rename are stored.
rename 's/\b\d{4}\b\K.+(?=\.)//g;s/[^A-Za-z\d]+(?=.*?\.[^.]+$)/ /g;s/\b(\d{4})\./($1)./' *.*

Example:
$ ls
Annabelle.2014.HC.HDRip.XViD.AC3-juggs[ETRG].avi
Teenage Mutant Ninja Turtles (2014) 1080p Full HDRip x264 AC3 6Ch-CPG.mp4
Transformers.Age.of.Extinction.2014.1080p.BluRay.x264.YIFY.mp4
$ rename 's/\b\d{4}\b\K.+(?=\.)//g;s/[^A-Za-z\d]+(?=.*?\.[^.]+$)/ /g;s/\b(\d{4})\./($1)./' -vn *.*
Annabelle.2014.HC.HDRip.XViD.AC3-juggs[ETRG].avi renamed as Annabelle (2014).avi
Teenage Mutant Ninja Turtles (2014) 1080p Full HDRip x264 AC3 6Ch-CPG.mp4 renamed as Teenage Mutant Ninja Turtles (2014).mp4
Transformers.Age.of.Extinction.2014.1080p.BluRay.x264.YIFY.mp4 renamed as Transformers Age of Extinction (2014).mp4


text:
Q: Max geometric body inside another one If we take in consideration the dimensions of the Giza Great Pyramid, what would be the maximum size of an sphere put inside the building? How can I calculate same for an outer sphere on the pyramid vertices, at maximum size?
[]

A: Hint...The largest internal sphere has to touch the base at its centre and touch the lines of symmetry of the triangular faces. So if $r$ is the radius of the sphere and $h$ is the height of the pyramid, we have $$\cos  51.87=\frac{r}{h-r}$$ and you can solve this for $r$


text:
Q: What's the meaning of function eval() in torch.nn module Official comment shows that "This has any effect only on modules such as Dropout or BatchNorm." But I don't understand its implementation.

A: Dropout and BatchNorm (and maybe some custom modules) behave differently during training and evaluation. You must let the model know when to switch to eval mode by calling .eval() on the model.
This sets self.training to False for every module in the model. If you are implementing your own module that must behave differently during training and evaluation, you can check the value of self.training while doing so.


text:
Q: Couch authentication. New react native project I'm starting up a new project using Couch DB and a react native front end. I was wondering what is the recommended way of doing user authentication. weather it is setting up users in Couch DB or going through, for example, a node server to process user credentials and get a token for them and whatnot. or if there are any other ideas, I'd greatly appreciate that.

A: CouchDB authentication system is a bit limited:

*

*You can't revoke sessions

*It somehow hard to integrate third party authentication (facebook, google+)

*Password recovery/reset is not available by default

Since you're building a client application, you can't implement password recovery on the client side. You'll need a backend service that handle this.
It all depends on your need. You can easily start with CouchDB's auth system and add a auth service on top of CouchDB later.