text:
Q: Angular folder structure and component services I have read many articles about Angular folder structure. It is still not clear to me where do we put component services. Shared services between components are put under shared. But what about a service that is used only by a component?
Usually I put all my component logic into a service and leave the component with code relevant only to UI stuff.
Which one is better to use:
Each component and its service into the same folder
.
├── app.component.html
├── app.component.ts
├── app.module.ts
├── app-routing.module.ts
└── shop
    ├── clients
    │   ├── clients.component.html
    │   ├── clients.component.ts
    │   ├── clients.component.css
    │   └── clients.service.ts
    ├── orders
    │   ├── orders.component.html
    │   ├── orders.component.ts
    │   ├── orders.component.css
    │   └── orders.service.ts
    ├── shop.module.ts
    └── shop-routing.module.ts

or all services of a module under a services folder
.
├── app.component.html
├── app.component.ts
├── app.module.ts
├── app-routing.module.ts
└── shop
    ├── clients
    │   ├── clients.component.html
    │   ├── clients.component.ts
    │   └── clients.component.css
    ├── orders
    │   ├── orders.component.html
    │   ├── orders.component.ts
    │   └── orders.component.css
    ├── services
    │   ├── clients.service.ts
    │   └── orders.service.ts
    ├── shop.module.ts
    └── shop-routing.module.ts

A: I don't think there is a one size fit all for a folder structure as it is completely opinionated and really it's just a nice to have.
Some say we should group based on features.
Some say we should group based on similarities.
The list goes on...
I remember a guide from Dan Abramov the really speaks about how we should truly look at structuring our app. It can be found Here.
Simple but not simple just work with what you think is best.

A: It is all about Semantics and Readability in my opinion. Just doing it in a way that suits you and your convenience won't make it a good practice. It should be easy for a newbie or substitute developer to figure out your method in not time, so you should probably focus on that.
Tips to keep in mind:
1) Services should be easily relatable and shouldn't create any confusion
2) Path navigation shouldn't become complex ( for eg: avoid cases of ../../../../ )
3) Shared services should be placed under a meaningful folder
I would say that the second method you suggested is the common standard followed.
Refer : https://itnext.io/choosing-a-highly-scalable-folder-structure-in-angular-d987de65ec7

A: Personally, I'll prefer this architecture, Since everything related to clients is in client module.It is easy for someone new to get this architecture and it is predeicatble.

--app.component.html
--app.component.ts
--app.module.ts
--app-routing.module.ts
--shop
------clients
--------clients.component.html
--------clients.component.ts
--------clients.component.css
--------clients.service.ts
------orders
--------orders.component.html
--------orders.component.ts
--------orders.component.css
--------orders.service.ts
----shop.module.ts
----shop-routing.module.ts

Apart from this, the architecture is for own ease...

My current architecture is like

--app.component.html
--app.component.ts
--app.module.ts
--app-routing.module.ts
--pages
----- About
-------- Component
----------- Has Details
--------------Component.ts
-----------------Html
--------- Service
------------All services here
----- Contact US
-------- Component
----------- Details
--------------Component.ts
-----------------Html
-------- Models
------------Model.ts
--------- Service
------------All services here
--Theme
---- Common components

A: I prefer having services separately from components because the package structure for components will probably reflect where they are on the page visually for most apps. While for services you probably want to package "by domain/feature" https://medium.com/sahibinden-technology/package-by-layer-vs-package-by-feature-7e89cde2ae3a
Also components needing their own folders doesn't help with navigation when you also have to cram services into the same folder structure.


text:
Q: jquery change label for="" value I'm not sure if this is possible, but can jquery change the label "for" value?
Example:
whatever

changed to :
whatever

I've looked around, but can't seem to find anything..

A: jQuery can change any attribute, using the .attr() method:
$("label[for=foo]").attr("for", "bar");

redpajama_set_name: RedPajamaStackExchange


text:
Q: ASP.NET: How to get FormsAuthenticationTicket object when authentication expired I'm trying to check the Expired property of the user's current FormsAuthenticationTicket to see if the authentication period has expired. But when the period has expired, I'm never able to get enough information to even create the ticket to check. I've tried this:
FormsIdentity id = (FormsIdentity)User.Identity;
FormsAuthenticationTicket ticket = id.Ticket;

But User is null when the authentication period has expired. So that won't work. I've tried this:
HttpCookie authCookie = context.Request.Cookies[FormsAuthentication.FormsCookieName];
FormsAuthenticationTicket authTicket = FormsAuthentication.Decrypt(authCookie.Value);

But the Forms Cookie is gone when the authentication period has expired, meaning authCookie will be null. So that doesn't work.
Is there any way to actually get the FormsAuthenticationTicket object when the authentication period has expired? There must be, because there's an "Expired" property in the object. What am I missing?
Thanks.

A: Assuming the browser (IE only) does not remove an expired cookie, ASP.Net appears to strip an expired authentication ticket out of the Request.Cookies collection. It is still there in the Request.Header["Cookie"], but not available in the cookies collection. I believe this happens sometime between the "BeginRequest" and "AuthenticateRequest" events. I'm running into the same issue and am exploring it further myself.
    void context_BeginRequest(object sender, EventArgs e)
    {
        string cookie = ((HttpApplication)sender).Context.Request.Cookies[".ASPXFORMSAUTHSS"].Value;
        FormsAuthenticationTicket ticket = FormsAuthentication.Decrypt(cookie);
    }

A: An expired cookie is left out of the headers by the client browser. So there is no code-behind method of retrieving it since the client will never give it to you. It might be possible to use javascript cookies to retrieve the raw cookie data and put it into a post header or AJAX call for some purpose, but I believe the javascript cookie mechanism has the same expiration restrictions as the browser. Expired cookies are no longer valid, and thus not accessible.


text:
Q: Can we restrict the type be a delegate We can restrict the type be the class or struct. Can we strict the type be a delegate?

A: A Delegate is a class, and you would normally be able to specify a non-sealed class as a constraint. However, the language specification specifically excludes System.Delegate as a valid constraint in section 10.1.5.

A class-type constraint must satisfy
  the following rules:

*

*The type must be a class type.

*The type must not be sealed.

*The type must not be one of the following types: System.Array,
  System.Delegate, System.Enum, or
  System.ValueType.

*The type must not be object. Because all types derive from object,
  such a constraint would have no effect
  if it were permitted.

*At most one constraint for a given type parameter can be a class type.

A: As has already been pointed out, the C# specification does not allow a Delegate generic constraint. Nor are Delegate subclasses accepted by the compiler as a generic constraint.  The best you can do is test and throw an exception. I will show this with a method, but if this is a generic class, the constructor would be a great place to do the check.
public void Foo<T>(T x)
{
    if (x == null)
        throw new ArgumentNullException("x");

    Delegate d = x as Delegate;
    if (d == null)
        throw new ArgumentException("Argument must be of Delegate type.", "x");

    // Use d here.
}


text:
Q: Sending email with Python/Django through Microsoft Exchange (IMAP) I have a Django web application which sends email through a standard SMTP, but I want it to use a mailbox from the corporate Exchange server.
I would like the emails sent from the application to be listed in the sent items of the inbox.
Currently the email are sent, but not listed in the sent items..
Is that even possible ?

A: You need to put a copy of the mail into the sent folder on the exchange server, I can think of 2 ways of doing this:
Exchange Web Services
http://msdn.microsoft.com/en-us/library/bb204119.aspx
A quick google reveals a python libraries for doing this, but I've never used them
IMAP on the Exchange Server
I wouldn't do this if it's not already enabled, but the python libraries are mature and well documented.


text:
Q: Eclipse auto import missing classes in all classes I have a library(com.x.y.z) used in my project.
Recently the package name in library changed to com.a.b.c.
There are many instances of com.x.y.z package in my project and eclipse is showing compile time errors to change package name from com.x.y.z to com.a.b.c. It is hard to do it in every class by pressing Control+Shift+O (import all missing classes at once) as there are more than 100 classes contain the same error.
Is there any special short cut key to import missing classes at once in all classes?


text:
Q: Calculate the width and height of a rectangle, given its diagonal and area Here's my problem: "In a rectangle, the diagonal is 6 and area 14. The perimeter is:
 a) 10 b) 14 c) 16 d) 18 e) 20.
So I know that $x^2 + y^2 = 36$, and that $xy = 14$, but I'm having problems figuring out what the width and height equals.. (sorry if anything's unclear, English is not my primary language , but I can't find any information on this in my own language).

A: Hint: try to use $(x+y)^2=x^2+y^2+2xy$


text:
Q: Disconnecting client with error: client socket write error: Broken pipe - passenger 5.0.2 When I start Phusion Passenger Standalone web server (version 5.0.2), I see the following error in the log (even though everything works fine otherwise):
ServerKit/Server.h:892 ]: [Client 1-1] Disconnecting client with error: client socket write error: Broken pipe (errno=32)

Any idea what might be causing it?
Note: I start the server with foreman start and I stop it with control-c.

A: Passenger author here. Actually, the issue maxd linked to has got nothing to do with it.
The "Disconnecting client with error: client socket write error: Broken pipe" is a harmless informational message. It's quite normal, but I forgot to give it a lower logging level. I will do that in the next release. You can safely ignore this message. Nothing bad is going on.


text:
Q: WD calendar, getting value out of drop down I am adding WD calendar to project I'm working (http://www.webappers.com/2010/06/08/wdcalendar-jquery-based-google-calendar-clone/). Basicly I have to remake all "Add New Event" form. The thing is, I cant seem to get dropdown values out of time input.
 $(document).ready(function() {
        //debugger;
        var DATA_FEED_URL = "php/datafeed.php";
        var arrT = [];
        var tt = "{0}:{1}";
        for (var i = 0; i < 24; i++) {
            arrT.push({ text: StrFormat(tt, [i >= 10 ? i : "0" + i, "00"]) }, { text: StrFormat(tt, [i >= 10 ? i : "0" + i, "30"]) });
        }
        $("#timezone").val(new Date().getTimezoneOffset()/60 * -1);
        $("#stparttime").dropdown({

            dropheight: 200,
            dropwidth:60,
            selectedchange: function() {
              var startH= $("li .hover div").html();
             console.log(startH);
               },
            items: arrT
        });

Input
<input MaxLength="5" class="required time" id="stparttime" name="stparttime" style="width:50px; margin-right:5px;" type="text" value="<?php echo isset($event)?$sarr[1]:""; ?>" />To
          <input MaxLength="50" class="required time" id="etparttime" name="etparttime" style="width:50px;" type="text" value="<?php echo isset($event)?$earr[1]:""; ?>" />

Also, i cant modify too much time input (which sadly is not select), beacaus it will affect badly callendar functions.
Picture of my form
http://oi59.tinypic.com/2e5ioau.jpg

A: Problem solved. input #stparttime, saves selected li's html as value. Probably I had some typo when I tried it at first.


text:
Q: Adopting standard libraries My team has a command parsing library for console apps. Each team around us has their own as well. There isn't anything in the BCL so I suppose this is natural.
I've looked at the the module in Mono, which seems solid, and the one on CodePlex looks fine as well. There are probably others out there that will work (and I would love to hear your suggestions).
The real question is: how do I get my team, and others around us, to commit to just using one?

A: Well to be honest, you can't make everyone settle on one solution. You can suggest a solution and point out it's benefits, but eventually the advantages would have to be greater than the inertia that they have built up with their present library.
To make them settle on one library you would need to go up the management change until you get to the person that manages all the groups involved. Convince that person why everyone should use one library then let it filter back down.
Now that I have said that, why does it matter? Does your team routinely have to work on code from the other teams? Are the other teams using libraries that cause problems for your code? Is this standardization purely for the sake of standardization or is there some specific problem that not standardizing causes?

A: Once you find a solution, you start forcing it in code reviews. If it's not implemented in new code, tell them, sorry, but you have to go back and do it again. If you already have standards and reviews in place, this is a lot easier to implement.

A: EBGreen, good point, I should have mentioned why I am looking to do this. Our teams frequently read and edit code from the surrounding teams. And I mean feature teams, not just dev/test/pm divisions.
This is just one of those little things that slow everybody down. Working on Team C's code? Got to track down their lib, which mysteriously isn't in the nightly builds (another problem, but independent of this). Reviewing another dev's work? Need to figure out how their parser works. Starting a new project? Need to decide which library to import.
I think that your response does indicate the solution though: Put the library somewhere very convenient, so it can be picked up by new projects (I doubt that many existing ones will be revised, nor should they be if they're working fine), and make the advantages of using it clear.
Thanks!

A: @fatcat1111, in that case by all means a standardized library would be advantageous. As for how to convince the other teams, there are two approaches that I can think of. First point out that standardization across a group always reduces coding effort (discounting for the initial ramp up for people that are new to the standardized library). Second, try to convince them on features. Hopefully you would be choosing the most feature complete library so it would be superior to what everyone else is using.

A: PowerShell provides great command line parsing options for free.  When you create a cmdlet, you define properties and use attributes to determine command line options.  The PowerShell runtime then handles the parsing of input for you.
Also, since PowerShell works with .NET objects, the result of your commands can be rich objects with properties and methods.
Here is a nice blog post demonstrating writing and debugging cmdlets.

A: I recommend NDesk.Options. It makes use of Lambda functions / .NET 3.5 and it's very
nice:
http://www.ndesk.org/Options
What you basically do is:
var p = new OptionSet () {
    { "file=",      v => data = v },

    { "v|verbose",  v => { ++verbose } },

    { "h|?|help",   v => help = v != null },

};
List<string> extra = p.Parse (args);

And you're done.
It support key/value pairs with custom separators, lists, single value options and toggle options
You WILL NOT regret using it.


text:
Q: SQL Developer not exporting as .xlxs or .csv when using WITH statement When I create a temp table using a WITH statement and run the query, I get the desired output, however, when I try and export as .xlxs or .csv in SQL Developer, it exports as a 0KB file. Why is this? Is there a workaround this? The reason why I'm using WITH is because IN maxes out at 1000 and I want to search for specific IDs. I also don't have permissions to create tables.
with base as (
    select 4684 spid from dual union
    select 112477 spid from dual union
    ...
    select 6547 spid from dual
)
select *
from base
left join table on base.spid = table.supplypointid
where table.propertykey='MPCORE' and table.dateend is null

A: I don't think this has anything to do with your WITH clause.
I think you're running into an old SQLDev bug - do you have any DATE columns in your table that are NULL?
Here's a working scenario -
with base as (
    select 101 spid from dual union
    select 102 spid from dual union
    select 201 spid from dual
)
select *
from base
left join employees on base.spid = employees.employee_id

Then open the file...

So my official answer to your question is..provide actual scenario with the data and/or make sure you're on version 21.2.1 (latest) of SQL Developer.


text:
Q: Using git/git-svn, how can I get out from remotes/trunk My directory structure was like this:
feipu123/
feipu123/trunk
feipu123/trunk/work
feipu123/tags
feipu123/branch

I used this command:
git reset --hard remotes/trunk

My directory structure became:
feipu123/
feipu123/work

What can I do to make the file folders become the former look?

A: It looks like you reset your master branch to match the tip of a remote branch. If you want to return the master branch to it's previous state, you can use git reflog to find what commit you were on right before the git reset --hard remotes/trunk. The output of git reflog should contain something similar to this
f9e224f HEAD@{0}: reset: moving to remotes/trunk
37abebb HEAD@{1}: xxxxx

Use the hash that is one step before the reset in the reflog to do
git reset --hard 37abebb


text:
Q: nested for-loops result in wrong result I have some problems with nested for-loops. as you see in the result, the correct line was loaded, but the second loop which splits up the line into two fields does somthing wrong
Any ideas ?
cheers endo
current output
line=user1|pass1
usr:   user2
pass:  pass2
 --------
line=user2|pass2
usr:   user2
pass:  pass2
 --------

pass.txt
user1|pass1
user2|pass2

batchfile
cls
@echo off &setlocal

for /f "tokens=*" %%a in (pass.txt) do (
  echo line=%%a
  set "string=%%a"

    for /f "tokens=1,2 delims=|" %%i in ("%string%") do set "variable1=%%i" &set "variable2=%%j"
    echo usr:   %variable1%
    echo pass:  %variable2%
    endlocal

set "string="
echo. --------

)

A: Nested for loops are correctly working.
But what is not working (not as intended) are the variables. In batch script, each time a block (the lines enclosed in parenthesis) is reached, all variable reads are replaced with the value in the variable before the execution. If inside a block you need to access the value of a variable, and this value has been assigned/changed inside the block, then, it is necessary to indicate that the variable read should be delayed.
So, your code should be something like
@echo off  & cls
setlocal enabledelayedexpansion

for /f "tokens=*" %%a in (pass.txt) do (
  echo line=%%a
  set "string=%%a"

    for /f "tokens=1,2 delims=|" %%i in ("!string!") do set "variable1=%%i" &set "variable2=%%j"
    echo usr:   !variable1!
    echo pass:  !variable2!

echo. --------

)
endlocal

setlocal enabledelayexexpansion activates this feature, and %var% references are replaced (where needed) with !var! sintax, indicating variables that need delayed read.

A: You could remove the (temporary) variable assignments and use the for variables "%%?" immediately as arguments for further commands if you want to avoid delayed expansion:
@echo off & cls
setlocal
for /f "tokens=*" %%a in (pass.txt) do (
    echo line=%%a
    for /f "tokens=1,2 delims=|" %%i in ("%%a") do (
        echo usr:   %%i
        echo pass:  %%j
        echo. --------
    )
)
endlocal

Another thought: for this approach you do not need two nested loops, because the FOR command is capable of splitting each read line of a text file immediately; try this:
@echo off & cls
setlocal
for /f "tokens=1,2 delims=|" %%a in (pass.txt) do (
    echo line=%%a^|%%b
    echo usr:   %%a
    echo pass:  %%b
    echo. --------
)
endlocal


text:
Q: Why is this code slowing down? I'm currently in the process of converting a number of Access databases to Xml files. I have done this before and I still have the code from a previous project. However, this code will not let me structure the xml as I please which is what I need to do this time around. I'm using XDocument with for-loops to achieve this but it gets incredibly slow after a couple of 1000 rows of data.
Reading in on how XDocument works tells me that XElement.Add actually copies the entire xml-code and adds the new element as it pastes everything back into the file. If this is true then that's probably where the problem lies.
This is the part that reads and writes the data from Access to Xml, take a look and see if there's any way of saving it. Converting a database with 27 columns and 12 256 rows takes almost 30 minutes while a smaller one with a mere 500 rows takes roughly 5 seconds.
private void ReadWrite(string file)
{
    using (_Connection = new OleDbConnection(string.Format("Provider=Microsoft.ACE.OLEDB.12.0;Mode=12;Data Source={0}", pathAccess)))
    {
        _Connection.Open();
        //Gives me values from the AccessDB: tableName, columnName, colCount, rowCount and listOfTimeStamps.
        GetValues(pathAccess);

        XDocument doc = new XDocument(new XDeclaration("1.0", "utf-8", "true"), new XElement(tableName));
        for (int rowInt = 0; rowInt < rowCount; rowInt++)
        {
            XElement item = new XElement("Item", new XAttribute("Time", listOfTimestamps[rowInt].ToString().Replace(" ", "_")));
            doc.Root.Add(item);

            //colCount"-1" prevents the timestamp from beeing written again.
            for (int colInt = 0; colInt < colCount - 1; colInt++)
            {
                using (OleDbCommand cmnd = new OleDbCommand(string.Format("SELECT {0} FROM {1} Where TimeStamp = #{2}#", columnName[colInt] , tableName, listOfTimestamps[rowInt]), _Connection))
                {
                    XElement value = new XElement(columnName[colInt], cmnd.ExecuteScalar().ToString());
                    item.Add(value);
                }
            }
            //Updates progressbar
            backgroundWorker1.ReportProgress(rowInt);
        }
        backgroundWorker1.ReportProgress(0);
        doc.Save(file);
    }
}

This is this code from my old converter. This code is pretty unaffected by the size of the database, the 12 556 database only takes a second to convert. Could there possably be a way to merge these two?
public void ReadWrite2(string file)
{
    DataSet dataSet = new DataSet();
    using (_Connection = new OleDbConnection(string.Format("Provider=Microsoft.ACE.OLEDB.12.0;Mode=12;Data Source={0}", file)))
    {
        _Connection.Open();

        DataTable schemaTable = _Connection.GetOleDbSchemaTable(OleDbSchemaGuid.Tables, new object[] { null, null, null, "TABLE" });

        foreach (DataRow dataTableRow in schemaTable.Rows)
        {
            string tableName = dataTableRow["Table_Name"].ToString();

            DataTable dataTable = dataSet.Tables.Add(tableName);
            using (OleDbCommand readRows = new OleDbCommand("SELECT * from " + tableName, _Connection))
            {
                OleDbDataAdapter adapter = new OleDbDataAdapter(readRows);
                adapter.Fill(dataTable);
            }
        }
    }
    dataSet.WriteXml(file.Replace(".mdb", ".xml"));
}

EDIT: Just to clarify, the application slows down as it's executed. As in the first 500 takes 5 seconds no matter how big the database is.
UPDATE: Okay so I've come back after the weekend now and I made a small adjustment in the code to seperate the reading and the writing by filling a jagged array with the values in one loop and writing them in another. This has proven my theory wrong and it's infact the reading that takes so much time. Any ideas on how to fill an array with the values without hitting the database inside the loop?
UPDATE2: This is the end result after switching to a DataReader.Read()-loop and collecting all the data right away.
public void ReadWrite3(string Save, string Load)
    {
        using (_Connection = new OleDbConnection(string.Format("Provider=Microsoft.ACE.OLEDB.12.0;Mode=12;Data Source={0}", Load)))
        {
            _Connection.Open();
            GetValues(_Connection);

            _Command = new OleDbCommand(String.Format("SELECT {0} FROM {1}", strColumns, tables), _Connection);
            XDocument doc = new XDocument(new XDeclaration("1.0", "utf-8", "true"), new XElement("plmslog", new XAttribute("machineid", root)));
            using (_DataReader = _Command.ExecuteReader())
            {
                for (int rowInt = 0; _DataReader.Read(); rowInt++ )
                {
                    for (int logInt = 0; logInt < colCount; logInt++)
                    {

                        XElement log = new XElement("log");
                        doc.Root.Add(log);

                        elementValues = updateElementValues(rowInt, logInt);

                        for (int valInt = 0; valInt < elements.Length; valInt++)
                        {
                            XElement value = new XElement(elements[valInt], elementValues[valInt]);
                            log.Add(value);
                        }
                    }
                }
            }
            doc.Save(Save);
        }
    }

A: Forgive me, but I think you're making your life more complicated than it needs to be. If you use an OleDbDataReader object you can just open it and read through the Access table row-by-row without having to cache the row data in an array (since you already have it in the DataReader).
For example, I have some sample data
dbID    dbName  dbCreated
----    ------  ---------
bar     barDB   2013-04-08 14:19:27
foo     fooDB   2013-04-05 11:23:02

and the following code runs through the table...
static void Main(string[] args)
{
    OleDbConnection conn = new OleDbConnection(@"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Documents and Settings\Administrator\Desktop\Database1.accdb;");
    conn.Open();

    OleDbCommand cmd = new OleDbCommand("SELECT * FROM myTable", conn);
    OleDbDataReader rdr = cmd.ExecuteReader();

    int rowNumber = 0;
    while (rdr.Read())
    {
        rowNumber++;
        Console.WriteLine("Row " + rowNumber.ToString() + ":");
        for (int colIdx = 0; colIdx < rdr.FieldCount; colIdx++)
        {
            string colName = rdr.GetName(colIdx);
            Console.WriteLine("    rdr[\"" + colName + "\"]: " + rdr[colName].ToString());
        }
    }
    rdr.Close();
    conn.Close();

    Console.WriteLine("Done.");
}

...and produces the result...
Row 1:
    rdr["dbID"]: foo
    rdr["dbName"]: fooDB
    rdr["dbCreated"]: 2013-04-05 11:23:02
Row 2:
    rdr["dbID"]: bar
    rdr["dbName"]: barDB
    rdr["dbCreated"]: 2013-04-08 14:19:27
Done.

A: You are hitting the database from inside a nested loop (all rows and columns)
 using (OleDbCommand cmnd = new OleDbCommand(string.Format("SELECT {0} FROM {1}

You might be better off keeping the data in an array or collection and then accessing the database.

A: simple math calculation will tell you why.
(amount of data)
27 * 12256 = 330912
27 * 500 = 13500
330912 / 13500 = 24512
so your big statement is 24512 times bigger!
(time wise)
30*60 = 1800
1800 / 5 = 360
so your time is 360 times bigger!
you can see that your code doesn't seem to be doing a bad thing.


text:
Q: error: c++ [map] does not name a type I've written the following as part of a text command parser for a text adventure game.
I'm attempting to associate a string input by a user to an item in an enum class. The following is in my header file:
#include <iostream>
#include <map>
#include <string>
using namespace std;

enum class Noun
{
    // Interrogation subjects
    name,                   // ask the subject his name
    base,                   // where is the base?
    attack,                 // when will the attack be?

    invalid
};

map < string, Noun > knownNouns;
knownNouns["name"]      = Noun::name;
knownNouns["base"]      = Noun::base;
knownNouns["attack"]    = Noun::attack;

Noun parseNoun(string &noun)
{
    auto n = knownNouns.find(noun);
    if ( n == knownNouns.end() ) {
        return Noun::invalid;
    }
    return n->second;

When I put this through the compiler, I get the following:
nouns.h:46:1: error: 'knownNouns' does not name a type
 knownNouns["name"]      = Noun::name;
 ^
nouns.h:47:1: error: 'knownNouns' does not name a type
 knownNouns["base"]      = Noun::base;
 ^
nouns.h:48:1: error: 'knownNouns' does not name a type
 knownNouns["attack"]    = Noun::attack;
 ^
nouns.h: In function 'Noun parseNoun(std::string&)':
nouns.h:52:10: error: 'n' does not name a type
     auto n = knownNouns.find(noun);
          ^
nouns.h:53:10: error: 'n' was not declared in this scope
     if ( n == knownNouns.end() ) {
          ^
nouns.h:54:16: error: 'Noun' is not a class or namespace
         return Noun::invalid;
                ^
nouns.h:56:12: error: 'n' was not declared in this scope
     return n->second;
            ^

This is my first time attempting to use maps and enums, and I'm not sure what it is I did wrong. I'm also not terribly familiar with the use of auto vars, so that's a bit of cargo-cult programming on my part. I'm hoping I understood its implementation and the error will clear once I resolve the type definition problem I'm having.
edit: That's embarassing. I copy pasted a mistake that I had already corrected. the code still does not compile when (i.e., the same issue occurs when)
map < string, Noun > knownNouns;
knownNouns["name"]      = Verb::name;
knownNouns["base"]      = Verb::base;
knownNouns["attack"]    = Verb::attack;

is corrected as
map < string, Noun > knownNouns;
knownNouns["name"]      = Noun::name;
knownNouns["base"]      = Noun::base;
knownNouns["attack"]    = Noun::attack;

A: You may not initialize map entries statically like:
 knownNouns["name"]      = Verb::name;
 knownNouns["base"]      = Verb::base;
 knownNouns["attack"]    = Verb::attack;

A: You can't place non-declaration constructs directly in namespace scope.
A C++ translation unit is a sequence of declarations.
Non-declaration statements such as assignments must be inside function bodies.

Fixed code:
#include <iostream>
#include <map>
#include <string>
using namespace std;

enum class Noun
{
    // Interrogation subjects
    name,                   // ask the subject his name
    base,                   // where is the base?
    attack,                 // when will the attack be?

    invalid
};

map< string, Noun > knownNouns =
{
    { "name", Noun::name },
    { "base", Noun::base },
    { "attack", Noun::attack }
};

auto parseNoun( string const& noun )
    -> Noun
{
    // auto n = knownNouns.find(noun);
    // if ( n == knownNouns.end() ) {
        // return Noun::invalid;
    // }
    // return n->second;
    return Noun::invalid;
}

Here knownNouns is initialized. It's not an assignment, even if the = looks very much like an assignment.


text:
Q: IPad Game Time Manager I have a game in Ipad that gives out daily rewards, if I advance the date on my device, i'll have a boat load of stuffs, is there a way I can control it? any suggestions on what is the best solution i can implement, even if not best, maybe i need to hear it so i can mixed the ideas and come up with something, thanks

A: You can use remote time server to calculate exact periods of time.


text:
Q: Stop executing code and wait for Webbrowser I'm writing a program to navigate a website, but I'm having trouble with code execution occuring when I don't want it to execute.
I have a WebBrowser control where once the page finishes loading, I have code analyzing the html, and for certain circumstances I tell the WebBrowser to navigate to a new URL.
So I basically have a line of code that looks like this, within a method, the method within the DocumentCompleted handler
if this condition then
wb.Navigate(new Uri("http://www.website.com"), "_self");
else do something else, exit method, continue processing code

However, when I Navigate, the code continunes to execute beyond the Navigate. It exits the method, and keeps processing code.
How to I stop the DocuemntComplete event handler from processing whenever I call a new page navigation?


text:
Q: update primary key values based on a new sequence in MySQL / MariaDB Consider a table my_table with a column id_my_table as primary key with auto increment
CREATE TABLE `my_table` (
  `id_my_table` INT UNSIGNED NOT NULL AUTO_INCREMENT,
  `some_name` VARCHAR(50) NOT NULL,
  PRIMARY KEY (`id_my_table`)
) ENGINE=InnoDB;

That primary key is referenced by some other tables.
I have some records and for the sake of this example let say I have five of them having id_my_table the following values: 1, 2, 3, 4 and 5. Because of a request by a client, which involves having a particular sequence from a legacy dataset, I updated the values of the primary key in order to match that sequence.
This is what I did:
ALTER TABLE `my_table` ADD COLUMN `my_old_id` INT UNSIGNED NULL AFTER `some_name`;

UPDATE `my_table` set `my_old_id` = `id_my_table`;

SET FOREIGN_KEY_CHECKS=0;

-- +100 so no duplicate error...
UPDATE `my_table` set `id_my_table` = `id_my_table` + 100;

UPDATE `my_table` set `id_my_table` = 25 where `id_my_table` = 1;
UPDATE `my_table` set `id_my_table` = 37 where `id_my_table` = 2;
UPDATE `my_table` set `id_my_table` = 58 where `id_my_table` = 3;
UPDATE `my_table` set `id_my_table` = 72 where `id_my_table` = 4;
UPDATE `my_table` set `id_my_table` = 96 where `id_my_table` = 5;

ALTER TABLE `my_table` AUTO_INCREMENT = 97;

UPDATE another_table at
INNER JOIN my_table mt on mt.my_old_id = at.reference_to_id_my_table
SET at.reference_to_id_my_table = mt.id_my_table;

SET FOREIGN_KEY_CHECKS=1;

Now everything is working as expected and new records have the correct sequence (based on the legacy one), but...
Can I continue normally? Or did I messed up some internal index and I'm not seing a potential issue down the road?

A: Short Answer:  Looks fine.
Long Answer:
The "right" way to test this is to copy all the relevant tables to another server (or on the same server, but in a different database).  Then perform operations that exercise things like fetching via the Foreign Key or adding a new row (which will get id=97).
One more thing to do:  Put START TRANSACTION and COMMIT around the set of UPDATEs.  This single transaction will assure that all the Updates or non are done.
Offhand I see nothing wrong with your code.  (I assume that Update with the Join will be done for each other table that references my_table.)  (If you have already run all the Update, don't worry about the transaction.  Think of it as a tip for 'next time'.)
As for how AUTO_INCREMENT works, I don't see any future gotchas.  The new ids will be 97 and up; the numbers in the gap will be forever missing.
Be aware that REPLACE is DELETE + INSERT, so it will, in all(?) cases, lose the auto_inc id.
Did you have to write the 5 Updates?  It might have been easier to build a table with the mapping, then apply it to all relevant tables.  In the case of the main table, only if there is a risk of dup ids, would you need some trick (like +100) may be necessary.
Consider doing DROP COLUMN later.


text:
Q: Firefox Add-on - How to inject scripts to tabs that were open before installation? How can we inject our scripts to tabs that existed before our add-on was installed?
We would like to inject our scripts to all open tabs once the user install our add-on and without refreshing the pages.
Any idea how this can be done?
At the moment, we inject scripts to new tabs that the user open after our add-on is installed this way:
pageMod.PageMod({
    include: "*",
    contentScriptFile: [self.data.url("js/jquery-1.8.1.min.js"), self.data.url("content.js")],
    onAttach: function (worker) {

        worker.port.on('settings', function () {
            log('settings: get');
            var settings = {
              user: storage.user
            };

            worker.port.emit("settings", settings);
        });
    }
});

btw, we use firefox add-on sdk 1.12
Thanks

A: Just add the option
attachTo: ["existing"]


text:
Q: OpenLayers SelectFeature - Manually set feature as selected/unselected In the OpenLayers SelectFeature, how can I manually set a feature as selected/unselected and have it reflect the appropriate color?
For instance, when my application loads, it sends back the existing select state which I want to set on the polygons. Thanks!

A: I noticed that there are two methods which can be used to select a feature manually.

*

*Method select(feature) in the SelectFeatures control.

*Method clickFeature(feature) in the SelectFeatures control.

Here's a fiddle demonstrating that feature in case anyone else is interested.
At one point, I wasn't able to get select to work. Setting selectFeature.allowSelection to true let me select it, but later I noticed that it worked without it so I'm not sure when setting that to true is required. If you run into any issues, you might want to try playing with that attribute. Looking into the source further should allow us to understand the purpose of that variable.


text:
Q: How can I remove #! from url in angularjs? I want to remove #! from url and I used
$locationProvider.html5Mode(true);

For this and it works but when I refreshes the page it can't be able to find the page and give error.
what should I do for this?
Index.html
<!DOCTYPE html>

<meta http-equiv="content-type" content="text/html;charset=utf-8" />

    <meta charset="UTF-8" />

    <meta name="viewport" content="width=device-width, initial-scale=1">

    <meta http-equiv="X-UA-Compatible" content="IE=edge">

    <base href="/">

    <page-loader flag="isLoading"></page-loader>

config file for routing
var app = angular.module('myapp');

app.config(['$stateProvider', '$urlRouterProvider', '$locationProvider', function($stateProvider, $urlRouterProvider, $locationProvider) {
    $urlRouterProvider.otherwise('/');

    $stateProvider
        .state('productpagelayout', {
            abstract: true,
            views: {
                layout: {
                    templateUrl: 'template/layout/productpagelayout .html',
                },
                controller : 'productCtrl'
            }
        })
        .state('landing', {
            url: '/',
            templateUrl: 'template/landing/mainpages.html',
            controller: 'menuCtrl',
            parent: 'productpagelayout',
        })
        .state('home', {
            url: '/home',
            templateUrl: 'template/landing/landing.html',
            controller: 'menuCtrl',
            parent: 'productpagelayout',
        })
        .state('category2',{
            url: '/c/:name1/:name2',
            templateUrl: 'template/product/productsgridpage.html',
            controller: 'productCtrl',
            parent: 'productpagelayout'
        })
     $locationProvider.html5Mode(true);
}])

app.js
var app = angular.module('myapp', ['ui.router',
  'rzModule',
  'ngCookies',
  'ui.bootstrap',
  'ngSanitize',

]);

A: You can try and use:
app.config(['$locationProvider', function($locationProvider) {
  $locationProvider.hashPrefix('');
}]);


text:
Q: Insert into database using a while loop I need to insert data from a table named wishlist into another table (wishlisturi_salvate) and altough the insert looks ok, something doesn't work right and no inseration is being made.Thanks for the help, I really appreciate it.
<?php
session_start();
include ('conex.php');
$sel2="select id_wishlist  from wishlisturi_salvate";
$que2=mysql_query($sel2);
while($rez2=mysql_fetch_array($que2))
{
$a=$rez2['id_wishlist'];
}
$id_wishlist=$a;
echo $id_wishlist;
$sel="SELECT * from wishlist";
$que=mysql_query($sel);
while ($rez=mysql_fetch_array($que))
{
$insert="INSERT INTO 'wishlisturi_salvate'('id_user', 'id_wishlist', 'id_produs',        'nume_produs', 'pret_produs', 'cantitate_produs', 'suma')
   VALUES('".$_SESSION['id']."','".$id_wishlist."','".$rez['id_produs']."','".$rez['nume_produs']."','".$rez['pret_produs']."','".$rez['cantitate_produs']."','".$rez['suma']."')";
if(!mysql_query($insert)) echo "fml";
echo "<br>".$insert;
}

if(mysql_query($insert))
{
header("location:user.php");
}
else echo "Nu s-a facut inserarea";
?>

A: No insertion is being made most likely because of the errors inside the query:
Right of the bat, there is already an error:
INSERT INTO 'wishlisturi_salvate'('id_user', 'id_wishlist', 'id_produs',        'nume_produs', 'pret_produs', 'cantitate_produs', 'suma')

The proper quoting of table/column names must be backtickts, not single quotes
INSERT INTO `wishlisturi_salvate` (`id_user`, `id_wishlist`, `id_produs`, `nume_produs`, `pret_produs`, `cantitate_produs`, `suma`)

Or just omit them, its okay in this case.
Obligatory Note:

Please, don't use mysql_* functions in new code. They are no longer maintained and are officially deprecated. See the red box? Learn about prepared statements instead, and use PDO or MySQLi - this article will help you decide which. If you choose PDO, here is a good tutorial.

Sidenote:
If you haven't already, always turn on error reporting:
error_reporting(E_ALL);
ini_set('display_errors', '1');

A: First of all I'll rcomend you to use PDO or mysqli instead of mysql to avoid SQL injection.
Anyway, if you want to insert elements from one table to another one I recommend you to use an insert statment with a subselect. That way it'll be faster and you will waste less memory.

A: Not an answer, more of an observation ; It will be far more efficient to loop through your results to build up a single SQL insert multiple statement that you send to the db once.
$insert = "INSERT INTO 'wishlisturi_salvate'('id_user', 'id_wishlist', 'id_produs',        'nume_produs', 'pret_produs', 'cantitate_produs', 'suma') VALUES ";

foreach( of your results ){
$insert .= "(x,y,z,a,b,c,d),";
}

// now trim off last comma, then send to db.
// or create an array then join it to the $insert

Same info can be read here : http://www.electrictoolbox.com/mysql-insert-multiple-records/


text:
Q: Как добавить запись в существующую таблицу Excel? Везде описана запись в новую таблицу, но мне нужна дозапись. Как с параметром "a" в обычных .txt файлах:
with open("test.txt", "a") as file:
    file.write("новая запись")

Как же всё-таки добавить запись в сушествующую таблицу Еxcel?

A: С модулем openpyxl также просто, например:
from openpyxl import load_workbook

fn = r"C:\temp\test.xlsx"

wb = load_workbook(fn)
ws = wb["Sheet1"]

row = (101, 102, 103)   # <--- новая строка
ws.append(row)

wb.save(fn)
wb.close()

A: Способ с пересозданием файла. Считывать xls можно следующей функцией:
import xlrd
def extract_sheet(tab_path_, sheet_name_):
    my_book = xlrd.open_workbook(tab_path_)
    my_sheet = my_book.sheet_by_name(sheet_name_)
    return my_sheet

Затем превратить таблицу в списки:
def xl_to_list(sheet_):
    my_table = []
    for m in range(len(sheet_.col(0))):
        my_row = []
        for n in range(len(sheet_.row(m))):
            my_row.append(sheet_.row(m)[n].value)
        my_table.append(my_row)
    return my_table

После можно работать с данными, проводить вычисления и пр., в вашем случае добавить запись, а после сохранить в новую excel:
import xlwt
book = xlwt.Workbook()
sheet1 = book.add_sheet(sheet_name_)
sheet1.row(index).write(line)
book.save(export_path)


text:
Q: menu close on click on body page i have created a dropdown menu which opens on clicking the nav button. But i couldn't find a way to close the dropdown menu when the mouse clicks on the body of the page.
I you can figure it out, please help me
(function(){
    var bodyEl = $('body'),
    navToggleBtn= bodyEl.find('.nav-toggle-btn');
    navToggleBtn.on('click', function(e){
        bodyEl.toggleClass('active-nav');
        e.preventDefault();
    });
})();

active-nav is created within css and linked with menu and body

A: I don't know if it is the right solution, but I would add a div element that covers the entire page.
The menu is on top of that div, but the rest is below. If you click the div, it closes itself and the menu.
So basically, it's a lightbox (as for showing images), but without the shade. Or width a shade, because it will make your menu stand out a little more, and it will fit the expectations of disabling clicks on specific elements in the body.
Another advantage of having an extra element instead of just capturing clicks on the main level on the body, it that it won't interfere with other event handlers on the body itself, which could capture the click and therefor have unexpected results for someone who just wants to close the menu.
A rough example can be found below:

$('header > ul > li').on('click', function() {
  // Deactive all menu items
  $('ul.active').removeClass('active');
  // Activate the one clicked.
  $(this).closest('li').addClass('active');

  // If there is no lightbox setup a new one.
  var box = $('.lightbox');
  if (box.length == 0) {
    // It's just a div with a class.
    $('
')
      .prependTo($('body'))
      .addClass('lightbox')
      .on('click', function() {
          // Lightbox clicked? Remove it, and deactivate the menu.
          $('.lightbox').remove();
          $('li.active').removeClass('active');
        });
  }

});
li {
  padding: 1em;
}
header > ul > li {
  display: inline-block;
  vertical-align: top;
  position: relative;
  background-color: #eee;
}
li > ul {
  display: none;
  background-color: #ddd;
  position: absolute;
  top: 100%;
  left: 0;
}

li.active > ul {
  display: block;
}

.lightbox {
  position: absolute;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
  background: rgba(0,0,0, 0.2); /* Just for show */
}

   Header, page title

Main

sub

sub

sub

sub

Other

About

  Main content

A: You can bind click event to body, then check if the event is generated from a particular element using event.target
var bodyEl = $('body');
navToggleBtn = bodyEl.find('.nav-toggle-btn');
$('body').on('click', function (e) {
    if ($(e.target).hasClass("nav-toggle-btn")) {
        bodyEl.toggleClass('active-nav');
        e.preventDefault();
        e.stopPropagation();
    }
    else
    {
        //close the menu here
    }
});


text:
Q: populating google maps markers using ajax I'm trying to put about 120 marker on a Google Map using ajax populated array of google.maps.LatLng objects
here's my script

Html

I think i'm missing something here
Should i parse latlng array of google.maps.LatLng objects to LatLng before i assign it to position  ?
marker = new google.maps.Marker({
                    map: map,
                    position: latlng[i]
                });

Your help will be appreciated,
Thanks in advance,

A: i think the problem is that you aren't taking into account the asynchronous nature of the ajax request.
you need to build the markers after the ajax request has completed.
put your for each loop in a function and call it within 9at the end) of your on success ajax callback.
you will also need to load the ajax after google maps has loaded otherwise you wont be able to create google latlng objects becasue google maps librbary may not be loadded yet.
withjout rewriting everything this may work..
$.ajaxSetup({
    cache: false
});

var gMapsLoaded = false;
var latlng = [];
var returnValue;
var marker;
var xmlDoc;

window.gMapsCallback = function () {
    gMapsLoaded = true;
    $(window).trigger('gMapsLoaded');
}
window.loadGoogleMaps = function () {
    if (gMapsLoaded) return window.gMapsCallback();
    var script_tag = document.createElement('script');
    script_tag.setAttribute("type", "text/javascript");
    script_tag.setAttribute("src", "http://maps.google.com/maps/api/js?sensor=false&callback=gMapsCallback");
    (document.getElementsByTagName("head")[0] || document.documentElement).appendChild(script_tag);
}

$(document).ready(function () {
    function initialize() {
        var mapOptions = {
            zoom: 8,
            center: new google.maps.LatLng(24.678517, 46.702267),
            mapTypeId: google.maps.MapTypeId.ROADMAP
        };
        map = new google.maps.Map(document.getElementById('map'), mapOptions);

 $.ajax({
    type: "POST",
    url: "map.aspx/getLatLng",
    data: '{}',
    contentType: "application/json; charset=utf-8",
    dataType: "json",
    success: function (response) {
        xmlDoc = $.parseXML(response.d);
        $(xmlDoc).find("Table").each(function () {
            latlng.push(new google.maps.LatLng($(this).find("lat").text(), $(this).find("lng").text()));
        });

        for (var i = 0; i < latlng.length; i++) {

            marker = new google.maps.Marker({
                map: map,
                position: latlng[i]
            });
            var infowindow = new google.maps.InfoWindow({
                content: 'Location info:
Country Name:
LatLng:'
            });
            google.maps.event.addListener(marker, 'click', function () {
                // Calling the open method of the infoWindow
                infowindow.open(map, marker);
            });
        }

    },
    failure: function (response) {
        alert(response.d);
    },
    error: function (response) {
        alert(response.d);
    }
});

    }

    $(window).bind('gMapsLoaded', initialize);
    window.loadGoogleMaps();
});

A: I moved xml processing after map initialization
$(document).ready(function () {
        function initialize() {
            var mapOptions = {
                zoom: 8,
                center: new google.maps.LatLng(24.678517, 46.702267),
                mapTypeId: google.maps.MapTypeId.ROADMAP
            };
            map = new google.maps.Map(document.getElementById('map'), mapOptions);

            xmlDoc = $.parseXML(stringxml);
            $(xmlDoc).find("Table").each(function () {
                marker = new google.maps.Marker({
                    map: map,
                    position: new google.maps.LatLng($(this).find("lat").text(), $(this).find("lng").text())
                });
                var infowindow = new google.maps.InfoWindow({
                    content: 'Location info:
Country Name:
LatLng:'
                });
                google.maps.event.addListener(marker, 'click', function () {
                    // Calling the open method of the infoWindow
                    infowindow.open(map, marker);
                });
            });

        }

        $(window).bind('gMapsLoaded', initialize);
        window.loadGoogleMaps();
    });

And every marker in its proper place.
Thanks guys


text:
Q: php -> shell_exec() -> psexec -> my executable chain fails I have a php from where I have to call a cmd, and from that cmd I have to start an exe using psexec. My php, cmd, psexec.exe and the exe I actually need to run are in the same folder.
php:
shell_exec("runas.cmd");

runas.cmd:
@echo off
psexec -u userName -p password my.exe

If I run the php I can see in the task manager that PSexex.exe is stared but my.exe is not. Also if I run runas.cmd by double-clicking on it, everything is just fine.

A: add 2>&1 after the command and print shell_exec response to see whats actually happen
$a = shell_exec('runas.cmd 2>&1');
var_dump($a);


text:
Q: Error: Minified React error #130, When rendering the child component I am creating a chrome extension with react and an npm component package. I am trying to show an error message on the page. When I trigger the error message component, I am getting an error.
this is the error:-
Error: Minified React error #130; visit https://reactjs.org/docs/error-decoder.html?invariant=130&args[]=undefined&args[]= for the full message or use the non-minified dev environment for full errors and additional helpful warnings.
But that error message component working normally in other codes. It only appears in my chrome extension.
This is my rollup config.!
var babelPresets = [
    [ presetEnv, { modules: false } ],
    [ presetReact]
];
var babelPlugins = ["@babel/plugin-proposal-class-properties"];

modules.forEach((module, i) => {
        rollup({
            input: module.entry,
            treeshake: true,
            external:[],
            plugins: [
                postCss({
                    extract: true,
                    plugins: []
                }),
                commonjs({
                    include: path.resolve(__dirname, "./node_modules/**"),
                    namedExports: {
                        react: [
                            'PropTypes',
                            'createElement', 'Component', 'PureComponent', 'Fragment', 'createContext',
                            'forwardRef',
                            'useContext',
                            'useLayoutEffect',
                            'useEffect',
                            'useRef', "isValidElement", "useReducer", "useImperativeHandle",
                            'useState', 'useMemo', 'useCallback', "Children", "cloneElement", "createRef"
                        ],
                        "react-transition-group": ["CSSTransition"],
                        "react-dom": ["unmountComponentAtNode", "render"],
                        "react/jsx-runtime": ["jsxs", "jsx", "Fragment"]
                    }
                }),
                resolve({
                    mainFields: ["module", "main"],
                    customResolveOptions: {
                        moduleDirectory: path.resolve(__dirname, './node_modules')
                    }
                }),
                babel({
                    babelrc: false,
                    externalHelpers: false,
                    presets: babelPresets,
                    plugins: babelPlugins
                }),
                json(),
                replace({
                    "process.env.NODE_ENV": JSON.stringify("production")
                })
            ]
        })
            .then( (bundle) => {
                bundle.write({
                    name: "__rollupModule",
                    format: "iife",
                    file: module.dest,
                    // footer: "window.__rollupModule = undefined;",
                    // dest: module.dest,
                    sourcemap: 'inline'
                }).then(() => {
                    if (i === modules.length - 1) {
                        callback();
                    }
                });
            })
            .catch((err) => log(err));
    });

A:
Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: undefined.

It seems like you have passed undefined as a component child/JXS node. Check what have you passed into the error message component using console.log().


text:
Q: google chrome web dynpro How to solve this error message on Google chrome running on Ubuntu 14.04
"Sorry, your browser/program is not supported by Web Dynpro!"
but when i use firefox the site is working fine  (on Ubuntu 14.04)

A: The list of supported browsers is defined in the Web DynPro runtime property file.  So for support for the browser you are using you need to ask the owner SAP SE to include support.
You can however bypass this by editing your browser identification string (and make it look like it is a supported browser) with a user agent switcher.

A: As answered by @Rinzwind:

*

*Install User-Agent Switcher for Chrome

*go to the site you are intesseted

*click on the icon added by the User-Agent Switcher and switch to Windows Firefox 33


text:
Q: jquery step by step with $.Deferred() Here a test code:
var dfd_1 = $.Deferred(),
    dfd_2 = $.Deferred(),
    dfd_3 = $.Deferred();

function test(content, waitTime, dfd) {
    console.log(content + ' begin');
    setTimeout(function() {
        console.log(content + ' end');
        dfd.resolve();
    }, waitTime);
    return dfd.promise();
}

$.when(test('first', 2000, dfd_1), test('second', 4000, dfd_2), test('third', 6000, dfd_3))
.then(function() {
    console.log('all done');
});

The result from console is:
first begin
second begin
third begin

first end
second end
third end

all done

3 function starts and after step by step ends
But i need result like this (start end, start end...):
first begin
first end

second begin
second end

third begin
third end

all done

How to make $.Deferred work step by step?
help me please with solution

A: Use then():
test('first', 2000, dfd_1)
    .then(function() {
        return test('second', 4000, dfd_2);
    })
    .then(function() {
        return test('third', 6000, dfd_3);
    })
    .then(function() {
        console.log('all done');
    })
;

Fiddle: http://jsfiddle.net/saj5stt9/


text:
Q: how to generate c# documentation to a chm or html file in visual studio 2012? i have read How to generate C# documentation to a CHM or HTML file?. but, i use visual studio 2012 and all of the answer to that question is in visual studio 2010 and lower. so, how i generate it in visual studio 2012?

A: Sandcastle Help File Builder is my favourite..
http://shfb.codeplex.com/
You simply code as normal and it generates itself.
There is a getting started tutorial here:
http://www.ewoodruff.us/shfbdocs/Index.aspx?topic=html/b772e00e-1705-4062-adb6-774826ce6700.htm

A: Sandcastle will certainly do the job, however I prefer doxygen and it provides good documentation.  It can also generate class diagrams for your code.


text:
Q: Python Binance Futures def position_short(key, secret):
    client = Client(key, secret, base_url="https://fapi.binance.com")
    params = [{"symbol": "APEUSDT", "side": "SELL", "type": "MARKET",
    "quantity": "1", 'recWindow': '5000'}]

def position_long(key, secret):
    client = Client(key, secret, base_url="https://fapi.binance.com")
    params = [{'symbol': 'APEUSDT', 'type': 'TRAILING_STOP_MARKET', 'side': 'BUY', 'callbackRate': '0.2',
    'quantity': '1', 'recWindow': '5000'}]

def position_long(key, secret):
    client = Client(key, secret, base_url="https://fapi.binance.com")
    params = [{'symbol': 'APEUSDT', 'type': 'TRAILING_STOP_MARKET', 'side': 'BUY', 'callbackRate': '0.2',
    'quantity': '1', 'recWindow': '5000'}]

Позиция 'short'
Всем привет, помогите с проблемой, пожалуйста. Код исполняет как надо, но после исполнения этих сделок, он через 2 секунды, не понятно по какой причине заходит в 'long' автоматически.


text:
Q: How to display multiple months in CLNDR.js Instead of the traditional one month view with CLNDR.js, I'd like to display two months, however I cannot find any documentation that shows how this is possible.
http://kylestetz.github.io/CLNDR/
Any help would be appreciated.

A: Update. Multi-month views are now supported out of the box via the lengthOfTime setting. An example configuration might look like this:
$('#cldnr-container').clndr({
    lengthOfTime: {
        months: 3,
        interval: 3
    }
});

This would render a three month view, where paging (clicking "next" or "previous") would move the calendar 3 months at a time.

A: I solved this by making 3 instances, like:
var $multipleCalendar = {
    left: $('#calendarLeft').clndr(...),
    middle: $('#calendarMiddle').clndr(...),
    right: $('#calendarRight').clndr(...)
};

You have to change some CSS to make this look better, but i think this is a start:
Have fun


text:
Q: tools for obfuscating html and css I am looking for something like this or this
what it does

rewrites classes and ids in CSS, HTML, and JavaScript files,
  doing something like .class to .a or #id to #a not sure the javascript obfu is great to use ( i prefer google closure to do this ) but the html and css is the question.

is there any alternative ?

A: Google's Closure Stylesheets can rename your class names. It work in conjunction with Closure Template for the HTML and Closure Compiler for the JavaScript.

Closure Stylesheets makes it possible to rename CSS class names in the generated stylesheet, which helps reduce the size of the CSS that is sent down to your users. Of course, this is not particularly useful unless the class names are renamed consistently in the HTML and JavaScript files that use the CSS. Fortunately, you can use the Closure Compiler to update the class names in your JavaScript and Closure Templates to update the class names in your HTML.

A: I saw html muncher mentioned in an answer to a similar question.  I have not tried it, but it looks to be as simple to use as what you mentioned in your comment on Jerome's answer.  It doesn't look to be actively maintained though.
[Update] I also found a similar node project, munch.js, that says it is based on html muncher.


text:
Q: Chart.js only showing two datapoints in the middle of the data I could not get it going with code snippet so here is a JSFiddle https://jsfiddle.net/akmiecik/v562aghf/18/
Why is this only showing the two datapoints from the middle of the data?  I tried deleting all points before and got nothing, same with all datapoints after.
var dates = ["10/21/22", "10/24/22", "10/27/22", "10/28/22", "10/31/22", "11/03/22", "11/14/22", "11/26/22", "11/26/22", "11/28/22", "11/28/22", "11/30/22", "12/01/22", "12/02/22", "12/06/22", "12/07/22", "12/08/22", "12/09/22", "12/12/22", "12/13/22", "12/16/22", "12/21/22", "12/28/22", "01/10/23", "01/12/23", "01/13/23", "01/16/23", "01/17/23", "01/19/23", "01/21/23", "01/24/23", "01/26/23", "01/30/23", "02/04/23", "02/06/23", "02/08/23", "02/09/23", "02/14/23", "02/10/23", "02/13/23", "02/15/23", "02/16/23", "02/17/23", "02/21/23", "02/24/23", "02/27/23"];
var lap_ave = ["1:02", "1:04", "1:00", "1:01", "1:02", "1:01", "1:03", "1:03", "1:03", "0:59", "0:59", "1:01", "1:02", "1:01", "1:00", "1:00", "1:00", "1:00", "0:59", "00:58", "01:02", "01:04", "01:00", "01:02", "1.01", "1.04", "01:03.1000", "01:00.2188", "01:01.5862", "01:01.4516", "00:57.8621", "01:00.6129", "01:01.1290", "01:00.6563", "01:00.5000", "01:00.0909", "00:59.0294", "00:59.0294", "00:59.7059", "00:59.0000", "00:59.7000", "00:59.6757", "00:58.3125", "00:59.4118", "00:58.8056", "00:58.9459"];
var options = {
  type: 'line',
  data: {
    labels: dates,
    datasets: [
        {
          label: 'Lap Average',
          data: lap_ave,
        borderWidth: 1
        },
        ]
  },
  options: {
    scales: {
        yAxes: [{
        ticks: {
                    beginAtZero: true
        }
      }],
      xAxes: [{
        display: false
      }],
    }
  }
}

var ctx = document.getElementById('theChart').getContext('2d');
new Chart(ctx, options);

A: You provide strings for your data array. Chart.js expects numbers for the y axis. You can fix this by setting your y axis to a category scale and provide a labels array with a valid lap times.
But the easyest solution would be for you to transform the minute:seconds format to only seconds and use that in combination with a custom tick callback

A: It looks like there are inconsistencies in the data you're passing. Some of the lap_ave's are "#.##" while others are "#:#.##"
If you change the last value in the fiddle below to "1.03", you'll see the third data point show up on the graph.
var dates = ["01/12/23", "01/13/23", "01/16/23"];
var lap_ave = ["1.01", "1.04", "01:03.1000"];

https://jsfiddle.net/q0a23j4z/


text:
Q: Pressure in fluid mechanics of incompressible liquid Most liquids can be approximated to be incompressible, since the Mach-number is much smaller than 1. That means that the density variations are negligible and from the relation between pressure p and density ρ,
$$
p=c_s^2 \rho
$$
we see that the pressure in constant as well. Now, say that I look at a pipe with the following geometry:

From Bernoulli's equation we get that the pressure and velocity will be different between the large-radius part of the pipe and the small-radius part. How does this varying pressure conform with the constant pressure/density obtained from the equation of state?

A: Using Bernoulli you get:
$$
\frac{P_1}{\rho} + \frac{1}{2}v_1^2 = \frac{P_2}{\rho} + \frac{1}{2}v_2^2
$$
Using your formula:
$\displaystyle{c_s^2 + \frac{1}{2}v_1^2 = c_s^2 + \frac{1}{2}v_2^2}$ and this implies: $v_1 = v_2$
From mass continuity: $v_1 \times A_1 = v1 \times A_2$, so  $A_1=A_2$, which is a false. There is clearly a misinterpretation.
Your equation is a state function that relates pressure and density, but the constant is extremely small for liquids, and Bernoulli's equation assumes that the fluid is not compressible, so your state function can't be used together with Bernoulli's.
I hope this helps!

A: How does this varying pressure conform with the constant pressure/density obtained from the equation of state?
It doesn't conform.  It is a contradiction to reality:  you cannot have an incompressible material.  However, that doesn't mean the approximation isn't a useful one under many circumstances.
For example, consider water which as a density of roughly $\rho_0=1000$ $kg/m^3$ and a speed of sound of $c_{s0}=1,484$ $m/s$ at room temperature and standard atmospheric pressure.  In order to see if compressibility is important to a given problem we might make a Taylor series approximation to the equation of state $$p(\rho, e) = c_{s0}^2 (\rho - \rho_0) + p_0$$ with $c_s$ being the speed of sound defined by $$c_{s0}^2 = \frac{\partial p}{\partial \rho}\Large{|}_{s,\rho_0}$$  Plugging in the speed of sound for water we see that $$\rho - \rho_0 = 4.54\times10^{-7}(p- p_0)$$  From this equation you can now estimate how much density change you can expect to see and evaluate how important that change really is to the problem at hand.  For something like water flowing through a pipe at low Mach numbers you will find that changes in density contribute very little to the resulting flow features.

A: Note that your relation is for gases and it is a first order approximation to small pressure and density differences according to a Taylor series of the full definition $c^2=\partial p/\partial \rho$. For incompressible fluids c is infinite because $\partial p/\partial \rho$ goes to infinity.

A: If the velocity of the fluid is above 100 m/s, then we can regard the flow as incompressible, let's assume tat this is the case for section 2 (smaller surface area therefore greater velocity).
If the flow is steady, then, we can say that the mass flow rate (that is rhoUA) would remain constant.
Now, furthermore, if the liquid is isothermal, then we can take the following steps:
rho*U1*A1 = rho*U2*A2.       rho= p/RT
p/RT*U1*A2 = p/RT*U2*A2.     T & R cancel (both constant)
p1*V(fr)1 = p2*V(fr)2.$       where V(fr) is the volume flow rate i.e U x A
Now, comparing the pressures at the section 1 (bigger surface area) and at section 2 (smaller surface area), we can see that, the pressure at section 1 would need to be greater if the flow would continue moving.
This is because at section 1, the area is bigger and the velocity is slower.
Now, p1>p2 hence, why, if we rearrange the above equation $
(p1/p2)* V(fr)1 = V(fr)2.  we can see that the volume flow rate at 2 would be greater than the volume flow rate at 1.
Now, this would make sense since the velocity would increase at section 2 due to the decrease in surface area.
The hardest part about this problem in uni for me was determining how the pressure would be greater at 1, and if you think in terms of the demand, which is to continue the flow of the fluid, then an increase in pressure would be the only plausible explanation for this example.

A: In liquids, pressure is not given by the above function of density (this is valid only for gases). The pressure will vary along the pipe according to the Bernoulli theorem and this variation is important to the description of the liquid flow. The density will vary slightly too, but this can be often neglected - the density can be assumed to have the same value everywhere.


text:
Q: How to get user input in java programs in vs code without using public static void main (String[]args) Can anyone please help me how to get user input in java programs in vs code without using public static void main (String [] args)
I can safely do this thing using method call in BlueJ ide but couldn't figure out how to do this in vs code or any other ides....
Here is the simple code that I want to run--
public class Rectangle
{
    public static void main (int l, int b)
    {
        int area, peri;
        area = l*b;
        peri = 2*(l+b);
        System.out.println("Area = "+area);
        System.out.println("Perimeter = "+peri);
    }
}

A: There isn't a practical alternative if you are writing a stand-alone command line application in Java.
There are various libraries for command line argument parsing in Java, but (AFAIK) they all require you to write a public static void main (String [] args) method .... even if it is just simple boilerplate code.
(This is not true for all kinds of Java application.  For example webapps in a web container, JavaFX applications, or ... applets)

A: You cant run a program with out main program. Execution always starts from main program.Your IDE may automatically generate main program, But if you are looking for an alternative way of ( other than command line argument)  getting input  you can use Scanner or any input stream methods

 import java.util.Scanner
    public class Rectangle
    {
        public static void main(String arg[])
        {    Scanner myObj = new Scanner(System.in);  // Create a Scanner object
            int l= myObj.nextInt();  // Read user input
            int b=myObj.nextInt();
            int area = l*b;
            int peri = 2*(l+b);
            System.out.println("Area = "+area);
            System.out.println("Perimeter = "+peri);
        }
    }

A: You can't not do that.
As described here a java application entry point has to be public static void main(String[] args).
This makes sense. The parameters from the command line arguments are Strings, not matter what. To make int out of it, there would be an implicit conversion. Where do you catch parsing errors for that if it happens before it reaches your code?


text:
Q: Load testing using Jmeter 5k users, website crashed I was running 5K users on a website while load testing with Jmeter. It was taking too long time and my colleagues were not able to access the site. Then i stop the test. now the website is totally dead and is not accessible. What should I do now?

A: You should either restart your browser and/or your entire system.

A: First of all I  would recommend you to try to understand how many users are going to use your system to set clear test objectives.
These articles I find useful:
stress testing web applications with JMeter (Part 1)
stress testing web applications with JMeter (part 2)
After you've set up your testing goals clearly follow JMeter Performance Testing best practices steps.
Also I would recommend you  to get acquainted with Load Testing Cloud - altentive cloud solution for running your .jmx tests instead of local run, which often associated with resource demand on your PC machine.

A: The best would be use ramp up technique. This does not over load the server all at once but adds the load slowly till its reaches peak. This way it is easier to find the crash point.
Restarting the server will be a good way to bring up the application. Also check the server Logs.


text:
Q: How do I get the Java sound API to work from jar Now there seems to be a lot of questions about the Java API itself, but I'm facing a problem I haven't found anywhere: My code runs fine if I run it directly from the class file, but it refuses to work as soon as I put it in a JAR.
public static void main(String[] args) {
    Mixer.Info[] mixerInfo = AudioSystem.getMixerInfo();
    for (Mixer.Info info: mixerInfo) {
        Mixer mixer = AudioSystem.getMixer(info);
        Line.Info[] targetLineInfo = mixer.getTargetLineInfo();
        for (Line.Info lineInfo: targetLineInfo) {
            try {
                Line line = mixer.getLine(lineInfo);
                line.open();     //<---- problematic line
                System.out.println("Success: Opened line " + line.getLineInfo());
                if (line.getLineInfo().getLineClass().equals(TargetDataLine.class)) {
                    TargetDataLine dataLine = (TargetDataLine) line;
                    byte[] read = new byte[16];
                    dataLine.start();
                    dataLine.read(read, 0, 16);
                    dataLine.stop();
                    System.out.println("Success: Finished reading from line " + line.getLineInfo());
                }
                line.close();
            } catch (LineUnavailableException e) {
                System.out.println("Error: " + e.getMessage());
            }
        }
    }
}

So for this very simple example, the following runs as expected:
src>javac AudioTest.java
src>java AudioTest
Success: Finished reading from line interface TargetDataLine supporting 8 audio formats, and buffers of at least 32 bytes
Success: Finished reading from line interface TargetDataLine supporting 8 audio formats, and buffers of at least 32 bytes

Building a jar out of this yields the following result:
src>jar cfe AudioTest.jar AudioTest AudioTest.class
src>jar tf AudioTest.jar
META-INF/
META-INF/MANIFEST.MF
AudioTest.class

The problem arises when trying to run this jar:
src>java -jar AudioTest.jar
Error: line with format PCM_SIGNED 44100.0 Hz, 16 bit, stereo, 4 bytes/frame, little-endian not supported.
Error: line with format PCM_SIGNED 44100.0 Hz, 16 bit, stereo, 4 bytes/frame, little-endian not supported.

Running the main class manually and putting the jar on the classpath works as expected.
src>java -classpath .\AudioTest.jar AudioTest
Success: Finished reading from line interface TargetDataLine supporting 8 audio formats, and buffers of at least 32 bytes
Success: Finished reading from line interface TargetDataLine supporting 8 audio formats, and buffers of at least 32 bytes

I'm completely stumped at this point. Any help is appreciated.


text:
Q: Response design and two fragments Hi I got one activity and 3 fragments.
1st fragment - List of items ---click---> it has to open layout and inflate there two frameLayouts with fragment 2 and fragment 3.
Here is the code in fragment 1 onItemClickListener
            if (getResources().getConfiguration().smallestScreenWidthDp >= 600) {
                FragmentManager fragmentManager = getActivity().getSupportFragmentManager();

                fragmentManager.beginTransaction()
                        .replace(R.id.main_frame_list_600_detailed, detailedFragment)
                        .addToBackStack(null)
                        .commit();
                StepDescriptionFragment stepDescriptionFragment =
                        StepDescriptionFragment.getInstance(itemClicked.getSteps(), 0);

                fragmentManager.beginTransaction()
                        .replace(R.id.main_frame_list_600_step, stepDescriptionFragment)
                        .addToBackStack(null)
                        .commit();

Here is the layout
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/tablet_linear_layout"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:baselineAligned="false"
    android:orientation="horizontal">
            <FrameLayout
                android:id="@+id/main_frame_list_600_detailed"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_weight="0.5" />

            <FrameLayout
                android:id="@+id/main_frame_list_600_step"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_weight="0.5" />
</LinearLayout>

Here is the error.
 07-09 14:34:14.547 9066-9066/com.example.boris.bakingapp E/FragmentManager: No view found for id 0x7f080072 (com.example.boris.bakingapp:id/main_frame_list_600_detailed) for fragment DetailedFragment{9ee18e2 #1 id=0x7f080072}
    Activity state:
    07-09 14:34:14.596 9066-9066/com.example.boris.bakingapp E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.example.boris.bakingapp, PID: 9066
    java.lang.IllegalArgumentException: No view found for id 0x7f080072 (com.example.boris.bakingapp:id/main_frame_list_600_detailed) for fragment DetailedFragment{9ee18e2 #1 id=0x7f080072}

So it suppose to put fragments in that views but it doesn't see it

A: it says no view found for "detailedFragment" please define it as you have done for "stepDescriptionFragment "
please show some more code like you have shown this :
StepDescriptionFragment stepDescriptionFragment =
                    StepDescriptionFragment.getInstance(itemClicked.getSteps(), 0);


text:
Q: How to validate each test case in Robot Framework How to validate each test case in Robot Framework. Like if i have  3 fields Name,Number and Join Date and Save button, all are mandatory fields.
First Case--> I will enter the Number and Join Date and click on the Save button then validation message will appear "Please enter the Name"
Second Case-->I will enter the Name and Join Date and click on the Save button then validation message will appear "Please enter the Number"
Third Case-->I will enter the Name and Number  and click on the Save button then validation message will appear "Please enter the Join Date "
Fourth Case-->1000 is already added then if i enter the Name,Number,Join Date click on the Save button validation message will appear "Duplicate Employee Number"
How to handle this case need to use "Test Template " if i use the Test Template
*** Settings ***
Documentation     A test suite containing tests related to invalid login.
...
...                     These tests are data-driven by they nature. They use a single
...                   keyword, specified with Test Template setting, that is called
...                    with different arguments to cover different scenarios.
...
...                    This suite also demonstrates using setups and teardowns in
...                    different levels.
Test Template     Invalid Data
Resource           resource.txt

*** Test Cases ***                           Number                     Name                    Join Date
Empty Employee Number               ${EMPTY}                  Foo                       01 Apr 2015
Empty Employee Name                  1000                         ${EMPTY}               01 Apr 2015
Empty Join Date                            1000                          Foo                        ${EMPTY}

*** Keywords ***
Invalid Data
      [Arguments]    ${employeenumber}    ${name}    ${doj}
      Enter Employee Number        ${employeenumber}
      Enter Employee Name           ${name}
      Enter Join Date                     ${doj}
      Validation check for Invalid Data

Validation check for Invalid Data
       Page Should Contain        Please enter the Name
       Page Should Contain        Please enter the Number
       Page Should Contain        Please enter the Join Date

If i use like this then first test case is Pass and rest of the test case will be Fail because for the second test case  it will check for "Page Should Contain        Please enter the Name" but for the second test case we are already adding the Number. How to handle these kind of cases in Robot Framwork can any one help me.

A: Add another argument for what you want to validate
*** Keywords ***
Invalid data
[Arguments]    ${employeenumber}    ${name}    ${doj}    ${expected}
...
Page should contain    ${expected}

*** Test Cases ***      Number    Name      Join Date     Expected
Empty Employee Number   ${EMPTY}  Foo       01 Apr 2015   Please enter the name
Empty Employee Name     1000      ${EMPTY}  01 Apr 2015   Please enter the number
Empty Join Date         1000      Foo       ${EMPTY}      Please enter the Join Date

A: In robot framework, with the help of if statement validators can be in used
LIKE EXAMPLE -
***variables***
${code_snippets}   print("Hello I am Sharvik")

***Test Cases***
        Input text   Locater_here   ${code_snippets}

        IF    ${code_snippets} == ${code_snippets}
                     Log    This line IS executed.
        END

Now if in this code something gets change in variable section then the Automation script will be failed.


text:
Q: JSON is Malformed - AWS Personalize Input File I'm trying to filter Recommendations with AWS Personalize.
Here is my data:
{"userId":"102155","filterValues":{"vehicleList":"\"487392\",\"136579\",\"389046\",\"454400\",\"108908\",\"172677\",\"552009\",\"140498\",\"575257\",\"141883\",\"82165\",\"271906\",\"349764\",\"555072\",\"487997\",\"445148\",\"377268\",\"155944\",\"695511\",\"42694\",\"2688\",\"686149\",\"428393\",\"303605\",\"315137\",\"429949\",\"36664\",\"399623\",\"255099\",\"198335\""}}

d
From using JSON lint and my eyes it seems like its structured accordingly to their documentation, yet I keep getting the Malformed JSON error.
Any help is very welcome! It was working before I added the filterValues.
Thanks

A: Note the structure of the json above. Filtervalues should look more like:
,"filterValues":{"vehicleList":"\"677186\",\"620751\"

Fixed the issue.


text:
Q: Spring Boot Actuator Endpoint "Not Found" for Wildfly Deployment since version 2.4.0 Since Spring Boot Release 2.4.0 the actuator endpoints don't work for me anymore if I choose to deploy the application as a WAR-file on Wildfly.
My Pom looks as follows:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
          https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.5.1</version>
        <relativePath /> <!-- lookup parent from repository -->
    </parent>
    <groupId>com.example</groupId>
    <artifactId>demo</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <packaging>war</packaging>
    <name>demo</name>
    <description>Demo project for Spring Boot</description>

    <properties>
        <java.version>1.8</java.version>
    </properties>
    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-actuator</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-tomcat</artifactId>
            <scope>provided</scope>
        </dependency>
        <!-- To run under Wildfly 23.y.z -->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-logging</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
        </plugins>
    </build>
</project>

additionally I have the jboss-web.xml file under src/main/webapp/WEB-INF with the content:
<?xml version="1.0" encoding="UTF-8"?>
<jboss-web xmlns="http://www.jboss.com/xml/ns/javaee"
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xsi:schemaLocation="
  http://www.jboss.com/xml/ns/javaee
  http://www.jboss.org/j2ee/schema/jboss-web_5_1.xsd">
    <context-root>/helloworld/</context-root>
</jboss-web>

The endpoint http://localhost:8080/helloworld/actuator/health for example is reachable if i downgrade the Spring Boot version to 2.3.12.RELEASE but returns a 404 code for Spring Boot 2.4.X and 2.5.X. If I run the application as a normal JAR-file with the embedded Tomcat the actuator endpoint is exposed successfully (under http://localhost:8080/actuator/health).
My Setup:
Wildfly: 23.0.2.Final
Java: AdoptOpenJDK - 11.0.10+9


text:
Q: Tiling flat-topped hexagons I found James Tauber's great CSS hexagon tutorial. I would like to use the pseudo element method shown at the end of the page to create a flat topped hexagon grid that would fill out the whole viewport. The code I've written for the hexagon itself is as follows:
.hex {
  float:left;
  position: relative;
  width: 15vw;
  height: 25vw;
  background-color: #64C7CC;
  margin-left: 8vw;
}

.hex:before,
.hex:after {
  position: absolute;
  content: "";
  border-top: 12.5vw solid transparent;
  border-bottom: 12.5vw solid transparent;
}

.hex:before {
  border-right: 9vw solid #64C7CC;
  right:15vw;
}

.hex:after {
    border-left: 9vw solid #64C7CC;
    left:15vw;
}

Here's the fiddle.
I am having trouble combining the pseudo element method with the tiling example shown in the tutorial. How can I repeat the shape to fill out the page - even the small gaps that they will leave near the edges of the viewport?

A: Here is the Demo

.hex {
  float:left;
  position: relative;
  width: 15vw;
  height: 25vw;
  background-color: #64C7CC;
  margin: 12vw;
}

.hex:before,
.hex:after {
  position: absolute;
  content: "";
  border-top: 12.5vw solid transparent;
  border-bottom: 12.5vw solid transparent;
}

.hex:before {
  border-right: 9vw solid #64C7CC;
  right:15vw;
}

.hex:after {
    border-left: 9vw solid #64C7CC;
    left:15vw;
}


text:
Q: Java JScrollPane I'm trying to add a Vertical scrolling my java programs textarea. I am using this code to create my JScrollPane:
console = my textarea.
I am also Declaring JScrollPane vertical;
        vertical = new JScrollPane(console);
    vertical.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
    vertical.setVisible(true);
    this.add(vertical);

EDIT:
View of program:

I'm new to Java but shouldn't that work and add a Vertical scroll bar to my textarea
What am I doing wrong?
Thanks for any help.

A: I think that in official tutorial about JTextArea and JScrollPane is described everything about that, another examples here and here
mySchroll = new JScrollPane(myTextArea,
    ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED,
    ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);

A: Here is an example:

import java.awt.Dimension;
import javax.swing.*;

public class ScrolledPane extends JPanel
{
    private JScrollPane vertical;
    private JTextArea console;

    public ScrolledPane()
    {
        setPreferredSize(new Dimension(200, 250));
        console = new JTextArea(15, 15);

        vertical = new JScrollPane(console);
        vertical.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
        add(vertical);
    }

    public static void main( String args[] )
    {
        new JFrame()
        {{
            getContentPane().add(new ScrolledPane());
            pack();
            setVisible(true);
        }};
    }
}

A: import javax.swing.*;
import java.awt.*;

public class Demo extends JFrame {

    private JTextArea textArea;
    private JScrollPane scroll;

    Demo(){
        super("Write here...");
        textArea = new JTextArea();
        scroll = new JScrollPane(textArea);
        scroll.setVerticalScrollBarPolicy(22); /*22 is a const value for always vertical */
        add(scroll, BorderLayout.CENTER);

        setSize(270,270);
        setVisible(true);

    }

    public static void main(String[] args) {
        new Demo();
    }

}

Output of the code :
See


text:
Q: gdb won't open a compiled python in Mac OS X 10.10 I can't open my compiled Python file in my Mac OS X 10.10 in gdb.
I tried these two options to open the file but it still not work:
p0sxs-iMac:~ p0sx$ gdb --args /usr/bin/python

Giving the error:

Error message from gdb: not in executable format: File format not recognized

Second option:
gdb --args python ./ReaFile.py

Giving the error:

Error message from gdb : not in executable format: File format not recognized

Hope someone can help me.

A: It seems like gdb is not capable of running a Universal binary. See post:

*

*https://sourceware.org/ml/gdb/2011-11/msg00133.html

file /usr/bin/python
      /usr/bin/python: Mach-O universal binary with 2 architectures
      /usr/bin/python (for architecture x86_64):      Mach-O 64-bit executable x86_64
      /usr/bin/python (for architecture i386):        Mach-O executable i386

Is there a way to build gdb to work around this?

No.  Currently gdb is not able to debug fat binary.  Use lipo to
  extract the architecture you want to use.


text:
Q: Creating A Hue on iOS I've had a client approach me with a very interesting programming request: To create a red hue that is permanent on the iPhone. You launch the app, turn on the hue, then while the app is running in the background, all of iOS will have a red tint. Obviously this would have to be on a jailbroken device, which I have no experience with.
The approach I want to take is putting a transparent red image on the screen, and allow for everything in the background to be pressed. Is this even possible? What would be the best approach?
I know this exists for iOS apps:
[[UIApplication sharedApplication] keyWindow].tintColor = [UIColor orangeColor];

But how can I do this to the entire OS?

A: This would be a very simple jailbreak tweak. First you will have to learn to write a jailbreak tweak, start here: http://iphonedevwiki.net/index.php/Getting_Started
Skipping ahead and pretending that you already have your environment setup and able to build a tweak, you will hook into SpringBoard at the point where it is finished loading the UI(ex. applicationDidFinishLaunching:) and add a new window at a very high level(ex. 10,000). With the app or preference bundle to turn it on the hue you will just setBackgroundColor: of that window.


text:
Q: 'it' in mocha does not run on using await "it" in mocha does not run on using await.
I use functions to read files asynchronously and based on the returned value, run multiple loops to process my test.
I also use the same file read functions multiple times in the loop.
I need to use await to get the resolved value from that function.
If I remove the await then the "it" runs but my function remains unresolved.
const subList1 = [
    {name: 'value1', info: 'value1'},
    {name: 'value2', info: 'value2'},
    {name: 'value3', info: 'value3'},
]
const subList2 = [
    {name: 'value1', info: 'value1'},
    {name: 'value2', info: 'value2'},
    {name: 'value3', info: 'value3'},
]
const subList3 = [
    {name: 'value1', info: 'value1'},
    {name: 'value2', info: 'value2'},
    {name: 'value3', info: 'value3'},
]

const mainList = [
    subList1, subList2, subList3,
    ]

function getList() {
    return mainList;
}

describe('Test', async function () {
    const list = await getList();
    list.forEach(mainListItem => {
        describe('Main Test', function () {
            mainListItem.forEach(subListItem => {
                describe(subListItem.name, function () {
                    let valueInCaps;
                    const name = subListItem.name;
                    console.log(`name: ${JSON.stringify(name)}`);
                    before(function () {
                        valueInCaps = subListItem.info.toUpperCase();
                    })
                    it(name, function () {
                        console.log(valueInCaps);
                    })
                })
            })

        });
    });
})

Expected:
name: "value1"
name: "value2"
name: "value3"
name: "value1"
name: "value2"
name: "value3"
name: "value1"
name: "value2"
name: "value3"

  Test
    Main Test
      value1
VALUE1
        √ value1
      value2
VALUE2
        √ value2
      value3
VALUE3
        √ value3
    Main Test
      value1
VALUE1
        √ value1
      value2
VALUE2
        √ value2
      value3
VALUE3
        √ value3
    Main Test
      value1
VALUE1
        √ value1
      value2
VALUE2
        √ value2
      value3
VALUE3
        √ value3

Actual:
name: "value1"
name: "value2"
name: "value3"
name: "value1"
name: "value2"
name: "value3"
name: "value1"
name: "value2"
name: "value3"

A: If you go into the the mocha websites you'll find a good example of how to structure a test. I believe your problem is that you are not asserting anything in your tests. You're not testing any assumptions.
// require an assertion library
var assert = require('assert');

    describe('Test', async function () {
        const list = await getList();
        list.forEach(mainListItem => {
            describe('Main Test', function () {
                mainListItem.forEach(subListItem => {
                    describe(subListItem.name, function () {
                        let valueInCaps;
                        const name = subListItem.name;
                        console.log(`name: ${JSON.stringify(name)}`);
                        before(function () {
                            valueInCaps = subListItem.info.toUpperCase();
                        })
                        it(name, function () {
                            console.log(valueInCaps);
                            assert.equal(someCondition)
                        })
                    })
                })

            });
        });
    })


text:
Q: memory game in objective-c I'm making a memory game in obj-c. I have 6 UIButtons as cards and 3 pairs of pictures. I just arc4Random() % 3 for each button to get a new image every time view loads. My problem is that, obviously, for example all buttons could have the same image since it just takes a random number. How can I make sure only 2 images of each pair is generated?

A: You can add the images in an array, shuffle it, and then iterate on it, setting the buttons' images.


text:
Q: objective c - how do I set the scope when declaring what my cell.textlabels should be? I have this code that where I would normally use one line:
    if (tableView == self.searchDisplayController.searchResultsTableView)
{
    NSLog(@"Configuring cell to show search results");
    shoppingList = [self.searchResults objectAtIndex:indexPath.row];

    cell.textLabel.text = shopList.name;
    cell.textLabel.text = shopList.type;
    cell.textLabel.text = shopList.price;
    cell.textLabel.text = shopList.occasion;

    }

The reason I have this is that I am implementing a scope under my search bar.
Now the scope works, when I type in a name I would expect to see the name when I select the first scope which is the name of the product.
What is happening however is that it shows what is under occasion, since it is the last one  in the list (I pressume). So when I type in the name of a product it comes up with the matching occasion instead of the name of the product.
How do I set it up that it shows what I select in the scope?
I have implemented the following method, to make the scope work correctly, just the labels are not coming up right, which is affected in the tableView section code above.
- (void)filterContentForSearchText:(NSString*)searchText scope:(NSString*)scope
 {

Any help is great:-)
Thanks.

A: The = operator is the assignment operator.  That means that whatever is on the left side of the = operator is going to become whatever is on the right side after that line of code is executed.
For example:
int i = 5;
i = 4;
i = 3;
i = 8;
After all four of those lines are executed, i is equal to 8.  It doesn't matter that it was another value previously--the = operator obliterates whatever was in the variable before and places the new value into it.
So, regardless of what you want your code to do, what you are doing is obliterating the value of cell.textlabel.text every time you use the = operator.  shopList.name, shopList.type, and shopList.price don't exist anymore after you set cell.textlabel.text to shopList.occasion, for the same reason i = 8 in my above example.  This is a fundamental and hugely important programming concept.
Do you understand what's wrong, now?  If you want to save all four items--price, name, type, and occasion--you need four separate variables to do so.

As an aside, I'm fairly certain you aren't using the word scope properly (unless I'm entirely misunderstanding the purpose of your program).  From Wikipedia:

In computer programming, a scope is the context within a computer
  program in which a variable name or other identifier is valid and can
  be used, or within which a declaration has effect. Outside of the
  scope of a variable name, the variable's value may still be stored,
  and may even be accessible in some way, but the name does not refer to
  it; that is, the name is not bound to the variable's storage.