text:
Q: SQL select largest 10 entries by data in many-many relationship I have a SQL database set up with a User object, a Guild object, and a GuildMember object. Users can be in many guilds and guilds can have many users so the GuildMember object links them. The User object contains a value for their current balance of money and I'm looking for a way to get the richest users in a specific guild. Right now I'm just getting all users from the guild and sorting it myself but there could be up to 100k users in a guild and this seems incredibly inefficient. Is there a way to have SQL do more of the work? Basically I'm just trying to figure out a single statement to return the top 10 or so richest users from a Guild ID. I'm running a MySQL database.
Model:
User --> GuildMember <-- Guild
id: string | UID: string | id: string
econ: int | GID: string | other data
I've been using Sequelize (though I'm very open to using a prepared SQL statement instead) and this is my current system in TypeScript:
public static async getTop(guildId: string, num: number) {
  return Db.Guild.findByPk(guildId, { include: [{ model: Db.User, attributes: ['id', 'econ'] }] })
  .then(guild => (<UserInstance[]>guild.Users).sort((a, b) => b.econ - a.econ).slice(0, num));
}

Sample data:
User: id: 1, econ: 10
User: id: 2, econ: 3
...
User: id: 7, econ 12
--
Guild: id: 1, other data
Guild: id: 2, other data
--
GuildMember: UserId: 1, GuildId: 2
GuildMember: UserId 7, GuildId: 2
--
Expected output from querying richest in guild 2: [User 7, User 1].
Obviously this is a very simplified example as users may belong to multiple guilds and there will thousands of users per guild. I need to return the top 10.


text:
Q: Div is not displaying properly I am crating a registration form. When the user clicks the register button, if there is any errors I need to show them.For that I wrote the following code,
<?php  if($flag==0)
       {
   ?>
         <div class="info-message">
                <?php echo $error_message;?>
         </div><?php
      }

the css is,
    .info-message{
     background:yellow;
     padding:10px;
     border:1px solid black;
     color:black;
     width:780px;
}

but if the value of $flag = 1, padding space of the div is visible, but I needn't show the div if the value of $flag != 0. Please help me to solve this.

A: The div.info-message will only appear if $flag == 0. If you don´t want to show an empty div with padding you have to check also if $error_message == false! If that is not helpful I don´t understand your question!

redpajama_set_name: RedPajamaStackExchange


text:
Q: How does Python distinguish if a parameter is default? a = iter([1])
next(a)
next(a)

raises StopIteration

a = iter([1])
next(a)
next(a, None)

there is no StopIteration

however the defination of nextis
def next(iterator, default=None):
How does Python distinguish if the parameter is default or user-given?

A: The builtin function next doesn't use None as its default. In fact, as you can see in the C source code (for cpython, the official Python interpreter), its argument handling is very low level. The pure Python equivalent would be using *args in the function definition and and manually checking that you got either one or two arguments. Here's what that might look like:
def next(*args):
    assert(1 <= len(args) <= 2)
    try:
        return args[0].__next__()
    except StopIteration:
        if len(args) > 1:
            return args[1]
        else:
            raise

A better way to replicate similar behavior in Python is to use a default value that is not possible for outside code to accidentally supply. Here's one good way to do it:
_sentinel = object() # a unique object that no user should ever pass to us

def next(iterator, default=_sentinel):
    try:
        return iterator.__next__()
    except StopIteration:
        if default is not _sentinel:
            return default
        else:
            raise


text:
Q: Edit Outlook email from Excel VBA I've got the below code to successfully use a pre-made Outlook template that is saved locally on my machine (fileName) and attach the Active Excel document into it, however there is some additional text that I'd like to add to the email template to save me the time to copy and paste it over. Is there anyway to add ADDITIONAL body text to the pre-made email template or if I can have my VBA code read the body text and then I can add to it by storing it in a temporary variable? It's a saved .msg file
Public Function GenerateEmail(sendTo As String, _
    sendCC As String, sendBCC As String, _
    subjectText As String, fileName As String)

    Application.ScreenUpdating = False

    Dim OutApp As Object
    Dim OutMail As Object

    Set OutApp = CreateObject("Outlook.Application")
    Set OutMail = OutApp.CreateItemFromTemplate(fileName)

    With OutMail
        .sendTo = sendToText
        .CC = sendCCText
        .BCC = sendBCCText
        .Subject = subjectText
        .Attachments.Add (Application.ActiveWorkbook.FullName)
        .Display
    End With

    On Error GoTo 0

    Set OutMail = Nothing
    Set OutApp = Nothing

    With Application
        .ScreenUpdating = True
        .EnableEvents = True
    End With

End Function

A: You have to save down a template - you just draft a template (I typically use markers to substitute certain part of the body, depending on the recipient - like "Dear %Recipient%") and then "Save as" a .oft file. then run you code to sent the mails. I'd also use .HTMLbody to maintain the fomatting of the template so you'd put in
With OutMail
        .sendTo = sendToText
        .CC = sendCCText
        .BCC = sendBCCText
        .Subject = subjectText
        .HTMLbody= WorksheetFunction.Substitute(OutMail.HTMLbody, "%Recipient%", [Recipiants name here (this could be a stored string)])
        .Attachments.Add (Application.ActiveWorkbook.FullName)
        .Display
End With

A: Just add a .body to the email text such as below
 With OutMail
        .sendTo = sendToText
        .CC = sendCCText
        .BCC = sendBCCText
        .Subject = subjectText
        .body = "Add your Text here"
        .Attachments.Add (Application.ActiveWorkbook.FullName)
        .Display
End With


text:
Q: how to find the last time stamp of the particular TYPE file in that directory? how get the date and time of the last modified particular TYPE file in that directory
let me explain with an example
if i use the command dir *.reo /o:d
i get the all *.reo files in that directory sorted according to the date ..
this is the the last line of the output
29-03-2010 11.31 arun.reo
now i just want to copy the date and time of the last created file in variable or file .is it possible ?

A: You can do this using a batch file like this:
@echo off
setlocal enableextensions

for /f "delims=" %%f in ('dir *.reo /o:-d /b') do (
  set dt=%%~tf
  goto endloop
)

: endloop
echo %dt%

A little explanation:

*

*dir *.reo /o:-d /b produces a list of all .reo files in the current directory, sorted by date in descending order (so that the last modified file comes first).

*%%~tf expands to the date of the file specified by the %f variable.

A: It depends on what os your using. If you want just the last file
command one pipes the complete directory into a temp file
dir *.reo /o:d > temp.txt;
command two gets the last line of the temp file. Only works if you have the windowserver 2003 install which the link is provided below.
tail - 1 temp.txt;
Go to the Microsoft Windows Server 2003 download section at http://www.microsoft.com/windowsserver2003/
downloads/tools/default.mspx. Or, if that link does not work, visit http://www.microsoft.com/ and search for "Windows 2003". Once there, choose the "Downloads -> Tools" link.


text:
Q: converting ios 3rd party APIS to 64bit architecture i am new in ios development and now days working on an app that has been designed in 32 bit architecture with lots of 3rd party apis and cocopods usage in it.
As apple has decided to move all the apps to 64-bit architecture, i'm unable to figure out if there's any api in my code that's not following the rules and is still in 32bit architecture.
is there any way to check that and to convert them for 64bit architecture support.???

A: You can use lipo -info to get the supported architectures. For example:
lipo -info mylib.a
Could give an output like:
Architectures in the fat file: mylib.a are: armv7 i386 x86_64 arm64
In this case, you see arm64, which is the 64-bit slice you want.
As far as upgrading your libraries, you'll need to rebuild the libraries yourself or download new versions with 64-bit support.


text:
Q: How to select from partitioned table except a version in big query?
My data set have a partitioned table and I have select all from them:
Select Customer id
from Company.database.Customer_*

*

*various from (2022-01-01 till today)
But have a error version on 2022-06-08 and I dont want to select this version?

I tried
Select Customer id
from Company.database.Customer_*[^20220608] but well doesnt work

A: Finally I found the answer:
Company.database.Customer_TABLE_SUFFIX >=
  FORMAT_DATE("%Y%m%d", DATE_SUB(CURRENT_DATE(), INTERVAL 1 DAY)


text:
Q: how to view/edit a git remote branch Hi I'm completely new to git, but I have experience with SVN. All the tutorials assume that one knows how to view/edit a file when using git, but I'm confused. I cloned a repository (from someone who needed to share code with me), then checked out several remote branches to local branches. Now I want view the code (it's Java). I can't find the files anywhere on my file system. From the command line, it only gives me the diffs for different commits. I'm not interested in that! I just want to see the latest edition of the code, preferably in Eclipse. But at this point I would be happy to open it in gedit. Help!
Thank you very much!

A: If you cannot find any files in file system, it is possible that the repository is cloned with --bare option. You can clone the repository again, but without --bare.
git clone <repository>

A: First, here are a couple helpful general resources.  Here's a good, short git tutorial.
http://www.eecs.harvard.edu/~cduan/technical/git/
Chapter 0 of this Mercurial tutorial works just as well for someone moving from svn to git as svn to hg.  Only read this chapter, and replace any mention of Mercurial with Git.
http://hginit.com/top/00.html
Make sure you cloned the repository correctly.  I'll pretend we're doing this in your home directory.
cd ~
git clone git://url.to.remote.repository.com/foo.git

You should now have a folder ~/foo.  This is your working copy.  Inside foo you will find a folder .git.  .git holds your local repository.  To see the most up to date version of the project, run these commands.
cd ~/foo
git checkout master

Git will update the files in ~/foo to the most recent version in the repository.  Read the links I gave you at the beginning of this post to learn how to navigate around the git repository.


text:
Q: Cannot run PHP scripts anymore I had been running PHP script successfully for a year or so with WAMP but yesterday i noticed that scripts were not opening/running. When I go to http://localhost, the page just keeps on loading indefinitely. Of course, there is no errors in the scripts.
I tried:

*

*Re-starting All Services

*Re-installing WAMP

*Even tried easyphp (similar to wamp)

*uninstalled the suspicious softwares

When I tried telnet localhost 80, it says "Connecting to localhost..." but it never connects.
Interesting:
Am able to run script inside PHP Designer (the editor for PHP) but not on browser using WAMP as said before.
OS: XP SP2 with Avira Antivirus
Update:
Here is my Apache log, but I can't figure out what it says:
[Wed Feb 17 10:27:35 2010] [notice] Apache/2.2.8 (Win32) PHP/5.2.6 configured -- resuming normal operations
[Wed Feb 17 10:27:35 2010] [notice] Server built: Jan 18 2008 00:37:19
[Wed Feb 17 10:27:35 2010] [notice] Parent: Created child process 740
[Wed Feb 17 10:27:36 2010] [notice] Child 740: Child process is running
[Wed Feb 17 10:27:36 2010] [notice] Child 740: Acquired the start mutex.
[Wed Feb 17 10:27:36 2010] [notice] Child 740: Starting 64 worker threads.
[Wed Feb 17 10:27:36 2010] [notice] Child 740: Starting thread to listen on port 80.
[Wed Feb 17 10:31:15 2010] [notice] Parent: Received shutdown signal -- Shutting down the server.
[Wed Feb 17 10:31:15 2010] [notice] Child 740: Exit event signaled. Child process is ending.
[Wed Feb 17 10:31:16 2010] [notice] Child 740: Released the start mutex
[Wed Feb 17 10:31:17 2010] [notice] Child 740: All worker threads have exited.
[Wed Feb 17 10:31:17 2010] [notice] Child 740: Child process is exiting
[Wed Feb 17 10:31:18 2010] [notice] Parent: Child process exited successfully.
[Wed Feb 17 10:31:28 2010] [notice] Apache/2.2.8 (Win32) PHP/5.2.6 configured -- resuming normal operations
[Wed Feb 17 10:31:28 2010] [notice] Server built: Jan 18 2008 00:37:19
[Wed Feb 17 10:31:28 2010] [notice] Parent: Created child process 2200
[Wed Feb 17 10:31:28 2010] [notice] Child 2200: Child process is running
[Wed Feb 17 10:31:28 2010] [notice] Child 2200: Acquired the start mutex.
[Wed Feb 17 10:31:28 2010] [notice] Child 2200: Starting 64 worker threads.
[Wed Feb 17 10:31:28 2010] [notice] Child 2200: Starting thread to listen on port 80.
[Wed Feb 17 10:34:20 2010] [notice] Parent: Received shutdown signal -- Shutting down the server.
[Wed Feb 17 10:34:22 2010] [notice] Child 2200: Exit event signaled. Child process is ending.
[Wed Feb 17 10:34:24 2010] [notice] Child 2200: Released the start mutex
[Wed Feb 17 10:34:25 2010] [notice] Child 2200: All worker threads have exited.
[Wed Feb 17 10:34:25 2010] [notice] Child 2200: Child process is exiting
[Wed Feb 17 10:34:26 2010] [notice] Parent: Child process exited successfully.
[Wed Feb 17 10:43:32 2010] [notice] Apache/2.2.8 (Win32) PHP/5.2.6 configured -- resuming normal operations
[Wed Feb 17 10:43:32 2010] [notice] Server built: Jan 18 2008 00:37:19
[Wed Feb 17 10:43:32 2010] [notice] Parent: Created child process 3640
[Wed Feb 17 10:43:33 2010] [notice] Child 3640: Child process is running
[Wed Feb 17 10:43:33 2010] [notice] Child 3640: Acquired the start mutex.
[Wed Feb 17 10:43:33 2010] [notice] Child 3640: Starting 64 worker threads.
[Wed Feb 17 10:43:33 2010] [notice] Child 3640: Starting thread to listen on port 80.
[Wed Feb 17 10:46:27 2010] [notice] Parent: Received shutdown signal -- Shutting down the server.
[Wed Feb 17 10:46:27 2010] [notice] Child 3640: Exit event signaled. Child process is ending.
[Wed Feb 17 10:46:28 2010] [notice] Child 3640: Released the start mutex
[Wed Feb 17 10:46:29 2010] [notice] Child 3640: All worker threads have exited.

A: Turn off anything running on port 80 ie Skype  (you can run skype after wampserver starts but not before)
I have the same problem also happen to me in Internet explorer are you using that browser?  If you are running certain addons in IE it will cause this issuse such as "AVG safe search" if i recall that was the one causing me problems... but you may want to disable add-ons and try that... try different browsers...
edit:
one more thing:  check out one of my tutorials on how to edit the host file you may try remove  line 19 and save the file and then restart your server and try localhost again or your local ip 127.0.0.1
http://vzio.com/learn_web-design_development/how-to-customize-localhost-to-anything-you-choose-httpmypage/

A: First check if your apache server is running.
Start->Run->cmd
and then execute command:
netstat -abn
Lookup the result for line like this:
TCP    0.0.0.0:80             0.0.0.0:0              LISTENING       600
[apache.exe]
If you cant find anything listening on port 80 ( no 0.0.0.0:80 line) then your apache is failing to start. To find out why it cant start you should find apache log directory and examine the error.log (may be you have updated your php resently?).
If you find 0.0.0.0:80 listening line but some other software is listening there (do you have IIS running?) then you should remove / reconfigure that softure to free port 80.
If you have apache listening on port 80 but still cant open your site and you cant figure out what is causing the problem via examining apache log files then it my be database problem. Check if your mysql is running and listening using same command but you should be looking for
TCP    0.0.0.0:3306           0.0.0.0:0              LISTENING
[mysqld-nt.exe]
If you cant find such line then your mysql server is not running - check mysql log files for errors.
If both servers are running and you cant get any output in your browser then check your firewall and antivirus - they may block your requests.
Hope this helps ;)

A: open up command prompt and confirm:
telnet localhost 80
is never connecting, it could be a firewall is dropping packets. Try turning off firewall.
Or you webserver (apache?) is not responding and is hung. Try: stopping apache, confirm apache is no longer running (check task manager), and starting apache.


text:
Q: How is a MongoDB ObjectID 12 bytes? From what I know, Strings in MongoDB are stored in UTF-8, so each character is between 1 and 4 bytes.
MongoDB documentation says the following about ObjectID:

Returns a new ObjectId value. The 12-byte ObjectId value consists of:
a 4-byte value representing the seconds since the Unix epoch,
  a 5-byte random value, and
  a 3-byte counter, starting with a random value.

In an example, it shows ObjectId("507f1f77bcf86cd799439011"). This String is 24 bytes though in UTF-8, so I don't understand where the 12 bytes come into play.

A: As per the ObjectId documentation, that string you see is a hex representation of the 12 bytes. It's not Unicode or even a string. It's actually a number.
A byte is 8 bits, meaning that it can have 2^8 == 256 possible values (see Byte).
How do you represent a number with 256 possible values succinctly? How about representing it as 16^2 instead? You can achieve this by using 2 hexadecimal values (base 16). The only thing you need to invent is a numbering system that goes to 16 instead of 10.
As a matter of fact, we use letters from a to f to represent values 10 to 15.
Thus, one byte can be represented in two hexadecimal numbers. It just happens to use a to f since we couldn't be bothered to invent special symbols for them. They are not letters. They are numbers.
So no, the string you see in ObjectId does not represent 24 bytes. Every 2 characters represent a byte instead. 24 hex numbers == 12 bytes.

A: Supplementing the @kevinadi answer , let's examine a bit the code of ArrayBuffer presented below for 12 bytes of ObjectId reflected representation where as every indexed character (elements, characters – both are synonyms in this particular context) within our chosen TypedArray is in the condition of "2 BYTES_PER_ELEMENT". As far as I am considered MongoDB 12 bytes ObjectId + 4 unused indexed allocations within fixed-size TypedArray composes 16 byte (hexadecimal approach) , where as if not compressed , this would be equivalent of 24 elements + 8 unused indexed allocations (in total 32). In every part of scenario 2 times 16 (MongoDB ObjectId is presented in hexadecimal string) is equal to 32 . Simple math , right ? Now let's examine a bit the possible interpretation of ArrayBuffer in use with TypedArray chosen to mock the process of allocation vs. compression and their properties of: .length vs. .byteLength respectively :

const init_buffer = new ArrayBuffer(16); // init allocation
const uint8_inst1 = new Uint8Array(init_buffer);
const uint8_inst2 = new Uint16Array(uint8_inst1);
console.log("2 BYTES_PER_ELEMENT i.e. 2 times less than total quantity of characters available [compressed approach]: ", uint8_inst2.length);
console.log("How many characters in total available [uncompressed approach]: ", uint8_inst2.byteLength);


text:
Q: Show Chm file using Help.ShowHelp() How to show local chm file in new window without disturbing background using help.showhelp(control, path) on-click in web-browser on server side. I was passing control object without any parameters and it was displaying the chm file with clearing of the div contents. How to overcome this problem.
Thanks in Advance.

A: Server Side Scripting
Since I was making a server call onclick of help link the Page_Load method in the aspx.cs file is called and tries to assign the values to the fields. Here I have a condition where if it IsPostback to skip the set of statements. So the those fields are made null. To avoid that I have declared the fields out of the IsPostback condition.
Client Side
To avoid the complete page to reload I was using update panel.
 < asp:ScriptManager ID="smAJAX1" runat="server" ScriptMode="Release" >< /asp:ScriptManager >
    < asp:UpdatePanel ID="UpdatePanel1" runat="server" >
        < ContentTemplate >
            < a href="#" runat="server" class="" title="Help File" onserverclick="helpdoc">help</a >
        < /ContentTemplate >
    </asp:UpdatePanel>


text:
Q: Errors in rendering a RSS page I'm trying to render a RSS page for a site.
The RSS it'self works fine and it's also validated. It's built by a PHP script I made.
However, when I implement the CSS and the XSL, and I call the page, what I get is this message:
This page contains the following errors:

error on line 4 at column 1: Document is empty
Below is a rendering of the page up to the first error.

This document was created as the result of an XSL transformation. The line and column numbers given are from the transformed result.

But the line 4 is not empty at all, nor the rest of the document.
Please, here there is the XSL file:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/feed">

        <link href="xsl.css" rel="stylesheet" type="text/css" />

            <xsl:element name="a">
                <xsl:attribute name="href">
                    <xsl:value-of select="channel/link" />
                </xsl:attribute>
                <xsl:value-of select="channel/title" />
            </xsl:element>

                <xsl:value-of select="channel/description" />

                <xsl:for-each select="channel/item">

                        <xsl:element name="a">
                            <xsl:attribute name="href">
                                <xsl:value-of select="link"/>
                            </xsl:attribute>
                            <xsl:value-of select="title"/>
                        </xsl:element>

                        <xsl:value-of select="description" />

                        <xsl:value-of select="pubDate" />

                </xsl:for-each>

            <xsl:value-of select="channel/copyright" />

</xsl:template>
</xsl:stylesheet>

The page is "visible" here:
http://www.melanie-music.net/feed/?feed=rss2
you will get the error above but if you go to check the Source, you find the code
What can I do please?

EDIT:
deleting the XSL line and adding the argument
xmlns:atom="http://www.w3.org/2005/Atom"

to the RSS tag, at least I made fworking the CSS
Still all the CDATA not correctly interpreted

A: Ok if anybody has what I got, the way to remove the attribute to the <rss> tag is good choice
For the CDATA, I foudn this topic:
Styling RSS feed using XSLT issues with CDATA tags
which is great, but you need to work a bit with it, in order to make it working in an acceptable way and having added
<xsl:output method="html" doctype-system="about:legacy-compat" encoding="UTF-8" indent="yes" />

to have the HTML5 (let's say)


text:
Q: How do I exclude commented lines from searches in Xcode? Is it possible to exclude commented lines (either individual, or groups) from searches in Xcode?
If so, how can this be done?

A: No, you cannot exclude comment lines from Xcode search.
You can use "search scopes" to search more efficiently in Xcode:

Reference by Apple docs:

The refined search navigator allows all current search options and settings to be seen at a glance. The options are easily manipulated by clicking directly on them in the search navigator. You can set search scopes, including selecting multiple folders in a project, and save them by name for easy re-use. The search results display wraps to allow you to see ore results easily and quickly.


text:
Q: How to change the contents in the header of Magento 2 I have attached the screenshots images of my store and the model how it should appear. I have to change according to that. can anyone please help how to change or customize the header of the magento 2.
I have to change the header in 1st image to the header in the 2nd image

A: Do some to create custom container into

app/design/frontend/Agtech/mapharma/Magento_Theme/layout/default.xml

Just Use Move to function for that design.

A: Customizing Header in extended Your Current Theme
You need to make changes in following files.
1 ) Adding DIV around your logo and giving styles
app/design/frontend/vendorname/themename/Magento_Theme/templates/html/header/logo.phtml

Use _extend.less for adding custom styles
app/design/frontend/vendorname/themename/Magento_Theme/web/css/source/_extend.less

2 ) Edit you search box in your extended module, extend if not extended . Add DIV around and assign our class and define styles in _extend.less
app/design/frontend/vendorname/themename/Magento_Search/templates/form.mini.phtml

3 ) Same above method you can use for Navigation at below path in sections.phtml
app/design/frontend/vendorname/themename/Magento_Theme/templates/html/header/sections.phtml

I hope this will help you, let me know if any issue
Run upgrade/deploy/cache commands to see the CSS changes if using _extend.less for custom styling
Thanks


text:
Q: How to calculate size per minute of MP4 file(MPEG4,H.264)? I've a .MP4 file. I know MP4 file has some attributes such as: general bitrate,file size.
Video: Max bitrate,min bitrate,avg bitrate,size
Audio: Max bitrate,min bitrate,avg bitrate,size
I want to get the size(or maximum size) per minutes from above attributes.
Can anyone help me?
Thank so much

A: If the average bitrate is in bits per second (I think it is?), then you can get the "size per minute" like this:
 sizePerMin = 60 * avgBitRate

Which will be the size per minute in bits.  You can do similar for the max and min size per minute.

A: Here is an online video-file-size calculator, you can specify your settings, and run it:
http://www.dr-lex.be/info-stuff/videocalc.html


text:
Q: Elastic Search Information On ElasticProperty Can anyone tell me what this means?
[ElasticProperty(Index = FieldIndexOption.Analyzed)]
I've been looking through documentation and I just don't understand what it means.

A: It is an annotation that Nest uses to infer information about how to tell ElasticSearch to index/analyze the field. In this case, it says that this field should be analyzed.


text:
Q: HTML CSS DIV margin-top doesn't work I'm trying to make a menu bar that is vertically on the right side of the screen. The menubar should touch the horizontal main navigation bar on the top, but i can't set the top margin of the vertical bar to zero.
Here:
https://www.dropbox.com/s/azz5diwqzfchued/Schermafdruk%202015-09-08%2022.22.09.png?dl=0
is a screenshot of how chrome inspect element shows the problem, this might make things a bit clearer.
Thanks in advance!

A: According to the element inspector your margin-top style got a syntax problem.
From the looks of it I'd say you used a double ':' (colon) character.
Try removing the double ':' character and try again.
If this still doesn't work, maybe another style is overriding your new one so you could try:
margin-top: 0 !important;

This will make sure this style will always have the highest priority.


text:
Q: Remove Backward Rewinding Loop from Owl carousel I have created a simple slider with Owl carousel. In that slide contains total of 4 slides.
It works fine, but problem is after reaching 4 slide the carousel goes to 1st slide in backward rewinding.
I need a forward direction for all the slides in div data.
This is the settings which i have used,
<script>
        $(document).ready(function(){
    $("#testimonial-slider").owlCarousel({

        items:1,
        itemsDesktop:[1000,1],
        itemsDesktopSmall:[979,1],
        itemsTablet:[768,1],
        pagination:true,
        navigation:false,
        navigationText:["",""],
        slideSpeed:500,
        singleItem:true,
        autoPlay:true,
    });

});

</script>

Demo Page


text:
Q: Which package should I download to compile C++0x code OS is Ubuntu 10.04.
I need to compile some C++ code with -std=c++0x flag. But compiling doesn't work because I need 4.6.1 version.
Now, when I go to Gnu's ftp, I see two different packages:
gcc-4.6.1
gcc-g++-4.6.1

Knowing that I need to compile C++0x code, which one should I download, and how do I install it/them?
I already installed these libraries (gmp, mpc and mpfr).

A: Find yourself a PPA that suits your needs, and install a GCC package from there. There are install instruction within each PPA's page.
Obviously, PPAs contain unofficial packages, so YMMV.

A: I think this PPA has gcc 4.6.1 : Toolchain test builds. But the installation process probably will replace other packages. Probably would be safer downloading the source and compiling it yourself.
You can also upgrade to 11.10 or install it in a VM (currently it has gcc/g++ 4.6.1).


text:
Q: Render react app inside a plain html project? I have the following problem.
I created a bunch of plain html/css/js pages to do the landing of my webpage due to the fact that i didn't feel necessary to add react to them, due to the fact that all the data there is static.
Now i want to create all the login and inner app stuff, is there a way to keep the plain html files and have a react project at the same time?
My idea is something like create the react app, send all the plain files to the public files and, instead of starting the app in the index.html file given by react, start my app in my home.html file (one of the static files i created), but i don´t know if that is even possible.

A: Not sure if this is what you're looking for, but you can have a react app running anywhere really. You can also use JSX, although you would need a transpiler for it like babel. So here is an example of a React app right here within my answer:

This is a static component

Just give it a try right here. This can allow you have a website where any random page can be powered by React, while others may or may not. React is pretty pliable like that.


text:
Q: Haskell ByteString / Data.Binary.Get question Attempting to use Data.Binary.Get and ByteString and not understanding what's happening. My code is below:
getSegmentParams :: Get (Int, L.ByteString)
getSegmentParams = do
    seglen <- liftM fromIntegral getWord16be
    params <- getByteString (seglen - 2)
    return (seglen, params)

I get the following error against the third item of the return tuple, ie payload:
Couldn't match expected type `L.ByteString'
       against inferred type `bytestring-0.9.1.4:Data.ByteString.Internal.ByteString'

Someone please explain to me the interaction between Data.Binary.Get and ByteStrings and how I can do what I'm intending. Thanks.

A: It says you expect the second element of the tuple to be a L.ByteString (I assume that L is from Data.ByteString.Lazy) but the getByteString routine returns a strict ByteString from Data.ByteString.  You probably want to use getLazyByteString.

A: There are two ByteString data types: one is in Data.ByteString.Lazy and one is in Data.ByteString.
Given the L qualifying your ByteString, I presume you want the lazy variety, but getByteString is giving you a strict ByteString.
Lazy ByteStrings are internally represented by a list of strict ByteStrings.
Fortunately Data.ByteString.Lazy gives you a mechanism for turning a list of strict ByteStrings into a lazy ByteString.
If you define
import qualified Data.ByteString as S

strictToLazy :: S.ByteString -> L.ByteString
strictToLazy = L.fromChunks . return

you can change your code fragment to
getSegmentParams :: Get (Int, L.ByteString)
getSegmentParams = do
    seglen <- liftM fromIntegral getWord16be
    params <- getByteString (seglen - 2)
    return (seglen, strictToLazy params)

and all should be right with the world.


text:
Q: Proper way to return JSON list in Web API with MVC and partial model I am trying to use Web API to grab certain fields from my MVC controller.  I can't seem to match the right type with the right list.  I am fine with converting everything to string.
I either get an error in code (can not convert types), or if I get it to compile, I get this error:
"The 'ObjectContent`1' type failed to serialize the response body for content type 'application/xml; charset=utf-8'."

From other similar posts, people responded with how to create a list, but not with the declaration of the return value of the Get.  Please include both.
Also I would prefer not to add additional controllers as I need to do this on a number of my models.
Here is my code--note you can see I tried a number of different ways:
public class APICLIENTsController : ApiController
{
    private ApplicationDbContext db = new ApplicationDbContext();

    // GET api/<controller>
    public IEnumerable<string> Get()
    //public IEnumerable<CLIENT> Get()
    {
        //return db.CLIENTs.OrderBy(x => x.CLIENTNAME).ToList();
            string[] listOfUsers = db.CLIENTs.OrderBy(x => x.CLIENTNAME).Select(r => new
            {
                ID = r.CLIENTID.ToString(),
                NAME = r.CLIENTNAME
        });

        return listOfUsers.ToList();
        //return db.CLIENTs.Select(x => new { x.CLIENTNAME }).ToArray();
    }

A: If you want to return JSON use the

JsonResult

type.
public JsonResult Get()
{
    //return db.CLIENTs.OrderBy(x => x.CLIENTNAME).ToList();
    string[] listOfUsers = db.CLIENTs.OrderBy(x => x.CLIENTNAME).Select(r => new
    {
        ID = r.CLIENTID.ToString(),
        NAME = r.CLIENTNAME
    });

    return Json(listOfUsers.ToList(), JsonRequestBehavior.AllowGet);
}

A: Your query is returning a collection of anonymous objects, not string[] so it will throw an exception. Even if you were to generate string[] by concatenating the CLIENTID and CLIENTNAME properties, it would be a little use to the client.
Create a model to represent what you need to return to the view
public class ClientVM
{
    public int ID { get; set; }
    public string Name { get; set; }
}

and modify your method to
public IEnumerable<ClientVM> Get()
{
    IEnumerable<ClientVM> model = db.CLIENTs.OrderBy(x => x.CLIENTNAME).Select(r => new ClientVM
    {
        ID = r.CLIENTID,
        Name = r.CLIENTNAME
    });
    return model;
}

Side note: depending on how your calling and consuming this in the client, you may need to change the Content-Type to specifically return json (refer these answers for more detail)


text:
Q: #using  in VS2012 links to 4.0 version but I need 2.0. How? I'm trying to migrate my .NET 2.0 C++/CLI project from VS2008 to VS2012. After the conversion, the project depends on 4.0. When I do the
<TargetFrameworkVersion>v2.0</TargetFrameworkVersion>

the project depends on 2.0 and 4.0. I verify that by looking in the External Dependencies magic folder in Solution Explorer. It also gives me compiler warning when I reference the project in a 2.0 C# project.
Commenting out #includes reveals that the 4.0 dependency is pulled in by #using directives in Microsoft headers such as vcclr.h and atlbase.h.
I need these headers for the classes and functions they provide. How do I make the #using directives in them point to 2.0 version of mscorlib.dll instead of 4.0?

A: Changing the <TargetFrameworkVersion> isn't enough, the build tools still use the .NET 4 version that's installed on your machine.  Something you can see by running ildasm.exe on the generated assembly.  Double click the manifest to see:
// Metadata version: v4.0.30319
...
.assembly extern mscorlib
{
  .publickeytoken = (B7 7A 5C 56 19 34 E0 89 )                         // .z\V.4..
  .hash = (DD 9E C9 8D BF 2A 2D C2 AA 2D C3 8B 51 CD 4C A6   // .....*-..-..Q.L.
           15 F0 22 F6 )                                     // ..".
  .ver 2:0:0:0
}
...
.assembly extern mscorlib as mscorlib_4
{
  .publickeytoken = (B7 7A 5C 56 19 34 E0 89 )                         // .z\V.4..
  .hash = (47 6E C0 E3 BA CD CE B1 9A 4D 68 BE 29 75 61 6F   // Gn.......Mh.)uao
           BE 04 C6 BA )
  .ver 4:0:0:0
}

Note how both versions of mscorlib.dll ended up as a dependency.  The problem you encountered.
The feedback article I linked recommended changing the toolset to "v90".  This however doesn't work on my machine, even though I have VS2008 installed.  The option doesn't show up in the combobox dropdown and when I force it I get this build error:

C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V110\Microsoft.Cpp.Platform.targets(43,5): error MSB8020: The builds tools for Visual Studio 2008 (Platform Toolset = 'v90') cannot be found. To build using the v90 build tools, either click the Project menu or right-click the solution, and then select "Update VC++ Projects...". Install Visual Studio 2008 to build using the Visual Studio 2008 build tools.

Following the advice given in the error message, I get this:
------ Update VC++ projects started -------
Updating project 'ConsoleApplication74'...
    Configuration 'Debug|Win32': changing Platform Toolset to 'v110' (was 'v90').
    Configuration 'Release|Win32': no update required. Platform Toolset is 'v110'.
    TargetFrameworkVersion = v4.5 (was v2.0)

Back to square one.  I'd say that targeting .NET 2.0 in C++/CLI projects with VS2012 is a lost cause.

A: One way to do it is to open up the project file (.vcxproj) and change the
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
to
<TargetFrameworkVersion>v2.0</TargetFrameworkVersion>
See Change C++/CLI project to another framework than 4.0 with vs2010


text:
Q: Are there any issues using Angular Material with Protractor for E2E testing? I've been experiencing the intermittent timeouts that are blamed in the Protractor FAQ on use of $timeout for polling (AKA: The waitForAngular timeout). I wonder if it fails also in the cases its not polling. For my team it comes more to light as we rely on the Angular Material components. They are heavy on animation interactions with constant use of $timeout(func, 0).
This question is similar to issue #29966301, but focuses on a possible issue between Angular Material and Protractor.
I'm really interested to know how folks that heavily utilize Angular Material and Protractor deal with such issues if they encounter them at all.
The interesting point is that I have not seen neither in the Protractor nor Angular Material github sites any utilization of each others capabilities. Since both of them are Angular libraries coming from the same group in Google, @juliemr and the Protractor Gang can talk with @ThomasBurleson and the Material group to come up with comprehensive use cases and E2E tests for Angular Material using Protractor to flush out these issues.

A: Well protractor is designed to test angular, so if you are using waitForAngular function and your website is angular you should not use that, you should do the following beforeEach test:
browser.ignoreSynchronization = false;

and you can do this to make your tests faster and probably help removing the timeout problem, on your protractor-conf.js file add this code:
...
onPrepare: function() {
    var disableNgAnimate = function () {
        angular.module('disableNgAnimate', []).run(function($animate){
            $animate.enabled(false);
        });
    },
    browser.addMockModule('disableNgAnimate', disableNgAnimate);
},

...
and maybe you should check this video out.

A: I would add that disabling ngAnimate may not be enough. You may also have to disable Angular Material's CSS animation by injecting CSS inside the protractor 'onPrepare' option. (How to disable animations in protractor for angular js application).


text:
Q: How can I get an specific list item from ListView tap event in nativescript I'm trying to get data from a tap event using angular2 + typescript:
this is the component HTML:
<RadListView row="1" [items]="groceryList" [class.visible]="listLoaded" (tap)="seeItem($event)"
    swipeActions="true" (itemSwipeProgressStarted)="onSwipeCellStarted($event)">

    <ng-template let-item="item">

    </ng-template>

    <GridLayout *tkListItemSwipeTemplate columns="*, auto">
        <StackLayout id="delete-view" col="1" (tap)="delete($event)" class="delete-view">
            <Image src="~/images/delete.png"></Image>
        </StackLayout>
    </GridLayout>
</RadListView>

This is the component code:
seeItem(args: ListViewEventData) {
    console.log('item ', <Grocery>args.object.bindingContext);
    console.log('in case');
}

When I tap an element from my ListView I get the console.log:
[Eric Guzmán's iPhone]: item undefined
[Eric Guzmán's iPhone]: in case

The "delete" event (in this component) works using the same logic, when tap:
delete(args: ListViewEventData) {
        let grocery = <Grocery>args.object.bindingContext;
        this.groceryService.delete(grocery.id)
            .subscribe(() => {
                let index = this.groceryList.indexOf(grocery);
                this.groceryList.splice(index, 1);
            });
    }

I'm a beginner in NativeScript and I would appreciate the help,

A: If you are expecting to get the item on tap, here are the changes you need to make
replace
<ng-template let-item="item">

</ng-template>

with
<ng-template let-item="item">

</ng-template>

And make the changes in the function
seeItem(item: Grocery) {
    console.log('item ', item);
    console.log('in case');
}

Try this it should work.


text:
Q: Best practices with regard the read of vast amounts of files in apache spark I want to deal with a vast amount of .DAT files which contain measurements per second (each line represents a second) from an electrical device.
I have more than 5000 files each of which is about 160 KiB (not that much actually), but I am finding it difficult to find an efficient or recommended way to deal with this kind of problem: create an object that summmarizes each file content.
This is my file structure:
feeder/
     CT40CA18_20190101_000000_60P_40000258.DAT
     CT40CA18_20190101_010000_60P_40000258.DAT
     CT40CA18_20190101_020000_60P_40000258.DAT
     CT40CA18_20190101_030000_60P_40000258.DAT
     CT40CA18_20190101_040000_60P_40000258.DAT
     ....
     ....
     ....
     CT40CA18_20190812_010000_60P_40000258.DAT

My current code in Java Spark (2.1.1 version) is:
public class Playground {

    private static final SparkSession spark = new SparkSession
            .Builder()
            .master("local[*]")
            .getOrCreate();

    public static void main(String[] args) {

        Dataset<FeederFile> feederFileDataset = spark
                .read()
                .textFile("resources/CT40CA18/feeder/*.DAT")
                .map(new ParseFeederFile(), Encoders.bean(FeederFile.class));

    }
}

ParseFeederFile is:
package transformations.map;

import model.FeederFile;
import org.apache.spark.api.java.function.MapFunction;

public class ParseFeederFile implements MapFunction<String, FeederFile> {

    private StringBuilder fileContent;

    public ParseFeederFile() {
        fileContent = new StringBuilder();
    }

    @Override
    public FeederFile call(String s) throws Exception {
        return new FeederFile().withContent(fileContent.append(s).append("\n").toString());
    }
}

and FeederFile
package model;

import java.io.Serializable;

public class FeederFile implements Serializable {

    private String content;

    public FeederFile() {}

    public void setContent(String content) {
        this.content = content;
    }

    public String getContent() {
        return content;
    }

    public FeederFile withContent(final String content) {
        this.content = content;
        return this;
    }
}

The problem is that when map invokes call the string that is passed represents a line of a .DAT file. Therefore there is a vast and unnecessary creation of FeederFile objects. Another problem is that textFile does not differentiate between different files so everything is being appended to the same object (i.e, content of all files are in attribute content in FeederFile class)
I managed this naive way for retrieving all the content (I do not want all the content itself, but to create a sort of object that summarises information about the .DAT file, like the lines count, and some statistics based upon the data)
Does any of you come up with an idea on how can I create a FeederFile per .DAT?
Thank you in advance for any help you can provide.

A: You could use:
sparkContext.wholeTextFiles(...)

SparkContext's whole text files method, i.e., sc.wholeTextFiles in
  Spark Shell, creates a PairRDD with the key being the file name with a
  path. It's a full path like
  "hdfs://aa1/data/src_data/stage/test_files/collection_vk/current_snapshot/*".
  The value is the whole content of file in String.


text:
Q: Comparar arrays en Swift Tengo dos arreglos: en arreglo 1 cambian los valores, el arreglo 2 tiene que sincronizarse con el primero, pero sin perder las posiciones del valor.
He probado con difference(from:) pero reordena los valores del arreglo 2.
Aquí como debería ser:
let array1 = ["01", "06", "17", "22", "33", "45", "04"]
var array2 = ["04", "17", "22", "10", "01", "34"]

//
...
// Resultado
var array2 = ["04", "17", "22", "01", "06", "33", "45"]

El orden de los valores que hay en arreglo 2 tienen que permanecer, borrar los que no haya en el arreglo 1 y agregar al final del arreglo 2 los que faltan del arreglo 1.

A: Espero que esto sea ayuda, agregando un método filter al array2 y array1 y utilizando el metodo includes se puede lograr el resultado esperado

let array1 = ["01", "06", "17", "22", "33", "45", "04"];
var array2 = ["04", "17", "22", "10", "01", "34"];

  array2 = array2.filter((item) => array1.includes(item));
  array1 = array1.filter((item) => !array2.includes(item));

  array2 = [...array2, ...array1];

  console.log(array2);

A: Esta es la mejor solución que consigo
let array1 = ["01", "06", "17", "22", "33", "45", "04"]
var array2 = ["04", "17", "22", "10", "01", "34"]

let remove = (array2.filter{!array1.contains($0)})
let append = (array1.filter{!array2.contains($0)})
for i in remove {
    array2 =  array2.filter {$0 != i}
}
array2.append(contentsOf: append)

print("array2:\(array2)")
// array2:["04", "17", "22", "01", "06", "33", "45"]


text:
Q: Parse.User Reading User info if not current user I'm trying to get a user's email address without being the "current user".
var query = new Parse.Query(Parse.User);
query.equalTo("objectId", "8Vv6axJ");
query.find({
success: function(object) {
var username = object.get("username");
   alert(username);
   }
 });

Seems that I can't get at it.  Docs seem to say I should be able to get at it.  Seems to not like the var=username line.   Thanks.
LATER EDIT:    So, per suggestions, I changed to code to:
var query = new Parse.Query(Parse.User);
query.equalTo("objectId", "cx1ha3YPZj");
query.find({
   success: function(results) {
         alert(results.length);
         for (var i = 0; i < results.length; i++) {
             var username = results[i].get("username");
         }

results.length is 0  .  I know the objectID is correct, copied from Parse Browser.
OK.  Here is what I have determined:
It appears that although the Parse Docs say that any user can read User data, the following contradicts that.  So, the following ACL from User indicates that only the user can read and write it. If you try to change the ACL in the Parse.User, when you refresh it, it changes it back to original ACL.
{"cx1ha3YPZj":{"read":true,"write":true}}
parse ACL link
Parse.ACL(arg1)
Creates a new ACL. If no argument is given, the ACL has no permissions for anyone. If the argument is a Parse.User, the ACL will have read and write permission for only that user.

A: Object is a reserved name in several browsers. That's probably why you get the error. Change object to something else should solve the problem.
Also results will return an array of results like:
var query = new Parse.Query(Parse.User);
query.equalTo("objectId", "8Vv6axJ");
query.find({
    success: function(results) {
       alert(results.length);
       for (var i = 0; i < results.length; i++) {
           var username = results[i].get("username");
       }
    }
});


text:
Q: What is the purpose of UTF-8 hex 00 (U+0000) to hex 1f (U+001f)? How and where are they used? What are they for in the context of networking, specifically, websockets?

A: The characters x00-x1F are "C0 control codes". A few of them are generally used and understood, such as the tab character or the line separator characters, but most of them are rarely used. They are sometimes used in special contexts, for example in hardware or in specific communication protocols.
In the context of websockets, the control codes do not have any special meaning, with perhaps the exception of the carriage return CR x0D and line feed x0A characters. These characters are used to terminate HTTP protocol headers in the initial websocket handshake.


text:
Q: array of objects in genie I have 2 classes: one with 2 properties and one with an array. I want to make an array of objects of the first class.
The example compiles, but gives a wrong answer. Why?

[indent=4]

class data

    prop first_name : string = " "
    prop last_name    : string = " "

class Arr : Object

    person : data
    dataset : array of data[]

    init
        person = new data()
        dataset = new array of data[3]

    def date_input()

        print "\n data input \n"

        person.first_name = "Egon"
        person.last_name = "Meier"

        dataset[0] = person

        print dataset[0].first_name + " " + dataset[0].last_name

        person.first_name = "John"
        person.last_name = "Schneider"

        dataset[1] = person

        print dataset[1].first_name + " " + dataset[1].last_name

        person.first_name = "Erwin"
        person.last_name = "Müller"

        dataset[2] = person

        print dataset[2].first_name + " " + dataset[2].last_name

    def date_output()

        print "\n data output \n"

        for i : int = 0 to 2
            print dataset[i].first_name + " " + dataset[i].last_name

init

    Intl.setlocale()

    var a = new Arr()

    a.date_input()
    a.date_output()

A: The fundamental problem is you are referring to the same person three times, but changing their name each time. In Genie there are both value types and reference types. Value types are simpler and automatically copied on assignment. For example:
[indent=4]
init
    a:int = 2
    b:int = a
    b = 3
    print( "a is still %i", a )

A reference type has the advantage that it can be easily copied, Genie simply keeps a count of the references made. So to copy a reference type the reference count is increased by one, but this means that changes to the underlying object will affect all variables that refer to it:
[indent=4]
init
    a:ReferenceTypeExample = new ReferenceTypeExample()
    a.field = 2
    b:ReferenceTypeExample = a
    b.field = 3
    print( "a.field is not 2, but %i", a.field )

class ReferenceTypeExample
    field:int = 0

In the working example below I have made Person a value object by using readonly properties:
[indent=4]
init
    Intl.setlocale()

    var group = new Group()
    print "\n data input \n"
    try
        group.add_person( new Person( "Egon", "Meier" ))
        group.add_person( new Person( "John", "Schneider" ))
        group.add_person( new Person( "Erwin", "Müller" ))
    except err:GroupError
        print( err.message )
    print( @"$group" )

class Person
    prop readonly first_name:string = ""
    prop readonly last_name:string = ""

    construct( first:string, last:string )
        _first_name = first
        _last_name = last

exception GroupError
    GROUP_FULL

class Group
    _people_count:int = -1
    _group:new array of Person
    _max_size:int = 2

    construct()
        _group = new array of Person[ _max_size ]

    def add_person( person:Person ) raises GroupError
        _people_count ++
        if _people_count > _max_size
            _people_count = _max_size
            raise new GroupError.GROUP_FULL(
                        "Group is full. Maximum is %i members",
                        _max_size + 1
                        )
        _group[ _people_count ] = person

        print( "  " + _group[ _people_count ].first_name +
               " " + _group[ _people_count ].last_name
             )

    def to_string():string
        result:string = "\n data output \n\n"
        if _people_count < 0
            result += "  empty group"
            return result
        for i:int = 0 to _people_count
            result += "  " + _group[i].first_name + \
                      " " + _group[i].last_name + "\n"
        return result

Some details about the code:

*

*By changing the properties to be readonly an error will be given when you compile the program if it tries to change a detail of Person. In your example, if you change the properties of data to be readonly then the Vala compiler will warn you are trying to re-write the current object

*Person has its data values set in the constructor and then any attempt after that to change them is an error

*For a simple property Genie generates an automatic backing field that starts with an underscore. For example in Person the property first_name has the backing field _first_name and it is that field that is set in the constructor

*Instead of including the people's names in the method itself, a method called add_person() is used that takes a Person as a parameter. This separates the concrete data from the abstract class

*Checks have been added to the add_person() method to make sure the array doesn't go beyond its limits. If more people are added to the group than are allowed then an exception is raised

*The add_person() calls in the init block create the Person as part of the method call. This means a reference to a Person object is not kept in the init block


text: Q: Microsoft edge could not save picture as When I open Microsoft edge and right click on a picture--> save picture as-->I got " Web browser could not save picture as". I have tried to reinstall Microsoft edge, change sign in to local account, scan antivirus, repair windows but it is still the same problem. My windows 10 version 1511.


text:
Q: sharepoint remote event receiver itemDeleting event not firing I have written a remote event receiver to fire when item is deleting in a docmentlibarary. but itemDleting event is not firing.But itemAdded and ItemDeleted events are working ok.
in remote event receiver file
public void ProcessOneWayEvent(SPRemoteEventProperties properties)
        {

            if (properties.EventType == SPRemoteEventType.ItemDeleting)
            {
                using (ClientContext clientContext = TokenHelper.CreateRemoteEventReceiverClientContext(properties))
                {
                    if (clientContext != null)
                    {
                        try
                        {
                            DeleteDocuments(properties);
                        }
                        catch (Exception ex) { }
                    }
                }
            }

        }

in appeventreceiver file
 public SPRemoteEventResult ProcessEvent(SPRemoteEventProperties properties)
        {
            SPRemoteEventResult result = new SPRemoteEventResult();
            if (properties.EventType == SPRemoteEventType.AppInstalled)
            {
                using (ClientContext clientContext = TokenHelper.CreateAppEventClientContext(properties, false))
                {
                    if (clientContext != null)
                    {
                        //Get reference to the host web list with name Feedback
                        var documentsList = clientContext.Web.Lists.GetByTitle("Pre Meeting Docs");

                        clientContext.Load(documentsList);
                        clientContext.ExecuteQuery();
                        string remoteUrl = "https://xxxxx.net/Services/RemoteEventReceiver1.svc";

                        //Create the remote event receiver definition for deletion
                        EventReceiverDefinitionCreationInformation deleteEventReceiver = new EventReceiverDefinitionCreationInformation()
                        {
                            EventType = EventReceiverType.ItemDeleting,
                            ReceiverAssembly = Assembly.GetExecutingAssembly().FullName,
                            ReceiverName = "RemoteEventReceiver1",
                            ReceiverClass = "RemoteEventReceiver1",
                            ReceiverUrl = remoteUrl,
                            SequenceNumber = 15001
                        };

                        //Add the remote event receiver to the host web list

                        documentsList.EventReceivers.Add(deleteEventReceiver);
                        clientContext.ExecuteQuery();
                    }
                }
            }
            else if (properties.EventType == SPRemoteEventType.AppUninstalling)
            {
                using (ClientContext clientContext = TokenHelper.CreateAppEventClientContext(properties, false))
                {
                    var list = clientContext.Web.Lists.GetByTitle("Pre Meeting Docs");

                    clientContext.Load(list);
                    clientContext.ExecuteQuery();
                    EventReceiverDefinitionCollection erdc = list.EventReceivers;
                    clientContext.Load(erdc);
                    clientContext.ExecuteQuery();
                    List<EventReceiverDefinition> toDelete = new List<EventReceiverDefinition>();
                    foreach (EventReceiverDefinition erd in erdc)
                    {
                        if (erd.ReceiverName == "RemoteEventReceiver1")
                        {
                            toDelete.Add(erd);
                        }
                    }
                    //Delete the remote event receiver from the list, when the app gets uninstalled
                    foreach (EventReceiverDefinition item in toDelete)
                    {
                        item.DeleteObject();
                        clientContext.ExecuteQuery();
                    }
                }
            }
            return result;
        }

in elements.xml
<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
  <Receivers ListTemplateId="3101">
    <Receiver>
      <Name>RemoteEventReceiver1ItemDeleting</Name>
      <Type>ItemDeleting</Type>
      <SequenceNumber>10000</SequenceNumber>
      <Url>~remoteAppUrl/Services/RemoteEventReceiver1.svc</Url>
    </Receiver>
  </Receivers>
</Elements>

A: If you want to use any of the "-ing" events, then write your codes in ProcessEvent().
ProcessEvent()
It handles "Before" events and returns an object to SharePoint that reports on whether it should cancel the current process or terminate it.
If you want to use any of the "-ing" events, then write your codes in ProcessEvent().
ProcessOneWayEvent()
It handles "After" events. It runs asynchronously and does not return anything to SharePoint.
If you are using any code which is to be run after the "-ed" event, then write your codes in ProcessOneWayEvent().
Check the article here: Difference Between Process Event() And Process One Way Event() In Event Receiver


text:
Q: Stop 'Div' from changing position 'hover' I'm trying to build an audio player using HTML, CSS and Jquery. I'm having trouble with the 'hover' method using Jquery. It seems to move the div down when the 'background-image' is removed - why is this? I understand that has to do with the flow of the page. Thinking I should start the audio player again from scratch as there is too much wrong with it. Should I just use CSS hover?
Here is a link to the live site

$('.music-box').hover(function() {
  $('.music-box').css("border", "1px solid black");
  $('.music-box').css("background", "none");
  $('.player').css('display', 'block');
  $('.music-details').css('display', 'block');
  $('.buyDiv').css('display', 'block');
});
$('.music-box').mouseleave(function() {
  $('.music-box').css("border", "none");
  $('.music-box').css("background", "url('junction.jpg')");
  $('.music-box').css("background-size", "contain");
  $('.music-box').css("background-repeat", "no-repeat");
  $('.player').css('display', 'none');
  $('.music-details').css('display', 'none');
  $('.buyDiv').css('display', 'none');
});
.junction {
  display: inline;
  padding: 2vw;
}
.music-box {
  background: url(junction.jpg);
  background-size: contain;
  background-repeat: no-repeat;
  position: relative;
  width: 16vw;
  cursor: pointer;
  height: 30vh;
  display: inline-block;
}
.music-details {
  display: none;
  position: relative;
  top: 5vh;
  text-transform: uppercase;
  font-size: 1vh;
  font-family: 'Nunito Sans', sans-serif;
  letter-spacing: 0.5px;
  font-weight: normal;
}
.appleLink {
  height: 3vh;
  width: auto;
}
.player {
  display: none;
  position: relative;
  top: 7vh;
}
.buyDiv {
  display: none;
  height: 3vh;
  top: 9vh;
  width: auto;
  position: relative;
}
.buyList {
  position: relative;
  padding: 0;
  margin: 0;
}
.buyList li {
  display: inline;
  cursor: pointer;
}
.buyFnt {
  text-transform: uppercase;
  font-size: 1vh;
  font-family: 'Nunito Sans', sans-serif;
  letter-spacing: 0.5px;
  font-weight: normal;
  display: inline;
  cursor: pointer;
}

Junction - EP

      Turn Around (feat Madi Lane)

      My Nu Leng - 2018

    <audio id="player" src="tune.mp3"></audio>

      <button onclick="document.getElementById('player').play()"></button>
      <button onclick="document.getElementById('player').pause()"></button>
      <button onclick="document.getElementById('player').volume += 0.1"></button> </button>
      <button onclick="document.getElementById('player').volume -= 0.1"></button> </button>

BUY

<button></button>

A: there are small changes to be done to make it perfect.
Add float attribute and background-position to music box class(.music-box) css as follows:
.music-box{
     float:left;
     background-position: center !important;
}

This worked on your website and I have tested on your site.

A: There could be interference from other CSS/JS. I copied your code into a Fiddle here https://jsfiddle.net/Lkm4fotd/1/
HTML

Junction - EP

                                    Turn Around (feat Madi Lane)

                                    My Nu Leng - 2018

                                <audio id="player" src="tune.mp3"></audio>

                                  <button onclick="document.getElementById('player').play()"></button>
                                  <button onclick="document.getElementById('player').pause()"></button>
                                  <button onclick="document.getElementById('player').volume += 0.1"></button>
                                  <button onclick="document.getElementById('player').volume -= 0.1"></button>

BUY

<button></button>

CSS: Your css file
JS:
$('.music-box').hover(function() {
    $('.music-box').css("border", "1px solid black");
    $('.music-box').css("background", "none");
    $('.player').css('display', 'block');
    $('.music-details').css('display', 'block');
    $('.buyDiv').css('display', 'block');
});
$('.music-box').mouseleave(function() {
    $('.music-box').css("border", "none");
    $('.music-box').css("background", "url('https://benjamingibbsportfolio.000webhostapp.com/junction.jpg')");
    $('.music-box').css("background-size", "contain");
    $('.music-box').css("background-repeat", "no-repeat");
    $('.player').css('display', 'none');
    $('.music-details').css('display', 'none');
    $('.buyDiv').css('display', 'none');
});


text:
Q: Java Is there an exception about Spring Profile? when I test Spring profile,I create a class named "student" and add the annotation @Profile("prod") to test create bean.
@Component
public class Student{
  private String name;
  private int age;

  public Student(String name,int age){
    this.name = name;
    this.age = age;
  }

  //getter and setter toString()
}

java pojo
this is an configuration class
@Configuration
@ComponentScan("com.lucky.profile")
public class ProfileConfig{

  @Bean
  @Profile("prod")
  public Student student(){
    return new Student("jack",12);
  }
}

but the bean can't be created,I don't know where is the reason for this question.
I tried to delete the annotation @Profile("prod") in the ProfileConfig.class ,whene I deleted the annotation ,it can be created the bean,but when I add the annotation again ,it was still have this UnsatisfiedDependencyException.
@RunWith(SpringJunit4ClassRunner.class)
@ContextConfiguration(classes={ProfileConfig.class})
@ActiveProfiles("prod")
public class ProfileActiveTest{
    @Test
    public void test1(){
        ApplicationContext ctx = new AnnotationConfigApplicationContext(ProfileConfig.class);
        Student student = ctx.getBean("student");
        System.out.println(student.toString());
    }
}

org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'student' defined in file [E:\work_spaces\spring4_workspaces\springInAction\chapter3_a\target\classes\com\lucky\profile\Student.class]: Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'java.lang.String' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {}

    at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:729)
    at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:192)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1270)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1127)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:545)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:502)
    at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:312)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:228)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:310)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:200)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:758)
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:868)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:549)
    at org.springframework.context.annotation.AnnotationConfigApplicationContext.<init>(AnnotationConfigApplicationContext.java:88)
    at com.lucky.profile.ProfileActiveTest.test(ProfileActiveTest.java:24)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
    at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
    at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
    at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
    at org.springframework.test.context.junit4.statements.RunBeforeTestExecutionCallbacks.evaluate(RunBeforeTestExecutionCallbacks.java:73)
    at org.springframework.test.context.junit4.statements.RunAfterTestExecutionCallbacks.evaluate(RunAfterTestExecutionCallbacks.java:83)
    at org.springframework.test.context.junit4.statements.RunBeforeTestMethodCallbacks.evaluate(RunBeforeTestMethodCallbacks.java:75)
    at org.springframework.test.context.junit4.statements.RunAfterTestMethodCallbacks.evaluate(RunAfterTestMethodCallbacks.java:86)
    at org.springframework.test.context.junit4.statements.SpringRepeat.evaluate(SpringRepeat.java:84)
    at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
    at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:251)
    at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:97)
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
    at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61)
    at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:70)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
    at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:190)
    at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
    at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
    at com.intellij.rt.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:33)
    at com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:230)
    at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:58)
Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'java.lang.String' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {}
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.raiseNoMatchingBeanFound(DefaultListableBeanFactory.java:1504)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1101)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1062)
    at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:815)
    at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:721)
    ... 44 more

how can happen this error?I want someone can help me ?thanks so much!

A: Try removing the @Component from the Student class. You already have the bean defined in the ProfileConfig.
The reason for the error is that the error, though, is that your class has a constructor that accepts a String and an int. When Spring tries to instantiate this bean - when it's annotated by @Component - it'll try to look up beans to inject via constructor. That's why it says No qualifying bean of type 'java.lang.String' available in the stacktrace - there is no bean of type String available in the context.
When you instantiate your bean yourself, like you do in the ProfileConfig, you provide the dependencies yourself.
Here's what worked for me:
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = Config.class)
@ActiveProfiles("prod")
public class SpringExampleTest {

    @Autowired
    private Student student;

    @Autowired
    private ApplicationContext context;

    @Test
    public void test() {
        // Just using the bean
        System.out.println(student.getName());

        // Getting it through application context
        System.out.println(((Student)context.getBean("student")).getName());
    }
}

class Student {
    private String name;
    private int age;

    public Student(final String name, final int age) {
        this.name = name;
        this.age = age;
    }

    public String getName() {
        return name;
    }

    public int getAge() {
        return age;
    }
}

@Configuration
class Config {

    @Bean
    @Profile("prod")
    public Student student() {
        return new Student("Andy", 27);
    }
}

Note that I don't create a new ApplicationContext, rather I inject one provided by the SpringJUnit4ClassRunner. But even that is not necessary, as you can inject your beans directly, also using @Autowired.


text:
Q: Ansible: imposible to connect to server SSH Error: Permission denied (publickey,gssapi-keyex,gssapi-with-mic,password) I have set up some ansible roles to configure a php web server. I use vagrant to my working copy and it works perfectly. But when I want to connect to a remote server I get this error:
fatal: [xxxxxxx] => SSH Error: Permission denied (publickey,gssapi-keyex,gssapi-with-mic,password).
    while connecting to xxxxxxxxxx:22
It is sometimes useful to re-run the command using -vvvv, which prints SSH debug output to help diagnose the issue.

I have the ssh key set on the server (Cent OS 7) so if I do:
ssh -l root XX.XX.XXX.XX

I log in without problems.
Any idea why its failing to log in to the server? Thanks

A: You really should post the -vvvv logs as well as your ansible configuration.  But taking a bit of a stab in the dark here, have you set the SSH user?
I'd hope that you aren't logging into every box as root, in which case if you want to connect to the other server as root you should specify something like this in your hosts file:
[group]
hostname.com ansible_user=root

A: Depending on your needs (e.g. whether you will be using ansible to create an unprivileged user, and no longer use root for login), you can also just run your play with some command line options:
ansible-playbook -u root <... rest of command line ..>
@hvindin's suggestion is otherwise a good one if you plan to use the root account more permanently.


text:
Q: Polynomial with residual and condition For which k is the residual when
$q(x)=x^{17}-kx^{15}+(k-2)x^{10}+2x+k^2-2$ is divided by $x-1$ equals to 3?
I did $q(3)=k^2+k(3^{10}-3^{15})+4+3^{17}-2\cdot3^{10}$ and used Reduced quadratic equation with:
$p=3^{10}-3^{15}$ and $q=4+3^{17}-2\cdot3^{10}$
and got a $k_1$ and $k_2$ for solving k as a Reduced quadratic equation.
I then used the equation for q(x) and wrote
$k_1$ instead of k. And a second time but with $k_2$ instead of k.
When i did the division $\frac{x^{17}-k_1x^{15}+(k_1-2)x^{10}+2x+k_1^2-2}{x-1}$ I got the equation to equal to 0. But it's supposed to equal to 3.
Where did I go wrong?
edit: If i take the same steps with q(1) instead of q(3) i get $q(1)=(k-1)(k+1)=3$ which gives me $k_1=2$ and $k_2=-2$. the division is now with $k_1$:
$\frac{x^{17}-2x^{15}+2x+2}{x-1}$

A: Your updated answer is now correct. In particular, we have
$$\begin{align*} x^{17} - 2x^{15} + 2x + 2 &= (x^{17} - 2x^{15} + x) + (x - 1) + 3 \\ &= x(x^{16} - 2x^{14} + 1) + (x - 1) + 3 \\ &= x((x^2 - 2)x^{14} + 1) + (x - 1) + 3 \\ &= x(x^2 - 1)x^{14} - x(x^{14} - 1) + (x - 1) + 3 \\ &= (x - 1)\left(x^{15}(x + 1) - x(x^{13} + x^{12} + \ldots + 1) + 1\right) + 3\end{align*}$$
For the other value $k_2 = -2$, the polynomial $q(x)$ is now
$$q(x) = x^{17} + 2x^{15} - 4x^{10} + 2x + 2$$
And we have
$$\begin{align*} x^{17} + 2x^{15} - 4x^{10} + 2x + 2 &= (x^{17} + 2x^{15} - 4x^{10} + 2x - 1) + 3 \\ &= (x^{17} - x^{15}) + 3(x^{15} - x^{10}) - (x^{10} - x) + (x - 1) + 3 \\ &= x^{15}(x^2 - 1) + 3x^{10}(x^5 - 1) - x(x^9 - 1) + (x - 1) + 3\end{align*}$$
Which once again is divisible by $x - 1$, since each of $x^n - 1$ is divisible by $x - 1$ (geometric series).
TL;DR your answer is correct.


text:
Q: Guide me with this stored procedure or function Manager | Employee  |HireDate
----------------------------------------
ManagerA| EmpA      |1/1/2012
managerA| EmpB      |1/15/2012
ManagerB| Emp C     |2/1/2012
ManagerA| Emp D     |2/15/2012
ManagerB| Emp E     |2/8/2012

The bonus amount for each manager is calculated based on how many recruits were hired that month.
ex. each Manager gets 1000 for first hire and 500 additional for every next.
Its almost like each record has a seed
Manager | Employee  |HireDate   | Seed
------------------------------------------------
ManagerA| EmpA      |1/1/2012   | 1
managerA| EmpB      |1/15/2012  | 2
ManagerB| Emp C     |2/1/2012   | 1
ManagerA| Emp D     |2/15/2012  | 1
ManagerB| Emp E     |2/8/2012   | 2

and Bonus is a function of the seed as 1000+(seed-1)*500
I need help generating the seed .I am not sure if I should use a stored procedure to generate the seed or a function
eventually I want to generate a table as below
Manager | Employee  |HireDate   | Bonus
-------------------------------------------------
ManagerA| EmpA      |1/1/2012   | 1000
managerA| EmpB      |1/15/2012  | 1500
ManagerB| Emp C     |2/1/2012   | 1000
ManagerA| Emp D     |2/15/2012  | 1000
ManagerB| Emp E     |2/8/2012   | 1500

A: To get the seed
Select
     *
    ,ROW_NUMBER() Over(Partition By Manager, Year(HireDate), Month(HireDate) Order By HireDate) As Seed
From
    YourTable

To get the bonus directly
Select
     *
    ,1000 + (Seed - 1) * 500 As Bonus
From
    (
        Select
             *
            ,ROW_NUMBER() Over(Partition By Manager, Year(HireDate), Month(HireDate) Order By HireDate) As Seed
        From
            YourTable
) T


text:
Q: Wordpress Post # of # filtered by category slug I want to show post #4/100 at the top for each post
for which I'm using following code
function updateNumbers() {
/* numbering the published posts: preparation: create an array with the ID in sequence of publication date, /
/ save the number in custom field 'incr_number' of post with ID  /
/ to show in post (within the loop) use <?php echo get_post_meta($post->ID,'incr_number',true); ?>
/ alchymyth 2010 */
global $wpdb;
$querystr = "SELECT $wpdb->posts.* FROM $wpdb->posts WHERE $wpdb->posts.post_status = 'publish' AND $wpdb->posts.post_type = 'post' ";
$pageposts = $wpdb->get_results($querystr, OBJECT);
$counts = 0 ;
if ($pageposts):
foreach ($pageposts as $post):
setup_postdata($post);
$counts++;
add_post_meta($post->ID, 'incr_number', $counts, true);
update_post_meta($post->ID, 'incr_number', $counts);
endforeach;
endif;
}

add_action ( 'publish_post', 'updateNumbers' );
add_action ( 'deleted_post', 'updateNumbers' );
add_action ( 'edit_post', 'updateNumbers' );

<?php echo get_post_meta($post->ID,'incr_number',true); ?>

This code seems to work fine for me but I just want to filter posts by category slug & only count posts for that particular category
Thanks

A: You should use one of query functions - get_posts(), it allows to very flexibly configure set of posts to retrieve.


text:
Q: Opencv compare Error: Sizes of input arguments do not match I tried to compare 2 black and white images with the function, opencv provides (compare()). At first i declare some variables and then i just try to compare the black and white images just like in the documentation of opencv. At the end i just calculate the confidence percentage. But every time i run m program i got this error:
OpenCV: terminate handler is called! The last OpenCV error is:
OpenCV(4.3.0) Error: Sizes of input arguments do not match (The operation is neither 'array op array' (where arrays have
 the same size and the same type), nor 'array op scalar', nor 'scalar op array') in compare, file C:\OpenCV\opencv\sourc
es\modules\core\src\arithm.cpp, line 1228

Here is my code:
Mat img2 = cv::imread("...");
Mat result;
Capture >>img1;
cv::compare(img1, img2, result, cv::CMP_EQ);
enter code here

A: But the error is pretty much verbose. Even the documentation (https://docs.opencv.org/2.4/modules/core/doc/operations_on_arrays.html, not really version from tag but it shouldn't be relevant) says that:
Elements of two arrays when src1 and src2 have the same size:
I believe you could resize the second image to match first image's size:
https://docs.opencv.org/2.4/modules/imgproc/doc/geometric_transformations.html#void%20resize(InputArray%20src,%20OutputArray%20dst,%20Size%20dsize,%20double%20fx,%20double%20fy,%20int%20interpolation)
but not sure if such comparison would be okay for you.
You can check Mat's size as follows:
Mat img2 = cv::imread("...");
int rows = M.rows;
int cols = M.cols;

By the way, you tagged the question with OpenCV3.1, yet in the error message we can see 4.3.0. You sure you are using the correct version?


text:
Q: Apache is working but Mysql module not working on xampp v3.2.1 windows 7 I had used xampp for my virtual server side program but suddenly i got an error message while I was trying to access phpmyadmin on my localhost.
"Mysql said:#2002 - No connection could be made because the target machine actively refused it." Then I re-install xampp and change the apache port from 80 to 8080 (because I am using Skype also) & I got the same mysql error see the link however Apache is running correctly... Please it would best if you help me out with that! thanks :)

A: Please turn off the mysql service from administrative Tool -> services panel.


text:
Q: How to write a word letter by letter? how a word is written letter by letter. it should appear letter after another with some delay. here is the code.
var txt = 'animating text';
var current = 0;

function write(text){
   var elem = document.getElementById('target');
   if (current < text.length){
      elem.textContent = elem.textContent + text.charAt(current);
      current++;
      wait(100);
   }
}

Write(txt);

A: Basically you write one character at a time and have a timeout in beteween. Here's the fiddle. and below the code
var text = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque consequat ante sed fringilla bibendum. In quam elit, rutrum quis adipiscing id, iaculis eu ipsum. Morbi faucibus lectus at ante feugiat dignissim. In turpis turpis, placerat in fringilla eget, sodales blandit lacus. Vivamus tempor blandit mauris nec semper. Sed cursus metus sed justo cursus bibendum. Maecenas ornare sem sed lacinia auctor. Nulla sapien dolor, faucibus vitae dapibus in, commodo id est. Sed a ipsum laoreet, convallis lacus eu, hendrerit magna.';

// Variable for current position
var curr = 0;

var Write = function write(){

    // Find the target element to write to
    var elem = document.getElementById('target');

    // Append next character into the text content
    elem.textContent = elem.textContent + text.charAt(curr);

    // Update the current position
    curr++;

    // if we're not yet in the end of the string
    // we have a little (20ms) pause before we write the next character
    if (curr < text.length)
        window.setTimeout(write, 20);
};

Write(); // And of course we have to call the function


text:
Q: VLC Player and VirtualBox font problem in Xubuntu 14.04 LTS I've installed VLC player and VirtualBox. Both of them have the similar character/font problem as you may see from the screen shots.
I also tried to install and re-installing them via Software Center and also tried to install them from terminal (after removing each of them completely).
I'm having trouble with just that two and I did not tried to install extra font package previously.
For VLC screen shot ==> http://imgur.com/7Gfjfz8
For VirtualBox screen shot ==> http://imgur.com/QraRzfB

A: I've solved my problems by using Infinality. While looking any kind of cure to my problem, I've noticed Infinality and installed it with the following from terminal.

sudo add-apt-repository ppa:no1wantdthisname/ppa
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install fontconfig-infinality

After that, I've installed VLC and VirtualBox from synaptic and both worked fine ;)
Hope it may help anyone who needs.
Best


text:
Q: jscroll load data when at the end I have some UI element that needs infinite scrolling. So I am using jscroll.
I want to fetch new data when the div is at the end.

<?php
include_once('conn.php');

$start=0;
$query="Select * from data where id > ". $start ." Limit 90;";
$res=mysqli_query($con,$query);

echo '
';
while ($row = mysqli_fetch_array($res, MYSQL_NUM)) {
    echo "
 ".$row[0]."        ". $row[1]."

";
}

echo "
"

?>

So basically I display a page with 90 records and want to fetch records above 91 in load() function.But this doesn't work.
handle.php code
<?php
include_once('conn.php');
$goahead=$_GET['lastdis'];

$query="Select * from data where id > ". $goahead ." Limit 20;";
$res=mysqli_query($con,$query);
while ($row = mysqli_fetch_array($res, MYSQL_NUM)) {
    echo "
 ".$row[0]."        ". $row[1]."

";
}

Just two hours of jquery experience.Please bear with me.

A: Use the .scroll() event on window, like this:
$(window).scroll(function() {
   if($(window).scrollTop() + $(window).height() == $(document).height()) {
       alert("bottom!");
   }
});

You can test it here, this takes the top scroll of the window, so how much it's scrolled down, adds the height of the visible window and checks if that equals the height of the overall content (document).  If you wanted to instead check if the user is near the bottom, it'd look something like this:
$(window).scroll(function() {
   if($(window).scrollTop() + $(window).height() > $(document).height() - 100) {
       alert("near bottom!");
   }
});

You can test that version here, just adjust that 100 to whatever pixel from the bottom you want to trigger on.
Now, just instead of alerting the user at bottom use ajax to get the data you want to append at bottom.
  $.ajax({
      url: "handle.php",
      type: "post",
      data: values,
      success: function(data){
           $("#result").append(data);
      },
      error:function(){
          alert("failure");
          $("#result").append('Error Occurred while fetching data.');
      }
    });


text:
Q: PHP class: Unable to access array in another function I tried a lot of search but unable to figure out why array $wordlinks in function DoWordLink is not carrying values from function __construct. PHP class code as below:
<?php

class autolinkkeyword
{

    public $wordlinks = array();

    public function __construct(){
        $query = mysql_query("SELECT keyword FROM library");
                while ($row = mysql_fetch_array($query))
                {
                    $this->wordlinks [$row["keyword"]] = $row["keyword"];
                }
    }

    public function linkkeywords ($posts)
    {
            function DoWordLink($match)
            {
                $rpl=$match[1];
                if(isset($wordlinks[$rpl]))
                {
                        $kword = $this->wordlinks[$rpl];
                        $rpl="$kword";
                        unset($this->wordlinks[$match[1]]);
                }
                return $rpl;
            }

            $wl=array_keys($this->wordlinks);
            $pm="/((?<=\s|^)(?:" . implode('|',$wl) .")(?=\.|\!|\?|\,|\'|\s|$))/im";
            foreach($posts as $key => $mainbody)
            {
                $mainbody=preg_replace_callback($pm, 'DoWordLink', $mainbody)  ;
                echo $mainbody;
            }

    }
}
?>

A: aren't you missing a "this->" construct here? if(isset($this->wordlinks[$rpl]))

A: You can make it an actual method of that class and call it using this method:
http://www.php.net/manual/en/language.pseudo-types.php#language.types.callback
like:
preg_replace_callback($pm, array($this, 'DoWordLink'), $mainbody);

Change DoWordLink function so it is part of the class like:
class autolinkkeyword
{
  function DoWordLink($match)
  {
    $rpl=$match[1];
    if(isset($this->wordlinks[$rpl]))
    {
      $kword = $this->wordlinks[$rpl];
      $rpl="$kword";
      unset($this->wordlinks[$match[1]]);
    }
    return $rpl;
  }
}

A: Use the $this everywhere you refer to $wordlinks.
$this->wordlinks

A: You need to access the property in your linkkeywords-method with the object-accessor, too!
public function linkkeywords ($posts)
{

   // Here use $this->wordlinks not $wordlinks
}


text:
Q: sikuli: how to execute java jar file I loaded a java jar file into http://www.sikuli.org/ and tried to run it like this but it is not working. Any hints?
load("C:\Users\...\TJF.jar")

import subprocess
subprocess.call(['java', '-jar', 'TJF.jar'])

Error message: Unable to access jarfile TJF.jar

A: The comment was correct. Full path necessary. No "load" line necessary.


text:
Q: css3 cursor and default shadow problems So my cursor is still the default one even though I've changed it to pointer. As I was taking screenshots to post here I noticed if I hovered on the link and hit CMD it would change to a pointer but it would remain like that everywhere on the page unless I hit CMD again. My second problem is turning off the default shadow on an text input field. Ive tried box-shadow: none; but it didn't work. Im on a mac using safari 9.0.3Default shadow on input element
form {
    width: 100%;
    input[type=text]{
        border-radius: 0.5em;
        height: 1.5vw;
        font-size: $fntSize;
        width: 12.7%;
        position: absolute;
        top: 10.35vw;
        left: 68.3vw;
        box-shadow: none;
        cursor: text;
    }
    input[type=image]{
        position: absolute;
        top: 10.8vw;
        left: 80.1vw;
        height: 0.8vw;
        cursor: pointer;

A: Solving the issue with the cursor would be a lot easier with a jsfiddle that replicates the error on your end.
In terms of the default styling on the input, that's actually a border style not a box-shadow. The input defaults to border-style: inset so you just need to set your desired properties in its place. E.g. border: 1px solid #ccc or border-style: solid at a minimum.


text:
Q: Error in SSIS Packages loading data into azure data warehouse We have some ssis packages loading data into azure data warehouse from CSV files. All the data flow tasks inside the packages are configured for parallel processing.
Recently packages are started failing with following error.

Failed to copy to SQL Data Warehouse from blob storage. 110802;An internal DMS error occurred that caused this operation to fail. Details: Exception: System.NullReferenceException, Message: Object reference not set to an instance of an object.

When we run the package manually (Running Each dft individually) its running fine. When we run the package manually as it is ( with parallel processing), same error occurs.
Anyone here please help to find the root-cause for this issue?

A: I believe this problem may occur if multiple jobs are trying to access the same file exactly at the same time.
You may need to check if one CSV file is source for multiple SSIS packages, if yes, you may need to change your approach.
When one package is trying to read one CSV file, it locks that file so that other job can't modify this file.
To get rid of this problem, you can use sequential DFTs for those tasks that are using the same CSV as source and keep other DFTs in parallel as it is.

A: IMHO it's a mistake to use SSIS Data Flow to insert data in Azure SQL Data Warehouse.  There were problems with the drivers early on which made performance horrendously slow and even though these may now have been fixed, the optimal method for importing data into Azure SQL Data Warehouse is Polybase.  Place your csv files into blob store or Data Lake, then reference those files using Polybase and external tables.  Optionally then import the data into internal tables using CTAS, eg pseudocode
csv -> blob store -> polybase -> external table -> CTAS to internal table

If you must use SSIS, consider using only the Execute SQL task in more of an ELT-type approach or use the Azure SQL DW Upload Task which is part of the Azure Feature Pack for SSIS which is available from here.
Work through this tutorial for a closer look at this approach:
https://learn.microsoft.com/en-us/azure/sql-data-warehouse/design-elt-data-loading


text:
Q: Avoid MS Access SQL insert bug I am converting an Access ADP file to ACCDB in preparation for Access 2016.
It's currently Access 2013 while all the functional testing is done before we move that to Access 2016 for compatibility testing.
I have one form where inserting a new record displays #Deleted after the insert.
I have traced through the profiler that it does 2 sp_executesql calls
One does the insert
The second queries for the new identity column value by using all the column values.
Unfortunately, there are several column values that are NULL, and the text shows it is querying for Field = @P6 (where @P6 = NULL) rather than Field IS NULL.
I've checked, and replacing the NULL variable checks with IS NULL does return the correct key value.
Is there a known bug relating to this?
I'm assuming it would be either in Access or ODBC
If so, can someone point me to the appropriate documentation so I can arrange any required upgrades, etc.
ODBC Connection I am using:
ODBC;Driver={SQL Server};APP=TEST;SERVER=TEST_SQL;DATABASE=TestDB;Trusted_Connection=Yes;TABLE=dbo.Inspection


text:
Q: QGIS 3 won't open in Windows 10 pro, how to fix? I have installed QGIS 3 in Windows 10 pro 64 bit, but it won't open the GUI. This is the error:

And then this:

Some specifications:

*

*I had installed QGIS 2.18, and it ran perfectly.

*I had installed the latest QGIS 3 under "Program Files" folder and also in the root C:.

*I installed with OSGeo4W software and with QGIS desktop .exe, load to QGIS web page.

*I run other software like PostgreSQL, GeoServer, GeoNetwork and ArcGIS  on the PC.

A: The comments were very helpful and I can now open QGIS 3 without a problem. I have done it in two ways:
With the help of Mapperz, look for Qgis-rel-dev-g 7.4.0.bat inside the installation of QGIS 3 and this run.

With the help of Techie_Gus, I can run QGIS 3 without problems from the OSgeo4w terminal.
Both ways work well.

I don't consider the language likely to be the problem, if not more the path as Techie_Gus said , because I did run QGIS 3 in another session.
I'll be trying to do what Xunilk says, to define the specific error.
The main problem was solved, and I could run QGIS 3, also, I think it is a path problem perhaps in the registry of W10, I will checked the environment variables.


text:
Q: Problem with passing data flag out of javascript function I have a bit of javascript and jQuery where I am using jQuery .each to loop through a set of text area boxes as part of a light spellcheck routine. I am also using jQuery addClass to change the border of the text areas if a spelling criteria is not reached. The spell checking and add class portion of the code work fine. Where I am stuck is in returning an error indicator that will either flag to remain on the page because of errors or carry on to the next page.
Code is below:

function executeFormCheckSubmit() {
  function getSpellCount(essayContent) {
    return new Promise((resolve, reject) => {
      jQuery(function(\$) {
        var values = {
          'str': essayContent
        };\
        $.ajax({
          type: "POST",
          url: "/path/to/scripts/ajax/spellcheckEssay.php",
          data: values,
          success: resolve,
          error: reject,
        })
      });
    })
  }

  function checkTextArea() {
    let elementID = "";
    let errorFlag = false;
    let textAreaCheck = \$("textarea").each(function(elementID, errorFlag) {
      let textbox = this.value;
      let percentage = getSpellCount(textbox);
      elementID = this.id;
      percentage.then(function(result) {
        let grade = result.percentage;
        if (grade < 80) {
          errorFlag = true;\
          $("#" + elementID).addClass("error");
        }
      }).catch(function(error) {
        console.log('Failed', error);
      });
    });
    return errorFlag;
  }
  let isError = checkTextArea();
  if (isError === true) {
    //alert("The text does not meet our minimum requirements.");
    console.log("isError is true.");
    return false;
  } else {
    console.log("isError is false.");
    //document.course_finger.submit();
  }
}


text:
Q: Iterate through a string backwards to find a character or phrase Is there a good way to start at a given index and move BACKWARDS looking for a given phrase in a string? I only know how to use indexof iterating forwards.

A: You can use LastIndexOf:
int index = s.LastIndexOf("foo");

It also has an optional start index if you want to start search backwards from somewhere other than the end of the string.
int index = s.LastIndexOf("foo", 20);

A: Use LastIndexOf http://msdn.microsoft.com/en-us/library/system.string.lastindexof.aspx.