text:
Q: How to focus search bar on barbutton click? I am trying to autofocus a searchbar when i click on a bar button, but it does not seem to work with becomeFirstResponder, follow the GIF:

I've already tried using becomeFirstResponder and it does not work, this is how i am handling the searchbar:
// MARK: SearchBar Delegate
    @IBAction func showSearchBarAction(_ sender: Any) {
        let searchController = UISearchController(searchResultsController: nil)
        searchController.searchBar.delegate = self
        searchController.searchResultsUpdater = self
        searchController.searchBar.keyboardAppearance = .dark
        searchController.dimsBackgroundDuringPresentation = false
        navigationItem.searchController = searchController
        navigationItem.searchController?.isActive = true
    }

    func searchBarCancelButtonClicked(_ searchBar: UISearchBar) {
        navigationItem.searchController?.isActive = false
        self.navigationItem.searchController = nil
    }

All of it works perfectly, but the autofocus is something i really want and i can't change my design as well
Solution
This code is the solution:

This is how my class declaration looks like:
class YourViewController: UITableViewController, UISearchResultsUpdating, UISearchBarDelegate, UISearchControllerDelegate {

// MARK: SearchBar Delegate
    @IBAction func showSearchBarAction(_ sender: Any) {
        let searchController = UISearchController(searchResultsController: nil)
        searchController.delegate = self
        searchController.searchBar.delegate = self
        searchController.searchResultsUpdater = self
        searchController.searchBar.keyboardAppearance = .dark
        searchController.dimsBackgroundDuringPresentation = false
        self.navigationItem.searchController = searchController
        self.navigationItem.searchController?.isActive = true
    }

    func didPresentSearchController(_ searchController: UISearchController) {

        DispatchQueue.main.async {
            searchController.searchBar.becomeFirstResponder()
        }
    }

    func searchBarCancelButtonClicked(_ searchBar: UISearchBar) {
        navigationItem.searchController?.isActive = false
        self.navigationItem.searchController = nil
    }


text:
Q: Converting a input (Password) into MD5 Hi I'm a bit new to this and can't exactly figure out how to get it working.
Here is my current code:
import hashlib

def PasswordCreate():
    password = input(str("Please enter a password next to this text"))
    password = hashlib.md5()
    password.update(password.encode('utf-8'))
    return password.hexdigest()

PasswordCreate()

The error is:
AttributeError: '_hashlib.HASH' object has no attribute 'encode'

A: Hello Josh,
Try this code,
import hashlib
def PasswordCreate():
  inputVar = input(str("Please enter a password next to this text: "))
  password = hashlib.md5()
  password.update(inputVar.encode("utf-8"))
  return password.hexdigest()

# Create Variable for dipslay encoded value.
displayPass = PasswordCreate()
print "User Password is: ",displayPass

A: Perhaps something like following:
import hashlib

def PasswordCreate():
    password = raw_input(str("Please enter a password next to this text: "))
    return hashlib.md5(password).hexdigest()

PasswordCreate()

A: import hashlib

def PasswordCreate():
    user_in = input(str("Please enter a password next to this text"))
    password = hashlib.md5()
    password.update(user_in.encode("utf-8"))
    return password.hexdigest()

PasswordCreate()

Just an issue in your variables. See user_in in my code

A: As simple as I can put:
import hashlib
print(hashlib.md5(input().encode()).hexdigest())

redpajama_set_name: RedPajamaStackExchange


text:
Q: Change of entropy in irreversible process When calculating entropy change for a irreversible process,do I assume a reversible path and then integrated it?

A: If the endpoints of the irreversible path are equilibrium points and they can also be connected with a reversible path then the answer is yes, because the entropy is a state function. Complications ensue if there is no reversible path connecting the endpoints of the irreversible path or the irreversible process does not start/end in thermodynamic equilibrium. An example for the latter is ferromagnetic hysteresis or plastic deformation, see Bridgman: "The Thermodynamics of Plastic Deformation and Generalized Entropy", REV. MOD. PHYS. VOL. 22. NUMBER 1 JANUARY, 1950. and Tolman & Fine: "On the Irreversible Production of Entropy" REV. MOD. PHYS. VOL. 20, NUMBER 1 JANUARY, 1948

A: Once you have determined the final state of the system for the irreversible process (say using the 1st law of thermodynamics), you devise an alternate reversible process path between the same initial and final end states and integrate along that path.  For further details on how to do this, see the following link:  https://www.physicsforums.com/insights/grandpa-chets-entropy-recipe/


text:
Q: \caption{title subsubsection} I am entering the following code in more than 180 times after each \subsubsection.
Is there any way to automate \caption{subsubsection title}?
I tried with \caption{\subsubsectiontitlename} but it does not work.
%%%%%%%%

\begin{figure}[H]
\caption{títol \subsubsection}
\subfloat[Mostres absolutes]{
\includegraphics[width=0.50\linewidth]{Columna_34_absol.jpg}}
\subfloat[Mostres ponderades]{
\includegraphics[width=0.50\linewidth]{Columna_34_pond.jpg}}
\\
\subfloat[]{
\includegraphics[scale=0.1]{Formatge_34_preg.jpg}}
\subfloat[]{\includegraphics[width=0.33\linewidth]{Formatge_34_absol.jpg}}
\hfil
\subfloat[]{\includegraphics[width=0.33\linewidth]{Formatge_34_pond.jpg}}\hfil
}
\end{figure}

%%%%%%%%%%%%%%%%

A: Use a personal environment:
\newenvironment{subsectionfigure}[1]
  {\subsection{#1}\begin{figure}[H]\caption{#1}}
  {\end{figure}}

and then
\begin{subsectionfigure}{Title of this subsection}
\subfloat[Mostres absolutes]{
\includegraphics[width=0.50\linewidth]{Columna_34_absol.jpg}}
\subfloat[Mostres ponderades]{
\includegraphics[width=0.50\linewidth]{Columna_34_pond.jpg}}
\\
\subfloat[]{
\includegraphics[scale=0.1]{Formatge_34_preg.jpg}}
\subfloat[]{\includegraphics[width=0.33\linewidth]{Formatge_34_absol.jpg}}
\hfil
\subfloat[]{\includegraphics[width=0.33\linewidth]{Formatge_34_pond.jpg}}\hfil
}
\end{subsectionfigure}

In the argument of the newly defined argument you put the subsection title, which will be repeated in the caption (although it seems a useless repetition).

A: Here a solution that works by modifying the subsubsection command. Note: this only works properly if the figure is inside of a subsubsection.
Add these lines to your preamble:
\let\oldsubsubsection\subsubsection
\newcommand\ssv{}
\newcommand\tempcommand[1]{%
\renewcommand\ssv{#1}%
\oldsubsubsection{#1}}
\renewcommand\subsubsection\tempcommand

Then, for your captions in your figures you can use \caption{\ssv}. This should output the name of the current subsubsection title in the caption.


text:
Q: Document.onload not working in JavaScript? I write document.onload code inside my head tag.. but it doesn't seems to work.
here is my code..
<head>
<script>
    document.onload = function () {
        alert("Window Loaded...!!");
    }
</script>
</head>

But if i replace  with window.onload it perfectly works!!
What is the problem? Am I doing something wrong ??

A: As far as I'm aware, the closest you can come to your method is:
document.addEventListener('DOMContentLoaded', function () {
   /* your logic here */
});

The problem you have is document may not have a method of onload for a particular browser. Luckily! The window does in most cases. :) Give that a try for your JavaScript invocation.


text:
Q: Alter $resource default methods How can I alter and add to the default $resource return object methods?
The return object defaults in question are (from the docs):
A resource "class" object with methods for the default set of resource actions optionally extended with custom actions. The default set contains these actions:
{ 'get':    {method:'GET'},
  'save':   {method:'POST'},
  'query':  {method:'GET', isArray:true},
  'remove': {method:'DELETE'},
  'delete': {method:'DELETE'} };

As I understand, this does not follow the restful principles so good in regard to when to use POST and PUT. Perhaps it would be better to have the following methods:
{ 'get':    {method:'GET'},
  'save':   {method:'PUT'},
  'create': {method:'POST'},
  'query':  {method:'GET', isArray:true},
  'remove': {method:'DELETE'},
  'delete': {method:'DELETE'} };

Is there a way to change the default object that $resource creates, so I do not need to alter each resource I am creating with $resource?

A: I found a talk at ng-conf 2014 by Googles DoubleClick team that was a real good answer to this question and beyond. Basically they create a apiProvider that uses and extends $resource.
They also have a github gist that would be too long to include here.


text:
Q: Save R output to a different directory I am running some R code on a Windows computer using RStudio and my code generates Excel files and netCDF files periodically (dozens of them eventually). I don't want them to clutter my working directory. Is there a way to save the files to a directory called "Output" (ex:  C:/.../original file path/Output) in the parent directory? I would like a way to change my current working directory to a different directory. I understand there is getwd() and setwd() but how do I set the path to the output directory without typing out the entire windows path (for example: setwd(current source file path for windows or Mac/output). My collaborator uses a Mac and he would have his output stored there as well.

A: You have a file argument in your write* function. If your Output directory is in your working directory, it works like this:
write.xlsx(df, file = "Output/table.xlsx")
write.csv(df, file = "Output/table.csv")

A: You can specify an argument in your write.csv function and other similar write functions which specifies your path.
#Output path
OutPath<- "C:/blah/blahblah/op/"

#Table to dump as output
OutTbl <- iris

write.csv(OutTbl, file = OutPath)

Source: https://stat.ethz.ch/R-manual/R-devel/library/utils/html/write.table.html


text:
Q: C: not printing what I want I have a simple code to print only the numbers in a string, but yet it's not printing what I want and I have absolutely no idea why. It should print 1 and 10 but it prints 1, 10 and 100. Now why the 100?? :s
char string[50] = "1 10 +";
int value = 0;

for (int i = 0; i != strlen(string); i++)
{
    if (isdigit(string[i])){
            value = value*10 + atoi(&string[i]);
            printf(" %d\n", value);
    }
    else
    {
        if (string[i] == ' ')
        {
                value = 0;
        }
    }
}
return(0);
}

A: Assume the function isdigit() performs correctly, the string[i] inside the if block would be in the range between '0'..'9'.
Replace your line:
value = value*10 + atoi(&string[i]);

with
value = value*10 + string[i] - '0'; // the difference between string[i] and '0'
                                    // are the integer value you're looking for.
                                    // i.e.  '9' - '0' equals to 9.

Further, you probably don't want to print the value inside the loop. Instead, print the final value  at the end might be better.

A: Here is a solution that will print only the digits of a given string separated by a single white space.
int main(void) {
        char *string = "1   10  +";
        int len = strlen(string);
        for( int i = 0 ; i < len ; ) {
                while (i < len && isdigit(string[i])) printf("%c", string[i++]);
                while (i < len && ! isdigit(string[i])) i++;
                printf(" ");
        }
        return 0;
}


text:
Q: Detect paired bluetooth devices from application How to discover non-apple compliant Bluetooth devices with iPhone..???
I have made an app where i need to detect non- apple compliant Bluetooth car kit with my iPhone.i have to detect Bluetooth devices paired with my iPhone  when car kit comes in range i have to call a method. Unable to detect device using external accessory framework. so any help regarding this will be appreciable.Thanks in advance

A: I  am not from iPhone but i think Bluetooth communication to external devices for non-jailbroken iOS devices is restricted to MFi-compliant Bluetooth hardware.


text:
Q: SQL simulating Auto increment field We are about to move our website to windows azure and faced a problem with sql-azure. They are not supporting the identity increment property due to a performance optimization.
Hence we have to design our own logic to support the existing feature in generating sequential identity.
So to generate unique sequential value we get the max(value) from the ID field of the table and increment it by 1 to insert a new record.
We now have to manage concurrent transactions, hence checked with isolation levels.
However none of the isolation level lock the table to avoid reading the max value under concurrency.
Any help on locking a table or comment about this method would be very helpful. If some of you have already overcome this problem in a nice way, then can you please share..
Thanks for your help.

A: Use the following procedure to increment a value stored in a separate table.  Putting an exclusive lock on the main table will result in horrible concurrency issues.
CREATE PROCEDURE [dbo].[GetNextID](
    @IDName nvarchar(255)
)
AS
BEGIN
    /*
        Description:    Increments and returns the LastID value from tblIDs for a given IDName
        Author:         Max Vernon / Mike Defehr
        Date:           2012-07-19

    */

    DECLARE @Retry int;
    DECLARE @EN int, @ES int, @ET int;
    SET @Retry = 5;
    DECLARE @NewID int;
    SET TRANSACTION ISOLATION LEVEL SERIALIZABLE;
    SET NOCOUNT ON;
    WHILE @Retry > 0
    BEGIN
        BEGIN TRY
            UPDATE dbo.tblIDs
            SET @NewID = LastID = LastID + 1
            WHERE IDName = @IDName;

            IF @NewID IS NULL
            BEGIN
                SET @NewID = 1;
                INSERT INTO tblIDs (IDName, LastID) VALUES (@IDName, @NewID);
            END
            SET @Retry = -2; /* no need to retry since the operation completed */
        END TRY
        BEGIN CATCH
            IF (ERROR_NUMBER() = 1205) /* DEADLOCK */
                SET @Retry = @Retry - 1;
            ELSE
                BEGIN
                SET @Retry = -1;
                SET @EN = ERROR_NUMBER();
                SET @ES = ERROR_SEVERITY();
                SET @ET = ERROR_STATE()
                RAISERROR (@EN,@ES,@ET);
                END
        END CATCH
    END
    IF @Retry = 0 /* must have deadlock'd 5 times. */
    BEGIN
        SET @EN = 1205;
        SET @ES = 13;
        SET @ET = 1
        RAISERROR (@EN,@ES,@ET);
    END
    ELSE
        SELECT @NewID AS NewID;
END
GO

(For completeness, here is the table associated with the stored proc)
CREATE TABLE [dbo].[tblIDs]
(
    IDName nvarchar(255) NOT NULL,
    LastID int NULL,
    CONSTRAINT [PK_tblIDs] PRIMARY KEY CLUSTERED
    (
        [IDName] ASC
    ) WITH
    (
        PAD_INDEX = OFF
        , STATISTICS_NORECOMPUTE = OFF
        , IGNORE_DUP_KEY = OFF
        , ALLOW_ROW_LOCKS = ON
        , ALLOW_PAGE_LOCKS = ON
        , FILLFACTOR = 100
    )
);
GO

Every time you want to obtain a new ID to use in the main table, you simply EXEC GetNextID 'TableIDField';

A: You can achieve something similar this way

*

*Start a transaction (in read committed transaction isolation level).

*Select the max existing value with exclusive lock in SELECT query ((XLOCK) hint).

*Update the value to be increased by 1.

*Commit transaction.
Putting exclusive lock into the select statement will lock all other processes that will want to read the ID at the same time. They will have to wait until the transaction is finalised and  will read the new value if the transaction was committed.

As pointed out by Max Vernon below, this approach may not be suitable for high volume, highly concurrent systems. It may result in deadlocks as well (though possibility of deadlocks is not limited to this solution).

A: ** Not a Sql Answer **
In the past I've solved similar situations by passing the ID into the insert.
To make sure it is the correct id you have a service exposed that runs on one box that just returns an integer from memory that is auto incremented after every request.
Should the service go down, fetch the max id from your table, increment and start handing out the Id's again.
This functions very similarly to a queue.


text:
Q: How to attach files to list item using Client Object Model? I have a SharePoint List to which I am adding new ListItems using the Client Object Model.
Adding ListItems is not a problem and works great.
How to add Attachments?

A: You can use below logic
List list = web.Lists.GetByTitle("listtitle");
ListItem item = list.GetItemById(1);
var attachment = new AttachmentCreationInformation();
attachment.FileName = "fileName";
attachment.ContentStream = new MemoryStream(System.IO.File.ReadAllBytes("streamFile"));
Attachment att = item.AttachmentFiles.Add(attachment);
context.Load(att);
context.ExecuteQuery();

A: using (var ctx = GetContext(webUri, userName, password))
{
   var list = ctx.Web.Lists.GetByTitle(listTitle);
   var listItem = list.GetItemById(itemId);
   var attachment = listItem.SaveAttachment(filePath);
}

where
static class ListItemExtensions
{
    public static Attachment SaveAttachment(this ListItem item,string path)
    {
        var ctx = item.Context;
        var attachmentInfo = new AttachmentCreationInformation();
        attachmentInfo.FileName = System.IO.Path.GetFileName(path);
        using (var fs = new FileStream(path, FileMode.Open))
        {
            attachmentInfo.ContentStream = fs;
            var attachment =  item.AttachmentFiles.Add(attachmentInfo);
            ctx.ExecuteQuery();
            return attachment;
        }
    }

}

public static ClientContext GetContext(Uri webUri, string userName, string password)
{
    var securePassword = new SecureString();
    foreach (var ch in password) securePassword.AppendChar(ch);
    return new ClientContext(webUri) { Credentials = new SharePointOnlineCredentials(userName, securePassword) };
}


text:
Q: Why does Elm use the '++' operator to concatenate strings? I am learning Elm and I find a lot of things that are attractive about it, such as its elegance and simplicity.  However, one aspect that I find puzzling is its use of "++" to concatenate strings. For example:
> "hello" ++ " world"
"hello world"

Addition works the way you would expect it.
> 2 + 3 + 9
14

The majority of high level languages such as C#/Java/JavaScript/Python  use a single plus "+" in concatenating strings in the analogous way multiple numbers would be summed. It seems so much more intuitive, as there is a certain consistency in concatenating strings like summing numbers.
Does anyone know the logic behind the design decision to use a ++ instead of + in this context?

A: This may be to avoid overloading an operator.
It can be useful to statically infer types or even improve readability when variables are used, as it is then clear what is being done (string concatenation if ++ or arithmetics if +).
In languages that are not strongly typed (I do not know if this is the case in Elm), using the same notation can make it impossible to know what is being done on variables before actually running the program, which makes it slower.
XQuery uses || instead of + too, some languages even use different notations for decimals, like +. in CAML.

A: According to the docs, the ++ operator is used for appending lists:
-- alias for appending lists and two lists
append xs ys = xs ++ ys
xs = [1,2,3]
ys = [4,5,6]

-- All of the following expressions are equivalent:
a1 = append xs ys
a2 = xs ++ ys

b2 = (++) xs ys

c1 = (append xs) ys
c2 = ((++) xs) ys

Prior to version 0.9, strings were represented as a Haskell-inspired list of characters. Version 0.9 introduced a new string library (see the announcement here), so it looks like the ++ operator persisted despite strings no longer being represented as a list.

A: Elm allows you to define polymorphic functions.
Parametric polymorphism is when a function can be applied to elements of any types:
f : (a, b) -> (b, a)
f (x, y) = (y, x)

Ad-hoc polymorphism is when a function can be applied to elements of some types:
g : appendable -> appendable -> appendable -> appendable
g x y z = x ++ y ++ z

h : number -> number -> number
h x y = (x + 2) * y

The type variables number and appendable are special because they represent a subset of all Elm types. List and String are appendable types while Float and Int are number types.
It could theoretically be possible to instead define a hasPlus type variable which would include List, String, Float and Int, but then when defining a polymorphic function you would need to be aware that it is possible that x + y is different than y + x and that would be quite a burden if you are actually thinking about numbers...

A: Concatenation and addition are completely different operations with different properties. For example, addition is commutative (on integers, floats are different beasts), while concatenation most definitely is not. The arbitrary decision to re-use the operators by some languages is the strongest connection between them you can find.
And even if the overloading made sense, you would hit the static nature of the language – what should the type of such operator be?
Currently the operator works on magic type number:
(+) : number -> number -> number

While you could have a new magic type numberorstring and the + function would be polymorphic with two different semantics, this would only be introducing even more magic into the language.


text:
Q: ARM GDB cannot access memory only on Linux Trying to switch development to Linux, but running into a (probably simple newbie) problem. On my Mac, I can use ARM GDB (arm-eabi-none-gdb from the GNU ARM Embedded Toolchain) to load my elf to my STM32L432, then at my breakpoints a simple i lo (or examine, or whatever) gives me the local vars. On Linux, however, the exact same code gives me something like the following:
cr1 = <error reading variable cr1 (Cannot access memory at address 0x2000fff4)>

Is there something I should be doing different to map the memory correctly?
Edit: Thought I'd start again today with a mem dump of the entire SRAM block (datasheet RM0394 page 63) to see if there's just some offset (maybe some sort of memory aliasing that I was unaware of), but even the dump command is stymied:
(gdb) dump ihex memory result.bin 0x20000000 0x40000000
Cannot access memory at address 0x2000c000

This isn't happening on my Mac, and I can see the data I'm looking for on my scope (nothing like debugging software with a scope), so the problem isn't with the SRAM, but with gdb.
And to the person who voted to close, could you specify in what way this is off-topic? I'm stepping through code using gdb and there are tags for pretty much everything I mention, which leads me to believe that this is an appropriate place for the question. I'm not asking for "debugging help" as in "help with debugging specific code", I'm asking for help with a very widely used debugger on somewhat common equipment.

A: For anyone with this problem in the future (sc. myself), the issue was that gdb was not tracking the memory region that includes my SRAM (viz. 0x2000c000 to 0x40000000). The fix was to set up a memory region manually.
Before:
(gdb) info mem
Using memory regions provided by the target.
Num Enb Low Addr   High Addr  Attrs
0   y   0x00000000 0x00040000 ro nocache
1   y   0x08000000 0x08040000 flash blocksize 0x800 nocache
2   y   0x1fff0000 0x1fff7000 ro nocache
3   y   0x1ffff800 0x1ffff810 ro nocache
4   y   0x20000000 0x2000c000 rw nocache
5   y   0x40000000 0x5fffffff rw nocache
6   y   0xe0000000 0xffffffff rw nocache

After:
(gdb) mem 0x2000c000 0x40000000 32 rw
(gdb) info mem
Using user-defined memory regions.
Num Enb Low Addr   High Addr  Attrs
0   y   0x00000000 0x00040000 ro nocache
1   y   0x08000000 0x08040000 flash blocksize 0x800 nocache
2   y   0x1fff0000 0x1fff7000 ro nocache
3   y   0x1ffff800 0x1ffff810 ro nocache
4   y   0x20000000 0x2000c000 rw nocache
1   y   0x2000c000 0x40000000 rw 32 nocache
5   y   0x40000000 0x5fffffff rw nocache
6   y   0xe0000000 0xffffffff rw nocache

(gdb) x/x cr1
0x36c:  0x60f8af00

A: I encountered the same problem when I used st-util 1.3.0 as the GDB server to debug on a STM32L432. It looks like this is a problem in that version, which was fixed in st-util 1.5.0. At the moment there is only source code for that version, so if you happen to be in the situation, try build 1.5.0 from code and try it.


text:
Q: Where to set MVC 3 Connection Strings in code I would like to connect to an existing database, and I put the connection string in the ConnectionStrings section of the Web.Config. But where and how do you refer to this connection in the code. For example, I try things like
string connString = System.Configuration.ConfigurationManager.ConnectionStrings["MyDatabase"].ToString();
in my C# code right before I read the database.
The only way I can make it work is to hard-code the connection string in the C# code, because I don't know how to get it from Web.Config.

A: That code you have is correct (i fixed one small typo with it).  Make sure you add a reference to System.Configuration to your project. And obviously make sure that "MyDatabase" exists as a connection string in the project's web.config.


text:
Q: Error 5123 when creating a database with my SQL Server on Linux I followed the steps of this MS Guide and I managed to run a localdb and create a Testdb with this script:
CREATE DATABASE Test
ON
    (NAME='Test_DAT',
    FILENAME='/home/dlag/Documentos/Proyectos/BDtest/Test.mdf',
    SIZE=10,
    MAXSIZE=50,
    FILEGROWTH=5)
LOG ON
    (NAME='Test_Log',
    FILENAME='/home/dlag/Documentos/Proyectos/BDtest/Test.ldf',
    SIZE=5,
    MAXSIZE=25,
    FILEGROWTH=5);

GO
use Test;
GO

Time after, I try to create another db with the following script:
CREATE DATABASE BconDatos2
ON
    (NAME='BconDatos2_DAT',
    FILENAME='/home/dlag/Documentos/Proyectos/BDs/BiblioConDatos2/BconDatos2.mdf',
    SIZE=10,
    MAXSIZE=50,
    FILEGROWTH=5)
LOG ON
    (NAME='BconDatos2_Log',
    FILENAME='/home/dlag/Documentos/Proyectos/BDs/BiblioConDatos2/BconDatos2.ldf',
    SIZE=5,
    MAXSIZE=25,
    FILEGROWTH=5);

GO
use BconDatos2;

and I get this errors:
Msg 5123, Level 16, State 1, Line 4

AND SAYS(translated from Spanish):

The instruction CREATE FILE found OS error: 2(The system cannot find the file specified.) when trying to open or create the physical file.
   '/home/dlag/Documentos/Proyectos/BDs/BiblioConDatos2/BconDatos2.mdf'.

Msg 1802, Level 16, State 4, Line 4

(translated from Spanish):

CREATE DATABASE error. Can not create some of the files in the list. See related errors

Total execution time: 00:00:00.081

On both DB I'm in master and the path for mdf and ldf files are previously created.
It's strange because in the script of 'Test' DB I can make SELECTS for Tables, but when I run:
SELECT Name from sys.Databases

This database doesn't appear, but another empty DB created later appears.
Anyway on 'BconDatos2' DB script I can't create DataBases...
Problems with permissions on scripts?

A: Finally I solve it.
The problem was about users permissions in the directory where T-SQL was going to create the file.
I make the user 'mssql' who create the DB, owner of the folder where DB files are going to be placed.

A: The problem isn't solved, but I just donwloaded the software 'Azure Data Studio' developed for linux and I have been able to see that the tables were being created in master. It's seems this app works and is more convenient to me for learn msslq by now. So maybe we can close the post.


text:
Q: Chi-Square Test of Independence in r I have a technical question related to my df structure.
It looks like this:
    Month District   Age Gender Education Disability Religion                          Occupation JobSeekers GMI
1 2020-01      Dan   U17   Male      None       None   Jewish              Unprofessional workers          2   0
2 2020-01      Dan   U17   Male      None       None  Muslims          Sales and costumer service          1   0
3 2020-01      Dan   U17 Female      None       None    Other                           Undefined          1   0
4 2020-01      Dan 18-24   Male      None       None   Jewish         Production and construction          1   0
5 2020-01      Dan 18-24   Male      None       None   Jewish                     Academic degree          1   0
6 2020-01      Dan 18-24   Male      None       None   Jewish Practical engineers and technicians          1   0
  ACU NACU NewSeekers NewFiredSeekers
1   0    2          0               0
2   0    1          0               0
3   0    1          0               0
4   0    1          0               0
5   0    1          0               0
6   0    1          1               1

And I'm looking for a way to make an Chi-Square Test of Independence between 2 variables like district and JobSeekers so i can tell if Northern district related to jobseekers more than the southern for example.
As far as i can tell, something is wrong with the data structure (District is a char and jobseekers is an integer which indicate how many jobseekers I have based on District, Gender, Occupation etc)
I tried to subset it to district and jobseekers like this:
  Month   District  JobSeekers   GMI   ACU  NACU NewSeekers NewFiredSeekers
  <chr>   <chr>          <int> <int> <int> <int>      <int>           <int>
1 2020-01 Dan            33071  4694  9548 18829       6551            4682
2 2020-01 Jerusalem      21973  7665  3395 10913       3589            2260
3 2020-01 North          47589 22917  4318 20354       6154            3845
4 2020-01 Sharon         25403  6925  4633 13845       4131            2727
5 2020-01 South          37089 18874  2810 15405       4469            2342
6 2020-02 Dan            32660  4554  9615 18491       5529            3689

But it makes it harder to handle
I'll accept any other test that will work of course.
Please help and let me know if there's more information that you need,
Moshe
Update
# t test for district vs new seekers

# sorting

dist.newseek <- Cdata %>%
  group_by(Month,District) %>%
  summarise(NewSeekers=sum(NewSeekers))

# performing a t test on the mini table we created

t.test(NewSeekers ~ District,data=subset(dist.newseek,District %in% c("Dan","South")))

# results

Welch Two Sample t-test

data:  NewSeekers by District
t = 0.68883, df = 4.1617, p-value = 0.5274
alternative hypothesis: true difference in means is not equal to 0
95 percent confidence interval:
  -119952.3  200737.3
sample estimates:
  mean in group Dan mean in group South
74608.25            34215.75

#wilcoxon test

# filtering Cdata to New seekers based on month and age

age.newseek <- Cdata %>%
  group_by(Month,Age) %>%
  summarise(NewSeekers=sum(NewSeekers))

#performing a wilcoxon test on the subset

wilcox.test(NewSeekers ~ Age,data=subset(age.newseek,Age %in% c("25-34","45-54")))

# Results

Wilcoxon rank sum exact test

data:  NewSeekers by Age
W = 11, p-value = 0.4857
alternative hypothesis: true location shift is not equal to 0

ANOVA test
# Sorting occupation and month by new seekers

occu.newseek <- Cdata %>%
  group_by(Month,Occupation) %>%
  summarise(NewSeekers=sum(NewSeekers))

## Make the Occupation as a factor

occu.newseek$District <- as.factor(occu.newseek$Occupation)

## Get the occupation group means and standart deviations

group.mean.sd <- aggregate(
  x = occu.newseek$NewSeekers, # Specify data column
  by = list(occu.newseek$Occupation), # Specify group indicator
  FUN = function(x) c('mean'=mean(x),'sd'= sd(x))
)

## Run one way ANOVA test
anova_one_way <- aov(NewSeekers~ Occupation, data = occu.newseek)
summary(anova_one_way)

## Run the Tukey Test to compare the groups
TukeyHSD(anova_one_way)

## Check the mean differences across the groups

library(ggplot2)
ggplot(occu.newseek, aes(x = Occupation, y = NewSeekers, fill = Occupation)) +
  geom_boxplot() +
  geom_jitter(shape = 15,
              color = "steelblue",
              position = position_jitter(0.21)) +
  theme_classic()

Plot

A: You can't do a chi-square because JobSeekers is continuous, so if you want to know there is difference between North and South district, you can use a wilcoxon or t.test. It depends on your data. wilcoxon is ranked based and does not require your data to be normally distributed.
Assuming you have tallied the number of job seekers per district and month:
df = data.frame(Month=rep(c("2020-01","2020-02","2020-03","2020-04","2020-05","2020-06"),3),
District=rep(c("Dan","North","South"),each=6),JobSeekers=rpois(18,20))

A t.test is done like below, however if your samples are paired, for example you have 12 values for each month for North, and a corresponding 12 for south, then you need to set paired=FALSE, see this tutorial:
t.test(JobSeekers ~ District,data=subset(df,District %in% c("North","South")))

    Welch Two Sample t-test

data:  JobSeekers by District
t = 0.27455, df = 9.9435, p-value = 0.7893
alternative hypothesis: true difference in means is not equal to 0
95 percent confidence interval:
 -3.560951  4.560951
sample estimates:
mean in group North mean in group South
               21.5                21.0

If you are not sure whether your samples are normally distributed, use a wilcoxon:
wilcox.test(JobSeekers ~ District,data=subset(df,District %in% c("North","South")))

    Wilcoxon rank sum test with continuity correction

data:  JobSeekers by District
W = 19.5, p-value = 0.8721
alternative hypothesis: true location shift is not equal to 0

A: You can use an ANOVA test to compare multiple groups. If you find any statistically significant results with the omnibus ANOVA test, then you can check which district is different better or worse.
You can also refer to UCLA's website that shows which tests one should use to test their data. The link is here.
As a quick example, let me put here how to run an ANOVA test.
Here is your data:
head(df)

r$> head(df)
    Month  District   Age Gender Education Disability Religion                          Occupation JobSeekers GMI ACU NACU NewSeekers NewFiredSeekers
1 2020-01       Dan 18-24   Male      None       Hard   Jewish Practical engineers and technicians          1   0   0    1          1               1
2 2020-01     North 18-24   Male      None       Hard   Jewish Practical engineers and technicians          1   0   0    1          1               1
3 2020-01     North 18-24   Male      None       Hard   Jewish Practical engineers and technicians          1   0   0    1          1               1
4 2020-01     South 18-24   Male      None       Hard   Jewish Practical engineers and technicians          1   0   0    1          1               1
5 2020-01       Dan 18-24   Male      None       Hard   Jewish Practical engineers and technicians          1   0   0    1          1               1
6 2020-01 Jerusalem 18-24   Male      None       Hard   Jewish Practical engineers and technicians          1   0   0    1          1               1

Because I need more data points to carry out the test, I replicated your data by bootstrapping. I also increased the number of job seekers in the South and North regions. You do not need to do the following steps in your data. But this is how I did.
# For the sake of this example, I increased the number of observation by bootstrapping the example data

for(i in 1:20) df <- rbind(df[sample(6, 5), ],df)
rownames(df) <- 1:nrow(df)
df$District <- sample(c("Jerusalem", "North", "Sharon", "South", "Dan"), nrow(df),replace = T)
df$JobSeekers[df$District == "North"] <- sample(1:3,length(df$JobSeekers[df$District == "North"]),replace=T,p=c(0.1,0.5,0.4))
df$JobSeekers[df$District == "South"] <- sample(4:6,length(df$JobSeekers[df$District == "South"]),replace=T,p=c(0.1,0.5,0.4))

It is preferable to make the character as a factor when you are analyzing categorical variables. By doing this, you can control the level of factors.
## Make the District as a factor

df$District <- as.factor(df$District)

Next, get the group means and standard deviations to see whether there are any meaningful differences across the group. As you see, I changed the south and north districts, so they have the highest mean scores compared to the rest districts.
## Get the group means and standart deviations
    group.mean.sd <- aggregate(
        x = df$JobSeekers, # Specify data column
        by = list(df$District), # Specify group indicator
        FUN = function(x) c('mean'=mean(x),'sd'= sd(x))
    )

r$> group.mean.sd
    Group.1    x.mean      x.sd
1       Dan 1.1000000 0.3077935
2 Jerusalem 1.0000000 0.0000000
3     North 2.3225806 0.5992827
4    Sharon 1.1363636 0.3512501
5     South 5.2380952 0.4364358

Finally, you can run an ANOVA test and Tukey test as follow.
## Run one way ANOVA test
    anova_one_way <- aov(JobSeekers~ District, data = df)
    summary(anova_one_way)

r$> summary(anova_one_way)
             Df Sum Sq Mean Sq F value Pr(>F)
District      4 260.09   65.02   346.1 <2e-16 ***
Residuals   101  18.97    0.19
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

## Run the Tukey Test to compare the groups
    TukeyHSD(anova_one_way)

r$> Tukey multiple comparisons of means
    95% family-wise confidence level

Fit: aov(formula = JobSeekers ~ District, data = df)

$District
                        diff        lwr        upr     p adj
Jerusalem-Dan    -0.10000000 -0.5396190  0.3396190 0.9695592
North-Dan         1.22258065  0.8772809  1.5678804 0.0000000
Sharon-Dan        0.03636364 -0.3356042  0.4083315 0.9987878
South-Dan         4.13809524  3.7619337  4.5142567 0.0000000
North-Jerusalem   1.32258065  0.9132542  1.7319071 0.0000000
Sharon-Jerusalem  0.13636364 -0.2956969  0.5684241 0.9048406
South-Jerusalem   4.23809524  3.8024191  4.6737714 0.0000000
Sharon-North     -1.18621701 -1.5218409 -0.8505932 0.0000000
South-North       2.91551459  2.5752488  3.2557803 0.0000000
South-Sharon      4.10173160  3.7344321  4.4690311 0.0000000

Lastly, you can plot which district has the highest job seekers with a bar plot.
## Check the mean differences across the groups

library(ggplot2)
ggplot(df, aes(x = District, y = JobSeekers, fill = District)) +
    geom_boxplot() +
    geom_jitter(shape = 15,
        color = "steelblue",
        position = position_jitter(0.21)) +
    theme_classic()

Update
Based on your update, you can use the following syntax to abbreviate the x labels and change the legends.
library(stringr)
library(ggplot2)
ggplot(occu.newseek, aes(x = Occupation, y = NewSeekers, fill = str_wrap(Occupation,10))) +
    geom_boxplot() +
    geom_jitter(
        shape = 19,
        color = "black",
        position = position_jitter(0.21)
    ) +
     scale_x_discrete(
        labels =
            c(
                "Academic degree" = "Academic",
                "Practical engineers and technicians" = "Engineering",
                'Production and construction'='Production',
                "Sales and costumer service" = "Sales",
                "Unprofessional workers" = "Unprofessional",
                "Undefined" = "Undefined"
            )
    ) +
    labs(fill = "Occupation") +
        theme_classic()+
        theme(
            axis.text.x = element_text(angle = 45, vjust = 1, hjust = 1), legend.key.height=unit(2, "cm")
            #legend.position = "top",

        )

You should get a graph like that.


text:
Q: Access object properties from object function I want to access an object's properties from an object's function.
I have tried:
var ui_conf = {
    Conf: {
        "a": "b",
        "c": "d",
        "f": {}
    },
    someFunc: function(paramx, paramy) {
       //access conf.a
       console.log(this.Conf) //undefiend
       console.log(window.ui_conf) //undefiend
    },
};

A: Most probably you are calling this function with some other reference something like
var temp = ui_conf.someFunc;

temp();

And that will give you undefined against  this.Conf as this is not a  reference to ui_conf.
You may want to try it like

var ui_conf = {
    Conf: {
        "a": "b",
        "c": "d",
        "f": {}
    },

    someFunc: function(paramx, paramy) {
        //access conf.a
        console.log(this.Conf) //undefiend
        console.log(window.ui_conf) //undefiend

    },
};

ui_conf.someFunc();

A: You can call your object's properties from an object function using this way because you have't call your property it only declared in you code:

var ui_conf = {
                Conf : {
                    "a": "b",
                    "c": "d",
                    "f": {}
                },
                someFunc: function(paramx, paramy) {
                   console.log(this.Conf)
                },
            };
ui_conf.someFunc();


text:
Q: Discord.py rewrite bot won't change my nickname I've been learning Python 3.8 by building a Discord bot for my small server of friends. I want my friends to be able to change my nickname, but Discord doesn't seem to allow that unless I give everyone the same rank.
My idea was to give my bot the highest role and let them use a bot command to change my nickname (which would be the second-highest role), but I get the following error:
Traceback (most recent call last):
  File "/home/cqqlguy/.local/lib/python3.8/site-packages/discord/client.py", line 333, in _run_event
    await coro(*args, **kwargs)
  File "/home/cqqlguy/CQQLBOT/CQQLBOT.py", line 516, in on_message
    await cqqluser.edit(nick = newnick)
  File "/home/cqqlguy/.local/lib/python3.8/site-packages/discord/member.py", line 601, in edit
    await http.edit_member(guild_id, self.id, reason=reason, **payload)
  File "/home/cqqlguy/.local/lib/python3.8/site-packages/discord/http.py", line 241, in request
    raise Forbidden(r, data)
discord.errors.Forbidden: 403 Forbidden (error code: 50013): Missing Permissions

The relevant code looks like this:

@bot.event
async def on_message(message):
    lowermess = message.content
    dMess = lowermess.lower()

    if dMess.startswith("$changenick "):
            newnick = lowermess.split(" ", 1)[1] #whatever the user enters after the command
            changeuser = guild.get_member(id) #id would be my user ID
            await changeuser.edit(nick = newnick)

This seems to work on users that aren't me, but the bot has been given a higher role than everyone so I'm not sure why it's not changing it for me.


text:
Q: Is there a way that I can set the width of two buttons appearing at the bottom of a page to 75? I have code that displays two buttons at the bottom of my screen:
<Grid VerticalOptions="FillAndExpand" Padding="10" IsVisible="{Binding TwoBtnsVisible}">
    <Grid.ColumnDefinitions>
        <ColumnDefinition Width="*" />
        <ColumnDefinition Width="*" />
    </Grid.ColumnDefinitions>
    <Button Grid.Column="0" BorderColor="#999999" VerticalOptions="FillAndExpand" Style="{StaticResource pointButton2}" Text="Don't Know" Command="{Binding NButtonClickedCommand}" />
    <Button Grid.Column="1" BorderColor="#999999" VerticalOptions="FillAndExpand" Style="{StaticResource pointButton2}" Text="Easy" Command="{Binding YButtonClickedCommand}" />
</Grid>

The width of the buttons fills the screen with a small amount to spare on either side and in between.
I would like to set the width of the buttons but it seems to not be possible. Is there some way I could do this so that each button is still spaced out nicely but has a width of just 75?

A: The grid size will be based upon its parent container (that you did not include), so assuming you do not want to alter it, you can use ColumnSpan. With 6 Proportional(*) columns, and a button width of two columns, that works out to:

100% width / 6 columns * 2 buttons of 2 column width = 66% of total width and thus 16.5% padding on the sides of the buttons

<Grid VerticalOptions="FillAndExpand" Padding="10">
    <Grid.ColumnDefinitions>
        <ColumnDefinition Width="*" />
        <ColumnDefinition Width="*" />
        <ColumnDefinition Width="*" />
        <ColumnDefinition Width="*" />
        <ColumnDefinition Width="*" />
        <ColumnDefinition Width="*" />
    </Grid.ColumnDefinitions>
    <Button Grid.Column="1" Grid.ColumnSpan="2" BackgroundColor="Red" BorderColor="#999999" VerticalOptions="FillAndExpand"  Text="Don't Know"  />
    <Button Grid.Column="3" Grid.ColumnSpan="2" BackgroundColor="Red" BorderColor="#999999" VerticalOptions="FillAndExpand"  Text="Easy" />
</Grid>

A: Try adding this two properties to each button.
It *should display them as you describe.
WidthRequest="75"
HorizontalOptions="Center"


text:
Q: When inserting syntax code into `` elements ckeditor auto closes tag When inserting code into <pre> elements in CKEditor it picks up on strongly type objects like

public IQueryable<Post> PostArchive

it then adds a closing tag <post/> tag which messes up the syntax highlighting.

Any help please.

Tried config.allowedContent = true; in ckeditor but with no luck..

A: I am pretty sure that you're not encoding code correctly.
This is how your data should look like:
<pre>
public IQueryable<Post> PostArchive
</pre>

Note that <Post> has to be transformed to <Post>, because otherwise it is a custom HTML tag and that's why parse tries to fix it.


text:
Q: JPA/Hibernate - How is subclass type determined when querying by superclass? I just noticed this bevahior in Hibernate and found it a bit surprising (in a welcome kind of way).  I have a single entity type called SyncItem that serves as a superclass to a number of other entities.  The inheritance strategy is set to InheritanceType.JOINED so there is a single table for all the fields in the superclass, and subclass tables just include fields for anything that is added in the subclass, plus a reference back to the superclass table.
So for instance, my SyncItem table looks like:
mysql> describe syncItems;
+------------+--------------+------+-----+---------+----------------+
| Field      | Type         | Null | Key | Default | Extra          |
+------------+--------------+------+-----+---------+----------------+
| id         | bigint(20)   | NO   | PRI | NULL    | auto_increment |
| hidden     | bit(1)       | NO   |     | NULL    |                |
| title      | varchar(255) | NO   |     | NULL    |                |
| createDate | datetime     | NO   |     | NULL    |                |
| modifyDate | datetime     | YES  |     | NULL    |                |
| deleteDate | datetime     | YES  |     | NULL    |                |
+------------+--------------+------+-----+---------+----------------+

And if I have a Property subclass, it might get a table like:
mysql> describe properties;
+--------------+--------------+------+-----+---------+-------+
| Field        | Type         | Null | Key | Default | Extra |
+--------------+--------------+------+-----+---------+-------+
| syncId       | bigint(20)   | NO   | PRI | NULL    |       |
| propertyCode | varchar(255) | YES  |     | NULL    |       |
+--------------+--------------+------+-----+---------+-------+

Now I've got about a dozen different subclasses, and the thing that surprised me is that I have a query like:
@NamedQuery(
    name="SyncItem.findByTitle",
    query="SELECT s FROM SyncItem s WHERE s.title = :title")

When I wrote this, I expected that because I am selecting from SyncItem, I would only get back the information contained in the superclass table (i.e. that I would get a SyncItem instance, and not a Property instance).  When I ran it, however, I found that the query actually returns the proper subclass instance.  This is good, because it makes a number of things easier to implement.
However, I'm wondering, how is JPA/Hibernate managing to bring back the subclass?  It has no way of knowing that a given title will map to a Property and not to something else, and as far as I can tell it has no direct mapping from syncItems to properties (instead it has to map back from properties to syncItems).  Is it doing a join with every single subclass table when this query executes?  If so then doesn't that make the query very expensive?
So yeah, just wondering what is going on behind the scenes here.

A: Yes, it performs a Join for every sub-table. It is expensive, but you can use any of the other 2 strategies to map inheritance.
Here you can find a reference where this is stated:

the joined strategy is often the slowest of the inheritance models.
  Retrieving any subclass requires one or more database joins, and
  storing subclasses requires multiple INSERT or UPDATE statements

Each one of the 3 available strategies has its own advantages and disadvantages (if you prefer to save space instead of time, or a compromise between both). The choice depends also on the kind of operations you are going to perform on these tables more often. In the reference I pasted you will find a fairly good and simple explanation of each one.

A: I believe that it joins all subclasses. It is probably more expensive than no join but not as much since keys are indexed and only one table will contain required key. Using inheritance will inevitably have some overhead.
You can look at SQL log output to see for yourself.


text:
Q: Adjust space between \newline within a tabularx cells I've created a table with tabularx where I have long text (gets broken at the end of the cell by latex) and manually inserted \newline. The space between the the automatically linebreak and the \newline is the same, making it difficult to distinguish if the text still belongs to the line above or if it is a new "item".
Therefore, I would like to increase the vertical space after the \newline a bit to make it clear if the text is a new item or still belongs to the previous line.
P.S. How can I avoid the Overfull \hbox (3.91661pt too wide) detected?
\documentclass[
paper=a4,
12pt,
BCOR=0.5cm,
twoside=false,
]
{scrreprt}
\usepackage[british]{babel}
\usepackage[utf8]{inputenc}
\usepackage[LGR,T1]{fontenc}
\usepackage{microtype}
\usepackage{lmodern}
\usepackage{setspace}
\onehalfspacing

\usepackage{tabularx}
\usepackage{booktabs}
\setlength{\tabcolsep}{12pt}

\usepackage[format=hang, labelsep=quad, font=normal, labelfont=bf, justification=justified, singlelinecheck=false, figurewithin=none, tablewithin=none]{caption}
\usepackage{floatrow}
\floatsetup[table]{style=plaintop,footnoterule=none}
\captionsetup[floatfoot]{footfont=normalsize}
\captionsetup[table]{footfont=normalsize}

\overfullrule=1em
\begin{document}

\setlength{\extrarowheight}{.5em}
\begin{table}
    \ttabbox{%
        \caption[Comparison of relevant domains according to sepsis survivor's perception and domains covered by SF-36 and EQ-5D]{Comparison of relevant domains according to sepsis survivor's perception and domains covered by SF-36 and EQ-5D} \label{tab2}}
    {\begin{tabularx} {\linewidth} {lXX}
            \toprule
            Domain&SF-36 & EQ-5D  \\
            \midrule
            Physical impairment &   Physical functioning \newline Role limitations due to physical problems \newline Bodily pain & Pain/discomfort \newline Mobility  \\
            Fatigue &   Vitality & \\
            Coping with daily life  &   Social functioning & Self-care \newline Usual activities  \\
            Psychological impairment    & Role limitations due to emotional problems \newline General mental health  & Anxiety/depression  \\
            Control over one's life &   &  \\
            Ability to walk &   &   \\
            Return to normal living &   &  \\
            Cognitive impairment    &    &  \\
            Family support  &   &  \\
            Delivery of health care &   & \\
            Self-perception &   & \\
            & General health perception & VAS overall health \\
            \bottomrule
    \end{tabularx}}
\end{table}

\end{document}

A: I would rather wrote each item in cell as separate cell. By this I would avoided your problem regarding space between items in cells:
\documentclass[ paper=a4,
                12pt,
                BCOR=0.5cm,
                twoside=false]{scrreprt}
\usepackage[british]{babel}
\usepackage[LGR,T1]{fontenc}
\usepackage{microtype}
\usepackage{lmodern}
\usepackage{setspace}
\onehalfspacing
%---------------- show page layout. don't use in a real document!
\usepackage{showframe}
\renewcommand\ShowFrameLinethickness{0.15pt}
\renewcommand*\ShowFrameColor{\color{red}}
%---------------------------------------------------------------%

\usepackage{booktabs, tabularx}

\usepackage[format=hang, labelsep=quad,
            font=normal, labelfont=bf,
            justification=justified, singlelinecheck=false,
            figurewithin=none, tablewithin=none]{caption}
\usepackage{floatrow}
\floatsetup[table]{style=plaintop,footnoterule=none}
\captionsetup[floatfoot]{footfont=normalsize}
\captionsetup[table]{footfont=normalsize}

\begin{document}
    \begin{table}[ht]
\setlength{\extrarowheight}{.5em}
\setlength\tabcolsep{9pt}
    \caption[Comparison of relevant domains according to sepsis survivor's perception and domains covered by SF-36 and EQ-5D]{Comparison of relevant domains according to sepsis survivor's perception and domains covered by SF-36 and EQ-5D}
    \label{tab2}
\begin{tabularx}{\textwidth}{|l|
    *{2}{>{\raggedright\arraybackslash}X|}}
        \toprule
    Domain  &SF-36 & EQ-5D            \\
        \midrule
    Physical impairment
        &   Physical functioning
            &   Pain/discomfort     \\
        &   Role limitations due to physical problems
            &   Mobility            \\
        &   Bodily pain     &       \\
    Fatigue
        &   Vitality        &       \\
    Coping with daily life
        &   Social functioning
            &   Self-care           \\
        &   &   Usual activities    \\
    Psychological impairment
        &   Role limitations due to emotional problems
            &   Anxiety/depression  \\
        &   General mental health
            &                       \\
    Control over one's life
        &   &                       \\
    Ability to walk         &   &   \\
    Return to normal living &   &   \\
    Cognitive impairment    &   &   \\
    Family support          &   &   \\
    Delivery of health care &   &   \\
    Self-perception         &   &   \\
        &   General health perception
            &   VAS overall health \\
        \bottomrule
\end{tabularx}
    \end{table}
\end{document}

Compilation of aboe MWE: no errors, no warnings, no bad (overfull) boxes.

(red lines show text borders)


text:
Q: Unique Existence In Local Set Theories I am working through Toposes and Local Set Theories by Bell. I would like to know the proof of this expression from page 82:
$$(\exists ! w)\alpha, \alpha(w/true),\alpha \vdash w = true $$
I would like the proof to be based on local set theory/ Mitchell–Bénabou language (i.e., the internal language of a topos).
Any help would be much appreciated.

A: This may be a bit tedious so let me give you an outline (references are from Bell):

*

*Expand the definition of $\exists!$
$$\exists w.(\alpha\wedge \forall u.\alpha(w/u)\to w=u),\alpha(w/true),\alpha\vdash w=true$$

*Use proposition 3.7.3 to eliminate the existential on the left and introduce a fresh variable $v$,
$$\alpha(w/v)\wedge\forall u.\alpha(w/u)\to v=u,\alpha(w/true),\alpha\vdash w=true$$

*Use proposition 3.3.1 to eliminate the conjunction on the left
$$\alpha(w/v),\forall u.\alpha(w/u)\to v=u,\alpha(w/true),\alpha\vdash w=true$$

*Use proposition 3.4.7 to eliminate the universal on the left and substitute $u/true$
$$\alpha(w/v),\alpha(w/true)\to v=true,\alpha(w/true),\alpha\vdash w=true$$

*But we can also use 3.4.7 to eliminate the universal on the left and substitute $u/w$
$$\alpha(w/v),\alpha(w/w)\to v=w,\alpha(w/true),\alpha\vdash w=true$$

*Putting these together, (noticing that we don't even need $\alpha(w/v)$, and also that $\alpha(w/w) = \alpha$), we obtain
$$\alpha\to v = w, \alpha(w/true)\to v = true,\alpha(w/true),\alpha\vdash w = true$$
The result then follows by applying transitivity (and a few applications of modus ponens/cut).


text:
Q: I have a problem with my dataset clasification I latino so mi english is not so good, but i try to explain my problem.
I have a dataset with 3 clasess, but when i try validation the dataset with else image, only recognize a 1 class, but i have 3, i follow the tutorials but i think that the problem is the file coco128.yml when i try to custom.
train: /content/dataset-train/images/train
val: /content/dataset-train/images/validation
test:  # test images (optional)

# Classes
nc: 3
names:
  0: pitbull
  1: husky
  2: sanbernando

this is my code, but only recognize the class "pitbull" someone can help me?
train: /content/dataset-train/images/train
val: /content/dataset-train/images/validation
test:  # test images (optional)

# Classes
nc: 3
names: ["pitbull","husky","sanbernando"]

before try this way, but cant work same, i dont know how fix.


text:
Q: What is the difference between an EAR file and a "WebSphere Enhanced EAR"? Supposing that I have a standard EAR file (and the source files that were used to generated it,) what additional processing needs to be done to convert it to an IBM WebSphere "Enhanced EAR"?
Another way to ask this question would be to ask, "What is the difference between an Enhanced EAR and a standard EAR?"
I'm very aware that there is tooling in the Rational development tools (RAD and RSA.)  But, for the purpose of this question, I need to accomplish the same task in an automated build (via either Ant or Maven.)

A:
Another way to ask this question would be to ask, "What is the difference between an Enhanced EAR and a standard EAR?"

An enhanced EAR is an EAR with some XML files added to the META-INF directory to configure specific resources at the application, server or cell level (see the IBM Redbook WebSphere Application Server V7: Packaging Applications for Deployment for more details on this).
Table 23-1 of J2EE Packaging, Enhanced EARs, and the Application Server Toolkit (pdf) lists these files:
alt text http://img46.imageshack.us/img46/6751/table231.png
The files being located under the META-INF directory, embedding them in a standard EAR from Ant or Maven should be pretty straight forward, just put them in the META-INF before packaging.
If you have to generate these files from scratch (this wouldn't make sense IMHO), then it's really another story and I'm not sure that the structure of these files is publicly available.
Seriously, if you want to use that feature, find a way to generate the files from the WebSphere Enhanced EAR editor. Maybe get a trial version of RAD to evaluate this feature >:) Or contact IBM, I'm sure they will be happy to helpsell you something, even a single license.
UPDATE: IBM provides Ant Tasks for WebSphere that you could also use from Maven using the antrun plugin (this seems to be the preferred way) but I don't think that wsDefaultBindings is exactly what you're looking for, default IBM WebSphere Bindings don't offer the same features than Enhanced EAR - but they might be useful and enough though. Just in case, if you ever decide to use the wsadmin task instead of Enhanced EAR, here is a list of options.

A: From their docs:

The server configuration data that you specify in this editor gets embedded within the application itself.

Sounds like they embed the stuff that's usually added via the admin console (e.g., JNDI for data sources and messaging, JAAS for security) into the EAR itself for greater portabililty between servers.

A: You can populate the EAR with the required deployment information using the wsDefaultBindings Ant task. Sample scripts here.


text:
Q: C# How to make a smooth jump in unity3d without moving the X, towards the nearest object I would like to make a smooth jump towards the nearest cube. I already have a script to detect the closest cube. I want that the X-axis is locked, so only the Y-axis and the Z-axis change when jumping. I would like to use a Jump animation when jumping. I already tried to use Vector3MoveTowards, but that didn't really work well, maybe I didn't use it properly.
Detect nearest cube where the player should jump to (C#)

void Update()
{
  FindClosestCube ();
  GameObject closestCube = FindClosestCube ();
  Debug.Log (closestCube);
}

GameObject FindClosestCube() {

  GameObject[] gos;
  gos = GameObject.FindGameObjectsWithTag("cube");
  GameObject closest = null;
  float distance = Mathf.Infinity;
  float position = transform.position.z;
  foreach (GameObject go in gos) {
   float diff = go.transform.position.z - position;

   float curDistance = diff;
   if (curDistance < distance) {
    closest = go;
    distance = curDistance;
   }
  }
  return closest;
 }

The tricky part is that at some cubes you have to jump up (y+1), with some cubes you jump towards the same Y (y+0) and with some cubes you jump down (y-1).
How do I do this?
Image of how it looks like:

EDIT: I have this code right now:

 ----------------C#-----------------

    Rigidbody rb;
 public int clicks = 0;
 Vector3 target;
 public Animation jumpAnimation;
 bool jump = false;
 float cubeDiffY;
 bool movePlayer;
 public float smoothTime = 0.3f;
 public float yVelocity = 0.0f;

 void Start()
 {
  rb = GetComponent<Rigidbody> ();
 }

 void Update ()
 {
  FindClosestCube ();
  GameObject closestCube = FindClosestCube ();
  Debug.Log ("Closestcube = " + closestCube);

  target = closestCube.transform.position + new Vector3 (0f, 0.7f, 0f);

  cubeDiffY = target.y - transform.position.y;
  movePlayer = true;

  Debug.Log("Cube Difference Y-axis = " + Mathf.Round(cubeDiffY));

  if (Input.GetMouseButtonDown (0))
  {
   clicks += 1;

   jump = true;
   jumpAnimation = gameObject.GetComponent<Animation>();
   //jumpAnimation.Play ();
  }

  if (jump == true)
  {
   Jump ();
  }
 }

 void Jump()
 {

  float newPosition = Mathf.SmoothDamp (transform.position.y, target.y, ref yVelocity, smoothTime);
  transform.position = new Vector3 (0, newPosition, transform.position.z);
 }

I calculated the difference in Y-axis between the cube where the player is standing on and the closestCube. But the Jump() doesn't work. How do I fix that?

A: Okay I set up a quick version of your game and got what you wanted to work, it is not exactly a quick solution, because what your doing doesn't have built in functionality for other than using animations.
Here is the character script that has all the code you need and commented thoroughly so it should explain itself.
using UnityEngine;

public class Character : MonoBehaviour
{
    //the collider for the player
    private new BoxCollider collider;

    //the jump box collider on a empty game object that is a child to the player object
    public BoxCollider JumpBox;

    //the offset of the cube so it doesn't stop inside of it
    public Vector3 cubeOffset;

    //how high the jump will be
    public float JumpHeight;

    //how fast the jump will be
    public float JumpSpeed;

    //holds the change in position the jump will produce
    private Vector3 jumpDelta;

    //holds the destination cube the jump is attempting to hit
    private Cube destinationCube;

    //true if a jumping animation is currently playing
    private bool jumping = false;

    //used to swap the jump direction from up to down
    private bool jumpDirection = true;

    //used to hold the position of the jump so it knows when to stop
    private float jumpPosition = 0;

    // Use this for initialization
    void Start()
    {
        collider = GetComponent<BoxCollider>();
    }

    // Update is called once per frame
    void Update()
    {
        if(jumping)
        {
            //move straight towards the cube
            transform.position = transform.position + (JumpSpeed * jumpDelta);

            //move up and down to simulate a jump
            //check the current move direction
            if (jumpDirection)
            {
                //add to the jump position twice product of the JumpHeight the JumpSpeed so that it will
                //rise and fall the same amount of time it takes to move to the destination
                jumpPosition += JumpHeight * JumpSpeed * 2;
                //if it has passed the jump height reverse the jump direction
                if (jumpPosition >= JumpHeight)
                    jumpDirection = !jumpDirection;
                transform.position += transform.up * JumpHeight * JumpSpeed * 2;
            }
            //the jump direction is going down
            else
            {
                jumpPosition -= JumpHeight * JumpSpeed * 2;
                transform.position -= transform.up * JumpHeight * JumpSpeed * 2;
            }
            //check if the character collider intersects witht he cubes collider
            //if it has then stop jumping and set the final position as the destination position
            if (collider.bounds.Intersects(destinationCube.BoxCollider.bounds))
            {
                jumping = false;
                transform.position = destinationCube.transform.position + cubeOffset;
            }
        }
        //detect a jump
        if (Input.GetKeyDown(KeyCode.Space))
        {
            //detect all hits on the jump box
            Collider[] hits = Physics.OverlapBox(JumpBox.center, JumpBox.size * 0.5f);
            //get the closest collider with the right tag
            Collider result = GetClosestColliderWithTag(hits, "Cube");

            //if we have a result then begin the jumping animation
            if(result != null)
            {
                //gets the destination cubes cube component(the custom class you have on your cubes)
                destinationCube = result.gameObject.GetComponent<Cube>();

                //calculate the jump delta
                jumpDelta = (result.transform.position + cubeOffset) - transform.position;

                //remove the left and right components so the jumping doesnt move to the left or right of the player
                Vector3 component = Vector3.Project(jumpDelta, -transform.right);
                jumpDelta -= component;
                component = Vector3.Project(jumpDelta, transform.right);
                jumpDelta -= component;

                //setup the jump animation control fields to the initial values
                jumpPosition = 0;
                jumpDirection = true;
                jumping = true;
            }
        }
    }
    private Collider GetClosestColliderWithTag(Collider[] colliders, string tag)
    {
        //just gets the closest collider
        float distance = float.MaxValue;
        int result = -1;
        for (int i = 0; i < colliders.Length; i++)
        {
            if (colliders[i].tag == tag)
            {
                float distanceTemp = Vector3.Distance(transform.position, colliders[i].transform.position);
                if (distanceTemp < distance)
                {
                    distance = distanceTemp;
                    result = i;
                }
            }
        }
        if (result != -1)
            return colliders[result];
        else return null;
    }
}

And here is my cube script which has some things you will need to add
using UnityEngine;

public class Cube : MonoBehaviour {
    //these arent important just fields I used to set up a quick version of your game
    public GameObject StartPoint;
    public GameObject EndPoint;
    public float Speed;
    private Vector3 directionVector;
    private bool direction;

    //YOU WILL NEED THIS!!
    [HideInInspector]
    public BoxCollider BoxCollider;

    // Use this for initialization
    void Start() {
        //not important
        directionVector = EndPoint.transform.position - StartPoint.transform.position;
        directionVector.Normalize();

        //DONT FORGET TO SET YOUR BOX COLLIDER
        BoxCollider = GetComponent<BoxCollider>();
    }

    // Update is called once per frame
    void Update()
    {
        float distance = 0;
        if (direction)
        {
            distance = Vector3.Distance(EndPoint.transform.position, transform.position);
            transform.position += directionVector * Speed;
            if (distance < Vector3.Distance(EndPoint.transform.position, transform.position))
                direction = !direction;
        }
        else
        {
            distance = Vector3.Distance(StartPoint.transform.position, transform.position);
            transform.position -= directionVector * Speed;
            if (distance < Vector3.Distance(StartPoint.transform.position, transform.position))
                direction = !direction;
        }
    }
}

Previous Answer
I would say you need to calculate the perceived position of the object in the future.
Vector3 futurePos = cubePos + (cubeMoveDirection * cubeMoveSpeed);

Once you have the future position, even if it is not exact, you should aim your animation towards that position. To do this I would have the animation change a speed vector instead of an actual transforms position that way we can rotate this speed vector in any direction you want while keeping the orientation of the block. Otherwise you have to rotate the entire block to point towards the direction you want. If this is what you want then put your block under a empty gameobject, rotate the empty gameobject to point to where you want and do the speed calculations only.
Next your animation should have a net move vector which should be pre-calculated and scaled down or up to meet the distance to the future position. It will look something like this(note this is not tested)
//class fields
Vector3 AnimatedSpeed;

Vector3 AnimationDelta;

//basic calculation

//get the direction vector from the players current position to the future
block position

Vector3 dirVector = futurePos - transform.position;
//find the rotation from the current orientation to the direction vector
Quaternion rotation = Quaternion.FromToRotation(transform.forward, dirVector);

//calculate the distance from you to the cube and scale it with the magnitude of the AnimationDelta
float result = Vector3.Distance(transform.position, futurePos);

result = result / animationDelta.magnitude;

//finally rotate the forward vector by the rotation and multiply it by the
//animation speed and the result to get the step by step movement as
//the animation plays. NOTE: The animation should be based on forward direction

transform.position += (AnimationSpeed * rotation) * result * Time.deltaTime;

Hopefully this does it, like I said I haven't tested it at all so you may have to do some tweaking based on your particular case as this is essentially psuedo-code.
Good luck! I'm off to bed I'll check back when I wake up.


text:
Q: What's the word for a boolean and statement stopping if the first returns false? Sorry the title isn't descriptive, but if I could describe it well I probably would've found my answer.
In Python, if you were to run the following:
def fun1():
    print("fun1 runs")
    return False

def fun2():
    print("fun2 runs")
    return True

x = fun1() and fun2()

It would print the statement
fun1 runs

because after fun1 returns False, x will be false regardless of what fun2 is so fun2 never runs.
What's the word for this? I ask because I wanted to search if PHP boolean expressions do the same thing but didn't know what it was called.
Sorry for asking a silly question about terminology, but it's been bugging me!

A: if I got you right then you are talking about short-circuit evaluation


text:
Q: Product of induced topologies and induced product topology coincide? Let $X$ and $Y$ be two topological spaces, $A\subset X, B\subset Y$. I have to prove that the following two topologies on $A\times B$ coincide:
The product of the topology of $A$ (induced from $X$) and that of $B$ (induced from $Y$),
and the topology induced on $A\times B$ from the product topology on $X\times Y$.
Intuitively, I know this is correct. But how do I prove this mathematically correct?
Thank you!

A: $(U \cap A) \times (V \cap B) = (U \times V) \cap (A \times B)$ (where $U$ open in $X$, $V$ open in $Y$) is a key identity here. The right hand side describes a base for the subspace topology for $A \times B$, the left hand side a base for the product topology of the subspace topologies. So the topologies share a base and are identical.


text:
Q: Do GUIRunOnce and product key in a VM template work in SCVMM? If so, why are my VMs being spun up not activated? I'm using SCVMM v3.2.8224 to manage dozens of VMs that run Windows Server 2012 R2 (both Standard and Datacenter). In each VM template's OS properties, I've inputted the pertinent product key from here.  However, upon spinning up a VM, the VM shows as not activated.  I assume this is because, as the article above states, I have to run this on the VM:
slmgr /ipk <AVMA_key>

This does indeed activate the OS, but if this is necessary, then what is the point of inputting the product key in the VM's properties?  I suppose, specifically, I am asking what supplying that information actually does.
In any case, I figured I would ignore the seemingly uselessness of specifying the key there and just throw the above command into the GUIRunOnce portion of the VM template's OS properties and that should work.  But it doesn't.  VMs still spin up as not activated.  What am I doing wrong here?  Does GUIRunOnce only work if you specify an action file?


text:
Q: Reading files and output is skipping lines This is homework but im stuck wondering where i went wrong. any help from you experts would be appreciated greatly!
Intended Output :
 Date: 31/3/2016
 Time: 09:00
 Speed: 6

 Date: 31/3/2016
 Time: 09:10
 Speed: 5

Date: 31/3/2016
 Time: 09:20
 Speed: 5

Date: 31/3/2016
 Time: 09:30
 Speed: 5

Date: 31/3/2016
 Time: 09:40
 Speed: 6

and so on, basically in sequence
Current output
 Date: 31/3/2016
 Time: 22:20
 Speed: 4

 Date: 31/3/2016
 Time: 22:40
 Speed: 4

 Date: 31/3/2016
 Time: 23:0
 Speed: 3

 Date: 31/3/2016
 Time: 23:20
 Speed: 4

 Date: 31/3/2016
 Time: 23:40
 Speed: 5

as you can see, its skipping in 20mins interval. im not sure where in my code is causing this.
#include <iostream>
#include <string>
#include <sstream>
#include <fstream>
#include "Date.h"
#include "Time.h"
#include "Vector.h"

using namespace std;
typedef struct {
    Date d;
    Time t;
    float speed;
} WindLogType;

ostream & operator <<( ostream & os, const WindLogType& wl );
istream & operator >>( istream& input, WindLogType& wl );

int main()
{   Vector<WindLogType> windLogs;
    string day,month,year,hours,minss,strInput;
    string test;
    WindLogType windlogs2;
    ifstream infile("test2.csv");
    if(!infile) return -1;

infile >> windlogs2;
while (!infile.eof()){
//infile >> windlogs2;

getline(infile,strInput); //skip the first line
getline(infile, strInput, '/');
windlogs2.d.SetDay(stoi(strInput));
getline(infile,strInput, '/');
windlogs2.d.SetMonth(stoi(strInput));
getline(infile,strInput, ' ');
windlogs2.d.SetYear(stoi(strInput));
getline(infile,strInput, ':');
windlogs2.t.SetHours(stod(strInput));
getline(infile,strInput,',');
windlogs2.t.SetMins(stod(strInput));
getline(infile,strInput,',');
getline(infile,strInput,',');
getline(infile,strInput,',');
getline(infile,strInput,',');
getline(infile,strInput,',');
getline(infile,strInput,',');
getline(infile,strInput,',');
getline(infile,strInput,',');
getline(infile,strInput,',');
getline(infile,strInput,',');
windlogs2.speed = (stof(strInput));
getline(infile,strInput,',');
getline(infile,strInput,',');
getline(infile,strInput,',');
getline(infile,strInput,',');
getline(infile,strInput,',');
getline(infile,strInput,',');
getline(infile,strInput,',');

ofstream outfile("outputFile.txt.");
outfile << windlogs2 << '\n';
cout << windlogs2 << '\n';

 }

    return 0;

}

ostream & operator <<( ostream & os, const WindLogType& wl )
{
    os << wl.d << wl.t << " Speed: " << wl.speed << '\n';

        return os;
}
istream & operator >>( istream& input, WindLogType& wl )
{
    input >> wl.d >> wl.t >> wl.speed;
    return input;
}

so I did some modification to
infile >> windlogs2;
while (!infile.eof()){
//infile >> windlogs2;

getline(infile,strInput); //skip the first line
getline(infile, strInput, '/');
windlogs2.d.SetDay(stoi(strInput));
getline(infile,strInput, '/');
windlogs2.d.SetMonth(stoi(strInput));
getline(infile,strInput, ' ');
windlogs2.d.SetYear(stoi(strInput));
getline(infile,strInput, ':');
windlogs2.t.SetHours(stod(strInput));
getline(infile,strInput,',');
windlogs2.t.SetMins(stod(strInput));
getline(infile,strInput,',');
getline(infile,strInput,',');
getline(infile,strInput,',');
getline(infile,strInput,',');
getline(infile,strInput,',');
getline(infile,strInput,',');
getline(infile,strInput,',');
getline(infile,strInput,',');
getline(infile,strInput,',');
getline(infile,strInput,',');
windlogs2.speed = (stof(strInput));
getline(infile,strInput,',');
getline(infile,strInput,',');
getline(infile,strInput,',');
getline(infile,strInput,',');
getline(infile,strInput,',');
getline(infile,strInput,',');
getline(infile,strInput,',');

where i changed the getline(input,strInput) // skip the first line to before the while loop and removed the last few getlines as such
infile >> windlogs2;
getline(infile,strInput); //skip the first line
while (!infile.eof()){

getline(infile,strInput); //skip the first line
getline(infile, strInput, '/');
windlogs2.d.SetDay(stoi(strInput));
getline(infile,strInput, '/');
windlogs2.d.SetMonth(stoi(strInput));
getline(infile,strInput, ' ');
windlogs2.d.SetYear(stoi(strInput));
getline(infile,strInput, ':');
windlogs2.t.SetHours(stod(strInput));
getline(infile,strInput,',');
windlogs2.t.SetMins(stod(strInput));
getline(infile,strInput,',');
getline(infile,strInput,',');
getline(infile,strInput,',');
getline(infile,strInput,',');
getline(infile,strInput,',');
getline(infile,strInput,',');
getline(infile,strInput,',');
getline(infile,strInput,',');
getline(infile,strInput,',');
getline(infile,strInput,',');
windlogs2.speed = (stof(strInput));

and currently its not skipping the 20min interval. however the date is messed up. but if i dont change getline(input,strInput)// skip the first line, the date is all okay. anyone have any idea why this is happening?


text:
Q: how to parse arbitrary json file in gwt? I am writing a GWT application where I need to load and parse arbitrary JSON file.
So I think the overlay type is not very useful in this case since I do not know the schema/format of the file beforehand.
I've done some research online but still can't figure out a way of doing so.
Can someone please give some ideas on how to do this?
Thanks!

A: When you don't know the schema in advance, you're (unfortunately) left with the JSONParser.

A: You could first construct JavaScriptObject from string/file
private final native JavaScriptObject asJavaScriptObject(String json) /*-{
    eval('var res = ' + json);
    return res;
}-*/;

and then use it to create JSONObject which has methods for accessing JSON properties and checking if they exist.
new JSONObject(asJavaScriptObject(json));


text:
Q: Porting a C library to Python via ctypes I've read in a lot of places that C-libraries can be ported to or written in python using the ctypes module from the standard library.
I've gone through the help('ctypes') page and from what I could gather I can create some of the C structures in Python, but my question is how do I use these to access the underlying system calls? For eg. when trying to port something like 'sys/if.h' to Python?
Can someone point me to good resources/documentation regarding the same?

A: If you want access to the system calls you could do something like this:
>>> from ctypes import CDLL
>>> libc = CDLL('libc.so.6')
>>> print libc.strlen('abcde')
5

Reference: http://blog.bstpierre.org/using-pythons-ctypes-to-make-system-calls
Or (This is the tricky part)
Wrap a system call as outlined here into your C code:
How to reimplement (or wrap) a syscall function in linux?
And, then write a compliant source code file which will be used by CTypes, as per here:
http://www.scipy.org/Cookbook/Ctypes
I hope this helps.


text:
Q: adding view is disabled in VS 2015 MVC 5 I have a working MVC 5 web application. everything was ok until suddenlly i found out that i cannot add a view to the application and the add button is disabled.

*

*I use VS 2015 Entrprise update 3 RC.

*C# as a programming language.

the project type GUIDS tag looks like this
<ProjectTypeGuids>{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>

please help me with this.
Thanks all

A: Your ProjectTypeGuids look ok. You can view a list of ProjectTypeGuids here.
I have Visual Studio 2015 Community Edition here and it works fine when I try to add a View clicking on Views folder and an Action inside a Controller.
There are some similar questions here at stackoverflow, maybe they can help you:

*

*Cannot add view to ASP.NET MVC 5 project

*Visual Studio 2013 button to add a View is disabled
Can you give more information about how you are trying da add that View please?
Some tests
I can reproduce clicking on the Views folder and the add button is disabled if I choose Template: Empty and don't select any Model Class:

The only way the button Add will be enabled with no Model Class selected is if I choose Empty (Without Model):

A: Make sure you have all the following installed:
Modifying VS -> workloads -> installation details


text:
Q: Where does Java store the data? I am new to Java/ OOP and just learning the basics. I have a basic doubt.
Say I have developed an application, created executable file and distributed to my client. All that the customer knows is to click on that application, it gets launched and he uses it.
But as a developer, say I have some stuff going on inside such as new object creation, methods, etc. So if the customer uses that application and clicks on an icon "Create new product", the application is actually creating a new object using constructor. Similarly when the customer enters some other buttons, at the backend some methods are called.
More importantly, I may have some data file which has existing data of some products and as the client creates new products, the information of new products is added to this data file.
My doubt is where is this data stored in Java? Say the client creates 1000 or million products by using this application, where is all this information stored. Does the data file gets updated? Can the data in source file get changed? Or is it like, the client needs to have some external storage place like database where I link the existing data file.
I am unable to frame the question properly as I myself am not clear about this. I am totally new to Java/OOP. My basic doubt is when I finish learning Java and develop applications to be used by client, where will the data that the client creates using the application go?

A: Constructor create object in memory only, and once your app is closed or pc shutdown your data will be lost,
store data in a file is useful to store application settings, you have to use an xml or a properties file.
If you want to store your business or other data in a database, you have to learn the java persistence API ,some relational database and some persistence provider and your object (class) must implements serializable interface.
if you need to store and manage a very huge data (BIG DATA) you have to use NoSQL database.


text:
Q: Find the path to rust source file that invoked a macro (within the macro) on rust stable I have a working macro (shown below) on rust nightly. I would like to be able to do the same on rust stable.
I use proc_macro2's Span to get the name of the source file where the macro was used.
#![feature(proc_macro_span)]

// uses are here... removed for brevity

#[proc_macro_attribute]
pub fn flow_function(_attr: TokenStream, implementation: proc_macro::TokenStream) -> TokenStream {
    // Get the full path to the file where the macro was used, and join the relative filename from
    // the macro's attributes, to find the path to the function's definition file
    let span = Span::call_site();
    let implementation_file_path = span.source_file().path().canonicalize()
        .expect("the 'flow' macro could not get the full file path of the file where it was invoked");

    let mut definition_file_path = implementation_file_path.clone();
    definition_file_path.set_extension("toml");
    //print!("file_path = {}", file_path.display());

    let function_definition = load_function_definition(&definition_file_path);

    // Build the output token stream with generated code around original supplied code
    generate_code(implementation, implementation_file_path,
                  function_definition, definition_file_path)
}

Is there any way to do this (get the source file path where the macro was used) on rust stable?


text:
Q: Questions about singular/plural when explaining two things in one sentence Consider the following two sentences.

*

*In [10], an algorithm to find a trajectory of a UAV effective in estimating the channel models for a target area has been proposed.

*In [11], an algorithm to find a trajectory of a UAV effective in estimating the user locations for a target area has been proposed.

With the above two sentences, I want to express them in one sentence.

In [10] and [11], algorithms to find trajectories of a UAV effective in estimating the A2G channel models and the user locations, respectively, for target areas have been proposed.

Is it reasonable to combine my two sentences into one sentence?

A: *

*Yes, you can merge two sentences, and you can use "respectively" to help clarify what refers to what. (Tom and Jane like burgers and hot dogs, respectively.)

*These sentences are already long and complex enough that, instead, they would probably benefit from a different structure.

It would read a bit more easily if you move the main verbal phrase higher in the sentence:

In [10] and [11], algorithms have been proposed to find trajectories of a UAV effective in estimating the channel models and user locations (respectively) for a target area.

... But that's still awfully hard to parse. Something like this might be easier:

In [10] and [11], I propose* algorithms to find trajectories of a UAV. The [10] algorithm can help make effective estimates of the channel models for a target area, and the [11] algorithm can be similarly effective for user locations.

* If you're forced to use the passive voice ("algorithms have been proposed") by a style guide or other factors, then you'll have to do so; otherwise, active voice is much more readable and interesting. I've made the assumption that the correct pronoun is "I"; that might not be true. Also, I understand little enough about the source material that I might be mangling the intended meaning overall.


text:
Q: get route parameters in angular with lazy loading I would retrieve a parameter from my route path in Angular 5
http://localhost:4200/#/dashboard/74618/LastCC

I would get  74618 from route which is an id parameter.
I have processed like this
constructor(public activatedRoute: ActivatedRoute)

this.activatedRoute.paramMap.subscribe(params => {
  console.log("params******");
  params.get("id");
});

I get undefined as value.
It's working when I'm on this path http://localhost:4200/#/dashboard/74618/  (Without \LastCC )
LastCC is lazy Loaded and here's the router config:
const routes: Routes = [
  {
    path: "",
    component: CreditPointComponent
  }
];

@NgModule({
  imports: [RouterModule.forChild(routes)],
  exports: [RouterModule]
})
export class CreditPointRoutingModule {}

The id parameter is on the parent module router configuration ( Dashboard module ).
const routes: Routes = [
  {
    path: ":id",
    component: DashboardComponent,
    children: [
      {
        path: "LastCC",
        loadChildren:
          "app/useful-documents/credit-point/credit-point.module#CreditPointModule"
      }
    ]
  }
];

A: You don't have a parameter configured on the LastCC route. Try something like this:
  {
    path: ":id",
    component: DashboardComponent
  },
  {
     path: ":id/LastCC",
     loadChildren:
          "app/useful-documents/credit-point/credit-point.module#CreditPointModule"
   }

Notice that the path for the LastCC route now has a route parameter: path: ":id/LastCC"
Notice also that the LastCC route is no longer a child route. Did it need to be?
If it does need to be a child route, then you may need to leave the route configuration as you have it and read the parameter from the parent's route instead of from the LastCC route.
this.activatedRoute.parent.paramMap.subscribe(params => {
  console.log("params******");
  console.log(params.get("id"));
});

Notice the .parent after the activatedRoute.


text:
Q: ProgressBar countdown with Handlers in an Android application I first want to say I used google a lot to find a progress bar that fills itself when time passes. All results I found where either with a thread or with an Asynctask. As being new to Android, I thought it was easier to accomplish with an extra Handler that handles the updates of the progressbar.
However, I did not find anyone doing it my way. Does it maybe violate Android rules? For example, can I use multiple Handlers at the same time?
My code looks like:
public void restarttimebar()
{
    stoptimebar();
    for(int i=1;i<12;i++)
    {
    Message msg = timebarhandler.obtainMessage(0,i,0);
    timebarhandler.sendMessageDelayed(msg, i*250);
    }

};

public void stoptimebar()
{
    timebarhandler.removeMessages(0);
    Message msg = timebarhandler.obtainMessage(0,0,0);
    timebarhandler.sendMessage(msg);
};

Handler timebarhandler = new Handler()
{
    @Override
    public void handleMessage(Message msg)
    {
        ProgressBar progressbar = (ProgressBar)findViewById(R.id.timebar);
        if (msg.arg1 == 0)
        {
            progressbar.setProgress(0);
        }
        if (msg.arg1 > 0)
        {
            progressbar.setProgress(msg.arg1*9);
        }
    }
};

Now one can call restarttimebar(); to (re)start the progress bar. It will fill over 3 seconds with increments at each 0.25 second. Any remarks greatly appreciated!!
EDIT: Also added a stoptimebar(); to just stop the progressbar. Also, the standard size of a progressbar is 100. So I just make the twelve updates times 9. It is almost 100 ;) The bar does not have to be THAT very precise in my application.

A: As far as i know, the threads you create and Asynctasks (Non-UI-Threads) should not touch UI-stuff like your progressbar. If you need your task communicate with the progressbar, use Asynctask and make sure that UI related actions are done in onPostExecute(). This method will be also called by the main UI Thread.

A: I guess my method of updating the progress bar can be seen as correct. So for anyone who googles and has the same kind of question: Use the code in the question!


text:
Q: How to fix rubber band network lag? I am playing Saints Row the Third with my friend co-op on PC, using the LAN feature.
When playing and say if my friend is driving, there is extreme rubber banding (where the car/objects rubber band [network lag]). Walking around isn't that noticeable, but it is during driving. Both PCs are connected to the router via an ethernet.
We are both on the same network under 1 router. How can we fix this?
There is no firewall running on either PC. My connection is fine, I can get ~2Mbps download on Steam. Or I can copy files over the LAN at Megs a second as well.
I put in a support ticket with the developers, but they're just telling me to update my video card drivers...
This does not happen in any other games played over LAN. Pinging the two PCs results in 0% loss and <1ms response time.

A: This is a well known issue of the game since its release.
See here: http://www.saintsrow.com/community/go/thread/view/136781/28692595/Lag_while_in_co-op_lan
The problem is not in your hardware, system or network.
The problem is in the game engine. But neither the game developer - Volition, nor THQ -publisher, even commented on the issue yet, let alone taking any effort to fix it.
(There is a single, one line response from sombody from Volition on the mentioned forum, and that blames the issue, quite nonsensicaly, on somebodys low hardware specs (!?) ).
There are apparently hundreds of people with varying HW and network connections, including me. Including people with flawless lan\net paramaters, people who exceed HW specs for this game and its co-op. Still having the issue.
This is a state of things well in 2013. Still no real fix (official or unofficial) is known to me :(
There are some hints on the forum on how to make it more bearable. In short:
Try to make the game run with same or as similar as possible frame rate (FPS) on all computers that are connected to one coop session.
That can be partially (but tediously) achieved by tweaking ingame - mainly Graphic settings.
E.G. On faster computer set graphic details higher (even ridiculously / needlessly high) to slow the game down. On slow computer lower game resolution and other graphic effects settings. Do so until the game on both computers run with as similar FPS as possible.
IF your net connection is all right, this should reduce (though not remove) the rubber-banding effect, at least while driving cars.
This is what I found it the mentioned forum. I didn't test it myself (because the process is really tiresome and not worth it for me).
The bottom line is: remember this issue and how it was never fixed, before buying next game from either of the above mentioned companies.


text:
Q: Why is my memory running out when file gets to big? So the error I am getting is this.

An unhandled exception of type 'System.OutOfMemoryException' occurred
  in mscorlib.dll

I have never encountered this error before and I've looked it up on Google.
I do have a 64-Bit system.
I do have 16GB of RAM.
Some people said that I need to set the platform target to x64 in my project properties but wont that make it so only 64-bit systems will be able to run this application?
public static string RC4(string input, string key)
{
    StringBuilder result = new StringBuilder();
    int x, y, j = 0;
    int[] box = new int[256];

    for (int i = 0; i < 256; i++)
    {
        box[i] = i;
    }

    for (int i = 0; i < 256; i++)
    {
        j = (key[i % key.Length] + box[i] + j) % 256;
        x = box[i];
        box[i] = box[j];
        box[j] = x;
    }

    for (int i = 0; i < input.Length; i++)
    {
        y = i % 256;
        j = (box[y] + j) % 256;
        x = box[y];
        box[y] = box[j];
        box[j] = x;

        result.Append((char)(input[i] ^ box[(box[y] + box[j]) % 256]));
    }
    return result.ToString(); //This would be the line throwing me the error.
}

Because every second im appending new text from a keyboard hook to a textfile. So lets say I type abc the first second its going to append that, now if I type def the next second its going to append that. This is all happening inside of a timer tick so its really straight forward.
Whenever the textfile reaches around 350 000KB it throws me that error.

A: There is a limit to how big single objects are allowed to be, even on x64. The actual limit doesn't matter and depends on configuration, but the upshot is that when processing large volumes of data you should read through the data in pieces (usually via Stream), processing chunks at a time. Never try to hold the entire thing in memory at once. This applies equally to input and output.
Now, if you managed to load the entire thing into input, then you got lucky; but StringBuilder is intentionally oversized, so that it doesn't have to keep allocating all the time. You might be able to "fix" your code by telling StringBuilder the correct amount of characters you need in the constructor, but that is only a temporary hack that will let you to process slightly larger data. The real fix is to not attempt to process huge data in a single chunk.


text:
Q: Deleting/overwriting a mounted file on host or in container I mount a file on the host to a file inside the docker container:
-v /var/mydir/myfile.yml:/cotainerdir/myfile.yml
I expect the file outside the container, to reflect changes made on the file inside the container. For example, when the file inside the container is overwritten, the file on the host also gets overwritten. Or when I delete the file on the host, and overwrite the file inside the container, the file to be created on the host side.
But after deleting the file on the host side, the mount link seems to be broken. Why is this happening?
I use docker inspect -f '{{ .Mounts }}' and I see the mount relation is there as expected.

A: I suspect it's because you're mapping a specific file (identifier|inode) and, when you overwrite|delete it, the mapping is broken.
An alternative approach would be to map a directory that contains the file(s) you're going to be creating|deleting|overwriting:
docker run .... --volume=var/mydir:/containerdir

Then, because the directory will persist, you should (!) be able to create and delete files without issue and changes on the host|container will be reflected corectly.


text:
Q: How to define a URL in django that directly points to a static file? I have a urls.py file that looks like this:
from django.conf.urls import include, url
from django.contrib import admin
from django.conf.urls.static import static
from django.conf import settings
from django.views.generic.base import RedirectView
from django.contrib.staticfiles.templatetags.staticfiles import static

urlpatterns = [
    url(r'^admin/', admin.site.urls),
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)

I want to make a URL (say r'^test/' ) such that when I enter that URL, it directly links to a static file (say 'static/test.html').

A: A simple way is you can use redirect function to do this.
from django.shortcuts import redirect
def test(request):
    return redirect(to="/static/test.html")

and point with your url to this function. I have tested and this works perfectly for me.


text:
Q: How to add arguments to a jq function? def gather($ary):
  INDEX(.[]; .column) as $dict
  | $ary
  | map( $dict[.] | .value );

.[] | gather(["h1", "h2", "h3"])

Given the above jq file, I got the following output. I'd like to make "column" and "value" additional argument to gather() so that users can easily change them. Could you show me how to make such scalar as function arguments? Thanks.
$ jq -f ./main.jq <<EOF
[
  [
    { "column": "h1", "value": "v1" },
    { "column": "h2", "value": "v2" },
    { "column": "h3", "value": "v3" }
  ],
  [
    { "column": "h1", "value": "v4" },
    { "column": "h2", "value": "v5" },
    { "column": "h3", "value": "v6" }
  ]
]
EOF
[
  "v1",
  "v2",
  "v3"
]
[
  "v4",
  "v5",
  "v6"
]

A: Function arguments are separated by ; rather than ,; note also that, as the jq manual says:

Arguments are passed as filters (functions with no arguments), not as values...

Thus you could define:
def gather($ary; column; value):
   ....

and invoke it as:
def gather(["h1", "h2", "h3"]; .column; .value)

See also https://github.com/stedolan/jq/wiki/How-to:-Avoid-Pitfalls#multi-arity-functions-and-commasemi-colon-confusability