text:
Q: Why is passport.deserializeUser called after req.user has been restored? According to the Passport Documentation on Sessions

...only the user ID is serialized to the session, keeping the amount
of data stored within the session small. When subsequent requests are
received, this ID is used to find the user, which will be restored to
req.user.

However my test SPA which is based on Passport form-based authentication sample with debug messages added indicates req.user has already been restored before the app.get route handler is triggered.
Here is the output from an HTTP POST where the username and passport fields are empty -
[nodemon] starting `node app.js`
agenda-spa app listening at http://localhost:3000
handling request for:  / POST
handling request for:  / GET
xxx get root
xxx req.user  undefined
handling request for:  /style.css GET

req.user is undefined as expected
Here is the output from an HTTP POST with an authenticated username and password
handling request for:  / POST
xxx passport.use  sss
xxx findByUsername sss
xxx password match
xxx serializeUser { id: 1, username: 'sss', password: 'sss' }
xxx auth success
xxx deserializeUser 1
xxx findById 1
handling request for:  / GET
xxx get root
xxx req.user  { id: 1, username: 'sss', password: 'sss' }
xxx deserializeUser 1
xxx findById 1
handling request for:  /style.css GET

I would expect it to be -
...
xxx deserializeUser 1
xxx findById 1
xxx req.user  { id: 1, username: 'sss', password: 'sss' }
...

Why is passport.deserializeUser called after req.user has been restored?

A: First, in my case I get:
xxx passport.use  sss
xxx findByUsername sss
xxx password match
xxx serializeUser { id: 1, username: 'sss', password: 'sss' }
xxx auth success
xxx deserializeUser 1
xxx findById 1
handling request for:  / GET
xxx get root
xxx req.user  { id: 1, username: 'sss', password: 'sss' }

To reproduce the issue I run the following script:
#!/usr/bin/env bash
set -eu
rm cookies.txt || true
args=(
-sSv -b cookies.txt -c cookies.txt
)
curl "${args[@]}" -d 'username=sss&password=sss' localhost:3000
curl "${args[@]}" localhost:3000

Let's add some debugging information to understand where requests start:
$ DEBUG=* node app.js
...
  express:router dispatching POST / +10s
  express:router session  : / +1ms
  express-session no SID sent, generating session +1ms
  express:router initialize  : / +3ms
  express:router authenticate  : / +1ms
  express:router <anonymous>  : / +0ms
handling request for:  / POST
xxx passport.use  sss
xxx findByUsername sss
xxx password match
xxx serializeUser { id: 1, username: 'sss', password: 'sss' }
xxx auth success
  express-session saving y4TUFn7tzccSARC7kHiDbuKY8qXj1sCU +13ms
  express-session split response +1ms
  express-session set-cookie connect.sid=s%3Ay4TUFn7tzccSARC7kHiDbuKY8qXj1sCU.yxt3TbHx4HSzm03JMrtPcTPrm3K40FbHiuS6NGT%2Fd7E; Path=/; HttpOnly +3ms
...
  express:router dispatching GET / +14ms
  body-parser:urlencoded skip empty body +0ms
  express:router session  : / +0ms
  express-session fetching y4TUFn7tzccSARC7kHiDbuKY8qXj1sCU +1ms
  express-session session found +1ms
  express:router initialize  : / +1ms
  express:router authenticate  : / +0ms
xxx deserializeUser 1
xxx findById 1
  express:router <anonymous>  : / +1ms
handling request for:  / GET
xxx get root
xxx req.user  { id: 1, username: 'sss', password: 'sss' }
...

As such what is output for the second request in your case is:
xxx deserializeUser 1
xxx findById 1
handling request for:  / GET
xxx get root
xxx req.user  { id: 1, username: 'sss', password: 'sss' }
xxx deserializeUser 1
xxx findById 1

So it's as you expected, but for some reason the session strategy is triggered twice. That I can't reproduce.


text:
Q: Workflow activity status logging I am new to Work Flows. I have created a small workflow. and put a few custom activities in it.
Now i would like to log the status of this activities as and when they complete and what where its input and output parameters.
Similar to one which we see in TFS Build.

A: You can define a TrackingParticipant as an extension to add for a WorkflowApplication.

Custom Tracking Participant

using System.Activities.Tracking;

public class MyTrackingParticipant : TrackingParticipant
{
    protected override void Track(TrackingRecord record, TimeSpan timeout)
    {
        if (record is WorkflowInstanceRecord)
        {
            var wfInstanceRecord = record as WorkflowInstanceRecord;
            Console.WriteLine($"My workflow's current state: {wfInstanceRecord.State}");
        }

        if (record is ActivityStateRecord)
        {
            var activityStateRecord = record as ActivityStateRecord;
            Console.WriteLine($"Activity: {activityStateRecord.Activity.Name} State: {activityStateRecord.State} Timestamp: {activityStateRecord.EventTime}");
        }
    }
}

Register the Custom Tracking Participant

var wfApp = new WorkflowApplication(myActivity);
wfApp.Extensions.Add(new MyTrackingParticipant());
wfApp.Run();

redpajama_set_name: RedPajamaStackExchange


text:
Q: OPC connection establishment I am a newbie. I have searched various forums for opc application. It seem they are using US SDKs to create opc client and server application. I have gone through Unified automation SDK and i am sucessful to connect, read and write. But i need to create my own opc application. I wanted to know how to connect opc server and client without using any external SDKs or application. In my first step i want to know the communication packet required to establish the connection in between server and client. I have tried wireshark to see the communication packet but i couldnot figure them out.
I want to make a simple program in c++ to establish connection in between opc client and server and preferrably a opc UA.
I also think that i am doing it wrong way to make opc application. What can be the right step to start working to develop opc client and opc server.
Could you please help me. I have been stuck in this problem for a long time.
Regards,
Sika

A: Starting developping an OPC UA Client/Server has few possibilities :
First is to use one of the Stack provided by OPC Foundation (.NET, Java or C/C++). The 1.02 has just been released this month. Then you will maybe need to port on your platform depending of the language you want to use. The Stack is only the communication part, you will be required to code everything on it (like SessionManager, SubscriptionsManager,...) to send your data through it. You need to be OPC Foundation member ($) to download it.
The second is to try or buy a SDK from a third party : Prosys, Unified Automation, Softing,... You could find them easily on search engine. They give you a nearly ready to go Client/Server interface where you only have to connect with your data. It could cost you a lot of money but save you some time.
The third is to join one of the open source project such as Open OPC UA giving you the possibility to develop your own OPC UA Client/Server with an OpenSource code base.
BTW there is no more forum on the OPC Foundation website. I recommend you to use this website since it starts to have some OPC topics

A: OPC UA communication packet details can be found in Part 6 of the spec. BTW, specs now are available for registered users too (not paying members).
And SDKs are available under GPL license on GitHub.


text:
Q: How does Overdrive impact Affinity Chart of Blade? In Xenoblade Chronicles 2, there is the possibility to transfer non-plot Blade between Drivers. It is called Overdrive. Yet, I'm not sure how it works.
Most abilities of Blade are determined by the Affinity Chart. First Driver has to unlock tier of abilities by increasing Trust with Blade, then perform a specific action to unlock ability from tier. More of that, each ability has impact on Driver's mindset, by increasing a certain stat, e.g. Bravery or Compassion.
That's where numerous questions appear. I suppose, it would make sense, if trust between Blade and new Driver will be Rank E, but what about unlocked skills? If new Driver unlocks new set of skills, does he need to unlock each skill again, by performing same actions, or are skills becoming unlocked, if were unlocked by previous Driver? And what about mindset? Does mindset of previous Driver update? And last question - if Driver transfers Blade back to its previous owner, does Trust become Rank E, or keeps Trust Driver and Blade had before transferring?

A: It does not affect it at all.
You can overdrive a blade and the level goes unchanged. The same happens if you release and find a rare blade again.
Another reason this is validated:

 When Rex gets the ability to control all blades, he can also raise their affinity.


text:
Q: How to do incremental backups with AWS? I'm been reading the documentation about using services Amazon Glacier and AWS S3 for the purpose to use them as nightly backups. Unless I've missed it, how are incremental backups accomplished?
I want to backup nightly 100 GB of data, which is about 70k files, from our Linux file server to be stored for off-site backup. But there is an issue about deleting files, so it doesn't sound like you can updated them.
Is there another easier method for this? What about using rsync to do the backups to AWS EC2, and then have the data transferred from EC2 to Amazon Glacier for storage or to AWS S3? Because the idea of sending out a new 100 GB compressed tar file each night isn't practical.

A: There's plenty of ways of doing backups, here's a few thoughts and options.
Incremental Backups
Ideally your backups should be incremental. This means you can roll back to previous versions if you need to. It can also significantly reduce CPU, bandwidth usage, and sometimes storage. You can also look at differential backups, which are slightly different, in that they're a delta to the last full backup.
On-Premise backups to AWS
The AWS Storage Gateway virtual appliance could be useful for you. Install the VM, allocate some disk. There are a few modes and they changed the names not so long ago, but in essence it works like a local disk that's backed up to S3. It can keep all your data on premise, or use the on-premise disk as a cache to S3.
Otherwise there are plenty of other options to get data into AWS.
AWS S3 Sync
I use the "aws s3 sync" command line utility to upload data to AWS S3, using the IA storage class. This keeps the backups safe on AWS S3. You can upload the files you want backed up direct to S3, you can upload the repository of a backup program that's stored locally, or your backup software may use S3 natively. Using the command line here's what you do.
aws s3 sync /path/to/backups s3://bucketname/backups --storage-class STANDARD_IA --delete --exclude ".sync/*"

You can turn on encryption and versioning within S3. It keeps each version of the file separately, it's not incremental, so it can use a more storage than incremental backup software that also does compression.
Destination
S3 is a good place for backups. If your backups are fairly static you can use S3 Infrequent Access class storage, which is cheaper than standard storage class. You can use the S3 Glacier storage class if your backups are immutable (never change), but remember it takes hours to get those backups back.
Dropbox is a reasonable place for backups. I've used the Dropbox Uploader script. It's not as flexible though - it doesn't delete files that have been removed locally, wasting disk space. This is how you use it.
/opt/Dropbox-Uploader/dropbox_uploader.sh -s -q upload /path/to/files /dropbox/path

**Borg Backup (no longer using) **
I backup my Linux server (which happens to be on AWS) using Borg Backup. This creates an incremental, de-duplicated backup on a local disk. It has retention policies which tell it how long to save data - eg every night for a week, once a week for a month, monthly for a year. There are plenty of incremental backup programs you can use.
One thing I don't love about Borg Backup is each time it runs it renames existing files. I think this behaviour changes for really large backups, but my 500MB backup definitely renames the file each night. You end up with hundreds of tiny files and one new / renamed file each day that's large. Because of that, if your backups are remote you'll probably use a lot more bandwidth that you'd expect. I stopped using Borg because of this.
Borg also supports remote repositories natively, accessed via SSH. You could have have an EC2 instance with an EBS disk come up, sync to it, then the instance go down - but EBS is a lot more expensive than S3 so it's not a great option.
**Restic Backup (now using for PC / web server backups) **
I've been using Restic Backup for a couple of years now. It aims to be easy, fast, verifiable, secure, efficient, and free. It works on most platforms (*nix, Windows, etc), and it's compiled to a single binary so installation is easy.
It's block based and efficient with disk / network. I've done multiple restore tests and it's always restored everything perfectly. I'm happy with restic. It's under slow but steady development, things like compression will be added in future - it does de-duplication but not compression as at August 2020.
Initialise the repository
set RESTIC_PASSWORD=abcdefg
restic_0.9.1_windows_amd64.exe init --repo x:\repository

set RESTIC_PASSWORD=abcdefg
restic_0.9.1_windows_amd64.exe --exclude c:\data\exclude --repo c:\data backup x:\repository

You can have Restic keep backups for configurable amounts of time - for example keep daily backups, then weekly backups for 8 weeks, monthly for 24 months.
restic_0.9.1_windows_amd64.exe  --repo x:\repository forget --keep-daily 7 --keep-weekly 8 --keep-monthly 24
restic_0.9.1_windows_amd64.exe  --repo x:\repository prune

If you want Restic to backup to S3 you just define your keys and do a backup like this. One thing to consider here is Restic may read the data from S3, even though it has a local cache, so IA class might end up more expensive than standard in some cases - though I suspect those would be rare cases.
Here's the basic setup of Restic:
REM setup S3 (once)
set AWS_ACCESS_KEY_ID=ABCDEFGHIJK
set AWS_SECRET_ACCESS_KEY=XXXXXXXXXXXXXXXXXXXXXXXXXX/AAA
set RESTIC_PASSWORD=abcdefg
restic_0.9.1_windows_amd64.exe --repo s3:s3.amazonaws.com/s3-bucket-name init

This is how you do the backup
REM backup
restic_0.9.1_windows_amd64.exe --repo s3:s3.amazonaws.com/s3-bucket-name backup c:\data

A: Use Amazon Glacier if you need only store the archives. And Glacier is more cheaper than S3.


text:
Q: Sum seems to double/triple count when left joining two tables I am trying to join two tables (inventory and sales) on an identification number, and sum the quantity of the goods in inventory, the inventory value, and the sales value/volume. This is grouped by part number.
Here's what I'm doing:
`select inv.[num]
, sum(inv.[Value]) as [Inventory Value]
, sum(inv.[qty]) as [Inventory Qty]
, sum(sales.[Value]) as [Sales Value]
, sum(sales.[qty]) as [Sales qty]
from Inv
left join sales
on inv.[num]=sales.[num]
group by inv.[num]`

The inventory value summation is about 50x too big, sales about 3 or 4 times too big.
How can I keep from over summing?

A: When using group by with joins that are many-to-one or many-to-many, you should first aggregate the measures and join on the dimensions.
select
    inv_agg.inv_num as 'Inventory Number'
    ,inv_agg.inv_value as 'Inventory Value'
    ,inv_agg.inv_qty as 'Inventory Qty'
    ,sales_agg.sales_value as 'Sales Value'
    ,sales_agg.sales_qty as 'Sales Qty'
from (select
        inv.num as inv_num
        ,sum(inv.Value) as inv_value
        ,sum(inv.qty) as inv_qty
    from inv
    group by inv.num) inv_agg
left join (select
        sales.num sales_num
        ,sum(sales.Value) as sales_value
        ,sum(sales.qty) as sales_qty
    from sales
    group by sales.num) sales_agg
on inv_agg.inv_num = sales_agg.sales_num

Or, with CTE's
with inv_agg as (select
        inv.num as inv_num
        ,sum(inv.Value) as inv_value
        ,sum(inv.qty) as inv_qty
    from inv
    group by inv.num),
sales_agg as (select
        sales.num sales_num
        ,sum(sales.Value) as sales_value
        ,sum(sales.qty) as sales_qty
    from sales
    group by sales.num)
select
    inv_agg.inv_num as 'Inventory Number'
    ,inv_agg.inv_value as 'Inventory Value'
    ,inv_agg.inv_qty as 'Inventory Qty'
    ,sales_agg.sales_value as 'Sales Value'
    ,sales_agg.sales_qty as 'Sales Qty'
from inv_agg left join sales_agg
    on inv_agg.inv_num = sales_agg.sales_num


text:
Q: laravel-doctrine lazy loading set up in mapping not taking effect I've checked other questions on here and can't find anything definite.
I am trying ot build an api endpoint using an existing database. The tables are massive, and the tables that they join to are equally massive.
I want to find an animal in the animal table with ID 111.
I have the mapping set up and a controller that calls it like this:
public function get($id)
{
    $animal = EntityManager::getRepository(Animal::class)->find(111);
    var_dump($animal);
    die();
}

For now I'm just var_dump'ing to confirm that the data I'm retrieving is accurate. My problem is that even though I've set up all the relationships to other tables to lazy load, it is still loading everything.
Example of lazy loading set up in the mapping:
/**
 * @var \Contact
 *
 * @ORM\ManyToOne(targetEntity="Contact", fetch="LAZY")
 * @ORM\JoinColumns({
 *   @ORM\JoinColumn(name="animaldata_billingcontact", referencedColumnName="contact_id")
 * })
 */

I want to just load the contact id, not the entire contact object, because this is slowing down my call significantly.


text:
Q: Переместить видео на право от текста <!DOCTYPE html>

    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="stylesheet" href="style/index.css">
    <title>Document</title>

HOME

PORTFOLIO

ABOUT US

CONTACT

our strong
 organaisation

Lorem ipsum dolor sit amet, consectetur adipis cing elit, sed do eiusmod tempor incididunt  ut labore et. ectetur adig ipis cing elit, sed do eiusmod tempor incididunt.

Contact Us

<video src="pomehi.mp4" controls width="360" height="240"><source type="video/mp4"></video>

body {
    background-color: #f6f6f6;
    width: 1050px;
    margin: 0 auto;
}

a {
    text-decoration: none;
}

.header {
    font-family: sans-serif, Arial;
    background-color: #313030;
}

.header ul {
    padding: 0;
    text-align: center;
}

.header ul li {
    padding-top: 30px;
    padding-bottom: 30px;
    padding-right: 25px;
    padding-left: 25px;
    list-style: none;
    display: inline-block;
}

.header ul li a {
    color: #e0e0e0;
}

.header ul li:hover {
    background-color: #ff3f40;
    transition: .4s;
}

.text_osn {
    max-width: 500px;
}

.text_osn p {
    font-size: 18px;
    margin-bottom: 30px;
}

.text_osn h1 {
    text-transform: uppercase;
    font-size: 60px;
    font-family: sans-serif;
    font-weight: 200;
    margin-bottom: 0;
}

.btn span {
    color: #fff;
    background-color: #ff3f40;
    border-radius: 5px;
    text-align: center;
    font-size: 24px;
    padding-bottom: 7px;
    padding-top: 7px;
    padding-right: 40px;
    padding-left: 40px;
}

.btn {
    max-width: 500px;
}

Нужно примерно так:

A: Обернуть текст и видео в контейнер и задать
display: flex;

Вот пример

   .wrapper{
            display: flex;
            justify-content: space-evenly;
        }
        .element{
            width: 49%;
            background-color: #736357;
            height: 300px;
        }
        h2{
            text-align: center;
        }

 Тут текст

Тут картинка

A:

body {
  background-color: #f6f6f6;
  width: 1050px;
  margin: 0 auto;
}

a {
  text-decoration: none;
}

.header {
  font-family: sans-serif, Arial;
  background-color: #313030;
}

.header ul {
  padding: 0;
  text-align: center;
}

.header ul li {
  padding-top: 30px;
  padding-bottom: 30px;
  padding-right: 25px;
  padding-left: 25px;
  list-style: none;
  display: inline-block;
}

.header ul li a {
  color: #e0e0e0;
}

.header ul li:hover {
  background-color: #ff3f40;
  transition: .4s;
}

.osn {
  position: relative;
  overflow: hidden;
  float: left;
}

.text_osn {
  max-width: 500px;
}

.text_osn p {
  font-size: 18px;
  margin-bottom: 30px;
}

.text_osn h1 {
  text-transform: uppercase;
  font-size: 60px;
  font-family: sans-serif;
  font-weight: 200;
  margin-bottom: 0;
}

.btn span {
  color: #fff;
  background-color: #ff3f40;
  border-radius: 5px;
  text-align: center;
  font-size: 24px;
  padding-bottom: 7px;
  padding-top: 7px;
  padding-right: 40px;
  padding-left: 40px;
}

.btn {
  max-width: 500px;
}

.vid {
  position: relative;
  overflow: hidden;
  float: right;
}
<!DOCTYPE html>

  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="stylesheet" href="style/index.css">
  <title>Document</title>

HOME

PORTFOLIO

ABOUT US

CONTACT

our strong
 organaisation

Lorem ipsum dolor sit amet, consectetur adipis cing elit, sed do eiusmod tempor incididunt ut labore et. ectetur adig ipis cing elit, sed do eiusmod tempor incididunt.

Contact Us

<video src="pomehi.mp4" controls width="360" height="240"><source type="video/mp4"></video>


text:
Q: Why my rich cards are shown in Structured Data section? I recently added Rich Cards to my shop project. But in Google Console they are in the "Structured Data" section. And my product Structured Data is getting doubled. And my "Rich Cards" section is empty too.

Should I remove structured data or both of them work well with each other?
Rich Cards code:

Structured data code:

    گوشی موبایل ال جی کا 10-کا430 دی اس  دوسیم کارت- 4G
        LG K10- K430DS Dual SIM - 4G Mobile Phone
...

A: Rich cards are currently only being used for Recipes and Movies at present: https://webmasters.googleblog.com/2016/05/introducing-rich-cards.html?m=1
It also looks like you are returning the exact same information in both bits of code - Product information. It's just one is in JSON-LD format and one is in embedded Microdata. So yes you are duplicating your own efforts here. Pick one format. Google is favouring JSON-LD at the moment (your top one) though doesn't yet accept every type of rich snipped in that format.


text:
Q: Puppet agent: provider git is not functional on this host I been trying to fix this for a couple of days but no succsses yet, hope you can help me out:
What I have to do is to daily clone specific branchs of the company's git repo to specific (windows) vm's on the server.
For learning  matters, right now im just trying to clone the master branch in a folder on my Desktop.
Two important observations:
1 - I know that git is installed on the puppet agent
2 - The repository  doesnt have passphrase and the private key (ssh) is well allocated on the windows agent.
Now the code i have:
vcsrepo{ "C:\{Name of the win agent user}\Desktop\folder":
    ensure => present,
    provider => git,
    source =>'git@scm.example.com.br:controle_versoes.git',
}

When I run windows agent I receive the following message:

Error: /Stage[main]/Main/Node[{nameoftheagent}]/Vcsrepo[C:\User{Name
  of the win agent user}\Desktop\folder]: Provider git is not
  functional on this host

Any idea what the problem is or how could i fix it?
Thank you a lot!
Gustavo B. Barbosa

A: The error ("Provider git is not functional on this host") generally means that Puppet is unable to find the git command.  If git is installed, that probably means that the command is not in a directory that is in your PATH environment variable.


text:
Q: Displaying embedded VF page in page layout I am displaying a VF page embedded in a page layout.  I am using $User.UIThemeDisplayed to display the content only in Classic, not in Lightning.  But when I view the page in Lightning, it still shows the empty space where the VF page would display, equal to the size of the Height I have setup for the VF page.  The question is, is there a way to do this so that the empty space is not displayed?

A: Based on all my experiences, I can say there's no way to hide it.
Anything on the page layout takes a "real estate" and is static in nature. It does not re-arrange dynamically if one or other component is not applicable.
Let's say if there are some fields on the page layout which are not supposedly visible to a particular profile, the fields won't be re-arranged and that empty spaces will fill in there. However, if there are fields in a particular section, and that the user doesn't have access to any of them, then the section is not displayed either.
In case of VF page in a section, because the dimensions are statically mentioned, depending if it has contents to be displayed or not, it still will be shown on the page. And if a User doesn't have access to that VF page, the section displays a message mentioning insufficient privileges.
So, ultimately it looks like you don't have an option of hiding/reducing the size of the section.


text:
Q: NSString stringWithFormat I don't know what I am missing here. I am trying to concatenate strings using [NSString stringWithFormat] function. This is what I am doing.
NSString *category = [row objectForKey:@"category"];
NSString *logonUser = [row objectForKey:@"username"];
user.text = [NSString stringWithFormat:@"In %@ by %@", category, logonUser];

The problem here is that it always print only one variable. Say if there is "Sports" in category and "Leo" in logonUser it will print "In Sports" and skip the remaining text. It should print "In Sports by Leo".

A: You need to try:
NSLog(@"In %@ by %@", category, logonUser);

To check the problem! Let me know the results on debugger console XD

A: Is user a UILabel? Make sure that your text isn't wrapping or being clipped. Try making the UILabel bigger.

A: The code looks correct:
By any chance are u getting a carriage return or extra white space in the category variable? In case of a small label, it may not display the full string. Try swapping the two variables in the third line and see what the output is.
I am baffled that even the "by" is missing from the output. I have a feeling that the value of the category variable is masking the text.

A: Whats the point for the first line in this code? It seems unrelated to the 3rd line?
Are you 100% sure that both category and logonUser are populated in the code? Perhaps put a NSLog statement right after the user.text = line and make sure they have the values you expect because your 3rd line looks fine.
Edit
I would try changing
user.text = [NSString stringWithFormat:@"In %@ by %@", category, logonUser];

to
user.text = [NSString stringWithFormat:@"In %@ by %@", @"category", @"logonUser"];

and see if that outputs In category by logonUser. Because it sure looks correct to me.


text:
Q: Finding and printing ranges between IP addresses with bash I have this ip addresses that are in use in a file:
192.168.1.121
192.168.1.141
192.168.1.172
192.168.1.180
192.168.1.180
192.168.1.181
192.168.1.182
192.168.1.185
192.168.1.190
What I want to do is to be able to print out the ranges between used IP addresses with Bash. So for example by looking at the example 192.168.1.121 is used but I want to be able to print out all IP addresses between 121 and 141. Similarly between 141 and 172. I am not worried about printing IP addresses before 121 though.
Is there a way to do this ?
Thanks
Kuti.

A: Yes.
addresses=( `< listofnums` )
network=${addresses[0]%.*}
hosts=( ${addresses[@]##*.} )

for (( i=${hosts[0]}; i<255; ++i ))
do
        case "${hosts[@]}" in *"$i"*) ;; *) echo "$network.$i" ;; esac
done


text:
Q: VueJS Use prop as data-attribute value I am really struggling with the following scenario:
Some index page:
<!doctype html>

    <meta charset="utf-8"/>

some existing option

        <example-component :foo="foo" :bar="bar"/>

      Click ME!

Some single file component:
<template>

{{ this.bar }}

</template>

And the app.js looks something like this:
import Vue from 'vue'

Vue.component('example-component', require('ExampleComponent.vue'));

const app = new Vue({
    el: '#app',

    props: [
      'foo',
      'bar'
    ],

    data: {
      foo: '',
      bar: ''
    },

     methods: {
      showDetail: function (foo, bar) {
        this.foo = foo,
        this.bar = bar
      }
  }
});

I am using babel with webpack under a laravel instalation.
The scenario is like this:

*

*When I click the Click ME! link, foo and bar are updated and passed to the component (This part is working)

*The computed property, named checkBool for this example becomes true, so I will then see the new list item (This part is working)

*New list item, has a link, with the text correctly set to bar (This part is also working)

At this point I know that the values setting and communication between component and parent is working properly, however data-tab-url="{{ this.foo }}" part is driving me crazy.
Instead of parsing the moustache syntax as expected and return data-tab-url="1", I get a parsed/escaped value of everything between quotes.
Something like data-tab-url="%7B%7B+this.foo+%7D%7D".
Now, how do I prevent the encode from happening?
From what I've read, there used to be a way in vuejs 1.*. Using three brackets: {{{ this.foo }}} but it's now deprecated in favor of v-html which I cannot use for my example.

A: Bind the attribute like this :data-tab-url="foo".
This will give the affected element a data-tab-url attribute with a value equal to the foo property of your component.

A: thanksd's answer is right but;
for further understanding:
You can't use mustache syntax for attribute binding. Use mustache {{}} only content of a dom element, ie.

{{someValue}}
 (THIS IS WRONG)

To bind any attribute, including template props any other attribute, such as "src" or "data-tab-url" like in question, you can use "v-bind:attr" or ":attr" shorthand, ie.

or

You can use any member(data, method, computed etc.) of your component or Vue app, without "this".

A: To render any component instance property (prop, data, computed ...) inside html you've to :

*

*Bind it to an attribute using v-bind: or the shorthand : like :foo="someFoo"

*Use it inside mustache syntax {{someFoo}}

*Use it as directive value v-show="isShown" or v-model="username", directives are always prefixed by v-
For the events, they are written like v-on:eventName or @eventName which could run an inline statement @click="count++" or a method @click="increment" knowing that increment is a function defined inside the methods options


text:
Q: Cannot change field type from text to date after field is used in concat - mysql In a table, I created a new field/column then set the column to populate as a concat of two other fields.  The two fields used in the concat are text fields.  I executed the concat just fine.  However, I need to convert one of the two text fields used in the concat to a date format (the field values are already populated as dates but in text format).  When I change the format of the field from text to date, it results in the column populating with all zeros in date format (00-00-0000).  Initially, I figured this was somehow being caused by the concat the field used to populate (even though theoretically it shouldn't), so I deleted the field/column where the concat was populating, went back and changed the format of the field from text to date, and this resulted in the field values all changing to zeros once again (00-00-0000).
In troubleshooting this issue, I found that it is possible to change the desired field's format to types other than date (for example from varchar to bigint or text).  If I change the format before executing the concat, the format changes from text to date perfectly fine; so it seems as though once the text field is used in the concat, something happens to the integrity of the field values so that if the text field is converted to a date field after the text field is used in a concat, the values will change to 00-00-0000.  In addition, I created a new empty column, copied the text column that I want to convert to a date, and pasted it in the empty column; the data pastes exactly how it is, but then when I change the format the field values change to 00-00-0000 again.
In a total of five DB tables comprised of over 80M total rows, I created an additional column and ran concats that use two fields in each table to populate the new column.  The fields used in the concat are both text fields and the field populated with the concat is a varchar field.
I'm in the very early stages of building this database, so if the only logical solution to this problem is to delete the database and recreate it, I will do so; however, finding a solution that doesn't involve deleting and loading the data in again, without compromising the DB's integrity as a whole, would be ideal.
I'm running an RDS Aurora DB w/ an InnoDB storage engine and using Navicat mysql as a DBMS.
Thank you in advance for any assistance you might be able to provide regarding this issue.


text:
Q: PayPal API charging card but returning error Please excuse me if this is a newbie question but I have never worked with any sort of credit card API before and I am, well, pretty much a newbie...
I have a script with "PayPal integrated" heh, and its not working.
When I run a card on the PayPal Sandbox, the transaction seems to go through, my sandbox account gets credited the amount but the script returns this error:

TIMESTAMP:  2011-04-25T14:03:42Z
CORRELATIONID:  5e727288789fb
ACK:  SuccessWithWarning
L_LONGMESSAGE0:  This transaction has been completed, but the total of items in the cart did not match the total of all items.
AMT:  25.00
CURRENCYCODE:  EUR
AVSCODE:  X
TRANSACTIONID:  4MM79765A4836914N

I understand the error message, but I am not sure where to begin looking in order to try and rectify it.
Sorry if this question is blurry, I am pretty lost and hoping that someone could just help get me pointed in the right direction here?
Thanks in advance!

A: "In your request string you may have use &L_COST0=18.00& for amount".
which may create problem for transaction, The variable for line item is L_AMTn so in this case it should be &L_AMT0=18.00&.
Just try this if needed. otherwise send the request string you had pass for more detail view.
Thanks.

A: you are suppose to called this function-
$httpParsedResponseAr = PPHttpPost('DoDirectPayment', $nvpStr);
where
$nvpStr =   &PAYMENTACTION=$paymentType&AMT=$amount&CREDITCARDTYPE=$creditCardType&ACCT=$creditCardNumber".
            "&EXPDATE=$padDateMonth$expDateYear&CVV2=$cvv2Number&FIRSTNAME=$firstName&LASTNAME=$lastName".
            "&STREET=$address1&CITY=$city&STATE=$state&ZIP=$zip&COUNTRYCODE=$country&CURRENCYCODE=$currencyID";

Some parameters may diff for your payment process,
so you can try this.
Thanks.


text:
Q: Best way to upload a directory of images to Google drive in python I have a directory of images that I'd like to transfer to Google drive via a python script.
What's a good way to upload (recursively) a directory of images to Google drive while preserving the original directory structure? Would there be any benefit to making this multithreaded? And if so, how would that work?

A: I would do this in two passes. Start by scanning the folder hierarchy, and then recreate the folders on drive. Update your in-memory folder model with the Drive folder ids. Then scan your files, uploading each one with appropriate parent id.
Only make it multithreaded if each thread will have a unique client id. Otherwise you will end up triggering the rate limit bug in Drive. If you have a large number of files, buy the boxed set of Game Of Thrones.


text:
Q: Botium informations are available but whats the happy path to setup up alexa skill starting point of Botium What needs to be setup first then the second level what needs to be done .
Eg :

*

*Install botium in vs code with package.json with dependencies

"chai": "^4.2.0",
"mocha": "^6.1.4",
"botium-bindings": "^2.0.13",
"botium-cli": "^0.0.50",
"botium-connector-alexa-avs": "^0.0.3",
"botium-connector-alexa-smapi": "^0.0.5"

2.In vs code Cmd ->node modules ->bin

botium-cli init
  botium-cli run

3.Botium.json file is available in node modules-> bin
4.Add the required dependencies (sample botium.json file for alexa required)
5.Define test cases (The below is for IBM watson.Need the same for amazon alexa)
[https://chatbotsmagazine.com/5-steps-automated-testing-of-chatbots-in-eclipse-ef4c3dcaf233][1]
6.Setup Botium box (This i know in browser with npmjs steps i've done it)
7.Setup Botium-bindings(where does this happen in IDE like eclipse or vs code)
So a happy path of installation steps is required .Now all we have is raw information which can't be connected together to find the start and end point
https://chatbotsmagazine.com/5-steps-automated-testing-of-chatbots-in-eclipse-ef4c3dcaf233

A: First step, install Botium-CLI and connector:
> npm install -g botium-cli
> npm install -g botium-connector-alexa-smapi
> botium-cli init
> botium-cli run

Second step, connect your Alexa Skill to Botium by adapting the botium.json file. This requires multiple steps, all of them are described here (Install ask-cli, retrieve credentials, copy to botium.json).
For an introduction what Botium is and how to get started writing test cases, I recommend the Botium in a nutshell blog series.


text:
Q: Is there a name for this special, "most parallel" ultraparallel line in hyperbolic geometry? Suppose you're in the hyperbolic plane, and you have a line L and a point P not through L. There are an infinite number of lines parallel to L that go through P.
However, there's one line M which is "special" in that the closest that it gets to L is exactly P.
One way to construct this line is to draw the perpendicular from P down to L, then obtain M by drawing the perpendicular through L at P.
Another way, in the Klein model, is to get the unique chord M going through P which is "parallel" to L if L and M are both extended outside of the disk to the rest of the Euclidean plane.
I believe this line should also be the "bisector" of the angle made by the asymptotic limiting parallels to L which go through P.
Does this line have a name in the hyperbolic geometry literature? It is, in a certain sense, the "most parallel" line to L going through P.

A: I don't think it has a special name. the line is not so special.
(every point has one, two of these lines from different points but the  same axis can intersect, while if they are perpendiculatr to the same line they don't)
Maybe best is to describe it as:
"the line trough $P$ that is perpendicular to the perpendicular from $P$ to $l$"
or
"the line trough $P$ that is member of the hyperpencil/ bundle  with as centre the perpendicular from $P$ to $l$"
Be Aware:
In hyperbolic geometry there is (yet) no general accepted terminology, different authors use different names for the same "thing" and the same name for different "things". So read and formulate carefully.
As example for some authors an "Ideal point" is a point at the infinite (Greenberg)
for some it are the points beyond that ( Sommerville)
In the other direction:
Non-intersecting lines with a common perpendicular are called "ultraparallel lines" (Greenberg) or "hyperparallel lines" (Borsuk)


text:
Q: Unreachable return statement still throws error I have this very simple code snippet:
static String getInput() throws IOException{
  if(in.ready()){
      return in.readLine().trim();
  }
  System.err.println("Please provide more input in order to execute the program.");
  System.exit(0);
  return "";
}

By what I think I know, there is no possible way that the JVM will execute the return statement at the end of the code. But if I comment this line out, java will complain about a missing return statement. Why doesn't the JVM recognize that a System.exit(0) will not allow any other code to execute, but complains about unreachable statements if a return will not allow code to be executed?
I think the return statement at the end is redundant and might be confusing to other devs, so why won't java let me get rid of it?

A:
Why doesn't the JVM recognize that a System.exit(0) will not allow any other code to execute, but complains about unreachable statements if a return will not allow code to be executed?

It's not the JVM - it's the compiler. And the compiler doesn't know what library calls will do - it only knows the language rules. (In particular, JLS section 14.21, Unreachable Statements.)
So for example:
public int foo() {
    alwaysThrow();
    // This is required.
    return 10;
}

private static void alwaysThrow() {
    throw new RuntimeException();
}

vs
public int foo() {
    throw new RuntimeException();
    // Error: unreachable statement
    return 10;
}

That simple inlining changes the meaning of the code as far as the compiler's concerned.
This could be "fixed" by having a return type of "never" - to indicate "this method never returns normally - it either hangs or throws an exception" but that's simply not part of the language (and would have its own complications). If you're interested, Eric Lippert has a couple of blog posts on this topic with regard to C# (which is in a similar position): part one, part two.


text:
Q: Mostrar datos personales del cliente y empleado que participan en un pedido Estoy atrapada en un problema de SQL y espero poder conseguir aquí cualquier ayuda por mínima que sea!
Lo que quiero lograr es mostrar en un listado el nombre y apellido del cliente y del empleado que participan en un pedido! lo que me causa problemas es a la hora de hacer la consulta porque los datos personales de clientes y empleados se encuentran en una misma tabla... me recomendaron el uso de alias pero aún asi no puedo lograr nada! adjunto la imagen de las tablas y el código que estoy probando

`SELECT * FROM pedidos p
INNER JOIN detalle_pedido dp ON p.`pedido_id`=dp.`rela_pedido`
INNER JOIN pedidos_estados pe ON p.`rela_pedido_estado`=pe.`pedido_estado_id`
INNER JOIN clientes c ON p.`rela_cliente`=c.`cliente_id`
INNER JOIN empleados e ON p.`rela_empleado`=e.`empleado_id`
INNER JOIN personas_fisicas pf ON ...`

A: Tome de esta pregunta la respuesta marcada como correcta y pude resolver mi problema!

*

*Creación de vistas (view).

*Join utilizando las mismas.

Les dejo habilitado para que les sea mas fácil llegar a una solución rápida! Gracias


text:
Q: XmlPullParser skip from START_DOCUMENT to END_DOCUMENT eventType I'm trying to parse xml file in Android app. When I'm trying to process it I don't receive eventType except START_DOCUMENT and END_DOCUMENT right after START. It looks like I will deliver empty file or something. The stranges thing is that I tryied this code on 5 different xml files and it worked (worked I mean I get different eventTypes than START and END) for corrupted one (there was missing some end tags). I was thinking that maybe I created wrong xml files but I even download some sample xml files and it didn't worked too.
some code:
public static void parseXML(Activity activity) throws XmlPullParserException, IOException {
        XmlPullParserFactory parserFactory;
        parserFactory = XmlPullParserFactory.newInstance();
        parserFactory.setNamespaceAware(true);
        XmlPullParser parser = parserFactory.newPullParser();
        InputStream inputStream = activity.getAssets().open("XML_RENAME.xml");
        InputStreamReader isReader = new InputStreamReader(inputStream);
        BufferedReader reader = new BufferedReader(isReader);
        parser.setInput(reader);
        processParces(parser);
    }

    private static void processParces(XmlPullParser parser) throws XmlPullParserException, IOException {
        int eventType = parser.getEventType();
        String tagname = "";
        String text = "";
        while(eventType != XmlPullParser.END_DOCUMENT)
        {
            tagname = parser.getName();
            switch(eventType)
            {
                case XmlPullParser.START_TAG:
                    if (tagname.equalsIgnoreCase(KEY_REGION)) {
                    }
                    break;

                case XmlPullParser.TEXT:
                    //grab the current text so we can use it in END_TAG event
                    text = parser.getText();
                    Log.e("Text: ", text);
                    break;

                case XmlPullParser.END_TAG:
                    if (tagname.equalsIgnoreCase(KEY_SECTOR)) {
                        Log.e("XML ",KEY_SECTOR);
                    } else if (tagname.equalsIgnoreCase(KEY_DIRECTIONS)) {
                        Log.e("XML ",KEY_DIRECTIONS );
                    } else if (tagname.equalsIgnoreCase(KEY_CONDITIONS)) {
                        Log.e("XML ",KEY_CONDITIONS );
                    } else if (tagname.equalsIgnoreCase(KEY_NEIGHBORS)) {
                        Log.e("XML ",KEY_NEIGHBORS );
                    } else if (tagname.equalsIgnoreCase(KEY_CONTINUATIONS)) {
                        Log.e("XML ",KEY_CONTINUATIONS );
                    } else if (tagname.equalsIgnoreCase(KEY_BLOCKS)) {
                        Log.e("XML ",KEY_BLOCKS );
                    }
                    break;

                default:
                    break;
            }
            eventType = parser.next();
            }
        }

A: I found a problem. Some xml files contains at start some extra bytes, to be specific "EF BB BF". It's called BOM (Byte-Order-Mark). When xml contains this extra bytes our XmlPullParser doesn't work properly and behave like there is no START_TAG event and goes to END_DOCUMENT.


text:
Q: DIV position change while scrolling down using scrollTop(); - jQuery I'm stuck with this, hope any of you can help me out.
I have this HTML:

With this CSS:
#one, #two, #three {
    width: 100%;
    height: auto;
}

And this jQuery:
$(window).scroll(function(){
var y = $(window).scrollTop();
var one = $('#one').height();
var two = $('#two').scrollTop();
var three = $('#three').scrollTop();

var pos_one = 310;
var pos_two = 454;
var pos_three = 596;

if( y > one ){
    $("#header").fadeIn(200);
} else {
    $('#header').fadeOut(200);
}

if( (y > one) && (y < two) ) {
    $('.bubble').animate({
        "left" : pos_two + "px"
    }, 300);
}

if( (y > two) && (y < three) ) {
    $('.bubble').animate({
        "left" : pos_three + "px"
    }, 300);
}
});

So, #header is fading in when I reach #two, that's working. The problem I have is that .bubble div is not moving when I reach the other sections while scrolling.
What am I doing wrong? Any help would be much appreciated!

A: simply use overflow property
just include overflow:hidden within your css something like this....
#one, #two, #three {
    width: 100%;
    height: auto;
    overflow:hidden;
}

you can use property value as per your need. here is the reference link overflow property link
Let me know it will help you or not ???


text:
Q: IRepository Aggregates and Lazy Loading I've been trawling stackoverflow and the internet in general all day about the IRepository pattern trying to better understand it before I try and use it in anger.
From what I've read (and please do correct me if I'm mistaken) a repoistory encapsulates access to its aggregate root and child objects exposing a common interface that can then be injected or mocked.
So in the instance where you have your aggregate root object:
class Employee {
    string FirstName;
    string LastName;
    IEnumerable<Address> Addresses;
    IEnumerable<PhoneNumber> PhoneNumbers;
}

Then its child objects:
class Address {
    string BuildingName;
    ...etc
}

class PhoneNumber {
    string PhoneNo;
    ...etc
}

So the repository would look something like:
class EmployeeRepository : IRepository<Employee> {
    Employee Get(id) {
    ...does stuff, builds full Employee object including Addresses/Phone No's and returns
    }
}

But say I dont want to get the whole Employee, say I just want the flat Employee record with FirstName LastName and be able to lazy load in the rest in later. How should this be accomplished? Would it be permissible to have something like:
class EmployeeRepository : IRepository<Employee> {
    Employee Get(id) {
    ...does stuff and builds flat Employee object without Addresses and Phone Numbers
    }

    Employee GetAddresses (Employee emp) {
    ...
    }

    Employee GetPhoneNumbers (Employee emp) {
    ...
    }
}

Is this ok or would I be breaking some sacrosanct DDD rule and burn in developer hell? How is lazy loading supposed to fit this model, again tried searching but all I've found is "let NHibernate/Entity Framework/ORM do it for you".
Thanks in advance.
D.

A: true lazy loading would mean that you have references to proxy objects in the properties of your aggregate root (and anywhere else in the object graph you wind up loading lazily) that would be smart enough to load the real entity and replace the proxy with it when properties are invoked that require it.  using something like castle's dynamic proxy or linfu's dynamic proxy are the best way to do this because dynamic proxies are complex beasts that have been well implemented by those guys.
doing what you have suggested requires that your consuming code be aware of what has and hasn't been loaded and puts the burden on the user to know about the lazy loading and think about it in the client code.  with a dynamic proxy, you don't have to think about it.
really, the best answer, though, is the one you have already found.  this is a problem that has been solved by ORMs.  use NHibernate and worry about your domain rather than implementing something that is already implemented and well tested and used by tons of other projects.  it's a problem with a lot of nuances and you are better off using what is already out there.


text:
Q: Correct iptables configuration for ip forwarding I think I miss something during configuration. Ping still shows host is not reachable
My goal is to access remote host 10.0.0.2 from 10.0.0.99.

UPDATE:

After playing with different AllowedIPs I finally get traffic flow as expected.

A: The problem is most certainly from the way wireguard's cryptokey routing works:

Cryptokey Routing
At the heart of WireGuard is a concept called Cryptokey Routing, which
works by associating public keys with a list of tunnel IP addresses
that are allowed inside the tunnel.

this association is declared with allowed-ips/AllowedIPs. Thus at a given time, on a given wireguard interface, one associated IP address can be associated with only one peer. (Probably nothing prevents to use more than one wireguard interface to "overcome" this, but this probably wouldn't scale as well.)
So if each node has this setting:
AllowedIPs = 10.0.0.0/24

it's fine for nodes connected to one peer and thus declaring this once, but becomes wrong for a node with multiple peers. A routing node having multiple peers, it's always wrong for it.
On marat3c when the first peer's config section, from my guess, 10.0.0.2's peer, is read, 10.0.0.0/24 is associated to this peer. Then when the second peer's (10.0.0.99's) config section is read, 10.0.0.0/24 is removed from the first peer and associated to the second peer. If you now type just wg on marat3c, you 'll get something like this:
interface: wg0
[...]

peer: (right peer's public key)
  endpoint: [...]
  allowed ips: (none)

peer: (left peer's public key)
  endpoint: [...]
  allowed ips: 10.0.0.0/24

If you change the order of the configuration you'll just reverse the problem: you can never have both with allowed ips: 10.0.0.0/24, the other will switch to (none), as explained at the start.
The multi-peer node should use only the IP addresses (often just one) expected to appear on the given peer to avoid this clash. So on marat3c's wg-quick's config use AllowedIPs = 10.0.0.99 for the left peer, and AllowedIPs = 10.0.0.2 for the right peer. You can also correct it "manually" (won't save it) using wg instead of wg-quick with:
wg set wg0 peer 'longpublickeyforleftpeer' allowed-ips 10.0.0.99
wg set wg0 peer 'longpublickeyforrightpeer' allowed-ips 10.0.0.2

A: *

*Enable IP forwarding on 10.0.0.99

user@wg-server:~$ cat /etc/sysctl.d/99-sysctl.conf  | grep -i forw
net.ipv4.ip_forward=1
reload sysctls: sudo systemctl reload sysctl

*Set proper routes on the wireguard clients:
If AllowedIPs directive on .99 and .2 do not include 0.0.0.0/0, or  a network including 10.0.0.0/24 then add:
AllowedIPs = 10.0.0.0/24 <<<<< include this on your client configuration or extend the current AllowedIPs list.


text:
Q: Using one text block for headers and bodies with bullets and different fonts I have a ScrollViewer with a TextBlock in it that I want to populate dynamically. I'd like some advice on what the best way to do this is. Here's my XAML with one sample "entry" in the TextBlock.
<ScrollViewer Background="White">
    <ScrollViewer.Resources>
        <sys:Double x:Key="{x:Static SystemParameters.VerticalScrollBarWidthKey}">30</sys:Double>
    </ScrollViewer.Resources>
    <TextBlock FontSize="26"
                   HorizontalAlignment="Left"
                   Margin="25">
            <Run Text="April 14, 2017"
                        FontFamily="VAG Rounded"
                        FontWeight="Bold" /><LineBreak />
            <Run Text="• Updates galore!" /><LineBreak />
            <Run Text="-------------------------------------------------------------------------------------------------------------------" />
    </TextBlock>
</ScrollViewer>

I want just a little space between the VAG Rounded Bold header and the default font body. It doesn't look like a Run allows for margins or padding. Should I just insert an empty line with a very small font size?
I'd appreciate any feedback on the rest of it as well.

A: If you use a Panel such as a Grid as the Content of the ScrollViewer you could use several TextBlocks with individual margins, e.g.:
<ScrollViewer Background="White">
        <ScrollViewer.Resources>
            <sys:Double x:Key="{x:Static SystemParameters.VerticalScrollBarWidthKey}">30</sys:Double>
        </ScrollViewer.Resources>-->
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="*" />
        </Grid.RowDefinitions>
        <TextBlock FontSize="26" FontFamily="VAG Rounded" FontWeight="Bold" Text="April 14, 2017" />
        <TextBlock FontSize="26" Margin="25" Grid.Row="1">
            <Run Text="• Updates galore!" />
            <LineBreak />
            <Run Text="-------------------------------------------------------------------------------------------------------------------" />
        </TextBlock>
    </Grid>
</ScrollViewer>


text:
Q: Trying to clone one disk to another but one starts up with a parition and the other doesn't I've got an Amazon EC2 m1.small that I am trying to migrate over to t2.small.  I'm aware that because of the virtualization type being different on both types that there is no direct upgrade path.
Someone over at https://forums.aws.amazon.com/thread.jspa?threadID=155526 suggested that I could take a snapshop of each and then create a volume from those snapshots, mount the volumes on a common server instance, remove the /boot folder from the /source system (old system) and remove the rest of the data from the new system other than /boot and then run: rsync -aAXHPv /mnt/source/ /mnt/target
Having said that I'm trying to mount each disk to perform the rsync and I'm running into a problem.
Terminal Screenshot Here
It seems that /dev/xvdn (new mnt/target) has a partition (dev/xvdn1) but dev/xvdo does not so when I try to mount the disk /dev/xvdn I can't and get an error that it's already been mounted or is busy.
I think the problem is that /dev/xvdn is auto mounting on boot but I don't know how to stop that from happening now am I really sure that's the issue.
Any help would be appreciated.
Thanks!


text:
Q: Разница использования библиотек поддержки? При чтении статей сталкиваюсь с тем, что пишут нужно подключить такую или такую библиотеку поддержки. Я немного почитал, чтоб постараться от сего зависит какую библиотеку нужно подключать.
Я так понял, что в зависимости для какого апи пишешь то такую библиотеку и нужно использовать.
Я открыл один из своих проектов и в градле заметил, что у меня бывает даже есть 2 библиотеки разных версий. Допустим так
android.support.v4
android.support.v13

Я так понимаю, что
android.support.v4

Можно вовсе удалить так как
android.support.v13

должна включать в себя все из предыдущей библиотеки, верно я понял?

A: К сожалению все неправильно.
Во первых, версией библиотеки считается трехзначный номер в конце (как 24.3.0), а не число, что идет после v. в названии библиотеки. Эти числа - это до какого минимального API эта библиотека поддержки собственно оказывает поддержку. Так, v.4 значит, что библиотека поддержки будет работать на устройствах с API4 и выше.
Использовать нужно версию библиотеки не менее чем minSDKversion проекта и равную или более, чем compileSDKversion (targetSDKversion) а крайне  желательно - последнюю стабильную (сейчас это 24.3.0), так как с каждой новой версией вносятся фиксы в существующие классы и дополняются новые классы или методы. При этом смотреть соответствие API нужно по мажорному номеру библиотеки (здесь 24.3.0 - для compileSDKversion API24).
Ознакомиться с изменениями, вносимыми в библиотеки поддержки с каждой новой ревизией можно на официальном сайте разработчика Android - здесь указано, какие именно изменения и дополнения были внесены с каждой ревизией и в какие именно из библиотек поддержки (так в ревизии 24.3.0 были внесены изменения в библиотеки v4, v7 (в подбиблиотеки AppCompat, MediaRouter, Preferences, RecyclerView) , Design.
библиотеки support.v4 , support.v7 и тд - это разные библиотеки, с различными классами поддержки и выполняемыми функциями и они не взаимозаменяют друг друга по принципу большей версии. С полным списком библиотек поддержки Google и их назначением и функциями вы можете ознакомиться на все том же официальном сайте разработчика Android.
Например, библиотека com.android.support:support-v4:24.3.0 - библиотека поддержки с минимальным API, на котором она работает API4 и версией самой библиотеки - 24.3.0. Список классов и функций этой библиотеки можно посмотреть здесь. Как видите, это совсем не то же, что библиотека com.android.support:support-v7, в которую входит вообще несколько отдельных библиотек, как ApppCompat, CardView и тд.
PS: никакой библиотеки support.v21 у Google не наблюдается ..


text:
Q: CPU Intensive SQL Query Optimization How do I optimize this Oracle SQL query as it takes approximately 23 seconds to execute and it also increases CPU usage? The query is meant to get all parent_users and their respective child_users transactions aggregates. The tables structure is including after the Query.
        SELECT

        mydb.USERS.first_name,
        mydb.USERS.last_name,
        mydb.USERS.work_id,
        mydb.USERS.unique_id as parent_user_id,

        (SELECT SUM(mydb.TRANSACTIONS.amount) FROM mydb.TRANSACTIONS, mydb.USERS childUsers WHERE mydb.TRANSACTIONS.FROM_UNIQUE_ID = childUsers.unique_id AND childUsers.parent_id = mydb.USERS.unique_id
         ) AS transaction_value,

        (SELECT COUNT(mydb.TRANSACTIONS.txn_id) FROM mydb.TRANSACTIONS, mydb.USERS childUsers WHERE mydb.TRANSACTIONS.FROM_UNIQUE_ID = childUsers.unique_id AND childUsers.parent_id = mydb.USERS.unique_id
         ) AS transaction_volume,

        (SELECT COUNT(DISTINCT mydb.WORK_ZONE.id) FROM mydb.WORK_ZONE
         WHERE mydb.USERS.work_id = mydb.WORK_ZONE.id AND mydb.WORK_ZONE.status = 1
         ) AS active_zones_count,

         (SELECT COUNT(DISTINCT childUsers.city_id) FROM mydb.USERS childUsers
         WHERE  mydb.USERS.unique_id = childUsers.parent_id
         ) AS active_city_count,

        (SELECT COUNT(childUsers.parent_id) FROM mydb.USERS childUsers GROUP BY childUsers.parent_id HAVING  mydb.USERS.unique_id = childUsers.parent_id) AS child_users_count,

         (SELECT COUNT(mydb.TRANSACTIONS.status) FROM mydb.TRANSACTIONS, mydb.USERS childUsers WHERE mydb.TRANSACTIONS.status = 'SUCCESS' AND mydb.TRANSACTIONS.FROM_UNIQUE_ID = childUsers.unique_id AND childUsers.parent_id = mydb.USERS.unique_id
         ) AS success_count,

         (SELECT COUNT(mydb.TRANSACTIONS.status) FROM mydb.TRANSACTIONS, mydb.USERS childUsers WHERE mydb.TRANSACTIONS.status = 'FAILED' AND mydb.TRANSACTIONS.FROM_UNIQUE_ID = childUsers.unique_id AND childUsers.parent_id = mydb.USERS.unique_id
         ) AS failed_count

        FROM mydb.USERS

        LEFT JOIN mydb.TRANSACTIONS ON mydb.TRANSACTIONS.FROM_UNIQUE_ID = mydb.USERS.unique_id

        LEFT JOIN mydb.WORK_ZONE ON WORK_ZONE.id = USERS.work_id

        WHERE mydb.USERS.user_type = :user_type AND mydb.USERS.parent_id IS NULL

        AND substr(mydb.TRANSACTIONS.created_at,0,10) > :start_date AND substr(mydb.TRANSACTIONS.created_at,0,10) < :end_date AND mydb.USERS.region_name LIKE :region_name AND mydb.WORK_ZONE.zone LIKE :zone

        GROUP BY  USERS.unique_id, USERS.first_name, USERS.last_name, USERS.work_id

        OFFSET :offset ROWS
        FETCH NEXT :per_page ROWS ONLY

TABLES STRUCTURE

*

*USERS TABLE

unique_id | parent_id | user_type | first_name | last_name | work_id | city_id | region_name
85000061370 |    null    | 90 | John     | Doe       | 3     | null | null
50474671481 | 85000061370| 91 | James     | Wayne    | null  | null | null
60373735474 | 85000061370| 91 | Samuel     | Tony    | null  | null | null

*

*TRANSACTIONS TABLE

txn_id       | from_unique_id | amount | status | created_at
622160546487 | 50474671481    | 10000  | SUCCESS| 2021-05-28 00:09:00 +01:00
474837593733 | 60373735474 | 5000    | SUCCESS    | 2021-06-20 00:09:00 +01:00

*

*WORK_ZONE TABLE

id | zone | status
5 | SOUTH EAST | 1
6 | SOUTH WEST | 0


text:
Q: mPDF - When I import/merge PDFs with a fillable form field it strips the form elements We're using mPDF, but when combining PDF files with Acrobat form fields, the output result strips the form fields.

I've combed through the documentation, looked extensively online, and I can't find a solution that works with mPDF.

A: mPDF uses FPDI in the back which simply does not support importing of form fields.

A: Update: As of mPDF 7 you can create fillable forms within PDFs dynamically - :D !


text:
Q: Insert a string to a path I have a string like this
folder1/folder2/folder3/13007805372971.jpg

What should I do to append a string before file name ? I would like to look like this
folder1/folder2/folder3/sometext_13007805372971.jpg

A: You can make use of the pathinfo function, which is designed to parse paths.
$s='folder1/folder2/folder3/13007805372971.jpg';
$x='sometext_';
$fos=pathinfo($s);

$s2=$fos['dirname'].DIRECTORY_SEPARATOR.$x.$fos['basename'];

A: You can use the SplFileInfo class
$file = new SplFileInfo('folder1/folder2/folder3/13007805372971.jpg');
printf('%s/sometext_%s', $file->getPath(), $file->getBasename());

Can also use the DIRECTORY_SEPARATOR constant instead of hardcoding the slash into the call.
Live Demo

A: You can achieve that using the following code.
$string           = 'folder1/folder2/folder3/13007805372971.jpg';
$last_slash_pos   = strrpos($string, '/');
$path             = substr($string, 0, $last_slash_pos + 1);
$filename         = substr($string, $last_slash_pos + 1);

$filename_prefix  = 'sometext_';
$new_filename     = $path . $filename_prefix . $filename;

echo $new_filename; // Output: folder1/folder2/folder3/sometext_13007805372971.jpg

View Live Version

A: $filePath = 'folder1/folder2/folder3/13007805372971.jpg';
$str = 'sometext_';

$newPath = dirname($filePath) . DIRECTORY_SEPARATOR . $str . basename($filePath);

A: preg_replace("/\/([^\/]+)$/", "/sometext_\\1", "folder1/folder2/folder3/13007805372971.jpg");
This takes the part after the last slash, and adds sometext_ right after it.

A: Get the components of the filename using pathinfo and then plug in your addition as required.
$path_parts =pathinfo($string);
$string = $path_parts['dirname'].'/sometext_'.$path_parts['basename'];


text:
Q: Simplifying product of matrix exponential? Is there a known generalization for n-term matrix exponential multiplication?
I am aware that the Baker–Campbell–Hausdorff formula could be used, e.g.:
expm(A) * expm(B) = expm(A + B + [A,B]/2 + ...)

But is there any (simple) formulation for n terms, e.g. like this?
expm(A_1) * ... * expm(A_n) = expm(A_1 + ... + A_n + ???)

Additionally, I wonder if it would be possible to find a simpler formula, if it is known that:
A_i = B + C_i

so that:
expm(B + C_1) * ... * expm(B + C_n)

Note that B and C_i are not commuting and not nilpotent, so I do not see much free lunch over there, but C_i is very sparse and actually it might be possible to find a direct formula for expm(C_i).
Also, I am specifically interested in a faster computation of:
expm(B + C_1) * ... * expm(B + C_n)

and I thought it would be cheaper to trade of some expm() with some matrix multiplication...
p.s. they are all n x n invertible square matrix.


text:
Q: Can I use push notifications without developing my own server? I want to make android app, which will use push notifications, but I don't know how to create my own server (I don't know php). Can I create this application using some free services?

A: You can use Parse Push. But their services will only be available until Jan 2017. But you can try http://rzlts.com/. It's a free straight forward tool.


text:
Q: Tortoise Mercurial - combine 2 commits I am starting to use Mercurial:
1.)  I pulled the latest updates from public (central) repository (revision 3029)
2.)  Working on code, I made a commit - revision 3030
3.)  Some additional work, and - I made another commit 3031.
So, both of my commits 3030 and 3031 are in a local repository.
At this stage my local repo looks like this

There are no commits by other people in Central repository.
I am finished at this point, and submit the code for code review - my reviewer tells me that there should be only single commit. I need to "get rid" the commit at revision 3030, and keep the 3031 revision.
If I do "strip" at a revision 3030, it strips both 3030 AND 3031.
(I know how to restore from the back up, so I did not loose anything.  I restored back).
how can combine revision 3030 and 3031 into a single commit using Tortoise HG ?

A: Using Revert All Files.
One easy way, as long as you don't have any uncommitted changes in your working directory.
update to the commit before the changes you want to squash.

right click on latest commit and click "Revert all files..."
This sets you working directory state, to be as if you were updated to the last commit.

Now just make a new commit, the contents of which will be the last two commits.
Then you can use 'strip' to remove the unwanted branch. (or just change the phase to secret to prevent it getting accidentally pushed)

A: Using Rebase.
first enable rebase
Then select the bottom/oldest commit, and click rebase.

In the rebase options screen select collapse.

You will be then asked to enter a new commit message.


text:
Q: link to open a new tab gets invisible in dashboard in r shiny app In r shiny i have added a help link to a pdf file which open on a new browser on click. On left is the logo and right is that link. On running the app,the logo on left is clearly visible but the help link is invisible.But when the cursor is hover around in that location on right in the browser it is visible in fade colour. However if the browser is restore down the link gets visible clearly.
Below is the ui code:
library(shiny)
library(shinydashboard)

dashboardPage(
dashboardHeader(title = "flex_logo",
         tags$li(class = "dropdown",
         tags$p(h4(a("Help",target="_blank",href="Flex-Forecasting_Usage_Guidelines.pdf"),
         style="font-weight: bold;color:red;")))
),
dashboardSidebar(
radioButtons("filetype", "Select file type",choices=c("csv file","xlsx file"))
 ),
dashboardBody()
)

Here is server code
shinyServer(function(input,output){
})

I want the link to be clearly visible all the time. I might be doing something which is very basic.
Please suggest.

A: The problem is your color:red doesn't get applied to your anchor a tag!
Modified Code:
library(shinydashboard)

dashboardPage(
dashboardHeader(title = "flex_logo",
         tags$li(class = "dropdown",
         tags$a("Help",target="_blank",href="Flex-Forecasting_Usage_Guidelines.pdf",
         style="font-weight: bold;color:red;"))
),
dashboardSidebar(
radioButtons("filetype", "Select file type",choices=c("csv file","xlsx file"))
 ),
dashboardBody()
)


text:
Q: Resolutions of higher-dimensional Kummer varieties If $A$ is an abelian variety over a field, the Kummer variety $K_A$ associated to $A$ is obtained as the quotient of $A$ by the involution $\iota: a \mapsto -a$.  If $A$ is a surface, it is well-known that a resolution of $K_A$ can be constructed simply by blowing up the image (under the quotient map) of the set of $2$-torsion points.  Is this statement still true if $A$ has dimension at least $3$?  Precisely, is the variety obtained from $K_A$ by blowing up the image of the locus of $2$-torsion points under the quotient map always smooth?

A: Yes, it is smooth. What is different from dim 2, is that the resolution is not crepant, so the resolution of $K_A$ is not a Calabi--Yau variety.


text:
Q: Does a monad guarantee to have a way to get an "unwrapped" type? The quote from Eric's answer:
Monads in C# -- why Bind implementations require passed function to return a monad?

"But there simply is no composition of f and g if g returns a monad and f doesn't return the monad -- there is no guarantee that there is a way to go back from the instance of the monad to an "unwrapped" type"

Does that mean that if both g and f return the monad will guarantee that these is a way to go back from the instance the monad to an "unwrapped" type? but how? Can someone explaint this point to me?
Update: Thanks for Aaron and Euge's answers, now I understand that getting back T from M is not part of Monad's requirement (API), but from inside Monad bind function implementation itself, it should know how to get T from M<T>, otherwise, how the Func<T, M<R>> can be called inside the Bind function.

A: No, that is not one of defined properties of a Monad.  The Haskell page on Monads explains clearly that you can't directly get an a back out of an M a.  The quote is explaining that once you've gone from T to M<T>, you always need to work with M<T>, hence the utility of Lifting.

A: As Aaron already said, the answer is no. The simplest example to see that you cannot always "come back" from a monad, in my opinion, is the case of the frequently called Maybe monad or Option. You can see an implementation in C# here: https://mikhail.io/2016/01/monads-explained-in-csharp/
I don't really know C# so I will avoid writing code and try to explain it with words.
To model computations that can fail we could use a data type that either is a value or it is nothing (think of an alternative to null). The requirements for that datatype to be a monad are the following:

*

*If we have a computation that never fails, returning something of type B, then we can get an equivelent computation that returns Maybe<B>.
This is the return constructor, that simply wraps the value inside Maybe.

*We can compose computations that might fail. How? Well, if the first one fails, everything fails. If it doesn't, then we pass the returned value to the next function. This is the behaviour of bind.

*We also need some laws to be valid, but let's forget about it for the sake of simplicity.

Consider the case where we compose two functions that might fail. Can we always get a value? Well, not always. We get a value when neither of the two functions have failed.
I will try to explain it with code now. You can correct me when I'm wrong.
So lets say we have maybe a value maybeValue of type A
Maybe<A> maybeValue = ...;

And we have a function foo that takes values of type A.
Maybe<B> foo(A a) {...}

We want to pass maybeValue to foo. Monads let you do that without inspecting maybeValue to see if it has or not a value. Yo do it like this:
Maybe<B> result = maybeValue.bind(foo)

Again: Can I always transform result into something of type B? I mean, does result always contain a value? Well, no. Only when both maybeValue and foo were successful.


text:
Q: Why Greatest Lower Bound of this lattice does not exist? f^g does not exist in this lattice
Well in this problem greatest lower bound of f^g (i.e. f meets g) does not exist.
Why is it so. Since we could have b or e as GLB.
Any help/answers will be appreciated

A: A greatest lowest bound has the property that it is greater then all other lower bounds.  b is not grater then e so it can't be the greatest lower bound (likewise for e).


text:
Q: App insights common logging utility service - Valid pattern? At the moment I have about 10 microservices in my domain model. Each microservice includes the app insights sdk and the logs just push to app insights.
I have a customer of mine who has specifically requested that all microservices should go through like a app insights common microservice which would then push to app insights.
Lets just ignore that they are introducing a single point of failure for a sec. I want to know if the above is actually possible? Is the above suggestion a valid pattern? In the common Microservice would I be able to write a method in a class like ...
public void logBusinessEvent(String eventRequest,eventMessage){
    AppInsights ai = new AppInsights();
    ai.logRequests(eventRequest);
    ai.logTraces(eventTraces);
}

This feels very wrong but nether the less I want to do my homework on this before I get back with a response.
thanks

A: I agree with Peter's option. In that way, it will break the correlation.
We'd better send it directly to application insights, and set up Continuous export, then do the set of tasks based on the exports.


text:
Q: Docusing Plugin for Sugar CRM does not craete envelope with document I am using docusign Plugin for Sugarcrm. I have added docusign dashlet on Accounts record. when I click on "Send With Docusign" button if works fine if there is no documetn attached with given account and opens sender view with attached contacts as recipients.  but if there is document attached with given account record. It keeps on loading for long time then it gives following error.
'DocuSign_IOException' with message 'SSL read: error:00000000 lib(0):func(0: reason(0): errno :10054' on DocuSign_CurlIO.php line 63. which is '$result = curl_exec($curl);'. if I display curl_errno($curl); it gives me 56
Kindly suggest me what to do. Thanks in Advance.


text:
Q: When will PLANCK release all-sky CMB anisotropy measurements? After hearing so much about PLANCK, people these days are still constraining models with WMAP results. When will PLANCK finally release its much more superior data?

A: Dear Felix, by the middle of 2010, Planck had already covered 100% of the skies for the first time. The first version of the final results are scheduled to be released in January 2013 (previously by the end of 2012), see

http://en.wikipedia.org/wiki/Planck_(spacecraft)#Results

However, during a January 2011 Planck conference in Paris, they have released "early results"

http://arxiv.org/abs/1101.2022

It's mostly about the health status - the spacecraft seems to work astoundingly well so far. The package is available at

http://www.rssd.esa.int/index.php?project=Planck
http://www.sciops.esa.int/index.php?project=PLANCK&page=Planck_Published_Papers

The second link contains 25 papers on the arXiv. Again, the maps and timelines will be released in January 2013 according to the current plan - see the conclusions of the 1101.2022 paper above.


text:
Q: Protractor screenshot tests error code 105 Protractor tests were running well till I messed around with my config.js file to include screenshot testing.
Errors from running protractor conf.js

C:\Users\hhhhhh\mmmm\tests\e2e>protractor conf.js
[10:50:13] E/configParser - error code: 105
[10:50:13] E/configParser - description: failed loading configuration file conf.js
C:\Users\hhhhhh\AppData\Roaming\npm\node_modules\protractor\built\configParser.js:130
              throw new exitCodes_1.ConfigError(logger, 'failed loading configuration file ' + filename);`

package.json
{
  "name": "e2e",
  "version": "1.0.0",
  "description": "yup yup yup",
  "main": "conf.js",
  "dependencies": {
  "protractor-jasmine2-screenshot-reporter": "^0.3.1",
  "protractor": "3.3.0"
  },
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "",
  "license": "ISC"
}

conf.js
  var ScreenShotReporter = require('protractor-screenshot-reporter');

  exports.config = {
    seleniumAddress: 'http://localhost:4444/wd/hub',

    capabilities: {
      'browserName': 'chrome'
    },

    directConnect: true,

    framework: 'jasmine2',

    specs: ['specs/*spec.js'],

    onPrepare: function() {
       jasmine.getEnv().addReporter(new ScreenShotReporter({
          baseDirectory: 'target/screenshots'
       }));
    }

  };

Many seem to be having issues with this. Anyone found a sound solution?

A: It looks from your package.json that you are using protractor-jasmine2-screenshot-reporter but you are using protractor-screenshot-reporter in your conf.js. Both are different modules, please use one of those and try again!


text:
Q: MarketingCloudSDK (5.2.1) iOS: duplicate symbol ___llvm_profile_runtime I have just integrated the MarketingCloudSDK (5.2.1) via CocoaPods to an iOS app and I am facing a duplicate symbol error. Someone already had the same issue posted to the apple forum:
https://forums.developer.apple.com/thread/105532 but never got a reply.
All our pods are statically linked. The App is pure Objective C. We added for the App "Other Linker Flags": -all_load for good reasons (which is actually causing the trouble).
In our app we have "Code coverage" set to "Gather coverage" for all targets. If I turn it off, it is working, but our CI should really run with code coverage.
Is it possible that the sdk was build with CLANG_ENABLE_CODE_COVERAGE? I believe it is the corresponding flag.
Or some other profiling flags, i.e. -fprofile-instr-generate which would be rejected by Apple: https://developer.apple.com/library/archive/qa/qa1964/_index.html

A: @theguy we are aware of this issue and the conflict presented by the "-all_load" linker flag in conjunction with CocoaPods.
We are determining the best path forward with the change to the SDK.
In the meantime, is it possible to switch to -force_load with a specific path to the output of the pod's build (the .a)? This may address the problem directly while we work out the SDK change.


text:
Q: Organizing a list of items into two columns Is it possible in LaTeX to divide the following list of items into two columns:
\documentclass[12pt,letterpaper]{article}

\usepackage{enumitem}

\begin{document}

\section*{Section 01}
\begin{itemize}[noitemsep,nolistsep]
    \item item 1
    \item item 2
    \item item 3
    \item item 4
    \item item 5
\end{itemize}

\end{document}

Here is the output:

I would like to have items 1, item 2, item 3 in the left column while item 5 and item 6 on the right one. Would this possible using LaTeX? I am actually looking for something like the following image:

A: You can use multicol package.
\documentclass[12pt,letterpaper]{article}

\usepackage{enumitem,multicol}

\begin{document}

\section*{Section 01}
\begin{itemize}[noitemsep,nolistsep]
\begin{multicols}{2}
    \item item 1
    \item item 2
    \item item 3
    \item item 4
    \item item 5
\end{multicols}
\end{itemize}

\end{document}

A: The following solution worked for me. However, I am not sure if it is the best solution.
\documentclass[12pt,letterpaper]{article}

\usepackage{enumitem}
\usepackage{multicol}

\begin{document}

\section*{Section 01}

\begin{multicols}{2}
    \begin{itemize}[noitemsep,nolistsep]
        \item item 1
        \item item 2
        \item item 3
        \item item 4
        \item item 5
    \end{itemize}
\end{multicols}
\end{document}

Here is the output:


text:
Q: Newton's law doubt Consider the following arrangement

When I drew the FBD of block C then I got a doubt that why tension in string pulling C backwards cannot be equal to force F. I know it is against what actually happens but why is it so.
Why can't tension be equal to force F? Is it because we know that when we pull a block in such a way , it accelerates so there must be some horizontal force for the same ?

A: If the surface is frictionless, I guess you would agree that an external force is going to make the whole system move (to the right in your diagram) as nothing is stopping the whole system from moving.
If the system moves, block C moves too (the strings have constant length). The forces over block C are the force $F$ and the tension $T$. If $T=-F$ then there is no movement. Which means that $T\neq -F $ is the only possible solution.


text:
Q: vBulletin merging old database and new database How to merge old database with new database?
I need to add all stuff (topics, comments, users and all info) from one db to other...
vBulletin 3.7.3 (both dbs)

A: You can use ImpEx. https://www.vbulletin.com/docs/html/impex/


text:
Q: pointer to non-const type 'id' with no explicit ownership xcode I have an app that runs great on various devices but when I try to run it on the simulator I get the following error.
pointer to non-const type 'id' with no explicit ownership
I see where I should remove the * from the id* to solve the problem, however the id* resides inside the coreData.h  so I can't change it.
How can I get rid of this error?
in the NSFetchRequest.h there is a line
id*_additionalPrivateIvars; (this is where the error is coming from)
it is a header inside the framework coreDate/coreData.h
this framework is imported into one of my view controllers
others within coreData are
id** _kvcpropertyAccessors; in NSEntityDescription.h
and
id_optimizationHints; in NSManagedObjectModel.h
and
id_cachedObsInfoByEntity; and id*_contextLabel; in NSManagedObject.h
and
id _additonalPrivateIvars; inside NSPersistentStoreCoordinator.h
and
id _oidFactories; in NSPersistentStore.h
don't know if this helps but...
all of these have to do with uploading a video to youtube
I don't have all the devices so I have to run the app on the simulator mostly to look at the different view to make sure everything looks right.  I can't use autoresize because I have various animation when the views run and they have to position things differently depending on the device.
Any help would be greatly appreciated.
OK here is the code in context within coreData/NSEntityDescription.h
#import <Foundation/NSArray.h>
#import <Foundation/NSDictionary.h>
#import <Foundation/NSRange.h>

NS_ASSUME_NONNULL_BEGIN

@class NSManagedObjectModel;
@class NSManagedObjectContext;
@class NSManagedObject;
@class NSData;
@class NSPropertyDescription;
@class NSRelationshipDescription;
@class NSAttributeDescription;

// Entities describe the "types" of objects available.
NS_CLASS_AVAILABLE(10_4,3_0)
@interface NSEntityDescription : NSObject <NSCoding, NSCopying, NSFastEnumeration> {
@private
    int32_t  _cd_rc;
    id _snapshotClass;
    NSString *_versionHashModifier;
    NSData *_versionHash;
    __weak NSManagedObjectModel *_model;
    NSString *_classNameForEntity;
    Class _instanceClass;
    NSString *_name;
    __weak NSEntityDescription *_rootentity;
    __weak NSEntityDescription *_superentity;
    NSMutableDictionary *_subentities;
    NSMutableDictionary *_properties;
    id _propertyMapping;
    __strong NSRange *_propertyRanges;
    struct __entityDescriptionFlags {
        unsigned int _isAbstract:1;
        unsigned int _shouldValidateOnSave:1;
        unsigned int _isImmutable:1;
        unsigned int _isFlattened:1;
        unsigned int _skipValidation:1;
        unsigned int _hasPropertiesIndexedBySpotlight:1;
        unsigned int _hasPropertiesStoredInTruthFile:1;
        unsigned int _rangesAreInDataBlob:1;
        unsigned int _hasAttributesWithExternalDataReferences:1;
        unsigned int _hasNonstandardPrimitiveProperties:2;
        unsigned int _hasUniqueProperties:1;
        unsigned int _validationUniqueProperties:1;
        unsigned int _reservedEntityDescription:19;
    } _entityDescriptionFlags;
    __strong void *_extraIvars;
    NSMutableDictionary *_userInfo;
    id _flattenedSubentities;
    id** _kvcPropertyAccessors;  (THIS IS THE OFFENDING CODE LINE)
    long _modelsReferenceIDForEntity;
}

and here is the youTubeConnectViewController.h page that imports the coreData.h framework.  //  youTubeConnectViewController.h
//  my little world app
//
//  Created by Creatucate on 11/25/12.
//  Copyright (c) 2012 Creatucate. All rights reserved.
//

#import <UIKit/UIKit.h>
#import "GData.h"
#import "GDataYouTubeAccessControl.h"
#import <GoogleSignIn/GoogleSignIn.h>
#import <CoreData/CoreData.h>
#import <Security/Security.h>
#import "SSKeychain.h"
#define devKey @"AIzaSyDrmQGFblRrH0aBTbR7gsMKxl5QMqgTxcc"

@interface youTubeConnectViewController : UIViewController <UITextViewDelegate, UIPickerViewDataSource,UIPickerViewDelegate, UITextFieldDelegate,NSFetchedResultsControllerDelegate,GIDSignInDelegate,GIDSignInUIDelegate>{

    IBOutlet UILabel *UserName;
    IBOutlet UILabel *commas;
    IBOutlet UIButton *signInButton1;
    IBOutlet NSTextField *mEntryCountField;*/
    IBOutlet UIPickerView *catagoryPicker;
    IBOutlet UIProgressView *mUploadProgressIndicator;
    IBOutlet UIButton *cancel;
    NSDictionary *titleTextAttributes;
    IBOutlet UITextField *number;
    IBOutlet UILabel *toptitle;
    IBOutlet UILabel *movieTitle;
    IBOutlet UILabel *descp;
    IBOutlet UILabel *tags;
    IBOutlet UILabel *catag;
    IBOutlet UILabel *account;
    IBOutlet UILabel *pub;
    IBOutlet UILabel *pubdef;
    IBOutlet UILabel *pub1;
    IBOutlet UILabel *unlist;
    IBOutlet UILabel *unlistdef;
    IBOutlet UILabel *unlist1;
    IBOutlet UILabel *priv;
    IBOutlet UILabel *privdef;
    IBOutlet UILabel *priv1;
    NSDictionary *pictureDictionary3;
    NSDictionary *pictureDictionary4;
    NSMutableArray *pickerArray;
    IBOutlet UITextField *catagoryField;
    IBOutlet UITextField *catagoryField1;
    IBOutlet UITextField *ViewingField;
    IBOutlet UIImageView *buttonbg;
    IBOutlet UIImageView *pickerback;
    IBOutlet UILabel *okl;
    IBOutlet UIView *SignInButton;
    float downloadingstatus;
    IBOutlet UITextView* terms;
    NSString *authToken;
    BOOL mIsPrivate;
    BOOL mIsPublic;
    IBOutlet UIImageView *signIn;
    IBOutlet UIImageView *fail;
    IBOutlet UIImageView *signOutView;
    IBOutlet UIButton *signIncancel;
    IBOutlet UIButton *ok;
    IBOutlet UILabel *Password;
    IBOutlet UITextField *UserNameField;
    IBOutlet UITextField *PasswordField;
    IBOutlet UITextField *movieNameField;
    IBOutlet UITextField *tagsField;
    IBOutlet UITextView *descpView;
    IBOutlet UITextField *accountView;
    IBOutlet UITextField *UserOutField;
    IBOutlet UITextField *PublicField;
    IBOutlet UITextField *PrivateField;
    IBOutlet UITextField *UnlistedField;
    IBOutlet UIButton *chooseButton;
    NSMutableDictionary *SignInDictionary;
    IBOutlet UITextField *PasswordDisplayField;
    IBOutlet UIButton *termsButton;
    IBOutlet UIButton *SignOutButton;
    IBOutlet UIButton *cancelOutButton;
    IBOutlet UIButton *toOutButton;
    IBOutlet UITextField *length;
    IBOutlet UILabel *authfailed;
    IBOutlet UILabel *YouTubesignin;
    IBOutlet UILabel *YouTubesignout;
    IBOutlet UILabel *YouTubesignoutacc;
    IBOutlet UITextView *errorfailed;
    IBOutlet UIScrollView *scrollview;
    GDataFeedYouTubeVideo *mEntriesFeed; // user feed of album entries
    GDataServiceTicket *mEntriesFetchTicket;
    NSError *mEntriesFetchError;
    NSString *mEntryImageURLString;
    GDataServiceTicket *mUploadTicket;
    NSURL *mUploadLocationURL;
UIImage *buttonimage3;
}
@property (nonatomic, retain)IBOutlet UILabel *allow;
@property (nonatomic, retain)IBOutlet UILabel *done;
@property (nonatomic, retain)IBOutlet UILabel *tap1;
@property (nonatomic, retain)IBOutlet UILabel *tap2;
@property (nonatomic, retain)IBOutlet UILabel *tap3;
@property (nonatomic, retain)IBOutlet UILabel *tap4;
@property (nonatomic, retain)IBOutlet UILabel *tap5;
@property (nonatomic, retain)IBOutlet UILabel *tap6;
@property (nonatomic, retain)IBOutlet UILabel *tap7;
@property(retain, nonatomic) IBOutlet GIDSignInButton *signInButton;
@property (nonatomic, retain) UIImage *buttonimage3;
- (GDataServiceGoogleYouTube *)youTubeService;
@property (nonatomic, retain) IBOutlet UILabel *commas;
@property (nonatomic, retain) IBOutlet UITextField *length;
@property (readwrite, retain) UIView *inputAccessoryView;
@property (nonatomic, retain) IBOutlet UITextField *catagoryField;
@property (nonatomic, retain) IBOutlet UITextField *catagoryField1;
@property (nonatomic, retain) IBOutlet UITextField *PasswordDisplayField;
@property (nonatomic, retain) IBOutlet UIProgressView *mUploadProgressIndicator;
@property (nonatomic, retain) IBOutlet UIScrollView *scrollview;
@property (nonatomic, retain) IBOutlet UIImageView *signIn;
@property (nonatomic, retain) IBOutlet UIImageView *signOutView;
@property (nonatomic, retain)IBOutlet UIButton *signIncancel;
@property (nonatomic, retain)IBOutlet UIButton *signInButton1;
@property (nonatomic, retain)IBOutlet UILabel *UserName;
@property (nonatomic, retain)IBOutlet UILabel *Password;
@property (nonatomic, retain)IBOutlet UITextField *UserNameField;
@property (nonatomic, retain)IBOutlet UITextField *PasswordField;
@property (nonatomic, retain)IBOutlet UITextField *movieNameField;
@property (nonatomic, retain)IBOutlet UITextField *tagsField;
@property (nonatomic, retain) NSArray *pickerArray;
@property (nonatomic, retain) IBOutlet UIButton *chooseButton;
@property (nonatomic, retain) IBOutlet UIPickerView *catagoryPicker;
@property (nonatomic, retain) NSMutableDictionary *SignInDictionary;
@property (nonatomic, retain) IBOutlet UITextField *accountView;
@property (nonatomic, retain) IBOutlet UITextField *UserOutField;
@property (nonatomic, retain) IBOutlet UITextField *ViewingField;
@property (nonatomic, retain) IBOutlet UITextField *PublicField;
@property (nonatomic, retain) IBOutlet UITextField *PrivateField;
@property (nonatomic, retain) IBOutlet UITextField *UnlistedField;
@property (nonatomic, retain) IBOutlet UIImageView *buttonbg;
@property (nonatomic, retain) IBOutlet UIImageView *pickerback;
@property (nonatomic, retain) IBOutlet UILabel *okl;
@property (nonatomic, retain) IBOutlet UIImageView *fail;
@property (nonatomic, retain) IBOutlet UIButton *ok;
@property (nonatomic, retain) IBOutlet UITextView* terms;
-(IBAction)failure:(id)sender;
-(IBAction)cancel:(id)sender;
-(IBAction)cancelSignIn:(id)sender;
-(IBAction)hideUserName:(id)sender;
-(IBAction)hidePassword:(id)sender;
-(IBAction)hideTitle:(id)sender;
-(void)textViewDidBeginEditing:(id)sender;
-(IBAction)displayPicker:(id)sender;
-(IBAction)dismissPicker:(id)sender;
-(IBAction)showTerms:(id)sender;
-(IBAction)signOut:(id)sender;
-(IBAction)CancelOut:(id)sender;
-(IBAction)ToOut:(id)sender;
-(IBAction)Public:(id)sender;
-(IBAction)Private:(id)sender;
-(IBAction)Unlisted:(id)sender;
-(IBAction)textFieldReturn:(id)sender;
@property (nonatomic, retain)IBOutlet UIButton *SignOutButton;
@property (nonatomic, retain)IBOutlet UIButton *cancelOutButton;
@property (nonatomic, retain)IBOutlet UIButton *toOutButton;
@property (nonatomic, retain)IBOutlet UIButton *termsButton;
@property (nonatomic, retain)IBOutlet UILabel *toptitle;
@property (nonatomic, retain)IBOutlet UILabel *movieTitle;
@property (nonatomic, retain)IBOutlet UILabel *descp;
@property (nonatomic, retain)IBOutlet UILabel *tags;
@property (nonatomic, retain)IBOutlet UILabel *catag;
@property (nonatomic, retain)IBOutlet UILabel *account;
@property (nonatomic, retain)IBOutlet UILabel *pub;
@property (nonatomic, retain)IBOutlet UILabel *pub1;
@property (nonatomic, retain)IBOutlet UILabel *unlist;
@property (nonatomic, retain)IBOutlet UILabel *unlist1;
@property (nonatomic, retain)IBOutlet UILabel *priv;
@property (nonatomic, retain)IBOutlet UILabel *priv1;
@property (nonatomic, retain)IBOutlet UILabel *pubdef;
@property (nonatomic, retain)IBOutlet UILabel *unlistdef;
@property (nonatomic, retain)IBOutlet UILabel *privdef;
@property (nonatomic, retain)NSDictionary *pictureDictionary3;
@property (nonatomic, retain)NSDictionary *pictureDictionary4;
@property (nonatomic, retain)IBOutlet UIButton *cancel;
@property (nonatomic, retain) IBOutlet UITextField *number;
@property (nonatomic, copy) NSDictionary *titleTextAttributes;
@property(nonatomic, assign) UIModalTransitionStyle modalTransitionStyle;
@property (nonatomic, retain) IBOutlet UILabel *authfailed;
@property (nonatomic, retain) IBOutlet UILabel *YouTubesignin;
@property (nonatomic, retain) IBOutlet UILabel *YouTubesignout;
@property (nonatomic, retain) IBOutlet UILabel *YouTubesignoutacc;
@property (nonatomic, retain) IBOutlet UITextView *errorfailed;
-(IBAction)publish:(id)sender;
-(IBAction)SignInSave:(id)sender;

This is one example.  I'm sorry there is so much code but I thought I should include everything for you to look at

A: I suspect the problem is because of the compiler being too new for used SDK. The new clang will enable ARC, but old SDK is not made to compile with ARC.


text:
Q: Why is my algorithm timing out? Here's the problem (from Leetcode):
Given an unsorted array of integers, find the length of longest increasing subsequence.

Example:

Input: [10,9,2,5,3,7,101,18]
Output: 4
Explanation: The longest increasing subsequence is [2,3,7,101], therefore the length is 4.
Note:

There may be more than one LIS combination, it is only necessary for you to return the length.
Your algorithm should run in O(n2) complexity.

Here's my solution:
memo = {}
def lis_calc(lower_bound, offset):
    if memo.get((lower_bound, offset), None):
        return memo[(lower_bound, offset)]
    if offset >= len(nums):
        return 0
    if nums[offset] > lower_bound:
        res = max(1 + lis_calc(nums[offset], offset + 1), lis_calc(lower_bound, offset + 1))
    else:
        res = lis_calc(lower_bound, offset + 1)

    memo[(lower_bound, offset)] = res
    return memo[(lower_bound, offset)]

In the worst case (list is already sorted ascending order), we'll have NxN unique function calls, (N values for each arg in pair). However, my algorithm is timing out for very large inputs, which suggests that my algorithm does not have a worst case time cost of O(NxN). Am I doing something incorrectly here? Seems like a straightforward implementation of DP + memoization. The test input that it's timing out on is list(range(1,2501))
I invoke the function via lis_calc(float('-inf'), 0)

A: Your algorithm may not be quadratic, but exponential.
Look at this code:
if nums[offset] > lower_bound:
    res = max(1 + lis_calc(nums[offset], offset + 1), lis_calc(lower_bound, offset + 1))

At each step, in the worst case, you make two calls. And each of those two calls, worst-case, makes two calls. And each of those four call makes two calls, and so on.
Your algorithm could still be polynomial if one of two things were true:

*

*If at least half of those new calls were memo-cached, or

*If it were guaranteed that a worst case would reduce to the lower-bound case (which becomes linear) in at worst log N steps.

But as far as I can tell, neither of those is true. So, worst case, your algorithm takes O(2**N) steps. Which is why it's too slow.

Or… maybe that's not true, maybe it's just taking quadratic time with an extra constant factor, and 2500 is right near the edge of where they expected your code to work comfortably, and you just didn't quite pass?
Each time you double the calls, you aren't going to cache half of them—but you should be caching half of N-1 of them. So your total steps should work out to N * (N+1) + 1 if everything is going right, but if you got it slightly wrong that could be enough to be off by a factor of 4… Although really, I don't think it would be a great test if a constant factor of 4 at even the very largest number they test is enough to make a difference.


text:
Q: git bundle stashed code I have a specific set of code stashed in git and would like to bundle it up in order to transfer it to a different clone on a separate PC, but I have not figured out how to reference the stash in the bundle command.
stash@{0}: On issue/789: Something I do not want bundled
stash@{1}: WIP on issue/456: Something I do want bundled
stash@{2}: On issue/123: Something else I do not want bundled

I have tried:
git bundle create My-WIP.bundle stash@{1}

but get the following error:
error: Refusing to create empty bundle.

I can confirm that stash@{1} is not empty. Does the bundle command not support the stash? Is it possible to do what I'm trying to do?

A: First, a quick note: each stash is actually just a set of commits, in a particular format (a "stash bag") that is not on any branch.  (The easiest thing to do here is probably to convert the stash to a branch, which makes it all much simpler.  See the git stash branch section of this answer for details.)

Does the bundle command not support the stash?

This is correct: it does not—at least, not in the way you are trying to use it.  But there is an easy(ish) fix.
As noted in the git bundle documentation, the <git-rev-list-args> arguments is:

A list of arguments, acceptable to git rev-parse and git rev-list (and containing a named ref, see SPECIFYING REFERENCES below)

(boldface mine).  The section they refer to goes on to say:

git bundle will only package references that are shown by git show-ref: this includes heads, tags, and remote heads. References such as master~1 cannot be packaged ...

Although their example uses master~1, anything that is not an actual reference name falls afoul of this problem, including reflog references like stash@{1}.
The solution, then, if you really want to do it like this, is to give the hash ID a proper reference name, such as a branch or tag name.  Let's use a tag name here:
git tag temp-tag stash@{1}

Now you have a tag and can create a bundle (or, simpler, just push or fetch the tag across the network so that you need not compute an appropriate basis or set of bases).  To avoid making an enormous bundle you can give some appropriate base as a stop point, e.g.:
git bundle create foo.bundle temp-tag ^master

(assuming ^master is an appropriate stop point).
You can now delete the tag locally:
git tag -d temp-tag

and transfer the bundle and run git fetch on it on the other system, to create the tag there.  (Or, again, instead of messing with git bundle, just fetch or push the tag using a network protocol such as git:// or ssh:// between the two computers, or to a server.)
You now have a tag, temp-tag, that works as a stash.  The regular git stash commands work fine when given this tag:
git stash apply temp-tag

for instance.  Deleting the tag deletes the name for this set of commits.