text:
Q: k8s HorizontalPodAutoscaler - set target on limit, not request I have a deployment where cpu request is 500m and cpu limit is 1000m.
I create a hpa as -
 metrics:
  - type: Resource
    resource:
      name: cpu
      target:
        type: Utilization
        averageUtilization: 80

This makes calculations based on the cpu requests. Is there a way to make it look at the cpu limit instead ?

A: If you set different values for limits and request, you made them "Burstable". What this means in Kubernetes is "This application is very important and may exceed it's normal targeted usage". You should set requests as normal limits and scale based on them. Actual limits provides infrastructure safety by limiting pod capabilities.
This is why you should start with setting requests and limits to same values. If you have problems with this(like pod startup requires little bit more than needed or scaling happens slowly) you should set bursting range but still think like requests as normal limits(More like soft limit/hard limit thing).
Answer is no, you can't. Because you're looking it wrong.


text:
Q: How to block dedicated server requests in Oracle Database? I have gone through some docs but no luck. Oracle database is always enabled to allow dedicated server processes. You can't control tnsnames.ora but you need to disallow clients to connect the database service in dedicated server mode.
Is it possible to disable dedicated server connection in server side or to block out dedicated server request from some clients in a technological way?

A: Taken from the Oracle documentation in the article 5.1 About Dedicated and Shared Server Processes:

Your database is always enabled to allow dedicated server processes, but you must specifically configure and enable shared server by setting one or more initialization parameters.

Enabling Shared Servers is a simple as setting the parameter SHARED_SERVERS to a non-null value:

Shared server is enabled by setting the SHARED_SERVERS initialization parameter to a value greater than 0. The other shared server initialization parameters need not be set.

Reference: 5.4.3 Enabling Shared Server (Oracle Docs)
So we've got the server covered, but what about clients?
There are two parameter files where a client can configure how its process will connect to an Oracle instance. These are the tnsnames.ora file and the sqlnet.ora file.
sqlnet.ora
In the sqlnet.ora file the following parameter can be set:
USE_DEDICATED_SERVER=[on|off]

If set to on, then the parameter USE_DEDICATED_SERVER automatically appends (SERVER=dedicated) to the connect data for a connect descriptor. This way connections from this client use a dedicated server process, even if shared server is configured.
Default
off

Reference: 5.2.82 USE_DEDICATED_SERVER (Oracle Docs)
So setting this parameter to OFF on the client side will ensure that ON isn't set for client connections. And the explanation tells us how the settings would look like in the tnsnames.ora file.

...automatically appends (SERVER=dedicated) to the connect data for a connect descriptor

tnsnames.ora
In the tnsnames.ora file each connection (client side) can be set up to either use a shared or a dedicated connection, which in turn results in the oracle.exe spawning an individual process (dedicated) or directing the connection to a dispatcher on the database instance (shared).

dedicated to specify whether client requests be served by dedicated server.
shared to specify whether client requests be served by a dispatcher or shared server.

Reference: 6.9.7 SERVER (Oracle Docs)
Setting this parameter to (SERVER=SHARED) at the client level will ensure that the client will connect to a dispatcher.
Possible Solution

*

*Enable Shared Servers at the Oracle instance level by providing the SHARED_SERVERS=1 parameter in your SPFILE or PFILE.

*Ensure that the clients don't have any of the parameters required to connect using a Dedicated Server in their configuration files (sqlnet.ora or tnsnames.ora).

*Ensure that USE_DEDICATED_SERVER=ON is set on your Oracle Database Server in the sqlnet.ora file as RMAN and other tasks require a dedicated connection to function correctly.
Answering Your Question

Is it possible to disable dedicated server connection in server side or to block out dedicated server request from some clients in a technological way?

No, because of my first quote:

Your database is always enabled to allow dedicated server processes, but you must specifically configure and enable shared server by setting one or more initialization parameters.

However, if the clients aren't explicitly configured to connect using a dedicated connection, then enabling Shared Servers at the instance level will allow non-configured clients to at least connect using a shared connection, because the default for USE_DEDICATED_SERVER is off.

A: No, no way to block the dedicated server mode. It's an unchangeable feature and an important mechanism in Oracle Database. Actually the shared server mode could  be blocked.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Array format unexpected when combined columns into a new one I have 3 columns in a dataframe:
df:
A |B|C
hi| |dear

In order to combine them into a new column D, I did:
df['D'] = [[x, y, z] for x, y, z in zip(df.A, df.B, df.C)]

Unfortunately, the outcome looks like this: [hi, ,dear] . How do I format it to this: [hi dear] or [hi-dear] by essentially removing null values (and commas associated) and then connecting the remaining values with space or dash? Any help is appreciated!
Thanks.

A: apply is a handy tool to apply a simple function to all the rows of a dataframe. Here you could join the columns with a space character and replace any number of spaces with a single one. Code could be:
import re

blanks = re.compile(' +')
df['D'] = df.apply(lambda x: blanks.sub(' ', ' '.join(x)), axis=1)

df will become as expected:
    A B     C        D
0  hi    dear  hi dear

A: Since you tag pandas
df.mask(df=='').stack().groupby(level=0).apply('+'.join).tolist()
['hi+dear']


text:
Q: found: liquibase.logging.core.DefaultLoggerConfiguration | required: java.lang.Class [ERROR]   required: java.lang.Class
[ERROR]   found: java.lang.Class<liquibase.logging.core.DefaultLoggerConfiguration>
[ERROR]   reason: inference variable T has incompatible bounds
[ERROR]     equality constraints: liquibase.logging.core.DefaultLoggerConfiguration
[ERROR]     lower bounds: liquibase.configuration.ConfigurationContainer
I face this issue when I upgrade Liquibase version from 3.5.5. to any higher version. I use postgres 13 and hibernate. Any help is appreciated.


text:
Q: Why is it the case that $\det(T_\alpha)=\det(T_\alpha|_{\mathbb{Q}(\alpha)})^{n/d}$ I'm reading a solution to a problem and in it they use this fact, It seems intuitive that it should be true, but I dont see how you could show it.
$K$ is a number field of degree $n$, and $\alpha\in K$. $T_\alpha:K\to K$ is a linear transformation from $K$ as a $\mathbb{Q}$ vector space corresponding to multiplication by $\alpha$.
Then, if $[\mathbb{Q}(\alpha):\mathbb{Q}]=d$, we get $[K:\mathbb{Q}(\alpha)]=\frac{n}{d}$.
How can we show that $\det(T_\alpha)=\det(T_\alpha|_{\mathbb{Q}(\alpha)})^{n/d}$ and that $N_{K/\mathbb{Q}}(\alpha)=(N_{\mathbb{Q}(\alpha)/\mathbb{Q}}(\alpha))^{n/d}$

A: Take a basis
$$K = \sum_{j=1}^{n/d} b_j \Bbb{Q}(\alpha)$$
Each subspace $b_j \Bbb{Q}(\alpha)$ is sent to itself by the linear map $T_\alpha:x\to \alpha x$, thus $$\det(T_\alpha) = \prod_{j=1}^{n/d} \det(T_\alpha|_{b_j \Bbb{Q}(\alpha)})$$
Finally $$\det(T_\alpha|_{b_j \Bbb{Q}(\alpha)})=\det(T_\alpha|_{\Bbb{Q}(\alpha)})$$


text:
Q: Hive UDF in Java fails when creating a table What is the difference between those two queries:
SELECT my_fun(col_name) FROM my_table;

and
CREATE TABLE new_table AS SELECT my_fun(col_name) FROM my_table;

Where my_fun is a java UDF.
I'm asking, because when I create new table (second query) I receive a java error.
Failure while running task:java.lang.RuntimeException: java.lang.RuntimeException: Map operator initialization failed
...
Caused by: org.apache.hadoop.hive.ql.exec.UDFArgumentException: Unable to instantiate UDF implementation class com.company_name.examples.ExampleUDF: java.lang.NullPointerException

I found that the source of error is line in my java file:
encoded = Files.readAllBytes(Paths.get(configPath));

But the question is why it works when table is not created and fails if table is created?

A: The problem might be with the way you read the file. Try to pass the file path as the second argument in the UDF, then read as follows
private BufferedReader getReaderFor(String filePath) throws HiveException {
    try {
        Path fullFilePath = FileSystems.getDefault().getPath(filePath);
        Path fileName = fullFilePath.getFileName();
        if (Files.exists(fileName)) {
            return Files.newBufferedReader(fileName, Charset.defaultCharset());
        }
        else
        if (Files.exists(fullFilePath)) {
            return Files.newBufferedReader(fullFilePath, Charset.defaultCharset());
        }
        else {
            throw new HiveException("Could not find \"" + fileName + "\" or \"" + fullFilePath + "\" in inersect_file() UDF.");
        }
    }
    catch(IOException exception) {
        throw new HiveException(exception);
    }
}

private void loadFromFile(String filePath) throws HiveException {
    set = new HashSet<String>();

    try (BufferedReader reader = getReaderFor(filePath)) {
        String line;
        while((line = reader.readLine()) != null) {
            set.add(line);
        }
    } catch (IOException e) {
        throw new HiveException(e);
    }
}

The full code for different generic UDF that utilizes file reader can be found here

A: I think there are several points unclear, so this answer is based on assumptions.
First of all, it is important to understand that hive currently optimize several simple queries and depending on the size of your data, the query that is working for you SELECT my_fun(col_name) FROM my_table; is most likely running locally from the client where you are executing the job, that is why you UDF can access your config file locally available, this "execution mode" is because the size of your data. CTAS trigger a job independent on the input data, this job runs distributed in the cluster where each worker fail accessing your config file.
It looks like you are trying to read your configuration file from the local file system, not from the HDSFS Files.readAllBytes(Paths.get(configPath)), this means that your configuration has to either be replicated in all the worker nodes or be added previously to the distributed cache (you can use add file from this, doc here. You can find another questions here about accessing files from the distributed cache from UDFs.
One additional problem is that you are passing the location of your config file through an environment variable which is not propagated to worker nodes as part of your hive job. You should pass this configuration as a hive config, there is an answer for accessing Hive Config from UDF here assuming that you are extending GenericUDF.


text:
Q: unaccessible and inaccessible inaccesible and unaccessible?
what is the difference between the two and how would they be chosen for a sentence. Are both words used equally or is there a certain rule that decides wich is used?

A: Inaccessible is much more common, but it seems that unaccessible is sometimes used in the same places and it is listed in some online dictionaries. I looked it up in my dictionary and there is no entry for "unaccessible". I guess "unaccessible" is a word some native/non-native speakers have wrongly used to an extent that some online dictionaries have felt the need to define it. It's better not to use a non-standard word and only use it when it's become common enough to be included in all dictionaries.

A: If you always use inaccessible, you'll never go wrong and you won't have to debate whether "unaccessible" is even a real word.


text:
Q: Cannot find org.bouncycastle.cms --> cannot compile I am upgrading my web project. Then some obselete function cannot be used. Then I download new jar and have some new coding according to the search in the web. But it cannot find org.bouncycastle.cms library even I have imported with libraries as shown below: Please help!!
enter image description here
   import org.bouncycastle.cms.CMSAlgorithm;
    import org.bouncycastle.cms.jcajce.JceCMSContentEncryptorBuilder;
    import org.bouncycastle.cms.jcajce.JceKeyTransRecipientInfoGenerator;

    Security.addProvider(new BouncyCastleProvider());
    SMIMEEnvelopedGenerator encrypter = new SMIMEEnvelopedGenerator();
    InputStream inStream = new FileInputStream(cert_file);
    CertificateFactory cf = CertificateFactory.getInstance("X.509");
     X509Certificate cert = (X509Certificate)cf.generateCertificate(inStream);

    MessageDigest dig = MessageDigest.getInstance("SHA1", "BC");
                dig.update(SubjectPublicKeyInfo.getInstance(cert.getPublicKey().getEncoded()).getPublicKeyData().getBytes());
 issue here --->   encrypter.addRecipientInfoGenerator(new JceKeyTransRecipientInfoGenerator(dig.digest(),cert.getPublicKey()).setProvider("BC"));
         inStream.close();
    MimeMessage msg = new MimeMessage(mailSession);
 issue here -->   MimeBodyPart encryptedPart = encrypter.generate(msg, new JceCMSContentEncryptorBuilder(CMSAlgorithm.DES_EDE3_CBC).setProvider("BC").build());


text:
Q: Why are my dates not being sorted correctly? I have a dataframe and want to sort it by dates.

The format here is dd/mm/yyyy. As you can see it is not sorted correctly. I guess I need to change the format of my dates.
How can I get this dataframe sorted so that it looks like:
01/05/2020
02/05/2020
03/05/2020
etc.


text:
Q: Clonezilla not enough free memory I have cloned an 1.2TB drive using clonezilla and put it on the NFS share. My friend is trying to use that image and burn it on his drive (6.4 TB one). After confirming everything and when we were hoping to see progress bars we have received and error "there is not enough free memory, partclone suggests you should have 1089871111003596937 bytes memory". This is quite a lot of memory to be honest. Can anyone help us?
Thanks in advance

A: That is more than a lot of memory.  Thats asking for an exabyte, which is...  LARGE.
You didnt detail the steps you took to do the clone, so its impossible to say what could be the issue.  Assuming you did, this appears to be a bug in Clonezilla.
I suggest you go to Clonezilla's forum and post there.

A: Updating clonezilla to newer version (20200703-focal) resolved all issues.


text:
Q: ASP.NET Core with SPA, how to handle invalid routes on root? Our ASP.NET Core with Single Page App as client, is hosted on Azure Web Service.  We noticed that all environments and deployment slots get an occasional POST action request on /index.html.  In the ASP.NET Core application, http requests to the root is routed to the SPA application files through configuring the SPA static files provider middleware:
services.AddSpaStaticFiles(configuration => {
                configuration.RootPath = "ClientApp/dist/ClientApp";
});

When these POST actions are requested on /index.html, the application will throw an exception:

The SPA default page middleware could not return the default page '/index.html' because it was not found, and no other middleware handled the request.

In turn, the exception causes issues in our performance monitoring as the exceptions are not caught/handled anywhere.  Especially if this happens multiple times in a short time.
Question: What can we configure to either immediately return 403 or similar response, or setup such that we at least catch the exception?

A:
The SPA default page middleware could not return the default page '/index.html' because it was not found, and no other middleware handled the request.

*

*This problem arises when the wwwroot folder is not copied in build or publishing the project.

*In either cases, both commands don't copy the wwwroot folder.

*As a workaround, you can add this target to your project file:
  <Target Name="AddGeneratedContentItems" BeforeTargets="AssignTargetPaths" DependsOnTargets="PrepareForPublish">
    <ItemGroup>
      <Content Include="wwwroot/**" CopyToPublishDirectory="PreserveNewest" Exclude="$(DefaultItemExcludes);$(DefaultExcludesInProjectFolder);@(Content)" />
    </ItemGroup>
  </Target>

What can we configure to either immediately return 403 or similar response, or setup such that we at least catch the exception?

*

*Another reason can be , if your controller route attribute don't exactly match the request URL, then this type of error occurs.

*Please refer the similar issue found in GitHub.

A: I have found a solution in an issue case on GitHub.  This solution will call on the middleware only when the request meets the correct condition: when it's a GET request.
In the Configure method of the Startup class:
app.UseWhen(context => HttpMethods.IsGet(context.Request.Method), builder =>
{
    builder.UseSpa(spa =>
    {
       // ... add any option you intend to use for the Spa middleware
    });
});


text:
Q: Maya Python append a button into a list creates 2 UI elements I'm trying to create an automated way of adding elements to my UI interface and deleting them when needed.
The functionality is there, on button press I create an instance of the translateUI class and with the other button I can remove it.
The issue lies within the def setBoolOn(self, *args).
btnList.append(self.delBtnFetch) is creating a second button in the UI and I cannot figure out why. Clicking the 'Add' button once generates 2 buttons, even though the function only creates one.
When commenting out the btnList.append, it only creates a single button, but the rest of the code breaks, when trying to remove it.
import maya.cmds as cmds
import maya.mel as mel

class UI(object):
    #Constructor
    def __init__(self):

    #global counter, classList, sequence
    self.btnList = []
    global counter
    counter = 1
    classList.clear()
    btnList.clear()

    #define name, size and title
    self.window = 'Animation_Window'
    self.title = 'Animation Automator'
    self.size = (400,560)

    #close window if open
    if cmds.window(self.window, exists=True) :
        cmds.deleteUI(self.window, window=True)

    #create new window
    self.window = cmds.window(self.window, title=self.title, widthHeight=self.size, sizeable=False)

    #specify layout for window
    cmds.columnLayout(adjustableColumn=True)

    #test text
    cmds.text('Text in class')

    #add button
    self.btnChckBoxOn = cmds.button(label='Add', c=self.setBoolOn)
    #remove button
    self.btnChckBoxOff = cmds.button(label='Remove', c=self.setBoolOff)

    #display window
    cmds.showWindow()

############################
##Add button functionality##

def setBoolOn(self, *args):
    #button check
    btnChckOn = cmds.button(self.btnChckBoxOn, query=True)
    global counter
    self.classList = []
    #add 1 to the counter
    if counter >= 0:
        counter = counter + 1
        #create, based on sequence, the translateUI class
        self.sequence = translateUI(counter)

        #add the sequence class to a list
        classList.append(self.sequence)

        #get the button from translate
        self.delBtnFetch = translateUI(0).delBtn

        #add the delBtn to a list
        btnList.append(self.delBtnFetch)
        print(btnList)

###############################
##remove button functionality##

def setBoolOff(self, *args):
    #button check
    btnChckOff = cmds.button(self.btnChckBoxOff, query=True)
    global counter, classList
    #substract one off the counter
    if counter >= 1:
        counter = counter - 1

        #get the last class in the list
        lastSequence = classList[-1]

        #set the last class instance to null
        lastSequence = Null()

        #get the last button in the list
        lastButton = btnList[-1]

        #remove the last button from list
        btnList.remove(lastButton)

        #delete last button from the UI
        cmds.deleteUI(lastButton)
    else :
        print('You cannot remove all Sequences')

#initiate window class
myWindow = UI()

#######################
##Additional UI class##
#######################

class translateUI():
    def __init__(self, counter):
        global delBtn
        self.delBtn = cmds.button(l='Animate', c=self.AnimatePress)

    def AnimatePress(self, *args):
        btnAnimate = cmds.button(self.delBtn, query=True)
        print('Animation Pressed')

##############
##VOID class##

class Null():
    pass

I am not that insanely experienced with Python yet and am at a loss here, any help is appreciated!

A: The issue is in your setBoolOn() method, the translateUI class is initialized twice as you can see here
# >> first translate UI instance was created
self.sequence = translateUI(counter)

self.classList.append(self.sequence)

# >> second translate UI instance was created
self.delBtnFetch = translateUI(0).delBtn

now each time it gets initiated, it will create a button for you, as that's how you declared it.
class translateUI():
    def __init__(self, counter):
        global delBtn
        # >> you're creating a button during the initialization
        self.delBtn = cmds.button(l='Animate', c=self.AnimatePress)

A: I didn't use your code but I guess what you're trying to do is something like this:
from maya import cmds
import sys

# I'm trying to create an automated way of adding elements to my UI interface and deleting them when needed.

def userInput():
    user_input = cmds.promptDialog(title="Control Info", message="name,label", style="text",
                                   button=['OK', 'Cancel'], defaultButton='OK',
                                   cancelButton='Cancel', dismissString='Aborted'
                                   )
    if user_input == 'OK':
        ranges = cmds.promptDialog(query=True, text=True)
    else:
        print('closed')
        # force to stop the script
        sys.exit()
    return ranges.split(",")

def setParentLayout(*args):
    """ Set the parent one level up in the current active window"""
    cmds.setParent('..')
    print ("MOVED the parent to: {0}".format(cmds.setParent(q=True)))

def addButtons(*args):
    """ Add a button to the current parent """
    # get control type and name
    description = userInput()

    # a dynamic dictionnary to extend for more buttons
    ctrl_dict = {"button": cmds.button, "checkBox": cmds.checkBox}

    # create the control
    ctrl_cmd = ctrl_dict[description[0]]
    the_ctrl = ctrl_cmd()

    # If it's not a layout, use the label
    if not cmds.layout(the_ctrl, q=True, ex=True):
        ctrl_cmd(the_ctrl, e=True, l=description[1])

    print("ADDED A BUTTON: {0}".format(the_ctrl))
    # update the list
    controls.append(the_ctrl)

def addLayout(*args):
    """ Add a layout to the current parent """
    lay = cmds.columnLayout()
    controls.append(lay)
    print("ADDED A LAYOUT: {0}".format(controls))

def removeButtons(*args):
    """ remove one by one anything that the user created"""
    for button_name in controls.__reversed__():
        if cmds.control(button_name, q=True, ex=True):
            cmds.deleteUI(button_name)
            print("DELETED CONTROL: {0}".format(button_name))

            # update my list
            controls.remove(button_name)
        break

# A simple window for testing the methods
controls = []
windowed = 'myWindow'
if cmds.window(windowed, q=True, exists=True):
    cmds.deleteUI(windowed)
    cmds.windowPref(windowed, remove=True)

cmds.window(windowed, title='Updater UI', w=297, h=113)
cmds.showWindow(windowed)
cmds.frameLayout("main_layout", lv=False, mh=7)

# create the updater button
edge = 7
layout2 = cmds.rowColumnLayout(nc=2, adj=1, columnOffset=[(1, "left", edge), (2, "right", edge)],
                               columnSpacing=(2, 3),
                               parent=windowed)
add_btn = cmds.button(l="Add more buttons", c=addButtons, p=layout2)
remove_btn = cmds.button(l="Remove buttons", c=removeButtons, p=layout2)
# change parent to the top level layout of the window
cmds.setParent('|')

layout1 = cmds.columnLayout(adj=1, columnOffset=("both", edge), rs=5, parent=windowed)
cmds.button(l="Add Layout", c=addLayout, p=layout1)
cmds.button(l="Set parent Layout", c=setParentLayout, p=layout1)
# change parent to the top level layout of the window
cmds.setParent('|')


text:
Q: Haskell : unexpected ´;' possibly due to bad layout I have to write an easy program telling me, how many solutions has a quadratic equation. I wrote:
howManySolutions :: Float -> Float -> Float -> Int

howManySolutions a b c = if (b^2-(4*a*c)) > 0 then 2 else
                         if (b^2-(4*a*c)) == 0 then 1
                         else -1

but in WinHugs I get syntax error:
  unexpected ´;' possibly due to bad layout

I can open my program in GHCi, but it doesn't let me use negative numbers... What am i doing wrong?

A: I'm not sure about the winhugs problem, but I can help you with the ghci one.
First of all, a bit of indentation:
howManySolutions a b c = if (b^2-(4*a*c)) > 0
                         then 2
                         else
                           if (b^2-(4*a*c)) == 0
                           then 1
                           else -1

Now, if you try entering howManySolutions -1 2 3 into ghci, you get No instance for (Num (Float -> Float -> Float -> Int)) arising from a use of '-'. Basically it's interpreting '-' as a function to apply to 1 2 and 3 instead of just applying it to the '1'.
All you need to do is enter it as howManySolutions (-1) 2 3.
Now, if I can give you a tip, the way that patterns like this are usually handled are like so:
howManySolutions a b c
  | delta > 0 = 2
  | delta == 0 = 1
  | otherwise = -1
  where delta = b^2-4*a*c

the '|' symbols (guards) act as different 'ifs', and the 'where' clause at the bottom let you define delta once to reuse multiple times in the guards. It's prettier :D

A: just use the right indentation
howManySolutions a b c = if (b^2-(4*a*c)) > 0
                            then 2
                            else if (b^2-(4*a*c)) == 0
                                    then 1
                                    else (-1)

a more idiomatic solution would be
sol a b c | d >  0 = 2
          | d <  0 = 0
          | d == 0 = 1
          where d = b^2-(4*a*c)

A: Using -1 is a bad idea for Haskell.  You could use Maybe a instead, like:
howManySolutions :: Float -> Float -> Float -> Maybe Int
howManySolutions a b c = let delta = b^2-(4*a*c) in
             if delta > 0
             then Just 2
             else if delta == 0
                  then Just 1
                  else Nothing


text:
Q: ADB in android studio I'm learning to use Android Studio. I've downloaded Android Studio Canary 4.1 from developer.android.com. When I started to run a template, I got this error (shown in pictures below).
I hope someone can help me with this.

And this was shown in Help | Show log
Consult IDE log for more details (Help | Show Log) (1 m 0 s 845 ms)
2020-04-23 07:36:09,826 [ 240277]   INFO - roid.tools.ndk.GradleWorkspace - Updating model took 0.04s
2020-04-23 07:36:09,882 [ 240333]   INFO - .deployment.AsyncDevicesGetter - adb not found
2020-04-23 07:36:10,121 [ 240572]   WARN - openapi.vfs.newvfs.VfsImplUtil - LocalFileSystem failed to extract root path '' from '//help.gradle.org' (original '//help.gradle.org')
2020-04-23 07:36:10,214 [ 240665]   INFO - ge.ExternalProjectsDataStorage - Save external projects data in 47 ms
2020-04-23 07:36:10,229 [ 240680]   WARN - com.intellij.util.xmlb.Binding - no accessors for class org.jetbrains.kotlin.idea.scripting.gradle.GradleScriptInputsWatcher$Storage
2020-04-23 07:36:10,238 [ 240689]   WARN - com.intellij.util.xmlb.Binding - no accessors for class org.jetbrains.kotlin.idea.core.script.configuration.utils.ScriptClassRootsStorage
2020-04-23 07:36:10,261 [ 240712]   INFO - rationStore.ComponentStoreImpl - Saving Project (name=My Application, containerState=ACTIVE, componentStore=C:\Users\ASUS\AndroidStudioProjects\MyApplication) XDebuggerManager took 12 ms
2020-04-23 07:36:10,384 [ 240835]   INFO - .deployment.AsyncDevicesGetter - adb not found
2020-04-23 07:36:11,391 [ 241842]   INFO - .deployment.AsyncDevicesGetter - adb not found
2020-04-23 07:36:11,892 [ 242343]   INFO - .deployment.AsyncDevicesGetter - adb not found
2020-04-23 07:36:12,392 [ 242843]   INFO - .deployment.AsyncDevicesGetter - adb not found
2020-04-23 07:36:12,899 [ 243350]   INFO - .deployment.AsyncDevicesGetter - adb not found
2020-04-23 07:36:13,403 [ 243854]   INFO - .deployment.AsyncDevicesGetter - adb not found

A: First you shout sync successfully , in case you can`t sync successfully?
Follow this steps,

*

*Download latest version of gradle  .

*gradle download link

*After downloading it extract new folder.

*Then open android studio. Go to file->settings->Build,Execution,Deployment->Gradle.

*Then choose Use local gradle distribution and in the Gradle home give path of the folder where we have extracted file.

*Finally restart your android studio.
Otherwise it will be occur from offline work in Global Gradle Settings , if its checked please UnCheck it. Have a nice day.


text:
Q: Jetpack Compose lazycolumn performance I'm new to jetpack compose and learning it from code of JetpackCompose Basics
so I have found in the create a performant lazy list

Note: LazyColumn doesn't recycle its children like RecyclerView. It
emits new Composables as you scroll through it and is still
performant, as emitting Composables is relatively cheap compared to
instantiating Android Views.

so how emitting new composable is cheap and performant, and then why not to just using column and compose the whole list for one time instead of keep emitting composable items while scrolling even if the emitting composables is only the items visible by layout
Update : if the visible items is 10, so before user scroll the items from 0 to 9 is visible and has been rendered, now the user has scrolled up and the visible items from 5 to 14, is jetpack compose removed the 5 items that have been previously rendered and if user scroll down, they will be recomposed or  jetpack compose keep all rendered views in memory no matter if it visible or not

A: Because there's a limit to the definition of "cheap", but no limit to how big a list can be.  It may be cheap to output 100-200 composables (which I'm not convinced of, but lets say so for the sake of argument).  It isn't cheap to output 10K of them.  Which a list of results backed by a DB could easily be.
So you still don't want to output everything all time time.  But it may be relatively cheap to output everything a user would reasonably scroll to, because nobody goes to the end of a 10K list.  Thus making it a reasonable compromise based on common user behavior.  You'd lose performance as they scroll further down the page, but the percentage of users who do that is small enough you may not care.


text:
Q: When decomposing a large function, how can I avoid the complexity from the extra subfunctions? Say I have a large function like the following:
function do_lots_of_stuff(){

    { //subpart 1
      ...
    }

    ...

    { //subpart N
      ...
    }
}

a common pattern is to decompose it into subfunctions
function do_lots_of_stuff(){
    subpart_1(...)
    subpart_2(...)
    ...
    subpart_N(...)
}

I usually find that decomposition has two main advantages:

*

*The decomposed function becomes much smaller. This can help people read it without getting lost in the details.

*Parameters have to be explicitly passed to the underlying subfunctions, instead of being implicitly available by just being in scope. This can help readability and modularity in some situations.

However, I also find that decomposition has some disadvantages:

*

*There are no guarantees that the subfunctions "belong" to do_lots_of_stuff so there is nothing stopping someone from accidentally calling them from a wrong place.

*A module's complexity grows quadratically with the number of functions we add to it. (There are more possible ways for things to call each other)

Therefore:
Are there useful convention or coding styles that help me balance the pros and cons of function decomposition or should I just use an editor with code folding and call it a day?

EDIT: This problem also applies to functional code (although in a less pressing manner). For example, in a functional setting we would have the subparts be returning values that are combined in the end and the decomposition problem of having lots of subfunctions being able to use each other is still present.
We can't always assume that the problem domain will be able to be modeled on just some small simple types with just a few highly orthogonal functions. There will always be complicated algorithms or long lists of business rules that we still want to correctly be able to deal with.
function do_lots_of_stuff(){
   p1 = subpart_1()
   p2 = subpart_2()
   pN = subpart_N()
   return assembleStuff(p1, p2, ..., pN)
}

A: Just because your functions can call each other a variety of ways doesn't mean they do. Your program's complexity isn't suddenly quadratic because you've named the blocks of code you ran before...
All of the other advice is good, but missing a key issue: you have a function doing a lot of stuff. Breaking that function into a series of function calls doesn't make it do less stuff, it just pushes the stuff around. Having a function that does too much is a sign that you have poorly abstracted your problem. Fix your abstraction so that the functionality is a better mapping to what you need to do and the function will naturally be less complex.

A: Keep each function as simple as possible.
Think of it in simple terms, the way a function is meant to be:

*

*gets 0 to N inputs,

*returns 0 or 1 result (possible a composite or collection),

*and isn't tied to state.

When you stick to functional programming idioms, you get rid of most of these questions you're asking yourself. Sure, your class will get bigger in terms of number of functions. But if the methods are not tied to each by internal state changes, they get easier to understand, manage and compose to achieve an end result.

Also, try to give them appropriate accesses based on the above design decisions. Helpers will commonly easily be declared as statics (and if they don't seem to need to be private or can be reused, they could extracted to an helper class), which gives a strong hint to the other developers: this thing is meant to be independent and side-effect free.
Repeat the following mantras to aim for purity:

*

*My function shall be:

*

*short,

*side-effects free,

*realizing one and one function only.

*My function shall be strict on output. [1]

*My function shall be testable, and tested.

*My function shall be readable and read like a natural language expression.

*My function shall be documented. [2]

*My function shall be null-hostile.

[1] Whether it shall be strict or lenient on input depends on whether it's consumer code or library code.

[2] Self-documentation counts, comments for tricky parts count as well.

Of course, if you are in a generally non-FP-oriented code base, you won't manage to avoid shared mutable state for ever, but it's a very good, sensitive and no-BS guideline to follow. Even if you do get it wrong by over-modularizing and complexifying your class, it'll still be easier to pick up from there and refactor again than from a giant dump of code with high complexity and tight coupling.
Regarding the rules of the compositionality of your functions, these are your business rules. They are dictated by what you want to achieve, there's no automagical way of determining it for you.

A: I would suggest moving to a more functional programming style. The fact that you are talking about "calling in the wrong order" and showing functions that don't return data, this means that you are working with very impure functions.
The better approach is to work with pure functions:
1) Reject global state variables. They are bad. Enough said.
2) Every function should take arguments and return something.
3) Given the same arguments functions should output the same data.
When you follow these goals you will find that your code becomes much cleaner, functions can call other functions without fear of side-effects because functions are not allowed to mess with global state.
Now, in a web/gui app, you will have to modify global state at some point, in that case you can break the above rules in small fringe cases.
At this point, decomposing functions is extremely simple. You simply start taking logical parts in the code and breaking them into functions. When you find duplicated code, merge the functions into a single function. If you find yourself writing the same code over and over, then find a way to write that as a single function.
For instance, in a pseudo language, a for loop could be re-written as a map. So instead of this:
arr = [1, 2, 3, 4, 5]

for (x = 0; x < arr.length; x ++)
{
   arr[x] += 1
}

You could write a map function once:
function map(func, arr)
{
   out = []
   for (x = 0; x < arr.length; x ++)
   {
     out.add(func(arr[x]))
   }
   return out;
}

And in the future, instead of a for loop, you simply write:
function inc (x) { return x + 1; }

map(inc, [1 2 3 4])

So instead of a single-use-case imperative for-loop. Now you have 2 functions that you can reuse in thousands of places in your program.
Resources:
http://skilldrick.co.uk/2011/07/easy-functional-programming-in-javascript-with-underscore-js-part-1/
http://www.ibm.com/developerworks/library/wa-javascript/index.html
EDIT:
Update to address the OP's edits:
In your example, I suggest using maps in a situation like this. So in your example:
function foo(arg)
{
    data = {"p1": func1(arg),
            "p2": func2(arg),
            "pN": funcN(arg)}
    return assemble(data);
}

So in general, try to start with a empty hash map, and build out the structure by applying small functions to it until you build out your entire data set.
Or in a much cleaner way:
function reduce(fn, data, init)
{
   for (x = 0; x < data.length; x ++ 1)
       init = fn(init, data[x])
   return init
}

Then simply:
function foo(arg)
{
    fns = [p1, p2, pN]
    data = reduce((l, f) -> f(l), fns, {})
    reduce assembleData(data)
}

Using reduce you can also implement business rules with ease. Focus around data, and functional programming and you'll start to see how simple these things can really be.
Every day I spend close to 10 hours programming in both C# and Clojure, so I've seen both extremes and the functional approach simplifies things dramatically.
Perhaps a full real-world example would be in order?

A: More dynamic languages like javascript and python have the ability to declare functions inside of functions
function a(param1, param2) {
  function helperFunc1() {
    return param1 % param2 * param2
  }
  function helperFunc2(param3) {
    return (param1 - param2) * param3
  }
  return helperFunc1() + helperFunc2(2) - helperFunc2(1.5)
}

These internal functions should have access to all vars inside the main function while hiding them from the outside, like a class would.

A: I would suggest that the OP look at refactoring the problem and solution before starting to code.  If something is so complex that you start to worry about these issues, then you really need to jump outside of the box and look at the problem from a different angle.
Just for fun, Maybe you can create a DSL to solve your problem ^^


text:
Q: Migration messages and audience strings of Stack Overflow and Programmer.SE I've just noticed the similarity in the Audience strings of Stack Overflow and Programmers.
It was particularly apparent when a question had been migrated from Stack Overflow, and the following was displayed below the question:

This question came from our site for professional and enthusiast programmers.

To my mind, given that we now have Programmers as well, this string is no longer the best description for uniquely identifying the audience of Stack Overflow. The converse description is displayed when a question is migrated from Programmers:

This question came from our site for expert programmers interested in professional discussions on software development.

Whilst I think this describes perfectly what Programmers is about
and how it is different to Stack Overflow, I think the first message, particularly when viewed on Programmers, doesn't do enough to show the differences between Stack Overflow and Programmers.
Now that we have both Programmers and Stack Overflow, does that audience string need re-wording to show that Stack Overflow is a site for questions related to programs, whereas Programmers is for questions related to the programmer, and if so, does anyone have any suggestions? I'd suggest something like

This question came from our site for expert programmers wishing to ask technical questions

A: The two messages come automatically from each site's taglines. I'm not sure what we could do to differentiate between then, since they are both sites for programmers, just with a different scope.
I don't have any suggestions at the moment, but I do think this post may be best asked on Meta.SO, but it will get seen by the dev team here too, and we might see if they're open to a change like that or not in the first place.

I don't think the taglines need changing. StackOverflow's tagline is still accurate and trying to quantify everything it's about in a short sentence would be, in my mind, difficult.

A: I certainly consider this a confusion that should be fixed. I think that the way StackOverflow's tagline is currently worded, it seems to include all of the questions that are on-topic for Programmers SE, but off topic for StackOverflow. I think that the tagline should focus on the content, rather than the audience.
I suggest the following reformulation for StackOverflow:

This question came from our site for asking technical programming questions.

"Technical" rules out subjective workflow style questions that are better on Programmers SE, and "programming" rules out system administration questions that are better on SuperUser.
Programmers SE looks mostly fine to my eye, but if you wanted to improve it, you might say

This question came from our site for questions about the interpersonal aspects of software development.


text:
Q: Async Task<> function's Result just block the program on running So, I am trying to get my data from User table on Firebase and after I return and try to set the result to a Label the screen just go full white (I am using xamarin for android if it matter) and nothing happen. Maybe I do something wrong or I missed something, I am also kinda blurred on how task work. I anyone have any idea please fell free to give me any directions or any other alternatives. This is the code I used
.Thank you
UserDetailsRetrive.cs
public async Task<UserDetails> getUserInfoDetails()
        {
            FirebaseClient client = new FirebaseClient("https://xyz.firebaseio.com/");
            return (UserDetails)(await client.Child("user").OnceAsync<UserDetails>()).Select(item => new UserDetails
            {
                first_name = item.Object.first_name,
                last_name = item.Object.last_name,
                username = item.Object.username,
                birthdate = item.Object.birthdate,
                newsletter = item.Object.newsletter,
                term_condition = item.Object.term_condition
            });

Profile.cs
 public void setUserInfo()
        {

            UserDetailsRetreive usr = new UserDetailsRetreive();
            UserDetails userDetails = usr.getUserInfoDetails().Result;
            username.Text = userDetails.username.ToString();

        }

UserDetails.cs
class UserDetails
    {
        public string first_name { get; set; }
        public string last_name { get; set; }
        public string username { get; set; }
        public string birthdate { get; set; }
        public bool newsletter { get; set; }
        public bool term_condition { get; set; }

    }

A: Task.Result would block until Task is completed, which why you experience freezing of UI. For solving this, you need to call usr.getUserInfoDetails asynchronously
public async Task setUserInfo()
{
    UserDetailsRetreive usr = new UserDetailsRetreive();
    UserDetails userDetails = await usr.getUserInfoDetails();
    username.Text = userDetails.username.ToString();
}


text:
Q: Improvement upon a for-loop: create a series of subsets without looping My objective is to create a number of time-series subsets from a list of variables. I wrote this with a for-loop. However, I'm looking for more elegant ideas on how to do with an existir R function, that doesn't require a loop.
All ideas and intros to new functions in R are much appreciated.
A reproducible example of the code:
russell_sim <- arima.sim(model=list(ar=c(.9,-.2)),n=449)
russell_sim <- ts(russell_sim, start = c(1980,1), end = c(2017,5) ,frequency = 12)

pmi_sim <- arima.sim(model=list(ar=c(.9,-.2)),n=449)
pmi_sim <- ts(russell_sim, start = c(1980,1), end = c(2017,5) ,frequency = 12)

big_list<- list(russell = russell_sim, pmi= pmi_sim)

for (i in 1: length(big_list)) {
  assign(paste(names(x = big_list)[i], "_before08", sep = ""), window(big_list[[i]], start=c(1981,1), end=c(2007, 12))  )
}

Thank you.

A: You can make use of the handy list2env function but you will need to edit the list first to get your desired output:
# New List to edit
big_list_before08 <- big_list
# change your observations
big_list_before08 <- lapply(big_list_before08, function(x) window(x, start = c(1981,1),
                                                                     end = c(2007,12)))
# change the individual list element names
names(big_list_before08) <- paste0(names(big_list),"_before08")

# save to the global environment
list2env(big_list_before08, envir = .GlobalEnv)

Let me know if you have any questions!


text:
Q: ERROR running force:org:create: We don't recognize this namespace: x. Did you register it in your Dev Hub org? I am trying to create a Scratch Org with a Namespace using command:
sfdx force:org:create -s -f config/project-scratch-def.json -a my-namespace -d 30

But I get this error:

ERROR running force:org:create: We don't recognize this namespace: my-namespace. Did you register it in your Dev Hub org?

I realise what the error message is telling me...
I need to create the Namespace.
I want to double-check my understanding of the solution is correct.
Currently, creating a Namespace is only possible via a traditional Developer Org rather than a Scratch Org or just via the Namespace Registries page in my Dev Hub Org
Therefore, there is no way to develop a 2PG Managed Package without first using an old school Developer Org to create the Namespace?

A: The documentation specifically says:

Sign up for a new Developer Edition org

I.e. you are right; you must have an org on which the namespace is defined and the (recommended) way of doing that is to use a new Developer Edition org, then to link that namespace to your dev hub.
For us we use a specific pattern for the org name to ensure they are listed in our PBO's Environment Hub together.


text:
Q: How can I put borders to my BottomNavigationBarItem elements? I am trying to have something like this.

But I don't know how to do it, I can't find any option related to the styles container of each tab.
    bottomNavigationBar:
        new BottomNavigationBar(items: <BottomNavigationBarItem>[
      new BottomNavigationBarItem(
        icon: new Icon(Icons.home),
        title: new Text("Left"),
      ),
      new BottomNavigationBarItem(
        icon: new Icon(Icons.search),
        title: new Text("Right"),
      ),
    ]),

A: You can try this way
  bottomNavigationBar: Container(
    height: 60,
    child: Row(
      mainAxisAlignment: MainAxisAlignment.center,
      children: <Widget>[
        Expanded(child: IconButton(icon: Icon(Icons.home), onPressed: () {})),
        VerticalDivider(
          color: Colors.green,
        ),
        Expanded(child: IconButton(icon: Icon(Icons.home), onPressed: () {}))
      ],
    ),
  ),

OUTPUT

Another example same your requirement
  bottomNavigationBar: Container(
    height: 60,
    child: Row(
      mainAxisAlignment: MainAxisAlignment.center,
      crossAxisAlignment: CrossAxisAlignment.center,
      children: <Widget>[
        Expanded(child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          crossAxisAlignment: CrossAxisAlignment.center,
          children: <Widget>[
            Icon(Icons.home),
            Text("Left")
          ],
        )),
        VerticalDivider(
          color: Colors.green,
        ),
        Expanded(child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          crossAxisAlignment: CrossAxisAlignment.center,
          children: <Widget>[
            Icon(Icons.home),
            Text("Right")
          ],
        )),
      ],
    ),
  ),

OUTPUT

Please find Sample code with click effects
import 'package:flutter/material.dart';

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
  static const String _title = 'Flutter Code Sample';

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: _title,
      debugShowCheckedModeBanner: false,
      home: HomeWidget(),
    );
  }
}

class HomeWidget extends StatefulWidget {
  HomeWidget({Key key}) : super(key: key);

  @override
  _HomeWidgetState createState() => _HomeWidgetState();
}

class _HomeWidgetState extends State<HomeWidget> {
  int _selectedIndex = 0;

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text('AskNilesh'),
        centerTitle: false,
      ),
      bottomNavigationBar: Container(
        height: 60,
        child: Row(
          mainAxisAlignment: MainAxisAlignment.center,
          crossAxisAlignment: CrossAxisAlignment.center,
          children: <Widget>[
            Expanded(
                child: InkWell(
              onTap: () {
                setState(() {
                  _selectedIndex = 0;
                });
              },
              child: Column(
                mainAxisAlignment: MainAxisAlignment.center,
                crossAxisAlignment: CrossAxisAlignment.center,
                children: <Widget>[
                  Icon(
                    Icons.home,
                    color: _selectedIndex == 0 ? Colors.red : Colors.grey,
                  ),
                  Text(
                    "Left",
                    style: TextStyle(color: _selectedIndex == 0 ? Colors.red : Colors.grey),
                  )
                ],
              ),
            )),
            VerticalDivider(
              color: Colors.green,
            ),
            Expanded(
                child: InkWell(
              onTap: () {
                setState(() {
                  _selectedIndex = 1;
                });
              },
              child: Column(
                mainAxisAlignment: MainAxisAlignment.center,
                crossAxisAlignment: CrossAxisAlignment.center,
                children: <Widget>[
                  Icon(
                    Icons.search,
                    color: _selectedIndex == 1 ? Colors.red : Colors.grey,
                  ),
                  Text(
                    "Right",
                    style: TextStyle(color: _selectedIndex == 1 ? Colors.red : Colors.grey),
                  )
                ],
              ),
            )),
          ],
        ),
      ),
      body: Container(
        child: SafeArea(
            child: Center(
          child: Text('Current Page $_selectedIndex'),
        )),
      ),
    );
  }
}

OUTPUT
You can check here on Dartpad  BottomNavigationBarItem with borders

A: Create a CustomPaint wrapper your BottomNavigationBar
Define CustomPainterBottomBar extends from CustomPainter and set into foregroundPainter of CustomPaint
sample:
  bottomNavigationBar: CustomPaint(
    child: BottomNavigationBar(
        items: [
          BottomNavigationBarItem(
            icon: new Icon(Icons.home),
            title: new Text("Left"),
          ),
          BottomNavigationBarItem(
            icon: new Icon(Icons.home),
            title: new Text("Left"),
          )
        ]
    ),
    foregroundPainter: CustomPainterBottomBar(),
  )

custom_painter_bottombar.dart
class CustomPainterBottomBar extends CustomPainter {
  static const TAG = 'CustomPainterBottombar';

  Paint paintLine = Paint()..color = Colors.green;

  @override
  void paint(Canvas canvas, Size size) {
    canvas.drawLine(Offset(size.width/2, 0), Offset(size.width/2, size.height), paintLine);
  }

  @override
  bool shouldRepaint(CustomPainter oldDelegate) {
    return true;
  }
}

A: Hello you can try this way, maybe can help you solve the problem, you still can have the effect of the ripple which you want from the navigationBar:
import 'package:flutter/material.dart';

class FieldBottomNavigation extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Container(
        color: Colors.white,
        height: 50,
        child: Center(
          child: Row(
              mainAxisAlignment: MainAxisAlignment.center,
              crossAxisAlignment: CrossAxisAlignment.center,
              children: <Widget>[
                _IconButton(
                    iconData: Icons.home, iconTitle: 'Left', isLeft: true),
                _IconButton(iconData: Icons.search, iconTitle: 'Right')
              ]),
        ));
  }
}

class _IconButton extends StatelessWidget {
  const _IconButton({this.iconTitle, this.iconData, this.isLeft = false});

  final String iconTitle;
  final IconData iconData;
  final bool isLeft;

  @override
  Widget build(BuildContext context) {
    return Expanded(
        child: Container(
      decoration: BoxDecoration(
          border: isLeft
              ? Border(right: BorderSide(color: Colors.green, width: 1))
              : null),
      child: Material(
          color: Colors.transparent,
          child: InkWell(
            onTap: () {},
            child: Column(
                mainAxisAlignment: MainAxisAlignment.center,
                crossAxisAlignment: CrossAxisAlignment.center,
                children: <Widget>[
                  Icon(iconData, color: Colors.black, size: 24),
                  Text(iconTitle)
                ]),
          )),
    ));
  }
}


text:
Q: how to use highstock in ecmascript? here are an example of code that work, I create a graph
import $ from 'jquery';
import Highcharts from 'highcharts';

class test {
    constructor(){
        let chart = new Highcharts.chart('container', {
            chart: {
                animation: false
            },

            xAxis: {
                categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
            },

            series: [{
                data: [29.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4]
            }]

        });
    }
}

now I want do a stockChart like https://jsfiddle.net/74vn5utd/
but I import it and its module
import StockChart from 'highcharts/highstock';
import datahc from 'highcharts/modules/data';

after that I load the module
datahc(StockChart);

and finally I call the chart and
StockChart.chart('container', {

    rangeSelector: {
        selected: 1
    },

    title: {
        text: 'AAPL Stock Price'
    },

    series: [{
        name: 'AAPL',
        data: response.graph,
        tooltip: {
           valueDecimals: 2
        }
    }]
});

I have a regular graph, not a HighStock graph, I don't get it, what is wrong?

thanks in advance

A: You still use the chart constructor which creates regular chart.
Try to use StockChart.stockChart('container, {...}), where stockChart is a Highstock constructor.
Demo: https://jsfiddle.net/BlackLabel/v4qbyka6/
  Highcharts.stockChart('container', {

    series: [{
        data: data
    }]
  });


text:
Q: Symfony5 cannot deploy code to the server, permission issue I am attempting to deploy my Symfony production code to an Ubuntu server.
I have everything set up and I can deploy fine if I set the permissions to the web folder to 777, but if I try to set it to 755, git cannot write to the folder.
I have done the following:
 sudo chown -R www-data:www-data /var/www/website/
 sudo chmod -R 755 /var/www/website/

But I get a failed to write files notice from git.
Now if I change the permissions to 777, it works fine.
If I ls -la, this is what I get:
 drwxr-xr-x 13 www-data www-data 4096 Dec 17 19:19 website

What am I missing here?

A: You'll either need to make your user a member of the www-data group.
$ usermod -a -G $USER www-data

or run git as the www-data user.
$ sudo -u www-data git ...


text:
Q: R - transform column type where column name is variable pretty simple question, but I can't find an answer.
Suppose I want to transform data frame column type from string to double, but column name is unknown at compile time, so I can't write like:
train <- transform(train, columnName = as.double(columnName))

but if I write smth like this
varKnownAtRuntime <- "columnName"
train <- transform(train, varKnownAtRuntime = as.double(varKnownAtRuntime))

It just appends column "varKnownAtRuntime" to my data frame, while I want to change type of train$columnName

A: transform is a non-standard-evaluating shortcut function. If you want to use column names stored in variables you'll need to use standard evaluation functions like [.
varKnownAtRuntime <- "columnName"
train[, varKnownAtRuntime] = as.double(train[, varKnownAtRuntime])


text:
Q: JSP - Basic example of Apache FileUpload I'm looking for a very basic example of the use of Apache FileUploader - one that actually has explanation of the components. All I can find on Google just seems to dive right into the code without any understanding imparted.
The libraries are installed and I've had a shot at it, but I just don't understand the code and I hate being a copy-coder.
The use is for a single file upload, from an HTML form. Multiple files are not needed (which most tutorials also focus on).
Any help or links would be useful, thanks.

A: http://www.tutorialspoint.com/jsp/jsp_file_uploading.htm has necessary comments and explanation for the file upload.
You can also see How to upload files to server using JSP/Servlet?

A:   <form name="form1" action="forward.jsp" method="post" >
      File Upload:<input type="file" name="upload" size="100"/>
                  <input type="submit" value="submit" size="100"/>

   </form>

In forward.jsp
out.println(request.getparameter(upload));//returns filename only rather than whole path


text:
Q: Angular.module minification bug Having the darnedest time trying to figure out why minification is not working.
I have injected via an array object my providers prior the function per numerous suggestions across the web and yet still "Unknown provider: aProvider <- a"
Regular:
var app = angular.module('bpwApp', ['ui.bootstrap', 'ui', 'myTabs'])
    .config(['$routeProvider', '$locationProvider', function($routeProvider, $locationProvider){
    $routeProvider.
        when('/', {templateUrl: 'partials/home.jade', controller: HomeCtrl});

    $locationProvider.html5Mode(true);
    }])

Minified:
var app = angular.module('bpwApp', ['ui.bootstrap', 'ui', 'myTabs'])
    .config(['$routeProvider', '$locationProvider', function(a, b){
    a.
        when('/', {templateUrl: 'partials/home.jade', controller: HomeCtrl});

    b.html5Mode(true);
    }])

Any suggestion would be much obliged!

A: I had a similar issue using grunt, ngmin and uglify.
I ran the process in this order: concat, ngmin, uglify
I was continuing to get the $injector error from angular until I added in the uglify options mangle: false - then everything was fixed.
I also tried to add the exceptions to uglify like this:
 options: {
  mangle: {
     except: ['jQuery', 'angular']
  }
}

But to no avail...
Here is my gruntFile.js for further clarification:
module.exports = function(grunt) {
'use strict';
// Configuration goes here
grunt.initConfig({
    pkg: require('./package.json'),

    watch: {
        files: ['scripts/**/*.js', 'test/**/*spec.js', 'GruntFile.js'],
        tasks: ['test', 'ngmin']
    },

    jasmine : {
        // Your project's source files
        src : ['bower_components/angular/angular.js', 'bower_components/angular-mocks/angular-mocks.js', 'scripts/app.js', 'scripts/**/*.js' ],
        // Your Jasmine spec files

        options : {
            specs : 'test/**/*spec.js',
            helpers: 'test/lib/*.js'
        }
    },

    concat: {
      dist : {
          src: ['scripts/app.js', 'scripts/**/*.js'],
          dest: 'production/js/concat.js'
      }
    },

    ngmin: {
        angular: {
            src : ['production/js/concat.js'],
            dest : 'production/js/ngmin.js'
        }

    },

    uglify : {
        options: {
            report: 'min',
            mangle: false
        },
        my_target : {
            files : {
                'production/app/app.min.js' : ['production/js/ngmin.js']
            }
        }
    },

  docular : {
      groups: [],
      showDocularDocs: false,
      showAngularDocs: false
  }

});

// Load plugins here
grunt.loadNpmTasks('grunt-ngmin');
grunt.loadNpmTasks('grunt-docular');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-jasmine');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-connect');

// Define your tasks here
grunt.registerTask('test', ['jasmine']);
grunt.registerTask('build', ['concat', 'ngmin', 'uglify']);
grunt.registerTask('default', ['test', 'build', 'watch']);

};

A: Problem
From AngularJS: The Bad Parts:

Angular has a built in dependency injector that will pass appropriate
  objects to your function based on the names of its parameters:
function MyController($scope, $window) {
    // ...
}

Here, the names of the parameters $scope and $window will be
  matched against a list of known names, and corresponding objects get
  instantiated and passed to the function. Angular gets the parameter
  names by calling toString() on the function, and then parsing the
  function definition.
The problem with this, of course, is that it stops working the
  moment you minify your code. Since you care about user experience
  you will be minifying your code, thus using this DI mechanism will
  break your app. In fact, a common development methodology is to use
  unminified code in development to ease debugging, and then to minify
  the code when pushing to production or staging. In that case, this
  problem won't rear its ugly head until you're at the point where it
  hurts the most.
(...)
Since this dependency injection mechanism doesn't actually work in the
  general case, Angular also provides a mechanism that does. To be sure,
  it provides two. You can either pass along an array like so:
module.controller('MyController', ['$scope', '$window', MyController]);

Or you can set the $inject property on your constructor:
MyController.$inject = ['$scope', '$window'];

Solution
You can use ng-annotate for auto adding annotations required for minifying:

ng-annotate adds and removes AngularJS dependency injection
  annotations. It is non-intrusive so your source code stays exactly the
  same otherwise. No lost comments or moved lines.

ng-annotate is faster and stabler than ngmin (which is now deprecated) and it has plugins for many tools:

*

*grunt-ng-annotate

*gulp-ng-annotate

*browserify-annotate

Starting from AngularJS 1.3 there's also a new param in ngApp called ngStrictDi:

if this attribute is present on the app element, the injector will be
  created in "strict-di" mode. This means that the application will fail
  to invoke functions which do not use explicit function annotation (and
  are thus unsuitable for minification), as described in the Dependency
  Injection guide, and useful debugging info will assist in tracking
  down the root of these bugs.

A: AndrewM96 suggestion of ng-min is right.
The alignment and white space matters to Uglify as well as Angular.

A: I had a similar problem. And solved it the following way. We need to run a Gulp module called gulp-ng-annotate before we run uglify.
So we install that module
npm install gulp-ng-annotate --save-dev

Then do the require in Gulpfile.js
ngannotate = require('gulp-ng-annotate')

And in your usemin task do something like this
js: [ngannotate(), uglify(),rev()]

That solved it for me.
[EDIT: Fixed typos]

A: I got same error. However, for me, the problem is directives' controller declaration. You should do this instead.
myModule.directive('directiveName', function factory(injectables) {
    var directiveDefinitionObject = {
      templateUrl: 'directive.html',
      replace: false,
      restrict: 'A',
      controller: ["$scope", "$element", "$attrs", "$transclude", "otherInjectables",
        function($scope, $element, $attrs, $transclude, otherInjectables) { ... }]
    };
    return directiveDefinitionObject;
  });

https://github.com/angular/angular.js/pull/3125

A: Uglify has an option to disable mangling on specific files:
options: {
  mangle: {
     except: ['jQuery', 'angular']
  }
}

https://github.com/gruntjs/grunt-contrib-uglify#reserved-identifiers

A: This is very difficult to debug because a lot of services are named the same (mostly e or a). This will not solve the error, but will provide you with the name of the unresolved service which enables you to track down, in the uglified output, the location in the code and finally enables you to solve the issue:
Go into lib/scope.jsof Uglify2 (node_modules/grunt-contrib-uglify/node_modules/uglify-js/lib/scope.js) and replace the line
this.mangled_name = this.scope.next_mangled(options);

with
this.mangled_name = this.name + "__debugging_" + counter++

A: I ran into this problem before with Grunt.js Uglify plugin.
One of the options are mangle
uglify: {
  options: {
    mangle: false
  },

Which I believe runs regex functions on "like strings" and minifys them.
For example:
angular.module("imgur", ["imgur.global","imgur.album"]);

Would become:
angular.module("a", ["a.global","a.album"]);

Disable it --- this feature doesn't play nice with Angular.
Edit:
To be more precise as @JoshDavidMiller explains:
Uglify mangle only mangles like variables, which is what actually causes the AngularJS problem. That is, the problem is in injection and not definition.
function MyCtrl($scope, myService) would get mangled to function MyCtrl(a, b), but the service definition inside of a string should never get altered.

*

*Running ng-min before running uglify solves this problem.


text:
Q: Graph theory - torus proof Let $G = (V, E)$ be a simple graph that can be embedded on a torus so that every region is bordered by exactly $3$ edges. Find (with a proof) all the possible values for the quantity
$|V | − |E| + r$,
where $r$ is the number of regions that the graph $G$ can split the torus.
So the torus will be covered in $C_3$'s connected to each other. I'm not really sure what to do with that information. Any help/hints will be appreciated.

A: A triangulated graph on a plane is maximal planar i.e. we cannot add a new edge without introducing an edge crossing. It is easy to see how on a plane a triangulated graph is maximal planar. By extending the similar logic, or you prove rigorously that a triangulated graph on a torus is also maximal (or maximal torus), i.e., you cannot add an edge without introducing an edge crossing.
Now a maximal torus graph is either maximal planar or non planar. If it is maximal planar, $\gamma(G)=0$ and if it is non-planar (and we know it can be embedded on a torus), $\gamma(G)=1$. Hence, the value of $|V|-|E|+r$ is either 2 or 0.


text:
Q: how can i submit form data and file using fetch in react? At first, the task was set to send data from the form. The problem was solved in the following way:
export let useRequest = () => {
  let request = async (url, method = "Post", body = null, headers = {}) => {
    try {
      if (body) {
        body = JSON.stringify(body);
        headers["Content-Type"] = "application/json";
      }

      let res = await fetch(url, { method, body, headers });
      let data = await res.json();
      return data;
    } catch (e) {
      throw e;
    }
  };

form:
 <form>
   <input name="name" class="help-input" placeholder="name" type="text" value=""/>
   <input name="email" class="help-input" placeholder="email" type="text" value=""/>
   <textarea name="message" class="help-input"placeholder="message"></textarea>
   <input name="file" type="file" value="">
   <input name="agree" type="checkbox" value="" checked/>
   <button type="submit" onClick="props.send">send</button>
</form>

Form container(form wrapper):
export let HelpBlock = (props) => {
  let { request } = useRequest();
  let reqFromForm = async (values) => {
    let data = await request("/api/message", "POST", props.values);
    console.log(data.message)
  };
  return (
    <>
      <Form send={reqFromForm}></Form>
    </>
  );
};

After clicking on the button, data comes with the following structure:
{
    name:name,
    email:email,
    message:message,
    file:file
}

A: In this case I think that you can render the body according to the content type:
export let useRequest = () => {
  let request = async (url, method = "Post", body = null, headers = {}, contentType="application/json" ) => {
    try {
      if (body) {
        body = renderBodyFormat(body, contentType);
        headers["Content-Type"] = contentType;
      }

      let res = await fetch(url, { method, body, headers });
      let data = await res.json();
      return data;
    } catch (e) {
      throw e;
    }
  };
  return { request };
};

const renderBodyFormat = (data, type) => {
 const formats = {
   "application/json": ()=> JSON.stringify(body),
   "multipart/form-data": ()=> {
      const form = new FormData();
      Object.keys(data).forEach(key => form.append(key, data[key]));
      return form;
   }
 }

 return formats[type]();

}

EDIT: //using the hook:
const Component = ()=> {
 const {request} = useRequest();

 useEffect(()=> {
   const data = {
    //...other props
    file: new File(["file"], "file.txt", { type: "text/plain"});
   }

   request(url, "Post", data, {}, "multipart/form-data")
   .then(()=> {
     //...
   })
 })
}

Here you can find more info https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API/Using_Fetch


text:
Q: Incompatible types required: Object found: BarcodeGraphic I am getting the above mentioned error when I try to loop over all the graphics displayed on my camera preview in Android on the following line.
for(BarcodeGraphic graphic : mGraphicOverlay.getGraphics){
//blah blah blah
}

The BarcodeGraphic is a class that represents a graphic on a preview display and is defined as such
class BarcodeGraphic extends TrackedGraphic<Barcode>{
//all the code regarding my graphic
}

and the getGraphics is a function in the GraphicOverlay class which the above class extends to and is defined as follows.
public class GraphicOverlay<T extends GraphicOverlay.Graphic> extends View{
private List<BarcodeGraphic> mGraphics = new ArrayList<>();
public List<BarcodeGraphic> getGraphics(){
synchronized (mLock){
return mGraphics;
}
}

Update: However if I make a List within the calling class right above the offender code the error goes away.
List<BarcodeGraphic> bgraphic = new ArrayList<>();
for (BarcodeGraphic graphic : bgraphic){
//this works fine
}

But the getGraphics function basically returns a List just like this one. I am really confused now.
I believe I have included all the relevant pieces of the code but my code is based on the Google sample in case you need more clarification. Can someone point why I am getting the above error?


text:
Q: Unable to expose my Interface manual class in WCF service I have developed a WCF service, below is a sample TestCode to get the clear understand of the issue:
IService.cs:
[OperationContract]
List<TestClass> Display(string companyCode, string employeeId);

Inside this interface, I have defined TestClass:
public class TestClass
{
    public System.Guid Id {get; set;}
    public string Name { get; set; }
    public System.Nullable<System.DateTime> DateOfBirthOn { get; set; }
    public string CountryName { get; set; }
    public string LastName { get; set; }
}

Service1.svc.cs:
 public List<TestClass> Display(string companyCode, string employeeId)
 {
     try
     {
         TestClass oTestClass = null;
         oTestClass = new TestClass(companyCode);
         List<TestClass> oITestClass =  oTestClass.GetDetails("ABC", someid) as List<TestClass>
         if (oITestClass != null && oITestClass .Count > 0)
         {
             return oITestClass ;
         }
         else
         {
             return null;
             //logger.Debug("No Record Found");
         }
     }
     catch (Exception ex)
     {
         return null;
     }
     finally
     {
         // Nothing To Do
     }
 }

The problem is I get the List null on the following line
List<TestClass> oITestClass =  oTestClass.GetDetails("ABC", someid)

What am I doing wrong?
UPDATE
GetDetails method returning the Interface of TestClass so I have to cast in TestClass

A: What you're doing wrong is that you're not assigning the oTestClass variable:
TestClass oTestClass = null; // <- This _is_ null
List<TestClass> oITestClass =  oTestClass.GetDetails("ABC", someid)

How do you expect it to be anything other than null?
This is basic, basic, basic knowledge about the language. If you don't know these things, I'd suggest you stay away from WCF and do something more basic until you've learned the language.
You can start by reading about the NullReferenceException :)

A: change the return type of GetDetails to IEnumerable<> instead of List<>, it should work.
 TestClass tc = new TestClass();
 IEnumerable<ITestClass> bList = tc.GetDetails();
 IEnumerable<TestClass> dlist = bList as IEnumerable<TestClass>;

pls refer http://msdn.microsoft.com/en-us/library/dd799517(v=vs.110).aspx
btw, which version of .net you are using?


text:
Q: Issue with attempting to replace odd characters with 'é' Is there any problem with this update I am trying to run? When I run it, it says the relevant amount of rows have been updated but nothing actually changes:
BEGIN TRAN
UPDATE a
SET a.name = REPLACE(a.name, 'é', 'é')
FROM table1 a
JOIN table2 b
ON a.userID = b.userID

--ROLLBACK
--COMMIT

I am wondering if SQL Management Studio is not able to read the characters perhaps? I have seen nothing online to confirm this however.

A: SELECT REPLACE(a.name, 'é', 'é') AS name
INTO temp_new
FROM table1 a
JOIN table2 b ON a.userID = b.userID

I then just ran this update which has resolved
BEGIN TRAN
UPDATE a
SET a.name = tmp.name
FROM table1 a
JOIN temp_new tmp
ON a.userID = tmp.userID

--ROLLBACK
--COMMIT


text:
Q: Google Analytics Issue for Magento to PayPal So, having discovered that customers are not returning to our website after making their PayPal payments, our Google Analytics reports are wonky as the landing page (success.phtml) which generates the order completion history/goal is never achieved.
Is there a PayPal APi callback to Magento which can generate the correct Google Analytics data? Is there a way to generate GA code at the PayPal end?
Any pointers appreciated!
Thanks, Joe.

A: a better question for you is why are your customers not reaching the success.phtml?
Go to Website Payments under Profile on the PayPal website. Setup your return URL and enter the succes url there...
If your customers don't return because they close their browser before returning to the shop:
You could remove the script from success.phtml and add a serverside-call to GA using something like serversidegoogleanalytics but you'll have to implement this for all paymentmethods you are accepting... This serversidecall would be done in the success-action within the controller of the paypal module


text:
Q: Android for Dummies code error In Android app Development for Dummies and I am getting an error after the last bit of code.

The method setListAdapter(ArrayAdapter<String>) is undefined for the type ReminderListActivity

The code is as follows:
package com.dummies.android.taskreminder;

import android.app.Activity;
import android.os.Bundle;
import android.widget.ArrayAdapter;

public class ReminderListActivity extends Activity {
  /** Called when the activity is first created. */
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.reminder_list);

    String[] items = new String[] { "Foo", "Bar", "Fizz", "Bin"};
    ArrayAdapter<String> adapter =
      new ArrayAdapter<String>(this, R.layout.reminder_row, R.id.text1, items);
    setListAdapter(adapter);
  }
}

A: It looks to me like Activity doesn't have setListAdapter() but its subclass ListActivity does.  Maybe you want
public class ReminderListActivity extends ListActivity {

instead?  This should work fine:
package com.dummies.android.taskreminder;

import android.app.ListActivity;
import android.os.Bundle;
import android.widget.ArrayAdapter;

public class ReminderListActivity extends ListActivity {
  /** Called when the activity is first created. */
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.reminder_list);

    String[] items = new String[] { "Foo", "Bar", "Fizz", "Bin"};
    ArrayAdapter<String> adapter =
      new ArrayAdapter<String>(this, R.layout.reminder_row, R.id.text1, items);
    setListAdapter(adapter);
  }
}

A: Activity doesn't define the method setListAdapter(). I think you want to extend ListActivity instead:
public class ReminderListActivity extends ListActivity {
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.reminder_list);

        String[] items = new String[] { "Foo", "Bar", "Fizz", "Bin"};
        ArrayAdapter<String> adapter =
            new ArrayAdapter<String>(this, R.layout.reminder_row, R.id.text1, items);
        setListAdapter(adapter);
    }
}


text:
Q: Mass 301 Moved Permanently redirect I am having trouble finding the best way to redirect 25+ pages to their new URLs. I have updated a weebly site to a PHP one so all the .html links are now .php and some files are renamed completely (updating since the old site wasn't mobile responsive).
I have try some .htaccess things to change .html  extensions to .php ones but it doesn't seem to work on my shared host.
Is there a php 301 redirect I can use and include on the 404 page? or will the hurt SEO? Having a 404 to 301 to new page? Is there another way? Other than creating HTML page with the old names and adding meta refresh? or using .htaccess?
I have looked at a lot of over stacks but their not SEO focus or don't match my pro, I really want to keep SEO in mind.
ErrorDocument 404 http://www.sitename.co.nz/404_error.php

RewriteEngine On
RewriteCond %{REQUEST_URI} .html$
RewriteRule ^(.*).html$ /$1.php [R=301,L]

#http://www.inmotionhosting.com/support/website/redirects/setting-up-a-301-permanent-redirect-via-htaccess

Redirect 301 /oldfilea.htm /newfilea.htm
Redirect 301 /oldfileb.htm /newfileb.htm
Redirect 301 /oldfilec.htm /newfilec.htm
Redirect 301 /oldfilee.htm /newfilee.htm
Redirect 301 /oldfiled.htm /newfiled.htm

A: Couple of important changes needed:

*

*Don't mix mod_alias rules with mod_rewrite rules.

*Keep redirect rules before internal rewrite ones.

Try this in root .htaccess:
ErrorDocument 404 http://www.sitename.co.nz/404_error.php

RewriteEngine On

RewriteRule ^oldfilea\.htm$ /newfilea.htm [L,NC,R=301]
RewriteRule ^oldfileb\.htm$ /newfileb.htm [L,NC,R=301]
RewriteRule ^oldfilec\.htm$ /newfilec.htm [L,NC,R=301]
RewriteRule ^oldfilee\.htm$ /newfilee.htm [L,NC,R=301]
RewriteRule ^oldfiled\.htm$ /newfiled.htm [L,NC,R=301]

RewriteRule ^(.+?)\.html$ /$1.php [R=301,L,NC]

Test this after clearing your browser cache.


text:
Q: Widevine can only run on ARMv7 When i am trying to run a video with embedded ID in the OOyala player, i am getting like "Widevine can only run on ARMv7".
NSLog(@"video id= %@ ",videoID);
self.ooyalaPlayerViewController = [[OOOoyalaPlayerViewController alloc] initWithPcode:PCODE domain:PLAYERDOMAIN];

// Attach it to current view
[self addChildViewController:_ooyalaPlayerViewController];
[self.ooyalaPlayerViewController.view setFrame:self.videoPlayerView.bounds];
[self addChildViewController:self.ooyalaPlayerViewController];
[self.videoPlayerView addSubview:self.ooyalaPlayerViewController.view];

// Load the video
[self.ooyalaPlayerViewController.player setEmbedCode:videoID];

// Add observers
[self addObserversForOoyalaVideoplayer];

[self addCloseButton];

[self.ooyalaPlayerViewController.player play];

A: I added that line a while back when I still worked at Ooyala.
Basically, the Widevine playback library for iOS is only distributed in compiled ARM binaries.  The simulator runs natively on x86, so it can't load the library (I believe is purposeful, as it makes the DRM code slightly harder to reverse engineer), and we issue a warning.
Try playing it back on an actual device and everything should work fine.

A: In our case, we were testing on the iPhone 5S, which can't really be ignored.
As it turns out, the issue was that we left the project files configurations as they are, which added arm64 support to the build, and that broke the player. All we had to do was override the architecture configuration in all the project files and build.

A: Set valid and build architectures in the build settings to armv7 and try to run the application it will work.


text:
Q: WCF Project - EntityFramework 5.0.0 ' 'Could not load file or assembly 'EntityFramework...' Error I have a WCF Service application that uses EntityFramework 5.0.0 and when I called the method that uses the EDMX framework I get the below given message.

The server encountered an error processing the request. The exception message is 'Could not load file or assembly 'EntityFramework, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' or one of its dependencies. The system cannot find the file specified.'. See server logs for more details.

Here are my config snippets:
App.config
<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <configSections>
    <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
    <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
  </configSections>
  <entityFramework>
    <defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
      <parameters>
        <parameter value="v11.0" />
      </parameters>
    </defaultConnectionFactory>
  </entityFramework>
</configuration>

Packages.config
<?xml version="1.0" encoding="utf-8"?>
<packages>
  <package id="EntityFramework" version="5.0.0" targetFramework="net45" />
</packages>

Web.config
<assemblyBinding>
      <dependentAssembly>
        <assemblyIdentity name="EntityFramework" publicKeyToken="b77a5c561934e089" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-5.0.0.0" newVersion="5.0.0.0" />
      </dependentAssembly>
</assemblyBinding>

Am I missing anything? What do I have to check?
Help Please!!

A: .NET 4.5 is required. However, EF5 will run on .NET 4
So you have to check that IIS Application pool is configured to support .Net FrameWork 4.0.
For example: Sharepoint 2010 requires ASP.Net 3.5, so it does not support EF5.

A: Summary with the help of @Ruslan-Dayanov:
Configure and Use the Fusion Log Viewer to see where the service looks for the dll. Make sure the dll is available in that location.
References

*

*How to configure Fusion Log: Hanselman's Guide

*MSDN article on Fusion Log Viewer: Click Here


text:
Q: Stop Safari extension from caching messages I'm having problems with creating a safari extension that has been causing me headaches.
The problem is this: I have created an extension that gets images from a web page using an injected script. I have a function in the popover that displays the web images and allows the user to click and send the selected image to a backend.  This all goes through the global page which handles signals and messages. The scenario is this:

*

*When the popover opens, it sends a signal to the global page to initiate the response (image URLs) from the injected script.

*When the global page gets the message from the injected script, it calls the function in the popover passing in the data from the injected script as an argument.

*The popover shows all images returned from the global page via the injected script.

The problem is that every time I open the popover, it appends the images from the last call instead of giving a fresh list of images. For instance, on first popover open, I get one image (assuming the page has only one image). If I close the popover and open it again, I get two of the same image. If I close and open the popover a third time, it appends the first image with the one from the second time and gives me 3 of the same image.  On the fourth open of the popover I get 1 + 1 + 1 + 1, so 4 images. So it seems to be appending the messages and not giving me a fresh message every time.
My question is: how can I destroy the messages that are being cached after each popover closes? I hope I am being clear. Perhaps something else is happening with my code that I am not aware of. Please help if you can.  Here is my code from the global HTML:
function popoverHandler(event) {
  //check for popover opening
  if (event.target.identifier === "MyPopUp") {
    //send message to injected script to send page info
    safari.application.activeBrowserWindow.activeTab.page.dispatchMessage("getContent", '', false);
    //this works fine, I get this message every time popover opens
    console.log('getContent message sent');
    //listen for message containing page info from injected script
    safari.application.addEventListener('message', function (messageEvent) {
      //only get message from current tab
      if (messageEvent.name === "pageInfo" && messageEvent.message.url === safari.application.activeBrowserWindow.activeTab.url) {
        pageInfo = messageEvent.message;
        //the problem seems to be in here.  Every time I open the popover, //I get the current page info plus all the page info messages from //the previous time I open the pover, all duplicates of the previous //messges
        console.log(pageInfo);

        // call a function in the popover, passing the pageInfo data //received from the injected script
        safari.extension.popovers[0].contentWindow.onPageDetailsReceived(pageInfo);
      }
    });
  }
}

A: Ok, so I was able to solve the problem. First of all, I separated the popoverHandler from the eventListener.  For some reason, it was firing the function too many times and returning several lists of the same images.  The major issue, however, was that in the popover.js, I was storing the list of images as a var.  When I removed the var, the data stopped persisting and I was getting a fresh list every time.


text:
Q: liquibase  : Insert current date I am trying to insert data using liquibase insert tag. It works fine when I am inputing a number to value tag .
But I am looking for a simple function that will take care of default date (current DateTime of database) even when I don't have it as part of my table definition.
Eg:
<changeSet id="abc_1" author="Me">
<insert tableName="Emp" schemaName="XYZ">
    <column name="name" value="Me"/>
    <column name="create_date" value ="1328055111692"/>
    <column name="profile_last_update" value="currentDateTimeFunction"/>
    <column name="group_name" value="BlahBlah"/>
</insert>
</changeSet>

here <column name="create_date" value ="1328055111692"/> works fine and it gets inserted in to the database. I also tried using <defaultValueDate> and <valueDate> but they also need some date input in specified format.
I am looking for some function like currentDateTimeFunction that would be converted to UNIX_TIMESTAMP() or SYSDATE or now() based on type of database I am using. Please help me.
Thank you,
Ramya

A: What you you will have to do is use changelog parameters and
define a "now" or "current_timestamp" parameter that is replaced per database type.
At the top of your <databaseChangeLog>, normally just outside your <changeset>, add per-database definitions of the property like:
  <property name="now" value="sysdate" dbms="oracle"/>
  <property name="now" value="now()" dbms="mysql"/>
  <property name="now" value="now()" dbms="postgresql"/>

then in your changesets use
<column name="Join_date" defaultValueFunction="${now}"/>

Notice the use of defaultValueFunction that will let liquibase know
not to parse it as a date or quote it.

A: If you are using DB2 then you could do the following:
<changeSet id="emp_1" author="Me">
<insert tableName="Emp" schemaName="XYZ">
    <column name="EmpName" value="abc"/>
    <column name="Join_date" valueDate="CURRENT TIMESTAMP"/>
    <column name="Profile_last_update" valueDate="CURRENT TIMESTAMP"/>
    <column name="group_name" value="BlahBlah"/>
</insert>
</changeset>

The resulting SQL is not quoted so it just calls the DB2 function.

A: There is a simple way of doing it given as below
you can simply use valueDate="now()" for MySQL. Like in my case I did:
    <changeSet id="emp_1" author="Me">
       <insert tableName="Emp" schemaName="XYZ">
         <column name="last_updated_at" valueDate="now()"></column>
       </insert>
    </changeset>

A: Thank you for your reply. it was helpful. Below is what I did and it worked for me.
<property name="now" value="UNIX_TIMESTAMP()" dbms="mysql"/>
<changeSet id="emp_1" author="Me">
<insert tableName="Emp" schemaName="XYZ">
    <column name="EmpName" value="abc"/>
    <column name="Join_date" valueDate="${now}"/>
    <column name="Profile_last_update" valueDate="${now}"/>
    <column name="group_name" value="BlahBlah"/>
</insert>
</changeSet>

Thanks again,
Ramya

A: Liquibase + Oracle: use valueComputed="SYSDATE"
Worked with Oracle 11g:
    <insert tableName="SOMETABLE">
        <column name="ID" valueComputed="SOMETABLE_SEQ.NEXTVAL" />
        <column name="USER_ID" value="123" />
        <column name="CREATED_DATE" valueComputed="SYSDATE" />
    </insert>

A: The answers posted by Ramya and Adam D, works for PostgreSQL too.
Using the "property" tag, I had to change the dbms to dbms="postgresql" and to use a PostgreSQL function for "value" (CURRENT_TIMESTAMP in my case).
Without the "property" tag, I used valueDate="CURRENT_TIMESTAMP" in the "column" tag.
I'm using PostgreSQL 9.1.9 and Liquibase 2.0.5.

A: You can use valueNumeric to execute functions, as it will prevent the wrapping of quotes around the value.
<column name="id" valueNumeric="uuid_generate_v4()"></column>

A: First you have to set dbms in insert tag.
then for date use valueDate field in column tag.
 <changeSet  author="name"  id="id_1">
    <insert tableName="table_name" dbms="oracle">
        <column  name="id" value="71"/>
        <column  name="description" value="test"/>
        <column  name="start_date" valueDate="2020-01-01"/>
        <column  name="end_date" valueDate="2021-01-01"/>
    </insert>
</changeSet>

A: Below solution worked for me with mysql DB.
<column name="LAST_MODIFIED_DATE" valueComputed="CURRENT_TIMESTAMP"/>

A: Neek's answer works well (although I had to use valueComputed), however, issues can arise with substitution in other parts of the code such as unit testing, so the following approach as per the Liquidbase documentation worked:
<insert tableName="Emp" schemaName="XYZ" dbms="oracle">
    <column name="profile_last_update" value="sysdate"/>
</insert>
<insert tableName="Emp" schemaName="XYZ" dbms="postgresql, mysql">
    <column name="profile_last_update" value="now()"/>
</insert>


text:
Q: Powershell: Setting SASS_BINARY_PATH I need to set SASS_BINARY_PATH environment variable with the local file I've downloaded to be able to install node-sass behind a corporate firewall. So on windows cmd, I just do:
SET SASS_BINARY_PATH=C:\Source\Repos\SRT\Srt.Web\sass-binary\v4.7.2\win32-x64-48_binding.node

And the installation works fine since it successfully sets the variable. But when I try doing it via Powershell, it doesn't work:
$env:SASS_BINARY_PATH="C:\Source\Repos\SRT\Srt.Web\sass-binary\v4.7.2\win32-x64-48_binding.node"

I've also tried another way on Powershell:
[Environment]::SetEnvironmentVariable("SASS_BINARY_PATH", "C:\Source\Repos\SRT\Srt.Web\sass-binary\v4.7.2\win32-x64-48_binding.node", "Machine")

Upon checking it on the control panel, it successfully added a "SASS_BINARY_PATH" system variable. But upon trying to reinstall node-sass, it fails again.
One of my observations is when I'm doing it the windows cmd way then check it by using the command line set, the variable shows up along with others. But when I use both the Powershell methods, it does not show up. Any ideas on this?
The error encountered when trying to npm-install node-sass over a corporate firewall is:

Downloading binary from
  https://github.com/sass/node-sass/releases/download/v4.7
  .2/win32-x64-48_binding.node Cannot download
  "https://github.com/sass/node-sass/releases/download/v4.7.2/win3
  2-x64-48_binding.node":
HTTP error 401 Unauthorized

A: *

*Download win32-x64-48_binding.node manually

*Put it in C:\Users\<user>\AppData\Roaming\npm-cache\node-sass\4.7.2 folder.

*Then try to run npm install node-sass
here is the PowerShell command @jengfad used based on above solution which is commented in the discussion
$cacheSassPath = $env:APPDATA + '\npm-cache\node-sass'

if( -Not (Test-Path -Path $cacheSassPath ) )
{

Write-Host "cacheSassPath not exists"

New-Item -ItemType directory -Path $cacheSassPath
Write-Host "cacheSassPath CREATED"
}

<# Ensure has no content #>
Get-ChildItem -Path $cacheSassPath -Recurse| Foreach-object {Remove-item -Recurse -path $_.FullName }

<# Copy local sass binary (~Srt.Web\sass-binary\4.7.2) file to cache folder #>
$sassBinaryPath = split-path -parent $MyInvocation.MyCommand.Definition
$sassBinaryPath = $sassBinaryPath + "\sass-binary\4.7.2"

Copy-Item -Path $sassBinaryPath -Recurse -Destination $npmcachedir -Container

Write-Host "node-sass binary file successfully copied!"


text:
Q: shared managed object context in tab bar application update entity not propagate to other tabs I'm working on a tab bar application that fetches places and photos from Flickr, stores the data in CD and allows the user to view photos saved as favorite.
This application shares a managed object context from the app delegate to the other tabs.
There are two custom entities in Core Data: Places and Photos. These have the appropriate one to many and inverse relationships setup.
The first tab fetches data from flickr and stores it into core data:
NavigationController -> TableViewController (of Places) -> TableViewController (of photos for selected place) -> ViewController (present photo &  button to favorite)
The second tab bar is similar but only uses input from core data via Fetched results controllers:
NavigationController -> TableViewController (of Places from CD) -> TableViewController (of favorite photos from selected place) -> ViewController (present photo & button to toggle favorite status)
The problem I'm having is this scenario:
1) Favorite a photo in first tab.
2) View photo in second tab and toggle favorite back to no.
3) Return to first tab where photo entity is still favorite T_T.
I can't seem to make that update in the second tab propagate through to the first one.
I've looked at NSNotification after setting the property, calling save from the managed object context, but I am stumped ... help!

A: Wow I'm a fool. Apparently there was no core data problem... just my check to set the button title self.photo.isFavorite is a nsnumber returned from CD not a bool...
so if(self.photo.isfavorite) was always returning yes
checking if 1 now solves
/queue emojii
m(_ _)m ゴメンナサイ


text:
Q: Can the area between an arc of the curve $y = \sin kx$ and $x-$axis ever be $2/k$, where $k$ is any positive constant? Can the area between an arc of the curve $y = \sin kx$ and $x-$axis ever be $2/k$, where $k$ is any positive constant?
I guess it's true. So, I tried to fix values for the limits as $a=0$ and $b=\pi$, then
$$\int^{b}_a \sin kx dx=\dfrac{1-\cos kx}{k}.$$
However, I'm not getting it. So, I think I'm missing it. Can anyone help out?

A: You are asking to solve $$\int^{b}_a \sin kx dx=-\left[\dfrac{\cos kx}{k}\right]_a^b=\frac1k\left({\cos ka}-{\cos kb}\right)=\frac2k$$I.e. we want solutions to $$\cos ka-\cos kb=2$$This is possible only if $\cos ka=1, \cos kb=-1$. That is $$ka=2n\pi, n\in\Bbb N\\kb=(2n+1)\pi,n\in\Bbb N$$Thus, it works for any region where $$a=\frac{2n\pi}k;\,\,\,\,\,b=\frac{(2m+1)\pi}k$$for integers $m,n$. In particular, you can adjust your example by using $a=0$ and say, $b=\pi/k$.