text:
Q: SDK Version Issue on iOS testflight I'm trying to initiate the testflight for my iOS application, suddenly I'm started getting the below error
"SDK Version Issue. This app was built with the iOS 13.2 SDK. All iOS apps submitted to the App Store must be built with the iOS 14 SDK or later, included in Xcode 12 or later."
After googling a bit, I found that few people are facing the same and like other developers, I don't want to upgrade the xcode as many other applications are dependent on it and I am using xcode 11.0.1 and to upgrade the xcode to higher version, I need to upgrade my macOS as well, I am using mojave and I have to upgrade it to Bigsur.
As I'm a cross-platform developer, I have very little idea about these processes, so please help  with a proper solution

A: The upgrade is compulsary and I have to go with it


text:
Q: Name of some category with two objects Does the category that consists of two objects and exactly one non-identity morphism that connects both objects have a specific name?

A: The interval category. It is often denoted $\mathbf{I}$. Note that if $\mathbf{C}$ is category, then $\mathbf{C}^\mathbf{I}$ is the arrow category of $\mathbf{C}$.

A: As goblin suggests, "the interval category" is good, and it has the imprimatur of the nlab. I might also call it "the arrow category". If I say "the interval category", I somehow feel the need to clarify that I'm talking about the category with one nontrivial arrow, rather than one nontrivial isomorphism. I might also use the notation $\uparrow$, although this is hard to pronounce.
Another possibility is "the walking arrow" (as opposed to "the walking isomorphism"). In general, if you have a functor $F$ which is isomorphic to $\mathrm{Hom}(X,-)$, then you might call $X$ "the walking $F$" (in this case we have an isomorphism of 2-functors $\mathrm{Arr} \cong \mathrm{Hom}(\uparrow, - ): \mathsf{Cat} \to \mathsf{Cat}$ where $\mathrm{Arr}$ sends a category $C$ to its arrow category $\mathrm{Arr} C$). This terminology probably feels a little too informal in some contexts, although it's fairly precise.
I suppose you could also say "the universal arrow" (as opposed to "the universal isomorphism").

A: It might also be denoted $\mathbf 2$ as it is the category associated to the cardinal poset $\mathbf 2 = \{0<1\}$.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Service Design Pattern I'm working with services and I found out there are at least 3 ways to use them inside controllers...
Statically: Like helper, Text::uppercase('foo')
Instancing it: $text = new Text(); $text->uppercase('foo');
Injecting with reflection through parameters:
public function(Text $text) {
    $text->uppercase('foo');
}

Injecting with reflection, but on the constructor:
private $text;
__construct(Text $text){
    $this->text = $text;
}

public function anyMethod() {
    $this->text->uppercase('foo');
}

A friend of mine, who works for a lot of time with this, told me that is an error to use it in different ways, and that he always uses the constructor method, even if there is such a simple thing as a string helper.
I'm a bit confused about this. From the pure and strong theory, what is the best way to work on this pattern?
The reference I'm talking about:
https://blog.quickadminpanel.com/laravel-when-to-use-dependency-injection-services-and-static-methods/

A: Sorry for the C# syntax, I'm not a PHP dev. But the core of the answer is language-agnostic, and I hope the syntax is readable enough for you to understand the focus of the examples.

You've actually done a great job of listing ways to have one class use another, ordered ascendingly by looseness of the coupling.

*

*Hardcoding a reference (tightest coupling)

*Passing a method parameter with the object reference

*Passing a contructor parameter with the object reference (loosest coupling)

A friend of mine, who works for a lot of time with this, told me that is an error to use it in different ways, and that he always uses the constructor method, even if there is such a simple thing as a string helper.

Your friend is mostly, but not completely on the right track.
For good practice, you always want to promote loose coupling. Loose coupling means that it's easier to swap out individual components when you need to. You might need to do so because you're making a change to your codebase, and having things loosely coupled mean that you can more easily target a specific component and swap it out without affecting the other components.
Another great example of loose coupling is the ability to unit test your code. In this answer, I'm going to use unit testing as the main use case here to highlight how coupling affects the ease of development. Just remember that the benefits of loose coupling are much bigger than just testability.

Let's say we've developed the following class, and it currently hardcodes a dependency on EmailSender:
public class MyService
{
    public int Add(int a, int b)
    {
        var result = a + b;

        var emailSender = new EmailSender();
        emailSender.SendEmail(
            "boss@company.com",
           $"Hey boss, I just calculated {a}+{b}, did you know that that is equal to {result}?"
        );

        return result;
    }
}

It's a silly example, but it serves the purpose I need it to. We want to test this service. However, we don't want to bombard our actual boss with emails about all our test runs.
While this is not relevant yet, I want you to look back at the code and think about what the consumer of this service needs to know to work with this service. All it needs to know is which numbers it needs to add, i.e. a and b. The consumer doesn't know about the mailsender specifically or how to operate it.

By injecting the dependency, we make it possible to swap this mailsender out for a different one. When we run our test, we inject a fake mailsender which does not send an actual email, but does correctly confirm to us that someone tried to send an email.
Let's inject it as a method parameter, like you suggested.
public class MyService
{
    public int Add(int a, int b, IEmailSender emailSender)
    {
        var result = a + b;

        emailSender.SendEmail(
            "boss@company.com",
           $"Hey boss, I just calculated {a}+{b}, did you know that that is equal to {result}?"
        );

        return result;
    }
}

public interface IEmailSender
{
    void SendEmail(string to, string message);
}

You can imagine the existence of a EmailSender class which actually sends out real emails.
Let's look at what a fake mailsender would look like:
public class FakeMailSender : IEmailSender
{
    public void SendEmail(string to, string message)
    {
        // Snitch about what someone tried to do
        Console.WriteLine($"Someone just tried to send an email to {to}");

        // DON'T SEND AN ACTUAL EMAIL
    }
}

If I now want to test if MyService is working correctly, I can run a test where I inject a FakeMailSender instead of a real EmailSender. This doesn't affect the internal logic of MyService itself, which is what I'm testing. If MyService behaves correctly for a FakeMailSender, then I can rest assured that it will also behave correctly when I give it a real EmailSender (when deploying the code for real).

However... Remember when I pointed out that the consumer of MyService only needed to know the numbers they needed to add?
That is sadly no longer the case. Now, they need to have access to some IEmailSender object and pass that along before they can add two numbers together? That means putting more work into their hands. The consumer is not going to like that, and they might possibly not even be allowed to know that we are secretly sending emails.
This is why we inject dependencies via the constructor. The constructor is separate from the public methods, and therefore we are able to separate the construction of the object from actually using the constructed object, which is really useful when the construction requires specific information (e.g. what kind of mailsender to use) even though you want to keep the usage short and simple (e.g. only knowing which numbers you want to add up).
public class MyService
{
    private IEmailSender _emailSender;

    public MyService(IEmailSender emailSender)
    {
        _emailSender = emailSender;
    }

    public int Add(int a, int b)
    {
        var result = a + b;

        _emailSender.SendEmail(
            "boss@company.com",
           $"Hey boss, I just calculated {a}+{b}, did you know that that is equal to {result}?"
        );

        return result;
    }
}

Now, you might be thinking to yourself:

Wait a minute. Since the consumer would need to construct the MyService object anyway, it still needs to know what IEmailSender should be used, regardless of whether it passes it via the MyService constructor or the Add method itself.

Dependency injection is a recursive pattern. Just like how IEmailSender is injected into MyService instead of letting MyService create its own sender, your consumer will also get its MyService dependency injected, and it generally wouldn't be creating its own MyService instance.
Just as a quick example, you'd expect the same dependency injection pattern for your consumer:
public class MyConsumer
{
    private MyService _myService;

    public MyConsumer(MyService myService)
    {
        _myService = myService;
    }

    public int CountFingers()
    {
        var totalFingers = myService.Add(leftHand.Fingers, rightHand.Fingers);
    }

Notice how the CountFingers method cares about how to add two numbers, but it doesn't care one bit about IEmailSender objects. CountFingers is only interested in using a (created) service, it's not interested in creating one.
If we had required CountFingers to have to pass the mail sender object as well, that would've significantly increased the complexity of the code, and the mail-sender-creating part of that code would've been a complete distraction from the true purpose of the method, i.e. counting the consumer's fingers.

The reason I mentioned that your friend is mostly but not completely on track is that there are exceptions to this. His advice is generally correct but it's not universally true.
1
One example is pure functions. These are static functions who track no state, and have no side effect except the value they return.

even if there is such a simple thing as a string helper

Helper methods are often this exact kind of pure function. One C# example here is String.Join:
var numbers = new int[] { 1, 2, 3, 4, 5 };

var result = String.Join(", ", numbers);

Console.WriteLine(result); // "1, 2, 3, 4, 5"

Pure functions, by virtue of being pure, generally escape the requirement of being context-specific and therefore being considered as a dependency that must be injected.
Just to be clear, pure functions exist in a lot of code bases, but they are few and far between, usually nothing more than trivial helper methods that people tend to gloss over. The reason your friend's advice did not include this exception is possibly because the codebase he works in doesn't have pure functions
2
Another example of an exception to using constructor-based dependency injection is when you want the dependency to be passed as a method parameter, because the consumer very specifically cares about choosing this dependency.
For example, if you want to change the behavior of a method. Let's look at OrderBy, which sorts the elements of a collection based on a particular equality comparison.
var numbers = new int[] { 1, 4, 3, 2, 5 };

var orderedNumbers = numbers.OrderBy(x => x);

By default, it uses the default comparison logic, which in the case of integers is a simple a < b check. However, you are able to write your own comparer class, which uses a custom comparison logic. For example, you might want to sort numbers not by their size, but by how many factors you get when you factorize them.
var numbersOrderedByFactorization = numbers.OrderBy(x => x, new FactorizationComparer());

By injecting this comparer via the method, the consumer is able to very directly control how the method behaves.
While having to inject this dependency via method parameter was considered an unjustified burden when we were discussing the mailsender example, in this case the ability to choose the comparer is desirable and actually something the consumer is interested in.
This is therefore a very contextual consideration whether your consumer will be interested in deciding this dependency or not. There is no universal answer here.


text:
Q: mongoexport collection using node.js I am currently experiencing a major headache (for a middle-aged duffer, that is).
My current problem is this:
I have to use D3.js to visualise data stored in a local MongoDB database. I have the visualisation pretty much sorted, just one or two minors, but I think I can sort them.
My problem is actually getting the data out of the database. I can import and export to my heart's content using the shell, but I need to automate the process. The step I am having no progress with is this: Using Node.js, I can connect to my local MongoDB databse with the following script:
**

var MongoClient = require('mongodb').MongoClient, format = require('util').format;
MongoClient.connect('mongodb://127.0.0.1:27017' function(err,db){
    if(err){
        throw err;
    }else{
        console.log("Connected");
    }
    db.close();
});

**
Whilst I am connected, I need to export one of three collections (newYork, manchester or london) , as a .json array, from a database called monopoly.
I have to use javascript and I need to export an entire collection to a folder location that I can choose, which will allow me to direct my D3.js to it
I think mongoexport is the method I want as when I try this from the mongo shell, I get exactly what I want
Any enlightenment would be gratefully received
Thanks
S

A: This documentation might help.
https://docs.mongodb.com/manual/reference/program/mongoexport/
Try this
    app.get('/export', function(req, res)
    {
        var spawn = require('child_process').spawn,
        ls = spawn('mongoexport',['--db','monopoly','--collection','newYork']);
        res.sendfile('/home/database.csv')

    });


text:
Q: How to reduce copy-pasting? If I have a number of similar classes, say:
Integer i0;
Integer i1;
Integer i2;
Integer i3;
Integer i4;
Integer i5;
Integer i6;
Integer i7;
Integer i8;
Integer i9;

And wanted to avoid doing this:
i0 = 0;
i1 = 1;
i2 = 2;
i3 = 3;
i4 = 4;
i5 = 5;
i6 = 6;
i7 = 7;
i8 = 8;
i9 = 9;

I'm thinking of doing something similar to this to achieve the same result:
int cnt = 0;
for(classname : arrayOfClassNames {
    classname = cnt++;
}

How do I do that?
[clarification] I appears I was misunderstood. I was thinking more along the lines of having 10 separate classes still, not one array having 10 items.

A: Use an array or an ArrayList?
// using an array
Integer[] ints = new Integer[10];
for (int i = 0; i < 10; i++) {
    ints[i] = i;
}

// using an array list
ArrayList<Integer> ints = new ArrayList<Integer>();
for (int i = 0; i < 10; i++) {
    ints.add(i);
}

Following on from your update, what you are looking to do can be achieved using
Class.forName(classname).newInstance();

However, I would suggest that whatever you save in time to code it, you will lose in readability and ease of maintenance, so you may find this a false economy.

A: Store them in an array:
Integer[] array = new Integer[10];
for(int i = 0 ; i < 10 ; i++){
    array[i] = i ;
}

To get i9: array[9]

A: A number of similar classes sounds like you want an Array:
Integer[] manyI = new Integer[] {0, 1, 2, ....};

Or you fill the Array with a loop:
Integer[] manyI = new Integer[10];
for (int i = 0; i < manyI.length; i++) manyI[i] = i;

A: Use a java.util.Map<T, K>:
Map<String, Integer> map = new HashMap<String, Integer>();

for (int i = 0; i < 10; i++)
{
  map.put("i" + i, i);
}

System.out.println(map);
System.out.println("i8: " + map.get("i8"));


text:
Q: Unity 3D - Multiple Camera Switch Script by Keycode im doing a little scene in Unity 3D with multiple cameras
Im trying to make a script to change camera pressing Keys 1,2,3,4,5,6,7,8,9,0
Each number goes to specific camera.
Any help aprreciate.
Thanks.

A: Here is a complete version of a script you can use to switch between cameras
using System.Collections.Generic;
using UnityEngine;

public class CameraSwitch : MonoBehaviour
{
    public List<Camera> Cameras;

    private void Start()
    {
        EnableCamera(0);
    }

    private void Update()
    {
        if (Input.GetKeyDown(KeyCode.Alpha1))
        {
            EnableCamera(0);
        }
        else if (Input.GetKeyDown(KeyCode.Alpha2))
        {
            EnableCamera(1);
        }
        else if (Input.GetKeyDown(KeyCode.Alpha3))
        {
            EnableCamera(2);
        }

        /*
         * If you want to add more cameras, you need to add
         * some more 'else if' conditions just like above
         */
    }

    private void EnableCamera(int n)
    {
        Cameras.ForEach(cam => cam.enabled = false);
        Cameras[n].enabled = true;
    }
}

Name the script CameraSwitch (full name CameraSwitch.cs), create a new GameObject in your scene or use an existing one, add the script to the GameObject (either from the Add Component menu or just drag-n-drop the script to your GameObject's inspector), then you need to expand property Cameras by clicking on it in the inspector, set the number of Camera (Size) to 3, and link your cameras in the following fields. Put the main camera first and don't leave a field blank or the script will fail.
If you need to add a new camera to the list, just add an else if condition besides the existing ones and don't forget to change the size of your list and link the new cameras in the inspector.

A: You can use this simple code:
public Camera camera1;
public Camera camera2;
...

void Start()
{
    camera1.enabled = true;
    camera2.enabled = false;
    ...
}

void Update()
{
    if(Input.GetKeyDown(KeyCode.Alpha1))
    {
         camera1.enabled = true;
         camera2.enabled = false;
         ...
    }
    else if(Input.GetKeyDown(KeyCode.Alpha2))
    {
         camera1.enabled = false;
         camera2.enabled = true;
         ...
    }
    ...
}

You can add other cameras like this. I hope it helps you.

A: public GameObject cam1;
public GameObject cam2;
public GameObject cam3;

if (Input.GetKeyDown(KeyCode.Alpha1)) {

cam1.SetActive(true);
cam2.SetActive(false);
cam3.SetActive(false);

}

if (Input.GetKeyDown(KeyCode.Alpha2))
{

cam1.SetActive(false);
cam2.SetActive(true);
cam3.SetActive(false);

}

if (Input.GetKeyDown(KeyCode.Alpha3)) {

cam1.SetActive(false);
cam2.SetActive(false);
cam3.SetActive(true);

}


text:
Q: React inputs aren't rendering properly after value change when the keys are the same https://codesandbox.io/embed/trusting-fire-bz5ti
here is a code sandbox showing the issue
in the working version I have used Math.random() as the key
in the not working version I have used the index of the array as the key
when the array this.state.values updates it re renders the collection of inputs, however because they have the same key value it appears that it doesn't update the values properly.
you can try this by adding values (a, b, c, d) into each new input that appears and then deleting b or c to view the behaviour.

A: as Sung M. Kim said basically needed to provide each element of the array with a consistent key. I did this by including a key value in the object inputs object.
https://medium.com/@robinpokorny/index-as-a-key-is-an-anti-pattern-e0349aece318


text:
Q: How to fetch the latest version number of a delta table for one of my use cases I am using change data feed (CDF) feature of delta lake,it goes all well with CDF but when i read all the data to insert in gold, it lists all the versions, is there a way i can read only the latest version without specifying version number or a way to fetch latest version ?
        return spark.read.format("delta") \
                  .option("readChangeFeed", "true") \
                  .table(tableName) \
                  .where(col("_change_type") != "preimage")

above code block returns results from all versions since start, i can fetch only latest data by looking into the table and specifying the version but i don't understand how to enable this in production, I don't want to use timestamp to fetch the latest version as in case of retries some one might run the pipeline multiple times a day and this will bring data inaccuracies if not handled as 1st run of the day.  Any help would be appreciated.

A: We can write a query for row level modifications to get the different versions of a delta table.
As Tim posted in an answer to a similar Stack Overflow question, you can read it as a stream like the following:

spark.readStream
     .format("delta")
     .option("readChangeFeed", "true")
     .option("startingVersion", "latest")
     .table(tableName)
     .filter("_change_type != 'update_preimage'")


text:
Q: Typelite: Why is Dictionary mapped to KeyValuePair and not to any or [index:string]:any I have a class,
public class Instance : IResource
{
   public Dictionary<string, object> Value { get; set; }

and it is mapped to
interface Instance {
   Value: System.Collections.Generic.KeyValuePair[];

interface KeyValuePair {
   Key: any;
   Value: any;
}

I would have expected
interface Instance {
   Value: any;

or
interface Instance {
   Value: {[index:string]:any};

How can I change the generation?
Also, how can I skip the name space in the generation?

A: A quick and dirty workaround is to use a regex to alter output:
Using
<#= Regex.Replace( ts.Generate(TsGeneratorOutput.Properties)
        , @":\s*System\.Collections\.Generic\.KeyValuePair\<(?<k>[^\,]+),(?<v>[^\,]+)\>\[\];"
        , m=>": {[key: "+m.Groups["k"].Value+"]: "+m.Groups["v"].Value+"};"
        , RegexOptions.Multiline)
#>

Transforms a field
    myField: System.Collections.Generic.KeyValuePair<string,OtherClass>[];

to
    myField: {[key: string]: OtherClass};

A: Collection types (any type implementing IEnumerable) is converted to arrays. Dictionary<> implements IEnumerable<KeyValuePair<>> and thus is converted to an array. The item-type is then expanded to its fully qualified name (FQN): System.Collections.Generic.KeyValuePair.
Using Type Converters will let you change the type-name, but not the FQN. So it is only applicable to local types. In the case of dictionaries, you can't change the item type by inheritance.
You could either create a new dictionary type, without inheriting from Dictionary<>. Another way around this problem, is to also use Type Formatters:
ts.WithConvertor<Dictionary<string,object>>(t => {
    // Embed the real type in $
    // "System.Collections.Generic.${ [key: string]: any }$[]"
    return "${ [key: string]: any }$";
});
ts.WithFormatter((string memberTypeName, bool isMemberCollection) => {
    // Extract the content inside $
    string[] pieces = memberTypeName.Split('$');
    if (pieces.Length == 3) return pieces[1];
    // Default behaviour
    return memberTypeName + (isMemberCollection ? "[]" : "");
});

A: Here's a more generalized (and updated) solution that builds off of Markus Jarderot's answer:
static void RegisterDictionaryMemberFormatter(this TsGenerator tsGenerator)
{
    tsGenerator.SetMemberTypeFormatter((tsProperty, memberTypeName) => {
        var dictionaryInterface =
            tsProperty.PropertyType.Type.GetInterface(typeof(IDictionary<,>).Name) ??
            tsProperty.PropertyType.Type.GetInterface(typeof(IDictionary).Name);

        if (dictionaryInterface != null)
        {
            return tsGenerator.GetFullyQualifiedTypeName(new TsClass(dictionaryInterface));
        }
        else
        {
            return tsGenerator.DefaultMemberTypeFormatter(tsProperty, memberTypeName);
        }
    });
}

// and if you like the fluent syntax...
static TypeScriptFluent WithDictionaryMemberFormatter(this TypeScriptFluent typeScriptFluent)
{
    typeScriptFluent.ScriptGenerator.RegisterDictionaryMemberFormatter();
    return typeScriptFluent;
}

Use it like this:
var ts = TypeLite.TypeScript.Definitions().For(typeof(SomeClass).Assembly);
ts.ScriptGenerator.RegisterDictionaryMemberFormatter();

// alternatively with fluent syntax:

var ts = TypeLite.TypeScript.Definitions()
    .For(typeof(SomeClass).Assembly)
    .WithDictionaryMemberFormatter();

N.B. this only fixes type signatures of properties (or fields) that have dictionary types. Also definitions for IDictionary are not automatically emitted, you'd have to add them manually:
declare module System.Collections.Generic {
    interface IDictionary<TKey extends String, TValue> {
        [key: string]: TValue;
    }
}
declare module System.Collections {
    interface IDictionary {
        [key: string]: any;
    }
}


text:
Q: How to stop a logstash Config file running in Ubuntu? Im running my logstash config file in Ubuntu using the following command.
/opt/logstash/bin/logstash -f /etc/logstash/conf.d/logstash.conf

Its working, However I recently realized that every time I run this command it starts another instance. Now I think there are six instances running. Because each new record i create shows as six in elasticsearch.
How can I stop all these other instances and is there any way to check how many are running?
Thanks

A: You can use the pkill command and specify the name of the process(es)  you want to kill
pkill logstash

Or the killall command works as well the same way
killall logstash

A: As Val states, pkill should work to resolve what you are facing.
To avoid this in future why don't you create a small service file so which uses a PID file so you can't have multiple instances running? Here is what I did:
http://www.logstashbook.com/code/3/logstash-central.init


text:
Q: "that's all this analysis will tell us is" "I don't really have an opinion of whether Steven Avery is innocent or guilty," Spalding says in the piece. "I have more of an opinion of whether I think there's been planted evidence or not and ultimately that's all this analysis will tell us is whether or not this evidence is planted."
Source: http://www.postcrescent.com/story/news/local/steven-avery/2016/10/21/could-swedish-scientist-break-open-avery-case/92459398/
I am a little bit stuck in the bold part of the above sentence. Especialy the part "that's all the analysis will tell us is". Could you please tell me to which part is "is" before "whether" connected? I would understand if this part would be as follows: …all what this analysis will tell us is… But I am not able to parse the original version.

A: The usage of the phrase "that's all" doesn't sound grammatical in the sentence.  The phrase is usually used for saying there's nothing more involved than what you have mentiond.  It's also used for saying that something is completed/finished/what's needed or wanted.  For examples:
I wasn't interrupting. I was just trying to give my suggestion  - that'all.
Do you want anything else? No, thanks, that's all.
Moreover, there should not be the repetition of the copula 'is', as commented by @FumbleFingers. Even if one 'is' dropped, the sentence will not be correct.
The proper phrase to be used is 'all that' instead of that's all, as commented by @Mick.

A: All strikers are not equally skilled on the pitch. For example, some strikers can shoot accurately and with force only with their dominant foot, and they will sometimes make a clumsy adjustment mid-stride to avoid a shot with the weak foot.  The skill of speakers also varies, and speakers will sometimes make adjustments mid-sentence, analogous to the striker's adjustments during an attack on goal. It isn't pretty football and it isn't pretty speech.
What you have in your sentence is such an adjustment.

... ultimately that's all this analysis will tell us is whether or not
  this evidence is planted.

The speaker  starts out on one foot, as it were:

that is all this analysis will tell us...

which can accept as adjunct an if-clause or a whether-clause which stands in apposition to that:

... whether or not this evidence is planted

But the speaker "switches foot" in the heat of the moment and starts the adjunct  with is:

... is whether or not this evidence is planted.

as if he had begun the first clause so:

all this analysis will tell us...

which demands a verb to complete its thought.


text:
Q: No CI/CD on forked GitLab project I have forked a repository on GitLab. After I created the fork, that project added CI. However, even after updating my fork to the latest revision, I still do not see CI/CD in the menu. The main project has it, though.
I have added CI/CD on several of my own projects, it is just a matter of adding .gitlab-ci.yml (with a valid config) to the root folder of the repo. The repo I forked has that file, and if in the main repo page I click CI/CD configuration (above the file list), I get that file.
What else do I need to enable CI/CD on my forked repo?

A: Check if pipelines are enabled for this repo. In this case, they were disabled—either because it was forked repo, or because the original repo had no pipelines at the time it was forked (which could have been before the availability of pipelines).
They can be enabled in Settings > General > Visibility, project features, permissions > Pipelines. Once enabled there, CI/CD will appear in your repo's menu, and a pipeline will start the next time you push changes.
You may also need to enable shared runners: Go to Settings > CI / CD > Runners and enable shared runners (in the right column).


text:
Q: Can't solve this text problem with a code in c++ Alex is a student at a collage and will now enroll in the summer semester, for which he needs to take paper documents to the faculty. All students bring their documents on one of the N days (marked from 1 to N) that are provided for it. From the enrollments of previous years, for each of the N days it is known what is the expected number of students who will take the documents that day. Alex will bring the documents on the day when the least number of students are expected to bring documents on that day, and if there are more such days - then on the first possible day. Print on which of the days Alex will bring the documents and how many students are expected to go to the college on that day.
Input
In the first row is the number N (1 ≤ N ≤ 30), the number of days provided for carrying documents.
The next row contains N integers in the range 1 to 1000, the number of students expected to attend college on each of the N days, starting with day one
Output
On one line, print the sequence number of the day Alex chooses, followed by the number of students expected to attend college on that day.
Examples
#1
Input 3 30 20 40
Output 2 20
#2
Input 4 20 30 40 20
Output 1 20
I can find the min number,but im now sure on how to get the position of the array and choose the first one if values repeat
int arr[1000],n,i,min;
    cin>>n;
    for (int i = 0; i < n; ++i)
    cin>>arr[i];
    min = arr[0];
    for (i = 0; i < n; i++)
    {
        if (min > arr[i])
            min = arr[i];
    }
        cout<<min;

A: The task requires you to output the day on which the minimum number of students attend – which is equivalent to the index of the minimum in the array (by the way: why an array of size 1000 if at most 30 days are to be considered anyway?).
However you lose this information by only storing the minimum value. Instead you can simply store the index and compare relying on that one:
size_t min = 0;
for(size_t i = 1; i < n; ++i) // note: can start at 1 as 0 is tested already
{
   if(arr[i] < arr[min])
   {
       min = i;
   }
}

Now after the loop has terminated you can simply output min + 1 (note: index translation, C++ is zero-based, desired output is one-based).


text:
Q: Kubernetes Calling multiple values with the same name Helm Charts We have two networks that suppose to use the sane name ClientApp but different values in the values.yaml file. The network_a works when on a particular network.
For example a user with a particular laptop with network_a can access the application url and can access network-a.co.uk URL. but the issue is that another type of laptop require network_b and we do not want to overrides network_a in the values.yaml file but define also the network_b in order to access application in network-b.co.uk.
deployment.yaml
  env:

      - name: ClientApp
        value: {{ .Values.env.network_a }}

// how to define network_b on this deployment template

values.yaml
  env:

network_a: https://network-a.co.uk
network_b: https://network-b.co.uk

Since we can not call the same variables name in the deployment.yaml, how would I put the network_b to use the values from the deployment using the same name ClientApp.


text:
Q: Determining a VS2010 WebService project from .csproj I'm writing some PS to inspect .csproj files (for enforcing an SCM check-in policy)
Is the following check sufficient to determine if a .csproj is a WebService project?
    # Check for WebProjectProperties (indicates project is a Web Service)
if ($xmldata.Project.ProjectExtensions.VisualStudio.FlavorProperties.WebProjectProperties -ne $null)
{
    $isWebService = $true
}

The only alternative I've seen is parsing the Project.PropertyGroup.ProjectTypeGuids - but that seems overkill if this element is always set for a WS as well.

A: After digging a bit further, I'm (mostly) convinced.  I've added this Dictionary:
# Visual Studio ProjectTypeGuid keys - store in a constant dictionary
# Courtesy of http://www.mztools.com/articles/2008/MZ2008017.aspx
New-Variable -Name ProjTypeMap -Option Constant -Value @{
"FAE04EC0-301F-11D3-BF4B-00C04F79EFBC" = "Windows (C#)";
"F184B08F-C81C-45F6-A57F-5ABD9991F28F" = "Windows (VB.NET)";
"8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942" = "Windows (Visual C++)";
"349C5851-65DF-11DA-9384-00065B846F21" = "Web Application";
"E24C65DC-7377-472B-9ABA-BC803B73C61A" = "Web Site";
"F135691A-BF7E-435D-8960-F99683D2D49C" = "Distributed System";
"3D9AD99F-2412-4246-B90B-4EAA41C64699" = "Windows Communication Foundation (WCF)";
"60DC8134-EBA5-43B8-BCC9-BB4BC16C2548" = "Windows Presentation Foundation (WPF)";
"C252FEB5-A946-4202-B1D4-9916A0590387" = "Visual Database Tools";
"A9ACE9BB-CECE-4E62-9AA4-C7E7C5BD2124" = "Database";
"4F174C21-8C12-11D0-8340-0000F80270F8" = "Database (other project types)";
"3AC096D0-A1C2-E12C-1390-A8335801FDAB" = "Test";
"20D4826A-C6FA-45DB-90F4-C717570B9F32" = "Legacy (2003) Smart Device (C#)";
"CB4CE8C6-1BDB-4DC7-A4D3-65A1999772F8" = "Legacy (2003) Smart Device (VB.NET)";
"4D628B5B-2FBC-4AA6-8C16-197242AEB884" = "Smart Device (C#)";
"68B1623D-7FB9-47D8-8664-7ECEA3297D4F" = "Smart Device (VB.NET)";
"14822709-B5A1-4724-98CA-57A101D1B079" = "Workflow Foundation 3.0 (C#)";
"D59BE175-2ED0-4C54-BE3D-CDAA9F3214C8" = "Workflow Foundation 3.0 (VB.NET)";
"32f31d43-81cc-4c15-9de6-3fc5453562b6" = "Workflow Foundation 4.0";
"06A35CCD-C46D-44D5-987B-CF40FF872267" = "Deployment Merge Module";
"3EA9E505-35AC-4774-B492-AD1749C4943A" = "Deployment Cab";
"978C614F-708E-4E1A-B201-565925725DBA" = "Deployment Setup";
"AB322303-2255-48EF-A496-5904EB18DA55" = "Deployment Smart Device Cab";
"A860303F-1F3F-4691-B57E-529FC101A107" = "Visual Studio Tools for Applications (VSTA)";
"BAA0C2D2-18E2-41B9-852F-F413020CAA33" = "Visual Studio Tools for Office (VSTO)";
"F8810EC1-6754-47FC-A15F-DFABD2E3FA90" = "SharePoint Workflow";
"6D335F3A-9D43-41b4-9D22-F6F17C4BE596" = "XNA (Windows)";
"2DF5C3F4-5A5F-47a9-8E94-23B4456F55E2" = "XNA (XBox)";
"D399B71A-8929-442a-A9AC-8BEC78BB2433" = "XNA (Zune)";
"EC05E597-79D4-47f3-ADA0-324C4F7C7484" = "SharePoint (VB.NET)";
"593B0543-81F6-4436-BA1E-4747859CAAE2" = "SharePoint (C#)";
"A1591282-1198-4647-A2B1-27E5FF5F6F3B" = "Silverlight"
}

and look-up any ProjectTypeGuids encountered.  This did flush out one more WebApp than just testing on Project.ProjectExtensions.VisualStudio.FlavorProperties.WebProjectProperties, so it is more robust.

A: The WebProjectProperties section also exists for web application projects.
The distinction seems to be whether the app.config (probably web.config too?) contains (non-empty) configuration/system.serviceModel/services/service/host sections.

A: This list has been very helpful ! Thx a lot.
I was only missing this Guid:
"EF7E3281-CD33-11D4-8326-00C04FA0CE8D" = "BizTalk"


text:
Q: Can you make a noun doubly possessive? I've noticed that native speakers sometimes make nouns they've already made possessive, possessive again. If this is syntactically sound, I don't understand it.
For example, "her relative was mean" could alternatively be written as: "a relative of hers was mean."
Why isn't it "a relative of her was mean"?

A: In modern English, of is not commonly used to indicate possession, which perhaps explains Jason's comment that it feels biblical. Relationships are (generally) mutual so examples using relatives make this a little more confusing than it needs to be. If we instead think of possessing an item, like a car, a native English speaker would find the sentence "This is the car of John" strange, archaic or maybe even wrong.
My native feeling for the word of in your question, is more similar to "one of many", as in, she has many cars. "This car is one of hers." Could be short for "This car is one of her cars."
As a final example, let's consider the phrase "a part of her" and compare with "a part of hers". The first phrase says she is composed of parts and we are talking about one of them. The second says that she possesses parts but it's unclear if they are car parts or some other kind of part (like a part of her personality).


text:
Q: iPhone DatePicker with Actionsheet I am using this code to display a datePicker. When a textField was clicked, it appears. However, The "close" button overwraps the DatePicker. Do you know any way to move it down a little bit? thanks in advance.
-(IBAction)acsheet:(id)sender{

actionSheet = [[UIActionSheet alloc] initWithTitle:nil
                                          delegate:nil
                                 cancelButtonTitle:nil
                            destructiveButtonTitle:nil
                                 otherButtonTitles:nil];

[actionSheet setActionSheetStyle:UIActionSheetStyleBlackTranslucent];

//CGRect pickerFrame = CGRectMake(0, 45, 0, 0);
pickerView1 = [[UIDatePicker alloc] init];
pickerView1.datePickerMode = UIDatePickerModeDate;

[actionSheet addSubview:pickerView1];

UISegmentedControl *closeButton = [[UISegmentedControl alloc] initWithItems:[NSArray arrayWithObject:@"Close"]];
closeButton.momentary = YES;
closeButton.frame = CGRectMake(260, 7.0f, 50.0f, 30.0f);
closeButton.segmentedControlStyle = UISegmentedControlStyleBar;
closeButton.tintColor = [UIColor blackColor];
[closeButton addTarget:self action:@selector(dismissActionSheet:) forControlEvents:UIControlEventValueChanged];
[actionSheet addSubview:closeButton];
[actionSheet showInView:[[UIApplication sharedApplication] keyWindow]];
[actionSheet setBounds:CGRectMake(0, 0, 320, 485)];

[pickerView1 addTarget:self
             action:@selector(updateLabel:)
     forControlEvents:UIControlEventValueChanged];
UIBarButtonItem *spacer = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:nil action:nil];
UIBarButtonItem *doneButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone target:self action:@selector(dismissDatePicker:)] ;
UIToolbar *toolBar = [[UIToolbar alloc] initWithFrame:CGRectMake(0, self.view.bounds.size.height, 320, 44)];
toolBar.tag = 11;
toolBar.barStyle = UIBarStyleBlackTranslucent;

[toolBar setItems:[NSArray arrayWithObjects:spacer, doneButton, nil]];
[self.view addSubview:toolBar];

}

A: If you want a UIDatePicker to appear when a UITextField becomes the first responder, then you should set the date picker to be the textfield's inputView.  Then when you tap on the field, the date picker will slide up instead of the keyboard.

A: closeButton.frame = CGRectMake(260, 7.0f, 50.0f, 30.0f);

change the 7.0f and 30.f to more positive values.and then try.
7.0f value is the origin.y of Button // increase it to shift the button lower
30.f value is the size.height of button// increase it by the same amount you increase origin to keep proportional height

A: I've worked out by myself;
i've changed this line:
  pickerView1 = [[UIDatePicker alloc] init];

into this:
pickerView1 = [[UIDatePicker alloc] initWithFrame:CGRectMake(0, 40, 320, 450)];


text:
Q: How to Redirect only if form is not empty , JavaScript Validation Right now even if input fields are empty , if submit button is pressed it shows alert"message": and then redirects to window.location="URL"
What I m looking for is it only shows done alert and redirects if input fields are filled
        <form>
            <input type="text" placeholder="enter name here">

            <input type="number" placeholder="enter number here">

            <input type="submit" id="submitbutton" value="submit">
        </form>

    </center>
</body>

<script type="text/javascript">

    const submitit = document.getElementById('submitbutton');

    submitit.addEventListener("click",function(){
        alert("Done, Meanwhile check our website");
        window.location="https://www.google.com";
    });

</script>

A: Try this
<form>
  <input id="name" type="text" placeholder="enter name here">

  <input id="number" type="number" placeholder="enter number here">

  <input type="submit" id="submitbutton" value="submit">
</form>

and JavaScript:
const submitit = document.getElementById('submitbutton');

submitit.addEventListener("click", function(e) {
  // prevent form from being submitted
  e.preventDefault();

  alert("Done, Meanwhile check our website");

  const name = document.getElementById('name');
  const number = document.getElementById('number');

  if (name.value !== '' && number.value !== '') {
    window.location = "https://www.google.com";
  }
});

Demo - https://jsfiddle.net/vyspiansky/v7yjwL6x/


text:
Q: Why can't I focus on the current field when using useFieldArray() for dynamic form in react-hook-form? Using react-hook-form 7.14.2. I've got a dynamic form and I'm using the built-in validation. I'm getting the feeling that react-hook-form can't handle dynamic forms very elegantly, and I should probably just quit churning on this, and fall back to a plain HTML form.
I simply want to focus to stay on the field I'm typing in, after validation occurs. The fields are required, but after the validation message shows, and I begin typing, a re-render happens and focus is lost on the current field...and it jumps back to the last field in the form. It's a clunky, poor user experience and I just can't seem to find the magic combo of tricks and techniques to get it to work like a normal react-hook-form form would work!
Form:
import React, { useEffect } from "react";
import { useForm, useFieldArray } from "react-hook-form";
import { Icon } from "@iconify/react";

import socials from "../../enum/social";

const SocialLinksEdit = props => {
    const {
        socialLinks,
        onSave,
        onCancel
    } = props;

    const { control, register, setValue, setFocus, handleSubmit, formState: { errors } } = useForm();

    const { fields, append } = useFieldArray({
        control,
        name: "socialItems"
    });

    useEffect(() => {
        Object.entries(socials).find(([, s]) => append(s));
    }, []);

    const getErrorMessage = i => {
        if (!errors || Object.keys(errors).length === 0) {
            return;
        }
        if (errors.socialItems && errors.socialItems[i]) {
            return errors.socialItems[i].url.message;
        }
        return null;
    };

    const SocialItems = () => {
        const onFocus = field => {
            // setValue(e.target.value);
            setFocus(field);
        };
        const onFocusOut = e => {
            setValue(e.target.value);
        };
        return (
            <>
                {
                    fields.map((field, i) => {
                        let socialData = socialLinks.find(sl => sl.social_service === field.name);
                        console.log(errors);
                        return (

                                        <Icon icon={field.icon} />
                                        {field.label}

                                <input
                                    type="text"
                                    // autoFocus={i === 0}
                                    ref={control}
                                    autoFocus
                                    // onFocus={() => onFocus(`socialItems.${i}.url`)}
                                    // onFocusOut={onFocusOut}
                                    {...register(`socialItems.${i}.url`, { required: "URL is required!" })}
                                    defaultValue={socialData?.url}
                                />
                                {errors && {getErrorMessage(i)}}

                        );
                    })
                }
            </>
        );
    };

    return (

                <form onSubmit={handleSubmit(onSave)}>

<Icon icon="bi:megaphone" />

Social Links

                    <SocialItems />

                        <button type="submit" className="form-button-primary">Save</button>
                        <button type="button" className="form-button-cancel" onClick={e => onCancel(e)}>Cancel</button>

                </form>

    );
};

export default SocialLinksEdit;

Some 'splainin' to do:

*

*I left a bunch of commented stuff in there so you can see all the wacky Stack-O suggestions I've tried already - none of them works.

*I'm appending on load because defaultValues did not work - nothing renders

*I'm only concerned w/ the "url" field of the object registered/bound on the field

*The validation message line is commented out because I'm not sure what to do w/ it

Here's a quick video of how it behaves. If I could just get the field to retain focus and not skip down to the bottom field like this, I'd be a happy guy.
https://www.tiktok.com/@zambizzi/video/7093151720624147755?is_from_webapp=1&sender_device=pc&web_id=7039430208454280710

A: Turns out, was just a matter of nesting the fields directly inside, rather than in a separate component, to prevent a re-render:
return (

            <form onSubmit={handleSubmit(onSave)}>

<Icon icon="bi:megaphone" />

Social Links

                {
                    fields.map((field, i) => {
                        let socialData = socialLinks.find(sl => sl.social_service === field.name);
                        console.log(errors);
                        return (

                                        <Icon icon={field.icon} />
                                        {field.label}

                                    <input
                                        type="text"
                                        autoFocus
                                        {...register(`socialItems.${i}.url`, { required: "URL is required!" })}
                                        defaultValue={socialData?.url}
                                    />
                                    {errors && {getErrorMessage(i)}}

                        );
                    })
                }

                    <button type="submit" className="form-button-primary">Save</button>

            </form>

);


text:
Q: How would you save the state of html table that allows you to toggle cell background color? I have an HTML table below that allows users to click on a cell and toggle its background color. How can I save the state of the table and the toggled cells? So when the user revisits the page at another session, the same cells are highlighted.

$(function () {
            $('td').click(function () {
                $(this).toggleClass('green');
            });
        });
        .green {
            background-color: green;
            color: white;
        }

            row1 col1
            row1 col2
            row1 col3
            row1 col4

            row2 col1
            row2 col2
            row2 col3
            row2 col4

            row3 col1
            row3 col2
            row3 col3
            row3 col4

            row4 col1
            row4 col2
            row4 col3
            row4 col4

A: Use localStorage. My example is hardcoded, but I hope you get the point.
See the snippet below.

<!DOCTYPE html>

    <title>Home</title>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width" />

    <button id="my-button">Red background</button>


text:
Q: how can i send an email to lots of users using php? I am trying to send email to more than 2 emails if it is possible with the bellow code, but currently with the code i have i can only send to 1 email but i want to send it more than 4 users. Also i will fetch users from a database but right now it is not a problem for me, id prefer solving the first one
//index.php

$error = '';
$name = '';
$email = '';
$subject = '';
$message = '';

function clean_text($string)
{
    $string = trim($string);
    $string = stripslashes($string);
    $string = htmlspecialchars($string);
    return $string;
}

if(isset($_POST["submit"]))
{
    if(empty($_POST["name"]))
    {
        $error .= '
Please Enter your Name
';
    }
    else
    {
        $name = clean_text($_POST["name"]);
        if(!preg_match("/^[a-zA-Z ]*$/",$name))
        {
            $error .= '
Only letters and white space allowed
';
        }
    }
    if(empty($_POST["email"]))
    {
        $error .= '
Please Enter your Email
';
    }
    else
    {
        $email = clean_text($_POST["email"]);
        if(!filter_var($email, FILTER_VALIDATE_EMAIL))
        {
            $error .= '
Invalid email format
';
        }
    }
    if(empty($_POST["subject"]))
    {
        $error .= '
Subject is required
';
    }
    else
    {
        $subject = clean_text($_POST["subject"]);
    }
    if(empty($_POST["message"]))
    {
        $error .= '
Message is required
';
    }
    else
    {
        $message = clean_text($_POST["message"]);
    }
    if($error == '')
    {
        require 'class/class.phpmailer.php';
        $mail = new PHPMailer;
        $mail->IsSMTP();                                //Sets Mailer to send message using SMTP
        $mail->Host = 'smtp.gmail.com';     //Sets the SMTP hosts of your Email hosting, this for Godaddy
        $mail->Port = '465';                                //Sets the default SMTP server port
        $mail->SMTPAuth = true;                         //Sets SMTP authentication. Utilizes the Username and Password variables
        $mail->Username = 'example@domain.co';                  //Sets SMTP username
        $mail->Password = 'xxxxxxxxxxx';                    //Sets SMTP password
        $mail->SMTPSecure = 'ssl';                          //Sets connection prefix. Options are "", "ssl" or "tls"
        $mail->From = $_POST["email"];                  //Sets the From email address for the message
        $mail->FromName = 'name';               //Sets the From name of the message
        $mail->AddAddress($_POST["email"]);     //Adds a "To" address
        $mail->AddCC($_POST["email"], $_POST["name"]);  //Adds a "Cc" address
        $mail->WordWrap = 50;                           //Sets word wrapping on the body of the message to a given number of characters
        $mail->IsHTML(true);                            //Sets message type to HTML
        $mail->Subject = $_POST["subject"];             //Sets the Subject of the message
        $mail->Body = $_POST["message"];                //An HTML or plain text message body
        if($mail->Send())                               //Send an Email. Return true on success or false on error
        {
            $error = 'Thank you for contacting us';
        }
        else
        {
            $error = 'There is an Error';
        }
        $name = '';
        $email = '';
        $subject = '';
        $message = '';
    }
}

?>
<!DOCTYPE html>

        <title>Send an Email on Form Submission using PHP with PHPMailer</title>

        <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" />

Send an Email on Form Submission using PHP with PHPMailer

                    <?php echo $error; ?>
                    <form method="post">

                            Enter Name
                            <input type="text" name="name" placeholder="Enter Name" class="form-control" value="<?php echo $name; ?>" />

                            Enter Email
                            <input type="text" name="email" class="form-control" placeholder="Enter Email" value="<?php echo $email; ?>" />

                            Enter Subject
                            <input type="text" name="subject" class="form-control" placeholder="Enter Subject" value="<?php echo $subject; ?>" />

                            Enter Message
                            <textarea name="message" class="form-control" placeholder="Enter Message"><?php echo $message; ?></textarea>

                            <input type="submit" name="submit" value="Submit" class="btn btn-info" />

                    </form>

```

A: you have multiple choice here, in first you can create a list of email input like by adding  email[1] in your input component.
<input type="email" name="email[1]" value="<? $email[1] ?>" >

The number is used to identify the input in your php ,like this $_POST[email][x].
In the " back-end " section, you will add a loop around
foreach($_POST['email] as $emailAdress){
   $mail->addAdress($emailAdress)
}

i hope that will help you


text:
Q: Provisioning profile doesn't include entitlement :)
I use eas (ExpoApplicationService) to build my react native NFC iOS app, and when I use

com.apple.developer.nfc.readersession.iso7816.select-identifiers

and

com.apple.developer.nfc.readersession.iso7816.select-identifiers

I always get this error from fastlane:

❌  error: Provisioning profile "*[expo] com.freeridre.senityApp
AppStore 2021-07-23T21:58:47.340Z" doesn't include the
com.apple.developer.nfc.readersession.felica.systemcodes and
com.apple.developer.nfc.readersession.iso7816.select-identifiers
entitlements. (in target 'senity' from project 'senity')

My entitlements look like this:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
  <dict>
    <key>aps-environment</key>
    <string>development</string>
    <key>com.apple.developer.nfc.readersession.felica.systemcodes</key>
    <array>
      <string>12FC</string>
    </array>
    <key>com.apple.developer.nfc.readersession.formats</key>
    <array>
      <string>NDEF</string>
      <string>TAG</string>
    </array>
    <key>com.apple.developer.nfc.readersession.iso7816.select-identifiers</key>
    <array>
      <string>A0000001020304</string>
      <string>A000000063504B43532D3135</string>
      <string>E828BD080F</string>
      <string>D2760000850100</string>
      <string>D2760000850101</string>
    </array>
  </dict>
</plist>

My info.plist looks like this:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
  <dict>
    <key>CFBundleDisplayName</key>
    <string>senity</string>
    <key>CFBundleShortVersionString</key>
    <string>1.0.1</string>
    <key>CFBundleURLTypes</key>
    <array>
      <dict>
        <key>CFBundleURLSchemes</key>
        <array>
          <string>com.freeridre.senityApp</string>
        </array>
      </dict>
      <dict>
        <key>CFBundleURLSchemes</key>
        <array>
          <string>exp+senityiosnfc</string>
        </array>
      </dict>
    </array>
    <key>CFBundleVersion</key>
    <string>1</string>
    <key>NFCReaderUsageDescription</key>
    <string>Senity Security Systems Ltd.</string>
    <key>UILaunchStoryboardName</key>
    <string>SplashScreen</string>
    <key>UIRequiresFullScreen</key>
    <true/>
    <key>UISupportedInterfaceOrientations</key>
    <array>
      <string>UIInterfaceOrientationPortrait</string>
      <string>UIInterfaceOrientationPortraitUpsideDown</string>
    </array>
    <key>com.apple.developer.nfc.readersession.felica.systemcodes</key>
    <array>
      <string>12FC</string>
    </array>
    <key>com.apple.developer.nfc.readersession.formats</key>
    <array>
      <string>NDEF</string>
      <string>TAG</string>
    </array>
    <key>com.apple.developer.nfc.readersession.iso7816.select-identifiers</key>
    <array>
      <string>A0000001020304</string>
      <string>A000000063504B43532D3135</string>
      <string>E828BD080F</string>
      <string>D2760000850100</string>
      <string>D2760000850101</string>
    </array>
  </dict>
</plist>

How can I fix this?
Thank you in advance!


text:
Q: how to make a directory as a package I have 2 python  files  a and b that are mutually dependent which raises a circular import error anytime when I import one from the other. I saw this post online which talks about creating a third file __init.py__ in the same directory as a and b and putting all the imports in the third file, hence the folder containing these 3 files becomes a package, correct? So in this case, the package can be imported in both a and b and submodules can be accessed however when I import the package in a and b, it gives an error that package is not defined. I am not sure, if I am creating the package correctly. Below is my code demonstration.
/code
 /package    # this becomes a package, correct?
  __init__.py
  a.py
  b.py

In __init__.py
from . import a
from . import b

In a.py
import package   # this throws "package is not defined" error
package.b.some_variable

In b.py
import package   # this also throws "package is not defined" error
package.a.some_variable


text:
Q: Symfony 4.3: Overwrite Command from other Bundle How can i overwrite in Symfony 4.3 a Command/bundleCommand.php from other bundle?
I tied to create a folder under src/Command/bundleCommand.php - but not working. Must i create also a folder with the bundle name in Command?

A: You need to configure your command as a decorator in services.yaml. Try something like this:
services:

    App\Command\BundleCommand:
        decorates: Bundle\Command\BundleCommand


text:
Q: Select areas of an image with Jquery I started a web application with C# and mvc5.
In my application I read images from database and show them in an image slider.
I want to add a button to the page and when user click on this button User can click on one area of image and I save this x and y of area to the database.
my problem is I dont know how can I get the x and y with any resolution of devices. Maybe user use Iphone maybe Ipad or maybe imac.

A: You can get and store the Positions with a click event as shown below:
function getClickPosition(e) {
    var cursorX = e.pageX;
    var cursorY = e.pageY;
}

document.addEventListener("click", getClickPosition);

The viewport size will be irrelevant as it will return the X and Y position for that specific viewport in px.


text:
Q: MSSQL-Server/ruby-gem sequel: How to read UTF-8 values? I use the ruby-gem sequel to read utf-8-encoded data from a MSSQL-Server table.
The fields of the table are defined as nvarchar, they look correct in the Microsoft Server Management Studio (Cyrillic is Cyrillic, Chinese looks chinese).
I connect my database with
  db = Sequel.connect(
    :adapter=>'ado',
    :host     =>connectiondata[:server],
    :database=>connectiondata[:dsn],
    #Login via SSO
  )

  sel = db[:TEXTE].filter(:language=> 'EN')
  sel.each{|data|
    data.each{|key, val|
      puts "#{val.encoding}: #{val.inspect}"  #-> CP850: ....
      puts val.encode('utf-8')
    }
  }

This works fine for English, German returns also a useable result:
CP850: "(2 St\x81ck) f\x81r
(2 Stück) für ...

But the result is converted to CP850, it is not the original UTF-8.
Cyrillic languages (I tested with Bulgarian) and Chinese produce only '?'
(reasonable, because CP850 doesn't include Chinese and Bulgarian characters).
I also connected via a odbc-connection:
    db = Sequel.odbc(odbckey,
      :db_type => 'mssql',  #necessary
      #:encoding => 'utf-8',  #Only MySQL-Adapter
    )

The result is ASCII-8BIT, I have to convert the data with force_encoding to CP1252 (not CP850!).
But Cyrillic and Chinese is still not possible.
What I tried already:

*

*The MySQL-adapter seems to have an encoding option, with MSSQL I detected no effect.

*I did similar tests with sqlite and sequel and I had no problem with unicode.

*I installed SQLNCLI10.dll and used it as provider. But I get a Invalid connection string attribute-error (same with sqlncli).

So my closing question: How can I read UTF-8 data in MS-SQL via ruby and sequel?
My environment:
Client:

*

*Windows 7

*Ruby 1.9.2

*sequel-3.33.0

Database:

*

*SQL Server 2005

*Database has collation Latin1_General_CI_AS

After preparing my question I found a solution. I will post it as an answer.
But I still hope, there is a better way.

A: If you can avoid it, you really don't want to use the ado adapter (it's OK for read-only workloads, but I wouldn't recommend it for other workloads).  I would try the tinytds adapter, as I believe that will handle encodings properly, and it defaults to UTF-8.
Sequel itself does not do any transcoding, it leaves the handling of encodings to the lower level driver.

A: After preparing my question I found a solution on my own.
When I add a
Encoding.default_external='utf-8'

to my code, I get the correct results.
As a side effect each File.open expects now also UTF-8-encoded files (This can be overwritten by additional parameters in File.open).
As an alternative, this works also:
Encoding.default_internal='utf-8'

As I mentioned in my question, I don't like to change global settings, only to change the behaviour of one interface.
So I still hope on a better solution.


text:
Q: NHibernate/Oracle : how to insert large number in BINARY_DOUBLE column? I have a C# System.Double property which may contains value like 1e250 :
public virtual double DoubleValue {get; set;}

The property is mapped to a BINARY_DOUBLE column :
<property name="DoubleValue" column="VALUE_BINARY_DOUBLE"/>

Max value for Binary_Double is about 1.7e+308 (Oracle doc), but I'm getting an exception :
ORA-01426 : numeric overflow
Problem appears even when executing a query through SQL+. I have to use the TO_BINARY_DOUBLE cast to make it work. In my understanding, the number supplied is implicitly converted to a NUMBER : my query work with 1e125 (max for NUMBER is 1e126) but won't work with 1e250.
I've also tried those mappings, without success :
<property name="DoubleValue" column="VALUE_BINARY_DOUBLE" type="System.Double"/>
<property name="DoubleValue" column="VALUE_BINARY_DOUBLE" type="binary"/>

Using : Oracle 11G - NHibernate 2.1.0 - .Net 3.5 SP1
Thanks for any lead you may provide !

A: Here is the workaround we are using, since we didn't find any solution :
Add a property in C# :
public virtual string DatabaseDoubleValue
{
    get
    {
        return DoubleValue.ToString();
    }
    set
    {
        DoubleValue = double.Parse(value);
    }
}

Change mapping to
<property name="DatabaseDoubleValue" column="VALUE_BINARY_DOUBLE"/>

Add a trigger on the VALUE_BINARY_DOUBLE column :
FOR EACH ROW
BEGIN
    :NEW.VALUE_BINARY_DOUBLE := TO_BINARY_DOUBLE(:NEW.VALUE_BINARY_DOUBLE);
END;

Works fine that way!


text:
Q: How do I prove $\Gamma, A, B \vdash C \Rightarrow \Gamma, A \wedge B \vdash C\ $ in a Hilbert system? How do I prove $$\Gamma, A, B \vdash C \Rightarrow \Gamma, A \wedge B \vdash C$$? It makes sense to me in general (like, if we want to show $C$ is derivable from $A \wedge B$, we have to show it's derivable assuming $A$ and also $B$) but I'm stuck constructing a formal proof. The deduction theorem ($\Gamma \vdash A \wedge B \supset C$) seem to bring me no closer to some kind of axiom.
I'm presented with the whole bunch of axioms:
$$A \supset (B \supset A)$$
$$(A \supset (B \supset C)) \supset ((A \supset B) \supset (A \supset C))$$
$$A \supset (B \supset A \wedge B)$$
$$A \wedge B \supset A$$
$$A \wedge B \supset B$$
$$(A \supset C) \supset ((B \supset C) \supset (A \vee B \supset C))$$
$$A \supset A \vee B$$
$$B \supset A \vee B$$
$$(A \supset B) \supset ((A \supset \neg B) \supset \neg A)$$
$$\neg\neg A \supset A$$
$$\textbf{F} \supset A$$
$$A \supset \textbf{T}$$

A: This is very easy: you just write out the same proof, except where you write in

*

*(hypothesis) $A$

in the first proof, you replace it with the sequence

*

*(hypothesis) $A \land B$

*(axiom) $A \land B \to A$

*(modus ponens) $A$

and similarly for $B$.


text:
Q: StackOverflowError Java 1.8 First time asking a question on here, I've been lurking for a while attempting to search for the answer to this issue but I can't seem to find a proper solution.
Information:Using javac 1.8.0_31 to compile java sources
Information:java: The system is out of resources.
Information:java: Consult the following stack trace for details.
Information:java:   at com.sun.tools.javac.parser.JavaTokenizer.readToken(JavaTokenizer.java:560)
Information:java:   at com.sun.tools.javac.parser.Scanner.nextToken(Scanner.java:115)
Information:java:   at com.sun.tools.javac.parser.JavacParser.nextToken(JavacParser.java:301)
Information:java:   at com.sun.tools.javac.parser.JavacParser.literal(JavacParser.java:759)
Information:java:   at com.sun.tools.javac.parser.JavacParser.literal(JavacParser.java:659)
Information:java:   at com.sun.tools.javac.parser.JavacParser.term3(JavacParser.java:1157)
Information:java:   at com.sun.tools.javac.parser.JavacParser.term2(JavacParser.java:909)
Information:java:   at com.sun.tools.javac.parser.JavacParser.term1(JavacParser.java:880)
Information:java:   at com.sun.tools.javac.parser.JavacParser.term(JavacParser.java:836)
Information:java:   at com.sun.tools.javac.parser.JavacParser.term(JavacParser.java:816)
Information:java:   at com.sun.tools.javac.parser.JavacParser.parseExpression(JavacParser.java:779)
Information:java:   at com.sun.tools.javac.parser.JavacParser.arguments(JavacParser.java:1779)
Information:java:   at com.sun.tools.javac.parser.JavacParser.classCreatorRest(JavacParser.java:2219)
Information:java:   at com.sun.tools.javac.parser.JavacParser.creator(JavacParser.java:2103)
Information:java:   at com.sun.tools.javac.parser.JavacParser.term3(JavacParser.java:1166)
Information:java:   at com.sun.tools.javac.parser.JavacParser.arguments(JavacParser.java:1794)
Information:java:   at com.sun.tools.javac.parser.JavacParser.term3(JavacParser.java:1255)
Information:java:   at com.sun.tools.javac.parser.JavacParser.blockStatement(JavacParser.java:2392)
Information:java:   at com.sun.tools.javac.parser.JavacParser.blockStatements(JavacParser.java:2298)
Information:java:   at com.sun.tools.javac.parser.JavacParser.block(JavacParser.java:2269)
Information:java:   at com.sun.tools.javac.parser.JavacParser.block(JavacParser.java:2283)
Information:java:   at com.sun.tools.javac.parser.JavacParser.parseStatement(JavacParser.java:2441)
Information:java:   at com.sun.tools.javac.parser.JavacParser.blockStatement(JavacParser.java:2352)
Information:java:   at com.sun.tools.javac.parser.JavacParser.parseStatementAsBlock(JavacParser.java:2317)
Information:java:   at com.sun.tools.javac.parser.JavacParser.parseStatement(JavacParser.java:2445)
Information:java:   at com.sun.tools.javac.parser.JavacParser.parseStatement(JavacParser.java:2449)
Information:java: Errors occurred while compiling module 'Server'
Information:5/1/2015 5:45 AM - Compilation completed with 1 error and 0 warnings in 952ms
Error:java: java.lang.StackOverflowError

I've never had issues running my program before and I'm not sure what could be the cause of this.
My system has 6 gb of ram available with 1gb allocated to the JVM. When running a previous version, I have no issues.
If anyone could help me troubleshoot what the cause of this might be, I would appreciate it.
Sorry about the question, I literally copy/pasted the entire source to a different module with the same exact settings and it's working good as new. If anyone has any explanation as to why this is the case, please, let me know.

A: Firstly, you don't run your program, you compile it. It is the java compiler that dies of stack overflow.
Clearly, your source code is too complicated for the java compiler to deal with. To run the java compiler with more stack space
javac -J-Xss4m ....

If you don't run javac directly, but through some "build tool", this is the time to find out how good it is. A good build tool, while providing reasonable defaults, should let you customize your final compilation command line at will.


text:
Q: In OctoberCMS how do you find the hint path? Mail::sendTo($to, 'OctoberCMS.PhotoElegance::mail.contactform', $params);

When this line of code is called I get back an error which says the following:
"No hint path defined for [OctoberCMS.PhotoeElgance] on line 112 of  vendor\laravel\framework\src\Illuminate\View\FileViewFinder.php"
In simple, I am trying to send mail when the contact form is submitted. The code is inside a function called onStart(). I discovered that the appname is OctoberCMS. After the dot I have PhotoElegance as that is the website name.
After the hint path (OctoberCMS.PhotoElegance) I am calling the static function (mail.contactform) to my defined contact form which has been built in the CMS.
Where do I find out the appname and website name. How do I define these if I want to change them. I understand this is to do with name spacing but I cannot figure it out.

A: hi the way you try to send an email is called "Mail view" this is the way you do send mail form a plugin, and the path to the mail view is author.plugin::path.to.view.
From the very short definition of your problem i can tell that you are not using plugin but the dynamic pages feature of october cms so you must use "mail template" .
Go to setting > find mail->mail template in the left side bar > click new template  chose a code once done you can use this tempalte to send email from dynamic page.
Mail::sendTo($to, 'template.code', $params);


text:
Q: Why did a moderator convert my accepted answer to a comment? A moderator just converted my accepted answer to a comment. Why was my accepted answer converted to a comment?

Screenshot of the question:

I have edited my answer, but now I am not able to flag it as undeleted. Why?

A: I think we need to start being more circumspect in removing link-only answers.  Sure, if the question is JavaScript: How can I use apply to call function f, passing the arguments of the current function over and you just provide a link to some blog post that shows how to do that, then you deserve the deletion that's coming.
But this question was asking for an API.  The answer provided an API.  I'm guessing it was a good api, since it got 3 upvotes.  It was very nice of the other answerer to provide a link to another api, and also give some commentary on how to use it, but I don't think that should be a requirement.
If I ask a question looking for an api to run dynamic queries in linq, and someone gives me a link to the dynamic linq api, then golden— +1 and accept.  My question is now answered.  I don't expect him to also give me commentary on how to use it.  It's my job to learn the tool, and if I get stuck, I'll ask a new question.

A: If a question can be answered by just a link then it's most likely symptomatic of a low quality question with little research beforehand. Stack Overflow should not become just a collection of links and awarding reputation from what's basically just a Google search seems a little perverse.
In the general case there's always scope to elaborate on a link, even a link to an API. A synopsis of the API in question for example, or a summary of the problems it solves (and can't solve) in relation to the question. If there's not enough meat to the question to make that possible then it's a bad question.

A: As the moderator that converted it to a comment, here's what happened:
The flag for "not an answer" was applied to your "answer", not the question, not other answers (at least, not that I've seen in the flag queue as of yet).  At the time, I was looking specifically at your answer (in addition to the rest of the post).
As others have commented (and I believe they are correct and I used this exact reasoning when approaching this situation), upvotes and accepted "answers" don't validate posts which really aren't answers.
The points about whether or not a question is a real question have merit, and it will be looked at.  However, moderators are encouraged on Stack Overflow (and some of the higher volume sites) to not hunt for content, but work primarily off the flag queue, so it's not guaranteed whether or not the question will be looked at in this light (although it more than likely will be now since you brought it's attention to meta, which pretty much has the effect of flagging the entire post in an indirect way).
With that in mind, even if the post is closed, it doesn't in any way validate that what you provided was nothing more than two links, and not an answer.
Was it helpful to the poster?  Yes.
Was it an answer that contributed to the overall quality of the site and by extension, the Internet (as per the mission statement of Stack Exchange)?  Absolutely not.
I think you'll also see by many of the comments that they agree.
In those cases, it's more often than not an indicator that the information should be placed in a comment, which is exactly what was done.
Also, it should be noted that your current edit is truly questionable, in the sense that it's nothing more than a copy-and-paste of the manual.  We prefer to have users put some effort into providing an answer and discourage copy-paste answers.

A: You should read this question.

A: Generally, people frown on link-only answers for the reasons others have better described here. Many of these get flagged as not being real answers, and some get deleted or converted to comments.
Your answers were better than the typical ones I see (which often just consist of something like "check this link I think it help u"), and the whole point is to link to the FMDB framework, but they could have been fleshed out a little bit. If nothing else, this would help someone in the future to find replacement links to the project, should the ones you provided go dead.
I'd suggest re-posting an answer worded something like the following:

Gus Mueller has created an Objective-C wrapper for interfacing with
  SQLite, called FMDB. The latest code for this can be obtained from
  Github. This might be a simpler way to provide your data to SQLite
  than via the raw C API.
Brandon Treb has written a brief tutorial on the use of FMDB,
  showing off the framework in action.

This gives a little more context on what FMDB is, why they might want to use it, and where they could find out more about it.
To be honest, though, I'd vote for the other answer there because Core Data really is the way to go for storing data on iOS, and can save a tremendous amount of code over raw SQLite.  However, Gus just updated his FMDB to a 2.0 version, and it can be useful for certain applications.


text:
Q: Get data belongs to a field of model in select_related to a list and create a dataframe I'm trying to query two related tables and create a pandas dataframe then use it for rule mining. The dataframe should look like this,
order   products
----------------
1       ['product1', 'product2']
2       ['product1', 'product3', 'product10']
...

My models,
class Order(models.Model):

    user = models.ForeignKey(User, on_delete=models.CASCADE)
    product = models.ManyToManyField(Product, through='OrderedProduct', related_name='orders')

class OrderedProduct(models.Model):

    order = models.ForeignKey(Order, on_delete=models.CASCADE)
    product = models.ForeignKey(Product, on_delete=models.DO_NOTHING)
    quantity = models.IntegerField(default=1)

class Product(models.Model):

    name = models.CharField(max_length=255)
    price = models.DecimalField(max_digits=10, decimal_places=2)

I've done the dataframe creating part as follows in views, and it works but needs preprocessing to get end result and feels it's inefficient for a larger dataset.
orders = OrderedProduct.objects.all().values('order__id', 'product__name')

df = pd.DataFrame.from_records(orders)
df = df.groupby(['order__id'])['product__name'].apply(list).to_list()

So, my question is 'Is there a more direct and efficient approach to do this?'. Any advice is highly appreciated.

A: Use something similar to this, i guess it has a better performanc:
OrderedProduct.objects.raw('SELECT order__id, GROUP_CONCAT(product__name) FROM myapp_OrderedProduct GROUP BY order__id')


text:
Q: Where's the Network Traffic Tool in Visual Studio 2019 According to this question (How to view network traffic in Visual Studio), in VS 2017, there was a network tool where you can see traffic.
I can't seem to find it on VS 2019. Has it been removed or moved to a different location?
I am using VS2019 Community Edition.

A: Answer on Github says the following:

The version selector indicates it's VS 2017 only. There's a banner comment when you switch to the VS 2019 view. This tool isn't available in VS 2019.


text:
Q: Prevent a directory listed in gallery app I am working on a chat application where I am sending/receiving Images/ Media. I am writing those files in a directory both sent and received.
Now the problem is if I send an image from gallery in chat I am copying it into Sdcardpath + AppName/Images/Sent/.
I this case the images in sent folder are duplicate.
And gallery app is Showing Sent folder with images. I need a way so that gallery cannot read the SentFolder. Below is my code for creating directory.
 public static File getImageSentDirectory() {
    String state = Environment.getExternalStorageState();
    if (Environment.MEDIA_MOUNTED.equals(state)) {
        File dir = new File(Environment.getExternalStorageDirectory() + DOCUMENT_FILE_SENT_PATH);
        if (!dir.exists())
            dir.mkdirs();
        return dir;
    } else {
        File dir = new File(getAppContext().getFilesDir() + DOCUMENT_FILE_SENT_PATH);
        if (!dir.exists())
            dir.mkdirs();
        return dir;
    }
}

I also tried .
dir.setWritable(true,true);
dir.setReadable(true,true);

But on restart device gallery app is showing the sent folder with images .

A: Add a .nomedia file in your "Sent" directory.
This will make the "Gallery" app skip your folder and thus it won't be listed.
The .nomedia file is like this inside WhatsApp media directory. It is a zero byte file.

A:
I need a way so that galery can not read the SentFolder.

Do not put SentFolder on external storage. Put it on internal storage.
The .nomedia suggestion may help, but it is a convention, not a rule. Any app that has read access to external storage can get to any files you put on external storage. If you do not want that, do not put the files on external storage.


text:
Q: Create and custom UITextfield inside Alertview in swift I'm trying to create a large size textfield inside an alert view with a limit of 100 characters programatically. Here is my code:
func alertWithTF() {
        let alert = UIAlertController(title: Constants.cancelPopupTitle,
                                      message: Constants.cancelPopupMessage,
                                      preferredStyle: .alert)
        alert.addTextField { (textField) in
            textField.frame = CGRect(x: 20, y: 100, width: 300, height: 80)
            textField.placeholder = "Please enter message"
            textField.borderStyle = UITextField.BorderStyle.line
            textField.contentVerticalAlignment = UIControl.ContentVerticalAlignment.center
        }
        alert.addAction(UIAlertAction(title: "OK", style: .default, handler: { [weak alert] (_) in
            guard let textfield = alert?.textFields?.first else { return }
            let message = textfield.text ?? ""
            print(message)
        }))
        alert.addAction(UIAlertAction(title: "Cancel", style: .cancel))
        self.present(alert, animated: true, completion: nil)
}

Here is my problems:

*

*I wanted to modify textfield height by edit its frame but it seem not working.

*I also want to set the limit characters of textfield <= 100 but i wasn't able to find a way.

Is there any posible solutions that i can use? Thank for helping me.

A: *

*UIAlertController is non-customizable. You can create your own alertViewController for this case and then play with UI however you want.

*In your addTextfield, provide delegate to self
  alert.addTextField { (textField) in

    textField.frame = CGRect(x: 20, y: 100, width: 300, height: 80)
    textField.placeholder = "Please enter message"
    textField.borderStyle = UITextField.BorderStyle.line
    textField.delegate = self
    textField.contentVerticalAlignment = UIControl.ContentVerticalAlignment.center
}

And the you can use shouldChangeCharactersIn method to limit the length
func textField(_ textField: UITextField, shouldChangeCharactersIn range: NSRange, replacementString string: String) -> Bool {
let maxLimit = 180
let currentString = textField.text!
let newString: String =
    currentString.replacingCharacters(in: range, with: string) as String
return newString.length <= maxLength
}

make sure your ViewController conforms to UITextFieldDelegate.
class YourViewController: UIViewController, UITextFieldDelegate {

}

A: alert.addTextField { textField in
    let heightConstraint = NSLayoutConstraint(item: textField, attribute: .height, relatedBy: .equal, toItem: nil, attribute: .notAnAttribute, multiplier: 1, constant: 100)
    textField.addConstraint(heightConstraint)
}

A: So after several research my self, i have managed to implement this:
extension ViewController: UITextViewDelegate {
    func alertWithTF() {
        let alert = UIAlertController(title: "Title",
                                      message: "\n\n\n\n\n",
                                      preferredStyle: .alert)
        let textView = UITextView()
        textView.borderColor = .black
        textView.borderWidth = 1.0
        textView.delegate = self
        textView.text = Constants.textViewPlaceholder
        textView.textColor = .lightGray
        alert.view.addSubview(textView)

        textView.translatesAutoresizingMaskIntoConstraints = false
        textView.topAnchor.constraint(equalTo: alert.view.topAnchor, constant: 125).isActive = true
        textView.rightAnchor.constraint(equalTo: alert.view.rightAnchor, constant: -20).isActive = true
        textView.leftAnchor.constraint(equalTo: alert.view.leftAnchor, constant: 20).isActive = true
        textView.bottomAnchor.constraint(equalTo: alert.view.bottomAnchor, constant: -60).isActive = true
        textView.heightAnchor.constraint(equalToConstant: 60).isActive = true

        alert.view.translatesAutoresizingMaskIntoConstraints = false

        alert.addAction(UIAlertAction(title: "Cancel", style: .default, handler: { [weak self] (_) in
            self?.dismiss(animated: true, completion: nil)
        }))

        alert.addAction(UIAlertAction(title: "OK", style: .default, handler: { [weak self] (_) in
            let message = (textView.text == nil||textView.text == Constants.textViewPlaceholder ? "" : textView.text)
            print(message)
        }))

        self.present(alert, animated: true, completion: nil)
    }

So i created a TextView instead of TextField and setup constraint for it inside alertView. These code was not perfect but it worked well. Also i used TextView delegate to handle textView characters limit anf placeholder since UITextView do not support it:
func textView(_ textView: UITextView, shouldChangeTextIn range: NSRange, replacementText text: String) -> Bool {
        let newText = (textView.text as NSString).replacingCharacters(in: range, with: text)
        let numberOfChars = newText.count
        return numberOfChars < 101 //Max 100 chars
    }

    func textViewDidBeginEditing(_ textView: UITextView) {
        if textView.textColor == UIColor.lightGray {
            textView.text = ""
            textView.textColor = UIColor.black
        }
    }

    func textViewDidEndEditing(_ textView: UITextView) {
        if textView.text == "" {
            textView.text = Constants.textViewPlaceholder
            textView.textColor = UIColor.lightGray
        }
    }

Hope this is helpful!


text:
Q: How to get outputs with specific names I'm trying to edit some text files at once with perl. So I have a folder "input" where I put my input text files, and I have a folder "output" where I get the text files edited. So my script starts like (I only copy the beginning):
use strict;
use warnings;

opendir IN, 'input';
my @in = grep { /^[^.]/ } readdir IN;
closedir IN;

for my $in (@in) {
open IN, '<', "input/$in" || next;
open OUT, '>', "output/$in" || die "can't open file output/$in";

My input text files are named TH0001_file.txt, TH0002_file.txt, ...
I would want that my output text files be named TH0001_edited.txt, TH0002_edited.txt, ....
But I do not know how to edit my perl to get that. Of course, I can use the "rename" command once I get the output to rename my files, but I would like to know how to do that in perl. Someone can help me? Thanks

A: You could use the following code as a starting point:
#!/usr/bin/perl

use warnings;
use strict;

foreach my $in_file (<input/*.txt>) {
    print "input file name: $in_file\n";
    if ($in_file =~ m/\/([^_]+)_file.txt$/) {
        my $out_file = "output/$1_edited.txt";
        print "output file name: $out_file\n";
    }
}


text:
Q: Using Azure blob storage with .NET Hi I am trying to learn how to work with Azure and .Net .
I built a simple "Hello World" webApp and created a Blob Storage with a table that has 3 email addresses (the webApp and the blob storage are under the same subscription of course)
All I want to do is to show this 3 email addresses when I run the website. i.e take this list of addresses from the table in the blob storage and render it over the website.
I have no idea where to start and the Microsoft tutorials did not help much.
Inside my solution explorer under the WebApp, there is a folder "Controllers". My intuition is to open a new class there but again I have no clue of how to start.

A: It's very simple if you follow this doc.
I have a demo as below:
1.In visual studio -> Nuget Package Manager, install the latest version of WindowsAzure.ConfigurationManager and WindowsAzure.Storage
2.In the web.config -> appsettings node, add <add key="StorageConnectionString" value="your storage account string" />:

3.In your asp.net web project, add a custom class derived from TableEntity:
public class CustomerEntity : TableEntity
{
    public CustomerEntity(string lastName, string firstName)
    {
        this.PartitionKey = lastName;
        this.RowKey = firstName;
    }

    public CustomerEntity() { }

    public string Email { get; set; }

    public string PhoneNumber { get; set; }
}

4.Then in your controller, add the following code(I add the code in Contact method):
       using System.Web.Mvc;

       using Microsoft.Azure;

       using Microsoft.WindowsAzure.Storage;

       using Microsoft.WindowsAzure.Storage.Table;

        public ActionResult Contact()
        {
            //define the emails to output in web page
            string emails = "";

            // Retrieve the storage account from the connection string.

            CloudStorageAccount storageAccount = CloudStorageAccount.Parse(

                CloudConfigurationManager.GetSetting("StorageConnectionString"));

            // Create the table client.

            CloudTableClient tableClient = storageAccount.CreateCloudTableClient();

            // Create the CloudTable object that represents the "people" table.

            CloudTable table = tableClient.GetTableReference("people");

            TableQuery<CustomerEntity> query = new TableQuery<CustomerEntity>();

            foreach (CustomerEntity entity in table.ExecuteQuery(query))
            {

                    emails += entity.Email+";";

            }

            ViewBag.Message = "Your contact page."+emails;

            return View();
        }

*My azure table and the test result:

all the email addresses are displayed in web page:


text:
Q: No assembly found containing a Startup or [AssemblyName].Startup class I've tried resolving this from answers in other and similar posts, but no luck.
I'm Using MVC 5, framework 4.8 latest VS2017.
Thanks
My Config is:  (including other attempts)
<configuration>
    <appSettings>
        <!--<add key="owin:AutomaticAppStartup" value="false" />-->
        <add key="owin:HandleAllRequests" value="true"/>
        <!--<add key="owin:AppStartup" value="Api.xxx" />-->
    </appSettings>
</configuration>

Startup class is:
[assembly: OwinStartupAttribute(typeof(Api.xxx.Startup))]
namespace Api.xxx
{
    public class Startup
    {
        public void Configuration(IAppBuilder app)
        {
            // Allow all origins
            app.UseCors(Microsoft.Owin.Cors.CorsOptions.AllowAll);
            ….
        }
    }
}

and Api is:
namespace Api.xxx
{
    [Route("values")]
    public class ValuesController : ApiController
    {
        private static readonly Random _random = new Random();

        public IEnumerable<string> Get()
        {
            var random = new Random();
            return new[]
            {
                _random.Next(0, 10).ToString(),
                _random.Next(0, 10).ToString()
            };
        }
    }
}

A: I think you need to change
[assembly: OwinStartupAttribute(typeof(Api.xxx.Startup))]
to
[assembly: OwinStartup(typeof(Api.xxx.Startup))]
Reference: https://learn.microsoft.com/en-us/aspnet/aspnet/overview/owin-and-katana/owin-startup-class-detection


text:
Q: Queries slow when run by specific Windows account Running SQL Server 2014 Express on our domain. We use Windows Authentication to log on. All queries are performed in stored procedures.
Now, the system runs fine for all our users - except one. When he logs on (using our software), all queries take around 10 times longer (e.g. 30 ms instead of 2 ms). The queries are identical, the database is the same, the network speed is the same, the operative system is the same, the SQL Server drivers are the same, connection pooling is the same, DNS is the same. Changing computer does not help. The problem seems to be linked to the account being used.
What on Earth may be the cause for this huge performance hit?
Please advise!

A: I would try rebuilding the SP (by running an ALTER statement that duplicates its existing structure) to force SQL Server to recompile. I don't know every way SQL Server caches things but it can definitely create distinct execution plans for different types of connections so I wouldn't be surprised if your slow user is running a version with an inefficient execution plan.
http://www.sommarskog.se/query-plan-mysteries.html


text:
Q: Change Asterisk chan_mobile packets size When call is made between two chan_mobile channels, all works fine.
But not when call is established between SIP and chan_mobile (through simple bridge).

SIP -> mobile is clear and fine with controllable packet size in sip.conf
Reverse direction voice going in too small packets causing near 180 kbits/s and loosing packets because of out of order on SIP phone side (if not enabled permissive mode on RTP).

So question is how to increase packets size originated by chan_mobile and going to SIP?
Setting like
allow=ulaw:100

not works in chan_mobile.conf

A: Chan mobile to chan_sip connection is via sln internal bridge ALWAYS.
You can control only outgoing packets(from your server sip to remote sip) by set
allow=g729:20

Or similar form. Please note, that codec should support length of packet you asking.
You have no any way control other side, so no way control inbound direction.
For more info see https://wiki.asterisk.org/wiki/display/AST/RTP+Packetization


text:
Q: Make UIImageView Go Up Then Down Swift I need to make a UIImageView animate up when the screen is tapped then back down when it hits the top.
This is the code I have got at the moment:
    override func touchesBegan(touches: NSSet!, withEvent event: UIEvent!) {
        if (CGRectIntersectsRect(self.playerImagePhone.frame, self.floorImagePhone.frame)) {
            UIView.animateWithDuration(0.4) {
                self.playerImagePhone.center = CGPointMake(self.playerImagePhone.center.x, self.playerImagePhone.center.y - 50)
                println("player jumped")
            }
        }
}

    override func touchesEnded(touches: NSSet!, withEvent event: UIEvent!) {
        UIView.animateWithDuration(0.4) {
            self.playerImagePhone.center = CGPointMake(self.playerImagePhone.center.x, self.playerImagePhone.center.y + 50)
            println("player jumped")
    }
}

This code is working to make it go up then back down but the problem is that it allows the user to hold their finger on the screen and the image will stay up. How can I make it go down as soon as the image is finished going up?
Thanks

A: touchesBegan can be called often... it probably isn't  a good idea to perform your animations in there. You'll probably want to update a seperate object maintaining the animation, then once the animation is done (once the duration is over) you run another animation to bring the image back down.
As an alternative you can use also use animateWithDuration:animations:completion: and calling the down animation within the completion block.