text:
Q: Why does building in Xcode overwrite my SQLite database? First of all, I'm not using Core Data, I'm using SQLite only.
I save the data in the table and then query them by opening the app and looking at the data using SQLiteStudio. I even create a LOG to check that the data is saved, and yes, it is saved.
But when I STOP and run the simulator again to consult, there is no more data!
Is Xcode overwriting the database every time? Or is something else happening that is outside my limited knowledge?

A: Without knowing more about how your application is setup, how you've got your app configured to build, or how it operates on the SQLite DB file in question I'll only be able to offer some pointers in things you can go check out about your code and build configuration that may be the source of your phantom deletions.  Of course, if you have other info to provide, I'd be happy to edit my answer!
Case 1: 'Create DB' always running?
One thing that may be tripping your app up is what happens leading up to the decision to create a new SQLite DB file or look/open an existing file.  If the code creating an empty DB is always running, then each time your app starts, your old DB file is getting overwritten with a blank DB.
Case 2: Using a 'starter' or 'template' empty database?
Sometimes developers may provide a blank database that contains the initial database schema (the general tables and structure) as well as some default or sample data.  If your app does this, perhaps the logic leading up to the decision to apply that default database is accidentally always being triggered?  If so, use of NSUserDefaults to record a boolean indicating the DB was successfully created may be an avenue to use to skip past the 'Load my starter DB' code.  Alternatively, you could check for the existence of your DB file, or see if the contents of a specific table are different from the template data, etc.
Case 3: Different Behavior between 'Build & Run' vs. 'Run Without Building'
There's a not-so-well-known option in the Product > Perform Action menu labelled 'Run without Building' that will essentially kickoff another Debug session using the version of the application you just finished running in the Simulator or on Device.  When you use this option do you see any different behavior with your database or is it still blank?
Case 4: Different Behavior when run directly in Simulator outside of an Xcode debugging session?
Part of the 'Run' operation is a build phase which may trigger the 'Copy Resources' phase even if your app hasn't changed since the last execution (as you suggest is the case in your question).  If you are providing a stock 'default' or 'template' DB file and your app is simply opening and editing that 'template' during the first execution of your app, then Xcode may be replacing it with a clean copy on the subsequent 'Run' operations where 'Copy Resources' is happening.  A way to test this avenue:

*

*Build and Run your app to the simulator using Xcode like normal.

*Perform some operations that would result in the creation or editing of data in your app's database.

*Click the stop button in Xcode to return to the Simulator home screen.

*Double-click the home button on the simulator (or if there is no home button, press CMD+SHIFT+H twice to bring up the multitasking bar and force-quit out of your application.

*Check and see if your DB file has data in it.

*If no data, then there is an issue persisting your changes into the database and we need to get that problem solved first. Otherwise:

*Relaunch your app directly from iOS Simulator and perform different operations that would result in more or different changes to the database.

*Click on the home button to return to the iOS Home Screen.

*Force-quit your appellation as was done in Step 4.

*Check and see if your DB file data has changed (but still has data) or has blanked out.

Finally, make sure you are following Apple's guidance about where to store user-data, if you are inadvertently storing something in an incorrect file path doesn't typically result in blanking of data, it may be prohibiting writing of data which could be interpreted as your data getting overwritten especially if you are interrogating it while it still is residing in an in-memory process.  There's some really useful guidance about file paths in the Table 1-1: (http://developer.apple.com/library/ios/#documentation/FileManagement/Conceptual/FileSystemProgrammingGUide/FileSystemOverview/FileSystemOverview.html)
Locating your Simulator App on your Mac's Hard Drive
To be thorough (and you may already know about this!), iOS Simulator applications are stored on your Mac's hard drive just like other files on your machine.  Their organization mimics that of a physical iOS device.  To get to your App and its data:

*

*Open a new Finder window.

*Press CMD+SHIFT+G or choose 'Go to Folder' from the 'Go' menu.

*Paste the following into the 'Go to Folder' box then click 'Go': ~/Library/Application Support/iPhone Simulator/

*Select the folder that matches the iOS version of the simulator you built to.

*Click on Appications.

*You'll then be presented with zero or more folders, each folder that appears will have a string of digits separated by hyphens.  Navigate through this list until you find the one containing your app.  You can then browse, and copy data out of this folder to somewhere to be examined by other tools on your Mac.


text:
Q: Dir.glob recursive file search and stop at occurence and back up a directory I want to dynamically look through a with possibly many subfolder for a file. This file could be a few folders deep, so this has to be done recursively.
But I would like for Dir.glob to stop at the first occurence, and not continue going through all the other folders. How could I accomplish this?
This is my code right now:
def find_installs
  installs = []
  glob_dir = @config[:install_folders]
  Dir.glob("#{glob_dir}**/install_file.md").each do |install_file|
    installs << File.dirname(install_file).gsub(glob_dir, "")
  end

  installs
end

Is there another class that I could use that provides this functionality?
By the way, the code has to run on Ruby 1.9.3

A: Required lib is Find.
I have created a Folder structure as follows :-
/folder1/
|- folder2/
     |-folder21/
        |-a.txt
     |-a.txt
|- folder3/
     |-folder31/
        |-a.txt
     |-a.txt

Now I write the code below to meet OP's need :-
require 'find'

path_find = '/home/kirti/workspace/folder1'

Find.find(path_find) do |path|
  if FileTest.directory?(path)
    unless Dir["#{path}/a.txt"].empty?
      p "#{path}/a.txt"
      Find.prune # Don't look any further into this directory.
    else
      next
    end
  else
    # nothing
  end
end
# >> "/home/kirti/workspace/folder1/folder2/a.txt"
# >> "/home/kirti/workspace/folder1/folder3/a.txt"

You can see folder21 also contains a.txt file, but as folder2 contains a.txt, no search made into the sub-directory folder21. Same explanation applicable for folder3 and its sub-directory folder31.

redpajama_set_name: RedPajamaStackExchange


text:
Q: How can we set source of data binding to this in xaml? How can I write this expression in xaml?
 Binding binding = new Binding("Logo");
            binding.Source = this;
            binding.Converter = new ToImageConverter();
            imgLogo.SetBinding(Image.SourceProperty, binding);

Please note that I don't want to set DataContext = this in xaml.cs. I want to set the Source to be this.
Thanks in advance :)
Edit:
This is my simple usercontrol:
<UserControl x:Class="SilverlightApplication4.MainPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d"
    d:DesignHeight="300" d:DesignWidth="400">

    <Grid x:Name="LayoutRoot" Background="White">
        <TextBlock Text="{Binding Tooltip, RelativeSource={RelativeSource Self}}"/>
    </Grid>
</UserControl>

This is my cs:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;

namespace SilverlightApplication4
{
    public partial class MainPage : UserControl
    {
        public static readonly DependencyProperty ToolTipProperty
       = DependencyProperty.Register("ToolTip", typeof(string), typeof(MainPage),
           new PropertyMetadata(string.Empty));

        public string Tooltip
        {
            get { return GetValue(ToolTipProperty) as string; }
            set { SetValue(ToolTipProperty, value); }
        }

        public MainPage()
        {
            InitializeComponent();
            this.Loaded += new RoutedEventHandler(MainPage_Loaded);
        }

        void MainPage_Loaded(object sender, RoutedEventArgs e)
        {
            Tooltip = "Test tooltip.";
        }
    }
}

The binding doesn't work.

A: Try using "{Binding Logo, RelativeSource={RelativeSource Self}}" (converter omitted for clarity).
edit:
Based on your updated code, you want:
<UserControl x:Class="SilverlightApplication4.MainPage"
    x:Name=MyUserControl
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d"
    d:DesignHeight="300" d:DesignWidth="400">

    <Grid x:Name="LayoutRoot" Background="White">
        <TextBlock Text="{Binding Tooltip, ElementName=MyUserControl}"/>
    </Grid>
</UserControl>

A: You should do this in the XAML:
<TextBlock Id="TextBlock1" Text="{Binding Tooltip}"/>

and in your code  (Constructor / UserControl_Loaded)  you should do:
TextBlock1.DataContext = this;

Also you might need to Implement INotifyPropertyChanged
and Raise OnPropertyChanged Event in the Property's Set
Why don't you want to do it in code?


text:
Q: How to categorizing a SQL Column value based I want to get the rate of women in a Branch basically it looks like this:
BranchID   | CountOfWomen   | CountofMen      | CountOfWomen/CountOfMen
(B001),           (3),            (4),                  (0.75)
(B002),           (1),            (1),                   (1)

So now I have the rates of the womens in a Branch:
75 % of B001 Employers are women etc...
What I need now is following:
The Rate(CountOfWomen/CountOfMen) is splitted in 3 Categories: Avarage, Low, High
Avarage means IF CountOfWomen / CountofMen is 1 so 1:1 rate
Low means  IF CountOfWomen / CountofMen is <1
High means  IF CountOfWomen / CountofMen is >1 ......More men are working than women works ..
I tried following:
I am trying to create a view and put the values in the located columns but It does not work!!
   CREATE VIEW MFKata2 (BranchID,High,Low,Avarage ) AS
    SELECT       MFKata.BranchID,
    Case When(MFKata.Quote > 1) As High,
    Case When (MFKata.Quote < 1) As Low,
    Case When (MFKata.Quote = 1) As Avarage
    FROM         MFKata

Quote is the rate(CountOfWomen/CountOfMen) I just renamed it here to better explain!
This is the code for creating MFKata:
CREATE VIEW MFKata (BranchID,AnzahlF, AnzahlM,Quote )
AS
SELECT    Frauen2.BranchID
        , AnzahlF
        , AnzahlM
        , CAST(AnzahlF as float)/CAST(AnzahlM as float) as Quote
FROM  Frauen2
INNER JOIN Maenner ON Frauen2.BranchID = Maenner.BranchID

A: You are missing END for all of your case statements.
 CREATE VIEW MFKata2 (BranchID,High,Low,Avarage ) AS
    SELECT       MFKata.BranchID,
    Case When (MFKata.Quote > 1) THEN 1 END AS High,
    Case When (MFKata.Quote < 1) THEN 1 END As Low,
    Case When (MFKata.Quote = 1) THEN 1 END As Avarage
    FROM

Or you can have one column for High/Low/Average, Something like.....
 CREATE VIEW MFKata2 (BranchID,[Rate]) AS
    SELECT       MFKata.BranchID,
    Case When (MFKata.Quote > 1) THEN 'High'
         When (MFKata.Quote < 1) THEN 'Low'
         When (MFKata.Quote = 1) THEN 'Avarage'
      END AS [Rate]
    FROM

Edit
Avoid creating views on top of views unless absolutely necessary, this can be achieved with a very simple select query. Something like.....
SELECT  BranchID
      , Case
           When (Quote > 1) THEN 'High'
           When (Quote < 1) THEN 'Low'
           When (Quote = 1) THEN 'Average'
        END AS [Rate]
FROM (
    SELECT    Frauen2.BranchID
            , AnzahlF
            , AnzahlM
            , CAST(AnzahlF as float)/CAST(AnzahlM as float) as Quote
    FROM  Frauen2
    INNER JOIN Maenner ON Frauen2.BranchID = Maenner.BranchID
    ) A


text:
Q: Module not found: Error: Can't resolve './router'| Vue router in search.js from this file:
import {createRouter, createWebHistory} from "vue-router";

import SearchIndex from './components/omdb/SearchIndex.vue'

const routes = [
    {
        path: '/',
        name: 'welcome',
        component: SearchIndex
    },
]

export default createRouter({
    history: createWebHistory(),
    routes
})

in app.js from this file:
require('./bootstrap');

require('alpinejs');

import { createApp } from "vue";
import router from './router'
import SearchIndex from './components/omdb/SearchIndex'

createApp({
    components:{
        SearchIndex
    }
}).use(router).mount('#app')

this error:
ERROR in ./resources/js/app.js 6:0-30
Module not found: Error: Can't resolve './router' in 'D:\xampp\htdocs\omdb\resources\js'

I don't understand why it gives me this error. I structured the file as follows:

A: The module path in import router from './router' resolves to either ./router.js or ./router/index.js. Neither file exists, leading to the error you observed.
You can either rename ./router/search.js to ./router/index.js, or import the ./router/search.js file directly:
import router from './router/search'


text:
Q: How to inject variables to git submodule foreach? I have 2 questions, (1) How to inject a variable into this foreach loop? in below example, $user_branch is not accessible in line 2.
USER_BRANCH="foo"
git submodule foreach -q --recursive 'branch="$(git config -f $toplevel/.gitmodules submodule.$name.branch)"; [ "$branch" = "" ] && git checkout $USER_BRANCH || git checkout $branch' –

(2) Is there a way to make this foreach into a regular loop?, something like:
foreach $(git submodules --recursive); do
  #do something
  #more
  #and more
done

A: Addressing your first question, the problem is that you are using single quotes so your variable doesn't get expanded. Switching to double quotes should fix that part.
git submodule foreach -q --recursive "git checkout $user_branch"

For the second question, the documentation suggests that you can run arbitrary shell commands in each module, so while you can't structure it like a bash for loop, you can run either a shell script or multiple commands concatenated by ;.

foreach [--recursive]
Evaluates an arbitrary shell command in each checked out submodule. The command has access to the variables $name, $path, $sha1
  and $toplevel: $name is the name of the relevant submodule section in
  .gitmodules, $path is the name of the submodule directory relative to
  the superproject, $sha1 is the commit as recorded in the superproject,
  and $toplevel is the absolute path to the top-level of the
  superproject. Any submodules defined in the superproject but not
  checked out are ignored by this command. Unless given --quiet, foreach
  prints the name of each submodule before evaluating the command. If
  --recursive is given, submodules are traversed recursively (i.e. the given shell command is evaluated in nested submodules as well). A
  non-zero return from the command in any submodule causes the
  processing to terminate. This can be overridden by adding || : to the
  end of the command.


text:
Q: Apply :hover to all equal classes I have multiple divs with the same class 'color-hover' and I'd like that the color of ALL divs change when ONE div hover.
I've coded the following but only the color of the hovered changes:
.color-hover {
 color: red;
}

.color-hover:hover {
 color: blue
}

also tried
.color-hover {
 color: red;
}

.color-hover:hover .color-hover {
 color: blue
}

Ideas?

A: One workaround is to put :hover on the parent, not .color-hover itself.
But all the .color-hover need to be in the same container, also it triggers while hovering the empty area of the parent

Fix
As 04FS mentioned, this can be fixed by adding pointer-events: none to the parent and revert it in its children.

.container {
  pointer-events: none;
}

.color-hover {
  color: red;
  pointer-events: all;
}

.container:hover > .color-hover {
  color: blue;
}

  Lorum ipsum
  Lorum ipsum
  Lorum ipsum
  Lorum ipsum
  Lorum ipsum
  Lorum ipsum
  Lorum ipsum

In the future when CSS4 is out, you can achieve that by :has() pseudo class
*:has(> .color-hover:hover) .color-hover {
  color: blue;
}


text:
Q: CKeditor , git rid of quotes so content displays as html I am building a blog application using JSF and Primefaces. I added the CKeditor through primefaces extensions. It is correctly producing html output, however when displayed in a browser all of the html tags are displayed instead of interpreted by the browser. For example here is the some test output.
Screenshot of CkEditor output:

Looking in developer tools the above content has quotes around it. I'm assuming if I can figure out how to get rid of the quotes it will display as html.
The JCP code to display the above
<h:outputText value="#{(editorBean.postMarkup)}"></h:outputText>

Currently only have simple getters and setters in the backing bean.
   public String getPostMarkup() {
        return this.postMarkup;
    }

    public void setPostMarkup(String postMarkup) {
        this.postMarkup = postMarkup;
    }

Ultimately I would like to store raw HTML in the database to be displayed on a blog page. How can I get rid of the quotes if that is indeed the problem?

A: use escape=false on h:outputText.


text:
Q: How does the triggering of mousemove work in Javascript? I have an object that prints the mouse's x and y positions on every mousemove.
It's something like this:
$('#canvas').mousemove(function(e){
    $('#output').prepend(e.pageX + ',' + e.pageY);
});

I've noticed that when you move over the object really fast it only prints out a few positions.
I'm not exactly unhappy that it does that (because it would be quite exhaustive to have it do something for all the hundreds of pixels you've crossed) but I am wondering how this works.
Is the mousemove event limited to a certain amount of triggers per second or what?
(Btw: this was tested on Chromium in Ubuntu Linux)

A: "Mice only report their position to the operating system n times per second, and I think n is usually less than 100"

A: You may want to look at this, as this may be browser dependent,
http://javascript.info/tutorial/mouse-events#mousemove-and-mouseover-frequency, but, if you look at this question, there is a suggestion on how to get better response.
How to set mousemove update speed?

A: i think it's synchronous. It's doesn't get triggered for every pixel in which you move your mouse, which means that the events are not queued up .
Say if you have some some code like this.
$('#canvas').mousemove(function(e){
//Some code which takes seconds to execute
//All subsequent events won't be dispatched while this event handler is executing.
});

Say if you move mouse while the mouse move event handlers execute. The mousemove handler won't be triggered.
Here is a example for handler which will take seconds to execute. --> http://jsfiddle.net/78Hf3/1/
And one that take only few time --> http://jsfiddle.net/78Hf3/2/


text:
Q: jquery send ajax post to zend controller action problems ive got a form with jqgrid inside, and when the user click submit i want to submit data to a controller.
here is my form
<form method='POST' >

Tags da ronda:

Nome da ronda:

<input type="text" name="nomeronda" id="nomeronda">

Tag Inicial:

<select id="tagini" name="tagini">
</select>

Tag Final:

<select id="tagfim" name="tagfim">
</select>

Ordem:

<select id="ordem" name="ordem">
<option value="Sim">Sim</option>
<option value="Não">Não</option>
</select>

<input id="button" class="st-button" type="submit" value="Submit" name="button">
<input id="button2" class="st-clear" type="reset" value="Cancel" name="button">

</form>

Now, when the user click submit button it activates this javascript code

So when the submit button is pressed, i make an ajax call to a controller name rondas, and the action name choosetags..
in this action im trying to see if the request is post and alert the data of the data that was sent to see if it is working.
if ($this->_request->isPost())
{
$this->view->layout()->disableLayout();
$this->_helper->viewRenderer->setNoRender(true);

$param1 = $this->_request->getParam('param1');
$param2 = $this->_request->getParam('param2');
echo '';
}

the problem is that my alert is blank..the alert is triggered but the $param1 value is null.
What is my problem...
i have tryed different solution found in here, but i cant see the alert of the $param1.
Thanks in advance...

A: Probably easiest if you serialize the form and send it as a string http://api.jquery.com/serialize/


text:
Q: Launch a Jython script from a Python3 script (incompatibility of Jython using Python2) So here is my problem : I wrote a script to connect to JMX service that needs to be run with Jython and that works perfectly !
I have also another script written in Python that is the « main » script of a bigger application that connects to different services by calling other Python scripts for each service.
The thing is I want this script to call and use the Jython one but without using an ugly method such as os.system("java -jar jython standalone jmx_with_jython.py..."), I found nothing online to call a Jython script from a python3 script…
If I start the main Python script with Jython I get a ton of lbraries errors because it uses Python2 following what I found on Internet (for example, one of them is : File "/my/dependencies/arguments.py", line 4, in <module> from urllib.parse import urlparse ImportError: No module named parse).
And on the other hand, if I start the main Python3 script with Python3 it can't start the Jython one because it doesn't recognize the javax module that is used to connect to JMX (ModuleNotFoundError: No module named 'javax' + I tried to install the module javax with pip for python3 and it didn't work).
the biggest probleme is that I can't change the "main" script and I don't want to modify the Jython one too. Any ideas to use my Jython script from my Python3 script?

A: You could try running your Python 2 Jython script within Python 3 using execnet as described here Calling Python 2 script from Python 3


text:
Q: How to restore normal child positioning behavior after calling `setX()` I have a TextView that is contained in the following LinearLayout:
<LinearLayout
    android:id="@id/percentage_frame"
    android:layout_width="wrap_content"
    android:layout_height="match_parent"
    android:gravity="right|center_vertical"
    android:minWidth="35sp"
    android:orientation="horizontal">

    <EditText
        android:id="@+id/number"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:background="@null"
        android:digits="0123456789."
        android:gravity="right"
        android:selectAllOnFocus="true"/>

    <TextView
        android:id="@+id/percent_sign"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="%"/>
</LinearLayout>

What I want to do is when the number is empty, position the percent sign at a particular x position within its parent, like so:
private void resetNumber() {

        float newX = ((LinearLayout) percentSignTextView.getParent()).getWidth()
                   - percentSignTextView.getWidth()
                   - pixelsFromDimen(R.dimen.percent_sign_right_margin));
        percentSignTextView.setX(newX);
}

And this works perfectly. The problem is restoring the automatic positioning behavior of the LinearLayout after setting the x position of percentSignTextView.
Before setting it, as the number changes, the width of the number EditText changes, and the percent sign moves with it. Resulting in the percent sign always at the end of the number. But after setting the x position, percentSignTextView will not move at all, regardless how much the number is changed.
I've tried resetting the LayoutParams of percentSignTextView and I've tried removing it and adding it back as a subview of the LinearLayout, but neither worked. How can I restore the default behavior after manually changing the x position?

A: You could use a RelativeLayout instead of a LinearLayout, making percentage TextView relative to the right of the EditText
Something like this:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    >
    <EditText
        android:id="@+id/myEditText"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerInParent="true"
        android:text="100"/>

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_toRightOf="@+id/myEditText"
        android:layout_centerVertical="true"
        android:text="%"/>

</RelativeLayout>

To have always text centered try this:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent">

    <LinearLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:orientation="horizontal"
        android:layout_centerInParent="true">

        <EditText
            android:id="@+id/myEditText"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content" />

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="%" />

    </LinearLayout>

</RelativeLayout>


text:
Q: How to deploy folder which is not included while publishing to Azure we are following plugin architecture, so we are having other projects which can plugin into the main web application.Right now we are using installshield to deploy our dlls from other projects into the main web application.
Folder structure:
MVC Application
-- bin
--Plugins
  -- Plugin1

      -- dlls

  -- Plugin2

       --dlls

When I  published my application to Azure App service.The dlls present in the main web application only got copied.How can I move the dlls present in my plugins folder.
Do we need to add any settings in publish profile to include these publish dlls?
Please let me know how can i include the plugins folder

A: If those files exist in project, just make sure you set the build action to Content and they will get deployed. Note that this is standard msdeploy behavior, and not specifically about Azure.


text:
Q: Visual studio 2012 publish database project to sql instance on a separate server fails when firewall is turned on Computer A has visual studio 2012 with a sql database project.
Computer B has windows server 2008 r2 and sql server 2008 r2.
I am trying to publish the database project from visual studio to the sql instance.
With the windows firewall turned off on Computer B, everything works; with the firewall on it fails. The error message is "The server was not found or was not accessible. Verify that the instance name is correct and that sql server is configured to allow remote connections (provider: Named Pipes Provider, error: 40 - Could not open a connection to Sql Server".
I have tried creating rules for incoming ports for udp and tcp for both 1433 and 1434. I have also added the program sqlservr.exe. Each exception/rule was applied to domain. private, and public. I don't know what else I need to do to allow visual studio to publish the database to the sql instance with the firewall on.
Thank you for any help!


text:
Q: Draw polygon from sdo.geometry with OpenLayers I have some polygons in my oracle database, the column type is sdo.geometry, and I want to draw the polygon using OpenLayers.
The problem is OpenLayers reads WKT type and I can't convert to this type, because my version of Oracle is "Oracle express Edition", and function like: SDO_UTIL.TO_WKTGEOMETRY(geometry) or geometry.get_WKT() returns "(null)"
.
I already have something on my database cuss:

I'm using C#, and I haven't found any library for my problem.

A: I have a pure PLSQL WKT library you are welcome to take here
https://github.com/pauldzy/DZ_WKT
It should work with XE as there is no java nor any requirements beyond PLSQL.  Feel free to drop me a line or add an issue if you have additional questions.
WKT is not the most web-friendly format, you may wish to just use GeoJSON and I have another pure PLSQL library for that here
https://github.com/pauldzy/DZ_JSON
Note my GeoJSON code is for GeoJSON output only.  There is no input support as I assume folks will use native 12c JSON handling for that.
Cheers,
Paul


text: Q: Is there a way to tell BPM of an audio playing on the computer in real time? I completely understand that this is by no means easy. I basically want to create a code which takes the audio playing on the computer, samples it and outputs its BPM as a number. Is there any way it would be possible? I am not new to audio engineering, so I think the easiest would be to find the bass drum and count the beats, although as I just started programming, I have no idea how to do this.


text:
Q: Horizontal Velocity of a Projectile thrown from a Cliff If I were to throw a rock of a cliff at 12 m/s as a horizontal velocity, what will the final velocity of the rock become when it hits the ground? I am tempted to say 12 m/s because the horizontal portion is independent of vertical but it doesn't make sense that way.
For the horizontal portion, there is no acceleration, initial velocity is 12 m/s and final, I have no idea. For the vertical portion, acceleration is -9.81 m/s/s (gravity), velocity is 0 m/s?
Please help me, can someone explain this concept?

A:
For the horizontal portion, there is no acceleration, initial velocity is 12 m/s and final, I have no idea.

See Newton's first law

an object in motion stays in motion with the same speed and in the same direction unless acted upon by an unbalanced force.

Your rock moving at 12 m/s horizontally has momentum in that direction. That momentum is conserved.
These are observations about how matter behaves. In classical physics they are so well supported by evidence that these statements are described as laws.
Unless your cliff is on a planet with no atmosphere, the rock will be acted on by an unbalanced force - namely friction with the gases comprising the atmosphere. These frictional forces, called air-resistance on Earth, will act to slow down the rock.


text:
Q: What influenced people to start using "I'm good" in answer to "How are you?" and in other contexts? There are many posts on this site about the appropriate responses to the question "How are you?" and there are many different opinions about which responses should be used. My intention is not to bring that question up here.
My question is about the evolution of the expression "I'm good". I hear it used in two ways all the time. One is in answer to the question "How are you?"
The other way it's used is to mean, "No thanks, I have enough," or "I'm all set here."
For example: "Would you like more ice cream?" "No thanks. I'm good." Or this: "Did everybody understand my explanation?" "Yes, I'm good." It's also used in the same way in questions. A waiter might arrive at a table and say, "Are you good?" to people who appear to have finished eating, as a way of asking whether it's OK to take away their plates.
We moved from the United States to France in 1988 and stayed there until 2002, when we returned. Before we left, I never, ever heard anyone say "I am good" in either of those two contexts. When we came back, the expression was everywhere. So I've always assumed that it emerged during the 1990s or, at the latest, around the year 2000. I've also always (perhaps erroneously) assumed that both types of usage evolved around the same time. Many of the posts on this site refer to "I'm good" as an expression used only in American English, but recently I have heard it used by many speakers of British English as well.
I've checked various sources to find the expression's origin. There are a few ideas about it here, here, and here. In the last of the sites I've referenced (wiktionary.org), there are people in a chat room who agree roughly with my estimate of when the expression entered common usage, and one of them suggests that it comes from language used by poker players.
I'm very interested to know if anyone has found more authoritative information about the origin and evolution of the expression, as used in the ways I've described.

A: It could be a kind of illogical carry over from another language. This is a colloquialism that could have started with bilingual/illiterate populations. There are presumably many languages in which the word for "The state of (an object or person) being in fine condition (i.e. "good")", overlaps with the word that can also describe "The state of a person's mood, which yields nonmaleficence/positive social behavior".
This is also true in English if for example you "fill in the blank" and assume that good is short for "I am in good shape". Shortened to simply "I'm good". which is incorrect because it actually means "I am benevolent/I am well-behaved". The relationship between the words is not obvious, but it can make sense if a few tweaks are made to the sentence.
The phrase "I am in good shape" basically establishes this relationship between the words "fine/well" and "good", by materializing an abstract concept which is "mood" as a malleable physical ["geometrically-shaped"] object which can be thought of as "damaged/altered/broken" when a person is "feeling down", or be "well/fine" i.e. in an intact/good/aesthetically pleasing condition when it a person is psychiatrically healthy.
See Spanish for example, "Bien" (well/fine) versus "Bueno" (good). In this language, the words resemble each other more closely. It is easy to assume that this is also the case in many other languages, and as you know, languages "evolve" as a result of people speaking incorrectly.
So for a bilingual person, it is "logical" because not all English 'word-usage customs' are taken into account, making it illogical for someone who knows the language to a better degree or is simply more concerned with following its rules.
The implied "etymological assumption" is the following: "Benevolence/tidiness/stability (good) is to happiness (fine/well), as maleficence/evil/untidiness/instability (bad) is to unhappiness (not fine/unwell)".

Regarding the "Ice cream" example, the answer is simply indicating that a person is emotionally content or in a state of complacency in response to an outcome. So they are not actually answering your question quantitatively (as expected). Instead, they are conveying other information, which in turn, only implies the desired answer. I.e. If a person is happy, then you can safely assume they are satisfied with that specific amount of ice-cream.
The 'conjugate' expression (which does not exist, and should not exist) would be the following: "Would you like more ice-cream?" --> "I am feeling evil/antisocial" or "I am bad" wherein, "evil/bad" represents an ill-intended (hence 'structurally unsound'/unstable) state of mind, which in turn would convey that the person "is unhappy and therefore does want more ice-cream".
Sources = My dyslexia.
My answer is too long... "My bad!"... (mistake:mischief/misbehavior:bad)

Also consider the following: Fine and good, may also both overlap, and be misused in other contexts, as they can both also refer to gustatory appeal "Taste", and even auditory appeal, (not just visual appeal/condition). E.g. "Fine wine" or "Good wine" "A carefully put-together delicacy, or of high quality".
So in English, (as in many other languages) you can say "She is fine", and it could mean anything from "She is doing well", to "I really wanna hit the hay with her", and everything in between...
So in this case, a positive state of mind is being equated to a high visual appeal, and then, the phrase to depict that figure of speech is being shortened...

A: Just to add something that hasn't been mentioned yet (I do like @BoozyBeaver's take on carry over from another language), there could also be carry-over from a standing idiom by way of abbreviation. I'm calling it a carry-over because it's not strictly logical but close enough:
How about good to go ? (explained well on the M-W page that turns up upon search there). Being in a state fit to commence something (or carry on), that's very close to a strong meaning and sufficiently close to "I'm fine" while lacking the nuance that comes with it. So, a likely candidate for how carry-over works (though I couldn't formally describe that right now).

A: Semantically, the expression "I'm good" is not that different from the prescribed "I am well."  I suspect that part of what might be striking about the frequency and use of "I'm good" today might be a result of uses in declining an offer.
The Oxford English Dictionary does denote this specific phrasal use of "I'm good" dating to 1966.

Originally U.S. I'm good: (used in response to a question or request) no thank you; I'm not in need of anything.

The earliest citation provided in the OED:

'More beer?' 'I'm still good, thanks.'

*

*1966   J. Ball Cool Cottontail x. 113

Prior to the 20th century, most uses that I can find of the phrase "I'm good" are part of larger expressions, most commonly, "I'm good for it," meaning "I can pay for it."  But saying "I am good" as a response to "how are you" was still a valid answer.  Indeed, similar phrases like "I am in good health" date back to Old English, per the OED.  Therefore, I suspect the apparent growth of the phrase may be more a reflection of its use in declining offers, as discussed above.

A: I started hearing this phrase in the 90s and I naturally assumed it had derived from the newly popular phrase, "It's all good", which I first heard from MC Hammer in 94: https://www.youtube.com/watch?v=I0xIa7RcD3g
Anecdotally, pretty much the same people I knew who would say, "It's all good" eventually started saying "I'm good".


text:
Q: Whether usage of API key is secure? I am created API server using Flask where user provided (through usual web-interface) with personal API key. And then all requests sent to my server must provides this key (in header or as get/post parameter, it does not matter). For now server operates over HTTP (not HTTPS).
But I am wondering whether it secure? If somebody using wireshark or any other traffic sniffer get this address then he could send requests to my API as original owner.
I reviewed couple of resources provided API with apikey usage and found that many of them uses HTTP schema. If I turn HTTPS only and force clients to use HTTPS would it be enough to secure my application against malicious persons?

A: HTTPS should be enough to secure flow of data over the network.
If you still want to support HTTP, then you can implement Limiting and Token-Expiry in your API.
By Limiting, you restrict the number of requests an API user can send within a particular timeframe.
By Token-Expiry, the user's API key expires after some time, and they can no longer use it. This means you'll have to implement token refresh in your codes.
Check out this PyCon 2014 presentation for better API implementations.
Find Presentation source on GitHub


text:
Q: Connecting 3.3 and 5 V devices The requirements are different from similar questions I've found here.
TXB/TXS are expensive for my needs.
Sparkfun's logic shifter is bi-directional, while I need two uni-directional conversions,  RX<->TX pairs.
As far as I understood from datasheets of both devices, the logic levels
ATMega328P (VCC=5V) page 313
\$V_{l}\$ = 0v - 0.3v
\$V_{h}\$ = 0.6v - 5v
and GPS receiver's page 16
\$V_{l}\$ = 0v - 0.8v
\$V_{h}\$ = 2v - 3.3v
I've tried to do that with voltage divider, but doesn't look like it's possible or maybe I am missing something.

A: I think you are using the wrong figures. You must use the output figures for the output, and the input figures for the input, and do that in both directions and for 0 and 1.
For the AT->GPS:

*

*AT out maximum for 0: 0.9 V

*GPS in maximum for 0: 0.8 V

Strictly speaking the AT might not pull the line low enough, but in practice (with no load on the line) this will be OK, even without a voltage divider.

*

*AT out for 1: min 4V2, can be up to 5V

*GPS in for 1: min 2V0, max Vcc (3V3)

This is a problem. A voltage divider will do fine at this low speed, don't take the values too high. I would take 1k5 / 1k, but probably 10k / 10k will do just as well.
For the GPS ->AT:

*

*GPS out at 0: 0 .. 0.4

*GPS out at 1 : 2.4 .. 2.8

*AT in at 0: 0 .. 1.5V

*AT in at 1: 3 .. 5.5V

One problem here: the output level of the GPS for a 1 is not enough to be guaranteed to be seen as 1 by the AT. You can go for tricky passive solutions here, but a simple HCT gate at 5V will do the trick, their minumum input level for 1 is 2V0. Take for instance a 74HCT00 (2 gates in series), or any other non-inverting set of gates.

A: For 5V -> 3V3 use a simple resistor divider or a transistor. For 3V3 -> 5V use a simple transistor: just drive its base using 3V3 signal.

A: This is how V-USB project does it for communication between a 5V AT(mega|tiny) and 3.6V USB. The trick here is in what the AT sees as a HIGH (0.6 × Vcc). So if your GPS module will output a HIGH as 3.0V then it should work just fine with the zener setup. Maybe if you carefully design the wires between GPS and AT, the 3V output for GPS won't be a problem.
Notice that your project uses 3.3V, whereas USB data lines are at 3.6V.


text:
Q: How to copy row if it contains certain text to another sheet using VBA I am trying to write a macro that copies a row if a cell in that row contains text (For ex: Mumbai, Delhi etc) from Column C.
For example if there are 30 rows but only 15 contains text(Mumbai & Delhi) in column C. I want to copy those 15 rows and paste them into "Sheet2"
I was using the below code. however it only copying "Mumbai". I need the for loop go through the same column and copy "Delhi" as well.
Sub test()
Dim lastrow As Long, erow As Long
lastrow = Worksheets("Sheet1").Cells(Rows.Count, 1).End(xlUp).Row
For i = 7 To lastrow
If Worksheets("Sheet1").Cells(i, 3) = "Mumbai" Then
Worksheets("Sheet1").Cells(i, 1).copy
erow = Worksheets("Sheet2").Cells(Rows.Count, 1).End(xlUp).Row
Worksheets("Sheet1").Paste Destination:=Worksheets("Sheet2").Cells(erow + 1,1)
Worksheets("Sheet1").Cells(i, 3).copy
Worksheets("Sheet1").Paste Destination:=Worksheets("Sheet2").Cells(erow + 1,2)
End If
Next i
End Sub

Please let me know how can use And function in the above code. or any other way to copy it into sheet2.
Thank you.

A: -Try to make a for loop
-Example copies from sheet 1 to sheet 2
Dim i As Long
Dim sh As Worksheet
dim sh2 As worksheet
Set sh = ThisWorkbook.Sheets("Sheet1")
Set sh2= ThisWorkbook.Sheets("Sheet2")
For i = 1 To Application.CountA( sh.Range("C:C"))

-by defining the if statements you can controll what values are copied
-make an if statement in the loop controlling if the value is not blank
-refer to cell with loopvalue
-copy :)
if sh.Range("C" & i).Value <> "" then

sh.Range("C" & i).Copy (sh2)

end if

Next i

A: Try the next code, please. You must use your used sheets name:
Sub testPasteinSh2()
 Dim sh1 As Worksheet, sh2 As Worksheet, rng As Range, cel As Range
 Dim rngCopy As Range, lastR1 As Long, lastR2 As Long
 Dim strSearch1 As String, strSearch2 As String

 strSearch1 = "Mumbai" 'or combo value...
 strSearch2 = "Delhi"  'or something else...
 Set sh1 = ActiveSheet          'use here your worksheet
 Set sh2 = Worksheets("Sheet2") 'use here your sheet
 lastR1 = sh1.Range("C" & Rows.count).End(xlUp).Row
 lastR2 = sh2.Range("A" & Rows.count).End(xlUp).Row + 1

 Set rng = sh1.Range("C2:C" & lastR1)
 For Each cel In rng.cells
    If cel.Value = strSearch1 Or cel.Value = strSearch2 Then
        If rngCopy Is Nothing Then
            Set rngCopy = sh1.Rows(cel.Row)
        Else
            Set rngCopy = Union(rngCopy, sh1.Rows(cel.Row))
        End If
    End If
 Next
 If Not rngCopy Is Nothing Then
    rngCopy.Copy Destination:=sh2.cells(lastR2, 1)
 End If
End Sub

It should be very fast, keeping the rows to be copied in a Union range and paste everything at once.
It will even be more efficient if you do not need the rows format. Array can be used. And not the whole row to be copied, only its filled part...


text:
Q: How to run a maven plugin without including it in pom.xml? I want to run the following plugin, but without having to include it into my pom.xml:
<plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>versions-maven-plugin</artifactId>
</plugin>

Reason: I have a project that I build and deploy from gitlab-ci. I want to create a job stage that checks for new version regarding my pom.xml definition. But the check should not be part of the usual project, thus I'm trying to include this version check plugin only in the gitlab stage, and not in my code.
Is that possible to use a maven plugin on the fly onto another pom?

A: No problem.
You can run
mvn versions:update-parent
for e.g. the update-parent goal.
or if you want a fixed version, you can run
mvn org.codehaus.mojo:versions-maven-plugin:2.11.0:update-parent


text:
Q: $_SESSION variable stays empty I'm creating a login script. The headers are all working but apparently the $_SESSION stays empty. Does anyone knows why this might be?
$db = dbConnection();

// username and password sent from form
$myusername= $_POST['myusername'];
$mypassword= md5($_POST['mypassword']);

// To protect MySQL injection (more detail about MySQL injection)
$myusername = stripslashes($myusername);
$mypassword = stripslashes($mypassword);
$myusername = mysql_real_escape_string($myusername);
$mypassword = mysql_real_escape_string($mypassword);
$sql="SELECT * FROM " .$members. " WHERE BINARY `username`= '".$myusername."' and BINARY `password`= '".$mypassword."'";
$result = $db->query($sql);

// Mysql_num_row is counting table row
$count=$result->rowCount();

// Fetch this accounts row from db
$row = $result->fetch(PDO::FETCH_ASSOC);

// If result matched $myusername and $mypassword, table row must be 1 row
if($count==1){

$_SESSION['username'] = $myusername;
$_SESSION['privileges'] = $row['privileges'];
$_SESSION['email'] = $row['email'];
header("location:index.php");

}

A: Add session_start() at the top of your script.

A: Two possibilities here either session_start(); is not used or $count is not equal to 1 may be both are missing.


text:
Q: communication between a cpp file and an h file Please consider the following
/*utils.h*/
#include <cstdio>
#include <iostream>
//#include some other files, including <string>
//ifndef ... and such macro
extern string configpath;
extern void writelog(string, string);
extern string get_fromfile(string, string);
//end the said macro

then we have
/*utils.cpp*/
//all necessary includes, including <string>
#include "utils.h" //they are in the same folder, as the following main .cpp
void writelog(string msg, string location = "lookinconfigfile")
{
if (location == "lookinconfigfile")
  {
    get_fromFile(configpath, "logpath");
    //the function correctly returns the path to logfile, tested separatly.
  }
  ...
}
string get_formFile(string flpt, string wht)
{...}

then in main.cpp, i include utils.h, and set the configpath to point to a file which holds a path to the logfile.
now g++ -c utils.cpp -std=c++11 produces utils.o
g++ -c main.cpp -std=c++11 produces main.o
before introducing the configpath as a global variable, by explicitly mentioning the configpath, that is, hard coding it to each occurrence, i was able to do this:
g++ main.o -o main

and that would generate main as an executable which would behave as expected.
But now i get this:
main.o: In function `writelog(std::string, std::string)':
main.cpp:(.text+0x2ce): undefined reference to `configpath

Also, if i keep the definition of get_fromFile in utils.cpp _after_ writelog, despite the prototype in utils.h, i get that get_fromFile is not defined.
where do i search looking for solutions?
edit: as user2079303 suggested, yes, it is utils.h, not utils.cpp, thank you.
edit2: as bobah mentioned, i actually have the cases correct in my code, just mistyped here. sorry.

A: You need to define your variable to let compiler know which object file to put it to. Mentioning it in the header file as extern string configpath; just tell compiler that somewhere there will be this variable, leave unresolved reference and let linker resolve it.
Add to your main.cpp:
string configpath;

A: In your final invocation to gcc, you only link main.o, but not utils.o.


text:
Q: populate HTML field from Hidden Field Value I have 2 forms. On the first form I want to place the username in a hidden field. Then, on the second form I want to use that user name as the value of username field.
<form method="POST" name="form1" id="don_form1">
        userName:<input type="text" name="uname">
        Email:<input type="text" name="fname">
        password:<input type="password" name="fname">
        <input type="submit" name="submit_btn1" id="btn1"/>
</form>

<form method="POST" name="form2" id="don_form2">
        userName:<input type="text" name="uname">
        Age:<input type="text" name="fname">
        Country:<input type="text" name="fname">
        <input type="submit" name="submit_btn2" id="btn2"/>
</form>

So, on the second form I don't want the user to his user name again, as this field should be populated on its own. The forms are on 2 different pages of Wordpress.


text:
Q: Prevent or Disable creating new users or changing roles of existing users to Administrator I am trying to give more permissions to the editor role by giving it access to create user accounts. See the code below. But I would like to prevent it from creating or editing existing users with the role of administrator.
function add_theme_caps() {
    $role = get_role('editor');
    $role->add_cap( 'edit_theme_options' );
    $role->add_cap('list_users');
    $role->add_cap('create_users');
    $role->add_cap('delete_users');
    $role->add_cap('edit_users');
}
add_action( 'admin_init', 'add_theme_caps');

Things I am trying to achieve.

*

*The list_users option lists all the users. I would like to list only the non-admin users.

*I want to limit this role from creating new user accounts with the role of administrator and also prevent it from change the role of any existing users to an administrator.

A: Imho that's one of the most important things regarding users:
/**
 * Deny access to 'administrator' for other roles
 * Else anyone, with the edit_users capability, can edit others
 * to be administrators - even if they are only editors or authors
 *
 * @since   0.1
 * @param   (array) $all_roles
 * @return  (array) $all_roles
 */
function deny_change_to_admin( $all_roles )
{
    if ( ! current_user_can('administrator') )
        unset( $all_roles['administrator'] );

    if (
        ! current_user_can('administrator')
        OR ! current_user_can('editor')
    )
        unset( $all_roles['editor'] );

    if (
        ! current_user_can('administrator')
        OR ! current_user_can('editor')
        OR ! current_user_can('author')
    )
        unset( $all_roles['author'] );

    return $all_roles;
}
function deny_rolechange()
{
    add_filter( 'editable_roles', 'deny_change_to_admin' );
}
add_action( 'after_setup_theme', 'deny_rolechange' );


text:
Q: latin1/unicode conversion problem with ajax request and special characters Server is PHP5 and HTML charset is latin1 (iso-8859-1). With regular form POST requests, there's no problem with "special" characters like the em dash (–) for example. Although I don't know for sure, it works. Probably because there exists a representable character for the browser at char code 150 (which is what I see in PHP on the server for a literal em dash with ord).
Now our application also provides some kind of preview mechanism via ajax: the text is sent to the server and a complete HTML for a preview is sent back. However, the ordinary char code 150 em dash character when sent via ajax (tested with GET and POST) mutates into something more: %E2%80%93. I see this already in the apache log.
According to various sources I found, e.g. http://www.tachyonsoft.com/uc0020.htm , this is the UTF8 byte representation of em dash and my current knowledge is that JavaScript handles everything in Unicode.
However within my app, I need everything in latin1. Simply said: just like a regular POST request would have given me that em dash as char code 150, I would need that for the translated UTF8 representation too.
That's were I'm failing, because with PHP on the server when I try to decode it with either utf8_decode(...) or iconv('UTF-8', 'iso-8859-1', ...) but in both cases I get a regular ? representing this character (and iconv also throws me a notice: Detected an illegal character in input string ).
My goal is to find an automated solution, but maybe I'm trying to be überclever in this case?
I've found other people simply doing manual replacing with a predefined input/output set; but that would always give me the feeling I could loose characters.
The observant reader will note that I'm behind on understanding the full impact/complexity with things about Unicode and conversion of chars and I definitely prefer to understand the thing as a whole then a simply manual mapping.
Update based on Delands question about single-byte character necessity:
Truth is, I don't know if I need it. Currently, I've two ways to pass data to server and get back:

*

*client latin1 -> normal post request -> latin1 on server, sends back complete page in latin1, characters ok

*client latin1 -> ajax request (get or post) -> latin1 gets converted to utf8 -> i try to convert utf8 back to latin1 -> send latin1 HTML fragment to client to be displayed inline -> special characters fail
The second way fails because the conversion from utf8->latin1 doesn't work as described above with utf8_decode/icon.
My ultimate goal is simply to present a preview of the data the user has entered. I require the server round trip for the HTML rendering and other data evaluation which is has to be done.
The solution
Alans answer is the solution: latin1 gets treated as windows-1252 in the back and this is also what Word (at least my 2007 here) seems to use when copy&pasting stuff between it and the browser.
Further interesting link (from Alans wikipedia article) is to the HTML 5 Syntax:

8.2.2.2: User agents must at a minimum support the UTF-8 and Windows-1252 encodings, but may support more.

...

When a user agent would otherwise use an encoding given in the first column of the following table to either convert content to Unicode characters or convert Unicode characters to bytes, it must instead use the encoding given in the cell in the second column of the same row. When a byte or sequence of bytes is treated differently due to this encoding aliasing, it is said to have been misinterpreted for compatibility.

...

Input encoding: ISO-8859-1 -> Replacement encoding: windows-1252

A: ISO-8859-1 does not support the em-dash character.  You're actually using one of one of Microsoft's extended code pages, probably windows-1252.  It's effectively a superset of latin1, so browsers tend to to use that when a page is served as ISO-8859-1 (which is why your characters display correctly).  But if you're going to use extended characters like the em-dash, you should specify windows-1252 as the charset wherever you can.  Or, even better, specify UTF-8 everywhere.

A: Pages with guides on how UTF-8 works:
http://azabani.com/15
https://en.wikipedia.org/wiki/UTF-8
Put simply, there isn't an easy mapping of "extended" ASCII sets like ISO-8859-1 (which limit at 255 code points) and Unicode (which owns 1114112 code points, where over 100000 are used). Please give me more detail about why a single-byte charset is needed; maybe I can help you get around this limitation. UTF-8 is the most efficient and flexible choice for encoding text, and should be used wherever possible.


text:
Q: how convertView change in getView (int position, View convertView, ViewGroup parent) in this example can you please explain for me how convertView will changed in this example:
@Override
public View getView(int position, View convertView, ViewGroup parent) {
// If we weren't given a view, inflate one
  if (convertView == null) {
    convertView = getActivity().getLayoutInflater().inflate(R.layout.list_item_crime, null);
  }
  // Configure the view for this Crime
  Crime c = getItem(position);
  TextView titleTextView =
    (TextView)convertView.findViewById(R.id.crime_list_item_titleTextView);
  titleTextView.setText(c.getTitle());
  TextView dateTextView =
    (TextView)convertView.findViewById(R.id.crime_list_item_dateTextView);
  dateTextView.setText(c.getDate().toString());
  CheckBox solvedCheckBox =
    (CheckBox)convertView.findViewById(R.id.crime_list_item_solvedCheckBox);
  solvedCheckBox.setChecked(c.isSolved());
  return convertView;
}

i want to know how titleTextView & dataTextView & solvedCheckBox affect on convertView???
or the convertView that returned at the end of method is the same as convertView = getActivity().getLayoutInflater().inflate(R.layout.list_item_crime, null); and  titleTextView & dataTextView & solvedCheckBox do not changed any thing in convertView???

A:  if (convertView == null) {
convertView = getActivity().getLayoutInflater().inflate(R.layout.list_item_crime, null);

}
This is the initialization of the convertView you need to do it only first time then it will not needed for the second time And titleTextView & dataTextView & solvedCheckBox don't affect on convertView


text:
Q: Reading only float values from text file I have a data file which is text format. It has 2 coloums first one is not useful that I could ignore it and second one is that what I need. The coloum has a different values on each row as string, float etc. For some calculation I need to only float members of this coloum. I followed that way, first declare a float array and read values and save the array with ">>" basic command.
Problem is when non-float row has came, reading function works as broken. It reads non-float values as "0" and save as that. It's OK but after that reads whole values as "0" even if it was a float.
Datafile.txt (example)
aa 1.1
bb 2.2
cc 3.0
dd somestring
ee 4.3
ff 4.9

Code (example)
 do
{
    dfile >> a >> dat[i];
    ofile << dat[i]<<endl;
    cout << dat[i]<<endl;
    i++;

}while(dfile.eof());

Output file (example)
1.1
2.2
3.0
0
0
0
..goes

I've thought two ways to solve the problem. First one is skipping non-float rows. Second one is reading row in a period. Because float values listed in a sequence.

A: Read a string first, then attempt to convert to a number:
std::string maybeNumber;
while (dfile >> a >> maybeNumber)
{

    std::istringstream is(maybeNumber);
    float number = 0.0f;
    if (is >> number)
    {
        dat[i] = number;
        i++;
    }
}

(You don't want to use eof. Everyone thinks they want to use eof, but it's almost always not what they need. See this question for details.)

A:
It's OK but after that reads whole values as "0" even if it was a float.

You haven't shown your full code, but this sounds like the input stream is in an error state after the first non-parseable floating-point number, so it stops reading anything at all.
As for a solution to the problem,  read every line as a std::string, then split the line into a std::vector<std::string>. If the vector doesn't contain two elements or if the second one is not a double, do nothing, else process the row.
Something like this:
std::string line;
while (std::getline(dfile, line))
{
    auto const elements = parse(line);
    if (size(elements) == 2 && is_double(elements[1]))
    {
        // process
    }
}

Now that you have solved the problem on the higher abstraction level, all you have to do is implement something like parse and implement something like is_double (divide & conquer).
Also note that the default C++ floating-point type is double and not float. When in doubt, use double.

A: I would use an algorithm like this:
For each line in the file:

*

*Split the string by whitespaces

*For each result of this split:

*

*Macht with regex "^\d+(\.\d+)?$"

*If string matches regex, convert to float and save in result array

A: using getline and regex_token_iterator
#include <regex>
#include <fstream>
#include <string>
#include <vector>
#include <algorithm>

int main()
{
    std::vector<float> v;
    std::regex reg("-?\\d+(\\.\\d+)?");
    const char* filename="myfile.txt";

    std::ifstream ifs(filename,std::ios::binary);

    for(std::string s;std::getline(ifs,s);)
       for(std::sregex_token_iterator rgi(s.begin(),s.end(),reg);rgi!=std::sregex_token_iterator();++rgi)
         v.push_back(std::stof(rgi->str());

    std::copy(v.begin(),v.end(),std::ostream_iterator<float>(std::cout," ");
    return 0;
}


text:
Q: How do I wait for page to load in selenium after click? I'm running a web scraping script, and I can't find anything reliable on allowing the page to reload when you click a link before the next line of code runs in the script. Below is what I'm currently doing, although it works, I know it's dependent on load times and it's definitely not efficient. Does anyone know if there's like a doThisWhenPageLoads() method I can use is selenium. I'm using node by the way in case that's important.
setTimeout(async () => {
        await driver.findElement(By.xpath('//*[@id="navigation"]/div[1]/ul/li[1]/div/div[1]/a')).click()
    }, 1500)
    // setTimeout(async () => {
        await driver.manage().timeouts().implicitlyWait(10, 10).findElement(By.xpath('//*[@id="navigation"]/div[1]/ul/li[1]/div/div[1]/div/div[2]/div[1]/ul/li[2]/a')).click()
    // }, 2500)
    setTimeout(async () => {
        await driver.findElement(By.xpath('//*[@id="content"]/div/div/div[2]/div/header/div/div[3]/nav/ul/li[1]/div/div/ul/li[6]/a')).click()
    }, 4500)
    setTimeout(async () => {
        await driver.findElement(By.xpath('//*[@id="content"]/div/div/div[2]/div/header/div/div[3]/nav/ul/li[1]/div/div[2]/ul/li[6]/ul/li[3]/a')).click()
    }, 6500)
    setTimeout(async () => {
        await driver.findElement(By.xpath('//*[@id="content"]/div/div/div[2]/div/header/div/div[3]/nav/ul/li[1]/div/div[2]/ul/li[6]/ul/li[3]/ul/li[2]/a')).click()
    }, 8500)
    setTimeout(async () => {
        const target = await driver.findElements(By.xpath('//ul[contains(@class, "product-list")]/li'))

        let arr = await target.map(async (x, index) => {
            let title = await x.findElement(By.xpath(`//li[${index + 1}]/div/div/div/div/div/div`)).getText()
            let price = await x.findElement(By.xpath(`//li[${index + 1}]/div/div/div/div/div[2]/form/div/div/div`)).getText()
            let pricePer100ml = await x.findElement(By.xpath(`//li[${index + 1}]/div/div/div/div/div[2]/form/div/div/div[2]`)).getText()
            let ok = { title, price, pricePer100ml }
            console.log(ok)
            return ok
        })
        console.log(arr)
    }, 13500)

A: Well Selenium already waits if page loads on button clicks. But there are some cases where you may need to wait and Selenium don't wait. You can do this by JavaScript in those cases.
I haven't used Selenium with JavaScript but here is a C# implementation which you can easily implement in JavaScript as per your requirements.
private void pageLoad(ChromeDriver driver)
{
    IJavaScriptExecutor js = (IJavaScriptExecutor)driver;
    WebDriverWait wait = new WebDriverWait(driver, new TimeSpan(0, 0, 20));
    wait.Until(wd => js.ExecuteScript("return document.readyState").ToString() == "complete");
}

document.readyState will return "complete" when the page loads completely. So, IJavaScriptExecutor is a class provided by Selenium which allows us to execute JavaScript code in browsers console. You need to check how you can use IJavaScriptExecutor in JavaScript.
This function will wait for 20 seconds. However you can also wait forever until the page loads completely by using while loop and check if the readyState complete or not.


text:
Q: Difference between JodaTime and Calendar for years before 1900 I'm getting different values in milliseconds for the same date in past while using JodaTime lib and java.util.Calendar.
For example for the first year AD
void test() {
    int year = 1;
    DateTime dt = new DateTime(year, 1,1,0,0,0,0);
    dt = dt.toDateTime(GregorianChronology.getInstance());

    Calendar cal = Calendar.getInstance();
    cal.clear();
    cal.set(year, 0, 1, 0, 0, 0);

    DateTime endDate = new DateTime(cal.getTimeInMillis());
    endDate = endDate.toDateTime(GregorianChronology.getInstance());

    System.out.println("JodaTime: " + dt);
    System.out.println("JodaTime, ms: " + dt.getMillis());
    System.out.println("Calendar: " + cal.getTime());
    System.out.println("Calendar, ms: " + cal.getTimeInMillis());
    System.out.println("JodaTime by Calendar: " + endDate);
}

By default DateTime use ISOChronology and Calendar is GregorianCalendar (except TH and JA locales). So I set GregorianChronology, but nothing changed.
Result of execution is
JodaTime:       0001-01-01T00:00:00.000+01:34:52
JodaTime, ms:   -62135602492000
Calendar:       Sat Jan 01 00:00:00 EET 1
Calendar, ms:   -62135776800000
JodaTime by Calendar:   0000-12-29T23:34:52.000+01:34:52

Could someone suggest am I wrong with something?

A: My guess is that it's to do with your time zone. Specify UTC to remove that from the equation.
Some time zones (e.g. Paris) have had some "interesting" transitions.
For example, zoneinfo suggests that Europe/Athens had an offset of 1:34:52 until 1916 (switching from an abbreviation of LMT to AMT in 1895).
Belarus had an offset of 1:50:16 until 1880.
Perhaps Java is using a different source of time zone data which doesn't include these oddities?

A: After doing some tests I've found out next things:

*

*The problem is my code is that it uses Europe/Athens time zone. Atm it has offset 2 hrs and until 1916 it used to be equal 1:34:52 (thanx Jon Skeet for help). But only Joda Time knows about it =). That's why I had difference since 1582 till 1916 years (not 1900 as I supposed before)
So since 1582-10-15 both Sun's Calendar and Joda Time acts similar (if you use UTC time zone)

*But if you try to create 1582-10-14 using java.util.Calendar (cal.set(1582, 9, 14, 0, 0, 0);) you'll get Sun Oct 24 00:00:00 EET 1582 (and right date in Joda Time). The same true for 05-14.10.1582. Before 1582-10-05 you'll get right string representation for Calendar, but different milliseconds value. And the difference becoming less by some rule. That's why in my example it was 3 days lag. As far as I remember it's connected with Julian calendar
Thanks all for your help


text:
Q: E: Unable to locate package python-pygraphviz E: Package 'ipython' has no installation candidate I wanted to use ns3 for which some prerequisites have to be met in Ubuntu. (https://www.nsnam.org/wiki/Installation)
First of all I cannot use apt-get install python-pygraphviz python-kiwi python-pygoocanvas libgoocanvas-dev ipython command as it shows :E: Could not open lock file /var/lib/dpkg/lock-frontend - open (13: Permission denied)
E: Unable to acquire the dpkg frontend lock (/var/lib/dpkg/lock-frontend), are you root?
When I write the same command as root user,sudo apt-get install gir1.2-goocanvas-2.0 python-gi python-gi-cairo python-pygraphviz python3-gi python3-gi-cairo python3-pygraphviz gir1.2-gtk-3.0 ipython ipython3
The command line interface shows,
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package ipython is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
E: Unable to locate package python-pygraphviz
E: Package 'ipython' has no installation candidate
What should I do ? Can anybody help me?

A: This should work
# Install pip
sudo apt install -y python3-pip

# Install ipython
pip3 install ipython

Source: https://askubuntu.com/questions/1298398/e-package-ipython-has-no-installation-candidate-while-trying-to-install-tor

A: Try executing the following command:
sudo apt install ipython
then do the follwing:
sudo apt install python3-pygraphviz
or
sudo apt-get install python3-pygraphviz


text:
Q: C programming-3 testing condition in if statements #include <stdio.h>
#include <stdlib.h>

int main()
{
   float marks;
   char sports;
   char dance[10];

   printf("Enter your marks:\n");
   scanf(" %f",&marks);

   printf("Do you play sports?? <y/n>\n");
   scanf(" %c",&sports);

   printf("Do you dance?? <yes/no>\n");
   scanf(" %s",dance);

   if((marks >=70) && (sports == 'y') &&(dance == "yes"))
  {
    printf("You are a Good Student\n");
} else{
    printf("You are a Average student\n");
}

return 0;

}

In any scenario am not getting output as -you are a good student
am getting output if i make dance as char but i want it to solve using string.
can anyone tell me whats wrong in this code.

A: When you do dance == "yes" you are comparing two pointers (the pointer to the first element in the array dance, and the pointer to the first letter in "yes"). And those two pointers will never be the same.
To compare string you need to use the strcmp function:
strcmp(dance, "yes") == 0

A: Use strcmp() in your code instead of dance == "yes" because dance read the three characters, plus the implicit \0 terminator and  your condition becomes false.


text:
Q: Global var is undefined outside function, Javascript I'm trying to store a variable inside a function into a global variable.
But the global variable outside of the function stays undefined.
Code snippet:
var x = document.getElementById("demo");

function getLocation() {
if (navigator.geolocation) {
    navigator.geolocation.getCurrentPosition(showPosition);
} else {
    x.innerHTML = "Geolocation is not supported by this browser.";
}
}

var latitude;
var longitude;

function showPosition(position) {
x.innerHTML = "Latitude: " + position.coords.latitude +
"
Longitude: " + position.coords.longitude;
 latitude = position.coords.latitude
 longitude = position.coords.longitude
 console.log(longitude);    // var longitude is set here
}
console.log(longitude);   // var longitude is undefined here

I want to use the variable outside of the function too, how can I fix this?

A: Refer this code


text:
Q: Can a suspended user participate in Winterbash? Can a suspended user participate in Winterbash? Can he/she/it earn hats after he/she/it is suspended? Can he/she/it wear hats after he/she/it is suspended?

A: Looking at this and this profiles they can wear (or keep already worn) hats even after suspended. So they can participate in Winterbash. But I am not sure if they can earn hats after suspension.
This user also wore hat after I asked this question.
Edit:
They can earn hats too even after suspension (mostly passively). See this user had 4 hats when I asked this question. Now she has 5 hats (she earned Hello, World! hat)


text:
Q: Copy to Clipboard on Button Click Event, the Current URL with prepended and/or appended text in Javascript/jQuery The goal is to add a button that will copy the page URL and amend text to the front and end of the URL using jQuery. So far, I have:
$(document).ready(function () {
    $(document).on("click", "#ShareButton", function (e) {
        $("body").append('<input id="copyURL" type="text" value="" />');
        $("#copyURL").val(window.location.href).select();
        document.execCommand("copy");
        $("#copyURL").remove();
    });
});

A: SOLUTION:
https://jsfiddle.net/jx7fg5eo/6/
    $(() => $('#ShareButton').on("click", () =>
      navigator.clipboard.writeText(
        'prepended text ' +
        window.location.href +
        ' appended text'
      )
    ));

NOTE:
If the SOLUTION above does not work in your specific environment, try some of the other solutions in the EXPLANATION section below.  Mainly, the arrow functions and event delegation. (Safe Rollback: https://jsfiddle.net/jx7fg5eo/1/)
EXPLANATION:
https://jsfiddle.net/jx7fg5eo/
For a quick and dirty fix, just change one line...
This is the line assigning a value to the element with id=copyURL, hence the .val().  The argument sent to .val() is window.location.href (aka the current URL).  So if you want to prepend or append to that URL, you can simply use javascript's string concatenation operator, the +, as I have demonstrated below (and in the fiddle linked above).
$("#copyURL").val('something' + window.location.href + 'or other').select();

However, the logic behind the entire algorithm you are using is not clean or efficient, as the best practice would be using...
navigator.clipboard.writeText
as per MDN ...

The "clipboard-write" permission of the Permissions API, is granted
automatically to pages when they are in the active tab.

So the final code would be much cleaner (whitespace added for readability)... https://jsfiddle.net/jx7fg5eo/1/
$(document).ready(function () {
    $(document).on("click", "#ShareButton", function (e) {
         navigator.clipboard.writeText(
           'prepended text ' +
           window.location.href +
           ' appended text');
    });
});

Or a little cleaner using arrow function ... https://jsfiddle.net/jx7fg5eo/2/
$(document).ready(function () {
    $(document).on("click", "#ShareButton", () =>
      navigator.clipboard.writeText('prepended text ' +
      window.location.href + ' appended text'
    ));
});

and cleaner still, you can use an => function for document.ready as you are only performing one operation.  Haven't tried it with multiple operations, not sure if that would work.... https://jsfiddle.net/jx7fg5eo/4/
$(() => $(document).on("click", "#ShareButton", () =>
  navigator.clipboard.writeText(
    'prepended text ' +
    window.location.href +
    ' appended text'
  )
));

Finally, you are using event delegation on the click event. Event delegation is necessary if you are dynamically creating the #ShareButton, or any of it's parent containers, after DOM (document) ready.  If the content is not being dynamically generated, you can move the 2nd argument to .on() to the preceding selector expression.... https://jsfiddle.net/jx7fg5eo/6/
$(() => $('#ShareButton').on("click", () =>
  navigator.clipboard.writeText(
    'prepended text ' +
    window.location.href +
    ' appended text'
  )
));


text:
Q: Common template for multiple routes I have route configuration like this:
[
  {
    path: '',
    component: Home
  },
  {
    path: 'parent',
    children: [
      {
        path: '',
        component: ChildComponent1
      },
      {
        path: 'child2',
        component: ChildComponent2
      },
      {
        path: 'child3',
        component: ChildComponent3
      }
    ]
  }
]

I have some HTML (for example toolbar or menu) that i only want to show for components under parent route i.e. ChildComponent1, ChildComponent2, ChildComponent3, but not for HomeComponent.
I could include my toolbar in each of those components separately, but that is a lot of repetition if i have large number of those components. Is there a better way?
---------------
EDIT
In Angular 1, using ui-router the solution was pretty straightforward. I would have abstract 'parent' route (state), which in Angular 1 could have its own Controller and Template. Something like this:
{
    name: 'parent',
    config: {
        abstract: true,
        url: '/parent-route-url',
        title: 'Parent route',
        template: '

'
    }
},
// all children of parent will now share common toolbar:

{
    name: 'parent.child1',
    config: {
        url: '',
        title: 'Child 1',
        template: 'This is child 1',
        controller: function() {}
    }
},
{
    name: 'parent.child2',
    config: {
        url: 'child2',
        title: 'Child 2',
        template: 'This is child 2',
        controller: function () { }
    }
}

In angular 2, abstract route (the one with children) cannot have its own Component with template (or can it?).


text:
Q: Ado JobStore use! well i'm new in Quartz i'm following this tutorial
and i configured my scheduler instance and quartz to use this properties:
properties["quartz.jobStore.lockHandler.type"] = "Quartz.Impl.AdoJobStore.UpdateLockRowSemaphore, Quartz";
        properties["quartz.jobStore.driverDelegateType"] = "Quartz.Impl.AdoJobStore.SqlServerDelegate, Quartz";
        properties["quartz.jobStore.dataSource"] = "default";
        properties["quartz.dataSource.default.connectionString"] = "Server=loclahost;Initial Catalog=aleo;Persist Security Info=True;User ID=userid;Password=password";
        properties["quartz.dataSource.default.provider"] = "SqlServer-20";
        properties["quartz.jobStore.type"] = "Quartz.Impl.AdoJobStore.JobStoreTX, Quartz";
        properties["quartz.jobStore.useProperties"] = "true";
        properties["quartz.jobStore.tablePrefix"] = "QRTZ_";

        ISchedulerFactory schedFact = new Quartz.Impl.StdSchedulerFactory(properties);
        IScheduler sched = schedFact.GetScheduler();
        sched.Start();

but what's next? i am new on C# but if someone explain to can understand :)
and my question are how i will add jobs and triggers and stuff to the database?
i also created the tables given in the Database/tables folder that comes with Quartz API
thanks.

A: For whom it may concerns: well, i asked this question because i didn't know that Quartz.net comes with a bunch of good examples :) once you give the properties Collection as an argument to the StdSchedulerFactory method, and you get your scheduler, all you have to do is to keep working as you are on RamJobStore, and the job or triggers will be stored in the database not on the Ram Memory :) good luck!


text:
Q: How to fix Native size of React Js app to 67% current sizing? Screen size:
Reduce Native size of app to 67% current sizing. I can do it via Chrome but user first impressions they shouldn't have to resize.
When Zoom is 67%. App look like this:
Why Blank Space coming when I set body zoom to 67%:

How to fix Native size of app to 67% current sizing.?


text:
Q: Declaring function in foreach loop I am trying to create a foreach loop which would visit a link from an array of links and get contents from each of the visited websites.
But when I try to run it:
<?php
    require('simple_html_dom.php');

    // Create DOM from URL or file
    $html = file_get_html('http://www.forgolf.cz/index.php/novinky.html');

   $titles = [];
    $links = [];
    $img_src = [];
    $paragraph = [];

   foreach ($html->find('h2 a') as $title) {

       $links[] = $title->getAttribute('href');
        $titles[] = $title->innertext;
    }

   foreach ($html->find('.item-inner p img') as $img) {
        $img_src[] = $img->getAttribute('src');
    }

   foreach ($links as $link) {
        require('simple_html_dom.php');

        $html = file_get_html('http://www.forgolf.cz'. $link);
        foreach ($html-find('.item-page p') as $p) {
            if (is_string($p))
                $paragraph[] = $p->innertext;
        }
    }
?>

I get Fatal error: Cannot redeclare file_get_html()
And when I dont include the require('simple_html_dom.php');
I get: Fatal error: Uncaught Error: Call to undefined function find()
So I am realy confused.
Anyone got any ideas how to repaire this.

A: Change
require('simple_html_dom.php');

to
require_once('simple_html_dom.php');

in all instances of calling this function, not only in the within loop.

A: please change code few line
 foreach ($links as $link) {
        require('simple_html_dom.php'); **// here** comment line like **//require('simple_html_dom.php');**

        $html = file_get_html('http://www.forgolf.cz'. $link);
        foreach ($html-find('.item-page p') as $p) {
            if (is_string($p))
                $paragraph[] = $p->innertext;
        }
    }
?>

Finally Code
    <?php
require ('simple_html_dom.php');

// Create DOM from URL or file

$html = file_get_html('http://www.forgolf.cz/index.php/novinky.html');
$titles = [];
$links = [];
$img_src = [];
$paragraph = [];

foreach($html->find('h2 a') as $title)
    {
    $links[] = $title->getAttribute('href');
    $titles[] = $title->innertext;
    }

foreach($html->find('.item-inner p img') as $img)
    {
    $img_src[] = $img->getAttribute('src');
    }

foreach($links as $link)
    {

    // require('simple_html_dom.php');

    $html = file_get_html('http://www.forgolf.cz' . $link);
    foreach($html->find('.item-page p') as $p)
        {
        if (is_string($p)) $paragraph[] = $p->innertext;
        }
    }

?>


text:
Q: Python - addition I'm trying to make a program that adds the input, which will be in the form of '7 5 4 1' etc with a space between each number, and will add 7, 5, 4 and 1 for the output. So far I've got nothing working.
x = []
inp = int(input('Enter the expenses: '))
x.extend(inp.split())
print((sum)(x))

Any help would be appreciated

A: You'll need to convert the input to integers after splitting:
inp = input('Enter the expenses: ')
numbers = [int(i) for i in inp.split()]
print(sum(numbers))

A: print(sum([int(x) for x in inp.split()]))

sum - sumarize int/float list
[function(x) for x in list] - a python list comprehensions (a common and nice structure)
int() - convert string to integer
inp.split() - split a string into a list of strings
Explanation from inside to outside: you split the string into a list of strings, convert every string into integer-numbers and summarize it.


text:
Q: is stale; either the element is no longer attached to the DOM, it is not in the current frame context, or the document has been refreshed So im scraping links using selenium.  I can print my links with my loop but I cant navigate to them because I get the following error:
selenium.common.exceptions.StaleElementReferenceException: Message: The element reference of  is stale; either the element is no longer attached to the DOM, it is not in the current frame context, or the document has been refreshed
from selenium import webdriver

driver = webdriver.Firefox()

driver.get("https://www.famousgraphicdesigners.org/")

links = driver.find_elements_by_xpath('//*[@id="pages-2"]/div/ul/li/a')
links_total = len(links)
print("Found", links_total, "total links.\n")

for i in links:
    # print(i.get_attribute('href')) # This works
    driver.get(i.get_attribute('href')) # This doesnt work

driver.quit()

A: When you navigate to a new page the previously located elements become stale, in that case the elements in links, so you can't access the href attribute. Kee p all the hrefs in a list of strings and iterate over it
links = driver.find_elements_by_xpath('//*[@id="pages-2"]/div/ul/li/a')
links_hrefs = [link.get_attribute('href') for link in links]

for i in links_hrefs:
    driver.get(i)

A: Reason for this is because the element to which you have referred is removed from the DOM structure.
solution :
from selenium.webdriver.common.by import By
from selenium import webdriver
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.action_chains import ActionChains

links = []
driver = webdriver.Chrome(executable_path=r"C:\New folder\chromedriver.exe")
driver.maximize_window()
driver.get('https://www.famousgraphicdesigners.org/')

all_Links = WebDriverWait(driver, 15).until(EC.presence_of_all_elements_located((By.XPATH, "//*[@id='pages-2']/div/ul/li/a[@href]")))

for link in all_Links:
    print link.get_attribute("href")
    links.append(link.get_attribute("href"))

for link in links:
    driver.get(link)

A: I came across same problem and
"browser.refresh()"
before calling same element solved my issue there.


text:
Q: Universal Classes of Regular Graphs There is a small but well-known open problem in graph coloring called the Total Coloring Conjecture.  I worked on this problem several years ago and am interested in returning to it, potentially.
For a finite graph $G$ with no multi-edges, I assume it is known what a proper coloring of its vertices is.  In the total coloring conjecture we also want to color the edges, i.e. assign a color to each edge such that no two edges sharing a common vertex are the same color.  A total coloring is a simultaneous proper coloring of the edges and the vertices so that, as well, no edge has the same color as one of its vertices.
Let $\Delta(G)$ be the maximum valence of vertices of $G$.  The total coloring conjecture, by Vizing, states that for a graph $G$ the total coloring number, i.e. the minimal number of colors needed to totally color the graph, is at most $\Delta(G) + 2$.
The method I was using was to supply total colorings of regular graphs and then embed $G$ into one.  There is a bit of difference between the even and odd cases concerning this, though it didn't cause problems in practice.  Given a homogeneous regular graph I was able to totally color a large number of these manually, even for high degrees, since the adjacency matrices are sort of 'modular' looking and thus susceptible to elementary arguments (putting colors of vertices on diagonals and colors of edges elsewhere).
So I am wondering, is there a nice, well-behaved family of (preferably homogeneous) regular graphs for valence $n$ that contain all regular graphs of valence $n$?  What I am picturing are sort of 'longer and longer wreaths' of a single graph, chosen from some finite collection based on $n$, and some rules for braiding it together.  I suppose it is alright if the regular graphs are infinite.
Does the question make sense?  Perhaps negative results would also be helpful, to evaluate the feasibility of this method.


text:
Q: RecyclerView not updating via Live Data Observer I am trying to update the recyclerView adapter in the observe response of live data object but it is not updating the UI rather if I debug it, it starts updating the UI.
Looks like adding a delay make it work or reassigning the recyclerView items adapter also works but I didn't understand why is the notifyDataSetChanged or notifyItemRangeChanged is not working
following is the code I am using
    adapter = MyAdapter(listOf())
    binding.recyclerView.adapter = adapter

    viewModel = ViewModelProvider(this).get(HomeViewModel::class.java)

    viewModel.data.observe(this, {
        adapter.setData(it)

        // This updates the UI, but this is not the right way to do so
        //binding.recyclerViewData.adapter = adapter
    })

Adapter class where I update the data
    fun setData(data: MutableList<DataModelRoom>) {
        this.data= data
        notifyItemRangeChanged(0, data.size)
    }

ViewModel part of the code
    var data: MutableLiveData<MutableList<DataModel>> = MutableLiveData()

    /* This is part of init method */
    viewModelScope.launch {
        Amplify.Hub.subscribe(HubChannel.DATASTORE) { event ->
            if (event.name == DataStoreChannelEventName.READY.toString()) {
                isAmplifyDataReady.postValue(true)

                data.postValue(repository.getDataFromAmplify())
            }
            Log.i(Logging.TAG_AMPLIFY, "event: $event")
        }

        /* Starting the DataStore Syncing */
        Amplify.DataStore.start(
            { Log.i(Logging.TAG_AMPLIFY, "DataStore started") },
            { Log.e(Logging.TAG_AMPLIFY, "Error starting DataStore", it) }
        )
    }

Layout part of the recyclerView
<androidx.recyclerview.widget.RecyclerView
    android:id="@+id/recyclerView"
    android:layout_width="match_parent"
    android:layout_height="152dp"
    android:orientation="horizontal"
    app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
    app:layout_constraintEnd_toEndOf="parent"
    app:layout_constraintStart_toStartOf="parent"
    app:layout_constraintTop_toBottomOf="@+id/textViewView" />

A: I think you're over complicating the issue. Use a ListAdapter<T, K> (included with the platform and call adapter.submitList(pass_the_new_list_here) and have the (required) DiffUtil.Callback handle the differences and update what's needed.


text:
Q: Was Rogue One not a Star Wars Episode movie? I've been hearing about Rogue One (mainly just on this site) but haven't been out to see it.  I just assumed it was the next Star Wars movie, but after seeing this question and reading the Wikipedia page, it appears it is not.
Could someone explain to a complete Star Wars newcomer whether Rogue One is a Star Wars movie and why it is/isn't the next Episode in the franchise?

A: No, Rogue One is not an "Episode" of the Star Wars saga. Note the absence of "Episode Roman Numeral" in its full title.
Rogue One takes place between Star Wars Episode III: Revenge of the Sith and Star Wars Episode IV: A New Hope. There's no room left for a numeral in between.

But more importantly, the Star Wars Episodes (so far) tell the saga of the Skywalker family in general and the journeys of Luke Skywalker and his father Anakin in specific. While the events in Rogue One are related and somewhat relevant to that saga and even show members of the Skywalker family, it is not part of that journey.

A: The film's producer made it clear in a press-release that her film, and the other standalone films, are separate and distinct from the "Star Wars Saga" films.

Producer Kathleen Kennedy was very supportive of Edwards' desire to
experiment and to give the film its own unique personality: "The Star
Wars saga films have a responsibility to maintain a continuity of tone
and stylistic device. Things like the crawl at the beginning, and the
wipes. But with the standalone films we're relaxing some of those
rules so that we can try stylistic and tonal experiments that depart a
bit from what we've seen and are exciting."
Director Gareth Edwards puts own stamp to Star Wars with "Rogue One"

A: In the past we had the (episodic) films and the cartoons. With the latter filling the gaps.
When Disney took over the franchise, they tried to produce more profit for themselves, and fill in the gaps in a different way. Thus they created the anthology films.
This means we now have 2 different variants of films:

*

*Episodic films that tell the main story (Eps 1-7 currently)

*Anthology films that tell side stories

(like how the death star plans from Ep 4 came into the possession of the rebels or the background story of Han Solo ...).

This means that, despite Rogue One being a Star Wars film, it is "just" an anthology film, and thus if you want to know the main story it is not required to see. Although it adds to the main story (being a side arc), it is not truly part of it.

A: Rogue One is absolutely a Star Wars movie.
Is it a movie such that it is deemed "Episode x"? No, not so much.
You could call it "Episode 3½", because it sits narratively between episodes 3 and 4.
But it is its own tale.
That's why it is not called "Star Wars Episode 3½: Rogue One", but "Rogue One: A Star Wars Story".
And, let's face it, "Episode 3½" would be kind of a stupid title! Maybe that's why they didn't do that.

A: Rogue One is a stand-alone film set in the Star Wars universe. Unlike the 7 Episodes we have seen, Rogue One simply fills the gap in knowledge of what happened between Episode III and Episode IV, rather than further the plot of the Episodes so far.
Essentially, the basis for Rogue One is:

 the tale of how the Rebellion acquires the Death Star plans in Episode IV and discusses why there was such a major flaw in the design of the Death Star

It is part of the Star Wars Anthology Series which was planned after the decision to make the Sequel Trilogy.
The next anthology film, based on how Han Solo

 becomes the criminal smuggler we meet in the Mos Eisley Cantina

is set to come out in May 2018, and will be directed by Phil Lord and Christopher Miller
The final anthology film, which, not much is known about, has had a writer for the script since September 2016 and is planned to be released in 2020
The difference between these films and the Episodes is that they don't further the plot of the Skywalker family and the story of the Jedi, however they give us more information about plot points and characters we have only been able to speculate about and expand the galaxy.


text:
Q: c++ application using qt, how to include gnuplot Im looking for a solution or some guidelines on how to, from a c++ application using Qt, create scientific plots. I have set my mind on gnuplot because it have nice features for later use of my plots in latex and such.
My question is then, can i and how do i accomplish to show a plot in qt and also makes it possible to expose the gnuplot commands for generating the plot later for reporting.
Should i based on my data create some datafile, and create a text file with the commands?
Can it be integrated into my c++ application such that i create the plot, see it in my application and then save the data and plot file.
Any input would be nice. I dont now gnuplot at the moment, and wonder if its a application on unix or its a library i can use in my application. Thanks.

A: Easiest way is to have your app run gnuplot in a system() or similar call, plotting to an image and then display the image.
If you want more detailed control there is an iostream lib to talk to gnuplot or an old C interface

A: If your not set on gnuplot look into:

*

*KD Chart, it uses Qt ModelView programming model. It's cross platform and even has a plugin that appears as a widget in Qt Designer.

*The R-Project is great for plotting might be all you need as a standalone program, but also as a Qt interface R-Forge. It too is cross platform.

Note:
I havn't tried R-Forge yet. R is actually a statistical programming language.
KD Chart targets business type charts but may have what you need.


text:
Q: fade a picture and bring up others in a presentation Actually, I have seen some presentation that an image fade and other 3 images appeared there. or one image went smaller in top and two images appeared in down of a page
Is there anyone know how to make such slides ? I really appreciate any comment .
Thanks

A: Sounds like you may want to look into slide transitions, see 14.3 Slide Transitions of the beamer user guide.
A short example:
\documentclass{beamer}

\begin{document}

\begin{frame}
    \transfade<1-2>
  \includegraphics<1>[width=.5\textwidth]{example-image-a}
  \includegraphics<2>[width=.25\textwidth]{example-image-b}
  \includegraphics<2>[width=.25\textwidth]{example-image}
\end{frame}

\end{document}


text:
Q: CocoaPods not installed or not in valid state. Error launching application on iPhone 13 1.i received this error after updating android studio when i try to run the app but if i write flutter run on terminal the app run normally how to solve this issue
Launching lib/main.dart on iPhone 13 in debug mode...
Warning: CocoaPods not installed. Skipping pod install.
CocoaPods is used to retrieve the iOS and macOS platform side's plugin code that responds to your plugin usage on the Dart side.
Without CocoaPods, plugins will not work on iOS or macOS.
For more info, see https://flutter.dev/platform-plugins
To install see https://guides.cocoapods.org/using/getting-started.html#installation for instructions.
CocoaPods not installed or not in valid state.
Error launching application on iPhone 13.
Launching lib/main.dart on iPhone 13 in debug mode...
Warning: CocoaPods not installed. Skipping pod install.
  CocoaPods is used to retrieve the iOS and macOS platform side's plugin code that responds to your plugin usage on the Dart side.
  Without CocoaPods, plugins will not work on iOS or macOS.
  For more info, see https://flutter.dev/platform-plugins
To install see https://guides.cocoapods.org/using/getting-started.html#installation for instructions.

CocoaPods not installed or not in valid state.
Error launching application on iPhone 13.

this is my flutter doctor massage
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 2.8.1, on macOS 12.1 21C52 darwin-x64, locale en-CU)
[✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 13.2.1)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2021.1)
[✓] Connected device (2 available)

• No issues found!

local gems

*** LOCAL GEMS ***

activesupport (6.1.4.1, 5.2.6, 4.2.11.3)
addressable (2.8.0)
algoliasearch (1.27.5)
atomos (0.1.3)
benchmark (default: 0.1.0)
bigdecimal (default: 2.0.0)
bundler (default: 2.1.4)
CFPropertyList (3.0.5)
cgi (default: 0.1.0)
claide (1.0.3)
cocoapods (1.11.2)
cocoapods-core (1.11.2, 1.10.0, 1.7.5)
cocoapods-deintegrate (1.0.5)
cocoapods-downloader (1.5.1)
cocoapods-plugins (1.0.0)
cocoapods-search (1.0.1)
cocoapods-stats (1.1.0)
cocoapods-trunk (1.6.0)
cocoapods-try (1.2.0)
colored2 (3.1.2)
concurrent-ruby (1.1.9)
csv (default: 3.1.2)
date (default: 3.0.0)
dbm (default: 1.1.0)
delegate (default: 0.1.0)
did_you_mean (default: 1.4.0)
escape (0.0.4)
etc (default: 1.1.0)
ethon (0.15.0)
fcntl (default: 1.0.0)
ffi (1.15.5, 1.15.4)
fiddle (default: 1.0.0)
fileutils (default: 1.4.1)
forwardable (default: 1.3.1)
fourflusher (2.3.1)
fuzzy_match (2.0.4)
getoptlong (default: 0.1.0)
gh_inspector (1.1.3)
httpclient (2.8.3)
i18n (1.8.11, 0.9.5)
io-console (default: 0.5.6)
ipaddr (default: 1.2.2)
irb (default: 1.2.3)
json (default: 2.3.0)
logger (default: 1.4.2)
matrix (default: 0.2.0)
minitest (5.13.0)
molinillo (0.8.0, 0.6.6)
mutex_m (default: 0.1.0)
nanaimo (0.3.0)
nap (1.1.0)
net-pop (default: 0.1.0)
net-smtp (default: 0.1.0)
net-telnet (0.2.0)
netrc (0.11.0)
observer (default: 0.1.0)
open3 (default: 0.1.0)
openssl (default: 2.1.2)
ostruct (default: 0.2.0)
power_assert (1.1.7)
prime (default: 0.1.1)
pstore (default: 0.1.0)
psych (default: 3.1.0)
public_suffix (4.0.6)
racc (default: 1.4.16)
rake (13.0.1)
rdoc (default: 6.2.1)
readline (default: 0.0.2)
readline-ext (default: 0.1.0)
reline (default: 0.1.3)
rexml (3.2.5, default: 3.2.3)
rss (default: 0.2.8)
ruby-macho (2.5.1, 1.4.0)
sdbm (default: 1.0.0)
setup (5.2.0)
singleton (default: 0.1.0)
stringio (default: 0.1.0)
strscan (default: 1.0.3)
test-unit (3.3.4)
thread_safe (0.3.6)
timeout (default: 0.1.0)
tracer (default: 0.1.0)
typhoeus (1.4.0)
tzinfo (2.0.4, 1.2.9)
uri (default: 0.10.0)
webrick (default: 1.6.0)
xcodeproj (1.21.0)
xmlrpc (0.3.0)
yaml (default: 0.1.0)
zeitwerk (2.5.1)
zlib (default: 1.1.0)

A: Clicking "Check for updates..." and installing the updates that are available fixed this for me.