text:
Q: CSS float inside the list avoid unwanted padding In my list element I want to place the control buttons aside, from the left of the list item text. In order to do that I use a property float: left;, it does the job, but when there are more than one line in a list, every new line has a padding of a size of the previous floating block:

The list is based on Vue.js & Bootstrap.
My CSS/HTML code:

   <transition-group name="item">

            {{item.properties.NAME}}

            Update
            Delete

   </transition-group>

How to display buttons inside the list on the right/left side of the list just one under the other?
The final result should be something like that:

*

*Item #1_____________________________________Update___Delete

*Item #2_____________________________________Update___Delete

A: Try style="clear:left;".  If that doesn't work, you would actually do the float or the clear left on the  'li' element, not on the span containing the buttons. This way each 'li' containing the buttons will contain the buttons themselves.
Try something to this affect below. Since there is not a JS Fiddle, editing code for what your needs are harder to edit.

<transition-group name="item">

        {{item.properties.NAME}}

  Update
        Delete

</transition-group>

Kind of like this. Quick and dirty. Except on the elements, instead of inline styling, highly recommend CSS.
https://jsfiddle.net/y1x53zx2/1/

A: Your issue should be solved by resetting or clearing the float that you've created. As you're using bootstrap you can simply add the class clearfix to your li element that you have added float to. This will add a pseudo after element which will reset the flat after the element.
The final code snippet:

   <transition-group name="item">

         {{item.properties.NAME}}

            עדכן
            מחק

   </transition-group>


text:
Q: Lua string.match() problem I want to match a few lines for a string and a few numbers.
The lines can look like
"  Code                                             : 75.570 "

or
"  ..dll                                   :          13.559       1"

or
"  ..node                                    :  4.435    1.833    5461"

or
"  ..NavRegions                                     :  0.000         "

I want something like
local name, numberLeft, numberCenter, numberRight = line:match("regex");

But I'm very new to the string matching.

A: This pattern will work for every case:
%s*([%w%.]+)%s*:%s*([%d%.]+)%s*([%d%.]*)%s*([%d%.]*)
Short explanation: [] makes a set of characters (for example the decimals). The last to numbers use [set]* so an empty match is valid too. This way the number that haven't been found will effectively be assigned nil.
Note the difference between using + - * in patterns. More about patterns in the Lua reference.
This will match any combination of dots and decimals, so it might be useful to try and convert it to a number with tonumber() afterwards.
Some test code:
s={
"  Code                                             : 75.570 ",
"  ..dll                                   :          13.559       1",
"  ..node                                    :  4.435    1.833    5461",
"  ..NavRegions                                     :  0.000         "
}
for k,v in pairs(s) do
    print(v:match('%s*([%w%.]+)%s*:%s*([%d%.]+)%s*([%d%.]*)%s*([%d%.]*)'))
end

A: Here is a starting point:
s="  ..dll                                   :          13.559       1"
for w in s:gmatch("%S+") do
        print(w)
end

You may save these words in a table instead of printing, of course. And skip the second word.

A: @Ihf Thank you, I now have a working solution.
local moduleInfo, name = {};
for word in line:gmatch("%S+") do
    if (word~=":") then
        word = word:gsub(":", "");
        local number = tonumber(word);
        if (number) then
            moduleInfo[#moduleInfo+1] = number;
        else
            if (name) then
                name = name.." "..word:gsub("%$", "");
            else
                name = word:gsub("%$", "");
            end
        end
    end
end

@jpjacobs Really nice, thanks too. I'll rewrite my code for synthetic reasons ;-) I'll implement your regex of course.

A: I have no understanding of the Lua language, so I won't help you there.
But in Java this regex should match your input
"([a-z]*)\\s+:\\s+([\\.\\d]*)?\\s+([\\.\\d]*)?\\s+([\\.\\d]*)?"
You have to test each group to know if there is data left, center, right
Having a look at Lua, it could look like this. No guarantee, I did not see how to escape . (dot) which has a special meaning and also not if ? is usable in Lua.
"([a-z]*)%s+:%s+([%.%d]*)?%s+([%.%d]*)?%s+([%.%d]*)?"

redpajama_set_name: RedPajamaStackExchange


text:
Q: Code first Entity Framework (EF6) Adding Many-to-Many relationship after initial create
I am new to MVC, the Entity Framework, and Databases in general, but I have not been able to figure out what is going on here.  I am trying to create a many-to-many relationship via code from an already created db.  Thanks in advance for any pointers you can give.
I have a code-first database defined by 2 models (the real one is much more complex, but for brevity this also shows my question/problem):
public class Beer
{
    public int BeerID { get; set; }
    public string Name { get; set; }
    public virtual ICollection<Company> Companies { get; set; }  // one beer could have many companies

}

public class Company
{
    public int CompanyID { get; set; }
    public string Name { get; set; }

    // Navigation Property

}

public class ManyToManyDB : DbContext
{
    public DbSet<Beer> Beers { get; set; }
    public DbSet<Company> Companies { get; set; }
}

When I run the Enable-Migrations -ContextTypeName ManyToManyTest.Models.ManyToManyDB, everything is fine.  I get the Configuration.cs file in my project.  I do some editing there:
    public Configuration()
    {
        AutomaticMigrationsEnabled = true;
        AutomaticMigrationDataLossAllowed = true;
    }

Add some data to the Seed method:
        context.Companies.AddOrUpdate(c => c.Name,
            new Company { Name = "Company1" },
            new Company { Name = "Company2" },
            new Company { Name = "Company3" }
            );

        context.Beers.AddOrUpdate(b => b.Name,
            new Beer { Name = "Beer1" },
            new Beer { Name = "Beer2" },
            new Beer { Name = "Beer3" }
            );

Now I run "Update-Database -verbose" and the DB is created.  So far so good.
Now lets say I forgot to create my Many to Many relationship in the Company class, so I update it:
public class Company
{
    public int CompanyID { get; set; }
    public string Name { get; set; }

    // Navigation Property
    public virtual ICollection<Beer> Beers { get; set; }  // this is what I forgot, a company can have many beers
}

Ok, so, as this is early on in development, I should be able to just run "update-database" again and it will add the necessary stuff (which in this case will include a new junction table for the many-to-many relationship).  Unfortunately, when I do, this happens:
EXECUTE sp_rename @objname = N'dbo.Companies', @newname = N'CompanyBeers', @objtype = N'OBJECT'

Caution: Changing any part of an object name could break scripts and stored procedures.
IF object_id(N'[dbo].[FK_dbo.Companies_dbo.Beers_Beer_BeerID]', N'F') IS NOT NULL
    ALTER TABLE [dbo].[Companies] DROP CONSTRAINT [FK_dbo.Companies_dbo.Beers_Beer_BeerID]

It throws this exception
System.Data.SqlClient.SqlException (0x80131904): Cannot find the object "dbo.Companies" because it does not exist or you do not have permissions.

The error being:
Cannot find the object "dbo.Companies" because it does not exist or you do not have permissions.
Any idea why I cannot create a many-to-many relationship after creating the initial db schema?
I may just try again from the start, but wanted to know if there is a solution to this in case I happen upon it in the future.
Using VS2013 and EF6.02 if that matters.  The project is from the normal MVC template.

A: Sorry to say but it seems like a bug in EF.
EF generates automatic update that is equal to the one that would be produced by running Add-Migration.
    public override void Up()
    {
        RenameTable(name: "dbo.Companies", newName: "CompanyBeers");
        DropForeignKey("dbo.Companies", "Beer_BeerID", "dbo.Beers");
        DropIndex("dbo.Companies", new[] { "Beer_BeerID" });
        CreateIndex("dbo.CompanyBeers", "Company_CompanyID");
        CreateIndex("dbo.CompanyBeers", "Beer_BeerID");
        AddForeignKey("dbo.CompanyBeers", "Company_CompanyID", "dbo.Companies", "CompanyID", cascadeDelete: true);
        AddForeignKey("dbo.CompanyBeers", "Beer_BeerID", "dbo.Beers", "BeerID", cascadeDelete: true);
        DropColumn("dbo.Companies", "Beer_BeerID");
    }

Now in the second line of migration method it calls DropForeignKey that produces ALTER TABLE with DROP that ends with an exception because table was renamed in the first place.
The workaround is to run Add-Migration, drop code and write it by hand. I ended up with code like this:
    public override void Up()
    {
        DropIndex("dbo.Companies", new[] { "Beer_BeerID" });
        DropForeignKey("dbo.Companies", "Beer_BeerID", "dbo.Beers");
        DropColumn("dbo.Companies", "Beer_BeerID");

        CreateTable(
            "dbo.CompanyBeers",
            c => new
            {
                Company_CompanyID = c.Int(nullable: false),
                Beer_BeerID = c.Int(nullable: false),
            })
            .PrimaryKey(t => new { t.Company_CompanyID, t.Beer_BeerID })
            .ForeignKey("dbo.Companies", t => t.Company_CompanyID, cascadeDelete: true)
            .ForeignKey("dbo.Beers", t => t.Beer_BeerID, cascadeDelete: true)
            .Index(t => t.Company_CompanyID)
            .Index(t => t.Beer_BeerID);
    }

A: Answering my own question.  After a few hours of thinking about it, like pg0xC states it is probably a bug in the Entity Framework.  Here is an easy workaround in case anyone else hits this problem.
Sticking with my example above, remove both of the ICollections from the Beer and Company classes:
public class Beer
{
    public int BeerID { get; set; }
    public string Name { get; set; }
    //public virtual ICollection<Company> Companies { get; set; }  // one beer could have many companies

}

public class Company
{
    public int CompanyID { get; set; }
    public string Name { get; set; }

    // Navigation Property
    // public virtual ICollection<Beer> Beers { get; set; }  // this is what I forgot, a co
}

Now run update-database again... it worked for me on both the sample as well as my actual code.  Of course you will lose any Companies that were linked to the beer class. If this is unacceptable, you will have to do something similar to what the other answerer (pg0xC) stated.
Go back and uncomment the ICollections in both the Beer and Company classes, run update-database one last time and everything should work.  After doing this, I had the CompanyBeers junction table in the localdb.


text:
Q: ios local notification didreceivelocalnotification Will the "didreceivelocalnotification" method be called if the user has disabled notifications for my app? I need a way to call a method on a specific date . Even if the user doesn't want to see a notification the method should be called. Is there a better way than local notifications for this?

A: Firstly, the didReceiveLocalNotification: method would be called only if your app is running and local notification fires while the app is running.
It seems that once you "send" the local notification to the system using scheduleLocalNotification: or presentLocalNotificationNow: method, it is to be fired.
So when the "fire date" comes, if your app is running, the didReceiveLocalNotification: method would be called.
I ran a sample application and confirmed that.

A: No, its not called.
Its better you to save your task into a server, and run it over there.
You cant guarantee that your user dont delete you app or enable its notifications.


text:
Q: locked files on HFS+ home partition shared between OSX/Linux I dual boot into Arch Linux and OS X 10.6 on my MacBook pro. I synced my UID between both OSes and created an HFS partition (with no journaling) to use as a shared home/Users partition.  For the most part it works just as I'd expect, but sometimes when I'm booted into OS X certain files are "locked" (when I get info on a particular file the "Locked" box is checked under the "General" pane.  I can resolve the issue by manually unchecking the box) and/or I get "Operation not permitted" when I try deleting or chmod'ing a file. In both cases I don't see anything out of the ordinary on the permission bits displayed with ls -l, except for a trailing '@' character in the position where the sticky bit would normally occur:
-rw-r--r--@  1 myuser  mygroup   296 Mar 29 11:44 myfile

This '@' character shows up on ALL normal files, so doesn't seem to be linked to the locked/operation not permission situation.
On the Linux side of things I never have permission problems. To the best of my limited knowledge and experience with ACLs I've not found any ACLs on any of the files in question.
For what it's worth, I do most of my file editing using emacs (Aquamacs in OSX), is it possible it is setting weird permission bits?

*

*What is the "locked" setting that OS X uses and does it have a permission bit equivalent (so at the very least I could recursively unlock all files in my home directory from the terminal)

*why might some, but not other files get "locked" when booting into OS X

*what is the meaning of the '@' character?

A: I have been running into the same issue too.
My understanding from information that I read here, and on other places, is that it's a linux kernel bug in the hfsplus module. It adds random user flags to files. There are two flags that prevent editing/deleting files: uchg and uappnd. These are the two bad guys. They can be applied to a file or even to a parent directory.
Flags are displayed with:

$ ls -laO /Volumes/my-volume

Flags can be removed recursively with:

$ man chflags
$ chflags -R nouchg,nouappnd,noopaque,dump /Volumes/my-volume

NOTE: I remove also the opaque and nodump flags. I don' t need no flags.

A: The @ means that file has "extended attributes" (extra metadata, abbreviated "xattrs") attached to it in the filesystem.  To see the list of xattrs attached to the files, do ls -l@ in Mac OS X.
Classic Mac OS had the concept of "Finder Info" which was a small fixed (non-extensible) set of metadata that all files on an HFS volume had. This included the "type and creator codes", and the "Finder flags", including the "locked" bit, the "visible" (hidden) bit, and several others.  Mac OS X has basically deprecated the old Finder meta-data, but on the occasions where it's still needed, it now gets attached to the file's record in the filesystem as an xattr.  Those locked files you're seeing almost certainly have this Finder info xattr attached, so that the state of the old Finder "locked" bit can be recorded.
My Snow Leopard system has a /usr/bin/xattr command that seems to have no man page, but it does have a usage statement if you invoke it with -h.  Note that xattr -l filename can be useful to get a hex/ASCII dump of the values of the xattrs attached to a file.
Mac OS X's built-in commands for viewing and manipulating the old Finder info xattr from the terminal include GetFileInfo(1) and SetFile(1).
Update:
I have no good explanation for why those files are getting locked, but my hunch would be that whatever HFS support software you're running in Linux is either misunderstanding the purpose, and the deprecated status, of the old Finder lock bit and setting it when it shouldn't, or it's intentionally using the lock bit as a mechanism to map some kind of Linux filesystem semantic concept onto HFS.
The Finder lock bit was intended as a way for users to manually lock their own files so they didn't accidentally modify or delete them, and was not meant as a mechanism for process-level file locking to avoid multiple processes writing to the same file at the same time. That is, it was not supposed to be a replacement for fcntl(2) or flock(2). At the time the Finder lock bit was designed, the Mac was not a multiprocessing system.
Update 2:
It could also be that Aquamacs is abusing the old Finder lock bit to carry out emacs' file locking wishes.

A: I've found a workaround. It's seems to be a race condition in the hfsplus kernel module, caused by non atomic access to userflags. I've disabled it and the userflags will ever be zero, unlocked, ok for me.
fs/hfsplus/inode.c near line 248:
    inode->i_mode = mode;

/* FIXME commented out because of unreliable results, needs mutex_lock (?) */
//    HFSPLUS_I(inode)->userflags = perms->userflags;
    if (perms->rootflags & HFSPLUS_FLG_IMMUTABLE)

fs/hfsplus/catalog.c near line 79:
            perms->rootflags &= ~HFSPLUS_FLG_APPEND;

/* FIXME commented out because of unreliable results, needs mutex_lock (?) */
//    perms->userflags = HFSPLUS_I(inode)->userflags;
    perms->mode = cpu_to_be16(inode->i_mode);

You could build a custom kernel, but I use dkms:
$ cd /usr/src
$ tar xjpvf linux-source-*.tar.bz2 linux-source-*/fs/hfsplus
$ cp -R linux-source-*/fs/hfsplus hfsplus-YOUR_VERSION
$ vi hfsplus-YOUR_VERSION/inode.c
$ vi hfsplus-YOUR_VERSION/catalog.c
$ vi hfsplus-YOUR_VERSION/dkms.conf (see below for the content)
$ su
# dkms install hfsplus/YOUR_VERSION

/usr/src/hfsplus-YOUR_VERSION/dkms.conf:
NAME=hfsplus
VERSION=YOUR_VERSION
PACKAGE_NAME="$NAME"
PACKAGE_VERSION="$VERSION"
MAKE[0]="make -C ${kernel_source_dir}
  SUBDIRS=${dkms_tree}/${NAME}/${VERSION}/build modules"
BUILT_MODULE_NAME[0]="hfsplus"
DEST_MODULE_LOCATION[0]="/kernel/fs/hfsplus"
REMAKE_INITRD=y
AUTOINSTALL="yes"

Note: The installation fails for me, if I don't cd into /usr/src .
To uninstall:
# dkms remove hfsplus/YOUR_VERSION --all

Environment: MacBookPro7,1, Core 2 Duo, SATA NVidia MCP89 AHCI, Mac OS X 10.6, Debian GNU/Linux, Kernel 2.6.28, 2.6.29, 3.0, 3.1, 3.2.

A: This is a Linux kernel bug, fixed in 3.4 (patch).
I've had the same problem using pure Unix utilities. Namely, I've backed up my Mac OS X hard drive from Xubuntu 12.04 live using rsync. After restore, many folders were randomly locked, including directories in git repositories (and I highly doubt git would do that). You can see those attribs with ls -lO. Doing that on my backup shows that these bits have essentially random values:
# ls -ldO /Volumes/HFS+Backup/Users/pgiarrusso/*
drwx------   31 pgiarrusso  staff  uchg,nodump,opaque         1054 Aug 13 02:00 /Volumes/HFS+Backup/Users/pgiarrusso/Desktop
drwx------   36 pgiarrusso  staff  nodump                     1224 Jul 22 16:04 /Volumes/HFS+Backup/Users/pgiarrusso/Documents
drwx------  108 pgiarrusso  staff  uappnd                     3672 Aug 13 11:43 /Volumes/HFS+Backup/Users/pgiarrusso/Downloads
drwx------   13 pgiarrusso  staff  uappnd,uchg,opaque          442 Jul 22 05:04 /Volumes/HFS+Backup/Users/pgiarrusso/Dropbox
drwx------   53 pgiarrusso  staff  -                          1802 Aug 12 00:58 /Volumes/HFS+Backup/Users/pgiarrusso/Library
drwx------   11 pgiarrusso  staff  uchg,nodump,opaque          374 Jul 22 17:25 /Volumes/HFS+Backup/Users/pgiarrusso/Movies
drwx------   13 pgiarrusso  staff  uappnd,uchg,nodump          442 Jun 10 12:05 /Volumes/HFS+Backup/Users/pgiarrusso/Music
drwx------   15 pgiarrusso  staff  uappnd,nodump,opaque        510 Jun 10 12:05 /Volumes/HFS+Backup/Users/pgiarrusso/Pictures
drwxr-x---   11 pgiarrusso  staff  opaque                      374 Jul  6 15:33 /Volumes/HFS+Backup/Users/pgiarrusso/Public
drwxr-xr-x   34 pgiarrusso  staff  uappnd,uchg,opaque         1156 May 27 12:39 /Volumes/HFS+Backup/Users/pgiarrusso/Sites
drwxr-xr-x    2 pgiarrusso  staff  uappnd,nodump,opaque         68 Jun 10 21:43 /Volumes/HFS+Backup/Users/pgiarrusso/VirtualBox VMs
-rwxr-xr-x    1 pgiarrusso  staff  uappnd,nodump,opaque       1703 Feb 19  2012 /Volumes/HFS+Backup/Users/pgiarrusso/bash-prompt.sh
drwxr-xr-x   22 pgiarrusso  staff  -                           748 Aug 10 19:47 /Volumes/HFS+Backup/Users/pgiarrusso/bin
lrwxrwxrwx    1 pgiarrusso  staff  nodump,opaque                37 Sep 27  2011 /Volumes/HFS+Backup/Users/pgiarrusso/default.sfx -> /Users/pgiarrusso/opt/rar/default.sfx
-rw-r--r--    1 pgiarrusso  staff  uappnd,uchg          1375563169 Aug  2 18:52 /Volumes/HFS+Backup/Users/pgiarrusso/heapdump-1343925310626.hprof
drwxr-xr-x   22 pgiarrusso  staff  uappnd,nodump               748 Aug  1 22:15 /Volumes/HFS+Backup/Users/pgiarrusso/opt
drwxr-xr-x    7 pgiarrusso  staff  uappnd                      238 Apr 19 20:00 /Volumes/HFS+Backup/Users/pgiarrusso/share
drwxr-xr-x   35 pgiarrusso  staff  nodump,opaque              1190 Aug 10 00:06 /Volumes/HFS+Backup/Users/pgiarrusso/tmp

I've compared this to the same directory on a working filesystem, and those bits are not set.


text:
Q: Java networking Not Working Im trying to solve an exercise on JAVA IO . The problem i get is that the messages are not coming on the correct order. For example this is what happens:

*

*Run server

*Run Client

*Type Password

*Two

*Three

*Wrong password

*One

*Wrong password

*Trial

*Waiting for sentence

*T

*TRIAL
Your IP address is :/
Your Socket is : 4351
Current date is : 2011/05/18 15:45:13.
So for some reason the messeges are not on right order.
This is the code:
import java.io.*;
import java.net.*;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;

class TCPServer {

    public TCPServer() {
    }

    public static void main(String args[])
            throws Exception {
        String clientSentence;
        String capitalisedSentence;
        DateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
        Date date = new Date();

        ServerSocket welcomeSocket = new ServerSocket(4351);

        while (true) {

            Socket clientSocket = welcomeSocket.accept();
            BufferedReader inFromClient =
                    new BufferedReader(new InputStreamReader(clientSocket.getInputStream()));
            DataOutputStream outToClient =
                    new DataOutputStream(clientSocket.getOutputStream());

            boolean correctPass = false;
            while (!correctPass) {
                if (getPassword(clientSocket,inFromClient,outToClient)) {
                    correctPass = true;
                }
            }

            outToClient.writeBytes("Waiting for sentence"+"\n");

            clientSentence = inFromClient.readLine();

            capitalisedSentence = clientSentence.toUpperCase();

            outToClient.writeBytes(capitalisedSentence + "\n"
                    + "Your IP address is :" + clientSocket.getInetAddress() + "\n"
                    + "Your Socket is : " + clientSocket.getLocalPort() + "\n"
                    + "Current date is : " + dateFormat.format(date) + "\n");

        }
    }

    private static boolean getPassword(Socket clientSocket,BufferedReader inFromClient,DataOutputStream outToClient) throws Exception {
        boolean passed = false;
        outToClient.writeBytes("Type password." + "\n");
        while (!passed) {
            String password = inFromClient.readLine();
            if (password.equals("1")) {
                passed = true;

            } else {
                outToClient.writeBytes("Wrong Password" + "\n");
            }

        }
        return true;
    }
}

import java.io.*;
import java.net.*;

class TCPClient {

    public static void main(String args[])
            throws Exception {
        String sentence;
        String modifiedSentence = "";

        BufferedReader inFromUser =
                new BufferedReader(new InputStreamReader(System.in));

        Socket clientSocket = new Socket("localhost", 4351);

        DataOutputStream outToServer =
                new DataOutputStream(clientSocket.getOutputStream());

        BufferedReader inFromServer =
                new BufferedReader(new InputStreamReader(clientSocket.getInputStream()));

        do{
        while(inFromServer.ready()){
            System.out.println(inFromServer.readLine());
        }
        sentence = inFromUser.readLine();
        outToServer.writeBytes(sentence + "\n");

        }while(true);

        // close the socket and the connection
    }
}

A: the problem is you are using a DataOutputStream for output and a Reader for input -- instead try using a PrintWriter (which offers a println!) for output and the Reader you currently use for reading. It's not a good idea to mix a Stream and a Reader/Writer!

A: Note that the messages aren't so much in the wrong order, as that you are one behind on the replies from the server. I think your problem is just that you send a message, and then immediately go back to the top of the loop and check if there is an incoming message. If it is not there immediately, you ask for another input. But what if the server does not reply in between the time when you send the message and go back to the top of the loop? This will happen in a nanosecond.
So you're asking a question, and then if you don't get an immediate reply, you're promptly asking another question. Then you display the reply to the first question and ask the third question. Etc. You need to be a little more patient. It's been a while since I've done socket programming, but I think you really need to wait for a reply, don't just say that if there is no reply, barrel ahead.


text:
Q: pattern match any into a list I get the following as a result from using the scala json parse.
import scala.util.parsing.json.JSON._
val j: String = """["this",["a","b",["c","d"]]]"""
val parse_test=parseFull(j)

now from this I get a result of Option[Any]
I can use get to obtain the results (in this case I am not concerned about invalid json format, so this should be safe, right?)
parse_test.get
res26: Any = List(this, List(a, b, List(c, d)))

Now, how should I go about going from this Any to the List that I had expected? I assume I should use pattern matching, but I can't figure it out. Any help would be much appreciated

A: What you could do is a fold with a pattern match and a cast:
test_result.fold[List[String]](Nil){
  case _ :: list :: _ => list.asInstanceOf[List[String]]
  case _ => Nil
}

Assuming you're trying to throw out of the first element and that the 2nd element is the list you wanted.
Edit:
Be aware that if the 2nd element isn't a list this cast would cause an exception.  It's really horrible dealing with a List[Any] and trying to decode what's in there...

A: Here is my solution:
scala> val Some(xs @ List(_*)) = parse_test
xs: List[Any] = List(this, List(a, b, List(c, d)))


text:
Q: Non-English Character Problem When Updating Migration in .NET 6 EF Core I am trying to make a CRUD with a .NET 6 Web API & Entity Framework Core and I'm having a problem doing a migration update. MS SQL is used as database.
The name of the database given to me is made with a non-English naming like 'ZİRVEDB'. I don't know why they did such a thing, but they named the database like this.
The "ConnectionStrings" in the appsettings.json file looks like this:
{
  "ConnectionStrings": {
    "DefaultConnection" : "Server=myServerAddress;Database=ZİRVEDB;User Id=myUsername;Password=myPassword;"
  },
  "Logging": {
    "LogLevel": {
      "Default": "Information",
      "Microsoft.AspNetCore": "Warning"
    }
  },
  "AllowedHosts": "*"
}

Program.cs file contains:
global using MyAPI.Data;
global using Microsoft.EntityFrameworkCore;

var builder = WebApplication.CreateBuilder(args);

// Add services to the container.

builder.Services.AddControllers();
builder.Services.AddDbContext<DataContext>(options =>
{
    options.UseSqlServer(builder.Configuration.GetConnectionString("DefaultConnection"));
});

// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
builder.Services.AddEndpointsApiExplorer();
builder.Services.AddSwaggerGen();

var app = builder.Build();

// Configure the HTTP request pipeline.
if (app.Environment.IsDevelopment())
{
    app.UseSwagger();
    app.UseSwaggerUI();
}

app.UseHttpsRedirection();

app.UseAuthorization();

app.MapControllers();

app.Run();

And when I try to "dotnet ef database update", due to non-English character, it creates a new database like Z�RVEDB and saves the migration there. But I already have an existing database and I want it to save in that database.
Here's what I've tried:

*

*"...;Database=\"ZİRVEDB\""

*"..;Database='ZİRVEDB'"

*Set it to "Turkish_CI_AI" in database settings.

But these did not work. How can i solve this problem?
Thanks.

A: Startup cs
services.AddWebEncoders(o => {
o.TextEncoderSettings = new System.Text.Encodings.Web.TextEncoderSettings(UnicodeRanges.All);
});
bunu yaparsan düzelir


text:
Q: How to validate multiple value with single field in laravel validation I have array of id and i want to validate each id with database table using laravel validator so how can i validate multiple id
My code like this
$idArray = [10,15,16]; // I have tree routine_schedule table id
$validatior = Validator::make(array("id"=>$idArray), ["id"=>"required|exists:routine_schedule,id"]);
if ($validatior->passes()){
    exit('valid');
}else{
    exit('invalid');
}

I wan to validate each and every id is exist in routine_schedule table? so how can i validate this array id's

A: Try something like this:
public function rules($idArray)
{
  $rules = [];

  foreach($idArray as $key => $val)
  {
    $rules[$key] = 'required|exists:routine_schedule,id';
  }

  return $rules;
}

$validatior = Validator::make($idArray, rules($idArray));


text:
Q: Lower limit topology doesn't arise from metric; proof by contradiction. This problem is in Tao's Epsilon of the room, 1.6.11.

Show that the half-open topology (Example 1.6.22) is Hausdorff, but does not arise from a metric. (Hint: assume for contradiction that the half-open topology did arise from a metric; then show that for every real number x there exists a rational number q and a positive integer n such that the ball of radius 1/n centred at q has infimum x.)

And I proved it in below way; I think this proof has some missing points; Could you verify this proof?

Clearly, Let $F$ be half-open interval topology and $x,y \in \mathbb{R}$ and without loss of generality, $x<y$. Then $[x,y)$ and $[y,y+1)$ is clearly open neighborhood of $x,y$ without nonempty intersection. Hence this topology is hausdorff. Now we want to show that it doesn't arise from metric space. For contradiction, suppose it is arise from metric space. By definition of metrizable topology, for any $[x,y) \in F$ can be represented as union of open balls $B(x_0, r) = \{ x \in X : d(x_0 , x) < r\}$. We know that $\mathbb{Q}$ is dense in $\mathbb{R}$, so for any open sets $[a,b) \in F$, $\mathbb{Q} \cap [a,b) \neq \emptyset$. Hence $F$ is separable. With the fact that $\mathbb{Q} \cap [a,b)$ is dense in $F$ and $F$ is metrizable, there exists $x \in \mathbb{R}$ such that $x= \inf\{B(q,\frac{1}{n})\}$. However this is contradiction when $x \notin \mathbb{Q}$ since $ \inf\{B(q,\frac{1}{n})\} = (q-\frac{1}{n},q+\frac{1}{n})$ has infimum as $q-\frac{1}{n}$, which is rational number. Therefore, $F$ is not metrizable.

A: Another proof to see it is not metrizable: $X$ is separable: every set $[a,b)$ with $a < b$ contains a rational (already in $(a,b)$), so $\mathbb{Q}$ is dense and countable. But $X$ is not second countable: let $\{ B_i: i \in I\}$ be a base for $X$. For each $x$ in $X$, we pick $i(x) \in I$ such that $x \in B_{i(x)} \subset [x, x+1)$, by the definition of being a base.
But note that if $x < y$, say, then $x \notin B_{i(y)}$, as $B_{i(y)} \subset [y, y+1)$, which does not contain $x$, and $x \in B_i(x)$ by construction, hence $B_{i(x)} \neq B_{i(y)}$ for two distinct $x,y$ in $X$. So the base has at least as many elements as $X$ has, which is certainly uncountable...
For a metrizable space, being separable implies having a countable base, so this shows that $X$ is not metrizable.

A: One small problem occurs at the end, when you say

$\inf \{ B ( q , \frac 1n ) \} = ( q - \frac 1n , q + \frac 1n )$

Apart from a notational difficulty (a real number is not an interval), you seem to be assuming that the balls arising from the metric generating the half-open interval topology are open intervals in $\mathbb{R}$.  Note that if this were the case, then the half-open interval topology would be coarser than the usual topology, which is not so.
Note the following: $X$ is a metric space, and $D \subseteq X$ is dense, one can show that the family $$\mathcal{B} = \{ B_{1/n} ( x ) : x \in D , n \in \mathbb{N} \}$$ is a base for the topology.
Use the above with your observed fact that $\mathbb{Q}$ is dense in $F$ to prove Tao's hint (pick an appropriate open neighbourhood of $x$).  Next observe that if $x,y \in \mathbb{R}$ are distinct and $p,q \in \mathbb{Q}$, $n,m \in \mathbb{N}$ are such that $$x = \inf ( B_{1/m} ( p ) ) \quad y = \inf ( B_{1/n} ( q ) )$$ then either $n \neq m$ or $p \neq q$.  From here we can set up an injective function $\mathbb{R} \to \mathbb{Q} \times \mathbb{N}$, which is problematic.

As an aside, you actually note something that is very important in your run-down (emphasis added):

Hence $F$ is separable.

One basic fact about metric (metrizable) spaces is that they are separable iff they are second-countable.  This is the usual route (in my humble opinion) to show that $F$ is not metrizable (and, actually, Tao's hint gets you pretty close to going this way).


text:
Q: R Markdown html_notebook : How to set UTF-8 encoding directly in the script? I have a html_notebook in R Markdown that I saved in UTF-8 in RStudio by doing file > Save with Encoding > UTF-8. When other users open the R Markdown file on their computer, the UTF-8 encoding is lost and replaced with their local encoding (Général becomes Général, for example).
Is there a way to "force" an encoding for the other users on a html_notebook, without manual intervention from them? In other words, I wan them to simply open and run the script without having to change their default local encoding.
Is there a way to set the encoding of a R Markdown html_notebook directly in the YAML header settings like the one below, for example? Adding encoding: UTF-8 doesn't seem to be an option.
---
title: "Title"
author: "Author"
date: "September, 2017"
output:
  html_notebook:
    code_folding: none
    df_print: paged
    fig_height: 4
    fig_width: 9
    includes:
      after_body: tabset-dropdown.html
    theme: spacelab
---


text:
Q: How do I use a disable method in combination of another initialization? I am using the following autocomplete plugin: http://www.richwidgets.io/api/classes/autocomplete.html
What I would like to achieve, is to have all fields with the class .autocomplete be transformed into autocomplete fields, BUT the one that are disabled, to be disabled using the plugin's method ("disable").
I currently use the following, but seems to result in errors:
$('.autocomplete').each(function(){
   $(this).autocomplete({..});
   if($(this).is(':disabled')){
       $(this).autocomplete('disable');
   }
}

P.s. the code that is between brackets ( {..} ) works, I double checked. It's really what happens next ;-)
Not sure what I'm doing wrong..
Any help would be appreciated. Thanks!


text:
Q: Python 3.6: async version of islice? I'm trying to do something like this:
import asyncio
from itertools import islice

async def generate_numbers(n):
    for x in range(n):
        yield x

async def consume_numbers(n):
    async for x in generate_numbers(n):
        print(x)

async def consume_some_numbers(n,m):
    async for x in islice(generate_numbers(n),m): #<-- This doesn't work.  islice doesn't recognize async iterators as iterators.
        print(x)

loop = asyncio.get_event_loop()
loop.run_until_complete(consume_numbers(10))
loop.run_until_complete(consume_some_numbers(10,5))

Is there a way to make this work, or at least get similar functionality?

A: Here is an attempt to implement asyncio friendly islice (and enumerate):
import asyncio
import sys

import random

async def aenumerate(aiterable):
    i = 0
    async for x in aiterable:
        yield i, x
        i += 1

async def aislice(aiterable, *args):
    s = slice(*args)
    it = iter(range(s.start or 0, s.stop or sys.maxsize, s.step or 1))
    try:
        nexti = next(it)
    except StopIteration:
        return
    async for i, element in aenumerate(aiterable):
        if i == nexti:
            yield element
            try:
                nexti = next(it)
            except StopIteration:
                return

async def generate_numbers(n):
    for x in range(n):
        await asyncio.sleep(random.uniform(0.1, 0.4))
        yield x

async def consume_numbers(tag, n):
    print(tag, "start")
    async for x in generate_numbers(n):
        print(tag, x)
    print(tag, "done")

async def consume_some_numbers(tag, n, a, b, step=1):
    print(tag, "start")
    async for x in aislice(generate_numbers(n), a, b, step):
        print(tag, x)
    print(tag, "done")

loop = asyncio.get_event_loop()
loop.run_until_complete(asyncio.wait([
    consume_numbers("A", 5),
    consume_numbers("B", 10),
    consume_some_numbers("C", 10, 0, 5),
    consume_some_numbers("D", 30, 3, 20, 4),
    consume_some_numbers("E", 10, 3, 8, 2),
]))
loop.close()

This was not tested in a real world application, comments welcome :-)

A: The aiostream library provides generator-based operators for asynchronous iteration. See this example using stream.take:
import asyncio
from aiostream import stream

async def generate_numbers(n):
    for x in range(n):
        yield x

async def consume_some_numbers(n,m):
    async for x in stream.take(generate_numbers(n), m):
        print(x)

loop = asyncio.get_event_loop()
loop.run_until_complete(consume_some_numbers(10, 5))

All the stream operators return an enhanced asynchronous iterable providing extra features such as slicing support. Consider the following example:
import asyncio
from aiostream import stream

async def main():
    xs = stream.count()
    ys = xs[5:10:2]
    async for y in ys:
        print(y)  # Prints 5, 7, 9

loop = asyncio.get_event_loop()
loop.run_until_complete(main())

See more examples in this demonstration and the documentation.


text:
Q: Laravel 5.4 Image Intervention upload on Heroku using S3 I have created and hosted a website using Heroku which allows users to upload images onto the server, atleast I believe I have. The problem I am encountering currently is

GD Library extension not available with this PHP installation.

I have tried other forums to include the GD files. The page I used for this is How to install GD on Heroku more specifically adding "ext-gd". Preview code of my composer.json is below
{
    "require": {
        "aws/aws-sdk-php": "~2.6",
        "ext-gd": "*" ,
    }
}

However I am starting to believe that the issue could be within my controller rather than my composer. The controller function for image uplods is below:
     public function updateavatar(Request $request, User $user){

if($request->hasFile('avatar')){

    $avatar = $request->file('avatar');
    $filename = time() . '.' . $avatar->getClientOriginalExtension();
    // $destinationPath = public_path('/uploads/avatars/');

    $imageS3 = Image::make($avatar)->resize(300,300);

    Storage::disk("s3")->put($filename, $imageS3->__toString());

    $user = Auth::user();
    $user->avatar = $filename;
    $user->save();

}

This is the form within view.
    <form enctype="multipart/form-data" action="/users/{{$user->id}}/edit" method="POST">
        <label>Update Image</label>
        <input type="file" name="avatar">
        <input type="hidden" name="_token" value="{{csrf_token()}}">
        <input type="submit" value="Submit">
</form>

Any help would be trully usefull.
Thanks


text:
Q: Why is javac creating an unused variable with the postfix "++" operator on a class? Inspired by this question I started out on a little research.
I was able to determine that using primitives, the prefix ++i just gets rewritten to i++ by the compiler:
Before:
public class PrefixIncrement {
    public static void main(String args[]) {
        for(Integer i = 0; i < 100; ++i) {
            System.out.println(i);
        }
    }
}

Decompiled with jd-gui 0.36:
import java.io.PrintStream;

public class PrefixIncrement
{
  public static void main(String[] args)
  {
    for (int i = 0; i < 100; i++) {
      System.out.println(i);
    }
  }
}

Okay.  So that part was answered.  But then I stumbled across what happens when we use the Integer class instead, this time with Postfix:
Before:
public class PostfixIncrement {
    public static void main(String args[]) {
        for( Integer i = 0; i < 100; i++) {
            System.out.println(i);
        }
    }
}

After decompilation:
import java.io.PrintStream;

public class PostfixIncrement
{
  public static void main(String[] args)
  {
    Integer localInteger1;
    Integer localInteger2;
    for (Integer i = Integer.valueOf(0); i.intValue() < 100; localInteger2 = i = Integer.valueOf(i.intValue() + 1))
    {
      System.out.println(i);localInteger1 = i;
    }
  }
}

The compiler seems to do some stupid stuff with "i++."  It creates two new integer classes and creates a logically unnecessary series of assignments:
localInteger2 = i = Integer.valueOf(i.intValue() + 1);
localInteger1 doesn't appear to ever be used.  Its just allocated on the stack.  Why is javac doing this?
$ java -version
java version "1.7.0_60"
Java(TM) SE Runtime Environment (build 1.7.0_60-b19)
Java HotSpot(TM) 64-Bit Server VM (build 24.60-b09, mixed mode)

===================BY REQUEST:  javap output=======================
Postfix Increment using the Integer class.
{
  public com.foo.PostfixIncrement();
    flags: ACC_PUBLIC
    Code:
      stack=1, locals=1, args_size=1
         0: aload_0
         1: invokespecial #1                  // Method java/lang/Object."<init>
":()V
         4: return
      LineNumberTable:
        line 3: 0
      LocalVariableTable:
        Start  Length  Slot  Name   Signature
               0       5     0  this   Lcom/matt/PostfixIncrement;

  public static void main(java.lang.String[]);
    flags: ACC_PUBLIC, ACC_STATIC
    Code:
      stack=2, locals=4, args_size=1
         0: iconst_0
         1: invokestatic  #2                  // Method java/lang/Integer.valueO
f:(I)Ljava/lang/Integer;
         4: astore_1
         5: aload_1
         6: invokevirtual #3                  // Method java/lang/Integer.intVal
ue:()I
         9: bipush        100
        11: if_icmpge     40
        14: getstatic     #4                  // Field java/lang/System.out:Ljav
a/io/PrintStream;
        17: aload_1
        18: invokevirtual #5                  // Method java/io/PrintStream.prin
tln:(Ljava/lang/Object;)V
        21: aload_1
        22: astore_2
        23: aload_1
        24: invokevirtual #3                  // Method java/lang/Integer.intVal
ue:()I
        27: iconst_1
        28: iadd
        29: invokestatic  #2                  // Method java/lang/Integer.valueO
f:(I)Ljava/lang/Integer;
        32: dup
        33: astore_1
        34: astore_3
        35: aload_2
        36: pop
        37: goto          5
        40: return
      LineNumberTable:
        line 5: 0
        line 6: 14
        line 5: 21
        line 8: 40
      LocalVariableTable:
        Start  Length  Slot  Name   Signature
               5      35     1     i   Ljava/lang/Integer;
               0      41     0  args   [Ljava/lang/String;
      StackMapTable: number_of_entries = 2
           frame_type = 252 /* append */
             offset_delta = 5
        locals = [ class java/lang/Integer ]
           frame_type = 250 /* chop */
          offset_delta = 34

}

A: The semantics of the int version of prefix ++ is:  ++i is simpler: i = i + 1; return i.
Whereas i++ means a more complicated thing: int i$ = i; i = i + 1; return i$.
When int is wrapped in an Integer the used compiler evidently does not generate sufficiently intelligent code. It actually maintains the old value of i (i$ above). No reason to be that dumb, as the result of i++ is not used at that position.
for (...; ...; (void)[[ i++ ]] ) {

generates in the first instance
Integer i$ = i;
i = Integer.valueOf(i.intValue() + 1);
"return" i$ to a void context
drop variable i$ where i$ is unused

Which should easily have been reduced to:
i = Integer.valueOf(i.intValue() + 1);

A: As you can see in the javap output of your class (compiled with javac 1.8.0_60), the variables do not actually exist:
public static void main(java.lang.String[]);
  descriptor: ([Ljava/lang/String;)V
  flags: ACC_PUBLIC, ACC_STATIC
Code:
  stack=2, locals=2, args_size=1
     0: iconst_0
     1: invokestatic  #2                  // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
     4: astore_1
     5: aload_1
     6: invokevirtual #3                  // Method java/lang/Integer.intValue:()I
     9: bipush        100
    11: if_icmpge     34
    14: getstatic     #4                  // Field java/lang/System.out:Ljava/io/PrintStream;
    17: aload_1
    18: invokevirtual #5                  // Method java/io/PrintStream.println:(Ljava/lang/Object;)V
    21: aload_1
    22: invokevirtual #3                  // Method java/lang/Integer.intValue:()I
    25: iconst_1
    26: iadd
    27: invokestatic  #2                  // Method java/lang/Integer.valueOf:(I)Ljava/lang/Integer;
    30: astore_1
    31: goto          5
    34: return

(Local variables are used with *LOAD and *STORE instructions, and as you can see, there is only a single one involved.)
The problem seems to be caused by decompiler, which probably doesn't support boxing within for statements really well. So javac does nothing wrong, it's just the decompiler's fault. No need to worry about performance impacts or anything, unless you plan on reverse-engineering and saving the decompiled code :P.

A: I suspect those two temporary variables, localInteger1 and localInteger2 are placeholders introduced to handle general boxing/unboxing rules. Without looking at the decompiled byte code, which may reveal some details not in the reinterpreted-from-compiled java code, and without looking at some other less trivial cases, I am only speculating.
However, it is obvious though that they are retaining the value of i both before and after the loop ForUpdate expression.
Consider this case:
Integer i;
for( i = 0; i < 100; i++) {
   System.out.println(i);
}
System.out.println(i); // what is the value of `i` here?

Which is identical in Java code to the case of the primitive other than the declared type being Integer instead of int.
The compiler must track the value of i through and after the execution of the loop, at which point it will be 100. I suspect there are some cases in implementing a loop and handling the primitive int can be done trivially but handling object reference updates includes more complex cases and thus requires the two temporary values.


text:
Q: Ruby parsing parsed response First time messing with ruby.
The library I am using has this
require 'net/http/post/multipart'
require 'uri'

    def find(issue_id)
      get("issue/#{issue_id}")
      response.parsed_response
    end

and I used it in my file as
puts issue_resource.find("XVRCI-42")

which prints
{"issue"=>{"field"=>[{"value"=>"XVRCI", "type"=>"SingleField", "name"=>"projectShortName"}, {"value"=>"42", "type"=>"SingleField", "name"=>"numberInProject"}, {"value"=>"Add CHANGELOG.MD with Short Changelog Generation Script", "type"=>"SingleField", "name"=>"summary"}, {"value"=>"We need a changelog at root and a script that generates a short changelog when we push out now XVRClient Harnesses and new releases.", "type"=>"SingleField", "name"=>"description"} etc...}], "id"=>"XVRCI-42", "entityId"=>"66-4857"}}
I assumed this is json and parsed.
So I tried to add require 'json' and run
respons = JSON.parse(issue_resource.find("XVRCI-42"))
puts respons["field"][0]["name"]

it didnt work
How can I get summary field here and obtain the "Add CHANGELOG.MD with Short Changelog Generation Script" in a string variable?

######## EDIT ANSWER

thanks to martin turns out it is hash
so
#get the summary field
file['issue']['field'].each do |item|
   if item['name'] == "summary"
     puts item['value']
  end
end

worked for me

A: According to your source, what you need is:
puts respons["issue"]["field"][0]["name"]

A: Enumerable#find is what you want here.
response['issue']['field'].find {|x| x['name'] == 'summary'}
=> {"value"=>"Add CHANGELOG.MD with Short Changelog Generation Script", "type"=>"SingleField", "name"=>"summary"}


text:
Q: Can DCL be rolled back in transactions? Can DCL commands (e.g. GRANT/REVOKE) be committed/rolled back as transactions in snowflake? I can't find any mention of how DCL is handled in the snowflake transaction documentation.

A: Explicit transaction:

Explicit transactions should contain only DML statements and query statements. DDL statements implicitly commit active transactions (for details, see the DDL section).

GRANT and REVOKE are also considered
User & Security DDL:

Access Control Management
Use the following commands to manage access control for objects by granting (and revoking) object privileges to roles and granting roles to users and other roles:

*

*GRANT  … TO ROLE

*REVOKE  … FROM ROLE

A: DCL commands always force a commit(implicit autocommit if they are successfully executed without errors) and will in turn commit all statements before them.


text:
Q: Know any embeddable NNTP servers? I'm writing a bit of code that uses the Apache NNTP Client to fetch articles from an NNTP server. Once the code ships, we'll use an Apache James server to read the articles from. But to test the code, I'm looking for an embedded Java NNTP server, so I don't have to mock every server call. Are there any good ones I can use? Google seems to have failed me.
My requirements are as follows:

*

*A server I can start from within the code.

*Tests can be run out-of-the-box on different machines without additional setup. (Once I commit the code, a remote build machine needs to be able to run the test cases).

Any other inspired suggestions are also welcome.

A: There is sonews, which seems to be active and supports a suprising lot of database backends. I didn't look at it further, so I can't tell if you can embed it.


text:
Q: Tableau server tried to activate but said command not found Hello everyone i tried to activate tableau server but it said
tsm command not found

i tried to activate it with using command
tsm licenses activate -k myproductkey

Before i tried to run this command
sudo ./initialize-tsm --accepteula

and got this 'warning', i do't really get the 'warning' meaning of it maybe because my lack of english(?)
User 'root' has been selected as the user to add to the TSM authorized group, but
TSM does not allow root as a TSM-authorized user. You must either re-run this
script using 'sudo' while logged in as a normal user instead of root (most common
case), rerun this script with the '-a username' option to select a user other than
root to add to the group, or the '-g' flag to disable group addition completely
and add appropriate users to the group yourself. Canceling.

Why do i get this error and how to resolve it?

A: Use the -a flag to specify a user to be added to the tsmadmin and tableau groups instead of the user running this script. If you are installing with the root account, the you must specify the -a flag


text:
Q: What is an appropriate mathematical term for this combinatorics algorithm? TL;DR: I am wondering if there is a proper mathematical nomenclature for the instances generated by this algorithm (given that there are unique and specific definitions for the words "permutation" and "combination"):
"You are given a sequence of n sets of independently variable size. To generate an "instance," you must select exactly 1 element from each set. Generate all possible instances."
Example given:
( Set A: { 1, 2, 3 },
Set B: { 1, 2 } )
This would produce: (1,1),(2,1),(3,1),(1,2),(2,2),(3,2)
What would these instances be called?

Details:
To make that a bit more concrete, the real-world example that led me to write this algorithm is this: my company is selling 2 flavors of health-conscious ice cream, and on the website's order form for this ice cream, we wanted to provide customers with the option of variable quantities up to a maximum of 6 for each.
So, imagine 2 quantity selectors (1 for vanilla, 1 for chocolate), options ranging 0-6. (In this example, the flavors/selectors are the sets, and the quantities are the objects.)
A customer could choose (0 vanilla x 1 chocolate), (1 vanilla x 1 chocolate), (2 vanilla x 1 chocolate), etc... these would be the "instances" I am trying to name.
We don't care about the number of sets or the cardinality/size of each set (i.e. it doesn't matter how many flavors we have, nor what the maximum quantity for each would be.)
If anyone is curious, here is the program, written in Javascript: https://jsfiddle.net/ybj90vdn/

A: Cartesian product, ordered pair, tuple, and product type are all words that you might find relevant. Since I don't know what you want to say, I'm not sure which is best for your use cases.

A: I've always used the term "List" for an ordered multi-set. I've heard $n$-tuple also used.
A permutation is generally a 'function' object - it rearranges a list based on indexes, which doesn't seem to be implied by instances. A combination is a subset of some larger set, and hence not ordered like your objects ($(1,2)$ is a different instance than $(2,1)$).


text:
Q: Is there still integrated login on the iPhone for Google, Facebook, and Twitter? It seems that since iOS 11, integrated login for Facebook and Twitter was removed (which was introduced in iOS 6).
What about for Google?

A: Yes, Apple has removed the Facebook and Twitter integration starting with iOS 11.
Google integration has never been available in iOS in the manner similar to how Facebook and Twitter was. However, it has been always possible to add a Google account on your iPhone to access Mail, Contacts and Notes within the 1st party apps. The option can be found Passwords & Accounts section of iOS Settings app.

A: Was Google ever officially integrated for login?
App Extensions
Apple now recommend third parties implement app extensions to share and integrate into iOS.


text:
Q: Why do I get the same result, without matter if I change the file? Hello I am trying to use the following sdk:
https://github.com/watson-developer-cloud/python-sdk/blob/master/examples/speech_to_text_v1.py
In order to get the text transcription of a wav file as follows:
import json
from os.path import join, dirname
from watson_developer_cloud import SpeechToTextV1

speech_to_text = SpeechToTextV1(
    username='XXXXXXXXX',
    password='XXXXXXXXX',
    x_watson_learning_opt_out=False
)
print(json.dumps(speech_to_text.models(), indent=2))
print('I am using the spanish model for this test')
print(json.dumps(speech_to_text.get_model('es-ES_NarrowbandModel'), indent=2))

with open(join(dirname(__file__), '/Users/Downloads/python-sdk-master/examples/test.wav'),
          'rb') as audio_file:
    print(json.dumps(speech_to_text.recognize(
        audio_file, content_type='audio/wav', timestamps=True,
        word_confidence=True),
        indent=2))

The problem is that every time that I run the request as follows:
python speech.py

I am getting the same result and it does not matter if I change the name of the file in the parameters I always get:
I am using the spanish model for this test
{
  "name": "es-ES_NarrowbandModel",
  "language": "es-ES",
  "sessions": "https://stream.watsonplatform.net/speech-to-text/api/v1/sessions?model=es-ES_NarrowbandModel",
  "url": "https://stream.watsonplatform.net/speech-to-text/api/v1/models/es-ES_NarrowbandModel",
  "rate": 8000,
  "supported_features": {
    "custom_language_model": false,
    "speaker_labels": true
  },
  "description": "Spanish narrowband model."
}
{
  "results": [
    {
      "alternatives": [
        {
          "word_confidence": [
            [
              "yeah",
              0.361
            ],
            [
              "and",
              0.867
            ],
            [
              "on",
              0.448
            ],
            [
              "the",
              0.243
            ],
            [
              "loss",
              0.172
            ],
            [
              "of",
              0.68
            ],
            [
              "my",
              0.953
            ],
            [
              "honor",
              0.131
            ],
            [
              "and",
              0.12
            ],
            [
              "sometimes",
              0.23
            ],
            [
              "platter",
              0.659
            ],
            [
              "and",
              0.339
            ],
            [
              "also",
              0.337
            ],
            [
              "got",
              0.227
            ],
            [
              "asking",
              0.383
            ],
            [
              "about",
              0.1
            ],
            [
              "someone",
              0.571
            ],
            [
              "economies",
              0.144
            ],
            [
              "on",
              0.146
            ],
            [
              "both",
              0.093
            ]
          ],
          "confidence": 0.368,
          "transcript": "yeah and on the loss of my honor and sometimes platter and also got asking about someone economies on both ",
          "timestamps": [
            [
              "yeah",
              0.18,
              0.47
            ],
            [
              "and",
              0.72,
              1.28
            ],
            [
              "on",
              1.28,
              1.41
            ],
            [
              "the",
              1.41,
              1.48
            ],
            [
              "loss",
              1.48,
              1.78
            ],
            [
              "of",
              1.78,
              1.89
            ],
            [
              "my",
              1.89,
              2.04
            ],
            [
              "honor",
              2.04,
              2.37
            ],
            [
              "and",
              2.37,
              2.53
            ],
            [
              "sometimes",
              2.56,
              3.17
            ],
            [
              "platter",
              3.17,
              3.53
            ],
            [
              "and",
              4.04,
              4.17
            ],
            [
              "also",
              4.17,
              4.45
            ],
            [
              "got",
              4.45,
              4.63
            ],
            [
              "asking",
              4.63,
              4.97
            ],
            [
              "about",
              4.97,
              5.18
            ],
            [
              "someone",
              5.18,
              5.45
            ],
            [
              "economies",
              5.45,
              5.97
            ],
            [
              "on",
              5.97,
              6.12
            ],
            [
              "both",
              6.12,
              6.34
            ]
          ]
        }
      ],
      "final": true
    },
    {
      "alternatives": [
        {
          "word_confidence": [
            [
              "even",
              0.547
            ],
            [
              "in",
              0.586
            ],
            [
              "the",
              0.766
            ],
            [
              "planet",
              0.276
            ],
            [
              "of",
              0.131
            ],
            [
              "my",
              0.188
            ],
            [

So I would like to appreciate support to overcome this task,

A: You shouldn't need the join(dirname(__file__), if you're specifying a fully qualified file path. If the path of your desired audio file isn't in a relative path, I'd try removing the join, although if that's the problem I'd expect a file not found error.


text:
Q: How to create cluster values? I'm trying to draw graphs with nested clusters using the GraphViz package, but I'm having trouble understanding how to use the constructors of the NodeCluster type:
N a
C c (NodeCluster c a)

The picture I have in mind is that the clusters are arranged in a tree (representing the nesting) and labelled by labels cl, but I don't see how it translates to the above.
Specifically, I'm writing the following function. The two comments describe what I'm trying to do.
makeClusterParams :: (Show el) => (Node -> nl -> String) -> (Node -> nl -> (cl,Maybe cl)) -> Gr nl el -> GraphvizParams Node nl el cl nl
makeClusterParams f g graph = nonClusteredParams {
  clusterBy = cb,
  fmtNode = fn,
  fmtEdge = fe
  }
  where
    cb (xn,xl) =
      case g xn xl of
        (thisCluster, Just parentCluster) -> --put this node inside of thisCluster, and put thisCluster inside of parentCluster
        (thisCluster, Nothing) -> --put this node in the top-level cluster.
    fn (xn,xl) = [(Label . StrLabel. pack) (f xn xl)]
    fe (xm,xn,l) = [(Label . StrLabel. pack) (show l)]

A: This type doesn't represent a tree. Instead, it seems to represent a path, from the root to the specific node.
It seems that your approach is fundamentally wrong. What if g xn1 xl1 returns (thisCluster, Just parentCluster1), and g xn2 xl2 returns (thisCluster, Just parentCluster2)? Do you expect thisCluster to be put into two different parents?


text:
Q: Test Drag and drop with jest (dnd-kit) I'm trying to test drag and drop with dnd-kit (testing-library / jest) and I can't,
I tested to trigger the listeners events of the useDraggable hook,
it.only("should pass the pack in the activatedPack zone by drag and drop", async () => {
            const ui = (
                <AppWrapper
                    routeParams={{
                        id: "602fdec72b21c534fc8ca136",
                    }}
                    useQueryResponses={{
                        "user|602fdec72b21c534fc8ca136|availablePacks": {
                            data: mockDataAvailable,
                            isSuccess: true,
                        },
                    }}
                >
                    <Packs />
                </AppWrapper>
            );

            const { queryByTestId } = render(ui);

            const draggableItem = queryByTestId(
                "draggableItem_6137129fb0337106e08680fd"
            );

            const dropZone = queryByTestId("activatedPacks");

            fireEvent.dragStart(draggableItem);
            fireEvent.drop(dropZone);
        });

Thank you for your support ;)


text:
Q: Not able to use images if I call gb4e.sty My tags are follows:
\documentclass{book}

\usepackage{gb4e,qtree,skull}
\usepackage{graphicx}

\begin{document}

\begin{figure}
\includegraphics[width=\textwidth]{../74934_Art/Hackl.jpg}
\caption{Results of Hackl et~al. (2012)}
\end{figure}

\end{document}

If I comment the package "gb4e.sty" then its works fine. If I call that package then the below error occurs:
! TeX capacity exceeded, sorry [parameter stack size=10000].
^#1->
     \gb@ifnextchar _{\automath@two ^{#1}}{\ensuremath {\sp {#1}}}
l.28  \catcode`\noexpand\^^A
                            \the\catcode`\^^A\relax
!  ==> Fatal error occurred, no output PDF file produced!
Transcript written on test.log.

But based on my requirement, I need to use both packages, Please suggest...

A: The gb4e package makes the underscore and the caret "active" characters so that they can be used outside of math mode. This is useful in many situations, but can interfere with other things quite easily if you're not aware of it.
The simplest solution is to turn the feature of immediately after loading the package:
\usepackage{gb4e}
\noautomath

If you find the feature useful, then it's helpful to load the package late in the loading order, or turn it on selectively.  If you activate it, you things like underscores in filenames will cause problems, as in your example.
\documentclass{book}

\usepackage{gb4e}
\noautomath
\usepackage{qtree,skull}
\usepackage{graphicx}

\begin{document}

\begin{figure}
\includegraphics[width=\textwidth]{../74934_Art/Hackl.jpg}
\caption{Results of Hackl et~al. (2012)}
\end{figure}

\end{document}

A: It is one of the cases where you need to change the order of package loading.
Update: As Alan Munn noted, gb4e makes the underscore active and paths with underscores (which I did not use in my test) break this setup. So this will only avoid the load-time error (which may be enough if you do not intend to use underscores in paths), but his answer also solves the OP's issue.
\documentclass{book}

\usepackage{graphicx}
\usepackage{gb4e,qtree,skull}

\begin{document}

\begin{figure}
\includegraphics[width=\textwidth]{example-image}
\caption{Results of Hackl et~al. (2012)}
\end{figure}

\end{document}


text:
Q: How to cancel the inheritance of the "li:before {content: 'text'}" without reassigning it for each
* element? everyone!
The general goal is that all li elements for which a property is not explicitly declared use the standard value.
I don't understand why the content property can't be reset:

ul {
 position: relative;
 list-style: none;
 margin-left: 0;
 padding-left: 1.2em;
}

li:before {
 content: unset;
}

ul > li:before {
 content: "A";
 position: absolute;
 left: 0;
}

ul > ul > li:before {
 content: "B";
 position: absolute;
 left: 0;
}

Level 1 Item 1

Level 2 Item 1

Level 3 Item 1

Level 3 Item 2

Level 3 Item 3

Result:

But shouldn't the result be like this:

How can I fix this so that the result is the same as in the last picture?

A: Try adding a class to your ul tags. I made a slight change in your second li selector by removing ul > li > li:before to ul.myClass > li:before. Run the code snippet and you will see your desired output

ul {
 position: relative;
 list-style: none;
 margin-left: 0;
 padding-left: 1.2em;
}

li:before {
 content: unset;
}

ul.myParentClass > li:before {
 content: "A";
 position: absolute;
 left: 0;
}

ul.myClass > li:before {
 content: "B";
 position: absolute;
 left: 0;
}

Level 1 Item 1

Level 2 Item 1

Level 3 Item 1

Level 3 Item 2

Level 3 Item 3

A: You're unsetting it with a simple li:before selector. That's going to be overridden by your other rules with ul >s, in particular the most specific ul > ul > li:before because it includes your level 3 items (children of the level 2 and level 1 ul elements). You'll need another one of these selectors, nested 3 levels, to unset it for those particular items:

ul {
 position: relative;
 list-style: none;
 margin-left: 0;
 padding-left: 1.2em;
}

ul > li:before {
 content: "A";
 position: absolute;
 left: 0;
}

ul > ul > li:before {
 content: "B";
 position: absolute;
 left: 0;
}

ul > ul > ul > li:before {
 content: unset;
}

Level 1 Item 1

Level 2 Item 1

Level 3 Item 1

Level 3 Item 2

Level 3 Item 3

On a side note, I'd recommend either

*

*(recommended) changing :before to ::before since you're writing CSS3 that's not going to work in CSS2-only browsers anyway, or

*using content: none instead of content: unset, which will allow your code to be supported in CSS2-only browsers, if you care about that

A: This question is generated by my inheritance error. I shouldn't have blamed CSS for my problem. CSS did everything right...
Solution (use the check for the absence of the previous level — :not(ul)):
*:not(ul) > ul > ul > li::before {
 content: "B";
 position: absolute;
 left: 0;
}


text:
Q: Firebase how to write security rule for a child that is 2 level random id deep in the tree I have a database node called (people) that looks like this:
    people
    |
    |
    -------UserID1 //which is a random id
    |       |
    |       |
    |        ----UserId2 //which is a random id
    |            |
    |            |
    |            name:"some_name"
    |            id:"UserId2"
    |            image:"image_url"
    |
    |
    |
    -------UserId2
            |
            |
             ----UserId3
                 |
                 |
                 name:"some_name"
                 id:"UserId3"
                 image:"image_url"

If we look at the (people / UserID1 / UserId2) node :
Since UserId1 and UserId2 are 2 random ids, then if we want to write a rule to UserId2 we will notice that it is 2 random id level deep.
What I want is to write a rule at this specified path that says these:
1) people / UserId1 : can be written by (UserID1) and (UserId2).
2) people / UserId1 : can be read by (UserID1) and (UserId2).
3) people / UserId1 / UserId2 : must end up with a newData that has (name, id, image).
How do I do this?
Thanks.

A: Due to the way Firebase Realtime Database rules cascade into deeper keys, allowing people/UserId1 to be writable by UserId2 is not advised, as this would allow UserId2 write access to the data of other users stored under people/UserId1 like people/UserId1/UserId3.
But using this trait, we can "add" users that are allowed read & write permissions as we go deeper into the data structure.
So the new conditions are:

*

*people/UserId1 - UserId1 has read & write access

*people/UserId1/UserId2 - UserId2 has read & write access

*people/UserId1/UserId2 - must always contain 'name', 'id' and 'image' keys

*people/UserId1/UserId3 - cannot be read/written by UserId2

{
"rules": {
  "people": {
    "$userId1": {
      "$userId2": {
        ".read": "auth.uid == $userId2", // add $userId2 to those granted read permission, cascades into deeper keys
        ".write": "auth.uid == $userId2", // add $userId2 to those granted write permission, cascades into deeper keys
        ".validate": "newData.hasChildren(['name', 'id', 'image'])" // any new data must have 'name', 'id' and 'image' fields.
      },
      ".read": "auth.uid == $userId1", // add $userId1 to those granted read permission, cascades into deeper keys
      ".write": "auth.uid == $userId1" // add $userId1 to those granted write permission, cascades into deeper keys
    }
  }
}

Lastly, if it is also required that people/UserId1/UserId2/id is equal to UserId2, you can change the ".validate" rule to enforce this:
".validate": "newData.hasChildren(['name', 'id', 'image']) && newData.child('id').val() == $userId2" // any new data must have 'name', 'id' and 'image' fields and 'id' must have a value of $userId2


text:
Q: Script language native extensions - avoiding name collisions and cluttering others' namespace I have developed a small scripting language and I've just started writing the very first native library bindings. This is practically the first time I'm writing a native extension to a script language, so I've run into a conceptual issue.
I'd like to write glue code for popular libraries so that they can be used from this language, and because of the design of the engine I've written, this is achieved using an array of C structs describing the function name visible by the virtual machine, along with a function pointer.
Thus, a native binding is really just a global array variable, and now I must obviously give it a (preferably good) name. In C, it's idiomatic to put one's own functions in a "namespace" by prepending a custom prefix to function names, as in myscript_parse_source() or myscript_run_bytecode(). The custom name shall ideally describe the name of the library which it is part of. Here arises the confusion.
Let's say I'm writing a binding for libcURL. In this case, it seems reasonable to call my extension library curl_myscript_binding, like this:
MYSCRIPT_API const MyScriptExtFunc curl_myscript_lib[10];

But now this collides with the curl namespace. (I have even thought about calling it curlmyscript_lib but unfortunately, libcURL does not exclusively use the curl_ prefix -- the public APIs contain macros like CURLCODE_* and CURLOPT_*, so I assume this would clutter the namespace as well.)
Another option would be to declare it as myscript_curl_lib, but that's good only as long as I'm the only one who writes bindings (since I know what I am doing with my namespace). As soon as other contributors start to add their own native bindings, they now clutter the myscript namespace. (I've done some research, and it seems that for example the Perl cURL binding follows this pattern. Not sure what I should think about that...)
So how do you suggest I name my variables? Are there any general guidelines that should be followed?

A: Well realistically, it's not necessary to contain a global array of exported functions just to make them visible to your runtime environment.
A good question to ask is whether your runtime environment saves the function pointer and the name associated to it?
Your notion of using a global array to export functions only makes sense if your runtime environment does not save that information but I assume you must save it for the VM's execution environment to properly execute.
A common feature that's added to scripting language like yours is the idea of registering your functions.
Essentially, you need a medium to store the exported function ptr and the exported function pointer's name that will be used in the script code.
I know of two options you could implement for this:

*

*A hashmap that will use the script-side function name as the string key and the function ptr as the value associated to that key.
exported_funcs["do_thing"] = &native_do_thing;

*Commonly used in embedded systems scripting languages such as Pawn, you could use the script data itself to store the function pointer. When you "register" the function, you iterate the script's exported functions table and search for the name that the exported function will register as; once you found that name, overrwrite that script data (not the script file itself but the loaded script memory data) and you've essentially stored the native function pointer.
FuncPtrType **table_entry = get_script_entry_ptr(func_name);
*table_entry = func_ptr;
I highly advise that, for the 2nd option, you give the table entry enough size to accommodate pointers sizes of all architectures, notably the entry should be 8 bytes.


text:
Q: None of the following functions can be called with the arguments supplied? viewHolder.itemView.task_contrtaintLayout_task.setOnClickListener {
                Log.d(TAG,"Clicked $taskId Body")
                val intent = Intent(this, EditTaskActivity::class.java)
                startActivity(intent)
            }

I'm trying to create an intent inside the ViewHolder, why does this bug come out? The same thing happens when I try to make a toast, how do I define the context in this case?
None of the following functions can be called with the arguments supplied:  public constructor Intent(p0: Context!, p1: Class<*>!) defined in android.content.Intent public constructor Intent(p0: String!, p1: Uri!) defined in android.content.Intent

A: It looks like you are trying to start a new activity from RecyclerView adapter from item holder. For normal intent working you have two ways:

*

*Pass context to the adapter's constructor and use it in intent:
val intent = Intent(context, SomeActivity::class.java)
context.startActivity(intent)

*Use interface class which will call fragment/activity method from the adapter click listener.
For more info about intents you can read documentation

A: Have context as a parameter to the Adapter class. Then access the context inside your ViewHolder Class.
class CartImagesAdapter(val items : List<String>, val context: Context) :
RecyclerView.Adapter<ViewHolder>() {

 // Gets the number of animals in the list
   override fun getItemCount(): Int {
  return items.size
 }
 // Inflates the item views
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder
{
  return
 ViewHolder(LayoutInflater.from(context).inflate(R.layout.item_payment_method,
  parent, false))
   }

// Binds each animal in the ArrayList to a view
override fun onBindViewHolder(holder: ViewHolder, position: Int) {

 }}
 class ViewHolder (view: View) : RecyclerView.ViewHolder(view) {
 // Holds the TextView that will add each animal to
  view.itemView.task_contrtaintLayout_task.setOnClickListener {
            Log.d(TAG,"Clicked $taskId Body")
            val intent = Intent(context, EditTaskActivity::class.java)
            startActivity(intent)
        }   }


text:
Q: Having trouble when counting prime numbers between two integers I'm having issues getting all prime numbers between a given integer A and integer B.
The issue is that the output goes well beyond whatever I defined for B. I thought that the
if (isPrime){
    count++;

would fix this but the output still goes well beyond the intended number of integer B.
For example if int valueA = 1 and int valueB = 100, it'll get prime numbers from around 1 to 500 before stopping, instead of just ending the check at 100.
Thank you for any assistance.
import java.util.*;

public class PrimeNumbersTest {

    public static void main(String[] args) {
        // TODO Auto-generated method stub
        Scanner input = new Scanner(System.in);

        // Ask user to input an integer value for A and B
        System.out.print("Enter the value of A (must be an integer): ");
        int valueA = input.nextInt();

        System.out.print("Enter the value of B (must be an integer): ");
        int valueB = input.nextInt();

        System.out.println("The prime numbers between " + valueA + " and " + valueB + " are:");

        final int LINE = 10;
        int count = valueA;
        int number = 2;

        while (count < valueB) {
        // Assume the number is prime
        boolean isPrime = true;
        // Test if number is prime
        for (int divisor = 2; divisor <= number / 2; divisor++) {
            if (number % divisor == 0) { // If true number is not prime
                isPrime = false; // Set isPrime to false
                break; // Exit the for loop
            }
        }
         if (isPrime) {
             count++;

            if (count % LINE == 0) {
                System.out.println(number);
            }
            else
                System.out.print(number + " ");

         }
         number++;
    }
  }
}

A: When you want to work on a range of number, use a for loop instead of while loop to reduce confusion. You obviously want
for(int number = valueA; number <= valueB; number++){/*check if number is prime*/}

Example:
public static void main(String []args){
    int valueA = 1;
    int valueB = 100;
    int count = 0;
    for(int number = valueA; number <= valueB; number++)
    {
        if(isPrime(number))
        {
            count++;
            System.out.println(number);
        }
    }
    System.out.println("count = " + count);
}

public static boolean isPrime(int n)
{
    for(int i = 2; i*i <= n; i++)
    {
        if(n % i == 0)
        {
            return false;
        }
    }
    return n > 1;
}

For your requirement of checking isPrime inline:
public static void main(String []args){
    int valueA = 1;
    int valueB = 100;
    int count = 0;
    for(int number = valueA; number <= valueB; number++)
    {
        boolean isPrime = number > 1;
        for(int i = 2; i*i <= number; i++)
        {
            if(number % i == 0)
            {
                isPrime = false;
                break;
            }
        }
        if(isPrime)
        {
            count++;
            System.out.println(number);
        }
    }
    System.out.println("count = " + count);
}


text:
Q: Nutch- how to delete old segments? In nutch, when I crawl and then re-crawl, duplicated segments are created.
how can I delete the old ones?
I can't know for sure that only the segments that were created in the latest crawl are used and all the others can be deleted, can I?

A: I can't know for sure that only the segments that were created in the latest crawl are used and all the others can be deleted, can I?

The segments created in the last crawl are useful and others can be deleted.


text:
Q: Webdriver Actionchains - click on the next page doesn't work I am new here and I tried to write a code that should go through all of die 3090 pages and extract the information given in the table (box-b).
But it doesn't work. It seems to stay on the first page and it extracts those informations over and over.
If any of you has an idea how I can fix it please help me :)
Lara
import requests
from bs4 import BeautifulSoup
from selenium import webdriver
from selenium.webdriver import ActionChains
from selenium.webdriver.common.keys import Keys
import time

url = "https://www.dieversicherer.de/versicherer/auto---reise/typklassenabfrage#orderBy=kh&orderDirection=ASC"

driver = webdriver.Chrome('/Users/laraschneider/Downloads/chromedriver')
driver.get(url)

time.sleep(5)

html = driver.page_source
soup = BeautifulSoup(html, "html.parser")
number = 0
while number < 3090:
    results_html = soup.find_all('div', "ttw-entry__box-b")

    results = list()

    for result in results_html:
        results.append(result.text)

    for t in results:
        print(t)

    time.sleep(5)

    element = driver.find_element_by_xpath("/html/body/main/div/div[5]/div/div/div/div[2]/div[2]/div[2]/div[2]/button[2]/div")
    action = ActionChains(driver)
    action.move_to_element(element)
    action.click(element).perform()

    number = number+1

A: Use driver.execute_script("arguments[0].click();", element) instead of ActionChains. Here is the full code:
import requests
from bs4 import BeautifulSoup
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
import time

url = "https://www.dieversicherer.de/versicherer/auto---reise/typklassenabfrage#orderBy=kh&orderDirection=ASC"

driver = webdriver.Chrome('/Users/laraschneider/Downloads/chromedriver')
driver.get(url)

time.sleep(5)

html = driver.page_source
soup = BeautifulSoup(html, "html.parser")
number = 0
while number < 3090:
    results_html = soup.find_all('div', "ttw-entry__box-b")

    results = list()

    for result in results_html:
        results.append(result.text)

    for t in results:
        print(t)

    time.sleep(5)

    element = driver.find_element_by_xpath('/html/body/main/div/div[5]/div/div/div/div[2]/div[2]/div[2]/div[2]/button[2]/div')
    driver.execute_script("arguments[0].click();", element)
    number = number+1


text:
Q: react-native-document-picker not listing some files I'm giving a try to react-native-document-picker. In my use case, what I want is listing some .db files so that the user is able to select one of them to import to my app. Turns out that, while using react-native-document-picker, when I navigate to the folder where the db file is, neither the .db file is shown nor the other files are.
As it's possible to see bellow, while I'm accessing the folder using Google Files, I can see the files, but I can't when I'm using react-native-document-picker:
Google files result (files being listed)

React-native-document-picker result (no files being listed)

My code is very very simple and the version I'm using is react-native-document-picker:4.0.6:

import DocumentPicker, {
    DirectoryPickerResponse,
    DocumentPickerResponse,
    isInProgress,
    types,
  } from 'react-native-document-picker';

const getImportFile = async (translate) => {
    try {
        const file = await DocumentPicker.pick();
        console.log(file);
        return { success: true, error: null, payload: file };
    } catch (ex) {
        return { success: false, error: ex }
    }
}

I'd appreciate if someone could help me with it.


text: Q: Separating GLUT animation from variable processing My question is a very simple one: say I want to run a for loop, and for each sequence of the loop I want the GLUT window to redisplay. However, I want the for loop to be separate from any GLUT method. I don't want the processing of variables which the for loop does to intersect or to be subordinated to the graphical processing functions.


text:
Q: Which Perl bindings for selenium webdriver? I am new to selenium 2.0 and working on automation through perl and java(maven-eclipse). I want to know the perl bindings for Se differ.
Selenium website shows https://metacpan.org/module/Selenium::Remote::Driver
While CPAN also has WWW:Selenium bundle....
Which to use to perl automation in this context?

A: Selenium::Remote::Driver is the one you want. WWW:Selenium is old.

A: You can visit the following URL:
http://repo1.maven.org/maven2/org/seleniumhq/selenium/client-drivers/selenium-perl-client-driver/


text:
Q: MVC4 Bundles returns 404 I have a project that works with bundling when you run it from within visual studio. However, after you do a deployment, the bundling handler never seems to pick up the route. It ends up going to the static file handler instead, which returns a 404 response.
Any ideas? I see the optimization assembly in the bin of the website under IIS.
It's using the 4.0 app pool and integrated mode.
I'm wondering if anyone has any ideas or suggestions?
Thanks
----- update based on questions -----
VS2012
targetFramework="4.5"
I also added some code into the view to show which modules were loaded and I can see the bundle module listed there.
BundleConfig is the default provided when using the Internet Application MVC4 project template.
The site is being deployed into the root. It's odd as when I set EnableOptimizations = true (due to running in debug mode via visual studio F5), it works perfect! I can navigate to content/css and it spits out the combined css.
I deploy it over and everything else works, but bundling!

A: Even I got the same error.
Adding <modules runAllManagedModulesForAllRequests="true" /> under <system.webServer> in web.config file solved the problem.

A: I've just hit (and solved) this problem.
Make sure your bundle's virtual path can't be confused for an existing directory or actual file name.  In my case, I'd coded it as:
bundles.Add(new ScriptBundle("~/bundles/main.js").Include( ...

But when I changed it to
bundles.Add(new ScriptBundle("~/bundles/main").Include( ...

it all started working.

A: Updated Answer on 11/17/2013
This is caused by the fact that the default MVC routing only handles * instead of * . *, i.e. IIS or IIS Express's applicationhost.config has the following:
            <add name="ExtensionlessUrl-Integrated-4.0" path="*." verb="GET,HEAD,POST,DEBUG" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" responseBufferLimit="0" />

So to workaround it, we can add the following to the web.config:
      <system.webServer>
        <handlers>
          <add name="UrlRoutingHandler"
               type="System.Web.Routing.UrlRoutingHandler,
                     System.Web, Version=4.0.0.0,
                     Culture=neutral,
                     PublicKeyToken=b03f5f7f11d50a3a"
               path="/bundles/*"
               verb="GET"/>
        </handlers>
      </system.webServer>

For more information, you can reference the following:
http://weblogs.asp.net/owscott/archive/2013/01/16/handing-mvc-paths-with-dots-in-the-path.aspx
ASP.NET MVC Url Route supporting (dot)
Old wrong answer:
Basically, DOT is generally not allowed in virtual path when IIS parse URLs.
This a Link mentioned the following URLScan AllowDotInPath parameter:
By default, this option is set to 0. If this option is set to 0, URLScan rejects any request that contains multiple periods (.). This prevents attempts to disguise requests for dangerous file name extensions by putting a safe file name extension in the path information or query string portion of the URL. For example, if this option is set to 1, URLScan might permit a request for http://  servername/BadFile.exe/SafeFile.htm because it interprets it as a request for an HTML page, when it is actually a request for an executable (.exe) file with the name of an HTML page in the PATH_INFO area. When this option is set to 0, URLScan may also deny requests for directories that contain periods.

A: I had the same problem even with sample MVC application. I saw the default template bundles the style-sheet with css name which i guess IIS does not likes resulting in 404 error.
Changing  the bundle name from css to APPCSS will resolve the issue for me.


text:
Q: Animation won't start if state changed (short snack for demonstration) Snack is here
Hello, I'm hard stuck on a silly problem and I'm becoming nut.
I just wanted to make a simple and elegant animation when a screen is focused (in a tab bar navigation). My snack works perfectly until I perform a state change in my screen. Then the animation just won't start, even though the callback from focus listener is called and executed (check logs)... WHY?
I made a button to trigger manually the animation... and it works!????
I think I made the snack clear, but if you need more information, please ask me. I beg you, please help a brother in despair.
Snack is here
If you're lazy to click the Snack:
import React, { useState, useEffect } from "react";
import { Text, View, Animated, Dimensions, StyleSheet, SafeAreaView, Button } from 'react-native';
import { NavigationContainer } from '@react-navigation/native';
import { createBottomTabNavigator } from '@react-navigation/bottom-tabs';

function HomeScreen({navigation}) {
  const initialXPos = Dimensions.get("window").height * 0.5 ;
  const xPos = new Animated.Value(initialXPos);
  const opacity = new Animated.Value(0);
  const [change, setChange] = useState(true)

   useEffect(() => {
    const unsubscribe = navigation.addListener("focus", comingFromBot);
    return unsubscribe;
  }, []);

  const comingFromBot = () => {
    xPos.setValue(initialXPos);
    opacity.setValue(0);
    Animated.parallel([
      Animated.spring(xPos, {
        toValue: 100,
        tension:3,
        useNativeDriver: true,
      }),
      Animated.timing(opacity, {
        toValue: 1,
        duration: 1000,
        useNativeDriver: true,
      }),
    ]).start();
    console.log("Animation's Fired!");
  };

  return (
    <SafeAreaView style={{flex:1}}>
      <Animated.View style={[
            styles.container,
            { transform: [{ translateY: xPos }] },
            { opacity: opacity },
          ]}>
        <Text style={{fontSize:30}}>{change ? "Home!" : "TIMMY!"}</Text>
      </Animated.View>

      {/* debug */}
      <View style={styles.fire}>
        <Button title="fire" onPress={() => comingFromBot()}/>
      </View>

      <View style={styles.change}>
        <Button title="change" onPress={() => setChange(!change)}/>
      </View>
    </SafeAreaView>
  );
}
const styles = StyleSheet.create({
  container: { flex: 1, alignItems: 'center' },
  fire:{position:"absolute", width:"100%", bottom:0},
  change:{position:"absolute", width:"100%", bottom:48}
  });

function SettingsScreen() {
  return (
    <View style={{ flex: 1, justifyContent: 'center', alignItems: 'center', padding:8 }}>
      <Text>{"Go to Home tab again, and notice the animation.\n\nEXCEPT if we changed the text... WHY?\n\nBUT still works if we fire the animation with the button, but after still won't work on focus detection... HOW?\n\nWorks if you hot reload / hard reload the app... HELP?"}</Text>
    </View>
  );
}

const Tab = createBottomTabNavigator();

function MyTabs() {
  return (
    <Tab.Navigator>
      <Tab.Screen name="Home" component={HomeScreen} />
      <Tab.Screen name="Settings" component={SettingsScreen} />
    </Tab.Navigator>
  );
}

export default function App() {
  return (
    <NavigationContainer>
      <MyTabs />
    </NavigationContainer>
  );
}

A: It doesn't work because you're not following the rules of hooks. The following things are wrong in your code:

*

*You're using variables from outside in useEffect hook, but passing empty dependency array

*The animated values need to be in a useState or useRef hook so that they aren't recreated every render

Then the animation just won't start, even though the callback from focus listener is called and executed (check logs)... WHY?

The problem is that the callback is recreated after state update on re-render, so the callback passed to the focus listener isn't the same as what's in render anymore. And since you also don't have your animated values in state/ref, new animated values are also created while the old focus listener is referring to the old values. Basically the log you see is from an old listener and not the new one.
You should use the official eslint plugin and ensure that you fix all the warnings/errors from it so that such problems are avoided.
To fix your code, do the following changes:
const [xPos] = React.useState(() => new Animated.Value(initialXPos));
const [opacity] = React.useState(() => new Animated.Value(0));
const [change, setChange] = useState(true)

useEffect(() => {
  const unsubscribe = navigation.addListener("focus", comingFromBot);
  return unsubscribe;
}, [navigation, comingFromBot]);

const comingFromBot = useCallback(() => {
  xPos.setValue(initialXPos);
  opacity.setValue(0);
  Animated.parallel([
    Animated.spring(xPos, {
      toValue: 100,
      tension:3,
      useNativeDriver: true,
    }),
    Animated.timing(opacity, {
      toValue: 1,
      duration: 1000,
      useNativeDriver: true,
    }),
  ]).start();
  console.log("Animation's Fired!");
}, [xPos, opacity]);

I basically added useCallback, fix the dependency arrays, and moved the animated values to useState hook.

A: I finally ended with this, thanks to @satya164: Snack
I also wish I read this in documentation before.
HomeScreen's code:
// HomeScreen.js
function HomeScreen({navigation}) {
  const initialXPos = Dimensions.get("window").height * 0.5 ;
  const xPos = useRef(new Animated.Value(initialXPos)).current
  const opacity = useRef(new Animated.Value(0)).current
  const [change, setChange] = useState(true)

  useEffect(() => {
    const unsubscribe = navigation.addListener("focus", comingFromBot);
    return unsubscribe;
  }, [navigation, comingFromBot]);

  const comingFromBot = useCallback(() => {
    xPos.setValue(initialXPos);
    opacity.setValue(0);
    Animated.parallel([
      Animated.spring(xPos, {
        toValue: 100,
        tension:3,
        useNativeDriver: true,
      }),
      Animated.timing(opacity, {
        toValue: 1,
        duration: 1000,
        useNativeDriver: true,
      }),
    ]).start();
    console.log("Animation's Fired!");
  }, [xPos, opacity, initialXPos ]);

  return (
    <SafeAreaView style={{flex:1}}>
      <Animated.View style={[
            styles.container,
            { transform: [{ translateY: xPos }] },
            { opacity: opacity },
          ]}>
        <Text style={{fontSize:30}}>{change ? "Home!" : "TIMMY!"}</Text>
      </Animated.View>

      {/* debug */}
      <View style={styles.fire}>
        <Button title="fire" onPress={() => comingFromBot()}/>
      </View>

      <View style={styles.change}>
        <Button title="change" onPress={() => setChange(!change)}/>
      </View>
    </SafeAreaView>
  );
}


text:
Q: Compatibility issues when upgrading a C++ project from  VS 2005 to VS 2010 Express I was given some files that were built in Visual Studio 2005 version.
When I tried to convert the .sln file to use in VS 2010 Express C++, however, I run into problems.
The error gives out the path and says that the file was not found even though the file is there. I know there shouldn't be any compatibility issues between the two unless I am missing something. Has anyone run into this type of problems?
The exact error message is:

"Conversion Report - GeoM\GeoM.vcproj:  Converting project file
  'C:\Users...\GeoM\GeoM.vcproj'.  File 'C:\Users...\GeoM\GeoM.vcproj' was not found. \
  Project upgrade failed.

A: The most likely explanation is that your C++ project has been configured to support compilation for a platform other than x86 (such as x64 or IA-64).
This is explained on the Visual C++ blog, in the Visual Studio 2010 C++ Project Upgrade Guide:

Make sure you have the required platforms installed before doing upgrade
Converting a project on a machine without all the available platforms for the project will result in a conversion error. For example, if you try to convert a project with Itanium Platform on Visual Studio Professional SKU, which does not support the Itanium platform, you will see a conversion error like the following:
Failed to upgrade 'Debug|<Itanium>'. Please make sure you have the
corresponding platform installed under '%vctargetspath%\platforms\Itanium'.
Cannot load the project due to a corrupt project file. The following error
has occurred during XML parsing:

    File: D:\Sample\ConsoleApp\ConsoleApp.vcproj
    Line: 28
    Column: 5
    Error Message:
    System error: -2147154677.
    The file 'D:\Sample\ConsoleApp\ConsoleApp.vcproj' has failed to load.

This is by design as the conversion needs to evaluate the properties in the missing platforms to do a successful conversion. You can verify which platforms are installed on your machine by looking in the following directories:  %ProgramFiles%\MSBuild\Microsoft.cpp\V4.0\Platforms (or %ProgramFiles(x86)%\MSBuild\Microsoft.cpp\V4.0\Platforms on x64 machine) for the Platforms installed on the machine.

Since the Express version does not support compiling C++ applications for either of these platforms, the upgrade wizard is failing to convert your project and returning the described error message.
The only way this upgrade is going to succeed is if you use a full version of Visual Studio (with the appropriate platform compiler tools installed), or if you edit the solution/project files that you have to remove any mention of a non-x86 configuration. You should be able to do this with a simple text editor like Notepad, but as always, back up first in case you destroy something irreplaceable.


text:
Q: Difference between Groovy String variable replacement When looking at examples of variable substitution in GStrings, I have noticed two difference syntaxes.  This can be seen here: Groovy Templates
This has the example:
def text = 'Dear "$firstname $lastname",\nSo nice to meet you in <% print city %>.\nSee you in ${month},\n${signed}'

It looks like ${variable} is used more commonly when you have an expression, but $variable is used when you just have a single variable, but even here they mix it with $firstname and ${month}.  Is there a reason to do it one way or another when you have a single variable and not an expression, or does it not matter?

A: It doesn't matter...
As you say, if you have an expression like "${name.toUpperCase()}", "${number}th" or "${list[0]}", then it has to be inside braces, but both "${name}" and "$name" are the same.
Indeed, so long as it's simple property access you can omit the braces, ie: "Hello $person.username"
It could be said that adding the braces can make your string templates easier to read, but that's a personal preference thing.