text:
Q: Bootstrap 3 accordion expand/collapse stopped working with iPad screen reader enabled We're using Bootstrap 3 (v3.3.5) accordion and it works fine until the screen reader is enabled on the iPad (iOS v9.1).  Once the screen reader is enabled, the accordions will no longer expand/collapse for accordions with shorter labels (labels that take up less than 50% of the available space).  The shorter label issue is consistent as the screen is rotated between landscape and portrait.  The issue can be corrected by making the labels longer than 50% of the available space or centering them. Unfortunately, centering or expanding the label is not an option on our team.
This seems to be a problem with Bootstrap 3 and not Bootstrap 2. I pointed to the bootstrap 2 accordion example here (http://getbootstrap.com/2.3.2/javascript.html#collapse) and enabled the screen reader on the iPad and it worked fine.  Then, I pointed to the bootstrap 3 accordion example here (http://getbootstrap.com/javascript/#collapse) and enabled the screen reader on the iPad and it failed to expand/collapse the accordion.
Has anyone found a fix or another workaround? Perhaps, we are missing an attribute to fix the problem or something else.
Here is the code that we're using in our accordion:

        This label is to short for any screen
          show content

This label is to short to expand/collapse this content on any iPad screen with the screen reader enabled.

        This label works on portrait/landscape screen and will expand/collapse accordion
          show content

This label is long enough to expand/collapse this content on the iPad portrait and landscape screens with the screen reader enabled.

        This label works on portrait screen not landscape
          show content

This label is long enough to expand/collapse this content on the iPad portrait screen but not the landscape with the screen reader enabled.

Thank you

A: This might be related to the following bug:
Use of anchors nested in headings causes issues in VoiceOver, promotes anti-pattern usage

anchors within headings(H4) confuse VoiceOver(VO), which:

*

*causes VO to place the VO cursor on the H4 vs. the anchor,

*doesn't read any of the aria attributes on the anchor,

*breaks the standard VO-Spacebar interaction


text:
Q: How to run a spreadsheet bound script as the creator (not viewer/editor) I made some script with my spreadsheet, which uses some Trigger and SendEmail functionalities. I have menu items in spreadsheet to control these triggers and sendemails.
Now when I share this spreadsheet with someone other, when he tried to access the trigger or sendemail functions from menu, the script asks for authorization as that user. IF authorized it will function as that user. e.g. send email as that user or make a new trigger as that user. This makes things double and useless
I want that any user accessing the script can use those functionalities, but won't require authorization to run as that user. The script should run as the creator of the sheet, so that no double triggering occurs. How should I do it?

A: You could create a web-app. Web-apps have the ability to run either as the user himself, or as the developer/publisher.

Under Execute the app as, select whose authorization the app should
  run with: your account (the developer's) or the account of the user
  who visits the app (see permissions).
  https://developers.google.com/apps-script/guides/web

This web-app wouldn't have a sheet linked to it, but if you only use 1 sheet you can have the web-app access the sheet through the ID of the sheet. You could use your existing menu-items to trigger the webapp
Would this be a possible solution for your problem?

redpajama_set_name: RedPajamaStackExchange


text:
Q: Rails 3 Metasearch issue, but only in production I must be doing something wrong.  I have a simple search that works fine in development (with sqlite3 DB) but not in production (with MYSQL DB).  Not sure how to debug.
Here are the details:
Controller:
def index
  @search = Individual.search(params[:search])
  @individuals = @search.all
  # @individuals = @search.order(:lastname).page params[:page]
end

View:
= form_for @search, :url => individuals_path, :html => {:method => :get} do |f|
  %fieldset
    %strong
      = f.label :firstname_like, "First Name?"
    = f.text_field :firstname_like
    %strong
      = f.label :lastname_like, "Last Name?"
    = f.text_field :lastname_like
    = f.submit "Search"

No problems using the console in the production environment:
Individual.search :lastname_like => 'Smith', :firstname_like => ''
=> #<MetaSearch::Searches::Individual:0blahblah....

Just doesn't work via the browser.  I get EVERY Individual returned. (No errors)
I'm wondering if it's something to do with URL encoding?
Started GET "/individuals/?utf8=%25E2%259C%2593&search%255Bfirstname_like%255D=& search%255Blastname_like%255D=hermans&commit=Search" for 68.87.23.92 at Thu May 26 09:22:31 -0700 2011
  Processing by IndividualsController#index as HTML
  Parameters: {"commit"=>"Search", "search%5Bfirstname_like%5D"=>"", "utf8"=>"%E2%9C%93", "search%5Blastname_like%5D"=>"smith"}

Any ideas?  Or at least how to debug?
Rails 3.0.7
Metasearch 1.0.3

A: If you are getting the output on console, then your function is working correctly. To debug try logging information at every step and see where it goes wrong, e.g. print the params being passed to search function, what output is search returning, etc etc and see where thing go wierd. You can also look at the db query being fired in production.log and try running it manually from the terminal and see the result.
You can even try running your application in development mode on the production server, changing the database.yml to use the production db and mysql to see if it is an environment specific issue.

A: Yeah, I'd say it's something with the url. As far as I can tell it should look like this:
/individuals/?utf8=%E2%9C%93&search%5Bfirstname_like%5D=&search%5Blastname_like%5D=hermans&commit=Search

I don't use haml, so I can't say what's going on but it's a problem with your form. It's adding those '25's in every encoded character. Is the encoding set correctly on your page?


text:
Q: How to fix: 'Unable to preventDefault inside passive event listener...' on this code? Chrome gives me this error on console:

[Intervention] Unable to preventDefault inside passive event listener
  due to target being treated as passive. See
  https://www.chromestatus.com/features/6662647093133312

The part on code is this (specially this part 'event.preventDefault();'):
/**
             * Mouse wheel handler.
             * @param {Object} event
             */
            function wheel(event) {

                if (!initDone) {
                    init();
                }

                var target = event.target;
                var overflowing = overflowingAncestor(target);

                // use default if there's no overflowing
                // element or default action is prevented
                if (!overflowing || event.defaultPrevented ||
                    isNodeName(activeElement, "embed") ||
                   (isNodeName(target, "embed") && /\.pdf/i.test(target.src))) {
                    return true;
                }

                var deltaX = event.wheelDeltaX || 0;
                var deltaY = event.wheelDeltaY || 0;

                // use wheelDelta if deltaX/Y is not available
                if (!deltaX && !deltaY) {
                    deltaY = event.wheelDelta || 0;
                }

                // check if it's a touchpad scroll that should be ignored
                if (!options.touchpadSupport && isTouchpad(deltaY)) {
                    return true;
                }

                // scale by step size
                // delta is 120 most of the time
                // synaptics seems to send 1 sometimes
                if (Math.abs(deltaX) > 1.2) {
                    deltaX *= options.stepSize / 120;
                }
                if (Math.abs(deltaY) > 1.2) {
                    deltaY *= options.stepSize / 120;
                }

                scrollArray(overflowing, -deltaX, -deltaY);
                event.preventDefault();
            }

How can i fix this problem in the code above?
Thanks in advance.


text:
Q: Clang++ cannot find GL/glu.h, but g++ (mingw-w64) works correctly I am making a OpenGL wrapper in C++ and modern OpenGL. So in my main header I have the following includes
#define GLFW_INCLUDE_GLU
#ifdef _WIN32
    #define GLFW_DLL
#endif

#include <GL/glew.h>
#include <GLFW/glfw3.h>

And compile with this command through a makefile:
g++ <all sources> -g -o main.exe  -L"D:/cpp_libraries/glfw-3.3.5-compiled/src" -L"D:/cpp_libraries/glew-2.1.0-compiled/lib" -lglfw3 -lglew32 -lopengl32 -I"./include" -I"D:/cpp_libraries/glfw-3.3.5-source/include" -I"D:/cpp_libraries/glew-2.1.0-source/include" -I"D:\cpp_libraries\glm" -std=c++2a -Wall
This works correctly. Then I tried switching g++ to clang++ for compilation and now there is an error on line 1205 in glew.h:
glew.h:1205:14: fatal error: 'GL/glu.h' file not found
After a google search I found out I really shouldn't need glu. I tried adding a #define GLEW_NO_GLU before the inclusion of glew, all that does is make glfw3.h throw the same error. I also tried removing the #define GLFW_INCLUDE_GLU and that somehow made clang fail to find libraries like iostream and chrono. Neither of these changes had any effect on the compilation with gcc.
This is my first time using clang and I really hope that I have not done some elementary mistake in assuming it is too similar to gcc


text:
Q: The Resource 'ImageConverter' could not be resolved I'm new on Windows phone and silverlight development. During my learning exercises i have encountered an error which is i mentioned on the title of this post.
My main goal is saving and retrieving the image file to the SQLCE database, and i have used this tutorial http://antonswanevelder.com/2011/10/28/writing-an-image-to-sql-ce-linq-to-sql/
However, i had a problem with this code snippet
<Image Source="{Binding ItemImage, Converter={StaticResource ImageConverter}}" Stretch="UniformToFill"/>
My idea is compiler cannot locate the resouce ImageConverter. I really need a help on this.
My code is:
MainPage.xaml
<phone:PhoneApplicationPage.Resources>
    <DataTemplate x:Key="CallListListBoxItemTemplate">
        <StackPanel Orientation="Vertical">
            <TextBlock Text="{Binding CallName}" Foreground="DarkCyan" FontSize="{StaticResource PhoneFontSizeLarge}"
                       VerticalAlignment="Top" Margin="12,12,0,0"/>
        </StackPanel>
    </DataTemplate>
    <DataTemplate x:Key="PersonalInfoListBoxItemTemplate">
        <Grid >
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto"/>
                <ColumnDefinition Width="Auto"/>
                <ColumnDefinition Width="Auto"/>
            </Grid.ColumnDefinitions>
            <Image Source="{Binding PersonImage, Converter={StaticResource ImageConverters}}" Stretch="UniformToFill" Name="_personPhoto" />

MainPage.xaml.cs
public class ImageConverters : IValueConverter
{
    public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
    {
        if (value is byte[])
        {
            MemoryStream ms = new MemoryStream(value as byte[]);
            WriteableBitmap wb = PictureDecoder.DecodeJpeg(ms, 100, 100);
            return wb;
        }
        else
        {
            return null;
        }

    }
    public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
    {
        throw new NotImplementedException();
    }
}

A: Let's consider your value converter locates in ProjectName.Converters namespace.
In xaml you need to add a namespace:
<phone.PhoneApplicatinPage
        .. all your code here
      xmlns:converters="clr-namespace;ProjectName.Converters"
      >

and in Resources tag:
   <phone:PhoneApplicationPage.Resources>
     <converters:ImageConverters x:Key="ImageConverter"/>
      <!- your DataTemplates here-->

And small tutorial to make you more familiar with IValueConverter here


text:
Q: Error in HTML display of  tag I have a bit of code something like the below:
<form>
    <fieldset>
        <legend>Form Title</legend>
        <legend>Text Box 1</legend>
            <input type="text"/>
        <legend>Text Box 2</legend>
            <input type="text"/>
        <legend>Text Box 3</legend>
            <input type="text"/>
        <input type="submit"/>
    </fieldset>
</form>

Nevermind that the above snippet is incomplete, it will serve as an example for my problem.
When the page is displayed, about half of the time it loads as the left bit of the image below, whereas the rest of the time it loads as intended like the right bit.

Why is this? I know <legend> is being used improperly here, and I plan to replace them with  tags instead. I'm gradually replacing all of the errors I was taught in university, but old habits die hard. Is this perhaps the issue?
The source code for the page when either appears is identical to each other.

A: As mentioned in my comment, don't use <legend> like that. That's not what it's for, it's wrong, and if it renders correctly, it's purely by chance.
See this Fiddle for a proper implementation.
HTML:
<form>
    <fieldset>
        <legend>Send Support Inquiry</legend>
        Name
        <input type="text" name="name" id="name"/>
        Email
        <input type="text" name="email" id="email"/>
        Message
        <textarea rows="8" cols="30" name="message" id="message"></textarea>
        <input type="submit" value="Submit" />
    </fieldset>
</form>

CSS:
label, input, textarea
{
    float: left;
    clear: both;
}


text:
Q: Chrome extension: Update badge text every hour I just started messing around with chrome extensions and I need to perform some checks once every hour and update the badge text if necessary. I thought of using a setInterval() function in the background script which runs every 60 minutes to accomplish this. But I feel like this might not be the most efficient approach and there might be a better way to do this. Can someone suggest a method?
Secondly, I'd also like to know the lifetime of the background script. I read the docs but couldn't figure it out. Is it started when the browser is opened and stopped when the browser is closed? Thanks.


text:
Q: JS Disable drag and drop (draggable attribute) Using this method, I have some elements on my page that can be dragged from one column to another.
I would like to be able to make the drag permanent. That is, once an element is dragged (or dropped I guess) ONCE, it can no longer be dragged.
I tried setting draggable to false using setAttribute, but that didn't seem to work.
So how could you (using plain old JS, no jQuery stuff) disable the draggable ability of an element?
I actually searched this and only found stuff about disabling dragging and dropping of files and other stuff onto a page, that is not what I am asking about. Thanks in advance.

A: On the W3Schools page you referenced - past this into the console:
document.getElementById('drag1').setAttribute('draggable',false);

Then try to drag the element. I think you'll find it works ;)
If you provide your code, I will help you debug.

A: you can try adding ondragstart="return false;" ondrop="return false;" in the html tag to disable the drag & drop.
Hope this will help you :)


text:
Q: react must be in scope when using jsx error Very Simple code , I'hv checked react spelling, ReactDom imported, Please guide me about the error. I am new to the codding world.

import React, { Component } from "react";
import "./App.css";
import { Cardlist } from "./components/cardlist/cardlist.component.jsx";

class App extends Component {
  constructor() {
    super();
    this.state = {
      string: "Hello before",
    };
  }

  render() {
    return (

{this.state.string}

        <button onClick={() => this.setState({ string: "After text" })}>
          Change text
        </button>
        <Cardlist name="this was prop" />

    );
  }
}

export default App;

Cardlist component
import react from "react";

export const Cardlist = (props) => {
  console.log(props);
  return
COngratulations
;
};

A: Try changing that react to React on first line on CardList ?


text:
Q: JQuery not selecting specific element after using .replaceWith() function to replace a  element with  I am creating a profile page for my app's users and i want to let the user change his personal information. My idea is  when the page loads, his personal information is displayed in rows inside a
 tag. And then when he decides to edit his info, the
 tag is replaced with a textbox and it's value is the text from the
 tag.
Now the problem is, when i try to do anything with the textboxes JQuery doesn't seem to select them even if i had already assigned an id for the textboxes.
Note no errors are shown in the console
I tried getting the textbox's id when i click it using this function.
$(window).click(function(e) {
        alert(e.target.id);
});

the id gets alerted but still, JQuery doesn't want to select the textboxes.
here's my code.
html

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Epicurean Inc.</title>
    <link rel="stylesheet" href="assets/bootstrap/css/bootstrap.min.css">
    <link rel="stylesheet" href="assets/fonts/ionicons.min.css">
    <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Abel">
    <link rel="stylesheet" href="assets/css/Contact-Form-Clean.css">
    <link rel="stylesheet" href="assets/css/Footer-Basic.css">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/animate.css/3.5.2/animate.min.css">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/aos/2.1.1/aos.css">
    <link rel="stylesheet" href="assets/css/Navigation-with-Button.css">
    <link rel="stylesheet" href="assets/css/styles.css">

Epicurean<button class="navbar-toggler" data-toggle="collapse" data-target="#navcol-1">Toggle navigation</button>

 Log Out

Your Profile

 About Me

        <form action="updateprofile.php" method="POST">

First name:

Paragraph

Last name:

Paragraph

Middle name:

Paragraph

Date of birth:

Paragraph

Email address:

Paragraph

Password:

Paragraph

Contact number:

Paragraph

Application status:

Paragraph

                    View resume
                    View assesment

                <button class="btn btn-light action-button" type="submit" data-bs-hover-animate="pulse"
                    id="savebtn">Save changes</button>
                <button class="btn btn-light action-button" type="button" data-bs-hover-animate="pulse" id="cancelbtn">Cancel</button>

        </form>

Home

Services

About

Terms

Privacy Policy

Epicurean Partners Exchange Inc. © 2017

jquery
$(document).ready(function() {

    $("#edit").click(function() { //turns the fields into text boxes when edit button is clicked
        for (var i = 1; i < 8 ; i++) {//for loop for replacing
 tags with textboxes
            if (i == 4) {
                $("#item"+i).replaceWith("<input type='date' id='"+i+"' class='txtbox' min='1940-12-31' max='2003-12-31'>"); //value='"+ $("#item"+i).text() +"'>");
            } else if (i == 6) {
                $("#item"+i).replaceWith("<input type='password' id='"+i+"' class='txtbox' value='"+ $("#item"+i).text() +"'>");
            } else {
                $("#item"+i).replaceWith("<input type='text' id='"+i+"' class='txtbox' value='"+ $("#item"+i).text() +"'>");
            }
        }
        $("#savebtn").slideDown().removeAttr("hidden");
        $("#cancelbtn").slideDown().removeAttr("hidden");
    });
    $("#cancelbtn").click(function() { //reloads the page if user cancels
        location.reload();
    });

    $("#1").click(function() {//not working

        alert("textbox is clicked");

    });
});

A: To bind an event on dynamically created element use
    $(document).on(eventName, selector, function(){});
Here is jsfiddle: http://jsfiddle.net/xpvt214o/881429/
Hope I answered the question.


text:
Q: Mover un
* al final del Navbar Bootstrap 5 Este es un nav general entregado por bootstrap 5. Estoy tratando de llevar el Dropdown al final del NavBar y que Home y Link se mantengan en su posicion original.
He probado con float-end, flex, margenes, pero no logro hacer que solo ese en especificio se mueva.
El codigo original del navbar d bootstrap 5

        <>

    Navbar
    <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">

    </button>

          Home

          Link

            Dropdown

Action

Another action

Something else here

        </>

A: A ver si te sirve esta solución.
En esencia lo que hace está alineado por defecto a la izquierda (al start), luego haces que ocupe todo el ancho disponible (clase w-100).
Ahora haces que el item justo antes del drop down crezca y ocupe todo el espacio posible con la clase flex-fill
Puedes verla funcionando aquí

    Navbar
    <button class="navbar-toggler collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">

    </button>

          Home

          Link

            Dropdown

Action

Another action

Something else here


text:
Q: opening folder in web site structure in Windows I am trying to set up a hyperlink to open a Windows Explorer, so that it can display a folder on the web server that is within the web site.
So in IIS, we have inetpub/MyWebSite/subFolder/Data/
I would like to allow for a web page hyper link to open the folder /Data
I can set up a user account on the web server and only provide access to this folder. I can use ASP Membeship to restrict access here, and/or assign the Network Service acccount access.
I don't really care who can see this folder as anything that gets placed in here will only be temporary, and nothing is "Mission Critical" just a file that the web site will read and write to and then it gets deleted.
Any and all ideas and suggestions will be tested.
Thanks for any help.

A: Build a representation of the folder's contents (using a DirectoryReader and CSS) and display that. Don't actually try to display the physical folder.

A: this sounds like FTP, and if it's on an intranet, why not create a share? much less work.


text:
Q: Getting all phone numbers stored in the database using foreach loop in asp.net mvc I have phone numbers stored in the database, I want to retrieve all phone numbers using foreach loop and assign them to variable and send bulk sms, but problem is, I am getting only one number from database. Here is my code:
    // GET: Members/SendBatch
    public ActionResult SendBatch()
    {

        return View();
    }

    [HttpPost]
    [ValidateAntiForgeryToken]
    public ActionResult SendBatch(Membership member)
    {
        var db = new ChurchContext();
        StreamReader objReader;
        WebClient client = new WebClient();

        string mess = member.Message;
        string cell = member.Cell;
        string pass = "xxxx";
        string user = "xxxx";
        string selectministries = member.SelectMinistries;
        string pathtoministries = "";

        pathtoministries = GetMinisry(selectministries);

        if (pathtoministries == "Youth")
        {

            var youthtable = from e in db.Youths
                             select e;
            var Entyouth = youthtable.ToList();

            foreach (Youth y in Entyouth)
            {
                string youthcell = y.ContactMobile.ToString();
                cell = youthcell;

            }

        }

      string baseurl = "http://bulksms.2way.co.za/eapi/submission/send_sms/2/2.0?" +
     "username=" + user + "&" +
     "password=" + pass + "&" +
     "message=" + mess + "&" +
     "msisdn=" + cell;

        WebRequest wrGETURL;
        wrGETURL = WebRequest.Create(baseurl);
        try
        {
            Stream objStream;
            objStream = wrGETURL.GetResponse().GetResponseStream();
            objReader = new StreamReader(objStream);
            objReader.Close();
        }
        catch (Exception ex)
        {
            ex.ToString();
        }

        return View("Index", member);

    }

    public static string GetMinisry(string ministry)
    {
        string membership = "";

        switch (ministry)
        {
            case "Youth":
                membership = "Youth";
                break;
            case "Children":
                membership = "Children";
                break;

            case "Men":
                membership = "Men";
                break;

            case "Women":
                membership = "Women";
                break;

            case "Visitors":
                membership = "Visitors";
                break;
            case "Members":
                membership = "Members";
                break;

        }

        return membership;
    }

I would like to get all the phone numbers and assigned them to cell variable and then to sms api and send bulk sms.

A: Try this (dirty but will do the job):
    string mess = member.Message;
    string cell = member.Cell;
    List<string> cellNumbers = new List<string>(); //LIST OF NUMBERs
    string pass = "xxxx";
    string user = "xxxx";
    string selectministries = member.SelectMinistries;
    string pathtoministries = "";

    pathtoministries = GetMinisry(selectministries);

    if (pathtoministries == "Youth")
    {

        var youthtable = from e in db.Youths
                         select e;
        var Entyouth = youthtable.ToList();

        foreach (Youth y in Entyouth)
        {
            string youthcell = y.ContactMobile.ToString();
            cell = youthcell;
            cellNumbers.add(cell);

        }

    }
   foreach(string number in cellNumbers) // send all the sms
   {
      string baseurl = "http://bulksms.2way.co.za/eapi/submission/send_sms/2/2.0?" +
     "username=" + user + "&" +
     "password=" + pass + "&" +
     "message=" + mess + "&" +
     "msisdn=" + number;

        WebRequest wrGETURL;
        wrGETURL = WebRequest.Create(baseurl);
        try
        {
            Stream objStream;
            objStream = wrGETURL.GetResponse().GetResponseStream();
            objReader = new StreamReader(objStream);
            objReader.Close();
        }
        catch (Exception ex)
        {
            ex.ToString();
        }
    }

A: You have a cycle where you override cell in each iteration and even though cell received all the values you need, all were overriden by the next one, except for the very last one. When the cycle is finished, you are sending the request using the very last value of cell. This is why you had the illusion that you have got a single value. Actually you have got all the values, but made the mistake of overriding them before using them. The solution is to send the request inside the cycle instead of after the cycle, like this:
// GET: Members/SendBatch
public ActionResult SendBatch()
{

    return View();
}

[HttpPost]
[ValidateAntiForgeryToken]
public ActionResult SendBatch(Membership member)
{
    var db = new ChurchContext();
    StreamReader objReader;
    WebClient client = new WebClient();

    string mess = member.Message;
    string cell = member.Cell;
    string pass = "xxxx";
    string user = "xxxx";
    string selectministries = member.SelectMinistries;
    string pathtoministries = "";

    pathtoministries = GetMinisry(selectministries);

    if (pathtoministries == "Youth")
    {

        var youthtable = from e in db.Youths
                         select e;
        var Entyouth = youthtable.ToList();

        foreach (Youth y in Entyouth)
        {
            string youthcell = y.ContactMobile.ToString();
            cell = youthcell;

  string baseurl = "http://bulksms.2way.co.za/eapi/submission/send_sms/2/2.0?" +
 "username=" + user + "&" +
 "password=" + pass + "&" +
 "message=" + mess + "&" +
 "msisdn=" + cell;

    WebRequest wrGETURL;
    wrGETURL = WebRequest.Create(baseurl);
    try
    {
        Stream objStream;
        objStream = wrGETURL.GetResponse().GetResponseStream();
        objReader = new StreamReader(objStream);
        objReader.Close();
    }
    catch (Exception ex)
    {
        ex.ToString();
    }

    return View("Index", member);

        }

    }
}

public static string GetMinisry(string ministry)
{
    string membership = "";

    switch (ministry)
    {
        case "Youth":
            membership = "Youth";
            break;
        case "Children":
            membership = "Children";
            break;

        case "Men":
            membership = "Men";
            break;

        case "Women":
            membership = "Women";
            break;

        case "Visitors":
            membership = "Visitors";
            break;
        case "Members":
            membership = "Members";
            break;

    }

    return membership;
}

A: Thanks guys, your answers solved my problem, hope future visitors to this page with similar problem will get help quickly.


text:
Q: How to send email in Windows command prompt using only pipes (no files) with newlines? I want to send email using only pipes without writing the message to a temporary file in Windows XP command prompt. I can do it with for example blat.exe, but I can't get the newlines to work.
I tried this kind of command:
echo something something & echo.more of something | blat.exe - -to my.email.address@domain.com

But this just sends "more of something" and ignores the everything before the last newline (& echo.).

A: This is doing:
echo something something & (echo.more of something | blat.exe - -to my.email.address@domain.com)

What you actually want is:
(echo something something & echo.more of something) | blat.exe - -to my.email.address@domain.com


text:
Q: In Gitlab Changelog API how can I bump the commit message description in the Chagelog I am able to automate the change-log generation in my project using GitLab Change-log API.
https://docs.gitlab.com/ee/api/repositories.html#add-changelog-data-to-a-changelog-file
I can only get the title of commit in Change-log but I am not able to get a description of the commit in changelog
Anyone has any idea on it.


text:
Q: I am trying to download multiple images as a zip file related to Id using laravel 7 I am trying to download multiple images as zip files related to id and I am getting all images that are available on uploads/images but I don't need to download all images only I want all those images that are related to id please help me how can I resolve that thanks.
dd($files);
array:2 [▼
  0 => "/home/developer/htdocs/yourstitchart.com/cms/public/phpCM0Yia.png"
  1 => "/home/developer/htdocs/yourstitchart.com/cms/public/phptLC57a.png"
]

InboxController
 public function dowloads($id)
    {
        $inboxFiles = Inbox::where('id', $id)->first()->file;

        $files = [];
        foreach ($inboxFiles as $i => $value) {
            $files[$i] = (public_path($value));
        }
        // dd($files);

        $zip = new \ZipArchive;
        $fileName = 'yourstitchart.zip';
        if ($zip->open(public_path($fileName), ZipArchive::CREATE) === TRUE) {

            $files = File::files(public_path('uploads/images'));

            foreach ($files as $file) {
                $relativeNameInZipFile = basename($file);
                $zip->addFile($file, $relativeNameInZipFile);
            }
            $zip->close();
        }
        return response()->download(public_path($fileName));
    }

HTML VIEW

                    @if($digitizingInbox->file)
                    id) }}"
                       class="download btn btn-warning">Download

                    @endif


text:
Q: Missing entries in join I've got a question about a query.
I've got two tables. The first table has to columns, a start-date and an end-date.
For example start: 00:00:00 and end: 00:15:00
The first table period:
|---start---|----end----|
| 00:00:00  | 00:15:00  |
| 00:15:01  | 00:30:00  |
| 00:30:01  | 00:45:00  |
| 00:45:01  | 01:00:00  |
|-----------|-----------|

The seconds table tt contains following information: name,zeit,points
|---name---|----zeit----|---points---|
|   AAAA   |  00:11:00  |     5      |
|   AAAA   |  00:12:00  |     5      |
|   BBBB   |  00:08:00  |     9      |
|   BBBB   |  00:10:00  |     9      |
|   CCCC   |  00:13:00  |     8      |
|   AAAA   |  00:31:00  |     1      |
|   BBBB   |  00:37:00  |     3      |
|   AAAA   |  00:47:00  |     7      |
|   BBBB   |  00:50:00  |     2      |
|   CCCC   |  00:55:00  |     4      |
|----------|------------|------------|

I've used the following query to summarize the points of each team grouped by the period:
SELECT
   period.end,
   IFNULL(sum(tt.punkte), 0) punkte,
   tt.name
FROM period
   LEFT JOIN tt ON (tt.zeit < period.end AND tt.zeit >= period.start)
GROUP BY period.end,tt.name

With this query I get this result:
|---end----|---punkte---|----name----|
| 00:15:00 |     10     |    AAAA    |
| 00:15:00 |     18     |    BBBB    |
| 00:15:00 |      8     |    CCCC    |
| 00:45:00 |      1     |    AAAA    |
| 00:45:00 |      3     |    BBBB    |
| 01:00:00 |      7     |    AAAA    |
| 01:00:00 |      2     |    BBBB    |
| 01:00:00 |      4     |    CCCC    |
|----------|------------|------------|

As you can see the results table is missing the rows with end 00:30:00 and there are only two rows with end 00:45:00.
So I've tried everything to add these rows to the result:
| 00:30:00 |      0     |    AAAA    |
| 00:30:00 |      0     |    BBBB    |
| 00:30:00 |      0     |    CCCC    |
| 00:45:00 |      0     |    CCCC    |

How can I change the query to get these missing rows to my result?

A: Another way, that doesn't use dynamic SQL would be to first CROSS JOIN the period with a (derived) table that holds DISTINCT name values from tt and then LEFT JOIN tt:
SELECT
    period.end,
    n.name,
    IFNULL(SUM(tt.punkte), 0) AS punkte
FROM
        period
    CROSS JOIN
        ( SELECT DISTINCT name FROM tt ) AS n
    LEFT JOIN
        tt
    ON
       tt.name = n.name
       AND (tt.zeit < period.end AND tt.zeit >= period.start)
GROUP BY
    period.end,
    n.name ;

A: idea next - for each distinct name we can calculate proper result:
SELECT
    `end` ,
    'AAAA' AS `name` ,
    IFNULL((SELECT
                SUM(points) FROM tt WHERE
                tt.`name` = 'AAAA' AND (tt.zeit < period.END AND tt.zeit >= period.START)) , 0) AS punkte
FROM
    period

next step UNION ALL result for each unique name
In common case (when more than 3 names) it could be:
SET @query_text =

                (SELECT GROUP_CONCAT(t1.query_text SEPARATOR " UNION ALL ")
                FROM (
                SELECT

                    CONCAT("SELECT `end`, '", `name`,"' as `name`, IFNULL((SELECT SUM(points) FROM tt WHERE tt.`name` = '",`name`,"' and (tt.zeit < period.end AND tt.zeit >= period.start)),0) as punkte FROM period") as query_text

                FROM tt GROUP BY `name`) t1);

PREPARE long_query_text FROM @query_text;
EXECUTE long_query_text;

00:15:00    AAAA    10
00:15:00    BBBB    18
00:15:00    CCCC    8
00:30:00    AAAA    0
00:30:00    BBBB    0
00:30:00    CCCC    0
00:45:00    AAAA    1
00:45:00    BBBB    3
00:45:00    CCCC    0
01:00:00    AAAA    7
01:00:00    BBBB    2
01:00:00    CCCC    4

prepare statements, than execute prepared


text:
Q: is there any query to find record from mongodb that will ignore white spaces from database For Example my collection company contains one document like
{
   name : "XYZ PVT LTD"
}
then i can find this document like
db.company.findOne({name :{regEx : "XYZPVTLTD"}});

A: Create your regex as following

let str = 'XYZPVTLTD';
let regex = new RegExp([...str].join('\\s*'));
console.log(regex.test('XYZ PVT LTD'))

db.company.findOne({name :{$regex : regex}});

A: If you want to pass your search string without space, you must follow the below:
db.arraytest.findOne(
{name:{
    $regex : /XYZ\s*PVT\s*LTD/
    }})


text:
Q: exclusion of index.html in nginx rewrite rule I have a website which I am rendering in https mode and I have written the rewrite rule in the default.conf like below:
listen       80;
server_name  hostname.com;
rewrite      ^ https://$server_name$request_uri? permanent;

However, I need to exclude the index.html or / from rewriting. How can I write the rule to exclude the index.html or / from rewriting?

A: I see no reason for this, but here is example which excludes / and /index.html from rewrite. Also I've changed rewrite to more efficient return directive.
listen 80;
server_name example.com;
root /path/to/root/dir;

# exclude / from rewrite
location = / {
    index index.html;
}

# exclude /index.html from rewrite
location = /index.html {
}

location / {
    return 301 https://$host$request_uri;
}


text:
Q: Logback SMTPAppender mixes up mails I do issue 10 error messages using this code:
final Logger log = LoggerFactory.getLogger("myLogger");
for(int i = 0; i<10; i++)
   log.error("myMessage" + i);

I configured logback.xml (see bottom) to write to console and to send emails. Console says:
17:56:21.172 [http-bio-8443-exec-1] ERROR myLogger - myMessage0
17:56:21.174 [http-bio-8443-exec-1] ERROR myLogger - myMessage1
17:56:21.174 [http-bio-8443-exec-1] ERROR myLogger - myMessage2
17:56:21.174 [http-bio-8443-exec-1] ERROR myLogger - myMessage3
17:56:21.174 [http-bio-8443-exec-1] ERROR myLogger - myMessage4
17:56:21.174 [http-bio-8443-exec-1] ERROR myLogger - myMessage5
17:56:21.174 [http-bio-8443-exec-1] ERROR myLogger - myMessage6
17:56:21.174 [http-bio-8443-exec-1] ERROR myLogger - myMessage7
17:56:21.175 [http-bio-8443-exec-1] ERROR myLogger - myMessage8
17:56:21.175 [http-bio-8443-exec-1] ERROR myLogger - myMessage9

which is perfect.
Also ch.qos.logback.classic.ViewStatusMessagesServlet shows my emails with 10 rows saying
INFO | SMTPAppender | About to send out SMTP message "ERROR myLogger myMessageNNN" to [xxx@xxx.yyy.com]

with N in 0 to 9, but the order of emails is shuffled to 7-0-9-2-8-1-4-3-5-6, which is still ok.
But unfortunatly, in my email account I find 10 equal emails, all with subject "ERROR myLogger myMessage8" and body
ERROR myLogger

myMessage6

So instead of sending 10 emails, one of them is sent 10 times. Even worse, subject and body of that email do not correspond to each other.
All 10 emails do have exactly the same Message-ID.
I tried this with logback 1.1.2, 1.1.1, and 1.1.0 (fetched from mvnrepository) and it always shows the same behaviour.
I tried it with two different smtp servers of my employer, and I did access both via Thunderbird and SquirrelMail, but this makes no difference.
If I do a "Thread.sleep(1000)" before each log.error, everything works as expected and the emails are perfectly fine.
<configuration scan="true" scanPeriod="1 minute">
  <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
    <encoder>
      <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
    </encoder>
  </appender>
  <appender name="EMAIL" class="ch.qos.logback.classic.net.SMTPAppender">
    <filter class="ch.qos.logback.classic.filter.ThresholdFilter">
      <level>ERROR</level>
    </filter>
    <smtpHost>xxx.yyy.com</smtpHost>
    <to>xxx@xxx.yyy.com</to>
    <from>xxx@xxx.yyy.com</from>
    <subject>%-5level %logger{26} %m{50}</subject>
    <layout class="ch.qos.logback.classic.PatternLayout">
      <pattern>%level %logger%n%n%m%n%n%ex</pattern>
    </layout>
  </appender>
  <root level="INFO">
    <appender-ref ref="STDOUT"/>
    <appender-ref ref="EMAIL"/>
  </root>
</configuration>

I created an jira issue for that: http://jira.qos.ch/browse/LOGBACK-1032 but the jira looks a bit orphaned.


text:
Q: StorageItemAccessList like functionality in Android For windows, we have StorageItemAccessList  to get a token for a file that users opens,which helps us to access the same file in future using the same token and not care if the file was moved to other location. Do we have similar support in android?
My requirement is that, i am saving list of files that user opened recently and if a file is deleted/moved to other location, need FutureAccessList token kind of functionality to handle the cases.

A:
Do we have similar support in android?

No, sorry.


text:
Q: Microsoft SQL Server Management Studio 18 menu is repeated 3 times My menu is repeated 3 times. When I click on whatever button the menu is repeated like the second screenshot.
How can I fix it ? Thanks


text:
Q: Adding both CNAME and TXT DNS records for one subdomain I have a Heroku app and I need to set up a domain for it. The common way to set it up is to use CNAME record to specify that this domain is an alias to <your-domain-name>.herokuapp.com. The thing is, I also want to add Google Webmasters and Yandex.Metrika integrations and the easiest way is to add two TXT record for the domain. I set it up like that:
I need to have 2 TXT records on http://www.cscombo.com, but apparently this won't work because of this: https://stackoverflow.com/questions/34613083/cname-and-txt-record-for-same-subdomain-not-working
My current setup isn't working properly, because adding http://www.cscombo.com to the Google Webmasters wouldn't work (because TXT record for the www subdomain doesn't exist), and adding http://cscombo.com (non-www version) will work (the TXT record for this subdomain exists), but this way Google Webmasters won't be able to read both sitemap.txt and robots.txt (because they both redirect to the www version of the site). The same story with Yandex.Metrika.
So, the question: is there any way to add CNAME and TXT records for the same subdomain?

A: A workaround would be to use an ALIAS record if your registrar supports it. It is a type of records that provides CNAME-like behavior on apex domains. Read more: https://support.dnsimple.com/articles/alias-record/#whats-an-alias-record
For example, you could create an ALIAS record for @ which points to myapp.herokuapp.com. This would allow you to also have TXT records for @ on the same domain name.

A: You can't.  As RFC1034 says in s3.6.2,

If a CNAME RR is present at a node, no other data should be
present

If you want a TXT record for (say) www.example.com, you can't have a CNAME for www.example.com, and will have to find another way to achieve what you want.  This may mean monitoring example.herokuapp.com yourself, and when the IP address changes, updating your own A records for www.example.com.


text:
Q: How to count a number of links with this code I cant show the number of links in the textarea.. I use this code:

<textarea id="textarea" style="height: 300px; width: 500px;"></textarea>

But this show the name of urls for example:
Insert in textarea:
https://www.google.com
https://www.amazon.com

Show:
URLS: https://www.google.com, https://www.amazon.com

But I need show:
URLS: 2

I try with:
$("#result").html("URLS: " + output.length);

But get the number of letters of the URLS.
Anyone can help me? thx so much

A: If you make output an array instead of a string, you can use the length property:
var output = [];
and
while ((urls = url.exec(this.value)) !== null) {
    output.push( urls[0] );
 }
and
$("#result").html("URLS: " + output.length );

"use strict";
var url = /[-a-zA-Z0-9@:%_\+.~#?&//=]{2,256}\.[a-z]{2,4}\b(\/[-a-zA-Z0-9@:%_\+.~#?&//=]*)?/gi;

document.querySelector( 'textarea' ).addEventListener( 'keyup', function( e ) {
  var urls;
  var output = [];
  if ( e.keyCode !== 8 && e.keyCode !== 9 && e.keyCode !== 13 && e.keyCode !== 32 && e.keyCode !== 46 ) {
            // Return is backspace, tab, enter, space or delete was not pressed.
            return;
        }

  while ((urls = url.exec(this.value)) !== null) {
    output.push( urls[ 0 ] );
  }
  document.querySelector( '#result' ).innerHTML = "URLS: " + output.length;
});
textarea {
  height: 100px;
  width: 400px;
}
<textarea></textarea>

A: It can be done using a variable i, initialize it with zero outside of loop. and for every iteration of loop increase i with 1.
Go here for solution demo

A: Change your code from:
$(function() {
"use strict";
var url = /[-a-zA-Z0-9@:%_\+.~#?&//=]{2,256}\.[a-z]{2,4}\b(\/[-a-zA-Z0-9@:%_\+.~#?&//=]*)?/gi;

$("#textarea").on("keyup", function( e ) {
    var urls, output = "";
    if ( e.keyCode !== 8 && e.keyCode !== 9 && e.keyCode !== 13 && e.keyCode !== 32 && e.keyCode !== 46 ) {
        // Return is backspace, tab, enter, space or delete was not pressed.
        return;
    }

    while ((urls = url.exec(this.value)) !== null) {
        output += urls[0] + ", ";
    }
    $("#result").html("URLS: " + output.substring(0, output.length - 2));
});

});
To:
$(function() {
"use strict";
var url = /[-a-zA-Z0-9@:%_\+.~#?&//=]{2,256}\.[a-z]{2,4}\b(\/[-a-zA-Z0-9@:%_\+.~#?&//=]*)?/gmi;

$("#textarea").on("keyup", function( e ) {
    var urls, output = "";
    if ( e.keyCode !== 8 && e.keyCode !== 9 && e.keyCode !== 13 && e.keyCode !== 32 && e.keyCode !== 46 ) {
        // Return is backspace, tab, enter, space or delete was not pressed.
        return;
    }

  var urls = this.value.match(url);

  $("#result").html(urls.length);
});

});
https://codepen.io/jthomas077/pen/gjZbPe
Note: You can still iterate over the matches if you need too.


text:
Q: How to find all week numbers that are first week of month in a year python I want to create a event that falls on Sunday of every first week of months.
This is what I am doing for a particular week number which is first week of june to get date:
from datetime import datetime
myDate = "2017 22 0"
# here `2017` is year, `22` is week number and `0` =sunday is week day
datetime.strptime(myDate, "%Y %W %w")

#output...
datetime.datetime(2017, 6, 4, 0, 0)

So I need a list of all week numbers that are first week of month so I can loop on it and get desire dates.
Adding More information
I want a method which return list of week numbers which are first week of month where first week means week has first sunday.
def get_week_number(year=2017, day=0):
   #day 0 means sunday
   ...
   ...
   return [1, 5, 9, 13, 18, 22, ...]

A: (Edited, because of error in weekday numbering)
>>> import datetime
>>> june1 = datetime.datetime(2017,6,1)
>>> june1
datetime.datetime(2017, 6, 1, 0, 0)
>>> june1_weekday = june1.weekday()
>>> if june1_weekday < 6:  # 6 indicates Sunday
        first_sunday_in_june = june1 + datetime.timedelta(days=6-june1_weekday)
else:
        first_sunday_in_june = june1

>>> print(first_sunday_in_june)
2017-06-04 00:00:00

Assuming you want ISO weeknumbers, you can then use the isocalendar() method. This gives a tuple (year, weeknumber, weekday). This uses the convention that weeks start with Monday, and the first week of the year is the first week with at least four days in the year (or in other words, the week with the first Thursday).
>>> first_sunday_in_june.isocalendar()
(2017, 22, 7)

If you have another convention for first-day-of-the-week or first-week-of-the-year, you will have to brew your own function to get the week number.
Use the above method in a loop over the months, and you can create the desired list with week numbers.

A: I've done a loop through the months, then got the first Sunday (starting at month's 1st and moving to the next day until a Sunday is found), then got the week-of-year of the date found:
from datetime import datetime
from datetime import date

# dayofweek: Sunday=0, Monday=1 and so on
def get_week_number(year=2017, dayofweek=0):
    weeks = []

    for month in range(1, 13):
        # get first Sunday of month
        d = date(year, month, 1)
        while(d.weekday() != dayofweek):
            d = d.replace(day=d.day + 1)

        # isocalendar()[1] is the week-of-year field
        weeks.append(d.isocalendar()[1])

    return weeks

print(get_week_number(2017, 0))

The result, though, is different from what you expect:
[1, 6, 10, 14, 18, 23, 27, 32, 36, 40, 45, 49]

I also tried with weeks.append(int(d.strftime("%W"))) but it gives the same results - I'm using Python 3.5.2 and a week is defined as:

The ISO year consists of 52 or 53 full weeks, and where a week starts on a Monday and ends on a Sunday. The first week of an ISO year is the first (Gregorian) calendar week of a year containing a Thursday. This is called week number 1, and the ISO year of that Thursday is the same as its Gregorian year.


text:
Q: How to animate a 3D object along a path, so that two animations are synchronous? I want to create an animation showing the movement of an arrow on a set trajectory.
I created a path in SVG and JS technology and a 3D vector in CSS technology. I created a path animation (using dashed line animation). Unfortunately, I have a problem with creating an arrow animation.
My code:

let r = 15;
let ry = [];// the array of points used to draw a conical helix

function getPoints() {
  var a = 0.8;// angle for the tilt

  for (var t = 0.1; t < 2 * Math.PI; t += 0.008) {
    let x = r * t * Math.cos(6 * t + a);
    let y =
        (r + r / 2 * Math.cos(a)) * t -
        r / 2 * Math.sin(a) * t * Math.sin(6 * t + a) -
        150;

    ry.push({ x, y });
  }
}

getPoints();

//using the points to build the d attribute for the path
let d = `M${ry[0].x},${ry[0].y}L`;

for (let i = 0; i < ry.length; i++) {
  d += `${ry[i].x},${ry[i].y} `;
}

ch.setAttributeNS(null, "d", d);

$('#RF1').click(function(){

  $('#ch').removeClass('my_impuls');
  $('#redVec').removeClass('anima');

  $('#ch').addClass('my_impuls');
  $('#redVec').addClass('anima');
});
.my {
  border:1px solid;
  -webkit-transform: translate(180px, 200px);
  -moz-transform: translate(180px, 200px);
  -o-transform: translate(180px, 200px);
  transform: translate(180px, 200px);
  stroke-dasharray: 1300;
}

.my_impuls{
  animation: dash1 5s linear forwards  reverse;
  -webkit-animation: dash1 5s linear forwards  reverse;
}

.my_no_impuls{
  animation: dash2 5s linear forwards  ;
  -webkit-animation: dash2 5s linear forwards  ;
}

@keyframes dash1 {
  to {
    stroke-dashoffset: 1250;
  }
}

@keyframes dash2 {
  to {
    stroke-dashoffset: -1300;
  }
}

.container3{
  width: 350px;
  height: 250px;
}

.perspective {
  perspective: 12000px;
  -webkit-perspective: 12000px;
}

.vec-wrap {
  transform-style: preserve-3d;
  -webkit-transform-style: preserve-3d;

  transform: translateZ(-300px) translateX(92px) translateY(-560px);
  -webkit-transform: translateZ(-300px) translateY(-557px) translateX(90px);
}

.vec {
  position: relative;
  width: 200px;
  height: 200px;
  margin: 100px auto;

  transform-style: preserve-3d;
  -webkit-transform-style: preserve-3d;

  transform-origin: 20px 130px;
  -webkit-transform-origin: 20px 130px;
  transform: rotateX(-20deg) rotateY(-30deg) ;
  -webkit-transform: rotateX(-20deg) rotateY(-30deg);

}

.vec .triangle {
  transform-style: preserve-3d;
  -webkit-transform-style: preserve-3d;

  transform-origin: 50% 50%;
  -webkit-transform-origin: 50% 50%;
}

.triangle .side {
  position: absolute;
  width: 0;
  height: 0;
  border-left: 15px solid transparent;
  border-right: 15px solid transparent;
  border-bottom: 30px solid red;

  transform-style: preserve-3d;
  -webkit-transform-style: preserve-3d;
  z-index: 1;
}

.side:nth-of-type(1) {
  transform: rotateX(30deg) translateZ(8px);
  -webkit-transform: rotateX(30deg) translateZ(8px);
}

.side:nth-of-type(2) {
  transform: rotateY(90deg) rotateX(30deg) translateZ(8px);
  -webkit-transform: rotateY(90deg) rotateX(30deg) translateZ(8px);
}

.side:nth-of-type(3) {
  transform: rotateY(180deg) rotateX(30deg) translateZ(8px);
  -webkit-transform: rotateY(180deg) rotateX(30deg) translateZ(8px);
}

.side:nth-of-type(4) {
  transform: rotateY(-90deg) rotateX(30deg) translateZ(8px);
  -webkit-transform: rotateY(-90deg) rotateX(30deg) translateZ(8px);
}

.vec .arrow {
  transform-style: preserve-3d;
  -webkit-transform-style: preserve-3d;

  transform-origin: 50% 50%;
  -webkit-transform-origin: 50% 50%;
}

.arrow .side2 {
  position: absolute;
  top: 20px;
  left: 10px;
  width: 10px;
  height: 110px;
  background-color: red;
  border: 1px solid black;

  transform-style: preserve-3d;
  -webkit-transform-style: preserve-3d;
  z-index: 1;
}

.side2:nth-of-type(1) {
  transform: translateZ(5px);
  -webkit-transform: translateZ(5px);
}

.side2:nth-of-type(2) {
  transform: rotateY(90deg) translateZ(5px);
  -webkit-transform: rotateY(90deg) translateZ(5px);
}

.side2:nth-of-type(3) {
  transform: rotateY(180deg) translateZ(5px);
  -webkit-transform: rotateY(180deg) translateZ(5px);
}

.side2:nth-of-type(4) {
  transform: rotateY(-90deg) translateZ(5px);
  -webkit-transform: rotateY(-90deg) translateZ(5px);
}

.arrow .floor {
  position: absolute;
  width: 10px;
  height: 10px;
  left: 10px;
  top: 125px;
  transform: rotateX(90deg);
  background-color: red;
  border: 1px solid black;

  transform-style: preserve-3d;
  -webkit-transform-style: preserve-3d;
  z-index: 1;
}

.arrow .ceeling {
  position: absolute;
  width: 30px;
  height: 30px;
  left: 0px;
  top: 8px;
  transform: rotateX(90deg);
  background-color: red;
  border: 1px solid black;

  transform-style: preserve-3d;
  -webkit-transform-style: preserve-3d;
  z-index: 1;
}

.anima{
  transform-origin: 20px 130px;
  -webkit-animation-duration: 5s;
  -webkit-animation-name: anim;
  -webkit-animation-iteration-count: 1;
  -webkit-animation-direction: normal;
  -moz-animation-duration: 5s;
  -moz-animation-name: anim;
  -moz-animation-iteration-count: 1;
  -moz-animation-direction: normal;
  -o-animation-duration: 5s;
  -o-animation-name: anim;
  -o-animation-iteration-count: 1;
  -o-animation-direction: normal;
  animation-duration: 5s;
  animation-name: anim;
  animation-iteration-count: 1;
  animation-direction: normal;
}

@keyframes anim {
  from {
    transform: rotateX(-20deg) rotateY(-30deg);
  }
  to {
    transform:
      rotateX(-20deg)
      rotateZ(-10deg) rotateY(360deg) scale3d(0.9, 0.9, 0.9)
      rotateZ(-20deg) rotateY(360deg) scale3d(0.9, 0.9, 0.9)
      rotateZ(-30deg) rotateY(360deg) scale3d(1, 1, 1)
      rotateZ(-40deg) rotateY(360deg) scale3d(1,1, 1)
      rotateZ(-50deg) rotateY(360deg) scale3d(1,1,1)
      rotateZ(-55deg) rotateY(360deg) scale3d(1,1,1)
      rotateZ(-60deg) rotateY(360deg) scale3d(1,1,1) ;
  }
}

    <button id="RF1"> Animate </button>

  <svg width="350" height="500" xmlns="http://www.w3.org/2000/svg">

    <path class="my" id="ch" stroke="blue" stroke-width="3" fill="none" />

  </svg>

https://codepen.io/kolekole/pen/BXBOXd
Do you know how to write an arrow animation so that it moves along a path and synchronized with the path motion?


text:
Q: How to transform Flutter web app into a PWA? I am making a new Web application with Flutter web.
I want to add service workers to my app in order to make it a PWA.
What I need to use to achieve my goal ?
I have tried to do it with dart packages (service_worker or pwa), but they are deprecated for Dart 2.

A: Since a service worker is just javascript code you can write one in plain javascript (e.g. in a sw.js file), bundle it with your flutter web app and then register the service worker from the index.html file like this (source):
if ('serviceWorker' in navigator) {
  navigator.serviceWorker.register('/service-worker.js');
}

A: You currently need to switch to Flutter Channel Dev (at Feb 17th 2020, current Dev version 1.15.3)
For existing projects, use the terminal to hit the command:
flutter create .
For new projects, you would have a 2 files: manifest.json and index.html inside your web folder.
While checking index.html you would notice the following script:
if ('serviceWorker' in navigator) {
  window.addEventListener('load', function () {
     navigator.serviceWorker.register('/flutter_service_worker.js');
  });
}

If the script is not there, added inside <body></body>
This script creates the PWA support for you and be able to "install" the app on a device (this also includes MacOS)
Follow this GUIDE to complete your PWA functionalities.


text:
Q: How to callback ReCAPTCHA a object function? When I callback a object function like this
<button class="g-recaptcha"
        data-sitekey="xxxxx"
        data-callback="Obj.fn">
    Send
</button>

I have this error:
ReCAPTCHA couldn't find user-provided function: Obj.fn


text:
Q: Code not working trying to write the content of a StringVar to a file I've got a lot of experience with basic programming, but none with GUI programming, and I am teaching myself Python 3 with tkinter for that purpose.  I've got some great answers by checking stackoverflow posts, but now I've got a problem that doesn't seem to have been covered.  I want my program to get user input from an Entry widget and write that data to a file.  After stripping out all nonessential lines, my current code is
from tkinter import *
from tkinter import ttk

root = Tk()

sheetid = StringVar()

def finish():
    with open('C:/Python33/data.txt', 'w') as f:
        f.write('first line of text\n')
    with open('C:/Python33/data.txt', 'a') as f:
        f.write(sheetid)

main = Frame(root).grid()
ttk.Entry(main, textvariable="sheetid").grid(row=0, column=1)
ttk.Button(main, text="Close", command=finish).grid(column=1)

root.mainloop()

I've previously used the Label widget to write the variable "sheetid"in a window, so I know the combination of Entry widget and the "Close" Button widget are working.  The first write statement works, so I know my file-opening code is correct.  The second write gives a run-time error:
TypeError: must be str, not StringVar.
Next I tried converting "sheetid" to a string, using
s = str(sheetid,'\n')

but this also returned a run-time error:
TypeError: coercing to str: need bytes, bytearray or buffer-like object, StringVar found.
Surely there is a way to do this, but my google search hasn't found it.
Thanks!

A: You cannot use ..., textvariable="sheetid", you must use ..., textvariable=sheetid, ... (notice the lack of quotes around sheetid). And then, when you want to write the value out you must use sheetid.get().


text:
Q: Determinant of a flipped or rotated matrix The determinant of a square matrix is the same as the determinant of its transpose. The transpose of a matrix can be obtained by reflecting the matrix across its main diagonal.
I was wondering how the determinant might change if we transform the matrix in other ways.
Setup
Suppose we have an $NxN$ matrix
$$
a_{11}\ a_{12}\ ...\ a_{1N}\\
a_{21}\ a_{22}\ ...\ a_{2N}\\
.\\
.\\
.\\
a_{N1}\ a_{N2}\ ...\ a_{NN}
$$
whose determinant is $D$.
Rotation
If we rotate $M$ $90$ degrees clockwise to get $M_{rot}$
$$
a_{N1}\ a_{N-1,1}\ ...\ a_{21}\ a_{11}\\
a_{N2}\ a_{N-1,2}\ ...\ a_{22}\ a_{12}\\
.\\
.\\
.\\
a_{NN}\ a_{N-1,N}\ ...\ a_{2N}\ a_{1N}
$$
how are the determinant of $M$ and $M_{rot}$ related?
Flip/reflection across horizontal axis
If we flip $M$ across a horizontal axis to get $M_{horizflip}$
$$
a_{N1}\ a_{N2}\ ...\ a_{NN}\\
.\\
.\\
.\\
a_{21}\ a_{22}\ ...\ a_{2N}\\
a_{11}\ a_{12}\ ...\ a_{1N}
$$
how are the determinant of $M$ and $M_{horizflip}$ related?
Flip/reflection across vertical axis
If we flip $M$ across a vertical axis to get $M_{vertflip}$
$$
a_{1N}\ a_{1,N-1}\ ...\ a_{12}\ a_{11}\\
a_{2N}\ a_{2,N-1}\ ...\ a_{22}\ a_{21}\\
.\\
.\\
.\\
a_{NN}\ a_{N,N-1}\ ...\ a_{N2}\ a_{N1}
$$
how are the determinant of $M$ and $M_{vertflip}$ related?

A: If you flip across vertical or horizontal axis, the only thing you are doing is transposing rows or columns several times. Transposing two rows or two columns will multiply the determinant by -1. So if the size of the matrix is $n \times n$, the determinant will be multiplied by $(-1)^{\lfloor\frac{n}{2}\rfloor}$ where $\lfloor\frac{n}{2}\rfloor$ is the total number of transposition necessary to do the flip operation.
For the rotated case, we can see that rotating by $90$ degrees clockwise is equivalent to first transpose the matrix (which does not change the determinant), and then flip vertically. Therefore it also multiplies the determinant by $(-1)^{\lfloor\frac{n}{2}\rfloor}$.

A: I can answer your question for $M_{horizflip}$ and $M_{vertflip}$. The key principle is that of elementary row (or column) operations, particularly that of interchanging rows (or columns). This operation has the effect of changing the sign of $\det(M)$. There are a lot of proofs of this online, or you can try to prove it yourself using the definition of determinant.
Suppose you had a $3\times 3$ matrix $M$. Then $M_{vertflip}$ is obtained by interchanging the first and third column of $M$. Therefore $\det(M_{vertflip}) = -\det(M)$.
But in the $4\times 4$ case, we would perform two operations: interchange columns 1 and 4, and then 2 and 3. Since we do two interchanges, we find $\det(M_{vertflip}) = \det(M)$.
Since we see there are only two options, we naturally ask when the determinant changes sign and when it stays the same, and we see this is dependent on the size of $M$. In particular, we are curious about the parity of the number of pairs needed to interchange. One way to describe the behavior is by examining $N \mod4$.
If $N \mod 4 \in \{0,1\}$, then $\det(M) = det(M_{vertflip})$.
If $N \mod 4 \in \{2,3\}$, then $\det(M) = -det(M_{vertflip})$.
Of course, my choice of vertflip and columns was arbitrary. As you note in your first sentence, you could do all of this in the transpose to find the same result about horizflip and rows. I'm sorry I can't help with $M_{rot}$; I'm sure some smarter person will come along and help us both with that.


text:
Q: WordPress's "Text" Format When using self-hosted WordPress, you have the option of writing in "Visual" or "Text" mode.

Assuming there's no plugins installed,

*

*Is this "Text" format a well defined standard or pseudo standard? (like markdown, textile, etc.)

*Is there a single place in a plugin-less 3.5.1 WordPress where this text is converted into HTML?

*If the answer to number 2 is "No", how is this text converted into html?

A: Text its just plain text, just as its saved in your db.
Wordpress changes line breaks with paragraphs with the function wpautop, through the filter the_content and the_excerpt.
If you need to remove the wpautop behavior, you can remove the filter by doing this in your theme's functions.php:
remove_filter( 'the_content', 'wpautop' );
remove_filter( 'the_excerpt', 'wpautop' );

And maybe adding your own customized function:
add_filter( 'the_content', 'my_custom_format' );
add_filter( 'the_excerpt', 'my_custom_format' );

function my_custom_format ($text) {
  // do something with $text
  return $text;
}


text:
Q: Intuitive way to see how degrees of freedom affects the mean of a chi square distribution? I am new to Statistics and trying to intuitively understand how a change in degrees of freedom affects the mean of a chi-square distribution.
Suppose, We have $n$ normal random variables such that $X_1 + \cdots + X_n = 0$
Now, for a chi-square distribution, the expected value is = degrees of freedom.
In this case, the degrees of freedom is $n-1$.
If we consider an example where $X_1 + X_2 = 0 $.
Then $X_1^2 + X_2^2 = 2 X_1^2$ although has $1$ degree of freedom yet it's mean value is $2$!
Where am I making a mistake?
Thanks a lot!

A: If $X_1+\ldots+X_n=0$ with probability one, the vector $(X_1,\ldots,X_n)$ is not a Normal vector, hence $X^2_1+\ldots+X^2_n$ is not a $\chi^2_n$ random variable.


text: Q: Closest sumset to a set Suppose $A$ is a subset of the finite field with $p$ elements. What is the best approximation of $A$ by a sumset $B+C$ in the sense that $|A\Delta (B+C)|$ is minimal? Of course if $B=A-x$ and $C=\{x\}$ then we have equality so I would ask that both sets be non-singleton. If $A+A$ is small then there are standard covering lemmas which give an answer but this is a fairly strong assumption about $A$. If I recall correctly there are results that say $A$ is a sumset if it is almost the whole field. What about smaller $A$?


text:
Q: Haskell - foldl and foldr? Is difference between foldl and foldr just the direction of looping? I thought there was a difference in what they did, not just in the direction?

A: There's a difference if your function isn't associative (i.e. it matters which way you bracket expressions) so for example,
foldr (-) 0 [1..10] = -5 but foldl (-) 0 [1..10] = -55.
This is because the former is equal to 1-(2-(3-(4-(5-(6-(7-(8-(9-(10 - 0))))))))), whereas the latter is (((((((((0-1)-2)-3)-4)-5)-6)-7)-8)-9)-10.
Whereas because (+) is associative (doesn't matter what order you add subexpressions),
foldr (+) 0 [1..10] = 55 and foldl (+) 0 [1..10] = 55. (++) is another associative operation because xs ++ (ys ++ zs) gives the same answer as (xs ++ ys) ++ zs (although the first one is faster - don't use foldl (++)).
Some functions only work one way:
foldr (:) :: [a] -> [a] -> [a] but foldl (:) is nonsense.
Have a look at Cale Gibbard's diagrams (from the wikipedia article); you can see f getting called with genuinely different pairs of data:

Another difference is that because it matches the structure of the list, foldr is often more efficient for lazy evaluation, so can be used with an infinite list as long as f is non-strict in its second argument (like (:) or (++)). foldl is only rarely the better choice. If you're using foldl it's usually worth using foldl' because it's strict and stops you building up a long list of intermediate results. (More on this topic in the answers to this question.)


text:
Q: Complete mismatch of font display in Google Chrome vs Firefox I've used a CSS from Goolge and I'm getting puzzling result. Below are two screenshots. The one from Firefox shows the correct (or, at least, the expected rendering), the one from Chrome shows some random font...

Firefox

Chrome
This is how I load it:
<link href='http://fonts.googleapis.com/css?family=Lobster+Two:700italic'
          rel='stylesheet' type='text/css'/>

The relevant CSS rule:
.digit {
    font-family: 'Lobster Two', cursive;
    font-size: 24pt;
    background-color: #d1d2d4;
    color: #ebebec;
    padding-left: 5px;
    padding-right: 5px;
    margin-bottom: 10px;
    cursor: pointer;
    display: block;
    float: left
}

I'm at a loss...

A: Following, somewhat, Fluidbyte's advice I decided to use the font file I have, rather than the one from Google's CDN and it worked. I'd still be interested to know why wouldn't it work the first time I tried, but as the practical solution (possibly only relevant to this particular font) this should help you, if you are facing the same problem.


text:
Q: How to create dynamically named dictionary in Python? I am looking to chunk a bunch of data from a dataframe. In order to do so, I need to define a dynamic name to a dictionary.
I would like to do something like:
dict_{}.format(VARIABLE_NAME) = {}

The above shown is an illegal operation. How can I go about defining a new dictionary name every time I need to create one? This is happening in a for loop, so I need to use dynamic dict names. Let me know if there is anything else I need to provide.
Here is a snippet of the dataframe
   REFERENCE_CODE                                        TRANSLATION
0      ladder_now                                                NaN
1               0                                              xyzwu
2               1                                              yxzuv
3               2                                            asdfasd
4               3                                             sdfsdh
5               4                                             hghffg
6               5                                            agfdhsj
7               6                                            dfgasgf
8               7                                             jfhkgj
9               8                                           djfgjfhk
10              9                                            dsfasys
11             10                                            kghkfdy
12             98                                          dsfhsuert
13             99                                           wsdfadjs
14  country_satis  Sa pangkagab'san, aoogma po ba kamo o dai naoo...
15              1                                            Naoogma
16              2                                        Dai naoogma
17              8                           Dai aram (HUWAG BASAHIN)
18              9                           Huminabo (HUWAG BASAHIN)
19            NaN                                                NaN

I am trying to take chunks of data, as in, take ladder_now and all the values associated with it, then find country_satis and take those values, put them in a separate dictionary. Here is the logic I have.. just missing the dynamically created dict:
for index, row in df.iterrows():
    j = 0
    if isinstance(row['REFERENCE_CODE'], str):
        if j == 0:
            # fix dynamically changing dict here
            trend_dict = {}
            trend_dict[row['REFERENCE_CODE']] = row['TRANSLATION']
        else:
            j = 0
            # create new dynamically named dictionary
            next_dict = {}
            next_dict[row['REFERENCE_CODE']] = row['TRANSLATION']
    else:
        trend_dict[row['REFERENCE_CODE']] = row['TRANSLATION']
        j += 1

So essentially, I would like to have dict_ladder_now as one dictionary which contains all key, value pairs of everything below it until it reaches country_satis, and then a dict_country_satis as another.

A: Instead of trying to generate a dynamic number of variable names on the fly, You should instead opt for a different higher level data-structure to store your objects, such as a dictionary or a list.
import pandas as pd
REFERENCE_CODE = ["ladder_now", 0, 1, 5, 15, "country_satis", 20, 50, 100, "test3", 10, 50, 90]
TRANSLATION = list(range(len(REFERENCE_CODE)))
df = pd.DataFrame({"REFERENCE_CODE": REFERENCE_CODE,
                   "TRANSLATION": TRANSLATION
                   })
print(df)
#Output: Dummy data prepared for reference
   REFERENCE_CODE  TRANSLATION
0      ladder_now            0
1               0            1
2               1            2
3               5            3
4              15            4
5   country_satis            5
6              20            6
7              50            7
8             100            8
9           test3            9
10             10           10
11             50           11
12             90           12

Using a list: Using a list, and the logic written in the original question
result = [] #container list that grows dynamically
for index, row in df.iterrows():
    j = 0
    if isinstance(row['REFERENCE_CODE'], str):
        if j == 0:
            # fix dynamically changing dict here
            result.append({}) #new dictionary in container
            result[-1][row['REFERENCE_CODE']] = row['TRANSLATION']
        else:
            j = 0
            # create new dynamically named dictionary
            result.append({}) #new dictionary in container
            result[-1][row['REFERENCE_CODE']] = row['TRANSLATION']
    else:
        result[-1][row['REFERENCE_CODE']] = row['TRANSLATION']
        j += 1

Note that the way the logic is written, you can simplify it to the following. the j variable is not being used, and the same line of code is written in almost every block. That ends up with something like this:
result = []
for index, row in df.iterrows():
    if isinstance(row['REFERENCE_CODE'], str):
        result.append({})
    result[-1][row['REFERENCE_CODE']] = row['TRANSLATION']

print(result)
#Output:
[{'ladder_now': 0, 0: 1, 1: 2, 5: 3, 15: 4},
 {'country_satis': 5, 20: 6, 50: 7, 100: 8},
 {'test3': 9, 10: 10, 50: 11, 90: 12}]

Using a dict: A dictionary container may be nicer here, as you can refer to the sub dictionaries by name.
result_dict = {}
for index, row in df.iterrows():
    if isinstance(row['REFERENCE_CODE'], str):
        key = row['REFERENCE_CODE']
        result_dict[key] = {}
    result_dict[key][row['REFERENCE_CODE']] = row['TRANSLATION']
print(result_dict)
#Output:
{'ladder_now': {'ladder_now': 0, 0: 1, 1: 2, 5: 3, 15: 4},
 'country_satis': {'country_satis': 5, 20: 6, 50: 7, 100: 8},
 'test3': {'test3': 9, 10: 10, 50: 11, 90: 12}}

Note that you may want to further modify the logic of the if block, especially since i am not sure you would want the string keys to reappear inside the sub dictionary. However, this should give you an idea of how you can tackle creating dynamic number of items.


text:
Q: Playing mp3 attach href link to audio control I've created a link to play mp3 from and certain point and end at a certain point

<audio id="sample" src="Hard To Say I'm Sorry.mp3" controls preload></audio>

Play1

My question, how do I put the href "Play1" link into the audio control?


text:
Q: JQuery definition added in TypeScript code but it's not becoming part of transcompiled JS file I learnt that if I install and import TypeScript libraries, they will be compiled to JS and included in the JS build output but that is not the case with below script and I don't know why.
main.ts
/// <reference path="../typings/globals/jquery/index.d.ts" />
var data  = "Hello Tahir";
$("div").text(data);

Above code produces no errors and trans-compiles to
main.js
/// <reference path="../typings/globals/jquery/index.d.ts" />
var data = "Hello Tahir";
$("div").text(data);
//# sourceMappingURL=main.js.map

As you can see jQuery library is not part of final output and hence my code produces below error in browser's console

ReferenceError: $ is not defined

For me the only way to resolve this issue is to add jquery to header of my template file like
<script
        src="https://code.jquery.com/jquery-3.1.1.js"
        integrity="sha256-16cdPddA6VdVInumRGo6IbivbERE8p7CQR3HzTBuELA="
        crossorigin="anonymous"></script>

But I believe this is not the proper way to do the stuff, there must be something that I am missing.
Need guidance, thanks !

A: The .d.ts files contain the defintions of the types of an external library; they are not the same as the external library itself. The typings are dropped when transpiling your TypeScript code into JavaScript, because JavaScript doesn't have explicit typing. As a consequence, the .d.ts file has no use in the transpiled code. It is just there to enable the TypeScript transpiler to do type checking for the external library.
To solve your problem, you have to copy the JQuery file you are using to your own scripts folder (or whatever folder your scripts go) and you have to reference this script file in your HTML header.


text:
Q: Files in folder /run/udev/data Does someone know, when and how the files in this folder /run/udev/data are generated.
I ask because I have a program, which needs udev in jail. But the version in jail is newer (version 208) than the version of my CentOS 6.6 system (version 147). The udev version in jail searches for files in directory /run/udev/data, but on CentOS 6.6, there is no such a directory.
Edit: To be more clear: I install an external software on my CentOS 6.6 System. This external software uses udev, but the udev version which is shipped with the software is newer than the software of my CentOS 6.6 system. This newer udev searches for /run/udev which isn't on my host system and because of this also not in jail.

A: In older versions the udev database was located under /dev/.udev/db. In newer versions it is located under /run/udev/data. From a quick browsing it appears to me that also the contents has changed a bit, so not sure whether just copying around the files (or creating symbolic links) will work.
I have successfully copied /run/udev/data from a host (running systemd-udevd) into a container (not running systemd-udevd) However, libudev was the same version on both the host and inside the container. (This was just a proof of concepts. I'm not sure whether that results in a stable and secure system.)
To my understanding the udevd (systemd-udevd) writes the files. Other programs access them using libudev.


text:
Q: Vertical align a marginpar with the *first* line of a 2-line statement I have an article in which I'd like to use margin notes near some text (some minor headings, equivalent with a subsubsubsection).
In some cases that text runs on two lines. I'd like the margin note to be vertically align with the first line of those two, not the second (as it happens now as seen in the screenshot).

Is it possible? Many thanks in advance.
\usepackage{mparhack}
\reversemarginpar

% <snip>
\textbf{Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.}
\marginpar{\sc{\small{Case~1}}}

A: Wouldn't moving the \marginpar to the front of your text work for you? E.g., \newcommand{\mysubsubsub}[2]{\textbf{\marginpar{\sc{\small{#1}}}#2}}.

A: Usually it helps to place the marginpar content near the beginning of the considered paragraph.
\documentclass[11pt,a4paper]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{mparhack}

\reversemarginpar

\begin{document}
  \textbf{Lorem\marginpar{\textmd{\textsc{\small Case 1}}} ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.}
\end{document}


text:
Q: .htaccess rewrite id I'm trying to prevent a "messy" URL for people to see, when they hover over the link. Like this one:
http://screensnapr.com/v/4z84A3.png
Now, I have it in the .htaccess as this:
RewriteEngine On
RewriteRule ^forms/([0-9]+).*/?$ _lib/forms/report.php?id=$1 [L,QSA]

but apparently I'm doing something wrong. This is my link:
<a style="float: right;padding-right: 15px; color: #3BC3C0;" href="../../_lib/forms/report.php?id=<?php echo $row['id'] ?>" rel="facebox">

Do you guys happen to know what I'm doing wrong?

A: RewriteRule forms/(\d+)/.*$ /foldername/foldername/_lib/forms/report.php?id=$1

HTML
<a style="float: right;padding-right: 15px; color: #3BC3C0;" href="/foldername/foldername/_lib/forms/report.php?id=<?php echo $row['id'] ?>" rel="facebox">

You need to use absolute urls for your links so don't use ../../_lib/forms use /foldername/foldername/_lib/forms/ then update the path portion in the rewrite rule I have with that path as well.

A: Try this:
RewriteRule ^forms/([0-9]\d*)/.*$ /_lib/forms/report.php?id=$1

This is assuming your _lib directory is in the Document Root of the website. It's better to provide an explicit path to the PHP file from the Document Root.


text:
Q: Checking properties for each file recursively in Bash I've been trying to make a bash script that starts at a folder, namely my home folder, then gets each file recursively and checks for some properties. Say I want to check to see if my files have a certain size and have text (not binary data) in them. It should take care of the special cases where the files are hidden or starting with a hyphen. This is what I came up with:

for i in $(cd "/home/user" && ls -aR);
do
    if [[ $(file ./"$i") == "./\"$i\": ASCII text" ]] && [[ $(du -b ./"$i" | grep -oE "[0-9]+") == "1015" ]]; then
        echo ./"$i"
    fi
done

I don't know how many subfolders there are, and I need it to echo the path of the files that meet the criteria. It works ok for files in /home/user/ but it doesn't seem to find (and thus check) the files in any subfolder. How may I fix this?

A: I'm going to assume you are using bash 4 unless otherwise stated.
shopt -s globstar
for f in /home/user/**/*:
    if [[ $(file -- "$f") != *": ASCII text" ]]; then
        continue
    fi
    # This is the syntax for GNU stat; consult your manual for
    # other implementations
    size=$(stat -c %s -- "$f")
    if (( size != 1015 )); then
        continue
    fi

    echo "$f"
done

A: I would separate traversing the file tree from checking the individual files.
Start by writing a script which examines a single file and prints the file name to stdout if the file matches your criteria. Let's call this script check_file. Now use, for instance,
find /home/user -type f -exec check_file {} \;


text:
Q: Are there MVC/JPA tutorials without using Spring? this is my first post here.
I am searching for some examples or tutorials for web application using JPA and MVC. All the tutorials and examples that I found so far are related using Spring. I am new on using JPA/MVC and I am finding a little difficult to understand how Spring works. Can anyone recommend me a good tutorial or a simple example without Spring?

A: Watch this videos its easy to understand : http://m.youtube.com/user/koushks?gl=US&hl=en&client=mv-google

A: For what's it worth, the concept 'clicked' for me through this book. A bit dated now, but the basics stay the same. Other than that you can just as well find a bunch of simple tutorials and presentation if you search for something like 'java servlets basic mvc tutorial'


text:
Q: adding in the database with json type not working i want to show in my project made with Laravel the avaibility of the doctor , with type json to show the avaibility in the morning and in the afternoon like this :
Monday_morning:["8:30" ; "12:30"]
So at first it was working , but after it just show me this one :
Monday_morning: "12:30"
with the last time added
So this is my controller :
 'lun_mat1' => 'nullable',
            'mar_mat1' => 'nullable',
            'mar_ap1' => 'nullable',
            'mer_mat1' => 'nullable',
            'mer_ap1' => 'nullable',
            'jeu_mat1' => 'nullable',
            'jeu_ap1' => 'nullable',
            'ven_mat1' => 'nullable',
            'ven_ap1' => 'nullable',
            'sam_mat1' => 'nullable',
        $medecin= new doc() ;

        $medecin->Lun_mat_de=$request->input('lun_mat1');
        $medecin->Lun_apres_a=$request->input('lun_ap1');

        $medecin->Mar_mat_de=$request->input('mar_mat1');
        $medecin->Mar_apres_a=$request->input('mar_ap1');

        $medecin->Mer_mat_de=$request->input('mer_mat1');
        $medecin->Mer_apres_a=$request->input('mer_ap1');

        $medecin->Jeu_mat_de=$request->input('jeu_mat1');
        $medecin->Jeu_apres_a=$request->input('jeu_ap1');

        $medecin->Vend_mat_de=$request->input('ven_mat1');
        $medecin->Vend_apres_a=$request->input('ven_ap1');

        $medecin->Sam_mat_de=$request->input('sam_mat1');

        $medecin->save();
return redirect()->back()->withSuccess('medecin ajouter' ) ;

And this is the model  :
 protected  $table = 'doctors' ;
    protected $primaryKey = 'ID';
    protected $fillable = [
        'ID' ,
        'Photo' ,
        'demande',];

        protected $casts = [

        'Lun_mat_de' =>'array',
        'Lun_apres_a' =>'array',

        'Mar_mat_de' =>'array',
        'Mar_apres_a' => 'array',

        'Mer_mat_de' =>'array',
        'Mer_apres_a' =>'array',

        'Jeu_mat_de' => 'array',
        'Jeu_apres_a' => 'array',

        'Vend_mat_de' => 'array' ,
        'Vend_apres_a' => 'array',

        'Sam_mat_de' => 'array',

        ];

and finaly this is the form :

Avaiability of doctor

   Monday morning

  <input type="time"  name="lun_mat1" />

  <input type="time"  name="lun_mat1" />

  Monday afternoon

  <input type="time"  name="lun_ap1" />

  <input type="time"  name="lun_ap1" />

  <input type="checkbox"  name="rememberMe"> Fermer

   Tuesday morning

  <input type="time"  name="mar_mat1" />

  <input type="time"  name="mar_mat1" />

   Tuesday afternoon

  <input type="time"  name="mar_ap1" />

  <input type="time"  name="mar_ap1" />

  <input type="checkbox"  name="rememberMe"> Fermer

   Wedensday Morning

  <input type="time"  name="mer_mat1" />

  <input type="time"  name="mer_mat1" />

   Wedensday afternoon

  <input type="time"  name="mer_ap1" />

  <input type="time"  name="mer_ap1" />

  <input type="checkbox"  name="rememberMe"> Fermer

   Thursday morning

  <input type="time"  name="jeu_mat1" />

  <input type="time"  name="jeu_mat1" />

   Thursday afternoon

  <input type="time"  name="jeu_ap1" />

  <input type="time"  name="jeu_ap1" />

  <input type="checkbox"  name="rememberMe"> Fermer

   friday morning

  <input type="time"  name="ven_mat1" />

  <input type="time" name="ven_mat1" />

   Friday afternoon

  <input type="time" name="ven_ap1" />

  <input type="time"  name="ven_ap1" />

  <input type="checkbox"  name="rememberMe"> Fermer

   Saturday morning

  <input type="time" name="sam_mat1" />

  <input type="time"  name="sam_mat1" />

  <input type="checkbox"  name="rememberMe"> Fermer

A: I think problem you are facing is here:

    Monday morning

          <input type="time"  name="lun_mat1" /> /* input name is supposed to be like this lun_mat1[] */

          <input type="time"  name="lun_mat1" /> /* input name is supposed to be like this lun_mat1[] */

It's wrong because you want to get lun_mat1 as array, but both of your above input name is the same, it should be changed to this for retrieving array value when posting to controller:

    Monday morning

          <input type="time"  name="lun_mat1[]" />

          <input type="time"  name="lun_mat1[]" />

With this, you can apply this rule for all of your input, if you want to retrieve array data when posting to controller, add [] after the input name


text:
Q: A proper way to bundle realm file using Swift I've tried to bundle my pre-populated Realm file with my app. I copied if and add the copy bundle resources area in Build Phase. But every time started the app, I can't pull the data. When I look at the file my app has created on the device, the classes are there they are empty.
Here's how I fetch the objects
var allTrees: Results<trees>?
allTrees = realm.objects(trees.self)
print(allTrees?.count ?? 0) // always zero

My AppDelegate setup
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
    application.statusBarStyle = .lightContent

    let bundlePath = Bundle.main.path(forResource: "default", ofType: ".realm")
    let destPath = Realm.Configuration.defaultConfiguration.fileURL?.path
    let fileManager = FileManager.default

    if fileManager.fileExists(atPath: destPath!) {
        //File exist, do nothing
        print(destPath ?? "if loop")
    } else {
        do {
            //Copy file from bundle to Realm default path
            try fileManager.copyItem(atPath: bundlePath!, toPath: destPath!)
        } catch {
            print(error)
        }
    }

    return true
}

My model class
class trees: Object {
    @objc dynamic var turkishName = ""
    @objc dynamic var latinName = ""
    @objc dynamic var seedTpye = true
    @objc dynamic var leafType = true
    @objc dynamic var botanicProperties = ""
    @objc dynamic var spreadingArea = ""
}


text:
Q: How to eliminate halo on blurred edge? So I am working on a filter that performs a blur.
When the image has an alpha channel, it is blurring incorrectly. This is because it is blurring with the colored pixels that lie on the alpha=0 sections.
I have created an example to illustrate. In the top-left image, we have the original. It has an alpha channel but I have it disabled.
In the top-right image, I am importing it with the alpha channel. It displays the pixels in the alpha channel section as black.
In the bottom-left image, I have performed my blur algorithm. You can see that the edges have a bright halo because they are blurring against the light colored background pixels shown in the first image, even though the alpha channel is there.
In the bottom-right image, I have composited it against a background so that you can see it is compositing incorrectly.

I have read that this might be a premultiplication issue. I have premultiplied the RGB pixels that lie on the alpha=0 sections by black but it is still incorrect. When I composite that version, you can see it creates a dark halo instead of a bright one.
It seems that I would need to know the RGB values of the destination image but that is impossible to know as the user will determine that.
So what am I doing wrong? How can I adjust my algorithm so that it blurs the edges correctly and not against the background brighter pixels, thus creating a bright halo?
I appreciate any help on this as I'm really stuck!

A: Blurring works by averaging the pixels in some neighborhood of the target pixel. As you reach the boundaries of the foreground objects, the algorithm has little other choice than taking pixels from the background as well.
If you don't want to get any mixture with the background pixels, you have to modify the blur algorithm so that it only uses foreground pixels i.e. assigns a zero weight to any background pixel.
Anyway, doing this, you will somewhat lower the amount of blur at the edges. There is no perfect solution.


text:
Q: Specifying complex structure with meta tag in Microdata How can I tag information that is not displayed on the page with the Microdata format?
Typically, we do not want to display publisher/author info on the page, but Google requires this info for Articles, and they have a complex structure.
I do not want to put this data in hidden span/div or anything, so I thought I'd use the meta tag. But how do I specify the logo and name of the publisher entity using metas? Do I need to use itemref somehow?

 <meta itemprop="keywords" content="kw1, kw2" />
 <meta itemprop="publisher" content="© My Company" />

I've already looked at Using a different image for microdata that isn't displayed in the article?, but is it possible to achieve what I want without using JSON-LD? If no, can I use both JSON-LD and meta/tag descriptions?

A: I think you have two (in some cases three) options using Microdata.
meta/link + div
The most simple solution is to use meta/link elements for properties with non-item values, and div elements for properties with item values.

  <meta itemprop="keywords" content="kw1, kw2" />

    <meta itemprop="name" content="My Company" />

meta/link elements are hidden by default, and div elements that contain nothing else than meta/link elements don't show anything either.
meta/link + itemref
If you don't want to use div elements, it's possible to use meta elements for representing an item. But then you have to

*

*provide an empty content attribute (ugly), and

*use the itemref attribute for every property you want to add to this item.

<meta itemscope itemprop="publisher" content="" itemtype="https://schema.org/Organization" id="pub" itemref="pub-name" />

<meta itemprop="name" content="My Company" id="pub-name" />

  <meta itemprop="keywords" content="kw1, kw2" />

Note that this does not work for top-level items, because the meta element requires an itemprop attribute (which can't be empty).
(meta/link +) itemid
In some cases it might be possible to reference URIs for the items (instead of embedding them), e.g., if you have another page that contains the data about the publisher.
However, note that it's not clear if Google supports this.

  <meta itemprop="keywords" content="kw1, kw2" />
  <link itemprop="publisher" href="/publisher#this" />

My Company


text:
Q: Notepad++ regex get 2nd group I have a tex with 32k lines like this example
A01.2 Some Text
A01.3 some Text
A01.4 3Some Text
A02.0 [some text]
B02.1 Text .05 example

I need to replace white spaces with ';' symbol.
I tried (\S{3}\.\d)(\s) but notepad++ highlights/gets both groupsB02.1 with whitespace.
1st question: how do i disable 1st group, or take only 2nd
2nd question: is there another expression do find only this white space?
Here is the real example:

A: If you want to replace the whitespace by ;, so this B02.1 will be B02.1; using notepad++; since you're capturing the groups then use $ notation in the replace expression.
Find: (\S{3}\.\d)(\s)
Replace: $1;
$1 is for the first captured group.
Hope it helps,

A: *

*You disable the first group simply not grouping it:
\S{3}\.\d(\s)

Otherwise, the look-behind may suite your case:
(?<=\S{3}\.\d)(\s)

A: Use a lookbehind so B02.1 won't get matched:
(?<=\S{3}\.\d)(\s)


text:
Q: How to install python-devel when using virtualenv Before asking my question, let me introduce my computing environment first.

*

*OS: Red Hat Enterprise Linux Server 6.5.

*Python: Python 2.6 (by rpm install), Python 2.7 (based on virtualenv)

Question:
I want to install a library that requires python-devel.  However, when using
    yum install python-devel

The system installs python-devel-2.6.*, because the installed (yum-packaged) python is version 2.6.  My question is , how to install python-devel that matches the version of the python in virtualenv (which is version 2.7 in my case).
Thanks!

A: This question has nothing to do with pip or virtualenv. python-dev is a Linux system package, not something you install with pip. You just need to explicitly install python-devel-2.7 - you can search your distribution's package repository for the exact package name.


text:
Q: Is it possible to capture microphone in background? One company asked me to make a demo version of their software. After couple hours searching I have come to the conclusion their requirements are not maybe possible.
Problem is capturing microphone in background, even the program is not in use or active. Of course it would be asking of the user permission for that, but is that even possible.
Here is one article: https://www.theverge.com/2018/3/7/17091104/android-p-prevents-apps-using-mic-camera-idle-background
I am not special with Android systems, but is this the end of my project?
The purpose is made this demo with Java. It is "easy" to make an app which is listening microphone and comparing this recorder sound with given sound. In bytes. But in background.. Driving me crazy. Have not found any discussion of this kind of mic using. So thats why i am here guys.
https://developer.android.com/guide/topics/media/mediarecorder

Note: On devices running Android 9 (API level 28) or higher, apps running in the background cannot access the microphone. Therefore, your app should record audio only when it's in the foreground or when you include an instance of MediaRecorder in a foreground service.

If i am understand this right, this kind of app not working on any newer Androids?
Thanks.

A: On devices running Android 9 (API level 28) or higher, apps running in the background cannot access the microphone. Therefore, your app should record audio only when it's in the foreground or when you include an instance of MediaRecorder in a foreground service.


text:
Q: Python Random function Write a program to create an array of random numbers between 1000 to 2000
and count the number of values that are higher than 1500.
I've kind of have the understanding of setting the range, but not counting the number of returns.
What I have is this:
import random
for x in range(20):
     a=random.randint(1000,2000)
     b=(a>1500)
     print b
print

this simply returns Trues or Falses, I need to know the total number of numbers over 1500 not if they are or aren't Thanks

A: This is how you do it, assuming your original code is correct in other respects:
import random
count = 0
for x in range(20):
     a=random.randint(1000,2000)
     # b=(a>1500)// This is expected to give a boolean
     # print b
     if (a > 1500):
        count = count + 1

print count


text:
Q: File picker. Import from another workbook's sheet I'm trying to create file picker to import sheet from another workbook. Workbook can be any path. Here is the code but something going wrong with file name. If anybody solved it before please help what's wrong here
Sub Main()
Dim fd As FileDialog
Set fd = Application.FileDialog(msoFileDialogFilePicker)
Dim vrtSelectedItem As Variant
With fd
  .AllowMultiSelect = True
  If .Show = -1 Then
    For Each vrtSelectedItem In .SelectedItems
      Application.ScreenUpdating = False
      Dim path As String
      Dim file_name As String
      Workbooks.Open Filename:=path & file_name
      Set closedBook = Workbooks.Open("File_name As String")
      closedBook.Sheets("INPUT").Copy Before:=ThisWorkbook.Sheets(1)
      closedBook.Close SaveChanges:=False
      Application.ScreenUpdating = True
      Worksheets("INPUT (2)").Visible = False
    Next
  Else
  End If
End With
Set fd = Nothing
End Sub

A: This is modified snippet from something I've used in the past. I'm not certain if FileDialogue works the same, but it's likely somewhat similar, so could probably be modified to work with it instead. Hopefully it helps.
Sub Main()
Dim dataFiles As Variant
Dim dataWorkbook As Workbook
Dim fileCount As Integer

    dataFiles = Application.GetOpenFilename(MultiSelect:=True)
    If IsArray(dataFiles) Then
        For fileCount = LBound(dataFiles) To UBound(dataFiles)
            Set dataWorkbook = Workbooks.Open(dataFiles(fileCount))
            'whatever you want to do here
            dataWorkbook.Close SaveChanges:=False
        Next fileCount
    Else: Exit Sub
    End If
End Sub


text:
Q: How to set new joomla template I  have created my own template for Joomla and now I want to apply it to my site. However, when I logged in to the adminstrator --> extensions --> Template Manager, my template was not there. So, I got confused. I already put all of them into an appropriate folder and try to zip them, try other couple of tutorials in the Internet. The Template Manager just does not recognize my template, no error

A: Are you using Joomla 1.6? If so, you may need to "discover" your new template.
This can be done by going to Extensions -> Extension Manager and clicking the Discover tab at the top. Do a refresh and check if your new template shows up. If it does, then you also have the option to install it from here and then it should show up in the template manager.

A: You need to have a valid templateDetails.xml for the template to show up in the template manager. You do not have to install the template through the installer, you can just upload the files.