text:
Q: Nfs Hanged suddenly not able to restart service Nfs Hanged suddenly ! Not able to even restart service  :
# /etc/init.d/nfs-kernel-server restart
 * Stopping NFS kernel daemon                                                                                [ OK ]
 * Unexporting directories for NFS kernel daemon...                                                                            [ OK ]
 * Exporting directories for NFS kernel daemon...                                                                              [ OK ]
 * Starting NFS kernel daemon                                                                                ^C

Syslogs says nfs is blocked for more than 120sec. How to understand the logs ? what has gone wrong here ?
# cat  /var/log/syslog | grep nfs
Sep  4 10:02:11 InksedgeDev kernel: [2427120.248354] INFO: task nfsd:2318 blocked for more than 120 seconds.
Sep  4 10:02:11 InksedgeDev kernel: [2427120.248363] nfsd            D 0000000000000000     0  2318      2 0x00000000
Sep  4 10:02:11 InksedgeDev kernel: [2427120.248406]  [<ffffffffa02a28c0>] ? nfsd_proc_getattr+0xa0/0xa0 [nfsd]
Sep  4 10:02:11 InksedgeDev kernel: [2427120.248418]  [<ffffffffa02a3c11>] nfsd_vfs_write.isra.13+0x81/0x3b0 [nfsd]
Sep  4 10:02:11 InksedgeDev kernel: [2427120.248422]  [<ffffffffa02bf691>] ? lookup_clientid+0x51/0x80 [nfsd]
Sep  4 10:02:11 InksedgeDev kernel: [2427120.248426]  [<ffffffffa02bf766>] ? nfsd4_lookup_stateid+0xa6/0xc0 [nfsd]
Sep  4 10:02:11 InksedgeDev kernel: [2427120.248429]  [<ffffffffa02a7773>] nfsd_write+0x93/0x110 [nfsd]
Sep  4 10:02:11 InksedgeDev kernel: [2427120.248433]  [<ffffffffa02b2281>] nfsd4_write+0x1b1/0x250 [nfsd]
Sep  4 10:02:11 InksedgeDev kernel: [2427120.248437]  [<ffffffffa02b35ca>] nfsd4_proc_compound+0x56a/0x7c0 [nfsd]
Sep  4 10:02:11 InksedgeDev kernel: [2427120.248440]  [<ffffffffa029fd2b>] nfsd_dispatch+0xbb/0x200 [nfsd]
Sep  4 10:02:11 InksedgeDev kernel: [2427120.248455]  [<ffffffffa029f71f>] nfsd+0xbf/0x130 [nfsd]
Sep  4 10:02:11 InksedgeDev kernel: [2427120.248458]  [<ffffffffa029f660>] ? nfsd_destroy+0x80/0x80 [nfsd]

Output of Iostat :
# iostat 5 5
Linux 3.13.0-29-generic (InksedgeDev)   09/04/2015  _x86_64_    (2 CPU)

avg-cpu:  %user   %nice %system %iowait  %steal   %idle
           5.68    0.00    0.48    0.25    0.01   93.58

Device:            tps    kB_read/s    kB_wrtn/s    kB_read    kB_wrtn
xvdap1            3.63        15.71        82.80   38138709  201066916
xvdb              0.01         0.05         0.01     119271      15231
xvdc              0.01         0.05         0.01     112329      14600
xvdf              4.25       155.14       175.05  376748353  425087092
md0               0.02         0.10         0.01     231288      29831

avg-cpu:  %user   %nice %system %iowait  %steal   %idle
           0.30    0.00    0.20   49.75    0.00   49.75

Device:            tps    kB_read/s    kB_wrtn/s    kB_read    kB_wrtn
xvdap1            0.00         0.00         0.00          0          0
xvdb              0.00         0.00         0.00          0          0
xvdc              0.00         0.00         0.00          0          0
xvdf              0.00         0.00         0.00          0          0
md0               0.00         0.00         0.00          0          0

What might be the reason ? how to troubleshoot ?


text:
Q: Generate url with different locale in Symfony2 I have a controller with a redirect like this:
return $this->redirect(
        $this->generateUrl(
            'my_route',
            array(
                'stuff1' => $stuff1,
                'stuff2' => $stuff2,
            )
        )
    );

The route controller has the route defined for various languages:
my_route:
    locales:  { en: "/{stuff1}/{stuff2}", es: "/{stuff1}/{stuff2}" }
    defaults: { _controller: myBundle:Controller:my_route}

It always redirects to 'en'. How can I force to redirect it to 'es'?

A: Use:
return $this->redirect(
    $this->generateUrl(
        'my_route',
        array(
            'stuff1' => $stuff1,
            'stuff2' => $stuff2,
            '_locale' => 'es',
        )
    )
);

redpajama_set_name: RedPajamaStackExchange


text:
Q: Add ONLY checked items from a checklistbox to a listView control My situation:
I have a populated checklistbox control on Form1.
Then I have a listView control on Form2.
I would like for the user to be able to check items on the checklistbox on Form1, then click on a button on Form1 to open Form2.
Form2 contains the listView control, that I want to populate with only the checked items from checklistbox on Form1.
I tried
namespace Boodschappenlijst
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

    public static string[] strKruideniersw = new string[] { Boodschappenlijst.producten[0], Boodschappenlijst.producten[1], Boodschappenlijst.producten[2] };
    public static string[] strVerswaren = new string[] { Boodschappenlijst.producten[3], Boodschappenlijst.producten[4], Boodschappenlijst.producten[5] };
    public static string[] strVerzorgingspr = new string[] { Boodschappenlijst.producten[6], Boodschappenlijst.producten[7], Boodschappenlijst.producten[8], Boodschappenlijst.producten[9] };

    public static List<string> kruidenierswList = new List<string>(strKruideniersw);
    public static List<string> verswarenList = new List<string>(strVerswaren);
    public static List<string> verzproductenList = new List<string>(strVerzorgingspr);

    public static string[] strKruidenierswCh;

    public void Form1_Load(object sender, EventArgs e)
    {
        clbKruidenierswaren.Items.AddRange(strKruideniersw);
        clbVerswaren.Items.AddRange(strVerswaren);
        clbVerzproducten.Items.AddRange(strVerzorgingspr);
        strKruidenierswCh = clbKruidenierswaren.CheckedItems;
    }

    // TODO
    // public string kruidenierswChecked = clbKruidenierswaren.CheckedItems;

    private void button1_Click(object sender, EventArgs e)
    {
        // Create a new instance of the Form2 class
        Form2 form2 = new Form2();

        // Show the settings form
        form2.Show();
    }
}

public abstract class Boodschappenlijst : Form1
{
    public static string[] producten = new string[] { "Peper", "Zout", "Kruidnagel", "Sla", "Komkommer", "Tomaten", "Tandpasta", "Shampoo", "Wax", "Deodorant" };

    // Not working.. clbKruidenierswaren is not static.
    List<string> items = clbKruidenierswaren.CheckedItems.Cast<string>().ToList();

    // Make form1 controls accessible for other classes?
    // Form1 form1 = Application.OpenForms.OfType<Form1>().FirstOrDefault();

}
}

but the I get the error

A field initializer cannot reference the non-static field, method, or property 'Form1.clbKruidenierswaren'.

Can you please direct me to a solution that works?

A: The problem is you're passing UI objects around, you should be passing data around instead.  Here's an example of a Form that can be given data during construction.
public class BaseForm : Form
{
    public object InitialisationData { get; set; }
}

public partial class MagicForm : BaseForm
{
    public string MyBindableGuy;

    public MagicForm()
    {
        InitializeComponent();

        MyBindableGuy = InitialisationData as string;
    }
}

and open it with:
var myForm = new MagicForm();
myForm.InitialisationData = "Hi, I'm a string.";
myForm.Show();

A: You should make a constructor in the class like this:
Class itself:
public class Boodschappenlijst
{
    public static string[] producten { get; set; } = new string[] { "Peper", "Zout", "Kruidnagel", "Sla", "Komkommer", "Tomaten", "Tandpasta", "Shampoo", "Wax", "Deodorant" };
    private List<string> Items { get; set; }

    public Boodschappenlijst(List<string> items)// << Constructor
    {
        Items = items;
    }
}

And then make an instance the class like so:
On the place (Form?) you have clbKruidenierswaren:
Boodschappenlijst boodschappenLijst =
           new Boodschappenlijst(clbKruidenierswaren.CheckedItems.Cast<string>().ToList());

A: public partial class Form1 : Form
{
    // Todo declare the variables
    private List<string> kruidenierswList;
    private List<string> verswarenList;
    private List<string> verzproductenList;

    public Form1()
    {
        InitializeComponent();

        // call the instance once and add that to the variable lijst
        Boodschappenlijst lijst = Boodschappenlijst.Instance; // <- @ others on S/O this is just used as information I know I could do a new as well.

        // initialize the variables
        kruidenierswList = new List<string>() { lijst.Products[0], lijst.Products[1], lijst.Products[2] };
        verswarenList = new List<string>() { lijst.Products[3], lijst.Products[4], lijst.Products[5] };
        verzproductenList = new List<string>() { lijst.Products[6], lijst.Products[7], lijst.Products[8], lijst.Products[9] };
    }

    public void Form1_Load(object sender, EventArgs e)
    {
        // populate the checklist boxes
        clbKruidenierswaren.Items.AddRange(kruidenierswList.ToArray());
        clbVerswaren.Items.AddRange(verswarenList.ToArray());
        clbVerzproducten.Items.AddRange(verzproductenList.ToArray());
    }

    private void button1_Click(object sender, EventArgs e)
    {
        // Create a new instance of the Form2 class
        Form2 form2 = new Form2();

        // Show the settings form
        form2.Show();
    }
}

public class Boodschappenlijst
{
    private static Boodschappenlijst instance;

    public string[] Products
    {
        get;
        private set;
    }

    private Boodschappenlijst()
    {
        Products = new string[] { "Peper", "Zout", "Kruidnagel", "Sla", "Komkommer", "Tomaten", "Tandpasta", "Shampoo", "Wax", "Deodorant" };
    }

    public static Boodschappenlijst Instance
    {
        get
        {
            // singleton initialization => look for design pattern - singleton  <- Design patterns can brighten your day.
            //
            return instance == null ? instance = new Boodschappenlijst() : instance;
        }
    }
}


text:
Q: callback invalid in wcf service I have a win forms client that accesses a wcf service for a long running operation. The service exposes subscribe and unsubscribe methods. When a client calls the subscribe method, service generates new guid for it and gets the current callback context, saves this guid and callback context in a client Dictionary and returns the Guid. On user request, client call service with this guid to start the long operation. Once the service finishes the operation it gives a callback to the client. the client then retrieves the processed data from the service.
The error I get sometimes when doing a callback is

The operation 'OnServiceCallback' could not be completed because the sessionful channel timed out waiting to receive a message.  To increase the timeout, either set the receiveTimeout property on the binding in your configuration file, or set the ReceiveTimeout property on the Binding directly.

The part that I am not able to understand is that this happens very inconsistently. Most of the times it happens after the client and the service have been running for some time.
I am a beginner in wcf service and welcome any suggestions to solve this error.

A: Binding has property called receiveTimeout. This property is by default set to 10 minutes. It defines how long does the service instance wait for next request before it is terminated. So if there is no activity between client and service within 10 minutes your service instance is closed and client can't use it any more. In duplex service it can be even more complicated because there are services on both sides. You will probably need to configure receiveTimeout on both ends.

A: I was able to figure the answer to the error by doing some good old trial and error. The callback was failing because the OperationContext.Current object that I was trying to use was null. This was because I was trying to access the OperationContext.Current object on a thread which was different from the service thread. So to solve that I am now accessing the OperationContext.Current object in the service thread and then passing the callbackContext as a parameter to the external processing logic which actually needs to use it.


text:
Q: Finding datetime object in pandas df column I have the following code, where I want to determine if a datetime object exists in a data frame.
Here is the code:
df_grid['Date'] = pd.to_datetime(df_grid['Date'])
start_date = df_grid['Date'].iloc[0].date()
end_date = df_grid['Date'].iloc[-1].date()
current_date = start_date

while current_date < end_date:
    current_date += datetime.timedelta(days=1)
    print(current_date)
    if current_date in df_grid['Date']: continue
    print('not in')

And here is what the dataframe column looks like:
Date
2021-11-01
2021-11-01
2021-11-01
2021-11-02
2021-11-02
2021-11-03
2021-11-03
...

Most of the dates do exist in the column; however, when I run the code, it indicates that none of the dates exist in the dataframe column. I've tried matching with and without .date() and get the same results.

A: Well, this is what I ended up doing to identify missing dates in the dateframe
    while current_date < end_date:
        missing = True
        for row in df_grid.index:
            if current_date == df_grid['Date'].iloc[row]:
                missing = False
                break
        if missing == True:
            [code to execute when date is missing]
        current_date += datetime.timedelta(days=1)

Seems a lot more inefficient than what I originally tried to do, but at least this works.


text:
Q: In Nginx, should I tune worker_processes to CPU cores or CPUs? I'm confused from the articles I read.
Should I set the amount of worker_processes in Nginx to:
Amount of CPUs (grep processor /proc/cpuinfo | wc -l displays 2)
or to the amount of CPU cores? (nproc displays 8)
Thanks.

A: Read the fine manual

The optimal value depends on many factors including (but not limited
  to) the number of CPU cores, the number of hard disk drives that store
  data, and load pattern. When one is in doubt, setting it to the number
  of available CPU cores would be a good start (the value "auto" will
  try to autodetect it).

However, that assumes that there is no other processing on the server. If you were also running other processes on that server then you should probably reserve CPUs for those processes.
There's also probably a very real probability in diminishing returns for assigning 8 cores to Nginx. You be better off setting it to only 4, and then only increasing it if you can identify a need to have more worker processes running.


text:
Q: Using Redis and Laravel with a Password I've got an app written using Laravel. I've been using Redis when developing locally. I've now moved my project onto AppFog which has a redis service running. It seems though that they require a password (which is supplied), but I'm not sure how to add a password to the redis config in database.php.
When I try to use redis without the password I get "Redis error:  operation not permitted". A quick look and it seems that's what happens when a password isn't supplied.
Anyone know how to supply a password when connecting to a Redis DB using Laravel?

A: In case anyone with the same problem. Here is the code to enable laravel redis connection with password.
https://gist.github.com/bslima/6207163

A: It doesn't appear Laravel has a method for doing this in the manner you mention. However, it would seem you should be able to use the run method to execute the redis auth command just as you would any other method. You would do this after creating the connection.
Redis doesn't authenticate when connecting, it implements a command to handle authentication as documented at http://redis.io/commands/auth
As for storing the password in the config file, it would also likely be a matter of adding a variable to the config and referencing it as you would any other config variable.


text:
Q: d3.js zoom+pan center changed I am learning d3.js, and I found this example. I have made a few changes, nothing fancy. However, I wanted to add a zoom to it, and that caused a lot of trouble.
Here is what I have so far (code is also available below): https://fiddle.jshell.net/4w65nbq9/3/
(see comments for what I did and want to do)
I am using this method to zoom and pan:
.call(d3.behavior.zoom().on("zoom", function () {
        svg.attr("transform", "translate(" + d3.event.translate[0] + "," + d3.event.translate[1] + ")" + " scale(" + d3.event.scale + ")")}))

It works great, however when I first used the zoom or pan, the whole svg would center back to the (0,0) coordinates.
I found out that the below attribute was responsible for centering the svg in the first place (see comments for changes I made or want to make):
.attr("transform", "translate(" + radius*1.5 + "," + radius + ")")

So when I'd zoom, this part of the code would be voided, and the center would become (0,0).
I then used this code snippet, but put it on the "Links" part of the svg, which would center the links part, and not recenter wrongly after zoom.
What I want to do now, is to center the text the same way (they are generated in the "nodes" section. There is an attribute that generates the placement of each text.
My question is how can I center the texts aswell, so the zoom/pan works correctly, or how can I make the svg not recenter at (0,0). If this method of zooming/panel doesn't work, which one should I use (I want infinite zoom/dezoom, not a max/min).
Here is the same code, but with the links recentered, and the texts not centered: https://fiddle.jshell.net/hanjcupg/1/
The below code has had its style removed to make it shorter (see comments):
<!DOCTYPE html>
<meta charset="utf-8">
<body>
<script src="https://d3js.org/d3.v3.min.js" charset="utf-8"></script>
<script>

var file = "https://gist.githubusercontent.com/mbostock/1044242/raw/8f22cf2264e1f6ec6cb233c4b49333fb8f75bb99/readme-flare-imports.json",
    fileinternet = "https://gist.githubusercontent.com/mbostock/1044242/raw/8f22cf2264e1f6ec6cb233c4b49333fb8f75bb99/readme-flare-imports.json",
    fileregular = "data.json",
    isLineActive = false,
    //originally 0.85
    tension = 0.85,
    //originally 960
    diameter = 900,
    radius = diameter / 2,
    innerRadius = radius - 120;

var cluster = d3.layout.cluster()
    .size([360, innerRadius])
    .sort(null)
    .value(function(d) { return d.size; });

var bundle = d3.layout.bundle();

var line = d3.svg.line.radial()
    .interpolate("bundle")
    .tension(tension)
    .radius(function(d) { return d.y; })
    .angle(function(d) { return d.x / 180 * Math.PI; });

var svg = d3.select("body").append("svg")
    .attr("width", diameter*1.5)
    .attr("height", diameter)
    .attr("style", "outline: thin solid grey;")
    .call(d3.behavior.zoom().on("zoom", function () {
        svg.attr("transform", "translate(" + d3.event.translate[0] + "," + d3.event.translate[1] + ")" + " scale(" + d3.event.scale + ")")
      }))
  .append("g")
    /*.attr("transform", "translate(" + radius*1.5 + "," + radius + ")")*/;

var link = svg.append("g").selectAll(".link"),
    node = svg.append("g").selectAll(".node");

d3.json(file, function(error, classes) {
  if (error) throw error;

  var nodes = cluster.nodes(packageHierarchy(classes)),
      links = packageImports(nodes);

  link = link
      .data(bundle(links))
    .enter().append("path")
      .each(function(d) { d.source = d[0], d.target = d[d.length - 1]; })
      .attr("class", "link")
      .attr("d", line)
      //added the transform here to center the links
      .attr("transform", "translate(" + radius*1.5 + "," + radius + ")");

  node = node
      .data(nodes.filter(function(n) { return !n.children; }))
      .attr("transform", "translate(" + radius*1.5 + "," + radius + ")")
    .enter().append("text")
      .attr("class", "node")
      .attr("dy", ".31em")
      //I suppose this is where I need to change the transform to somehow center the nodes, but keep the way it's generated
      .attr("transform", function(d) { return "rotate(" + (d.x - 90) + ")translate(" + (d.y + 8) + ",0)" + (d.x < 180 ? "" : "rotate(180)"); })
      .style("text-anchor", function(d) { return d.x < 180 ? "start" : "end"; })
      .text(function(d) { return d.key; })
      .on("click", mouseovered);
});

function mouseovered(d) {
  if (isLineActive) {
    link
      .classed("link--target", false)
      .classed("link--source", false);

    node
      .classed("node--target", false)
      .classed("node--source", false);
    isLineActive = false;
  }
  else {
    node
      .each(function(n) { n.target = n.source = false; });

    link
      .classed("link--target", function(l) { if (l.target === d) return l.source.source = true; })
      .classed("link--source", function(l) { if (l.source === d) return l.target.target = true; })
      .filter(function(l) { return l.target === d || l.source === d; })
      .each(function() { this.parentNode.appendChild(this); });

    node
      .classed("node--target", function(n) { return n.target; })
      .classed("node--source", function(n) { return n.source; });
  }

}

function mouseouted(d) {
  link
      .classed("link--target", false)
      .classed("link--source", false);

  node
      .classed("node--target", false)
      .classed("node--source", false);
}

d3.select(self.frameElement).style("height", diameter + "px");

function packageHierarchy(classes) {
  var map = {};

  function find(name, data) {
    var node = map[name], i;
    if (!node) {
      node = map[name] = data || {name: name, children: []};
      if (name.length) {
        node.parent = find(name.substring(0, i = name.lastIndexOf(".")));
        node.parent.children.push(node);
        node.key = name.substring(i + 1);
      }
    }
    return node;
  }

  classes.forEach(function(d) {
    find(d.name, d);
  });

  return map[""];
}

function packageImports(nodes) {
  var map = {},
      imports = [];

  // Compute a map from name to node.
  nodes.forEach(function(d) {
    map[d.name] = d;
  });

  nodes.forEach(function(d) {
    if (d.imports) d.imports.forEach(function(i) {
      imports.push({source: map[d.name], target: map[i]});
    });
  });

  return imports;
}

</script>
</body>

A: I found out what the problem was. The simple solution was to add an extra .append(g) after the svg transform like so:
var svg = d3.select("body").append("svg")
    .attr("width", diameter*1.5)
    .attr("height", diameter)
    .attr("style", "outline: thin solid grey;")
    .call(d3.behavior.zoom().on("zoom", function () {
        svg.attr("transform", "translate(" + d3.event.translate[0] + "," + d3.event.translate[1] + ")" + " scale(" + d3.event.scale + ")")
    }))
    .append("g")
        .attr("transform", "translate(" + radius*1.5 + "," + radius + ")")
    //this is the part that I added.
    .append("g")


text:
Q: Symfony ArrayCollection vs PersistentCollection As I understood when you query database by repository you get PersistentCollection and when your working with your entities you get ArrayCollection.
so consider I have one to many self referencing relation for my user entity.
and in my user entity I have a setChildren method which get ArrayCollection of users as argument .
<?php

namespace UserBundle\Entity;

use Abstracts\Entity\BaseModel;
use CertificateBundle\Entity\Certificate;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\ORM\Mapping as ORM;
use EducationBundle\Entity\Education;
use LanguageBundle\Entity\Language;
use PostBundle\Entity\Post;
use ProfileBundle\Entity\Company;
use RoleBundle\Entity\Role;
use SkillBundle\Entity\Skill;
use Symfony\Component\Security\Core\User\UserInterface;
use Symfony\Component\Validator\Constraints as Assert;
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;

/**
 * User
 *
 * @ORM\Table(name="users")
 * @ORM\Entity(repositoryClass="UserBundle\Repository\Entity\UserRepository")
 * @UniqueEntity("email")
 * @UniqueEntity("username")
 */
class User implements UserInterface
{

    use BaseModel;
    /**
     * @var int
     *
     * @ORM\Column(name="id", type="integer")
     * @ORM\Id
     * @ORM\GeneratedValue(strategy="AUTO")
     */
    private $id;

    /**
     * @var string
     *
     * @ORM\Column(name="type", type="string", columnDefinition="ENUM('merchant', 'company', 'customer') ")
     */
    private $type;

    /**
     * @ORM\Column(type="string", unique=true)
     * @Assert\NotBlank()
     */
    private $username;

    /**
     * @var string
     *
     * @ORM\Column(type="string", length=255)
     * @Assert\NotBlank()
     */
    private $email;

    /**
     * @var string
     * @ORM\Column(type="string", nullable=true)
     */
    private $avatar = null;
    /**
     * @var string
     * @ORM\Column(type="string", nullable=true)
     */
    private $cover = null;

    /**
     * @ORM\OneToMany(targetEntity="PostBundle\Entity\Post", mappedBy="user", orphanRemoval=true, cascade={"persist", "remove"})
     */
    private $posts;

    /**
     * @ORM\OneToMany(targetEntity="EducationBundle\Entity\Education" , mappedBy="user" , orphanRemoval=true, cascade={"persist", "remove"})
     */
    protected $educations;

    /**
     * @ORM\OneToMany(targetEntity="SkillBundle\Entity\SkillUser" , mappedBy="user" , orphanRemoval=true, cascade={"persist", "remove"})
     */
    protected $skills;

    /**
     * @ORM\OneToMany(targetEntity="LanguageBundle\Entity\LanguageUser" , mappedBy="user" , orphanRemoval=true, cascade={"persist", "remove"})
     */
    protected $languages;

    /**
     * @ORM\OneToMany(targetEntity="ResumeBundle\Entity\Resume" , mappedBy="user" , cascade={"all"})
     */
    protected $resumes;

    /**
     * @ORM\OneToMany(targetEntity="CertificateBundle\Entity\CertificateUser" , mappedBy="user" , orphanRemoval=true, cascade={"persist", "remove"})
     */
    protected $certificates;

    /**
     * @ORM\OneToOne(targetEntity="ProfileBundle\Entity\Company", mappedBy="user")
     */
    protected $company;

    /**
     * @ORM\OneToOne(targetEntity="ProfileBundle\Entity\Customer", mappedBy="user")
     */
    protected $customer;

    /**
     * @ORM\OneToOne(targetEntity="ProfileBundle\Entity\Merchant", mappedBy="user")
     */
    protected $merchant;

    /**
     * @var string
     * @Assert\NotBlank()
     * @Assert\Length(min=4)
     * @ORM\Column(name="password", type="string", length=255)
     *
     */
    private $password;

    /**
     * @ORM\ManyToMany(targetEntity="RoleBundle\Entity\Role", inversedBy="users", cascade={"persist"})
     * @ORM\JoinTable(name="user_role", joinColumns={@ORM\JoinColumn(name="user_id", referencedColumnName="id")}, inverseJoinColumns={@ORM\JoinColumn(name="role_id", referencedColumnName="id")})
     */
    private $roles;

    /**
     * @ORM\ManyToOne(targetEntity="UserBundle\Entity\User", inversedBy="children")
     * @ORM\JoinColumn(name="parent_id", referencedColumnName="id", onDelete="SET NULL")
     */
    protected $parent;

    /**
     * @ORM\OneToMany(targetEntity="UserBundle\Entity\User", mappedBy="parent", orphanRemoval=true, cascade={"persist", "remove"})
     *
     */
    protected $children;

    /**
     * @var array
     */
    public static $fields = [ 'email', 'username', 'id', 'avatar', 'cover', 'type'];

    /**
     * User Entity constructor.
     */
    public function __construct(/*EncoderFactoryInterface $encoderFactory*/)
    {
        //$this->encoderFactory = $encoderFactory;
        $this->posts        = new ArrayCollection();
        $this->skills       = new ArrayCollection();
        $this->languages    = new ArrayCollection();
        $this->certificates = new ArrayCollection();
        $this->educations   = new ArrayCollection();
        $this->children     = new ArrayCollection();

        dump($this->children);
        die();

    }

    /**
     * @param User $user
     * @return $this
     */
    public function setParent(User $user)
    {
        $this->parent = $user;

        return $this;
    }

    /**
     * @return $this
     */
    public function removeParent()
    {
        $this->parent = null;

        return $this;
    }

    /**
     * @param User $user
     * @return $this
     */
    public function addChild(User $user)
    {
        if(!$this->children->contains($user)){
            $this->children->add($user);
        }

        return $this;
    }

    /**
     * @param User $user
     * @return bool
     */
    public function hasChild(User $user)
    {
        return $this->children->contains($user);
    }

    /**
     * @param User $user
     * @return bool
     */
    public function isChildOf(User $user)
    {
        return $user->getChildren()->contains($this);
    }

    /**
     * @return ArrayCollection
     */
    public function getChildren()
    {
        return $this->children;
    }

    /**
     * @param User $user
     * @return $this
     */
    public function removeChild(User $user)
    {
        if($this->children->contains($user)){
            $this->children->removeElement($user);
        }

        return $this;
    }

    /**
     * @param ArrayCollection $users
     * @return $this
     */
    public function setChildren(ArrayCollection $users)
    {
        $this->children = $users;

        return $this;
    }

    /**
     * @return $this
     */
    public function removeChildren()
    {
        $this->children->clear();

        return $this;
    }

    /**
     * @param ArrayCollection $certificates
     * @return $this
     */
    public function setCertificates(ArrayCollection $certificates)
    {
        $this->certificates = $certificates;

        return $this;
    }

    /**
     * @param Certificate $certificate
     * @return $this
     */
    public function addCertificate(Certificate $certificate)
    {
        if(!$this->certificates->contains($certificate))
            $this->certificates->add($certificate);

        return $this;
    }

    /**
     * @param Certificate $certificate
     * @return $this
     */
    public function removeCertificate(Certificate $certificate)
    {
        if($this->certificates->contains($certificate))
            $this->certificates->removeElement($certificate);

        return $this;
    }

    /**
     * @return $this
     */
    public function removeCertificates()
    {
        $this->certificates->clear();

        return $this;
    }

    /**
     * @param ArrayCollection $skills
     * @return $this
     */
    public function setSkills(ArrayCollection $skills)
    {
        $this->skills = $skills;

        return $this;
    }

    /**
     * @param Skill $skill
     * @return $this
     */
    public function addSkill(Skill $skill)
    {
        if(!$this->skills->contains($skill))
            $this->skills->add($skill);

        return $this;
    }

    /**
     * @param Skill $skill
     * @return $this
     */
    public function removeSkill(Skill $skill)
    {
        if($this->skills->contains($skill))
            $this->skills->removeElement($skill);

        return $this;
    }

    /**
     * @return $this
     */
    public function removeSkills()
    {
        $this->skills->clear();

        return $this;
    }

    /**
     * @param ArrayCollection $languages
     * @return $this
     */
    public function setLanguages(ArrayCollection $languages)
    {
        $this->languages = $languages;

        return $this;
    }

    /**
     * @param Language $language
     * @return $this
     */
    public function addLanguage(Language $language)
    {
        if(!$this->languages->contains($language))
            $this->languages->add($language);

        return $this;
    }

    /**
     * @param Language $language
     * @return $this
     */
    public function removeLanguage(Language $language)
    {
        if($this->languages->contains($language))
            $this->languages->removeElement($language);

        return $this;
    }

    /**
     * @return $this
     */
    public function removeLanguages()
    {
        $this->languages->clear();

        return $this;
    }

    /**
     * @param ArrayCollection $posts
     * @return $this
     */
    public function setPosts(ArrayCollection $posts)
    {
        $this->posts = $posts;

        return $this;
    }

    /**
     * @param Post $post
     * @return $this
     */
    public function addPost(Post $post)
    {
        $this->posts->add($post);

        return $this;
    }

    /**
     * @param Post $post
     * @return $this
     */
    public function removePost(Post $post)
    {
        $this->posts->removeElement($post);

        return $this;
    }

    /**
     * @return $this
     */
    public function removePosts()
    {
        $this->posts->clear();

        return $this;
    }

    /**
     * @param ArrayCollection $educations
     * @return $this
     */
    public function setEducations(ArrayCollection $educations)
    {
        $this->educations = $educations;

        return $this;
    }

    /**
     * @param Education $education
     * @return $this
     */
    public function addEducation(Education $education)
    {
        $this->educations->add($education);

        return $this;
    }

    /**
     * @param Education $education
     * @return $this
     */
    public function removeEducation(Education $education)
    {
        $this->educations->removeElement($education);

        return $this;
    }

    /**
     * @return $this
     */
    public function removeEducations()
    {
        $this->educations->clear();

        return $this;
    }

    /**
     * Get id
     *
     * @return integer
     */
    public function getId()
    {
        return $this->id;
    }

    /**
     * @param integer $id
     * @return $this
     */
    public function setId($id)
    {
        $this->id = $id;

        return $this;
    }

    /**
     * @return mixed
     */
    public function getType()
    {
        return $this->type;
    }

    /**
     * @param mixed $type
     * @return $this
     */
    public function setType($type)
    {
        $this->type = $type;

        return $this;
    }

    /**
     * Set email
     *
     * @param string $email
     * @return User
     */
    public function setEmail($email)
    {
        $this->email = $email;

        return $this;
    }

    /**
     * @return string
     */
    public function getEmail()
    {
        return $this->email;
    }

    /**
     * @param $username
     * @return $this
     */
    public function setUsername($username)
    {
        $this->username = $username;
        return $this;
    }

    /**
     * @return mixed
     */
    public function getUsername()
    {
        return $this->username;
    }

    /**
     * @return array
     */
    public function getRoles()
    {
        return ['ROLE_USER', 'IS_AUTHENTICATED_ANONYMOUSLY'];
    }

    /**
     * @param $password
     * @return $this
     */
    public function setPassword($password)
    {
        //$password =$this->encoderFactory->getEncoder($this)->encodePassword($password, $this->getSalt());

        $this->password = $password;
        return $this;

    }

    /**
     * @return string
     */
    public function getPassword()
    {
        return $this->password;
    }

    /**
     *
     */
    public function getSalt()
    {
        return md5(sha1('somesalt'));
    }

    /**
     *
     */
    public function eraseCredentials()
    {
    }

    /**
     * @param $cover
     * @return $this
     */
    public function setCover($cover)
    {
        $this->cover = $cover;
        return $this;

    }

    /**
     * @return string
     */
    public function getCover()
    {
        return $this->cover;
    }

    /**
     * @param $avatar
     * @return $this
     */
    public function setAvatar($avatar)
    {
        $this->avatar = $avatar;
        return $this;

    }

    /**
     * @return string
     */
    public function getAvatar()
    {
        return $this->avatar;

    }

    /**
     * @param Role $roles
     */
    public function addRoles(Role $roles)
    {
        $this->roles[] = $roles;
    }

    /**
     * @return mixed
     */
    public function getRoles2()
    {
        return $this->roles;
    }

    /**
     * @return array
     */
    public function getRolesAsArray()
    {
        $rolesArray = [];
        foreach ($this->getRoles2() as $role) {
            $rolesArray[] = $role->getName();

        }
        return $rolesArray;

    }

    /**
     * @return Company
     */
    public function getCompany()
    {
        return $this->company;
    }

    /**
     * @param Company $company
     * @return $this
     */
    public function setCompany(Company $company)
    {
        $this->company = $company;

        return $this;
    }

}

and this is what I want to do
$new_owner = $this->userRepository->findOneById($user_id, false);

$children = $old_owner->getChildren();

$old_owner->removeChildren();
$new_owner->setChildren($children);

and I get error which says :

Argument 1 passed to
  Proxies__CG__\UserBundle\Entity\User::setChildren() must be an
  instance of Doctrine\Common\Collections\ArrayCollection, instance of
  Doctrine\ORM\PersistentCollection given

should I change my type hint in setChildren method to PersistentCollection ??
or I need to totally change my approach?

A: Short answer:
/**
 * @param Doctrine\Common\Collections\Collection $users
 * @return $this
 */
public function setChildren(Doctrine\Common\Collections\Collection $users)
{
    $this->children = $users;

    return $this;
}

Explanation:
If you look deep into Doctrine Classes you will see the following structure:
Array collection is class that implements interface Collection:
class ArrayCollection implements Collection, Selectable

PersistentCollection is class that extentds AbstractLazyCollection:
final class PersistentCollection extends AbstractLazyCollection implements Selectable

but AbstractLazyCollection implements Collection:
abstract class AbstractLazyCollection implements Collection

So:
Collection is interface, that you should use in method setChildren().
This is because of doctrine use lazy loading - mechanism that allow to load not all properties, but only these, that are needed.
Similar question:

Doctrine manyToMany return PersistentCollection instead of ArrayCollection

A: In your typing add Collection $children

use Doctrine\Common\Collections\Collection;
...
private ?Collection $children;

symfony: 5.3


text:
Q: Symfony3.4/Doctrine migrations - An exception occured in driver: SQLSTATE[HY000] [2002] No such file or directory I'm trying to run Doctrine migrations in Symfony3.4 project however I stuck for a couple of days now.
Does anyone faced the same issue? How to make this work?
Thanks in advance!
php bin/console doctrine:migrations:migrate Version20180909015642

19:03:19 ERROR     [console] Error thrown while running command
"doctrine:migrations:migrate". Message: "An exception occured in
driver: SQLSTATE[HY000] [2002] No such file or directory" ["exception"
=> Doctrine\DBAL\Exception\ConnectionException { …},"command" =>
"doctrine:migrations:migrate","message" => "An exception occured in
driver: SQLSTATE[HY000] [2002] No such file or directory"] []

In AbstractMySQLDriver.php line 103:

  An exception occured in driver: SQLSTATE[HY000] [2002] No such file
or directory

In PDOConnection.php line 47:

  SQLSTATE[HY000] [2002] No such file or directory

In PDOConnection.php line 43:

  SQLSTATE[HY000] [2002] No such file or directory

Bundle is registered in AppKernel.php
new Doctrine\Bundle\MigrationsBundle\DoctrineMigrationsBundle(),

In config.yml
doctrine_migrations:
    dir_name: "%kernel.root_dir%/DoctrineMigrations"
    namespace: Application\Migrations
    table_name: doctrine_migration_versions
    name: Application_Migrations_Default

app/DoctrineMigrations/Version20180909015642.php
<?php
declare(strict_types=1);

namespace Application\Migrations;

use Doctrine\DBAL\Migrations\AbstractMigration;
use Doctrine\DBAL\Schema\Schema;

/**
 * Auto-generated Migration: Please modify to your needs!
 */
class Version20180909015642 extends AbstractMigration
{

    /**
     * @param Schema $schema
     */
    public function up(Schema $schema)
    {
        //...
    }

    /**
     * @param Schema $schema
     */
    public function down(Schema $schema)
    {
        //...
    }
}

A: The console commands have help options -h which are very helpful.
 php bin/console doctrine:migrations -h

Have said that, for migrating up to specific migration file you should use timestamp of the final migration file like bellow
 php bin/console doctrine:migrations:migrate 20180909015642

For executing specific migration file though, the execute command should be used; like following
php bin/console doctrine:migrations:execute 20180909015642 --up

Get help on specific command to see full explanation and examples
php bin/console doctrine:migrations:execute -h

php bin/console doctrine:migrations:migrate -h


text:
Q: Can I use previously not selected perks in the punch card machine? From what I could find, the punch card machine allows to create a second build for the same character by redistributing and saving a new set of SPECIAL attributes and assign new perks. This means (again, to my understanding), that I can have, for example, a heavy gunner build and a shotgun build that I can switch between.
However, when I was leveling my basic shotgun build, I didn't choose any heavy guns related perks, as both shotgun and heavy guns use Strength as their main SPECIAL attribute. Hence now, I cannot simply switch from shotgun to HG, because while I've unlocked the Shotgunner (regular, expert and master) and the scattershot perks, I don't have any cards for the heavy guns (heavy gunner/ expert HG/ master HG /Bear Arms).
If I use the punch card machine, will I be able to re-select perks as I was leveling from lev 1 again, or does it only allow to select already unlocked perks?

A: I've finally tested it myself, and the answer is a flat "NO":
No matter which build you've selected in the Punch card Machine, you will have access to the same perks. This means that:

*

*You have to keep grinding levels to get more perks

*You have to be careful about leveling the perk cards: if one of your build uses lvl 1 card and you will upgrade this card in another build, you won't have access to that lvl 1 card at all (unless you will get it again on another level up).


text:
Q: php header("Location: home.php"); not redirecting me properly I'm making a login and registration system but my header redirect isn't working properly, Instead of redirecting me to my home.php page on log in it is bringing me to my index.php.
Here is the code:
$_SESSION["user_login"] = $user_login;
header("Location: home.php");
  exit();
} else {
    echo 'That information is incorrect, try again';
    exit();

Why form action is set to index.php but when I change it to home.php it sends me there but does not log me in.
Here is the form code:
<form action="index.php" method="POST">
    <input type="text" name="user_login" size="25" placeholder="Username" />

    <input type="text" name="password_login" size="25" placeholder="Password" />

    <input type="submit" name="login" value="Login">
</form>

A: exit();

terminates program, so remove it and try again.


text:
Q: Custom page with products where attribute is equal to I'm looking for a way to show a custom page with products on it. This is the case:
In an older version of the webshop there were 2 pages. The first one was 'promoties.html' for Dutch and 'promotions.html' for English. They were in the table pp_core_url_rewrite like this:

The category 13 was a category named promotion and all linked products to this category where promotion products.
The categories in the new version are changed and we don't have promotion category anymore. We can now set an attribute named promotion of an article to true or false.

But now I would like to know how I can make the promotion pages work again with selecting all the products where the attribute promotion is true. But I don't really know how to start with this, can anybody help me on my way?

A: As i think you know how to create product attribute using admin panel in magento. Create a promotion attribute of a product first .Then Using the query update the product attribute to true or false in previously created products as required .Then you can show the products on the basis of that attribute in promotion pages store wise.


text:
Q: SQLSTATE[42000]: Syntax error or access violation: 1064 in laravel I use a master page and in the header, there is a number of unread messages
master page code:

            @php $totlUnread = 0; @endphp
            @foreach($chatusers as $chatuser)
                @if($chatuser->unread)
                    @php $totlUnread+=$chatuser->unread; @endphp
                @endif
            @endforeach

            @if($totlUnread == 0)
                @php echo ""; @endphp
            @else
                @php echo "$totlUnread"; @endphp
            @endif

when I need to pass this value (users) to all views, I Create View Composer and pass data through it.
public function boot()
{
    $chatusers = DB::select("select users.id, users.name, users.email, count(is_read) as unread
    from users LEFT  JOIN  messagesnews ON users.id = messagesnews.from and is_read = 0 and messagesnews.to = " . Auth::id() . " where users.id != " . Auth::id() . "
    group by users.id, users.name, users.email");
    View::share('chatusers', $chatusers);
}

but give me an error

SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'where users.id != group by users.id, users.name, users.email' at line 3 (SQL: select users.id, users.name, users.email, count(is_read) as unread from users LEFT JOIN messagesnews ON users.id = messagesnews.from and is_read = 0 and messagesnews.to = where users.id != group by users.id, users.name, users.email)

when I use the SQL query in any controller it's working very well, but in View Composer give me an error.

A: Using Auth::id() will result in a null value. You should use either Auth::user()->id or auth()->user()->id to get the authenticated user's ID.

A: Thanks for all, I do the below and it's working well
 public function boot()
{
     view()->composer('*', function ($view)
    {
        if (Auth::check())
        {
            $id=Auth::user()->id;
            $chatusers = DB::select("select users.id, users.name, users.email, count(is_read) as unread
        from users LEFT  JOIN  messagesnews ON users.id = messagesnews.from and is_read = 0 and messagesnews.to = " . $id . "
       where users.id != " . $id . "
        group by users.id, users.name, users.email");

            $view->with('chatusers', $chatusers );
            $view->with('id', $id );
        }
    });
}


text:
Q: Implementing methods on multiple ASPX pages for the same usercontrol So, this is my situation. I have multiple ASPX pages (11 total), each of which contains a different set of fields exclusive to those pages.
The way I have implemented is to copy the same code over all those pages, make a few modifications and execute. Ex. on Page 1 remove any handling for Page01 button, on page 2 I remove eventhandler for Page02 button... so on and so forth.
Good News? This works just fine (postbacks, saves, etc).
Bad News? It is tedious, especially if I have to need to add new event(s) to the control ASCX (TMControl.ASCX). Then, I have to recode all those 11 ASPX pages, wire them to the ASCX, et. al.
Question: Is there a way to do this in a way that I do not duplicate effort?
protected void Page_Load(object sender, EventArgs e)
{
    Page.Title = "...";

    wucTMControls = LoadControl("TMControls.ascx") as TMControls;
    wucTMControls.btnPage02Click += new EventHandler(wucTMControls_btnPage02Click);
    wucTMControls.btnPage03Click += new EventHandler(wucTMControls_btnPage03Click);
    //-----------
    // similar lines of eventhandling code exists here for pages 4 thru 11,
    // which I removed for readability
    //-----------
    wucTMControls.btnSavePageClick += new EventHandler(wucTMControls_btnSavePageClick);
    wucTMControls.btnSavePayeeClick += new EventHandler(wucTMControls_btnSavePayeeClick);
    phTMControls.Controls.Add(wucTMControls);
    if (!IsPostBack)
    {
        loadPage01();
    }
}

void wucTMControls_btnPage02Click(object sender, EventArgs e) { if (noChangesOnThisPage()) wucTMControls.btnPage02Clicked(); }
void wucTMControls_btnPage03Click(object sender, EventArgs e) { if (noChangesOnThisPage()) wucTMControls.btnPage03Clicked(); }
//-----------
// similar lines of eventhandler code exists here for pages 4 thru 11,
// which I removed for readability
//-----------
void wucTMControls_btnSavePayeeClick(object sender, EventArgs e) { }

A: A UserControl is used when you have to do the same task on different pages. It seems to me that your UserControl does different things on all the pages it is used on. Moreover it has events named like the pages that it is used on. This is really bad design. The UserControl should not have to know anything about the pages. You can use member variables to alter the behavior of the UserControl. But it seems to me that a UserControl is not the solution for your task.


text:
Q: paralell_rspec with options --exclude-pattern Trying to exclude the specs in the /home dir during the parallel run.
Tried a few things similar to the following:
parallel_rspec myproj -n 4 -o '--exclude-pattern "myproj/spec/home/*_spec.rb"'
parallel_rspec ./myproj -n 4 -o '--exclude-pattern "./myproj/spec/home/*_spec.rb"'
But it does not exclude specs in the /home dir. It runs all specs in myproj.
The following commands do exclude specs in /home dir but I need to run them in parallel:
rspec myproj --exclude-pattern "myproj/spec/home/*_spec.rb"
rspec ./myproj --exclude-pattern "./myproj/spec/home/*_spec.rb"

A: I always used the rake task for that as advised here:
ParallelRSpec::RakeTask.new(:prspec) do |t|
  ENV['WORKERS'] = '4'
  t.rspec_opts = '--exclude-pattern "myproj/spec/home/*_spec.rb"'
end

and run it as:
bundle exec rake prspec

A: I ended up using the parallel_test gem.
I added the following to the .rspec_parallel file:
--tag ~tagname1
--tag ~tagname2
--tag ~tagname3

This excluded the specs tagged with tagname1,2,3.


text:
Q: How to adds multiple images with delete add images in iphone? I want add multiple images in my own project like 7 images but in delete and add images is troubles. I also add images successfully. And more also delete success. But when i added with delete image, the image position was moved incorrect position. Can anybody please help me to correct my code. Thanks in advance.
This is my code
NSInteger x=0,i=0,z=0;
NSInteger im=0,im1=0,im2=0,im3=0,im4=0,im5=0,im6=0;
-(IBAction) selectimg
{
if(i>6)
{
   alertbox...
}
else {
popupQuery = [[UIActionSheet alloc] initWithTitle:nil delegate:self cancelButtonTitle:@"Cancel" destructiveButtonTitle:@"Capture Image" otherButtonTitles:@"Gallery", nil];
popupQuery.actionSheetStyle = UIActionSheetStyleBlackTranslucent;
[popupQuery showInView:self.view];
[popupQuery release];
}}

-(void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex
{
if (buttonIndex == 0)
{
UIImagePickerController * picker = [[UIImagePickerController alloc] init];
picker.delegate = self;
picker.sourceType = UIImagePickerControllerSourceTypeCamera;
[self presentModalViewController:picker animated:YES];
if (i==0)
{
bgImage = [[UIImageView alloc] initWithFrame:CGRectMake(20,30+x,100,100)];
bgImage.image = [UIImage imageNamed:@"default.jpg"];
[self.view addSubview:bgImage];
[scrollview addSubview:bgImage];

myButton = [UIButton buttonWithType:UIButtonTypeRoundedRect];
myButton.frame = CGRectMake(120, 65+x, 70, 30); // position in the parent view and set the size of the button
[myButton setTitle:@"Delete" forState:UIControlStateNormal];
[myButton addTarget:self action:@selector(buttonClicked) forControlEvents:UIControlEventTouchUpInside];
[self.view addSubview:myButton];
[scrollview addSubview:myButton];
x=x+100;
}
if (i==1)
{
 bgImage1 = [[UIImageView alloc] initWithFrame:CGRectMake(20,30+x,100,100)];
 bgImage1.image = [UIImage imageNamed:@"default.jpg"];
 [self.view addSubview:bgImage1];
 [scrollview addSubview:bgImage1];

 myButton1 = [UIButton buttonWithType:UIButtonTypeRoundedRect];
 myButton1.frame = CGRectMake(120, 65+x, 70, 30); // position in the parent view and set the size of the button
 [myButton1 setTitle:@"Delete" forState:UIControlStateNormal];
 [myButton1 addTarget:self action:@selector(buttonClicked1) forControlEvents:UIControlEventTouchUpInside];
 [self.view addSubview:myButton1];
 [scrollview addSubview:myButton1];
 x=x+100;
}
if (i==2)
{
bgImage2 = [[UIImageView alloc] initWithFrame:CGRectMake(20,30+x,100,100)];
bgImage2.image = [UIImage imageNamed:@"default.jpg"];
[self.view addSubview:bgImage2];
[scrollview addSubview:bgImage2];
myButton2 = [UIButton buttonWithType:UIButtonTypeRoundedRect];
myButton2.frame = CGRectMake(120, 65+x, 70, 30); // position in the parent view and set the size of the button
[myButton2 setTitle:@"Delete" forState:UIControlStateNormal];
[myButton2 addTarget:self action:@selector(buttonClicked2) forControlEvents:UIControlEventTouchUpInside];
[self.view addSubview:myButton2];
[scrollview addSubview:myButton2];
x=x+100;
}
if (i==3)
{
bgImage3 = [[UIImageView alloc] initWithFrame:CGRectMake(20,30+x,100,100)];
bgImage3.image = [UIImage imageNamed:@"default.jpg"];
[self.view addSubview:bgImage3];
[scrollview addSubview:bgImage3];

myButton3 = [UIButton buttonWithType:UIButtonTypeRoundedRect];
myButton3.frame = CGRectMake(120, 65+x, 70, 30); // position in the parent view and set the size of the button
[myButton3 setTitle:@"Delete" forState:UIControlStateNormal];
[myButton3 addTarget:self action:@selector(buttonClicked3) forControlEvents:UIControlEventTouchUpInside];
[self.view addSubview:myButton3];
[scrollview addSubview:myButton3];
x=x+100;
}
if (i==4)
{
bgImage4 = [[UIImageView alloc] initWithFrame:CGRectMake(20,30+x,100,100)];
bgImage4.image = [UIImage imageNamed:@"default.jpg"];
[self.view addSubview:bgImage4];
[scrollview addSubview:bgImage4];

myButton4 = [UIButton buttonWithType:UIButtonTypeRoundedRect];
myButton4.frame = CGRectMake(120, 65+x, 70, 30); // position in the parent view and set the size of the button
[myButton4 setTitle:@"Delete" forState:UIControlStateNormal];
[myButton4 addTarget:self action:@selector(buttonClicked4) forControlEvents:UIControlEventTouchUpInside];
[self.view addSubview:myButton4];
[scrollview addSubview:myButton4];
x=x+100;
}
if (i==5)
{
bgImage5 = [[UIImageView alloc] initWithFrame:CGRectMake(20,30+x,100,100)];
bgImage5.image = [UIImage imageNamed:@"default.jpg"];
[self.view addSubview:bgImage5];
[scrollview addSubview:bgImage5];

myButton5 = [UIButton buttonWithType:UIButtonTypeRoundedRect];
myButton5.frame = CGRectMake(120, 65+x, 70, 30); // position in the parent view and set the size of the button
[myButton5 setTitle:@"Delete" forState:UIControlStateNormal];
[myButton5 addTarget:self action:@selector(buttonClicked5) forControlEvents:UIControlEventTouchUpInside];
[self.view addSubview:myButton5];
[scrollview addSubview:myButton5];
x=x+100;
}
if (i==6)
{
bgImage6 = [[UIImageView alloc] initWithFrame:CGRectMake(20,30+x,100,100)];
bgImage6.image = [UIImage imageNamed:@"default.jpg"];
[self.view addSubview:bgImage6];
[scrollview addSubview:bgImage6];
myButton6 = [UIButton buttonWithType:UIButtonTypeRoundedRect];
myButton6.frame = CGRectMake(120, 65+x, 70, 30); // position in the parent view and set the size of the button
[myButton6 setTitle:@"Delete" forState:UIControlStateNormal];
[myButton6 addTarget:self action:@selector(buttonClicked6) forControlEvents:UIControlEventTouchUpInside];
[self.view addSubview:myButton6];
[scrollview addSubview:myButton6];
x=x+100;
}}
else if (buttonIndex == 1)
{
UIImagePickerController * picker = [[UIImagePickerController alloc] init];
picker.delegate = self;
picker.sourceType = UIImagePickerControllerSourceTypeSavedPhotosAlbum;
[self presentModalViewController:picker animated:YES];
im1=0,im2=0,im3=0,im4=0,im5=0,im6=0;
if (i==0)
{
NSLog(@"in 0");
bgImage = [[UIImageView alloc] initWithFrame:CGRectMake(20,30+x,100,100)];
bgImage.image = [UIImage imageNamed:@"default.jpg"];
[self.view addSubview:bgImage];
[scrollview addSubview:bgImage];

myButton = [UIButton buttonWithType:UIButtonTypeRoundedRect];
myButton.frame = CGRectMake(120, 65+x, 70, 30); // position in the parent view and set the size of the button
[myButton setTitle:@"Delete" forState:UIControlStateNormal];
[myButton addTarget:self action:@selector(buttonClicked) forControlEvents:UIControlEventTouchUpInside];
[self.view addSubview:myButton];
[scrollview addSubview:myButton];
x=x+100;
}
if (i==1)
{
NSLog(@"in 1");
bgImage1 = [[UIImageView alloc] initWithFrame:CGRectMake(20,30+x,100,100)];
bgImage1.image = [UIImage imageNamed:@"default.jpg"];
[self.view addSubview:bgImage1];
[scrollview addSubview:bgImage1];

myButton1 = [UIButton buttonWithType:UIButtonTypeRoundedRect];
myButton1.frame = CGRectMake(120, 65+x, 70, 30); // position in the parent view and set the size of the button
[myButton1 setTitle:@"Delete" forState:UIControlStateNormal];
[myButton1 addTarget:self action:@selector(buttonClicked1) forControlEvents:UIControlEventTouchUpInside];
[self.view addSubview:myButton1];
[scrollview addSubview:myButton1];
x=x+100;
}
if (i==2)
{
NSLog(@"in 2");
bgImage2 = [[UIImageView alloc] initWithFrame:CGRectMake(20,30+x,100,100)];
bgImage2.image = [UIImage imageNamed:@"default.jpg"];
[self.view addSubview:bgImage2];
[scrollview addSubview:bgImage2];

myButton2 = [UIButton buttonWithType:UIButtonTypeRoundedRect];
myButton2.frame = CGRectMake(120, 65+x, 70, 30); // position in the parent view and set the size of the button
[myButton2 setTitle:@"Delete" forState:UIControlStateNormal];
[myButton2 addTarget:self action:@selector(buttonClicked2) forControlEvents:UIControlEventTouchUpInside];
[self.view addSubview:myButton2];
[scrollview addSubview:myButton2];
x=x+100;
}
if (i==3)
{
bgImage3 = [[UIImageView alloc] initWithFrame:CGRectMake(20,30+x,100,100)];
bgImage3.image = [UIImage imageNamed:@"default.jpg"];
[self.view addSubview:bgImage3];
[scrollview addSubview:bgImage3];

myButton3 = [UIButton buttonWithType:UIButtonTypeRoundedRect];
myButton3.frame = CGRectMake(120, 65+x, 70, 30); // position in the parent view and set the size of the button
[myButton3 setTitle:@"Delete" forState:UIControlStateNormal];
[myButton3 addTarget:self action:@selector(buttonClicked3) forControlEvents:UIControlEventTouchUpInside];
[self.view addSubview:myButton3];
[scrollview addSubview:myButton3];
x=x+100;
}
if (i==4)
{
NSLog(@"in 4");
bgImage4 = [[UIImageView alloc] initWithFrame:CGRectMake(20,30+x,100,100)];
bgImage4.image = [UIImage imageNamed:@"default.jpg"];
[self.view addSubview:bgImage4];
[scrollview addSubview:bgImage4];

myButton4 = [UIButton buttonWithType:UIButtonTypeRoundedRect];
myButton4.frame = CGRectMake(120, 65+x, 70, 30); // position in the parent view and set the size of the button
[myButton4 setTitle:@"Delete" forState:UIControlStateNormal];
[myButton4 addTarget:self action:@selector(buttonClicked4) forControlEvents:UIControlEventTouchUpInside];
[self.view addSubview:myButton4];
[scrollview addSubview:myButton4];
x=x+100;
}
if (i==5)
{
NSLog(@"in 5");
bgImage5 = [[UIImageView alloc] initWithFrame:CGRectMake(20,30+x,100,100)];
bgImage5.image = [UIImage imageNamed:@"default.jpg"];
[self.view addSubview:bgImage5];
[scrollview addSubview:bgImage5];

myButton5 = [UIButton buttonWithType:UIButtonTypeRoundedRect];
myButton5.frame = CGRectMake(120, 65+x, 70, 30); // position in the parent view and set the size of the button
[myButton5 setTitle:@"Delete" forState:UIControlStateNormal];
[myButton5 addTarget:self action:@selector(buttonClicked5) forControlEvents:UIControlEventTouchUpInside];
[self.view addSubview:myButton5];
[scrollview addSubview:myButton5];
x=x+100;
}
if (i==6)
{
NSLog(@"in 6");
bgImage6 = [[UIImageView alloc] initWithFrame:CGRectMake(20,30+x,100,100)];
bgImage6.image = [UIImage imageNamed:@"default.jpg"];
[self.view addSubview:bgImage6];
[scrollview addSubview:bgImage6];

myButton6 = [UIButton buttonWithType:UIButtonTypeRoundedRect];
myButton6.frame = CGRectMake(120, 65+x, 70, 30); // position in the parent view and set the size of the button
[myButton6 setTitle:@"Delete" forState:UIControlStateNormal];
[myButton6 addTarget:self action:@selector(buttonClicked6) forControlEvents:UIControlEventTouchUpInside];
[self.view addSubview:myButton6];
[scrollview addSubview:myButton6];
x=x+100;
}}}
- (void)imagePickerController:(UIImagePickerController *)UIPicker didFinishPickingImage:(UIImage *)info editingInfo:(NSDictionary *)dictionary
{
[UIPicker dismissModalViewControllerAnimated:NO];
if(i==0)
{
bgImage.image=info;
}
else if (i==1)
{
bgImage1.image=info;
}
else if (i==2)
{
bgImage2.image = info;
}
else if (i==3)
{
bgImage3.image = info;
}
else if(i==4)
{
bgImage4.image = info;
}
else if(i==5)
{
bgImage5.image = info;
}
else if(i==6)
{
bgImage6.image = info;
}
i++;
}
- (void)buttonClicked
{
if((im1==1)&&(im2==1)&&(im3==1)&&(im4==1)&&(im5==1))
{
bgImage6.frame=bgImage.frame;
myButton6.frame=myButton.frame;
}
else if((im1==1)&&(im2==1)&&(im3==1)&&(im4==1))
{
bgImage6.frame=bgImage5.frame;
bgImage5.frame=bgImage.frame;
myButton6.frame=myButton5.frame;
myButton5.frame=myButton.frame;
}
else if((im1==1)&&(im2==1)&&(im3==1)&&(im5==1))
{
bgImage6.frame=bgImage4.frame;
bgImage4.frame=bgImage.frame;
myButton6.frame=myButton4.frame;
myButton4.frame=myButton.frame;
}
else if((im1==1)&&(im2==1)&&(im4==1)&&(im5==1))
{
bgImage6.frame=bgImage3.frame;
bgImage3.frame=bgImage.frame;
myButton6.frame=myButton3.frame;
myButton3.frame=myButton.frame;
}
 else if((im1==1)&&(im3==1)&&(im4==1)&&(im5==1))
{
bgImage6.frame=bgImage2.frame;
bgImage2.frame=bgImage.frame;
myButton6.frame=myButton2.frame;
myButton2.frame=myButton.frame;
}
else if((im1==1)&&(im2==1)&&(im3==1))
  {
bgImage6.frame=bgImage5.frame;
bgImage5.frame=bgImage4.frame;
bgImage4.frame=bgImage.frame;
myButton6.frame=myButton5.frame;
myButton5.frame=myButton4.frame;
myButton4.frame=myButton.frame;
}
else if((im1==1)&&(im2==1)&&(im4==1))
{
bgImage6.frame=bgImage5.frame;
bgImage5.frame=bgImage3.frame;
bgImage3.frame=bgImage.frame;
myButton6.frame=myButton5.frame;
myButton5.frame=myButton3.frame;
myButton3.frame=myButton.frame;
}
else if((im1==1)&&(im2==1)&&(im5==1))
{
bgImage6.frame=bgImage4.frame;
bgImage4.frame=bgImage3.frame;
bgImage3.frame=bgImage.frame;
myButton6.frame=myButton4.frame;
myButton4.frame=myButton3.frame;
myButton3.frame=myButton.frame;
}
else if((im1==1)&&(im3==1)&&(im4==1))
{
bgImage6.frame=bgImage5.frame;
bgImage5.frame=bgImage2.frame;
bgImage2.frame=bgImage.frame;
myButton6.frame=myButton5.frame;
myButton5.frame=myButton2.frame;
myButton2.frame=myButton.frame;
}
else if((im1==1)&&(im3==1)&&(im5==1))
{
bgImage6.frame=bgImage4.frame;
bgImage4.frame=bgImage2.frame;
bgImage2.frame=bgImage.frame;
myButton6.frame=myButton4.frame;
myButton4.frame=myButton2.frame;
myButton2.frame=myButton.frame;
}
else if((im1==1)&&(im4==1)&&(im5==1))
{
bgImage6.frame=bgImage3.frame;
bgImage3.frame=bgImage2.frame;
bgImage2.frame=bgImage.frame;
myButton6.frame=myButton3.frame;
myButton3.frame=myButton2.frame;
myButton2.frame=myButton.frame;
}
else if((im2==1)&&(im3==1)&&(im4==1))
{
bgImage6.frame=bgImage5.frame;
bgImage5.frame=bgImage1.frame;
bgImage1.frame=bgImage.frame;
myButton6.frame=myButton5.frame;
myButton5.frame=myButton1.frame;
myButton1.frame=myButton.frame;
}
else if((im2==1)&&(im3==1)&&(im5==1))
{
bgImage6.frame=bgImage4.frame;
bgImage4.frame=bgImage1.frame;
bgImage1.frame=bgImage.frame;
myButton6.frame=myButton4.frame;
myButton4.frame=myButton1.frame;
myButton1.frame=myButton.frame;
}
else if((im2==1)&&(im4==1)&&(im5==1))
{
bgImage6.frame=bgImage3.frame;
bgImage3.frame=bgImage1.frame;
bgImage1.frame=bgImage.frame;
myButton6.frame=myButton3.frame;
myButton3.frame=myButton1.frame;
myButton1.frame=myButton.frame;
}
else if((im3==1)&&(im4==1)&&(im5==1))
{
bgImage6.frame=bgImage2.frame;
bgImage2.frame=bgImage1.frame;
bgImage1.frame=bgImage.frame;
myButton6.frame=myButton2.frame;
myButton2.frame=myButton1.frame;
myButton1.frame=myButton.frame;
}
else if((im1==1)&&(im2==1))
{
bgImage6.frame=bgImage5.frame;
bgImage5.frame=bgImage4.frame;
bgImage4.frame=bgImage3.frame;
bgImage3.frame=bgImage.frame;
myButton6.frame=myButton5.frame;
myButton5.frame=myButton4.frame;
myButton4.frame=myButton3.frame;
myButton3.frame=myButton.frame;
}
else if((im1==1)&&(im3==1))
{
bgImage6.frame=bgImage5.frame;
bgImage5.frame=bgImage4.frame;
bgImage4.frame=bgImage2.frame;
bgImage2.frame=bgImage.frame;
myButton6.frame=myButton5.frame;
myButton5.frame=myButton4.frame;
myButton4.frame=myButton2.frame;
myButton2.frame=myButton.frame;
}
else if((im1==1)&&(im4==1))
{
bgImage6.frame=bgImage5.frame;
bgImage5.frame=bgImage3.frame;
bgImage3.frame=bgImage2.frame;
bgImage2.frame=bgImage.frame;
myButton6.frame=myButton5.frame;
myButton5.frame=myButton3.frame;
myButton3.frame=myButton2.frame;
myButton2.frame=myButton.frame;
}
else if((im1==1)&&(im5==1))
{
bgImage6.frame=bgImage4.frame;
bgImage4.frame=bgImage3.frame;
bgImage3.frame=bgImage2.frame;
bgImage2.frame=bgImage.frame;
myButton6.frame=myButton4.frame;
myButton4.frame=myButton3.frame;
myButton3.frame=myButton2.frame;
myButton2.frame=myButton.frame;
}
else if((im2==1)&&(im3==1))
{
bgImage6.frame=bgImage5.frame;
bgImage5.frame=bgImage4.frame;
bgImage4.frame=bgImage1.frame;
bgImage1.frame=bgImage.frame;
myButton6.frame=myButton5.frame;
myButton5.frame=myButton4.frame;
myButton4.frame=myButton1.frame;
myButton1.frame=myButton.frame;
}
else if((im2==1)&&(im4==1))
{
bgImage6.frame=bgImage5.frame;
bgImage5.frame=bgImage3.frame;
bgImage3.frame=bgImage1.frame;
bgImage1.frame=bgImage.frame;
myButton6.frame=myButton5.frame;
myButton5.frame=myButton3.frame;
myButton3.frame=myButton1.frame;
myButton1.frame=myButton.frame;
}
else if((im2==1)&&(im5==1))
{
bgImage6.frame=bgImage4.frame;
bgImage4.frame=bgImage3.frame;
bgImage3.frame=bgImage1.frame;
bgImage1.frame=bgImage.frame;
myButton6.frame=myButton4.frame;
myButton4.frame=myButton3.frame;
myButton3.frame=myButton1.frame;
myButton1.frame=myButton.frame;
}
else if((im3==1)&&(im4==1))
{
bgImage6.frame=bgImage5.frame;
bgImage5.frame=bgImage2.frame;
bgImage2.frame=bgImage1.frame;
bgImage1.frame=bgImage.frame;
myButton6.frame=myButton5.frame;
myButton5.frame=myButton2.frame;
myButton2.frame=myButton1.frame;
myButton1.frame=myButton.frame;
}
else if((im3==1)&&(im5==1))
{
bgImage6.frame=bgImage4.frame;
bgImage4.frame=bgImage2.frame;
bgImage2.frame=bgImage1.frame;
bgImage1.frame=bgImage.frame;
myButton6.frame=myButton5.frame;
myButton5.frame=myButton2.frame;
myButton2.frame=myButton1.frame;
myButton1.frame=myButton.frame;
}
else if(im1==1)
{
bgImage6.frame=bgImage5.frame;
bgImage5.frame=bgImage4.frame;
bgImage4.frame=bgImage3.frame;
bgImage3.frame=bgImage2.frame;
bgImage2.frame=bgImage.frame;
myButton6.frame=myButton5.frame;
myButton5.frame=myButton4.frame;
myButton4.frame=myButton3.frame;
myButton3.frame=myButton2.frame;
myButton2.frame=myButton.frame;
}
else if(im2==1)
{
bgImage6.frame=bgImage5.frame;
bgImage5.frame=bgImage4.frame;
bgImage4.frame=bgImage3.frame;
bgImage3.frame=bgImage1.frame;
bgImage1.frame=bgImage.frame;
myButton6.frame=myButton5.frame;
myButton5.frame=myButton4.frame;
myButton4.frame=myButton3.frame;
myButton3.frame=myButton1.frame;
myButton1.frame=myButton.frame;
}
else if(im3==1)
{
bgImage6.frame=bgImage5.frame;
bgImage5.frame=bgImage4.frame;
bgImage4.frame=bgImage2.frame;
bgImage2.frame=bgImage1.frame;
bgImage1.frame=bgImage.frame;
myButton6.frame=myButton5.frame;
myButton5.frame=myButton4.frame;
myButton4.frame=myButton2.frame;
myButton2.frame=myButton1.frame;
myButton1.frame=myButton.frame;
}
else if(im4==1)
{
bgImage6.frame=bgImage5.frame;
bgImage5.frame=bgImage3.frame;
bgImage3.frame=bgImage2.frame;
bgImage2.frame=bgImage1.frame;
bgImage1.frame=bgImage.frame;
myButton6.frame=myButton5.frame;
myButton5.frame=myButton3.frame;
myButton3.frame=myButton2.frame;
myButton2.frame=myButton1.frame;
myButton1.frame=myButton.frame;
}
else if(im5==1)
{
bgImage6.frame=bgImage4.frame;
bgImage4.frame=bgImage3.frame;
bgImage3.frame=bgImage2.frame;
bgImage2.frame=bgImage1.frame;
bgImage1.frame=bgImage.frame;
myButton6.frame=myButton4.frame;
myButton4.frame=myButton3.frame;
myButton3.frame=myButton2.frame;
myButton2.frame=myButton1.frame;
myButton1.frame=myButton.frame;
}
else
{
bgImage6.frame=bgImage5.frame;
bgImage5.frame=bgImage4.frame;
bgImage4.frame=bgImage3.frame;
bgImage3.frame=bgImage2.frame;
bgImage2.frame=bgImage1.frame;
bgImage1.frame=bgImage.frame;

myButton6.frame=myButton5.frame;
myButton5.frame=myButton4.frame;
myButton4.frame=myButton3.frame;
myButton3.frame=myButton2.frame;
myButton2.frame=myButton1.frame;
myButton1.frame=myButton.frame;
}
[bgImage removeFromSuperview];
[bgImage release];
bgImage=nil;
[myButton removeFromSuperview];
myButton=nil;
i--;
x=x-100;
im=1;
}
- (void)buttonClicked1
{
if(im==1)
{
[self buttonClicked];
}
else
{
if((im2==1)&&(im3==1)&&(im4==1)&&(im5==1))
bgImage6.frame=bgImage1.frame;
myButton6.frame=myButton1.frame;
}
else if((im2==1)&&(im3==1)&&(im4==1))
{
bgImage6.frame=bgImage5.frame;
bgImage5.frame=bgImage1.frame;
myButton6.frame=myButton5.frame;
myButton5.frame=myButton1.frame;
}
else if((im2==1)&&(im3==1)&&(im5==1))
{
bgImage6.frame=bgImage4.frame;
bgImage4.frame=bgImage1.frame;
myButton6.frame=myButton4.frame;
myButton4.frame=myButton1.frame;
}
else if((im2==1)&&(im4==1)&&(im5==1))
{
bgImage6.frame=bgImage3.frame;
bgImage3.frame=bgImage1.frame;
myButton6.frame=myButton3.frame;
myButton3.frame=myButton1.frame;
}
else if((im3==1)&&(im4==1)&&(im5==1))
{
bgImage6.frame=bgImage2.frame;
bgImage2.frame=bgImage1.frame;
myButton6.frame=myButton2.frame;
myButton2.frame=myButton1.frame;
}
else if((im2==1)&&(im3==1))
{
bgImage6.frame=bgImage5.frame;
bgImage5.frame=bgImage4.frame;
bgImage4.frame=bgImage1.frame;
myButton6.frame=myButton5.frame;
myButton5.frame=myButton4.frame;
myButton4.frame=myButton1.frame;
}
else if((im2==1)&&(im4==1))
{
bgImage6.frame=bgImage5.frame;
bgImage5.frame=bgImage3.frame;
bgImage3.frame=bgImage1.frame;
myButton6.frame=myButton5.frame;
myButton5.frame=myButton3.frame;
myButton3.frame=myButton1.frame;
}
else if((im2==1)&&(im5==1))
{
bgImage6.frame=bgImage4.frame;
bgImage4.frame=bgImage3.frame;
bgImage3.frame=bgImage1.frame;
myButton6.frame=myButton4.frame;
myButton4.frame=myButton3.frame;
myButton3.frame=myButton1.frame;
}
else if((im3==1)&&(im4==1))
{
bgImage6.frame=bgImage5.frame;
bgImage5.frame=bgImage2.frame;
bgImage2.frame=bgImage1.frame;
myButton6.frame=myButton5.frame;
myButton5.frame=myButton2.frame;
myButton2.frame=myButton1.frame;
}
else if((im3==1)&&(im5==1))
{
bgImage6.frame=bgImage4.frame;
bgImage4.frame=bgImage2.frame;
bgImage2.frame=bgImage1.frame;
myButton6.frame=myButton4.frame;
myButton4.frame=myButton2.frame;
myButton2.frame=myButton1.frame;
}
else if((im4==1)&&(im5==1))
{
bgImage6.frame=bgImage3.frame;
bgImage3.frame=bgImage2.frame;
bgImage2.frame=bgImage1.frame;
myButton6.frame=myButton3.frame;
myButton3.frame=myButton2.frame;
myButton2.frame=myButton1.frame;
}
else if(im2==1)
{
bgImage6.frame=bgImage5.frame;
bgImage5.frame=bgImage4.frame;
bgImage4.frame=bgImage3.frame;
bgImage3.frame=bgImage1.frame;
myButton6.frame=myButton5.frame;
myButton5.frame=myButton4.frame;
myButton4.frame=myButton3.frame;
myButton3.frame=myButton1.frame;
}
else if(im3==1)
{
bgImage6.frame=bgImage5.frame;
bgImage5.frame=bgImage4.frame;
bgImage4.frame=bgImage2.frame;
bgImage2.frame=bgImage1.frame;
myButton6.frame=myButton5.frame;
myButton5.frame=myButton4.frame;
myButton4.frame=myButton2.frame;
myButton2.frame=myButton1.frame;
}
else if(im4==1)
{
bgImage6.frame=bgImage5.frame;
bgImage5.frame=bgImage3.frame;
bgImage3.frame=bgImage2.frame;
bgImage2.frame=bgImage1.frame;
myButton6.frame=myButton5.frame;
myButton5.frame=myButton3.frame;
myButton3.frame=myButton2.frame;
myButton2.frame=myButton1.frame;
}
else if(im5==1)
{
bgImage6.frame=bgImage4.frame;
bgImage4.frame=bgImage3.frame;
bgImage3.frame=bgImage2.frame;
bgImage2.frame=bgImage1.frame;
myButton6.frame=myButton4.frame;
myButton4.frame=myButton3.frame;
myButton3.frame=myButton2.frame;
myButton2.frame=myButton1.frame;
}
else
{
bgImage6.frame=bgImage5.frame;
bgImage5.frame=bgImage4.frame;
bgImage4.frame=bgImage3.frame;
bgImage3.frame=bgImage2.frame;
bgImage2.frame=bgImage1.frame;

myButton6.frame=myButton5.frame;
myButton5.frame=myButton4.frame;
myButton4.frame=myButton3.frame;
myButton3.frame=myButton2.frame;
myButton2.frame=myButton1.frame;
}
[bgImage1 removeFromSuperview];
[bgImage1 release];
bgImage1=nil;
[myButton1 removeFromSuperview];
myButton1=nil;
im1=1;
i--;
x=x-100;
}
}
- (void)buttonClicked2
{
if((im==1)&&(im1==1))
{
[self buttonClicked];
}
else if((im1==1)||(im==1))
{
[self buttonClicked1];
}
else
{
if((im3==1)&&(im4==1)&&(im5==1))
{
bgImage6.frame=bgImage2.frame;
myButton6.frame=myButton2.frame;
}
else if((im3==1)&&(im4==1))
{
bgImage6.frame=bgImage5.frame;
bgImage5.frame=bgImage2.frame;
myButton6.frame=myButton5.frame;
myButton5.frame=myButton2.frame;
}
else if((im3==1)&&(im5==1))
{
bgImage6.frame=bgImage4.frame;
bgImage4.frame=bgImage2.frame;
myButton6.frame=myButton4.frame;
myButton4.frame=myButton2.frame;
}
else if((im4==1)&&(im5==1))
{
bgImage6.frame=bgImage3.frame;
bgImage3.frame=bgImage2.frame;
myButton6.frame=myButton3.frame;
myButton3.frame=myButton2.frame;
}
else if(im3==1)
{
bgImage6.frame=bgImage5.frame;
bgImage5.frame=bgImage4.frame;
bgImage4.frame=bgImage2.frame;
myButton6.frame=myButton5.frame;
myButton5.frame=myButton4.frame;
myButton4.frame=myButton1.frame;
}
else if(im4==1)
{
bgImage6.frame=bgImage5.frame;
bgImage5.frame=bgImage3.frame;
bgImage3.frame=bgImage2.frame;
myButton6.frame=myButton5.frame;
myButton5.frame=myButton3.frame;
myButton3.frame=myButton1.frame;
}
else if(im5==1)
{
bgImage6.frame=bgImage4.frame;
bgImage4.frame=bgImage3.frame;
bgImage3.frame=bgImage2.frame;
myButton6.frame=myButton4.frame;
myButton4.frame=myButton3.frame;
myButton3.frame=myButton1.frame;
}
else
{
bgImage6.frame=bgImage5.frame;
bgImage5.frame=bgImage4.frame;
bgImage4.frame=bgImage3.frame;
bgImage3.frame=bgImage2.frame;

myButton6.frame=myButton5.frame;
myButton5.frame=myButton4.frame;
myButton4.frame=myButton3.frame;
myButton3.frame=myButton2.frame;
}
[bgImage2 removeFromSuperview];
[bgImage2 release];
bgImage2=nil;
[myButton2 removeFromSuperview];
myButton2=nil;
im2=1;
i--;
x=x-100;
}
}
- (void)buttonClicked3
{
NSLog(@"Delete 3");
if((im4==1)&&(im5==1))
{
bgImage6.frame=bgImage3.frame;
myButton6.frame=myButton3.frame;
}
else if(im4==1)
{
bgImage6.frame=bgImage5.frame;
bgImage5.frame=bgImage3.frame;
myButton6.frame=myButton5.frame;
myButton5.frame=myButton3.frame;
}
else if(im5==1)
{
bgImage6.frame=bgImage4.frame;
bgImage4.frame=bgImage3.frame;
myButton6.frame=myButton4.frame;
myButton4.frame=myButton3.frame;
}
else
{
bgImage6.frame=bgImage5.frame;
bgImage5.frame=bgImage4.frame;
bgImage4.frame=bgImage3.frame;

myButton6.frame=myButton5.frame;
myButton5.frame=myButton4.frame;
myButton4.frame=myButton3.frame;
}
[bgImage3 removeFromSuperview];
[bgImage3 release];
bgImage3=nil;
[myButton3 removeFromSuperview];
myButton3=nil;
im3=1;
i--;
x=x-100;
}
- (void)buttonClicked4
{
if(im5==1)
{
bgImage6.frame=bgImage4.frame;
myButton6.frame=myButton4.frame;
}
else
{
bgImage6.frame=bgImage5.frame;
bgImage5.frame=bgImage4.frame;

myButton6.frame=myButton5.frame;
myButton5.frame=myButton4.frame;
}
[bgImage4 removeFromSuperview];
[bgImage4 release];
bgImage4=nil;
[myButton4 removeFromSuperview];
myButton4=nil;
im4=1;
i--;
}

I can't find a problem in what I've pasted above. Am I missing something?

A: It is better to use NSMutableArray.Use UITableView.Look at this below,may be it useful.For add,delete & insert.You have to see what I declared.
.h---

NSMutabeArray *list;

.m---

-(IBAction)AddButtonAction:(id)sender

{

  [list addObject:@"SaturDay"];

  [tableView reloadData];
}

-(IBAction)DeleteButtonAction:(id)sender
{
  [list removeLastObject];

  [tableView reloadData];

}

-(IBAction) Edit:(id)sender
{

  if(self.editing)

 {

   [super setEditing:NO animated:NO];

   [tableView setEditing:NO animated:NO];

   [tableView reloadData];

   [self.navigationItem.leftBarButtonItem setTitle:@"Edit"];

   [self.navigationItem.leftBarButtonItem setStyle:UIBarButtonItemStylePlain];

 }

else

{

   [super setEditing:YES animated:YES];

   [tableView setEditing:YES animated:YES];

   [tableView reloadData];

   [self.navigationItem.leftBarButtonItem setTitle:@"Done"];

   [self.navigationItem.leftBarButtonItem setStyle:UIBarButtonItemStyleDone];

  }

}


text:
Q: On the existence of solutions to two integer quadratic equations of the same "parity" Let $a,b,c,d\in\mathbb{Z}$ such that $b\mid a^2+1$, $d\mid c^2+1$, $a\equiv c\,(2), b\equiv d\,(2)$.
I have the equations $$b^2 x^2-2abxy+y^2(a^2+1)=b,\quad d^2 x^2-2cdxy+y^2(c^2+1)=d$$ and I am guaranteed that there exist integer solutions $(x,y)$ to the first one and $(x', y')$ to the second one (Not necessarily the same), but I would like to know if always exist integer solutions $(x_1,y_1)$ of the first and $(x_2,y_2)$ of the second with $x_1\equiv x_2\,(2)$ and $y_1\equiv y_2\,(2)$
Analyzing cases I get to:
$a$ even, $b$ odd then \begin{cases}y \,\text{odd} \Rightarrow x\, \text{even}, \\y\,\text{even} \Rightarrow x \,\text{odd}\end{cases}
So in this case it works.
$a$ odd, $b$ odd then $x$ must be odd but I don't know nothing for $y$.
$a$ even, $b$ even cannot happen
$a$ odd, $b$ even gives me no information.
Thanks in advance!

A: Following sketch is based on idea that each of the equations must have two solutions that differ in parity, so if you want two equations that also have different parity, this results in four different parity combinations, yet in this case only three parity combinations are possible for any solution...
First let $P=b,Q=-2a,R=\frac{a^2+1}{b}$, after dividing by $b$ we have a diophantine equation
$$
Px^2+Qxy+Ry^2=1\tag{*}.
$$
This is a quadratic diophantine equation, you can search for generic solutions (there are some on this site too). In our case we have discriminant $D=-4$, so we can use for example Lagrange's Algorithm Revisited:
Solving $at^2 + btu + cu^2 = n$ in the
Case of Negative Discriminant, see especially sections 2 and 4. To summarize, the equation has following solutions by cases:

*

*If $P=1$, $(x,y)=\pm(1,0),\pm(-N,1)$, notice the two solutions have different parity, specifically in second component

*If $P=2$, $(x,y)=\pm(\frac{-N+1}{2},1), \pm (\frac{-(N+1)}{2},1)$ for an odd integer $N$, again we can see the parity differs in first component

*Otherwise solutions are given by two consecutive convergents in continued fraction of $-\frac{Q}{2P}$ in a form $\pm (x,y)$ and $\pm (Nx+Ry,Px+Ny)$. Now to see that these two will differ in parity is a bit tricky, but can be done by inspecting three cases of parity of first solution $(x,y)$ (see below why only three...), then combine it with equation $(*)$ to show that $(Nx+Ry,Px+Ny)$ will have different parity.

We see that equation $(*)$ has by itself always at least two solutions with different parity.
Notice also that $(*)$ implies we cannot have both $x$ and $y$ even, so there are only three possibilities modulo $2$: $(1,0),(0,1)$ and $(1,1)$.
Finally, for the sake of contradiction assume we have a pair of equations with solutions that do not have same parity. That gives at least two distinct parity combinations from each of them, so at least four different parity possibilities together. That is clearly not possible as we have shown there can be at most three possibilities...


text:
Q: Is the Euler characteristic $\chi =2$ for the prism with a hole? I keep getting $\chi=2$ for the solid in the picture. It's a prism with a hole joining two opposite sides. I remember reading that $\chi=0$ for such solids.
Help me find my error. I'd appreciate if someone could just point out which of V, E, F is wrong.

$\text{Vertices} = 4\times 2\times 2=16$
$\text{Edges}=4\times2\times2+4\times 2=24$
$\text{Faces}=4\times2+2=10$
$\chi = V-E+F=16-24+10=2$.

A: The trouble is that not all your "faces" are simply-connected.
Draw segments connecting the corner points of each square to those of the inner square.  Then $V=16$, $E=32$, and $F=16$, so $\chi = 0$.
Hope this helps!


text:
Q: Responsive website redirected in iframe isn't responsive I have multiple domains who redirect to the same responsive website by iFrame.
The problem is, when I visit these website's on a mobile device, it's not longer responsive.
The original website, http://m.isero.nl/, works perfect.
But it's not longer responsive when I use a domain who redirect by frame, like http://iseroijzerwarengroep.be/.
How can I make this website responsive to mobile devices inside an iFrame?
I tried this in my css:
iframe, object, embed{
   width: 100%;
   height: auto;
}

But no success.

A: The problem is that your parent sites don't have the appropriate viewport meta-tag in the <head>. That tag is present in the child site:
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">

A: Create a .php document and upload it to your hosting. Don't create a frame forward in your domain setting, but point the domain to the created .php document. Then use the following code in your .php document to create the frame forward there.
<html>
<head>
<title>Your Title</title>
<meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-
scale=1.0; user-scalable=0">
<link rel='shortcut icon' type='image/x-icon' href='/favicon.ico' />
</head>
<frameset rows="100%" border="0" framespacing="0" frameborder="0">
<frame name="main" src="https://your-target-domain.com/" marginwidth="0"
marginheight="0" scrolling="auto"
noresize="noresize">
</frameset>
<noframes>
</noframes>
</html>

I created a link to a favicon as well. You can take this line out if you dont need it. If you need it, simply upload your favicon as "favicon.ico" into the same directory as the .php file.
Now you have a mobile responsive frame forwarding :)

A: The PHP method recommended by Timm worked like a magic. Check https://shop.wavessystems.com/ redirecting to https://shop.wati.io/075a04d0-5098-4d8f-ad9d-d34e048666c5 without affecting the responsiveness on mobile view.


text:
Q: Python check Internet connection for Scraping I'm creating a Web-Scraper. For that i want to add a function that for each Time the Scraper runs after the Sleep Function, it should check if a Internet connection is available, and when that is the Case, it should continue with the next Scrape and that should continue until I stop the scraper.
At the following Code below I tried to add the Function. When i Debug the Code it jumps to the Breakpoints, but it is breaking when there is no Internet connection.
Code
import time
import smtplib
import lxml
import requests
from bs4 import BeautifulSoup
import csv
import re
from datetime import datetime
import os.path

INTERVAL = 10
INTERVALTIMEOUT = 1

def checkInternetRequests(url='http://www.google.com/', timeout=3):
    try:
        #r = requests.get(url, timeout=timeout)
        r = requests.head(url, timeout=timeout)
        print('Connection funktioniert')
        print(r)
        return True
    except requests.ConnectionError as ex:
        print(ex)
        return False

def supremeJostensGoldRing():

    URL = 'https://stockx.com/de-de/supreme-jostens-world-famous-champion-ring-gold'
    NAME = 'Supreme Jostens Gold Ring'

    headers = {
        "User-Agent": 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.79 Safari/537.36'}

    file_exists = os.path.isfile("Supreme_Jostens_Gold_Ring.csv")
    if not file_exists:
        with open('Supreme_Jostens_Gold_Ring.csv', 'w+') as f:
            f.write('ID,Datum,Uhrzeit,Datum mit Uhrzeit,Preis\n')

    with open('Supreme_Jostens_Gold_Ring.csv', 'r+') as csv_file:
        fieldnames = ['ID', 'Datum', 'Uhrzeit', 'Datum mit Uhrzeit', 'Preis']
        writer = csv.DictWriter(
            csv_file, fieldnames=fieldnames, lineterminator='\n')
        entry = len(csv_file.readlines())

        page = requests.get(URL, headers=headers)
        soup = BeautifulSoup(page.content, "lxml")
        search_for_class = soup.find_all(
            'div', class_="sale-value")
        print(search_for_class)

        x = str(soup.find('div', class_="sale-value"))
        preis = str(re.sub("<.*?>", "", x))

        datum = datetime.now().strftime('%Y-%m-%d')
        uhrzeit = datetime.now().strftime('%H:%M:%S')
        dateTime = datetime.now().strftime('%Y-%m-%d %H:%M:%S')

        new_line = '\n'

        print(NAME)
        print(preis)
        print(datum)
        print(uhrzeit)
        print(dateTime)
        print(new_line)

        writer.writerow({
            'ID': entry,
            'Datum': datum,
            'Uhrzeit': uhrzeit,
            'Datum mit Uhrzeit': dateTime,
            'Preis': preis
        })
        csv_file.flush()
        entry += 1

# while checkInternetRequests() == True:
#     nikeAirRubberDunkOffWhiteGreenStrike()
#     nikeCourtPurple()
#     supremeJostensGoldRing()
#     time.sleep(INTERVAL * 60)

if checkInternetRequests() == True:
    supremeJostensGoldRing()
    time.sleep(INTERVAL * 60)
else:
    if checkInternetRequests() == False:
        try:
            checkInternetRequests()
            if checkInternetRequests == True:
                supremeJostensGoldRing()
                time.sleep(INTERVAL * 60)
        except ValueError as err:
            print(err)


text:
Q: Errors launching Matlab from bash script... likely silly I have the following bash script, calling the matlab script below:
#!/bin/bash -x

var1=HelloWorld
var2=1:4

matlab -nosplash -nodisplay -r "testtest('$var1', $var2), exit"

and
function testtest(in1, in2)
if ischar(in2)
  in2 = str2num(in2)
end

in1
total = sum(in2)

return

I get the following errors (seems to be independent of the function I try to call):
+ var1=HelloWorld
+ var2=1:4
+ matlab -nosplash -nodisplay -r 'testtest('\''HelloWorld'\'', 1:4), exit'
MATLAB_MOD_VERSION:
MATLAB_VERSION: R2014a
LM_LICENSE_FILE (before Matlab is loaded) :
LM_LICENSE_FILE (after Matlab is loaded) : #@#
**************************************************************

... Matlab load text ...

**************************************************************
Executing: /app/matlab/R2014a/bin/matlab -nosplash -nodisplay -r testtest('HelloWorld', 1:4), exit
/app/matlab/R2014a/bin/matlab -c #@# -nosplash -nodisplay -r testtest('HelloWorld', 1:4), exit
/app/matlab/R2014a/bin/matlab: eval: line 1682: syntax error near unexpected token `)'
/app/matlab/R2014a/bin/matlab: eval: line 1682: `exec  "/work1/app/matlab/R2014a-gcc/bin/glnxa64/MATLAB"  -c #@# -nosplash -nodisplay -r "testtest('HelloWorld'," 1:4), exit'
/app/matlab/R2014a/bin/matlab: line 1682: warning: syntax errors in . or eval will cause future versions of the shell to abort as Posix requires

(Note, I replaced the license number with #@#, above)
Thoughts?
Edit: It appears to not like the spaces within the double quotes. If I get rid of the spaces, it works, but I want to say that there is a way to make this work with spaces... I guess not critical to me though. I think it has to do with my single/double quote usage. I've searched around, and as far as I can tell, I'm doing things right...

A: I also thought the quotes were off after looking at the echos.
After more digging, I found that modules are setup for the c-shell, and they are not configured by default for bash. Although I thought Matlab was loaded, this was not the case. I had to manually source the modules for bash, and from there, the code above worked fine.
The code to source and load the module was:
. /etc/profile.d/modules.sh
modules load matlab/R#####

Where ##### was the matlab version. That will be system-dependent as I understand things.
Primary reference:
http://www.linuxquestions.org/questions/programming-9/script-executing-problem-module-command-not-found-761592/
Thanks for your help. I am new to the community... I have found many answers to past questions here!


text:
Q: SJF preemptive scheduling I got this table for pre-emptive Shortest Job First
JOB     ARRIVAL Burst
        TIME    Time
A       15      5
B       27      8
C       19      7
D       4       6
E       10      8
F       52      4
G       33      10
H       38      2

before G, there is 2 seconds before it perform, do i need to include that?
The table given in my answer using gantt chart is
 D  E  E  A  A  C  C  B  B  H  G     F
4 10 15 18 19 23 27 30 33 38 40 50 52

my question is, is it ok to include the waiting time before F arrives?

A: Given your question,first of all I'd like to mention that you haven't mention that whether processes are evaluated on the basis of time-quantum which seems,but,can't be verified because of answer given in your textbook violating the time quanta concept too.
I doubt why the answer consists of two separate A process,if the given scheduling algorithm is Shortest Job First (SJF).
But,I'd like to write this answer. The Gantt chart for this process' list would be :-
|----|   D   |    E    |  A   |    C   |    B    | H |     G    |----|  F  |

0    4      10        18     23       30        38  40          50  52    56

So, the answer to your question is

"YES, WE WOULD HAVE TO CONSIDER THE TIME_GAP OF 2 UNIT(FROM 50 TO 52), AS THERE WON'T BE ANY PROCESS IN THE READY QUEUE TO GET SCHEDULED
  AT THAT TIME,AS ALL OTHER PROCESS WOULD HAVE EXECUTED FULLY IN THE GIVEN TIME."


text:
Q: Rearranging Limit Problem Having some trouble expressing the following:
Find $\displaystyle \lim_{x\to\infty} \frac{2-3x+4x^2}{7 + 12x + 3x^2}$, by first expressing the limit as $\displaystyle \lim_{x\to0} f(x)$, for some real function $\displaystyle f$
My initial thoughts would be to switch the numerator and the denominator and then evaluate at $\displaystyle x\to0$, which would leave an answer of $\displaystyle \frac{7}{2}$, but this seems too easy and is thus more than likely incorrect.

A: First write
$$
{2-3x+4x^2\over 7+12x+3x^2}=
{{2\over x^2}-{3\over x}+4\over {7\over x^2}+{12\over x}+3}.
$$
Then the limit is expressed by (setting $u=1/x$ in the above)
$$
\lim_{u\rightarrow0}{{{2u^2}-{3u}+4\over {7u^2}+{12u}+3}} .
$$

A: Changing variables is inefficient. Rather, simply employ the useful Principle of Domination to deduce the that limit of a quotient is the limit of the quotient of the "dominant" terms, namely factor out the dominant terms from each sum as follows (where limits are as $\rm\:x\to \infty)$
$$\rm\ \frac{f}g\to a,\ \ \frac{f_j}f \to 0,\ \ \frac{g_j}g \to 0\ \ \Rightarrow\ \ \frac{f + f_1 +\cdots f_n}{g + g_1\cdots g_k} \ =\ \frac{f}g\: {\frac{1 + \dfrac{f_1}f+\cdots+\dfrac{f_n}f}{1 + \dfrac{g_1}g +\cdots + \dfrac{g_k}g}}\:\!\to\: a $$
Therefore $\rm\ \ \dfrac{x}{x^2} = \dfrac{1}{x}\to 0,\ \ \dfrac{1}{x^2}\to 0\ \ \Rightarrow\ \ \dfrac{ax^2+bx+c}{dx^2+ex+f}\ =\ \dfrac{a + \dfrac{b}x + \dfrac{c}{x^2}}{d + \dfrac{e}x + \dfrac{f}{x^2}}\to\: \dfrac{a}d $
Should you go on to study the algebraic approach to limits and asymptotics via valuation theory you will find that an analogous principle of domination plays a key role.


text: Q: Get longitude latitude from address using OpenStreetMaps? I'm using OpenStreetMaps + Itinero to route and play with longitude and latitude coordinates. I selected a specific area in OSM and saved it to a file. Thing is, I don't know if these long/lat coords can also be mapped to addresses. Do we know if this is possible?


text:
Q: "Printfing" or "printingf"?

*

*At this point the program starts printfing the pot value.

*At this point the program starts printingf the pot value.

Both sound wrong, and yet... one of them must be used.

A: "printf" shouldn't be a verb in any context, but if that's irrelevant you can set off the piece of code with punctuation as 'printf'ing or `printf'ing.

A: Though I would describe the actions of a computer by function and not by the implementation (meaning that I would say: "while the computer is printing") I would not break up the token if converting it into a verb.

While the computer was printf-ing...

A: I would say "At this point the program starts printing the output value using printf". This is, in my opinion, a case of taking verbing too far.

A: To be honest, I'm not sure why you can't just use the term printing.

At this point the program starts printing the pot value.

Is it really important to include the letter f, just because the printf function is used?  (I mean, it's not as though the output gets printf-ed on the printfer – right?).
If it's absolutely critical to include the name of the function, simply write:

At this point the program starts printing the pot value, using printf.

A: No, you actually have another choice:

"At this point the program starts to printf the pot value."

Similarly, if you have another case like "Don't interrupt the program while it's printfing", you can also reword that:

"Don't interrupt the program during printf"

In short, printf is a programming-language token, not an English-language verb; so if you try to conjugate it you may cause confusion or at least a double-take (unless that's your intention).


text:
Q: LibreOffice Writer edited document is recognized as virus or spyware I got MS word document, person asked me to edit it, to add table of contents, to add page numbers, because she doesn't know how to do in MS Office. So I did with LibreOffice writer. But when I saved (tried several filetypes, including: .doc, .docx, .odt) and send file back to her through facebook firefox and chrome showed error in download list saying
"Blocked: May contain a virus or spyware - "
And actually it says same thing when I download file which I sent and try to open it. And when I did edited this file second time, this time with windows and MS word, everything worked just fine.
So what's the problem here... Do I have virus which is unlikely, not even because I'm on linux, but I know how viruses works and I do not open suspicious files, I'm not going to suspicious websites and this ubuntu 14.04 LTS installed 2 weeks ago.
Something should be wrong with LibreOffice, right.. ?
Can't find any info on the internet about this issue...
And I can replicate this by creating new file with LibreOffice Writer, saved it in .odt with random text with two fonts, Times New Roman and LiberationSeriff, sent it via facebook and can not open it, same error...
Did some experiments and: it's Times New Roman font what caused the problem... What should I do? I need this font...
EDITED: So I turned off this blockage on firefox and I can download file and open it, haven't tried to open it in MS office yet, so not sure if it will work if something really wrong what libre does with MS fonts...
UPDATE: well... everything works in MS Office, nothing bad happened with fonts or document when I opened it. So everything works, but still, browser treats it as virus or spyware. :) I guess LibreOffice guys should know that...

A: That's probably a false positive. You can't do much about that, but you can circumvent it, by putting the document in a Zip archive using your favourite archive manager.
Some malware scanners peek into archives too, in which case you need to encrypted your archive and send the password along with it.


text:
Q: Installing DBD::Sybase on OS X with Homebrew fails to find freetds libraries I am installing  DBD::Sybase
I receive following error, after setting
export SYBASE=/usr/local/Cellar/freetds/0.95.80

and download freetds:
brew install freetds

Error:
Configuring DBD-Sybase-1.15 ... Can't find any Sybase libraries in /usr/local/Cellar/freetds/0.95.80/lib or /usr/local/Cellar/freetds/0.95.80/lib64 at Makefile.PL line 155, <IN> line 44

I believe I need to edit the makefile directly. Do I need to edit makefile? And could I use CPANM still. CPANM is under Brew (cellar).
/usr/local/Cellar/freetds/0.95.80/lib
├── libct.4.dylib
├── libct.a
├── libct.dylib -> libct.4.dylib
├── libsybdb.5.dylib
├── libsybdb.a
└── libsybdb.dylib -> libsybdb.5.dylib

 /usr/local/Cellar/freetds/0.95.80/
AUTHORS              ChangeLog            NEWS                 TODO                 etc                  lib
COPYING              INSTALL_RECEIPT.json README               bin                  include              share

A: There is a reported bug in DBD::Sybase on OS X which is causing your problem.
One part of the configuration thinks you're on Windows. Perl reports OS X as darwin and DBD::Sybase is checking for /win/ as in MSWin32 or maybe cygwin. As a result it looks for a dll directory, but falsely reports it's looking for lib and lib64.
The quick fix is to use cpanm --prompt DBD::Sybase. When it fails, cpanm will ask what to do.
Configuring DBD-Sybase failed.
You can s)kip, r)etry, e)xamine build log, or l)ook ? [s]

Tell it to l)ook. This will dump you into a shell with the unpacked source for DBD::Sybase. Use an editor to delete lines 143-145 in the Makefile.PL.
if ($^O =~ /win/i) {
  @libdir = ( 'dll' );
}

Then exit the shell. cpanm will ask you what to do again, tell it to r)etry. It should use your edited Makefile.PL.


text:
Q: LWC: how to dynamically get translated value from Label In Aura we used to do this:
let labelName = 'mylabel';
$A.getReference("$Label.c."+ labelName);

In LWC $A is not accessible anymore.
Following the documentation I can only see a way to get access to Label's value through import.
As far as I know import don't work dynamically. By this I mean that you need to know which label you want the value of in advance.
In our case the label's name would be stored in a Custom Metadata
I was hoping for a solution involving Apex and/or SOQL but could not find anything.
Any idea?

A: You can dynamically get a label via Apex using this slightly hackish technique:
Component.Apex.OutputText output = new Component.Apex.OutputText();
output.expressions.value = '{!$Label.' + labelStringPassedIn + '}';
String labelValue = String.valueOf(output.value);

Unfortunately you'll need to call this for each label you want to retrieve.
This works in a lightning context.

A: In an LWC you can wrap an Aura function with eval() and it will work still.
I have been trying to dynamically retrieve a Custom Label for an LWC as it contains a Decryption Key, but it doesn't seem possible.
Also the comments above using Component.Apex.OutputText won't work, I get back this error:
Visualforce Component types can only be created within a controller class for a Visualforce page.

Try wrapping your Aura code in eval like this:
eval('$A.getReference("$Label.c.' + labelName + '")');

A: You can not import label dynamically. Here are the conversions from twitter where we have talked about the same thing.
It does include a message from Principal Architect at @Salesforce. This is not possible now but it will be there in the future.
And Dynamic import hasn't made it to a JavaScript standard yet. It is a level 4 proposal
https://github.com/tc39/proposal-dynamic-import/#import
https://twitter.com/TheVishnuKumar/status/1107558419983032320