text:
Q: org.xml.sax.SAXParseException: Unexpected token (position:TEXT @1:2 in java.io.StringReader@4156ccc8) I have this code in my Main Activity:
BufferedReader reader = new BufferedReader (new InputStreamReader(in));

        StringBuilder xml1 = new StringBuilder();
        String cursor;
        try {
            while ( (cursor = reader.readLine()) != null){
                xml1.append(cursor);
            }
        } catch (IOException e1) {
            // TODO Auto-generated catch block
            e1.printStackTrace();
        }
        String xml = xml1.toString();

                XmlParser parser = new XmlParser();
        Document doc = parser.getDomElement(xml);

And here is the getDomElement function:
public Document getDomElement(String xml){
        Document doc = null;
        DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
        try {

            DocumentBuilder db = dbf.newDocumentBuilder();

            InputSource is = new InputSource();
                is.setCharacterStream(new StringReader(xml));
                doc = db.parse(is);

            } catch (ParserConfigurationException e) {
                Log.e("Error: ", e.getMessage());
                return null;
            } catch (SAXException e) {
                Log.e("Error: ", e.getMessage());
                return null;
            } catch (IOException e) {
                Log.e("Error: ", e.getMessage());
                return null;
            }

            return doc;
    }

Here is the XML File:
<?xml version="1.0" encoding="utf-8"?>
<feed xml:base="https://portal.wow2.telenor.com/global/newscentre/_api/" xmlns="http://www.w3.org/2005/Atom" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns:georss="http://www.georss.org/georss" xmlns:gml="http://www.opengis.net/gml">
  <id>032acc78-4645-416d-8f57-69f9de340d9e</id>
  <title />
  <updated>2014-03-20T06:20:12Z</updated>
<entry m:etag=""28"">
    <id>3cd3253c-7a95-4751-b34c-dada815c6d23</id>
    <category term="SP.Data.PagesItem" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" />
    <link rel="edit" href="Web/Lists(guid'b1b97552-232e-46e3-b9ec-f864a85f7177')/Items(2)" />
    <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/FirstUniqueAncestorSecurableObject" type="application/atom+xml;type=entry" title="FirstUniqueAncestorSecurableObject" href="Web/Lists(guid'b1b97552-232e-46e3-b9ec-f864a85f7177')/Items(2)/FirstUniqueAncestorSecurableObject" />
    <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/RoleAssignments" type="application/atom+xml;type=feed" title="RoleAssignments" href="Web/Lists(guid'b1b97552-232e-46e3-b9ec-f864a85f7177')/Items(2)/RoleAssignments" />
    <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/AttachmentFiles" type="application/atom+xml;type=feed" title="AttachmentFiles" href="Web/Lists(guid'b1b97552-232e-46e3-b9ec-f864a85f7177')/Items(2)/AttachmentFiles" />
    <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/ContentType" type="application/atom+xml;type=entry" title="ContentType" href="Web/Lists(guid'b1b97552-232e-46e3-b9ec-f864a85f7177')/Items(2)/ContentType" />
    <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/FieldValuesAsHtml" type="application/atom+xml;type=entry" title="FieldValuesAsHtml" href="Web/Lists(guid'b1b97552-232e-46e3-b9ec-f864a85f7177')/Items(2)/FieldValuesAsHtml" />
    <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/FieldValuesAsText" type="application/atom+xml;type=entry" title="FieldValuesAsText" href="Web/Lists(guid'b1b97552-232e-46e3-b9ec-f864a85f7177')/Items(2)/FieldValuesAsText" />
    <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/FieldValuesForEdit" type="application/atom+xml;type=entry" title="FieldValuesForEdit" href="Web/Lists(guid'b1b97552-232e-46e3-b9ec-f864a85f7177')/Items(2)/FieldValuesForEdit" />
    <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/File" type="application/atom+xml;type=entry" title="File" href="Web/Lists(guid'b1b97552-232e-46e3-b9ec-f864a85f7177')/Items(2)/File" />
    <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Folder" type="application/atom+xml;type=entry" title="Folder" href="Web/Lists(guid'b1b97552-232e-46e3-b9ec-f864a85f7177')/Items(2)/Folder" />
    <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/ParentList" type="application/atom+xml;type=entry" title="ParentList" href="Web/Lists(guid'b1b97552-232e-46e3-b9ec-f864a85f7177')/Items(2)/ParentList" />
    <title />
    <updated>2014-03-20T06:20:12Z</updated>
    <author>
      <name />
    </author>
    <content type="application/xml">
      <m:properties>
        <d:FileSystemObjectType m:type="Edm.Int32">0</d:FileSystemObjectType>
        <d:Id m:type="Edm.Int32">2</d:Id>
        <d:ContentTypeId>0x010100C568DB52D9D0A14D9B2FDCC96666E9F2007948130EC3DB064584E219954237AF3900242457EFB8B24247815D688C526CD44D000C4FEEB0930A3E4FAC4CED6DBC3688FA</d:ContentTypeId>
        <d:OData__ModerationComments m:null="true" />
        <d:Title>a1</d:Title>
        <d:OData__dlc_DocId>67XPVZAHCTHM-7-2</d:OData__dlc_DocId>
        <d:OData__dlc_DocIdUrl m:type="SP.FieldUrlValue">
          <d:Description>67XPVZAHCTHM-7-2</d:Description>
          <d:Url>https://portal.wow2.telenor.com/global/newscentre/_layouts/15/DocIdRedir.aspx?ID=67XPVZAHCTHM-7-2</d:Url>
        </d:OData__dlc_DocIdUrl>
        <d:Comments m:null="true" />
        <d:PublishingStartDate m:null="true" />
        <d:PublishingExpirationDate m:null="true" />
        <d:PublishingContactId m:type="Edm.Int32">1</d:PublishingContactId>
        <d:PublishingContactEmail m:null="true" />
        <d:PublishingContactName m:null="true" />
        <d:PublishingContactPicture m:null="true" />
        <d:PublishingPageLayout m:type="SP.FieldUrlValue">
          <d:Description>Body only</d:Description>
          <d:Url>https://portal.wow2.telenor.com/_catalogs/masterpage/PageFromDocLayout.aspx</d:Url>
        </d:PublishingPageLayout>
        <d:PublishingIsFurlPage m:type="Edm.Boolean">true</d:PublishingIsFurlPage>
        <d:SeoBrowserTitle m:null="true" />
        <d:SeoMetaDescription m:null="true" />
        <d:SeoKeywords m:null="true" />
        <d:RobotsNoIndex m:type="Edm.Boolean">false</d:RobotsNoIndex>
        <d:PublishingPageContent>
test
</d:PublishingPageContent>
        <d:ArticleByLine m:null="true" />
        <d:ArticleStartDate m:null="true" />
        <d:PublishingImageCaption m:null="true" />
        <d:TelenorBanner m:null="true" />
        <d:BusinessUnit>
          <d:element m:type="SP.Taxonomy.TaxonomyFieldValue">
            <d:Label>Global</d:Label>
            <d:TermGuid>95e90ed7-544b-4526-8479-b829dbf448f6</d:TermGuid>
            <d:WssId m:type="Edm.Int32">4</d:WssId>
          </d:element>
        </d:BusinessUnit>
        <d:GeoLocation m:null="true" />
        <d:SecurityClassification>Internal</d:SecurityClassification>
        <d:RightColumnContact m:null="true" />
        <d:InformationContentType m:null="true" />
        <d:InformationContextCategory m:null="true" />
        <d:InformationValue>Non-Essential</d:InformationValue>
        <d:TelenorArticleFirstPublishDate m:null="true" />
        <d:ArticleAuthorId m:null="true" />
        <d:ArticleCoAuthorsId m:null="true" />
        <d:Teaser m:null="true" />
        <d:Introduction m:null="true" />
        <d:EnableComments m:type="Edm.Boolean">true</d:EnableComments>
        <d:IsHighlight m:type="Edm.Boolean">false</d:IsHighlight>
        <d:ArticleLanguage m:type="SP.Taxonomy.TaxonomyFieldValue">
          <d:Label>1</d:Label>
          <d:TermGuid>23c0f277-1348-4971-aac7-9bba7d153ecf</d:TermGuid>
          <d:WssId m:type="Edm.Int32">1</d:WssId>
        </d:ArticleLanguage>
        <d:ArticleSummaryLinkText m:null="true" />
        <d:TelenorArticlePublishingDate>2014-02-06T10:28:21Z</d:TelenorArticlePublishingDate>
        <d:EnableCommentsWebArtice m:type="Edm.Boolean">false</d:EnableCommentsWebArtice>
        <d:AggregateTarget />
        <d:Set_x0020_Publish_x0020_Date m:null="true" />
        <d:Set_x0020_Publish_x0020_Date_x0028_1_x0029_ m:null="true" />
        <d:AverageRating m:null="true" />
        <d:RatingCount m:null="true" />
        <d:LikesCount m:null="true" />
        <d:OData__ModerationStatus m:type="Edm.Int32">0</d:OData__ModerationStatus>
        <d:ID m:type="Edm.Int32">2</d:ID>
        <d:Created m:type="Edm.DateTime">2013-07-09T05:59:34Z</d:Created>
        <d:AuthorId m:type="Edm.Int32">1</d:AuthorId>
        <d:Modified m:type="Edm.DateTime">2014-02-06T10:28:21Z</d:Modified>
        <d:EditorId m:type="Edm.Int32">3974</d:EditorId>
        <d:OData__CopySource m:null="true" />
        <d:CheckoutUserId m:null="true" />
        <d:OData__UIVersionString>6.0</d:OData__UIVersionString>
        <d:GUID m:type="Edm.Guid">1bb37159-2438-4693-acab-ceef4b5a8214</d:GUID>
      </m:properties>
    </content>
  </entry>
  <link rel="next" href="https://portal.wow2.telenor.com/global/newscentre/_api/web/lists('b1b97552-232e-46e3-b9ec-f864a85f7177')/items?%24skiptoken=Paged%3dTRUE%26p_SortBehavior%3d0%26p_ID%3d1288&%24%24orderby=Created+dsc" />
</feed>

I am getting this error:
org.xml.sax.SAXParseException: Unexpected token (position:TEXT @1:2 in java.io.StringReader@4156ccc8) at the StringReader

Also I am not getting the whole XML file displayed when I display it in Logcat after converting it to String.

A: The problem is StringReader Object. Pass the InputStream straightly to the Document object
Thank you all who shares knowledge


text:
Q: How can I draw a partial ellipse in D3? I basically want to create a partial ellipse , say half an ellipse , can I do it by using the inbuilt D3 ellipse method , if not then how would I be able to accomplish this ?

A: To draw half an ellipse by using SVG,
still searching to use d3.
Below is the code for you,
<svg>
   <clipPath id="cut-off-bottom">
       <rect height="100" width="200" y="0" x="0">
    </clipPath>
    <ellipse clip-path="url(#cut-off-bottom)" ry="30" rx="100" cy="100" cx="100">
</svg>

If you want to know more about how this drawn, here is the link https://developer.mozilla.org/en-US/docs/Web/SVG/Tutorial/Clipping_and_masking.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Css mobile version (trouble with width) I need to do mobile version of this page.(code below) But I receive the result such as on screenshot see my mobile version What i have do?
P.S. if not difficult couple of words about the html structure and css (I just started to learn how to make websites)

.row-wrap-left,
.row-wrap-right,
.row-wrap-bottom,
.field-wrap {
 float: none;
 width: 100%;
}

.request-input {
 width: 90%;
}

textarea {
 width: 98%;
}

.button-submit {
 float: none;
 width: 100%;
 margin-bottom: 20px;
}

.button-cancel {
 float: none;
 width: 100%;
}

.clearfix:before,
.clearfix:after {
  content: "";
  display: table;
}

.clearfix:after {
  clear: both;
}

body {
 background: #282828;
 font-family: 'Montserrat', sans-serif;
}

.container {
 background: #27292b;
 max-width: 636px;
}

.request {
 text-align: left;
 position: relative;
 overflow: hidden;
}

.wrapper {
 padding: 36px 85px 60px 85px;
}

.row-wrap-left {
 float: left;
 width: 50%;
 overflow: hidden;
}

.row-wrap-right {
 float: right;
 width: 50%;
 overflow: hidden;
}

.row-wrap-right .field-wrap {
 float: right;
}

.row-wrap-bottom {
 float: left;
 width: 100%;
 overflow: hidden;
}

.field-wrap {
 position: relative;
}

form {
 overflow: hidden;
}

.request-head h1 {
 font-size: 29px;
 text-transform: uppercase;
 color: #fff;
 padding-bottom: 25px;
 border-bottom: solid 1px #47494b;
 margin-bottom: 36px;
}

.request-input {
 width: 195px;
 height: 12px;
 font-size: 18px;
 padding: 14px;
 background: none;
 border: 1px solid #47494b;
 border-radius: 2px;
 margin-top: 17px;
 margin-bottom: 44px;
}

.request-country,
.request-code {
 width: 33px;
}

.request-number {
 width: 58px;
}

.request-input:focus,
textarea:focus {
 outline: none;
 color: #fff;
 border-color: #fff;
}

.request-input:focus ~ label,
.request-input:focus + span,
textarea:focus + label {
 color: #fff;
}

.field-wrap label {
 color: #434546;
 font-size: 13px;
 display: block;
 position: absolute;
 top: 0;
}

.field-wrap .icon {
 position: absolute;
 top: 30px;
 margin-left: -40px;
 padding-left: 10px;
 color: #434546;
}

textarea {
 width: 460px;
 height: 150px;
 font-size: 18px;
 background: none;
 border: 1px solid #47494b;
 border-radius: 2px;
 margin-top: 17px;
 margin-bottom: 28px;
}

p {
 font-size: 13px;
 color: #434546;
}

a {
 font-size: 13px;
 text-decoration: none;
 color: #fff;
}

.agreement {
 margin-bottom: 30px;
}

.button-submit {
 background: #5d9f81;
    color: #fff;
    border: none;
    padding: 14px 44px;
    text-align: center;
    text-decoration: none;
    display: inline-block;
    font-size: 13px;
    border-radius: 2px;
    margin-right: 18px;
}

.button-cancel {
    background: none;
    color: #434546;
    border: 1px solid #47494b;
    padding: 14px 44px;
    text-align: center;
    text-decoration: none;
    display: inline-block;
    font-size: 13px;
    border-radius: 2px;
}

.button-submit:hover {
 background: #4c876c;
    color: #fff;
    cursor: pointer;
}

.button-cancel:hover {
    background: #5d9f81;
    color: #fff;
    cursor: pointer;
}

input:focus:invalid,
textarea:focus:invalid {
 border: 1px solid #e7635e;
}

input:focus:invalid ~ label {
 color: #da5f5b;
}

input:focus:invalid + span {
 color: #da5f5b;
}

textarea:focus:invalid + label {
 color: #da5f5b;
}

input:required:valid,
textarea:required:valid {
 border: 1px solid #6abd97;
 color: #6abd97;
}

input:required:valid + label,
textarea:required:valid + label{
 color: #6abd97;
}

input:required:valid ~ label {
 color: #6abd97;
}

input:required:valid + span {
 color: #6abd97;
}
<!DOCTYPE html>

 <meta charset="UTF-8">
 <title>Register form</title>
 <link rel="stylesheet" href="css/style.css">
 <link rel="stylesheet" href="font-awesome-4.5.0/css/font-awesome.min.css">
 <link rel="stylesheet" href="css/small.css" media="(max-width:600px)">

Request a demo

    <form action="/" method="post">

       <input type="text" name="form_data[first_name]" id="fname" class="request-input request-fname" required autocomplete="off">
       First Name

       <input type="email" name="form_data[email]" id="email" class="request-input request-email" required autocomplete="off">
       Email *

       <input type="text" name="form_data[school_organization]" id="school-org" class="request-input request-school" required autocomplete="off">

       School/Organization *

       <input type="text" name="form_data[last_name]" id="lname" class="request-input request-lname" required autocomplete="off">
       Last Name

       <input type="tel"  name="form_data[phone][country]" id="tel" class="request-input request-country" required autocomplete="off" pattern="[0-9]{3}">
       <input type="tel"  name="form_data[phone][code]" id="tel" class="request-input request-code" required autocomplete="off" pattern="[0-9]{2}">
       <input type="tel"  name="form_data[phone][number]" id="tel" class="request-input request-number" required autocomplete="off" pattern="[0-9]{7}">
       Phone Number

       <input type="text" name="form_data[role]" id="role" class="request-input request-role" required autocomplete="off">
       Role on Campus *

       <textarea name="form_data[goals]" id="goals" class="label-goals" required autocomplete="off"></textarea>
       What are your goals for DemoSystem? *

       <input type="checkbox" name="checkbox" id="checkbox" checked>

        I agree to the DemoSystem

         Terms of Service

        and

         Privacy Policy

       <button class="button-submit">Submit</button>
       <button class="button-cancel">Cancel</button>

    </form>

A: You can use media query in your css.
Media query allowed you to change css depending on the screen size.
@media screen and (max-width: 750px) {
    /* your new Css here */
}

Right after the max-width parametre you put the desired width.
If the max-width parameter is set to 750px the code will be active whenever the screen size is bellow 750px.
Then you can put all the existing css selector already used for higher screen and make them have new value.
Put the media query code at the bottom of you css style sheet.
You can use several media query in the same code.
Example:
@media screen and (max-width: 1150px) {
    /* your new Css for tablet here */
}
@media screen and (max-width: 750px) {
    /* your new Css for smart phone here */
}

Also it's strongly advise to add the code below on the head of your html code
<meta name="viewport" content="width=device-width, initial-scale=1">

Feel free to ask if needed.

A: In the small css you have to specify a new width for input #id:
#tel{
  width:25%;
}

Result: jsfiddle


text:
Q: How are nodes laid within the DOM tree? I am learning JavaScript.
I am new to the topic of Document Object Model (DOM).
I am confused about how are nodes laid within the DOM tree?
I used this HTML file.

List

Buy groceries

emTextdirectText

headText

I used this JavaScript file.
var li = document.getElementById('one');

var emText = li.firstChild.firstChild.nodeValue;
var directText = li.firstChild.nextSibling.nodeValue;

document.write(emText + '
');
document.write(directText + '
');

var div = document.getElementById('TDiv');
var headText = div.firstChild.nextSibling.firstChild.nodeValue;
document.write(headText);

The two variables:
var li = document.getElementById('one');
var div = document.getElementById('TDiv');
hold the location of the li element node and div element node within the DOM tree.
Although this line gives the right answer but it is formulated unexpectedly:
var headText = div.firstChild.nextSibling.firstChild.nodeValue;

It is used to get the text value of the text node within the H1 node element within the DIV node element. So I expected it to be written like this:
var headText = div.firstChild.firstChild.nodeValue;

DIV has H1 as a first child, and in turn H1 has a first child of Text node.
div.firstChild should returns H1.
div.firstChild.firstChild should returns the Text node of H1.
div.firstChild.firstChild.nodeValue should returns the value of the Text node.
How are those nodes really laid within the DOM tree?!

A: There is whitespace between the
 and the
 - the newline. That will (or might) be turned into a text node.
If you changed the HTML:

headText

then the DOM would not have that extra text node.
This is a good illustration of why it's a terrible idea for JavaScript code to expect a particular structure from an HTML document.


text:
Q: How to display app's form to display at desired monitor when debugging? When I press F5 to debug my C# Windows form app, built with Visual Studio 2017 pro on Windows 10, the app window always displays on my main monitor, which is the middle monitor of my 3 monitors.
Is there a 'trick' to always open and display on the left-hand monitor?
(I want to use middle monitor to see the source code.)
If no trick, then I must program form's x,y to persist across debug sessions.

A: Try setting the form's startup location manually.
this.StartPosition = FormStartPosition.Manual;

Then you should be able to find your other monitor and apply its' location to your current form using
Screen[] screens = Screen.AllScreens;
Point location = screens[0].Bounds.Location;
this.Left = location.X;
this.Top = location.Y;

I can't confirm that this is exactly what you need since I currently am not at a computer with multiple monitors but it should be something very close to this if I'm wrong.


text:
Q: viewing c# console app arguments I have a console app (written in c#) that is passed various arguments from the command line by an external application (an InstallShield exe).  Without adding code into the console app or InstallShield exe to log the value of arguments is there any way to see the value of the arguments passed to the console app? (perhaps via some sort of process monitoring app)
Any suggestions would be very helpful!
Cheers
Tim

A: The excellent and free Sysinternals Process Explorer will do what you want.  Highlight the process, right-click, choose Properties, and on the dialog that opens you'll see a "Command line:" section that lists the arguments passed to your executable:

(source: ask-leo.com)
(Image source: Process Explorer - A Free Powerful Replacement for Windows Task Manager)


text:
Q: Getting Error: Resource myAzureFunction does not exists. GItHub workflow Azure Functions Actions I am following youtube example Azure-Resume : https://www.youtube.com/watch?v=ieYrBWmkfno&ab_channel=ACloudGuru
Stuck on creating workflow with GitHub.

The resource azure function app is for sure exists and in Running status:

yaml code:
name: deploy_backend

on:
  push:
      branches: [ main ]
      paths:
      - 'backend/**' # whenever change in a backup folder - it will be picked up
env:
  AZURE_FUNCTIONAPP_NAME: fnGetResumeCounter    # set this to your application's name
  AZURE_FUNCTIONAPP_PACKAGE_PATH: 'backend'   # set this to the path to your web app project, defaults to the repository root
  DOTNET_VERSION: '3.1'                       # set this to the dotnet version to use

jobs:
  build-and-deploy:
    runs-on: windows-latest
    steps:
    - name: 'Checkout GitHub Action'
      uses: actions/checkout@v2
    # use the same secret we generated for frontend.
    - name: 'Login via Azure CLI'
      uses: azure/login@v1
      with:
          creds: ${{ secrets.AZURE_CREDENTIALS }}

    - name: Setup DotNet ${{ env.DOTNET_VERSION }} Environment
      uses: actions/setup-dotnet@v1
      with:
        dotnet-version: ${{ env.DOTNET_VERSION }}

    - name: 'Resolve Project Dependencies Using Dotnet'
      shell: pwsh
      run: |
        pushd './${{ env.AZURE_FUNCTIONAPP_PACKAGE_PATH }}/api'
        dotnet build --configuration Release --output ./output
        popd

    - name: "Run unit test"
      shell: pwsh
      run: |
        pushd './${{ env.AZURE_FUNCTIONAPP_PACKAGE_PATH }}/tests'
        dotnet test

    - name: 'Run Azure Functions Action'
      uses: Azure/functions-action@v1
      with:
        app-name: ${{ env.AZURE_FUNCTIONAPP_NAME }}
        package: '${{ env.AZURE_FUNCTIONAPP_PACKAGE_PATH }}/api/output'


text:
Q: Expectation propagation for feature selection I'm using Expectation propagation algorithm (infer.net library) for my feature selection problem.
I generate input data and test my model. The thing is that when I use different number of data points, I get very different results.
For example, in my current setting it really works well with 50 data points. However, with more than 60 and less than 40 the result are dramatically poorer.
Can anyone explain this to me? Is it something related to Expectation Propagation? Or it is because of the way it is may be implemented in infer.net?
Any help is appreciated.

A: *

*Maybe it hasn't converged.

*Try initializing near the true answer.

*Try a different inference algorithm.


text:
Q: Issue with uploading image from Android to Mysql I'm working on a social app and I want to upload an image in the database, I tried a code and it worked. The file is in my folder but the problem is that the path couldn't get to the Mysql database I figured out that $_FILES['uploaded_file']['name'] is empty but I don't know how to solve this.
AddStatus.java :
public class AddStatus extends AppCompatActivity implements View.OnClickListener  {
private ProgressDialog pDialog;
EditText status;
Button send,upload_img;
String user_id;
private TextView messageText;
private ImageView imageview;
private int serverResponseCode = 0;
private ProgressDialog dialog = null;
private String imagepath=null;
JSONParser jsonParser = new JSONParser();
private static final String upLoadServerUri = "http://192.168.1.10/social/addstatus.php";

private static final String TAG_SUCCESS = "success";
private static final String TAG_MESSAGE = "message";

protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.add_status);

    ImageView img= new ImageView(this);

    status =(EditText)findViewById(R.id.edt_status);
    send = (Button)findViewById(R.id.btn_send);
    upload_img = (Button) findViewById(R.id.btn_img);

    messageText  = (TextView)findViewById(R.id.messageText);
    imageview = (ImageView)findViewById(R.id.imageView_pic);
    send.setOnClickListener(this);
    upload_img.setOnClickListener(this);

    final Intent callingIntent = getIntent();
    user_id = callingIntent.getStringExtra("user_id");

}
@Override
public void onClick(View v) {
    switch (v.getId()) {
        case R.id.btn_send:

            dialog = ProgressDialog.show(AddStatus.this, "", "Uploading file...", true);
            messageText.setText("uploading started.....");
            new Thread(new Runnable() {
                public void run() {

                    uploadFile(imagepath);

                }
            }).start();

            String stat = status.getText().toString();
            Long ts = System.currentTimeMillis();
            String time = ts.toString();
            new addStatus().execute(stat,user_id,time);

            break;

        case R.id.btn_img:
            Intent intent = new Intent();
            intent.setType("image/*");
            intent.setAction(Intent.ACTION_GET_CONTENT);
            startActivityForResult(Intent.createChooser(intent, "Complete action using"), 1);
            break;

        default:
            break;
    }

}

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {

    if (requestCode == 1 && resultCode == RESULT_OK) {
        //Bitmap photo = (Bitmap) data.getData().getPath();

        Uri selectedImageUri = data.getData();
        imagepath = getPath(selectedImageUri);
        Bitmap bitmap= BitmapFactory.decodeFile(imagepath);
        imageview.setImageBitmap(bitmap);
        messageText.setText("Uploading file path:" +imagepath);

    }
}

public String getPath(Uri uri) {
    String[] projection = { MediaStore.Images.Media.DATA };
    Cursor cursor = managedQuery(uri, projection, null, null, null);
    int column_index = cursor.getColumnIndexOrThrow(MediaStore.Images.Media.DATA);
    cursor.moveToFirst();
    return cursor.getString(column_index);
}

public int uploadFile(String sourceFileUri) {

    String fileName = sourceFileUri;

    HttpURLConnection conn = null;
    DataOutputStream dos = null;
    String lineEnd = "\r\n";
    String twoHyphens = "--";
    String boundary = "*****";
    int bytesRead, bytesAvailable, bufferSize;
    byte[] buffer;
    int maxBufferSize = 1 * 1024 * 1024;
    File sourceFile = new File(sourceFileUri);

    if (!sourceFile.isFile()) {

        dialog.dismiss();

        Log.e("uploadFile", "Source File not exist :"+imagepath);

        runOnUiThread(new Runnable() {
            public void run() {
                messageText.setText("Source File not exist :"+ imagepath);
            }
        });

        return 0;

    }
    else
    {
        try {

            // open a URL connection to the Servlet
            FileInputStream fileInputStream = new FileInputStream(sourceFile);
            URL url = new URL(upLoadServerUri);

            // Open a HTTP  connection to  the URL
            conn = (HttpURLConnection) url.openConnection();
            conn.setDoInput(true); // Allow Inputs
            conn.setDoOutput(true); // Allow Outputs
            conn.setUseCaches(false); // Don't use a Cached Copy
            conn.setRequestMethod("POST");
            conn.setRequestProperty("Connection", "Keep-Alive");
            conn.setRequestProperty("enctype", "multipart/form-data");
            conn.setRequestProperty("Content-Type", "multipart/form-data;boundary=" + boundary);
            conn.setRequestProperty("uploaded_file", fileName);

            dos = new DataOutputStream(conn.getOutputStream());

            dos.writeBytes(twoHyphens + boundary + lineEnd);
            dos.writeBytes("Content-Disposition: form-data; name=\"uploaded_file\";filename=\""
                    + fileName + "\"" + lineEnd);

            dos.writeBytes(lineEnd);

            // create a buffer of  maximum size
            bytesAvailable = fileInputStream.available();

            bufferSize = Math.min(bytesAvailable, maxBufferSize);
            buffer = new byte[bufferSize];

            // read file and write it into form...
            bytesRead = fileInputStream.read(buffer, 0, bufferSize);

            while (bytesRead > 0) {

                dos.write(buffer, 0, bufferSize);
                bytesAvailable = fileInputStream.available();
                bufferSize = Math.min(bytesAvailable, maxBufferSize);
                bytesRead = fileInputStream.read(buffer, 0, bufferSize);

            }

            // send multipart form data necesssary after file data...
            dos.writeBytes(lineEnd);
            dos.writeBytes(twoHyphens + boundary + twoHyphens + lineEnd);

            // Responses from the server (code and message)
            serverResponseCode = conn.getResponseCode();
            String serverResponseMessage = conn.getResponseMessage();

            Log.i("uploadFile", "HTTP Response is : "
                    + serverResponseMessage + ": " + serverResponseCode);

            if(serverResponseCode == 200){

                runOnUiThread(new Runnable() {
                    public void run() {
                        String msg = "File Upload Completed.\n\n See uploaded file here : \n\n"
                                +" F:/wamp/wamp/www/uploads";
                        messageText.setText(msg);
                        Toast.makeText(AddStatus.this, "File Upload Complete.", Toast.LENGTH_SHORT).show();
                    }
                });
            }

            //close the streams //
            fileInputStream.close();
            dos.flush();
            dos.close();

        } catch (MalformedURLException ex) {

            dialog.dismiss();
            ex.printStackTrace();

            runOnUiThread(new Runnable() {
                public void run() {
                    messageText.setText("MalformedURLException Exception : check script url.");
                    Toast.makeText(AddStatus.this, "MalformedURLException", Toast.LENGTH_SHORT).show();
                }
            });

            Log.e("Upload file to server", "error: " + ex.getMessage(), ex);
        } catch (Exception e) {

            dialog.dismiss();
            e.printStackTrace();

            runOnUiThread(new Runnable() {
                public void run() {
                    messageText.setText("Got Exception : see logcat ");
                    Toast.makeText(AddStatus.this, "Got Exception : see logcat ", Toast.LENGTH_SHORT).show();
                }
            });
        }
        dialog.dismiss();
        return serverResponseCode;

    } // End else block
}

public void onPause() {

    super.onPause();
    if (pDialog != null)
        pDialog.dismiss();
}
class addStatus extends AsyncTask<String, String, String> {

    protected void onPreExecute() {
        super.onPreExecute();
        pDialog = new ProgressDialog(AddStatus.this);
        pDialog.setMessage("Creating User...");
        pDialog.setIndeterminate(false);
        pDialog.setCancelable(true);
        pDialog.show();
    }

    @Override
    protected String doInBackground(String... args) {
        int success;
        String status = args[0];
        String user_id = args[1];
        String time = args[2];

        try {
            // Building Parameters
            List<NameValuePair> params = new ArrayList<NameValuePair>();
            params.add(new BasicNameValuePair("status", status));
            params.add(new BasicNameValuePair("user_id", user_id));
            params.add(new BasicNameValuePair("time", time));

            Log.d("request!", "starting");

            // getting product details by making HTTP request
            JSONObject json = jsonParser.makeHttpRequest(
                    upLoadServerUri, "POST", params);

            // check your log for json response
            Log.d("Login attempt", json.toString());

            // json success tag
            success = json.getInt(TAG_SUCCESS);
            if (success == 1) {
                Log.d("User Created!", json.toString());
                return json.getString(TAG_MESSAGE);
            } else {
                Log.d("Login Failure!", json.getString(TAG_MESSAGE));

            }
        } catch (JSONException e) {
            e.printStackTrace();
        }

        return null;
    }

    protected void onPostExecute(String file_url) {
        // dismiss the dialog once product deleted
        pDialog.dismiss();
        if (file_url != null) {
            Toast.makeText(AddStatus.this, file_url, Toast.LENGTH_LONG).show();
        }
    }

}

}

addStatus.php
<?php

 error_reporting(E_ALL ^ E_DEPRECATED);

 $response = array();

 $target_path = "";

  $file_upload_url = 'http://' . '192.168.1.10' . '/' . 'social' . '/' .             $target_path;

  if (isset($_FILES['uploaded_file']['name'])) {

$target_path = $target_path . basename($_FILES['uploaded_file']['name']);

$response['file_name'] = basename($_FILES['uploaded_file']['name']);

try {
    // Throws exception incase file is not being moved
    if (!move_uploaded_file($_FILES['uploaded_file']['tmp_name'], $target_path)) {
        // make error flag true
        $response['error'] = true;
        $response['message'] = 'Could not move the file!';
    }

    // File successfully uploaded
    $response['message'] = 'File uploaded successfully!';
    $response['error'] = false;
    $response['file_path'] = $file_upload_url . basename($_FILES['uploaded_file']['name']);
    $path = $file_upload_url . basename($_FILES['uploaded_file']['name']);

} catch (Exception $e) {
    // Exception occurred. Make error flag true
    $response['error'] = true;
    $response['message'] = $e->getMessage();
}
} else {

// File parameter is missing
$response['error'] = true;
$response['message'] = 'Not received any file!F';
}

   if (isset($_POST['user_id']) && isset($_POST['status']) && isset($_POST['time'])){

$status = $_POST['status'];
$user_id = $_POST['user_id'];
$time = $_POST['time'];

 require_once __DIR__ . '/db_connect.php';

// connecting to db
$db = new DB_CONNECT();

 $result = mysql_query("INSERT INTO posts(user_id,text,time,image) VALUES('$user_id','$status','$time','$path')");

    if ($result) {
        $response["success"] = 1;
        $response["message"] = "User created";

        echo json_encode($response);
    }
    else {
        $response["success"] = 0;
        $response["message"] = "Registration failed";

        echo json_encode($response);

    }
}
else {
// required field is missing
$response["success"] = 0;
$response["message"] = "Required field(s) is missing";

// echoing JSON response
echo json_encode($response);
}
 ?>

I hope you can help me with this issue. Thanks.


text:
Q: serve static and media files in django when debug=False I want to publish my django project
but when is change my settings.py
"debug = False"
static files are not loaded !
here is my settings.py
MEDIA_URL = '/media_files/'
STATIC_URL = '/static_files/'

MEDIA_ROOT = '/home/domain/public_html/static_cdn/media_root'
STATIC_ROOT = '/home/domain/public_html/static_cdn/static_root'

also I used "python manage.py collectstatic" command and it created folder in public_html

A: i tried many ways but this is worked for me:
for Media files Create a symlink of media folder to public_html in terminal:
$ ln -s ~/project_path/media/ public_html/media
for static files make symlink in terminal or just copy them to public_html folder.


text:
Q: outlet collection to detail view controller I have a button outlet collection that gathers the 10 closest store locations and displays them in order. What I am attempting to do is whenever one of the buttons is pressed, it opens a detail view controller and displays the title in the new window. The code I have that declares the query and outlet collection is the following:
[query findObjectsInBackgroundWithBlock:^(NSArray *objects, NSError *error) {
    if (!error) {
        int i = 0;
        for (PFObject *object in objects) {
            if (i >= [self.EventTitles count]) break;
            [(UIButton *)self.EventButtons[i] setTitle:[object objectForKey:@"objectId"] forState:UIControlStateNormal];
            [(UIButton *)self.EventButtons[i] addTarget:self action:@selector(DetailEvent1:) forControlEvents:UIControlEventTouchUpInside];
            i++;
        }
    }
}];

And the DetailEvent1 action code:
-(IBAction)DetailEvent1:(id)sender {
    TableDetailViewController *objDetail = [[TableDetailViewController alloc] initWithNibName:@"TableDetailViewController" bundle:nil];
    objDetail.??????? = self.????????;
}

I need a bit of help writing how to push the selected object forward to the TableDetailViewController. I really appreciate the help.

A: To set the title of the new view as the one from the button and to push the new view controller this code should work (assuming your current view is already inside a UINavigationController):
-(IBAction)DetailEvent1:(id)sender
{
    TableDetailViewController *objDetail = [[TableDetailViewController alloc]
                                           initWithNibName: @"TableDetailViewController"
                                                    bundle: nil];

    // Copy button's title
    objDetail.title = ((UIButton *)sender).titleLabel.text;

    // Push new view controller
    [self.navigationController pushViewController:objDetail animated:YES];
}

A: If you use the storyboard to create a segue to your new view controller, you can simply call performSegueWithIdentifier within DetailEvent1. Then set the VC title and pass across whatever data the new VC needs in prepareForSegue.


text:
Q: Custom vertical ScrollBar through half part of a listview I am trying to achieve something like this:

While I am aware of how to customize a ScrollBar, which can be achieved through shape drawables and styles and similarly the thumb, I am looking for an idea of how to place the scroll bar in between views on the left and right. any guidance would be highly appreciated.
Even a hint towards the right direction will do :)

A: I'm not sure this going to work but maybe you can set you scroll bar view width to be very big (so it'll start from the list view edge and ended in the text view part).
But- I would recommend you to create a custom view for you scroll bar and implement it using scroll events on you list view, it'll be more flexible and you will be able to do things like dragging, change text size, etc...


text:
Q: Shell, bash : grep the html tag in multiple lines Shell, bash : grep the html tag in multiple lines
How do I grep from tr to /td in input.txt?

   Answer

My code is
 grep -o "
.*	" input.txt > output.txt

But it returns nothing..

A: You'd be better off using a HTML parser, but for simple needs a range-based awk solution may work
awk '/
/,/<\/td\>/' input.txt


text:
Q: Summary measurement lost when adding mods to rma.glmm At this moment I'm trying to calculate the (adjusted)IRLM with the rma.glmm function of the metafor package.
My data is a dataframe that looks like the following:
head(data)

 patient-years events    age
1  180.0000  4    NA
2  116.2500 13 51.83
3   66.2500  6 48.00
4  423.6333 21 58.00
5  142.1783  7 53.20
6 1117.3167 72 59.90

The function to calculate IRLM works fine:
y=rma.glmm(xi=events, ti=patent-years, data=data, measure="IRLN",method="ML")

And gives me the following forest plot:
metafor::forest.rma (y)

Forest plot
However, when I want to adjust my model:
    nh=rma.glmm(xi=events,ti=patient-years, data=datanh,
measure="IRLN", mods = ~ age , method="ML")

(Where age is a numeric vector)
The summary measure is lost
Adjusted forest
I've tried all I can think of, but really don't know how to fix this. Do you have any suggestions?

A: When you add a moderator to the model, there is no longer the effect (or to be precise, the average effect in a random-effects model). The size of the average effect then depends on the value of the moderator. The gray-shaded polygons in the forest plot then reflect the estimated average effects corresponding to the values of 'age' for the included studies.
You could compute the predicted average effect for a particular value of age with the predict() function, i.e.,:
predict(nh, newmods = <age value>, transf=exp)

(transf=exp to obtain the estimated average IR for the specified age value).
Some might plug the average of the age values observed in the studies into  and interpret this as an adjusted estimate. One can debate whether this terminology ('adjusted effect') is correct.


text:
Q: WIX Deployment: Which files to deploy? This might be a very trivial question but deployment is new to me and little confused about which file to deploy.
I have a WPF test project uses Entity framework in visual studio and trying to use WIX to deploy it. Target machine is running windows 7. Given that .Net Framework and sql server localdb is installed on the target machine what files I need to deploy (make component in the WIX xml file)? I have tried copying the whole bin/Release folder to the target machine and it works. However I don't know if that is necessary. The following screenshot shows the bin\Release directory of my application.

The problem is I don't know the job of some files particularly the files with the following extensions:

*

*.exe.config

*.pdb

*.vshost.exe

*.vshost.exe.config

The database file is located in the Users\[username] directory and gets created if it doesn't exist so I suppose it's not part of the deployment.
Additionally I would like to understand two xml files-

*

*EntityFramework.SqlServer.xml

*EntityFramework.xml

Do I need to deploy these two files as well?

A: exe.config

Several settings you can change here - if defined in the Project building the EXE. You probably want to deploy this.
.pdb

Debugfiles. Deploy if you are investigating errors - else don't, these contain source information.
.vshost.exe
.vshost.exe.config

Do not deploy. These are used/generate by Visual Studio. If you start a Project out of Visual Studio it is ran in a hosted process environment so it cannot crash Visual Studio when then application runs into an error. Not for production.
EntityFramework.SqlServer.xml
EntityFramework.xml

This is documentation for the corresponding dlls. Useful for development, I do not think you want to deploy them thou.


text:
Q: How to intercept AJAX-Requests within QtWebKit? I want to intercept, inspect and (if needed) reject AJAX-Requests based on the Fingerprint of the SSL-Certificate. I use the QNetworkAccessManager::createRequest(...) function to issue requests. Everything works fine when I use QWebFrame::load(...). Even the content which is loaded within the request (like .css or .js files) emit signals. Unfortunately no AJAX-Requests emits any Signals. I know that the Signals are connected to the very same slots (for "normal" as well as AJAX-Requests) within MyNetworkAccessManager::createRequest(...) function.
QNetworkReply *reply = QNetworkAccessManager::createRequest(op, req, outgoingData);
connect(reply, SIGNAL(readyRead()), this, SLOT(handleStarted()));
connect(reply, SIGNAL(sslErrors(const QList<QSslError> &)), this, SLOT(handleSslErrors(const QList<QSslError> &)));
connect(reply, SIGNAL(error(QNetworkReply::NetworkError)), this, SLOT(handleNetworkError()));

Why are AJAX Requests so different? Where can I access them?

A: From what I can tell, AJAX requests do emit the finished signal on QNetworkAccessManager. You need connect to the instance of QNetworkAccessManager on your QWebPage instance:
QWebPage *page = ui->webView->page();
QNetworkAccessManager *nam = page->networkAccessManager();

connect(nam, SIGNAL(finished(QNetworkReply*)), this, SLOT(replyFinished(QNetworkReply*)));

QFile file;
file.setFileName(":/js/jquery-2.1.1.min.js"); // jQuery is loaded as a resource
file.open(QIODevice::ReadOnly);
QString jQuery = file.readAll();
file.close();

ui->webView->load(QUrl("about:blank"));
QWebFrame *frame = m_page->mainFrame();

frame->evaluateJavaScript(jQuery); // load jQuery

// check that jQuery is loaded
frame->evaluateJavaScript("$(document).ready(function() { alert('jQuery loaded!'); });");

// do an AJAX GET
frame->evaluateJavaScript("$.ajax({"
                          "url: 'http://www.json-generator.com/api/json/get/cqkXBAEoQy?indent=2',"
                          "method: 'GET',"
                          "dataType: 'json'"
                      "}).done(function (data) {"
                          "for (var i = 0; i < data.length; i++) {"
                              "alert(data[i].name);"
                          "}"
                      "}).error(function (data) { alert('AJAX error'); });");

Then you can monitor replies in the replyFinished slot like so:
void MainWindow::replyFinished(QNetworkReply *reply)
{
    QByteArray bytes = reply->readAll();
    QString str = QString::fromUtf8(bytes.data(), bytes.size());
    QString replyUrl = reply->url().toString();
    int statusCode = reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt();
    qDebug() << statusCode;
    qDebug() << replyUrl;
    qDebug() << str;
}

I have noticed that jQuery AJAX's done promise doesn't seem to execute when you do anything with the QNetworkReply, but you can see that the request actually finishes in the debug console.
See my GitHub repository to try out the above code: https://github.com/pcmantinker/QtWebkitAJAX
As far as blocking connections based on SSL certificates, you'd have to subclass QNetworkAccessManager and override QNetworkAccessManager::createRequest. Something like this could work:
QNetworkReply *CustomQNetworkAccessManager::createRequest(Operation op, const QNetworkRequest& request, QIODevice* outgoingData)
{
    QNetworkRequest req(request);
    QNetworkReply *reply = QNetworkAccessManager::createRequest(op, req, outgoingData);
    QSslConfiguration *sslConfig = reply->sslConfiguration();
    QList<QSslCertificate> sslCaCerts = sslConfig->caCertificates();
    // do something with sslCaCerts

    return reply;
}


text:
Q: .NetCore 2 Angular 5 - Error: StaticInjectorError(AppModule)[BASE_URL]: I get this error when i am trying to navigate to a WebApi Controller. This error is what i get as soon as the page loads because the codes are situated in the constructor function.
core.js:1598 ERROR Error: Uncaught (in promise): Error: StaticInjectorError(AppModule)[BASE_URL]:
  StaticInjectorError(Platform: core)[BASE_URL]:
    NullInjectorError: No provider for BASE_URL!
Error: StaticInjectorError(AppModule)[BASE_URL]:
  StaticInjectorError(Platform: core)[BASE_URL]:
    NullInjectorError: No provider for BASE_URL!
    at NullInjector.push../node_modules/@angular/core/fesm5/core.js.NullInjector.get (core.js:979)
    at resolveToken (core.js:1232)
    at tryResolveToken (core.js:1182)
    at StaticInjector.push../node_modules/@angular/core/fesm5/core.js.StaticInjector.get (core.js:1077)
    at resolveToken (core.js:1232)
    at tryResolveToken (core.js:1182)
    at StaticInjector.push../node_modules/@angular/core/fesm5/core.js.StaticInjector.get (core.js:1077)
    at resolveNgModuleDep (core.js:9217)
    at NgModuleRef_.push../node_modules/@angular/core/fesm5/core.js.NgModuleRef_.get (core.js:9911)
    at resolveDep (core.js:10276)
    at NullInjector.push../node_modules/@angular/core/fesm5/core.js.NullInjector.get (core.js:979)
    at resolveToken (core.js:1232)
    at tryResolveToken (core.js:1182)
    at StaticInjector.push../node_modules/@angular/core/fesm5/core.js.StaticInjector.get (core.js:1077)
    at resolveToken (core.js:1232)
    at tryResolveToken (core.js:1182)
    at StaticInjector.push../node_modules/@angular/core/fesm5/core.js.StaticInjector.get (core.js:1077)
    at resolveNgModuleDep (core.js:9217)
    at NgModuleRef_.push../node_modules/@angular/core/fesm5/core.js.NgModuleRef_.get (core.js:9911)
    at resolveDep (core.js:10276)
    at resolvePromise (zone.js:814)
    at resolvePromise (zone.js:771)
    at zone.js:873
    at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask (zone.js:421)
    at Object.onInvokeTask (core.js:4053)
    at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask (zone.js:420)
    at Zone.push../node_modules/zone.js/dist/zone.js.Zone.runTask (zone.js:188)
    at drainMicroTaskQueue (zone.js:595)

login.component.ts
import { Component, Inject } from '@angular/core';

import { NgForm } from '@angular/forms';
import { Router, ActivatedRoute } from '@angular/router';
import { HttpClient } from '@angular/common/http';

import { Candidates } from '/Solutions/Angular/ExamBuddy/Interfaces/Candidate';

@Component({
  selector: 'app-login',
  templateUrl: './login.component.html',
  styleUrls: ['./login.component.css']
})

export class LoginComponent  {
  candDetails: Candidates;

  constructor(private http: HttpClient, @Inject('BASE_URL') baseUrl: string) {
    var url = baseUrl + '/api/Candidate/ExamDetails/12345';
    this.http.get<Candidates>(url).subscribe(result => { this.candDetails = result; }, error => console.error(error));
  }

This is also my app.module.ts code.
app.module.ts
    import { BrowserModule } from '@angular/platform-browser';

    import { NgModule } from '@angular/core';
    import { HttpClientModule } from '@angular/common/http';
    import { FormsModule } from '@angular/forms';
    import { AppComponent } from './app.component';
    import { ExamComponent } from './exam/exam.component';
    import { LoginComponent } from './login/login.component';
    // import { RouterModule } from '@angular/router';
    import { InstructionComponent } from './instruction/instruction.component';
    import { routes } from './app.route';

    @NgModule({
      declarations: [
        AppComponent,
        ExamComponent,
        LoginComponent,
        InstructionComponent,

      ],
      imports: [
        BrowserModule,
        HttpClientModule,
        FormsModule,
        routes
      ],
      providers: [],
      bootstrap: [AppComponent]
    })
    export class AppModule { }

i also have the WebApi controller which connects to the database and fetches the result in JSON format.

A: You are injecting a string value with the key BASE_URL in your LoginComponent, with the inject decorator:  @Inject('BASE_URL') baseUrl: string. For this to work you need to provide a value for BASE_URL in your AppModule. But you didn't provide a vaule, this is what the error is telling you: NullInjectorError: No provider for BASE_URL!
In Angular 5 it is recommended to create InjectionToken e.g.
import { InjectionToken } from '@angular/core';
export const BASE_URL = new InjectionToken<string>('BASE_URL');

providing the value in your AppModule is done by defining a provider in your AppModule:
providers: [  { provide: BASE_URL , useValue: "http://example.com/api" }

you can then use this InjectionToken in your LoginComponent like this:
constructor(private http: HttpClient, @Inject(BASE_URL) baseUrl: string) {

Further informations regarding injection of values can be found in the offical documentation: https://angular.io/guide/dependency-injection#dependency-injection-tokens

A: First: In main.ts, I have the following code, which refers to  index.html
export function getBaseUrl() {
  return document.getElementsByTagName('base')[0].href;
}

const providers = [
  { provide: 'BASE_URL', useFactory: getBaseUrl, deps: [] }
];

platformBrowserDynamic(providers).bootstrapModule(AppModule)
  .catch(err => console.log(err));

Second: In our component (fetch-data.component.ts), we use the BASE_URL in the following way:
export class FetchDataComponent {
    public forecasts: WeatherForecast[];

    constructor(http: HttpClient, @Inject('BASE_URL') baseUrl: string) {
        http.get<WeatherForecast[]>(baseUrl + 'api/SampleData/WeatherForecasts').subscribe(result => {
           this.forecasts = result;
        }, error => console.error(error));
    }
}

that's it.

A: In my case I tried to enable Hot Module Replacement.  The official instructions for HMR have this example for main.ts:
Update src/main.ts to use the file we just created:

import { enableProdMode } from '@angular/core';
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';

import { AppModule } from './app/app.module';
import { environment } from './environments/environment';

import { hmrBootstrap } from './hmr';

if (environment.production) {
  enableProdMode();
}

const bootstrap = () => platformBrowserDynamic().bootstrapModule(AppModule);

if (environment.hmr) {
  if (module[ 'hot' ]) {
    hmrBootstrap(module, bootstrap);
  } else {
    console.error('HMR is not enabled for webpack-dev-server!');
    console.log('Are you using the --hmr flag for ng serve?');
  }
} else {
  bootstrap().catch(err => console.log(err));
}

(https://github.com/angular/angular-cli/wiki/stories-configure-hmr)
However, the Visual Studio 2017 ASP.Net Core Angular CLI template includes these lines:
const providers = [
  { provide: 'BASE_URL', useFactory: getBaseUrl, deps: [] }
];

platformBrowserDynamic(providers).bootstrapModule(AppModule)
  .catch(err => console.log(err));

Notice that the providers array is not being passed into the HMR main.ts example. The simple fix is to simply pass it in to platformBrowserDynamic. The corrected line then looks like this:
const providers = [
  { provide: 'BASE_URL', useFactory: getBaseUrl, deps: [] }
];

const bootstrap = () => platformBrowserDynamic(providers).bootstrapModule(AppModule);


text:
Q: "Good" classifier destroyed my Precision-Recall curve. What happened? I'm working with imbalanced data, where there are about 40 class=0 cases for every class=1. I can reasonably discriminate between the classes using individual features, and training a naive Bayes and SVM classifier on 6 features and balanced data yielded better discrimination (ROC curves below).

That's fine, and I thought I was doing well. However, the convention for this particular problem is to predict hits at a precision level, usually between 50% and 90%. e.g. "We detected some-number of hits at 90% precision." When I tried this, the maximum precision I could get from the classifiers was about 25% (black line, PR curve below).
I could understand this as a class imbalance problem, since PR curves are sensitive to imbalance and ROC curves aren't. However, the imbalance doesn't seem to affect the individual features: I can get pretty high precision using the individual features (blue and cyan).

I don't understand what's going on. I could understand it if everything performed badly in PR space, since, after all, the data is very imbalanced. I could also understand it if the classifiers looked bad in ROC and PR space - maybe they're just bad classifiers. But what is going on to make the classifiers better as judged by ROC, but worse as judged by Precision-Recall?
Edit: I noticed that in the low TPR/Recall areas (TPR between 0 and 0.35), the individual features consistently outperform the classifiers in both ROC and PR curves. Maybe my confusion is because the ROC curve "emphasizes" the high TPR areas (where the classifiers do well) and the PR curve emphasizes the low TPR (where the classifiers are worse).
Edit 2: Training on nonbalanced data, i.e. with the same imbalance as the raw data, brought the PR curve back to life (see below). I'd guess my problem was improperly training the classifiers, but I don't totally understand what happened.

A: I've found that there isn't an incredible benefit in using downsampling/upsampling when classes are moderately imbalanced (i.e., no worse than 100:1) in conjunction with a threshold invariant metric (like AUC). Sampling makes the biggest impact for metrics like F1-score and Accuracy, because the sampling artificially moves the threshold to be closer to what might be considered as the "optimal" location on an ROC curve. You can see an example of this in the caret documentation.
I would disagree with @Chris in that having a good AUC is better than precision, as it totally relates to the context of the problem. Additionally, having a good AUC doesn't necessarily translate to a good Precision-Recall curve when the classes are imbalanced. If a model shows good AUC, but still has poor early retrieval, the Precision-Recall curve will leave a lot to be desired. You can see a great example of this happening in this answer to a similar question. For this reason, Saito et al. recommend using area under the Precision-Recall curve rather than AUC when you have imbalanced classes.

A: The best way to evaluate a model is to look at how it will be used in the real world and develop a cost function.
As an aside, for example, there is too much emphasis on r squared but many believe it is a useless statistic. So do not get hung up on any one statistic.
I suspect that your answer is an example of the accuracy paradox.
https://en.m.wikipedia.org/wiki/Accuracy_paradox
Recall (also known as sensitivity aka true positive rate) is the fraction of relevant instances that are retrieved.
tpr = tp / ( tp + fn )
Precision (aka positive predictive value) is the fraction of retrieved instances that are relevant.
ppv = tp / (tp + fp)
Let's say you have a very imbalanced set of 99 positives and one negative.
Let's say a model is trained in which the model says everything is positive.
tp = 99
fp = 1
ppv becomes 0.99
Clearly a junk model despite the "good" positive predictive value.
I recommend building a training set that is more balanced either through oversampling or undersampling. After the model is built then use a validation set that the keeps the original imbalance and build a performance chart on that.

A:
I could understand this as a class imbalance problem, since PR curves
  are sensitive to imbalance and ROC curves aren't. However, the
  imbalance doesn't seem to affect the individual features: I can get
  pretty high precision using the individual features (blue and cyan).

May I just point out that this is actually the other way around: ROC is sensitive to class imbalance while PR is more robust when dealing with skewed class distributions. See https://www.biostat.wisc.edu/~page/rocpr.pdf.
They also show that "algorithms that optimize the area under the ROC curve are not
guaranteed to optimize the area under the PR curve."


text:
Q: Does the Flash Incubator support joystick / gamepad input? I realize that natively Flash not been able to support joystick / gamepad input in the past and that it can be done using third party software that must be ran separately.  However, with the new Molehill/Stage3D API which supports 3D model integration you would think that joystick / gamepad input would be available.  Does anyone know if this is going to be possible in Flash Player 11 using the Molehill / Stage3D API?

A: As Thibault Imbert said:
For HID/Joystick, we are still designing some parts of it. We want to make sure it will work on all platforms and generic enough. It will not make FP11, same for ActionScript Workers, which we are still working on.
Thibault
Friday, July 15, 2011 at 3:18 am #
I guess this answers your question. I'm waiting for HID support as well...


text:
Q: How do I achieve a wrap/flow layout from left to right in Sencha Touch None of the layouts I've seen in Sencha Touch seem to handle the flow type layout. For example I'd like to dipsplay within a dataview, images 2 columns wide and flow left to right like so:
[ 1 ] [ 2 ]
[ 3 ] [ 4 ]
[ 5 ] [ 6 ]

How would I achieve the above using Sencha's layout system?

A: You can work with "vbox" and "hbox" combo: http://docs.sencha.com/touch/2.2.0/#!/guide/layouts
Here a code sample:
Ext.define('MyApp.view.central.Menu',{
extend: 'Ext.Container',
requires: ['Ext.Container'],

xtype: 'centralMenu',

config: {
    layout: {
        type: 'vbox',
        pack: 'center'
    },

    defaults: {flex:1},

    items: [
        {
            layout: {
                type: 'hbox',
                pack: 'center'
            },
            items: [
                {
                    xtype:'button',
                    width: '50%',
                    cls:'menu-button menu-button-1',
                    pressedCls: 'menu-button-1-pressing',
                    id: 'menu-button-1'
                },
                {
                    xtype: 'button',
                    width: '50%',
                    cls:'menu-button menu-button-2',
                    pressedCls: 'menu-button-2-pressing',
                    id: 'menu-button-2'
                }
            ]
        },
        {
            layout: {
                type: 'hbox',
                pack: 'center'
            },
            items: [
                {
                    xtype: 'button',
                    width: '50%',
                    cls:'menu-button menu-button-3',
                    pressedCls: 'menu-button-3-pressing',
                    id: 'menu-button-3'
                },
                {
                    xtype: 'button',
                    width: '50%',
                    cls:'menu-button menu-button-4',
                    pressedCls: 'menu-button-4-pressing',
                    id: 'menu-button-4'
                }
            ]
        },
        {
            layout: {
                type: 'hbox',
                pack: 'center'
            },
            items: [
                {
                    xtype:'button',
                    width: '50%',
                    cls:'menu-button menu-button-5',
                    pressedCls: 'menu-button-5-pressing',
                    id: 'menu-button-5'
                },
                {
                    xtype: 'button',
                    width: '50%',
                    cls:'menu-button menu-button-6',
                    pressedCls: 'menu-button-6-pressing',
                    id: 'menu-button-6'
                }
            ]
        },
    ]
}

});

A: You can get some ideas from touchstyle example which comes with sencha touch library or have a look at this http://www.touchstyle.mobi/app/
The list is rendered as 2 row layout using tpl, you can use similar approach.

A: I would do something like this for your dataViewItem template:
itemTpl: Ext.create('Ext.XTemplate',
     '

',
     {
          getWidth: function() {
               var width = window.innerWidth / 2;
               return width;
          }
      }
),


text:
Q: Python - use different .json files and be able to do it with less code of data[attachment] What is the most effective/less code to use data[attach.] .json from this code:
with open('slack.json') as slackAttachment:
       data = json.load(slackAttachment)

with open('slack2.json') as slackAttachment:
       data2 = json.load(slackAttachment)

with open('slack3.json') as slackAttachment:
       data3 = json.load(slackAttachment)

with open('slack4.json') as slackAttachment:
       data4 = json.load(slackAttachment)

data["attachments"][0]["title"] = country

itemname = item.get('Title', {})
if itemname:
    newitemword = item['seoTitle']
    data["attachments"][0]["text"] = "" + newitemword + ""

else:

    data["attachments"][0]["fields"].append({
    "value": '*Item name not found*',
    "short": True,
})

Also there is not just these two data["attachments"][0] but around xx of them.
Basically what I DON'T want to do is:
 data["attachments"][0]["text"] = "" + newitemword + ""
 data2["attachments"][0]["text"] = "" + newitemword + ""
 data3["attachments"][0]["text"] = "" + newitemword + ""
 data4["attachments"][0]["text"] = "" + newitemword + ""

and I wonder if there is maybe other effective way to solve it with less code than the code above and still be able to use all these slacks.json for their own?
EDIT:
webhook0 = 'HELLO'
webhook1 = 'WORLD
webhook2 = 'STACK'

       data = {}

                    file_numbers = range(0, 3)  # I assume the numbers are from 1 to 4, but you can change this.
                    for file_number in file_numbers:  # go overf file numbers
                        file_name = 'slack' + str(file_number) + '.json'  # create file name from number
                        with open(file_name) as slackAttachment:
                            data[file_number] = (json.load(slackAttachment))  # append file json to data list
                        webhook_number = 'webhook' + str(file_number)

                    print(webhook_number)

                    # data is now complete
                    # you can use data[file_number] to access the corresponding json

                    for file_number in file_numbers:

A: You can store all your data into a single dict.
data = {}

file_numbers = range(1, 5) # I assume the numbers are from 1 to 4, but you can change this.
for file_number in file_numbers: # go overf file numbers
    file_name = 'slack' + str(file_number) + '.json' # create file name from number

    with open(file_name) as slackAttachment:
        data[file_number] = (json.load(slackAttachment)) # append file json to data list

# data is now complete
# you can use data[file_number] to access the corresponding json

for file_number in file_numbers:

    data[file_number]["attachments"][0]["title"] = country

    itemname = item.get('Title', {})
    if itemname:
        newitemword = item['seoTitle']
        data[file_number]["attachments"][0]["text"] = "" + newitemword + ""

    else:

        data[file_number]["attachments"][0]["fields"].append({
            "value": '*Item name not found*',
            "short": True,
        })

every time you want to access the data of a file, you use data[<file_number>].
So to access the first slack.json you use data[0]


text:
Q: SQL Query to fetch data as of the year,quarter or month passed in parameter I have the following query-
  (SELECT DISTINCT accrual_period
     FROM   anc_per_accrual_entries a,
            anc_per_plan_enrollment b
     WHERE  a.per_plan_enrt_id = b.per_plan_enrt_id
            --AND a.accrual_period = b.last_accrual_run
            AND b.work_term_asg_id = paam.work_terms_assignment_id
            AND accrual_period = (SELECT Max(acrl2.accrual_period)
                                  FROM   anc_per_accrual_entries acrl2
                                  WHERE  person_id = paam.person_id
                                         AND acrl2.plan_id = appe.plan_id
                                         AND acrl2.accrual_period <= sysdate)
            AND b.plan_id = appe.plan_id
            AND b.person_id = paam.person_id
            AND sysdate BETWEEN b.enrt_st_dt AND b.enrt_end_dt)

I have the following query to fetch accrual_period as of the sysdate or today. Now there are three parameters -
P_YEAR  - 2022
P_QUARTER - 2022 Q 4
P_MONTH - 2022 / 12

*

*If the year is passed - I want the query to fetch the data as of current month and date of that year. i.e. the sysdate in the query should be replaced by 2021/05/06 if i pass year as 2021.

*If i pass Year and quarter of that year then the sysdate in the query should be replaced
by that quarter. i.e. if the quarter is 2021 Q 1, then it should be calculated as of the last date of that quarter i.e. 31 march 2021.

*If I pass month, then the last day of month
How can i achieve it in the same query ?

A: To me, it looks like the following where clause (which is to be applied to query you already posted):
where accrual_period >=
  case when :p_year is not null then
               to_date(:p_year || to_char(sysdate, 'mmdd'), 'yyyymmdd')
       when :p_quarter is not null then
               last_day(to_date(substr(:p_quarter, 1, 4) || case substr(:p_quarter, -1)
                                                                   when '1' then '03'
                                                                   when '2' then '06'
                                                                   when '3' then '09'
                                                                   when '4' then '12
                                                            end, 'yyyymm'))
       when :p_month is not null then last_day(:p_month, 'yyyy / mm')
  end;

As of your comment regarding an "invalid argument" error and doubt about the last_day function: everything is just fine when I run it (I don't have your tables nor data, but such a dummy query works OK):
SQL> with test(col) as
  2    (select '2022 Q 4' from dual)
  3  select last_day(to_date(substr(col, 1, 4) || case substr(col, -1) when '1' then '03'
  4                                                           when '2' then '06'
  5                                                           when '3' then '09'
  6                                                           when '4' then '12' end, 'yyyymm')) result
  7  from test;

RESULT
----------
31.12.2022

SQL>


text:
Q: Should I store salt on SQL Server as varchar or varbinary and in hex? I'm working on implementing a hash. I intend to store the salt in a database, specifically SQL Server. The salt will be at least 32 bytes. Should the salt be in hex form or should I convert it to a string, integer, or something else?  Also, what data type should I use to store the salt: varchar, varbinary, or something else?
For security, it really doesn't matter because the salt is not a secret. But in terms of performance and maybe readability, it might.
Thank you very much.

A: Any cryptographic alogorithm worth its salt, (please excuse the pun) will be working on binary data. Assuming that the salts you use will be the same length you should use a BINARY column, if the salts are of variable length use VARBINARY.
The salt should be a random, or pseudo-random sequence of bytes. It should be different for each value you are hashing but can be stored in the clear.

Code something like this will give the values you need.
-- obviously, don't store a password in code,
-- this is here to enable subsequent calls.
DECLARE @password NVARCHAR(MAX) = N'Whatever';

---

DECLARE @salt BINARY(64) = CRYPT_GEN_RANDOM(64);

-- There is a limit of 4000 bytes for HASHBYTES so in case the password
-- very long, truncate to 3936 bytes. If you can I'd convert the password
-- to binary before passing to SQL server.
DECLARE @passwordBytes VARBINARY(3936);
SELECT
            @passwordBytes = @passwordBytes +
                CONVERT(BINARY(2), UNICODE(SUBSTRING([A].[B], [V].[number] + 1, 1)))
    FROM
            (SELECT CAST(@password NVARCHAR(1968)) [B]) [A]
        JOIN
            [master].[dbo].[spt_values] [V]
                ON [V].[number] < LEN([A].[B])
    WHERE
            [V].[type] = 'P';

DECLARE @hash BINARY(64) = HASHBYTES('SHA2_512', @passwordBytes + @salt);


text:
Q: Position fixed and width 25% not taking correct width I have two divs. outer div taking 25%. And the inner div is placed at the bottom (position: fixed; bottom: 0; width: 25%; border-top: 1px solid red) But this is not taking 25%.
I am adding border for this div. So there is an white space is showing because of the width.
HTML:

CSS:
#main-div{
    height: 100%;
    width: 100%;
    display: table;
}
#outer-div {
    width: 100%;
}
#div-1, #div-2 {
    width: 100%;
}
#inner-div {
    position: fixed;
    bottom: 0; width: 25%;
    border-top: 1px solid red;
}

How to apply exactly apply 25% width to inner-div which has position fixed ?
UPDATE Added js fiddle in comment

A: You can use below css for this
#inner-div {
    box-sizing: border-box;
}

You can check updated fiddle

A: Remove your body margin . This issue because of you don't remove your body margin you can simply fix this
body {
 margin:0;
}

body {
 margin:0;
}
#main-div{
    height: 100%;
    width: 100%;
    display: table;
    }
#outer-div {
    width: 100%;
    }
#div-1, #div-2 {
    width: 100%;
    }
#inner-div {
    position: fixed;
    bottom: 0; width: 25%;
    border-top: 1px solid red;
}

A: The real reason why inner-div has more width than outer-div is because inner-div has position: fixed applied to it.
Now when you apply position: fixed, it makes the element position relative to the viewport.
So, in this case inner-div is relative to the body which has some user-agent margin styles applied. To make them have same width apply margin: 0 to the body.
Also, apply box-sizing: border-box to outer-div to exclude the border in the width.
I have updated the fiddle for you. So both divs have the same width.
https://jsfiddle.net/nashcheez/uur2h5w3/4/

A: Fixed position is relative to the browser window hence percentage values will be relative to the  element (http://www.w3schools.com/cssref/pr_class_position.asp). Although experimental position:sticky might accomplish what you need since it is relative to the viewport (parent relative element).

A: You need to reset body for browser. For this reason "inner-div" is taking space.
body{margin:0;padding:0;}

body{margin:0;padding:0;}
#main-div{
    height: 100%;
    width: 100%;
    display: table;
     background: blue none repeat scroll 0 0;
     border: 1px solid blue;
}
#outer-div {
    width: 25%;
   border: 1px solid green;
}
#div-1 {
  width: 100%;
}
#div-2 {
   display: table;
    height: 0;
    padding-right: 2px;
    width: 100%;
}
#inner-div {
  text-align: center;
    position: fixed;
    bottom: 0;
    width: 25%;
    border-top: 1px solid red;
    padding-bottom: 27px;
    padding-top: 10px;
}

 //list

 //parent-scrol

 //scroll

 //inner-list

wefffef
 //create-new


text:
Q: OpenGraph throwing error on valid og meta tags I am receiving this error in our logs which would seem to indicate that we have set an og type to 'website'.
Object error: Object code: 3502 message: "(#3502) Object at URL (see link below) has og:type of 'website'. The property 'movie' requires an object of og:type 'video.movie'. "type: "OAuthException"

Here are the meta tags on one of our products.  As you can see, the og type is still listed as video.
<meta content="217556128271512" property="fb:app_id">
<meta content="17 Again" property="og:title">
<meta content="video.movie" property="og:type">

According to the debugger for this product, the og type correctly displays video.movie:
Any idea what is going on here? Seems this just started up today as I was able to post messages yesterday.

A: You can try to check you webserver logs for errors happened at the same time. Inproper html can be returned to Facebook on OpenGraph request which can be considered a 'website'.

A: From the fb documentaion :
<head prefix="og: http://ogp.me/ns# fb: http://ogp.me/ns/fb# video: http://ogp.me/ns/video#">
<meta property="fb:app_id"      content="302184056577324" />
<meta property="og:type"        content="video.movie" />
<meta property="og:url"         content="Put your own URL to the object here" />
<meta property="og:title"       content="Sample Movie" />
<meta property="og:image"       content="https://s-static.ak.fbcdn.net/images/devsite/attachment_blank.png" />
<meta property="video:actor:id" content="Sample Actor: ID" />


text:
Q: What kind of DC motor is this and what does the circuit do?
I've had this motor at least for 5 years (salvaged from something) and I remember it working then. However it doesn't work now (5 VDC mobile charger) and so I opened it up expecting to see just the split rings. But I was surprised to find this circuit built in it. Why does it need that circuit and what does it do?
The motor body says - (If the picture is not clear)
6JS E 06 R
2400N 6V
Link to a better quality picture
http://postimg.org/image/l4unckkin/

A: That looks like a DC motor of the type used in tape cassette players.

Why does it need that circuit and what does it do?

For music reproduction with accurate pitch constant motor speed is required. Achieving this in battery powered equipment requires addition of a voltage regulator or speed controller as DC motors' speed varies (nearly linearly) with voltage. The potentiometer in the motor allows the speed to be factory set.
I modified one such motor on a good tape deck, adding an external pot and switch to allow some pitch adjustment so that I didn't have to keep retuning my guitar between tracks / albums.

The TDA1151 seems to be one simple device intended for such applications.


text:
Q: Getting File list from Adobe Media Server 5 I have started working on a VOD app for Android. I am using the Adobe Media Server 5 for my streaming solution.
I have been able to figure out how to configure the server to put files in the correct location and things like that.
Right now my problem is that I want to display a list of all available media files on the AMS in my android application so that the user can go ahead and select the appropriate file for playing back.
Do i need to create a .m3u8 kind of manifest for all the files that are available and then access that to get a complete listing of all the files or is there some other way to achieve what i am looking for?


text:
Q: I want to disable it as soon as a value from dropdown has been selected I have a drop down menu with a few options and I want to enable the selected portion and disable the other portions once I select a value from dropdown using PHP.

A: Are you looking for something like this?

var ddl = $('#test');

ddl.on('change', function()
  {
    if (ddl.find('selected').val() != '')
      {
        ddl.prop('disabled', true);
      }
  });
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<select id='test'>
    <option value=''>select</option>
    <option value=''>a</option>
    <option value=''>b</option>
    <option value=''>c</option>
</select>

A: It is not possible to achieve what you  want from PHP. PHP is a server side language. What you want is client side interaction.The code snippet by @Vimalan is appropriate.


text:
Q: Single Post like button animation is working but multiple post mean first post button only working I have code in like button code with css here single news-feed mean button is working but multiple news-feed mean first post button only working if i click other post button also first post button only working. I using post UI and according to the total post count looping the UI, for this animation fully working html with css not using Javascript, Please give me a feedback or advice me how i can fix this issues.
CSS Code :
svg {
    cursor: pointer;
    overflow: visible;
    width: 60px;
    margin: 0;
    margin-bottom: -45px;
}

svg #heart {
    transform-origin: center;
    animation: animateHeartOut .3s linear forwards;
}

svg #main-circ {
    transform-origin: 29.5px 29.5px;
}

#checkbox-ins {
    display: none;
}

#checkbox-ins:checked+label svg #heart {
    transform: scale(0.2);
    fill: #ddd810;
    animation: animateHeart .3s linear forwards .25s;
}

#checkbox-ins:checked+label svg #main-circ {
    transition: all 2s;
    animation: animateCircle .3s linear forwards;
    opacity: 1;
}

#checkbox-ins:checked+label svg #grp1 {
    opacity: 1;
    transition: .1s all .3s;
}

#checkbox-ins:checked+label svg #grp1 #oval1 {
    transform: scale(0) translate(0, -30px);
    transform-origin: 0 0 0;
    transition: .5s transform .3s;
}

#checkbox-ins:checked+label svg #grp1 #oval2 {
    transform: scale(0) translate(10px, -50px);
    transform-origin: 0 0 0;
    transition: 1.5s transform .3s;
}

#checkbox-ins:checked+label svg #grp2 {
    opacity: 1;
    transition: .1s all .3s;
}

#checkbox-ins:checked+label svg #grp2 #oval1 {
    transform: scale(0) translate(30px, -15px);
    transform-origin: 0 0 0;
    transition: .5s transform .3s;
}

#checkbox-ins:checked+label svg #grp2 #oval2 {
    transform: scale(0) translate(60px, -15px);
    transform-origin: 0 0 0;
    transition: 1.5s transform .3s;
}

#checkbox-ins:checked+label svg #grp3 {
    opacity: 1;
    transition: .1s all .3s;
}

#checkbox-ins:checked+label svg #grp3 #oval1 {
    transform: scale(0) translate(30px, 0px);
    transform-origin: 0 0 0;
    transition: .5s transform .3s;
}

#checkbox-ins:checked+label svg #grp3 #oval2 {
    transform: scale(0) translate(60px, 10px);
    transform-origin: 0 0 0;
    transition: 1.5s transform .3s;
}

#checkbox-ins:checked+label svg #grp4 {
    opacity: 1;
    transition: .1s all .3s;
}

#checkbox-ins:checked+label svg #grp4 #oval1 {
    transform: scale(0) translate(30px, 15px);
    transform-origin: 0 0 0;
    transition: .5s transform .3s;
}

#checkbox-ins:checked+label svg #grp4 #oval2 {
    transform: scale(0) translate(40px, 50px);
    transform-origin: 0 0 0;
    transition: 1.5s transform .3s;
}

#checkbox-ins:checked+label svg #grp5 {
    opacity: 1;
    transition: .1s all .3s;
}

#checkbox-ins:checked+label svg #grp5 #oval1 {
    transform: scale(0) translate(-10px, 20px);
    transform-origin: 0 0 0;
    transition: .5s transform .3s;
}

#checkbox-ins:checked+label svg #grp5 #oval2 {
    transform: scale(0) translate(-60px, 30px);
    transform-origin: 0 0 0;
    transition: 1.5s transform .3s;
}

#checkbox-ins:checked+label svg #grp6 {
    opacity: 1;
    transition: .1s all .3s;
}

#checkbox-ins:checked+label svg #grp6 #oval1 {
    transform: scale(0) translate(-30px, 0px);
    transform-origin: 0 0 0;
    transition: .5s transform .3s;
}

#checkbox-ins:checked+label svg #grp6 #oval2 {
    transform: scale(0) translate(-60px, -5px);
    transform-origin: 0 0 0;
    transition: 1.5s transform .3s;
}

#checkbox-ins:checked+label svg #grp7 {
    opacity: 1;
    transition: .1s all .3s;
}

#checkbox-ins:checked+label svg #grp7 #oval1 {
    transform: scale(0) translate(-30px, -15px);
    transform-origin: 0 0 0;
    transition: .5s transform .3s;
}

#checkbox-ins:checked+label svg #grp7 #oval2 {
    transform: scale(0) translate(-55px, -30px);
    transform-origin: 0 0 0;
    transition: 1.5s transform .3s;
}

#checkbox-ins:checked+label svg #grp2 {
    opacity: 1;
    transition: .1s opacity .3s;
}

#checkbox-ins:checked+label svg #grp3 {
    opacity: 1;
    transition: .1s opacity .3s;
}

#checkbox-ins:checked+label svg #grp4 {
    opacity: 1;
    transition: .1s opacity .3s;
}

#checkbox-ins:checked+label svg #grp5 {
    opacity: 1;
    transition: .1s opacity .3s;
}

#checkbox-ins:checked+label svg #grp6 {
    opacity: 1;
    transition: .1s opacity .3s;
}

#checkbox-ins:checked+label svg #grp7 {
    opacity: 1;
    transition: .1s opacity .3s;
}

@keyframes animateCircle {
    40% {
        transform: scale(10);
        opacity: 1;
        fill: #ddd810;
    }
    55% {
        transform: scale(11);
        opacity: 1;
        fill: #ddd810;
    }
    65% {
        transform: scale(12);
        opacity: 1;
        fill: #ddd810;
    }
    75% {
        transform: scale(13);
        opacity: 1;
        fill: transparent;
        stroke: #ddd810;
        stroke-width: .5;
    }
    85% {
        transform: scale(17);
        opacity: 1;
        fill: transparent;
        stroke: #ddd810;
        stroke-width: .2;
    }
    95% {
        transform: scale(18);
        opacity: 1;
        fill: transparent;
        stroke: #ddd810;
        stroke-width: .1;
    }
    100% {
        transform: scale(19);
        opacity: 1;
        fill: transparent;
        stroke: #ddd810;
        stroke-width: 0;
    }
}

@keyframes animateHeart {
    0% {
        transform: scale(0.2);
    }
    40% {
        transform: scale(1.2);
    }
    100% {
        transform: scale(1);
    }
}

@keyframes animateHeartOut {
    0% {
        transform: scale(1.4);
    }
    100% {
        transform: scale(1);
    }
}

HTML Code :
<?php
 while($row->mysqli_fetch_assoc($newsfeed))
{
?>
<input type="checkbox" id="checkbox-ins"/>
                                                                        <label for="checkbox-ins">
                                                                          <svg id="heart-svg" viewBox="467 392 58 57" xmlns="http://www.w3.org/2000/svg">
                                                                            <g id="Group" fill="none" fill-rule="evenodd" transform="translate(467 392)">
                                                                              <path d="M25.82,40.35a1.67,1.67,0,0,0,.31.94l.94,1.36a1.8,1.8,0,0,0,1.36.73h3.24A1.76,1.76,0,0,0,33,42.65L34,41.29a1.69,1.69,0,0,0,
                                                                                .32-.94v-2H25.92A13.27,13.27,0,0,0,25.82,40.35Zm-5-14.53a9.11,9.11,0,0,0,2.3,6.06,14.75,14.75,0,0,1,2.72,
                                                                                4.81h8.36a16,16,0,0,1,2.72-4.81,8.92,8.92,0,0,0,2.3-6.06,9.2,9.2,0,0,0-18.4,0ZM30,21.64a4.19,4.19,0,0,0-4.18,4.18.9.9,0,0,
                                                                                1-.84.84.89.89,0,0,1-.83-.84A5.84,5.84,0,0,1,30,20a.89.89,0,0,1,.84.83A.9.9,0,0,1,30,21.64Z" id="heart" fill="#AAB8C2"/>
                                                                              <circle id="main-circ" fill="#ddd810" opacity="0" cx="29.5" cy="29.5" r="1.5"/>

                                                                              <g id="grp7" opacity="0" transform="translate(7 6)">
                                                                                <circle id="oval1" fill="#ddd810" cx="2" cy="6" r="2"/>
                                                                                <circle id="oval2" fill="#ddd810" cx="5" cy="2" r="2"/>
                                                                              </g>

                                                                              <g id="grp6" opacity="0" transform="translate(0 28)">
                                                                                <circle id="oval1" fill="#ddd810" cx="2" cy="7" r="2"/>
                                                                                <circle id="oval2" fill="#ddd810" cx="3" cy="2" r="2"/>
                                                                              </g>

                                                                              <g id="grp3" opacity="0" transform="translate(52 28)">
                                                                                <circle id="oval2" fill="#ddd810" cx="2" cy="7" r="2"/>
                                                                                <circle id="oval1" fill="#ddd810" cx="4" cy="2" r="2"/>
                                                                              </g>

                                                                              <g id="grp2" opacity="0" transform="translate(44 6)">
                                                                                <circle id="oval2" fill="#ddd810" cx="5" cy="6" r="2"/>
                                                                                <circle id="oval1" fill="#ddd810" cx="2" cy="2" r="2"/>
                                                                              </g>

                                                                              <g id="grp5" opacity="0" transform="translate(14 50)">
                                                                                <circle id="oval1" fill="#ddd810" cx="6" cy="5" r="2"/>
                                                                                <circle id="oval2" fill="#ddd810" cx="2" cy="2" r="2"/>
                                                                              </g>

                                                                              <g id="grp4" opacity="0" transform="translate(35 50)">
                                                                                <circle id="oval1" fill="#ddd810" cx="6" cy="5" r="2"/>
                                                                                <circle id="oval2" fill="#ddd810" cx="2" cy="2" r="2"/>
                                                                              </g>

                                                                              <g id="grp1" opacity="0" transform="translate(24)">
                                                                                <circle id="oval1" fill="#ddd810" cx="2.5" cy="3" r="2"/>
                                                                                <circle id="oval2" fill="#ddd810" cx="7.5" cy="2" r="2"/>
                                                                              </g>
                                                                            </g>
                                                                          </svg>
                                                                        </label>
<?php
}
?>

A: Change
1) id="checkbox-ins" to class="checkbox-ins"
2) In css styles change all #checkbox-ins to .checkbox-ins


text:
Q: Sublime Text 3, Build system - How to stop when there is an error I wrote a custom build system for cc65 compiler. When there is no error it works correctly but the batch script doesn't stop when there is an error.
Even though compiler stopped working and sublime text catches error messages batch script continues to line %VICE_PATH%\x64 index which is running previous version of the output file. How can I make it stop on error?
My build script:
{
    "cmd": "build.bat",
    "file_regex": "^ *([A-z0-9.]*)\\(([0-9]+)\\)",
    "working_dir": "$project_path",
    "shell": true,
    "syntax": "",
}

Batch file:
@ECHO off

SET CPP_PATH=C:\Users\gokhan\Documents\C64CrossDev\tools\cc65\bin
SET VICE_PATH=C:\Users\gokhan\Documents\C64CrossDev\tools\WinVICE-2.4-x64

%CPP_PATH%\cl65 index.c text.s
%VICE_PATH%\x64 index

p.s.: I'm working on Windows 10

A: After doing some search about %errorlevel% I've reached the folowing solution:
@ECHO off

SET CPP_PATH=C:\Users\gokhan\Documents\C64CrossDev\tools\cc65\bin
SET VICE_PATH=C:\Users\gokhan\Documents\C64CrossDev\tools\WinVICE-2.4-x64

%CPP_PATH%\cl65 main.c text.s -o main.prg

IF %ERRORLEVEL%==0 %VICE_PATH%\x64 main.prg


text:
Q: Parallelizing a function that changes an attribute of a class under condition How can I parallelize a function that modifies an attribute of a class? In the following example, change_arr() modifies the contents of the attribute x of the class based on loc; it assigns -99 to each element of x that equals loc. When I run this script as written, I get the same array in both prints (and hence no modification took place). If I, however, comment the line using Pool and uncomment the two lines that do the same job using a for loop I get [-3, -2, -1, 0, 1, 2, 3] and [-99, 2, -99, 0, -99, 2, -99], which is what I want.
My question is, then, how can I parallelize the use of the function change_arr to modify the same class attribute in parallel?
I am aware that there probably are better ways to implement this. However, the example is not exactly my code (as it is way longer and more complex), but a minimal example.
import numpy as np
from multiprocessing import Pool

class MyClass:
    def __init__(self) -> None:
        self.x = np.array([-3, -2, -1, 0, 1, 2, 3])

    def process(self):
        Pool(2).map(self.change_arr, [-3, -1, 1, 3])

        # for i in [-3, -1, 1, 3]:
        #     self.change_arr(i)

    def change_arr(self, loc):
        self.x[self.x == loc] = -99

if __name__ == '__main__':
    mc = MyClass()
    print(mc.x)
    mc.process()
    print(mc.x)

A: You can share memory between processes with multiprocessing.Value and multiprocessing.Array types. I've created a minimal example how it works without involving numpy and classes.
from multiprocessing import Pool, Array

def change_arr(loc):
    for i in range(len(x)):
        if loc == x[i]:
            x[i] = -99

if __name__ == '__main__':
    x = Array('i', [-3, -2, -1, 0, 1, 2, 3])
    print([i for i in x])
    Pool(2).map(change_arr, [-3, -1, 1, 3])
    print([i for i in x])

I'm not sure if it works with numpy arrays. Theoretically the objects wrapped in Arrays or Values can be of any type.
The trick is to define x as a global variable and bind it to the function used in the map function.


text:
Q: Custom input Angular / Reactive Forms I'm using a stepper from the angular material and I'm unsure how best to make a component for each step of this stepper.
Because I have a lot of difficulty in shared forms. I wanted to know the best way to do this.
In the main component of the stepper, get the values of each step and at the end make a post with the 3 forms of the step.
As you can see, the code is already getting too big, so the ideal would be to make a component for each step

Componente TS

  companyInfo!: FormGroup;
  contactInfo!: FormGroup;
  selectedType: boolean = false;

  constructor(public fb: FormBuilder) { }

  ngOnInit(): void {
    this.initCompanyInfo();
    this.initContactInfo();
    console.log(this.companyInfo.get('industry')?.value)
  }
  initCompanyInfo(){
    this.companyInfo = this.fb.group({
      companyName: ['', Validators.required],
      industry: ['', Validators.required],
      country: ['', Validators.required],
    })
  }
  initContactInfo() {
    this.contactInfo = this.fb.group({
      contact: this.fb.array([this.createContact])
    })
  }
  createContact(): FormGroup {
    return this.fb.group({
      firstName: ['', Validators.required],
      lastName: ['', Validators.required],
      position: ['', Validators.required],
      email: ['', Validators.required],
      confirmEmail: ['', Validators.required],
      password: ['', Validators.required],
      confirmPassword: ['', Validators.required],
      phoneNumber: ['', Validators.required],
    })
  }
<mat-horizontal-stepper [labelPosition]="'bottom'" linear>
  <mat-progress-bar [value]=progressValue></mat-progress-bar>

  <mat-step label="COMPANY INFORMATION">
    <mat-card>

Company Info

        <button mat-raised-button matStepperNext (click)="additionProgress()">Next</button>

      <mat-card-content>
        <form [formGroup]="companyInfo">

                STATE

                <mat-form-field class="width6" appearance="outline">
                  <mat-label>COUNTRY</mat-label>
                  <input matInput formControlName="country">
                  <mat-error></mat-error>
                </mat-form-field>

                <mat-form-field appearance="outline">
                  <mat-label>STATE</mat-label>
                  <input matInput formControlName="state">
                  <mat-error></mat-error>
                </mat-form-field>

                <mat-form-field appearance="outline">
                  <mat-label>CITY</mat-label>
                  <input matInput formControlName="city">
                  <mat-error></mat-error>
                </mat-form-field>

                <mat-form-field class="width6" appearance="outline">
                  <mat-label>ADDRESS</mat-label>
                  <input matInput formControlName="address">
                  <mat-error></mat-error>
                </mat-form-field>

                <mat-form-field class="width8" appearance="outline">
                  <mat-label>ZIPCODE</mat-label>
                  <input matInput type="number" formControlName="zipcode">
                  <mat-error></mat-error>
                </mat-form-field>

                COMPANY

        </form>
      </mat-card-content>
    </mat-card>
  </mat-step>

  <mat-step label="CONTACT INFORMATION">

Opa2

    <button mat-raised-button matStepperPrevious (click)="subtractionProgress()">Previous</button>
    <button mat-raised-button matStepperNext (click)="additionProgress()">Next</button>
  </mat-step>

  <mat-step label="GENERAL INFORMATION">

Opa3

    <button mat-raised-button matStepperPrevious (click)="subtractionProgress()">Previous</button>
  </mat-step>
</mat-horizontal-stepper>

A: you can use a SERVICE and BehaviorSubject to share the FormGroup objects among multiple components... check the following demo on stackblitz...
https://stackblitz.com/edit/angular-ivy-cd6bup


text:
Q: Making a SKSpriteNode platform that recognize when a SKSprite is outside of it I'm trying to make a random type platform (based on the shape of the sprite that I put) in where the main character of my game would be situated; if an enemy passes the platform shape, it will be removed (like it was fallen). Here is an image of what I want to say:

The blue dot will be the hero character, the red ones the bad guys; the one that is inside a purple circle is the one that should be removed when falling out of the circular platform
So basically, I don't know how to detect properly when a charater is falling, I have something now, but they fall when all the body is fallen:
- (void) boundsCheck:(SKSpriteNode*)sprite{
    CGPoint newPosition = self.position;
    CGPoint newVelocity = self.velocity;

    CGPoint bottomLeft = CGPointMake(sprite.frame.origin.x, sprite.frame.origin.y);
    CGPoint topRight = CGPointMake(sprite.frame.origin.x + sprite.size.width,
                                   sprite.frame.origin.y + sprite.size.height);

    if (newPosition.x <= bottomLeft.x) {
        [self removeCharacterWithPosition:newPosition];
    }
    if (newPosition.x >= topRight.x) {
        [self removeCharacterWithPosition:newPosition];
    }
    if (newPosition.y <= bottomLeft.y) {
        [self removeCharacterWithPosition:newPosition];
    }
    if (newPosition.y >= topRight.y) {
        [self removeCharacterWithPosition:newPosition];
    }

    self.position = newPosition;
    self.velocity = newVelocity;
}

Can you tell me some tips? Thanks

A: If the platform is exactly circular you could check the distance of the red dots from the platform center. If their distance is bigger than the platform radius you can consider them out of the platform. To check the distance between two CGPoints (which are used to store the position property of nodes) you can use a function like this:
- (float)distanceBetween : (CGPoint) centerOfPlatform and: (CGPoint)enemy
{
    return sqrt(pow(p2.x-p1.x,2)+pow(p2.y-p1.y,2));
}

A: The answer was simple, there is a method called: containsPoint with that I could detect if the CGPont of the enemy is inside or not of the platform :) so I made it:
 if ([bezierPath containsPoint:newPosition]) {
        self.position = newPosition;
        self.velocity = newVelocity;
        return;
    }

thanks for the answers!