text:
Q: Waffle as a module in Jboss 7.1 We are trying to migrate from tomcat to Jboss AS 7.1, but we have a problem with Waffle library we use for SSO.
we read that in order to use Waffle in jboss AS 7.1 we needed to create a module  in Jboss with the following dependencies:
<module xmlns="urn:jboss:module:1.1" name="com.sso">
    <resources>
        <resource-root path="Waffle-1.4.jar"/>
        <resource-root path="platform-gcp_1.jar"/>
        <resource-root path="jna-gcp_1.jar"/>
        <resource-root path="guava-r07-gcp_1.jar"/>
        <resource-root path="commons-logging-1.1.1.jar"/>
    </resources>

    <dependencies>
        <module name="javax.servlet.api" />
    </dependencies>
</module>

and added the following dependencies to our jboss-deployment-structure.xml:
<dependencies>
   <module name="org.jboss.ironjacamar.jdbcadapters"/>
   <module name="com.sso"  export="TRUE" />
</dependencies>

but it seems like jboss is not finding all the classes inside the module because  we are getting the following error:
Caused by: java.lang.ClassNotFoundException: waffle.spring.NegotiateSecurityFilt
erEntryPoint from [Module "deployment.Grc.war:main" from Service Module Loader]

Thanks a lot for the help.
UPDATE:
This is the whole exception:
18:26:04,936 SEVERE [org.springframework.web.context.ContextLoader] (MSC service thread 1-2) Context initialization failed: org.springframework.beans.factory.BeanCreationException: Error creating bean with name '_filterChainProxy': Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name '_filterChainList': Cannot resolve reference to bean '_exceptionTranslationFilter' while setting bean property 'filters' with key [2]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name '_exceptionTranslationFilter': Initialization of bean failed; nested exception is org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [waffle.spring.NegotiateSecurityFilterEntryPoint] for bean with name 'negotiateSecurityFilterEntryPoint' defined in class path resource [waffle-filter.xml]; nested exception is java.lang.ClassNotFoundException: waffle.spring.NegotiateSecurityFilterEntryPoint from [Module "deployment.Grc.war:main" from Service Module Loader]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:480) [spring-2.5.5.jar:2.5.5]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409) [spring-2.5.5.jar:2.5.5]
    at java.security.AccessController.doPrivileged(Native Method) [rt.jar:1.7.0_13]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380) [spring-2.5.5.jar:2.5.5]
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264) [spring-2.5.5.jar:2.5.5]
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:221) [spring-2.5.5.jar:2.5.5]
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261) [spring-2.5.5.jar:2.5.5]
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185) [spring-2.5.5.jar:2.5.5]
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164) [spring-2.5.5.jar:2.5.5]
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:429) [spring-2.5.5.jar:2.5.5]
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:729) [spring-2.5.5.jar:2.5.5]
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:381) [spring-2.5.5.jar:2.5.5]
    at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:255) [spring-2.5.5.jar:2.5.5]
    at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:199) [spring-2.5.5.jar:2.5.5]
    at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:45) [spring-2.5.5.jar:2.5.5]
    at org.apache.catalina.core.StandardContext.contextListenerStart(StandardContext.java:3392) [jbossweb-7.0.13.Final.jar:]
    at org.apache.catalina.core.StandardContext.start(StandardContext.java:3850) [jbossweb-7.0.13.Final.jar:]
    at org.jboss.as.web.deployment.WebDeploymentService.start(WebDeploymentService.java:90) [jboss-as-web-7.1.1.Final.jar:7.1.1.Final]
    at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811)
    at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_13]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_13]
    at java.lang.Thread.run(Thread.java:722) [rt.jar:1.7.0_13]
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name '_filterChainList': Cannot resolve reference to bean '_exceptionTranslationFilter' while setting bean property 'filters' with key [2]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name '_exceptionTranslationFilter': Initialization of bean failed; nested exception is org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [waffle.spring.NegotiateSecurityFilterEntryPoint] for bean with name 'negotiateSecurityFilterEntryPoint' defined in class path resource [waffle-filter.xml]; nested exception is java.lang.ClassNotFoundException: waffle.spring.NegotiateSecurityFilterEntryPoint from [Module "deployment.Grc.war:main" from Service Module Loader]
    at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:275) [spring-2.5.5.jar:2.5.5]
    at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:104) [spring-2.5.5.jar:2.5.5]
    at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveManagedList(BeanDefinitionValueResolver.java:287) [spring-2.5.5.jar:2.5.5]
    at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:126) [spring-2.5.5.jar:2.5.5]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1245) [spring-2.5.5.jar:2.5.5]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1010) [spring-2.5.5.jar:2.5.5]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:472) [spring-2.5.5.jar:2.5.5]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409) [spring-2.5.5.jar:2.5.5]
    at java.security.AccessController.doPrivileged(Native Method) [rt.jar:1.7.0_13]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380) [spring-2.5.5.jar:2.5.5]
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264) [spring-2.5.5.jar:2.5.5]
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:221) [spring-2.5.5.jar:2.5.5]
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261) [spring-2.5.5.jar:2.5.5]
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185) [spring-2.5.5.jar:2.5.5]
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164) [spring-2.5.5.jar:2.5.5]
    at org.springframework.security.config.FilterChainProxyPostProcessor.postProcessBeforeInitialization(FilterChainProxyPostProcessor.java:52) [spring-security-core-2.0.7.RELEASE.jar:]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInitialization(AbstractAutowireCapableBeanFactory.java:350) [spring-2.5.5.jar:2.5.5]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1330) [spring-2.5.5.jar:2.5.5]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:473) [spring-2.5.5.jar:2.5.5]
    ... 22 more
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name '_exceptionTranslationFilter': Initialization of bean failed; nested exception is org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [waffle.spring.NegotiateSecurityFilterEntryPoint] for bean with name 'negotiateSecurityFilterEntryPoint' defined in class path resource [waffle-filter.xml]; nested exception is java.lang.ClassNotFoundException: waffle.spring.NegotiateSecurityFilterEntryPoint from [Module "deployment.Grc.war:main" from Service Module Loader]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:480) [spring-2.5.5.jar:2.5.5]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409) [spring-2.5.5.jar:2.5.5]
    at java.security.AccessController.doPrivileged(Native Method) [rt.jar:1.7.0_13]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380) [spring-2.5.5.jar:2.5.5]
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264) [spring-2.5.5.jar:2.5.5]
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:221) [spring-2.5.5.jar:2.5.5]
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261) [spring-2.5.5.jar:2.5.5]
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185) [spring-2.5.5.jar:2.5.5]
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164) [spring-2.5.5.jar:2.5.5]
    at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:269) [spring-2.5.5.jar:2.5.5]
    ... 40 more
Caused by: org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [waffle.spring.NegotiateSecurityFilterEntryPoint] for bean with name 'negotiateSecurityFilterEntryPoint' defined in class path resource [waffle-filter.xml]; nested exception is java.lang.ClassNotFoundException: waffle.spring.NegotiateSecurityFilterEntryPoint from [Module "deployment.Grc.war:main" from Service Module Loader]
    at org.springframework.beans.factory.support.AbstractBeanFactory.resolveBeanClass(AbstractBeanFactory.java:1138) [spring-2.5.5.jar:2.5.5]
    at org.springframework.beans.factory.support.AbstractBeanFactory.resolveBeanClass(AbstractBeanFactory.java:1102) [spring-2.5.5.jar:2.5.5]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:386) [spring-2.5.5.jar:2.5.5]
    at java.security.AccessController.doPrivileged(Native Method) [rt.jar:1.7.0_13]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380) [spring-2.5.5.jar:2.5.5]
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264) [spring-2.5.5.jar:2.5.5]
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:221) [spring-2.5.5.jar:2.5.5]
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261) [spring-2.5.5.jar:2.5.5]
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185) [spring-2.5.5.jar:2.5.5]
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164) [spring-2.5.5.jar:2.5.5]
    at org.springframework.security.config.EntryPointInjectionBeanPostProcessor.postProcessBeforeInitialization(EntryPointInjectionBeanPostProcessor.java:37) [spring-security-core-2.0.7.RELEASE.jar:]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInitialization(AbstractAutowireCapableBeanFactory.java:350) [spring-2.5.5.jar:2.5.5]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1330) [spring-2.5.5.jar:2.5.5]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:473) [spring-2.5.5.jar:2.5.5]
    ... 49 more
Caused by: java.lang.ClassNotFoundException: waffle.spring.NegotiateSecurityFilterEntryPoint from [Module "deployment.Grc.war:main" from Service Module Loader]
    at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:190)
    at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:468)
    at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:456)
    at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:398)
    at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:120)
    at org.springframework.util.ClassUtils.forName(ClassUtils.java:242) [spring-2.5.5.jar:2.5.5]
    at org.springframework.beans.factory.support.AbstractBeanDefinition.resolveBeanClass(AbstractBeanDefinition.java:383) [spring-2.5.5.jar:2.5.5]
    at org.springframework.beans.factory.support.AbstractBeanFactory.resolveBeanClass(AbstractBeanFactory.java:1135) [spring-2.5.5.jar:2.5.5]
    ... 62 more

A: In the end, it turns out there was no need to make any change to the configuration, it was a dumb error, the JBoss machine must belong to the domain for Waffle to work.
Thanks anyway.


text:
Q: Displaying all data in database if that data exists in another database in asp.net mvc I have two models, SelectDate and Log, I'm trying to display a selected date from the calendar control if that date is present in the Log database. i.e if 2017-10-08 is selected and it is present in the log database, display all instances of 2017-10-08 from the database. Here's how far I've gone.
public class Log
{
    public int LogID { get; set; }
    public int EmployeeID { get; set; }
    public Employee Employee { get; set; }
    public string Login { get; set; }
    public string Logout { get; set; }
    public string Date { get; set; }
}

public class SelectDate
{
    public int SelectDateID { get; set; }
    [DataType(DataType.Date)]
    public string SelectedDate { get; set; }
}

The controllers, CalendarDetails is to display the proposed problem:
public ActionResult SelectDate(string username, SelectDate date, Log logdate)
{
    db.SelectDates.Add(date);
    db.SaveChanges();
    var getdate = from l in db.Logs
                  from sd in db.SelectDates
                  where (l.Date == sd.SelectedDate)
                  select l;
    if (getdate != null)
    {
        return RedirectToAction("CalendarDetail");
    }
    else
    {
        return View();
    }
}

public ActionResult CalendarDetail(string username)
{
    var logTimes = db.Logs.Include(a => a.Employee);
    return View(logTimes.ToList());
}

*

*What am I doing wrong?

*Is the Logic flawed?

redpajama_set_name: RedPajamaStackExchange


text:
Q: div rows skip a row after first two rows in my web page the first two rows of lists inside a div are just fine, they are 4 columns wide. after the first two rows in the third row, the left most 3 columns are not there, but the list element on the very right most column is. the next row down is perfectly fine and then is problem repeats on the 5th row. crude diagram below where * represents a list element
* * * *
* * * *
      *
* * * *
      *

Searched for a similar issue but couldn't find anything that matches and im sure it must be something in my css .li but i cant seem to figure it out. also, the code is only snippets related to the area having probelms. if the entire code (279 lines html and 398 lines css) is needed let me know.
Thank you in advance
css:
.gallery {
    list-style: none;
    margin: 0;
    padding: 0;
}
.gallery li {
    width: 260px;
    float: left;
    padding:17px;
    position: relative;
}
.gallery h3 {
    position: absolute;
    top: 190px;
    background: url(images/linkbg.jpg) repeat-x top left;
    padding: 5px;
    opacity: 0.85;
    width: 250px;
    text-align: center;
    border-radius: 0 0 10px 10px;
}
.gallery img {
    border-radius: 10px;
}
.poptrox-popup {
    background: #111111;
    border-radius: 8px;
    padding: 20px 20px 60px 20px;
    color: #aaaaaa;
}
.poptrox-popup .closer {
    position: absolute;
    width: 80px;
    height: 30px;
    bottom: 15px;
    right: 20px;
    background: url(images/linkbg.jpg) repeat-x top left;
    color: #ffffff;
    text-align: center;
    text-decoration: none;
    outline: 0;
    border-radius: 8px;
    line-height: 30px;
    text-shadow: 0 1px 1px #003A6C;
}
.poptrox-popup .closer:hover {
    background: #2094E6;
}
.poptrox-popup .caption {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 60px;
    line-height: 60px;
    padding: 0 20px 0 20px;
}

html:

Cisco 3560 Front

Cisco Catalyst 3560 Front View

Cisco 3560 Rear

Cisco 3560 Rear View

Cisco 2970

Cisco 2970 Front View

Cisco 3640 (NMA)

Cisco 3640 Front view. Commonly known in our network as an nma

Cisco 2621 (NM1)

Cisco 2621 Front view. Commonly known in our network as an nm1

Cisco 2621 Rear

Cisco 2621 Rear view. The expansion ports would normally have modem cards installed in our network. This known by Mediacom as an nm1

Cisco 7600

Cisco 7600 Router Front view. The only one in the network currently is ar01.ent.demia

Cisco 7606

The Cisco 7606 is a smaller version of the 7609 vtn switch

Cisco 7609

Cisco 7609 Front view. More commonly known as a VTN Switch

Cisco 1711 Front

Cisco 1711 Router Front view.

Cisco 1711 Rear

Cisco 1711 Router Rear view.

A: ROOT CAUSE
Your actual design will give you as many LI you can have in your browser width, due to you are using float and you have not provide a height so you have multiple heights what will affect the design.
FIX
Add height:310px; to .gallery li class.
EXAMPLE
http://goo.gl/QC9IjD


text:
Q: Pass parameters to web api from console application I need to communicate with a web api from a console application.
The api needs two variables/parameters passed to it like so:
    [HttpPost("api/loans/range/enroll/{loanStart}/{loanEnd}")]
    public IActionResult PostLoanData(DateTime loanStart, DateTime loanEnd)
    {
        Loans.CreateLoanDates(loanStart, loanEnd);
        return NoContent();
    }

So in my main method, I did something like this:
static void Main(string[] args)
{
        var LoanDateRange = new Dictionary<string, string>
                {
                    {"loanStart", startDate.ToString()},
                    {"loanEnd", endDate.ToString()}
                };

        var json = JsonConvert.SerializeObject(LoanDateRange);
        HttpClient client = new HttpClient();
        client.PostAsync("http://mybank1.com/api/loans/range/enroll", new StringContent(json, Encoding.UTF8, "application/json"))
            .ContinueWith(task => {
                var response = task.Result;
                    Console.WriteLine(response.Content.ReadAsStringAsync().Result);
                });
        Console.ReadLine();
 }

When I run the program I just get a null exception.
How can I give the api what it needs from a console application?  Or maybe, can I change the api so that it can better interact with the console app?
Thanks!

A: Try this way
Create a model
class DateModel
{
    public DateTime LoadStart {get;set;}
    public DateTime LoadEnd {get;set;}
}

then update your api
[HttpPost("api/loans/range/enroll")]
public IActionResult PostLoanData([FromBody] DateModel loan)
{
    Loans.CreateLoanDates(loan.LoadStart, loan.LoadEnd);
    return NoContent();
}

then call from console app
static void Main(string[] args)
{
    var LoanDateRange = new DateModel();
        LoanDateRange.LoadStart = startDate.ToString();
        LoanDateRange.LoadEnd = endDate.ToString();

    UploadAsync(LoanDateRange);

    Console.ReadLine();
}

public static  async Task UploadAsync(DateModel LoanDateRange)
    {
        using (var client = new HttpClient())
            {
                client.BaseAddress = new Uri("http://mybank1.com/");
                client.DefaultRequestHeaders.Accept.Clear();
                client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));

                StringContent content = new StringContent(JsonConvert.SerializeObject(LoanDateRange), Encoding.UTF8, "application/json");

                try
                {
                    HttpResponseMessage response = await client.PostAsync("api/loans/range/enroll", content);
                    if (response.IsSuccessStatusCode)
                    {
                        // "Success", MessageBoxButtons.OK);
                    }
                }
                catch (Exception)
                {
                    // ignored
                }
            }
    }

A: And the final version with Newtonsoft.Json
public class TestClass
{
    [JsonProperty]
    public string Server { get; set; }
    [JsonProperty]
    public string UserName { get; set; }
    [JsonProperty]
    public List<ShareData> Shares { get; set; }
}

 using (var client = new HttpClient()
 {
      string uri = new Uri("http://myapiendpoint/").ToString();

      string content = JsonConvert.SerializeObject(TestClass);
      var response = await client.PostAsync(uri, new StringContent(content, Encoding.UTF8, "application/json"));
 }


text:
Q: How can I find out if there is actually a cuda-toolkit-6-0 or similar in the apt-get repository (it should exist, but apt-get doesnt see it)? On my NVidia Jetson TK1 I ran this command:
sudo apt-get install cuda-toolkit-6-0

But got this output:
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package cuda-toolkit-6-0

In the installation instructions on elinux.org, written by NVidia, they very clearly say to install cuda-toolkit-6-0.  What could be going on?  Can I search the apt-get repository for all packages containing the word "cuda"?  It seems odd that NVidia would mess up such a basic instruction, and I'm pretty sure people are using this machine explicitly for cuda applications.
The only difference from their instructions was when I downloaded cuda-repo-l4t-r19.2_6.0-42_armhf.deb, I allowed the Ubuntu Software Center to do the install instead of using sudo dpkg -i cuda-repo-l4t-r19.2_6.0-42_armhf.deb.  I don't think that should be an issue though.

A: In Ubuntu 14.04 and Ubuntu 14.10 you can install nvidia-331, NVIDIA CUDA toolkit and the NVIDIA CUDA 5.5 Runtime library directly from the default Ubuntu repositories. libcudart5.5 is the package name of the NVIDIA CUDA runtime library. libcudart5.5 requires the nvidia-331 or more recent graphics driver. There is also an NVIDIA CUDA toolkit package (nvidia-cuda-toolkit) in the default Ubuntu repositories for Ubuntu 14.04 and Ubuntu 14.10, and like libcudart5.5 it is also version 5.5.
In Ubuntu 15.04 and Ubuntu 15.10 libcudart5.5 has been upgraded to libcudart6.5, and the nvidia-cuda-toolkit like libcudart6.5 is also version 6.5.
In Ubuntu 16.04 libcudart has been upgraded to libcudart7.5, and the nvidia-cuda-toolkit like libcudart7.5 is also version 7.5.

A: I would say that the instructions are outdated. They mention CUDA 6.0 and Ubuntu 12.04, whereas the nVidia downloads page mention CUDA 6.5 and Ubuntu 14.04. There's no evidence that the wiki page you link to is written by nVidia, so it's not a surprise to me.


text:
Q: Page elements failed to load at random moments in Google Chrome I have a problem with Google Chrome on a new laptop (Samsung series 9 with SSD disk) - sometimes pages look broken. Some elements of them such as css, js and imgs are failed to load. Chrome Developer Tools shows that these assets are not loaded (screenshot):

*

*they are colored red;

*status: (failed);

*size: (cache).

These problems could be encountered at any site. I've tried different networks. I've tested another notebook of the same model with the same result, tried versions 23 and 24 beta with the same results.
It could be some problems with the cache. Or something else. Only reloading of the page could solve the problem. How it could be fixed? It's quite annoying.

A: It looks that I found a root of the problem. The answer was found at Google Groups.
The problem is the software piece came with Samsung notebook, it is called Samsung Support Center. After uninstalling it and clearing the Chrome cache everything become OK.

A: 1) Check On Other Browser...
2) try clearing the cache by CTRL + SHIFT + DEL
3) click on certificate near URL... check javascripts or images are disabled by defaults..
4) check out with http ... this type of thing done almost with https protocol ...


text:
Q: Swift optional method in protocol without objc I know, that making some methods in a Swift protocol requires to use @objc protocol. The problem is, that I can't use the objective c way, because I have a method in the protocol, which returns a Swift struct. So I'm getting the error, that I can't use the @objc protocol, because my method returns a result, which cannot be represented in objective c.
Unfortunately, I absolutely want to use an optional methods, because there are two methods, which are alternative and the user of my class shall choose, which way he want to use.

A: What I do in this situation is return a class (compatible with Objective-C) which wraps the Swift struct. In other words, just make it so that everything Objective-C sees is compatible with Objective-C, and inside that you can do anything you like.

A: Well, I think I've a solution for you.
First is a protocol with the required method(s).
protocol A {
  func A() -> ()
}

And then, you define as many protocols you need to express the various combinations of optional method(s) you need.
protocol APrimo {
  func B() -> ()
}

protocol ASecundo {
  func C() -> ()
}

And last but not least, you'll define which protocols your class(es) implements.
class AClass: A, ASecundo {
  func A() -> () { }
  func C() -> () { }
}

Side note: you can of course define the optional protocols as inheriting from the required protocol. I find the style I used here nicer, but that's just me.

A: Protocol Extensions
Swift 3
Another way to approach this problem without dealing with objective-C compatibility is to use optionals backed by protocol extensions.
Define your optional property or method:
protocol MyProtocol {
    var optionalProperty: Int? { get }
    var requiredProperty: Int { get }
}

Implement the default behavior of your optional by extending MyProtocol with a computed property:
extension MyProtocol {
    var optionalProperty: Int? { return nil }
}

And now you can create 'MyProtocol inheriting structs' that don't require the optionalProperty implementation.


text:
Q: ASP.NET Core Identity: how to implement 2fa with redirect? ASP.NET Core Identity offers built-in 2fa providers such as SMS, phone and Authenticator app. They all trigger a 2fa flow in the backend (send an SMS, start a phone call, or just ask the user for a code from their auth app). However, we're required to use an external 2fa provider whose process involves redirecting the user to a page on their URL, which will then redirect back to a page on our end which verifies the 2fa token. This is not an OAuth flow.
IUserTwoFactorTokenProvider only offers a way to return a string token. I could abuse this by returning a URL and then redirecting in the UI but that seems a misuse of the interface. Still, I'd like to have ASP.NET Identity in charge of deciding which users require 2fa, but that means it also wants to do the 2fa itself.
public class ExternalTokenProvider : IUserTwoFactorTokenProvider<ApplicationUser>
{
    public async Task<bool> CanGenerateTwoFactorTokenAsync(UserManager<ApplicationUser> manager, ApplicationUser user)
    {
        return true; //all users require 2fa
    }

    public async Task<string> GenerateAsync(string purpose, UserManager<ApplicationUser> manager, ApplicationUser user)
    {
        var challenge = GenerateChallengeToken();
        return $"https://2fa.example.com?user={user.Id}&token={challenge}";
    }

    public async Task<bool> ValidateAsync(string purpose, string token, UserManager<ApplicationUser> manager, ApplicationUser user)
    {
        //validate the response token;
    }
}

Looking at the implementation of AuthenticatorTokenProvider I see it simply returns string.Empty in GenerateAsync(), and then in Microsoft.AspNetCore.Identity.UI the LoginWith2fa.cshtml.cs page is called. I could do something similar but use the URL retrieved from GenerateAsync() to redirect the user.
I've also read How to register a Two-factor authentication provider which still just uses the basic functionality of sending a code via phone/e-mail. It seems the only choice you really have here is to choose the communication gateway.
Is this a proper way to do it within ASP.NET Identity? What's a better way to do this?

A: My implementation ended up not generating the redirect URL in the TokenProvider (because it doesn't seem to be possible to retrieve the generated token/URL from the frontend) but rather copying the implementation of Microsoft.AspNetCore.Identity.UI and just doing it in the frontend:
MfaTokenProvider.cs

public async Task<bool> CanGenerateTwoFactorTokenAsync(...)
{
    return true;
}

public async Task<string> GenerateAsync(...)
{
    return Task.FromResult(string.Empty);
}

public async Task<bool> ValidateAsync(...)
{
    return _mfaProvider.ValidateToken(token, user.Email);
}

AccountController.cs

[HttpPost]
public async Task<IActionResult> Login(LoginForm form)
{
    var result = await _signInManager.PasswordSignInAsync(form.Username, form.Password, form.RememberMe, false);

    if (result.RequiresTwoFactor)
    {
        var authenticationUrl = _mfaProvider.GetUrl(form.Username, form.ReturnUrl);
        return RedirectResult(authenticationUrl);
    }
    return RedirectResult(form.ReturnUrl);
}

This has the advantage of leaving RequiresTwoFactor managed by Identity. The downside is the implementation of the 2FA is split over 2 classes and can cause issues when needing to offer multiple 2FA options. This is not currently a requirement of my app, however.


text:
Q: Hyperlinks for polygon feature labels - openlayers I am using Openlayers to display a map and some vector features like polygons and points. Is it possible to have hyperlinks for the label of a vector feature? Does anyone has any idea on how to do this? I have a map which has vector polygons and point features. And the point features could fall within polygon features which makes it hard to click point inside the polygon if both polygon and point features have selectControl. So I am thinking if I can have hyperlinks to the labels of the polygon, I can remove the selectControl for Polygon and do the same functionality by clicking on label instead of anywhere in the polygon.
Thanks,
Aridbh.

A: One way to add a hyperlink is to put it inside a popup html, I know this is not exactly what you want... perhaps if you make the popup anchored, non-closable and auto-sized you can get closer.


text:
Q: How many ions a day keep the rebels away? Some say you cannot teach new tricks to an old dog. I found that decapitation is the best way to ensure the error of mistaking a mantis for a dog never happens again.
Anyway, I went to kick some Rebels' asses today with the Vortex for the first time. Sadly, there wasn't much kicking going on without a crew. New crew members were of the greenish brittle kind or engi. As tempting as it was, buying a trusty teleporter made no sense. You ain't winning no fight with light bulbs and plumbers my dear!
I embraced the nature of the ship instead, with a final setup looking like this:

*

*ion weapons:

*

*Heavy Ion

*Ion Blast I

*Ion Blast II

*drones:

*

*Combat II

*Defense II

*Anti-Combat

To my surprise it worked1. However, I often could not decide what ion weapon to use against what system of an enemy ship at what moment. I mostly just pointed them all at the shields to keep them down and let the combat drone do the work. This worked even against those wimps hiding behind 4 layers of blue protection.
Is there a proven strategy to orchestrate multiple ion weapons for maximum efficiency? That is like a laser can lower shields to allow a beam weapon to go threw and deal more damage. Could I have disabled additional systems while keeping the shields down by aiming one ion weapon at that system occasionally?
In theory, reducing a system with ion damage should take more ion damage than keeping it low, freeing ion damage resources for other ion damaging tasks. Being able to ion damage additional systems appears to be advantageous.
My unit of choice is 'throats per minute', so I'm not exactly sure what to look for when optimising ion damage efficiency, here are the specs:
        energy req     ion damage    recharge [s]     damage/time
heavy       2               2           13               0.154
blast I     1               1            8               0.125
blast II    3               1            4               0.25

The blast II clearly wins on ion damage / time, but it also requires a lot of energy. Dealing 2 ion damage at once is great, but missing a shot that took 13s to charge is very unfortunate.
Is this just a numbers game or is there more to it than ion damage / time?
On a recent raid of a slug ship, I found this related information:

Additional ion effects will both reset the timer and add to the ion counter, allowing an ion barrage to completely disable a 4x Shield.

If the hit of an ion projectile not only adds to the ion count, but also resets any decrease of existing ion damage, then I wonder if I'm right in thinking that not only dealing the most ion damage / time is important, but doing so with the most ion projectiles / time has a certain importance, too?
After all a well scheduled impact of an ion projectile at 0.00001 resets to 1 and thus "adds" almost one full ion damage.
Could any of my dear fellow federation allies shed some light on this please?

1but barely, "working" as in The burning, heavily damaged ship managed to beat the flagship with its last almost dead zoltan, barricading himself in the room of the doorsystem that he frantically tried to repair, protecting him from the intruders to gain some time the combat drone needed to finish off the mothership.

A: I would definitely not just keep aiming at the shields. Once the shields are down then they only need to be kept down, not melted like cheese in a microwave.
I would keep the Ion Blast II on the shields as it has a fast enough fire rate that it will keep the shields down, even if it misses occasionally. I'd then use the other ion weapons to selectively disable key parts of the ship. The exact parts depend on what kind of ship you are fighting; you'll have to figure out what is the biggest threat. The idea is to get into the situation where you are dealing steady damage with your combat drone, but absorbing the enemy's attacks with your shield and defence drone. If there is no immediate threat then I'd probably keep the Ion Blast I charged but not targeted; ready for an immediate attack if the enemy tried to warp or if I had a run of misses with the Ion Blast II on the shield.

A: Actually, when using an ion strategy, you're very likely to have a level 2 weapons expert in your crew. Those reduce cooldown to 80%, or increase dps by 25%. That means you can modify your table to be:
        energy req     ion damage    recharge [s]     ion/time (i/s)     vs cloak
heavy       2               2           13               0.192            0.110
blast I     1               1            8               0.156            0.089
charge      2               1            6               0.208            0.119
blast II    3               1            4               0.313            0.179
chain       3               4           14               0.357            0.204
stunner     1               1           10               0.125            0.071

Note that the chain ion is not as good as it seems to be in this chart: by dealing 4 damage at one time it's far more susceptible to missing multiple times (Law of large numbers),
Here's precisely how an ion weapon works, in pseudo code (in units of milliseconds):
def oneIonDamage(system)
     if(shieldsUp) system = shields;
     system.ionized++
     system.ionDuration += 5000
     if(system.ionDuration > 25000) system.ionDuration = 25000

Notice how there is a 25-second 'grace period'. That means as long as there's less than 25 - 5n seconds left on the timer, dealing n ion damage will not result in any 'lost' ion damage on a system.
Another really important thing is the number 0.2  is-1. This is exactly what you need to keep a system ionized. Do less than this, and a system becomes deionized. Do more, and it will keep ionized. If a room is ionized while another ion hits, the ion damage will 'stack up' indefinitely, allowing you to fully disable it. Here's a graph illustrating the discontinuity: the effect of firing a consistent amount of ion/sec on a 6-power room:

What mostly makes ion weapons not a very good strategy is their ability to miss. You see, if you miss a few times in a row with your ion weapons (which will always eventually happen, you can even resolve the precise odds and expected rate of failure if you know your miss chance: this is a modified gambler's ruin problem. )
The exact problem statement:

A gambler starts with c coins; where 1 <= c <= 5. Every 5 seconds they lose one coin (guaranteed), while every s seconds with 0 < s < 10 (you may assume that s is rational), they have probability p of winning one coin if they have at most 4 coins, or getting nothing if they have 5 coins. Wanted:

*

*The expected duration of a game.

*The probability that a game lasts at least n turns.

I'm not going to solve this here, but you'll probably notice from playing with ion weapons a lot that this probability is quite high: the risk that you will eventually miss 10 times in a row is not insignificant.

So what you really need to do is ionize both the shields and the helm (or engines). At this point your ion weapons are guaranteed to hit. To do this you need 0.4 is-1. That means these combinations are 'good enough' to use ion as your shield-and-dodge-disabler:
heavy + charge
blast I + blast II
3x blast I or stunner
blast I + chain
stunner + chain
stunner + blast II

In actuality, you may want a little more than 0.4 ion per second, as late-game ships can have up to these stats on Hard, though not at the same time due to a 25 power limit:
60% dodge chance (10 power)
5 shields (10 power)
cloak (3 power).

Once you have at least 0.6 is-1, you can permanently disable 3 systems, and reliably go for the strategy of ionizing the oxygen on crewed enemy vessels. This requires 2 blast IIs or a blast II and 2 blast Is, or 2 chain Ions, or 3 charge Ions. Typically around 5 or 6 power worth of ion damage, depending on the type of guns you get.
If they have a medbay as well, what you might want to do is run them out of oxygen first (takes around 2 minutes), then hit the medbay with 2-3 ion shots. That should be enough to suffocate most crew. You may want Sensors upgrades to see what's going on.

And now we get to the other major problem with ion strategies. Notice how we used a large amount of weapons power (5-6)? And none of it directed to disable the enemy weapons? Not only is this a significant investment, but you're still going to have to defend the ship with what little energy you have left. Against late-game enemies on Hard mode, these opponents will even redirect their power, as their ships often have many decked out systems with up to 10 power per room.
Finally, Defense Drone II will shut you down hard. There's really nothing you can do about that aside from using the hacking glitch if you have that system.
However, you can still not reliably beat the flagship with this, or several late-game ships, due to their cloaking system. This will prevent your weapons from firing for 15 seconds every 35 seconds, see the last column. If you want to try against the Flagship, I recommend you get a hacking system to decloak it during phase I.

A: Since each resets the ion damage counter and adds about 5 seconds to it, the most important variable to consider is the difference in ion damage and ion impact and damage times. You could have a strong lvl 2 ion blaster that gives you stronger damage but the longer recharge time makes it "less useful". On the other hand 2 lvl 1 ion blaster timed correctly could potential take down 4 shields with some luck. Don't know if this is what you're looking for or not. But of course the fast recharge time, enables it to be able to single handedly take down four shields.


text:
Q: Change DOM element CSS with jquery Not I have two clickable headings. When you click one, it changes blue. If you click the other one, it changes blue, but should "unclick" the other heading and change it back to black.
I'm trying to do this using jquery not...
$("#pal1, #pal2").click(function(event) {
    $(this).css({"color" : "blue"});
    var pal1 = $(this).attr('id');
    var pal2 = $(this).next().attr('id');
    $(this).not(pal2).css({"color" : "black"}); //if the selected heading is not pal1, or not pal2, changed the one that is not == $(this) back to black.
});

Or something like that.

Edit: I know I can do it this way... but wanted to use jQuery functions to reduce code size. Plus this isn't very efficient.
$("#pal1, #pal2").click(function(event) {
    $(this).css({"color" : "blue"});
    if ($(this).attr('id') !== $("#pal1").attr('id')) {
        $("#pal1").css({"color" : "black"});
    }
    else {
        $("#pal2").css({"color" : "black"});
    }
});

A: Set both to black, then set the clicked one to blue.
$("#pal1, #pal2").click(function(event) {
  $("#pal1, #pal2").css({"color" : "black"});
  $(this).css({"color" : "blue"});
});


text:
Q: Remove border from JComboBox Do you know any way to remove the border from a JComboBox in Java? I try the following code
public class ComboFrame extends JFrame {
    public ComboFrame() {
        JPanel container = new JPanel();

        JComboBox cmb = new JComboBox(new String[] { "one", "two" });
        cmb.setBorder(BorderFactory.createEmptyBorder());
        container.add(cmb);

        getContentPane().add(container);
        pack();
    }
}

and
public static void main(String[] args) throws Exception {
    UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
    EventQueue.invokeLater(new Runnable() {
        public void run() {
            new ComboFrame().setVisible(true);
        }
    });
}

Don't ask why would someone want to remove the border from a combobx... I guess it does not make too much sense, but this is how it's wanted, and I got really curious if it can be done. I tried several tricks, but none of them worked.
The most effective was changing the UI with
cmb.setUI(new BasicComboBoxUI());

This makes the border go away, but alters the L&F, and I need to keep the Windows L&F if possible.
Thanks.

A: I did a bit of research and found this bug
I tried it for myself and it does seem to affect the border.  You might want to try one or both of the following code blocks for yourself.
for (int i = 0; i < combo.getComponentCount(); i++)
{
    if (combo.getComponent(i) instanceof JComponent) {
        ((JComponent) combo.getComponent(i)).setBorder(new EmptyBorder(0, 0,0,0));
    }

    if (combo.getComponent(i) instanceof AbstractButton) {
        ((AbstractButton) combo.getComponent(i)).setBorderPainted(false);
    }
}

It is important to note that at the bottom of the bug entry, you can read the following:

The JButton maintains it's own border so JComponent paintBorder() and paintComponent() has no awareness of the JComboBox border.

Good luck,
Jeach!

A: If you want to use the windows L&F, you can do cmd.setUI(new WindowsComboBoxUI());
If you, however, want to be able to use any L&F, you might be better off using the solution proposed by Jeach.


text:
Q: Mark json schema field as required for required xml tags I generate JSON schema from XSD in a way like this:
https://dzone.com/articles/generating-json-schema-xsd
Everything works fine except but it doesn't mark fields as required for those tags from XSD which mark as required (or minOccurs="1").
Is it possible to do with Jackson library?
Or some other tool?
I need something this:
{
"type": "object",
"required": true,
"properties": {
    "field": "value" ...

A: Okay, here is an answer.
You just have to register new JaxbAnnotationModule in your ObjectMapper instance.
Here is a code snippet:
import com.fasterxml.jackson.databind.AnnotationIntrospector;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.type.TypeFactory;
import com.fasterxml.jackson.module.jaxb.JaxbAnnotationIntrospector;
import com.fasterxml.jackson.module.jaxb.JaxbAnnotationModule;
import com.fasterxml.jackson.module.jsonSchema.JsonSchema;
import com.fasterxml.jackson.module.jsonSchema.factories.SchemaFactoryWrapper;

    ObjectMapper objectMapper = new ObjectMapper();
    TypeFactory typeFactory = TypeFactory.defaultInstance();
    AnnotationIntrospector introspector = new JaxbAnnotationIntrospector(typeFactory);
    mapper.getDeserializationConfig().with(introspector);
    mapper.getSerializationConfig().with(introspector);

    //To force mapper to include JAXB annotated properties in Json schema
    objectMapper.registerModule(new JaxbAnnotationModule());
    SchemaFactoryWrapper visitor = new SchemaFactoryWrapper();
    objectMapper.acceptJsonFormatVisitor(objectMapper.constructType(YOUR_JAXB_CLASS.class), visitor);

    JsonSchema inputSchema = visitor.finalSchema();
    String schemaString = objectMapper.writerWithDefaultPrettyPrinter().writeValueAsString(inputSchema);

    System.out.println(schemaString);


text:
Q: Sharing variables in JavaScript Namespace My Goal: To namespace my javascript to keep the global namespace clean.
My question: how do I share variables between methods in my JavaScript namespace?
In my example I am extending and overwriting the behaviour of the ASP.net ModalPopupExtender. I want to know how I can share the modalPopupStack variable with ModalPopupShowOverride and ModalPopupHideOverride without making it global.
Relevant code:
$(function () {
    if (Sys.Extended != undefined && Sys.Extended.UI != undefined && Sys.Extended.UI.ModalPopupBehavior != undefined) {
        MyPageMethods.ModalPopupShowOriginal = Sys.Extended.UI.ModalPopupBehavior.prototype.show;
        MyPageMethods.ModalPopupHideOriginal = Sys.Extended.UI.ModalPopupBehavior.prototype.hide;
        Sys.Extended.UI.ModalPopupBehavior.prototype.show = MyPageMethods.ModalPopupOverrides.ModalPopupShowOverride;
        Sys.Extended.UI.ModalPopupBehavior.prototype.hide = MyPageMethods.ModalPopupOverrides.ModalPopupHideOverride;
    }
});

var MyPageMethods = {

    ModalPopupShowOriginal: function () { },

    ModalPopupHideOriginal: function () { },

    ModalPopupOverrides: {

        modalPopupStack: new Array(),

        ModalPopupShowOverride: function () {

            var extender = this;
            var topElement;

            MyPageMethods.ModalPopupShowOriginal.apply(this, arguments);

            for (var x = 0; x < modalPopupStack.length; x++) {

                if ($(modalPopupStack[x].background).css("z-index") > $(extender._element).css('z-index') || $(modalPopupStack[x].popup).css("z-index") > $(extender._element).css('z-index')) {

                    if ($(modalPopupStack[x].background).css("z-index") > $(extender._element).css('z-index')) {
                        topElement = $(modalPopupStack[x].background).css("z-index");
                    }
                    else if ($(modalPopupStack[x].popup).css("z-index") > $(extender._element).css('z-index')) {
                        topElement = $(modalPopupStack[x].popup).css("z-index");
                    }

                }

            }

            if (topElement != undefined) {
                $(extender._backgroundElement).css('z-index', topElement);
            }

            modalPopupStack.push({ 'id': extender._id, 'background': extender._backgroundElement, 'popup': extender._element });

        },

        ModalPopupHideOverride: function () {
            var extender;
            MyPageMethods.ModalPopupHideOriginal.apply(this, arguments);
            extender = modalPopupStack.shift();
        }

    }

}

I'm sure there is a simple solution to this, but I'm not sure what it is.

A: It sounds like you want the variables to be visible within your namespace but not outside of it.  If so then try the following solution.
var MyPageMethods = (function() {
  // This variable is local to the namespace.  It can't be accessed from
  // the caller
  var modalPopupStack = new Array();

  // These values are available to the callers as members of MyPageMethods
  return {
    ModalPopupShowOriginal: function () { },

    ModalPopupHideOriginal: function () { },

    ModalPopupOverrides: { ... }
  };
})();

This pattern uses a function to establish a private function scope for local variables of the namespace.  It then returns a new object which contains the members accessible outside the namespace.  Those definitions occur inside the function hence they can access the namespace private data.

A: You can reference that property in both methods using:
MyPageMethods.ModalPopupOverrides.modalPopupStack

That can be a little bit cumbersome, so you'd likely want to alias it inside each method, like this:
var modalPopupStack = MyPageMethods.ModalPopupOverrides.modalPopupStack;

Note that the value is still visible in the global scope (unlike in @JaredPar's answer), but its merely piggy-backing on an existing global object.

A: Make it part of the namespace, if you like.  Or for more privacy, make a local closure which incorporates it and exposes the functions you want:
var MyPageMethods = {
    ModalPopupShowOriginal: function () { },
    ModalPopupHideOriginal: function () { },
    ModalPopupOverrides: (function() {
        var modalPopupStack = new Array();
        var show = function () {
            // show implementation using modalPopupStack
        };
        var hide = function () {
            // hide implementation using modalPopupStack
        };
        return {
            ModalPopupShowOverride: show,
            ModalPopupHideOverride: hide
        }
    }())
};

By the way, it's pretty rare to use new Array() these days.  This is usually preferred:
        var modalPopupStack = [];

It's shorter, cleaner, and really more explicit.


text:
Q: Uniqueness of positive square root of postive element in C* algebra
If a is a positive element then it has a unique positive square root, i.e. a unique b positive such that b^2=a.

I understand the existence part of the proof. If we define $f(x)=\sqrt x$ then $f\in C(\sigma (a))$ as $\sigma (a)$ non-negative. $b=f(a)$ satisfies $b^2=a$ and $b\ge0$.  My advisor gave me another proof for the uniqueness part and I want to understand it, in addition to the "popular" proof in which we use the fact that $f\circ g (a) = f(g(a))$ for $f,g\in C(\sigma (a))$ (continuous functional calculus respects composition).  So, consider the special case of a C*-algebra of the form C(X). Positive elements here are continuous functions with nonnegative values. Here we can directly see that there is only one positive square root.
In general, suppose $c$ is some other positive square root of $a$. We want to show that $c = f(a)$. $a$ and $f(a)$  are elements in the C*-subalgebra $C^*(1,c)$, which is commutative. But $C^*(1,c)$ is isomorphic to $C(X)$ for some compact Hausdorff $X$, so we're back to the previous paragraph.  Now, I understand the proof, but I'm a little bit worried that we "identify" between positive elements in isomorphic $C^*$ algebras. Is it true that *-isomorphism preserves positive elements? do we really need this fact to complete the proof?
 Thank you.

A: Once you know that positive elements are those of the form $a^*a$, you have
$$
\pi(a^*a)=\pi(a^*)\pi(a)=\pi(a)^*\pi(a)\geq0.
$$
This shows that any $*$-homomorphism preserves positivity.
If you restrict to isomorphisms, you can show it directly also if you define "positive" as "selfadjoint and $\sigma(a)\subset[0,\infty)$". Because
$a-\lambda I$ is invertible if and only if $\pi(a)-\lambda I=\pi(a-\lambda I)$ is invertible.

A: Alternative Proof: Calculus
For positive elements you have:
$$a,b\geq0:\quad a^2=b^2\implies a=\sqrt{a^2}=\sqrt{b^2}=b$$
exploiting the functional calculus:
$$x^*x=xx^*:\quad g(f(x))=(g\circ f)(x)$$
Concluding uniqueness.


text:
Q: Redirect back to the login page after logged in I have created a custom login page and registration page, all works good but when I try to logged in it redirect me back to the login page without any errors.
Following is store method in SessionsController for login but it does'n work I don't know why can any one help?
public function store()
{

    if(! auth()->attempt(request(['email','password'])))
    {

        return back();

    }
    return view('/posts');
}


text:
Q: Second screen not detected I have a Dell Latitude 7400 with an integrated Intel UHD 620 Graphics and a dual-boot Windows 10 and Ubuntu 18.04.4 LTS. When just running Ubuntu live from my flash drive, my second screen is regularly detected. Though, when using the installed version, the second screen is not detected (while in Windows it clearly is). Unfortunately, most solutions that I find online use Nvidia drivers, which I cannot use. Do you know what I can try? Please let me know which kind of information I should provide you with to try to figure out the issue. Thank you.

A: I solved it! Well, I did not do much myself. I installed Ubuntu version 20.04 LTS (which was released just a month ago), opting for a normal installation (as opposed to minimal installation) and toggling both other options (Download updates and Install third-party software). I don't know which part fixed it, but the second screen is now regularly detected.


text:
Q: Meaning of "My high kicks are not done in a line!"
My high kicks are not done in a line!

The above sentence appeared as a legend in a T-shirt I saw once. It accompanied the caricature of a soccer player warming up, but I didn't get the pun intended. When I told a friend of mine about this, he said that the joke might have to do with a certain expression from ballet ... I hope that you can shed some light on this enquiry of mine.

A: As others have mentioned in the comments, "high kicks" can refer to moves performed by a dance team; for example, these dancers are doing high kicks in a line:

However, the wearer of the T-shirt does her "high kicks" like this:

I think the shirt is just meant to playfully say, "I'm an athlete, not a dancer!" by making veiled references to the football (soccer) field and dance floor.
I'd also guess the T-shirt was meant to be worn by a girl, since boys don't typically high kick in a line, or proudly proclaim that they feel more at home on the athletic field, as opposed to the dance floor.


text:
Q: Multiple Selection Tree View Control for ASP.Net Web Application using C#.Net Would like to know about the TREE VIEW CONTROL which would allow me to select multiple nodes and those selected nodes can then be dragged and dropped onto the other drive.Is there any Property available for multiple selection or how exactly we can go about doing it..
Thank You

A: You could use the checked property on the treeview and allow multiple selections based on the state of the checkbox on each node.
You could iterate through the treenodes to see which were checked (you'd really use recursion but here is an example that would iterate through two layers of nodes):
StringBuilder sb = new StringBuilder();

foreach (TreeNode t in treeView1.Nodes)
{
     if (t.Checked == true) sb.Append(t.Text + Environment.NewLine);

     if (t.Nodes.Count > 0)
     {
          foreach (TreeNode tt in t.Nodes)
          {
               if (tt.Checked == true)
                    sb.Append(tt.Text + Environment.NewLine);
          }
    }
}

MessageBox.Show(sb.ToString(), "Checked Nodes")


text:
Q: create spinner options from json data / array 1. My question: How do I take my JSON data and parse it into an array that I can use in my spinner.
Below is my json data:
[["Mike Test 1"],["Mike Test 2"],["hello world"],["TEST MIKE 4"],["TEST MIKE 6"],["aliens,crazy stuff"],["Alien"],["american flags,flags"]]

My script calls a function that gets the data. I know that is working because I have toasted the return value. It should then loop through and assign the values to a new array that is used in the spinner.
Below is my java:
  Spinner areaspinner;

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

    JSONArray jsonArray;

    try {
    //SETTINGS AND METHOD THAT GETS THE DATA
        String spinnerContentType = "styles";
        String spinnerURL = "getStyles.php";
        String spinner_data =  DataCall.getJSON(spinnerURL,spinnerContentType);

     //NEW JSONArray OBJECT
        jsonArray = new JSONArray(spinner_data);

        final String[] array_spinner = new String[jsonArray.length()];

        int show_total = jsonArray.length();
        //CHECK HOW MANY ITEMS ARE RETURNED
        Toast.makeText(flash_tattoo.this, show_total + "test", Toast.LENGTH_LONG).show();

        for (int i=0; i<jsonArray.length(); i++)
        {
            //LOOP AND ASSIGN TO ARRAY
            String styleValue = jsonArray.getJSONArray(0).getString(i);
            array_spinner[i] = styleValue;

        }
        ArrayAdapter<String> adapter =
            new ArrayAdapter<String> (this,
                    android.R.layout.simple_spinner_item,array_spinner);

        adapter.setDropDownViewResource(R.layout.spinner_layout);
        areaspinner.setAdapter(adapter);

    }catch (JSONException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }

This is my spinner layout:
<?xml version="1.0" encoding="utf-8"?>

<TextView
  xmlns:android="http://schemas.android.com/apk/res/android"
  android:id="@android:id/text1"
  style="?android:attr/spinnerDropDownItemStyle"
  android:singleLine="true"
  android:layout_width="fill_parent"
  android:layout_height="?android:attr/listPreferredItemHeight"
  android:textColor="#e70909"
/>

A: To me it looks like areaspinner is null.
To add a spinner you have something like this in your main.xml.
<Spinner android:id="@+id/mySpinner"
        android:layout_width="fill_parent" android:layout_height="wrap_content"
        android:prompt="@string/mySpinnerText" />

Then in onCreate()
Spinner sp = (Spinner) findViewById(R.id.mySpinner);
        ArrayAdapter<String> adapter =
                new ArrayAdapter<String> (this, android.R.layout.simple_spinner_item, array_spinner);
        adapter.setDropDownViewResource(R.layout.spinner_layout);
        sp.setAdapter(adapter);


text:
Q: Passing parameter while including PHP script I want to do this, but it gives error :( for better understanding my problem I'm giving an example:
<?php
include 'script.php?text=hiii';
?>

content of the script.php
<?php
echo $_GET['text'];
?>

So, how can i pass an argument while including the script page?

A: You could set $_GET['text'] before including the file:
$_GET['text'] = 'hiii';
include 'script.php';

But this obviously won't affect other variables like $_SERVER['REQUEST_URI'], $_SERVER['QUERY_STRING'] etc.

A: After you include any script, the included script will act as it's in the same page.
For  yourpage.php?text=hiii, that include('script.php') will automatically print hiii, as content of script.php will be in your included page.

A: You could've done something like this:
<?php
$_GET['text'] = 'what you want to do';
include('script.php');
?>

A: Actually we don't need to add it to $_GET. just create a variable and use it. Example:
script.php
    <title><?php $text; ?></title>
    <!--- other code goes here -->
index.php
    <?php
    $text = 'Welcome back';
    include 'script.php';
    ?>


text:
Q: Grid or relative layout I want to have a page in an app have multiple buttons (in grid fashion) I was wondering if it would be better to populate a grid layout with buttons or manually add buttons to a relative layout, or if it even matters. I want each button to do something different so if using a grid layout is better  how would I do this. I know you need to have gridview.setOnItemClickListener but that would make each button do the same thing (I think). Any suggestions would be appreciated!

A: If you have a fixed number of buttons, use a RelayiveLayout or TableLayout.  If you have an unknown number of buttons and want to be able to scroll through them, that's the time to use a GridView.


text:
Q: zsh autocomplete wildcard across the network One of my favorite features of zsh is autocomplete, especially when I'm completing a filename on a networked machine.  But how to you include wildcards (like *) and have it autocomplete from the remote machine?
For instance, say I have file1, file2, and file3 residing on a server; I want to copy all those files to my local machine, so I enter
scp server:~/fi<tab>

zsh then correctly autocompletes to
scp server:~/file

but then when I try to wildcard
scp server:~/file*<tab>

all it does it beep at me (it works correctly if the file paths are local).  Is there a set of zsh options that makes this work?

A: Think setting GLOB_COMPLETE should change this.
setopt GLOB_COMPLETE

From man zshoptions:

GLOB_COMPLETE
When the current word has a glob pattern, do not insert all the words resulting from the expansion but generate matches as for completion and cycle through them like MENU_COMPLETE. The matches are generated as if a '*' was added to the end of the word, or inserted at the cursor when COMPLETE_IN_WORD is set. This actually uses pattern matching, not globbing, so it works not only for files but for any completion, such as options, user names, etc.
Note that when the pattern matcher is used, matching control (for example, case-insensitive or anchored matching) cannot be used. This limitation only applies when the current word contains a pattern; simply turning on the GLOB_COMPLETE option does not have this effect.

A: For whatever reason, you have to escape the glob character when used in the remote path in scp/ssh.
scp server:~/file\*<tab>

This is also true if you want to, say, scp over a bunch of files using a glob (rather than doing glob completion), e.g.
scp server:~/files/project.\* ~/localdir


text:
Q: InnoSetup: uninstall/update if install in the previous directory Different versions of our software should be able to install in parallel by specifying different install directories. But if the user decides to install in the directory where a previous version is installed, it should update that (aka uninstall the previous version in this directory and install the new one).
Using the same AppId as described in the InnoSetup FAQ is no option, because otherwise it is not possible to install in parallel.

A: Actually the AppId is exactly the right way to do it.  The AppId is allowed to be specified as a {code:...} constant.  As described in the help for that value, this will be called multiple times; at least once prior to the wizard starting and once prior to the installation proper beginning.
The first time this is called you should return a known value (either a fixed default [possibly an empty string] or some most-recently-used value retrieved from the registry) to aid in previous-value lookup, especially if the user does decide to only install a single instance.  Note that for the best user experience you should try to return a "real" valid value for a previously-installed instance on any subsequent install (eg. the first such install, or the most recent), but this is not essential.
After wpSelectDir has been shown and the user has chosen their destination path, you should return the "real" AppId from subsequent calls to the function.  It's up to you what value to use, but you must fulfil the following requirements:

*

*It must be unique to your application (no other apps should ever use the same value).

*It must be unique to a specific instance of your application (side-by-side installations in separate folders must have different values).

*It must be fixed for a specific instance of your application (if your app is installed into a particular folder, attempting reinstallation into that same folder without an intervening uninstall MUST yield exactly the same value as the previous time; if it was uninstalled first then it CAN yield the same value [as long as it's still unique] but it's not a requirement).

One way of doing this is to use an app-specific fixed prefix followed by an encoded form of the target directory (stripping backslashes at least).  Another way is to maintain a list in the registry of existing installations and using a numeric suffix indicating the position within that list of a particular instance (bearing in mind that this may end up noncontiguous if they are uninstalled out of order).
(If you do maintain a list of previously installed instances, then this offers other options to improve the user experience, such as explicitly asking them via a custom wizard page whether they want to upgrade an existing instance or install a new one, and in the former case you can let them pick from the list of instances instead of displaying wpSelectDir.  Of course, this way requires quite a bit of code.)
Further note that you should not uninstall if a previous version exists; simply install over the top.  Normally you don't need to do anything special for this, but on rare occasions you might want to add [InstallDelete] entries to remove now-redundant files.  As long as you maintain the rules above for the AppId, this will function cleanly.


text:
Q: Count number of times that each API version shows up in log file Develop script which receives data from localhost on port 33001 and finds how many times distinct API version is requested and print it on a screen.
Sample log is:
172.32.11.121 736443 /api/2.3
98.134.54.184 182294 /api/2.3
172.32.11.121 736443 /api/2.3/security
203.44.122.18 397832 /api/3.0
172.32.11.121 736443 /api/2.3
98.134.54.184 182294 /api/3.0
172.32.11.121 736443 /api/2.3/logging
172.32.11.121 736443 /api/2.3
71.11.139.205 291187 /api/2.3
172.32.11.121 736443 /api/3.0/security
98.134.54.184 182294 /api/2.3
71.11.139.205 397832 /api/3.0/logging

First field is IP-address, second one is user id and last one is path to resource.

A: Assuming data in file indata:
$ awk '{ ++c[$NF] } END { for (i in c) print c[i], i }' indata
1 /api/2.3/logging
1 /api/3.0/security
6 /api/2.3
2 /api/3.0
1 /api/3.0/logging
1 /api/2.3/security

The awk script keeps track of the number of times the data in the last column has shown up and prints a summary of this information at the end.
To only get the version number, use -F '/' and replace $NF with $3.
Alternatively:
$ cut -d ' ' -f 3 indata | sort | uniq -c
   6 /api/2.3
   1 /api/2.3/logging
   1 /api/2.3/security
   2 /api/3.0
   1 /api/3.0/logging
   1 /api/3.0/security

This cuts out the third space-separate column from the data and sorts it. uniq -c then counts how many times each unique entry occurs.
To only get the version number with this variation, replace -d ' ' with -d '/' in the call to cut.

A: Assuming you care only about the version and not the whole path:
$ awk -F/ '{count[$3]++} END {for (v in count) print v, count[v]}' file
2.3 8
3.0 4

Splitting fields on /, the version number seems to be the third field in all lines.


text:
Q: What do square brackets around an identifier in VB.NET signify?  I'm quite familiar with VB and .NET in general, but I just ran across this code:
Me.[GetType]()

What is the purpose of the brackets around GetType?

A: The square brackets are used to tell the compiler that he should interpret it as a type, even if it would be a keyword. But your example should be the same as Me.GetType().
You could use it for example for Enums.
Example-Enum:
Enum Colors
    Red
    Green
    Blue
    Yellow
End Enum 'Colors

Dim colors = [Enum].GetValues(GetType(Colors))
For Each c In colors
   Console.WriteLine(c)
Next

That wouldn't compile normally:
Enum.GetValues(GetType(Colors)) 'because Enum is a keyword'


text:
Q: Z3-Python: Invalid bounded variables strikes back with Complex numbers Using Z3 (in Python), the Z3Exception: Invalid bounded variable(s) error (same as asked in Z3: Invalid bounded variables) strikes back. But with a different shape, I guess.
It happens, concretely, when using the codification of Complex numbers by de Moura in (https://leodemoura.github.io/blog/2013/01/26/complex.html). We can see it below:
x = Complex('x')
y = Complex('y')
vars = [x,y]

l_1 = (-1000.5 == x*x)
l_2 = (y == x)

phi = Implies(l_1, l_2)

solve(Exists([x], (x==1)))

It returns the error on the last line.
The problem has nothing to do with l_1, nor l_2 (nor with vars), since it also fails for this:
x = Complex('x')

solve(Exists([x], (x==1)))

If I only change the type of the variable, it returns [] with no problem:
x = Int('x')
y = Int('y')
vars = [x,y]

l_1 = (-1000.5 == x*x)
l_2 = (y == x)

phi = Implies(l_1, l_2)

solve(Exists([x], And(l_1, l_2)))

Thus, there is a problem with the encoding of Complex and not with lists as it was in Z3: Invalid bounded variables
Any idea?
EDIT
Trying the answer for a list of variables:
def ComplexExists(ls, phi):
  existential_ls = []
  for i in range(0, len(ls)):
    existential_ls.append([ls[i].r, ls[i].i])
  print(existential_ls)
  return Exists(existential_ls, phi)

x = Complex('x')
y = Complex('y')
vars = [x,y]

l_1 = (-1000.5 == x*x)
l_2 = (y == x)

phi = Implies(l_1, l_2)

solve(ComplexExists(vars, phi))

Same error. Obviously. The ComplexExists returns a list like: [[x.r, x.i], [y.r, y.i], ...]
This is the other alternative:
def ComplexExists(ls, phi):
  existential_ls = []
  for i in range(0, len(ls)):
    existential_ls.append(ls[i].r)
    existential_ls.append(ls[i].i)
  print(existential_ls)
  return Exists(existential_ls, phi)

It returns a single list and works, but all the variables (both real parts and imaginary) are part of the same list, which sounds strange: [x.r, x.i, y.r, y.i, ...]

A: The problem here is that z3 has no knowledge of the Complex class; so when it tries to create the quantified expression it fails to map them to proper internal values.
The solution is easy; simply make sure to tell z3 about which "base" variables you're quantifying over. That is, instead of:
solve(Exists([x], And(l_1, l_2)))

Use:
solve(Exists([x.r, x.i], (x==1)))

Alternatively, you can define:
def ComplexExists(cv, e):
    return Exists([cv.r, cv.i], e)

And then:
solve(ComplexExists(x, x==1))

You can create variants of ComplexExists that handles a list as its first argument, like z3's Exists method does; etc.
Note that you get an empty list as your model when you run it because the only thing you asserted is locally quantified; and thus you don't have any "top-level" variables to show the values of. I'd rather code it like this:
s = Solver()
s.add(Exists([x.r, x.i], (x==1)))
s.add(phi)
print(s.check())
print(s.model())

Then you get:
sat
[x.r = 0, y.r = 0, x.i = 0, y.i = 0]

Now the output is clear. (Note that the model doesn't satisfy your locally quantified existential, because that x is different than the top-level x; and since phi is an implication, it satisfies that by making the antecedent false.`)
Making ComplexExists work for a list of variables
Here's a version of ComplexExists that takes a list of complex numbers:
def ComplexExists(ls, phi):
    return Exists([qv for v in ls for qv in [v.r, v.i]], phi)

With this definition, you can call:
solve(ComplexExists(vars, phi))

and it should work just fine.


text:
Q: Overriding method by return type in scala, oop solution? I have some problem to find oop information about my problem in scala, peraphs you can help me to find a good solution, or good web/book ressources ?
I have one principal abstract class Operator :
abstract class Operator[G <: AbstractGenome, F <: GenomeFactory[G]] {
  implicit val factory: F
  def operate (genomes: IndexedSeq[G])
}

and two other inherited abstract class :
abstract class Mutation [G <: AbstractGenome, F <: GenomeFactory [G]]
  extends Operator [G, F] {
  override def operate (genomes: IndexedSeq[G]):G
}

abstract class CrossOver [G <: AbstractGenome, F <: GenomeFactory [G]]
  extends Operator [G, F] {
  override def operate (genomes: IndexedSeq[G]) (implicit aprng : Random):IndexedSeq[G]
  }

My problem is here, i cannot override the method operate(..) with different return type when i try to instancite these abstract class, this code doesn't work.
I have already multiple lines of code which use the mutation operate() method which return an unique Genome G ... Can i conserve this OOP structure by using a wrapper, an intermediate object to catch my genome, and bypass this problem with also a generic structure  ?
Thanks a lot for your lights,
SR.

A: If you do not provide a return type for an abstract method Unit is used - not Any as you might have assumed. Just change the declaration in Operator to
def operate(genomes: IndexedSeq[G]): Any

This will not work in the second case though as you cannot add parameter lists when overriding methods. You will have to provide the implicit parameter via the constructor or add it to the declaration in the base class.
The easiest way to implement this would be to add a type parameter for your return type to Operation and put the implicit parameters needed for a specific instance to the constructor of your implementation, e.g.
abstract class Operator[G <: AbstractGenome, F <: GenomeFactory[G], R] {
  implicit val factory: F
  def operate (genomes: IndexedSeq[G]): R
}

class CrossOver[G <: AbstractGenome, F <: GenomeFactory [G]](implicit r: Random)
  extends Operator [G, F, IndexedSeq[G]]


text:
Q: Npm error "Error: EACCES: permission denied, mkdir '../node-sass/build'" Can't install the node-sass package via npm sudo npm i, i have been trying to resolve via sudo npm i -g node-sass --unsafe-perm=true --allow-root but it doesn't effect. Chmod 777 either.
I think there are something with npm permissions but i do not know
Log:
gyp verb build dir attempting to create "build" dir: /home/michael/Desktop/react/node_modules/node-sass/build
gyp ERR! configure error
gyp ERR! stack Error: EACCES: permission denied, mkdir '/home/michael/Desktop/react/node_modules/node-sass/build'
gyp ERR! System Linux 4.15.0-47-generic
gyp ERR! command "/usr/bin/node" "/home/michael/Desktop/react/node_modules/node-gyp/bin/node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
gyp ERR! cwd /home/michael/Desktop/react/node_modules/node-sass
gyp ERR! node -v v11.14.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
Build failed with error code: 1
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.7 (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.7: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! node-sass@4.11.0 postinstall: `node scripts/build.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the node-sass@4.11.0 postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/michael/.npm/_logs/2019-04-13T17_21_20_424Z-debug.log

A: As a general recommendation, never run npm install with sudo as it will create local files owned by root instead of your user, i think you shoud try the following :

*

*First change the owner of the folder :  chown -R yourusername:yourusername /home/michael/Desktop/react/ , or if you don't want to type your username : chown -R $USER:$USER /home/michael/Desktop/react/

*then run : npm install node-sass, do not use sudo

NOTE : This is fine when you install local packages, but for global installations, read the update below

UPDATE
Never Run sudo npm install  and sudo npm anything read this article to get an idea why
While changing the permissions by using chown or chmod is kinda fine and works, however it isn't the best approach when installing packages globally, if you are on a Linux or OSX i would suggest you read this article on the npm docs here, and either use nvm, or manually change npm's default directory.
Changing npm's default directory
To do so, you need to follow these steps :

*

*On the command line, in your home directory, create a directory for global installations:
mkdir ~/.npm-global

*Configure npm to use the new directory path:
npm config set prefix '~/.npm-global'

*In your preferred text editor, open or create a ~/.profile file   [alternatively you can edit either the ~/.bashrc or ~/.zshrc file instead of .profile if you see fit] and add this line  :
export PATH=~/.npm-global/bin:$PATH

*On the command line, update your system variables:
source ~/.profile

# or source ~/.bashrc,
# source ~/.zshrc, depends on where you exported the path

*To test your new configuration, install a package globally without using sudo:
npm install -g jshint

You can install node-sass globally :
    npm install -g node-sass

Now you shoudn't get permissions errors as this should resolve the EACCES permissions errors when installing packages globally .

Warning
LibSass and node-sass are deprecated. While they will continue to receive maintenance releases indefinitely, there are no plans to add additional features or compatibility with any new CSS or Sass features, projects that still use it should move onto Dart Sass.
You can read more on this topic here
Please use sass instead, migrating to Dart Sass is straightforward
And both packages expose the same JavaScript API, to install dart sass :
  npm install sass

Or globally :
  npm install -g sass

A: I followed the instructions as per @WaLid LamRaoui's answer as I also use to run npm install with sudo. It seemed to have done the trick in terms of changing the owner of the folder, but I still got an error when trying to run npm install. I then realized another problem which has to do with my cache folder which contains root-owned files, so for those whose also have this problem after following the approved answer, I simply did this:
sudo chown -R 1003:1003 "/home/<username>/.npm"

After this I ran npm install and it worked fine.

A: Do nothing ..
simply add --unsafe-perm to it
Give it unsafe permission access.
So, let's say.. if you were previously installing bcrypt library
sudo npm install --save bcrypt

then now write
sudo npm install --unsafe-perm --save bcrypt

And you are done.

A: I solved this issue by running
sudo npm install -g --unsafe-perm node-sass


text:
Q: How to get rid of duplicated pairs of id's from two column query result I got file information in one table and file_id and checksums stored in other one. Now i want to search for duplicate files in table with checksums
SELECT A.file_id pid, B.file_id sid
FROM checksums A INNER JOIN checksums B ON A.checksum = B.checksum
WHERE A.file_id <> B.file_id
ORDER BY pid

Result I got is fairly good and can be used after further processing. What I'm wondering about is  if and how I could get right result straight from query. I mean here to get rid of "cross duplicates" in these two columns. for example if File with id 1 got duplicates with Files that got id 43,77,14 and id 2 with duplicate in file with id 74 then i get following result
| pid | sid |
=============
|  1  |  43 |
|  1  |  77 |
|  1  |  14 |
|  2  |  74 |
...
|  14 |   1 |
...
|  43 |   1 |
...
|  74 |   2 |
...
|  77 |   1 |
...

And what I want to achieve to get rid of one of these opposite pairs to avoid duplicate results, is there way in SQL to do it?

A: I think an inequality condition should be sufficient:
SELECT a.file_id pid, b.file_id sid
FROM checksums a
INNER JOIN checksums b ON b.checksum = a.checksum
WHERE A.file_id < B.file_id
ORDER BY pid


text:
Q: WPF/C#5.0 Publish/Subscribe to an array of static fields? Using C# 5.0, I'm creating a publish/subscribe relationship on a static field, so that I can access it from multiple pages. In the host window, I have
public enum PLCStates
    {
        Good,
        Bad,
        Disabled
    };
    public static class PLCSafeStates
    {
        public static event EventHandler testStates1Changed;
        private static PLCStates _testStates1;

        public static PLCStates testStates1
        {
        get { return _testStates1; }
            set
            {
                if (value != _testStates1)
                {
                    _testStates1 = value;
                    if (testStates1Changed != null)
                        testStates1Changed(null, EventArgs.Empty);
                }
            }
        }
    }

And then in the pages hosted by the window, I have things like:
public FB1()
{
InitializeComponent();
SafteyFaults.PLCSafeStates.testStates1Changed += PLCSafeStates_testStates1Changed;
        }

    private void PLCSafeStates_testStates1Changed(object sender, EventArgs e)
    {
    var test2 = SafteyFaults.PLCSafeStates.testStates1;
    if (test2 == SafteyFaults.PLCStates.Bad)
        {
        VisualStateManager.GoToState(btnFB, "PLCBad", true);

        }
    if (test2 == SafteyFaults.PLCStates.Good)
        {
        VisualStateManager.GoToState(btnFB, "PLCGood", false);
        }

    }

    private void btnFB_Click(object sender, RoutedEventArgs e)
    {
        VisualStateManager.GoToState(btnOut1, "PLCBad",false);
        if (SafteyFaults.PLCSafeStates.testStates1 == SafteyFaults.PLCStates.Good)
        SafteyFaults.PLCSafeStates.testStates1=SafteyFaults.PLCStates.Bad;
        else
        SafteyFaults.PLCSafeStates.testStates1 = SafteyFaults.PLCStates.Good;

    }

(right now, I don't have any business logic wired up yet- once I get this working, I'll link to actual data).
Anyhow, all of this works to create a single field I can subscribe to, modify, etc. But I need 20+ of these fields. I want to make 'testStates1' an array, but I've not been able to get it to work.
If I make the following edits to the code shown so far, it compiles and runs, but throws an error when I actually try to access the field (e.g. click on the button to change it):
 //window
         public static class PLCSafeStates
     {
        public static event EventHandler testStates1Changed;
        private static PLCStates[] _testStates1;

        public static PLCStates[] testStates1
        {
        get { return _testStates1; }
            set
            {
                if (value != _testStates1)
                {
                    _testStates1 = value;
                    if (testStates1Changed != null)
                        testStates1Changed(null, EventArgs.Empty);
                }
            }
        }
    }

//page
        public FB1()
        {
        InitializeComponent();
        SafteyFaults.PLCSafeStates.testStates1Changed += PLCSafeStates_testStates1Changed;
        }

    private void PLCSafeStates_testStates1Changed(object sender, EventArgs e)
    {
    var test2 = SafteyFaults.PLCSafeStates.testStates1[0];
    if (test2 == SafteyFaults.PLCStates.Bad)
        {
        VisualStateManager.GoToState(btnFB, "PLCBad", true);

        }
    if (test2 == SafteyFaults.PLCStates.Good)
        {
        VisualStateManager.GoToState(btnFB, "PLCGood", false);
        }

    }

    private void btnFB_Click(object sender, RoutedEventArgs e)
    {
        VisualStateManager.GoToState(btnOut1, "PLCBad",false);
        if (SafteyFaults.PLCSafeStates.testStates1[0] == SafteyFaults.PLCStates.Good)
        SafteyFaults.PLCSafeStates.testStates1[0]=SafteyFaults.PLCStates.Bad;
        else
        SafteyFaults.PLCSafeStates.testStates1[0] = SafteyFaults.PLCStates.Good;

    }