text:
Q: Mongoose ValidationError: Product validation failed: CountInStock: Path `CountInStock` is required I am a beginner to React.I am working in MERN stack project and I am following this tutorial. In my case, connection to the DB was success. However, I was unable to display products in my Home screen and when I tried with this link http://localhost:5000/api/seed nodemon app get crashed and display this error.
(node:28916) [MONGODB DRIVER] Warning: collection.remove is deprecated. Use deleteOne, deleteMany, or bulkWrite instead.
(Use `node --trace-warnings ...` to show where the warning was created)
D:\Github\Ecommerce-mern\backend\node_modules\mongoose\lib\document.js:2965
    this.$__.validationError = new ValidationError(this);
                               ^
ValidationError: Product validation failed: CountInStock: Path CountInStock is required.
at model.Document.invalidate (D:\Github\Ecommerce-mern\backend\node_modules\mongoose\lib\document.js:2965:32)
at D:\Github\Ecommerce-mern\backend\node_modules\mongoose\lib\document.js:2754:17
at D:\Github\Ecommerce-mern\backend\node_modules\mongoose\lib\schematype.js:1333:9
at processTicksAndRejections (node:internal/process/task_queues:78:11) {
errors: {
CountInStock: ValidatorError: Path CountInStock is required.
at validate (D:\Github\Ecommerce-mern\backend\node_modules\mongoose\lib\schematype.js:1330:13)
at SchemaNumber.SchemaType.doValidate (D:\Github\Ecommerce-mern\backend\node_modules\mongoose\lib\schematype.js:1314:7)
at D:\Github\Ecommerce-mern\backend\node_modules\mongoose\lib\document.js:2746:18
at processTicksAndRejections (node:internal/process/task_queues:78:11) {
properties: {
validator: [Function (anonymous)],
message: 'Path CountInStock is required.',
type: 'required',
path: 'CountInStock',
value: undefined
},
kind: 'required',
path: 'CountInStock',
value: undefined,
reason: undefined,
[Symbol(mongoose:validatorError)]: true
}
},
_message: 'Product validation failed'
}
[nodemon] app crashed - waiting for file changes before starting...
Here is my Schema:
import mongoose from 'mongoose';

const productSchema = new mongoose.Schema(
  {
    name: { type: String, required: true, unique: true },
    slug: { type: String, required: true, unique: true },
    image: { type: String, required: true },
    brand: { type: String, required: true },
    category: { type: String, required: true },
    description: { type: String, required: true },
    price: { type: Number, required: true },
    CountInStock: { type: Number, required: true },
    rating: { type: Number, required: true },
    numReviews: { type: Number, required: true },
  },
  {
    timestamps: true,
  }
);

const Product = mongoose.model('Product', productSchema);
export default Product;

Here is my server.js:
import express from 'express';
import mongoose from 'mongoose';
import dotenv from 'dotenv';
import seedRouter from './routes/seedRoutes.js';
import productRouter from './routes/ProductRoutes.js';

dotenv.config();

mongoose
  .connect(process.env.MONGODB_URI)
  .then(() => {
    console.log('connected to db');
  })
  .catch((err) => {
    console.log(err.message);
  });

const app = express();
app.use('/api/seed', seedRouter);
app.use('/api/products', productRouter);

const port = process.env.PORT || 5000;
app.listen(port, () => {
  console.log(`server at http://localhost:${port}`);
});

And Here is my seedRoutes.js file :
import express from 'express';
import Product from '../models/productModel.js';
import data from '../data.js';

const seedRouter = express.Router();

seedRouter.get('/', async (req, res) => {
  await Product.remove({});
  const createdProducts = await Product.insertMany(data.products);
  res.send({ createdProducts });
});
export default seedRouter;

And my data.js file :
const data = {
  products: [
    {
      name: 'Nike Soccer Football',
      slug: 'nike-soccer-football',
      category: 'Shoes',
      image: '/images/p1.jpg',
      price: 120,
      countInStock: 10,
      brand: 'Nike',
      rating: 4.5,
      numReviews: 10,
      description: 'high quality pair of shoes',
    },
    {
      name: 'Adidas Soccer Football',
      slug: 'adidas-soccer-football',
      category: 'Shoes',
      image: '/images/p2.jpg',
      price: 250,
      countInStock: 0,
      brand: 'Adidas',
      rating: 4.0,
      numReviews: 10,
      description: 'high quality pair of shoes',
    },
    {
      name: 'Nike Slim Pant',
      slug: 'nike-slim-pant',
      category: 'Pants',
      image: '/images/p3.jpg',
      price: 65,
      countInStock: 5,
      brand: 'Nike',
      rating: 4.5,
      numReviews: 14,
      description: 'high quality product',
    },
    {
      name: 'Adidas Fit Pant',
      slug: 'Adidas-fit-pant',
      category: 'Pants',
      image: '/images/p4.jpg',
      price: 25,
      countInStock: 15,
      brand: 'Puma',
      rating: 4.5,
      numReviews: 10,
      description: 'high quality pair of shoes',
    },
  ],
};

export default data;

Can I know the error that I have done here? Is it regarding the file type that I have imported in server.js file?

A: I think it is rather a typo. You have CountInStock in the schema definition, but countInStock in your data file. Javascript object keys are case-sensitive and therefore the case should match.


text:
Q: Diagonalizability via self-inverse matrix Suppose $A\in K^{n\times n}$ is diagonalizable via an involutory (or self-inverse) matrix, i.e. there exist a diagonal $D\in K^{n\times n}$ and an involutory transformation $T\in K^{n\times n}$ (i.e. $T^{-1}=T$) such that
$$A=TDT^{-1}(=TDT)$$
What would be a characterization of such matrices, in particular for $K=\mathbb{C}$ (and $K=\mathbb{R}$)?

A: Clearly, $A$ is diagonalizable via involutary (denoted by DVI) IFF $A$ admits a basis of eigenvectors $(e_i)$ s.t. $[e_1,\cdots,e_n]$ is involutary.
Assume $K=\mathbb{C}$.
When $n=2$, every $A\in M_2$ that is diagonalizable is DVI and we have the same result if $K=\mathbb{R}$.
When $n=3$, the algebraic set $Z_3=\{A\in M_3; A\text{ is DVI }\}$ has dimension $7$ ($7$ degrees of freedom). In particular, a randomly chosen  matrix in $M_3$ is not in $Z_3$ with probability $1$.
More generally, I think that $dim(Z_n)=dim(Inv_n)+n$, where $Inv_n=\{A\in M_n;  A^2=I_n\}$ is an algebraic set of dimension $\approx n^2/2$.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Customize existing MS Word Template document's variables & Content Controls I'm looking to adapt this official MS-Word Template document to our company's needs, but I can't locate the source for the variables-in place and how they're managed.

This was a great read but I still can't find where and how the variables on this document are sourced and linked together. 'alt-F9' shows me the existing document-field code implementations, but I believe these are mapped XML schemas that aren't discernable from the MS word user interface. How do I view and edit the existing mapped XML schemas? (If that is what they are)
Thank you.

A: What you are asking could be the subject of a book.
Normally here we try to give answers but not write books. Content Controls can be linked or mapped to XML nodes but are not required to be so linked. The key through the user Interface is the Developer Tab and possibly the "document properties" found under Insert > Quick Parts which are discussed in the second reference link below.
That template could definitely be improved by using mapped content controls for information that is entered in multiple places. One of these could also be used to have the client name and other information in the footer or header.
Here are some references:

*

*Word Content Controls by Greg Maxey

*Repeating Data Using Document Property Content Controls and other Mapped Controls (my page)

*Mapped Content Controls by Greg Maxey

*Content Controls - Microsoft Documentation - focus is on changes made with Word 2013

*Walkthrough: Bind content controls to custom XML parts - Microsoft Documentation (requires Visual Studio)

*How to Add custom XML parts to document-level customizations - Microsoft Documentation (requires Visual Studio)

*Custom XML parts - Microsoft Documentation (requires Visual Studio)
I recommend starting with the first three unless you are already into VSTO solutions. They show how to work through the user interface of Word rather than external coding.
Here are free Add-Ins that make mapping Content Controls relatively simple. They are from Greg Maxey and Graham Mayor.

*

*Insert Content Control Add-In by Graham Mayor

*Content Control Tools by Greg Maxey

*(probably more than you need) CC/V/BM & DP Tools Add-In by Greg Maxey Content Control / Document Variable / Bookmark and Document Property Editor Add-In)
Other Thoughts
In your question, you are conflating variables, fields, and Content Controls. My answer deals with Content Controls, which are not fields and which can relate to variable information. Here is a list of the usual Word Fields with links to documentation. Document Properties can also hold variable information which can be shown in a DocProperty Field. These document properties are different, though from the ones discussed in my article and are not linked or mapped to XML.
Work on Content Controls through the User Interface is best done using the Windows desktop application
The Macintosh interface currently does not encompass creation or modification of Content Controls. It can be done through vba, though. At some point this may change but it has been more than ten years waiting for Microsoft to add this to their Mac versions. (March 2022) Content Controls for the Mac OS by John Korchok


text:
Q: Display different content for javascript enabled users and different content for javascript disabled users on the same page in Mediawiki? I placed this code .scriptonly { display: none; } in Mediawiki:Noscript.css and then used <div class="scriptonly">Content </div> on my page and the content displays only for javascript enabled users.
How do i do same for users who have javascript disabled?

A: You can use <noscript> tag
https://www.w3schools.com/tags/tag_noscript.asp

A: <noscript> isn't even necessary, and it is not supported in XHTML
You can initially set the class to .scriptonly{display:none;}.
Then you can add fillowing code, which will only be executed if user has enabled javascript, otherwise it will be ignored. You can toggle style properties if desired.
<script type="text/javascript">
     document.querySelectorAll(".scriptonly").style.display="block";
</script>

A: Hide element #foo from clients which have javascript:
html.client-js #foo { display: hidden; }

Hide element #foo from clients which do not have javascript:
html.client-nojs #foo { display: hidden; }


text:
Q: Is the "Not Programming Related" site proposal appropriate? I've been looking forward to Not Programming Related since before Area 51 existed (anyone remember StackOverflowOverflow?).  NPR even has Jeff's support.  But lately I've been wondering whether it's an appropriate site for the SE family.
As far as I can tell, all of the SE sites are holding at least moderately firmly to the "don't make subjective discussion posts, this is a place for questions that can be answered" mantra.  And let's face it, that's kind of what makes an SE site an SE site.  But NPR is, by its very nature, for more subjective, discussion-y questions.  Is making NPR a reality worth breaking with the SE brand?  I'm worried that it'll embolden people who want to have discussions on other SE sites.  Will it lead to other SE sites asking for subjective spinoffs?  Would that be bad?

A: That's what betas are for.
I think the name is not appropriate, but it would be worth (and perhaps interesting) to try the engine on this kind of subjective, discussion-y questions as you call them.
If it doesn't work, the site just won't graduate from beta and that would be it.

A: I'm personally all for these proposals and any other similar "spin-offs" that mean we can migrate all questions like Favorite Programmer Cartoon to those sites.  Mostly because I'm sick of voting to close questions only to be asked "If Favorite Programmer Cartoon gets to stay why can't my question?".


text:
Q: How to draw an arrow with a circle trajectory with animation on canvas android? guys
I try to implement an black arrow which is on head of arc. The arrow animates with the arc, and has circle trajectory. I already implement the red arc with animation based on different values.
Please see the attachment.
How can I implement the black arrow on top of red arc? since if I do the same way as red arc animation, the black arrow will print the trajectory which is not desired.
Thanks in advance!
Leon

A: all you need is Canvas.
Here is example.
This is the your draw class:
public class CircleView   extends View
{
    public CircleView(Context context) {
        super(context);
        path = new Path();
        paint = new Paint();
    }

    @Override
    protected void onDraw(Canvas canvas) {
        super.onDraw(canvas);

        float angle = 270;

        float radius = canvas.getWidth()/3;
        float x = canvas.getWidth()/2;
        float y = canvas.getHeight()/2;
        final RectF oval = new RectF();

        paint.setStyle(Paint.Style.STROKE);
        paint.setStrokeWidth(25);

        oval.set(x - radius, y - radius, x + radius,y + radius);

        // Draw circle
        paint.setColor(Color.RED);
        canvas.drawArc(oval, 135, angle, false, paint);
        paint.setColor(Color.BLUE);
        canvas.drawArc(oval, angle, 405-angle, false, paint);

        paint.setStyle(Paint.Style.FILL);
        paint.setColor(Color.BLACK);

        float l = 1.2f;
        float a = angle*(float)Math.PI/180;
        // Draw arrow
        path.moveTo(x+ (float)Math.cos(a) *radius, y + (float)Math.sin(a) * radius);
        path.lineTo(x+ (float)Math.cos(a+0.1) *radius*l, y + (float)Math.sin(a+0.1) * radius*l);
        path.lineTo(x+ (float)Math.cos(a-0.1) *radius*l, y + (float)Math.sin(a-0.1) * radius*l);
        path.lineTo(x+ (float)Math.cos(a) *radius, y + (float)Math.sin(a) * radius);
        canvas.drawPath(path, paint);
    }
    private Path path;
    private Paint paint;
}

This is activity for it:
public class MyActivity extends Activity {
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(new CircleView(this));
    }
}

For angle == 200 you will see image like this:

Working copy for IntelliJ Idea: https://github.com/weerf/android_circle


text:
Q: Firebase v9 modular - Can't find variable: IDBIndex I'm using React Native and Expo and I'm trying to use Firebase V9 (Modular version). I'm running into an error whenever I try to use a firebase function outside of my config file. For example, I have the signUpWithEmail function in firebase.tsx, but when I try to use it in my SignUpScreen.tsx, it gives me a
Can't find variable: IDBIndex.
Seems like it has to do with my node_modules??
Maybe the wrong versions?
I also don't have Google Analytics enabled.
Here are my code files:
firestore.ts:
import { initializeApp } from 'firebase/app';
import { createUserWithEmailAndPassword, getAuth } from 'firebase/auth';
import Constants from 'expo-constants';

const firebaseConfig = {
  apiKey: Constants.manifest?.extra?.firebaseApiKey,
  authDomain: Constants.manifest?.extra?.firebaseAuthDomain,
  projectId: Constants.manifest?.extra?.firebaseProjectId,
  storageBucket: Constants.manifest?.extra?.firebaseStorageBucket,
  messagingSenderId: Constants.manifest?.extra?.firebaseMessagingSenderId,
  appId: Constants.manifest?.extra?.firebaseAppId,
};

const app = initializeApp(firebaseConfig);
const auth = getAuth(app);

// AUTHENTICATION // ---------------------------------------------------------
export const signUpWithEmail = async (fName: string, lName: string, email: string, password: string) => {
    try {
        await createUserWithEmailAndPassword(auth, email, password);
        console.log('Success!')
    } catch (e) {
        console.log(e);
    }
}

SignUpScreen.tsx:
import React, { useState } from 'react';
import { StyleSheet, View} from 'react-native';
import MyButton from '../components/MyButton';
import MyField from '../components/MyField';
import { signUpWithEmail } from '../services/firebase';

export default function SignUpScreen() {
  const [fName, setFName] = useState("");
  const [lName, setLName] = useState("");
  const [email, setEmail] = useState("");
  const [password, setPassword] = useState("");

  return (
    <View style={styles.container}>
        <MyField title='First Name' type='text' onChangeFn={setFName}/>
        <MyField title='Last Name' type='text' onChangeFn={setLName}/>
        <MyField title='Email' type='text' onChangeFn={setEmail}/>
        <MyField title='Password' type='text' onChangeFn={setPassword}/>
        <MyButton text="Sign Up" type="primary" size="large" onPressFn={
          () => { signUpWithEmail(fName, lName, email, password) }} />
    </View>
  );
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    backgroundColor: '#fff',
    alignItems: 'center',
    justifyContent: 'center',
  },
  fixToText: {
    flexDirection: 'column',
    justifyContent: 'space-between',
    alignItems: 'center',
  },
});

Here is my error when I run the app:

ReferenceError: Can't find variable: IDBIndex
at node_modules/react-native/Libraries/Core/ExceptionsManager.js:104:6 in reportException
at node_modules/react-native/Libraries/Core/ExceptionsManager.js:172:19 in handleException
at node_modules/react-native/Libraries/Core/setUpErrorHandling.js:24:6 in handleError
at node_modules/@react-native/polyfills/error-guard.js:49:36 in ErrorUtils.reportFatalError
at node_modules/metro-runtime/src/polyfills/require.js:204:6 in guardedLoadModule
at http://192.168.1.189:19000/node_modules/expo/AppEntry.bundle?platform=ios&dev=true&hot=false&strict=false&minify=false:140947:3 in global code

A: Looks like after trying many different version numbers, "firebase": "^9.4.1" seems to finally get rid of the error! I based it off of the SDK used in this Firebase document:
https://firebase.google.com/docs/firestore/quickstart#web-version-9

A: I am glad that you finally get rid of the issue, it seems like Firebase 9 version has some issues I found here https://github.com/expo/expo-cli/issues/3066 the solution, which is basically to downgrade the Firebase version to 7 or 8.


text:
Q: Glib main loop events Could anyone provide me with way to connect to glib main loop events? I see no well-written tutorials about it nor description in documentation. I've never done it before and didn't use glib in any way. Is it even event-oriented or more like WinAPI?
Would be grateful for answers.

A: For timers use g_timeout_add if you don't have hard synchronization requirements. To listen on sockets, give a look to GIOChannel.


text:
Q: Access to user's email I want to put the email of user in my model Article.
from django.db import models
from django import forms
from django.contrib.auth.models import User

    class Article(models.Model):

    #auteur
    email = models.ForeignKey(User.email, unique=True)
    name = models.CharField(max_length=200)
    #titre
    title = models.CharField(max_length=200)
    title_en = models.CharField(max_length=200)
    subtitle = models.CharField(max_length=200)
    subtitle_en = models.CharField(max_length=200)

A: What you have written has no sense. You have to keep a ForeignKey on the user, and then access to his email through user.email:
class Article(models.Model):

    #auteur
    user = models.ForeignKey(User, unique=True)

    #titre
    title = models.CharField(max_length=200)
    title_en = models.CharField(max_length=200)
    subtitle = models.CharField(max_length=200)
    subtitle_en = models.CharField(max_length=200)

Then, Article.user.username (or self.user.username inside an Article method) gives you the name and Article.user.email the e-mail.
Some explanations
In Django, you can create ForeignKey only on Model object, and not object field. This will be translate in SQL as a classic reference between tables. (If you check your Article SQL database, you'll see a user_id field. This field will contains the ID of the user, extract from the auth_user table, which created the Article.


text:
Q: How can I ensure my programmatic uploads are done in the correct order? In our application, we store two copies of a file - an approved one and an unapproved one. Both track their versions separately. When the unapproved is then approved, all of its versions are added as new versions to the approved file. To do this properly, my code has to upload each version separately into the approved folder, and update the item each time with that version's information.
For some reason, though, this doesn't always work properly. In my latest scenario, the latest version was uploaded first, and then all of the remaining versions were uploaded afterwards. However, my code explicitly is supposed to upload the other versions first, that's the order I wrote it in. Why is this happening? And if it is possible, how do I ensure that the versions are uploaded in the correct order?
Clarification - It's not a problem with the enumeration - I'm getting the previous versions in the correct order. What is happening is that the final version, which is written after the loop, is being uploaded before the loop. Which really doesn't make any sense to me.

Here's a condensed version of the relevant code.
//These three are initialized earlier in the code.
SPList list; //The document library
SPListItem item; //The list item in the Unapproved folder
int AID; //The item id of the corresponding item in the Approved folder.

byte[] contents; //Not initialized.

/* These uploads are happening second when they should happen first. */
if (item.File.Versions.Count > 0)
{
    //This loop is actually a separate method call if that matters.
    //For simplicity I expanded it here.
    foreach (SPFileVersion fVer in item.File.Versions)
    {
        if (!fVer.IsCurrentVersion)
        {
            contents = fVer.OpenBinary();
            SPFile fSub = aFolder.Files.Add(fVer.File.Name, contents, u1, fVer.CreatedBy, dt1, fVer.Created);
            SPListItem subItem = list.GetItemById(AID);

            //This method updates the newly uploaded version with the field data of that version.
            UpdateFields(item.Versions.GetVersionFromLabel(fVer.VersionLabel), subItem);
        }
    }
}

/* This upload happens first when it should happen last. */
//Does the same as earlier loop, but for the final version.
contents = item.File.OpenBinary();
SPFile f = aFolder.Files.Add(item.File.Name, contents, u1, u2, dt1, dt2);
SPListItem finalItem = list.GetItemById(AID);
UpdateFields(item.Versions[0], finalItem);

item.Delete();

A: Why not simplify the code to use "for" instead of "foreach":
for (int i = item.File.Versions.Count - 1; i >= 0; i--)
{
    contents = item.File.Versions[i].OpenBinary();
    SPFile f = aFolder.Files.Add(item.File.Versions[i].File.Name, contents, u1, item.File.Versions[i].CreatedBy, dt1, item.File.Versions[i].Created);
    SPListItem subItem = list.GetItemByID(AID);
    UpdateFields(item.Versions.GetVersionFromLabel(item.File.Versions[i].VersionLabel), subItem);
}

This should then update in reverse order, with the first item being last.

A: I think the item.File.Versions collection just returns a bunch of items and does not return them in any guaranteed order.  You will be better off walking them in order explicitly than trying to foreach them and hope they come in the right order.  As you've already figured out, they don't.


text:
Q: Upgrading Ubuntu 15.10 to Xenial Xerus I currently have Ubuntu 15.10 and I want to upgrade that to Xenial Xerus ( 16.04 LTS ),
I invoked this in terminal :
update-manager -d

but when the windows pops out and it downloads some files from repository
it says :
The software on this computer is up to date

It doesn't find
the new release
What am I missing?

A: You need to add sudo to the command to run it as an administrator for update-manager to work properly. So you would run sudo update-manager -d. Rule of thumb: If  a command modifies your system, it needs sudo.


text:
Q: How to take off html elements from Content Keywords in Webmaster Tools? I have found a template. However, in the webmaster tools, HTML elements take over keywords. Why is this happening? I believe there's a problem in the HTML code of the template. How do I take off html elements from the Content Keywords in Webmaster Tools?
Here's the website if you'd like to see the HTML:
http://www.bestoffernet.com
And here's a picture of the problem:

A: I can see a lot display:none text in your pages.

<textarea id="postData-754007445393546837" style="display:none;">
"

Many people around the world have a slow connection and in order to see a page like this one, they take a whole cup of coffee while it's loading for them. Unfortunately, This tutorial isn't for them, because, in fact, this trick requires a good connection which is not necessarily fast.

If you like to see pages loading faster, willing to download or upload very big files, or only looking for a way to unlock a blocked website in your country or area, etc. then you've come to the right place.

How to surf the internet at the speed 500 Mbps?

In order to surf the internet at 500 Mbps, you just need to register in Rabbit. This is a chatting website that allows its users to use webcam, microphone or text only. But, we can also use it as a browser to surf the internet! Here's how to do it.

1) Go to Rabbit then click on Sign up, after that choose the way you like to register your new account.

2) Confirm your account by clicking on the link you've received on your email

3) Once registered, the website will ask you the following question "How do you want to Rabbit? Take your pick:", Here, choose Messages only. COOL! After that, you just need to click on Rabbitcast Launchpad (see the following picture)

4) When you click on it, a new notification will appear asking you to choose from a list of suggested websites like Youtube, Hulu and Netflix. Or you can merely enter any website you wish. I tried Bestoffernet.com

5) Here's how it looks like in the browser: ( if you don't like the quality of the image, turn it from LD to HD)

So, this is the best way to watch youtube videos at 1080p HD on a slow connection, without interruptions.

I tried "speed test" and here is the result, the speed exceeds 500 Mbps:

Note that this service works just like a VPS. You can download files, save them and then upload them to services like Dropbox in a very short time.

I hope you like this trick which is not going to last for a long period, so enjoy it!

If you have any question or anything, don't hesitate to use the comment box below. I will be glad to hear from you.

</textarea>

Godaddy

GoDaddy is one of the biggest hosting and domain name registrar companies on the internet today. Its services are so popular and widespread that even those who are not concerned about web hosting and domain names have surely heard about it in some way.

Some statistics shows that GoDaddy, in 2014, had more than 59 million domain names and is constantly growing, making it the world's largest ICANN-accredited registrar. Wikipedia

In short, services on GoDaddy are of high caliber and the 12 million customers they serve cannot be wrong. I personally tried their services and I'm more than satisfied.

Coupon Code $0.99 Domain Name
I'm writing this article for people looking for coupon codes with which they can get a high-quality domain name such as ".COM , .NET or CO.UK ," and many others, at a reduced priced.

What you need to do is remove all those. Forget about removing them from just the Content Keyword Report they are there because they are acutaly words in you html.
So the reason this report is on your search console is because you ACTUALY have all this text on your page. And at the same time it is considered a bad SEO practice from your site.


text:
Q: ssh get old public key from backed up private key I backed up and encrypted my private key but nothing else.
I am trying to get my public key out of it but don't know how. I am trying ssh-keygen -y -f ~/.ssh/id_rsa > ~/.ssh/id_rsa.pub but it says permissions are too open on id_rsa so the key will be ignored.
Did I screw up or is it possible to get my public key back?

A: If openssh refuses to read the file, you could use openssl
openssl rsa -in ~/.ssh/id_rsa -pubout -out ~/.ssh/id_rsa.pub

Nevertheless, you won't be able to use any of them until you correct your permissions.
~ must be 775 at most, ~/.ssh 700, ~/.ssh/id_rsa 600


text:
Q: How to store critically sensitive information such as secret, key, token, encryptionKey in iOS application When we talk about securing iOS application we often forget to secure most critically sensitive information such as secret, key, token, encryptionKey.  This information is stored in iOS binary. So none of your server side security protocol will help you.
There are lots of suggestion that we should not store such information in the app but store in the server and get it via SSL secured web service call. But this is not possible for all application. E.g. if my application does not need web service at all.
In iOS app we have following option to store information.

*

*UserDefault: Not appropriate for this case

*String Constant: Not appropriate for this case. Can be reverse
engineer to retrieve or just use strings command

*Secure Database: Store in Secure and encrypted Database. But again have responsibility to secure database username and password.

*KeyChain: Best to store critical info. But we cannot save information before installing the app. To store in the keychain, we first need to open the app, read from some source and store in the keychain. Not appropriate for our case either.

*Custom Hash String Constant: Not to directly use secret, token, key from service provider (mixpanel, paypal), instead use hash version of that information from custom key. This is also not perfect solution. But add complexity during hacking.

Kindly send some awsome solution to this problem.

A: 1) Internet Connection Required
1.1) Push Notifications
Great way to have a secure data exchange could be to use (silent) push services from Apple, those use the apns and send data through https - more Details 3.1
1.2)
A more or less similar approach is also used when distributing new user certificates to already deployed applications, if a reinstall of the application is no opportunity AND the application requires a working internet connection anyway.
Downside: working network connection required and basically the information is coming to the application, when it is already being executed => seems not to be appropriate for your case. (see step 4)
2) Static data (as there will be no exchange without network connection / communication partner)
Encryption of data with private key being provided in the bundle itself. Whether it is now a string or a hash, which can be reverse engineered with functions you got emebedded in your application.
Since iOS9 it is pretty hard to decompile iOS applications and basically you will mainly have a look into the provided header-files. So if you had such a function, string, hash value or whatever, make sure you got it in your .m-file!
But again: if the information is not device or user specific, just a secret across your own micro environment, valid across all devices, you would have to provide the encrypted data AND the decryption method in the same bundle, if there is no update process / information exchange or something else, you can think of.
Good for encryption:
iOS System.Security https://developer.apple.com/reference/security
or simply openssl
The difference between your described keychain approach is:
You got a value, which WILL be encrypted and stored securely.
(2) describes the approach to have an encrypted and stored (in bundle) semi secure value, which WILL be decrypted
3) Information exchange
You describe critical data, which was hashed by another instance. Great! - Make sure, relly make sure, the instance you are talking to is really the instance you expect to be (Network Hooking prevention with ssl certificate pinning etc, but even here you might have intruder (men-in-the-middle)). And you will (probably) have a certificate being provided in your application bundle, to ensure the authenticity of the communication server - here you go again, data that is supposed to ensure a secure process between certain instances of your micro environment. Nevertheless, this data is being provided in your application's bundle.
3.1 Secure Information Exchange extended - Silent Push
Make use of Apple's servers to exchange your secrets for this purpose. If you just need to exchange small data chunks. I would recommend to use silent push notifications to the user, those do even work without explicit permission from the user. Huge advantage: In case your secrets or keys change, you can inform users as soon as possible about the change. They will likely only need the change, when they receive new data, which should reliably work in most cases. Exception: Data exchange in local networks or via bluetooth, in this case I would recommend to provide a notification to the user to have the requirement to update a local decryption key. Or exchange the key in this format as well. Once again: I am leaking some detailed information about your environment architecture.
Downside: You don't know, whether a user just used your app for the first time, until the user "tells" you so.
https://developer.apple.com/library/content/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/APNSOverview.html#//apple_ref/doc/uid/TP40008194-CH8-SW1
3.1 Secure Information Exchange extended - In App Purchase
Use a frree In-App Purchase for the user to get the data to your phone. Good point here: you can provide larger data chunks easily, as this should be an active request by the user, the user does expect certain processing time and should also be aware of the fact to require a working internet connection.
Downside: User would have to select this on purpose. Up until then the app would not work accordinly.
https://developer.apple.com/library/content/documentation/NetworkingInternet/Conceptual/StoreKitGuide/Introduction.html#//apple_ref/doc/uid/TP40008267
So, it just slightly differs from the approach (2) in its basic idea.
In short: Can you provide additional information, what kind of data you need to encrypt/want to store securely and whether you will have a network exchange or not?
Would need some more information here :-)
I would like to emphasize once again that an application on iOS is not that easy to decrypt anymore, even decompiling would not get everything, you expect it to get. For instance decryption tools like dumpdecrypt were only working properly up until iOS 8.4

A: It seems to me that the best way to do this is using the built in CloudKit. You can save your secrets in the CloudKit Dashboard and then fetch them on startup. Since CloudKit is only a transport layer you'll have to store the app secrets in the KeyChain.
I know you mentioned the KeyChain not being ideal for your use case (not sure why), but this is a good way of not including the secrets in your app. You can't get around fetching your app secrets from another source.
CloudKit access is secured using the system iCloud account and if there is no iCloud account you still access the iCloud servers securely. Another added benefit of this is that you can change your app secrets at any time, so if you want to be even more secure you can implement a rotation schedule.
Learn more about CloudKit

A: If you don't want to use your own backend then use Apple. You can configure On Demand Resources and keep data file with your key, token, any secret on Apple server. After first download you can write this data to Keychain which is secure enough. I'm guessing networking between iOS and Apple server is also secure enough.
On-Demand Resources Essentials
Accessing and Downloading On-Demand Resources

A: I agree with @Lobsterman and believe that the best way will be to use a combination of these.

*

*Don't include the secret information in the app initially.

*Deliver the secret key either as in-App purchase content ,on-demand resource or send it through push notification. This will add the benefit of changing the key periodically if you want and the change will take effect without any additional effort.

*Add the entry to keychain access once the content is delivered.

A: Cocoapods-keys might be a best option.
From cocoapods-keys doc's

Key names are stored in ~/.cocoapods/keys/ and key values in the OS X
  keychain. When you run pod install or pod update, an Objective-C class
  is created with scrambled versions of the keys, making it difficult to
  just dump the contents of the decrypted binary and extract the keys.
  At runtime, the keys are unscrambled for use in your app.
The generated Objective-C classes are stored in the Pods/CocoaPodsKeys
  directory, so if you're checking in your Pods folder, just add
  Pods/CocoaPodsKeys to your .gitignore file. CocoaPods-Keys supports
  integration in Swift or Objective-C projects.

Check out this link for installation, usage and more info : https://github.com/orta/cocoapods-keys

A: If the data is extremely sensitive then it should never be stored offline on device because all devices are crackable. If you still want to store on device then keychain is one option for storing data securely, However it's encryption is based on the pin code of the device. User's are not forced to set a pin, so in some situations the data may not even be encrypted. In addition the users pin code may be easily hacked.
A better solution is to use something like SQLCipher which is a fully encrypted SQLite database. The encryption key can be enforced by the application and separate from the user's pin code.


text:
Q: How to get rid of #DIV/0! in excel...need non-geek response I have searched the web for help in this issue, only to come across countless replies that simply throw a page long code up and expect us common folk to understand wtf they are talking about. So here I am, searching for someone who can guide me through this process like I am a toddler and not just reply with a link to some page-long code. I realize there is code involved, but I am not interested in a page long code for something that has to be much simpler. I simply want to remove these values from the rows, not do any math on the rows or anything. Whatever code you send me, please explain exactly what each set of cells means and how that is supposed to be input by me. Thanks for helping a dinosaur.

A: The error you are getting is because you are trying to divide something 0.
if you use this here in the Total column, =IFERROR(A2/B2, "") you will get a blank cell in place of that error.
     A    |  B    |TOTAL (A/B) |
     1    |   0    |            |
     2    |   1    |      2     |
     3    |   2    |     1.5    |
     4    |   3    | 1.333333333|

Puttin this in the total column and double clicking the little green square will copy this to all the cells below. If you still need clarification just comment.

instead of the empty space if you can add anything in the place of the error. Like =IFERROR(A2/B2,"THIS IS AN ERROR!!") and if there are any of those error bugs "this is an error" will replace it.


text:
Q: How are ground truth bounding boxes created for a deep learning training dataset? I'm working on a project where I'd like to use mask RCNN to identify objects in a set of images. But, I'm having a hard time understanding how bounding boxes(encoded pixels) are created for the ground truth data. Can anyone point me in the right direction or explain this to me further?

A: Bounding boxes are typically labeled by hand. Most deep-learning people use a separate application for tagging. I believe this package is popular:
https://github.com/AlexeyAB/Yolo_mark
I developed my own RoR solution for tagging, because it's helpful to distribute the work among several people. The repository is open-source if you want to take a look:
https://github.com/asfarley/imgclass
I think it's a bit misleading to call this 'encoded pixels'. Bounding boxes are a labelled rectangle data-type, which means they are entirely defined by the type (car, bus, truck) and the (x,y) coordinates of the rectangle's corners.
The software for defining bounding-boxes generally consists of an image-display element, plus features to allow the user to drag bounding-boxes on the UI. My application uses a radio-button list to select the object type (car, bus, etc); then the user draws a bounding-box.
The result of completely tagging an image is a text-file, where each row represents a single bounding-box. You should check the library documentation for your training algorithm to understand exactly what format you need to input the bounding boxes.
In my own application, I've developed some features to compare bounding-boxes from different users. In any large ML effort, you will probably encounter some mis-labelled images, so you really need a tool to identify this because it can severely degrade your results.


text:
Q: Convert vector to array index in R? Say that we have an array A, that has arbitrary dimension dim(A). Say that we have a coordinate index vector V. Is there any way to access the element of A with coordinates V? Doing something like A[V] doesn't work obviously. If V=c(1,2,3) then A[V] will just give us the 1st, 2nd, and 3rd element of A. What if we want A[1,2,3] instead? If we know dim(A) ahead of time, this is easy obviously. But what if we want to make code that works no matter how many dimensions A has?

A: We may use do.call to execute `[`.
v <- c(1, 2, 3)

do.call(`[`, c(list(A), v))
# [1] 22

To assign we have `[<-`.
A <- do.call(`[<-`, c(list(A), v, 99))

Check:
A[,,3]
# , , 3
#
# [,1] [,2] [,3]
# [1,]   19   99   25
# [2,]   20   23   26
# [3,]   21   24   27

Using @duckmayr's A
A <- array(1:(3^3), dim = c(3, 3, 3))

A: You can make use of eval(parse()), like so:
foo <- function(A, v) {
    stopifnot(length(v) == length(dim(A)))
    idx <- paste(v, collapse = ", ")
    return(eval(parse(text = paste0("A[", idx, "]"))))
}

A <- array(1:(3^3), dim = c(3, 3, 3))
v <- c(1, 2, 3)

foo(A, v)
# [1] 22
A[1, 2, 3]
# [1] 22

Update: Assignment
In the comments you also ask about assignment; it looks like you've got it sorted, but in case you or someone else finds it useful, you could use a replacement function:
`foo<-` <- function(A, v, value) {
    stopifnot(length(v) == length(dim(A)))
    stopifnot(is.atomic(value) & length(value) == 1)
    idx <- paste(v, collapse = ", ")
    eval(parse(text = paste0("A[", idx, "] <- value")))
    return(A)
}

foo(A, v) <- 2
foo(A, v)
# [1] 2


text:
Q: Castle Windsor IOC and Order of Appearance in Config File I'm new to Castle Windsor and am confused about the order in the config file.  This is taken from the GettingStarted1 sample.  The HttpServiceWatcher class takes an IFailureNotifier implementor in it's constructor.  However, no matter how I order the two components that implement this interface -- AlarmFailureNotifier and EmailFailureNotifier -- I always get EmailFailureNotifier.  I know you can override which is chosen using parameters and a "service lookup" reference, but I thought that the order of declaration is used when other mechanisms are not.
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <configSections>
    <section name="castle"
             type="Castle.Windsor.Configuration.AppDomain.CastleSectionHandler,Castle.Windsor" />
  </configSections>

  <castle>
    <components>

      <component
        id="httpservicewatcher"
        type="GettingStartedPart1.HttpServiceWatcher, GettingStartedPart1">
      </component>

      <component
        id="alarm.notifier"
        service="GettingStartedPart1.IFailureNotifier, GettingStartedPart1"
        type="GettingStartedPart1.AlarmFailureNotifier, GettingStartedPart1" />

      <component
        id="email.notifier"
        service="GettingStartedPart1.IFailureNotifier, GettingStartedPart1"
        type="GettingStartedPart1.EmailFailureNotifier, GettingStartedPart1" />

      <component
        id="form.component"
        type="GettingStartedPart1.Form1,GettingStartedPart1" />

    </components>

  </castle>
</configuration>

A: This was resolved with Castle 2.0 (that went RTM early last year).
The latest version of Castle is 2.1.1:
http://sourceforge.net/projects/castleproject/files/InversionOfControl/2.1/Castle-Windsor-2.1.1.zip/download
Castle's releases are always a bit tricky to find (they need to update their site).  I always refer to the Project list:
http://www.castleproject.org/castle/projects.html
You want: MicroKernal/Windsor

A: I don't know which version you're using, but I believe this was a bug some time ago and it has been corrected in the build server version. Try that one and see what happens.
Also, you could use default components like this: Castle Windsor and default components


text:
Q: Cant retrieve data from an SQL database using PHP and session variables I have a website with the following code in the header - but the PHP echos in the body are returning anything:
<?php
session_start();
print_r($_SESSION);

$user = $_SESSION['email'];
$query = "SELECT * FROM first_page_data WHERE email_address= '$user' ";

$result = mysql_query($query);
$row_buyerdetails = mysql_fetch_assoc($result);
?>

The following returns nothing:
   <?php echo $row_buyerdetails['phone_number'] ?>

I know the session variable named 'email' is receiving a value from the previous page from the print_r function on line 3. Variable $user is also getting the correct email address.
The database is set up correctly (ive been able to access successfully in other ways, but im trying to modify it to access the data related to a particular email address as shown).
If somebody could point me in the right direction id apprectiate it! Also as a side, how would people suggest debugging PHP other than littering the code with echos and print_r functions? Is there even a way to put breakpoints in for example?

EDITED FOR HELP IN THE ANSWER BELOW
As requested, this is the code with the alterations requested:
<?php
$hostname_first_data = "*****";
$database_first_data = "*****";
$username_first_data = "*****";
$password_first_data = "*****";
$first_data = mysql_pconnect($hostname_first_data, $username_first_data, $password_first_data) or trigger_error(mysql_error(),E_USER_ERROR);

echo mysql_errno($first_data) . ": " . mysql_error($first_data). "\n";

session_start();

print_r($_SESSION);
$user = $_SESSION['email'];
echo $user;
$query = "SELECT * FROM first_page_data WHERE email_address= '$user' ";

$result = mysql_query($query, $first_data);

$row_buyerdetails = mysql_fetch_assoc($result);

print_r($row_buyerdetails);

?>

A: Aren't you missing a mysql_connect call in your header or includes?
Try adding:
echo mysql_errno($link) . ": " . mysql_error($link). "\n";

$link being the resource you get from mysql_connect.
To debug PHP you have to install or activate an extension that is called Xdebug and use a nice IDE like PHPStorm, then Bob's your uncle :)
You can also use the Zend Debugger but I have limited experience with it.
You can (and should) also have full error reporting on when you are developing. It would tell you for example that the mysql_* functions are deprecated.
If you do not want the errors to appear on your page, you can choose to write to a log file and keep a tail open on that file.
Update for code:
<?php
$hostname_first_data = "*****";
$database_first_data = "*****";
$username_first_data = "*****";
$password_first_data = "*****";

$first_data = mysql_pconnect($hostname_first_data, $username_first_data, $password_first_data) or trigger_error(mysql_error(),E_USER_ERROR);
mysql_select_db($database_first_data, $first_data);

session_start();

print_r($_SESSION);
$user = $_SESSION['email'];
echo $user;
$query = "SELECT * FROM first_page_data WHERE email_address= '$user' ";

$result = mysql_query($query, $first_data);

echo mysql_errno($first_data) . ": " . mysql_error($first_data). "\n";

$row_buyerdetails = mysql_fetch_assoc($result);

print_r($row_buyerdetails);

?>

Tell me what that version outputs...


text:
Q: Rewrite custom post type url - Multiple post types I know this question as been asked several times, but this question is not exactly the same. I have two functions to change the url of single custom post type, but couldn't figure out how make this work for multiple CPTs. What I have tried:

*

*Simply copy the functions and rename them - won't work, they overwriting each other

*Tried to add lines within the function twice - fatal error

*And tried to make this $queryarg = 'post_type=article&p='; to an array - but add_rewrite_tag only accepts one single string

So that's the code:
    function custom_post_rewrite() {

        global $wp_rewrite;
        $queryarg = 'post_type=article&p=';
        $wp_rewrite->add_rewrite_tag( '%cpt_id%'    , '([^/]+)', $queryarg );
        $wp_rewrite->add_rewrite_tag( '%cpt_type%'  , '([^/]+)', $queryarg );
        $wp_rewrite->add_rewrite_tag( '%cpt_title%' , '([^/]+)', $queryarg );
        $wp_rewrite->add_permastruct( 'article'     , '/%cpt_type%/%cpt_title%-id=%cpt_id%', false );

    }
    add_action( 'init', 'custom_post_rewrite' );

    function custom_post_permalink( $post_link, $id = 0, $leavename ) {

        global $wp_rewrite;
        $post       = get_post( $id );
        $uni_id     = get_post_meta( $post->ID, 'unique_post_identifier', true);
        $post_type  = get_post_type( $post->ID );
        $post_title = sanitize_title( get_the_title( $post->ID ));

        if ( is_wp_error( $post ) )
            return $post;
            $newlink = $wp_rewrite->get_extra_permastruct( 'article' );
            $newlink = str_replace( '%cpt_id%', $post->ID, $newlink );
            $newlink = str_replace( '%cpt_title%', $post_title, $newlink );
            $newlink = str_replace( '%cpt_type%', $post_type, $newlink );
            $newlink = home_url( user_trailingslashit( $newlink ) );
        return $newlink;

    }
    add_filter('post_type_link', 'custom_post_permalink', 1, 3);

So that function would produce a permalink like this:
/%cpt_type%/%cpt_title%-id=%cpt_id%


text:
Q: How can I copy to clipboard specific part of paragraph? I want to make the method or only copy to clipboard the "syntax" part of a paragraph.
I've done the logic to get the specific part of content I want and stored it in variable "syntaxClean". Now I just need to copy it somehow.
document.execCommand("copy"); would be awesome, but I just can't seem to make it work.

<!DOCTYPE html>

    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Test</title>

In this example I would like to copy to clipboard "lsb_release -i" and I have it stored in variable syntaxClean as I've already said above.
Any help is appreciated!

A: You can achieve this by creating a dummy textarea like this:

<!DOCTYPE html>

    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Test</title>

    <button onclick="copy()">Copy</button>


text:
Q: Seg Fault with Class Constructors C++ I am new to classes and am having a lot of difficulty with the constructors. I have two constructors for a business class and whenever I attempt to create a business object or do anything with the business object I immediately Seg Fault. The business class interacts with an additional class called Customer.  If anyone could offer any help I would greatly appreciate it.
Business.h
#ifndef BUSINESS_H
#define BUSINESS_H

#include <iostream>
#include <string>
#include "customer.h"

using namespace std;

class Business
{
  public:
    Business();
    Business(string name, float cash);

    void printData() const;
    void addCustomer(Customer newCustomer);
    void make_a_sale();

  private:
    string businessName;
    float  cashInReg;
    string itemArray[10];
    Customer custInBus[10];
    short numOfItems;
    short numOfCustom;
};
#endif

Business.cpp
#include "business.h"
#include <iostream>
#include <cstdlib>
using namespace std;

Business::Business(): businessName("Business"), cashInReg(0), numOfItems(0),
                  numOfCustom(0) {}

Business::Business(string name, float cash) : businessName(name),
                 cashInReg(cash), numOfCustom(0) {}

void Business::printData() const
{
  cout << businessName <<endl;
  for (int i=0; i<numOfCustom; i++)
  {
    cout << "\t Customer Name: " << custInBus[i].getName() <<endl;
  }
   for (int i=0; i<numOfItems; i++)
  {
    cout << "\t Item list: " <<itemArray[i] <<endl;
  }
}

void Business::addCustomer(Customer newCustomer)
{
  custInBus[numOfCustom-1] = newCustomer;
  numOfCustom++;
}
void Business::make_a_sale()
{
  int randomItem;
  int currCustomer=0;

  while (currCustomer < numOfCustom)
  {
    randomItem = rand() %tempItems;
    custInBus[currCustomer].purchase(tempArray[randomItem]);
    currCustomer ++;
  }
}

A: void Business::addCustomer(Customer newCustomer)
{
  custInBus[numOfCustom] = newCustomer;
  //use numOfCustom instead of numOfCustom-1
  numOfCustom++;
}


text:
Q: Puppeteer hangs when implementing request.respond with an intercepted request I am attempting to get past Client authentication in Puppeteer. There is a solution proposed in https://github.com/puppeteer/puppeteer/issues/1319#issuecomment-371503788 that I am attempting to implement.
I have had to modify the solution somewhat - to use got instead of request.
When this is run though I am finding that the browser just hangs. Eventually quitting with the error:
(node:16672) UnhandledPromiseRejectionWarning: TypeError: Cannot convert undefined or null to object
    at Function.keys (<anonymous>)
    at Object.main (/Users/boyded01/workspace/watson/lib/debug.js:138:22)
(node:16672) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:16672) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

My function is:
async function checkPage(parsedUrl, config, number, total) {

  const browser = await puppeteer.launch({
    headless: false,
    executablePath: '/Applications/Google Chrome.app/Contents/MacOS/Google Chrome'
  });

  const page = await browser.newPage();

  // Enable Request Interception
  await page.setRequestInterception(true);

  page.on('request', interceptedRequest => {
    // Intercept Request, pull out request options, add in client cert
    const options = {
      url: interceptedRequest.url(),
      method: interceptedRequest.method(),
      headers: interceptedRequest.headers(),
      https: {
        certificateAuthority: fs.readFileSync('/Users/------/Downloads/cloud-ca.pem'),
        certificate: fs.readFileSync('/Users/------/certs/client.crt'),
        key: fs.readFileSync('/Users/------/certs/client.key')
      }
    };

    // Fire off the request manually
    got(options, function(err, resp, body) {
      // Abort interceptedRequest on error
      if (err) {
          console.error(`Unable to call ${options.url}`, err);
          return interceptedRequest.abort('connectionrefused');
      }

      // Return retrieved response to interceptedRequest
      interceptedRequest.respond({
          status: resp.statusCode,
          contentType: resp.headers['content-type'],
          headers: resp.headers,
          body: body
      });
    });
  });

  await page
    .goto(parsedUrl.toString())
    .catch(error => console.log(chalk.red(`Error loading page: ${error.message}`)));

  await browser.close();
}

Any help here in getting this to work is appreciated. The solution is quite advanced and I am struggling to get to the bottom of what I am doing wrong here.

A: I realised I was not using got correctly.
      const resp = await got(options)

      // Return retrieved response to interceptedRequest
      interceptedRequest.respond({
          status: resp.statusCode,
          contentType: 'text/html;charset=utf-8',
          headers: resp.headers,
          body: resp.body
      });
    }

Was how it should be.


text:
Q: Is it possible to use volatile variables to allow consistent write-only synchronisation? Is it possible to use volatile variables to allow consistent write-only synchronisation?
This is the code:
public class Controller {

    Container cont = new Container();
    ...

    public Object get(){
        if(!cont.isLocked()){
            return cont.getObject(); //many threads can read at the same time
        }
        else synchronized(cont){
            return cont.getObject(); //threads wait until write is finished
        }
    }

    public void set(Object o){
        synchronized(cont){
            cont.lock();
            cont.setObject(o);
            cont.unlock();
        }
    }
}

public class Container {
    private volatile boolean lock = false;
    private Object data;

    public Container(){
            }

    public void lock() {
        lock = true;
    }

    public void unlock() {
        lock = false;
    }

    public boolean isLocked() {
        return lock;
    }

    public void setObject(Object o) {
        data = o;
    }

    public Object getObject() {
        return data;
    }
}

Will it work, or will it break, what do you think?

A: It may/will break. Example of execution:

*

*T1: if(!cont.isLocked()) returns true

*T2: set(someObject)

*T1: return cont.getObject(); returns an old version

Even worse, since you don't have a proper happens-before relationship between T2 and T1, cont.getObject() may return the a reference to the new object created by T2, but pointing to an inconsistent/not-fully-constructed object.
You have a typical check-then-act problem.
Why don't you just use a volatile reference to your object?
public class Controller {

    private volatile Object obj = new Object();

    public Object get(){ return obj; }
    public void set(Object o){ obj = o; }
}

That would be thread safe.


text:
Q: Android InAppBilling v3 queryInventoryAsync doesn't return information about purchased items on other device I'm developing Android application with InAppBilling support.
There is following algorithm:

*

*Check what user has bought and show it

    mHelper.queryInventoryAsync(false, null, listener)

*

*Then check what user can buy (in order to show some dialog for him)

    mHelper.queryInventoryAsync(true, skuList, listener)

And everything works fine on some device (phone).
Then I install application on tablet (using the same account) but information about purchased items is not available.
(Information about items user can buy I can get successfully.)
How can I get information about paid items (items user has bought) on other device (with the same account)?
-- UPDATED --
very strange use case:

*

*User buys 2 of 3 available items using Android InAppBilling on phone.

*Check 2 just bought items on phone. They are visible.

*Install app on tablet (or some other device).

*Check 2 just bought items on tablet. They are visible as well.

*Buy 3rd the last one item on phone

*Check 3rd item on phone. It is visible.

*Check 3rd item on tablet. It is not visible
What happens in source code:
IabHelper.java
Bundle ownedItems = mService.getPurchases(3, mContext.getPackageName(),
                itemType, continueToken);
...

ArrayList<String> ownedSkus = ownedItems.getStringArrayList(
                RESPONSE_INAPP_ITEM_LIST);
ArrayList<String> purchaseDataList = ownedItems.getStringArrayList(
                RESPONSE_INAPP_PURCHASE_DATA_LIST);
ArrayList<String> signatureList = ownedItems.getStringArrayList(
                RESPONSE_INAPP_SIGNATURE_LIST);

Consider number items 5-7 (have just bought 3rd item):

*

*On phone we have info about 3 bought items

*On tablet we have info about 2 bought items (1st and 2nd). But why 3rd item is not available here?

A: looks like its issue of Google Play. Can be fixed with clearing cache of Google Play app or reboot device.


text:
Q: Programmatically alter AliasName for fields defined in layer file (not underlying source) Is there a way to alter the AliasName on a layer file only, and not the underlying shapefile or feature class? I have a few hundred layers that define joins between hundreds of tables with census data sitting in an MS Access database, and a shapefile with census tracts. I like to keep it this way to not have to store the feature geography for each of those data files.
Each layer file maps out hundreds of variables with intuitive names such as B19325_089. All said, there are several thousand. I would like to change the NameAlias property to have meaningful aliases/variable labels based on a lookup value, but, can it be done/defined in the layer file and not in the actual geography file, as all the layer files create the join to the same shapefile?
I got off to a decent start on feature classes in a file GDB using Mark Cederholm's and Matt Wilkie's suggestions, but am, as noted, curious about whether it is possible to have the alias definition reside in the layer files.
Initially, I thought it very simple and doable with the geoprocessor object as ESRI lists the AliasName property as read/write, but that appears to not be possible, and arcobjects to be necessary.

A: It should be possible to cast your featurelayer to ITableFields, then loop through each ITableField.FieldInfo and set IFieldInfo.Alias.  Last time I checked no error was raised when I assigned more than one field the same alias, so be careful.
Update:
Field aliases can be confusing.  There's an alias for fields that are stored in the database (IField.AliasName) which can be changed as shown in this thread.  The IFieldInfo.Aliases are what you change when you go into the Fields tab on the Layer Properties dialog in ArcMap. I think those get initialized to whatever the IField.Alias is.


text:
Q: Execute bat file in the build event got the error "error MSB3073: The command "call "MyTest.bat" exited with code 1." In our solution we have more than 150 projects, I need build one of project before others, but I did not want to set project reference or project dependencies for more than 100 projects one by one. This is a waste of time. So I ask following question before this one:
Set build order without using project reference
And as @Leo Liu  suggested that I could use batch file to build the project first, it is should be a valid workaround. As optimization, I want set this bat file in the build event of that project so that I only need to build that project, do not need to manually run the bat file from outside.
However, when I build that project with below build event:
call "$(ProjectDir)\MyTest.bat"

I got this error:
C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\bin\Microsoft.Common.CurrentVersion.targets(5074,5): error MSB3073: The command "call "C:\Users\Myname\Source\repos\MysolutionName\GenerateFile\MyTest.bat"" exited with code 1. [C:\Users\\Source\repos\MysolutionName\GenerateFile\GenerateFile.csproj]

Update:
The scripts in the bat file is:
@echo OFF
call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\Tools\VsDevCmd.bat"
echo "Starting Build for all Projects with proposed changes"
MSBuild.exe "C:\Users\MyName\Source\repos\MySolutionName\MySolutionName.sln"
pause
echo "All builds completed."

Any suggestion? Thanks in advance.

A:
Execute bat file in the build event got the error "error MSB3073: The command "call "MyTest.bat" exited with code 1."

According to your question, I created a test sample and got more than 30 errors without any other detailed info:
error MSB3073: The command "call "D:\TestSample.bat"" exited with code 1.

Further study found the reason for those errors, that because you build the solution in the bat file, then you set this bat file in the build event of one project in the solution, which called in the bat file.
So an infinite loop will generated, that is the reason why we got more than 30 errors for one command line in the build event.
To resolve this issue, we should not build the specify project when we build the solution with bat file, so you could open Configuration Manager, uncheck the build checkbox for generate project:

With this setting, this project will be ignore when you build the solution with that bat file.


text:
Q: Python selenium cannot click or change value in radio button Trying to automate amazon affiliate report generation. cannot change the value of a checkbox
need to mark this checkbox
this is HTML of that checkbok

radio = driver.find_element_by_xpath(
    "//input[@value='custom' and @name='ac-daterange-radio-report-download-timeInterval']")

driver.execute_script("arguments[0].click();", radio)

# driver.execute_script(
#     "arguments[0].setAttribute('checked', 'checked';", radio)

If more clarity needed can ask here.
thanks in advance

A: You are not sending click event to java script executor, instead of this you directly click by .click() method. If you want to click one of the checkbox you use one of the following commands, change the text contains: Today,  Yesterday and other. See this:
driver.find_element_by_xpath("//span[contains(text(), 'Today')]/ancestor::label/input").click()
driver.find_element_by_xpath("//span[contains(text(), 'Yesterday')]/ancestor::label/input").click()
driver.find_element_by_xpath("//span[contains(text(), 'Custom Date Range')]/ancestor::label/input").click()


text:
Q: Use multipart data in html form Is it possible to set html form input value as multipart data ?
I'm trying to make an image-ready to upload while submitting an HTML form ( remote image data generated by PHP)
Something like this
<form action="http://remote_site.com" method="post" enctype="multipart/form-data">
    <input type="file" name="file" value="#Multipart/binary data used here (??)#">
    <input type="submit" name="submit">
</form>

A: You can use the FormData API using a Blob in modern browsers.
var formData = new FormData();

// JavaScript file-like object...
var content = 'hey!'; // the body of the new file...
var blob = new Blob([content], { type: "text/xml"});

formData.append("webmasterfile", blob);

var request = new XMLHttpRequest();
request.open("POST", "http://foo.com/submitform.php");
request.send(formData);

Some docs at MDN https://developer.mozilla.org/en-US/docs/Web/Guide/Using_FormData_Objects
Sorry, misunderstood before!


text:
Q: Typename Keyword for SFINAE I was studying about SFINAE in modern C++ which I see the following code:
#include <iostream>

struct Bar
{
    typedef double it;
};

template <typename T>
typename T::it Foo(const T& arg_f) {
    std::cout << "Foo<T>" << std::endl;
    return 0;
}

int Foo(int i) { std::cout << "foo(int)" << std::endl; return 0; }

int main(int argc, const char* argv[])
{
    Foo(Bar());
    Foo(0);

    return 0;
}

*

*Why in this code, the developer used typename T::it?

*How that typename is related to structure of Bar? because it variable is just defined in bar struct but it used outside of struct for function declaration.

*What is SFINAE at all?

A: The keyword typename is used here because you are accessing a type member of a template type argument.
It is completely unrelated except for the fact that if T is Bar then it should expose a it type member to gain access to the overload.
Substitution Failure Is Not An Error is a template meta programming pattern that relies on "removing" overloads that could not compile

A: In the template function you put here, the developer indirectly specifies Foo is just a function to work with Bar structure (or its derivated instances). So if you instantiated it like Foo(Bar()), the template function deduced by compiler like the following:
Bar::it Foo(const Bar& arg_f) {
    std::cout << "Foo<T>" << std::endl;
    return 0;
}

But if we pass an integer value rather Bar object to the function, it will be instantiated like the following codes:
int::it Foo(const int& arg_f) {
    std::cout << "Foo<T>" << std::endl;
    return 0;
}

Which has a wrong implementation and as a result, the compiler will fail because int class has not it member.
However, if you want to handle this issue, you should overload foo function for int values like the following:
int Foo(int arg_f)
{
     std::cout << "Foo<int>" << std::endl;
     return arg_f;
}

Or you can use enable_if_t for enabling a template function for a specialized data type like floating-point or ...:
template <typename T>
typename std::enable_if_t<std::is_floating_point<T>::value, T> Foo(T t)
{
    std::cout << "Foo<floating point>" << std::endl;
    return t;
}

Also, I should clarify type name just make a difference between a value and a type. when you use it, the compiler treats that object as a type, not a value because of that, the developer uses it to make compiler aware it is a type, not a value.
Also, as @Vivick said, Substitution Failure Is Not An Error is a template metaprogramming pattern that relies on "removing" overloads that could not compile. However, Wikipedia has a good reference for SFINAE: https://en.wikipedia.org/wiki/Substitution_failure_is_not_an_error


text:
Q: undefine method submit_to_remote <%= submit_to_remote(:category, :url => params[:id].blank? ? {:action => 'create'} : {:action => "update", :id => @category}) do %>

            Name

            <%= text_field(:category, :name, :size => 20) %>
            <%= submit_tag(params[:id].blank? ? "New": "Edit") %>

<% end %>

I want to create new record using Ajax. I got error undefined method submit_to_remote I declared prototype file in layout.
                  waiting for ans.......

A: Firstly, it looks like your submit_to_remote is trying to define a form - so use form_for or form_tag.
Secondly submit_to_remote no longer exists in Rails 3. You need the :remote => true option of form_tag, which will let UJS (Unobtrusive JavaScript) step in and make the AJAX happen.
See some docs.


text:
Q: How can I fix my error when I start my React-Native App? I'm creating a new React-Native app. I'm following the React-Native quickstart When I want to start my app with "expo start" I got this error :
Error: spawn cmd ENOENT
at Process.ChildProcess._handle.onexit (internal/child_process.js:246:19)
at onErrorNT (internal/child_process.js:427:16)
at processTicksAndRejections (internal/process/next_tick.js:76:17)

Thank you !


text:
Q: Handling exceptions from methods in map of Optional I have a method like this.
@Override
public Optional<List<Order>> getPendingOrders(AuthDTO authDTO) throws MyException {
    return connector.getConnection(authDTO).map(p->p.getOrders());
}

Here
connector.getConnection(authDTO)

returns an Optional of Connection and
p->p.getOrders()

throws KException which I cannot change and is of the form
public class KException extends Throwable {

    // variables
    public String message;
    public int code;

    // constructor that sets the message
    public KException(String message){
        this.message = message;
    }

    // constructor that sets the message and code
    public KException(String message, int code){
        this.message = message;
        this.code = code;
    }
}

and this the strucute of MyException
public class MyException extends KException {

    public MyException(String message, int code) {
        super(message, code);
    }
}

The code is not compiling with the below error
unreported exception com.something.exceptions.KException; must be caught or declared to be thrown

I want to convert this KException to MyException. Is there are an elegant way to do this? PLease help.

A: as suggested by some of the comments, you can trap the exception within the map operation and then perform any further logic you need to do:
return getConnection(authDTO).map(p -> {
        try {
            return p.getOrders();
        } catch (KException e) {
            // perform some other logic
        }
});

A: Cant you just do like this?
@Override
public Optional<List<Order>> getPendingOrders(AuthDTO authDTO) throws MyException {
    return connector.getConnection(authDTO)
            .map(p->p.getOrders())
            .orElseThrow(MyException::new));

}


text:
Q: Can a pointer value change just by passing it to another function? I am debugging my function A with GDB, and just before calling function B, I print the following value:
p *(key->s->fds[3].handler)

and I get as a result:  (these are all function pointers)
$3 = {handle_read = 0x55555555ba49 <socks5_read>, handle_write = 0x55555555baa2 <socks5_write>, handle_block = 0x55555555bb0a <socks5_block>, handle_close = 0x55555555bb15 <socks5_close>}

Then, I type s to enter function B with GDB.
Immediately after, I print p *(key->s->fds[3].handler) again, but its value is:
$4 = {handle_read = 0x7fffffffdb90, handle_write = 0x5555baa2, handle_block = 0x55555555bb0a <socks5_block>, handle_close = 0x55555555bb15 <socks5_close>}

I know that this question is really open, because I should show some of my code. But my question is general: Is it possible that the contents of my struct change just by passing a pointer to a function?
If it helps, this is the complete trace of what I've done in GDB:
(gdb) s
31              stm->current->on_arrival(stm->current->state, key);
(gdb) p *(key->s->fds[3].handler)
$3 = {handle_read = 0x55555555ba49 <socks5_read>, handle_write = 0x55555555baa2 <socks5_write>, handle_block = 0x55555555bb0a <socks5_block>,
  handle_close = 0x55555555bb15 <socks5_close>}
(gdb) s
hello_read_init (state=0, key=0x7fffffffdb90) at src/stm/stm_hello.c:20
20      hello_stm *hello_stm = &ATTACHMENT(key)->hello_state;
(gdb) p *(key->s->fds[3].handler)
$4 = {handle_read = 0x7fffffffdb90, handle_write = 0x5555baa2, handle_block = 0x55555555bb0a <socks5_block>,
  handle_close = 0x55555555bb15 <socks5_close>}

A:
Is it possible that the contents of my struct change just by passing a pointer to a function?

There are 3 possible reasons I can think of (most to least likely):

*

*Your program has undefined behavior of the stack use after scope variety.
That is, if key->s->fds[3].handler points to stack of a frame which has already returned, that stack will be overwritten by subsequent call instructions.

*You didn't step far enough.
If the called function is optimized, it is possible for GDB to stop in hello_read_init prolog (area where registers aren't yet set up).

*You have a multithreaded program and a data race (another thread overwrites key->s->fds[3].handler->handle_read while the first thread uses it).

Using Address Sanitizer should show whether this is an instance of UB (the first possibility above) right away.

A: In addition to @Employed Russian's answers, this can happen if you have stepped into a file in a library with different precompiler defines and you have a "#ifdef XXX" around field(s) in the data you are printing in GDB. I just encountered this case.
For example, say your binary named "test_cmd" has -DDEBUG but your library named "lib_my_cmd" does not have it. And then, your struct is defined as...
// my_cmd.h has...
typedef struct {
    #ifdef DEBUG
      int my_debug_only_field;
    #endif
    int my_regular_field;
} my_info;
...

// my_cmd.c, built as part of lib_my_cmd without -DDEBUG, has...
#include "my_cmd.h"

void do_foo(my_info* inputs) {
    // GDB stepping in here, where DEBUG is not defined, the value of
    //   inputs.my_regular_field is 1.  <== Expected to be 0!!!
}

// my_foo_test.cc, built in the binary with -DDEBUG, has...
#include "my_cmd.h"

void test_foo() {
    my_info inputs;
    inputs.my_debug_only_field = 1;
    inputs.my_regular_field = 0;
    do_foo(&inputs);
    //...

The inputs field values change when you step from test_foo() into do_foo(...).


text:
Q: How to install the cube function for Postgresql when I just run the sample statements like below:
select cube_union('(0,5,2),(2,3,1)', '0')

but facing the error:
postgres=# select cube_union('(0,5,2),(2,3,1)', '0');
ERROR:  function cube_union(unknown, unknown) does not exist
LINE 1: select cube_union('(0,5,2),(2,3,1)', '0');
               ^
HINT:  No function matches the given name and argument types. You might need to add explicit type casts.
postgres=#

Can anyone help me? Is there any place I need to setup or need to install the function separately.

A: The cube_union() function is provided by the extension cube
To install an extension you need create extension
An extension is installed per database, so you need to connect to the database you are using as a super user, then run:
create extension cube;


text:
Q: Using harddrive from another laptop, but getting Win7 Genuine Advantage error My wife spilled water over her laptop.  This machine had a working version of Windows 7 without any Genuine Advantage errors.  When the motherboard failed after the water incident we bought her a new laptop. All her data was on her old hard drive, and the drive still worked so we swapped the drives.
I knew I would need to install all the necessary drivers for the OS to work with the new laptop hardware but, I did not even think about verifying the windows product key.
Now whenever she is using her laptop she is getting prompted multiple times about counterfeit software.
Is there a way to verify her OS with the old product key that matches it from the old machine?

A: Actually, JustinD is incorrect.  Microsoft is very specific about how OEM keys work.  Specifically, they are tied to a specific hardware and activated as such.  During the activation process, they tend to take an inventory of components and recognize the key based off that (the motherboard is included in those).
So what that typically means is that the OEM key from the first laptop is tied to that Laptop.  However, you may be able to use the key that probably came with the new one.  Otherwise, you could call MS and see if they will work with you - but it is highly unlikely.

*

*I would try to activate with the key that likely came with your new computer before trying to deal with MS.  They rarely bend the rules on the OEM installs.

Per Microsoft's FAQ & Licensing pageQ. My customer bought a new PC and wants to move the OEM software from the old PC to the new one. Can't users do whatever they want with their software?
  A. No, the OEM software is licensed with the computer system on which it was originally installed and is tied to that original machine. OEM licenses are single-use licenses that cannot be installed on more than one computer system, even if the original machine is no longer in use. The End User Software License Terms, which the end user must accept before using the software, state that the license may not be shared, transferred to, or used concurrently on different computers. System builders must provide end-user support for the Windows license on computers they build, but cannot support licenses on computers they didn't build. This is a fundamental reason why OEM System Builder licenses can't be transferred.

A: There are a few ways to solve this.

*

*If the new laptop has the same windows version (e.g. win-7 home on both) then look for the CoA. (That is the sticker with all the XXXXXX-XXXXXX-XXXXXX-XXXXXX-XXXXXX letters and numbers on it).

*

*Select [My computer] from the desktop, right click, select [properties]

*Click on the change product key option. Enter the new key for this laptop.

*Call Microsoft and tell them you replaced you motherboard and that windows fails to re-activate.  If this is legal or not depends on your original license.

A: You could attempt in trying to re-activate your product by right clicking on "My Computer" and selecting properties, then at the bottom, select change product key. Hopefully you still have the key because you will need it.
Just try re-entering your original key and activate it.


text:
Q: Using a progress bar or wait indicator during webservice call I am using background worker to execute an "Import" web-service call;
This import operation call can take about 5 seconds to complete, so i was wondering how i could best visually entertain the user. I have seen that most progress bars are more or less used in loop operations where they get updated per object processed. In my doWorker, i just have the webservice call;
Something like :
Details importinfo = (Details)sender;
e.Result = WebService.ImportMe(importinfo);

So will it be smart to have a progress bar in such an operation or some animation while the user waits for completion ? How can i best approach this ?

A: When you have no idea how long it will take and/or at what "point" of the operation you are you can set the Style to ProgressBarStyle.Marquee.


text:
Q: How to align text one below the other in android? I'm working on android app. Here I have 2 TextView which I need to align one below the other.(i.e "Artist Name" should be exact below the "Title of song" )
Could anyone help me in aligning the TextView one below the other.
Thanks in advance.
Below is my code
<RelativeLayout xmlns:
  android="http://schemas.android.com/apk/res/android"
  android:layout_width="fill_parent"
  android:layout_height="wrap_content"
  android:background="@drawable/list_selector"
  android:orientation="horizontal"
  android:padding="5dip" >

  <TableLayout
  android:layout_width="wrap_content"
  android:layout_height="match_parent"
  android:layout_centerHorizontal="true" >

  <!--  Left side Thumbnail image -->
  <TableRow android:id="@+id/thumbnail"
   android:layout_width="wrap_content"
   android:layout_height="wrap_content"
   android:padding="3dip"
   android:layout_alignParentLeft="true"
   android:background="@drawable/image_bg"
   android:layout_marginRight="5dip">

<ImageView
    android:id="@+id/list_image"
    android:layout_width="50dip"
    android:layout_height="50dip"
    android:src="@drawable/doc"/>

 <!-- Title Of Song-->
 <TextView
 android:id="@+id/title"
 android:layout_width="wrap_content"
 android:layout_height="wrap_content"
 android:layout_alignTop="@+id/thumbnail"
 android:layout_toRightOf="@+id/thumbnail"
 android:text="love you the"
 android:textColor="#040404"
 android:typeface="sans"
 android:textSize="15dip"
 android:textStyle="bold"/>

 <!-- Artist Name -->
  <TextView
  android:id="@+id/artist"
  android:layout_width="fill_parent"
  android:layout_height="wrap_content"
  android:layout_below="@id/title"
  android:textColor="#343434"
  android:textSize="10sp"
  android:layout_marginTop="1dip"
  android:layout_toRightOf="@+id/thumbnail"
  android:text="Mary" />

  <!-- Rightend Duration -->
  <TextView
 android:id="@+id/duration"
 android:layout_width="wrap_content"
 android:layout_height="wrap_content"
 android:layout_alignParentRight="true"
 android:layout_alignTop="@id/title"
 android:gravity="right"
 android:text="7:45"
 android:layout_marginRight="5dip"
 android:textSize="10dip"
 android:textColor="#10bcc9"
 android:textStyle="bold"/>

    <!-- Rightend Arrow -->
     <ImageView android:layout_width="wrap_content"
 android:layout_height="wrap_content"
 android:src="@drawable/arrows"
 android:layout_alignParentRight="true"
 android:layout_centerVertical="true"/>
 </TableRow>
 </TableLayout>

   </RelativeLayout>

A: Simply use this to place your Item's to related to other's.
androidHacker is right, you can place one text view to below of other like this:
android:layout_below="@+id/your_another_text_view"
Similar layout is here in this tutorial for that you are looking here.

A: try like this..
 android:layout_below="@+id/your_another_text_view"

UPDATE
You just need to make use of relative layout specifically for that textView.. Try it and let me know.

A: // try this way,hope this will help you to solve your problem.

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:background="@drawable/list_selector"
    android:orientation="horizontal"
    android:padding="5dip" >

    <TableLayout
        android:layout_width="wrap_content"
        android:layout_height="match_parent"
        android:layout_centerHorizontal="true" >

        <!--  Left side Thumbnail image -->
        <TableRow android:id="@+id/thumbnail"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:padding="3dp"
            android:background="@drawable/image_bg"
            android:layout_marginRight="5dp">

            <RelativeLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content">
                <ImageView
                    android:id="@+id/list_image"
                    android:layout_width="50dp"
                    android:layout_height="50dp"
                    android:layout_alignParentLeft="true"
                    android:src="@drawable/ic_launcher"/>

                <TextView
                    android:id="@+id/title"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_toRightOf="@id/list_image"
                    android:text="love you the"
                    android:textColor="#040404"
                    android:typeface="sans"
                    android:textSize="15sp"
                    android:textStyle="bold"/>

                <!-- Artist Name -->
                <TextView
                    android:id="@+id/artist"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_below="@id/title"
                    android:layout_toRightOf="@id/list_image"
                    android:textColor="#343434"
                    android:textSize="12sp"
                    android:layout_marginTop="1dp"
                    android:text="Mary" />

                <TextView
                    android:id="@+id/duration"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_toRightOf="@id/title"
                    android:gravity="right"
                    android:text="7:45"
                    android:layout_marginRight="5dp"
                    android:textSize="12sp"
                    android:textColor="#10bcc9"
                    android:textStyle="bold"/>

                <ImageView
                    android:id="@+id/arrow_image"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:src="@drawable/ic_launcher"
                    android:layout_alignParentRight="true"
                    android:layout_toRightOf="@id/duration"
                    android:layout_centerVertical="true"/>

            </RelativeLayout>
        </TableRow>
    </TableLayout>
</RelativeLayout>

A:  <TextView
 android:id="@+id/title"
 android:layout_width="wrap_content"
 android:layout_height="wrap_content"
 android:layout_alignTop="@+id/thumbnail"
 android:layout_toRightOf="@+id/thumbnail"
 android:text="love you the"
 android:textColor="#040404"
 android:typeface="sans"
 android:textSize="15dip"
 android:textStyle="bold"/>

 <!-- Artist Name -->
  <TextView
  android:id="@+id/artist"
  android:layout_width="fill_parent"
  android:layout_height="wrap_content"
  android:layout_below="@id/title"
  android:textColor="#343434"
 android:layout_alignLeft="@+id/title"// This line is new
  android:textSize="10sp"
  android:layout_marginTop="1dip"

  android:text="Mary" />

A: try to use LinearLayout or use the property  android:layout_alignBottom="@+id/title"


text:
Q: How to extend background CSS styling indefinitely along the x-axis? I have a header background that I would like to bleed indefinitely on the x axis. So regardless of the size of someones monitor, the grey background would extend.
How do I do this?
Thanks!

A: Two answers, depending on what issue you're exactly facing.
First case: The background isn't repeating at all
Assuming you're using a CSS background-image to render your background, use background-repeat: repeat-x;
Little demo: little link.
If you're not using a background-image to render your background, then you should consider using it. There's no direct way of making an <img> repeat.
Second case: The background is repeating, it's just not spanning the whole width
You need to make sure your header has width: 100%;. If you have some padding to your headers parent, use display: block; instead of width: 100%;, otherwise it'll overflow.


text:
Q: How to Add header in a PDF generated by interop? I am generating MSWord to PDF and .ppt to PDF using interop services. I want to add header  in the PDF. There are two problems I am facing:

*

*I could not find the way of adding header or footer on fly while generating PDF through interop.

*I also tried iTextSharp to add header in generated PDF, but itext sharp is creating a new PDF file which is making my process long.

Is there any way so that I can add header on fly while converting MSWord to PDF??
Note:"I am not generating MSWord to PDF using iTextSharp"


text:
Q: Tiling Simplex Noise? I've been interested (as a hobbyist) in pseudo-random noise generation, specifically the Perlin and Simplex algorithms. The advantage to Simplex is speed (especially at higher dimensions), but Perlin can be tiled relatively easily. I was wondering if anyone was aware of a tiling simplex algorithm? Fixed-dimension is fine, generic is better; pseudocode is fine, c/c++ is better.

A: Just tile your noise the same way you would in Perlin only do it after the skew. You can do this by modifying the part that gets the permutaions to do the mod 256 (or & 255, whatever you are using) after (instead of before) you add to offsets to the get the other corners from the base corner. This is the modified bit of code in HLSL:
uint3 iIdx0 = p0SI % 256;
uint3 iIdx1 = (p0SI + pI1) % 256;
uint3 iIdx2 = (p0SI + pI2) % 256;
uint3 iIdx3 = (p0SI + 1.0f) % 256;
uint iGI0 = gPerm[ iIdx0.x + gPerm[ iIdx0.y + gPerm[ iIdx0.z ] ] ] % 12;
uint iGI1 = gPerm[ iIdx1.x + gPerm[ iIdx1.y + gPerm[ iIdx1.z ] ] ] % 12;
uint iGI2 = gPerm[ iIdx2.x + gPerm[ iIdx2.y + gPerm[ iIdx2.z ] ] ] % 12;
uint iGI3 = gPerm[ iIdx3.x + gPerm[ iIdx3.y + gPerm[ iIdx3.z ] ] ] % 12;

p0SI is the corner 0 point and pI2 and PI2 are vectors to corner one and corner 2 calculated in the usual way. Note that in HLSL scalars promote to vectors automatically in mixed operatons so for instance 1.0f is actually (1.0,1.0,1.0). I just figured this tiling stuf out but apprently it works. If you need to shade a large planet or some shit but only have single precision on your card there are a few more steps. Hit me up.
Edit: you know after thinking about it some more I don't think you have to change anything. I think it tiles autmatically at 256 units as implemented.

A: It would seem this question has been reasonably solved here, with a detailed description of the idea behind the working solution here. A fantastic answer to a long-standing problem!

A: Even if few years passed, this question is still among best results on Google.
In simplex noise, x and y from a straight (ortonormal) grid get skewed to find the simplex the point is in (a triangle in 2D), so with common tiling techniques (%255 or whatever), it DOES tile, but tiles on skewed coordinates, that is it tiles "diagonally", which is quite useless.
A simple solution I've found is to "un-skew" the result, so that original X and Y are first skewed "to the left", then the algorithm will skew them "to the right", and the final result will be re-aligned to a non skewed grid.
If, for example, your simplex implementation is similar to SimplexNoise.java you can find everywhere on the net, it skews the grid using :
var F2 = 0.5*(Math.sqrt(3.0)-1.0);
var s = (xin+yin)*F2; // Hairy factor for 2D
var i = Math.floor(xin+s);
var j = Math.floor(yin+s);

You can simply "pre-skew" it in the opposite direction at the entry point of the method:
var G2 = (3.0-Math.sqrt(3.0))/6.0;
var t = (xin+yin)*G2;
xin-=t;
yin-=t;

Unfortunately, it produces a somehow strange-looking effect (that is, it looks a bit skewed :D ), which is not usually a problem, but depends on what you need that noise for.
Since it was a problem for me, I tried applying this "inverse-skewing" only to a couple of octaves, those that weight more in the final output, and instead used interpolation for "lighter" octaves. This solution gave me satisfactory tiling based on simplex Perlin noise, cause interpolation on all octaves would produce too much attenuation on tile borders, and when more octaves are added without artificial skewing the strage-looking effect gets buried under the additional noise.

A: I recently needed tiling simplex noise and came across this question.
For tiling noise using any noise function, you can linearly interpolate additional tile samples:
Ftileable(x, y) = (
       F(x, y) * (w - x) * (h - y) +
       F(x - w, y) * (x) * (h - y) +
       F(x - w, y - h) * (x) * (y) +
       F(x, y - h) * (w - x) * (y)
) / (wh)

where F() is your noise function. Note that x, y must be coordinates within an individual tile: x in [0, w), y in [0, h). You could use something like tileX = x - Math.Floor(x / w) * w or fmod().
If performance is critical or for higher dimensions, this may not be the way to go because it requires 2^D lookups for dimension D. It also produced lower values toward the centers of tiles for me.
Taken from:
http://webstaff.itn.liu.se/~stegu/TNM022-2005/perlinnoiselinks/perlin-noise-math-faq.html


text:
Q: Ветвления if и мой пример друзья! Дали задание сделать ветвления в Java, так вот хотел бы спросить правильно ли сделан мой код или нет:
public static void main(String[] args) {
    int age = 13;
    if (age == 25) {
        if (age == 33) {
            if (age == 50) {
                System.out.println("Igor");
            }
        }
    } else {
        System.out.println("Error");
    }
}

A: "Цикл" сделан неправильно. Замените его на гораздо более простой код:
    if (age != 25) {
        System.out.println("Error");
    }


text:
Q: How to list all tagged files in ranger I have a nested directory with tagged files across the subdirectories. Is there any way to list all marked files in this nested hierarchy?

A: You can run
ranger --list-tagged-files='*'

to list all files tagged with * (replace * if you used another tag).
So either use a special tag for your hierarchy or filter the output to the base directory.


text:
Q: What is good about Intel Vt-d technology for direct IO? I'm interested in 2 CPUs ( or I should APUs ? ) the main difference between this 2 units it's the presence of a Vt-d feature that Intel names "Intel® Virtualization Technology for Directed I/O (VT-d)".
Since I'm also interested in running virtualized environment on this machine, what kind of features I will get or miss in real world scenarios ? What this Vt-d is about ?

A: From this excellent Intel blog post which is at the top of the google results for vt-d:

VT-d, at the time of this writing, includes four key capabilities

*

*I/O device assignment. This feature allows an administrator to assign I/O devices to VMs in any desired configuration.

*DMA remapping. Supports address translations for device DMA data transfers.

*Interrupt remapping. Provides VM routing and isolation of device interrupts.

*Reliability features. Reports and records system software DMA and interrupt erros that may otherwise corrupt memory of impact VM
  isolation.
Note that VT-d is not dependent on VT-x. That is, a VT-x enabled
  system can operate without VT-d, or without VT-d enabled or
  configured. You simply miss the benefits of the feature. Many people
  have asked about this point.
You can read about VT-d in detail at:
http://www.intel.com/technology/virtualization/technology.htm?iid=tech_vt+tech

This link is the architectural spec for VT-d, if you have an afternoon to burn and really want to know how it works.