text:
Q: SonarQube 6.2 - Change default landing page to /projects from /about The SonarQube 6.2 product has dramatically changed its skin. I am still playing with it, and my first impression is that I like it, but one thing that is bugging me and will surely confuse my users is the default landing page for my host (e.g. http://sonar.example.com ) is redirected to http://sonar.example.com/about instead of http://sonar.example.com/projects which is a pretty swift departure from where we used to be previously. I think it would be more useful to go to /projects by default. How can I get this as the default landing page instead of /about?
I haven't found any likely sonar.conf variable, nor anything in the Administration panels... Please help, thanks!

A: You cannot change the default landing page via configuration. Please note that the default landing page has changed only for non authenticated user. You can:

*

*authenticate. The next time you come back the default landing page will be the Projects page

*save the projects page as a browser favorite

A: if you are able/permitted to modify the files in
installdir\web\WEB-INF\app\controllers
you could change the file landing_controller.rb
def index
    if logged_in?
      return redirect_to :controller => 'projects', :action => 'favorite'
    else
      return redirect_to :controller => 'projects'  //here was 'about'
    end
  end

A: I am working with sonarqube 6.4, seems it is impossible to change this behavior as I found the web contents from install dir was refactored by reactJS and minimized.
I would like to suggest you checkout official docs about Look and Feel Settings, you are able to add custom text(html supported) on about page, what I had done is adding a redirect link with info to help users go to projects page.
Update Look and Feel - Screenshot

A: Tested in 6.7 LTS:
You need a tool to search over files, like Notepad++
Search within the "installdir\web\WEB-INF\" Folder in every *.js for the String
+"/about"  (including the quotation marks)
You should find a passage like this:
window.location.pathname!==window.baseUrl+"/about"

Change it to:
window.location.pathname!==window.baseUrl+"/projects"

//EDIT
The js-files are minimized but the variables for window.location.pathname are build in variables, so they must not be changed by a minimizer.
Therfore the text passage mentioned above, is in there, even if it is hard to find.


text:
Q: Do "cut set" and "edge cut" mean the same thing? The definitions I have are:

A cut set of a graph $G$ induced by a partition of $G$'s vertices
  into sets $X$ and $Y$ is the set of all edges with one endpoint in $X$
  and another endpoint in $Y$.
An edge cut of a connected graph $G$ is a set $S$ of $G$'s edges
  such that $G$-$S$ is disconected and $G$-$S$' is connected for any
  proper subset $S$' of $S$.

They do not appear to mean the same thing, yet my course materials refer to both as "cuts" of G. So please help me understand: do the "edge cut" and "cut set" of a graph refer to the same set?

A: A cut set is not necessarily an edge cut. Think about it: If $X$ in the definition of cut set is not itself connected, then you need to restore more than one edge to reconnect $G$.
Also, cut sets appear to be defined even for a graph that is not connected to begin with.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Not always can catch SEH on WoW64 on "clean" Windows 8.1 I have Win32 MFC application compiled with VS2008. The application has TreeConrtol. There is a TVN_ITEMCHANGING handler and inside the handler I'm forcibly repainting the changed tree item.
Here is the code with SEH handlers and direct WinAPI calls instead of MFC wrappers (this does not affect on the issue):

void CMainDlg::OnTvnItemChangingMainTree(NMHDR *pNMHDR, LRESULT *pResult)
{
    NMTVITEMCHANGE *pNMTVItemChange = reinterpret_cast(pNMHDR);

    HWND hTreeCtrl = _ctrlTree.GetSafeHwnd();
    RECT rect;
    __try
    {
        *(HTREEITEM*) &rect = hItem;
        if ((BOOL) ::SendMessage(hTreeCtrl, TVM_GETITEMRECT,
                (WPARAM) FALSE, (LPARAM) &rect))
        {
            ::InvalidateRect(hTreeCtrl, &rect, TRUE);
        }
    }
    __except(EXCEPTION_EXECUTE_HANDLER)
    {
        ::MessageBox(NULL, L"SEH exception is Here", L"__except Block", MB_OK);
    }
    *pResult = 0;
}

If I select an item in the Tree Control (programmatically or by a mouse click), then after deleting all items from the tree control (by using DeleteAllItems or one-by-one) I'm getting the TVN_ITEMCHANGING for item which already does not exist, so the code from above leads to structured exception raising when calling ::SendMessage(hTreeCtrl, TVM_GETITEMRECT, ...).
That's OK, but... The __except block never be executed on some Windows 8.1 Pro x64 (and maybe on other Windows versions).
My working machine is English Windows 8.1 Pro x64 (build 9600) updated from Windows 8. On that machine everything works fine (the handler catches the exception and MessageBox is shown). However on a clean English Windows 8.1 Pro x64 (build 9600) downloaded from MSDN the __except block is not called and application crashes. Fault Module Name: COMCTL32.dll
I run the same .exe file on both computers. How do you think why this might happen?
Here is a working example. I compiled it with /EHsc and then with /EHa (the real project was compiled with /EHa and uses try/catch).
The code in the example is different from the function from above: I have added options to use try/catch and _try/_except.
Using /EHa I can catch the exception using both try/catch or _try/_except on my working machine, using /EHsc using _try/_except. But none of these combination works for the other machine (with clean Win8.1): it does not catch the exception.
Demo project (compiled with Visual Studio 2008 Professional SP1 + MFC): here.
PS: The problem has been temporarily solved by adding if condition to the SendMessage() call, but here I want to investigate the issue with exception handling.
Thanks in advance for your comments.

A: You don't control all frames between the RaiseException (or equivalent) and the __try/__except: There's the SendMessage() call in-between.
Raymond Chen explained it best: When you transfer control across stack frames, all the frames in between need to be in on the joke


text:
Q: VS2019 Live Share - is it possible to share console as well? I worked on a Console Application with a friend today. Is it possible to share the default console during a Live Share session? What I mean is that we had to compile and run our program manually through the default Windows Terminal to see output(which wasn't the best idea, there was a ton of empty lines displayed every time we would input anything), and debugging was impossible because we just couldn't see the console (only the host could).

A: According to the docs, it's possible to share the terminal in both VS Code and Visual Studio, but I don't think there's a way to share the console that comes up when you debug a console app. The solution I see is simply sharing a terminal, running your app in it manually and if you want debugging, you can try attaching the VS debugger to the console app's process after you start it manually by following this guide.


text:
Q: C# How to terminate a click-event handler with another click-event I have a click-event handler to a button that forms an ssh connection. I want to terminate this function with another "cancel" button click.
However, when executing an event handler, "cancel" click event handler doesn't run while the first handler executing. I want to override the first handler with "cancel" handler.
private void button_sshconnection_Click(object sender, EventArgs e)
        { /* some code to create ssh connection */ }

private void button_cancel_Click(object sender, EventArgs e)
        { /* some code to terminate button_sshconnection_Click */ }

I tried a code-structure like the above code but as I said second function doesnt run while the first function running. If the structure is wrong, can someone tell me how to do this job.
Thanks in advance,
Onur

A: You can try implementing async version of your routine, e.g.
   private CancellationTokenSource m_Cancellation;

   private async void button_sshconnection_Click(object sender, EventArgs e) {
     // if method is executing, do nothing. Alternative: cancel and start again
     if (m_Cancellation != null)
       return;

     try {
       using (m_Cancellation = new CancellationTokenSource()) {
         var token = m_Cancellation.Token;

         await Task.Run(() => {
           //TODO: implement your logic here, please, note that cancellation is cooperative
           // that's why you should check token.IsCancellationRequested

         }, token);
       }
     }
     finally {
       m_Cancellation = null;
     }
   }

   private void button_cancel_Click(object sender, EventArgs e) {
     // If we can cancel, do it
     m_Cancellation?.Cancel();
   }


text:
Q: How to prevent HTTP 404 for a custom action in an odata controller? I have an ASP.Net WebApi2 project hosting odata both ApiController and ODataController.
And I want to add a custom action in an ODataController.
I saw this seems to be achievable by either adding [HttpPost] attribute on the desired action, or by configuring the ODataConventionModelBuilder with a specific FunctionConfiguration when using the MapODataServiceRoute.
To distinguish between odata routes and webapi routes we use the following scheme :

*

*odata  : http://localhost:9292/myProject/odata

*webapi : http://localhost:9292/myProject/api
I tried both these solution without success which all led to get an HTTP 404 result.
My custom action is defined as following:
public class SomeModelsController : ODataController
{
    //...

    [EnableQuery]
    public IHttpActionResult Get()
    {
        //...
        return Ok(data);
    }

    public IHttpActionResult MyCustomAction(int parameterA, int parameterB)
    {
        //...
        return Json(data);
    }

    //...
}

So as you guessed it, the Get call on the controller perfectly work with odata. However the MyCustomAction is a bit more difficult to setup properly.
Here is what I have tried :

*

*Setting an [HttpPost] attribute on MyCustomAction
[HttpPost]
public IHttpActionResult MyCustomAction(int parameterA, int parameterB)
{
    //...
    return Json(data);
}

I also tried decorating MyCustomAction with the [EnableQuery] attribute.
Also, I tried adding the [AcceptVerbs("GET", "POST")] attribute on the method without changes.

*Configuring the ODataConventionModelBuilder
  private static IEdmModel GetEdmModel()
  {
      var builder = new ODataConventionModelBuilder
      {
          Namespace = "MyApp",
          ContainerName = "DefaultContainer"
      };
      // List of entities exposed and their controller name
      // ...
      FunctionConfiguration function = builder.Function("MyCustomAction ").ReturnsFromEntitySet<MyModel>("SomeModels");
      function.Parameter<int>("parameterA");
      function.Parameter<int>("parameterB");
      function.Returns<MyModel>();

      return builder.GetEdmModel();
  }

Also tried decoration of MyCustomAction with [EnableQuery], HttpPost and [AcceptVerbs("GET", "POST")] attributes.
I still get HTTP 404 result.
My query url is as follow:
http://localhost:9292/myProject/odata/SomeModels/MyCustomAction?parameterA=123&parameterB=123
I also tried to POST parameters on
http://localhost:9292/myProject/odata/SomeModels/MyCustomAction with the same result. Actually with or without parameters I get HTTP 404 status.

A: I've created a working example from scratch with Visual Studio 2017.
If you want more info you can read this tutorial:
https://learn.microsoft.com/en-us/aspnet/web-api/overview/odata-support-in-aspnet-web-api/odata-v4/odata-actions-and-functions

*

*Create a new ASP.Net Web Application (no .Net Core)

*Choose WebApi Template

*Install from NuGet the package Microsoft.AspNet.OData (I have used v. 6.0.0)

*Create a simple model class into Models folder
TestModel.cs
namespace DemoOdataFunction.Models
{
    public class TestModel
    {
        public int Id { get; set; }

        public int MyProperty { get; set; }

        public string MyString { get; set; }
    }
}

*

*Configure WebApiConfig
WebApiConfig.cs
using DemoOdataFunction.Models;
using System.Web.Http;
using System.Web.OData.Builder;
using System.Web.OData.Extensions;

namespace DemoOdataFunction
{
    public static class WebApiConfig
    {
        public static void Register(HttpConfiguration config)
        {
            // Web API configuration and services

            // Web API routes
            config.MapHttpAttributeRoutes();

            config.Routes.MapHttpRoute(
                name: "DefaultApi",
                routeTemplate: "api/{controller}/{id}",
                defaults: new { id = RouteParameter.Optional }
            );

            ODataModelBuilder builder = new ODataConventionModelBuilder();
            builder.Namespace = "MyNamespace";

            builder.EntitySet<TestModel>("TestModels");

            ActionConfiguration myAction = builder.EntityType<TestModel>().Action("MyAction");
            myAction.Parameter<string>("stringPar");

            FunctionConfiguration myFunction = builder.EntityType<TestModel>().Collection.Function("MyFunction");
            myFunction.Parameter<int>("parA");
            myFunction.Parameter<int>("parB");
            myFunction.ReturnsFromEntitySet<TestModel>("TestModels");

            config.MapODataServiceRoute(
                routeName: "ODataRoute",
                routePrefix: "odata",
                model: builder.GetEdmModel()
                );
        }
    }
}

*

*Create the controller TestModelsController into Controllers folder
TestModelsController.cs
using DemoOdataFunction.Models;
using System.Collections.Generic;
using System.Linq;
using System.Web.Http;
using System.Web.OData;
using System.Web.OData.Query;

namespace DemoOdataFunction.Controllers
{
    public class TestModelsController : ODataController
    {
        IQueryable<TestModel> testModelList = new List<TestModel>()
            {
                new TestModel{
                MyProperty = 1,
                MyString = "Hello"
                }
            }.AsQueryable();

        [EnableQuery]
        public IQueryable<TestModel> Get()
        {
            return testModelList;
        }

        [EnableQuery]
        public SingleResult<TestModel> Get([FromODataUri] int key)
        {

            IQueryable<TestModel> result = testModelList.Where(t => t.MyProperty == 1);
            return SingleResult.Create(result);
        }

        [HttpPost]
        public IHttpActionResult MyAction([FromODataUri] int key, ODataActionParameters parameters)
        {
            string stringPar = parameters["stringPar"] as string;

            return Ok();
        }

        [HttpGet]
        [EnableQuery(AllowedQueryOptions = AllowedQueryOptions.All, MaxExpansionDepth = 2)]
        public  IHttpActionResult MyFunction(int parA, int parB)
        {
            return Ok(testModelList);
        }
    }
}

*

*Edit Web.config changing the handlers section in system.webServer
web.config
<system.webServer>
    <handlers>
      <clear/>
      <add name="ExtensionlessUrlHandler-Integrated-4.0" path="/*"
          verb="*" type="System.Web.Handlers.TransferRequestHandler"
          preCondition="integratedMode,runtimeVersionv4.0" />
    </handlers>
    [...]
</system.webServer>

That's all.
This is the request for MyAction:
POST
http://localhost:xxxx/odata/TestModels(1)/MyNamespace.MyAction
{
  "stringPar":"hello"
}

This is the request for MyFunction:
GET
http://localhost:xxxx/odata/TestModels/MyNamespace.MyFunction(parA=1,parB=2)

A: I am using HTTP POST with route on the controller functions like below:
        [HttpPost]
        [Route("{application}/{envName}/date/{offset}")]
        [ResponseType(typeof(DateInfo))]
        public async Task<IHttpActionResult> SetDateOffsetForEnvironmentName(string application, string envName, string offset)
        {
        }

can you try setting the route on the function and then call the post method on it like this:
POST /status/environments/ATOOnline/PTH/date/0
Also try and capture a request through Fiddler and see what is being passed.


text:
Q: Is it possible make a train moving with less atmospheric friction if a pressurized air shield is applied at its frontal part? Like the magnetic field blocks radiation particles approaching Earth could a pressurized air pipe at the frontal part of a train block atmosphere that constantly slows down that train? The pipe should have such an end that emits fast air in directions that are perpendicular to the train trajectory forming a flow that looks like an umbrela. The energy lost for using the pressurized air to block atmospheric particles is ballanced by minimizing the friction for the train to be slightly faster. The problem could be that this shield may produce vacuum at the train frontal glass that's why I am asking is this even possible as a solution.

(Please,can my question migrate to engineering SE to avoid rewriting?)

A: Unlikely since the density of air is already low, and the speeds are not that fast. You could try to use something like helium and have a thin layer of helium to try to reduce drag. Hard drives used contain to have helium to reduce drag.
Underwater on the other hand, it is a much more viable concept. There have been a variety of experiments with supercavitation. By reducing drag the underwater torpedo can go much faster.


text:
Q: Isotope initialization won't work. Having issues with images after adding slick.js carousel plugin I have created a grid using Desandro's Isotope.js and it's working fine until I added slick.js, a carousel plugin of my choice.
Now, on load,  the images that I put inside the carousel seems to go outside the .item container of isotope as block and that leaves a gap messing up the grid. When I press the responsive view from Firefox, it seems that the grids re-shuffles and it displays the correct positioning of the grid again.

So I thought it may be in the initialization of the script. I tried to put the isotope script at the bottom after the slick.js initialization with no effect. When I tried the $(document).ready function, isotope won't work anymore.
Changing the height from auto to fixed height on .carousel-item gets rid of the gap but the thing is I made the isotope responsive so when viewing it on other size screen, the grids aren't equal again  (the height of the .carousel-item gets smaller than the rest of the grid making the grid uneven on smaller screens).
My HTML is something like this:

this is my initialization that works good but with the grid messed up after adding images on slick.js carousel
var $container = $('#container');
// init
$container.isotope({
  // options
  masonry: {
    columnWidth: '.grid-sizer',
    gutter: '.gutter-sizer'
  },
  itemSelector: '.item'
});

I am trying to add this after googling isotope initialization but isotope doesn't work at all with this script.
$(document).ready({
  $container.imagesLoaded( function() {
    $container.isotope({
      // options
      masonry: {
        columnWidth: '.grid-sizer',
        gutter: '.gutter-sizer'
      },
      itemSelector: '.item'
    })
  }
})

this doesn't work either
 var $container = $('#container').imagesLoaded( function() {
    $container.isotope({
     // options
     masonry: {
       columnWidth: '.grid-sizer',
       gutter: '.gutter-sizer'
     },
     itemSelector: '.item'
    });
  });

A: I'm using this:
    var $container = $('.l-grid').imagesLoaded( function() {
        $container.isotope({
            itemSelector: '.block',
            gutter: 0,
            transitionDuration: 0,
            layoutMode: 'packery'
        });
    });

And it works for me.

A: Try running your slick code BEFORE the isotope init.


text:
Q: What is the origin of the phrase "blue moon"? Any alternate phrase for it? Was just wondering how this phrase came into being? Was it inspired from some natural or astronomical observation? or is it the result of poetic imagination?

A: The Online Etymology Dictionary gives the following origin:

blue moon
      1821 as a specific term in the sense "very rarely," perhaps
  suggesting something that, in fact,
  never happens (cf. at the Greek
  calends); suggested earliest in this
  couplet from 1528:
Yf they say the mone is blewe,
We must beleve that it is true.

Though this might refer to calendrical calculations by the
  Church, so that the general sense of
  the term and the specific one
  (commonly misinterpreted as "second
  full moon in a calendar month," but
  actually a quarterly calculation) are
  difficult to disentangle. In either
  case, the sense of blue is obscure.
  Literal blue moons do occasionally
  occur under extreme atmospheric
  conditions.

So as you suggest, its origin could be either poetic or astronomical. Perhaps the latter inspired the former? A lot older than I would have guessed, in any case!
As for alternatives, the most obvious one is simply "[very] rarely". A more interesting one is "black swan", which can be used to describe a very infrequent event.

A: A Blue moon is the second full moon in the same month.
As a full moon appears every 28 days the chances of a full moon happening twice in the same month are very rare.
This brings us to the common expression:

Once in a blue moon.

Meaning it happens very rarely.
Though Dr Hiscock in one of his books noted this is a modern interpretation of the term "Blue Moon"; Historically it has probably been related to the moon changing colour because of atmospheric conditions (which was even more rare).

A: Usually, blue moon appears in the phrase, once in a blue moon. An alternative is once in a while.


text:
Q: Question about the distribution of primes Let's say that you have two numbers, for example $5,000$ and $10,000$, and we calculate $\pi(5000)$ and $\pi(10000)$. For a number in between them, such as $7,500$, can we do some sort of interpolation to approximate $\pi(7500)$?

A: Interpolation as if $\pi(x)$ were a linear function will give a fairly good approximation. For example,
$$
\pi(7500) = 950, \quad (\pi(10000) + \pi(5000))/2 = 949
$$
and
$$
\pi(6000) = 783, \quad \frac{4}{5}\pi(10000) + \frac{1}{5}\pi(5000)= 781 \, .
$$
This works well because the function $x \mapsto \frac{x}{\log x}$ appearing in the Prime Number Theorem is increasing and concave down, with derivatives going to zero.


text:
Q: Can you please specify that how much apple paying for per app downloads Can you please specify that how much apple pays per app downloads.
I want to know that how much amount apple pays for app download/device.
I know, it's not a programming related question, but I don't know where to ask it. I posted a question on the Apple support forum, but got no reply.
Thanks in advance for your reply!

A: It depends on the price of your app.
For each sale, Apple charges a 30% tax on the price paid by the user.


text:
Q: ERROR-org.hibernate.type.SerializationException: could not deserialize I'm new to spring hybernate.
    I got the following exception.
could anyone can help....
org.hibernate.type.SerializationException: could not deserialize
    at org.hibernate.internal.util.SerializationHelper.doDeserialize(SerializationHelper.java:262)
    at org.hibernate.internal.util.SerializationHelper.deserialize(SerializationHelper.java:306)
    at org.hibernate.type.descriptor.java.SerializableTypeDescriptor.fromBytes(SerializableTypeDescriptor.java:155)
    at org.hibernate.type.descriptor.java.SerializableTypeDescriptor.wrap(SerializableTypeDescriptor.java:130)
    at org.hibernate.type.descriptor.java.SerializableTypeDescriptor.wrap(SerializableTypeDescriptor.java:44)
    at org.hibernate.type.descriptor.sql.VarbinaryTypeDescriptor$2.doExtract(VarbinaryTypeDescriptor.java:71)
    at org.hibernate.type.descriptor.sql.BasicExtractor.extract(BasicExtractor.java:64)
    at org.hibernate.type.AbstractStandardBasicType.nullSafeGet(AbstractStandardBasicType.java:267)
    at org.hibernate.type.AbstractStandardBasicType.nullSafeGet(AbstractStandardBasicType.java:263)
    at org.hibernate.type.AbstractStandardBasicType.nullSafeGet(AbstractStandardBasicType.java:253)
    at org.hibernate.type.AbstractStandardBasicType.hydrate(AbstractStandardBasicType.java:338)
    at org.hibernate.loader.Loader.extractKeysFromResultSet(Loader.java:785)
    at org.hibernate.loader.Loader.getRowFromResultSet(Loader.java:721)
    at org.hibernate.loader.Loader.processResultSet(Loader.java:953)
    at org.hibernate.loader.Loader.doQuery(Loader.java:921)
    at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:355)
    at org.hibernate.loader.Loader.doList(Loader.java:2554)
    at org.hibernate.loader.Loader.doList(Loader.java:2540)
    at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2370)
    at org.hibernate.loader.Loader.list(Loader.java:2365)
    at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:497)

Here is the model class
    DashModel.java
@Entity
@Table(name = "VIEW_GENERAL_SALES_DASHBOARD")
@DynamicUpdate(true)

public class DashModel implements Serializable  {

    private static final long serialVersionUID = -3465813074586302847L;

    public DashModel() {
        System.out.println("VIEW_GENSALES_DASH....");
    }

    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    @Column
    private Integer VIEW_ROW;

    public Integer getVIEW_ROW() {
        return VIEW_ROW;
    }

    public void setVIEW_ROW(Integer vIEW_ROW) {
        VIEW_ROW = vIEW_ROW;
    }

    @Column
    private String VIEW_CLASS;

    @Column
    private String VIEW_ZONE;

    @Column
    private double VIEW_GWP;

    @Column
    private double VIEW_TARGET;

    @Column
    private double VIEW_VARIANCE;

    @Column
    private double VIEW_ACHIEVEMENT;

    public String getVIEW_CLASS() {
        return VIEW_CLASS;
    }

    public void setVIEW_CLASS(String vIEW_CLASS) {
        VIEW_CLASS = vIEW_CLASS;
    }

    public String getVIEW_ZONE() {
        return VIEW_ZONE;
    }

    public void setVIEW_ZONE(String vIEW_ZONE) {
        VIEW_ZONE = vIEW_ZONE;
    }

    public double getVIEW_GWP() {
        return VIEW_GWP;
    }

    public void setVIEW_GWP(double vIEW_GWP) {
        VIEW_GWP = vIEW_GWP;
    }

    public double getVIEW_TARGET() {
        return VIEW_TARGET;
    }

    public void setVIEW_TARGET(double vIEW_TARGET) {
        VIEW_TARGET = vIEW_TARGET;
    }

    public double getVIEW_VARIANCE() {
        return VIEW_VARIANCE;
    }

    public void setVIEW_VARIANCE(double vIEW_VARIANCE) {
        VIEW_VARIANCE = vIEW_VARIANCE;
    }

    public double getVIEW_ACHIEVEMENT() {
        return VIEW_ACHIEVEMENT;
    }

    public void setVIEW_ACHIEVEMENT(double vIEW_ACHIEVEMENT) {
        VIEW_ACHIEVEMENT = vIEW_ACHIEVEMENT;
    }

}

Here is the dao class
    DashDao.java
@Repository
public class DashDao {

     Connection con;
        Statement st;
        ResultSet rs;

    @Autowired
     private SessionFactory sessionFactory;

     public void setSessionFactory(SessionFactory sf) {
      this.sessionFactory = sf;
      System.out.println("setSessionFactory ()");
     }

     public DashDao() {
            System.out.println("Dash dao ()");
        }

     //this code is to load all the companies
     public List<DashModel> getAllCompany() {

         List<DashModel> companees = null;
         //Session session = sessionFactory.openSession();
         Session session = sessionFactory.getCurrentSession();
         org.hibernate.Transaction tx = null;

         try {

                System.out.println("connect ");

                    tx = session.beginTransaction();
                    companees= session.createQuery("from DashModel").list();

                     tx.commit();

                } catch (Exception e) {

                    System.out.println("Error ");
                    e.printStackTrace();
                    JOptionPane.showMessageDialog(null, e);
                    return null;
                }

        return companees;
 }

}

Here is service DashService.java
@Service("dashservice")

public class DashService {

    @Autowired
    DashDao dashdao;

    public DashService() {
        System.out.println("Dash service()");
    }

    @Transactional
     public List<DashModel> getAllCompany(){

     return(dashdao.getAllCompany());

     }

}

Here is my controller class
    DashController.java
@Controller
public class DashController {

    @Autowired
    DashService dashservice;

    private static final Logger logger = Logger
            .getLogger(DashController.class);

    public DashController() {
        System.out.println("Dash Controller()");
    }

    @RequestMapping(value = "/", method = RequestMethod.GET)
    public ModelAndView listPersonsre(Model model, HttpSession session, HttpServletRequest request) {
        System.out.println("I am hear in / request");
        ModelAndView md = null;
        md= new ModelAndView("dashboard");
    return md;
    }

    // this code is to retrive all companys.
        @RequestMapping(value = "/companylist", method = RequestMethod.POST, produces = "application/json")
        public @ResponseBody List<DashModel> companyList(@ModelAttribute @Valid DashModel company, BindingResult result,
                ModelAndView model) {
            System.out.println("company List");
            List<DashModel> companyList = new ArrayList<DashModel>();

            return dashservice.getAllCompany();
        }

}

And this is my database view
CREATE OR REPLACE VIEW VIEW_GENERAL_SALES_DASHBOARD ( VIEW_ROW,
VIEW_CLASS, VIEW_ZONE, VIEW_GWP, VIEW_TARGET,
VIEW_VARIANCE, VIEW_ACHIEVEMENT, VIEW_GROWTH )

There's no primary key in this view.thats why i create a ROWNUM to the view.
I hope in your help and suggestions!
thanks....


text:
Q: Intel® TinyCrypt: how to use AES-128/CTR I need to do AES-128/CTR encryption/decryption using Intel TinyCrypt (written in C). I took a look at the test case provided by the library, but still have a few questions on how to use it. Here's the code of the test case (see the complete source code here):
/*
 * NIST SP 800-38a CTR Test for encryption and decryption.
 */
uint32_t test_1_and_2(void)
{
    const uint8_t key[16] = {
        0x2b, 0x7e, 0x15, 0x16, 0x28, 0xae, 0xd2, 0xa6, 0xab, 0xf7, 0x15, 0x88,
        0x09, 0xcf, 0x4f, 0x3c
    };
    uint8_t ctr[16] = {
        0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8, 0xf9, 0xfa, 0xfb,
        0xfc, 0xfd, 0xfe, 0xff
    };
    const uint8_t plaintext[64] = {
        0x6b, 0xc1, 0xbe, 0xe2, 0x2e, 0x40, 0x9f, 0x96, 0xe9, 0x3d, 0x7e, 0x11,
        0x73, 0x93, 0x17, 0x2a, 0xae, 0x2d, 0x8a, 0x57, 0x1e, 0x03, 0xac, 0x9c,
        0x9e, 0xb7, 0x6f, 0xac, 0x45, 0xaf, 0x8e, 0x51, 0x30, 0xc8, 0x1c, 0x46,
        0xa3, 0x5c, 0xe4, 0x11, 0xe5, 0xfb, 0xc1, 0x19, 0x1a, 0x0a, 0x52, 0xef,
        0xf6, 0x9f, 0x24, 0x45, 0xdf, 0x4f, 0x9b, 0x17, 0xad, 0x2b, 0x41, 0x7b,
        0xe6, 0x6c, 0x37, 0x10
    };
    const uint8_t ciphertext[80] = {
        0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8, 0xf9, 0xfa, 0xfb,
        0xfc, 0xfd, 0xfe, 0xff, 0x87, 0x4d, 0x61, 0x91, 0xb6, 0x20, 0xe3, 0x26,
        0x1b, 0xef, 0x68, 0x64, 0x99, 0x0d, 0xb6, 0xce, 0x98, 0x06, 0xf6, 0x6b,
        0x79, 0x70, 0xfd, 0xff, 0x86, 0x17, 0x18, 0x7b, 0xb9, 0xff, 0xfd, 0xff,
        0x5a, 0xe4, 0xdf, 0x3e, 0xdb, 0xd5, 0xd3, 0x5e, 0x5b, 0x4f, 0x09, 0x02,
        0x0d, 0xb0, 0x3e, 0xab, 0x1e, 0x03, 0x1d, 0xda, 0x2f, 0xbe, 0x03, 0xd1,
        0x79, 0x21, 0x70, 0xa0, 0xf3, 0x00, 0x9c, 0xee
    };
    struct tc_aes_key_sched_struct sched;
    uint8_t out[80];
    uint8_t decrypted[64];
    uint32_t result = TC_PASS;

    TC_PRINT("CTR test #1 (encryption SP 800-38a tests):\n");
    (void)tc_aes128_set_encrypt_key(&sched, key);

    (void)memcpy(out, ctr, sizeof(ctr));
    if (tc_ctr_mode(&out[TC_AES_BLOCK_SIZE], sizeof(plaintext),
            plaintext, sizeof(plaintext), ctr, &sched) == 0) {
        TC_ERROR("CTR test #1 (encryption SP 800-38a tests) failed in %s.\n", __func__);
        result = TC_FAIL;
        goto exitTest1;
    }

    result = check_result(1, ciphertext, sizeof(out), out, sizeof(out));
    TC_END_RESULT(result);

    TC_PRINT("CTR test #2 (decryption SP 800-38a tests):\n");
    (void) memcpy(ctr, out, sizeof(ctr));
    if (tc_ctr_mode(decrypted, sizeof(decrypted), &out[TC_AES_BLOCK_SIZE],
            sizeof(decrypted), ctr, &sched) == 0) {
        TC_ERROR("CTR test #2 (decryption SP 800-38a tests) failed in %s.\n", __func__);
        result = TC_FAIL;
        goto exitTest1;
    }

    result = check_result(2, plaintext, sizeof(plaintext),
            decrypted, sizeof(plaintext));

exitTest1:
    TC_END_RESULT(result);
    return result;
}

My input data is a double pointer (2D array) and I'd like to keep it that way:
uint8_t ** mydata = gen_rand_data(const size_t height, const size_t length);

Here's my understanding (correct me if I'm wrong):

*

*AES-128 is a block cipher, with 128-bit key.

*CTR mode makes the AES-128 a stream cipher and lets encrypt/decrypt data with arbitrary size.

*Having AES-128/CTR, the output (ciphertext) has the same length as plaintext.

*To improve the security, it's better to use 128-bit IV (nonce) for encryption.

Now here's my questions:

*

*Can I say ctr (initial counter, right?) is our IV?

*Why the ciphertext (expected value) and out (calculated value) are 128-bit bigger than plaintext?

*Why the code copies ctr value in the beginning of out?

*To encrypt mydata (2D array), I just need to loop over it and simple feed bytes from mydata to tc_ctr_mode, regardless of the dimension of mydata. Is this correct?

Thanks in advance.

A: *

*The counter is generally supplied as the iv parameter if there is no specific counter parameter.

*The output is 16-bytes longer because the counter is prepended, the counter is block sized and AES has a 16-byte block size..

*The counter value is not secret and is needed for decryption. Since the same key/counter combination can never be reused if the key is going to be reused (a common situation) the counter must be unique and thus not pre-shared. The general answer is to pre-pend the counter value to the encrypted data.

*Yes providing the decryption end knows a priori the array dimensions. But is is probably better to use some form of marshaling to preserve the array shape.


text:
Q: Can i get multiple VMs on the same monitor without changing the resolution of the VM displays? Was wondering if anyone knew how to get 3-4 virtual machines to share the same monitor (i.e. so that I could potentially get all 4 displays on one screen, each screen environment would need to maintain its 1280x1024 internal resolution (so scale I guess?) anyways if you could help it would be greatly appreciated. I'm new to VMWare so please be gentle :-P

A: Have you tried access with scaled VNC access?
For each VM, allow VNC access, on the host, use the VNC client, force scaling of the video.

A: If you are using WMware Workstation you can show each virtual machine at separate window.
Other possibility is remote desktop, but this depends, which operation system do you use in virtual machines and on the host system.
Virtual Machines
Windows - Remote Desktop - best performance nad user experience.
Linux/Unix - VNC (lightVNC, RealVNC), if you using some window system
Linux/Unix - putty or something like that, if you using console in virtual system


text: Q: Indecomposble Direct Summand of Nilpotent Endomorphism of Quiver Representation I was reading the proof of Gabriel's Theorem (Theorem 8.12) from Ralf Schiffler's 'Quiver Representations'. The proof begins by showing that for an indecomposable module $M$, the vector space $Hom(M,M) \cong k$ (where $k$ is the underlying field) by inducting on the dimension of $M$. In the induction step, he considers an arbitrary indecomposable quiver representation $M$, assuming the result to be true for all indecomposable representations of dimension less than that of $M$. Assuming for the sake of contradiction that $End(M) \not\cong k$, the indecomposability of $M$ implies that every endomorphism of $M$ is of the form $\lambda id_M + g$ for some nilpotent endomorphism $g$ and some $\lambda \in k$, so our assumption implies that there is some $f := \lambda id_M + g \in End(M)$, and by passing to a higher power of $g$ if necessary we may assume (without loss of generality) that the least exponent $m \in \mathbb{N}$ for which $g^m$ is identically zero is $m=2$. Moreover among all nonzero endomorphisms of $M$ whose square is zero we may choose the one with $dim$ $im$ $g$ minimal. Then $g^2 = 0 \neq g$ so that $im$ $g \subset ker$ $g$, and this is where he says, "and hence there exists an indecomposable summand $L$ of $ker$ $g$ such that $im$ $g \cap L$ is nonzero". Unfortunately it is not obvious to me why the last statement (in quotes) follows immediately from previous arguments. [It seems to me that the minimality in the dimension of $im$ $g$ (besides the fact that $g \neq 0 = g^2$) will be probably used somewhere, but I don't exactly see where.]


text:
Q: getting an error "p5practice.js:97 Uncaught TypeError: Cannot read property 'y' of undefined" I was working on the paddle part of my code and was fixing other errors and after it was fixed, it gave me this error "p5practice.js:97 Uncaught TypeError: Cannot read property 'y' of undefined" Also, if that error can be fixed, how do I properly get my paddle to work? I've looked at several other pong like examples and have had no luck with mine working.

//variables
var canvas;
var ctx;
var w;
var h;
var ball;
var paddle;
var score1;

//ball object
var BALL = function(x, y) {
    this.x = x;
    this.y = y;
    this.color = "white";
    this.radius = 12;
    this.vx = 3;
    this.vy = -3;
};

//paddle 1
var PADDLE = function(x, y) {
    this.x = 10;
    this.y = h/2 - 50;
    this.color = "white";
    this.width = 5;
    this.height = 100;

};

window.addEventListener("keydown", movePaddle);
//keydown event

    //down
function movePaddle(e) {

        switch (event.keyCode){
          case 38: //up
          console.log(paddle.y)
          if (paddle.y - 30 >= -10) {
            paddle.y -= 30;
          }
          break;
          case 40: // down
          console.log(paddle.y)
          if (paddle.y + 30 < 305) {
            paddle.y += 30;
          }
          break;
        }
      }

//DOM load
window.onload = function() {
    canvas = document.getElementById('canvas');
    w = canvas.width;
    h = canvas.height;
    ctx = canvas.getContext('2d');
    ball = new BALL (w/2, h/2);
    paddle = new PADDLE(w-100, h/2);
    drawScore();
    startGame();
    movePaddle();

};
function startGame() {
    requestAnimationFrame(startGame);
    ctx.clearRect(0, 0, w, h);
    ball.x += ball.vx;
    ball.y += ball.vy;

    ctx.fillStyle = ball.color;
    ctx.beginPath();
    ctx.arc(ball.x, ball.y, ball.radius, 0, 2*Math.PI, true);
    ctx.closePath();
    ctx.save();
    ctx.fill();
    ctx.restore();
    ctx.fillStyle = paddle.color;
    ctx.beginPath();
    ctx.save();
    ctx.shadowBlur = 20;
    ctx.shadowOffsetX = 4;
    ctx.shadowOffsetY = 4;
    ctx.shadowColor = "red";
    ctx.fillRect(paddle.x, paddle.y, paddle.width, paddle.height);
    ctx.closePath();
    ctx.restore();
}
//collision with walls
//https://www.khanacademy.org/computer-programming/paddle-ball/830543654

//bottom
if(ball.y >= 390) {
    ball.vy = -ball.vy;
    console.log("bottom hit");
}
//top
if(ball.y <= 10) {
    ball.vy = -ball.vy;
    console.log("top hit");
}

//right
if (ball.x >= 590){
     ball.vx = -ball.vx;
     console.log("right hit");
}
//left
if(ball.x <= 10){
    score++;
    ball.x = w/2;
    ball.y = h/2;
    console.log("left hit");
}

//collision with paddle
if(ball.x<15){
    if(ball.y>paddle.y && ball.y<paddle.y + paddle.height){
        ball.vy = -ball.vy;
        console.log("paddle");
    }
}

//reset
//https://bl.ocks.org/ruffrey/1e242222aebbcd102a53

//not finished
function reset(){
    ball.x;
    ball.y;
}

//score
var score = 0;

function drawScore(){
    ctx.font ="16px Arial";
    ctx.fillStyle ="#0095DD";
    ctx.fillText("Score: "+score,w/2, 20);

}

var leftScore = this.x > 10;
    if (leftScore){
        playerCount.score++;
    }
    this.reset();
canvas {
   border: 3px solid yellow;
   background-color: black;
  }
<!doctype html>
<html>
    <head>
        <title>Pong</title>
        <script src="p5practice.js"></script>
        <link rel= 'stylesheet' href="p5practice.css">
    </head>
    <body>
        <canvas id="canvas" width="600" height="400"></canvas>
        </script>
    </body>
</html>

A: You need to move your if statements at the bottom into the onload or startGame function. They are running before the variable ball is getting initialized. So you are getting the error that is saying ball is undefined
You will also need to move this or it will complain about x:
var leftScore = this.x > 10;

//variables
var canvas;
var ctx;
var w;
var h;
var ball;
var paddle;
var score1;

//ball object
var BALL = function(x, y) {
  this.x = x;
  this.y = y;
  this.color = "white";
  this.radius = 12;
  this.vx = 3;
  this.vy = -3;
};

//paddle 1
var PADDLE = function(x, y) {
  this.x = 10;
  this.y = h / 2 - 50;
  this.color = "white";
  this.width = 5;
  this.height = 100;

};

window.addEventListener("keydown", movePaddle);
//keydown event

//down
function movePaddle(e) {

  switch (event.keyCode) {
    case 38: //up
      console.log(paddle.y)
      if (paddle.y - 30 >= -10) {
        paddle.y -= 30;
      }
      break;
    case 40: // down
      console.log(paddle.y)
      if (paddle.y + 30 < 305) {
        paddle.y += 30;
      }
      break;
  }
}

//DOM load
window.onload = function() {
  canvas = document.getElementById('canvas');
  w = canvas.width;
  h = canvas.height;
  ctx = canvas.getContext('2d');
  ball = new BALL(w / 2, h / 2);
  paddle = new PADDLE(w - 100, h / 2);
  drawScore();
  startGame();
  movePaddle();

  //bottom
  if (ball.y >= 390) {
    ball.vy = -ball.vy;
    console.log("bottom hit");
  }
  //top
  if (ball.y <= 10) {
    ball.vy = -ball.vy;
    console.log("top hit");
  }

  //right
  if (ball.x >= 590) {
    ball.vx = -ball.vx;
    console.log("right hit");
  }
  //left
  if (ball.x <= 10) {
    score++;
    ball.x = w / 2;
    ball.y = h / 2;
    console.log("left hit");
  }

  //collision with paddle
  if (ball.x < 15) {
    if (ball.y > paddle.y && ball.y < paddle.y + paddle.height) {
      ball.vy = -ball.vy;
      console.log("paddle");
    }
  }
};

function startGame() {
  requestAnimationFrame(startGame);
  ctx.clearRect(0, 0, w, h);
  ball.x += ball.vx;
  ball.y += ball.vy;

  ctx.fillStyle = ball.color;
  ctx.beginPath();
  ctx.arc(ball.x, ball.y, ball.radius, 0, 2 * Math.PI, true);
  ctx.closePath();
  ctx.save();
  ctx.fill();
  ctx.restore();
  ctx.fillStyle = paddle.color;
  ctx.beginPath();
  ctx.save();
  ctx.shadowBlur = 20;
  ctx.shadowOffsetX = 4;
  ctx.shadowOffsetY = 4;
  ctx.shadowColor = "red";
  ctx.fillRect(paddle.x, paddle.y, paddle.width, paddle.height);
  ctx.closePath();
  ctx.restore();
}
//collision with walls
//https://www.khanacademy.org/computer-programming/paddle-ball/830543654

//reset
//https://bl.ocks.org/ruffrey/1e242222aebbcd102a53

//not finished
function reset() {
  ball.x;
  ball.y;
}

//score
var score = 0;

function drawScore() {
  ctx.font = "16px Arial";
  ctx.fillStyle = "#0095DD";
  ctx.fillText("Score: " + score, w / 2, 20);

  var leftScore = this.x > 10;
  if (leftScore) {
    playerCount.score++;
  }
  this.reset();
}
canvas {
  border: 3px solid yellow;
  background-color: black;
}
<!doctype html>
<html>

<head>
  <title>Pong</title>
  <script src="p5practice.js"></script>
  <link rel='stylesheet' href="p5practice.css">
</head>

<body>
  <canvas id="canvas" width="600" height="400"></canvas>
  </script>
</body>

</html>


text:
Q: CSS positioning - Looks right but performs funny The website is located: http://www.imvu-e.com/products/sro/
the css file here: http://www.imvu-e.com/files/style.css
I like where the download div and logo div is located, but for some reason the text on the webpage is following some weird box that firebug won't inspect correctly (like download div is somewhere its not). I am pretty sure its related to my poorly coded css where the content div has no float, the logo has float:right and then then download div has clear:right florat:right and then I use top: to position in line with the logo.  Both the logo and download bar also is "positioned" with margins...lol. I hate css.

A: It's your poor CSS. You've got top: -70px; on #download, which moves that up to the same height as #logo, but the text wrapping ignores that.

A: Your problem relates to the 'clear:right; position:relative; top:-xxx;' of the "Download" image.... as you are moving this image up by hand, the space you're seeing after the "Silent Room Observer" line, is where the "Download" image would go if you take out the 'relative';
scotts solution should work... remember that when your css class get to complex and convoluted... it usually is and there's a better/easier way of doing it :)

A: This should get you in the general direction of what you want:
1) Move your h1 in your source to be before your floated "download" and "logo".
2) Remove the clear: right and top: -70px on "download" and change margin-right to about 30px
3) Set margin-top: -30px (or so) for "logo"


text:
Q: Adding incentive for editing Not saying you should get rep for editing other people's posts but allow for some mechanism to encourage people to clean up questions (and answers if needed)
Some ideas to start the discussion:

*

*Edit counter on your profile page (and being able to sort users by edit counts)

*Being able to vote up edits (and have a separate edit reputation from your regular rep)

*More badges for editing

I think it's good for the Stack Overflow system as a whole not to be dependent on a few active editors. Since what happens if they go away or refuse to edit for some reason.

A: I think there is already sufficient encouragement to get people to edit posts.

*

*People edit because they earned that ability (sufficient reputation to allow editing).

*There is a badge awarded for editing a certain number of post.

*Recognition - The post is marked as "edited" and tagged with their name.

*Some people just find an intrinsic reward by helping out and adding to the site.

There are currently over 1,800 people with "editor" status on StackOverflow. I just feel that the developers have struck a good balance... a sufficient incentive to provide an appropropriate amount of editing. I would hate to see an "over-incentive" for people to over-zealously mangle other people's posts. The overall quality of posts I see here is uncharacteristically high.

A: I like the idea of more badges and I love the idea of an edit count (limit one per question/answer).  I wouldn't mind seeing an 'edit' stats page like we now have for tags.
The idea of upvoting an edit is an interesting one.  I think the majority of edits would go unappreciated, but I've seen many poorly-worded (and sometimes just plain poor) questions get salvaged by a good editor.

A: I would like to editors share in the reputation if they edit a significant portion of the answer.  I have seen a few cases were someone just posts a link in the answer, but someone else comes along and pulls in relevant quotes from the link and summarizes the information.  On SF, there was one where someone also added screenshots and translated information off of the link to English.
In cases like that, it seems odd that the original poster gains the reputation for the edits.

A: IMHO, editing is often its own reward.
However, we could perhaps do more to discourage the abuse sometimes directed at editors by those with an overactive sense of ownership.
Perhaps a more subtle indication of the editor in the post itself, combined with a separate "recognition" page highlighting those who've contributed heavily in the past week/month...?

A: I understand the impetus behind this however I must warn you of the flak you are about to receive by haters of the Editors Guild that lives deep in StackOverflow. I am talking about the 3 or 4 users who have itchy "edit" button fingers who wrack up dozens of "edited by ..." credits within minutes of a post by changing tiny things.
These people are necessary as they keep posts fairly clean. Their rewards are intrinsic and they do not require more motivation. Its a minor miracle that they haven't been banned outright because of their over zealous meddling.
update
In response to @Ólafur Waage's update to his question, I don't think more people need to be incentivised to edit posts. I think even without the current crop of editors the most egregious errors will be corrected in due course.

A: While not everyone feels this way, there is a significant number of people who simply love to edit. I am not sure we need to encourage even more people to do so.


text:
Q: Can't edit CSS Style with double click in chorme Dev tools I'm learning CSS from the news site with chrome,but when I inspect the element with Dev tools,I found it uneditable.

And this is the site:
https://www.nytimes.com/2020/12/06/science/space/jupiter-saturn-align-christmas-star.html
It shows in Dev Tools that class css-mcm29f is editable,but I can't edit it with double click,is there any trick to achieve this?

A: You don't need to double click. Simply click once on the right side of the following CSS selector.
element.style = { // click here only once and add your CSS properties to see the behaviour.
}

Clicking twice again sets it back to default condition.


text:
Q: MVC 4 Form Issue missing form method On an edit page for users I have a block to allow me or other admins to edit a users role. This is the code in the edit.cshtml

                    @foreach (var role in roles)
                    {

                    @using (Html.BeginForm("UserInRole", "Member"))
                    {
                      <input type="hidden" value = "@user"  name="username" />
                      <input type="hidden" value= "@role" name="rolename" />
                      <input type="hidden" value="@id" name="id" />
                      <input type="checkbox" name="ischecked" onclick="this.form.submit();" value="true" checked="@System.Web.Security.Roles.IsUserInRole(@Model.PrimaryEmail, role)" />
                    }

                    }

When the page displays I get the following result when looking at it with Firebug:

<input type="hidden" name="username" value="cxxxx.xxxxxxxn@xxxxxxxxxx.com">
<input type="hidden" name="rolename" value="Admin">
<input type="hidden" name="id" value="365">
<input type="checkbox" value="true" onclick="this.form.submit();" name="ischecked">

<form method="post" action="/Member/UserInRole" novalidate="novalidate">
<input type="hidden" name="username" value="xxxx.xxxxx@xxxxxxxxxx.com">
<input type="hidden" name="rolename" value="MediaAdmin">
<input type="hidden" name="id" value="365">
<input type="checkbox" value="true" onclick="this.form.submit();" name="ischecked">
</form>

Notice the form tag missing from the first
Not understanding why this is happening.


text:
Q: Modular arithmetics for two equatons I know the values of $x_1, x_2, y_1, y_2$ and I would like to calculate $a$ and $b$
How do I do it because I have to program the method.
$$\begin{align*}x_1\cdot a + b = y_1 \mod 26\\
x_2\cdot a + b = y_2 \mod 26\end{align*}$$

A: As Singhal says in his comment, to get $a,$ simply subtract the two congruences and multiply by $(x_1-x_2)^{-1}.$ (If the inverse doesn't exist, then there is no possible value of $a.$)
To get $b$ afterwards, you could either substitute the value of $a$ into one of the congruences and solve, or you could multiply the first congruence by $x_2,$ the second by $x_1,$ and subtract.
It's really like a normal system of equations, just with modular inverses instead of division.


text:
Q: How to get all the view controllers that is included within a tab bar controller? Iphone dev I am trying to switch between two different tab bar item setups. When I go into a detailedView a want another set of tab bar items. And when I go back, i want to reset it again. So far so good.
I want to load the new setup of tab bars from a nib file, and thus have two different nib files including the view controllers I want to switch between.
And the plan is then to just set the new view controllers upon the tab bar controller object with setViewControllers.
The problem is that I am not able to fetch the view controllers from the nib file with the new setup (the nib file that is not loaded). The nib file containing the current setup of tab bar items is loaded and the viewcontrollers are fetched successfully.
How can I fetch the view controllers that is within my nib file?

A: Create an IBOutletCollection property in the object that will load the nib with the second set of view controllers. Set that object's class as the type of the file's owner, and then you'll be able to connect multiple view controllers in the nib to the file's owner's outlet. Your outlet collection property will be an array, so you'll be able to set the tab bar's viewControllers property to that array. Of course, you'll probably want to keep a reference to the tab bar controller's original set of view controllers so that you can swap back later if necessary.


text:
Q: Filter Left join sql I have this sql query :
SELECT Customer.IDCustomer, Customer.Name,
Sign.IdSign, Sign.Name, Sign.Delete
FROM Customer
LEFT JOIN  Sign_Customer ON Sign_Customer.IDCustomer=Customer.IDCustomer
     AND  ( SELECT CAST(CASE WHEN S_C.Delete=0 OR S_C.Delete is Null THEN 1 ELSE 0 END AS BIT )
            FROM Sign AS S_C
            WHERE S_C.IdSign=Sign_Customer.IdSign)=1
LEFT JOIN Sign ON Sign.IdSign=Sign_Customer.IdSign

ORDER BY Customer.Name

This query works fine, but I want to know if it exists another way to filter my first left join without use the SELECT CAST... condition.

Update
Sorry, I don't explain what I want in my result:

*

*All my customer without Sign

*All my customer whith enable Sign

A Customer with disable Sign doesn't appear or appear like a "without Sign" if no enable Sign exist for it.
Exemple:
my customer table
IDCustomer   | Name
1            | Customer 1
2            | Customer 2
3            | Customer 3
4            | Customer 4

Sign_Customer:
IDCustomer   | IdSign
1            | 1
3            | 2
3            | 3
3            | 5
4            | 4

Sign
IdSign       | Name         | Delete
1            | Sign1        | 0
2            | Sign2        | 1
3            | Sign3        | 0
4            | Sign4        | 1
5            | Sign5        | 0

Result
Customer.IDCustomer | Customer.Name  | Sign.IdSign | Sign.Name | Sign.Delete
1                   | Customer 1     | 1           | Sign1     | 0
2                   | Customer 2     | null        | null      | null
3                   | Customer 3     | 3           | Sign3     | 0
3                   | Customer 3     | 5           | Sign5     | 0
4                   | Customer 4     | null        | null      | null

A: SELECT Customer.IDCustomer, Customer.Name, Sign.IdSign, Sign.LibEnseigne, Sign.Delete
FROM Customer
LEFT JOIN  Sign_Customer ON Sign_Customer.IDCustomer=Customer.IDCustomer
LEFT JOIN Sign ON Sign.IdSign=Sign_Customer.IdSign
AND (S_C.Delete=0 OR S_C.Delete is Null)
ORDER BY TEnseigne.NomEnseigne, Customer.Name

A: How about the following?
   SELECT Customer.IDCustomer
        , Customer.Name
        , Sign.IdSign
        , Sign.Name
        , Sign.Delete
     FROM Customer
LEFT JOIN Sign_Customer
     JOIN Sign
       ON Sign_Customer.IdSign = Sign.IdSign
      AND Sign.Delete = 0
       ON Customer.IDCustomer = Sign_Customer.IDCustomer
 ORDER BY Customer.NAME;

A: I believe this meets your criteria:
SELECT Customer.IDCustomer, Customer.Name,
Sign.IdSign, Sign.Name, Sign.Delete
FROM Customer
LEFT JOIN (
  select Sign_Customer.*
  from Sign_Customer
  join Sign on S_C.IdSign=Sign_Customer.IdSign
  where isnull(S_C.Delete,0) = 0
) Sign_Customer ON Sign_Customer.IDCustomer=Customer.IDCustomer
LEFT JOIN Sign ON Sign.IdSign=Sign_Customer.IdSign
ORDER BY Customer.Name


text:
Q: How can I generate 3 different (unique) numbers in javascript? a question from a beginner.
So I've used

let myArray = [];

function randomNumbers(){
  for(let i = 0; i < 3; i++){
    if(Math.floor(Math.random()*10) !== myArray[i]){
      myArray.push(Math.floor(Math.random()*10));
    }
  }
}

randomNumbers()
console.log(myArray)

Code above gives me 3 random number as intended but sometimes it's giving me same number twice and in very rare occasion, same number 3 times.

A: When generating random numbers, there is always the chance of getting duplicates. However as you specifically require 3 random numbers, I'd suggest checking that each number you generate does not already exist in the array of numbers.
I can see you have somewhat attempted to ensure that the same number isn't added twice in a row, however as you call Math.random() twice, once in the if and once when you push the number, you will actually be generating a new number each time.
Try instead using .includes() to check if the number already exists in the array.
Something like this:

let myArray = [];

function randomNumbers() {
  for (let i = 0; i < 3; i++) {
    while (!myArray[i]) {
      let newRandomInt = Math.floor(Math.random() * 10);
      if (!myArray.includes(newRandomInt)) {
        myArray.push(newRandomInt)
      }
    }
  }
}

randomNumbers()
console.log(myArray)

A: here is array generate numbers without repeatition demo


text:
Q: how to use a single jquery to change a div's display property and animate I was making a page where i clicked a button and a full menu opens using the jquery animate command. Then when you click the cross picture, it closes again with the animate command. But the problem is that it's position is fixed and it contains numbers from 1-30. so when you hide the div, it hides but the numbers are still visible on the left side until or unless you have not changed it's display property to none
//this resets the size of div to 0
$(document).ready(function(){
$("#fullmenu").animate({
  height:'0%',
  width:'0%'
  });
  });
  //This opens the div
    $(document).ready(function(){
  $("#imgdot").click(function(){
  $("#fullmenu").animate({
height:'90%',
width:'90%',
    });
  });
});
 //This closes the div when the image cross is clicked
$(document).ready(function(){
  $("#cross").click(function(){
    $("#fullmenu").animate({
            height:'0%',
            width:'0%'
      });
   });
});

My question is how to change the display property to none and also animate the div at the same time is a single function

A: use this
$('#foo').fadeOut("slow", function(){
    var div = $("
test2
").hide();
    $(this).replaceWith(div);
    $('#foo').fadeIn("slow");
});

A: jQuerys animations often don't affect children of a div,
you can try this:
$("#fullmenu").animate({
        height:'0%',
        width:'0%'
}).children().hide();

A: Css can be changed as $("#divId").css('display','none');

$(document).ready(function(){

  $("#cross").click(function(){

    $("#fullmenu").animate({

            height:'0%',
            width:'0%'
      },complete:function(){

$("#fullmenu").css('display','none')
});
   });
});

That said, you could use :

$(document).ready(function(){

  $("#cross").click(function(){

    $("#fullmenu").slideUp();
   });


text:
Q: Copy-constructor undefined behaviour I wrote the following code:
#include <iostream>
using namespace std;

class A
{
    int i;
public:
    A(int ii = 0) : i(ii) {}
    A(const A& a)
    {
        i = a.i + 1;
        cout << i << endl;
    }
};

A f(A a)
{
    A a2 = a;
    return a2;
}

int main()
{
    A a1;
    A a2;
    a2 = f(a1);
    return 0;
}

compiling this with g++ (no additional flags, same result if I add the -O0 flag) and running results:
1
2

compiling in VS2010 pro resulted:
1
2
3

what's going on here?


text: Q: Is it possible maintain offline API documentation in tablet/iPad(android)? I would like to maintain JAVA API & Angular API in my tablet for convenience. is it possible with android 4.1.2 version? help me to find the way.


text:
Q: Tokenizer method in python without using NLTK New to python - I need some help figuring out how to write a tokenizer method in python without using any libraries like Nltk. How would I start? Thank you!

A: Depending on the complexity you can simply use the string split function.
# Words independent of sentences
words = raw_text.split(' ')

# Sentences and words
sentences = raw_text.split('. ')
words_in_sentences = [sentence.split(' ') for sentence in sentences]

If you want to do something more sophisticated you can use packages like re, which provides support for regular expressions. [Related question]

A: I assuming you are talking about a tokenizer for a compiler. Such tokens are usually definable by a regular language for which regular expressions/finite state automata are the natural solutions. An example:
import re
from collections import namedtuple

Token = namedtuple('Token', ['type','value'])

def lexer(text):

    IDENTIFIER = r'(?P<IDENTIFIER>[a-zA-Z_][a-zA-Z_0-9]*)'
    ASSIGNMENT = r'(?P<ASSIGNMENT>=)'
    NUMBER = r'(?P<NUMBER>\d+)'
    MULTIPLIER_OPERATOR = r'(?P<MULTIPLIER_OPERATOR>[*/])'
    ADDING_OPERATOR = r'(?P<ADDING_OPERATOR>[+-])'
    WHITESPACE = r'(?P<WHITESPACE>\s+)'
    EOF = r'(?P<EOF>\Z)'
    ERROR = r'(?P<ERROR>.)' # catch everything else, which is an error

    tokenizer = re.compile('|'.join([IDENTIFIER, ASSIGNMENT, NUMBER, MULTIPLIER_OPERATOR, ADDING_OPERATOR, WHITESPACE, EOF, ERROR]))
    seen_error = False
    for m in tokenizer.finditer(text):
        if m.lastgroup != 'WHITESPACE': #ignore whitespace
            if m.lastgroup == 'ERROR':
                if not seen_error:
                    yield Token(m.lastgroup, m.group())
                    seen_error = True # scan until we find a non-error input
            else:
                yield Token(m.lastgroup, m.group())
                seen_error = False
        else:
            seen_error = False

for token in lexer('foo = x12 * y / z - 3'):
    print(token)

Prints:
Token(type='IDENTIFIER', value='foo')
Token(type='ASSIGNMENT', value='=')
Token(type='IDENTIFIER', value='x12')
Token(type='MULTIPLIER_OPERATOR', value='*')
Token(type='IDENTIFIER', value='y')
Token(type='MULTIPLIER_OPERATOR', value='/')
Token(type='IDENTIFIER', value='z')
Token(type='ADDING_OPERATOR', value='-')
Token(type='NUMBER', value='3')
Token(type='EOF', value='')

The above code defines each token such as IDENTIFIER, ASSIGNMENT, etc. as simple regular expressions and then combines them into a single regular expression pattern using the | operator and compiles the expression as variable tokenizer. It then uses the regular expression finditer method with the input text as its argument to create a "scanner" that tries to match successive input tokens against the tokenizer regular expression. As long as there are matches, Token instances consisting of type and value are yielded by the lexer generator function. In this example, WHITESPACE tokens are not yielded on the assumption that whitespace is to be ignored by the parser and only serves to separate other tokens.
There is a catchall ERROR token defined as the last token that will match a single character if none of the other token regular expressions match (a . is used for this, which will not match a newline character unless flag re.S is used, but there is no need to match a newline since the newline character is being matched by the WHITESPACE token regular expression and is therefor a "legal" match). Special code is added to prevent successive ERROR tokens being generated. In effect, the lexer generates an ERROR token and then throws away input until it can once again match a legal token.

A: use gensim instead.
tokenized_word = gensim.utils.simple_preprocess(str(sentences ), deacc=True) # deacc=True removes punctuations


text:
Q: retrieve data from a list of specific IDs in Firebase, follow user and only get their posts I have a list of users and they can each post events and follow each other, and when they do, the database will generate a feed object with userId object and a list of events they can see, like this:

Mo4JxyP4FCRtXYtNZAqs4EsLtTh2 and tq3bugOm5pRE2PxpmllKzUhKjty1 are User IDs, and -KIMxxx: true are the event posts.
In a separate events object, I have the details of the event stored there:
Currently, I retrieve all events in redux like this:
export const eventsFetch = () => {
  return (dispatch) => {
    firebase.database().ref(`/events/`)
      .on('value', snapshot => {
        dispatch({ type: EVENTS_FETCH_SUCCESS, payload: snapshot.val() });
      });
  };
};

How can I rewrite the method so it only retrieves data from the list of event IDs under a user's ID? I tried to do
firebase.database().ref(`/feed/${this.auth.currentUser.uid}`)

to get the object first, then use Object.keys() to get an array like so ["eventId1", "eventId2"], but now I'm stuck and not sure how to loop through all
firebase.database().ref(`/events/${eventId}`)

and dispatch all the data together like the mehtod above shown... not sure if I want to use .once('value) as I'd like to keep the list of events updated as the user unfollow/follow.
Bonus request, if it's possible, as you can see in events/${eventId}/timeAsDate, each event have a time,  I'd like to hide/not retrieve events that is in the past.
Thanks
UPDATE
thanks to Frank's answer, I finally got it working with the following code:
export const eventsFetch = () => {
  const { currentUser } = firebase.auth();

  return (dispatch) => {
    firebase.database().ref(`/feed/${currentUser.uid}`).on('value', snapshots => {
      const values = snapshots.val() || {};
      const entryIds = Object.keys(values);
      const promises = entryIds.map(
        eventId => firebase.database().ref(`/events/${eventId}`).once('value')
      );

      Promise.all(promises).then(results => {
        results.forEach(result => {
          values[result.key] = result.val();
        });
        dispatch({ type: EVENTS_FETCH_SUCCESS, payload: values });
      });
    });
  };
};

A: Something like this should do the trick:
export const eventsFetchForUser = (uid) => {
  return (dispatch) => {
    firebase.database().ref(`/feed/${uid}`)
      .on('value', snapshot => {
        var promises = [];
        snapshots.forEach((key) => {
          promises.push(
            firebase.database().ref(`/events/${key.key}`)).once('value')
          );
        });
        Promise.all(promises).then((snapshots) => {
          const values = snapshots.map(snapshot => snapshot.val));
          dispatch({ type: EVENTS_FETCH_SUCCESS, payload: values });
        });
      });
  };
};

So this first loads the keys from the user's feed, then loads each post by its key, and finally extracts the value of each post's snapshot before dispatching it all.
Note: I didn't run this, so typos are likely.


text:
Q: find a value in pascal triangle given row and column
How can I find a value from this pascal triangle given row and column number without calculating $^nC_r$?
For example, for row=$4$, column=$3$: value is $10$,
For row=$3$, column=$5$: value is $15$.
Is there any way to get this value without using $^nC_r$ explicitly?

A: I needed the following values modulo P (a prime):
$$^xC_1, ^{x+1}C_2, ^{x+2}C_3, ..., ^{x+y-1}C_y$$
where
$$0<x<10^{15}, 0<y<10^5, y\le x$$
Now you can consider each $^nC_r$  value as a fraction of numerator and denominator.
So $^xC_1$ = $\frac{x}{1}$, $^{x+1}C_2$ = $\frac{x.(x+1)}{1.2}$, $^{x+2}C_3$ = $\frac{x.(x+1).(x+2)}{1.2.3}$, ...
You can get modulo value of numerator and denominator separately.
Ultimately, $^nC_r = \frac{A}{B} \mod P = (A.B^{-1}) \mod P$ ......... (i)
Now, from Fermat's little theorem,
$$a^P \equiv a \mod P$$
$$a^{P-1} \equiv 1 \mod P$$
$$a^{P-2} \equiv a^{-1} \mod P$$
So we need $B^{P-2} \mod P$ in equation (i) which can be calculated by modular exponentiation
Gerry Myerson, can you edit this answer to format properly and add some details if you want?

A: ~~I'm editing in a note at the top of my response here, because defining row and column in the way that you have leads to a different sort of problem than what I have addressed. Apologies~~
~~The value you are looking for is (C+R-2)choose(R-1) where C and R are the row and column values in your examples.~~
The triangle diagram you have included is incorrectly labelled. The rows do not increase on the RHS in the same way that the columns increase on the LHS. Consider that the first row is the 0th row and the first column is the 0th column. So the 0th row has only 1 column. The 1st row has only 2 columns. The nth row has n+1 columns (because the first column of each row is the 0th column). That is, the rows go horizontally (starting from the top) and the columns go vertically (starting from the left); they are not angled as is shown in your diagram.
In your first example, the 3rd element on the 4th row has a value of 4, counting the row and column from 0. Using natural numbers, this would appear to be the 4th element of the 5th row.
In your second example, the 3rd row does not have a 5th column, and so the result of 15 is incorrect.
To answer your question, the best way to solve for any location in the triangle is by drawing it out or by calculating n!/r!(n-r)! Keep in mind that the row and column start at (0,0) and also that the triangle is horizontally symmetrical.
Here is my source for this answer: https://en.wikipedia.org/wiki/Binomial_coefficient


text:
Q: AJAX POST request returns 404 .NET 6 I have this issue:
I am using .NET 6 with MVC and I am making use of FullcalendarIo. I have a controller for making free slots in the calendar. This is the code in the controller:
 [Authorize(Roles = DoctorRoleName)]
 [HttpPost]
 [ValidateAntiForgeryToken]
 public async Task < ActionResult < AppointmentSlotInputModel >> GenerateSlots(AppointmentSlotInputModel model) {
     //await this.appointmentService.GenerateSlots(model.Start, model.End, model.SlotDurationMinutes);
     return Json("Hello");
 }

And this is my JS Code that makes the POST request
const params = {
    start: startDate,
    end: endDate,
    slotDurationMinutes: scale
};

const response = await fetch('/Appointment/GenerateSlots', {
    method: 'POST',
    headers: {
        'Content-Type': 'application/json',
        'RequestVerificationToken': document.getElementById("RequestVerificationToken").value
    },
    body: JSON.stringify(params)
});

In the network tab the request to /Appointment/GenerateSlots I get first code 302 - Redirect and then 404 Not Found. The request url seems correct - https://localhost:44376/Appointment/GenerateSlots.
f I change the method to GET and put the [HttpGet] attribute above the action in the controller I get the JSON result. In the Startup.cs I am using these:
    services.AddAntiforgery(options => {
        options.HeaderName = "X-CSRF-TOKEN";
    });

    services.Configure < CookiePolicyOptions > (options => {
        options.CheckConsentNeeded = context => true;
        options.MinimumSameSitePolicy = SameSiteMode.None;
    });

But event if I comment them out the result is the same - first 302 then 404. I have tried a lot of the code that is written here on the site for people with similar issues, but it hasn't helped. Where am I mistaking?
I am using standard routing:
app.UseEndpoints(endpoints => {
    endpoints.MapControllerRoute(
        name: "areas",
        pattern: "{area:exists}/{controller=Home}/{action=Index}/{id?}");

    endpoints.MapControllerRoute(
        name: "default",
        pattern: "{controller=Home}/{action=Index}/{id?}");
});

Edit: I have found a similar thread here - ASP.NET controller, AJAX GET works, but POST does not (404)
But this doesn't seem to be the case for me.

A: So I found a my solution. In my Startup.cs I have this code:
    services.AddAntiforgery(options =>
    {
        options.HeaderName = "X-CSRF-TOKEN";
    });

And the BadRequest from the Controller came because of the AntiForgeryToken validation. In my AJAX call my header for the AF Token was wrong: It was 'RequestVerificationToken', but it should have been 'X-CSRF-TOKEN' or the other way around. But still now I have the proper result and no more BadRequest.


text:
Q: Map an array to each item in another array? (Python) I'm trying to generate some predictable URL's for a crawler.
I have a set of base urls:
base_urls = ['http://something.com/john',
             'http://something.com/sally']

and each one has a unique url for their daily calendar:
to_append = ['-mon-calendar',
             '-tues-calendar',
             '-wed-calendar',
             '-thurs-calendar',
             '-fri-calendar']

I need to generate a new array containing a complete list of the all people's weekly calendars (e.g. 'http://something.com/john-mon-calendar',...
I could iterate through this the long way but assume it's possible to do it more efficiently with map(). I haven't used map much and doing it with two iterables is throwing me off. Could anyone point me in the right direction?

A: You can use itertools.product to create the Cartesian product between your lists, then join each item within a list comprehension.
>>> from itertools import product
>>> [''.join(i) for i in product(base_urls, to_append)]
['http://something.com/john-mon-calendar',
 'http://something.com/john-tues-calendar',
 'http://something.com/john-wed-calendar',
 'http://something.com/john-thurs-calendar',
 'http://something.com/john-fri-calendar',
 'http://something.com/sally-mon-calendar',
 'http://something.com/sally-tues-calendar',
 'http://something.com/sally-wed-calendar',
 'http://something.com/sally-thurs-calendar',
 'http://something.com/sally-fri-calendar']

A: No libraries:
links = [[url + day for day in to_append] for url in base_urls]
links_flattened = sum(links, [])


text:
Q: TypeError: Structtype 'int' -Pyspark in databricks I'm getting  TypeError: StructType can not accept object 3000 in type <class 'int'>
Code below. I can't see why 3000 can't be used as an integer? Am I doing something wrong?
import sys
from pyspark.sql.functions import *
from pyspark.sql.types import *
schema = StructType([StructField("pull_date",TimestampType(),True),StructField("Tot_Crdts",IntegerType(),True),StructField("Sum_Crdts",FloatType())])
data = [current_timestamp() , 3000, 1.00]

DFQuant = spark.createDataFrame(data, schema)

A: The data should be the list of 3-tuple. And the current_timestamp() function is not working outside of the dataframe, so I have changed to use the datetime package.
import sys
import datetime
from pyspark.sql.functions import *
from pyspark.sql.types import *

schema = StructType([
    StructField("pull_date", TimestampType(), True),
    StructField("Tot_Crdts", IntegerType(), True),
    StructField("Sum_Crdts", FloatType())
])
data = [(datetime.datetime.now(), 3000, 1.00)]

DFQuant = spark.createDataFrame(data, schema)
DFQuant.show(truncate=False)

+--------------------------+---------+---------+
|pull_date                 |Tot_Crdts|Sum_Crdts|
+--------------------------+---------+---------+
|2021-06-23 13:57:10.363901|3000     |1.0      |
+--------------------------+---------+---------+


text:
Q: Get dropdown value with Angular Reactive Forms I'm building a form with angular reactive forms. I can getting all my form value but platform entity's dropdown value.
Here's the .ts and .html files.
.html file

    Platform
    <select class="form-select" id="platformDropdown">
        <option selected>Choose...</option>
        <option *ngFor="let platform of platforms" [ngValue]="platform.id">{{ platform.name }}</option>
    </select>

.ts file
userAddForm: FormGroup;
platforms: Platform[];

constructor(private formBuilder: FormBuilder,
    private toastrService: ToastrService,
    private platformService: PlatformService) { }

ngOnInit(): void {
    this.createUserAddForm();
    this.getPlatforms();
}

createUserAddForm() {
    this.userAddForm = this.formBuilder.group({
      platformId: ["", Validators.required],
      username: ["", Validators.required],
      isFollowed: [false, Validators.required],
      isClosed: [false, Validators.required],
      lastControlDate: ["", Validators.required]
    });
}

getPlatforms() {
    this.platformService.getPlatforms()
        .subscribe(response => this.platforms = response.data);
}

add() {
    let userModel = Object.assign({}, this.userAddForm.value);
    console.log(userModel);
}

When I try to submit form and write data to console, platform id is getting just white space. How can I reach this value?

A: For the first look you just forgot bind control to the select
<select [formControl]="userAddForm.get('platformId')" class="form-select" id="platformDropdown">

or if you already binded formGroup then:
<select formControlName="platformId" class="form-select" id="platformDropdown">


text:
Q: Should programmers use STL or write their own code? I don't know much about C++ data structures but I am wondering do you (programmers) use STL or write your own code? After all STL is designed for doing tasks like searching, replacing and much more through a list of data.
Someone really don't need to learn much about the linked list, binary search and many more because I could use STL. What would you suggest?

A: A working knowledge of the underlying data structures, methods and applications of the tools provided by the STL will make you a much better programmer.  Knowing when to use what container type, or which algorithm is as important as a proper implementation.  Sometimes, the easiest way to understand some of the more complex concepts is to implement them yourself in the context of a data structures and algorithms class.
That said, the code in the STL has been written by experts and refined over time into a standard library that is used my millions of people world wide.  In practicality, there is almost never a reason to "roll your own" except for extreme cases where performance (or size) matter to a point that is critical for your exact application.

A: While the Standard Template Library is convenient when it comes to performing tasks as you mentioned like Searching, Replacing, using Linked Lists, it should not replace the knowledge of what is going on inside of the Library.
You mentioned not needing to learn about linked lists, binary searches and "many more", however you should have at least a working knowledge of how these Data Structures and procedures work as it will make using them (and knowing when to use them) much more effective.
Basically - you don't have to reinvent the wheel, but at least know what makes the wheels effectively turn.

A: I hesitate to write, since I haven't written C++ in 5 years.  But a couple of things came to mind that haven't been discussed yet.
If the implementation is a bad fit for what you need, don't use it if you can write and test your own easier than using the library.  I recently ran into this in Java, where I needed a fast bitset.  Details:: There are two relevant classes in the JVM (BitSet and BigInteger).  BitSet doesn't support initialization other than by setting one bit at a time; BigInteger has an irrelevant signum that confused things, and is immutable, which is costly in my case.  I ended up writing my own, with tests, in a few hours.  It fits better, is faster, and I can do whatever I want to it.
The other reason to write your own is if you don't understand the specification of the library implementation relative to your requirements, can't easily test it or read it to figure out what it does, and can easily roll your own.  This is/was a particular problem with STL implementations that are (or at least used to be) shipped with terse, inadequate, cryptic documentation and commentless, opaque source code that rolls over your head like a huge rogue wave.

A: Just to add my answer (from comment above):
Yes you should think about implementing e.g. a sequence, a linked list, using your own code.
This is what they teach on Comp Sci courses and it is not without good reason. But, if you're looking to work quickly then just use STL.
I just think people should understand how the tools really work.

A: You should use STL, because it is well tested and optimized.
That doesn't mean you shouldn't know how to write these data structures yourself. With that ability under your belt, you will be able to choose the best STL data structure for your application.

A: Use STL and standard libraries in general when you can. First it is probably way better tested than your own code, and second it helps keep your code portable. The only time you should rewrite any of this functionality is for learning purposes. It may be educational to write your own associative map or linked list, but for production code, stick with well tested and standard compliant code.

A: I use the C/C++ Standard library and STL because it is a really big time saver and I don't see the need to reinvent the wheel. I also use boost where I can.
It is still a good learning exercise to write your own container class and algorithms.

A: Use STL unless you have a compelling reason, e.g. speed or correctness, not to. Definitely know how to write basic data structures on your own.

A: In general you should use STL or Boost containers because of their effectiveness and reliability. Still you need to have a corresponding world view on existing containers. You should know its con and pros. Studying of the container internal structure and working principles allows you to reach better understanding.

A: STL is well tested and reliable but it is not the fastest solution. Some of the containers allocate a lot of small memory blocks rather than one big block. If you really have a speed problem then you may consider making your own fixed-size list. But for many purposes STL is the standard solution.

A: Very smart people wrote the STL.  Then more very smart people have used it, tested it, and refined it.  You think you are going to do better? Rarely.  It is a great tool; you should use it whenever possible!

A: Write low-level stuff yourself when learning/playing, but at work use code that was written and refined by experts over years, and has/is being tested by thousands of engineers in thousands of different conditions.
In other words, use your code only if your code can beat the other codes!


text:
Q: Adding a WCF service that accepts JSON, error on server I am taking over a project for someone who is no longer with the company, I am trying to add a WCF service that accepts and returns JSON to a project that already has a bunch of services that pass in data via the querystring and return JSON.  On my local machine it works in visual studio, moving it to the server I get an error:
Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.
Parser Error Message: The binding at system.serviceModel/bindings/webHttpBinding does not have a configured binding named 'jsonpBinding'. This is an invalid value for bindingConfiguration.
Any idea what is causing this?

A: You're missing the binding configuration on Web.Config.
Something like this:
<bindings>
    <webHttpBinding>
        <binding name="jsonpBinding" crossDomainScriptAccessEnabled="true" />
    </webHttpBinding>
</bindings>

Put this inside the <system.serviceModel> tag.


text:
Q: Emacs-Lisp lists, apostrophe ('), and backquote (grave accent, `) I'm an emacs newbie and was going through this tutorial: https://learnxinyminutes.com/docs/elisp/
I wrote this code:
(defun hello (name)
  (insert (format "Hello %s!\n" name)))

(setq list-of-names '("John", "Jane", "Chad")) ;; -1-

(mapcar `hello list-of-names) ;;-2-

and when I did C-xC-e at line 2 the result came out as:
Hello John!
Hello (, Jane)!
Hello (, Chad)!

So I looked up what apostrophe does and it's a short hand for quote.
    (setq list-of-names (quote("John", "Jane", "Chad"))) ;; -1-

and results are the same. But when I accidentally replaced apostrophe with a grave accent(`, or SHIFT + ~ in my keyboard) it printed out correctly.
Hello John!
Hello Jane!
Hello Chad!

I've spent an hour looking up what grave accent does but no luck so far. Does anyone know what grave accent means in emacs?
I'm using emacs-w32 with Korean/English keyboard.

A: ` is similar to ', but when you can use , to prefix symbols that won't be quoted. See "Backquote" in the Elisp manual.
Lists in lisp aren't comma separated.
(setq list-of-names `("John" "Jane" "Chad" ,(current-time-string)))
(mapcar 'hello list-of-names)


text:
Q: Fast growing function Aside from the power, gamma, exponential functions are there any other very fast growing functions in (semi-) regular use?

A: Tetration is a standard example.  Consider, for example, $f(n) = 2\uparrow\uparrow n$, so f(1) = 2, f(2) = $2^2$, f(3) = $2^{2^2}$, f(4) = $2^{2^{2^2}}$, etc.

A: It depends on what you mean by "in use"; the Busy Beaver function, which grows strictly faster than any sequence produceable by a Turing machine, is sometimes used in theoretical results in computability although only the first four terms are actually known. I'm not sure if it's the sort of thing you're looking for.

A: An upper bound in Szemerédi's regularity lemma grows pretty fast: it is "given by a $\log(1/\epsilon^5)$-level iterated exponential of $m$", and there's a lower bound by Gowers which is "a $\log(1/\epsilon)$-level iterated exponential of $m$".
Less spectacular is the upper bound in Szemerédi's theorem: $2^{2^{\delta^{-2^{2^{k+9}}}}}$.

A: Knuth's uparrow notation grows pretty fast.  Basically, it goes as follows:
$$a\uparrow b=a^b$$
$$a\uparrow\uparrow b=a^{a^{a^{\dots}}}\bigg\}b\text{ amount of }a's$$
$$a\uparrow\uparrow\uparrow b=\underbrace{a\uparrow\uparrow(a\uparrow\uparrow (\dots(a\uparrow\uparrow a)\dots))}_{b\text{ amount of }a's}$$
etc. you get the main idea.  It's use?  It's a good way to represent large numbers, the most famous of which is known as Graham's number, which is the upper bound to a problem in Ramsey theory:

Possibly just as famous as the above, we have the Ackermann function.  It's original usage was to show that not all total computable functions are primitive recursive, and it eventually built its way into things like Computability theory and computer science.
Within the realm of googology, one of the arguably most useful function is the fast growing hierarchy.  It is useful because its simple and it can easily be used to rank most functions.  For example, it is not only able to rank against addition, multiplication, and exponentiation, but it can easily extend further, providing non-trivial decent lower bounds to even the TREE sequence:
$$\text{TREE}(n)\ge f_{\vartheta(\Omega^\omega\omega)}(n)$$


text:
Q: Getting extra quote in query using codeigniter I am trying to select and join to other table but my query having extra quote unintentionally.
I use this code:
$this->db->select('TA.*, TC.username user FROM tbl_actlog AS TA');
$this->db->join('(SELECT id, username FROM tbl_login) AS TC', 'TC.id = TA.account_id', 'LEFT OUTER');
$this->db->where('TA.date_log >=', $start_date);
$this->db->where('TA.date_log <=', $end_date);

But when my code runs it gives me an error and the output is:
SELECT `TA`.*, `TC`.`username user FROM tbl_actlog` AS `TA`
LEFT OUTER JOIN (SELECT id, username FROM tbl_login) AS TC
ON `TC`.`id` = `TA`.`account_id`
WHERE `TA`.`date_log` >= '2019-12-10' AND `TA`.`date_log` <= '2019-12-10'
ORDER BY `TA`.`act_id` DESC LIMIT 10

MySQL said: Documentation

#1064 - You have an error in your SQL syntax;
check the manual that corresponds to your MariaDB server version for the
right syntax to use near 'LEFT OUTER JOIN (SELECT id, username FROM
tbl_login) AS TC ON `TC`.`id` = `TA`.`' at line 1

A: From what I understand the right query syntax should be:
$this->db->select('TA.*, TC.id, TC.username');
$this->db->from('tbl_actlog AS TA');
$this->db->join('tbl_login AS TC', 'TC.id = TA.account_id', 'LEFT OUTER');
$this->db->where('TA.date_log >=', $start_date);
$this->db->where('TA.date_log <=', $end_date);

A: You are not supposed to put the FROM inside your ->select() call. You can make a separate ->from($table_name) call or do ->get($table_name). See documentation.

A: try following code
    $this->db->select('TA.*, TC.username user, TC.id login_id');
    $this->db->from('tbl_actlog AS TA');
    $this->db->join('tbl_login as TC', 'TC.id = TA.account_id', 'LEFT');
    $this->db->where('TA.date_log >=', $start_date);
    $this->db->where('TA.date_log <=', $end_date);


text:
Q: Filter by month name I want to retrieve data on the basis of months. I want to get worksheet data between two months following is my query but it doesn't work fine.
SELECT  (CONVERT(varchar(3), DATENAME(month, w.ExpectedStartDate)) +  '-' +     CONVERT(VARCHAR(15), datepart(yyyy, w.ExpectedStartDate))) as MonthName

    FROM Worksheet w LEFT OUTER JOIN StatusType st ON st.StatusTypeId = w.StatusTypeId
    WHERE w.ProjectId = 20
    AND CONVERT(varchar(3), DATENAME(month, w.ExpectedStartDate)) between ('Jan')     AND ('Apr')

When i convert it to this:
SELECT  (CONVERT(varchar(3), DATENAME(month, w.ExpectedStartDate)) +  '-' +     CONVERT(VARCHAR(15), datepart(yyyy, w.ExpectedStartDate))) as MonthName

        FROM Worksheet w LEFT OUTER JOIN StatusType st ON st.StatusTypeId = w.StatusTypeId
        WHERE w.ProjectId = 20
        AND CONVERT(varchar(3), DATENAME(month, w.ExpectedStartDate)) between ('Jan')     AND ('Mar')

I have just changed ToMonth = Mar rather than Apr. then it shows me record which is correct because there is data for march. for April why it doesn't show any thing?
Please give your suggestion.
Thanks.

A: I imagine it doesn't like the fact you've used BETWEEN with strings; the string 'Apr' comes before the string 'Jan' so it doesn't work, but the string 'Mar' comes after the string 'Jan'.

A: You can use Month(w.ExpectedStartDate) between 1 AND 4

A: AND MONTH(w.ExpectedStartDate)>=1 AND MONTH(w.ExpectedStartDate)<=4

A: For accuracy use this code
w.ExpectedStartDate>='20110101' and ExpectedStartDate<'20110105'

A: If you need to do this query frequently, you could also investigate persisted computed columns - e.g. something like:
ALTER TABLE dbo.Worksheet
  ADD YearMonth AS
        RIGHT('0000' + CAST(YEAR(ExpectedStartDate) AS VARCHAR(4)), 4) +
        RIGHT('00' + CAST(MONTH(ExpectedStartDate) AS VARCHAR(2)), 2) PERSISTED

This will add a new column YearMonth to your table that is always up to date, always accurate, and it's persisted, e.g. stored on disk so it's fast, you can even put an index on that column!
That column will contains values such as
201103
201104

and so forth - the year (four digits) and month (two digits, leading zero) of your ExpectedStartDate
So to select all projects for January 2011, you can define:
 SELECT (list of columns)
 FROM dbo.Worksheet
 WHERE YearMonth = '201101'

and get exactly those rows very quickly - especially if you index this column.


text:
Q: Java exceptions and inner exceptions, am I doing this correctly? I'm validating a xml against a xsd, and I'm finding that there are many cases where exceptions have to be handled.
I believe these are called checked exceptions in java?
SchemaFactory sf = ....

Schema schema = sf.newSchema(...)    // SAXException has to be handled
Validator validator = ...

validator.validate(xmlFile);   // IOException has to be handled again

How should I be writing this code block?
Do I use try/catch nested inside a try/catch?

A: try {
  SchemaFactory sf = ....

  Schema schema = sf.newSchema(...)    // SAXException has to be handled
  Validator validator = ...

  validator.validate(xmlFile);   // IOException has to be handled again
} catch (SAXException e) {
    // handle SAX error
} catch (IOException e) {
    // handle IO error
}

A:
Do I use try/catch nested inside a try/catch?

IMO, no.
try {
    //...
} catch(SAXException e) {
    //handle SAXException
} catch(IOException e) {
    //handle IOException
}

I think the code looks cleaner like that than with nested try/catch.

How should I be writing this code block?

It depends on whether you need to handle the exception right there, in which case you use try/catch, or if need the caller to handle the exception, in which case you should propagate it to the caller by using the throws clause.
public void validateXml() throws SAXException, IOException {
    //...

A: Actually you are not supposed to handle checked exceptions if you don't have any recovery strategy.
Do you have another schema in case the one you use raise a Sax exception?
Do you have another validator in case the one you use raise an IO exception?
Any other recovery possible for these exceptions?
If you don't, you should probably wrap that exception inside a Runtime (unchecked) exception and let it be thrown to the top layer (where it will be catched). Eventually you can add an extra message in the wrapper class if needed to understand the problem.
Unless your program can work correctly without this sax schema (in this case you would catch Exception, to also be able to catch runtime exceptions), or your program have a recovery strategy, you are not supposed to catch an exception without rethrowing it.
If your recovery strategy fail, you can also wrap the recovery exception into an unchecked exception to let the top layer handle it (log + error 500 or something like that).
This is the principle of fail-fast.

Note that in Java there is a big controversy that exist for years about checked VS unchecked exceptions. Many influent people in Java really think introducing checked exceptions was an error.
The main reasons are:

*

*People are lazy and tend to catch the exception in the wrong place, so that they are not bothered anymore.

*People doesn't follow the sun recommandations: they throw checked exceptions just to "give a warning" at compile time for the client side of the API.

*People tend to think that only methods declaring checked exceptions can raise exception, while ANY code/method CAN throw exceptions. You are not supposed to catch exception ONLY WHEN THE COMPILER SAYS SO: YOU HAVE TO THINK WHERE IT'S APPROPRIATE TO CATCH.
Are kinda agree with Bruce Eckel:

I think the problem is that this is an untested assumption we're
  making as language designers that falls into the field of psychology.

You can find many links on that subject. Many java developers are not aware of this, but also many mature frameworks now mainly use unchecked exceptions (Spring, EJB3...).
Also people doing C# (no checked exceptions) and Java tend to think it's better when there are no checked exceptions.
So you may do:
try {
    your code here
} catch (Exception e) {
    throw new RuntimeException("optionnal message",e);
}

You can eventually use a custom runtime exception if you think it will be useful

Sun sources:
http://docs.oracle.com/javase/tutorial/essential/exceptions/runtime.html

Here's the bottom line guideline: If a client can reasonably be
  expected to recover from an exception, make it a checked exception. If
  a client cannot do anything to recover from the exception, make it an
  unchecked exception.

http://docs.oracle.com/javase/specs/jls/se5.0/html/exceptions.html#11.5

The class Exception is the superclass of all the exceptions that
  ordinary programs may wish to recover from.

Bruce Eckel (Thinking in Java book):
http://www.mindview.net/Etc/Discussions/CheckedExceptions

"Ignorable" in the previous paragraph is the other issue. The theory
  is that if the compiler forces the programmer to either handle the
  exception or pass it on in an exception specification, then the
  programmer's attention will always be brought back to the possibility
  of errors and they will thus properly take care of them. I think the
  problem is that this is an untested assumption we're making as
  language designers that falls into the field of psychology. My theory
  is that when someone is trying to do something and you are constantly
  prodding them with annoyances, they will use the quickest device
  available to make those annoyances go away so they can get their thing
  done, perhaps assuming they'll go back and take out the device later.
  I discovered I had done this in the first edition of Thinking in Java:
...
} catch (SomeKindOfException e) {}