text:
Q: Unable to upload images from Ruby to Wordpress using XMLRPC - damaged image I am using a gem called rubypress to post content from ruby to wordpress using XMLRPC. Everything is working except for the image uploading part. I converted the image to base64 encoded format but after upoloading, all i get is a grey image and not the one that i had intended to upload(I am using smaller images around 100kb size to upload for testing). What I am i doing wrong?
Here's the code from rubypress github page(https://github.com/zachfeldman/rubypress) for uploading:
FILENAME='myFile.png'
wp.uploadFile(:data => {
    :name => FILENAME,
    :type => MIME::Types.type_for(FILENAME).first.to_s,
    :bits => XMLRPC::Base64.new(IO.read(FILENAME))
    })

A: Try:
wp.uploadFile(:data => {:name => File.basename(FILENAME),
                   :type => MIME::Types.type_for(FILENAME).first.to_s,
                   :bits => XMLRPC::Base64.new(File.open(FILENAME).read)
})

A: I was finally able to solve it by changing the Base64 encoding code as follows:
$wp.uploadFile(:data => {
    :name => File.basename(imgname),
    :type => MIME::Types.type_for(imgname).first.to_s,
    :bits => XMLRPC::Base64.new(File.open(FILENAME,"rb").read),
    :post_id =>postid

    })

The file apparently needs to be "opened" first rather than be read using IO.read(FILENAME).

A: Here is my way of doing it, works pretty well:
image = MiniMagick::Image.open(this_image.path)
image.format('jpg')
image.combine_options do |c|
  c.strip
end
image.write(this_image.path)

# most efficient resize as suggested by https://www.smashingmagazine.com/2015/06/efficient-image-resizing-with-imagemagick/
MiniMagick::Tool::Mogrify.new do |mogrify|
  mogrify.filter('Triangle')
  mogrify.define('filter:support=2')
  mogrify.thumbnail('960x')
  mogrify.unsharp('0.25x0.08+8.3+0.045')
  mogrify.dither('None')
  mogrify.posterize('136')
  mogrify.quality('82')
  mogrify.define('jpeg:fancy-upsampling=off')
  mogrify.interlace('none')
  mogrify.colorspace('sRGB')
  mogrify << this_image.path
end

type = image.mime_type
bits = XMLRPC::Base64.new(IO.read(this_image.path))

begin
  result = wp.uploadFile(
           data: {
               name: image_name,
               type: type,
               bits: bits,
               post_id: post_id,
               overwrite: true
           })
rescue StandardError => e
  puts e
end


text:
Q: Contact Form in html/css Hello I have the following contact form code:

/* Contact Form */

input[type=text],
[type=email],
select,
textarea {
  width: 100%;
  padding: 12px;
  border: 1px solid #555;
  margin-top: 6px;
  margin-bottom: 16px;
  resize: vertical;
}

input[type=submit] {
  background-color: #0563bb;
  color: white;
  padding: 12px 20px;
  border: none;
  cursor: pointer;
}

input[type=submit]:hover {
  opacity: 0.9;
}

.contactform {
  position: relative;
  border-radius: 50px;
  background-color: #f2f2f2;
  padding: 5px;
  z-index: 2;
  display: block;
  margin-left: auto;
  margin-right: auto;
  margin-bottom: auto;
  margin-top: 1%;
  width: 100%;
  animation-name: gradient;
  animation-duration: 3s;
  animation-iteration-count: infinite;
}

.contactform:hover {
  animation-name: gradient;
  animation-duration: 15s;
  animation-iteration-count: infinite;
}

.column {
  float: center;
  width: 50%;
  margin-top: 6px;
  padding: 20px;
  display: block;
  margin-left: auto;
  margin-right: auto;
}

.row:after {
  content: "";
  display: table;
  clear: both;
}

@media screen and (max-width: 600px) {
  .column,
  input[type=submit] {
    width: auto;
    margin-top: 0;
  }
}

@keyframes shake {
  10%,
  90% {
    transform: translate3d(-1px, 0, 0);
  }
  20%,
  80% {
    transform: translate3d(2px, 0, 0);
  }
  30%,
  50%,
  70% {
    transform: translate3d(-4px, 0, 0);
  }
  40%,
  60% {
    transform: translate3d(4px, 0, 0);
  }
}

Get In Touch

Feel Free To Reach Out To Me Through This Form!

          <form name="myform" action="thankyou.html" method="POST" novalidate>
            First Name
            <input type="text" id="first name" name="firstname" placeholder="Your First Name.." required>
            Last Name
            <input type="text" id="lastname" name="lastname" placeholder="Your Last Name.." required>
            Email:
            <input type="email" id="email" name="email" placeholder="Your Email.." required>
            Subject
            <textarea id="subject" name="subject" placeholder="Lets Collaborate.." style="height:170px" required></textarea>
            <input type="submit" value="Submit">
          </form>

I want to modify this form a little bit, and only change the input fields. Basically, I would like to add animation on the input fields.
Expected Output
https://watch.screencastify.com/v/5kecEAtHg4o2VXpDpEYU
As you can see, I would like the message to be displayed in the input field, but then when the user clicks the input field, the message should display at the top of the input field as shown in the video. Any suggestions on how I can accomplish this task?
Here is the code of the contact form in the video:
Contact.jsx:
/ dependancies
import React from 'react'
import { Grid, Typography, TextField, Button, Divider, useMediaQuery } from '@material-ui/core'
import emailjs from 'emailjs-com'

// icons
import { FaGithub, FaLinkedin, FaPhone } from 'react-icons/fa'
import { MdEmail } from 'react-icons/md'

// file imports
import { db } from "../../firebaseConfig";
import ContactStyles from './ContactStyles'

import{ init } from 'emailjs-com';
init(process.env.REACT_APP_USER_ID);

const Contact = () => {
    // classes and queries
    const classes = ContactStyles();
    const md = useMediaQuery('(max-width: 960px)');
    const lg = useMediaQuery('(min-width: 960px)');

    // state declaration
    const [name, setName] = React.useState("");
    const [email, setEmail] = React.useState("");
    const [message, setMessage] = React.useState("");
    const [errorName, setErrorName] = React.useState(false);
    const [errorEmail, setErrorEmail] = React.useState(false);
    const [errorMessage, setErrorMessage] = React.useState(false);

    // event handler
    const submitHander = (e) => {
        e.preventDefault(); // prevents screen refresh
        // uses regex to verify email
        const emailRegex = /^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
        setErrorName(false);
        setErrorEmail(false);
        setErrorMessage(false);

        // if a field is invalid, ensure that email is not submitted and error is thrown
        if (name === "" || !emailRegex.test(email) || message === "") {
            if (name === "") {
                setErrorName(true);
            }

            if (!emailRegex.test(email)) {
                setErrorEmail(true);
            }

            if (message === "") {
                setErrorMessage(true);
            }
        } else {
            const firebaseObject = { // object to be sent to firebase and email
                name: name,
                email: email,
                message: message
            }

            // send to firebase
            db.collection('contacts').add(firebaseObject)
                .then(() => {
                    console.log('submitted to Firebase');
                })
                .catch((err) => {
                    console.log(err.message);
                });

            // send to email
            emailjs.send(process.env.REACT_APP_SERVICE_ID, process.env.REACT_APP_TEMPLATE_ID,{
                name: name,
                email: email,
                to_name: "",
                from_name: "",
                message: message,
                })
                .then((response) => {
                    alert('Message has been submitted!');
                    console.log(response);
                })
                .catch((err) => {
                    console.log(err);
                });

            setName('');
            setEmail('');
            setMessage('');
            setErrorName(false);
            setErrorEmail(false);
            setErrorMessage(false);
        }
    }

    return (
        <Grid container className={classes.root} id="contact">
            {/* Title */}
            <Grid className={classes.title} item xs={12}>

                <Typography variant="h2">Contact Me</Typography>
                <Typography variant="h4">- Can't Wait to Connect! -</Typography>
            </Grid>

            {/* Contact Text */}
            {lg && <>
                <Grid item xs={1}></Grid>
            <Grid item xs={10} md={5}>

                <Typography variant="h5">Get in Touch!</Typography>
                <Divider></Divider>

                <MdEmail />
                <Typography display="inline"> Email:</Typography>

                    <Typography display="inline"> anjaligta@outlook.com</Typography>

                <FaPhone />
                <Typography display="inline"> Phone:</Typography>

                    <Typography className={classes.contact}  display="inline"> 647-544-0781</Typography>

                <FaGithub />
                <Typography display="inline"> Github:</Typography>

                    <Typography  display="inline"> github.com/AnjaliGupta</Typography>

                <FaLinkedin />
                <Typography display="inline"> LinkedIn:</Typography>

                    <Typography  display="inline"> linkedin.com/in/AnjaliGupta</Typography>

            </Grid>
            <Grid item xs={1}></Grid>
            </>}

            {/* Contact Form */}
            {md && <Grid item xs={1}></Grid>}
            <Grid item xs={10} md={4}>

                    <form onSubmit={submitHander} className={classes.form}>
                        <TextField
                            className={classes.input}
                            value={name}
                            onChange={(e) => setName(e.target.value)}
                            label="Name"
                            variant="outlined"
                            error={errorName}
                            helperText={errorName ? "Please enter a name." : ""}
                        />

                        <TextField
                            className={classes.input}
                            value={email}
                            onChange={(e) => setEmail(e.target.value)}
                            label="Email"
                            variant="outlined"
                            error={errorEmail}
                            helperText={errorEmail ? "Please enter a correct email." : ""}
                        />

                        <TextField
                            className={classes.input}
                            value={message}
                            onChange={(e) => setMessage(e.target.value)}
                            label="Message"
                            multiline
                            rows={10}
                            variant="outlined"
                            error={errorMessage}
                            helperText={errorMessage ? "Please enter a message." : ""}
                        />

                            <Button type="submit" variant="contained" size="large" className={classes.button}>
                                Submit
                            </Button>

                    </form>

            </Grid>
            <Grid item xs={1}></Grid>
        </Grid>
    )
}

export default Contact;

ContactStyles.jsx:
import { makeStyles } from '@material-ui/styles';

const ContactStyles = makeStyles((theme) => ({
    root: {
        background: theme.palette.primary.dark
    },
    title: {
        textAlign: "center",
        color: theme.palette.secondary.dark
    },
    formContainer: {
        height: "78vh",
        position: "relative"
    },
    form: {
        position: "absolute",
        top: "50%",
        left: "50%",
        transform: "translate(-100%, -50%)"
    },
    input: {
        width: "200%",
        fontWeight: "600",
        '& label.Mui-focused': {
      color: theme.palette.secondary.dark,
    },
    '& .MuiInput-underline:after': {
      borderBottomColor: theme.palette.secondary.dark,
    },
    '& .MuiOutlinedInput-root': {
      '& fieldset': {
        borderColor: '#0644A3',
      },
      '&:hover fieldset': {
        borderColor: theme.palette.secondary.dark,
      },
      '&.Mui-focused fieldset': {
        borderColor: theme.palette.secondary.dark,
      },
    },
    },
    center: {
        display: "flex",
        justifyContent: "center",
        width: "200%"
    },
    button: {
        backgroundColor: "#0644A3",
        color: "#FFFFFF",
        borderRadius: 20,
        marginRight: "2%",
        textTransform: "none",
        "&:hover": {
            transition: "0.3s",
            color: "#0644A3",
            backgroundColor: "#FFFFFF",
            border: "1px solid #0644A3",
        }
    },
    contact: {
        textDecoration: "none",
        color: "#000000",
        "&:hover": {
            transition: "0.3s",
            color: "#b5befa"
        }
    },
    spacing: {
        display: "flex",
        alignItems: "center"
    }
}))

export default ContactStyles;

A: I tried to create a Beta for you, using the video you linked as a reference
using HTML and CSS only...
the trick here is creating an Extra Div as a Parent, so we can put the label and input inside.
now set the parent to have a position: relative; so the label will be absolute
now successfully we can use TOP, LEFT, RIGHT, BOTTOM and that's it (position the label as the place-holder)
I put the logic here .input-container input:focus~label

* {
  --input-height: 3rem;
}

section {
  height: 100vh;
  width: 100vw;
  display: grid;
  place-content: center;
}

.input-container input {
  height: var(--input-height);
  width: 80vw;
  font-size: 2rem;
}

.input-container {
  position: relative;
  display: grid;
  place-items: center start;
}

.input-container label {
  position: absolute;
  left: 1rem;
  font-size: 1.5rem;
  color: rgb(90, 90, 90);
  background-color: white;
  transition-duration: 0.5s;
}

.input-container input:focus~label {
  position: absolute;
  font-size: 0.7rem;
  top: -0.6rem;
  padding: 0.2em;
  left: 0.5rem;
  color: rgb(0, 81, 255);
  background-color: white;
  transition-duration: 0.2s;
  z-index: 2;
}
<!DOCTYPE html>

  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <link rel="stylesheet" href="style.css">

    <form action="">

        <input type="text" name="" id="my-input">
        hello world

    </form>

redpajama_set_name: RedPajamaStackExchange


text:
Q: How can I select a FAQ entry from a user's natural-language inquiry? I am working on an app where the user submits a series of questions. These questions are freeform text, but are based on a specific product, so I have a general understanding of the context.  I have a FAQ listing, and I need to try to match the user's question to a question in the FAQ.
My language is Delphi.  My general thought approach is to throw out small "garbage words", a, an, the, is, of, by, etc...  Run a stemming program over these words to get the root words, and then try to match as many of the remaining words as possible.
Is there a better approach?  I have thought about some type of natural language processing, but I am afraid that I would be looking at years of development, rather than a week or two.

A: You don't need to invent a new way of doing this. It's all been done before. What you need is called a FAQ finder, introduced by Hammond, et al in 1995 (FAQ finder: a case-based approach to knowledge navigation, 11th Conference on Artificial Intelligence for Applications).
AI Magazine included a paper by some of the same authors as the first paper that evaluated their implementation. Burke, et al, Question Answering from Frequently Asked Question Files: Experiences with the FAQ FINDER System, 1997. It describes two stages for how it works:
First, they use Smart, an information-retrieval system, to generate an initial set of candidate questions based on the user's input. It looks like it works similarly to what you described, stemming all the words and omitting anything on the stop list of short words.
Next, the candidates are scored against the user's query according to statistical similarity, semantic similarity, and coverage. (Read the paper for details.) Scoring semantic similarity relies on WordNet, which groups English words into sets of distinct concepts. The FAQ finder reviewed here was designed to cover all Usenet FAQs; since your covered domain is smaller, it might be feasible for you to apply more domain knowledge than the basics that WordNet provides.

A: Not sure if this solution is precisely what you're looking for, but if you're looking to parse natural language, you could use the Link-Grammar Parser.
Thankfully, I've translated this for use with Delphi (complete with a demo), which you can download (free and 100% open source) from this page on my blog.

A: In addition to your stemming approach, I suggest that you are going to need to look into one or more of the following:

*

*Recognize important pairs or phrases (2 or more words). For example if your domain is a technical field, an important pair that should be automatically considered as a pair instead of individual words, where the  pair of words means something special (in programming, "linked list", "serial port", etc, are more important in their meaning as a pair of words than individually).

*A large list of synonyms ("turn == rotate", "open == access", etc ).
I would be tempted to tear apart "search engine" open source software in whatever language it was written in, and see what general techniques they use.


text:
Q: can't upload to TestFlight tab on App Store Connect Problem: No builds in my TESTFLIGHT page.
Here's what I do...

*

*Create Xcode Swift project

*Create App ID on Apple Developer Identifiers page for project's Bundle ID

*Add new app to App Store Connect for project's Bundle ID (page spinner never stops)

*Upload/distribute Xcode project
App > Testflight page shows BUILDS "No builds"


text:
Q: Namespaced routes in rails 1 I'm working with some legacy code with the last version of rails 1. Upgrading to a later version of rails isn't possible and as such map.namespace is a private method in this version, otherwise I'd be using it.
I have several resources which I have nested into a submenu for simplicity. Their controllers are all within the folder of that submenu and all inherit that controller's namespace.
I'm having major issues with the sub elements. I have mapped the resources and applied a prefix to them in the form of
map.resources :subitem, :path_prefix => "/sub_menu"

but I'm having major issues with using RESTFul methods on these nested objects. The paths that I'm trying to use, say to delete an object simply do not work.
I'm refactoring this current code base so there's very little I can do, and there's very little I can find on rails 1 routes online. It's a bit of a finicky issue but maybe I've missed something simple about routes.
Do I simply need to manually write out every particular route I can use and then manually prefix it, or is there a simpler way?
My other routes work fine, I simply cannot use the
subitem_path(subitem) :method => :delete

function in my link to

A: So I figured out how to layout the routes appropriately so I could access the paths
Add to the above route the specified controller you're using and the routes will map accordingly
map.resources :subitem, :path_prefix => "/sub_menu, :controller => "submenu/subitem"

Thanks!


text:
Q: Setting up Google Analytics (gtag) to track ad blocking I've followed an online article as closely as possible (along with reading up in other articles) to track ad blocking but Google seems to have changed their GA tag lately to a new version called GTAG (no longer the same old "universal" tag.
https://www.kaushik.net/avinash/adblock-tracking-google-analytics-code-metrics-reports
I haven't found enough online documentation on how to set this up properly along with setting up the segment in GA to track adblock: true or false. So far, I just get a chart that tracks the adblocking event.
I am a GA GTM newbie and I've always found their UI horrible to navigate but that's besides the point. I hope someone can help with some tips if I've set up incorrectly. Thanks!
Here's what I have in GTM as a new tag as I didn't think I could use the standard GA tag where you just enter your id (I'd have to put the extra code I needed somewhere else and it would get messy imo):
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-ID">
</script>
<script>
  var isAdBlockEnabled;

  (function AdBlockEnabled() {
    var ad = document.createElement('ins');
    ad.className = 'AdSense';
    ad.style.display = 'block';
    ad.style.position = 'absolute';
    ad.style.top = '-1px';
    ad.style.height = '1px';
    document.body.appendChild(ad);
    isAdBlockEnabled = !ad.clientHeight;
    document.body.removeChild(ad);
    return isAdBlockEnabled;
  })()

  window.dataLayer = window.dataLayer || [];
  function gtag(){dataLayer.push(arguments);}
  gtag('js', new Date());

  // Configures custom dimension<Index> to use the custom parameter
  // 'dimension_name' for 'GA_TRACKING_ID', where <Index> is a number
  // representing the index of the custom dimension.
  gtag('config', 'UA-ID', {
    'custom_map': {'1': 'AdsBlocked'}
  });

  // Sends the custom dimension to Google Analytics.
  gtag('event', 'adsBlocked', {'AdsBlocked': isAdBlockEnabled});
</script>

Also, here's my GA segment setup - let me know if you guys need to see anything more:

I'm not sure when Google changed their tag but the old one seemed a lot more straightforward to set up. Thanks for the advice !


text:
Q: IBDesignable not working UIButton alignments? I am subclassing UIButton, trying to align them through programmatically but it does not working.
The same thing i can align them in stoaryboard. Why its not working?
See my code below:
  @IBDesignable
class AddProfilePictureView: UIButton {

    open var bottomLineLayer : CALayer?

    @IBInspectable var textColor:UIColor = .gray{
        didSet{ self.titleLabel?.textColor = textColor }
    }

    @IBInspectable var leftHandImage: UIImage? {
        didSet {
            leftHandImage = leftHandImage?.withRenderingMode(.alwaysOriginal)
            setupImages()
        }
    }
    @IBInspectable var rightHandImage: UIImage? {
        didSet {
            rightHandImage = rightHandImage?.withRenderingMode(.alwaysOriginal)
            setupImages()
        }
    }
    @IBInspectable var bottomLineColor: UIColor = UIColor.lightGray {
        didSet {
            addBottomLine()
        }
    }

    @IBInspectable var imageSize: CGFloat = 20{
        didSet {
            setupImages()
        }
    }
    @IBInspectable var titlePadding: CGFloat = 25{
        didSet {
            alignment()
        }
    }
    override init(frame: CGRect) {
         super.init(frame: frame)
        alignment()
     }

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

     override func prepareForInterfaceBuilder() {
         super.prepareForInterfaceBuilder()
        alignment()
     }

    override func titleRect(forContentRect contentRect: CGRect) -> CGRect {
        var tempRect = contentRect
        tempRect.origin.x = titlePadding
        return tempRect
    }

    override func layoutSubviews() {
        super.layoutSubviews()
        addBottomLine()
    }
    func alignment(){
        contentVerticalAlignment = .bottom
    }
    func  addBottomLine(){
//        if bottomLineLayer == nil{
        for layer in self.layer.sublayers  ?? [] {
             if layer.name == "bottom" {
                  layer.removeFromSuperlayer()
             }
         }
            bottomLineLayer = CALayer()
            bottomLineLayer?.name = "bottom"
            bottomLineLayer?.frame = CGRect(x: 0.0, y: self.frame.height + 5, width: self.frame.width, height: 1.0)
            bottomLineLayer?.backgroundColor = bottomLineColor.cgColor
            self.layer.addSublayer(bottomLineLayer ?? CALayer())
//        }
    }
    func setupImages() {

        if let rightImage = rightHandImage {
            for views in self.subviews{
                if views.tag == 100{
                    views.removeFromSuperview()
                }
            }
            let rightImageView = UIImageView(image: rightImage)
            rightImageView.tag = 100
            rightImageView.tintColor = .black
            self.addSubview(rightImageView)
            rightImageView.translatesAutoresizingMaskIntoConstraints = false
            NSLayoutConstraint.activate([
                rightImageView.trailingAnchor.constraint(equalTo: self.trailingAnchor,constant: 0),
//                rightImageView.centerYAnchor.constraint(equalTo: self.centerYAnchor),
                rightImageView.bottomAnchor.constraint(equalTo: self.bottomAnchor,constant: 0),
                rightImageView.widthAnchor.constraint(equalToConstant: imageSize),
                rightImageView.heightAnchor.constraint(equalToConstant: imageSize)
            ])
        }

        if let rightImage = leftHandImage {
            for views in self.subviews{
                if views.tag == 101{
                    views.removeFromSuperview()
                }
            }
            let rightImageView = UIImageView(image: rightImage)
            rightImageView.tintColor = .black
            rightImageView.tag = 101
            self.addSubview(rightImageView)
            rightImageView.translatesAutoresizingMaskIntoConstraints = false
            NSLayoutConstraint.activate([
                rightImageView.leadingAnchor.constraint(equalTo: self.leadingAnchor,constant: 0),
//                rightImageView.centerYAnchor.constraint(equalTo: self.centerYAnchor),
                rightImageView.bottomAnchor.constraint(equalTo: self.bottomAnchor,constant: 0),
                rightImageView.widthAnchor.constraint(equalToConstant: imageSize),
                rightImageView.heightAnchor.constraint(equalToConstant: imageSize)
            ])
        }
    }
}

This line does nothing
contentVerticalAlignment = .bottom

Output:

A: The problem is you are not calling super method of layoutSubviews.
Try this
override func layoutSubviews() {
    super.layoutSubviews()
    addBottomLine()
}


text:
Q: RHN won't update currently entitled RHEL v5 server I recently purchased RHEL v6 so I was able to get entitlements on my recently upgraded RHEL v4 machine to v5 (v6 is down the road currently).
However, in the web interface I run the updates, it fails as it just shows pending with the stopwatch icon.  If I run rhn_check the stop watch icon disappears and goes back to not installed.  If I login using rhn_register it says the system is already setup for updates but it won't update.  After doing an update from the website, I ran rhn_check -vv and got this as my results:
[root@intranet ~]# rhn_check -vv
D: check_action {'action': "<?xml version='1.0'?>\n<methodCall>\n<methodName>errata.update</methodName>\n<params>\n<param>\n<value><array><data>\n<value><int>11632</int></value>\n</data></array></value>\n</param>\n</params>\n</methodCall>\n", 'version': 2, 'id': 203338917}
updating login info
logging into up2date server
successfully retrieved authentication token from up2date server
D: logininfo: {'X-RHN-Server-Id': xxx, 'X-RHN-Auth-Server-Time': '1308081188.41', 'X-RHN-Auth': 'xxx', 'X-RHN-Auth-Channels': [['rhel-i386-server-5', '20110613025406', '1', '1']], 'X-RHN-Auth-User-Id': '', 'X-RHN-Auth-Expire-Offset': '3600.0'}
D: handle_action {'action': "<?xml version='1.0'?>\n<methodCall>\n<methodName>errata.update</methodName>\n<params>\n<param>\n<value><array><data>\n<value><int>11632</int></value>\n</data></array></value>\n</param>\n</params>\n</methodCall>\n", 'version': 2, 'id': 203338917}
D: handle_action actionid = 203338917, version = 2
D: do_call errata.update ([11632],)
D: Called update [['perl', 0, 0, '']]
Loading "rhnplugin" plugin
Loading "installonlyn" plugin
D: Downloading Packages:
warning: rpmts_HdrFromFdno: Header V3 DSA signature: NOKEY, key ID 37017186
D: Sending back response ((6,), 'Error while executing packages action: Refusing to automatically import keys when running unattended.\nUse "-y" to override.', {})
D: do_call packages.checkNeedUpdate ('rhnsd=1',)
D: local action status:  (0, 'rpm database not modified since last update (or package list recently updated)', {})

A:
D: Sending back response ((6,), 'Error
  while executing packages action:
  Refusing to automatically import keys
  when running unattended.\nUse "-y" to
  override.', {})

this kinda points to the issue. But in any case, if you have RHN then you should have support. Why ask on a forum when you can ask Red Hat?

A: A quick Google search yielded numerous results. Google search for redhat Use "-y" to override
The first response was: yum-rhn-plugin bug fix update. Take a look at it. It may help you.


text:
Q: PHP Script works in the terminal but not the browser I am trying to execute a exec command, and I am having problems. When I run the following code, it doesn't work when I run it through the browser. but if I take the output of $str copy and paste it into a terminal it works just fine. What would be causing this and how can I fix it? Currently I am running on localhost.
$php_location = "/usr/bin/php";
$data = str_replace("\"", "\\\"", json_encode($_POST));
$cwd = __DIR__;

shell_exec($str = "$php_locataion $cwd/phpExcel.php \"$data\" > /home/ryannaddy/Desktop/phpExcel.txt &");

echo $str;

Here is the file shell_exec is calling:
<?php
set_time_limit(0);
$args = $argv[1];

$data = json_decode(str_replace("\\\"", "\"", $args), true);
echo "hello!";

A: When you run it through the browser, it executes as the user for the web server who may not have the correct permissions. When you run it in the terminal it executes as whatever user you are logged in as. Check that the apache (assuming you are using apache) user has the correct permissions to the script / directory.

A: The issue likely has to do with permissions.
When you run something from the shell, it runs under your user account.  The web server will be running as something differently, generally with very few permissions to anything.  Either give the web server's account the appropriate permissions, or run the server under a different account (not recommended!).


text:
Q: reshape2 and wide (imputed) time variables I know reshape from base R can convert to a long format where the time is imputed from the stub variable names A and B, for example:
wide = data.frame(A.2010 = c('a', 'b', 'c'),
                  A.2011 = c('f', 'g', 'd'),
                  B.2010 = c('A', 'B', 'C'),
                  B.2011 = c('G', 'G', 'H'),
                  z = runif(3),
                  x = runif(3))

wide
#  A.2010 A.2011 B.2010 B.2011         z          x
#1      a      f      A      G 0.3626823 0.67212468
#2      b      g      B      G 0.3726911 0.09663248
#3      c      d      C      H 0.9807237 0.31259394

Becomes:
reshape(wide, direction = 'long', sep = '.',
        varying = c('A.2010', 'A.2011', 'B.2010', 'B.2011'))
#               z          x time A B id
#1.2010 0.3626823 0.67212468 2010 a A  1
#2.2010 0.3726911 0.09663248 2010 b B  2
#3.2010 0.9807237 0.31259394 2010 c C  3
#1.2011 0.3626823 0.67212468 2011 f G  1
#2.2011 0.3726911 0.09663248 2011 g G  2
#3.2011 0.9807237 0.31259394 2011 d H  3

Can I accomplish the same with reshape2::melt?

A: It seems like reshape in base r is the best tool to do this, since there is no similar functionality in the melt function from the reshape2 package. You can however, achieve something similar with the patterns function in melt.data.table:
library(reshape2)
library(data.table)

wide = data.table(wide)

long = melt(wide, id.vars = c("z", "x"), measure = patterns("^A", "^B"),
            value.name = c("A", "B"), variable.name = "time")

> long
           z         x time A B
1: 0.3421681 0.8432707    1 a A
2: 0.1243282 0.5096108    1 b B
3: 0.3650165 0.1441660    1 c C
4: 0.3421681 0.8432707    2 f G
5: 0.1243282 0.5096108    2 g G
6: 0.3650165 0.1441660    2 d H

Notice that melt recognizes the varying "time", and groups them correctly, but does not use 2010 and 2011 as desired. A workaround is to recode the levels manually, which should be trivial.
levels(long$time) = c("2010", "2011")

> long
           z         x time A B
1: 0.3421681 0.8432707 2010 a A
2: 0.1243282 0.5096108 2010 b B
3: 0.3650165 0.1441660 2010 c C
4: 0.3421681 0.8432707 2011 f G
5: 0.1243282 0.5096108 2011 g G
6: 0.3650165 0.1441660 2011 d H

I hope this helps!


text:
Q: One table or Two tables to store Forum's threads and Posts? I am building forum site with ASP.net and DB is MYSQL.
as you all know users can start a thread and others can reply to it.
So here is the table that I implemented.
CREATE TABLE `a_post` (
  `post_id_pk` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `is_thread` tinyint(1) NOT NULL,
  `parent_thread_id` int(10) unsigned DEFAULT NULL,
  `title` varchar(100) DEFAULT NULL,
  `short_description` varchar(200) DEFAULT NULL,
  `description` text NOT NULL,
  `category_id_fk` tinyint(3) unsigned DEFAULT NULL,
  `user_id_fk` int(10) unsigned NOT NULL,
 ......
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

So I am using one table to store both threads and posts. This approach is working fine. Normally thread count is smaller than posts count. Or else I can implement two tables to do is. One is to store threads and another one is to store comments with the corresponding thread Id.
What is best? One table or managing two tables?
I want an answer with performance wise. People who did forum systems. You are most welcome here.

A: One thread can have multiple posts and by that you might consider having two table, one for threads and one for posts.
also remember that, duo to microsoft naming conventions table field should be pascal case. so by that i suggest to change you schema to below:
Table [Threads]
ID int
CreatedBy int
CreatedOn DateTime
Title nvarchar
CategoryID int
...

Table [ThreadPosts]
ID int
ThreadID int
CreatedBy int
CreatedOn DateTime
Body nvarchar
...

by doing this you avoid data duplication, because for example when someone send a post on a thread you don't have a category_id to fill, and the field left empty. that might be the performance issue on larger systems.
consider you want to get all the posts of a thread. its so easy with two tables :
var query = from thread in db.Threads
            join posts in db.ThreadPosts on thread.ID equals posts.ThreadID
            where thread.ID == threadID
            select new ThreadFullModel(){
                 Thread = thread,
                 Posts = posts
            };


text:
Q: magento get Internal Server Error when click payment methods on backend's Configuration I am a new guy for Magento. When I click on backend's System>Configuration>Sales>Payment Methods, I got Internal Server Error. I checked error log file, it shows the below error:

[Tue Nov 29 20:25:39.934637 2016] [access_compat:error] [pid 306944:tid 140107193476864] [client 210.5.50.143:55854] AH01797: client denied by server configuration: /var/www/vhosts/baoho.nz/httpdocs/app/etc/local.xml
  [Tue Nov 29 20:25:40.318493 2016] [:error] [pid 306946:tid 140107373123328] [client 222.153.188.223] ModSecurity: Output filter: Response body too large (over limit of 524288, total not specified). [hostname "baoho.nz"] [uri "/index.php/admin/system_config/edit/section/payment/key/0ad75a974774456d274ebf7c4bcf4cb1/"] [unique_id "WD0tb@nx70z3ONKpFlNGtgAAAEI"]
  [Tue Nov 29 20:25:40.318964 2016] [proxy_fcgi:error] [pid 306946:tid 140107373123328] [client 222.153.188.223:55836] AH01068: Got bogus version 101, referer: http://baoho.nz/index.php/admin/system_config/edit/section/checkout/key/0ad75a974774456d274ebf7c4bcf4cb1/
  [Tue Nov 29 20:25:40.318986 2016] [proxy_fcgi:error] [pid 306946:tid 140107373123328] (22)Invalid argument: [client 222.153.188.223:55836] AH01075: Error dispatching request to :, referer: http://baoho.nz/index.php/admin/system_config/edit/section/checkout/key/0ad75a974774456d274ebf7c4bcf4cb1/

I did change .htaccess file's memory limited from 64MB to 512MB. However, it still showed the same error. Could anyone help me to solve this problem?
Thanks


text:
Q: Can't group focus selector css I am trying to override the thumb box-shadow for the different browsers, but for some reason when I group them, none of it gets applied. If I removed the other selectors, it works fine. Any thoughts
input[type='range']:focus::-webkit-slider-thumb,
input[type='range']:focus::-ms-thumb,
input[type='range']:focus::-moz-range-thumb {
  box-shadow: purple;
}

Expect css box-shadow rule to apply to all the selectors. Result: the rule doesn't get applied at all.


text:
Q: swagger-client request body missing, content-length 0, and 415 response I am maintaining someone else's web app (manual JavaScript files and MVC using swagger-js to connect to a .NET API).
The one POST route is returning 415 (Unsupported Media Type), but all the other GET routes work ok. I've had a look at the existing questions on this topic and they refer to incorrect specs or other issues which don't apply to me... I think.
You can quite clearly see from the Request Headers that nothing is posted in the body. But I don't know why:
POST /api/Trip/search HTTP/1.1
Accept-Encoding: gzip, deflate, br
Accept-Language: en-US,en;q=0.9
Connection: keep-alive
Content-Length: 0
Host: localhost:44393
Origin: https://localhost:44316
Referer: https://localhost:44316/
Sec-Fetch-Dest: empty
Sec-Fetch-Mode: cors
Sec-Fetch-Site: same-site
User-Agent: Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/102.0.0.0 Safari/537.36
accept: application/json
sec-ch-ua: " Not A;Brand";v="99", "Chromium";v="102", "Google Chrome";v="102"
sec-ch-ua-mobile: ?0
sec-ch-ua-platform: "Windows"

The Swagger spec is generated from dotnet core 3.1 using this route:
    [Route("search")]
    [HttpPost]
    [ProducesResponseType(StatusCodes.Status200OK)]
    [ProducesResponseType(StatusCodes.Status400BadRequest)]
    public async Task<ActionResult<TripInformationSearchResponse>> TripInformationSearch(TripInformationSearchRequest request)
    {
        ...
    }

Part of the generated spec is:
"/api/Trip/search": {
  "post": {
    "tags": [
      "Trip"
    ],
    "operationId": "TripInformationSearch",
    "requestBody": {
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Cust.API.Models.Trip.TripInformationSearchRequest"
          }
        },
        "text/json": {
          "schema": {
            "$ref": "#/components/schemas/Cust.API.Models.Trip.TripInformationSearchRequest"
          }
        },
        "application/*+json": {
          "schema": {
            "$ref": "#/components/schemas/Cust.API.Models.Trip.TripInformationSearchRequest"
          }
        }
      }
    },
    "responses": {
      "200": {
        "description": "Success",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Cust.API.Models.Trip.TripInformationSearchResponse"
            }
          }
        }
      },
      "400": {
        "description": "Bad Request",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Microsoft.AspNetCore.Mvc.ProblemDetails"
            }
          }
        }
      }
    }
  }
}

The webapp client uses swagger-js from JavaScript (not exactly how I would do it but I'm not about to rewrite it just now) to call the search_trips function which calls the above API route:
CUSTAPI = {
    swagger_client: function (urlBase) {
        var specUrl = urlBase + '/swagger/v1/swagger.json';
        SwaggerClient.http.withCredentials = true; // this activates CORS, if necessary
        var swaggerClient = new SwaggerClient(specUrl);
        return swaggerClient;
    },

    // ...and later

    search_trips: function (keywords, tripNumbersArr, status, routeType, hasGLPostDate, successCallback) {
        var failedSwaggerLoadSpecCallback = function (reason) { CUSTAPI.error_display("Unable to connect to the API: " + reason); };
        var failedApiRequestCallback = function (reason) { CUSTAPI.error_display("Unable to fulfill the API request: " + reason); };

        CUSTAPI.swagger_client(oldApiClient_UrlBase)
            .then(
                function (swaggerClient) {
                    var searchRequest = {
                        keywords: keywords,
                        tripNumbers: tripNumbersArr, //array
                        status: status,
                        routeType: routeType,
                        hasGLPostDate: hasGLPostDate
                    };
                    return swaggerClient.apis.Trip.TripInformationSearch(searchRequest); // chaining promises
                }, failedSwaggerLoadSpecCallback)
            .then(function (response) {
                if (response.ok)
                    successCallback(response.obj);
                //else
                //    return response
            }, failedApiRequestCallback);
    },

...

}

And from there no amount of debugging can show me why nothing is put in the body. Can you see why?


text:
Q: How to change the context path of bitbucket-server in docker mode I am looking for a way to change the context path of bitbucket-server in docker mode, because I am trying to run it behind a traefik reverse proxy and want to use my domain for multiple applications (one for each path):
I want my bitbucket-server to be served over https://my.domain.name/bitbucket, and my jira over https://my.domain.name/jira... etc
I already found a solution for other Atlassian products (jira, servicedesk and confluence) using the reverse proxy setting ATL_TOMCAT_CONTEXTPATH, that environment param is not described in the bitbucket-server docker hub page.
My docker swarm stack looks like this:
version: '3'

services:

  bitbucket-server:
    image: atlassian/bitbucket-server:6.7
    deploy:
      labels:
        - "traefik.enable=true"
        - "traefik.http.routers.bitbucket-server.entryPoints=websecure"
        - "traefik.http.routers.bitbucket-server.rule=Host(`my.domain.name`) && PathPrefix(`/bitbucket`)"
        - "traefik.http.services.bitbucket-server.loadbalancer.server.port=7990"
        - "traefik.http.routers.bitbucket-server.tls=true"
        - "traefik.http.routers.bitbucket-server.tls.certresolver=letsencrypt"
        - "traefik.http.routers.bitbucket-server.tls.domains=my.domain.name"
    environment:
      - ATL_PROXY_NAME=traefik.my.domain.name
      - ATL_PROXY_PORT=443
      # next line didn't work !
      # - ATL_TOMCAT_CONTEXTPATH=/bitbucket
    volumes:
      - bitbucket_data:/var/atlassian/application-data/bitbucket
    networks:
      - local
      - public-proxy
    labels:
      - description= "Bitbucket"

  jira-software:
    image: atlassian/jira-software:8.5
    deploy:
      labels:
        - "traefik.enable=true"
        - "traefik.http.routers.jira-software.entryPoints=websecure"
        - "traefik.http.routers.jira-software.rule=Host(`my.domain.name`) && PathPrefix(`/jira`)"
        - "traefik.http.services.jira-software.loadbalancer.server.port=8080"
        - "traefik.http.routers.jira-software.tls=true"
        - "traefik.http.routers.jira-software.tls.certresolver=letsencrypt"
        - "traefik.http.routers.jira-software.tls.domains=my.domain.name"
    volumes:
      - jira_software_data:/var/atlassian/application-data/jira
    environment:
      - ATL_PROXY_NAME=traefik.my.domain.name
      - ATL_PROXY_PORT=443
      # next line did work !
      - ATL_TOMCAT_CONTEXTPATH=/jira
      - ATL_TOMCAT_SCHEME=https
      - ATL_TOMCAT_SECURE=true
    networks:
      - local
      - public-proxy
    labels:
      - description= "Jira Software"

  jira-servicedesk:
    image: atlassian/jira-servicedesk:4.5

    # ... Same as jira-software

  confluence:
    image: atlassian/confluence-server:7.1

    # ... Same as jira-software

networks:
  local:
  public-proxy :
    external: true

volumes:
  servicedesk_data:
  confluence_data:
  jira_software_data:
  bitbucket_data:

A: Context path can be configured from bitbucket.properties by adding this line
server.context-path=/bitbucket

In a docker environment, you can mount your bitbucket properties file to your container so it replaces the default one
volumes:
  - YOUR_BITBUCKET_PROPERTIES:<Bitbucket home directory>/shared/bitbucket.properties


text:
Q: Derivative of a set of points So I know you can find the derivative of something like: "x^3-6*x^2" by doing: D(expression(x^3-6*x^2), 'x'), but what if I need to find the first derivative maximum of a list of values such as:
value <- c(610,618,627,632,628,634,634,628,634,642,637,643,653,666,684,717,787,923,1197,1716,2638,4077,5461,7007,8561,9994,11278,12382,13382,14252)
these values are the y coordinate and the x coordinate starts at 1 and increments by 1. IE the first point is (1,610) second is (2,618) etc. -Thanks

A: Consider using the package numDerive from CRAN. It has a function grad that computes derivative of a function at a point. Example:
f = function(x) x^3 - 6*x^2
library(numDeriv)
grad(f, 1) #derivative of f at x=1

To solve your problem with a list of values, use a for loop:
xval <- c(YOUR VALUES HERE)
xval.derivatives <- c() #empty vector to hold
for(i in 1:length(xval)) xval.derivatives[i] <- grad(f,xval[i])

A: The gradient function from the pracma package calculates the derivative from a vector of values.
library(pracma)

value <- c(610,618,627,632,628,634,634,628,634,642,637,643,653,666,684,717,787,923,1197,1716,2638,4077,5461,7007,8561,9994,11278,12382,13382,14252)
value_prime <- pracma::gradient(value, h1 = 1)
plot(value_prime)

Alternatively, fit a spline.
spl <- smooth.spline(1:length(value), y=value)
pred <- predict(spl)
pred.prime <- predict(spl, deriv=1)
plot(pred.prime, type = 'b')

If you are interested in higher derivatives, check the pspline package.


text:
Q: How to parse NSDictionary data from JSONValue I have a NSDictionary made up of the daily trend from twitter (made up of JSON). However there is a problem blocking my way. Before I can get to any data, I need to firstly get through the first key named @"trends". That is fine and works perfectly. However to actually get to the trend itself, I need to get through a few dates. What I would like to know is how can I get the trend data without knowing the dates.
At the moment the hierachy of the NSDictionary is:
Dictionary -> key:@"trends" -> Lots of keys named as dates, i.e: 2011-04-30 02:32:34 (this is where I am stuck) -> trend data (what I need to get).

A: NSDictionary *trends = [yourResultFromParsingJSON objectForKey:@"trends"];

[trends enumerateKeysAndObjectsUsingBlock:^(NSString *trendDate, id trendData, BOOL *stop) {
    // do whatever you want with trendData
}];

A: for(NSDictionary* key in responseDict) {
    if ([key isEqual:@"abc"]) {
        NSString *cookieValue = [responseDict objectForKey:@"abc"];
        cookieValue = [cookieValue substringWithRange:NSMakeRange(11, 32)];
    }
}


text:
Q: Route Change command with Powershell Captureing output I am trying to capture the output of the route change command.
$StrTemp = route change 0.0.0.0 mask 0.0.0.0 $Gateway metric 10 if $i

If the interface does not exist the output is not captured into $StrTemp. If the command is successful it is captured. Placing the | Out-Null command doesn't change anything either. Any error in the command is still printed on the screen. Anyone found this before?

A: It likely outputs to stderr on failure, you can merge it with stdout using the > redirection operator:
$routeOut = route change 0.0.0.0 mask 0.0.0.0 $Gateway metric 10 if $i 2>&1
$routeErr = $routeOut.Where({$_ -eq [System.Management.Automation.ErrorRecord]})

or wrap it in an expression and then capture it using the ErrorVariable parameter:
$routeOut = Invoke-Expression "route change 0.0.0.0 mask 0.0.0.0 $Gateway metric 10 if $i" -ErrorVariable routeErr


text:
Q: How to import private key with passprhase from PEM file I trying to load a private key from a PEM file using CryptStringToBinary and CryptDecodeObjectEx, that works fine when the private key is not password protected, but it doesn't work when the key is password protected.
if(!CryptStringToBinary(buffer.get(), length, CRYPT_STRING_BASE64HEADER, reinterpret_cast<BYTE*>(outBuffer.get()),
                        &outLength, 0, 0))
{
    cerr << "CryptStringToBinary Error: " << GetLastError();
    return -1;
}

DWORD keyBlobLength = 0;
CRYPT_PRIVATE_KEY_INFO* keyBlob = 0;

if(!CryptDecodeObjectEx(X509_ASN_ENCODING, PKCS_PRIVATE_KEY_INFO,
                        reinterpret_cast<const BYTE*>(outBuffer.get()),
                        outLength, CRYPT_DECODE_ALLOC_FLAG, 0, &keyBlob, &keyBlobLength))
{
    cerr << "CryptDecodeObjectEx Error:\n" << GetLastError();
    return -1;
}

Any ideas how to decrypt the PEM file using the password? I need to use WinCrypt not openssl.


text:
Q: How to use allocator to change vector values? I want to use std::allocator to change vector values, but i cant understand why when i construct a vector with this allocator as an argument to constructor, the afterward manipulation with this allocator do not change the vector contents.
To be more specific, consider simple example:
allocator<int> alloc;
vector<int> iVec(alloc);

int* pAlloc = alloc.allocate(1);
int i = 123;
alloc.construct(pAlloc, i);
cout << pAlloc[0] << endl; // this outs '123'
cout << iVec[0] << endl; // this causes out of range error. why?

Any advice what i have missed would be much appreciated,
Thanks

A: std::vector owns the allocator that it uses.  When you use vector<int> iVec(alloc);, alloc is copied and iVec uses that copy of alloc to do its allocations.
If you want to modify the contents of the vector, you need to use its interface to do so, like using iVec.push_back(1) to potentially allocate space and insert the value into the vector.


text:
Q: How do you create a UIButton programmatically in Obj-C with resizable text label? I'm completely stumped on how to even proceed with solving this problem.  I'm not very good with Obj-C, but I need to create a customized UIButton that will have text on the left side of the button and an image on the right side of the button.  The problem is that the text can vary from being 10 characters long to 17 characters long.  So, the button needs to resize based on the text length.
The button must have a black background with a corner radius of 12 with white foreground text.
I saw this post on SO: How do I create a custom view class Programmatically?.
This is sort of similar to what I need to do, but I don't understand how to get the "resizable text" part of it to work.
How can I create a custom view where the label and image in the button are configured using constraints?

A: Below may help.
UIFont   *  font = ...    // Button font
CGFloat     zoom = ...    // Zoom factor
NSString * label = ...    // Label text

// Create attributes
NSDictionary * attr = [NSDictionary dictionaryWithObject:
                           [font fontWithSize:font.pointSize * zoom]
                                                  forKey:
                           NSFontAttributeName];

CGSize size = [label sizeWithAttributes:attr];

This may be overkill for what you are looking for at present but if the button becomes more complex this can come in handy. If you do go this route then note there are attributes to control the breaking and paragraph width and so on. Here I just show the font.

A: So, I found the answer... there were a few things that were not done correctly:

*

*Make sure the XIB has the correct target membership

*The XIB wasn't loading because of a naming conflict (I think).  I gave the XIB file and the .h/.m file the XIB file is linked to all the same name.

*Made sure that the file owner was linked to the new class

*Made sure the outlets were hooked up to the .h file of the new class

After doing these steps, it seems to work.


text:
Q: Problems on bounded finite intervals. 1.Prove that if $\lim _{x \rightarrow 0} f(x)=0$ and $\lim _{x \rightarrow 0} \frac{f(2 x)-f(x)}{x}=0$, then $\lim _{x \rightarrow 0} \frac{f(x)}{x}=0$.
2.Suppose that $f$ defined on $(a,+\infty)$ is bounded on each finite interval $(a, b), a<b$. Prove that if $\lim _{x \rightarrow+\infty}(f(x+1)-f(x))=l$, then also $\lim _{x \rightarrow+\infty} \frac{f(x)}{x}=l$.
My approach for first problem:-
Fix $\varepsilon>0$ arbitrarily. By assumption there is $\delta>0$ such that
$$
\frac{\left|f(x)-f\left(\frac{1}{2} x\right)\right|}{|x|}<\varepsilon, \quad \text { whenever } 0<|x|<\delta
$$
Hence, for $0<|x|<\delta$,
$$
\begin{aligned}
\left|\frac{f(x)}{x}\right| &=\lim _{n \rightarrow \infty}\left|\frac{f(x)-f\left(\frac{1}{\left.2^{n+1} x\right)}\right.}{x}\right| \\
& \leq \varlimsup_{n \rightarrow \infty} \sum_{k=1}^{n+1} \frac{\frac{1}{2^{k-1}}\left|f\left(\frac{x}{2^{k-1}}\right)-f\left(\frac{x}{2^{k}}\right)\right|}{\frac{1}{2^{k-1}}|x|} \\
& \leq \varlimsup_{n \rightarrow \infty} \sum_{k=1}^{n+1} \frac{1}{2^{k-1}} f=2 \epsilon
\end{aligned}
$$
Kindly cheak this and please give hints or solution for the second problem also give another hints or solution for first problem. Thank you.

A: The first parts looks fine.
For the second part let $n \leq x <n+1$ and write $\frac {f(x)} x$ as $$\frac {f(x)-f(x-1)} x$$ $$+\frac {(f(x-1)-f(x-2))+\cdots+(f(x-(n-1))-f(x-n))} n \frac n x $$ $$+\frac {f(x-n)} x.$$ By assumption, the first and the last terms tend to $0$. Use Cesaro's Theorem to see that the second term tends to $l$. [Note that $n \to \infty$ and $\frac n x \to 1$ as $x \to \infty$].


text:
Q: Fluid layout of text in Flex3 In my Flex3 app I have some floating windows which contain variable amounts of text. The windows are meant to be user-resizable. Currently, while I can resize the windows OK, I can't get the text in a TextArea in the window to re-flow when the window is resized. I've come across blog postings that there's a size bug in TextArea that means that setting the text content does not re-size the TextArea properly, together with suggested workarounds. In my case, the content stays the same but the geometry of the container changes. What seems to be happening is that the TextArea adopts a fixed size when it is first rendered, and no amount of resizing the container changes that. Can anyone suggest a means of creating a fluid text area in Flex?
Ian

A: I found a great example of fluid windows please do visit it. They provide source code also so may be you would get better idea.
http://examples.adobe.com/flex3/devnet/dashboard/main.html

A: You could try Text Layout Framework from Adobe:
http://labs.adobe.com/technologies/textlayout/

A: I can take a whack at this... but don't laugh..
I am not sure if you need to use a particular container but in any event, set the width and height to 100% and use Grid > GridRow and GridItem to size and resize Text Control you can specify the width of the table or just use it just like an HTML table in Flex to manipulate the size of controls and containers....
hope that helps...

A: By binding the textArea's width to its container's with, you can manage to keep the margins and borders and don't have to deal with percentages.
Also, your textArea will be resized each time its parent changes in size.
i'm thinking of something like this:
<fx:Script>
    <![CDATA[
        import spark.layouts.supportClasses.LayoutBase;

        protected function onButtonClicked(event:MouseEvent):void
        {
            currentState = (event.target.selected ? 'largeState' : 'smallState');
        }

    ]]>
</fx:Script>
<s:TitleWindow id="window" width="300" height="200">
    <s:TextArea width="{window.width - 10}" height="{window.height - 60}"
        text="{IMyConsts.LOREMIPSUM}" borderVisible="false" />
    <s:ToggleButton id="btnEffect" bottom="5"  click="onButtonClicked(event)"
        label="{btnEffect.selected ? 'Go smaller' : 'Go larger'}" />
</s:TitleWindow>
<s:states>
    <s:State name="smallState" />
    <s:State name="largeState" />
</s:states>
<s:transitions>
    <s:Transition fromState="smallState" toState="*">
        <s:Resize target="{window}" widthTo="400" heightTo="300" />
    </s:Transition>
    <s:Transition fromState="largeState" toState="*">
        <s:Resize target="{window}" widthTo="300" heightTo="250" />
    </s:Transition>
</s:transitions>


text:
Q: How to Clear Parameters from Model Builder - ArcGIS I'm attempting to clear out the parameters from my model so that the parameter locations don't show up in the tool when launched from ArcToolbox.
ESRI's resource center has a couple of sentences about clearing parameters, but not how to actually do it.

ESRI's attempt at explaining how to clear out the parameters
Does anyone know the steps to clear the parameters of a model built inside Model Builder for ArcMap?

A: When you are building your model just don't assign a data source to it.  Leave it blank.  If you need to reset the model just click on the "Validate" button on the model builder toolbar (it's a checkmark) that should reset anything that was holding over from a previous run.


text:
Q: vb.net repeat data on RDLC report horizontally then vertically I was using crystal report on vb.net application to create this report
CrystalReportSample
So if the user what to print 26 labels he can on A4 Paper
Uncountably I wasn't able to achieve that on RDLC
My code is Simple I have table called Temp with 5 Strings values and I populate it as the following:
 Dim DT As New DataTable
    DT.TableName = "Temp"
    DT.Columns.Add("BarcodeId", Type.GetType("System.String"))
    DT.Columns.Add("BarcodePrice", Type.GetType("System.String"))
    DT.Columns.Add("BarcodeLabel", Type.GetType("System.String"))
    DT.Columns.Add("CurrencyType", Type.GetType("System.String"))
    DT.Columns.Add("Store", Type.GetType("System.String"))
    DT.Clear()
    For i = 1 To 1
    DT.Rows.Add(Label4.Text, Price.Text, Item_NameTextBox.Text, combobox1z, Main.Companylabel2.Text)
    Next
    ReportViewer1.Invoke(Sub() ReportViewer1.LocalReport.DataSources.Clear())
    ReportViewer1.Invoke(Sub() ReportViewer1.LocalReport.ReportPath = "D:\AZFTSAIO\AZFTS\RDLC Reports\Report2No.rdlc")
    ReportViewer1.Invoke(Sub() ReportViewer1.LocalReport.DataSources.Add(New Microsoft.Reporting.WinForms.ReportDataSource("DataSet1", DT)))
    ReportViewer1.Invoke(Sub() ReportViewer1.RefreshReport())

Now the Problem is I'm not able to repeat the data based on rows number.
I need the page to hold 44 labels 4 horizontally * 11 vertically


text:
Q: Execute multiple scripts on application startup I defined DataSource as bean:
@Bean(name="dataSource")
public DriverManagerDataSource dataSource() {
    DriverManagerDataSource dataSource = new DriverManagerDataSource();
    dataSource.setDriverClassName("org.h2.Driver");
    dataSource.setUrl("jdbc:h2:~/myDB");
    dataSource.setUsername("sa");
    dataSource.setPassword("");
    return dataSource;
}

It works perfectly, however i need to specify schema for db creation and load data on it. Is there any chances how to excute both scripts (schema and data scripts) just like Spring Data has? The Only thing I found is datasource.setSchema() and aswell as i'm concerned i have to specify full path to it. Then how to specify it, if my schema script located in src/main/resources/ path? (I did exactly, how documentation says, but it fails with a message)

There was an unexpected error (type=Internal Server Error, status=500).
  org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested exception is org.h2.jdbc.JdbcSQLException: Schema "~/schema-h2.sql" not found [90079-193]

Thank you for suggestions

A: You can do something like this :
import org.springframework.jdbc.datasource.init.DatabasePopulator;
import org.springframework.jdbc.datasource.init.DatabasePopulatorUtils;
import org.springframework.jdbc.datasource.init.ResourceDatabasePopulator;

@Bean(name="dataSource")
public DriverManagerDataSource dataSource() {
   DriverManagerDataSource dataSource = new DriverManagerDataSource();
   dataSource.setDriverClassName("org.h2.Driver");
   dataSource.setUrl("jdbc:h2:~/myDB");
   dataSource.setUsername("sa");
   dataSource.setPassword("");

   // schema init
   Resource initSchema = new ClassPathResource("script/schema.sql");
   DatabasePopulator databasePopulator = new ResourceDatabasePopulator(initSchema);
   DatabasePopulatorUtils.execute(databasePopulator, dataSource);

   return dataSource;
}

A: Solution 1
Update your connection url with these additional options:
DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE;INIT=CREATE SCHEMA IF NOT EXISTS

Solution 2
You should have a application.properties file in your src/main/resources which should contain these propertes:
spring.datasource.platform=h2
spring.datasource.initialize=true

Workaround
You could aim for putting INIT params with script location script in your connection url (being one of the options):
jdbc:h2:mem:test;INIT=RUNSCRIPT FROM '~/schema.sql'\;RUNSCRIPT FROM '~/data.sql'"

This functionality is enabled via the INIT property. Note that
  multiple commands may be passed to INIT, but the semicolon delimiter
  must be escaped, as in the example below.

A: Here is Spring official document - Creating an Embedded Database Programmatically.
import org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseBuilder;
import org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseType;

    @Bean(name = "dataSource")
    public static DataSource H2DataSource() {
        return new EmbeddedDatabaseBuilder()
                .setName("testdb")
                .setType(EmbeddedDatabaseType.H2)
                .addScripts("Your scripts in /resources")
                .build();
    }


text:
Q: B2B, B2C Tenants in Azure AD I have a query with regards to Tenant Concept in Azure and its relation with B2B and B2C Tenants.
As per definition "Azure AD organises users and apps into group called tenants".
Here does App represent VMs, Storage Disk etc. in Resource Group?
Secondly, its mentioned that Subscription can only be associated with single AD Tenant at a time.
If so, how can B2B and B2C Users use the Resources under a subscription where B2B and B2C are managed as separate tenants?
Requesting you to clarify this concept.
Regards,
Vinoth K Balu

A: An Azure subscription belongs to an Azure tenant (or organization). (This relationship was not intuitive to me at first, because you sign up for an Azure subscription and the "owning" Azure tenant is automatically created for you in the background.)
The admin credentials you create as part of the sign-up represent an Azure AD user (in your new tenant) and - as a global admin of the Azure tenant - that user can create resources in the subscription.
There are paid versions of Azure AD, but most people start with the free tier, so the resources (for example, VMs) in the subscription are what you pay for and the subscription is how you pay for it. If the same company had two projects and wanted to track the billing for the Azure costs separately, it could create a second subscription (under the original tenant) and create resources in the appropriate subscription to keep the billing as desired. (Billing issues are the only reason I can think of that you would create multiple subscriptions in the same tenant.)
The Azure AD user(s) can login to the Azure portal and create/manage the resources, but typically, if you create a Windows VM - you would use the resource (log into it via RDP) using a local Administrator account (just like a physical server), not your Azure AD user credentials.
Azure AD is not a cloud version of (on-premise) Active Directory. Due to the name, I think this is a common misconception.
Microsoft 365 (formerly Office 365) users are actually Azure AD users. Microsoft calls these "Work/School" accounts to differentiate between those and a (consumer) "Microsoft account". (The naming of these things adds to the complexity of discussing them.) With Windows 10, it's possible to join a computer to an Azure AD domain and login to the computer with your "Work/School" (actually Azure AD) user, but this is a different thing than logging in with an (on-premise) Active Directory account.
So (at least for now), most of the time you would use your Azure AD user credentials to login to the Azure portal and manage the resources, but will typically login to VMs with traditional credentials.
"App" as used here refers to an application (typically a web application) that is using Azure AD to authenticate with (similar to how you could use Okta or Google or Facebook as your identity provider).
A B2C tenant is really only used in this context. If your primary Azure AD tenant is  a directory of your company's users, and you have developed a web application - you could create a separate B2C tenant to hold that application's users. A B2C tenant wouldn't have a subscription or any resources (like VMs) - just users, groups, etc. for authenticating an application.
I'm not aware of their being a B2B "tenant". The B2B functionality lets you offer guest access to users in another Azure tenant/organization been given access to your tenant. Somewhat parallel to setting up a traditional AD domain trust.
Having said all of that, if you set up a VM and want to give RDP or SSH access to an end user - you can set that up in the VM and not worry about creating an Azure AD user. You could also run traditional Active Directory on Windows VMs running in Azure that are set up as domain controllers and give out traditional (not Azure) AD credentials.


text:
Q: Program Crashing while trying to open a .txt file When I try to run my program it crashes right of the start. The problem is my input from file, I can write to the file fine. Can someone explain why this code wouldn't work??
StringList::StringList()
{
  pTop=NULL;
  pBottom=NULL;

  ifstream in;
  in.open("read.txt");

  StringListNode * pCurrent;
  pCurrent = new StringListNode;
  pCurrent = pTop;

  while(!in.eof())  //reads it till the end of file
  {
    in >> pCurrent->data;
    pCurrent = pCurrent->pNext;
  }
  in.close();
}

This Output to the file works fine. I thought I would just include it.
StringList::~StringList()
{
  ofstream out;
  out.open("read.txt");

  StringListNode * pCurrent;
  pCurrent = new StringListNode;
  pCurrent = pTop;
  while(pCurrent != 0)
  {
    out << pCurrent->data << endl;
    pCurrent = pCurrent->pNext;
  }
  out.close();
 }

A: pCurrent = pTop; Why do you assign this here?  This makes pCurrent null pointer. Please remove or fix.
I'm confused with your code:
pCurrent = new StringListNode; // Allocate new memory and point at it
pCurrent = pTop; // Make pCurrent point at same thing as pTop

You assign to pCurrent twice. pTop looks like a data member, perhaps you meant in constructor:
pCurrent = new StringListNode; // Allocate new memory and point at it
pCurrent->pNext = nullptr; // Assign null to next pointer
pTop = pCurrent; // Make pTop point at new memory

and in destructor remove pCurrent = new StringListNode; because it does not do anything.
When outputting, you check pCurrent != 0, but you do not check for null when reading. Probably pCurrent is null pointer.
Also, please read Why is iostream::eof inside a loop condition considered wrong?. Your loop should be:
while(pCurrent && (in >> pCurrent->data))
{
   pCurrent = pCurrent->pNext;
}


text:
Q: Can I use Mix_OpenAudio and SDL_OpenAudio in the same game? I am trying to finish up a school project using SDL 1.2, but I have hit a snag that I can't get by.
The game has several game state modules, each with a function
int Run(SDL_Surface *screen);
In each module, Run() initializes audio, runs through its loop, then closes audio before returning.
all of the modules use Mix_OpenAudio() and Mix_CloseAudio() to init/deinit the sound, and work fine together.
The only exception is the cinematic movie module where I have used SDL_FFMpeg to show a movie. This module forces me to use SDL_OpenAudio() instead.
SDL_OpenAudio fails the first time with the error "Audio device is already open", but then works the second time.
Once I have run the movie module, all the sound in the other modules stops working even though all their functions return 0 for success.
anyone have any idea whats going on?

A: The conflicts chapter tells this :

When using SDL_mixer functions you
  need to avoid the following functions
  from SDL:
SDL_OpenAudio
      Use Mix_OpenAudio instead.

therefore I guess the answer to your question is : you can not mix SDL_OpenAudio() and MIX_OpenAudio() functions.

A: SDL_OpenAudio() and SDL_CloseAudio() is a pair function, once you open audio some where, you must close it, or you'll get the error like

Audio device is already open

While using SDL_OpenAudio(), it's a singleton, by trace into SDL source code, you may find that there was a current_audio object and this is the global audio object. If you open multiple audio files in the same time, this may cause race condition.
I think this pair function only fit for audio/video playing, not for game(in game there may be multiple audio source at the same time), because you'll probably not playing multiple audio/video time at the same time in a single process. So before you start to play a video/audio file, you must ensure that the SDL's audio status is SDL_AUDIO_STOPPED by calling SDL_GetAudioStatus(). After playing a audio/video file, you should do something like that:

SDL_LockAudio();
SDL_CloseAudio();
SDL_UnlockAudio();

This will ensure that the audio stop completely. BTW, the lock/unlock operation is to ensure that your audio callback code do not running at the point.


text:
Q: Eclipse Projects are gone My original computer with eclipse had crashed. I had backed up my entire hard drive. When I went and ran eclipse all my projects were gone. Is there a way to recover these projects.

A: If the projects are still on your hard drive, but not appearing in the Eclipse IDE, then:
1) In Eclipse, File>Switch Workspace to your prior workspace directory.
2) If that doesn't help, import your projects into the workspace with File>Import, using as an import source General>Existing Projects into Workspace. A dialog will appear asking for a directory in which to search for Eclipse projects. Pick one, and pick the projects to import.
If necessary, repeat step 2 for multiple parent directories.
Alternatively, if you or a teammate has created a "Team Project Set" beforehand, you can import it with File>Import using Team>Team Project Set.

A: Import your Workspace-Directory from Backup


text:
Q: Image of the veronese map for the rational normal curve Given the veronese mapping for n=1
\begin{align*}
 v_d:\mathbb{P}^1(\mathbb{C})&\longrightarrow\mathbb{P}^d(\mathbb{C})\\
 \langle z_0,z_1\rangle&\longmapsto\langle z_0^d,z_0^{d-1}z_1,\cdots,z_1^d\rangle
 \end{align*}
my goal is to show that

$$v_d(\mathbb{P}^1(\mathbb{C}))=Z(\langle
 x_ix_j-x_{j-1}x_{i+1}\rangle).$$

The inclusion $\subset$ is clear.
The other inclusion however I need a little help.
Attempt:
we let $\langle x_0,\cdots ,x_d\rangle\in \mathbb{P}^d$, which satisfies $x_ix_j-x_{j-1}x_{i+1}=0$.
Then let $i$ such that we always assume $x_i$ is non zero. Since $x_i^2=x_{i-1}x_{i+1}$, we may assume by induction that either $i=0$ or $i=d$.
For $i=0$: It follows that $x_j = x_{j-1}\frac{x_1}{x_0}$ , for $1\leq j \leq d$.
So we let $z=\frac{x_1}{x_0}$ and it follows that
\begin{align*}
\langle x_0,\cdots, x_d\rangle &= \langle x_0,zx_0,z^2x_0,\cdots,z^dx_0\rangle\\
&=v_d(\langle 1,z\rangle)
\end{align*}
Could anyone tell me how to then proceed with the case $i=d$?
Thanks in advance!


text:
Q: "Minkowski's inequality" taking on negative functions in $L^p$ confusion Does the "Minkowski inequality" imply that
$||f_n-f||_p=||f_n+-f||_p \leq ||f_n||_p + ||-f||_p =  ||f_n||_p -||f||_p?$

A: No, it does not.
The problem is in the last "$=$" sign.
In particular, $\|-f\|_p = -\|f\|_p$ is false,
if $f\neq0$.
Instead,
$$
\|-f\|_p = \|f\|_p
$$
is correct.

A: Norms are absolutely homogeneous, meaning that $\lVert \alpha f \rVert = |\alpha| \lVert f \rVert$ for $\alpha \in \mathbb{R}.$ So your last equality doesn't follow. In fact $\lVert -f \rVert = \rVert f \lVert.$


text:
Q: What happens to props once a React project is built? I am building a project out in React and am coming up against a problem I don't know how to solve as conceptually it's beyond me.
In my project, I pass a JavaScript Date object in to a component as props.
Then I store this data as state in the component.
That date state is then used to update a timeline bar, which obviously needs to be current for the timeline to progress.
A simplified version of the code is below:
DateComponent file:
class DateComponent extends Component{
  constructor(props){
    super(props);
    this.state = {
      start: new Date(this.props.start)
    }

  render() {
    return (

    )
  }
}

Passing props in:
<DateComponent
  start={new Date()}
/>

In my finished project I am going to have some HTML rendered like so:

Is there anyway I can get it so that if I then build the React project out, if I wanted to update the data-custom-attr with a new date, or to keep it returning the current date using plain JavaScript, it will perform the required operations as in the react environment?

A: To get this to update actively with props, you would need to either trigger a re-render because you are storing the props into state or use a lifecycle method like componentWillUpdate to catch the update at the parent level and setState again (I don't suggest using this lifecycle method since it is being deprecated by Facebook).
Personally, you just need to simplify your component. Rather than the DateComponent managing the date state, just extract that to the parent level and pass the date props directly to the html. Whenever start updates, this will update the DateComponent. For example:
Parent
class ParentComponent extends Component {
  constructor(props) {
    super(props);
    this.state = {
      currentDate = new Date()
    }
  }

  render = () => {
    const {currentDate} = this.state;
    return (
      <DateComponent start={currentDate} />
    )
  }
}

DateComponent
class DateComponent extends Component{
  constructor(props){
    super(props);
  }

  render() {
    const {start} = this.props;
    return (

    )
  }
}

The cool thing about this is that by simplifying the DateComponent to be static, this component can be simplified further. You can take advantage of some of the new features out there like context too, however, I won't get into that here.
static DateComponent
const DateComponent = ({start}) => (

)


text:
Q: $.Ajax in jQM mobile app with phonegap is not working on iOS devices I have a login button in a jQuery Mobile application. When the login button is pressed a soap service is getting called using $.ajax() method. This works on browser and android phones but the control does not even go inside the $.ajax() in iOS devices. Here is my sample code.
var User = $("#txtUsername").val();
var Psw = $("#txtPwd").val();
var soapMessage = '<?xml version="1.0" encoding="utf-8"?>'
                    + '<SOAP-ENV:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"><SOAP-ENV:Body><ns0:UserLogin SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns0="urn:LoginSrvcVi"><userId xsi:type="xsd:string">'+User+'</userId><password xsi:type="xsd:string">'+Psw+'</password></ns0:UserLogin></SOAP-ENV:Body></SOAP-ENV:Envelope>';

$.ajax({
        url : myLoginUrl,
        type : "POST",
        username : User,
        password : Psw,
        dataType : "xml",
        data : soapMessage,
        contentType : "text/xml; charset=\"utf-8\"",

        success : function(data, textStatus, jqXHR) {
            debugger;
            $.mobile.loading('hide');
            console.log("data" + data);
            var x2js = new X2JS();
            var test = x2js.xml2json(data);
            debugger;
            if (test.Envelope.Body.searchUserLoginResponse.Response.messages.item != "Data Retrived Successfully")
            {
                alert("Success");
            }
        },

        error : function(jqxhr)
        {
            alert("Error");
        }

    });

Note : I tried the SOAP url to run in safari but it shows only a blank screen and no data. The chrome on android displays the XML structure.
Need Help.
Thanks

A: Try wrapping all of your code inside the 'document.ready' event callback like this:
$(document).ready(function () {
   // Your code here
});

A: If your request is working correctly on Android and Desktop browsers, but not on iOS then it sounds like there may be a bug in your app's iOS configuration for CORS. Given that you mentioned that you get an "unauthoerized error" when you try to make the call with async: false, it looks like your Domain Whitelist Configuration might be the source of the issue.
Make sure that you have added the domain to your whitelist configuration in the AppName/config.xml file (for iOS) as well as in the res/xml/config.xml file (for Android). Be sure to check out the documentation for more on how to add the proper configurations. As mentioned in this post, the config.xml file that you need to modify for iOS is the one in the project folder (AppName, in the above, refers to the project folder).
As you will see in the documentation, there are many different configurations that you can use to whitelist your domains, and some are more secure (by being more specific) than others. The following configuration can be used to grant access to all domains, but is very unspecific and thus less secure:
<access origin="*" />

Once you have ensured that your iOS whitelist configuration is up to date, set async: false and try the request again.


text:
Q: AnyLogic: ArrayIndexOutOfBoundsException when trying to move an agent to a point I'm trying to move an agent using "moveTo"-function to a defined Point on a GIS-map. It works for a couple of Points and then all of a sudden the attached error occurs. Does it mean that the Point is not defined or that AnyLogic can't find a route using the OnlineRouteProvider or does it mean something else?
Ausnahme während der Ausführung eines diskreten Ereignisses:
739
java.lang.ArrayIndexOutOfBoundsException: 739
    at com.anylogic.engine.gis.AnyLogicOnlineRouteProvider.i(Unknown Source)
    at com.anylogic.engine.gis.AbstractGISRouteProvider.getPathData(Unknown Source)
    at com.anylogic.engine.gis.IGISRouteProvider.getPathData(Unknown Source)
    at com.anylogic.engine.gis.AbstractGISRouteProvider.getPathData(Unknown Source)
    at com.anylogic.engine.g.i(Unknown Source)
    at com.anylogic.engine.g.i(Unknown Source)
    at com.anylogic.engine.dh.i(Unknown Source)
    at com.anylogic.engine.dh.moveToInTime(Unknown Source)
    at com.anylogic.engine.dh.moveTo(Unknown Source)
    at com.anylogic.engine.Agent.moveTo(Unknown Source)
    at crowdsouring.Truck.enterState(Truck.java:696)
    at crowdsouring.Truck.executeActionOf(Truck.java:794)
    at com.anylogic.engine.TransitionTimeout.execute(Unknown Source)
    at com.anylogic.engine.Engine.n(Unknown Source)
    at com.anylogic.engine.Engine.u(Unknown Source)
    at com.anylogic.engine.Engine.i(Unknown Source)
    at com.anylogic.engine.Engine$i.run(Unknown Source)

A: It means that the point isn't there, even though that anylogic think it is.
If you have an array of size 4 and try to get something at the 13th place, you'll get this error.
But why this happens depends on the code that initialize the array and the code that determines the possible destination. Do you do it your self or is it an anylogic object that handles it?


text:
Q: Configure Windows Update group policy in the registry in Windows 10.2004 In previous versions of Windows 10 Pro, I could configure the Windows Update through group policies and also their corresponding registry values. Here's the entry description.
With Windows 10.2004, this doesn't match anymore. While the Windows Update (ask before installation) seemed to be applied from the registry key, the restart setting (no automatic restart) did not. Also, none of them were displayed in the group policy editor, everything was displayed as "unconfigured".
When I did configure these settings in the GP editor, the expected registry keys showed up. But they seem to be ignored then. After deleting those values and restarting the computer, the policy was still displayed as "configured" in the GP editor.
I have the impression that Windows 10.2004 broke something there. Registry values and group policy settings no longer match or synchronise.
What is the official method to install group policies automatically (with a single installable file, like .reg) in Windows 10.2004?
I'm especially interested in the settings for

*

*automatic updates: download automatically but ask before installation

*restart: never restart the computer automatically

Background: The installation of updates easily interferes with foreground realtime activities like video calls or screen recordings. And the computer is secured with BitLocker and requires a PIN to boot. Unattended restarts leave the computer turned off and unusable until I'm back in the office.


text:
Q: Query to insert values in a column, according to the value of another column I have a table with a empty column, and I want to insert values in this column according to the value of another column, something like that:
INSERT INTO table_name(color)
VALUE('blue')
WHERE number = 1
VALUE('red')
WHERE number = 2
VALUE('green')
WHERE number = 3

I know this query not work, it's just to exemplify what I want :)

A: You need an UPDATE, not an INSERT
See example

CREATE tABLE table_name (`number` int , color varchar(10))

INSERT INTO table_name(`number`)
VALUES(1),(2),(3);

SELEcT
* FROM table_name

number | color
-----: | :----
     1 | null
     2 | null
     3 | null

UPDATE table_name
SET color = case
when number = 1 then 'blue' when number = 2 then 'red'
when number = 3 then 'green' else color end

SELEcT
* FROM table_name

number | color
-----: | :----
     1 | blue
     2 | red
     3 | green

db<>fiddle here


text:
Q: .scroll-pane как сделать чтобы после reinitialise не достигал верха без unbind $( document ).ready(function(){

    var settings = {
        showArrows: true
    };

    var api = $(".scroll-pane").jScrollPane(settings).data('jsp');

    $(".scroll-pane").bind('jsp-scroll-y',function(event, scrollPositionY, isAtTop, isAtBottom){

        if(isAtTop) {
            $("#status").prepend("isAtTop"); // как заставить не срабытывать этот блог после reinitialise но без отмены события unbind //
        }

    });

    var count = 0;
    var interval = setInterval(function(){

        //api.getContentPane().prepend('
This is paragraph number '+i++'
');
        api.getContentPane().append("
1
");

        $(".scroll-pane").unbind('jsp-scroll-y');

        api.reinitialise({autoReinitialise: false , maintainPosition: true, stickToBottom : true});
        api.scrollToBottom(true);

        $(".scroll-pane").bind('jsp-scroll-y',function(event, scrollPositionY, isAtTop, isAtBottom) {
            if(isAtTop) {
                $("#status").prepend("isAtTop");
            }
        });
        count++;
        if(count==4)clearInterval(interval);
    },1000);
});


text:
Q: Selecting first row for group using select by expression How would/could I use the select by expression tool to select only the first row for each origin_id group?  The rows with a yellow border are the ones I want selected.

A: You can use:
array_first(array_agg($id,"origin_id",order_by:=$id)) = $id

You did not specify the sorting of your table so I assume you use the default order by feature id ($id). If you use another sorting, change the order_by:= part to a field you wish to sort by. For example to sort by destination_id:
array_first(array_agg($id,"origin_id",order_by:="destination_id")) = $id


text:
Q: Online output for dictionary with key within values How to generate the following output for this dictionary?
Dict:
dictBase = {'Name1': {'tbl_1' : 'item1', 'tbl_2' : 'item2'},
            'Name2': {'tbl_1' : 'item1', 'tbl_2' : 'item2'}}

Print:
Name1, tbl_1, item1, tbl_2, item2
Name2, tbl_1, item1, tbl_2, item2

A: This can be done using str.join and a loop:
for k, v in dictBase.items():
    print(k, *map(', '.join, v.items()), sep=', ')

This does rely on the fact that the items are strings.

A: for key in dictBase:
  output_line = key
  for subkey in dictBase[key] :
    output_line += ", " + subkey + ", " + dictBase[key][subkey]
  print (output_line + "/n")

If you want to store the whole output in a single variable, as you mention
above, simply do sth like
final_output = "";

for key in dictBase:
  output_line = key
  for subkey in dictBase[key] :
    output_line += ", " + subkey + ", " + dictBase[key][subkey]
  final_output += output_line + "/n"

print(final_output)


text:
Q: Finding lags of time series with `Do` I have generated two time series, S[t] and P[t] as follows:
In[2990]:= Table[S[t], {t, 1, 50}]

Out[2990]= {0.5, 0.5, 2.253, 2.7614, 2.87762, 4.05318, 5.03183, 5.42801, 6.32663,
7.43033, 8.14412, 8.98434, 10.0983, 11.0536, 11.9744, 13.0988, 14.2194, 15.2811,
16.4588, 17.7028, 18.9201, 20.1964, 21.5544, 22.9261, 24.3338, 25.8165, 27.3415,
28.9023, 30.5282, 32.2123, 33.9413, 35.7309, 37.5859, 39.4971, 41.4699, 43.5124,
45.6209, 47.7963, 50.0454, 52.3689, 54.7668, 57.2436, 59.8024, 62.4438, 65.1712,
67.988, 70.8963, 73.8987, 76.9988, 80.1996}

In[3057]:= Table[P[t], {t, 1, 50}]

Out[3057]= {0.75, 0.75, 0.75, 0.75, 2.22, 2.26635, 2.31409, 4.72832, 5.47929, 5.71359,
7.38173, 8.77145, 9.38649, 10.687, 12.2584, 13.3072, 14.5348, 16.1313, 17.5145,
18.8577, 20.4782, 22.0947, 23.6365, 25.3391, 27.1332, 28.8952, 30.7413, 32.7011,
34.6829, 36.7181, 38.8585, 41.0603, 43.3149, 45.6623, 48.0927, 50.5888, 53.1718,
55.8482, 58.6059, 61.4525, 64.3987, 67.44, 70.5779, 73.8214, 77.1718, 80.6293,
84.2004, 87.8892, 91.6969, 95.6281}

Now, these two time series are related to each other by a lag, L[t]. Thus, S[t]==P[t-L[t]]. Time series of L[t] is not known and I have to find it from given S[t] and P[t].
My code for this is:
Do[{Do[If[S[t] > P[i], k = i], {i, 1, t}],Print[t-k]},{t,5,50}]

The list of numbers printed out, i.e. t-k, is exactly what I expected. So I would like to define L[t_] := t - k. But if I substitute this for Print[t-k] in the code and Print the resulting list of numbers, I get a different result. Is there any way to define this function?

A: If you insist on using the Do construct, simply:
ClearAll[l]

(* cover undefined values *)
l[_] = Infinity

Do[{Do[If[S[t] > P[i], k = i], {i, 1, t}], l[t] = t - k}, {t, 5, 50}]

l /@ Range[5,50]

(* {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5} *)

Note I used lowercase l - it is a seriously bad idea to use uppercase initials, you risk name-clash.

A: This piece,
Do[If[S[t] > P[i], k[t_] := i], {i, 1, t}]

does not have a bound on the iterator. Mathematica does not know what t is.
How about define $k$ dynamically?
k[t_] := k[t]=Module[{i=1}, While[S[t] <= P[i],i++]; i];

Is this what you intend?


text:
Q: change the color of check icon in select dropdown ant design In react project I have a select component (from antd) that can selects multiple options
I am trying to find a way that allows me to override the color of select field shadow (after displaying the dropdown) and the check icon next to checked options as indicated in the attached screenshot:
I tried to override some ant classes like .ant-select-item-option-content and .ant-select-selection-overflow-item .ant-select-selection-overflow-item-suffix but no affect happened
and idea or solution would be Appreciated, Thank you


text:
Q: Apache pig script, Error 1070: Java UDF could not resolve import I am trying to write a Java UDF with the end goal of extending/overriding the load method of PigStorage to support entries that take multiple lines.
My pig script is as follows:
REGISTER udf.jar;
register 'userdef.py' using jython as parser;
A = LOAD 'test_data' USING PigStorage() AS row:chararray;
C = FOREACH A GENERATE myTOKENIZE.test();
DUMP D;

udf.jar looks like:
udf/myTOKENIZE.class

myTOKENIZE.java imports org.apache.pig.* ande extends EvalFunc. the test method just returns a Hello world String.
The problem that I am having is that when I try to call the method test() of class myTOKENIZE I get Error 1070:  ERROR 1070: Could not resolve myTOKENIZE.test using imports: [, java.lang., org.apache.pig.builtin., org.apache.pig.impl.builtin.] Thoughts?

A: As your UDF extends EvalFunc there should me a method called exec() in the class myTOKENIZE.
Your pig code would then look as follows:
C = FOREACH A GENERATE udf.myTOKENIZE(*);

Please read http://pig.apache.org/docs/r0.7.0/udf.html#How+to+Write+a+Simple+Eval+Function
Hope that helps.

A: So is myTOKENIZE in the package udf? In that case you'd need
C = FOREACH A GENERATE udf.myTOKENIZE.test();

A: After waaaaay too much time (and coffee) and a bunch a trial and error, I figured out my issue.
Important note: For some jar myudfs.jar, the classes contained within must have package defined as myudfs.
The corrected code is as follows:
REGISTER myudfs.jar;
register 'userdef.py' using jython as parser;
A = LOAD 'test_data' USING PigStorage() AS row:chararray;
C = FOREACH A GENERATE myudfs.myTOKENIZE('');
DUMP C;

myTOKENIZE.java:
package myudfs;
import java.io.IOException;
import org.apache.pig.EvalFunc;
import org.apache.pig.data.Tuple;
import org.apache.pig.impl.util.WrappedIOException;
public class myTOKENIZE extends EvalFunc (String)
{
    public String exec(Tuple input) throws IOException {
        if (input == null || input.size() == 0)
            return null;
        try{
            String str = (String)input.get(0);
            return str.toUpperCase();
        }catch(Exception e){
            throw WrappedIOException.wrap("Caught exception processing input row ", e);
        }
    }
}

the structure of myudfs.jar:
myudfs/myTOKENIZE.class

Hopefully this proves useful to someone else with similar issues!

A: This is very late but I think the solution is that while  using the udf in your pig you have to give fully qualified path of the class with your package name.
package com.evalfunc.udf; and Power is my class name as
public class Power extends EvalFunc<Integer> {....}
Then while using it in pig first register the jar file in pig and then use the udf with full package name like:
record = LOAD '/user/fsbappdev/maitytest/pig/pigudf/power_data' USING PigStorage(',');
pow_result = foreach record generate com.evalfunc.udf.Power(base,exponent);


text:
Q: Where is Minecraft Bedrock Edition folder? Having the same problem as many others seem to be having on here, but I'm stuck at a point at which everyone else seems to find what they are looking for.
Trying to install forge for Minecraft but as every guide says I've to make copies of all the game files which I'm trying to do but there is no Minecraft folder when I go looking. I've tried the %appdata% search and it returns nothing.
I had a thought, is it because my kids who play Minecraft don't play online, as they don't have an Xbox live account to sign-in to create saves from? Are they effectively playing as "guests"? If so, is the only way to fix this to get them Xbox live subscriptions? Its the Windows 10 edition (aka Bedrock edition) we have, is it better to try and use the Java Edition?

A: On Windows to find Minecraft folder press Win+R to open "Run" and there type %appdata% and there should be .minecraft folder.

I had a thought, is it because my kids who play Minecraft don't play online, as they don't have an Xbox live account to sign in to create saves from? Are they effectively playing as "guests"? If so, is the only way to fix this is to get them Xbox live subscriptions?

This is not applicable to Minecraft PC (aka Java Edition), because Minecraft PC doesn't have any Xbox integration, you maybe are referring to Minecraft Windows 10 Edition (aka Bedrock Edition) - (if it is so please edit question acordingly).

A: If you cannot run run command, then go into your main drive C:/, then you have to go into Users then into Your name, then into Appdata and Roaming, there is a .minecraft folder (so C:/Users/<Name>/AppData/Roaming/.minecraft).
BUT! if there is no mod folder, well, you have to create one. You create a folder named mods. Then if you download a mod you have to make sure that your Forge version is the same as the mod, then when installed you move the Mod into your mods folder, run Minecraft in the Forge version _____, let it load and there you go!
Here is one mostly asked question:

*

*The mod cannot be run but the version is the same!

*

*If you have a 1.12.2 Forge and a 1.10 Mod in the mods folder, Minecraft Forge tries to run BOTH of them, you might keep them in a special folder (the other mods) when you need it, they are there!

If you have more question, just ask me.


text:
Q: jQuery UI tabs load event sometimes seems to fire too early This is a weird one. I have a set of jQuery UI tabs, which are loaded via AJAX. The load event, which is supposed to fire once the content of the tab is loaded and ready, sometimes fires after the height of the content is calculated and sometimes before.
Here's the situation: the first tab contains two .resizable() divs - there's a center line that you can drag left or right to make one or the other panel larger. The only way that I could get them to work was to position them absolutely.
The problem is that, because they're positioned absolutely, the containing div can't automatically adjust to their height. To make them fit inside, I have to first find their height (the content is dynamic, so the height could change), then tell the containing div to be 70 pixels taller than that height. It's a simple function:
function setTabHeight() {
    // The problem is only with Tab1, because of the absolute positioning. Any other tab, height can be set automatically.
    if ($("#tabs").tabs('option', 'active') != 0) { $("#tabs").height('auto'); return false; }
    // Tab1 contains two side-by-side divs, which we'll call "east" and "west".
    // This figures out which is taller and makes the containing div taller than that.
    var westDiv = $("#westDiv").height();
    var eastDiv = $("#eastDiv").height();
    if (westDiv > eastDiv) { $("#tabs").height(westDiv + 70); }
    else { $("#tabs").height(eastDiv + 70);
}

I call that function like so:
$(#tabs).tabs({
    load: function (e, ui) {
        [a bunch of other code, mostly the call to .resizable()]
        setTabHeight();
    }
});

Except that sometimes it works and sometimes it doesn't. I can sit there reloading the exact same information and sometimes it'll adjust the containing div and sometimes it won't. I put console.log($('#westDiv').height()) at the end of my load function, and again, sometimes it knows the height of the div, sometimes it thinks its height is zero.
The only conclusion I can come to is that the load event for jQuery UI tabs fires just a bit faster than the height of the div inside can be calculated. I can make it work by using setTimeout(setTabHeight, 10), but that seems pretty spectacularly kludgy, and I'm worried that a user on a slower computer might still have trouble if my arbitrary number of ten milliseconds turns out to be wrong.
Any thoughts for a more general solution - specifically, a way to fire the function only after the height of the elements has been calculated?

A: I think you could solve this using jQuery.Deferred.
Something like this:
function getDivHeight(strDivId) {
    var def = $.Deferred(), $div = $("#" + strDivId);

    setInterval(function () {
        var intDivHeight = $div.height();

        if (intDivHeight > 0) {
            def.resolve(intDivHeight);
        }
    }, 40);

    return def.promise();
}

$.when(getDivHeight("westDiv")).then(function (divHeight) {
    // Do something with the westDiv's height here.
});

It's not much and you need some extra logic to make it work for your specific situation but I think this might be the right direction for you to make a working solution.


text:
Q: How to apply a predefined CSS class in PHP I would like to apply a CSS class to my output that is defined in a .css file. In the test snippet below I'm using the class, but it is not applied. Do I need to reference the file in some way or how do I apply it?
function dyc_product_archive_description(){
    if ( is_product_category( 'mycategory' ) ) {

        echo '
' . 'mycategory' .'
';
    }
}

A: There are several problems you may have:
This is a function
Since the code you have shown here is a function, you will need to make sure that you see what you think you see. Is this function called at all? Do some action, like writing a line in the logs as the first action of the function and see whether that's created.
If the function is not called, then the class is not applied by it.
We have a conditional
Now, if the function has been executed in the previous check, then move the behavior inside the conditional and see whether it is still happening. If not, then research your condition to find out whether it's correct. If it's incorrect, fix it. If your data is incorrect, fix it.
The class is added to the tag
Check the page-source of your browser. If the tag has the class, then the class is applied, but its styling is not. If the tag does not has the class, then either it is not generated by this function, or the class might have been removed by some Javascript. Check other instances of this tag's creation and see whether you were looking at the wrong place, see whether the class is inside the tag at all. If the tag is not inside the tag, then fix your code so that the class will be inside the tag. If it's already inside the tag, then see the next step.
Make sure that your CSS is applied
You have a styling, possibly in another file. Test that styling in the browser, by adding it to the class you have using the Dev Tools. If the styling is applied then, then check the inactive styles on your tag. If among the inactive styles you find the one which you intended, then you have a CSS priority issue. If not, then the styling you have is never loaded, in which case you need to load it.

A: Just realized this was much easier than I thought by just adding:
echo '<link rel="StyleSheet" href="https://example.com/csspath?ver=1.0.20" media="all" />';