text:
Q: Passing page URL parameter to controller in Laravel 5.2 In my application I have a page it called index.blade, with route /index. In its URL, it has some get parameter like ?order and ?type.
I want to pass these $_get parameter to my route controller action, query from DB and pass its result data to the index page. What should I do?

A: For those who need to pass part of a url as a parameter (tested in laravel 6.x, maybe it works on laravel 5.x):
Route
Route::get('foo/{bar}', 'FooController@getFoo')->where('bar', '(.*)');

Controller:
class FooController extends Controller
{
    public function getFoo($url){
    return $url;
    }
}

Test 1:
localhost/api/foo/path1/path2/file.gif will send to controller and return:
path1/path2/file.gif

Test 2:
localhost/api/foo/path1/path2/path3/file.doc will send to controller and return:
path1/path2/path3/file.doc

and so on...

A: If you want to access the data sent from get or post request use
public function store(Request $request)
{
    $order = $request->input('order');
    $type = $request->input('type');
    return view('whatever')->with('order', $order)->with('type', $type);
}

you can also use wildcards.
Exemple link
website.dev/user/potato

Route
Route::put('user/{name}', 'UserController@show');

Controller
public function update($name)
{
    User::where('name', $name)->first();
    return view('test')->with('user', $user);
}

Check the Laravel Docs Requests.


text: Q: Messages on Mac say not sending but they are going through I've tried changing my addresses on my phone, logging in and out, and messing with the library setting in finder. I know that the messages are being received and it happens all the time to almost everyone I message thru my comuter (and im receiveing all the messages on my phone as well.) It's just annoying really but not an actual problem.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Modify the size of a pie chart with ggplot in R I have run the following ggplot function :
    g <- ggplot(results_table, aes(x = "", y = Pct*100, fill = Criteria),width = 0.5) +
         geom_bar(stat = "identity", color = Palcolor, fill = Palcolor) +
         coord_polar(theta = "y", start = 0, direction = -1) +
         theme_minimal() +
         theme(legend.position = "none", axis.title.x = element_blank(), axis.title.y = element_blank(),
               panel.border = element_blank(), panel.grid = element_blank(), axis.text = element_blank(),
               axis.ticks = element_blank(), legend.title = element_blank(),
               plot.title = element_text(size = 14, hjust = 0.5, vjust = 0)) +
         geom_text(aes(label = paste0(Criteria,"; ",sprintf("%0.1f", round(Pct*100, digits = 1)),"%")),
                   position = position_stack (vjust = 0.5, reverse = TRUE)) +
        labs(title = gTitle)
  }

and the pie is the following :

but it is too large. I would like to have a diameter smaller than the length of the second part of the title. How can I proceed ?


text:
Q: How to ensure certain class members are initialized before use I was thinking about language constructs and how when we talk about classes and objects in Object oriented languages we draw comparisons to real world. Like when people talk of Inheritance people would quote an example of Parent and Children. One thing that i don't find in OO languages that i know , mainly C, C++, C#, is that they don't have a mechanism to declare a property as mandatory. What i mean by that is I cannot define a class called human and say that face, hands and lets say eye are mandatory property of my class. By having that construct i can enforce that anyone who is using my class need to set those properties before using my class. If user forgets to set those properties then i should get an compile time error.
Just wanted to see community thoughts on that.
Here is reason why i had asked above question:
When i build my user controls, i want to make sure that users should set some of the properties in their code when they use my control. For example, lets say i build a customer user control that would be used by other developers in my team. Some of the properties that i have exposed are: "CustomerId", "FirstName", "LastName", "Address1", "City", "State" and ZipCode. Now i want to make sure that any consumer of my control should set "CustomerId". Using Constructor to enforce that the value is set is a way but it will throw a run time exception plus how would user call that constructor from .cs file without dynamically creating the control and adding it to control collection.

A: The reason is that state needed to fulfil class invariants should be provided during object construction, so you should provide values of 'mandatory' properties as constructor parameters. Your question is based on false assumption that an object is characterized by setting state with properties. This is wrong for a handful of reasons, some of which are:

*

*many, if not most OO languages have no properties: Java, C++,...

*what you use is only formally an object, it is actually a plain record and it is not very object oriented, same as e.g. C++ struct without methods (see notes at the bottom about setters vs methods)

Allowing the client to create instances of the objects which are only later set up with correct values for mandatory state is sure-fire way to spend many hours in company of debugger.
Let's take some User with invariant that first and last name must always be set.
class User {
    public User(string first, string last) { ... }
    public User(string first, string last, uint age) : this(first, last) { ... }
}

// client code:
var user = new User("john", "doe");
var user2 = new User("Clint", "Eastwood", 82);

Compiler ensures that no one can instantiate the object without fulfilling the invariants.
Now compare it with your approach:
class User {
    public User(string first, string last) { ... }
    public User(uint age)  { ... }
    [Mandatory] public string FirstName { get; set; }
    [Mandatory] public string LastName { get; set; }
}

// client code:
var actor = new User(82); // << invalid
actor.FirstName = "Clint";
actor.LastName = "Eastwood"; // << valid

This approach results in more code and allows for a period of time (between << invalid and << valid) where your object is not in a valid state. What if some of property setters throw an exception? You are left with broken object instance floating around. Do you expect the compiler to also verify that code in the setter can not throw? Do you think it is even possible? Besides that, every client which instantiates User instances must check what are the mandatory properties and make sure to set all of them. This effectively breaks encapsulation.
IMO, property setters should be rare, unlike getters. I believe that in such a class you should not have setters for FirstName/LastName, only getters. Instead there should be a method SetName(string first, string last) if you really want to allow name changing. Here's why:
// lets rename actor
actor.FirstName = "John";
actor.LastName = "Wayne";

If the last line throws, you are left with John Eastwood, an actor I have never heard about. With actor.SetName("John", "Wayne") this can't happen.
Additionally, what about property which have dependency in order you specify them, e.g.
obj.ErrorCode = 123;  // imagine that error code must be != 0
obj.ErrorMsg = "foo"; // in order to be allowed to set error code

Would you also introduce attributes for that instead of having obj.SetErrorInfo(123, "foo")? This makes it obvious that properties break encapsulation as the order is caused by the implementation detail, unlike with method call.
Quite often, in languages like C#, required state or dependencies is provided in constructor while optional state can be set through properties. However, it is not properties or inheritance which make a language object-oriented.

A: You can do that, with a DDD principle: create a class with a private default constructor, and a public constructor that accept required parameters and validate its values. If a value is invalid, throw an exception so that the object cannot be created. Properties could also have private setters instead of public setters.
You can also create a 'Mandatory' attribute and put those on top of the properties that are mandatory; and have a mechanism that checks this based on whether a property has been decorated with the attribute or not.
Example:
public class BlogEntry
{
    private BlogEntry() {}
    public BlogEntry(string title, string body)
    {
        LastModifiedDate = DateTime.Now;
        Title = title;
        Body = body;

        var blogEntryValidator = new BlogEntryValidator();
        blogEntryValidator.ValidateAndThrow(this);
    }

    public int Id { get; private set; }
    public string Title { get; private set; }
    public string Body { get; private set; }
    public DateTime? LastPublishDate { get; private set; }
    public DateTime LastModifiedDate { get; private set; }
    public virtual ICollection<Comment> Comments { get; private set; }

    public void Publish()
    {
        LastPublishDate = DateTime.Now;
    }

    public void Unpublish()
    {
        LastPublishDate = null;
    }

    public void Modify(string title, string body)
    {
        Title = title;
        Body = body;
        LastModifiedDate = DateTime.Now;
    }

    public Comment AddComment(string commentText, string emailAddress, string name)
    {
        var comment = new Comment(this, commentText, emailAddress, name);
        if (Comments == null) Comments = new List<Comment>();
        Comments.Add(comment);
        return comment;
    }

    public void RemoveComment(Comment comment)
    {
        Comments.Remove(comment);
    }
}

public class Comment
{
    private Comment() {}
    public Comment(BlogEntry blogEntry, string name, string emailAddress, string commentText)
    {
        BlogEntry = blogEntry;
        Name = name;
        EmailAddress = emailAddress;
        CommentText = commentText;
        DateWritten = DateTime.Now;

        var commentValidator = new CommentValidator();
        commentValidator.ValidateAndThrow(this);
    }

    public int Id { get; private set; }
    public string Name { get; private set; }
    public string EmailAddress { get; private set; }
    public string CommentText { get; private set; }
    public DateTime DateWritten { get; private set; }
    public BlogEntry BlogEntry { get; private set; }
}

A: Yes, C++ and C# allow for this via constructors.
class A
{
public:
    A(int x, int y, int z)
      : _x(x_, _y(y), _z(z) {}
private:
    int _x;
    int _y;
    int _z;
};

You cannot create an instance of A without providing values for _x, _y, and _z.

A: Sure you can!  Just use parameters in constructor to denote which are mandatory.
public class Human
{
    public Face Face { get; set; }
    public Hand Hand { get; set; }

    public Human(Face face, Hand hand) {} etc...
}

In this instance, you cannot use the private constructor, so these properties are essentially "mandatory" in order to use the Human class.


text:
Q: How to delete cookie on codeigniter I don't know how to delete a cookie. I want is when I submit a form. The cookie is also delete. I try the delete_cookie("name") but is not working. I think because the cookie I created by javascript. Please check my code to fix this problem.
This is my sample text field:
<input name="cargo_no" type="text"  class="validate[required]"  id="cargonumber" onchange="setCookie('cargonumberC', this.value, 365);"/>

and this is the javascript
function setCookie(cookieName, cookieValue, nDays) {
    var today = new Date();
    var expire = new Date();

    if (!nDays)
        nDays=1;

    expire.setTime(today.getTime() + 3600000*24*nDays);
    document.cookie = cookieName+"="+escape(cookieValue) + ";expires="+expire.toGMTString();
}

function readCookie(name) {
  var nameEQ = name + "=";
  var ca = document.cookie.split(';');
  for(var i = 0; i < ca.length; i++) {
    var c = ca[i];
    while (c.charAt(0) == ' ') c = c.substring(1, c.length);
    if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length, c.length);
  }
  return null;
  }

document.addEventListener('DOMContentLoaded', function() {
  var themeSelect = document.getElementById('cargonumber');
  var selectedTheme = readCookie('cargonumberC');

  if (selectedTheme) {
    themeSelect.value = selectedTheme;
  }
});

A: Using Codeigniter, put it inside the save method of your controller:
Try:
delete_cookie('name', $domain, $path);

Details on official documentation

A: You can delete cookie from CodeIgniter. Use cookie helper like
$this->load->helper('cookie');
delete_cookie("name");

A: To delete a cookie use:
helper('cookie');
delete_cookie('remember_me');

A: You can't delete a cookie. The browser (or the user) has the delete the cookie(s). But, you can make the browser auto-remove the cookie by setting the expiration of the cookie to a date in the past. Here's a JavaScript example.
function deleteCookie(cookieName, cookieValue) {

document.cookie = cookieName+"="+escape(cookieValue) + ";expires=Thu, 01 Jan 1970 00:00:01 GMT;";

}


text:
Q: Why does JavaSystem.LoadLibrary() throw an UnsatisfiedLinkError despite the library existing in project? I try to embedd an external library to my .Net MAUI project, but am unable to.
Following the process in this question:

*

*I copied the .so file into
<project root>\Resources\lib\<platform>\ (the platforms being arm64-v8a, armeabi-v7a and x86_64).

*Then set the Build Action = AndroidNativeLibrary for the file

*I set the <AndroidNativeLibrary Include="Resources\lib\<platform>" /> in my .csproj file

*Then I call JavaSystem.LoadLibrary(lib name); in the MainActivity.cs file of the Android project (which is my target platform)

As soon as my App is starting I receive a Java.Lang.UnsatisfiedLinkgError: 'dlopen failed: library libc++_shared.so" not found'
Why do I get this Error? My interpretation is, that the path to my library is wrong or the file is not correctly included into the build process, but I don't know why my previous steps are not sufficient.
I already tried to solve this by:

*

*moving the path of the .so file into the platform specific folders \Platforms\Android\lib\<platform>

*changing the <CopyToOutputDirectory></CopyToOutputDirectory> to various options

Unfortunately without success.
Edit: Fixing a typo


text:
Q: Execute several commands in 1 line in cmd I couldn't come across a solution for this. I am working on a java program which creates a .bat file and executes it afterwards. the only struggle i have is, that i have to navigate to the destination the file was written to.
i tried with
cmd /K cd C:/Users/user start test.bat

as well as several other versions of it. none worked. the problem is that i can't have the cmd navigate the the folder and stay there to execute the start command. any help is appreciated

A: You can start several programs or commands in one line by either using & or &&.
In your example that would become
cmd /K cd C:/Users/user & start test.bat

Alternatively you can also just start the batchfile with the full path and place the cd command in the batchfile itself. Example:
start c:\users\user\test.bat

and in test.bat include:
cd /d c:\users\user
:: the rest of your script


text:
Q: Метод в C#, меняющий местами значения переменных Я новичок в программировании на C#, попался вопрос про обмен значениями переменных без использования третьей. С одним из решений все понятно:
int a = 2;
int b = 4;
a = a + b;
b = a - b;
a = a - b;

У меня другой вопрос, можно ли это как-то засунуть в метод? Написал так:
class Program
{
    public static void Main(string[] args)
    {

        Console.WriteLine("Введите значения переменных a и b");
        Console.Write("a = ");

        int x = int.Parse(Console.ReadLine());

        Console.Write("b = ");

        int y = int.Parse(Console.ReadLine());

        SwapNumbers(x, y);
        Console.Write($"Переменная a = {x}, переменная b = {y} ");
        Console.ReadLine();

    }

    public static void SwapNumbers(int a, int b)
    {
        a = a + b;
        b = a - b;
        a = a - b;
    }
}

Но переменные x и y не меняются местами, по крайне мере в методе Main. Можно сделать так:
public static void SwapNumbers(int a, int b)
    {
        a = a + b;
        b = a - b;
        a = a - b;
        Console.Write($"Переменная a = {a}, переменная b = {b} ");
    }

Но это выглядит как-то коряво и неуместно, потому что я хочу, чтобы метод только менял местами введенные с клавиатуры значения, а где и когда их вывести я хочу решать сам.

A: Всё дело в том, что ты передаешь копии переменных в метод Swap. Чтобы иметь возможность передавать ссылку есть ключевое слово ref.
Т.е. метод будет выглядеть так:
public static void Main(string[] args)
{
    int a = 7, b = 5;
    Console.WriteLine("a -> {0}; b -> {1}", a, b);
    Swap(ref a, ref b);
    Console.WriteLine("a -> {0}; b -> {1}", a, b);
}

public static void Swap(ref int a, ref int b)
{
    a = a + b;
    b = a - b;
    a = a - b;
}

Есть также параметр out. Разница между ref и out тут: ref и out

A: При передаче в метод по значению (по умолчанию) в метод передается копия переменной, соответственно в вашем коде значения x и y не изменяются.
При указании модификатора ref переменные передаются в метод по ссылке, а не по значению. В этом случае при изменении значений переменной в методе будет изменено значение и в вызывающем методе.

A: void Swap<T>(ref T a, ref T b){
    T temp = a;
    a = b;
    b = temp;
    //Здесь <T> означает что будут использоваться неконкретные типы и мы эти типы и
    //будем менять местами. При вызове метода нужно использовать такой синтаксис
    //int a = 0, b = 1;
    //Swap(ref a,ref b)
}

Можно в острые скобки (не знаю как их принято называть) вписываем тип переменной и всё.

A: Если использовать крайнюю версию языка C#, то можно вытворять вот такой беспредел
int a = 10;
int b = 15;

Console.WriteLine($"{a}-{b}");

(a, b) = (b, a); // обмен

Console.WriteLine($"{a}-{b}");

вывод ожидаемо
10-15
15-10


text:
Q: Having trouble identifying the error when using the navigationController stack Description
So I decided to fire up my app once more, after doing a clean and reinstall, and found that I was getting a crash that would send me to a "Thread 1: signal SIGABRT" at the top of the AppDelegate.swift file. The error occurred when I was simply navigating through views, via buttons that show(push) on to the stack. I even tried commenting out the functions on the view that I was trying to reach, in order to insure that it wasn't a function throwing an error for some reason. Below, I will attach some code snippets connected with the view I am trying to reach and the view that I am currently on. Sorry if this seems vague. It is just a very vague issue I am running into.
Code
class back4: UIViewController, UITextFieldDelegate{

@IBOutlet weak var no: UIButton!
@IBOutlet weak var yes: UIButton!
@IBOutlet weak var distance: UITextField!
override func viewDidLoad() {
    super.viewDidLoad()
}
override func didReceiveMemoryWarning() {
    super.didReceiveMemoryWarning()
}
/*
@IBAction func save(_ sender: AnyObject) {
    let appDel:AppDelegate = (UIApplication.shared().delegate as! AppDelegate)
    let context:NSManagedObjectContext = appDel.managedObjectContext
    let entity1 = NSEntityDescription.insertNewObject(forEntityName: "CrawlerOne", into:context) as NSManagedObject as! CrawlerOne
    entity1.crawlerDistance = distance.text

}
@IBAction func yes(_ sender: AnyObject) {
    let appDel:AppDelegate = (UIApplication.shared().delegate as! AppDelegate)
    let context:NSManagedObjectContext = appDel.managedObjectContext
    let entity1 = NSEntityDescription.insertNewObject(forEntityName: "CrawlerOne", into:context) as NSManagedObject as! CrawlerOne
    entity1.crawlerAbrasion = "yes"
}
@IBAction func no(_ sender: AnyObject) {
    let appDel:AppDelegate = (UIApplication.shared().delegate as! AppDelegate)
    let context:NSManagedObjectContext = appDel.managedObjectContext
    let entity1 = NSEntityDescription.insertNewObject(forEntityName: "CrawlerOne", into:context) as NSManagedObject as! CrawlerOne
    entity1.crawlerAbrasion = "no"

}
*/
@IBAction func back(_ sender: AnyObject) {
    if let navController = self.navigationController {
        navController.popViewController(animated: true)
    }
  }
}

*

*^ This is the code for the view that I am trying to reach, via a show segue connected to a button*
class back3: UIViewController, UITextFieldDelegate{

override func viewDidLoad() {
    super.viewDidLoad()
}
override func didReceiveMemoryWarning() {
    super.didReceiveMemoryWarning()
}
@IBAction func back(_ sender: AnyObject) {
    if let navController = self.navigationController {
      navController.popViewController(animated: true)
   }
  }
}

^ This is the code attached to the view I am currently at
Recap
Again, I don't get any error messages besides the "Thread 1: signal SIGABRT" at the top of AppDelegate.swift. I've also already checked for accidental multi-segue'd buttons, because I know I've accidentally done that in the past. I am using swift 3 and xcode 8.0
Debugger Console

2016-08-04 10:05:32.239 Prototype Inspection[9292:4560823] CUICatalog: Invalid asset name supplied
2016-08-04 10:05:32.241 Prototype Inspection[9292:4560823] Could not load the "" image referenced from a nib in the bundle with identifier "Wirtgen.Prototype-Inspection"
2016-08-04 10:05:33.732 Prototype Inspection[9292:4560823] CUICatalog: Invalid asset name supplied:
2016-08-04 10:05:33.733 Prototype Inspection[9292:4560823] Could not load the "" image referenced from a nib in the bundle with identifier "Wirtgen.Prototype-Inspection"
2016-08-04 10:05:34.609 Prototype Inspection[9292:4560823] CUICatalog: Invalid asset name supplied:
2016-08-04 10:05:34.610 Prototype Inspection[9292:4560823] Could not load the "" image referenced from a nib in the bundle with identifier "Wirtgen.Prototype-Inspection"
2016-08-04 10:05:35.981 Prototype Inspection[9292:4560823] Unknown class back4 in Interface Builder file.
2016-08-04 10:05:36.010 Prototype Inspection[9292:4560823] *** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[ setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key distance.'
*** First throw call stack:
(0x180a42db0 0x1800a7f80 0x180a42a70 0x18134f6e4 0x185f15de8 0x186078eb0 0x180966888 0x186077898 0x185f19230 0x185cde118 0x185ba08ec 0x185bb90d0 0x185d53e5c 0x185c5fe40 0x185c5fb1c 0x185c5fa84 0x185b9c1e4 0x18352e994 0x1835295d0 0x183529490 0x183528ac0 0x183528820 0x185b9eff4 0x1809f909c 0x1809f8b30 0x1809f6830 0x180920c50 0x182208088 0x185c0a088 0x1000ad4c8 0x1804be8b8)
libc++abi.dylib: terminating with uncaught exception of type NSException
  (lldb)

A: The view controller that you're navigation to has an outlet for distance hooked up in the storyboard, but a distance property doesn't (or no longer) exists on the destination view controller's class. It says that no back4 class could be found. Make sure that in the view controller's identity inspector, it has the correct module set below the class name. Sometimes Xcode fails to infer the correct module, and you have to set it manually.


text:
Q: Setting up macOS terminal to start a non-Anaconda R installation? I'm actually trying to get R work with the Jupyter notebook. For this the IRkernel is the native kernel but I'm getting an error code 127 when executing the last step. This is because the last command IRkernel::installspec() needs to be run in bash but the terminal is not recognising a valid PATH to a R installation.
Now, I also have Anaconda installed and despite providing the terminal a valid path to R, keying-in 'R' in the terminal returns this error:
MacBook-Pro:~ Shiv$ R
dyld: Library not loaded: @rpath/libintl.9.dylib
Referenced from: /Users/Shiv/anaconda3/lib/R/lib/libR.dylib
Reason: image not found
Abort trap: 6

Which I believe its pointing out to my Anaconda libraries that doesn't have RStudio installed. Now, I would like to keep R as a totally separate tool and not as a part of Conda. What am I missing here that bash won't start R in the native shell? Once am through with it, installing the kernel to work with Jupyter is a tiny process.


text:
Q: Jquery validation on container.validate() instead of form.validate() we are building a new umbraco website, which contains many registration forms and we are using Jquery validation plugin to validate these forms.
Since each usercontrol(macro) contains server tags we have to use one form in each usercontrol to get the JQuery validation to work.
But since we are using one form in each usercontrol, we can't add multiple controls in a page.
What we want to do is add a form tag with runat="server" in master page and then do all the validation with some container.validate(); instead of form.validate().
ie something like this

  <input type="text" class="required" name="Name" id="txtName" runat="server"/>

A: The Validation plugin needs the various fields that it's going to be validating to be contained within a set of <form></form> tags.
http://rocketsquared.com/wiki/Plugins/Validation
However, you can do validation without having to "submit" the form.  It can still be achieved with the onkeyup: or onfocusout: handlers for an example.
So if you can simply change your
 into something like <form id="regForm" ... >, you'll then be able to validate.
EDIT:
For HTML 4, the only required form attribute is action, so there's no reason you can't just replace your

 with this...
<form id="regForm" action="#"> </form>

A: This is a late answer, but seeing that none of the existing answers were accepted, here is my take on this. I just ran into a similar situation where I needed to validate a div contained in a form for a modal dialog. Here is how I solved it.

<form action="#">

       <input type="text" required name="Name" id="txtName"        runat="server"/>
       <button class="continue">Continue</button>

       <input type="text" required name="Address" id="txtAddress" runat="server"/>
       <input type="text" required name="City" id="txtCity" runat="server"/>
       <input type="text" required name="State" id="txtState" runat="server"/>
       <input type="text" required name="Zip" id="txtZip" runat="server"/>
       <button class="continue">Continue</button>

</form>

A: By default asp.net can only have one form with runat="server". You can however have multiple forms on the page as Sparky's answer shows. More info on multiple forms in asp.net can be found here: http://msdn.microsoft.com/en-us/magazine/cc164151.aspx.


text:
Q: How to exit or close an UWP C++ app programmatically? I want to add "Exit" button in my app.
If I write something like this:
void LibraryUWP::MainPage::ExitEvent(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e)
{
    Application::Exit;
}

I have an error:

1>...\mainpage.xaml.cpp(32): error C3867: 'Windows::UI::Xaml::Application::Exit': non-standard syntax; use '&' to create a pointer to member

If I run
void LibraryUWP::MainPage::ExitEvent(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e)
{
    Application::Exit();
}

I have:

1>...\mainpage.xaml.cpp(32): error C2352: 'Windows::UI::Xaml::Application::Exit': illegal call of non-static member function

And if I run this:
void LibraryUWP::MainPage::ExitEvent(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e)
{
    Application::Current::Exit();
}

I have an error:

1>...\mainpage.xaml.cpp(32): error C2039: 'Exit': is not a member of 'Windows::UI::Xaml::Application::Current'
  1>...\mainpage.xaml.cpp(32): error C3861: 'Exit': identifier not found

I understand, that first & second variant cannot work. But what about the third? Or something else?
MS Visual Studio 2015 Update 3.
For Windows 10.10240 platform
P.S. If I run third variant without last bracers, I have the same error, that tells me, that we have no such method.

A: Change your code to this:
void MyApp::MainPage::Button_Click(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e)
{
    Application::Current->Exit();
}

Thanks,
Stefan Wick - Windows Developer Platform

A: If your app only has one window, you can exit app like this:
void UWPcpp::MainPage::Button_Click(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e)
{
    ApplicationView::GetForCurrentView()->TryConsolidateAsync();
}

This suspends your app instead of abruptly exiting it, also this is the only way when you relaunch your app it will have the same size and location as previous.


text:
Q: Detect touch and hold with UITableViewCell, what are my options? With my current table view controller, I'd like to implement a touch and hold feature very similar to how the click-wheel iPod's On-The-Go queueing feature used to work.
I've been reading a few posts and have seen suggestions for using UILongPressGestureRecognizer. Whilst I could do that, it does bring up a couple more questions for me:

*

*If a long press is detected, how can I prevent the
didSelectRowAtIndexPath method from being called (Or do I
completely avoid using it and implement a Tap gesture recogniser in
my UITableViewCell subclass?)

*How would I go about animating the cell once a long-press has been
detected similar to the iPod style (where the highlighted cell
flashes/opacity of highlight goes up and down a few times).

Would appreciate some guidance.

A: If you use the long press recognizer, and it fires, didSelectRowAtIndexPath will not fire.
You can detect the state of the gesture recognizer and animate your cell after the 'start' state is detected, and end the animation when the 'end' state is detected.
if (gestureRecognizer.state == UIGestureRecognizerStateBegan) ...
if (gestureRecognizer.state == UIGestureRecognizerStateEnded) ...


text:
Q: C# Button transparent background on MouseHover I've got this button, created in code, which had a background image and is transparent. So far so good, it works, the horrible grey background color is gone.
EXCEPT for when I hover my mouse over it, the irritating keeps coming back.
So I've tried what I could think of, and that's adding an eventlistener which would change the backgroun color to transparent on MouseHover, Enter and Leave. But nothing seems to work.
Any ideas?
Here's my code so far:
    private void CreateFirstScreen() {
        mainForm.BackgroundImage = Image.FromFile(@"[img dir]");

        Button nextBtn = new Button();
        nextBtn.BackColor = Color.Transparent;        <== this works!
        nextBtn.BackgroundImage = Image.FromFile(@"[img dir]");
        nextBtn.FlatStyle = FlatStyle.Flat;

        nextBtn.FlatAppearance.BorderSize = 0;
        nextBtn.SetBounds(1555, 820, 274, 106);

        mainForm.Controls.Add(nextBtn);

        nextBtn.MouseHover += (sender, args) => {
            nextBtn.BackColor = Color.Transparent;    <= doesn't work
        };
        nextBtn.MouseEnter += (sender, args) => {
            nextBtn.BackColor = Color.Transparent;    <= doesn't work
        };
        nextBtn.MouseLeave += (sender, args) => {
            nextBtn.BackColor = Color.Transparent;    <= doesn't work
        };
        nextBtn.Click += (sender, args) => {
            CreateSecondScreen();                     <= does work
            mainForm.Controls.Remove(nextBtn);        <= does work
        };
    }

A: Try adding this:
nextBtn.FlatAppearance.MouseOverBackColor=Color.Transparent;


text:
Q: Why I can't use this as a model on my index page? I have a class named Banner which I want to use as a model for my index page. But whenever I try to use it, I receive the following errors:
"The name Banner does not exist in current context"
"The name of type or namespace Banner cannot be found ( Missing directive or reference )"
I've always used models like this and for other classes it works fine...
After some seach I found some answers but none worked, this is what I've tried:

*

*Restarting the computer

*Restarting Visual Studio

*Deleting .vs folder

*Recreating Banner class

Index.cshtml
@model QBit_Ecommerce_Mvc.Models.Util.Banner

@{
    ViewData["Title"] = "Home Page";
}

<link rel="stylesheet" href="~/css/Index.css">

                @{ int cont = 0;}
                @foreach (Banner _Banner in Banner.listaBanners)
                {
                    if (cont == 0)
                    {

                    }
                    else
                    {

                    }
                    cont++;
                }

                Previous

                Next

Here is where the Banner is not recognized:
@foreach (Banner _Banner in Banner.listaBanners)

And here is my Banner class:
using Microsoft.Data.SqlClient;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Threading.Tasks;

namespace QBit_Ecommerce_Mvc.Models.Util
{
    public class Banner : Conexao
    {
        #region "Construtores"
        public Banner()
        {

        }
        #endregion

        #region "Propriedades"
        public string _Imagem { get; set; }
        public byte[] _ImagemBytes { get; set; }
        #endregion

        #region "Variáveis"
        public static List<Banner> listaBanners = new List<Banner>();
        #endregion

        #region "Métodos"
        public List<Banner> GetBanners()
        {
            try
            {
                string sql = "SELECT Imagem FROM EcommerceBanners";
                DataTable dtBanner = new DataTable();

                using (SqlConnection _Connection = Conectar())
                {
                    using (SqlCommand _Command = new SqlCommand(sql, _Connection))
                    {
                        _Command.CommandType = CommandType.StoredProcedure;
                        SqlDataReader reader;
                        using (reader = _Command.ExecuteReader())
                        {
                            dtBanner.Load(reader);
                        }
                    }
                }

                if (dtBanner.Rows.Count != 0)
                {
                    foreach (DataRow _RowBanner in dtBanner.Rows)
                    {
                        Banner _Banner = new Banner();
                        _Banner._ImagemBytes = (byte[])_RowBanner.ItemArray[0];
                        _Banner._Imagem = Convert.ToBase64String(_Banner._ImagemBytes);
                        listaBanners.Add(_Banner);
                    }
                }
                return listaBanners;
            }
            catch (Exception)
            {

                throw;
            }
        }
        #endregion
    }
}

Any ideas on how to fix this and use my model on index?

EDIT
Controller index action
public IActionResult Index()
        {
            if(Produto.listaProdutos.Count() <= 0)
            {
                Produto _Produto = new Produto();
                _Produto.CarregaListaProdutos();
            }
            return View();
        }

A:
Here is where the Banner is not recognized:
@foreach (Banner _Banner in Banner.listaBanners)

Since you want to use Banner class in the View page(.cshtml), you have to add the namespace first. So, try to add @using QBit_Ecommerce_Mvc.Models.Util at the head of the page.
In the Index.cshtml, code like below:
@using QBit_Ecommerce_Mvc.Models.Util
@model QBit_Ecommerce_Mvc.Models.Util.Banner
@{
    ViewData["Title"] = "Home Page";
}

<link rel="stylesheet" href="~/css/Index.css">

                @{ int cont = 0;}
                @foreach (Banner _Banner in Banner.listaBanners)
                {
                    if (cont == 0)
                    {

                    }
                    else
                    {

                    }
                    cont++;
                }

                Previous

                Next


text:
Q: Kubuntu: unlock or disable keyring Whenever I login to skype I get this keyring message. I don't remember setting any keyring or don't even know what it is. I can login to my kubuntu with my password but to unlock keyring same password does not work. So how can I unlock this keyring or completely remove/disable this keyring option?
None of the existing solutions work for Kubuntu, either those solutions are old or the menu doesn't exist in Kubuntu.

A: In kubuntu for Passwords and keys option, Install seahorse.
sudo apt-get install seahorse

After installing you will get passwords and keys option in search. Open passwords and keys, it will display available password and keys. Right click on password and select delete to remove.

A: After doing tons of research I couldn't find anything that would work for Kubuntu. But I got some idea and found a keyrings directory here /home/bcc/.local/share/keyrings/. I removed all the files from this directory, then did a restart and everything was back to normal. Hope this will be helpful. I am using Kubuntu 18


text:
Q: Microsoft chart control failing to set background transparent I have a microsoft pie chart control. I am setting the background transparent, but it is staying white. As you can see I've set the BackColor and PageColor properties of the BorderSkin. I've also set the BackColor of the ChartArea as well. Here's some code.
Chart chart = new Chart
            {
                Width = 190,
                Height = 159,
                RenderType = RenderType.BinaryStreaming,
                AntiAliasing = AntiAliasingStyles.Graphics,
                TextAntiAliasingQuality = TextAntiAliasingQuality.Normal
            };

            // turn on transparency
            chart.BorderSkin.BackColor = Color.Transparent;
            chart.BorderSkin.PageColor = Color.Transparent;
            chart.BorderSkin.SkinStyle = BorderSkinStyle.Emboss;

            chart.ChartAreas.Add("");

            chart.ChartAreas[0].AxisX.Interval = 1; // setting this to 1 forces all items to show
            chart.ChartAreas[0].AxisX.LabelStyle.Enabled = true;
            chart.ChartAreas[0].AxisX.TitleFont = xLabelFont;
            chart.ChartAreas[0].AxisX.MajorGrid.Enabled = false;

            chart.ChartAreas[0].AxisY.TitleFont = yLabelFont;
            chart.ChartAreas[0].AxisY.LabelStyle.IsStaggered = false; // staggers axis label
            chart.ChartAreas[0].AxisY.TextOrientation = TextOrientation.Horizontal;
            chart.ChartAreas[0].AxisY.MajorGrid.Enabled = false;
            chart.ChartAreas[0].AlignmentOrientation = AreaAlignmentOrientations.All;

            chart.ChartAreas[0].BackColor = Color.Transparent;
            chart.Series.Add("");
            chart.Series[0].ChartType = SeriesChartType.Pie;
            //chart.Series[0]["PieLabelStyle"] = "Disabled"; // disable labels
            chart.Series[0].IsValueShownAsLabel = true; // *** super important to be able to manually set labels show point labels for value ***

            chart.ChartAreas[0].Area3DStyle.Enable3D = true;

A: I don't see this line:
chart.BackColor = Color.Transparent;

A: Colors of chart, chart's area(s), legends, etc... are set separately.
And remember add:
chart.TextAntiAliasingQuality = TextAntiAliasingQuality.SystemDefault;

when you set the background of the chart to transparent, or you will get terrible low quality fonts.

A: I needed these two lines:
chart.BackColor = Color.Transparent;
chart.ChartAreas[0].BackColor = Color.Transparent;


text:
Q: How to get an element inside the array I want to get only the title from my array but I'm not sure how
My array :
Let books = [
{title= "harry potter",
author="jk Rowling",
},
{title= "another title",
author="another author",
},
{title= "3rd title",
author="3rd author",
},
]

And because I'm trying to get every each of the titles I used the forEach function and I tried it like this :
books.forEach(element => console.log (element));

And then I tried to change the element with the
[books].title

But I get an error that says  that doesn't work with arrow function.

A: First lets fix your books array i assume your making JSON type array for this your code must be like this
let books = [
{"title": "Harry",
"author": "JK"
},
{"title": "Another title",
"author": "Another author"}
]

Then you can simply map that array using .map function
console.log(books.map((data)=>{return data.title}));

the output will be in Array with all title elements.
Output: ['Harry', 'Another title']

A: First, Let is not a valid JavaScript keyword; let is. Also, in JavaScript object key-value pairs are separated by : not by =.
You can use the Array#map method to achieve your objective as follows:

const books = [{title:"harry potter",author:"jk Rowling"},{title:"another title",author:"another author"},{title:"3rd title",author:"3rd author"}],

      titles = books.map(({title}) => title),
      authors = books.map(({author}) => author);

console.log( titles, authors );

A: I think from this you can get your answer so you have to create a map like this
var objArray = [{"firstname":"bbb","userName":"bbb1","title":"","created_by_user_id":"-1","enabled":"true","lastname":"AC","last_connection":"","password":"","manager_id":"0","id":"14","job_title":"job1","last_update_date":"2018-08-08 13:35:56.996"},{"firstname":"aaa","icon":"icons/default/icon_user.png","creation_date":"2018-08-08 13:35:56.876","userName":"aaa1","title":"","created_by_user_id":"-1","enabled":"true","lastname":"AH","last_connection":"","password":"","manager_id":"0","id":"9","job_title":"job2","last_update_date":"2018-08-08 13:35:56.876"}];

let result = objArray.map(o => ({id: o.id}));
console.log(result);

A: To begin with, the array is not a correct JS array, you should replace = by :. Then you can use map if you want to transform the array:
let books = [
  {
    title: "harry potter",
    author: "jk Rowling",
  },
  {
    title: "another title",
    author: "another author",
  },
  {
    title: "3rd title",
    author: "3rd author",
  },
]

let titles = books.map(book => book.title);
console.log(titles); // ["harry potter", "another title", "3rd title"]

A: You can simply do something like this

books.forEach( ({title}) => console.log (title));


text:
Q: Uncaught TypeError: undefined in removeCookie I check and the cookie is there but I got an error of Uncaught TypeError: undefined, below is my code:
$('#logout').click(function(){
  $.removeCookie("fb_userId");
});

A: The error says that script loading order is wrong. Try doing:

*

*include jQuery

*include jQuery cookie plugin

*move your code in $(document).ready(function () {...});
You code will be:
<script src="/path/to/jquery.js"></script>
<script src="/path/to/jquery.cookie.js"></script>
<script>
  $(document).ready(function () {
    $('#logout').click(function(){
      $.removeCookie("fb_userId");
    });
  });
</script>


text:
Q: Attach physical menu button to my preferences screen My app has a classic PreferenceScreen which activity is triggered by a dedicated button on my UI.
When I click the "Menu" button of the AVD, or the physical menu button on my device, a "Parameter" button shows at the bottom of the screen : pressing on it has no effect, how can I attach it to my actual preference screen, just like my button already does ? Thanks.
(I guess all I need is to be able to find it to attach a OnClick listener to it)
EDIT : I am targeting API Level 14+

A: Found it : by tracking key "action_settings" that was automatically generated, I ended up un MyMainActivity.onOptionsItemSelected(MenuItem item), which is a stub for selected options.
I just had to create and launch an Intent to my Settings activity from here.


text:
Q: SQL Server , inserting existing rows into the same table I have a table say Table A

*

*Col A is the primary key (identity).

*Col b is a foreign key from some other table.

Now, for example I want to select the rows where colB = 2 , and insert the rows back into the table again but with a different value of col B say 5 . This can be done easily. Next once the rows are inserted again, I need to find the relation between the copies, especially.
Say new rows are inserted with primary key 6,7,8. Now I want to check which parent row (row with primary key value 1/2/3) has the same data as row with primary key 6. Similarly, I need to find relative for the row with primary key 7, 8. One way is to do the insert one row at a time so that we can say that row with primary key 1 is the copy of row with primary key 6. Another way to do is to join all the columns. I am trying to avoid all these to see if there is any easy solution possible.

A: Use SCOPE_IDENTITY() to get last primary key inserted value on your table. If another process could be modifying the table then do your update & query in one transaction.


text:
Q: codeigniter ajax login error div and session issue i have stuck creating a login using codeigniter 3.0 with AppUI 2.1 bootstrap theme, it always show the error div in login and everytime i successfully logged in, it will also successfully direct to Maps view but when i navigate to Information Table view and go back to maps view, it will redirect to login view.
Any suggestions? Here's my code:
model/Login_model.php
class Login_model extends CI_Model {

public function login($username, $password) {
    $passwordEncrypt = sha1($password);
    $this->db->where('username', $username);
    $this->db->where('password', $passwordEncrypt);
    $query = $this->db->get('admin');
    if ($query->num_rows() == 1) {
        foreach ($query->result() as $row) {
            $data = array(
                'username' => $row->username,
                'password' => $row->password,
                'logged_in' => true
            );
        }
        $this->load->library('session');
        $this->session->set_userdata($data);
        return true;
    } else {
        return false;
    }
}

public function isLoggedIn() {
    header("cache-Control: no-store, no-cache, must-revalidate");
    header("cache-Control: post-check=0, pre-check=0", false);
    header("Pragma: no-cache");
    $is_logged_in = $this->session->userdata('logged_in');

    if (!isset($is_logged_in) || $is_logged_in !== true) {
        redirect('/');
        exit;
    }
}

}
views/page_ready_login.php
<?php
include 'assets/Backend/inc/config.php';
$template['title'] = 'BCGIS | LOGIN';
?>
<?php include 'assets/Backend/inc/template_start.php'; ?>

                <img src="<?= base_url(); ?>assets/Backend/images/Ph_seal_davao_del_norte_panabo_city.png" style="width: 95px; height: 80px;"/>

                Brgy. Cagangohan Geographical Information System

Administration Login

        <form id="form-login" action="<?= base_url(); ?>Maps" method="post" class="form-horizontal">

Invalid Administrator's Username or Password.

                    <input type="text" id="login-username" name="login-username" class="form-control" placeholder="Username..">

                    <input type="password" id="login-password" name="login-password" class="form-control" placeholder="Password..">

                        <button type="submit" class="btn btn-effect-ripple btn-block btn-primary"> Sign In</button>

        </form>

         © <?php echo $template['name'] . ' ' . $template['version']; ?>

<?php include 'assets/Backend/inc/template_scripts.php'; ?>

<?php include 'assets/Backend/inc/template_end.php'; ?>

controller/Login.php
class Login extends CI_Controller {

public function __construct() {
    parent::__construct();
    $this->load->library('session');
    $this->load->helper('form');
    $this->load->helper('url');
    $this->load->helper('html');
    $this->load->library('form_validation');
    $this->load->Model("Login_model");
}

public function index() {
    $this->load->view('Backend/page_ready_login');
}

public function logout() {
    $this->session->sess_destroy();
    redirect(base_url(), 'refresh');
}

public function login() {

}

controller/Maps.php (where it suppose to direct when successfully logged in)
class Maps extends CI_Controller {

public function __construct() {
    parent::__construct();
    $this->load->Model('Login_model');
}

public function index() {
    $username = $this->input->post('login-username');
    $password = $this->input->post('login-password');

    if ($this->Login_model->login($username, $password)) {
        $this->Login_model->isLoggedIn();
        $this->load->view('Backend/page_comp_maps');
    } else {
        redirect(base_url(), 'refresh');
    }
}

assets/Backend/js/pages/readyLogin.js
var ReadyLogin = function () {

return {
    init: function () {
        /*
         *  Jquery Validation, Check out more examples and documentation at https://github.com/jzaefferer/jquery-validation
         */

        /* Login form - Initialize Validation */
        $('#form-login').validate({
            errorClass: 'help-block shake animated', // You can change the animation class for a different entrance animation - check animations page
            errorElement: 'div',
            errorPlacement: function (error, e) {
                e.parents('.form-group > div').append(error);
            },
            highlight: function (e) {
                $(e).closest('.form-group').removeClass('has-success has-error').addClass('has-error');
                $(e).closest('.help-block').remove();
            },
            success: function (e) {
                e.closest('.form-group').removeClass('has-success has-error');
                e.closest('.help-block').remove();
            },
            rules: {
                'login-username': {
                    required: true,
                    error: true
                },
                'login-password': {
                    required: true,
                    minlength: 5,
                    error: true
                }
            },
            messages: {
                'login-username': {
                    required: "Please enter Administrator's username.",
                    error: "Invalid Administrator's username."
                },
                'login-password': {
                    required: "Please provide Administrator's password.",
                    minlength: "Admin's password must be at least 5 characters long.",
                    error: "Invalid Administrator's password."
                }
            }
        });
        $("#form-login").submit(function (e){
            e.preventDefault();
            var url = $(this).attr('action');
            var method = $(this).attr('method');
            var data = $(this).serialize();

            $.ajax({
               url:url,
               type:method,
               data:data
            }).done(function(data){
               if(data !=='')
                {
                    $("#response").show('fast');
                    $("#response").effect( "shake" );
                    $('#form-login')[0].reset();
                }
                else
                {
                window.location.href = url;
                throw new Error('go');
                }
            });
        });

        $( "div" ).each(function( index ) {
        var cl = $(this).attr('class');
        if(cl ==='')
            {
                $(this).hide();
            }
        });
    }
};

}();
in readyLogin.js between $('#form-login').submit(function(e){}), it seems the code in it didn't work.
for more, here the link for my project.
Any help will much appreciated. :)


text:
Q: Perfomance Comparision NHibernate and ADO.NET I have evaluating the performance of NHibernate and ADO.NET. I have created a test application which has an Employee table with 75,000 records. When I try to get data using NHibernate it is very slow compare to ADO.NET, it's about 290% (approx.) slower.
The average performance of NHibenrnate to bind 75,000 records is 2535 milliseconds .
The average performance of ADO.net  to bind 75,000 records is 867  milliseconds.
I can understand that NHibernate is a Wrapper to ADO.NET but you cannot pay the price of 300% for retrieval
We tried the optimization tips for NHibernate from Internet. Here are some

*

*Use of Stateless Session

*Use of Named Query

*Session Flushing

*Using Stored Procedure

*Using Recompiled option

As per my experience time is getting consumed when building the objects in memory. Also the query which is getting fired from NHibernate and SQL in profiler has differences. Does not make any difference if executed again and again
Select ID, Name, DateOfJoin, DateOfBirth, DepartmentID, Status from Employee : Duration 516
Select this._ID as ID2_0_, this_.Name as Name2_0_, this_.DateOfJoin as DateOfJoin2_0_, this_.DateOfBirth as DateOfBirth2_0_, this_.DepartmentID as DepartmentID2_0_, this_.Status as Status2_0_ from dbo.Employee this_: Duration 1538
Kindly suggest any other mechanism for increasing the performance. What should be the ideal performance difference when using ORM?
Please find the code below….
//Employee Class
public class Employee
{
    public virtual int ID { get; set; }
    public virtual string Name { get; set; }
    public virtual DateTime DateOfJoin { get; set; }
    public virtual DateTime DateOfBirth { get; set; }
    public virtual string DepartmentID { get; set; }
    public virtual string Status { get; set; }
}

//NHibernate Mapping
public EmployeeMap()
{
    Table("Employee");
    Id(p => p.ID).GeneratedBy.Increment();
    Map(p => p. Name);
    Map(p => p. DateOfJoin);
    Map(p => p. DateOfBirth);
    Map(p => p. DepartmentID);
    Map(p => p. Status);
}
//Building Session Factory
public static ISessionFactory SessionFactory
    {
       get
        {
            if (_sessionFactory == null)
            {
                _sessionFactory = Fluently.Configure()
                .Database(MsSqlConfiguration.MsSql2008.ConnectionString(c => c.FromConnectionStringWithKey("Connection")))
    .Mappings(m => m.FluentMappings.AddFromAssemblyOf<Employee>())
                                  .BuildSessionFactory();
            }
            return _sessionFactory;
        }
    }

//Fetching data using CreateQuey
using (IStatelessSession session = SessionManager.SessionFactory.OpenStatelessSession())
{
  IList<Employee> lstEmployee = session.CreateCriteria< Employee >().List<Employee>();
return lstEmployees.ToList<Employee>();
}

//Fetching data using Create Query
using (IStatelessSession session = SessionManager.SessionFactory.OpenStatelessSession())
      {
IList<Employee> lstEmployee = session.CreateQuery("from Employee "). List<Employee>();
return lstEmployees.ToList<Employee>();
   }

//Fetching Data using ADO.net
DataTable dtEmployees = /*Data is fetched from ADO.net using SQL Query*/;
        List<Employee> lstEmployee = new List<Employee>();

        foreach (DataRow dr in dtEmployees.AsEnumerable())
        {
            Employee employee = new Employee
            {
                ID = dr.Field<int>("ID"),
                Name = dr.Field<decimal>("Name"),
                DateOfJoin = dr.Field<int>("DateOfJoin"),
                DateOfBirth = dr.Field<int>("DateOfBirth"),
                DepartmentID = dr.Field<int>("DepartmentID"),
                Status = dr.Field<DateTime>("Status"),
            };
            lstEmployee.Add(Employee);

A: the following copies the complete 75k results in a seperate list;
IList<Employee> lstEmployee = ...
return lstEmployees.ToList<Employee>();

it is enough to
return lstEmployees;


text:
Q: How to install VSS in Windows 2007 I am working on Visual SourceSafe, for that I am trying to install the VSS update 2005. At the time of installing I am getting the following Error message: "The upgrade patch cannot be installed by the Windows Installer service because the program to be upgraded may be missing, or the upgrade patch may update a different version of the program.Verify that the program to be upgraded exists on your computer and that you have the correct upgrade patch."
Can you give me the solution for the above issue and I downloaded it from the following enter link description here


text:
Q: L298 Motor Driver spinning motor only one way :/ i just made a motor driver circuit on a veroboard to use with my arduino
but the problem is l298 spinning motor only one way.
here is the code
it was supposed to spin motor forth and backwards every 2 seconds right?
int mot1ana=5;
int mot1a=6;
int mot1b=7;

void setup() {
pinMode(mot1ana,OUTPUT);
pinMode(mot1a,OUTPUT);
pinMode(mot1b,OUTPUT);
}

void loop() {
  analogWrite(mot1ana,200);
  digitalWrite(mot1a,HIGH);
  digitalWrite(mot1b,LOW);
  delay(2000);
  analogWrite(mot1ana,200);
  digitalWrite(mot1a,LOW);
  digitalWrite(mot1b,HIGH);
  delay(2000);
}

A: It looks like you have chosen to use arduino pin numbers that are very similar to the necessary pin numbers on the L298. Nothing wrong with that, you can use whichever arduino pins are convenient. But it seems like it would be an easy mistake (with the given code) just to wire pin N from the arduino to pin N of the L298 under such circumstances.
With the L298, you want the analog PWM going into pin 6, and your arduino is producing that at pin 5. So you'd want 5 from the arduino going to 6 on the L298, and 6 on the arduino going to 5 on the L298. Arduino pin 7 would still go to L298 pin 7.
OR
if want to go with the 5-5, 6-6, 7-7 wiring, you could fix it in software, just by changing
int mot1ana=5;
int mot1a=6;
int mot1b=7;

to
int mot1ana=6;
int mot1a=5;
int mot1b=7;

A: The first thing would be to check your motor driver actually works. It could be damaged, or perhaps is not designed to run motors in reverse. I'd check it by connecting the appropriate control pins to its V+ input.


text:
Q: Table not displaying data when changing page in Angular I'm trying to make a table displaying data get from an API. I manage to get the 1st page but when changing page, the data is not displayed despite I can see my data from console.log().
Here's the code to call the serice
ngOnInit(): void {
    this.productsSub = this.productsService.getProducts(this.page, this.pageSize).subscribe((res: any) => {
      this.products = res.data
      this.total_products = res.meta.pagination.total
    })
  }

  getPageFromService(currentPage: any){
    this.productsSub = this.productsService.getProducts(currentPage, this.pageSize).subscribe((res: any) => {
      this.products = res.data
    })
  }

My HTML for the table

                        Thao tác
                        Mã QR
                        Hình ảnh
                        Mã Sản Phẩm
                        Tên Sản Phẩm
                        ĐVT
                        Scan
                        Danh mục
                        Phê duyệt
                        Giá
                        Tồn
                        Hiển thị
                        Cập nhật bởi
                        Ngày tạo

                            <fa-icon [icon]="file" style="background: orange;"></fa-icon>
                            <fa-icon [icon]="penToSquare" style="background: orange;"></fa-icon>
                            <fa-icon [icon]="trash" style="background: red;"></fa-icon>

                        QR

                        {{product.code}}
                        {{product.name}}
                        {{product.unit_name}}
                        0
                        {{product.categories}}
                        {{product.publish_status_name}}
                        {{product.original_price_formatted}}
                        {{product.qty}}

Bật

Tắt

                        {{product.created_by}}
                        {{product.created_at}}

<ngb-pagination (pageChange)="getPageFromService($event)" class="d-flex justify-content-center" [(page)]="page" [pageSize]="pageSize" [collectionSize]="total_products" [maxSize]="3" [rotate]="true" [ellipses]="false" [boundaryLinks]="true"></ngb-pagination>

Thanks for the help!

A: API call from method getProducts, is already taking care of bringing the relevant records from the server. You don't have to repeat the same logic on UI once again. You can remove the calculations part of *ngFor using slice pipe with page and pageSize based logic.
Just keep your *ngFor simple
*ngFor="let product of products"

What was wrong?
Let's assume pageSize = 10
Now the user clicks on the 2nd page of navigation. It is called getProducts with parameters page & pageSize. It brings the next page data 10 size. Now the calculation of (page-1)*pageSize : (page-1)*pageSize + pageSize becomes 10 to start slicing from 10 the index. And there are no more than 10 records, nothing was displayed.
*ngFor="let product of products | slice: (page-1)*pageSize : (page-1)*pageSize + pageSize"


text:
Q: Get a database value in QWeb PDF report (Odoo 10) I would like to retrieve a config parameter from database in a custom QWeb Report.
What shall I do?
Specifically, I want to get the equivalent (in the model):
self.env['ir.config_parameter'].get_param('my_param', '')

Could someone highlight where to start?

As additional information, the report I am trying to use inherits report.minimal_layout:
<?xml version="1.0"?>
<odoo>
    <data>

        <template id="report_saleorder_css" inherit_id="report.minimal_layout">
            <xpath expr="html/head/*[position() = last()]" position="after">
                <style>
                    body {
                        color: <t t-esc="color"/>;
                    }

                </style>
            </xpath>
        </template>

    </data>
</odoo>

And this is the custom render function I have tried:
class CustomReport(models.AbstractModel):
    _name = 'report.mymodule.report_saleorder_css'
    @api.model
    def render_html(self, data=None):
        report_obj = self.env['report']
        report = report_obj._get_report_from_name('mymodule.report_saleorder_css')
        docargs = {
            'doc_ids': self._ids,
            'doc_model': report.model,
            'docs': self,
            'color': 'red'
        }
        return report_obj.render('mymodule.report_saleorder_css', docargs)

without success

A: In simple word you want to retrieve a config parameter whenever you print qweb report.
we can not directly use self.env in qweb report, but we can call a function which do that operation and return config parameter value. To do that first create python function in your model.
@api.model
def get_system_para(self):
    para_value = self.env['ir.config_parameter'].get_param('web.base.url','')
    return para_value

Now call this function in your qweb report
<span t-esc="docs.get_system_para()"/>

A: You have to retrieve the value beforehand and pass it to your template for usage.
You can do this by defining your own parser for your report, check the documentation.
See under Custom Reports on how you can create your own parser (Python class) and how you can use the docargs. Basically within the render_html method you search for your value, insert it on docargs and then pass it on the render method. Then you can use it from your template like:
<t t-esc="my_param" />


text:
Q: Foreach only showing First item in array I am trying to get data for each id using foreach. But when code run it get only data for 1 ID.. Following is the code
$buffalidforavgmilk = Buffalodata::groupBy('buffaloID')->get('buffaloID')- >pluck('buffaloID')->toArray();

foreach ($buffalidforavgmilk as $id) {
    $milkperid = Buffalomilkrecord::where('buffaloID', $id)->pluck('buffaloID')->toArray();
    dd([$buffalidforavgmilk,$milkperid]);
}

Output
      array:2 [▼
               0 => array:4 [▼
                             0 => "Buffalo-01"
                             1 => "Buffalo-02"
                             2 => "Buffalo-03"
                             3 => "Buffalo-04"
                            ]

               1 => array:5 [▼
                             0 => "Buffalo-01"
                             1 => "Buffalo-01"
                             2 => "Buffalo-01"
                             3 => "Buffalo-01"
                             4 => "Buffalo-01"
                            ]
            ]

Here Loop giving only 1 ID where as required array for all 4 ID
( for Test, i try to get only buffaloID)
Thanks in Advance

A: dd interrupts execution. If you wanted to dump every result and then stop execution, you should have used dump instead
foreach ($buffalidforavgmilk as $id) {
    $milkperid = Buffalomilkrecord::where('buffaloID', $id)->pluck('buffaloID')->toArray();
    dump([$buffalidforavgmilk,$milkperid]);
}

dd('Done');

This is not ideal though. You are making a query in each iteration of the loop.
One way you could remove the foreach is to change your query to use whereIn.
$buffalidforavgmilk = Buffalodata::groupBy('buffaloID')->pluck('buffaloID')->toArray();

$milkperids = Buffalomilkrecord::whereIn('buffaloID', $buffalidforavgmilk)->pluck('buffaloID')->toArray();


text:
Q: Problemas al tratar de utilizar Project Loom/Virtual Threads con OPENJDK 19-loom JAVA estoy tratando de probar el proyecto loom referente de los virtual threads en Java y estoy utilizando la versión del JDK 19-loom siguiente:

package com;

import java.util.concurrent.ThreadFactory;

public class a {

    public static void main (String [] args) throws Exception{
        Runnable printThread = () -> System.out.println(Thread.currentThread());

        ThreadFactory virtualThreadFactory = Thread.builder().virtual().factory();
        ThreadFactory kernelThreadFactory = Thread.builder().factory();

        Thread virtualThread = virtualThreadFactory.newThread(printThread);
        Thread kernelThread = kernelThreadFactory.newThread(printThread);

        virtualThread.start();
        kernelThread.start();

    }
}

Y tengo la configuracion siguiente de intelij:

Pero estoy teniendo el error siguiente:

Y es que al parecer no se identifica el builder del thread

Me gustaría saber que mas necesito?

A: Lo primero que debes hacer es actualizar el IntelliJ para poder tener disponible el nivel de compilador "X - Experimental features" (yo estoy usando la versión 2021.3 y esta lo trae).

Luego debes actualizar tú código puesto que el método Thread#builder() ya no existe (por lo menos en la build 19-loom+2-58). En la API de esta versión indica que para crear builders tanto para threads virtuales como para los de plataforma debemos usar los métodos Thread#ofVirtual() y Thread#ofPlatform() respectivamente. Por lo que tú código debe quedar parecido a este:
ThreadFactory virtualThreadFactory = Thread.ofVirtual().factory();
ThreadFactory kernelThreadFactory = Thread.ofPlatform().factory();

P.D.: Lo parámetros por línea de comandos que le pases al compilador o al binario de java, como lo que indicas en tú comentario (javac --release 19 --enable-preview prueba.java), no tiene efecto en el IDE, por lo que aunque indiques el nivel del compilador de este modo no podrás autocompletar código desde el IDE de acuerdo a dicho nivel.


text:
Q: Store "Provider" and "Terraform" version in separate TF file? Currently, I have to define the Terraform version and Provider version in each of my Terraform templates.
I would like to have a file outside of my Terraform templates where I can define the Provider version and Terraform version to use for every template in the directory structure.
I've looked at using an overrides file (https://www.terraform.io/docs/configuration/override.html), but it appears I'd have to define the whole Terraform/Provider block from each template within the override.tf file. I'd really like to just be able to tell Terraform to look at (pseudo-file) versions.tf, for example, to get the necessary versions for every template.
So something like this would be the desired (simplified) directory structure:
 terraform
     ├── dev
     │   └── main.tf
     ├── prod
     │   └── main.tf
     ├── stg
     │   └── main.tf
     └── versions.tf

Right now there would need to be only one Provider version and one Terraform version defined in versions.tf
Is it possible to pass Provider/Terraform version into templates in this way?

A: If you don't want to use Terraform Workspaces then create a symlink in each subdirectory pointing to the versions.tf file.
For example, if your structure is:
terraform
     ├── dev
     │   └── main.tf
     ├── prod
     │   └── main.tf
     ├── stg
     │   └── main.tf
     └── versions.tf

And you want each subdirectory (dev, prod, stg) to point to the versions.tf file on the root terraform directory, create a symlink in each subdirectory:
ln -sf terraform/versions.tf terraform/dev/versions.tf
ln -sf terraform/versions.tf terraform/prod/versions.tf
ln -sf terraform/versions.tf terraform/stg/versions.tf

Your final structure would be:
terraform
     ├── dev
     │   └── main.tf
     │   └── versions.tf -> ../versions.tf
     ├── prod
     │   └── main.tf
     │   └── versions.tf -> ../versions.tf
     ├── stg
     │   └── main.tf
     │   └── versions.tf -> ../versions.tf
     └── versions.tf

Using Terraform Workspaces, instead of having a sub-directory for each "environment" you're using so have a single directory like:
terraform
     ├── main.tf
     └── versions.tf

And a workspace per environment which you create by doing:
terraform workspace new dev

You then use terraform interpolation to do something different depending on which environment you are working on, terraform states are also stored separately per workspace.
So if you want to work on the dev environment you switch to that one:
terraform workspace select dev


text:
Q: How do I add a VMware ESXi Host to Microsoft Virtual Machine Manager? I am trying to manage virtual machines running on a VMware ESXi host using Microsoft System Center Virtual Machine Manager.
I was able to add the ESXi machine using the "Add VMware VirtualCenter server" option, but can't access any of the VMs on the datastore associated with this ESXi server.
The datastore of the ESXi box is showing up with the correct name, but it won't let me see any of the VMs that have already been created; I get "There are no virtual machines on this host."
Because I couldn't get any of the existing virtual machines to show up, I tried creating some new ones. When using VMM to connect to ESXi and create new VMs, I get the following error messages in the "rating explanation" section:

The virtualization software on the
  selected host does not support virtual
  hard disks on an IDE bus.

and

The virtualization software on the
  host XXXXXX does not support the
  creation of dynamic virtual hard disk.

Any ideas on why I can't manage existing machines and why I can't create new ones? The existing machines were created in vSphere.
I should note that the ESXi server and the server running SCVMM are both on the same domain.
I should also note that although the ESXi box has been added as a VirtualCetner server, when I try to add it through the "Add Host" option, I get an error message saying "Virtual Machine Manager cannot complete the VirtualCenter action on server ESXi because of the following error: The operation is not supported on the object."

A: vCenter is a management tool installed on either a physical or virtual Windows 2003 or 2008 server. vCenter in turn manages ESX and ESXi hosts/clusters.
It sounds like you're trying to directly add an ESX or ESXi server when in fact its meant to communicate with a "vCenter" server.

A: ESX does not support using IDE hard disk. What you need to do is to add a new SCSI adapter in the VM creation wizard and attach the virtual hard disk to this controller.


text:
Q: The rank of a square 2 by 2 block matrix with singular square blocks I have tried to prove or disprove the following statement using Penrose-Moore pseudoinverses, but all of the literature on that subject seems to focus on the case $m \not= n$, i.e. rectangular matrices, rather than singular square matrices.

Let $M = \begin{bmatrix} M_1 & M_2 \\ M_3 & M_4 \end{bmatrix}$, where $M$ is a $2m \times 2m$ matrix, and $M_1 , M_2, M_3, M_4$ are $m \times m$ square matrices, all with determinant zero. Moreover, no two adjacent blocks of the $M_1, M_2, M_3, M_4$ are symmetric (hence the answers given here are non-examples, because all of the blocks are symmetric).
Show that $M$ has determinant zero, or find a counterexample where $M$ is not singular.

Any help or insights with this problem would be greatly appreciated; I know this is probably a simple problem, but I am not sure how to apply the Laplace expansion in the case that the block matrices just have determinant zero, rather than being all zeros.
This answer here says that the answer is affirmative and trivial, but I am not seeing it unfortunately.
The condition regarding symmetry may seem random, but it is motivated by the fact that in such cases we can replace the blocks by their characteristic polynomial and still achieve desirable results. See, for example, here: http://www.ee.iisc.ac.in/new/people/faculty/prasantg/downloads/blocks.pdf


text:
Q: Python: IndexError: list index out of range with randint function I have a code that asks the user if they want the program to draw rectangular patterns (if they enter the number 1) or circular patterns (if they enter number 2).
It works fine, but if the user enters the number 3 then the program randomly has to choose to draw either circular or rectangular patterns in a random place on the screen.
The only input the user has to enter after choosing (3) is how many random patterns should be drawn on the screen.
The problem is that I am getting an error

"line 91, in drawSuperPattern rand_shape = shape_functs[randint(0,1)] IndexError: list index out of range".

How can I solve this? I have tried fixing it but I can't seem to solve it.
my main code:
import pattern

def main():

    while True:
        print("Choose a mode")
        print("1) Rectangle Pattern")
        print("2) Circle Pattern")
        print("3) Super Pattern")

        mode = int(input("Which mode do you want to play? 1, 2 or 3: "))

        pattern.setup()

        if mode == 1:
            width = int(input("Enter width for the rectangles: "))
            height = int(input("Enter height for the rectangles: "))
            offset = int(input("Enter the offset for the rectangle: "))
            count = int(input("Enter how many rectangles you'd like in the pattern: "))
            centerX, centerY = eval(input("Enter center position (x, y): "))

            pattern.drawRectanglePattern(int(centerX), int(centerY), width, height, count, offset)
        elif mode == 2:
            radius = int(input("Enter the radius for the circles: "))
            offset2 = int(input("Enter the offset for the circle: "))
            count = int(input("Enter how many circles you'd like in the pattern: "))
            centerX, centerY = eval(input("Enter center position (x, y): "))

            pattern.drawCirclePattern(int(centerX), int(centerY), radius, count, offset2)
        elif mode == 3:
            super = int(input("Enter how many super patterns you'd like: "))

            pattern.drawSuperPattern(super)

        print("Do you want to play again?")
        print("1) Yes, and keep drawings")
        print("2) Yes, and clear drawings")
        print("3) No, I am all done")

        response = int(input("Choose 1, 2, or 3: "))

        if response == 1:
            pass
        elif response == 2:
            pattern.reset()
        else:
            print("Thanks for playing!")
            break

main()

pattern.py code
import turtle
from random import choice, randint

turtle.speed('fastest')

SCREEN_WIDTH = 1000
SCREEN_HEIGHT = 800

COLORS = ["pink", "red", "purple", "black", "dark cyan", "lavender", "blue", "yellow", "dark green", "orange", "gold", "brown", "tan"]

def setup():
    turtle.screensize(SCREEN_WIDTH, SCREEN_HEIGHT)
    turtle.speed('fastest')

def reset():
    turtle.clearscreen()

def getRandomColor():
    return choice(COLORS)

def drawRectangle(centerX, centerY, width, height):
    #turtle.goto(centerX - width/2, centerY - height/2)
    turtle.pd()
    turtle.color(getRandomColor())

    for _ in range(2):
        turtle.forward(width)
        turtle.left(90)
        turtle.forward(height)
        turtle.left(90)

def drawRectanglePattern(centerX, centerY, width, height, count, offset):
    rotation = 360 / count
    turtle.pu()
    turtle.goto(centerX, centerY)

    for _ in range(count):

        turtle.pu()

        turtle.forward(offset)
        turtle.right(90+rotation/2)

        drawRectangle(centerX, centerY, width, height)

        turtle.pu()

        turtle.left(90+rotation/2)
        turtle.backward(offset)

        turtle.right(rotation)

def drawCircle(centerX, centerY, radius):

    turtle.pd()
    turtle.color(getRandomColor())
    turtle.circle(radius)

def drawCirclePattern(centerX, centerY, radius, count, offset2):
    rotation = 360 / count
    turtle.pu()
    turtle.goto(centerX, centerY)

    for _ in range(count):

        turtle.pu()

        turtle.forward(offset2)
        turtle.right(90+rotation/2)

        drawCircle(centerX, centerY, radius)

        turtle.pu()

        turtle.left(90+rotation/2)
        turtle.backward(offset2)

        turtle.right(rotation)

def drawSuperPattern(super):

    for i in range(super):

        shape_functs = [drawRectanglePattern]

        rand_shape = shape_functs[randint(0,1)]

        width = randint(0,100)
        height = randint(0,100)
        offset = randint(0,100)
        count = randint(0,100)
        centerX = randint(0,100)
        centerY = randint(0,100)

        rand_shape(int(centerX), int(centerY), width, height, count, offset)

        shape_funcs = [drawCirclePattern]
        rand_shape2 = shape_funcs[randint(0, 1)]

        offset2 = randint(0, 100)
        count = randint(0, 100)
        radius = randint(0, 100)
        centerX = randint(0, 200)
        centerY = randint(0, 200)

        rand_shape2(centerX, centerY, count, offset2, radius)

A: You only have one item in your shape_funcs list:
shape_functs = [drawRectanglePattern]
rand_shape = shape_functs[randint(0,1)]

If you try access element 0, rand_shape will set to "drawRectanglePattern" but there is no object at element 1, it is outside the bounds of your list.  If you try and access it it will error.
You could try:
shape_functs = [drawRectanglePattern, drawCirclePattern]

This will solve that error, but since drawRectanglePattern and drawCirclePattern take a different number of arguments, the code will fail when you try and call rand_shape.
A good software pattern to use here, particularly if you have lots of different shapes to choose from would use 'Inheritance'.  For your simple use case you can get away with something like:
randnum = randint(0, 1)
if randnum == 0:
    # set up rectangle inputs
    drawRectanglePattern(int(centerX), int(centerY), width, height, count, offset)
elif randnum == 1:
    # set up circle inputs
    drawCirclePattern(centerX, centerY, radius, count, offset2)


text:
Q: how objects values are retained when we drain the pool at the end of run loop I know this sounds like a dumb question but I need to ask this. Well I read that autorelease pool is drained after one iteration of run loop after it has handled events. My question is that then how come my apps objects are retained after I clicked on button. So, by definition It should destroy all the objects which I have created (may be I have assigned some values to objects) after I click on button. But that doesnt happen ? right ? I can click my button again and again but I dont lose any object data.
Correct me if I am wrong somewhere.

A: All that the autorelease pool does is decrement the retain count of objects in the pool when it is drained.  If that results in the retain count becoming zero, the object will be destroyed (dealloc'ed).
However, if an object has been retained more than once, the retain count will be greater than zero so it will not be destroyed (note that objects are created with a retain count of 1.)

A: You should watch a video or two from https://developer.apple.com/videos/ - Great introductions to memory management and such. And I also strongly recommend you look into ARC as soon as you grasp the basics of retain/release/autorelease.


text:
Q: Microsoft SQL Subtract columns from query by column name How can I extract columns by column name from all columns selected with SELECT *
Table1 cols = x,y,z,t
Table2 cols = a,b,z,t

sample query like;
Select *
EXTRACT t
LEFT JOIN Table1
ON CAST(Table1.t AS SMALLDATETIME) = CAST(Table2.t AS SMALLDATETIME)

i want output
x,y,a,b,t

A: There are three ways to specify the columns you want in your result set.

*

*select *, which will return all columns available in the query.

*select MyTable.* which will return all columns from MyTable. If you have used an alias for the table, you can also use MyAlias.*, which is equivalent.

*Specify all of the columns you want individually, by name.

You can also combine techniques (2) and (3).
It is a good idea to always use technique 3 only.
There is no way to specify columns that you don't want to return, unfortunately.
Examples:
This query will return all columns {T.a, T.b, U.c, U.d}:
create table T (a int, b int);
create table U (c int, d int);

select *
from   T
join   U on t.a = u.c

This query will return only the columns on T, ie {T.a, T.b}
select T.*
from   T
join   U on T.a = U.c

This query will return the columns {T.a, T.b, U.d}
select T.a, T.b, U.d
from   T
join   U on T.a = U.c

This query will return all columns from T, plus column d from U:
select  T.*, U.d
from    T
join    U on t.a = u.c

There is no way to do anything like this:
-- syntax error
select * except U.c
from   T
join   U on T.a = U.c

A: I guess you want
SELECT Table1.x, Table1.y, Table2.a, Table2.b, Table1.t
  FROM Table2
  LEFT JOIN Table1
      ON CAST(Table1.t AS SMALLDATETIME)
       = CAST(Table2.t AS SMALLDATETIME)

You don't extract columns from tables, you SELECT them.


text:
Q: How to create View Controller and its Controls programmatically in Swift? I am populating a table view as menu using a custom table view cell and using it as menu.I am able to navigate to other views using navigation controller.
But I want to create views and its controls programmatically. Is it possible?
Can anyone please share me an example. Please find my menu structure in the following image.

A: This is how i did it. It works like a charm!!!
func tableView(_tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
    //Remove the below line from this function as it will perform segue.
    //performSegue(withIdentifier: "DynamicSegue", sender: self)
}

override func prepare(for segue: UIStoryboardSegue, sender: AnyObject?) {
    // This will actually perform your segue
    var DestViewController = segue.destination as! DynamicSuperView
    let selectedRow = tableView.indexPathForSelectedRow?.row
    DestViewController.labelText = names[selectedRow!]
}


text:
Q: How can I constantly check and compare values saved in sessionStorage? I am attempting to use a dedicated web worker (can only be accessed by the script that spawned it) over multiple pages (shared workers are incompatible with Safari and IE prior to 8). Due to this, a new dedicated worker must be created upon each new page load, as the previous worker will no longer be in the scope, so I am using sessionStorage to keep track of a variable across pages.
I am trying to set a timestamp from when the first worker is spawned on a login, save this timestamp in sessionStorage, then every x minutes after the initial timestamp, send a message to the server to make sure the session is still active.
I am using
if (Window.sessionStorage.getItem('last_timestamp') === null {
    //send message to server
    Window.sessionStorage.setItem('last_timestamp', Date.now().getTime());
}

to initialize the web worker and first timestamp.
I am unsure about how to constantly compare that timestamp to the current time in order to know precisely when x minutes have passed so that another message can be sent. I am thinking there must be some sort of listener for this, but I have not been able to find anything.


text:
Q: MySQL DISTINCT ignored in SELECT displays duplicate I have the following query that is joining 3 tables but is displaying duplicate results where I only one instance of a record by using DISTINCT on the r.Email column.
SELECT DISTINCT FirstName, LastName, r.Email, ListingID, ListingFirmID
    FROM sancap_Residential_Property e
    JOIN sancap_Agent r ON e.ListingAgentID=r.AgentID
    JOIN sancap_Office d ON e.ListingFirmID=d.firmID
    WHERE ListingFirmID != 'BrokerC'

The data looks like this, the ListingID information being unique is why I believe the query is showing the Agent ID. How do I overcome this?
Buck      |     Rogers     |     buck@rogers.com     |     656565      |      BrokerAA
Buck      |     Rogers     |     buck@rogers.com     |     787878      |      BrokerAA
Pamm      |     Feeets     |     pamm@feeets.com     |     999999      |      BrokerBB

The result I'd like is this:
Buck      |     Rogers     |     buck@rogers.com     |     656565      |      BrokerAA
Pamm      |     Feeets     |     pamm@feeets.com     |     999999      |      BrokerBB

A: Better try Group by and min() function
SELECT FirstName, LastName, r.Email, min(ListingID) as ListingID, ListingFirmID
    FROM sancap_Residential_Property e
    JOIN sancap_Agent r ON e.ListingAgentID = r.AgentID
    JOIN sancap_Office d ON e.ListingFirmID = d.firmID
    WHERE ListingFirmID != 'BrokerC'
GROUP BY FirstName, LastName, r.Email, ListingFirmID

With above query you will get distinct combination of FirstName, LastName, r.Email, ListingFirmID along with minimum value of ListingID.

A: try like this.
SELECT FirstName, LastName, r.Email, ListingID, ListingFirmID
    FROM sancap_Residential_Property e
    JOIN sancap_Agent r ON e.ListingAgentID=r.AgentID
    JOIN sancap_Office d ON e.ListingFirmID=d.firmID
    WHERE ListingFirmID != 'BrokerC'
group by FirstName, LastName, r.Email,ListingFirmID


text:
Q: Forms loosing caption on W10 I'm sorry, this will be a no-code question, but I think it is still the right place to ask. I'm using the (unfortunately) not so famous language APL and am having problems running my apps under W10 - the forms are shown without a caption:

Only when I switch focus to another app, it gets visible:

So, without going too much into the details, has anyone come across this before (in other languages on the Windows10-platform) and are there perhaps any new settings or events that need to be considered? (I discussed this with Dyalog, the developers of that environment, but they seem pretty sure that they are unable to address this...)

A: I've been struggling with this for wks now, but suddenly I found the solution: I was using a '3D'-property of the form (set to value 'Dialog') and when I removed this, everything looked good :-)


text:
Q: How to display information? sorry for the previous post. I'll try to be more precise.
Using Gstreamer I created a pipeline, which contains an element of video.ts, I can see and hear the video without problems, but I would like to get some information packages video.ts.
The information is to be interested get me PTS, DTS, OFFSET and PID. To view these values I used the property of "emit-stats" of Tsdemux.

g_object_set(G_OBJECT(v1_demux),"emit-stats",1,NULL);

Now, I want to see the values of PTS, DTS, OFFSET and PID. To do this use "gst_bus_add_watch" and create several cases for messages
case GST_MESSAGE_EOS:
        g_print (" \n");
        g_print (" End of video\n");

        g_main_loop_quit (loop);
    break;

case GST_MESSAGE_ERROR: {
        gchar *debug;
        GError *error;

        gst_message_parse_error (msg, &error, &debug);

        g_free (debug);
        g_printerr ("Error: %s\n", error->message);
        g_error_free (error);

        g_main_loop_quit (loop);
        break;
}/*end case error*/

case GST_MESSAGE_ELEMENT:{

    if(strcmp(GST_MESSAGE_SRC_NAME (msg),"mux")==0){
        msg_struct=gst_message_get_structure(msg);

       i=i+1;
       g_print ("Element nº: %d \n", i);

       /* get PID,PTS,DTS,OFFSET value */
       pts =gst_structure_get_value (msg_struct,"pts");
       dts =gst_structure_get_value (msg_struct,"dts");
       offset =gst_structure_get_value (msg_struct,"offset");
       pid =gst_structure_get_value (msg_struct,"pid");

       /*display information PTS, DTS, OFFSET*/
       if(pts!=0){
           g_print(" *PID= % " G_GUINT64_FORMAT" *PTS= % " G_GUINT64_FORMAT " *Offset: % " G_GUINT64_FORMAT "\n",g_value_get_uint64(pid), g_value_get_uint64(pts),g_value_get_uint64(offset));
       }else if (dts!=0){
           g_print(" *DTS= % " G_GUINT64_FORMAT " *Offset: % " G_GUINT64_FORMAT "\n",g_value_get_uint64(dts),g_value_get_uint64(offset));
       }else if (pts==0 && dts==0){
           g_print(" *Paquete nulo: PTS=0 DTS=0 \n" );
       }
    }

Now I can see the values of PTS, DTS and OFFSET. This part could be solve whit lot of patience, test and correct errors. But the PID is not displayed correctly and I do not really know how to solve this.
show a snapshot of messages

estoy imprimiendo estados n?: 490
   *DTS= 4672782274 *Offset: 12554828
  Element n?: 491
(test:3385): GLib-GObject-CRITICAL **: g_value_get_uint64: assertion `G_VALUE_HOLDS_UINT64 (value)' failed
   *PID= 0 *PTS= 4672793074 *Offset: 12554828
  Element n?: 492
(test:3385): GLib-GObject-CRITICAL **: g_value_get_uint64: assertion `G_VALUE_HOLDS_UINT64 (value)' failed
   *PID= 0 *PTS= 4672746274 *Offset: 12556520
  Element n?: 493
(test:3385): GLib-GObject-CRITICAL **: g_value_get_uint64: assertion `G_VALUE_HOLDS_UINT64 (value)' failed
   *PID= 0 *PTS= 4672748074 *Offset: 12605024
  Element n?: 494

What I can do, to show me the PID correctly?

A: A GstStructure is a collection of key/value pairs. You can use
gchar * gst_structure_to_string (const GstStructure *structure);

to display all fields. In you case
g_print("%s\n", gst_structure_to_string(gst_message_get_structure(msg)));


text:
Q: Optional-chaining "all to the right"? For deeply nested property access, is there a JS operator similar to the "optional chaining" operator which applies to all properties/methods/etc. to the right?
Consider an object with deep nesting, where some properties are null:
const sort = payload.meta.displayConfig.properties.search.sort;
//                        ^---null?     ^---null?  ^--null?

This can be handled with the optional-chaining operator:
const sort = payload.meta.displayConfig?.properties?.search?.sort;

But is there another operator where "all calls to the right" are handled as if they were preceded by the optional-chaining operator? Observe:
const sort = payload.meta.displayConfig?!.properties.search.sort;
//                                     ^^---fictional nested-optional-chaining
//                                          operator

In this example (with the fictional ?! nested-optional-chaining operator), if anything from displayConfig and onward to the right (properties, search) are null or undefined, then execution is short-circuited as if each property was preceded by ?.
Is there any discussion around adding such a feature?

A: The short answer is no. You have to put ?. between each segment if you want to make each segment safe against null/undefined values. And as far as I can tell from looking through the different proposals for ecmascript there hasn't been any discussion of an operator like you're talking about.
Before the optional chaining operator was a thing, many libraries would implemented their own ways to get an attribute in a safe way, some of which behave closer to what you're wanting. For example, in lodash you can do _.get(payload, 'meta.displayConfig.properties.search.sort') However, now that the optional chaining operator is a thing, I would prefer just using it between every segment instead of using these library functions.


text:
Q: How scala HashMap inherit the "++" method while both superclasses TraversableLike and MapLike has same method name When I was learning Scala source code of version 2.11.8, I found aspect of HashMap which confused me:
I noticed that there are 2 traits of HashMap for mixin directly or indirectly, which both defined ++ method:

*

*TraversableLike

*MapLike
It seems that these 2 traits both take GenTraversableOnce type as parameter, but with difference that TraversableLike trait defined one more parameter list for implicit CanBuildFrom, however in HashMap.scala, there is also defined an implicit CanBuildFrom in scope, but I have NO idea which ++ method HashMap will inherit from between these 2 traits, i.e. whether to use implicit CanBuildFrom or not. Please, see bellow my test example:
  //the paramter list for implicit ev is just evidence to limit the (A,B) as subtypes of (Int,String), to confirm with the expected return type.
  def addElements1[A,B](t: (A,B)*)(implicit ev: <:<[(A,B),(Int,String)]): HashMap[Int,String] = {
    val h = new HashMap[Int,String]
    h ++ t
    h
  }

  def addElements2[A,B](t: (A,B)*): HashMap[A,B] = {
    val h = new HashMap[A,B]
    h ++ t
    h
  }

  def main(args: Array[String]): Unit = {
    addElements1((1,"a"),(2,"b"),(3,"c"))
    addElements2((4,"d"),(5,"e"),(6,"f"))
  }

During debug process, I got different results of there 2 method, that is, the method addElements1 inherits the method ++ from trait TraversableLike. Method addElements2 inherits the method ++ from trait MapLike.
Is there obvious rule or condition for which method should me used for HashMap?
FYI: The inheritance chain of HashMap from these 2 traits are:
HashMap <- MapLike
HashMap <- Map <- Iterable <- Traversable <- TraversableLike

Thanks a lot for all your effort on this question in advance.


text:
Q: Android "Getting Started" Tutorial Splash Screen I'm trying to build a scrollable splash screen like the ones that exist in many Google apps.  Where a user can swipe between introductory information and an indicator is given at the bottom of the page for status.
Using a ViewFlipper seems possible, as outlined here: http://tekartlife.blogspot.com/2014/04/changing-screen-with-viewflipper-and.html
I'm curious what the "standard" or preferred implementation is?

A: I use a ViewPager and for indicators on the bottom I use this lib

A: Make splash screen and a one time welcome screen in your app . Watch the tutorial http://www.androidsources.com/index.php/2015/08/06/android-splash-screen-and-welcome-screen-tutorial-using-android-studio/

A: You can use ViewPager for the getting started screen and use indicators for the indicators.
You can also use best graphics like color hex codes for showing your "Getting Started" screen best.


text:
Q: Raising minimum iOS Deployment Target Version for App Update Let's say we have an application with a deployment target set to 3.0 and we want to raise the deployment target to 3.2.  Normally, the App Store won't let the App be installed on devices with an IOS version less then this, but what about devices which already had the App installed prior to the update?  Will they see the update but won't be able to install, will they just not see the update or, heavens forbid, will be able to install and the app just won't start?
I searched everywhere for this, but I can't find anything about raising the minimum OS version for an app update.
Thanks!

A: From my experience those updates just won't show up as available.
When I upgraded OS on my device from 3.1 to 4.1 about 10 available updates appeared immediately in App store app - so that should be the actual behavior.

A: In addition to only showing supported updates, the store now offers the "last compatible version". This lets people download an app even if their device doesn't support the most recent version. Unfortunately this means that some people could still download an older version with bugs you have already fixed. There may be a way to disable this, but none of my app updates have introduced new requirements, so I can not test.

A: It's nearly a safe bet that they won't be allowed to install it. A similar situation is iPad apps or Mac apps which won't display in the App Store on iPhones and iPods.
I say nearly because the updates should not appear to older users on their iOS devices. The risk, however, is when users sync with iTunes, or if they update with another device. The new version of the app is now associated  with their account, and will ruin the install on the older device if they try to sync it with iTunes.