text:
Q: python pandas translate text to english Hello I have a DataFrame from pandas that looks like this:
import pandas as pd
df = pd.DataFrame({"language": ["en", "it", "en", "it"],
                   "text": ["Hello", "Ciao", "This is english text", "Questo è un testo italiano"]})

I would like to translate all italian text to english.
How can I do this?

A: I agree that it is probably not a very good design like nbk has pointed out already.
I've answered something similar here a few days ago which might be helpful.
To answer your question:
Using google translator, you can do:
from deep_translator import GoogleTranslator
gt = GoogleTranslator(source='it', target='en')
df.loc[df.language == 'it', 'text'] = df.loc[df.language == 'it', 'text'].apply(gt.translate)


text:
Q: NSSlider custom subclass - how to maintain the link between the knob position and user interaction? Trying to create a custom NSSlider. Overriding the drawKnob() method of the NSSliderCell changes the knob's appearance but doing this somehow disconnects the link between the knob's position and user interactions with the slider.
In the objective C example that is often referenced (https://github.com/lucasderraugh/LADSlider) it looks like when you override drawKnob() you then need to explicitly deal with the startTracking method, but I haven't found a solution that works for me - at the moment I am just setting the cell's startTracking 'at' property to the current value of the slider, but not sure what the right approach is.
Quite a few examples include an NSCoder argument in the cell's custom initialiser - I don't understand why, but maybe this has something to do with ensuring a connection between the display of the knob and the actual slider value?
import Cocoa

class ViewController: NSViewController {

    var seekSlider = NSSlider()
    var seekSliderCell = SeekSliderCell()

    override func viewDidLoad() {

        super.viewDidLoad()
        seekSlider = NSSlider(target: self, action: #selector(self.seek(_:)))
        seekSlider.cell = seekSliderCell
        seekSlider.cell?.target = self
        seekSlider.cell?.action = #selector(self.seek(_:))
        seekSlider.isEnabled = true
        seekSlider.isContinuous = true
        view.addSubview(seekSlider)
    }

    @objc func seek(_ sender: NSObject) {

        let val = seekSlider.cell?.floatValue
        let point = NSPoint(x: Double(val!), y: 0.0)
        seekSlider.cell?.startTracking(at: point, in: self.seekSlider)
    }
}

class SeekSliderCell: NSSliderCell {

//  required init(coder aDecoder: NSCoder) {
//      super.init(coder: aDecoder)
//  }

    override func drawKnob() {

        let frame = NSRect(x: 0.0, y: 6.0, width: 20.0, height: 10.0)
        let c = NSColor(red: 0.9, green: 0.0, blue: 0.6, alpha: 1.0)
        c.setFill()
        NSBezierPath.init(roundedRect: frame, xRadius: 3, yRadius: 3).fill()
    }

    override func startTracking(at startPoint: NSPoint, in controlView: NSView) -> Bool {

       return true
    }
}

A: The documentation of drawKnob() states:

Special Considerations
If you create a subclass of NSSliderCell, don't override this method. Override drawKnob(_:) instead.

Instead of
func drawKnob()

override
func drawKnob(_ knobRect: NSRect)

Example:
class ViewController: NSViewController {

    var seekSlider = NSSlider()
    var seekSliderCell = SeekSliderCell()

    override func viewDidLoad() {
        super.viewDidLoad()
        seekSlider = NSSlider(target: self, action: #selector(self.seek(_:)))
        seekSlider.cell = seekSliderCell
        seekSlider.cell?.target = self
        seekSlider.cell?.action = #selector(self.seek(_:))
        seekSlider.isEnabled = true
        seekSlider.isContinuous = true
        view.addSubview(seekSlider)
    }

    @objc func seek(_ sender: NSObject) {
        let val = seekSlider.cell?.floatValue
        print("\(String(describing: val))")
    }

}

class SeekSliderCell: NSSliderCell {

    override func drawKnob(_ knobRect: NSRect) {
        var frame = NSRect(x: 0.0, y: 6.0, width: 20.0, height: 10.0)
        frame.origin.x = knobRect.origin.x + (knobRect.size.width - frame.size.width) / 2
        frame.origin.y = knobRect.origin.y + (knobRect.size.height - frame.size.height) / 2
        let c = NSColor(red: 0.9, green: 0.0, blue: 0.6, alpha: 1.0)
        c.setFill()
        NSBezierPath.init(roundedRect: frame, xRadius: 3, yRadius: 3).fill()
    }

}

redpajama_set_name: RedPajamaStackExchange


text:
Q: regex lookbehind with optional word lookups I need to pull the names out of these strings (ex: "L. Odem" or "A. Bargani")
Technical foul by L. Odom
Offensive foul by A. Bargnani (drawn by D. Granger)
Flagrant foul type 1 by B. Miller (drawn by J. Smith)
Flagrant foul type 1 by A. Croshere
Flagrant foul type 2 by M. Olowokandi
Away from play foul by R. Rogers
Offensive foul by T. MacCulloch
Personal foul by D. George

Here's what I tried:
"(?<=foul by ).*"

This works for most but is tripped up by the flagrant fouls that have either "type 1" or "type 2" between "foul" and "by", or the strings that end with parenthetical info which always begins with "(drawn by
I feel like I'm close but could use some help to address these hurdles.
Thanks much!

A: You may add a second alternative to the lookbehind and use [^()]+ or [^()]*[^()\s] to match the names up to the first (:
(?<=foul by |foul type [12] by )[^()]*[^()\s]

See the regex demo. In R, use
stringr::str_extract(x, "(?<=foul by |foul type [12] by )[^()]*[^()\\s]")

Regex details

*

*(?<=foul by |foul type [12] by ) - either foul by or foul type 1 by or  foul type 2 by must appear immediately to the left of the current location

*[^()]* - 0 or more chars other than ( and )

*[^()\s] - a char other than whitespace, ( and ).

Alternatives:
stringr::str_match(x, "foul(?:\\s+type\\s+\\d+)?\\s+by\\s+([^()]*[^()\\s])")[,2]

This will find the names even if the whitespaces between foul, type, etc. are inconsistent, and \d+ will match 1, 12, etc. (any 1+ digits)
regmatches(x, regexpr("foul(?:\\s+type\\s+\\d+)?\\s+by\\s+\\K[^()]*[^()\\s]", x, perl=TRUE)

This regex is a base R variation with a PCRE regex, it also allows inconsistent use of whitespace and any 1+ digits after type.
Details

*

*foul - a foul string

*(?:\s+type\s+\d+)? - an optional sequence

*

*\s+type\s+ - type enclosed with 1+ whitespaces

*\d+ - 1+ digits

*\s+by\s+ - by enclosed with 1+ whitespaces

*\K- match reset operator.


text:
Q: assign dataset from different project as a datasource to bindingsource In visual studio designer at design time I'd like to set DataSource property of BindingSource to a Dataset that is located in a different project.
Looks like designer limits choices of DataSource only to the current project, Is there a way to override that behavior?

A: You can use the 'Data Source Configuration Wizard' to set the DataSource property of a BindingSource to a DataSet in another project.
Add the project that the DataSet is defined in as a reference in your project where your BindingSource is.  Select to 'Add a Project Data Source' in your BindingSource's DataSource property and on the 'Data Source Configuration Wizard' select Object and click click Next.  On the next screen of the Wizard you'll see a namespace representation of the assemblies in your project.  You should be able to drill down to your DataSet from here.
If you don't see it, be sure you rebuild your solution and try again.

A: The other project needs to be a dll. If it is than declare that DataSet public and add the namespace of that DataSet to your file after adding reference to that project.


text:
Q: Populating a Telerik Grid using ViewModel (MVC3) Ok, this is a really newbie question but I am stumped.
I am trying to use a ViewModel to get my data from an entity object and populate the telerik mvc grid.
At this point I am a bit confused and need your help.
I understand the error message but I am not sure how I need to fix this since I am really new to MVC.
----ERROR----

Error 1 Cannot implicitly convert type 'System.Linq.IQueryable' to 'System.Linq.IQueryable'. An explicit conversion exists (are you missing a cast?) ProjectRepository.cs 23 20 MvcMyAPP

I have this viewmodel:
--VIEWMODEL--
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.UI.WebControls;

namespace mvcMyModel.ViewModels
{
    public class ProjectViewModel
    {
        public IQueryable<mvcMyAPP.Models.ProjectRepository> ProjectList
        {
            get;
            set;
        }
    }
}

--CONTROLLER--
namespace MvcMyAPP.Controllers
{
    public class HomeController : Controller
    {
        // GET: /Home/
        ProjectRepository Repository = new ProjectRepository();

        public ActionResult Index()
        {
            ProjectViewModel objProjectViewModel = new ProjectViewModel();
            objProjectViewModel.ProjectList = Repository.GetProjects();
            return View(objProjectViewModel);
            return View();
        }
    }
}

----REPOSITORY (MODEL)-----
namespace mvcMyAPP.Models
{
    public class ProjectRepository
    {

        mvcMyAPP.Models.MYEntities MYDB = new MYEntities();
        //Fetching data from table

        public IQueryable<mvcMyAPP.ViewModels.ProjectViewModel> GetProjects()
        {
            var vProjects = (from tblProjects in MYDB.Projects
                                select tblProjects);
            return vProjects;
        }
    }

---GRID---
@{Html.Telerik().Grid(Model.ProjectList)
.Name(
"Grid")
.Pageable()
.Sortable()
.Filterable()
.Groupable()
.Render();
}

A: You don't need the second return View() in the controller, but that isn't causing any problems.
You might try putting a cast on the return variable from your repository so it is returning the type specified in return:
 // return vProjects;

 // cast the return variable to return type
 return (IQueryable<mvcMyAPP.ViewModels.ProjectViewModel>)vProjects;

I highly recommend Microsoft site for learning MVC, they have a great starting point for learning MVC.
 http://www.asp.net/mvc


text:
Q: Django automatically converting datetime string to local timezone I am adding timestamp in my payload and storing it in the database for every record.
Suppose say a part of my payload is {"content":[{"timestamp":"2017-12-12 08:05:30"}]
This is how I process it.
content['timestamp'] = parser.parse(content['timestamp'],dayfirst=True)

My model has timestamp field as :
timestamp = models.DateTimeField(null=True)

When I check in my database it stores timestamp field as :
2017-12-12 13:35:30

Which should be stored as it is as per my requirement. 2017-12-12 08:05:30
i.e it stores the timestamp field + my local timezone(+5:30) hours.
I want it to store the timestamp field as it is.
I tried other posts where they suggest using del os.environ['TZ'].
Any idea what I may have done which causes this or what could I do to avoid this.
Any help is appreciated.

A: So according to this Question the problem is when django converts datetime to postgres timestamptz in the database.
Postgres prevent timestamp with timezone conversion
So I need to have timestamp field in PostgreSQL
In order to do that , I need to use the answer posted in this question.
Can we have django DatetimeField without timezone?
Where I need to specify USE_TZ = False in the settings.
This makes sure while migrating PostgreSQL considers datetimefield to be converted to timestamp and not timestamptz .

A: You can set a timezone in settings.py
Here is the list of valid timezones:
http://en.wikipedia.org/wiki/List_of_tz_database_time_zones
You can use
TIME_ZONE = 'Asia/Calcutta'
for UTC+05:30
Reference from Selcuk Answer


text:
Q: Stored procedure with conversion date I have a stored procedure that takes on range of dates:
Create Procedure Search_PO
(
@usersID CHAR(10),
@poNo VARCHAR(20),
@poDateFrom Date,
@poDateTo Date,
)
As
Begin
    If (@poNo = '')
    Begin
    Set @poNo = Null
    End
    If (@poDateFrom = '01/01/0001')
    Begin
    Set @poDateFrom = Null
    End
    If (@poDateTo = '01/01/0001')
    Begin
    Set @poDateTo = Null
    End

    Select * From PurchaseOrder p, Users u, Warehouse w
    Where p.warehouseID = w.warehouseID
    and w.usersID = u.usersID
    and u.usersID = @usersID
    and ((p.poNo like '%' + @poNo + '%') or @poNo Is Null)
    and (p.poDate >= convert(date, @poDateFrom, 103) Or @poDateFrom Is Null)
    and (p.poDate <= convert(date, @poDateTo, 103) Or @poDateTo Is Null)
End

This worked normally when I had selected dates where it was below 12(number of months), it throws me back an error of conversion from varchar into date
I believe this is due to the fact that:

*

*Date format in SQL Server is mm/dd/yyyy

*Date format in Visual Studio is dd/mm/yyyy

I tried using this code as a standalone code to check if my conversion is working:
select * from PurchaseOrder where poDate <= convert(date,'31/5/2017',103)
It does work, but when I execute my stored procedure:
exec Search_PO 'US00000001','','1/1/0001','31/5/2017'
It returns me the conversion error again. Thank you in advance for any kind of help.

A: I think the problem is in
exec Search_PO 'US00000001','','1/1/0001','31/5/2017'

You should pass date type parameter on yyyymmdd or yyyy-mm-dd format, not dd/mm/yyyy.
Change it to:
exec Search_PO 'US00000001','','1/01/01','2017/05/31'

And you don't need to convert convert(date, @poDateFrom, 103), its type is DATE already.
just
and (p.poDate >= @poDateFrom Or @poDateFrom Is Null)
and (p.poDate <= @poDateTo Or @poDateTo Is Null)

A: Can you send the dates as text variables and then make the conversion in the stored procedure? You can use SET DATEFORMAT dmy to aling SQL Server and Visual Studio date formats.
With this modification your SP would be like this:
Create Procedure Search_PO
(
@usersID CHAR(10),
@poNo VARCHAR(20),
@poDateFrom_Chr VARCHAR(10),
@poDateTo_Chr VARCHAR(10),
)
As
Begin

DECLARE @poDateFrom DATE
DECLARE @poDateTo DATE

SET DATEFORMAT dmy
SET @poDateFrom = @poDateFrom_Chr
SET @poDateTo = @poDateTo_Chr
SET DATEFORMAT mdy

If (@poNo = '')
Begin
Set @poNo = Null
End
If (@poDateFrom = '01/01/0001')
Begin
Set @poDateFrom = Null
End
If (@poDateTo = '01/01/0001')
Begin
Set @poDateTo = Null
End

Select * From PurchaseOrder p, Users u, Warehouse w
Where p.warehouseID = w.warehouseID
and w.usersID = u.usersID
and u.usersID = @usersID
and ((p.poNo like '%' + @poNo + '%') or @poNo Is Null)
and (p.poDate >= convert(date, @poDateFrom, 103) Or @poDateFrom Is Null)
and (p.poDate <= convert(date, @poDateTo, 103) Or @poDateTo Is Null)

End
Hope it helps.

A: You are currently converting your two date paramenters twice - once in the procdeure declaration (implicitly) and once in your select statement (explicitly). Your procedure is failing at the point where the @poDateFrom and @poDateTo parameters are being implicitly cast as date in the stored procedure declaration.  If you're not in control of the format of the date being passed to your procedure you should change the parameter type to varchar.
i.e.
ALTER Procedure Search_PO
(
@usersID CHAR(10),
@poNo VARCHAR(20),
@poDateFrom VARCHAR(10),
@poDateTo VARCHAR(10),
)

This will avoid the implicit conversion and rely only on your explicit conversion (i.e. convert(date, @poDateFrom, 103) ) which, as you've already shown, will work for string value '31/5/2017'


text:
Q: Interpretation of partial autocorrelogram function The partial autocorrelogram function for the time series I am working with shows a significant spike at lag 1 and a minor one at lag 3. For another time series, it shows the significant one also at lag 1 and another one at lag 6. How do I interpret this in terms of the time persistence of the series?

A: The data has a major change(maybe you should include a causal that explains the large bumps in the data?) and the model before period 19 is different after period 19.  This will "cloud" your ACF/PACF.  If you use the Chow test you can identify a break in the model and then using the last 25 observations, a difference model with an outlier at period 38. I ran this with Autobox(I am affiliated).
[(1-B1)]Y(T) = +[X1(T)][(1-B1)][(+ 96.6698)]   :PULSE            38
                +          +   [A(T)]


text:
Q: Changing the color of a mask OpenCV 3 I want to change the color of my mask which is black to any different color.
Here is my mask

and here is my original image

I know that if I use this function
src.copyTo(dst, mask);

it will allow me to use the mask properly and to have a result like this

However whenever I change the mask color to non black it doesn't make anything to dst Mat.
Is there a way to use a mask with non-black mask?
I don't want to use looping function because I know it'll cost me a lot of processing time.
Thanks

A: I don't write Java, but you can try in C++:
// assume that origin image has 3 channels
cv::Scalar myColor(255,0,255);

// create dst with background color of your choice
cv::Mat dst(src.size(),src.type(),myColor);

// now copy
src.copyTo(dst, mask);

And the result:

A: What you're looking for is a bitwise_and operation performed on the mask and the original image. If I understand you correctly, there is no reason for changing the color of the mask.


text:
Q: What am I doing wrong? Partial Fraction Decomp. $$\int\frac{1-v}{(v+1)^2}dv$$

I think I am supposed to do PFD, but solving for A and B I get zero for both.

$$(1-v) = A(v+1) + B(v+1)$$

let $v = -1$

$$A = \frac{2}{0}, B = \frac{2}{0}$$

So this is undefined? (or infinity?)

A: When the denominator has multiple roots, the method changes a bit. Try
$$\frac A{v+1}+\frac B{(v+1)^2}=\frac{1-v}{(v+1)^2}$$

A: If you're interested in the integration rather than the abstract partial fraction problem, you should make the substitution $u=v+1$, giving
$$
\int\frac{(2-u)du}{u^2}=\int\Big(2u^{-2}-\frac1u\Big)du\,,
$$
then make the backward substitution after doing your simple integration.


text:
Q: How to install different driver versions based on operating system? I've a driver named silabser.sys. I've two different versions of it.
My requirement is to install w1.x1.y1.z1 on WinXP and w1.x2.y2.z2 on Win7.
My Inf file looks like this:
[Version]
Signature="$WINDOWS NT$"
Class=Ports
ClassGuid={4D36E978-E325-11CE-BFC1-08002BE10318}
Provider=%Provider%
DriverVer=12/10/2012,6.6.1.0
CatalogFile=slabvcp_ncr.cat}

[Manufacturer]
%MfgName%=SiLabs, NTamd64

.....

[SourceDisksNames.x86]
1=%Disk_Description%,"silabser.sys",,\x86

[SourceDisksNames.amd64]
1=%Disk_Description%,"silabser.sys",,\x64

Is it possible to achieve this through inf file?
As you can see the DriverVer is hardcoded in the [Version] section.
How do I tell the OS to load different version of the driver for Win7?

A: You can do this, you'll need to format your INF to support multiple OS's. Take a look at this entry in MSDN, it points to an example INF in the WDK.
You can place the specific silabser.sys file in a subdirectory next to the INF file (ie .\win7\silabser.sys and .\xp\silabser.sys). Then you'll want to create DriverInstall_XP and DriverInstall_Win7 sections that point to point the correct driver location in your package.
Using a directory structure to support your versions will allow you to recertify the driver using and INF only update through WHQL (which Silabs helps with) since you haven't renamed it, which is an easier and cheaper option. If you were to rename your SYS files you would have to go through a full WHQL certification again.


text:
Q: How do I add more spacing per item in my NavigationDrawer? I can't seem to find a solution on how to add even more space between each item of my navigation drawer. Here is the image of what it looks like now.
.
I want to my items in my navigation drawer to have even more space in between. I tried android:paddingTop and android:layout_marginTop in my NavigationView of my activity.xml but it doesn't seem to work. How can I add more space between Items?
To help here is my code for my activity.xml
<?xml version="1.0" encoding="utf-8"?>
<androidx.drawerlayout.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".Location.Location"
    android:id="@+id/drawer_layout"
    tools:openDrawer="start"
   >

    <com.google.android.material.navigation.NavigationView
        android:id="@+id/drawerNavigationView"
        android:layout_width="wrap_content"
        android:layout_height="match_parent"
        android:layout_gravity="start"
        app:headerLayout="@layout/navigation_drawer_header"
        app:menu="@menu/navigation_drawer_menu"
        android:fitsSystemWindows="true"
        app:insetForeground="@android:color/transparent">
 </com.google.android.material.navigation.NavigationView>
</androidx.drawerlayout.widget.DrawerLayout>

It might help, here is my Menu.xml
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    tools:showIn="navigation_view">

    <group android:checkableBehavior="single">
        <item
            android:id="@+id/homeNavigationDrawer"
            android:title="Home"
            android:icon="@drawable/icon_home_nav_drawer"
            />
        <item
            android:id="@+id/profileNavigationDrawer"
            android:title="Profile"
            android:icon="@drawable/icon_profile_nav_drawer"
            />

        <item
            android:id="@+id/topicsNavigationDrawer"
            android:title="Topics"
            android:icon="@drawable/icon_latest_news_black"
            />

        <item
            android:id="@+id/settingsNavigationDrawer"
            android:title="Settings"
            android:icon="@drawable/icon_settings"
            />
    </group>
</menu>

A: For more space between each item You can apply following Theme in your styles.xml for Navigation Drawer
style name="NavigationTheme" parent="AppTheme">
<item name="android:textSize">16sp</item>
<item name="android:layout_marginBottom">8dp</item>
</style>

Apply this theme in Navigation Drawer
android:theme="@style/NavigationTheme"


text:
Q: ssis c# script task: 'else' can't catch the correct status for window services I need to use ssis c# script task to check if the service 'AutomationServices' is running on several remote servers (return value of the variable is written to database table). I have the below code, but status shows 'Running' for all servers, even for servers where the service is not running. Why the 'else' part doesn't work?
ServiceController sc = new ServiceController();
sc.ServiceName = "AutomationServices";
sc.MachineName = Dts.Variables["User::Server"].Value.ToString();

if (sc.Status == ServiceProcess.ServiceControllerStatus.Running)
{
    Dts.Variables["User::ServiceStatus"].Value = "Running";
}
else
{
    Dts.Variables["User::ServiceStatus"].Value = "NotRunning";
}

A: i tried to just pass the servicecontroller status to the dts variable to avoid using 'if else', but nothing is passed, the status field is empty in the table, what is missing here? why it doesn't pass the status value ('Running', 'Stopped', etc) to the variable?
ServiceController sc = new ServiceController();
sc.ServiceName = "AutomationServices";
sc.MachineName = Dts.Variables["User::Server"].Value.ToString();

if (sc.Status != null)
        {
        Dts.Variables["User::ServiceStatus"].Value = sc.Status.ToString();
        }


text:
Q: Getting Error when starting HornetQ server I'm learning Spring from the book "Pro Spring 5". In the current chapter we have to use HornetQ as the message broker. I downloaded HornetQ files and in C:\Users\User\Downloads\hornetq-2.4.0.Final-bin\hornetq-2.4.0.Final\bin I open a command prompt and execute run.bat.
My PC is running on Windows 10. I'm also using Java 13.
I'm getting this ouptut :
C:\Users\User\Downloads\hornetq-2.4.0.Final-bin\hornetq-2.4.0.Final\bin>run.bat
A subdirectory or file ..\logs already exists.
***********************************************************************************
"java  -XX:+UseParallelGC  -XX:+AggressiveOpts -XX:+UseFastAccessorMethods -Xms512M -Xmx1024M-Dhornetq.config.dir=..\config\stand-alone\non-clustered-
-Djava.util.logging.manager=org.jboss.logmanager.LogManager Djava.util.logging.config.file=..\config\stand-alone\non-clustered\logging.properties
-Djava.library.path=. -classpath ..\config\stand-alone\non-clustered;..\schemas\;
C:\Users\User\Downloads\hornetq-2.4.0.Final-bin\hornetq-2.4.0.Final\lib\hornetq-aerogear-integration.jar;
C:\Users\User\Downloads\hornetq-2.4.0.Final-bin\hornetq-2.4.0.Final\lib\hornetq-amqp-protocol.jar;
C:\Users\User\Downloads\hornetq-2.4.0.Final-bin\hornetq-2.4.0.Final\lib\hornetq-bootstrap.jar;
C:\Users\User\Downloads\hornetq-2.4.0.Final-bin\hornetq-2.4.0.Final\lib\hornetq-commons.jar;
C:\Users\User\Downloads\hornetq-2.4.0.Final-bin\hornetq-2.4.0.Final\lib\hornetq-core-client.jar;
C:\Users\User\Downloads\hornetq-2.4.0.Final-bin\hornetq-2.4.0.Final\lib\hornetq-jboss-as-integration.jar;
C:\Users\User\Downloads\hornetq-2.4.0.Final-bin\hornetq-2.4.0.Final\lib\hornetq-jms-client.jar;
C:\Users\User\Downloads\hornetq-2.4.0.Final-bin\hornetq-2.4.0.Final\lib\hornetq-jms-server.jar;
C:\Users\User\Downloads\hornetq-2.4.0.Final-bin\hornetq-2.4.0.Final\lib\hornetq-journal.jar;
C:\Users\User\Downloads\hornetq-2.4.0.Final-bin\hornetq-2.4.0.Final\lib\hornetq-native.jar;
C:\Users\User\Downloads\hornetq-2.4.0.Final-bin\hornetq-2.4.0.Final\lib\hornetq-ra.jar;
C:\Users\User\Downloads\hornetq-2.4.0.Final-bin\hornetq-2.4.0.Final\lib\hornetq-rest.jar;
C:\Users\User\Downloads\hornetq-2.4.0.Final-bin\hornetq-2.4.0.Final\lib\hornetq-server.jar;
C:\Users\User\Downloads\hornetq-2.4.0.Final-bin\hornetq-2.4.0.Final\lib\hornetq-service-sar.jar;
C:\Users\User\Downloads\hornetq-2.4.0.Final-bin\hornetq-2.4.0.Final\lib\hornetq-spring-integration.jar;
C:\Users\User\Downloads\hornetq-2.4.0.Final-bin\hornetq-2.4.0.Final\lib\hornetq-stomp-protocol.jar;
C:\Users\User\Downloads\hornetq-2.4.0.Final-bin\hornetq-2.4.0.Final\lib\hornetq-tools.jar;
C:\Users\User\Downloads\hornetq-2.4.0.Final-bin\hornetq-2.4.0.Final\lib\hornetq-twitter-integration.jar;
C:\Users\User\Downloads\hornetq-2.4.0.Final-bin\hornetq-2.4.0.Final\lib\jboss-jms-api.jar;
C:\Users\User\Downloads\hornetq-2.4.0.Final-bin\hornetq-2.4.0.Final\lib\jboss-mc.jar;
C:\Users\User\Downloads\hornetq-2.4.0.Final-bin\hornetq-2.4.0.Final\lib\jnp-client.jar;
C:\Users\User\Downloads\hornetq-2.4.0.Final-bin\hornetq-2.4.0.Final\lib\jnpserver.jar;
C:\Users\User\Downloads\hornetq-2.4.0.Final-bin\hornetq-2.4.0.Final\lib\netty.jar;
C:\Users\User\Downloads\hornetq-2.4.0.Final-bin\hornetq-2.4.0.Final\lib\proton-api.jar;
C:\Users\User\Downloads\hornetq-2.4.0.Final-bin\hornetq-2.4.0.Final\lib\proton-j-impl.jar;
C:\Users\User\Downloads\hornetq-2.4.0.Final-bin\hornetq-2.4.0.Final\lib\proton-jms.jar org.hornetq.integration.bootstrap.HornetQBootstrapServer hornetq-beans.xml"
***********************************************************************************
Unrecognized VM option 'AggressiveOpts'
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.

I would be really grateful if  you could help me with this problem.

A: HornetQ 2.4.0.Final is not compatible with Java 13. You need to use Java 8.
The copyright for Pro Spring 5 is 2017 which probably means most of the book was written in 2016. Java 9 wasn't released until September 2017 and HornetQ 2.4.0.Final was released in December 2013. My point here is that if you're going to use an old book and old software you need to use a comparably old version of Java.
It's also worth noting that the HornetQ code-base was donated to the Apache ActiveMQ community in 2014 and the broker has carried on as ActiveMQ Artemis. There hasn't been a release of HornetQ in the last 7 years or so because of this. However, there are regular releases of ActiveMQ Artemis (2.13.0 was released just a few weeks ago).


text:
Q: ubuntu 14.04 - Samba - How to share from another drive? I am pretty much done setting up my home media computer but I am stuck on one of my last tasks. I am new to linux/Ubuntu so I have a lot to learn about permissions and what not and I'm pretty sure that is what I'm tied up on at this time. So I followed this guide here on how to set samba up and it worked perfectly.
Now I am attempting to share a folder on another drive located at /media/media/Big Drive/Music with no luck. I have spent probably around 8 or so hours over the last 3 days and I keep failing miserably. The folder that I setup using the guide will let me access it and move files in and out, just like you would expect but the other folder I am attempting to share will let me see it on the network folder but I can't even open it. Windows just gives me a network error telling me it cannot access it. How would I go about fixing this?
Since I am new please give me step by step instructions or I may get confused :/ Thanks in advance for all your help

A: It could be the permissions issue. What actually you should do is check your permissions on /media/media/Big Drive/Music:
ls -l /media/media/Big Drive/Music

it could like in your case as this: drwx------- or something like that then proceed like following:
sudo chmod w+r /media/media/Big Drive/Music

but if you want only just let people read files (listen only to music) and not allowing them to write/modify run this:
sudo chmod 774 /media/media/Big Drive/Music


text:
Q: Creating diagrams with LaTeX or R I'm, trying to create an horizontal diagram (like the diagrams you can create with Visio but programatically) in R (to embed it in a LaTeX document) or directly in LaTeX.
So far I've been reading about differnt options and I've tried with Tikz, creating nodes and childs...
\documentclass{article}

\usepackage{tikz}

\begin{document}

\begin{tikzpicture}[grow = right,sibling distance=10em,
every node/.style = {shape=rectangle, rounded corners, draw, align=center, top color=white, bottom color=blue!20}]]

  \node {Formulas}
    child { node {single-line} }
    child { node {multi-line}
      child { node {aligned at}
        child { node {relation sign} }
        child { node {several places} }
        child { node {center} } }
      child { node {first left} }
    };

\end{tikzpicture}

\end{document}

But I get this,

As you can see, It's not automatically fitted properly. Some things overlap, other are very spread...
How do you suggest to create this kind of diagrams/flowcharts, preferably with arrows.
Maybe with the LaTeX package smartdiagram or with R diagrammer or with the package diagram?
I'm looking for the simplest one.
Smartdiagram seems nice but in the examples don't show hoy to create a horizontal tree or flowchart.
There is also a package called schemata that creates a different kind of diagrams, maybe not so beautiful. Anyway its difficulty is similar.

A: I have no idea what or who Visio is. Starting from Emma's answer and changing the structure to that produced by R, which I gather from your spamming is what you want, you can create a skan tree style which formats the tree accordingly.
There are several existing answers on this site illustrating different ways to draw trees with precisely this kind of structure and branches of this shape. Please look at those if you want a different approach.
Forest is the most powerful and flexible programme to draw trees in LaTeX as far as I know, with the exception of the tree layouts supported by the graph-drawing algorithms provided by TikZ itself. Those rely on LuaTeX and will automatically layout your tree, but they obviously require a different approach which may or may not be suitable for your work-flow. The TikZ manual documents thse facilities extensively.
For example,
\documentclass[tikz,border=10pt]{standalone}
\usepackage{forest}
\usetikzlibrary{arrows.meta}
\begin{document}
% addaswyd o ateb Emma: https://tex.stackexchange.com/a/342102/
\forestset{
  skan tree/.style={
    for tree={
      grow=0,
      rounded corners,
      draw,
      top color=white,
      bottom color=blue!20,
      edge={Latex-},
      child anchor=parent,
      %parent anchor=children,
      anchor=parent,
      tier/.wrap pgfmath arg={tier ##1}{level()},
      s sep+=20pt,
      l sep+=20pt,
      edge path'={
        (.child anchor) -- ++(-20pt,0) -- (!u.parent anchor)
      },
    },
    before typesetting nodes={
      for tree={
        content/.wrap value={\strut ##1},
      },
    },
  },
}
\begin{forest}
  skan tree
  [Formulas
    [single-line]
    [multi-line
      [aligned at
        [relation sign]
        [several places]
        [center]
      ]
      [first left]
    ]
  ]
\end{forest}
\end{document}

EDIT
You can override the alignments by overriding tier for particular nodes. For example,
\begin{forest}
  skan tree
  [Formulas
    [single-line
      [relation sign, delay={tier/.wrap pgfmath arg={tier #1}{level("!name=sp")}}]
    ]
    [multi-line
      [aligned at
        [several places, name=sp]
        [center]
      ]
      [first left]
    ]
  ]
\end{forest}

or, with spacing using a phantom,
\begin{forest}
  skan tree
  [Formulas
    [single-line, for children={delay={tier/.wrap pgfmath arg={tier #1}{level("!name=sp")}}}
      [relation sign]
      [, phantom]
    ]
    [multi-line
      [aligned at
        [several places, name=sp]
        [center]
      ]
      [first left]
    ]
  ]
\end{forest}

A: Here is the obligatory recommendation of the forest package for nice automatic tree layout:
\documentclass{standalone}
\usepackage{forest}

\begin{document}
\begin{forest}
  for tree={grow=east, s sep=10em, shape=rectangle, rounded corners,
            draw, align=center, top color=white, bottom color=blue!20}
  [Formulas
    [single-line]
    [multi-line
      [aligned at
        [relation sign]
        [several places]
        [center]
      ]
      [first left]
    ]
  ]
\end{forest}
\end{document}

A: I've found an answer with the R library Diagrammer:
mermaid(" graph LR
        V[Variable]-->A(Dependiente)
        V-->H(No dependiente)
        A-->B(Obligatorio)
        B-->D(Padre oblig.)
        B-->E(Padre NO oblig)
        A-->C(No obligatorio)
        C-->F(Padre oblig.)
        C-->G(Padre NO oblig.)
        H-->I(Obligatorio)
        H-->J(No obligatorio)
        ")

It seems quite fast and automatic.
The problem is that it doesn't generate a LaTeX code. You can just capture the image. I would prefer a solution directly with LaTeX.
Another thing I don't like is the starting position of the arrows emerging from the leftmost node.
There is also a command grViz used in a different way, creating nodes and later edges.
grViz("
digraph boxes_and_circles {
      graph [overlap = true, fontsize = 10]
      node [shape = circle, fixedsize = true, width = 0.9] // sets as circles
      V;A;B;C;D;E;F;G;H
      V->A V->H A->B B->D B->E A->C C->F C->G H->I H->j
            }
      ")

But with grViz I can only get tree  from top to bottom and not from left to right.


text:
Q: Flask 0.11 CLI dev server -- specify host? With Flask 0.11 it is highly recommend to run the dev server from the command line, however, I cannot figure out how to change the host.  I need to access this externally so previously I used app.run(host="0.0.0.0") which worked fine, but I can't find the equivalent for running this from the command line.  I tried setting app.config["SERVER_NAME"] = "0.0.0.0" but the dev server isn't picking this up.

A: You can run with --host option
flask run --host='0.0.0.0'

To see all available options
flask run --help


text:
Q: Is it appropriate to use Cox regression when risk of event is higher at the start of study? as per title, like to check if it is appropriate to use Cox regression when the risk of event appears to decrease with follow-up time?
If it is not appropriate, what model should I be using instead? Thank you.

A: Why would it not be? Cox regression assumes a baseline hazard function that can change over time in any way you want.
The more important question is whether the effect of model covariates stays proportional over time. I.e. in a standard Cox model, if those in category A have a 50% lower hazard rate than those in category B at the start of your follow-up, they should also have a 50% lower hazard rate later on. Of course, this is hard to check this when you only have a small number of events happens in each small time interval and one should not immediately get concerned if the Kaplan-Meier plots do not look exactly as one would expect. On the other hand, if this changes substantially over time, one can also have time varying covariates and/or interactions between time intervals and certain coefficients in the model.


text:
Q: What does the MOVHS command in ARM assembly do? I'm having a hard time understanding what this command does. I'm guessing it means mov halfword signed into a register, but i'm not sure. Any help would be appreciated!

A: I would assume it's a normal move that only occurs if the current condition codes indicate "higher or same" (unsigned >= from previous compare or subtract).

A: This does not have anything to do with halfword or signed. The ARM info center is always a good place to start if your confused, rather than guessing. Anyway, to answer your question, what this command or mnemonic does is it looks in the CSPR (Current Program Status Register), and goes off of the value stored in there. Now this could be the result of an earlier call like cmp r0, r1. Say that this was the case, and cmp r0, r1 was called before the code movhs was called. Now, the status of the cmp call is stored in the CPSR, and when a conditional such as hs or cs is added on as in the case with movhs, what this means is that this statement will only execute if the result in the CPSR is higher or same, i.e., in pseudocode, if (r1 >= r0){execute the mov command}.


text:
Q: Variable in setInterval only increments the first time I have a simple script:
var bannerNum = 2;
window.setInterval(function () {
    bannerSwap(bannerNum);
}, 5000);

function bannerSwap(bannerNum) {
    if (bannerNum == 5) {
        bannerNum = 1;
        document.getElementById('b1').style.display = "block";
        document.getElementById('b4').style.display = "none";
        return;
    }
    document.getElementById('b' + (bannerNum - 1)).style.display = "none";
    document.getElementById('b' + bannerNum).style.display = "block";
    bannerNum++;
    return;
}

It just loops through the function every 5 seconds and swaps the banner image (4 divs, all display:none except the first, named b1 through b4).  Pulling the page up, it switches the first time (bannerNum = 3), but it never switches after that.  I alerted bannerNum at the end and saw that it switched from 2 to 3 and then it popped up every 5 seconds saying it was 3 over and over.  So why isn't it incrementing?

A: Try
window.setInterval(function () {
    bannerSwap(bannerNum++);
}, 5000);

Remove the bannerNum++ inside the bannerSwap function
EDIT
Your code doesn't work because you are not modifying the actual bannerNum variable, but rather a parameter you recieve with the same name.
For your code to work entirely, you should do one of the following,

*

*Make all the modifications to bannerNum inside the setInterval function

*Remove the parameter from the bannerSwap signature, so you gain scope of the global variable

A: As said in the comments, remove bannerNum from bannerSwap's parameter list like this:
<script>
var bannerNum = 2;
window.setInterval(function() {
    bannerSwap();
},5000);
function bannerSwap() {
    // Your code here (it will work)
}
</script>


text:
Q: Generate VB.NET Code to Run SSIS Package? I'm a systems programmer myself and completely new to DTS or any ETL etc. I have a situation here and would greatly appreciate your support.
we are using MS SQL 2000 till now in project and now efforts are on way to move to 2008.
I can see some .dts files which were created long back with MSSQL2000. VB script(.bas) files were generated from these .dts files and they are run in the VB program, till date.
Problem::
Now as we are moving to MS SQL 2008 ==>
I need to make sure that the VB program(generated from .dts files earlier) are good to be run and MAINTAINED even with MSSQL 2008 R2.
Question:
Firstly can these programs be maintained even in MSSQL2008 (without MSSQL2000) ?
If yes, do i need to any dll's or references etc?
I could see one of my team member migrating the .dts to .dtsx files, is there a way to generate VB files(.bas) from .dtsx ?

A: ETL solutions in SQL Server 2000 (DTS) and SQL Server 2008 (SSIS) are incompatible, but you could use Execute DTS task from SSIS package. You don't need any dll's for it.
That'll give you some time before you have a chance to rewrite your system. You'll have to do it eventually, because 'Execute DTS' is deprecated component and won't be supported in future versions.


text:
Q: OpenID Connect server. Generate access token based on 3-rd party token (social login) I had implemented OpenID Connect server that generates access tokens for mobile client based on username/password using OpenIddict.
My next goal was to provide ability to generate Access Token using 3-rd party tokens (social login for example), and I started from integration with Google token, but stuck as cannot find any samples/informations about how to do this.
The only one idea that I currently have is to make request to "/connect/token" endpoint and send Google token in "code" parameter, for example in  "google:" format, then override OpenIdConnectServerProvider.DeserializeAuthorizationCode method:

Called when receiving an authorization code. An application may use this context to deserialize the code using a custom format and to skip the default logic using

So I have created own CustomProvider class based on OpenIddictProvider, registered it
services.AddOpenIddict<ApplicationUser, ApplicationRole, ApplicationDbContext, int>()
    .Configure(builder =>
    { builder.Provider = new CustomProvider(sp.GetRequiredService<SignInService>()); }

and overridden the DeserializeAuthorizationCode method:
public override async Task DeserializeAuthorizationCode(DeserializeAuthorizationCodeContext context)
{
    string code = context.Request.Code;
    if (code.StartsWith("google:"))
    {
        string token = code.Replace("google:", "");
        var principal = new GoogleTokenValidator().ValidateToken(token, null).Result;
        var ticket = new AuthenticationTicket(principal, new AuthenticationProperties(), "Bearer");
        ticket.SetPresenters(context.Request.ClientId);
        context.Ticket = ticket;

        context.Ticket.Properties.ExpiresUtc = DateTime.UtcNow.AddDays(1);
        context.HandleResponse();

        await _signInService.Login(principal);

        return;
    }
    else
    {
        base.DeserializeAuthorizationCode(context);
    }
}

where GoogleTokenValidator is a custom class for Google token handling (it makes call to Google User Information Endpoint and generate ClaimsPrincipal), based on "copy-pasted" code from GoogleHandler class in aspnet/Security repo.
In general it is working with some additional hacks, but I have strong feeling that reinventing the wheel...

A:
In general it is working with some additional hacks, but I have strong feeling that reinventing the wheel...

You're not only reinventing the wheel, but you're also implementing something totally non-standard that is not supported (at all) by OpenIddict.
Here's the approach I recommend (which is the one we use in the MVC server sample):

*

*The OAuth2/OpenID Connect client application redirects the user agent to your authorization controller (you can take a look at this controller for an example).

*OpenIddict will validate the authorization request and allow your controller to be invoked if it's fully valid.

*If the user is not already logged in, your authorization controller will redirect the user to the login endpoint, provided by AccountController. At this point, you're free to propose local authentication (e.g using a username/password couple) or Google authentication (you can use the Google authentication middleware for that). You can even offer 2-FA as part of this login process.

*Once the user is logged in (e.g after a registration process and/or an external authentication association), his/her browser is redirected back to the authorization endpoint, where a consent form indicating he/she's about to allow your JS app to access his personal data on his/her behalf is displayed.

*When the user allows your client application to access his data, the request is handled by your authorization controller, that calls SignInAsync to inform OpenIddict that an authorization code/access token should be returned to your application.


text:
Q: Update With SELECT FROM Table GROUP BY I have table material :
- id: int,
 - name : varchar(100),
 - content: varchar(255),
 - quantity : double,

the query without using group by
1, product1, content1, 25
2, product2, content2, 4
3, product1, content3, 35
4, product3, content4, 15

the query with group by and SUM quantity
 product1, content1, 25
 product2, content2, 4
 product3, content4, 15

when I want to update a quantity = 0 of the first id: 1, product1, content1, 25, I would make an update of the quantity = 0 for all materials that have the same name of the material
For example:
1, product1, content1, 0
2, product2, content2, 4
3, product1, content3, 0
4, product3, content4, 15

I tried with :
Update 'material' as m
INNER JOIN  (SELECT i1.produit FROM 'material' m1   GROUP BY m1.name) m1
ON(m1.name = m.name) SET quantity = 0

but I have not the result :

A: Try following;)
UPDATE `material` AS m
INNER JOIN (
    SELECT m1.name
    FROM `material` m1
    GROUP BY m1.name
    HAVING COUNT(m1.name) > 1) m2
ON m2.name = m.name
SET m.quantity = 0

A: @Reno, This query for the first id
but when I would choose whatever id
for example, I would choose the second id or whatever id
not necessarily the prermier id.
for example when i choose the second id :
i would dipaly
1, product1, content1, 10
2, product2, content2, 0
3, product1, content3, 20
4, product3, content4, 15
5, product2, content5, 0

and for example when i choose the fourth id :
i would dipaly
1, product1, content1, 10
2, product2, content2, 30
3, product1, content3, 20
4, product3, content4, 0
5, product2, content5, 35
6, product3, content6, 0


text:
Q: Visual Studio 2015 and ReSharper - Mouse cursor repeatedly loading while trying to show intellisense So this is one of the most irritating things I've encountered, and I'm 100% sure it's because of ReSharper (i tried installing/uninstalling ReSharper and it was fixed when it was gone).
While I type, and when ReSharper tries displaying IntelliSense, mouse cursor starts rapidly loading (like 5-6 times in 2 seconds) as if it's trying to load something. Project is not too big, and there's not too many classes. Also time it takes to display IntelliSense has slowed down.
I have no clue how to fix this, I've tried googling for this problem but to no avail.
Any help would be appreciated!

A: Resharper is pretty 'expensive' resources-wise, so if your machine isn't powerful enough, you'll see that happening.
Perhaps try setting down some of the features of resharper, such as CodeAnalysis, Cyclomatic complexity etc.
Maybe disable some other VS Extensions running in background, if you have any?


text:
Q: WCF service to handle Authentication and Roles I am trying to create a simple WCF service to handle various security scenarios, but am not really sure where to begin.
The WCF service will be hosted on IIS (most likely). It needs to be accessible by both authenticated active directory users and non-authenticated users (anonymous/external). I need to be able to access various methods for both types, though the authenticated users should have access to additional methods.
I would like to be able to check HttpContext.Current.User.Identity.IsAuthenticated (I assume this would be the easiest way to determine which type of user - or would it be ServiceSecurityContext.Current.WindowsIdentity) and access a roles database. The service will be accessed by both a .net 4.0 website (not webforms app and not mvc) and other external sources that may or may not be .net (java app or java web site, for instance).
I am unclear as to where to begin. What type of binding(s), transport(s), security mode(s). Can I use a membership/roles provider (SimpleMembership or the older asp.net membership) with the service?
If I want to have different types of anonymous users, do they need to be mapped to a specific active directory users for different roles or can I also include some sort of username/password to authenticate?
I also need to be able to use impersonation, so that assuming the correct rights, actions performed by one user can appear as if done by another.
I have been looking at various options and getting confused. ADFS, WIF, Microsoft.IdentityModel.dll, ACS 2.0, etc.
Not sure what is best, what is overkill, what will and will not meet the needs, what will be relatively easy to implement. Use SSL or not, and if so, how to setup both the service web.config as well as the client web.config
I know this a lot to ask, but at least if I get pointed in the right direction, I can stop looking at solutions that will not work or are overly complex and focus on the right solution(s).


text:
Q: What is the best way to compare fixed and random effects of a GLMM? I am doing a research in which i am trying to measure the importance of the doctor that is in charge of a patient in a medical decision. For that (and others reasons) i have used a GLMM using lmer4 that looks like that :
FitGlmm <- glmer(medical_decision ~ fixed_effect_1 + fixed_effect_2 + ... + (1|`dr`), family=binomial, data=data)
What i would like is to have a way to compare the "importance" of each effect (fixed AND random) in the medical decision.
From my (poor) understanding, pseudo-R2 (despite their limitations) could be of help to answer my question. After looking into partR2 and rptR packages, my issues, since i want to compare random effect vs fixed effects, is the following :

*

*Can i use ICC (or R) from rptR package to measure the proportion of variance of the random effect (dr) and compare it with R2m and partR2 of fixed effects ?

*Can i use this homemade formula R2c - R2m (getting R2c and R2m from partR2 package) to get the proportion of variance of the random effect "dr" ? And then compare it with partR2 values of fixed effects from partR2 package ?

*Should i use a completely different approach ?

Thanks in advance,
Thomas


text:
Q: Task in later version of Scalaz I'm using Scalaz 7.6.12 and I cannot find the class Task. Has it been deprecated? I just started learning Task but I cannot find the class in my library.

A: First, check dependencies in your build.sbt:
libraryDependencies ++= Seq(
  "org.scalaz" %% "scalaz-core" % "7.2.16",
  "org.scalaz" %% "scalaz-concurrent" % "7.2.16"
)

If everything is in place, Task resides in scalaz.concurrent package as usual:
import scalaz.concurrent.Task


text:
Q: Use polar coordinates to find the volume of the given solid Use polar coordinates to find the volume of the given solid bounded by the paraboloid $z=1+2x^2+2y^2$ and the plane $z=7$ in the first octant.
I did it. Is that right ?
$$\int_0^{\pi \over 2} \int_0^{\sqrt{3}}(7-(1+2r^2))r dr d\theta = \frac{9\pi}{4} $$
Thanks

A: Answer:
You are almost right except that the integrand is ($7-(1+2r^2)$) = $(6-2r^2)$


text:
Q: regex extraction 2 groups resulting only in one match New to regex.
Consider you have the following text structure:
"hello_1:45||hello_2:67||bye_1:45||bye_5:89||.....|| bye_last:100" and so on
I want to build a dictionary out of it taking the string value as a key, and the decimal number as the dict value.
I was trying to check my concept using this nice tool
I wrote my regex expression:
(\w+):(\d+)

And got only one match ->the first in the string : hello_1:45
I tried also something like:
.*(\w+):(\d+).*
But also not good, any ideas?

A: You should use the g (global) modifier to get all the matches and not stop to the first one. In python you can use the re.findall function to get all the matches. Check the example here.

A: You may achieve this only through split function.
s = "hello_1:45||hello_2:67||bye_1:45||bye_5:89"
print {i.split(':')[0]:i.split(':')[1] for i in s.split('||')}

Try this if you want to convert the value part as int.
print {i.split(':')[0]:int(i.split(':')[1]) for i in s.split('||')}

or
print {i.split(':')[0]:float(i.split(':')[1]) for i in s.split('||')}


text:
Q: SQL select count with multiple cases I want a column where I count transactions where itemtype contains either one of two specified values or location contains one of two specified values.
The first two columns (itemtype and location) gives correct figures, but the third seems to count all transactions, irrespective of itemtype or location.
What am I doing wrong?
SELECT
  COUNT(CASE WHEN itemtype IN ('BARNTAL','STORSTIL') THEN 1 END) 'itemtype',
  COUNT(CASE WHEN location IN ('Lattlast','Appelhyllan') THEN 1 END) 'location',
  COUNT(CASE WHEN itemtype IN ('BARNTAL','STORSTIL') THEN 1
             WHEN location IN ('Lattlast','Appelhyllan') THEN 1
             ELSE 0
        END) 'total'
FROM statistics

A: For last one you can use SUM instead of COUNT like below -
SELECT
  COUNT(CASE WHEN itemtype IN ('BARNTAL','STORSTIL') THEN 1 END) 'itemtype',
  COUNT(CASE WHEN location IN ('Lattlast','Appelhyllan') THEN 1 END) 'location',
  sum(CASE WHEN itemtype IN ('BARNTAL','STORSTIL') THEN 1
  WHEN location IN ('Lattlast','Appelhyllan') THEN 1
 END) 'total'

FROM statistics

A: You don't need to add ELSE part :
SELECT COUNT(CASE WHEN itemtype IN ('BARNTAL','STORSTIL') THEN 1 END) AS itemtype,
       COUNT(CASE WHEN location IN ('Lattlast','Appelhyllan') THEN 1 END) AS location,
       COUNT(CASE WHEN itemtype IN ('BARNTAL','STORSTIL') THEN 1
                  WHEN location IN ('Lattlast','Appelhyllan') THEN 1
             END) AS total
FROM statistics;

A: I think, the third condition would be as below
SELECT
COUNT(CASE WHEN itemtype IN ('BARNTAL','STORSTIL') OR location IN ('Lattlast','Appelhyllan') THEN 1 END) AS total
FROM statistics;

A: COUNT counts not null values which means it also "counts" the 0 from the ELSE part. Remove the ELSE part altogether:
SELECT
  COUNT(CASE WHEN itemtype IN ('BARNTAL','STORSTIL') THEN 1 END) 'itemtype',
  COUNT(CASE WHEN location IN ('Lattlast','Appelhyllan') THEN 1 END) 'location',
  COUNT(CASE WHEN itemtype IN ('BARNTAL','STORSTIL') THEN 1
             WHEN location IN ('Lattlast','Appelhyllan') THEN 1
        END) 'total'
FROM statistics


text:
Q: Is there any function for matlab to concantenate array using condition? I have this python code for concatenating 2 arrays using multiple conditions like give below
good_left_inds = ((nonzeroy >= win_y_low) & (nonzeroy < win_y_high) &
    (nonzerox >= win_xleft_low) &  (nonzerox < win_xleft_high)).nonzero()

is there any MatLab equivalent code to work on this kind of array?

A: Yes, there is. Have a look at MATLABs find function. Its documentation says

Find indices and values of nonzero elements

It is basically the same what numpy.nonzero does. The logical expressions are practically identical to python code.
% You are only interested in the indices, so you can omit the values as return parameter
[good_left_inds, ~] = find(nonzerox >= win_y_low & nonzerox < win_y_high & ...
    nonzerox >= win_xleft_low & nonzerox < win_xleft_high);

When comparing the results, please remember that MATLAB indexing starts at 1 and not at 0 like in python.


text:
Q: I have a problem with adding padding to a container-fluid. I tried using Bootstrap 4.0.0 and 4.4.1 but it won't add the padding I have a problem with adding padding to a container-fluid. I tried using Bootstrap 4.0.0 and 4.4.1 but it won't add the padding. My code looks the same as my instructor who's using bootstrap 4.0.0
I tried using the same version it didn't work and I tried using the latest version still didn't work.

/*css*/

.container-fluid {
  padding: 3% 15%;
}
<link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.4.1/css/bootstrap.min.css" rel="stylesheet" />

Meet new and interesting dogs nearby.

        <button type="button">Download</button>
        <button type="button">Download</button>


text:
Q: I want the bash script to echo only if I execute and not echo if executed by a cron job I want to echo to the terminal if the script is being executed by me, in the flesh or I want to echo to a log file if it is being done via a cron job.
Ubuntu 16.04
example:
#!/bin/bash

if [ ***** ]; then
   echo "You executed this script just now !";
else
   echo "You were executed by the server cron at ${date}" >> example.log
fi

I rewrote the above because I thought it would be a simpler way to explain it. It's a more direct and cleaner example.

A: Try this :
if [[ -t 0 ]]; then
    echo "executed from terminal"
elif [[ $(< /proc/$PPID/comm) == cron* ]]; then
    echo "executed by cron"
else
    echo "executed outside of a terminal"
fi

A: As an option you can set an environment variable in your crontab file and then let the script check for the variable. I.e. in you crontab add CRON=yes
in your script
if [[ "$CRON" = "yes" ]]; then
or simply check if $CRON is defined [[ -z "$CRON" ]]

A: Super easy way: just create a file before.
# m h  dom mon dow   command
* * * * * /usr/bin/touch /tmp/FOO && /your_script/

[ -f /tmp/FOO ] && echo "Executed by crontab"; rm /tmp/FOO || echo "I'm physically executing"


text:
Q: How to Override a single function of a system class? I am trying to override the ToString() function of the GroupPrincipal class within System.DirectoryServices.AccountManagement without having to create a child class. I feel like i have done something very similar before but can't seem to remember how.
I tried this as a test but it seems to override the entire class
public class GroupPrincipal
{
    public override string ToString()
    {
        return base.ToString();
    }
}

Thanks

A: If I understand you correctly you want to change methods of an existing class without inheriting it. That is not possible (at least not without reflection).
Creating a subclass is the proper way to do this.

A: Here you have not specified the base for your class.  Therefore, it only derives from the default, object.
Try:
public class GroupPrincipal : AccountManagement
{
    // Method overrides here...
}

Of course, in a sense this does "override the entire class."  But because of the wonders of OOP, the child class inherits its behaviour from the base until you start overriding members yourself.  There is little overhead to doing this.
If the AccountManagement class has non-default constructors, you might need to add corresponding constructors to your class too.  These would probably pass through to their counterparts in the base type.  For example, you might have:
public GroupPrincipal(string name)
    : base(name)
{
}


text:
Q: Prepend fails on x-editable values of 0 I have a bootstrapTable that is utilizing the x-editable plugin for dropdowns.
There is a method per the documentation to prepend values to a dropdown with a value of '' and text of Not Defined. This works just fine, except when another option in my dropdown has a value of 0. If that is the case, that value shows as the prepended value of Not Defined, when it should show as False.
My Code:
var data = [{"Bool": 1},{"Bool": 0}];

$('#table').bootstrapTable({
  columns: [
    {
      field: 'Bool',
      title: 'Bool',
      editable: {
        type: 'select',
        'prepend': 'Not defined',
        'source': [{'value': 1,
                    'text': 'True'},
                   {'value': 0,
                    'text': 'False'}]
      }
    }
  ],
  data: data
});

http://jsfiddle.net/t6pg9yg9/2/


text:
Q: Google IMA SDK AS3 - pauseAd Does anyone know how to pause a VPAID flash ad using the actionscript 3 Google IMA SDK?
Thanks

A: Current version v2 does not expose vpaid functions. v3 is finished and is about to be released. It has a full set of vpaid functionality.


text:
Q: How to find the process that is causing deadlock in MSSQL I am getting latency arrival and departure from an on board computer to a third party application that generates XML file with the information gathered from the OBC.
I tried to update the statuses of some of the transaction in the DB to all the 3rd party application to process the information, but it hasn't helped.
Below is the high level of chronological order of logic in MIF scheduler code for Arrival and Depart OBC interfaces ( MPNL.Services:mapPacosEvent):

*

*Perform:
Select uniqkey, status, vehicle_number, created_datetime, msn, base_msn, message_type, form_id, message_text from ALLINBOUNDMESSAGES where
status IN (0,6,7,8,9) AND (form_id = '003' OR form_id = '005') AND ((message_type = 'pacos') OR (message_type = 'form'))
ORDER BY created_datetime

*For each row result of the above query from the message_text get the dispatch_number. E.g.
Vehicle 103184 has arrived at Stop #5 (310466-000) at 2019-07-19 08:00:14 (local time).^886727^5^310466-000^41.412191^-73.454032^68139.250^401773.3

here the dispatch_id is 886727)

*Perform:
select dispatch_id, driver from dispatch where dispatch_number='${dispatch_number}' ORDER BY created_datetime DESC

*Perform:
select status,dispatch_number,stop_number,scheduled_arrival,stopprofile_id,planned5, planned4 ,planned3 ,planned2 from dispstops where dispatch_id='${dispatch_id}' AND stop_number='${stop_number}' AND status IN (${StopStatusValue}) ORDER BY Status Asc ,stop_number DESC.

Here the Stop_number and StopStatusVaues are read from the MPNLInboundInterfaces_ConfigFile.xml file.

*Perform:
select DISTINCT t1.login ,t1.login_datime_gmt from vehicleloginxref t1
join [elogevents] t2 ON ((t1.vehicle_number = t2.vehicle_number) AND (t1.login = t2.driverid))
where((t1.status = '${status}') AND (t1.userstatus = '${userstatus}') AND (t2.eid = '${eid}') AND (t1.vehicle_number='${vehicle_number}') AND (t1.logout_datime_gmt IS NULL)) ORDER BY login_datime_gmt DESC

Here the input is status, eid and vehicle_number.

*Perform:
select primary driver detail from TPNE using below query
  select secondary_driver, carrier_driver_id   from driver where secondary_driver != '' and secondary_driver is not null AND mark_for_deletion!='1'

*Perform:
Select TP_company_ID,LAST_KNOWN_FACILITY_ALIAS_ID,CARRIER_ID from DRIVER where Carrier_Driver_ID ='${DriverID}' AND mark_for_deletion!='1'

*Perform:
Select Last known FacilityAliasID from TPE
                           Select TP_company_ID,LAST_KNOWN_FACILITY_ALIAS_ID,CARRIER_ID from DRIVER where Carrier_Driver_ID ='${DriverID}' AND mark_for_deletion!='1'
                           select carrier_code from carrier_code where TP_company_ID= '${TPCompanyID}' and CARRIER_ID='${CARRIER_ID}'
                           select gmtoffset from opcenters where opcenter = (select opCenter from vehicles where vehicle_number = '${vehicle_number}' )
                           select time_zone_name from time_zone where time_zone_id = (select min(time_zone_id)  from time_zone where gmt_offset = '${gmtoffset}')
                           select uniqkey,vehicle_number,created_datetime,msn,base_msn,form_id,dispatchstop,on_dock_time,trailer,pro,seal,detention_hours,auto_latlong,
auto_location,auto_odometer,userflag1,userflag2,userfield1,userfield2,dispatch_number,stop_number from ${tablename1} where msn='${msn}' AND
base_msn='${base_msn}' AND vehicle_number='${vehicle_number}' AND userflag1 NOT in ('${successStatus}','${errorStatus}')

*Scheduler service MPNL.Services:mapPacosEvent composes Arrival_OBC and Depart_OBC xmls using the information pulled from TPNE and PeopleNet database and sends the same to MIF.

*Once the message sent to MIF successfully scheduler updates the ALLINBOUNDMESSAGES table using the below query:
Update status='1' where uniqkey='' and vehicle_number='' and message_type='' and form_id='';

*If sending the Arrival_OBC and Depart_OBC xmls fails scheduler updates the ALLINBOUNDMESSAGES table using the below query:
Update status='10' where uniqkey='' and vehicle_number='' and message_type='' and form_id=''

The error:
2019-07-17 14:02:00 EDT [ART.0114.1007E] Adapter Runtime: Error Logged. See Error log for details. Error: [ADA.1.316] Cannot execute the SQL statement "UPDATE  allinboundmessages SET status = ?  WHERE uniqkey = ? AND vehicle_number = ? AND message_type = ? AND form_id = ?". "
(40001/1205) Transaction (Process ID 78) was deadlocked on lock | communication buffer resources with another process and has been chosen as the deadlock victim. Rerun the transaction."
Transaction (Process ID 78) was deadlocked on lock | communication buffer resources with another process and has been chosen as the deadlock victim. Rerun the transaction.
2019-07-17 14:02:00 EDT [ART.0114.1007E] Adapter Runtime: Error Logged. See Error log for details. Error: [ART.117.4002] Adapter Runtime (Adapter Service): Unable to invoke adapter service MPNL.AdapterServices:updateAllInboundMessageRecs.
[ADA.1.316] Cannot execute the SQL statement "UPDATE  allinboundmessages SET status = ?  WHERE uniqkey = ? AND vehicle_number = ? AND message_type = ? AND form_id = ?". "
(40001/1205) Transaction (Process ID 78) was deadlocked on lock | communication buffer resources with another process and has been chosen as the deadlock victim. Rerun the transaction."
Transaction (Process ID 78) was deadlocked on lock | communication buffer resources with another process and has been chosen as the deadlock victim. Rerun the transaction.

A: If you run the stored proc sp_who2, it will show you what processes are blocked and what process is doing the blocking.


text:
Q: Which function to use for thumbnail creation imagecopyresampled() or imagecopyresized()? i'm building a image uploading functionality in my website which gives users the possibility to upload a picture of any size to the website. This picture gets automatically resized to a thumbnail size. I've browsed around for some code and i see some using the imagecopyresampled() function to resize and some the imagecopyresized(). Which one is the best to use? What are the differences?

A: imagecopyresized() copies a rectangular portion of one image to another image. dst_image is the destination image, src_image is the source image identifier.
imagecopyresampled() copies a rectangular portion of one image to another image, smoothly interpolating pixel values so that, in particular, reducing the size of an image still retains a great deal of clarity.
php.net is your friend
That seemed overly snarky. Sorry about that. Personally I always use imagecopyresampled()


text:
Q: return collection of same parameter as input collection parameter Say I have the following setup:
abstract class AbstractBaseClass {

    // Some common attributes

    AbstractBaseClass() { }

    AbstractBaseClass(AbstractBaseClass orig) {
        // Copy ctor impl
    }

    protected abstract AbstractBaseClass clone();
}

class DerivedClassA extends AbstractBaseClass {

    // Some specialized attributes

    DerivedClassA() { }

    DerivedClassA(DerivedClassA orig) {
        super(orig);
        // Copy ctor impl
    }

    List<DerivedClassB> subObjects = new ArrayList<>();

    protected DerivedClassA clone() {
        return new DerivedClassA(this);
    }

}

class DerivedClassB extends AbstractBaseClass {

    // Some specialized attributes

    DerivedClassB() { }

    DerivedClassB(DerivedClassB orig) {
        super(orig);
        // Copy ctor impl
    }

    List<DerivedClassC> subObjects = new ArrayList<>();

    protected DerivedClassB clone() {
        return new DerivedClassB(this);
    }

}

// DerivedClassC implemented the same way

Now I'd like to implement a generic method in my abstract base class which
clones a given list of subjects contained in one of the derived classes:
abstract class AbstractBaseClass {

    // Other stuff, see above

    // Doesn't work because of type issues
    protected <T> List<T> cloneList(List<? extends AbstractBaseClass> origList) {
        if (origList == null) return null;

        List<T> result = new ArrayList<>();
        for (AbstractBaseClass i: origList) {
            result.add(i.clone());
        }

        return result;
    }
}

Now I want to call this method as follows:
class DerivedClassA extends AbstractBaseClass {

    // Other stuff

    List<DerivedClassB> subObjects;

    DerivedClassA(DerivedClassA orig) {
        super(orig);
        // Copy ctor impl
        subObjects = cloneList(orig.subObjects);
    }

}

Now what I'd expect is that the implementation of cloneList(...) in AbstractBaseClass returns a list that has the same type as the argument list, so I can store them in my derived classes. How would I go about that?
What I've found out so far is that I can implement cloneList(...) like so:
protected List<AbstractBaseClass> cloneList(List<? extends AbstractBaseClass> origList) {
    // null check...

    List<AbstractBaseClass> result = new ArrayList<>();
    for (AbstractBaseClass i: origList) {
        result.add(i.clone());
    }

    return result;
}

and then use casts in my derived classes:
DerivedClassA(DerivedClassA orig) {
    super(orig);
    // Copy ctor impl
    List<AbstractBaseClass> tmp = cloneList(orig.subObjects);
    for (DerivedClassA i: tmp) {
        subObjects.add( (DerivedClassA) i );
    }
}

But this isn't really satisfying to me, since I'd like to have one generic implementation that doesn't rely on casting after getting my cloned collection of objects of type AbstractBaseClass

A: You may change the following lines:
abstract class AbstractBaseClass<T extends AbstractBaseClass<T>>

and
protected List<T> cloneList(List<T> origList) {
    if (origList == null)
        return null;

    List<T> result = new ArrayList<T>();
    for (T i : origList) {
        result.add(i.clone());
    }

    return result;
}

and the derived class
class DerivedClassA extends AbstractBaseClass<DerivedClassA>

and
DerivedClassA(DerivedClassA orig) {
    super(orig);

    List<DerivedClassA> clonedList = cloneList(orig.subObjects);
    subObjects.addAll(clonedList);
}

In the end you do not need to cast anything.


text:
Q: Class not found in Runtime in Eclipse while Maven Dependency already included I use maven to download the ojdbc.jar dependency.
The jar already appeared in Maven Dependencies in Eclipse which I guess it is ready for use. But when I try to import OracleDriver, Eclipse cannot help me to import the class and show error on the line.
I tried Class.forName("oracle.driver.OracleDriver") for searching the class. It also shows the exception of ClassNotFound.
pom.xml
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>com.techoffice.example</groupId>
    <artifactId>OracleJdbcExample</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <repositories>
        <repository>
            <id>codelds</id>
            <url>https://code.lds.org/nexus/content/groups/main-repo</url>
        </repository>
    </repositories>
    <dependencies>
        <dependency>
            <groupId>com.oracle</groupId>
            <artifactId>ojdbc6</artifactId>
            <version>11.2.0.3</version>
        </dependency>
    </dependencies>
</project>

Sample Code
public static void main(String[] args){
  Class.forName("oracle.jdbc.OracleDriver");
}

Exception
Exception in thread "main" java.lang.ClassNotFoundException: oracle.jdbc.OracleDriver
    at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:171)
    at com.techoffice.oracle.OracleJdbcAppl.main(OracleJdbcAppl.java:18)

A: Due to Oracle license restrictions, the Oracle JDBC driver is not available in the public Maven repository. To use the Oracle JDBC driver with Maven, you have to download and install it manually into your Maven local repository.
Use the following command for installation:
mvn install:install-file -Dfile={{Full path to your jar}}
           -DgroupId=com.oracle -DartifactId=ojdbc6 -Dversion=11.2.0 -Dpackaging=jar

Or you can use Oracle Maven Repository:
The Oracle Maven repository requires a valid user registration and the
user should also accept the terms and conditions by logging
into http://maven.oracle.com. This username will be used in
settings.xml.
Create a settings-security.xml file that holds the master password information under the local  maven repository (Example: {USER_HOME}/.m2/) that is usually under the user home directory.  For example: If the username is test then the path will be
Unix : /home/test/.m2/settings.xml
Windows : C:\Users\test\.m2\settings.xml
The settings.xml file is required for downloading Oracle JDBC drivers and UCP.  Encrypt the user password before using it in settings.xml.  Use the following commands to encrypt the user password and update settings.xml:
mvn -encrypt-password <any_master_password> or mvn -ep <any_master_password>
Source of the information

A: Download the "ojdbc6.jar" file to your PC. cd into the folder where it has been downloaded. Then use this command to install the library on your maven local repository (usually your ~/.m2 directory):
mvn install:install-file -Dfile=ojdbc6.jar -DgroupId=com.oracle -DartifactId=ojdbc6 -Dversion=11.2.0.3 -Dpackaging=jar -DgeneratePom=true

After this, Eclipse should be able to seamlessly find the dependency.

A: Include the ojdbc6.jar file in the Deployment Assembly of the Project

Right Click on project -> Properties -> Deployment Assembly -> Add your ojdbc6.jar file in it

Method2:
    Right Click on Project -> Build Path -> Configure Build Path -> Add External JAR -> add the ojdbc6.jar


text:
Q: Split text avoiding some cases (Javascript) i'm trying to split an html like this as a string:

 Hello, this is my html

what i need is to split that html by spaces ignoring the html tags in the split, i am currently getting this result:
["
","Hello,","this","is","my","html","
"]

but i need it to treat the tags as a complete word, to get this result:
["
","Hello,","this","is","my","html","
"]

how can i get to this result?
EDIT:
In the javascript side, i'm using a simple split:
var text = "
 Hello, this is my html
";
var splitText = text.split(' ');

In this case splitText would be:
["
","Hello,","this","is","my","html","
"]

I tried using Regular expressions like "/[<.*?>,\s]+/" but my result was:
var text = "
 Hello, this is my html
";
var splitText = text.split(/[<.*?>,\s]+/);

splitText = ["p class='class1'","Hello,","this","is","my","html","/p"]

Thanks in advance.

A: var a = $("
Hello, this is my html
");
var b = a.html().split(' ');
a.html('');
var c = a[0].outerHTML.split('><');
b.splice(0, 0,c[0]+'>');
b.splice(b.length+1, 0,'<'+c[1]);

b will result: ["
", "Hello,", "this", "is", "my", "html", "
"]
Note: This code is only for one dimension tag

A: I got this by using a simple regular expression and the match method.
var text = "

Hello world!

";
var splitText = text.match(/[\<].+?[\>]+|[^\s]+/g);

//splitText ->
//["
","
","Hello","world!","
","
"]

Thanks @MaveRick for your answer :)


text:
Q: How do I figure out the totally airborne height for a given machine? Technically "airborne" can just mean to move through the air, but I would like to know how high you have to be before you are entirely supported by air in a helicopter-like machine, as opposed to benefiting from the reaction from the earth (or whatever platform you are taking flight from). I am effectively asking for an equation that will tell me how high I have to be before the effect demonstrated in the following image is effectively zero.

I assume that this has something to do with mass, but am unclear on how to proceed beyond that.

A: I wasn't able to find a well-sourced table, but this page has a chart that shows a helicopter has almost zero ground effect advantage when hovering at a height greater than 1.25 times the rotor diameter.
That fits well with this page from a testing company that states that ground effect on a fixed wing craft reduces drag by only 1.7% when at an altitude equal to the length of the wing.  The reduction is much greater when the wing is closer to the ground.

A: The effect is never zero, unless you happen to stop producing lift.
Lift is produced by air being continuously pushed downwards. This downward motion continues for several minutes, but is dissipated eventually. But in all cases the motion produces a pressure increase on the ground underneath. This is clearly audible for aircraft flying at supersonic speeds, because then the pressure change will not spread ahead of the aircraft. For subsonic aircraft, the pressure change is much more gradual and widely spread, but still there nonetheless.
To answer your question: Eventually, the aircraft is always supported by the earth.
Maybe you know the question about the closed truck full of birds. Someone bangs at the outside, so all birds fly up. Will the truck be lighter? Same story: The truck will not change weight, because now the air transmits the weight of the birds into its structure.

A: The usual rule of thumb in flying is that ground effect starts to appear within about one wingspan of the ground. av8n always has a good intuitive explanation.
He explains it as a mirror-image aircraft beneath you.
In flight training, it becomes important in soft-field takeoffs, where you transfer weight to the wings at as slow an airspeed as possible and get into ground effect.
Then you accelerate to climb speed.
Aside:
In Lindbergh's flight from New York to Paris, at times he made use of ground effect to save fuel.
At a height above the water of 30 feet, more or less, its height is automatically stable, and it just putts along at low power like a sewing machine.

A: The ground effect is only present in winged craft because in a flight with wings there is a much high pressure under the wings when closer to the ground this increases the normal lift effect. In propeller lifted craft the effect still applies because the propellers are just air foils twisted ,but they are also smaller which means less surface area to have an effect on.  The smaller the surface area the close to the ground they have to be and Most craft like helicopters have there propellers on top of the craft for stability thus making to far away from the ground to have the ground effect apply. Also you should check out back spin lift driven craft.


text:
Q: Lack of possessive marker when taken from a group I'm confused by this sentence:

One of my best friends band is playing tonight.

What is it that happens here, is the possessive marker completely dropped?
From what I understand:

*

*I can't add an 's since "one of" refers to the group of friends

*I can't add s' (friends') since the band is only one person's band.

A: English is fairly malleable, but it is still possible to paint yourself into a corner. One area this crops up is where a writer tries to make a word function in incompatible ways - such as being singular and plural simultaneously.
What's happening in your example is that the "s" in "friends" can't be coerced to do double duty to mark a plural (my friends) as well as a singular (one friend's band).
There are several ways around this, one of which is to use a different syntax for the genitive / possessive: "the band of one of my friends ...".


text:
Q: how to apply canvas tag on the whole window of my page? I wanted to add background to my page with a LinearGradient using canvas tag  so , can anyone help me out?
I used
<script>
(function () {
    var c = document.getElementById('canvas'),
        context = c.getContext('2d');

    window.addEventListener('resize', resizeCanvas, false);

    function resizeCanvas() {
        c.width = window.innerWidth;
        c.height = window.innerHeight;
        drawin();
    }
    resizeCanvas();

    function drawin() {
        var rg = c.createLinearGradient(0, 0, c.width, c.height);
        rg.addColorStop(0, blue);
        rg.addColorStop(0, white);
        c.fillStyle = rg;
        c.fillRect(0, 0, c.width, c.height);
        c.fillStroke(0, 0, c.width, c.height);
    })();

A: HTML
<canvas id="canvas"></canvas>

CSS
* { margin: 0; padding: 0;}

body, html { height:100%; }

canvas {
    position:absolute;
    width:100%;
    height:100%;
}


text:
Q: Post messages from Facebook App to users who like it How to post messages from my Facebook App to users (exact users or all) who signed (likes) my App?

A: My suggestion is Koala gem which satisfy your needs and you can also verify the Facebook Graph API.
Koala Gem Github
Read the graph API wiki in koala gem. Here you will find how to write a post in users wall. For getting FB App users list you have to read FB graph API documentation.
P.S: Read the koala gem wiki completely.


text:
Q: Creating referenced Instance of a prefab I'm trying to create an enemy spawner that will spawn a new enemy drone at a fixed interval. However, whenever I try to create a new instance while holding a reference to it, the previous instance is destroyed, creating errors.
This does not work
        void SpawnDrone()
    {
        GameObject newDrone;
        newDrone = (GameObject)Instantiate(drone, enemies.transform);
        newDrone.transform.position = gameObject.transform.position + new Vector3(0,0,5);

        Invoke("SpawnDrone", coolDown);
    }

While this does for some reason
    void SpawnDrone()
    {
        Instantiate(drone, enemies.transform);

        Invoke("SpawnDrone", coolDown);
    }

However, I need a reference to the drone when creating it.
This is the code in Start that Drone inherits that should be saving a reference to it in my list of game objects "scope"
    protected virtual void Start()
    {
        //Make sure that any GameEntity has a CollisionBox
        gameObject.GetComponent<CollisionBox>();

        //Add to Scope
        CollManager.Instance.scope.Add(gameObject);
    }

After a new Drone is created, Scope is left with a missing reference where the previous Drone was


text:
Q: jQuery - check if the element is visible and fade in I have a <div> element on my page (let's say it has .myelement class). I have a third-party script that manipulates the element and can change its visibility style attribute to "visibility: visible".
I need to check if .myelement's visibility is :visible, and if it is, then trigger jQuery .fadeIn() function.

A: I think you mean check if element is visible and if not, fade it in. There is no point in fading in an element that is already visible on the page. If that is the case you should do something like this:
var $element = $('.myelement');

if (!$element.is(':visible')) {
    $element.fadeIn();
}

or
if ($element.is(':hidden')) {
    // your logic goes here
}

A: Try to use .css("property") function to extract the style value belong to the visible property then do a normal compare and call the fadeIn if the condition evaluates to true,
var elem = $(".myelement");
if(elem.css("visibility") === "visible"){
  elem.fadeIn();
}

A: you can use jquery css function
//first cache your element
var elm = $(".myelement");//better to use an id if you are targeting a specific element

 if (elm.css("visibility") === "visible"){
  elm.fadeIn();
 }else{
   elm.fadeOut();
 }

A: I think before start the fadeIn animation you have to set display:none at the element, so fadeIn function will make appear softly your div.
In jquery you can do it using hide()
try this snippet, for me works
jQuery(document).ready(function(){
   var $myel = $(".myelement");
   if ($myel.css("visibility") === "visible"){
     $myel.hide();
     $myel.fadeIn("slow");
   }
});


text:
Q: Lebesgue measure of sets with cardinality greater than $ℵ_1$ I am not a mathematician and I am asking this question out of my curiosity.
Lebesgue measure of a set $S$ such that $Cardinality(S)=ℵ_0$ is $0$.
And lebesgue measure of a set $P$ such that $Cardinality(P)=ℵ_1$ is a positive number including infinity (sometimes it can be $0$ too but mostly it is a positive number or infinity.)..
My question is:
What is the Lebesgue measure of a set with cardinality $ℵ_n$ where $n>1$?


text:
Q: How do I use the Set instead of list arrays? I am making a multiple choice game.
I have an ArrayList of Strings, and I want to remove the answered questions from the set of unanswered questions. I have the information that:
The easiest way to remove repeated elements is to add the contents to a Set (which will not allow duplicates) and then add the Set back to the ArrayList:
List<String> al = new ArrayList<>();
// add elements to al, including duplicates
Set<String> hs = new HashSet<>();
hs.addAll(al);
al.clear();
al.addAll(hs);

but still I have no idea to apply it in my code here,
here's 2 files of my code
TriviaQuestion.java

public class TriviaQuestion extends Activity {
    private int id;
    private String question;
    private String opta;
    private String optb;
    private String optc;
    private String optd;
    private String answer;

    public TriviaQuestion(String q, String oa, String ob, String oc, String od, String ans) {

        question = q;
        opta = oa;
        optb = ob;
        optc = oc;
        optd = od;
        answer = ans;
    }

    public TriviaQuestion() {
        id = 0;
        question = "";
        opta = "";
        optb = "";
        optc = "";
        optd = "";
        answer = "";
    }

   /* public int getId() {
        return id;
    }*/

    public String getQuestion() {
        return question;
    }

    public String getOpta() {
        return opta;
    }

    public String getOptb() {
        return optb;
    }

    public String getOptc() {
        return optc;
    }

    public String getOptd() {
        return optd;
    }

    public String getAnswer() {
        return answer;
    }

    public void setId(int i) {
        id = i;
    }

    public void setQuestion(String q1) {
        question = q1;
    }

    public void setOpta(String o1) {
        opta = o1;
    }

    public void setOptb(String o2) {
        optb = o2;
    }

    public void setOptc(String o3) {
        optc = o3;
    }

    public void setOptd(String o4) {
        optd = o4;
    }

    public void setAnswer(String ans) {
        answer = ans;
    }

}

and
TriviaQuizHelper.java
public class TriviaQuizHelper extends SQLiteOpenHelper {

    Context context;
    private static final String DATABASE_NAME = "DATABASEQUIZ";
    private static final int DATABASE_VERSION = 17;
    private static final String TABLE_NAME = "TRIVIAQUIZ";
    private static final String UID = "_UID";
    private static final String QUESTION = "QUESTION";
    private static final String OPTA = "OPTA";
    private static final String OPTB = "OPTB";
    private static final String OPTC = "OPTC";
    private static final String OPTD = "OPTD";
    private static final String ANSWER = "ANSWER";
    private static final String CREATE_TABLE = "CREATE TABLE " + TABLE_NAME + " ( " + UID + " INTEGER PRIMARY KEY AUTOINCREMENT , " + QUESTION + " VARCHAR(255), " + OPTA + " VARCHAR(255), " + OPTB + " VARCHAR(255), " + OPTC + " VARCHAR(255), " + OPTD + " VARCHAR(255), " + ANSWER + " VARCHAR(255));";
    private static final String DROP_TABLE = "DROP TABLE IF EXISTS " + TABLE_NAME;

    public TriviaQuizHelper(Context context) {
        super(context, DATABASE_NAME, null, DATABASE_VERSION);
        this.context = context;
    }

    @Override
    public void onCreate(SQLiteDatabase sqLiteDatabase) {
        sqLiteDatabase.execSQL(CREATE_TABLE);

    }

    @Override
    public void onUpgrade(SQLiteDatabase sqLiteDatabase, int i, int i1) {
        sqLiteDatabase.execSQL(DROP_TABLE);
        onCreate(sqLiteDatabase);

    }

    public void allQuestion() {
        TriviaQuestion q1 = new TriviaQuestion("Galileo was an Italian astronomer who developed?", "Telescope", "Airoplane", "Electricity", "Train", "Telescope");
        this.insert(q1);
        TriviaQuestion q2 = new TriviaQuestion("Who is the father of Geometry ?", "Aristotle", "Euclid", "Pythagoras", "Kepler", "Euclid");
        this.insert(q2);
        TriviaQuestion q3 = new TriviaQuestion("Who was known as Iron man of India ?", "Govind Ballabh Pant", "Jawaharlal Nehru", "Subhash Chandra Bose", "Sardar Vallabhbhai Patel", "Sardar Vallabhbhai Patel");
        this.insert(q3);
        TriviaQuestion q4 = new TriviaQuestion("The first woman in space was ?", "Valentina Tereshkova", "Sally Ride", "Naidia Comenci", "Tamara Press", "Valentina Tereshkova");
        this.insert(q4);
        TriviaQuestion q5 = new TriviaQuestion("Who is the Flying Sikh of India ?", "Mohinder Singh", "Joginder Singh", "Ajit Pal Singh", "Milkha singh", "Milkha singh");
        this.insert(q5);
        TriviaQuestion q6 = new TriviaQuestion("The Indian to beat the computers in mathematical wizardry is", "Ramanujam", "Rina Panigrahi", "Raja Ramanna", "Shakunthala Devi", "Shakunthala Devi");
        this.insert(q6);
        TriviaQuestion q7 = new TriviaQuestion("Who is Larry Pressler ?", "Politician", "Painter", "Actor", "Tennis player", "Politician");
        this.insert(q7);
        TriviaQuestion q8 = new TriviaQuestion("Michael Jackson is a distinguished person in the field of ?", "Pop Music", "Jounalism", "Sports", "Acting", "Pop Music");
        this.insert(q8);
        TriviaQuestion q9 = new TriviaQuestion("The first Indian to swim across English channel was ?", "V. Merchant", "P. K. Banerji", "Mihir Sen", "Arati Saha", "Mihir Sen");
        this.insert(q9);
        TriviaQuestion q10 = new TriviaQuestion("Who was the first Indian to make a movie?", "Dhundiraj Govind Phalke", " Asha Bhonsle", " Ardeshir Irani", "V. Shantaram", "Dhundiraj Govind Phalke");
        this.insert(q10);
        TriviaQuestion q11 = new TriviaQuestion("Who is known as the ' Saint of the gutters ?", "B.R.Ambedkar", "Mother Teresa", "Mahatma Gandhi", "Baba Amte", "Mother Teresa");
        this.insert(q11);
        TriviaQuestion q12 = new TriviaQuestion("Who invented the famous formula E=mc^2", "Albert Einstein", "Galilio", "Sarvesh", "Bill Gates", "Albert Einstein");
        this.insert(q12);
       TriviaQuestion q13 = new TriviaQuestion("Who is elected as president of us 2016", "Donald Trump", "Hilary Clinton", "Jhon pol", "Barack Obama", "Donald Trump");
        this.insert(q13);
        TriviaQuestion q14 = new TriviaQuestion("Who was the founder of company Microsoft", "Bill Gates", "Bill Clinton", "Jhon rio", "Steve jobs", "Bill Gates");
        this.insert(q14);
        TriviaQuestion q15 = new TriviaQuestion("Who was the founder of company Apple ?", "Steve Jobs", "Steve Washinton", "Bill Gates", "Jobs Wills", "Steve Jobs");
        this.insert(q15);
        TriviaQuestion q16 = new TriviaQuestion("Who was the founder of company Google ?", "Steve Jobs", "Bill Gates", "Larry Page", "Sundar Pichai", "Larry Page");
        this.insert(q16);
        TriviaQuestion q17 = new TriviaQuestion("Who is know as god of cricket ?", "Sachin Tendulkar", "Kapil Dev", "Virat Koli", "Dhoni", "Sachin Tendulkar");
        this.insert(q17);
        TriviaQuestion q18 = new TriviaQuestion("who has won ballon d'or of 2015 ?", "Lionel Messi", "Cristiano Ronaldo", "Neymar", "Kaka", "Lionel Messi");
        this.insert(q18);
        TriviaQuestion q19 = new TriviaQuestion("who has won ballon d'or of 2014 ?", "Neymar", "Lionel Messi", "Cristiano Ronaldo", "Kaka", "Cristiano Ronaldo");
        this.insert(q19);
        TriviaQuestion q20 = new TriviaQuestion("the Founder of the most famous gaming platform steam is ?", "Bill Cliton", "Bill Williams", "Gabe Newell", "Bill Gates", "Gabe Newell");
        this.insert(q20);
    }
    public void insert(TriviaQuestion triviaQuestion) {
        ContentValues contentvalues = new ContentValues();
       /* contentvalues.put(UID,triviaQuestion.getId());*/
        contentvalues.put(QUESTION, triviaQuestion.getQuestion());
        contentvalues.put(OPTA, triviaQuestion.getOpta());
        contentvalues.put(OPTB, triviaQuestion.getOptb());
        contentvalues.put(OPTC, triviaQuestion.getOptc());
        contentvalues.put(OPTD, triviaQuestion.getOptd());
        contentvalues.put(ANSWER, triviaQuestion.getAnswer());
        SQLiteDatabase db = this.getWritableDatabase();
        db.insert(TABLE_NAME, null, contentvalues);
    }
    public List<TriviaQuestion> getAllQuestion() {
        List<TriviaQuestion> que = new ArrayList<>();
        SQLiteDatabase db = this.getWritableDatabase();
        String coloumns[] = {UID, QUESTION, OPTA, OPTB, OPTC, OPTD, ANSWER};
        Cursor cursor = db.query(TABLE_NAME, coloumns, null, null, null, null, null);
        while (cursor.moveToNext()) {
            TriviaQuestion triviaQuestion = new TriviaQuestion();
            triviaQuestion.setId(cursor.getInt(0));
            triviaQuestion.setQuestion(cursor.getString(1));
            triviaQuestion.setOpta(cursor.getString(2));
            triviaQuestion.setOptb(cursor.getString(3));
            triviaQuestion.setOptc(cursor.getString(4));
            triviaQuestion.setOptd(cursor.getString(5));
            triviaQuestion.setAnswer(cursor.getString(6));
            que.add(triviaQuestion);

        }
        Collections.shuffle(que);
        cursor.close();
        return que;
    }
}

A: You should add boolean in TriviaQuestion 'isAnswered' with getter & setter and take ArrayList< TriviaQuestion>  list.
Now you can update object by list.get(position).setIsAnswered(true).


text:
Q: How to return a blank page I can't seem to figure this out, how do I return a blank/white page in the admin area from a plugin page?
Edit:
How do I stop the default ui from loading and return an empty body instead?

A: To return a blank page that's been created in a plugin like so:
Example: blank-page.php
<?php
// Blank PHP page...

Use the following function:
add_filter( 'some_tag', 'wpse_238008_blank_page', 99 );

function wpse_238008_blank_page() { // Template with an empty page
    define( 'PLUGIN_PATH', plugin_dir_path( __FILE__ ) );
    return PLUGIN_PATH . '/path/to/blank-page.php';
}

Replace the following to suit your needs

*

*some_tag - Name of the filter to hook the function to

*/path/to/blank-page.php - Location of your blank page in your plugin

Your question isn't very clear when you say:

...how do I return a blank/white page in the admin area...

If you can update your question to specify where you want to see this exactly, I can give you an updated answer.