text:
Q: Can not read property "mentions" of undefined, can not read property "guild" of undefined | Discord.js slash commands So I've tried using slash commands for my discord bot, I've copied and changed around a little bit of the warn command from the old bot where the warn command worked without the slash commands.
My code is
const { MessageEmbed } = require('discord.js')
const mongo = require('../mongo')
const warnSchema = require('../schemas/warn-schema')
const Discord = require('discord.js')

module.exports = {
  slash: 'both',
  testOnly: true,
  minArgs: 2,
  expectedArgs: '<mention> <reason>',
  description: "warns mentioned user",
  callback: async ({ message, args }) => {

const [mention, reason] = args

      const target = message.mentions.users.first()

    const guildId = message.guild.id
    const userId = target.id

    const warning = {
      author: message.member.user.tag,
      timestamp: new Date().getTime(),
      reason,
    }

const yerz = new MessageEmbed()
  .setTitle('yes')

    await mongo().then(async (mongoose) => {
      try {
        await warnSchema.findOneAndUpdate(
          {
            guildId,
            userId,
          },
          {
            guildId,
            $push: {
              warnings: warning,
            },
          },
          {
            upsert: true,
          }
        )
      } finally {
        mongoose.connection.close()
      }
    })

    return yerz
  },
}

If anyone knows how I could make the bot find the guid id and read the mentions, help would be appreciated.

A: I think the problem is in your JS code:
callback: async ({ message, args }) => {

It should be:
callback: async ({ message, args }) {

Without the => because => and {} are mutually exclusive in this case.
If that does not fix it, it is probably with the line:
const [mention, reason] = args

Could you tell us what args is? I am guessing its an object but I am not sure.


text:
Q: Unzipping & storing files in local storage UWP I am developing an app "Bible Lite" which has bible in XML in 17 different languages. To save space i have zipped it into archived.zip inside Assets folder. I want to unzip the folder containing the Bible in different languages and store it in the LocalFolder once the user has downloaded it and begins running it for the first time.
While unzipping files on Win32 apps is trivial tasks I am having a hard time doing it in jailed environment of UWP. I have tried digging stack overflow.
I just have a folder containing bible in various languages inside my Zip.
    private static async Task extractCompressedFile(StorageFolder destinationFolder)
    {

        StorageFolder _folder = await Windows.ApplicationModel.Package.Current.InstalledLocation.GetFolderAsync("Assets");

   /*fails here FileNotFound*/    StorageFile sourceCompressedFile = await _folder.GetFileAsync("archived.zip");

        ZipFile.ExtractToDirectory(sourceCompressedFile.Path, destinationFolder.Path);

    }

}

A: You need to set the "archived.zip" file 's "Copy to Output Directory" to "Copy always"

A: You can set the property of archived.zip in the Properties window. And set the Build Action from None to Content like the following image:

None: The file is not included in the package manifest. An example is a text file that contains documentation, such as a Readme file.
Content: The file is included in the package manifest. For example, this setting is the default value for an .htm, .js, .css, image, audio, or video file.
The default value of the .zip file is None.

redpajama_set_name: RedPajamaStackExchange


text:
Q: No linetype in geom_vline (ggplot) and customize legend I have a weird problem with geom_vline. It seems I cannot change the linetype. Here the data:
dput(gf)
structure(list(variable = structure(c(1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L,
2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L,
2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L,
2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L,
2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L,
2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L,
2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L,
2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L,
2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L,
2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L,
2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 3L, 3L, 3L, 3L, 3L, 3L,
3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L,
3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L,
3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L,
3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L,
3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L,
3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L,
3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L,
3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L,
3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L,
3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L,
3L, 3L), .Label = c("As", "Cd_totale", "Cr_totale"), class = "factor"),
    Area = structure(c(1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
    1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
    1L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 6L, 6L, 1L, 6L, 6L, 6L, 1L,
    1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 6L, 1L, 1L, 1L, 1L, 1L, 2L,
    2L, 2L, 2L, 3L, 3L, 1L, 1L, 1L, 1L, 4L, 4L, 5L, 1L, 1L, 1L,
    1L, 1L, 1L, 1L, 1L, 1L, 1L, 6L, 6L, 1L, 1L, 1L, 1L, 1L, 1L,
    1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
    3L, 3L, 4L, 4L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
    1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
    1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
    1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
    1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
    1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 3L,
    3L, 1L, 2L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
    1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
    1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
    1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
    1L, 1L, 1L, 1L, 6L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
    1L, 1L, 1L, 1L, 1L, 1L, 1L, 3L, 3L, 4L, 4L, 4L, 4L, 1L, 1L,
    1L, 5L, 5L, 5L, 5L, 5L, 6L, 6L, 6L, 6L, 1L, 1L, 6L, 6L, 1L,
    6L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 5L, 1L, 1L,
    1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 5L, 5L, 1L, 1L, 1L, 1L, 1L,
    1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
    1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
    1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
    1L, 6L, 6L, 6L, 6L, 1L, 1L, 6L, 6L, 1L, 1L, 1L, 1L, 1L, 1L,
    1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 1L, 1L, 1L, 1L, 1L,
    1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 6L, 1L, 1L,
    1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
    4L, 1L, 1L, 1L, 1L, 2L, 3L, 3L, 3L, 3L, 1L, 1L, 1L, 1L, 4L,
    5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 1L, 1L, 1L, 4L, 1L, 1L, 1L,
    1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 4L, 1L, 1L, 1L, 1L, 1L, 1L,
    1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
    1L, 1L, 1L, 6L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L), .Label = c("candiano",
    "Lido_Spina", "Porto_Corsini", "Punta_Marina", "Sito1", "Sito2"
    ), class = "factor"), Campione = structure(c(40L, 39L, 38L,
    155L, 37L, 36L, 153L, 50L, 51L, 156L, 34L, 152L, 73L, 154L,
    75L, 76L, 157L, 41L, 42L, 43L, 44L, 45L, 35L, 47L, 48L, 49L,
    6L, 7L, 13L, 21L, 162L, 164L, 166L, 2L, 8L, 46L, 14L, 165L,
    167L, 23L, 24L, 25L, 26L, 27L, 28L, 29L, 30L, 31L, 12L, 33L,
    150L, 151L, 111L, 74L, 3L, 9L, 15L, 18L, 4L, 10L, 158L, 159L,
    160L, 161L, 17L, 20L, 1L, 126L, 127L, 128L, 52L, 53L, 54L,
    55L, 56L, 57L, 58L, 22L, 163L, 139L, 140L, 141L, 142L, 143L,
    144L, 145L, 146L, 147L, 32L, 149L, 109L, 110L, 72L, 84L,
    112L, 113L, 114L, 115L, 116L, 77L, 16L, 19L, 5L, 11L, 82L,
    83L, 61L, 85L, 86L, 87L, 129L, 130L, 131L, 132L, 133L, 134L,
    135L, 59L, 60L, 123L, 62L, 62L, 63L, 64L, 65L, 66L, 67L,
    68L, 148L, 108L, 70L, 71L, 137L, 124L, 125L, 98L, 99L, 88L,
    89L, 117L, 78L, 79L, 80L, 81L, 122L, 91L, 138L, 97L, 90L,
    136L, 100L, 101L, 94L, 102L, 92L, 93L, 96L, 69L, 103L, 95L,
    105L, 119L, 107L, 104L, 118L, 120L, 121L, 106L, 106L, 109L,
    105L, 110L, 108L, 121L, 122L, 102L, 111L, 107L, 146L, 147L,
    104L, 149L, 150L, 112L, 148L, 103L, 145L, 120L, 117L, 4L,
    10L, 123L, 18L, 125L, 126L, 127L, 124L, 129L, 118L, 119L,
    91L, 92L, 93L, 94L, 95L, 96L, 97L, 98L, 99L, 128L, 101L,
    60L, 61L, 62L, 23L, 24L, 25L, 26L, 27L, 28L, 151L, 113L,
    114L, 115L, 116L, 3L, 9L, 15L, 78L, 79L, 80L, 81L, 82L, 83L,
    84L, 85L, 86L, 87L, 130L, 131L, 132L, 133L, 134L, 135L, 136L,
    137L, 138L, 139L, 140L, 100L, 59L, 142L, 143L, 144L, 165L,
    62L, 63L, 64L, 65L, 66L, 67L, 152L, 153L, 154L, 155L, 156L,
    157L, 158L, 159L, 160L, 161L, 40L, 16L, 19L, 5L, 11L, 17L,
    20L, 88L, 89L, 90L, 13L, 21L, 162L, 164L, 166L, 2L, 8L, 12L,
    14L, 141L, 58L, 22L, 163L, 74L, 167L, 76L, 77L, 39L, 41L,
    42L, 68L, 69L, 70L, 71L, 72L, 73L, 7L, 75L, 49L, 50L, 51L,
    52L, 53L, 43L, 44L, 45L, 46L, 1L, 6L, 34L, 48L, 36L, 37L,
    38L, 56L, 57L, 54L, 55L, 29L, 35L, 32L, 33L, 30L, 31L, 47L,
    66L, 64L, 62L, 67L, 103L, 65L, 101L, 63L, 58L, 59L, 60L,
    102L, 62L, 99L, 100L, 77L, 37L, 38L, 39L, 40L, 41L, 42L,
    43L, 44L, 61L, 48L, 49L, 50L, 51L, 52L, 53L, 54L, 55L, 56L,
    57L, 12L, 14L, 22L, 163L, 137L, 138L, 165L, 167L, 23L, 24L,
    25L, 68L, 69L, 70L, 71L, 72L, 73L, 74L, 75L, 76L, 36L, 3L,
    9L, 15L, 78L, 79L, 80L, 81L, 82L, 45L, 46L, 47L, 86L, 87L,
    88L, 89L, 90L, 91L, 92L, 93L, 94L, 8L, 135L, 136L, 97L, 98L,
    34L, 139L, 140L, 141L, 142L, 26L, 27L, 28L, 29L, 30L, 31L,
    32L, 33L, 17L, 35L, 154L, 155L, 156L, 18L, 4L, 10L, 16L,
    19L, 83L, 84L, 85L, 110L, 20L, 1L, 6L, 7L, 13L, 21L, 162L,
    164L, 166L, 95L, 96L, 109L, 11L, 111L, 112L, 113L, 114L,
    115L, 143L, 104L, 105L, 106L, 107L, 108L, 5L, 149L, 123L,
    124L, 125L, 126L, 127L, 157L, 158L, 159L, 160L, 161L, 121L,
    134L, 153L, 150L, 151L, 152L, 130L, 131L, 128L, 129L, 148L,
    144L, 132L, 2L, 116L, 133L, 122L, 146L, 147L, 120L, 145L,
    118L, 119L, 117L), .Label = c("A_1", "A_2", "A_LS", "A_PC",
    "A_PM", "B_1", "B1_1", "B1_2", "B1_LS", "B1_PC", "B1_PM",
    "B_2", "B2_1", "B2_2", "B2_LS", "B2_PC", "B2_PM", "B_LS",
    "B_PC", "B_PM", "C_1", "C_2", "C386", "C387", "C388", "C389",
    "C390", "C391", "C392", "C393", "C394", "C395", "C396", "C397",
    "C398", "C399", "C400", "C401", "C402", "C403", "C404", "C405",
    "C406", "C407", "C408", "C409", "C410", "C411", "C412", "C413",
    "C414", "C415", "C416", "C417", "C418", "C419", "C420", "C421",
    "C422", "C423", "C424", "C425", "C426", "C427", "C428", "C429",
    "C430", "C431", "C432", "C433", "C434", "C435", "C436", "C437",
    "C438", "C439", "C440", "C441", "C442", "C443", "C444", "C445",
    "C446", "C447", "C448", "C449", "C450", "C451", "C452", "C453",
    "C454", "C455", "C456", "C457", "C458", "C459", "C460", "C461",
    "C462", "C463", "C464", "C465", "C466", "C467", "C468", "C469",
    "C470", "C471", "C472", "C473", "C474", "C475", "C476", "C477",
    "C478", "C479", "C480", "C481", "C482", "C483", "C484", "C485",
    "C486", "C487", "C488", "C489", "C490", "C491", "C492", "C493",
    "C494", "C495", "C496", "C497", "C498", "C499", "C500", "C501",
    "C502", "C503", "C504", "C505", "C506", "C507", "C508", "C509",
    "C510", "C511", "C512", "C513", "C514", "C515", "C516", "C517",
    "C518", "C519", "C520", "C521", "C522", "C523", "C524", "D_1",
    "D_2", "E_1", "E_2", "F_1", "F_2"), class = "factor"), zona = structure(c(1L,
    1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
    1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L,
    2L, 2L, 2L, 2L, 1L, 2L, 2L, 2L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
    1L, 1L, 2L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 1L,
    1L, 1L, 1L, 2L, 2L, 2L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
    1L, 2L, 2L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
    1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 1L, 1L,
    1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
    1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
    1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
    1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
    1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
    1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 1L, 2L, 1L, 1L, 1L,
    1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
    1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L,
    2L, 2L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
    1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 1L,
    1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
    1L, 2L, 2L, 2L, 2L, 2L, 2L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L,
    2L, 2L, 2L, 2L, 1L, 1L, 2L, 2L, 1L, 2L, 1L, 1L, 1L, 1L, 1L,
    1L, 1L, 1L, 1L, 1L, 1L, 2L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
    1L, 1L, 2L, 2L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
    1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
    1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
    1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 1L,
    1L, 2L, 2L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
    1L, 2L, 2L, 2L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
    1L, 1L, 1L, 1L, 1L, 1L, 2L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
    1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 1L, 1L, 1L, 1L, 2L,
    2L, 2L, 2L, 2L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L,
    2L, 2L, 1L, 1L, 1L, 2L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
    1L, 1L, 2L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
    1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 1L, 1L,
    1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L), .Label = c("campione", "controllo"
    ), class = "factor"), variable_value = c(7.75, 7.83, 8, 9,
    7.2, 7.5, 6.5, 6.4, 6.2, 8, 7.75, 7.6, 8.5, 7, 8.25, 8.25,
    9, 7, 7.5, 8.17, 8.75, 6.67, 7.6, 5.83, 6.75, 5.6, 9.48,
    8.35, 8.37, 7.5, 5.5, 6.45, 6.22, 9.3, 8.62, 7, 6, 6.17,
    5.71, 9, 8.75, 13.5, 7.75, 7.6, 8.33, 8, 8.75, 7.4, 8, 8.17,
    6.17, 7, 8.5, 8, 8.45, 7.82, 6, 8.7, 10.1, 8.64, 9, 8, 6.6,
    6.6, 7, 7.66, 9.19, 7.67, 10, 8, 6.2, 6.2, 6.25, 7, 6, 6,
    6.4, 7, 7.75, 8, 7, 7, 9, 9, 7.8, 7, 6.17, 7, 8.25, 7, 8.6,
    6.6, 8.25, 8, 8, 6.5, 6.75, 6.2, 6, 8.25, 6, 8.38, 9.16,
    7.7, 8, 8, 5.6, 7.67, 7.67, 6.33, 9, 7.5, 7.33, 6.8, 7, 7,
    8, 6, 5.8, 7, 6, 6, 5.8, 7.25, 8.8, 8.5, 8, 8.25, 7.75, 8.4,
    8.5, 8.25, 7.25, 6, 7, 7, 7, 6.33, 7, 7, 8, 7.25, 6.67, 7.33,
    5, 6, 7, 8, 7, 8, 8, 8, 8, 8, 7.67, 8, 8, 8.25, 7, 9.5, 8,
    6, 8.2, 7, 6.5, 7, 6, 7.8, 0.12, 0.28, 0.12, 0.1, 0.24, 0.1,
    0.1, 0.12, 0.15, 0.22, 0.13, 0.1, 0.11, 0.1, 0.12, 0.13,
    0.13, 0.11, 0.1, 0.1, 0.1, 0.15, 0.14, 0.1, 0.15, 0.1, 0.1,
    0.1, 0.1, 0.1, 0.1, 0.1, 0.07, 0.09, 0.1, 0.1, 0.09, 0.1,
    0.11, 0.1, 0.08, 0.1, 0.1, 0.11, 0.1, 0.1, 0.15, 0.13, 0.15,
    0.1, 0.16, 0.13, 0.12, 0.1, 0.1, 0.12, 0.1, 0.14, 0.14, 0.025,
    0.12, 0.12, 0.11, 0.12, 0.13, 0.13, 0.11, 0.09, 0.1, 0.08,
    0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.2, 0.13, 0.1, 0.1, 0.1, 0.11,
    0.09, 0.15, 0.1, 0.1, 0.1, 0.11, 0.09, 0.12, 0.12, 0.12,
    0.12, 0.16, 0.1, 0.1, 0.1, 0.1, 0.2, 0.15, 0.1, 0.14, 0.12,
    0.15, 0.025, 0.16, 0.18, 0.16, 0.025, 0.15, 0.08, 0.09, 0.1,
    0.15, 0.17, 0.11, 0.05, 0.05, 0.12, 0.15, 0.12, 0.025, 0.1,
    0.11, 0.17, 0.16, 0.12, 0.05, 0.12, 0.12, 0.13, 0.17, 0.13,
    0.14, 0.12, 0.12, 0.11, 0.12, 0.13, 0.15, 0.12, 0.12, 0.1,
    0.1, 0.12, 0.1, 0.13, 0.13, 0.18, 0.1, 0.14, 0.12, 0.1, 0.1,
    0.18, 0.2, 0.15, 0.1, 0.11, 0.13, 0.11, 0.24, 0.16, 0.13,
    0.15, 0.15, 0.22, 0.1, 85.75, 63.25, 43.6, 84.5, 84, 95.4,
    98, 35.6, 79.6, 71.6, 73.2, 84, 54, 89, 99, 94.75, 70.6,
    92.25, 84.83, 78.5, 70.17, 92.5, 94.67, 93.75, 75.2, 64.75,
    66, 75.6, 82.4, 80.2, 78.8, 81, 79, 75.6, 79.2, 85.9, 57,
    93.9, 97.9, 96.25, 84, 53.9, 56.1, 108.5, 111.75, 104.5,
    78.25, 82.75, 87.25, 86.05, 85, 96, 102.25, 100.5, 100, 77,
    84.3, 83.9, 52, 90.67, 85.75, 76.67, 86.33, 93.67, 70.5,
    86.6, 77.67, 86.33, 74, 73.67, 86.67, 87.5, 72, 89.67, 93,
    95, 93.5, 96, 88, 91, 86, 104.5, 90, 86.5, 85, 100.25, 81.25,
    93.2, 109.75, 105, 104, 87.8, 99.75, 92.67, 47, 88.2, 73,
    95, 94, 98.7, 100.4, 91.5, 63, 94.2, 89.33, 90.33, 83.67,
    75.6, 86.8, 99.7, 90, 88.7, 88.4, 99.8, 76.4, 57.8, 52.5,
    93, 91, 108, 91.5, 105, 98, 69.5, 79.75, 68.6, 103, 81, 90,
    101.2, 102.6, 96.6, 100.8, 81, 90, 65, 79, 102.67, 102, 107,
    107.5, 93, 70.2, 70.2, 67, 90.33, 71.5, 61.17, 64.6, 84.8,
    87.5, 96.67, 76, 101, 100.75, 97.8, 77.4, 83.4, 79, 79, 55,
    59.33, 98, 95.25, 82, 87, 70, 91), LCB_pelite = c(17, 17,
    17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17,
    17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17,
    17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17,
    17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17,
    17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17,
    17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17,
    17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17,
    17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17,
    17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17,
    17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17,
    17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17,
    17, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2,
    0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2,
    0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2,
    0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2,
    0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2,
    0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2,
    0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2,
    0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2,
    0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2,
    0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2,
    0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2,
    0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2,
    0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2,
    0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2,
    0.2, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50,
    50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50,
    50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50,
    50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50,
    50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50,
    50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50,
    50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50,
    50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50,
    50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50,
    50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50,
    50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50,
    50, 50, 50, 50, 50), LCB = c(25, 25, 25, 25, 25, 25, 25,
    25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
    25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
    25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
    25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
    25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
    25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
    25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
    25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
    25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
    25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
    25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 0.35, 0.35, 0.35,
    0.35, 0.35, 0.35, 0.35, 0.35, 0.35, 0.35, 0.35, 0.35, 0.35,
    0.35, 0.35, 0.35, 0.35, 0.35, 0.35, 0.35, 0.35, 0.35, 0.35,
    0.35, 0.35, 0.35, 0.35, 0.35, 0.35, 0.35, 0.35, 0.35, 0.35,
    0.35, 0.35, 0.35, 0.35, 0.35, 0.35, 0.35, 0.35, 0.35, 0.35,
    0.35, 0.35, 0.35, 0.35, 0.35, 0.35, 0.35, 0.35, 0.35, 0.35,
    0.35, 0.35, 0.35, 0.35, 0.35, 0.35, 0.35, 0.35, 0.35, 0.35,
    0.35, 0.35, 0.35, 0.35, 0.35, 0.35, 0.35, 0.35, 0.35, 0.35,
    0.35, 0.35, 0.35, 0.35, 0.35, 0.35, 0.35, 0.35, 0.35, 0.35,
    0.35, 0.35, 0.35, 0.35, 0.35, 0.35, 0.35, 0.35, 0.35, 0.35,
    0.35, 0.35, 0.35, 0.35, 0.35, 0.35, 0.35, 0.35, 0.35, 0.35,
    0.35, 0.35, 0.35, 0.35, 0.35, 0.35, 0.35, 0.35, 0.35, 0.35,
    0.35, 0.35, 0.35, 0.35, 0.35, 0.35, 0.35, 0.35, 0.35, 0.35,
    0.35, 0.35, 0.35, 0.35, 0.35, 0.35, 0.35, 0.35, 0.35, 0.35,
    0.35, 0.35, 0.35, 0.35, 0.35, 0.35, 0.35, 0.35, 0.35, 0.35,
    0.35, 0.35, 0.35, 0.35, 0.35, 0.35, 0.35, 0.35, 0.35, 0.35,
    0.35, 0.35, 0.35, 0.35, 0.35, 0.35, 0.35, 0.35, 0.35, 0.35,
    0.35, 0.35, 0.35, 0.35, 0.35, 100, 100, 100, 100, 100, 100,
    100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100,
    100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100,
    100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100,
    100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100,
    100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100,
    100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100,
    100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100,
    100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100,
    100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100,
    100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100,
    100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100,
    100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100,
    100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100,
    100, 100, 100, 100, 100, 100), LCL = c(32, 32, 32, 32, 32,
    32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
    32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
    32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
    32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
    32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
    32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
    32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
    32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
    32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
    32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
    32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 0.8,
    0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8,
    0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8,
    0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8,
    0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8,
    0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8,
    0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8,
    0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8,
    0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8,
    0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8,
    0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8,
    0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8,
    0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8,
    0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8,
    0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 360,
    360, 360, 360, 360, 360, 360, 360, 360, 360, 360, 360, 360,
    360, 360, 360, 360, 360, 360, 360, 360, 360, 360, 360, 360,
    360, 360, 360, 360, 360, 360, 360, 360, 360, 360, 360, 360,
    360, 360, 360, 360, 360, 360, 360, 360, 360, 360, 360, 360,
    360, 360, 360, 360, 360, 360, 360, 360, 360, 360, 360, 360,
    360, 360, 360, 360, 360, 360, 360, 360, 360, 360, 360, 360,
    360, 360, 360, 360, 360, 360, 360, 360, 360, 360, 360, 360,
    360, 360, 360, 360, 360, 360, 360, 360, 360, 360, 360, 360,
    360, 360, 360, 360, 360, 360, 360, 360, 360, 360, 360, 360,
    360, 360, 360, 360, 360, 360, 360, 360, 360, 360, 360, 360,
    360, 360, 360, 360, 360, 360, 360, 360, 360, 360, 360, 360,
    360, 360, 360, 360, 360, 360, 360, 360, 360, 360, 360, 360,
    360, 360, 360, 360, 360, 360, 360, 360, 360, 360, 360, 360,
    360, 360, 360, 360, 360, 360, 360, 360, 360, 360, 360)), .Names = c("variable",
"Area", "Campione", "zona", "variable_value", "LCB_pelite", "LCB",
"LCL"), row.names = c(NA, -504L), class = "data.frame")

and here the code:
require("reshape2")
require("ggplot2")
require("plyr")

gf<-rename(gf, c("value"="variable_value"))
gf_melt<-melt(gf, id=c("variable", "Area", "Campione", "zona", "variable_value"), variable.name="limite")

gf_melt<-rename(gf_melt, c("value"="valore_limite"))

ggplot(gf_melt)+
    stat_ecdf(aes(x=variable_value, color=zona))+
    facet_wrap(~variable, scales="free_x")+
    geom_vline(aes(xintercept=valore_limite, color=limite, linetype="dotted"))

This the result:

Why the linetype of geom_vline are not dotted?
And a last question. Can I separate the legend of geom_vline from that of stat_ecdf in order to have 2 legends: the first with campione and controllo and the second with LCB_pelite, LCB and LCL?

A: The following should work and give the solution to your problem! The trick is to put color and linetype in separate parentheses:
p1<-ggplot(gf_melt) + stat_ecdf(aes(x=variable_value, color=zona))
p1<-p1+facet_wrap(~variable, scales="free_x")
p1<-p1+geom_vline(aes(xintercept=valore_limite, color=limite), linetype="dotted")
p1


text:
Q: Using String Type in Integer Type? i have a serious problem in C# console application,  the following code doesn't work as what i want... it must ask me to type the following letters value, then it must calculate with the values i typed, but when i type a character such as 'x', it doesn't make it equivalent to "1", how can i solve that problem???, what is the certain solution??
"x" value should be equivalent to 1
string nun = "2";
        Console.WriteLine("Type the 'A' value");
        double a = Convert.ToInt32(Console.ReadLine());

        if (a=='x') {

            a = 1

        }
        Console.WriteLine("Type the 'B' value");
        double b = Convert.ToInt32(Console.ReadLine());

        Console.WriteLine("Type the 'C' value");
        double c = Convert.ToInt32(Console.ReadLine());

        double delta = Math.Pow(b,2) - (4*a*c);

        if(delta > 0 ) {

            double x1 = (-b + Math.Sqrt(delta) / 2 * a);
            Console.WriteLine("value of x1: {0}",Convert.ToInt32(x1));
            double x2 = (-b - Math.Sqrt(delta) / 2 * a);

            Console.WriteLine("value of x2: {0}",Convert.ToInt32(x2));
        }

        else if (delta < 0) {

            Console.WriteLine("there is no any different real root in this equation!");

        }

A: You can do like this:
    Console.WriteLine("Type the 'A' value");
    string s = Console.ReadLine();
    double a = s == "x" ? 1 : Convert.ToInt32(s);

NOTE: the code doesn't care about some conversion exception, you should use try-catch to deal with it.


text:
Q: OpenSSL Digital Signature with ES256 I am trying to reproduce a valid signature for the JSON Web Token.
I make the privat key with: openssl ecparam -genkey -name prime256v1 -noout -out private.pem
also convert this from Pem to P8 with: openssl pkcs8 -topk8 -nocrypt -in private.pem -out privateKey.p8
The unsigned Token, which is the header and payload in Base64Url.
If I make my Signature with:
openssl dgst -sha256 -sign -privateKey.p8 -out signature.sha256 unsignedToken.txt and then make it Base64 like: openssl base64 -in signature.sha256
I dont get a valid signature, and also the valid Signature has to be 86 Characters. In my case I get 96 Character and every Signature is starting with 'ME'.


text:
Q: Access forbidden for Dependency Proxy in Gitlab CE I am trying to use the Gitlab Dependency Proxy on my on-promise instance of Gitlab CE 14.4.1 in the CI/CD jobs. I have updated the local gitlab runners to version 14.4.0, and activated the Dependency Proxy for the shared group. When running a simple job like:
test:
  image: ${CI_DEPENDENCY_PROXY_GROUP_IMAGE_PREFIX}/node:12.5.0

I get the following error:
ERROR: Preparation failed: Error response from daemon: Get https://<my-gitlab-url>/v2/<my-group>/dependency_proxy/containers/node/manifests/12.5.0: error parsing HTTP 403 response body: no error details found in HTTP response body: "{\"message\":\"access forbidden\",\"status\":\"error\",\"http_status\":403}" (executor_docker.go:188:0s)


text:
Q: Google Places Autocomplete Not Searching Address I'm using google autocomplete in my application for address search. I'm typing my address but results are not found for it mitskevichi 14. But if I go to google maps website and type same address there, result is found.
I've tried, mitskevichi 14 with any possible setups for
https://developers.google.com/maps/documentation/javascript/examples/places-autocomplete
and
https://developers.google.com/maps/documentation/javascript/examples/places-searchbox
and couldn't get any results. When I try
https://www.google.com/maps
I Get results.
Any ideas how to solve this problem?
Here is my sample
var Autocomplete = new google.maps.places.Autocomplete(document.getElementById('GoogleAutocomplete'));

https://jsfiddle.net/b4nz6Lk5/3/

A: I finally found a solution. I used two type of google services:
var Service = new google.maps.places.AutocompleteService();
var Request = { input: "mitskevichi 14", language:'en', types: ['geocode'] };
Service.getPlacePredictions(Request, function (Results, Status) {
    ...
});

And
var Service = new google.maps.Geocoder();
var Request = { address: 'mitskevichi 14', region: 'GE' };
Service.geocode(Request, function (Results, Status) {
    ...
});

Combined results from both and get what I initially wanted.


text:
Q: How to remove icons from an ActionBarSherlock's overflow menu on Android 2.3? I have an app with ActionBarSherlock using theme Theme.Sherlock.Light.DarkActionBar. Action bar is dark and my menu icons are light. When I run my app on small layouts, 2 or 3 menu items with icons are displayed in the overflow menu.
On Android 3+ the overflow menu items will not display their icons, but on Android 2.3 and earlier I see menu tiles with almost invisible icons, because the tile color is white and icons are close to be white.

As you can see, the light icons are invisible on a white background, but they must have light color to be visible on a dark action bar:

Can I remove icons when menu items are displayed in the overflow menu?

A: you could use configuration qualifiers.
e.g.
make a drawable folder
/res/drawable-v11/ put all the "light" icons in it.
and for the darker icons use the
/res/drawable/ folder.
be sure to use the same filenames in both folders.
I hope I have understood your problem and this might help you.
However, if you want to change the drawables JUST for the overflow menu, I don't think it's possible. Also because the menu icons are not intended to be used like that. ActionBarSherlock is probably also because of issues like this, not an official library.

A: I was also facing the same issue:
there are many ways you can achieve this rather than removing image:
1)you can use respective drawable folder to put light and dark image.
2)You can also change the background color by code of your menu by checking your device version.
If you device doen't support overflow menu, the, you can change the background color of your menu as well as you can also change menu text color.
I was also facing the same issue and resolved using following one:
static final Class<?>[] constructorSignature = new Class[] {Context.class, AttributeSet.class};

class MenuColorFix implements LayoutInflater.Factory {
public View onCreateView(String name, Context context, AttributeSet attrs) {
    if (name.equalsIgnoreCase("com.android.internal.view.menu.ListMenuItemView")) {
        try {
            Class<? extends ViewGroup> clazz = context.getClassLoader().loadClass(name).asSubclass(ViewGroup.class);
            Constructor<? extends ViewGroup> constructor = clazz.getConstructor(constructorSignature);
            final ViewGroup view = constructor.newInstance(new Object[]{context,attrs});

            new Handler().post(new Runnable() {
                public void run() {
                    try {
                        view.setBackgroundColor(Color.BLACK);
                        List<View> children = getAllChildren(view);
                        for(int i = 0; i< children.size(); i++) {
                            View child = children.get(i);
                            if ( child instanceof TextView ) {
                                ((TextView)child).setTextColor(Color.WHITE);
                            }
                        }
                    }
                    catch (Exception e) {
                        Log.i(TAG, "Caught Exception!",e);
                    }

                }
            });
            return view;
        }
        catch (Exception e) {
            Log.i(TAG, "Caught Exception!",e);
        }
    }
    return null;
}
}

public List<View> getAllChildren(ViewGroup vg) {
ArrayList<View> result = new ArrayList<View>();
for ( int i = 0; i < vg.getChildCount(); i++ ) {
    View child = vg.getChildAt(i);
    if ( child instanceof ViewGroup) {
        result.addAll(getAllChildren((ViewGroup)child));
    }
    else {
        result.add(child);
    }
}
return result;
}

@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {
LayoutInflater lInflater = getLayoutInflater();
if ( lInflater.getFactory() == null ) {
    lInflater.setFactory(new MenuColorFix());
}
super.onCreateContextMenu(menu, v, menuInfo);
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.myMenu, menu);
}

3) change background color from styles.xml file
<style name="Theme.MyTheme" parent="Theme.Sherlock.ForceOverflow">
    <item name="actionBarStyle">@style/Widget.MyTheme.ActionBar</item>
    <item name="android:actionBarStyle">@style/Widget.MyTheme.ActionBar</item>
</style>

<style name="Widget.MyTheme.ActionBar" parent="Widget.Sherlock.ActionBar">
    <item name="android:background">#ff000000</item>
    <item name="background">#ff000000</item>
</style>

For me, all of the 3 worked fine
Hope, this will work for you as well

A: Another option is to remove the icons from the non-action items in onPrepareOptionsMenu.
The idea is to use actionbarsherlock's MenuItemImpl.isActionButton to figure out if each item is an action item, and if not to remove the icon.  This is made a little bit tricky because onPrepareOptionsMenu is called (at least) twice by ABS - the first time when it is building the action bar, in which case MenuItemImpl.isActionButton has not yet been set and will always return false.  If that's the case, you want to leave the icons alone.  Once the action bar has been built the isActionButton method will return true for action bar items, false otherwise.  So you want to remove the icons for the ones that return false.  This is what I came up with:
@Override
public boolean onPrepareOptionsMenu(Menu menu) {
    if (Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB) {
        boolean buildingOptionsMenu = false;
        for (int i=0; i<menu.size(); ++i) {
            MenuItemImpl mi = (MenuItemImpl)menu.getItem(i);
            if (mi.isActionButton()) {
                buildingOptionsMenu = true;
                break;
            }
        }

        if (buildingOptionsMenu) {
            for (int i=0; i<menu.size(); ++i) {
                MenuItemImpl mi = (MenuItemImpl)menu.getItem(i);
                if (!mi.isActionButton()) {
                    mi.setIcon(null);
                    mi.setIcon(0);
                }
            }
        }
    }
    return super.onPrepareOptionsMenu(menu);
}

You'll need these two imports:
import com.actionbarsherlock.view.Menu;
import com.actionbarsherlock.internal.view.menu.MenuItemImpl;

This works in ABS 4.3.0, but since it uses internal library classes it might not work with other versions of the library.

A: OS 2.x was a mess since the options menu background could be black or white, depending on the device, with no way to know which for sure.
The easy fix was to use grey (#888888) icons for Android 2.x & under and put your modern (ICS/JB) icons in a v11 folder for modern devices:
drawable      // old school icons
drawable-v11  // modern icons

Of course that means drawable-mdpi-v11, drawable-hdpi-v11, and so on.

A: A simple alternative to adding a whole set of duplicate dark icons for 2.x versions can be simply removing the icons from all the items that can go to the overflow menu. For example:
res/menu
<item
    android:id="@+id/menu_send_email"
    android:showAsAction="ifRoom"
    android:title="@string/menu_send_email"/>

res/menu-v11 (or even res/menu-v9, because 2.3 usually has a dark menu)
<item
    android:id="@+id/menu_send_email"
    android:icon="@drawable/ic_action_send_email"
    android:showAsAction="ifRoom"
    android:title="@string/menu_send_email"/>

Of course, you need to make the titles short enough to fit into the ActionBar at least on some larger screens, or settle with the fact that they always go into the overflow.


text:
Q: Revoke/ Disable HTTP Strict Transport Security How can I revoke HSTS header information?
I have a website that I want to migrate from HTTPS to HTTP.
I reconfigured Apache2 to serve only HTTP. Unfortunately, Chrome and Firefox still try to open the HTTPS version of the page automatically.
I assume that this is because the previous configuration which seems to still have effect.
<VirtualHost *:443>
...
Header always set Strict-Transport-Security "max-age=63072000; includeSubDomains"
...
</VirtualHost>

A: The idea of the HSTS header is that the each client visiting the page should locally store the information "until time ([now]+[max-age] seconds), this site should be accessed using HTTPS only". It is intended to foil man-in-the-middle attacks trying to make the client use an unencrypted connection.
So, any server-side attempts to redirect the client to a HTTP version of the page that used to have an unexpired HSTS header are likely to produce a scary warning message to the user. The only way to avoid this (other than waiting for the specified HSTS period to expire) is to delete the stored HSTS information from any client that has visited the site while the HSTS header was in use.
Here are instructions for this procedure for Chrome and Firefox.
Instructions for Chrome
Navigate to: chrome://net-internals/#hsts
Then type the fully-qualified name of your site to the "Query Domain" box, click the Query button and verify that the HSTS information is there. Then type the same name to the "Delete domain security policies" section and click on Delete.
Instructions for Firefox
Close all open tabs, then open the full history window (press Control-Shift-H on Windows/Linux, Command-Shift-H on Macs, or select History -> Show All History from the menu bar if it's visible). Find the site, right-click on it and select Forget About This Site.
If you need a method that could be automated, you could also edit the  SiteSecurityServiceState.txt file in the Firefox profile directory when Firefox is not running. The editor you use should use Unix/Linux style line endings. Find the line that begins with <fully-qualified name of your site>:HSTS and delete it.


text:
Q: How to check whether specific revision is present on some Mercurial remote? In Git SCM I'm using the following command to check whether a specific revision is present on some remote:
git fetch <remote> <revision> -q --dry-run

If the exit code of the command is zero that means the revision is present on the remote.
For Mercurial I tried the following command:
hg pull <remote> -r <revision> -q

It works but the problem is that it actually pulls the revision if present on the remote, but not locally. Is there an equivalent of the --dry-run option for Git, or some other way to do it in Mercurial which does not perform pulling of the specified revision, but only checks whether it is present on the remote?

A: hg in -r REV
 -r --rev REV [+]       a remote changeset intended to be added

Returns 0 if there are incoming changes, 1 otherwise.


text:
Q: Verifying text is present within certain element When creating selenium tests using the #{selenium} tag, how do you use complex XPath locators? I've got some simpler examples that work but I'd really like to avoid having to give every element an id just to facilitate testing.
I've tried variations like these:
#{selenium 'Sitemap'}
...
// These work:
assertTitle('Site Map')
verifyTextPresent('Site Map')
verifyTextPresent('Login')
verifyText('id=test', 'Login')
verifyText('//ul', 'Login')
verifyText('//ul[2]', 'Login')

// this one results in "Element //ul[@class=sitemap] not found"
verifyText('Login','//ul[@class=sitemap]')

#{/selenium}

Has anyone gotten the more complex versions working?  It looks like it should work according to the selenium docs. Also, is the creation of selenium tests in the context of Play documented anywhere?  The only mention of it that I can find are these trivial examples.

A: I disagree to a degree. Badly constructed xpaths that search through the entire DOM will slow down tests but well constructed xpaths should have minimal effect on speed (unless you are using IE which has a horrific JavaScript rendering engine).
Ideally you want to key your xpath to an ID as close to the area of the DOM you want to search as possible, this will ensure you are only searching a specific area of the DOM rather than using an xpath like the one shown above that will search through the entire DOM even it it does find a matching element quickly.
I'll provide some examples of what I would call good xpaths using http://www.lazeryattack.com as an example.  If you have anything specific in mind shout and I'll see what I can do to help:

*

*The Voice Comms link: //ul[@id='leftMenu']/li/a[.='Voice Comms']

*H3 element that contains a span element with the text "January VAT Increase": //div[@id='news']/h3[span[.='January VAT Increase']]

*The first paragraph of text under the above element: //div[@id='news']/h3[span[.='January VAT Increase']]/following-sibling::p[1]

*The second paragraph of text under the above element: //div[@id='news']/h3[span[.='January VAT Increase']]/following-sibling::p[2]

*Start searching from the featuredNews div and drop down to the h2 element with the text "New Look And Feel": //div[@id='featuredNews']/descendant::h2[.='New Look And Feel']

I would suggect using FireFox with the FireBug and FirePath extensions to help you work out xpaths, this is my personal favourite combination.

A: Did you try
//ul[@class='sitemap']

Notice the single quote around sitemap.
XPath would make your tests slow and id, name are better option to use.


text:
Q: how to individually call search scopes in spree I can't seem to get the scoping examples in spree to work.
https://github.com/spree/spree/blob/89cb914efb16eabc4f790c018c0a747a61d55aee/core/app/models/spree/product/scopes.rb
1.9.3p429 :021 >  Spree::Product.taxons_id_eq(1)
NoMethodError: undefined method `taxons_id_eq' for #<Class:0x007fb583e8d5d8>

Also when are the searches being called?
https://github.com/spree/spree/blob/89cb914efb16eabc4f790c018c0a747a61d55aee/core/lib/spree/core/search/base.rb#L44
I tried putting a debugger breakpoint at line 44 of spree::core::base::search but I couldn't retrieve the class of the search variable.
Update: It appears that all the other search scopes worked, but just that the method is not defined.

A: To do what you want. Take a look at the method add_search_scope. This method is defined in the file below
https://github.com/spree/spree/blob/master/core/app/models/spree/product/scopes.rb
This allows you to create the scope and register it as a search_scope (which is causing you problems)


text:
Q: SOLR norms for non-text fields There is no sense in norms for string and numerable fields, but are norms omitted by default for such fields?
I have old schema without "omitNorms=true" and I'm trying to understand, if omitting norms for non-text fields will reduce memory usage.
UPD
I know what are norms about.
I'm asking if norms for non-text fields are omitted by default, or not. Especially, because wiki says, that they are only useful for text fields

A: if you look at the documentation here: http://wiki.apache.org/solr/SchemaXml
it says:

omitNorms defaults to true for primitive field types
              (int, float, boolean, string...)

and later:

Only full-text fields or fields that need an index-time boost need norms.


text:
Q: Excel VBA plus =hyperlink() I'm attempting to write hyperlinks to cells via one button click from the ribbon in Excel 2007. These hyperlinks must, in turn, execute another routine that does stuff to the row on which they're located. However, the standard method of Worksheet_FollowHyperlink() will not work, as I need to execute this via an external xlam addin, and as far as I understand, this event triggers from hyperlink clicks located only in the same worksheet.
As a result, I have found that using the =HYPERLINK("#funName()","Click me") method works, but a problem exists that I am still experiencing.
The following is a trimmed down version of my already-working code:
Sub InsertLink() ' This is run directly by the callback for an IRibbonControl button click
  With Sheet1
    lastrow = Range("A" & Rows.count).End(xlUp).Row
    While i <= lastrow
      Range("E" & i).Value = "=HYPERLINK(""#consolidateDuplicate(A" & i & ",C" & i & ")"",""Copy this row to next"")"
    Wend
    Call MsgBox ("Finished inserting hyperlinks on each row.", vbOKOnly)
  End With
End Sub

Sub consolidateDuplicate(PN, Quantity)
  Dim thisRow, prevQuant As Long
  thisRow = Selection.Row
  MsgBox("You clicked the hyperlink for " & thisRow & "Q: " & Quantity & ", PN: " & PN)
End Sub

Clicking the ribbon button successfully writes all hyperlinks into their respective rows as expected. However, when I try to click any of these hyperlinks, thus executing consolidateDuplicate() in the same add-in module, I immediately receive a "Reference is not valid" warning followed by the MsgBox message.
I have tried removing all code from the routine to no avail. I also tried the standard brute-force bypass method of adding On Error Resume Next ... On Error Goto 0 as well as Application.DisplayAlerts = False ... Application.DisplayAlerts = True. Neither helps. I still receive the warning.
So while my script works fine and does what I want it to in the end, I feel like there should be a way to suppress the warning, or fix whatever is causing it, which I have a feeling, like Worksheet_FollowHyperlink(), is from storing the routine in the scope of an add-in module (required for my application), rather than keeping it totally contained in the calling workbook/sheet itself.
Any ideas?

A: Your consolidateDuplicate subroutine should be a Function, returning the address that the hyperlink should take you to.  The lack of a return value is what is causing the "Reference is not valid" error.
The following code might work, effectively telling the hyperlink to take you to the cell in which the hyperlink was located:
Function consolidateDuplicate(PN, Quantity) As Range
    Dim thisRow, prevQuant As Long
    thisRow = Selection.Row
    MsgBox ("You clicked the hyperlink for " & thisRow & "Q: " & Quantity & ", PN: " & PN)
    Set consolidateDuplicate = Selection
End Function


text:
Q: Performance Enhancement in CSV value change though powershell Please reference earlier the question :
How to get replace by id (Id value get from XML) and put into CSV, powershell
I need add ForEach-Object instead of ForEach, I have 11,000 rows. So, it takes too much time.
foreach ($csvRow in $csvRows) {
  foreach ($columnName in $columnNames) {
    $id = $csvRow.$columnName
    if (-not $id) { continue }
    $newId = @($xmlDoc.enum_types.enum_type.Where( { $_.field_name -eq $columnName }, 'First').
               items).ForEach( { $_.item }).Where( { $_.id -eq $id }).value
        $csvRow.$columnName = $newId
  }
}
$csvRows | Export-Csv -NoTypeInformation -Encoding utf8 $CSVpath

A: One thing you could do is pre-compute your lookups from the "enums" xml in your other question.
Original code - 7649 milliseconds
# setup

$xml = @"
<enum_types>
  <enum_type field_name="Test1">
    <items>
      <item>
        <id>1</id>
        <value>A</value>
      </item>
    </items>
  </enum_type>
  <enum_type field_name="Test2">
    <items>
      <item>
        <id>1</id>
        <value>A</value>
      </item>
    </items>
  </enum_type>
</enum_types>
"@;

$enums = [xml] $xml;

$csv = @("Test1, Test2");
$csv += 1..110000 | % { "1, 1" }

$data = $csv | ConvertFrom-Csv

$columnNames = @( "Test1", "Test2" );

# perf test - 7649 milliseconds
measure-command -expression {
    foreach ($csvRow in $data)
    {
        foreach ($columnName in $columnNames)
        {
            $id = $csvRow.$columnName
            if ( -not $id )
            {
                continue;
            }
            $newId = @($enums.enum_types.enum_type.Where( { $_.field_name -eq $columnName }, 'First').
                items).ForEach( { $_.item }).Where( { $_.id -eq $id }).value
            $csvRow.$columnName = $newId
        }
    }
}

With pre-computed lookups - 792 milliseconds
# setup

... as above ...

# pre-compute lookups

$lookups = @{};
foreach( $enum_type in $enums.enum_types.enum_type )
{
    $lookups[$enum_type.field_name] = @{}
    foreach( $item in $enum_type.items.item )
    {
        $lookups[$enum_type.field_name][$item.id] = $item.value
    }
}
write-host ($lookups | convertto-json -depth 99)
# {
#   "Test1": {
#     "1": "A"
#   },
#   "Test2": {
#     "1": "A"
#   }
# }

# perf test - 792 milliseconds
measure-command -expression {
    foreach ($csvRow in $data)
    {
        foreach ($columnName in $columnNames)
        {
            $id = $csvRow.$columnName
            if (-not $id)
            {
                continue;
            }
            $csvRow.$columnName = $lookups[$columnName][$id]
        }
    }
}

There's possibly more you could squeeze out of this approach, but it's already a 10x speedup (in my very limited benchmarks).

A: Preload all the new items into hash tables:
$Types = $xmlDoc.enum_types.enum_type
$HashTable = @{}

Import-Csv .\1.Csv |ForEach-Object { $Names = $Null } {
    if (!$Names) {
        $Names = $_.psobject.Properties.Name
        foreach ($Name in $Names) {
            $HashTable[$Name] = @{}
            foreach ($Field in $Types.Where{$_.field_name -eq $Name}) {
                foreach ($Item in $Field.Items.Item) {
                    $HashTable[$Name][$Item.Id] = $Item.Value
                }
            }
        }
    }
    foreach ($Name in $Names) {
        $id = $_.$Name
        If ($HashTable[$Name].Contains($Id)) {
            $_.$Name = $HashTable[$Name][$Id]
        }
    }
    $_
} |Export-Csv .\1New.Csv -NoTypeInformation -Encoding utf8


text:
Q: Make a countdown without freezing application on Android? How can I make a countdown without to freeze the Application in Android ? For example a countdown which is counts the 10 to a 1 down .

A: From what I can get from your question, you are most likely having trouble because you are doing some sort of count-down in the main (UI) Thread. This will definitely cause the app to freeze for the duration of the timer. Simply use a timer, and do something like this:
//global variables
private int currTime = 10;
private TextView myTimer;//need to initialize this in your layout using findViewById, or programmatically

final Timer t = new Timer();
currTime = 10;
t.scheduleAtFixedRate(new TimerTask() {
    @Override
    public void run() {
        runOnUiThread(new Runnable() {//You need this, or a Handler to ensure the UI is changed on the correct thread.
            currTime--;
            myTimer.setText(currTime);//myTimer is a global reference to your TextView.
            if (currTime == 0)
                t.cancel();
        });
    }
}, 10000);//note that this is the duration in milliseconds (1/1000 of a second) - so 10000 for 10 seconds.


text:
Q: Android app about cookie in WebView I have a httpURLConnection request URL, POST Login request.
And when login success obtain cookies.
I embed a WebView in app now, the WebView is used for loading a connection that can visit after login.
The question is the connection I insert with WebView can't connect.the reason I can find is the cookies don't put in WebView right.
How to put cookies in WebView success?


text:
Q: problem in writing number in csv file using python I have this array of strings:
my_array = ['5.0', '6.066', '7.5', '7.83', '9.75']

and I want to write first 3 items on my csv file.
I am using this code
n=0
with open("file.csv",'w',newline="",)as e:
    while n<3:
        writer=csv.writer(e)
        writer.writerow(my_array[n])
        n=n+1

The output is:
5,.,0
6,.,0,6,6
7,.,5

but I don't want to separate numbers with comma
for example the output must be:
5.0
6.066
7.5

What should I do?

A: writerow() wants an iterable, and each element of that iterable is written as one column of the csv. Because a string is an iterable, each element (character) of that string is written to a separate column. To fix this, pass a list to writerow() that only contains your single string
You can do something like this:
import csv

my_array=['5.0', '6.066', '7.5', '7.83', '9.75']

with open('example.csv', 'w+') as f:
    writer = csv.writer(f)
    for elm in my_array[:3]:
        writer.writerow([elm])

Output of example.csv:
5.0
6.066
7.5

A: Apparently you don't actually want a CSV (comma separated values) file, so don't use the csv module.
Simply write each string from the list to a separate line in the file.
Some options are:
with open("file.txt", "w") as f:
    for value in my_array[:3]:
        print(value, file=f)

with open("file.txt", "w") as f:
    f.write("\n".join(my_array[:3]))


text:
Q: Get approval status in edit form Is there an easy way to retrieve item approval status (moderationStatus) inside the edit form? During display of edit form I need to know wheather the currently edited item was approved or not. I see that the information is not reflected in a hidden column or else. I have the following ideas:

*

*Custom flag column that indicates if the item was approved.

*Get the current item via js rest call and check OData__ModerationStatus.

I just want to know if there is an easier way to get the moderationStatus of the item I am editing.
Thank you!

A: Since Content Approval status is stored in List Item (_ModerationStatus) I would recommend to leverage any client APIs (JSOM, REST or SOAP) for that purpose.
How to retrieve content approval status using client APIs
JSOM
function getListItemModerationInfo(listId,itemId,success,error)
{
   var ctx = SP.ClientContext.get_current();
   var web = ctx.get_web();
   var list = web.get_lists().getById(listId);
   var item = list.getItemById(itemId);
   ctx.load(item);

   ctx.executeQueryAsync(
      function() {
          var moderationInfo = {};
          moderationInfo.Status = item.get_item('_ModerationStatus');
          moderationInfo.Comments = item.get_item('_ModerationComments');
          success(moderationInfo);
      },
      error);
}

Usage: how to retrieve content approval status of list item in edit form
var listId = _spPageContextInfo.pageListId; //current List Id
var itemId = parseInt(GetUrlKeyValue('ID')); //current Item Id

getListItemModerationInfo(listId,itemId,
   function(info){
       console.log(info.Status);
   },
   function(sendera,args){
       console.log(args.get_message());
   });

REST
Endpoint: /_api/web/lists/getById('<guid>')/items(<id>)?$expand=FieldValuesAsHtml
function getListItemDetails(webUrl,listId,itemId)
{
    var url = webUrl + "/_api/web/lists/getById('" + listId + "')/items(" + itemId + ")?$expand=FieldValuesAsHtml";
    return $.ajax({
        url: url,
        method: "GET",
        contentType: "application/json;odata=verbose",
        headers: {
           "Accept": "application/json;odata=verbose"
        }
    });
}

Usage
var listId = _spPageContextInfo.pageListId;
var itemId = parseInt(GetUrlKeyValue('ID'));
getListItemDetails(_spPageContextInfo.webAbsoluteUrl,listId,itemId)
.done(function(data)
{
    var moderationStatusName = data.d.FieldValuesAsHtml['OData__x005f_ModerationStatus'];
    console.log(moderationStatusName);
})
.fail(function(error){
    console.log(JSON.stringify(error));
});


text:
Q: How to create AWS EC2 instance shared folders A Dobut, how to create sharable folders between two EC2 windows systems?
And how to create a share folder in two Linux machine?
Is the only option for Linux is EFS and windows is FSx?
I couldn't find a way, can anybody help.
I tried with enabling proper ports in security groups, and made the discovery on in network and security in windows. But no results.

A: What is the purpose of shared folders? Based on that you can use services.
There is also a feature called EBS multi attach where you can attach the same io1/io2 type ebs volume to different ec2 in same AZ.
EFS for linux is pay per gb used. It costs roughly <$2 for 10 GB/Month. FSx is bit costly.
Check which one suits your needs & decide.


text:
Q: Rails 4 doesn't call my controller's default_url_options method from my HAML view I want to change the host and port for all link_to calls from my HAML views. I implemented default_url_options in my controller(s), but it is never called.
class WelcomeController < ApplicationController
  # ...
  def default_url_options
    { host: 'mysite.com:34567' }
  end
end

Where ApplicationController is ApplicationController < ActionController::Base
Is this supposed to work? Perhaps someone can point me to a working example?
I am using Rails 4.2.4

A: Shouldn't that method be within ApplicationController?
That way all controllers will inherit and override the default routes host.
Also note from the documentation:

In a given request, the method is not actually called for every single generated URL; for performance reasons, the returned hash is cached, there is at most one invocation per request.

You can also modify your environment to apply it from there, modifying development.rb for instance and adding:
Rails.application.routes.default_url_options[:host] = 'mysite.com:34567'

A: Ok--I couldn't get it to work exactly how I wanted, but I did find a reasonable solution:

*

*Create a helper for my controller link_to_asset. Using root_url respects what is returned by default_url_options in my controller.
module ApplicationHelper
  def link_to_asset(asset)
    "#{root_url}#{asset.path}"
  end
end

*Use in my view, like this
%li.link= link_to asset.name, link_to_asset(asset)


text:
Q: How do I get my cat off my head in Mo Creatures So I was playing in minecraft modded with Mo'Creatures and I have a cat on my head and I can't get it off. I can't find anything about how to get it off and whatever I try it doesn't work. Also I'm using the 1.10.2 version of Mo'Creatures. So how do I get my cat off my head?

A: According to this answer you must:

Look up at the creature and right click on it when it's on your head to remove it.

Full credits go to user user43291 who is sadly, no longer with us.


text:
Q: Postgresql - slow "select * from table limit 1" query I'm using PostgreSQL 9.3. I have database with one table, and this table have over 600 milions rows. When I connect to this database first query is really slow:
explain analyze select * from request_log limit 1;
Limit  (cost=0.00..0.02 rows=1 width=61) (actual time=481439.127..481439.129 rows=1 loops=1)
   ->  Seq Scan on request_log  (cost=0.00..13996870.79 rows=651159679 width=61) (actual time=481439.123..481439.123 rows=1 loops=1)
Total runtime: 481440.488 ms

I don't understand that - why seq scan just don't stop after reading first row?

A: I think that you mis-reading the output from explain analyse.
The line "Limit  (cost=0.00..0.02 rows=1 width=61) (actual time=481439.127..481439.129 rows=1 loops=1)" shows that it has limited the sequential scan.
If you try it without the limit
EXPLAIN ANALYSE SELECT * FROM request_log;

you will (probably) see that it takes a lot longer.
The problem is something to do with data retrieval in your database.  Check your postgresql.conf file under RESOURCE USUAGE and QUERY TUNING - look for anything unusual.  Check you postgresql log for anything unusual.


text:
Q: How to make space around bar clickable in echarts bar chart? The 'click' event gets triggered only when clicked exactly inside the bar. This is not convenient if we have a bar with small width or height. When i hover the bar, some space around the bar is highlighted with full chart height and tooltip is displayed. i want to make the highlighted region clickable and the bar data should be available in the event. I have gone through the docs and tried
chart.on('click', 'xAxis.category', function () {...});
But the function is not triggered.
In this demo, Alert is triggered only when i click inside a bar. How do i make the surrounding area clickable?
https://codesandbox.io/s/cocky-banzai-6j5pg?file=/src/Chart.js

A: It's true, you cannot receive the common event when click outside bar but Echarts is mature framework and almost any events can received with low-level object zRender. You need to get access to zRender with getZr() and then convert coordinates of the clicked pixel to chart coordinates. After it you will have index of series datapoint and with this to fetch category will be easy.
myChart.getZr().on('click', params => {
  var pointInPixel = [params.offsetX, params.offsetY];
  var pointInGrid = myChart.convertFromPixel('grid', pointInPixel);
  var category = myChart.getModel().get('xAxis')[0].data[pointInGrid[0]]
  console.log(category);
});

See example:

var myChart = echarts.init(document.getElementById('main'));

var option = {
  title: {
    text: 'ECharts'
  },
  tooltip: {},
  legend: {
    data: ['Label']
  },
  xAxis: {
    data: ["Category1", "Category2", "Category3", "Category4", "Category5", "Category6"]
  },
  yAxis: {},
  tooltip: {
    trigger: "axis",
    confine: true,
    enterable: true,
    axisPointer: {
      type: "shadow",
      shadowStyle: {
        color: "rgba(255,0,0, 0.5)"
      }
    },
    backgroundColor: "rgba(255,255,255,1)",
    textStyle: {
      color: "#6D6D70"
    },
    extraCssText: `box-shadow:  3px 6px 14px #cccccc61;border-radius: 10px;`
  },
  series: [{
    name: 'Series',
    type: 'bar',
    data: [5, 20, 36, 10, 10, 20],
    showBackground: true,
  }]
};

myChart.setOption(option);

myChart.getZr().on('click', params => {
  var pointInPixel = [params.offsetX, params.offsetY];
  var pointInGrid = myChart.convertFromPixel('grid', pointInPixel);
  var category = myChart.getModel().get('xAxis')[0].data[pointInGrid[0]]
  console.log(category);
});


text:
Q: Explanation of Interpolate Hermite method I've currently got this bounty running on how to resample audio data with the intention of increasing the pitch.
Many solutions have been made and I have to admit I'm feeling a bit overwhelmed by the choices and information.
I was directed to this solution and found this chunk of code:
public static float InterpolateCubic(float x0, float x1, float x2, float x3, float t)
{
    float a0, a1, a2, a3;
    a0 = x3 - x2 - x0 + x1;
    a1 = x0 - x1 - a0;
    a2 = x2 - x0;
    a3 = x1;
    return (a0 * (t * t * t)) + (a1 * (t * t)) + (a2 * t) + (a3);
}

public static float InterpolateHermite4pt3oX(float x0, float x1, float x2, float x3, float t)
{
    float c0 = x1;
    float c1 = .5F * (x2 - x0);
    float c2 = x0 - (2.5F * x1) + (2 * x2) - (.5F * x3);
    float c3 = (.5F * (x3 - x0)) + (1.5F * (x1 - x2));
    return (((((c3 * t) + c2) * t) + c1) * t) + c0;
}

This seems like something simple enough that I can wrap my head around, but I'm wondering how I input the amount I would want to increase my pitch by. Which leads me to the following questions:

*

*The t argument of the first method takes a number between 0 and 1. Is this the factor by which I increase the pitch? Would that make 1 an increase of pitch of %100 (essentially double the speed)?.

*If the above theory is correct am I able to input a factor of more then 1? If not, how would I be able to do this?

*If by stating the above I've clearly shown that I'm totally off track would someone please help clairfy how I control the amount of increase in pitch using this method?
Thank you so much.

A: These are functions that do the following: Given a discrete sequence of samples, interpolate smoothly between them. That is: suppose your original data is x(0), x(1), x(2), etc. You want (let's say) to make it 1.234 times faster. Then you want samples x(0), x(1/1.234), x(2/1.234), x(3/1.234), etc. And you want these to look like samples from a nice smooth signal that goes through the sample points you have.
Both of these functions should be used as follows. You want to interpolate between x(n) and x(n+1). To get a value you can call x(n+t), call them with arguments x(n-1), x(n), x(n+1), x(n+2) and t. When t=0 you'll get x(n); when t=1 you'll get x(n+1); you shouldn't (except maybe at the ends of your data) use arguments that aren't between 0 and 1.
So, to speed up or slow down your signal, sample at times [integer]/[speed factor]; for each time t, take n-1,n,n+1,n+2 such that n <= t <= n+1, and call the interpolator with values x(n-1),x(n),x(n+1),x(n+2) and t-n. And see how it sounds :-).

A:
Interpolation is a way to find new data points between discrete values.
The diagram above shows five values. X0, X1, X2, X3, X4. The values are for these five points are known. The in-between values aren't known and can only be approximated by interpolating from the known data points. Different interpolation algorithms will give different results.
For example, to find the value of the red dot (shown between the X1 and X2 values) we can use interpolation. The t specifies the point you wish to find. t will always be a value between 0 and 1. In this case t will be approximately 0.25.
The simplest interpolation method is linear interpolation. It is essentially the same as drawing a straight line between two points.
Linear Interpolation
y = x1 + (x2 - x1) * t

Cubic interpolation and hermite interpolation both function similary to linear interpolation except they use more data points to calculate curves instead of straight lines.
To understand what these functions are doing, it could be helpful to plot the functions in a graphing application.
To answer your questions:

*

*t has no relationship to pitch. It specifies the location of the in-between point the interpolation algorithm will calculate the value for.

*NA.

*These functions calculate values between discreet points. By themselves they do not pitch shift audio but they could be used in the algorithm that does.


text:
Q: HTML sliding bars? how does one create a sliding bar using HTML?
I cannot seem to find anything in the official documentation.

A: HTML5 does, in fact, have support for sliders:
<input type="range" min="0" max="10" step="2" value="6">

...browsers are expected to render
  type="range" as a slider control. At
  time of writing, the latest versions
  of Safari, Chrome, and Opera all do
  this. (Sadly, the iPhone renders it as
  a simple text box. It doesn't even
  optimize its on-screen keyboard for
  numeric input.) All other browsers
  simply treat the field as type="text",
  so there's no reason you can't start
  using it immediately. (diveintohtml5.ep.io)

A: You could use the JQuery UI Slider
(Yet another JavaScript question that is answered with JQuery)


text:
Q: Работа с строками python как убрать апострофы из строки: '"Просто текст"', чтобы получилось так: "Просто текст"?

A: Стандартная функция str.replace:
# оставить одинарные:
'""Просто текст""'.replace('""', '"')
# или убрать полностью:
'""Просто текст""'.replace('""', '')

A: Можно так:
"Просто текст".strip('"')

A: x = '"Просто текст"'
x = x.strip("'")
x = x.strip('"')
print(x)

Вывод:
Просто текст


text:
Q: jQuery Unslider working locally, but not on server Im having a strange problem when trying to implement jQuery Unslider on a website. I get everything working like a charm locally, but when I upload it to my host (One.com in this case), it all falls apart. The images in the slideshow now appear below one another.
I have looked for issues with the code for so long now my eyes are turning inwards. So, please help me if you can =)
Link to test site: http://villabalder.se/VBv2/index.html
Scripts:

jQuery:
    $(function() {
    $('.vbslides').unslider({
        speed: 500,               //  The speed to animate each slide (in milliseconds)
        delay: 3000,              //  The delay between slide animations (in milliseconds)
        complete: function() {},  //  A function that gets called after every slide animation
        keys: true,               //  Enable keyboard (left, right) arrow shortcuts
        dots: true,               //  Display dot navigation
        fluid: false              //  Support responsive design. May break non-responsive designs
        });
    });

HTML:

CSS:
    .vbslides {
    position: relative;
    overflow: no;
}

.vbslides ul {
    list-style: none;
    width: 100%;
    margin: 0;
    padding: 0;
}

.vbslides ul li {
    display: block;
    float: left;
    margin: 0;
    padding: 0;
}

    .vbslides .dot {
    -webkit-filter: drop-shadow(0 1px 2px rgba(0,0,0,.3));
    -moz-filter: drop-shadow(0 1px 2px rgba(0,0,0,.3));
    -ms-filter: drop-shadow(0 1px 2px rgba(0,0,0,.3));
    -o-filter: drop-shadow(0 1px 2px rgba(0,0,0,.3));
    filter: drop-shadow(0 1px 2px rgba(0,0,0,.3));
}

.vbslides .dots {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 20px;
}

    .vbslides .dots li {
        display: inline-block;
        width: 10px;
        height: 10px;
        margin: 0 4px;

        text-indent: -999em;

        border: 2px solid #fff;
        border-radius: 6px;

        cursor: pointer;
        opacity: .4;

        -webkit-transition: background .5s, opacity .5s;
        -moz-transition: background .5s, opacity .5s;
        transition: background .5s, opacity .5s;
    }

        .vbslides .dots li.active {
            background: #fff;
            opacity: 1;
        }

A: so you're calling the following in your head element:

and then at the end of your body, you're calling these:

which is overwriting the $ variable, and your unslider plugin is no longer defined.
Just to be clear: you should only have one core jQuery library being loaded, and it should (usually) be the first script file you are loading on the page.

A: Try to solve problem using online files:

Be sure that JavaScript looks like this:

If u still have problem copy/paste this example to the .html file

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

    <title>Unslider.com arrow example</title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

          ←
          →


text:
Q: Ninject Wcf Constructor Injection Not Working I am trying to get constructor injection working in a WCF Application but it is calling my parameter-less constructor instead of the one that has [inject] as the parameter.  I installed Ninject WCF via Nuget and it installed the dependencies for me.
Here are my packages:
<packages>
    <package id="Microsoft.Web.Infrastructure" version="1.0.0.0" targetFramework="net40" />
    <package id="Ninject" version="3.0.1.10" targetFramework="net40" />
    <package id="Ninject.Extensions.Wcf" version="3.0.0.5" targetFramework="net40" />
    <package id="Ninject.Web.Common" version="3.0.0.7" targetFramework="net40" />
    <package id="WebActivator" version="1.5.1" targetFramework="net40" />
</packages>

It created a NinjectWebCommon.cs class for me and put it in App_Start.  Below are my kernal bindings from that file.  Note: I am using entity framework pocos and the context is required in order to instantiate a repo.
private static void RegisterServices(IKernel kernel)
{
    var camContext = new STCAMx0Entities();
    var iseaContext = new iseaEntities();

    kernel.Bind<IRepository<EnrgyProfl>>().To<EnrgyProflRepository>().InRequestScope().WithConstructorArgument("context", camContext);
    kernel.Bind<IRepository<GenUnitCost>>().To<GenUnitCostRepository>().InRequestScope().WithConstructorArgument("context", camContext);
    kernel.Bind<IRepository<LglGenUnit>>().To<LglGenUnitRepository>().InRequestScope().WithConstructorArgument("context", camContext);

    kernel.Bind<IRepository<dly_sch>>().To<DlySchRepository>().InRequestScope().WithConstructorArgument("context", iseaContext);
    kernel.Bind<IRepository<DealModel>>().To<WtDealRepository>().InRequestScope().WithConstructorArgument("context", iseaContext);
    kernel.Bind<IRepository<EnrgyProfl>>().To<WtEnergyProfileRepository>().InRequestScope().WithConstructorArgument("context", iseaContext);
}

In my service, I have this as my constructor:
[Inject]
public CamService(IRepository<dly_sch> dlySchRepo, IRepository<dly_unit> dlyUnitRepo, IRepository<LglGenUnit> lglGenRepo, IRepository<EnrgyProfl> enrgyProflRepo, IRepository<DealModel> wtDealRepo)
{
    _dlySchRepo = dlySchRepo;
    _dlyUnitRepo = dlyUnitRepo;
    _lglGenRepo = lglGenRepo;
    _enrgyProflRepo = enrgyProflRepo;
    _wtDealRepo = wtDealRepo;
}

Here is an example of one of my repositories:
public class DlySchRepository : IRepository<dly_sch>
{
    private static readonly CommonLogger Log = LogFactory.Singleton.Create(typeof (DlySchRepository));
    private iseaEntities _context = new iseaEntities();
    public DlySchRepository(iseaEntities context) { _context = context; }
    public DlySchRepository() { }
...

Please help!!!!
Thank you.


text:
Q: Trees with two eigenvalues? Is it possible for a tree of order $n$ ($n$ even) to have eigenvalues $(\lambda_1, \ldots, \lambda_1, -\lambda_1, \ldots, -\lambda_1)$ ? Or perhaps $(\lambda_1, \ldots, \lambda_1, 0,-\lambda_1, \ldots, -\lambda_1)$ if $n$ is odd ?
Thanks.


text:
Q: Matlab organising and plotting temperature data Relatively new to matlab, would like some input on the best options for my project.
I have several temperature probes at set locations around the office and I have to display a heat map on a floor plan image.
(This is kinda what i want to achieve, where the points are the probes, and this would be overlayed on a floor plan)
At the moment i'm looking for the best way to organise and graph the data.
I have a csv file from each probe with a timestamp column and a temperature column.
Each csv file may have roughly upto around 3months/2000 readings.
At the moment I have all the csv files from the different probes being imported to cells and organised by a number corresponding to their location.
So data{1}{1} contains the timestamps and data{1}{2} contains the temperatures of the probe at location 1. data{2} is for location 2 and so on. Is this a good way to store it?
Eventually I need to be able to seek or play through the different times while viewing the map. But at the moment im just looking for the best option to graph it.
I have the floorplan image and i know that i'll have to find the pixels/xy representation of the locations, but what then?
What would be the best way to plot all these probes.
I was planning to use surf(top view), but this require an array for the x/y coords?
My idea was to store the locations as static integers, loc1X= .., loc1y=, etc, then make an array something like [loc1X loc1Y data{1}{2}(1); loc2X loc2Y data{2}{2}(1)]but surf still says Z needs to be an array to plot.

A: Assuming your locations are not set up to be exactly 1m apart in a rectangular grid (that woudl be a strange office...), you are facing the problem of having to interpolate a surface through scattered datapoints. The Matlab function TriScatteredInterp will be what you need there. Just follow the example in the link, with some changes:
x = [x values of your locations]
y = [y values of your locations]
z = [all heat readings for all x,y for a single timestamp]

F = TriScatteredInterp(x,y,z);

and plot as in the example. You'll have to do this for all time stamps, so, in pseudo code:
x = [x values of your locations]
y = [y values of your locations] % assuming they don't change

F = cell(numel(data{1}{1}),1);
for t = 1:numel(data{1}{1}) % loop through all time stamps

    z = cellfun(@(p)p{1}(t), data);
    F{t} = TriScatteredInterp(x,y,z);

end

and then you can plot the first F{1} and add a slider to the figure to select different times.
Note that this assumes all nodes collect data at equal time stamps. If this is not the case (which I suspect it's not), you have to do one more step: create an interpolation in the dimension of time for each XY point.
That can be done easily using spline. For example,
pp = spline(data{1}{1}, data{1}{2});

creates a spline through all data for the first location, so that
z = ppval(pp, [any random time within the interval])

gives an interpolated value for the heat at any time in the interval. You can do this in one go by issueing
z = spline(data{1}{1}, data{1}{2}, [any random vector of times] );

So, to summarize:
% interpolate over time

% NOTE: use the maximum first time, and the minimum last time,
% to ensure these endpoints are included in all splines.
minTime = max( cellfun(@(p)p{1}(1), data) );
maxTime = min( cellfun(@(p)p{1}(1), data) );

trange = minTime : [some step] : maxTime;

npts = size(data,1);
z    = cell(npts,1);
for ii = 1:npts
    % creates interpolation for H(t) at equal times
    % trange for location ii
    z{ii} = spline(data{ii}{1}, data{ii}{2}, trange);
end

% interpolate spatially

x = [x values of your locations]
y = [y values of your locations] % assuming they don't change

nts = numel(trange)
F = cell(nts,1);
for t = 1:nts

    zed = cellfun(@(p)p(t),z);
    F{t} = TriScatteredInterp(x,y, zed);

end

% ... and further plotting commands

A: Here is an answer to your second question (in the comment above):
% get a list of all initial sampling times for all sensors
first_times = cellfun(@(x)   x{1}(1), data);
last_times  = cellfun(@(x) x{1}(end), data);

% find the max/min of these times.
% NOTE: the order of max/min might be counter-intuitive!
[m, im] = max(first_times);
[M, iM] = min(last_times);

% 'im' contains the number of the data set which has the latest initial
% sampling time. 'iM' contains the number of the data set which has the
% earliest final sampling time.

% Now find the indices to the actual sampling times in all data sets
% that correspond to these initial and final times:

proper_first = cellfun(@(x) find(x{1}==m,1), data);
proper_last  = cellfun(@(x) find(x{1}==m,1), data);

% index times and data in dataset k like so:
data{k}{1}( proper_first(k) : proper_last(k) ) % times
data{k}{2}( proper_first(k) : proper_last(k) ) % data

Now for future reference, it's better form to just ask a new question on SO; it's not generally considered good practice to be asking all questions you have in one thread, because that will make it hard to find for any future googlers encountering the same problems you had.


text:
Q: C#: Call non-generic method from generic method class CustomClass<T> where T: bool
{
    public CustomClass(T defaultValue)
    {
        init(defaultValue); // why can't the compiler just use void init(bool) here?
    }
    public void init(bool defaultValue)
    {

    }
    // public void init(int defaultValue) will be implemented later
}

Hello. This seems to be a simple question, but I couldn't find an answer on the Internet: Why won't the compiler use the init method? I simply want to provide different methods for different types.
Instead it prints the following error message:
"The best overloaded method match for 'CustomClass.init(bool)' has some invalid arguments"
I would be glad about a hint.
Best regards,
Chris

A: The compiler cannot use init(bool) because at compile-time it cannot know that T is bool. What you are asking for is dynamic dispatch — which method is actually being called depends on the run-time type of the argument and cannot be determined at compile-time.
You can achieve this in C# 4.0 by using the dynamic type:
class CustomClass<T>
{
    public CustomClass(T defaultValue)
    {
        init((dynamic)defaultValue);
    }
    private void init(bool defaultValue) { Console.WriteLine("bool"); }
    private void init(int defaultValue) { Console.WriteLine("int"); }
    private void init(object defaultValue) {
        Console.WriteLine("fallback for all other types that don't have "+
                          "a more specific init()");
    }
}


text:
Q: Flexslider stop at first slide after loop I am trying to get the Flexslider to make a full loop and then stop or pause once it gets back to the first slide. Here is my code so far:
$(window).load(function(){
    $('.flexslider').flexslider({
        animation: "slide",
        animationLoop: true,
        slideshowSpeed: 5000,
        pauseOnHover: true,
        start: function(slider){
            $('body').removeClass('loading');
        }
    });
});

A: Try with this:
$(window).load(function(){
    $('.flexslider').flexslider({
        animation: "slide",
        animationLoop: true,
        slideshowSpeed: 5000,
        pauseOnHover: true,
        start: function(slider){
            $('body').removeClass('loading');
        },
        after: function (slider) {
            if ((slider.currentSlide + 1) == slider.count) {
                 slider.pause();
            }
        }
    });
});

A: Try this, it worked for me

$(window).load(function(){
    var loopCount = 0;
    $('.flexslider').flexslider({
        animation: "slide",
        animationLoop: true,
        slideshowSpeed: 5000,
        pauseOnHover: true,
        start: function(slider){
            $('body').removeClass('loading');
        },
        after : function(slider){
           if(slider.currentSlide == 0 && loopCount == 1){
             slider.pause();
           }
        },
        end : function(slider){
          loopCount++;
        }
    });
});

A: Use this to pause at first slide after looping specific times. change var n value to loop as many time you wish.
var n = 2;
$('.flexslider').flexslider({
    animation: "slide",
    slideshowSpeed: 5000,
    start: function(slider) {
        $('body').removeClass('loading');
    },
    after: function(slider) {
        if (slider.currentSlide == 0) { // is last slide
            n--;
            if(n==0) {
                slider.pause();
            }
        }
    }
});


text:
Q: Displaying empty chart using chart.js Displaying empty chart i am using django 2.2 and chart.js. Is there some one who can help me . I can see the data in console.log but not in graph. I am working to solve this problem from hours. Or can you suggest other library for performing same task
views.py
class secondapi(APIView):
    authentication_classes = []
    permission_classes = []

    def get(self, request, format=None):
        newlabels = ['black', 'Red', 'Blue', 'Yellow', 'Green', 'Purple'],
        newdata =  [111, 22, 21 , 113, 14, 15],
        data = {'newlabels':newlabels, 'newdata':newdata, }
        return Response(data)

html page
<div class="container-fluid w-50 h-50 float-left">
  <canvas id="myChart"></canvas>
  </div>

<script>
var endpoint = '/api/chart/data/'
var newlabels = []
var newdata = [];

$.ajax({
    method: 'GET',
    url: endpoint,
    success : function(i){
      newlabels = i.newlabels
      newdata = i.newdata
      console.log(newdata) // working in console

      var ctx = document.getElementById('myChart');
      var myChart = new Chart(ctx, {
        type: 'bar',
        data: {
            labels: newlabels, // CHANGED
            datasets: [{
                label: '# of Votes',
                data: newdata,  // CHANGED
            }]

          }
      })

    },  // FIRST ONE
  error : function(error_data){
        console.log('error')
        console.log(error_data)}

  })
</script>

Getting this result


text:
Q: (geo)django's dwithin-filter giving error whereas ST_DWithin from postgres works I'm using geodjango and I want to filter rows from a table based on distance:
geom = models.MultiLineStringField()

When I use geodjango like so:
geo_objects.objects.filter(geom__dwithin=(pnt, D(km=10)))

where pnt is 'POINT (-73.5666999999996136 45.5000000000000213)'
Geodjango gives me:
*** django.core.exceptions.FieldError: Join on field 'geom' not permitted. Did you misspell 'dwithin' for the lookup type?

On the other hand, doing the same thing (as far as I understand) directly from the postgres command line returns sensible results:
select * from geo_objects
WHERE ST_DWithin(geo_objects.geom, 'POINT(-73.5665 45.5000)', 122222, false)

works perfectly well.
What am i doing wrong?
Thanks in advance.

A: thats the answer:
in order to perform geometric queries, you need a geomanager.
https://docs.djangoproject.com/en/dev/ref/contrib/gis/model-api/#geomanager


text:
Q: How to process json data getting from multi curl? I have a script, which takes an ID from a database into an array and opens an url with that ID to get and process a json string.
$result = mysqli_query($bd, "SELECT app FROM appstoimport LIMIT 30 ") or die(mysqli_error());
$count = mysqli_num_rows($result);

 if (mysqli_num_rows($result) > 0) {
    while ($row = mysqli_fetch_assoc($result)) {
        $appID = $row['app'];

//Call search
            $cas = curl_init('https://externalsiet.com/search?id=' . $appID . '');
                curl_setopt($cas, CURLOPT_RETURNTRANSFER, 1);
                    $jsondata = curl_exec($cas);
                        curl_close($cas);

//Process  search
    $arr = json_decode($jsondata,true);

    foreach($arr['results'] as $item) {
        $price  = $item['price'];
        $title = $item['title'];
        $category = $item['category'];

//Insert into database
mysqli_query($bd, "INSERT INTO apps (price, title, category) VALUES ('$price', '$title', '$category' )") or die(mysqli_error($bd));

now I discovered multi curl and found a script and could attach it to my query.
$query = mysqli_query($bd, "SELECT app FROM appstoimport LIMIT 30 ") or die(mysqli_error());
$count = mysqli_num_rows($query);
$nodes = array();
while ($row = mysqli_fetch_array($query, MYSQL_NUM)) {
    $appID = $row[0];
    $nodes[] = 'https://externalsite.com/search?id=' . $row[0] . '';
}

//print_r($nodes);

$node_count = count($nodes);

$curl_arr = array();
$master = curl_multi_init();

for($i = 0; $i < $node_count; $i++)
{
    $url =$nodes[$i];
    $curl_arr[$i] = curl_init($url);
    curl_setopt($curl_arr[$i], CURLOPT_RETURNTRANSFER, true);
    curl_multi_add_handle($master, $curl_arr[$i]);
}

do {
    curl_multi_exec($master,$running);
} while($running > 0);

for($i = 0; $i < $node_count; $i++)
{
    $results = curl_multi_getcontent  ( $curl_arr[$i]  );
    echo( $i . "\n" . $results . "\n");
}

I get back the json data fine, but they are many strings in an array now, not just a single string per call and I can't figure out, how to process it that I can insert the values into my database, like before.
Can somebody tell me, how to split up the array again so I can add them separately in a row to my database?


text:
Q: tensorflow 1.13 how to use tf.searchsort safe? With code
tf.searchsorted(input, input2)

I got first error

InvalidArgumentError (see above for traceback): Reshape cannot infer
  the missing input size for an empty tensor unless all specified input
  sizes are non-zero

It also reminded me in line 3459 of

tensorflow/python/ops/array_ops.py
searchsorted

got
sorted_sequence_2d = reshape(sorted_sequence, [-1, sequence_size])

But when tensor shape contain 0 dimension,  input.shape=(0,), it will return an error. see here
I want to check the tensor shape before using tf.searchsorted, and I know the dimension is None
So I use
if not tf.equal(input.shape[0], 0):
  tf.searchsorted(input, input2)

Then I got my second error, and I know that tf.equal will return bool tensor, which cannot be used like bool. But I don't know how to solve my first error.

ValueError: Tried to convert 'x' to a tensor and failed. Error: Cannot
  convert an unknown Dimension to a Tensor: ?

My question is how to use tf.searchsort safe if the first error trigered by 0 dimension

A: Although it is not explicitly stated, it is implied that tf.searchsorted does not work with an empty sequence in the first parameter.
You can however use tf.cond to express something like "use searchsorted if it is not an empty sequence, otherwise return all zeros" (or whatever you prefer to return instead):
tf.cond(tf.not_equal(tf.size(input), 0),
        lambda: tf.searchsorted(input, input2),
        lambda: tf.zeros_like(input2, dtype=tf.int32))


text:
Q: Django data handling? I have successfully posted to the server side and can see my data delivered in the request payload. The payload is structured as
[{C1:R0, C2:R0, C3:R0},{C1:R1, C2:R1, C3:R1},...,{C1:Rn, C2:Rn, C3:Rn}]

I want to read this data in my views.py file and write it to the table that has columns that correspond to the C1, C2, and C3. Basically the columns represent readings and I am trying to log these reading in a table. How do I extract the raw string and insert these values into the table?
I am using Python/Django.


text:
Q: Generic way to insert some data into a table I have always been using nhibernate ORM for inserting data to sql tables from application.
But recently I tried reading on Ado.net and found suggestion to use stored proc instead of
sqlcommand.executenonQuery().
In that  case, every table insertion will need a different stored proc . A 100 table application will need 100 Stored procs. Is my understanding correct or is there a better way of doing it in a more generic way?
Please suggest.

A: A simple one-liner command can be an INSERT given directly in .NET code via parameterized Command class. Something like:
using (SqlConnection sqlConn = new SqlConnection(connectionString)) {
        using (SqlCommand sqlCmd = new SqlCommand("INSERT INTO MyTable (Field1, Field2) VALUES (@Param1, @Param2)", sqlConn)) {
            sqlCmd.Parameters.AddWithValue("@Param1", someValue1);
            sqlCmd.Parameters.AddWithValue("@Param2", someValue2);
            sqlConn.Open();
            sqlCmd.ExecuteNonQuery();
        }
    }

So it doesn't have to be a stored proc for every command. You can have a class or classes dedicated to DB access only (db access layer) and populate it with various methods to read/write from DB. You can even have a generic method that automatically derives parameters for INSERT/UPDATE commands.
Of course if it's more than 1-2 commands or some logic is involved - that asks for a stored procedure.
Btw, this is my personal opinion, but i think ORMs are evil.

A: Have you heard about dapper, a powerful tool to execute a query and map the results to a strongly typed List.  Dapper also support stored procedures, check this out.
Example:
dbConnection.Query<return type>("yourSP", parameters,
        commandType: CommandType.StoredProcedure).First();

Also take some time to check this SO question.

A: Personally I would use an ORM if I have more than 5 different tables to select and/or insert into. Why should you walk 100 miles if the bus stop is right infront of the door?
That said the ORM is a generic way to access data. If you would want to code everything by hand, you could surely write stored procedures with optional parameters, but I don't recomend it.


text:
Q: Calling multiple methods in viewWillAppear with a TabBarApplication I'm currently working on an application that uses a view controller and a tabBar controller. When a tab is selected I'm using webservices to update this particular view.  Each tab calls different services to display different types of data.
I use the viewWillAppear method to call methods when the different tabs are selected but what I would like to do is be able to setup some conditionals to only call the method for the current view/tab was selected.
One of my tabs has two views.  Based on the view loaded I would like to call the methods in viewWillAppear that relate to the specific view.
How does one find out which tab-view is currently selected and which view has displayed?
Thanks

A: You can know which tab and View is being selected by Tag id given to each TabBar Item and View in your nib.
There are few questions on SO which can help you indirectly on this problem. One of them is
How to remember last selected tab in UITabBarController?


text:
Q: My SetupDiEnumDeviceInfo returns ERROR_NO_MORE_ITEMS for certain devices (C#) I am trying to fetch power data for my devices(cm_power_data_s). I am using the SetupDiGetDeviceRegistryProperty API to do so. While this works fine for some devices, it doesn't work for others. The data returned by SetupDiEnumDeviceInfo is null, and without this, I can't use SetupDiGetDeviceRegistryProperty.  I tried manually filling sp_devinfo_data by making a wmi query to get the class GUID, but SetupDiGetDeviceRegistryProperty doesn't return the buffer size with it (same as passing null data). Can someone please help? Here's my code:
uint SPDRP_DEVICE_POWER_DATA = 0x0000001E;
        int proptype;
        int size;
        //int D3, D2, D1, D3wake, cap = 0;
        DEVPROPKEY key = DEVPROPKEY.DEVPKEY_Device_PowerData;

        IntPtr hDevInfo = SetupDiGetClassDevs(IntPtr.Zero, DevID, IntPtr.Zero, DIGCF.DIGCF_ALLCLASSES | DIGCF.DIGCF_PRESENT | DIGCF.DIGCF_DEVICEINTERFACE);
        if (hDevInfo == (IntPtr)INVALID_HANDLE_VALUE)
        {
            throw new ArgumentNullException("invalidhandle");
        }
        SP_DEVINFO_DATA data = new SP_DEVINFO_DATA();
        data.cbSize = Marshal.SizeOf(data);

        SetupDiEnumDeviceInfo(hDevInfo, 0, ref data); // This data is empty for some devices
       // SetupDiGetSelectedDevice(hDevInfo, ref data);
        int aa = Marshal.GetLastWin32Error();

        bool b = SetupDiGetDeviceRegistryProperty(hDevInfo, ref data, SPDRP_DEVICE_POWER_DATA, out proptype, IntPtr.Zero, 0, out size);
        int a = Marshal.GetLastWin32Error();
        if (size == 0)
        {
                          return "";
         //   throw new ArgumentNullException("Power Data cannot be fetched");
        }

        IntPtr buffer1 = Marshal.AllocHGlobal(size);

        if (!SetupDiGetDeviceRegistryProperty(hDevInfo, ref data, SPDRP_DEVICE_POWER_DATA, out proptype, buffer1, size, out size))
        {
            throw new Win32Exception(Marshal.GetLastWin32Error());

        }

A: I'm sure you've long since moved on since this question is from 18 months ago, but I just hit exactly this same problem.  My googling brought me to your thread.  Then I figured it out.  So in case anyone else ever hits this, the problem is the flags that you supplied to SetupDiGetClassDevs.
You should have just given it the DIGCF_PRESENT flag.  With all the flags you supplied you get back info for devices that aren't even there, leading to exactly the subsequent error you and I both got.

A: In my case I attempted to enable/disable netowrk interface, and used Setup API to get the index of the device that must be passed to SetupDiSetClassInstallParams(). I didn't cache the index, but got ERROR_NO_MORE_ITEMS arised randomly when dealing with the Setup API funcions.
The problem in behind was that the "list of network adapters" changed in between, f.ex., the "Microsoft ISATAP adapter" disappeared from the list (I also could see that it is hidden in device manager).
In my case using DIGCF_PROFILE instead of DIGCF_PRESENT worked for me.


text:
Q: Restrict What Can Extend a Class - Java I'm designing an SPI, and the inheritance structure within it is a single tree. So as you can imagine, some classes are leaf nodes in the tree, some are not.
My problem is that I want to restrict this inheritance structure, allowing developers to only extend specific classes (mostly leaf nodes). By definition of the problem, I can't just declare earlier classes as final, or else the leaf node classes cannot extend them.
How can I accomplish this?

A: You can put all parent classes in the same package as the "leaf" classes, making all those parent classes package-private in scope (don't declare them as public). This will restrict their visibility.
If you're lucky to use java 9, you can use modules in your project and only export the leaf classes.