text:
Q: How to connect Mongodb from Excel I want to connect to a mongodb database using excel macros, does anybody knows how to acomplish this task?

A: Simple way is

*

*create a C# dll to interact with Mongo db through available c# drivers.

*Make it Com visible (in Assemblyinfo.cs), build it and register it

*Go to the excel macro - > visual basic editor

*Click tools->reference, and select your registered assembly

*And use it in your VBA, like this.

.
Private Sub CallMongo()
    Dim mongoObj As New MyMongoAssembly
    mongoObj.AddItem("adas");
End Sub

thats all..

A: There are ODBC drivers available from progress (mentioned below), from easysoft and cdata.
I have tried with progress and it does the job well.
All these drivers are licensed softwares and trial version is available too.
The most easy to use is the cdata Excel Add-In which can query, update
and also allows to use excel based formula & VBA. It's licensed too.
One more way is to query using pymongo in python instead of mongo client,
dumping the results to a csv file and Importing the csv through VBA.
Querying mongoDB from python is fairly easy.
Here is the example to query from MongoDB Example Dataset.
The Python file for the query, "queryMongoDB.py"
SERVER = "192.168.43.22" # Replace wit with Server IP or Hostname running mongod
PORT   = "27017"

def queryMongoDB():
    try:
       from pymongo import MongoClient
       client = MongoClient("mongodb://" + SERVER + ":" + PORT)
       db = client.test
       queryResp = db.restaurants.find({'address.zipcode': "11215", 'cuisine': 'Indian'}, {'name': 1, 'address.building': 1, 'address.street': 1, 'borough': 1, '_id': 0})

       if queryResp.count() > 0 :
          for row in queryResp:
             printStr = ""
             if 'name' in row:
                printStr = row['name'] + ","
             else:
                printStr = ","
             if 'building' in str(row):
                printStr = printStr + row['address']['building'] + ","
             else:
                printStr = printStr + ","
             if 'street' in str(row):
                printStr = printStr + row['address']['street'] + ","
             else:
                printStr = printStr + ","
             if 'borough' in row:
                printStr = printStr + row['borough']
             print(printStr)
       else:
          return -2
       return 0
    except ImportError:
       return -1

queryMongoDB()

Executing this script will print to standard output as
Kinara Indian Restaurant,473,5 Avenue,Brooklyn
Baluchi'S,310,5 Avenue,Brooklyn
Kanan Indian Restaurant,452,3Rd Ave,Brooklyn
New Aarpan,396,5Th Ave,Brooklyn
Indian Spice,351,7Th Ave,Brooklyn

The Excel VBA macro using WshShell, macro_queryMongoDB()
Sub macro_queryMongoDB()
   Dim pythonExecutable  As String
   Dim pythonQueryScript As String
   pythonExecuatble = "python.exe" ' Path to python interpreter
   pythonQueryScript = "queryMongoDB.py" 'Full path to the above Python script

   If Dir(pythonExecuatble) <> "" And Dir(pythonQueryScript) <> "" Then
      Dim objShell         As Object
      Dim objWshScriptExec As Object
      Dim objStdOut        As Object

      Set objShell = CreateObject("WScript.Shell")
      Set objWshScriptExec = objShell.Exec(pythonExecuatble & " " & pythonQueryScript) ' Execute the Python script
      Set objStdOut = objWshScriptExec.StdOut

      Set mybook = Excel.ActiveWorkbook
      Set mybookSheet = mybook.ActiveSheet

      Dim rline            As String
      Dim strline          As String
      Dim lineCount        As Long

      ' Parse the results
      lineCount = 1
      While Not objStdOut.AtEndOfStream
         rline = objStdOut.ReadLine
         If rline <> "" Then
            strline = rline & vbCrLf
            mybookSheet.Range(mybookSheet.Cells(lineCount, "A"), mybookSheet.Cells(lineCount, "D")).Value = Split(strline, ",")
            lineCount = lineCount + 1
         End If
      Wend
      MsgBox "Query Successful"
   Else
      MsgBox "Python executable or Python query DB script doesn't exist."
   End If
End Sub

Running this macro will populate the comma separated data into rows as

A: My own solution was to let Python glue them together using pymongo and win32com. It's then fairly straightforward to run whatever you want. In my case I have the Python loop simply continuously "listen" to certain Excel cells, call what it needs from Mongo, then put it back into Excel. It's flexible and many things can be done this way. Here is the full code base, but you will have to change the calls to Mongodb to match your own database. In here you will also see certain ways you can change colours and things of Excel cells from within Python. Oh I should mention that it's peppered with ansi escape sequences so you might want to run Python from ansicon or ConEmu.
import win32com.client as win32
import time    # will need this for time parsing
from optparse import OptionParser
import pdb     # debugger, when necessary
import string  # for string parsing and the alphabet
from pymongo import MongoClient
import inspect
from datetime import datetime, timedelta, tzinfo
from dateutil import tz
from bson.son import SON
import msvcrt # for getch
import os
import sys # for stdout.write
from collections import OrderedDict

def parseCmdLine():
    parser = OptionParser(description="Retrieve realtime data.")
    parser.add_option("--f",
                      dest="file",
                      help="filename",
                      default="bbcapture.xls")
    parser.add_option("--mongohost",
                      dest="mongohost",
                      default="192.168.1.30")
    parser.add_option("--mongoport",
                      dest="mongoport",
                      type="int",
                      default=27017)

    (options, args) = parser.parse_args()
    return(options)

options = parseCmdLine() # parse the commandline
client = MongoClient(options.mongohost, options.mongoport) # link to mongo
db = client.bb # the database
bbsecs = db.bbsecs # now all the collections
bbdaily = db.bbdaily
bbticks = db.bbticks
linkstatusperiod = False # for the moving period in the top left excel cell showing we're linked

def ansi(colour = "white", bright = False, back = "black"):
# ansi colour sequences
    brit = {True:       "\033[1m",
            False:      "\033[0m"}
    colo = {"black":    "\033[30m",
            "red":      "\033[31m",
            "green":    "\033[32m",
            "yellow":   "\033[33m",
            "blue":     "\033[34m",
            "magenta":  "\033[35m",
            "cyan":     "\033[36m",
            "white":    "\033[37m"}
    bakk = {"black":    "\033[40m",
            "red":      "\033[41m",
            "green":    "\033[42m",
            "yellow":   "\033[43m",
            "blue":     "\033[44m",
            "magenta":  "\033[45m",
            "cyan":     "\033[46m",
            "white":    "\033[47m"}
    sys.stdout.write(brit[bright])
    sys.stdout.write(colo[colour])
    sys.stdout.write(bakk[back])

def mdaily(ticker = "USDEUR Curncy", field = "LAST_PRICE", sortdirection = 1, numget = 1000000):
    ansi("cyan", False)
    print "\nGetting", ticker, "field", field, "from Mongo...",
    lister = OrderedDict()
    #for post in bbdaily.find({"ticker": ticker, "fieldname": field}).limit(numget).sort("time", sortdirection):
    for post in bbdaily.find({"$query": {"ticker": ticker, "fieldname": field}, "$orderby": {"time": -1}}).limit(numget):
        lister[str(post["time"])] = post["fieldvalue"]
    ansi("cyan", True)
    print "got", len(lister), "values",
    ansi()
    return lister

def mtick(tickers, sortdirection = 1, numget = 1000000):
    if len(tickers) == 0:
        return []
    else:
        ansi("green", False)
        print "\n Getting minutes for for", tickers,
        tickerdic = OrderedDict()
        for eachticker in tickers:
            eachdic = dict()
            print numget
            for post in bbticks.find({"ticker": eachticker}).limit(numget):
                eachdic[post["time"]] = [post["open"], post["high"], post["low"], post["close"]]
            ansi("green")
            tickerdic[eachticker] = eachdic
            print "got", len(eachdic), "for ticker", eachticker,
        ansi("green", True)
        print "got", len(tickerdic), "tickers",
        dates = [set(tickerdic[x].keys()) for x in tickerdic] # get all the dates
        dates = set.intersection(*dates) # get the unique ones
        dates = [x for x in dates] # convert to list
        if sortdirection == -1:
            dates = sorted(dates, reverse = True)
        else:
            dates = sorted(dates, reverse = False)
        retlist = [[[x, tickerdic[y][x][0], tickerdic[y][x][1], tickerdic[y][x][2], tickerdic[y][x][3]] for x in dates] for y in tickerdic.keys()]
        ansi()
        return retlist

def getsecs():
    seclist = []
    for post in bbsecs.find():
        seclist.append(post["ticker"])
    return(seclist)

def offsetString(startrow, startcol, endrow, endcol):
    startrowstr = str(startrow)
    endrowstr = str(endrow)
    if(startcol > 26):
        startcolstr = string.uppercase[startcol / 26 - 1] + string.uppercase[startcol % 26 - 1]
    else:
        startcolstr = string.uppercase[startcol - 1]
    if(endcol > 26):
        endcolstr = string.uppercase[endcol / 26 - 1] + string.uppercase[endcol % 26 - 1]
    else:
        endcolstr = string.uppercase[endcol - 1]
    return(startcolstr + startrowstr + ":" + endcolstr + endrowstr)

def main():
    excel = win32.gencache.EnsureDispatch("Excel.Application")
    excel.Visible = 1
    try: # try to link to the file
        ansi("red", False)
        print "Linking to", options.file
        wb = excel.Workbooks(options.file)
        ws = wb.Worksheets("MongoData")
        ansi()
    except: # not open then try to load it
        try:
            ansi("red", False)
            print "Not open.... trying to open in current directory", os.getcwd()
            ansi()
            wb = excel.Workbooks.Open(os.getcwd() + "\\" + options.file)
            ws = wb.Worksheets("MongoData")
            ansi()
        except: # can't load then ask to create it
            ansi("red", True)
            print options.file, "not found here. Create? (y/n) ",
            ansi("yellow", True)
            response = msvcrt.getch()
            print response
            ansi()
            if response.upper() == "Y":
                wb = excel.Workbooks.Add()
                ws = excel.Worksheets.Add()
                ws.Name = "MongoData"
                wb.SaveAs(os.getcwd() + "\\" + options.file)
            else: # don't wanna create it then exit
                print "bye."
                return
    # see if ticks sheet works otherwise add it
    try:
        wst = wb.Worksheets("MongoTicks")
    except:
        wst = excel.Worksheets.Add()
        wst.Name = "MongoTicks"
        wst.Cells(3, 2).Value = 1
    # see if securities list sheet works otherwise add it
    try:
        wall = wb.Worksheets("AllSecurities")
        wall.Cells(1, 1).Value = "List of all securities"
        wall.Range("A1:A1").Interior.ColorIndex = 8
        wall.Range("A:A").ColumnWidth = 22
    except:
        wall = excel.Worksheets.Add()
        wall.Name = "AllSecurities"
        wall.Cells(1, 1).Value = "List of all securities"
        wall.Range("A1:A1").Interior.ColorIndex = 8
        wall.Range("A:A").ColumnWidth = 22

    ansi("green", True)
    print "talking to", options.file,
    ansi("green", False)
    print "... press any key when this console has the focus, to end communication"
    ansi()
    def linkstatusupdate():
        global linkstatusperiod
        if linkstatusperiod:
            ws.Cells(1, 1).Value = "Talking to Python|"
            wst.Cells(1, 1).Value = "Talking to Python!"
            linkstatusperiod = False
        else:
            ws.Cells(1, 1).Value = "Talking to Python|"
            wst.Cells(1, 1).Value = "Talking to Python!"
            linkstatusperiod = True
        ws.Cells(1, 2).Value = datetime.now()
    # daily worksheet header formatting
    ws.Cells(1, 1).Value = "Excel linked to Python"
    ws.Cells(1, 3).Value = "Sort direction:"
    ws.Cells(1, 4).Value = 1
    ws.Cells(1, 5).Value = "Fetch max:"
    ws.Cells(2, 1).Value = "Enter tickers:"
    ws.Cells(3, 1).Value = "Start data:"
    ws.Cells(4, 1).Value = "End data:"
    ws.Range("A:A").ColumnWidth = 22
    ws.Range("B:B").ColumnWidth = 20
    ws.Range("A2:GS2").Interior.ColorIndex = 19 # beige 200 columns
    ws.Range("A3:GS4").Interior.ColorIndex = 15 # grey
    ws.Range("A2").Interior.ColorIndex = 3 # red
    ws.Range("A3:A4").Interior.ColorIndex = 16 # dark grey
    # minute worksheet header formatting
    wst.Cells(1, 1).Value = "Excel linked to Python"
    wst.Cells(2, 1).Value = "Enter tickers:"
    #wst.Cells(3, 1).Value = "Enter periodicity:"
    wst.Cells(1, 3).Value = "Sort direction:"
    wst.Cells(1, 4).Value = 1
    wst.Cells(1, 5).Value = "Fetch max:"
    wst.Range("A:A").ColumnWidth = 22
    wst.Range("B:B").ColumnWidth = 20
    wst.Range("A2:GS3").Interior.ColorIndex = 19 # beige 200 columns
    wst.Range("A4:GS5").Interior.ColorIndex = 15 # grey
    wst.Range("A2:A3").Interior.ColorIndex = 4 # red
    wst.Range("6:100000").Clear()
    linkstatusperiod = False
    oldsecd = []
    oldseci = []
    oldnumget = oldsortdir = toldnumget = toldsortdir = 0
    while not msvcrt.kbhit():
        try:
            print "...", wb.Name,
            securities = ws.Range("B2:GS2").Value[0]
            sortdir = ws.Cells(1, 4).Value
            if sortdir == None:
                sortdir = 1
            sortdir = int(sortdir)
            numget = ws.Cells(1, 6).Value
            if numget == None:
                numget = 1000000
            numget = int(numget)
            securities = [x for x in securities if x is not None]
            if not ((oldsecd == securities) and (oldnumget == numget) and (oldsortdir == sortdir)): # clear content of cells
                ws.Range("5:1000000").Clear()
                ws.Range("B3:GS4").Clear()
                ws.Range("B3:GS4").Interior.ColorIndex = 15 # grey
                oldsecd = securities
                oldnumget = numget
                oldsortdir = sortdir
            currentcol = 0
            for sec in securities:
                linkstatusupdate()
                secdata = mdaily(sec, "LAST_PRICE", sortdir, numget)
                currentrow = 0
                vallist = []
                datelist = []
                if sortdir == -1:
                    sortedkeys = sorted(secdata, reverse = True)
                else:
                    sortedkeys = sorted(secdata, reverse = False)
                for eachkey in sortedkeys:
                    datelist.append(eachkey)
                    vallist.append(secdata[eachkey])
                #now stick them in Excel
                ws.Range(offsetString(5 + currentrow, 2 + currentcol, 5 + currentrow + len(vallist) - 1, 2 + currentcol)).Value = \
                        tuple([(x, ) for x in vallist])
                if currentcol == 0:
                    ws.Range(offsetString(5 + currentrow, 1, 5 + currentrow + len(vallist) - 1, 1)).Value = \
                        tuple([(x, ) for x in datelist])
                if len(sortedkeys) > 0:
                    ws.Cells(3, 2 + currentcol).Value = sortedkeys[len(sortedkeys) - 1].split()[0] # start data date
                    ws.Cells(4, 2 + currentcol).Value = sortedkeys[0].split()[0] # end data date
                currentcol += 1
            # now do the tick data
            securitiest = wst.Range("B2:GS2").Value[0]
            securitiest = [x for x in securitiest if x is not None]
            tsortdir = wst.Cells(1, 4).Value
            if tsortdir == None:
                tsortdir = 1
            tsortdir = int(tsortdir)
            tnumget = wst.Cells(1, 6).Value
            if tnumget == None:
                tnumget = 1000000
            tnumget = int(tnumget)
            if not ((oldseci == securitiest) and (toldnumget == tnumget) and (toldsortdir == tsortdir)): # clear the contents of the cells
                wst.Range("6:1000000").Clear()
                wst.Range("B4:GS5").Clear()
                wst.Range("B4:GS5").Interior.ColorIndex = 15 # grey
                oldseci = securitiest
                toldnumget = tnumget
                toldsortdir = tsortdir
            secdata = mtick(securitiest, tsortdir, tnumget)
            currentsec = 0
            for x in secdata:
                sender = [tuple(y[1:5]) for y in x]
                wst.Range(offsetString(6, 2 + currentsec * 4, 6 + len(x) - 1, 5 + currentsec * 4)).Value = sender
                if currentsec == 0: # then put the dates in
                    dates = [tuple([y[0], ]) for y in x]
                    wst.Range(offsetString(6, 1, 6 + len(x) - 1, 1)).Value = dates
                wst.Range(offsetString(5, 2 + currentsec * 4, 5, 5 + currentsec * 4)).Value = ["open", "high", "low", "close"]
                currentsec += 1
            for x in range(0, len(securitiest)):
                wst.Cells(4, 2 + x * 4).Value = securitiest[x]
            linkstatusupdate()
            allsecs = tuple([(yy, ) for yy in getsecs()])
            wall.Range(offsetString(2, 1, len(allsecs) + 1, 1)).Value = allsecs

        except:
            print "\nExcel busy",
        time.sleep(1)

    endchar = msvcrt.getch() # capture the last character so it doesn't go to console
    print "\nbye."

if __name__ == "__main__":
    main()

A: I can echo the other answers that refer to using an ODBC driver to connect to MongoDB data in Excel. The problem, of course, there is that there's no way for you to use macros.
As Irfan mentioned the CData Excel Add-In will allow you to do just that. (Full disclosure, I work for CData Software). You can read about connecting to MongoDB using macros in our Help documentation, but I've included a relevant code snippet here to demonstrate the basic functionality of reading your MongoDB data into excel:
Sub DoSelect()
  On Error GoTo Error
  p_id = InputBox("_id:", "Get _id")
  If p_id = False Then
    Exit Sub
  End If
  Dim module As New ExcelComModule
  module.SetProviderName ("MongoDB")
  Cursor = Application.Cursor
  Application.Cursor = xlWait
  Dim nameArray
  nameArray = Array("_idparam")
  Dim valueArray
  valueArray = Array(p_id)
  Query = "SELECT City, CompanyName FROM Customers WHERE _id = @_idparam"
  module.SetConnectionString ("Server=127.0.0.1;Port=27017;Database=test;User=test;Password=test;")
  If module.Select(Query, nameArray, valueArray) Then
    Dim ColumnCount As Integer
    ColumnCount = module.GetColumnCount
    For Count = 0 To ColumnCount - 1
      Application.ActiveSheet.Cells(1, Count + 1).Value = module.GetColumnName(Count)
    Next
    Dim RowIndex As Integer
    RowIndex = 2
    While (Not module.EOF)
      For columnIndex = 0 To ColumnCount - 1
        If Conversion.CInt(module.GetColumnType(columnIndex)) = Conversion.CInt(vbDate) And Not IsNull(module.GetValue(columnIndex)) Then
          Application.ActiveSheet.Cells(RowIndex, columnIndex + 1).Value = Conversion.CDate(module.GetValue(columnIndex))
        Else
          Application.ActiveSheet.Cells(RowIndex, columnIndex + 1).Value = module.GetValue(columnIndex)
        End If
      Next
      module.MoveNext
      RowIndex = RowIndex + 1
    Wend
    MsgBox "The SELECT query successful."
  Else
    MsgBox "The SELECT query failed."
  End If
  Application.Cursor = Cursor
  Exit Sub
Error:
  MsgBox "ERROR: " & Err.Description
  Application.Cursor = Cursor
End Sub

Our 2016 Version is currently in Beta, so you can start working with your MongoDB data in Excel for free today.

A: The Shell Approach
Pretty much anything that interfaces with the Command Line can be accessed with Shell.
Here's a bare-bones example that connects to a running MongoDB instance and prints a query to the Immediate Window. You'll need to add a reference to the Windows Script Host Object Model.
Private Sub Test()

    Dim wsh As New WshShell
    Dim proc As WshExec
    Dim line As String

    Set proc = wsh.Exec("mongo")

    With proc
        .StdIn.WriteLine "use test"
        .StdIn.WriteLine "db.restaurants.find({""address.zipcode"":""10075""})"
        .StdIn.WriteLine "quit()"

        Do While .Status = WshRunning
            line = .StdOut.ReadLine
            If line = "Type ""it"" for more" Then
                .StdIn.WriteLine "it"
            ElseIf line Like "{*" Then
                Debug.Print line
            End If
            DoEvents
        Loop
    End With
End Sub

Just printing the raw JSON strings isn't very exciting or useful, however. You could write your own JSON parser but, for this example, we will use VBA-JSON by Tim Hall (you can find it on GitHub).
At the time of writing, there is one issue with VBA-JSON that has to be tackled when using it to parse strings returned from MongoDB. Any values that contain parentheses, e.g. "_id": ObjectId("..."), will throw an error. A quick and dirty fix for this is to use RegEx to clean the string for the parser. You will need to reference the Microsoft VBScript Regular Expressions 5.5 library for the following function to work.
Private Function CleanString(str As String) As String

    Dim temp As String
    Dim rx As New RegExp

    With rx
        .IgnoreCase = True
        .Global = True

        .Pattern = "[a-z]*\(" ' Left
        temp = .Replace(str, "")
        .Pattern = "\)" ' Right
        temp = .Replace(temp, "")
    End With

    CleanString = temp
End Function

We can then parse the JSON returned from MongoDB and add each object to a Collection. Accessing the values becomes quite simple.
Private Sub Mongo()

    Dim wsh As New WshShell
    Dim proc As WshExec
    Dim line As String
    Dim response As New Collection
    Dim json As Object

    Set proc = wsh.Exec("mongo")

    With proc
        .StdIn.WriteLine "use test"
        .StdIn.WriteLine "db.restaurants.find({""address.zipcode"":""10075""})"
        .StdIn.WriteLine "quit()"

        Do While .Status = WshRunning
            line = .StdOut.ReadLine
            If line = "Type ""it"" for more" Then
                .StdIn.WriteLine "it"
            ElseIf line Like "{*" Then
                response.Add ParseJson(CleanString(line))
            End If
            DoEvents
        Loop
    End With

    For Each json In response
        Debug.Print json("name"), json("address")("street")
    Next
End Sub

... Which will produce the following output from the MongoDB Example Dataset.
Nectar Coffee Shop          Madison Avenue
Viand Cafe                  Madison Avenue
Don Filippo Restaurant      Lexington Avenue
Lusardi'S Restaurant        Second Avenue
Due                         Third Avenue
Lenox Hill Grill/Pizza      Lexington Avenue
Quatorze Bistro             East   79 Street
Luke'S Bar & Grill          Third Avenue
Starbucks Coffee            Lexington Avenue
New York Jr. League         East   80 Street
Doc Watsons                 2 Avenue
Serafina Fabulous Pizza     Madison Avenue
Canyon Road Grill           1 Avenue
Sushi Of Gari East          78 Street

Gotchas

*

*ReadLine and WriteLine are blocking functions.

*The window opened by Exec can't be hidden.

A workaround for both of the above would be to use a two-layer approach, where VBA calls a hidden script using wsh.Run, which then runs the Exec (as well as any other code that interacts with the proc). The downside to this approach is that StdIn (and to an extent StdOut) has to be written to a file.

A: They say there is a 3rd party Mongodb COM driver around:
http://na-s.jp/MongoCOM/index.en.html
After installing and referencing it, you can run queries like
    Dim oConn
    Dim oCursor,o

    Set oConn = oMng.NewScopedDBConnection( cHostAndPort )
    Set oCursor = oConn.Query( "ec.member", oMng.FJ("{ ""age"": 37 }")
    Do While oCursor.More
        Set o = oCursor.Next
        MsgBox "mname: " & o("mname")
        MsgBox "dept: "  & o("dept")
        MsgBox "age: "   & o("age")
    Loop

This is for those who thinks that de-normalizing of MongoDb structures and translating them into SQL-queryable form on the fly each time you need some chunk of data is an overkill ;-)

A: I think the best answer would be to write or find an ODBC driver for MongoDB.  Let me know if you find one.
Barring that, you could write a web frontend for mongodb that renders the appropriate query into an HTML table, and use Excel's feature to parse HTML tables from web pages.  Not as clean as ODBC, but better than exporting CSVs over and over again.

A: you can always look at this solution, haven't tried it myself and it does require a couple of jumps:
http://sqlmag.com/blog/integrating-mongodb-and-open-source-data-stores-power-pivot

A: Here's a solid ODBC driver that also helps maintain the fidelity of your mongoDB data by exposing the nested MongoDB data model as a set of relational tables to Excel and other ODBC apps:
http://www.progress.com/products/datadirect-connect/odbc-drivers/data-sources/mongodb


text:
Q: Windows Store app search keywords Our company (DriveHQ) has published a few apps on Windows Store. However, when searching apps in the Store using our company name "DriveHQ", we can only find two apps whose names contain "DriveHQ" - DriveHQ FileManager and DriveHQ WebDAV Service; the other two apps are named as Webcam Security Camera and CameraFTP Cloud Security Camera Viewer.
So my question is: in order for users to find an app by searching the company name, do we have to include the company name in the app name?

A: The choice is yours:
If you don't want to change the name of your app, you can add your company name to the keywords in the Store listing that are not displayed to customers but can help your app appear in search results related to your company name.
If you want to include your company name in the app "Webcam Security Camera" and "CameraFTP Cloud Security Camera Viewer", you might have to think about keeping your app name short since the space to display your app's name is limited in many places. Then you need to create a new submission for it and please make sure that the new name is used in the Package/Properties/DisplayName element in the app manifest file, and update the graphics and text including your app name.
You might refer to Rename an app that has already been published.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Multiple Reverse SSH Tunnels using Single Port I am able to accept reverse SSH connections from multiple remote systems on a single server using a port for each connection:
Remote A: ssh -fN -R5000:localhost:22 user@server-ip -p22
Remote B: ssh -fN -R5001:localhost:22 user@server-ip -p22
Remote C: ssh -fN -R5002:localhost:22 user@server-ip -p22

I can access these systems from my local client as needed:
Access Remote A: ssh root@server-ip -p5000
Access Remote B: ssh root@server-ip -p5001

This requires forwarding one port per remote system on the server. When 100+ remotes connect, do I have any options other than opening 100+ ports in the server firewall and statically assigning each remote to a port as above? My goal is to enable multiple remotes to create tunnels on demand, where I can query who is connected.
I found that sslh is a multiplexer that can differentiate between traffic on a single port based on protocol but this only applies to different protocols eg. ssl/ssh. Is there a solution that allows multiple tunnels on a single port?
Example:
Remote A: ssh -fN -R5000:localhost:22 user@server-ip -p22 -identifier abc123
Remote B: ssh -fN -R5000:localhost:22 user@server-ip -p22 -identifier def456
access Remote A: ssh root@server-ip -p5000 -identifier abc123
access Remote B: ssh root@server-ip -p5000 -identifier def456

A: I have the same issue you do and, by the time, have only arrived at one possible answer. My scenario is a bit different than yours as I only need one active ssh tunnel, but all clients must be ready to connect if needed.
I guess one could create a client/server simple protocol to handle all the clients and create a list of some sort. The user then could chose one of the clients to create the reverse tunnel. Doing that would require another open port rather than the ssh server, but using a threaded server one could listen() to various clients under the same port for this secondary protocol.
I'm still working on a solution (I'll probably implement what I just wrote), but mind you in your case you should decide the max number of clients connected at a single time and configure that amount of ports. As mine is just a small linux "support" for embedded devices, I can only work on one device at a time anyway, so I only need 1 device.
A cleverer idea would be to inform the client over the aux protocol at which server port to attach the reverse tunnel.


text:
Q: How to ask user to input number in class function? I written this code and now i want to take input from user for increment, like how much user want to increase the number. How can i do that?
#include <iostream>
using namespace std;
class myClass
{
     friend void increment(myClass *, int);
   private:
     int topSecret;
   public:
     void display() {
        cout << "\n The value of the topSecret is "
             <<topSecret;
     }
     myClass();
};

// constructor of the class
myClass::myClass()
{
  topSecret = 100;
}

// Friend function definition
void increment(myClass *a, int i)
{
  a->topSecret += i; // Modify private data
}

// showing the use of the friend function
main()
{
  myClass x;
  x.display();
  increment(&x, 20);
  x.display();
}

Current result is:
The value of the topSecret is 100
The value of the topSecret is 120

A: #include <iostream>
using namespace std;
class myClass
{

private:
    int topSecret;
public:
    void increment(int);
    void display() { cout << "The value of the topSecret is: " << topSecret << "\n"; }
    myClass();
};
// constructor of the class
myClass::myClass()
{
    topSecret = 100;
}
// Friend function definition
void myClass::increment(int i)
{
    topSecret += i; // Modify private data
}
// showing the use of the friend function
int main()
{
    myClass x;
    x.display();

    int number;
    std::cout << "input number: ";
    std::cin >> number;
    x.increment(number);

    x.display();
}


text:
Q: Integrating CSLA Authorization with DotNetNuke Roles I am interested if anyone has experience using DotNetNuke authorization in CSLA.
I would like to be able to use my DotNetNuke roles to be able to assign permissions to my CSLA objects and properties. If I just reference the DNN assemblies won't that create an unwanted dependency in my CSLA business objects?
Would it be easier to build CSLA objects that query the DNN database directly to get role membership?
Thanks...

A: You definately do not want to create that dependency with your DNN assembly. Your second suggestion is the way to go.
CSLA uses standard IPrincipal/IIdentity authentication. You can create an object that inherits from the CSLA.Security.BusinessPrincipalBase which uses a CSLA object (e.g. User) that grabs their roles from the DNN database directly. Once you have that authentication integrated, you can place your roles inside your business objects by overriding the AddAuthorizationRules method.


text:
Q: Where to put static files for Spark Web Framework? Where do I put files when trying to serve static files with the Spark web framework?
I haven't been able to find anything online - I'm beginning to suspect I don't understand anything about class paths, relative paths etc. for an Eclipse and Java project.
This paragraph about static files in Spark refers to /public, but I have no idea where that would be. Using windows, Eclipse Luna and my project is converted to use Maven.
I've tried looking at the code on GitHub, but I'm a little out of my depth trying to find it.

A: First you have to tell Spark where to search for the static files like this:
Spark.staticFiles.location("/public");

In Spark versions prior to 2.5, you should use:
Spark.staticFileLocation("/public");

Then your project should have a public folder under the resources folder like this
/src/main/resources/public/style.css
For example I added a style.css file there, so you should then access it like this:
http://localhost:4567/style.css

If you want to serve a non-classpath folder, then you should use
Spark.staticFiles.externalLocation("/path/to/dir");

In Spark versions prior to 2.5, you should use:
Spark.externalStaticFileLocation("/path/to/dir");

A: I put my style sheets below my static content as follows:
staticFileLocation( "/web" );
/web/
  |-- index.html
  +-- styles/
        +
        +--- default.css

And the index.html
... <link href="styles/default.css" rel="stylesheet"   type="text/css" />

I also have other generated HTML pages as with freemarker.  They just collect the path:

*

*/styles/default.css,  or

*localhost:8081/styles/default.css

Shows the CSS way index gets it.
Source: https://groups.google.com/d/msg/sparkjava/5vMuK_5GEBU/vh_jHra75u0J

A: *

*Right click your project on Eclipse, select create New -> Package. Give the new package a name, etc.

*Put your static resources under that package, so we can be sure they're under your classpath.

*In your Main class colde, call staticFileLocation("yourpackagename/");

A: *

*Place your public directory into src/main/resources

*Replace Spark.staticFileLocation("/public"); to Spark.staticFileLocation("public");


text:
Q: Kubernete have no access from eks pod to rds mysql I am trying set up eks with rds mysql. I used eksctl to setup the eks cluster and I did not change any default network configuration. eks and rds are using the same vpc.
This is the result in a debugging pod
telnet xx.rds.amazonaws.com 3306
Connected to xx.us-west-2.rds.amazonaws.com
J
8.0.16\#t'Ti1??]Gp^;&Aomysql_native_passwordConnection closed by foreign host
/ # nslookup xxx.us-west-2.rds.amazonaws.com
Server:     10.100.0.10
Address:    10.100.0.10:53

Non-authoritative answer:
xxx.us-west-2.rds.amazonaws.com canonical name = ec2-xx.us-west-2.compute.amazonaws.com
Name:   ec2-xx.us-west-2.compute.amazonaws.com
Address: 192.168.98.108

nc -vz 192.168.98.108 3306
192.168.98.108 (192.168.98.108:3306) open

I used service mesh Istio I created a mysql client pod in a sidecar not enabled namespace I get an error message like following
Mysql client pod
 ERROR 2002 (HY000) Can't connect to MySQL sever on xxxxx.us-west-2.rds.amazonaws.com.

 I am new to vpc. rds and vpc are using the same vpc. they are connected within the private network?
If it says connection refused in my grpc server log, eks grpc server try to connect 192.168.98.108 and that is the private ip of the ads Do I need other configuration in vpc?. Any ideas? cheers

A: I did had the same scenario (RDS in the same VPC as the EKS cluster). What I did is as following:

*

*I've created a Cloudformation template with which I created my custom VPC, 8 subnetes(3 public, 3 private for EKS cluster and 2 private networks for RDS database), internet gateway, NAT Gateway, route tables and routes.

*Using eksctl with cluster configuration yaml I created the cluster and the node group. The node group joined my cluster.

*Using aws cli, I've created the db-subnet-group (containing the 2 private DB subnet) and I also started and RDS instance. Then I've set up some security group to allow traffic to DB just from the 3 private subnets)
As reference to create my custom cloudformation template I used the template created by eksctl when running the create command with the flag --node-private-networking.


text:
Q: Validating Non-Model Field in a Rails form In my Rails 3.2 app, I have a signup form that includes a "terms and conditions" checkbox. The form looks something like this:
<%= form_for @user do |f| %>
  <!-- Error message stuff -->
  <%= f.text_field :email %>
  <!-- More fields... -->
  <%= text_field_tag :terms_and_conditions, false, "true" %>
<% end %>

To make sure the user checks that checkbox, I have the following code in my controller:
unless params[:terms_and_conditions] == "true"
  @user.errors[:base] << "You must check the 'Terms and Conditions' checkbox"
end

But when I call @user.save (or @user.valid?), it seems to clear out this error message. I know I could use @user.errors.empty? && @user.save, but I find it strange that the save method doesn't care about the error message I just added. Is there a better and more elegant way to do this?

A: Rails offers an acceptance validator. It's perfect for your situation. See docs for further information.


text:
Q: Active logins change in who -a and who system boot  2019-06-13 19:14
           run-level 5  2019-06-13 19:14
LOGIN      tty2         2019-06-13 19:14               420 id=tty2
LOGIN      console      2019-06-13 19:14               419 id=cons
           pts/0        2019-06-13 19:23               909 id=ts/0  term=0 exit=0
user + pts/1        2019-06-20 23:21 00:07         934 (177.232.6.247 via mosh [934])
user + pts/2        2019-06-20 23:27   .         21805 (177.232.6.247)
           pts/3        2019-06-19 11:03              2313 id=ts/3  term=0 exit=0
           pts/4        2019-06-13 20:14              2184 id=ts/4

term=0

exit=0

what is going on with pts/0, pts/3 and pts/4. Are they active logins? there appear to be no users there, although who just returns:
user pts/1        2019-06-20 23:21 (177.232.6.247 via mosh [934])
user pts/2        2019-06-20 23:43 (177.232.6.247)

A: Normally who without any additional flags only prints information about
users who are currently logged in.
who -a includes almost all who options including the -d option to also print dead processes.
These are the dead processes (and not active logins):
       pts/0        2019-06-13 19:23               909 id=ts/0  term=0 exit=0
       pts/3        2019-06-19 11:03              2313 id=ts/3  term=0 exit=0
       pts/4        2019-06-13 20:14              2184 id=ts/4  term=0 exit=0

The recorded exit status from who -d can provide info if the process exited cleanly (exit=0) or not.
With for instance last pts/0 you can see which user has used that pseudo terminal last.


text:
Q: Pandas DataFrame- create a 14 day moving average, but show simple averages for the first 14 days of data? I have a pandas dataframe similar to this.
             score   avg
 date
 1/1/2017        0      0
 1/2/2017        1    0.5
 1/3/2017        2      1
 1/4/2017        3    1.5
 1/5/2017        4      2
 1/6/2017        5    2.5
 1/7/2017        6      3
 1/8/2017        7    3.5
 1/9/2017        8      4
 1/10/2017       9    4.5
 1/11/2017      10      5
 1/12/2017      11    5.5
 1/13/2017      12    7.5
 1/14/2017      13    6.5
 1/15/2017      14    7.5
 1/16/2017      15    8.5
 1/17/2017      16    9.5
 1/18/2017      17   10.5
 1/19/2017      18   11.5
 1/20/2017      19   12.5
 1/21/2017      20   13.5
 1/22/2017      21   14.5
 1/23/2017      22   15.5
 1/24/2017      23   16.5
 1/25/2017      24   17.5
 1/26/2017      25   18.5
 1/27/2017      26   19.5
 1/28/2017      27   20.5
 1/29/2017      28   21.5

Basically I am looking to create a 14 day rolling average of the data, but instead of showing NaNs for the first 14 days, simply showing the simple averages. For example, the average on day 2 is the average of day 1 and 2, the average on day 10 is the averages of days 1-10, etc. How would I go about doing this without having to manually create averages? Thanks for the help!

A: What you need to use is rolling with min_periods=1 as paramter:
df['avg2'] = df.rolling(14, min_periods=1)['score'].mean()

Output:
         date  score   avg  avg2
0  2017-01-01      0   0.0   0.0
1  2017-01-02      1   0.5   0.5
2  2017-01-03      2   1.0   1.0
3  2017-01-04      3   1.5   1.5
4  2017-01-05      4   2.0   2.0
5  2017-01-06      5   2.5   2.5
6  2017-01-07      6   3.0   3.0
7  2017-01-08      7   3.5   3.5
8  2017-01-09      8   4.0   4.0
9  2017-01-10      9   4.5   4.5
10 2017-01-11     10   5.0   5.0
11 2017-01-12     11   5.5   5.5
12 2017-01-13     12   7.5   6.0
13 2017-01-14     13   6.5   6.5
14 2017-01-15     14   7.5   7.5
15 2017-01-16     15   8.5   8.5
16 2017-01-17     16   9.5   9.5
17 2017-01-18     17  10.5  10.5
18 2017-01-19     18  11.5  11.5
19 2017-01-20     19  12.5  12.5
20 2017-01-21     20  13.5  13.5
21 2017-01-22     21  14.5  14.5
22 2017-01-23     22  15.5  15.5
23 2017-01-24     23  16.5  16.5
24 2017-01-25     24  17.5  17.5
25 2017-01-26     25  18.5  18.5
26 2017-01-27     26  19.5  19.5
27 2017-01-28     27  20.5  20.5
28 2017-01-29     28  21.5  21.5


text:
Q: Cleaning Up Old Files in AWS CodePipeline I have CodePipeline set up to build and deploy a static Vue site from my Github repo to an S3 bucket. But since the built files have hashed names (e.g. app.2c71f2bb.js), after each deploy, the old files still remain in the bucket. I'm wondering what's a common way of dealing with this issue? And how would I go about doing it?

A: Without knowing the stages in your pipeline I am going to assume that you have a CodeBuild step already defined because you mentioned a build.
Checkout > Build > Deploy (S3)
Remove the Deploy step and add this to CodeBuild,
            post_build:
              commands:
              - aws s3 sync ${LOCAL_FILES} s3://${S3_BUCKET_NAME} --delete

When doing this you will need to add the relevant permissions to your CodeBuild role, not the CodePipeline role.

A: Throw in a CodeBuild action in CodePipeline to run some custom aws cli commands to remove the S3 objects. Make sure your CodeBuild service role has permissions to do the relevant AWS API actions.

A: *

*aws s3 rm s3://BUCKET_NAME --recursive.  (Empty bucket's current data)

*cd into the folder which you want to upload.

*aws s3 sync . s3://BUCKET_NAME. ( upload all the files into the given bucket)


text:
Q: Is my effort necessary and is my approach creating a suitable primary key? I am trying to create a dimension table (NewTable) from an existing Data Warehouse table (OldTable) that doesn't have a primary key.
The OldTable holds distinct values in [IdentifierCode] and other values repeat around it. I also need to invoke 3 functions to add reporting context.
I want IdentifierCode_ID to be an INT column - as the [IdentifierCode] column is VARCHAR(6).
My question is this: is using ROW_NUMBER() (as shown below) producing a suitably unique value?
My concern is that the row order on the live table could change if other rows are inserted to remediate missed codes.
Edit: OldTable has 500k rows in all and 227k when filtered with the WHERE clause
SELECT
    ROW_NUMBER() OVER (ORDER BY LoadDate, StartDate, Product, IdentifierCode) AS IdentifierCode_ID,
    LoadDate,
    StartDate,
    EndDate,
    Product,
    IdentifierCode,
    OtherField1, OtherField2, OtherField3, OtherField4,
    Function1, Function2, Function3
INTO
    NewTable
FROM
    OldTable
WHERE
    GETDATE() BETWEEN StartDate AND EndDate

A: First, unless you're either loading data once and never touching it again or are truncating NewTable before each load of a new date range, your approach will not work. ROW_NUMBER will restart at 1 and violate the primary key.
Even if you ARE truncating the table or only loading once ever, there is still a better way. Designate IdentifierCode_ID as an Identity column and SQL will take care of it for you. If the type is INT and IDENTITY is set, SQL will automatically add 1 to the last value when inserting a new row, you don't even have to assign it!
CREATE TABLE dbo.NewTable(
    [IdentifierCode_ID] int IDENTITY(1,1) NOT NULL,
    [IdentifierCode] VARCHAR(6) NOT NULL,
...

Also, make sure you consider what you'll do if you accidentally select an overlapping date range for subsequent loads and if values in the OldTable change - for example, add a restriction to the WHERE clause to exclude existing IdentifierCode values from the insert, and add a second query to update existing IdentifierCode values that have a different LoadDate, StartDate, etc.
...
AND NOT EXISTS (SELECT * FROM NewTable as N WHERE N.IdentifierCode = OldTable.IdentifierCode)

For updating existing rows that changed, you can do an INNER JOIN to select only existing rows and a WHERE clause for only rows that changed.
UPDATE NewTable
SET LoadDate = O.LoadDate, StartDate = O.StartDate, ... --don't forget to recalculate the functions!
FROM NewTable as N INNER JOIN OldTable as O on N.IdentifierCode = O.IdentifierCode
WHERE GETDATE() between O.StartDate and O.EndDate
  AND NOT (N.StartDate = O.StartDate and N.EndDate = O.EndDate ... )


text:
Q: issue in setting image of navigation bar while presentModalViewController this is how i set image in my first class in viewDidLoad which is tableView
  if ([self.navigationController.navigationBar respondsToSelector:@selector(setBackgroundImage:forBarMetrics:)]) {
        [self.navigationController.navigationBar setBackgroundImage:[UIImage imageNamed:@"header.png"] forBarMetrics:UIBarMetricsDefault];
    }

now this how i go to detail view

 DetailViewController *dvController = [[DetailViewController alloc]   initWithNibName:@"DetailViewController" bundle:[NSBundle mainBundle]];
      [self.navigationController pushViewController:dvController animated:YES];

in detail view's bar the image which i have set for navigation bar comes automatically there and everything works perfect
now my problem is that pushViewController is working perfectly images are getting displayed
but i get default image in presentModelViewController this is how i use it
- (void) modelappear
{

    if (self.testModalViewController == nil)
    {
        TestModalViewController *temp = [[TestModalViewController alloc] initWithNibName:@"TestModalViewController" bundle:[NSBundle mainBundle]];
        self.testModalViewController = temp;
        [temp release];
    }

    UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:self.testModalViewController];
    [self presentModalViewController:nav animated:YES];
}

Note i just set buttons in inner hierarchy views
Can you please tell me what am i doing wrong? please give explanation with answer thank you so much

A: try like this ,
     DetailViewController *dvController = [[DetailViewController alloc]   initWithNibName:@"DetailViewController" bundle:[NSBundle mainBundle]];
     dvController.topViewController.navigationController.navigationBar.tintColor = [UIColor colorWithPatternImage:[UIIMage imageNamed:@"name.png"]];
[self presentModalViewController:nav animated:YES];

A: UIImage *image = [UIImage imageNamed:@"header.png"];
    UIImageView *imageView = [[UIImageView alloc] initWithImage:image];

    [self.navigationController.navigationBar addSubview:imageView];

A:    UIImage *image = [UIImage imageNamed:@"header.png"];
    UIImageView *imageViewe = [[UIImageView alloc] initWithImage:image];

    UILabel *tmpTitleLabel = [[UILabel alloc] initWithFrame:CGRectMake(100, 3, 150, 40)];
    [tmpTitleLabel setFont:[UIFont boldSystemFontOfSize:18]];

    tmpTitleLabel.text = @"Add Manually";

    tmpTitleLabel.backgroundColor = [UIColor clearColor];

    tmpTitleLabel.textColor = [UIColor whiteColor];

    CGRect applicationFrame = CGRectMake(0, 0, 300, 40);
    UIView * newView = [[[UIView alloc] initWithFrame:applicationFrame] autorelease];
    [newView addSubview:imageViewe];
    [newView addSubview:tmpTitleLabel];

    [self.navigationController.navigationBar addSubview:newView];


text:
Q: Custom referencable items I have a list of conditions I want to reference, so I use
\begin{enumerate}
   \item \label{foo} ...
   \item \label{bar} ...
\end{enumerate}
We reference the condition \ref{foo}.

This way the conditions are numbered 1, 2, 3…
But what if I want a custom "numbering" reflecting some relation between the conditions like 1, 1', 2, 3, …? If I write
\begin{enumerate}
   \item \label{foo} ...
   \item[1'] \label{bar} ...
\end{enumerate}

the referencing does not work, the value 1' is not associated with the label bar.

A: There is no way to associate a label to an \item[] since the relevant counter (enumi in this case) is not used at all -- \item[] is explicitly meant for using a different item label which is perhaps not generated by an enumeration. It could be a letter, another symbol or -- with some effort -- even graphics.
Redefinining \item is possible, but tedious.
The crossreftools package provides \crtcrossreflabel{displayed label value}[labelname] which can be inserted for this.
Please note that \item[{\crtcrossreflabel{1'}[bar]}] must be used, since an optional argument (the one from \crtcrossreflabel) appears in another optional argument (the one from \item).
\documentclass{article}

\usepackage{hyperref}
\usepackage{crossreftools}

\begin{document}

See \ref{bar}

\begin{enumerate}
   \item \label{foo} ...
   \item[{\crtcrossreflabel{1'}[bar]}]  ...
\end{enumerate}

\end{document}


text:
Q: How can I set an Event type for 'layerX' and 'layerY' I'm making a dropdown menu having an absolute position.
It gets x, y coordiation from mouse event.
container.addEventListener(
  'contextmenu',
    (e: MouseEvent) => {
      drawingMenuX = e.layerX + 15; // chartiq basic padding is 15
      drawingMenuY = e.layerY + 15;
    },
    false,
);

But it show error "Property 'layerX' does not exist on type 'MouseEvent'.ts(2339)".
How can I set a correct event type instead of MouseEvent?

A: As above @Daniel A.White said, it because layerX and layerY are non-standard. The alternative option is offsetX and offsetY.


text:
Q: Какой плагин подойдет для отрисовки диаграмы бублика? Добрый есть такая диаграма

К примеру тут диаграмма состоит из 5 вариантов, а может из разного количество( Динамически выводится на php )
Можете пожалуйста посоветовать библиотеку для отрисовки, где я бы мог выводить опреленое количество вариантов указав %, а диаграмма отрисует?

A: Есть отличная библиотека Chart js для JS. При помощи PHP отправляете данные на вью, а там уже с помощью библиотеки отрисовываете.


text:
Q: JQTouch IPAD web app I am developing a web app for iPad using JQTouch. It contains two split views & two single views. I am using bee desk IPad example at
http://labnote.beedesk.com/ipad-split-view-supports-on-an-jqtouchs-fork
I had two split views & single views coded in separate four files. Then I integrated all four files in to one.
When I click A button from a split view a single view should be loaded.Single view loads but it's coming as the right side of a split view.. That's the problem... Pls help


text:
Q: Do all series whose terms are differences between a sequence and its limit diverge? So let $\lim_{n\rightarrow\infty}a_n = a$ and for simplicity let $\{a_n\}$ be increasing and $a>0$. Now consider $\sum_n (a- a_n)$. I wrote a proof that this doesn't converge, and I'm wondering where I went wrong, or if it just works because we have an increasing sequence (part of the proof relies on it being monotone).
Proof: For any $\epsilon > 0$ we have that there exists an $N$ so that the terms of the series $a-a_n = b_n <\epsilon$ for all $n>N$. In particular consider $\epsilon$ of the form $\frac{1}{k}$ for some integer $k$. We have that for every $k\geq 1$ that there exists an $N$ so that $b_n < \frac{1}{k}$ for all $n>N$.
Now since $\{a_n\}$ is increasing, we know that $b_n$ is bounded above by $a- a_0$. Let $k_0$ be the floor of $\frac{1}{a-a_0}$. Then for every integer $k>k_0$, there exists an integer $M$ so that for all $n\leq M$ we have that $b_n \geq \frac{1}{k}$.
Thus we have $\sum b_n \geq \sum_{k=k_0+1}^\infty \alpha_k\frac{1}{k}$ where the $\alpha_k$ are integer weights. They represent the distance between the $M$ we obtain for each consecutive $k$. In particular, $\alpha_k \geq 1$ for all $k$. Thus we have $\sum b_n \geq \sum_{k=k_0+1}^\infty \frac{1}{k}$ which proves divergence by the comparison test.
This completes the proof. Hopefully this is easy to read!
edit: seems that the critical problem is where I assumed that $\alpha_k \geq 1$ for all $k$. Since $\alpha_k$ = $M_k - M_{k-1}$ (where these $M$ come from paragraph 3) it could easily be the case that $\alpha_k = 0$, if the sequence approaches its limit fast enough.

A: Let $$\beta_k=\left|\left\{n\mid b_n\geq \frac{1}{k}\right\}\right|$$
Then you are assuming that $\beta_k\geq k-k_0.$ Your assumption that $\alpha_k>0$ for each $k>k_0$ means that you assume that $\beta_k\geq k-k_0$ for each $k>k_0$. That's not going to happen when $b_n$ converges to $0$ very quickly.
For example, with $b_n=\frac{1}{2^n},$ you have that $\beta_k=\left\lfloor \log_2 k\right\rfloor$.
Now, $\beta_k$ is an increasing sequence of integers that converges to $+\infty$. If $k=O(\beta_k)$, then you get "enough" to ensure that the series $\sum b_n$ is bounded below by some constant times the harmonic series.

A: The result itself is definitely not true: it can happen that $a_k$ converges rapidly enough that its deviations from its eventual limit are summable. For example this happens if $a_k=\sum_{n=1}^k 2^{-n}$.
The real error in your proof is that actually not all the $\alpha_k$ are $\geq 1$. For instance with this example $a_k$, the only $\alpha_k$ that are positive are those with $k$ given by a power of $2$.

A: On the contrary, every convergent series $\sum a_n $ enjoys the condition that $lim_{n\to \infty } a_n =0.$
Thus $\sum (a_n-a) = \sum (a_n-0) =\sum a_n $ has to converge.


text:
Q: Variable contents not being persistent I'm having a bit of trouble with trying to save user input into a variable, and then later accessing the contents of that variable. Basically, the user enters details about a song which are then saved in the next available song slot (4 slots total). But when I check to see if a slot is empty or filled, it's always empty as the last song details havn't saved.
Code:
SongDatabase class:
if (song1.getFileSize() == 0) {
    System.out.println("Name of song:");
    song1.setName(console.next());

    System.out.println("Artist:");
    song1.setArtist(console.next());

    System.out.println("File size (MB):");
    song1.setFileSize(console.nextInt());

    System.out.println("Duration (seconds):");
    song1.setDuration(console.nextInt());
}

else if (song2.getFileSize() == 0) {
    System.out.println("Name of song:");
    song2.setName(console.next());

    System.out.println("Artist:");
    song2.setArtist(console.next());

    System.out.println("File size (MB):");
    song2.setFileSize(console.nextInt());

    System.out.println("Duration (seconds):");
    song2.setDuration(console.nextInt());
}

else if (song3.getFileSize() == 0) {
    System.out.println("Name of song:");
    song3.setName(console.next());

    System.out.println("Artist:");
    song3.setArtist(console.next());

    System.out.println("File size (MB):");
    song3.setFileSize(console.nextInt());

    System.out.println("Duration (seconds):");
    song3.setDuration(console.nextInt());
}

else if (song4.getFileSize() == 0) {
    System.out.println("Name of song:");
    song4.setName(console.next());

    System.out.println("Artist:");
    song4.setArtist(console.next());

    System.out.println("File size (MB):");
    song4.setFileSize(console.nextInt());

    System.out.println("Duration (seconds):");
    song4.setDuration(console.nextInt());
}

else {
    System.out.println("The database is currently full. Please delete a song before adding a new one.");
}

Song class:
public void setName(String inputName) {
    name = inputName;
}

public String getName() {
    return name;
}

public void setArtist(String inputArtist) {
    artist = inputArtist;
}

public String getArtist() {
    return artist;
}

public void setFileSize(int inputFileSize) {
    fileSize = inputFileSize;
}

public int getFileSize() {
    return fileSize;
}

public void setDuration(int inputDuration) {
    duration = inputDuration;
}

public int getDuration() {
    return duration;
}

Do I need to add another parameter in the get/set methods or am I doing something completely wrong? Any help would be greatly appreciated, thanks!

A: The best way is to use constructor
song1 = new song("Name of song:","Artist:","File size (MB):","Duration (seconds):")

same thing for the other objects
Then, you need to add a method inside your song class
public boolean isEmpty() {
        if (this.name == null && this.artist == null && this.fileSize == null && this.duration == null ) return true;
        else return false;
    }


text:
Q: How to redraw the data table without losing the current page Suppose i am in 3rd page of datatable, and delete a row of datatable, and redraw the data table, it is coming back to 1st page. But i want to be in 3rd page.
This is my code, Once i delete the row from datatable, it comes to first page.
I am using jQuery v1.11.2
var oTable = $('#alluserlist').dataTable();
oTable.fnDeleteRow(oTable.fnGetPosition(row, null, false));

A: When using DataTables > 1.10 API, you can pass false to draw() to disable re-paging
var table = $('#alluserlist').DataTable();
table.row( this ).remove().draw( false );

Documentation here false - the ordering and search will be recalculated and the rows redrawn in their new positions. The paging will not be reset - i.e. the current page will still be shown.

A:         $(document).ready(function() {
        $('#table_id').DataTable( {
            stateSave: true
        } );
    });

Anyone who are using jQuery DataTables and wants to perform tasks e.g. reload the page, or edit, delete, will face a problem to lose the current page and navigate to 1st page, this snippet will help him to stay on the same page, It avoids to return from current page to first page.

A: If you find compatibility problems using the .draw(false);,  maybe it will be necessary to use a script to iterate the page elements, store the paging, change what you need, draw() the table and then click on each page link. One way could be something like this (using jquery):
    //storing the dataTable paging
    async function storePaging (){
    let lnks=[];
    await $('.paginate_button').each(function(i, obj){
        //iterates the '.paginate_button' elements (responsible for paging)
        classe = $(this).attr("class");
        ariaControls = $(this).attr("aria-controls");
        dataDtIdx = $(this).attr("data-dt-idx");
        //use the indexOf only if you have lots of dataTables into your page and want to specify some of it
        if (classe == "paginate_button current" && ariaControls.indexOf("tableId") > -1){
            lnks.push({classe:classe, ariaControls:ariaControls, dataDtIdx:dataDtIdx})
        }
    });
    return lnks;
}

 //iterates (each) on paging elements and click
async function clickTablesPaging(lnks){
    await $('.paginate_button').each(function(i, obj){
         //separates each value
        classe = $(this).attr("class");
        ariaControls = $(this).attr("aria-controls");
        dataDtIdx = $(this).attr("data-dt-idx");
       //iterates stored paging and click
        for (let elm of lnks){
           if ((classe == "paginate_button current" || classe==("paginate_button ")) && ariaControls == elm.ariaControls && Number(dataDtIdx)==elm.dataDtIdx){
               $(this).click();
           }
        }
    });
}

To use those functions you need just call them on the sequence bellow:
let pgs = await storePaging();
//draw the dataTable
await table.draw();
clickTablesPaging(pgs);


text:
Q: Where are the latest drivers for the Intel HD Graphics 4000? Strangely enough, I haven't been able to find any official website or webpage that hosts the official Intel HD Graphics 4000 latest drivers for OS X (10.9, to be specific).
Where are the drivers hiding?

A: The drivers for Intel GPU HD4000 are modified by apple and the revisions are delivered to you bundled in software updates.
If you want a access to specific driver open the installation package from 10.9 with specific tools for that and get it from there.


text:
Q: How do I iterate through a hash in an objects param hash? Rails (and coding) rookie here (I'm sure I'm just missing basic syntax structural stuff), I've created a form where the user can add as many field pairs as they like via AJAX (barely). This form will collect column titles for a 'sheet' and the associated data type (int, str... etc). The sheet will have item entries added later by users. I'm trying to make a Sheets controller create method that not only saves the title and description of the sheet, but also adds a record to the 'columns' table with the column title, data type and associated sheet id. When I submit the sheet form, I get the following params in the server terminal:
(sorry I'm not sure how to wrap the code snippet)
{"utf8"=>"✓", "authenticity_token"=>"yMlnfO1EWptkEXp5+9AGCO5C3vHt62EUHoKjdWoUB8I=", "sheet"=>{"title"=>"test 33", "description"=>"Descriptions"}, "column"=>[{"title"=>"1", "type"=>"num"}, {"title"=>"2", "type"=>"int"}, {"title"=>"3", "type"=>"real"}, {"title"=>"fo", "type"=>"no"}], "commit"=>"Save Specsheet!"}

I'm trying to loop through the column hash to create a record on the columns table. Each hash would use the title and type values as entries on the table.
My create method:
   def create
@sheet = Sheet.new(sheet_params)
@sheet[:column].each do |key, value|
  @column = Column.new
  @column[:column_title] = key
  @column[:column_data_type] = value
  @column.save
end

if @sheet.save
  redirect_to @sheet
else
  flash[:error] = "Error saving sheet."
  render :new
end

end
My error is usually something like this:
undefined method `each' for nil:NilClass
**@sheet[:column].each do |key, value|**
  @column = Column.new
  @column[:column_title] = key
  @column[:column_data_type] = value

So I know I'm messing up referencing the column hash and its key and values. I'm thinking I can .reduce something here? I have no idea. These kinds of basic structural questions don't really show up with googling, so please let me know what I'm doing wrong, and thank you for reading all of this! Cheers!
WORKING CODE (sorry for weird formatting)
  def create
@sheet = Sheet.new(sheet_params)

column_params.each do |value|
  @sheet.columns.build(value.permit(:title, :data_type))
end

if @sheet.save
  redirect_to @sheet
else
  flash[:error] = "Error saving sheet."
  render :new
end

end
      private
  def sheet_params
    params.require(:sheet).permit(:title, :description, :created_at, :updated_at, :column)
  end

  def column_params
    params.require(:column)
  end

A: When you are calling @sheet[:column], you are referencing an instance of Sheet instead of the params that you are trying to cycle through.
If you are trying to associate Columns to Sheets in a has_many relationship, you can create Columns like:
column.each do |key, value|
  @sheet.columns.new(
    column_title: key
   column_data_type: value
  end
end

(and then save block)
 in your controller. Where column are the params. This will indicate that the column belongs to the sheet instance.
If you are trying to make the Column record without the associations, you can do
column.each do |key, value|
  Column.new(
    column_title: key
    column_data_type: value
  end
end

(and then save block)
(Both assuming that your fields are named column_title and not just title.)


text:
Q: RestKit parsing nested dictionary I get this json response calling a REST api:
{
"ProfileResponse": {
    "Request_timestamp": 1378473780145780000,
    "Execution_time": 30135057
},
"Results": {
    "newsession": {
        "Sessionid": "110873298014",
        "Status": "ACTIVE",
        "Tag": "GO",
        "TimeStamp": 1378473780146026000
    }
},
"ResultsCount": 0,
"ResultsURL": ""
}

and I want to parse this response and get the newsession into a session object that have defined as an objective-c class.
I have defined a base_mapping that maps the base fields ('PrifileResponse', 'Results', 'ResultsCount', 'ResultsURL'), and another mapping for the 'newsession' and a relationship mapping:
RKObjectMapping *baseResponseMapping = [RKObjectMapping mappingForClass:[CSBaseResponse class]];
RKObjectMapping *sessionMapping = [RKObjectMapping mappingForClass:[CSSessionResponse class]];
[sessionMapping addAttributeMappingsFromDictionary:@{
     @"Sessionid":   @"sessionid",
     @"Status": @"status"
 }
];

RKRelationshipMapping *relationshipMapping = [RKRelationshipMapping relationshipMappingFromKeyPath:@"Results" toKeyPath:@"results" withMapping:sessionMapping];
[baseResponseMapping addPropertyMapping:relationshipMapping];

but I can't access the "newsession",
my question specifically is, is there a syntax that I can use in the "from key path" like Results.newsession or something like that to access the inside of "newsession",
or what is the best practice to parse/map this nested structure?


text:
Q: Proving that an uncountable union of convex sets is convex Let $C \subset \mathbb{R}^n$ be a convex set. Moreover let's fix two real numbers $a, b$ such that $0 \le a \le b$.
I am to prove that
$$ \Omega = \bigcup_{\alpha \in [a, b]} \alpha C$$is convex,
where $\alpha C = \{ x \in \mathbb{R}^n: x = \alpha y, y \in C \}$.
I tried to complete the proof using the definition of convex sets.
Let $\omega_1, \omega_2 \in \Omega$. That means that there exists $\alpha_1, \alpha_2 \in [a, b]$ such that $\omega_1 = \alpha_1 C$ and $\omega_2 = \alpha_2 C$. Let's choose $\lambda \in [0, 1]$.
I would like to show now that $\lambda \omega_1 + (1 - \lambda) \omega_2 \in \Omega$. Thus
$$\lambda \omega_1 + (1 - \lambda) \omega_2 = \lambda \alpha_1 y_1 + (1 - \lambda) \alpha_2 y_2 \tag{1}$$
I know that $(1)$ should be equal to $\beta z$, where $\beta \in [a, b]$ and $z \in C$ but I have no idea how I can achieve that goal. I would appreciate any hints or tips.

A: Hint: $\omega_1=\alpha_1 y_1$ and $\omega_w=\alpha_2 y_2$ for some $y_1,y_2 \in C$ (and not as you have stated).
Now $\lambda \omega_1+(1-\lambda) \omega_2= [\lambda \alpha_1 +(1-\lambda) \alpha_2] [ty_1+(1-t)y_2]$ where
$$ t=\frac {\lambda \alpha_1} {\lambda \alpha_1 +(1-\lambda) \alpha_2}$$.
Now use the fact that $ty_1+(1-t)y_2 \in C$ and the fact that $\lambda \alpha_1+(1-\lambda)\alpha_2 \in [a,b]$.

A:
I would like to show now that $\lambda \omega_1 + (1 - \lambda) \omega_2 \in \Omega$.

Hint: Since you know that $\omega_1 \in \alpha_1 C$ and $\omega_2 \in \alpha_2 C$, you should be able to find an $\alpha'$ such that $(\lambda \omega_1 + (1 - \lambda) \omega_2)\in\alpha'C$ by that same constant scaling concept.


text: Q: Possibility of mass update using Salesforce Rest api Is there any way by which we can update and insert records using rest api of salesforce in apex , if not how to do it with bulk api in apex . As object DatedConversionRate do not supports DML for ACM


text:
Q: Send custom audio response to Google Home for actions-on-google-app and to Alexa with skill-kit-app I'm currently building voice-based apps using dialog-flow and Alexa skill kit. Usually, we return the text result from webhook to Alexa or Home, which will read the text result. Now I have a requirement where first I'll generate the audio response(custom speaker voice through my Deep-Learning model) of the text result and wanted to send the generated audio to Home and Alexa to play. I have searched the documentation but saw only support for static audio files .
Is this kind of implementation possible?. How can this be done?


text:
Q: JSON Iteration To Make a List I am trying to iterate through a JSON to create list.
The code works but for some reason the loop is finished the output is all the data I'm trying to write 25 times. (25 because that is the length of the JSON).
Code:
forCounter = 0
sizeCounter = 3.5
json_object = json.loads(json1)
jsonLength = len(json_object["skuAvailability"])

d={}
sizelist=[]
for jsonLength in json_object['skuAvailability']:
  d[sizeCounter]=json_object["skuAvailability"][forCounter]["skuId"]
  sizelist.append(d)
  forCounter +=1
  sizeCounter +=.5

print(sizelist)

JSON(json1):
{"@type":"ItemAvailability","@context":"http://schema.org","skuAvailability":[{"minValue":0,"skuId":"1A9V7X","exists":true,"backOrder":false,"inStock":false,"maxValue":0},{"minValue":0,"skuId":"1A9V7Y","exists":true,"backOrder":false,"inStock":false,"maxValue":0},{"minValue":0,"skuId":"1A9V7Z","exists":true,"backOrder":false,"inStock":false,"maxValue":0},{"minValue":0,"skuId":"1A9V80","exists":true,"backOrder":false,"inStock":false,"maxValue":0},{"minValue":0,"skuId":"1A9V81","exists":true,"backOrder":false,"inStock":false,"maxValue":0},{"minValue":21,"skuId":"1A9V82","exists":true,"backOrder":true,"inStock":true,"maxValue":70},{"minValue":0,"skuId":"1A9V83","exists":true,"backOrder":false,"inStock":false,"maxValue":0},{"minValue":0,"skuId":"1A9V84","exists":true,"backOrder":false,"inStock":false,"maxValue":0},{"minValue":0,"skuId":"1A9V85","exists":true,"backOrder":false,"inStock":false,"maxValue":0},{"minValue":0,"skuId":"1A9V86","exists":true,"backOrder":false,"inStock":false,"maxValue":0},{"minValue":0,"skuId":"1A9V87","exists":true,"backOrder":false,"inStock":false,"maxValue":0},{"minValue":0,"skuId":"1A9V88","exists":true,"backOrder":false,"inStock":false,"maxValue":0},{"minValue":0,"skuId":"1A9V89","exists":true,"backOrder":false,"inStock":false,"maxValue":0},{"minValue":0,"skuId":"1A9V8A","exists":true,"backOrder":false,"inStock":false,"maxValue":0},{"minValue":0,"skuId":"1A9V8B","exists":true,"backOrder":false,"inStock":false,"maxValue":0},{"minValue":21,"skuId":"1A9V8C","exists":true,"backOrder":true,"inStock":true,"maxValue":70},{"minValue":0,"skuId":"1A9V8D","exists":true,"backOrder":false,"inStock":false,"maxValue":0},{"minValue":0,"skuId":"1A9V8E","exists":true,"backOrder":false,"inStock":false,"maxValue":0},{"minValue":0,"skuId":"1A9V8F","exists":true,"backOrder":false,"inStock":false,"maxValue":0},{"minValue":0,"skuId":"1A9V8G","exists":true,"backOrder":false,"inStock":false,"maxValue":0},{"minValue":0,"skuId":"1A9V8I","exists":true,"backOrder":false,"inStock":false,"maxValue":0},{"minValue":0,"skuId":"1A9V8K","exists":true,"backOrder":false,"inStock":false,"maxValue":0},{"minValue":0,"skuId":"1A9V8M","exists":true,"backOrder":false,"inStock":false,"maxValue":0},{"minValue":0,"skuId":"1A9V8O","exists":true,"backOrder":false,"inStock":false,"maxValue":0},{"minValue":0,"skuId":"1A9V8Q","exists":true,"backOrder":false,"inStock":false,"maxValue":0}],"identifier":"nvprod3690049v"}

Output:
[{3.5: '1A9V7X', 4.0: '1A9V7Y', 4.5: '1A9V7Z', 5.0: '1A9V80', 5.5: '1A9V81', 6.0: '1A9V82', 6.5: '1A9V83', 7.0: '1A9V84', 7.5: '1A9V85', 8.0: '1A9V86', 8.5: '1A9V87', 9.0: '1A9V88', 9.5: '1A9V89', 10.0: '1A9V8A', 10.5: '1A9V8B', 11.0: '1A9V8C', 11.5: '1A9V8D', 12.0: '1A9V8E', 12.5: '1A9V8F', 13.0: '1A9V8G', 13.5: '1A9V8I', 14.0: '1A9V8K', 14.5: '1A9V8M', 15.0: '1A9V8O', 15.5: '1A9V8Q'}, {3.5: '1A9V7X', 4.0: '1A9V7Y', 4.5: '1A9V7Z', 5.0: '1A9V80', 5.5: '1A9V81', 6.0: '1A9V82', 6.5: '1A9V83', 7.0: '1A9V84', 7.5: '1A9V85', 8.0: '1A9V86', 8.5: '1A9V87', 9.0: '1A9V88', 9.5: '1A9V89', 10.0: '1A9V8A', 10.5: '1A9V8B', 11.0: '1A9V8C', 11.5: '1A9V8D', 12.0: '1A9V8E', 12.5: '1A9V8F', 13.0: '1A9V8G', 13.5: '1A9V8I', 14.0: '1A9V8K', 14.5: '1A9V8M', 15.0: '1A9V8O', 15.5: '1A9V8Q'}, {3.5: '1A9V7X', 4.0: '1A9V7Y', 4.5: '1A9V7Z', 5.0: '1A9V80', 5.5: '1A9V81', 6.0: '1A9V82', 6.5: '1A9V83', 7.0: '1A9V84', 7.5: '1A9V85', 8.0: '1A9V86', 8.5: '1A9V87', 9.0: '1A9V88', 9.5: '1A9V89', 10.0: '1A9V8A', 10.5: '1A9V8B', 11.0: '1A9V8C', 11.5: '1A9V8D', 12.0: '1A9V8E', 12.5: '1A9V8F', 13.0: '1A9V8G', 13.5: '1A9V8I', 14.0: '1A9V8K', 14.5: '1A9V8M', 15.0: '1A9V8O', 15.5: '1A9V8Q'}, {3.5: '1A9V7X', 4.0: '1A9V7Y', 4.5: '1A9V7Z', 5.0: '1A9V80', 5.5: '1A9V81', 6.0: '1A9V82', 6.5: '1A9V83', 7.0: '1A9V84', 7.5: '1A9V85', 8.0: '1A9V86', 8.5: '1A9V87', 9.0: '1A9V88', 9.5: '1A9V89', 10.0: '1A9V8A', 10.5: '1A9V8B', 11.0: '1A9V8C', 11.5: '1A9V8D', 12.0: '1A9V8E', 12.5: '1A9V8F', 13.0: '1A9V8G', 13.5: '1A9V8I', 14.0: '1A9V8K', 14.5: '1A9V8M', 15.0: '1A9V8O', 15.5: '1A9V8Q'}, {3.5: '1A9V7X', 4.0: '1A9V7Y', 4.5: '1A9V7Z', 5.0: '1A9V80', 5.5: '1A9V81', 6.0: '1A9V82', 6.5: '1A9V83', 7.0: '1A9V84', 7.5: '1A9V85', 8.0: '1A9V86', 8.5: '1A9V87', 9.0: '1A9V88', 9.5: '1A9V89', 10.0: '1A9V8A', 10.5: '1A9V8B', 11.0: '1A9V8C', 11.5: '1A9V8D', 12.0: '1A9V8E', 12.5: '1A9V8F', 13.0: '1A9V8G', 13.5: '1A9V8I', 14.0: '1A9V8K', 14.5: '1A9V8M', 15.0: '1A9V8O', 15.5: '1A9V8Q'}, {3.5: '1A9V7X', 4.0: '1A9V7Y', 4.5: '1A9V7Z', 5.0: '1A9V80', 5.5: '1A9V81', 6.0: '1A9V82', 6.5: '1A9V83', 7.0: '1A9V84', 7.5: '1A9V85', 8.0: '1A9V86', 8.5: '1A9V87', 9.0: '1A9V88', 9.5: '1A9V89', 10.0: '1A9V8A', 10.5: '1A9V8B', 11.0: '1A9V8C', 11.5: '1A9V8D', 12.0: '1A9V8E', 12.5: '1A9V8F', 13.0: '1A9V8G', 13.5: '1A9V8I', 14.0: '1A9V8K', 14.5: '1A9V8M', 15.0: '1A9V8O', 15.5: '1A9V8Q'}, {3.5: '1A9V7X', 4.0: '1A9V7Y', 4.5: '1A9V7Z', 5.0: '1A9V80', 5.5: '1A9V81', 6.0: '1A9V82', 6.5: '1A9V83', 7.0: '1A9V84', 7.5: '1A9V85', 8.0: '1A9V86', 8.5: '1A9V87', 9.0: '1A9V88', 9.5: '1A9V89', 10.0: '1A9V8A', 10.5: '1A9V8B', 11.0: '1A9V8C', 11.5: '1A9V8D', 12.0: '1A9V8E', 12.5: '1A9V8F', 13.0: '1A9V8G', 13.5: '1A9V8I', 14.0: '1A9V8K', 14.5: '1A9V8M', 15.0: '1A9V8O', 15.5: '1A9V8Q'}, {3.5: '1A9V7X', 4.0: '1A9V7Y', 4.5: '1A9V7Z', 5.0: '1A9V80', 5.5: '1A9V81', 6.0: '1A9V82', 6.5: '1A9V83', 7.0: '1A9V84', 7.5: '1A9V85', 8.0: '1A9V86', 8.5: '1A9V87', 9.0: '1A9V88', 9.5: '1A9V89', 10.0: '1A9V8A', 10.5: '1A9V8B', 11.0: '1A9V8C', 11.5: '1A9V8D', 12.0: '1A9V8E', 12.5: '1A9V8F', 13.0: '1A9V8G', 13.5: '1A9V8I', 14.0: '1A9V8K', 14.5: '1A9V8M', 15.0: '1A9V8O', 15.5: '1A9V8Q'}, {3.5: '1A9V7X', 4.0: '1A9V7Y', 4.5: '1A9V7Z', 5.0: '1A9V80', 5.5: '1A9V81', 6.0: '1A9V82', 6.5: '1A9V83', 7.0: '1A9V84', 7.5: '1A9V85', 8.0: '1A9V86', 8.5: '1A9V87', 9.0: '1A9V88', 9.5: '1A9V89', 10.0: '1A9V8A', 10.5: '1A9V8B', 11.0: '1A9V8C', 11.5: '1A9V8D', 12.0: '1A9V8E', 12.5: '1A9V8F', 13.0: '1A9V8G', 13.5: '1A9V8I', 14.0: '1A9V8K', 14.5: '1A9V8M', 15.0: '1A9V8O', 15.5: '1A9V8Q'}, {3.5: '1A9V7X', 4.0: '1A9V7Y', 4.5: '1A9V7Z', 5.0: '1A9V80', 5.5: '1A9V81', 6.0: '1A9V82', 6.5: '1A9V83', 7.0: '1A9V84', 7.5: '1A9V85', 8.0: '1A9V86', 8.5: '1A9V87', 9.0: '1A9V88', 9.5: '1A9V89', 10.0: '1A9V8A', 10.5: '1A9V8B', 11.0: '1A9V8C', 11.5: '1A9V8D', 12.0: '1A9V8E', 12.5: '1A9V8F', 13.0: '1A9V8G', 13.5: '1A9V8I', 14.0: '1A9V8K', 14.5: '1A9V8M', 15.0: '1A9V8O', 15.5: '1A9V8Q'}, {3.5: '1A9V7X', 4.0: '1A9V7Y', 4.5: '1A9V7Z', 5.0: '1A9V80', 5.5: '1A9V81', 6.0: '1A9V82', 6.5: '1A9V83', 7.0: '1A9V84', 7.5: '1A9V85', 8.0: '1A9V86', 8.5: '1A9V87', 9.0: '1A9V88', 9.5: '1A9V89', 10.0: '1A9V8A', 10.5: '1A9V8B', 11.0: '1A9V8C', 11.5: '1A9V8D', 12.0: '1A9V8E', 12.5: '1A9V8F', 13.0: '1A9V8G', 13.5: '1A9V8I', 14.0: '1A9V8K', 14.5: '1A9V8M', 15.0: '1A9V8O', 15.5: '1A9V8Q'}, {3.5: '1A9V7X', 4.0: '1A9V7Y', 4.5: '1A9V7Z', 5.0: '1A9V80', 5.5: '1A9V81', 6.0: '1A9V82', 6.5: '1A9V83', 7.0: '1A9V84', 7.5: '1A9V85', 8.0: '1A9V86', 8.5: '1A9V87', 9.0: '1A9V88', 9.5: '1A9V89', 10.0: '1A9V8A', 10.5: '1A9V8B', 11.0: '1A9V8C', 11.5: '1A9V8D', 12.0: '1A9V8E', 12.5: '1A9V8F', 13.0: '1A9V8G', 13.5: '1A9V8I', 14.0: '1A9V8K', 14.5: '1A9V8M', 15.0: '1A9V8O', 15.5: '1A9V8Q'}, {3.5: '1A9V7X', 4.0: '1A9V7Y', 4.5: '1A9V7Z', 5.0: '1A9V80', 5.5: '1A9V81', 6.0: '1A9V82', 6.5: '1A9V83', 7.0: '1A9V84', 7.5: '1A9V85', 8.0: '1A9V86', 8.5: '1A9V87', 9.0: '1A9V88', 9.5: '1A9V8

Expected outPut:
[{3.5: '1A9V7X', 4.0: '1A9V7Y', 4.5: '1A9V7Z', 5.0: '1A9V80', 5.5: '1A9V81', 6.0: '1A9V82', 6.5: '1A9V83', 7.0: '1A9V84', 7.5: '1A9V85', 8.0: '1A9V86', 8.5: '1A9V87', 9.0: '1A9V88', 9.5: '1A9V89', 10.0: '1A9V8A', 10.5: '1A9V8B', 11.0: '1A9V8C', 11.5: '1A9V8D', 12.0: '1A9V8E', 12.5: '1A9V8F', 13.0: '1A9V8G', 13.5: '1A9V8I', 14.0: '1A9V8K', 14.5: '1A9V8M', 15.0: '1A9V8O', 15.5: '1A9V8Q'}]

What am I doing wrong?

A: Your code is very confusing and has many unnecessary things in it. The reason you're getting the same data 25 times is because that's how many references to the dictionary d get appended to the sizelist (because that's how long the "skuAvailability" list is in the JSON object).
In Python if's often unneeccesary to use an index like forCounter to reference items in a sequence because you can usually just iterate through them directly via a for statement. Below is your code modified to do this and create the dictionary. Since only thing in the resulting sizelist, it's simply put in it when the list itself is created near the very end.
import json

json1 = '''{"@type":"ItemAvailability","@context":"http://schema.org","skuAvailability":[{"minValue":0,"skuId":"1A9V7X","exists":true,"backOrder":false,"inStock":false,"maxValue":0},{"minValue":0,"skuId":"1A9V7Y","exists":true,"backOrder":false,"inStock":false,"maxValue":0},{"minValue":0,"skuId":"1A9V7Z","exists":true,"backOrder":false,"inStock":false,"maxValue":0},{"minValue":0,"skuId":"1A9V80","exists":true,"backOrder":false,"inStock":false,"maxValue":0},{"minValue":0,"skuId":"1A9V81","exists":true,"backOrder":false,"inStock":false,"maxValue":0},{"minValue":21,"skuId":"1A9V82","exists":true,"backOrder":true,"inStock":true,"maxValue":70},{"minValue":0,"skuId":"1A9V83","exists":true,"backOrder":false,"inStock":false,"maxValue":0},{"minValue":0,"skuId":"1A9V84","exists":true,"backOrder":false,"inStock":false,"maxValue":0},{"minValue":0,"skuId":"1A9V85","exists":true,"backOrder":false,"inStock":false,"maxValue":0},{"minValue":0,"skuId":"1A9V86","exists":true,"backOrder":false,"inStock":false,"maxValue":0},{"minValue":0,"skuId":"1A9V87","exists":true,"backOrder":false,"inStock":false,"maxValue":0},{"minValue":0,"skuId":"1A9V88","exists":true,"backOrder":false,"inStock":false,"maxValue":0},{"minValue":0,"skuId":"1A9V89","exists":true,"backOrder":false,"inStock":false,"maxValue":0},{"minValue":0,"skuId":"1A9V8A","exists":true,"backOrder":false,"inStock":false,"maxValue":0},{"minValue":0,"skuId":"1A9V8B","exists":true,"backOrder":false,"inStock":false,"maxValue":0},{"minValue":21,"skuId":"1A9V8C","exists":true,"backOrder":true,"inStock":true,"maxValue":70},{"minValue":0,"skuId":"1A9V8D","exists":true,"backOrder":false,"inStock":false,"maxValue":0},{"minValue":0,"skuId":"1A9V8E","exists":true,"backOrder":false,"inStock":false,"maxValue":0},{"minValue":0,"skuId":"1A9V8F","exists":true,"backOrder":false,"inStock":false,"maxValue":0},{"minValue":0,"skuId":"1A9V8G","exists":true,"backOrder":false,"inStock":false,"maxValue":0},{"minValue":0,"skuId":"1A9V8I","exists":true,"backOrder":false,"inStock":false,"maxValue":0},{"minValue":0,"skuId":"1A9V8K","exists":true,"backOrder":false,"inStock":false,"maxValue":0},{"minValue":0,"skuId":"1A9V8M","exists":true,"backOrder":false,"inStock":false,"maxValue":0},{"minValue":0,"skuId":"1A9V8O","exists":true,"backOrder":false,"inStock":false,"maxValue":0},{"minValue":0,"skuId":"1A9V8Q","exists":true,"backOrder":false,"inStock":false,"maxValue":0}],"identifier":"nvprod3690049v"}'''

json_object = json.loads(json1)
d = {}
sizeCounter = 3.5
for availability in json_object['skuAvailability']:
    d[sizeCounter] = availability["skuId"]
    sizeCounter += .5

sizelist = [d]
print(sizelist)


text:
Q: Ansible iosxr_command save the output even when command syntax error When using iosxr_command module to send arbitrary command to cisco device and save output, how can I keep the output even when the device return command syntax error, instead of considering task as failed?
Playbook:
- name: run command and save output
  iosxr_command:
    commands:
      - "invalid syntax command"
    register: output

Expected saved output:
RP/0/RSP0/CPU0:IOSXR_ROUTER#invalid syntax command
                              ^
% Invalid input detected at '^' marker.

Instead of:
TASK [run command and save output]
*****************************************************************************************************************
failed: [IOSXR_ROUTER] (item=invalid syntax command) => {"changed": false, "item": "invalid command",
"msg": "invalid syntax command\r\n\r
^\r\n% Invalid input detected at '^' marker.\r\nRP/0/RSP0/CPU0:IOSXR_ROUTER#"}

A: As @mdaniel adviced I tried using ignore_errors: yes in task then I modify playbook a bit so it will capture output.msg instead of output.stdout when the command is syntax error. Like this:
- name: run show command
  iosxr_command:
    commands:
      - invalid command
  register: output
  ignore_errors: yes

- name: Check previous task fail
  set_fact:
    captured_data: "{{output.msg}}"
  when: output.failed

- name: Check previous task succeed
  set_fact:
    captured_data: "{{output.stdout[0] | replace('\\n', '\n')}}"
  when: not output.failed


text:
Q: For Loop Half Pyramid Vertical - Java
how to this?
This is my Code
import java.util.*;
class ForLoopPyramids {
    public static void main(String args[]) {

        Scanner x = new Scanner (System.in);

        int a;
        System.out.println("The Input is: ");
        a=x.nextInt();
        int c;
        for (int i = 0; i < a; i++) {
              for (int j = 0; j < a; j++) {
                if (j <= i) {
                    c = a+j;
                    System.out.print("  "+i);
                } else {
                    System.out.print("   ");
                }
            }
            System.out.println();
        }
    }
}

But this is my output
The Input is:
5
  0
  1  1
  2  2  2
  3  3  3  3
  4  4  4  4  4

But i want my output to be
  5  5  5  5  5
  4  4  4  4
  3  3  3
  2  2
  1

A: One approach, start with i at a and loop down to 0, also your inner loop only needs to be from 0 to i and you might use formatted io. Something like,
for (int i = a; i > 0; i--) {
    for (int j = 0; j < i; j++) {
        System.out.printf("% 2d", i);
    }
    System.out.println();
}

Which outputs (with a of 5) as requested
 5 5 5 5 5
 4 4 4 4
 3 3 3
 2 2
 1

Alternatively, using Java 8+, and IntStream(s) it might be implemented like
IntStream.range(0, a).mapToObj(i -> {
    return IntStream.range(0, a - i).mapToObj(j -> {
        return new StringBuilder(" ").append(a - i);
    }).collect(Collectors.joining());
}).forEachOrdered(System.out::println);


text:
Q: Programmatically query Symfony / Doctrine ORM I'm using Doctrine-defined Entity schema as a reference to create a C++/Qt API to access such data.
Is there a way to programmatically iterate through all the fields and their parameters such that there is only one master schema (and the C++ boilerplate headers are generated from it?)

A: To get entities information, such as attributes and their properties you can use Doctrine Metadata Drivers. You just need your entities namespaces, once you have it you can use Doctrine to get their metadata.
I've created a service for this in my application (Posting here just as a usage example):
namespace Acme\Project\ProjectUserBundle\Service\Mapping;

use Doctrine\ORM\EntityManager;
use Doctrine\ORM\EntityNotFoundException;

/**
 * Class EntityService
 */
class EntityService
{
    private $em;

    public function __construct(EntityManager $entityManager)
    {
        $this->em = $entityManager;
    }

    /**
     * Return all Doctrine entities namespaces
     *
     * @return array
     */
    public function getAllEntityClasses()
    {
        $doctrineEntities = array();
        $allEntitiesMetadata = $this->em->getMetadataFactory()->getAllMetadata();

        foreach ($allEntitiesMetadata as $entityMetadata) {
            $doctrineEntities[] = $entityMetadata->getName();
        }

        return $doctrineEntities;
    }

    /**
     * Return all Doctrine entities namespaces in a given base namespace
     *
     * @param $namespace
     * @return array
     * @throws \Doctrine\ORM\EntityNotFoundException
     */
    public function getAllEntityClassesInNamespace($namespace)
    {
        $allEntityClasses = $this->getAllEntityClasses();

        foreach ($allEntityClasses as $entity) {
            preg_match($namespace, $entity, $haveFound);
            if (!empty($haveFound)) {
                $entitiesInNamespace[] = $entity;
            }
        }

        if (!isset ($entitiesInNamespace)) {
            throw new EntityNotFoundException("No entities found in $namespace namespace");
        }

       return $entitiesInNamespace;
    }

    /**
     * Receives a entity namespace and return all entity metadata
     *
     * @param $entityNamespace
     * @return \Doctrine\Common\Persistence\Mapping\ClassMetadata
     */
    public function getEntityMetadata($entityNamespace)
    {
        $metadataFactory = $this->em->getMetadataFactory();
        $entityMetadata = $metadataFactory->getMetadataFor($entityNamespace);

        //Check out, all entity information here;
        var_dump($entityMetadata);

        foreach ($entityMetadata->fieldMappings as $fieldMapping) {
            //Each attribute info;
            var_dump($fieldMapping);
        }

        return $entityMetadata;
    }
}

Register it on your services.yml/xml, it uses Doctrine entity manager as dependency.
services:
    Mapping.EntityService:
        class: Acme\Project\ProjectUserBundle\Service\Mapping\EntityService
        arguments: [ @doctrine.orm.entity_manager ]

Than just use the service on your controller (In my case I was using this service to get entities and apply permissions for users over them (read/write/view):
class UserPermissionController extends Controller
{

    public function yourAction()
    {
        $entityService = $this->get('Mapping.EntityService');

        $entitiesToApplyPermissions = $entityService->getAllEntityClassesInNamespace('/Acme/');

        foreach ($entitiesToApplyPermissions as $entity) {

            $entityService->getEntityMetadata($entity);
            //do whatever you want here
        }
    }
}

Note that this is just an example of usage, take a look at the documentation for more info:
http://doctrine-orm.readthedocs.org/en/latest/reference/metadata-drivers.html
To generate the C++ headers you likely could create another service to handle, which btw could use this Mapping.EntityService as dependency.


text:
Q: is there a way to combine different java web application to one web application (war) without impacting each other? I'm running an application with several different features, they are completely independent;
the only reason is i run them together is i run them on a small vps with limited memory;
I'm expecting:

*

*develop each module seperately

*combine them together into one application using some ant tasks;
for a ear file, we can combine several different war files into one, and they can run fine without impacting each other,
however, since I'm running a tomcat and do not want to involve heavy containers like jboss or so on, an ear file is not available;
is there a way that we can achieve this? such as we develop something standalone and then package them into a jar, put it into web-inf/lib and it will just work? thx.
the options i've used:

*

*develop them in one application, using different dir to seperate
them

*develop them in many different applications and deploy them as
different web applications in tomcat, but this one seems to load
duplicate classes under web-inf/lib into memory, which is not a good
option, while i do not like to putting them all to tomcat/lib...

A: You can do this using Maven (if you're happy to use Maven instead of Ant), and the Cargo plugin for Maven.  It has an 'uberwar' packaging format that allows multiple WAR files to be merged into a single combined WAR file.  Details are available here:
http://cargo.codehaus.org/Merging+WAR+files

A: You need to build some kind of wall, so would exist a technical restriction to avoid that a bad developer could break your design generating innecesary dependence. You could put all the java classes in different jars embedded in your new merged web project and just keeping the web content in the same project but separate folders.
Maven+SVN could host and provide the jars to the new project.


text:
Q: how to make UIBarButton Right Justified in IPhone I have added the Toolbar dynamically and in that i added barbutton dynamically but it appears on left side I want it to appear on the Right Side.
Can AnyOne help me Out with this My code Goes Like this
 CGRect frame = CGRectMake(0, 205, 320, 40);
 UIToolbar *toolbar = [[UIToolbar alloc]initWithFrame:frame];
 toolbar.barStyle =UIBarStyleBlackTranslucent;
 toolbar.tintColor = [UIColor darkGrayColor];

 UIBarButtonItem *backButton = [[UIBarButtonItem alloc] initWithTitle: @"Done" style:UIBarButtonItemStyleDone target:self action:@selector(foo)];
 NSArray *array = [[NSArray alloc]initWithObjects:backButton,nil];

 [toolbar setItems:array];

A: I got the Answer by Simply adding the following Line
UIBarButtonItem *BtnSpace = [[UIBarButtonItem alloc]initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:self action:nil];
and adding this in array
Now the Code Look Like this
self.tableView = [[UITableView alloc]initWithFrame:CGRectMake(0, 20, 320, 480) style:UITableViewStyleGrouped];
    CGRect frame = CGRectMake(0, 205, 320, 40);
    UIToolbar *toolbar = [[UIToolbar alloc]initWithFrame:frame];
    toolbar.barStyle =UIBarStyleBlackTranslucent;
    toolbar.tintColor = [UIColor darkGrayColor];
UIBarButtonItem *BtnSpace = [[UIBarButtonItem alloc]initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:self action:nil];
UIBarButtonItem *backButton = [[UIBarButtonItem alloc] initWithTitle: @"Done" style:UIBarButtonItemStyleDone target:self action:@selector(foo)];
NSArray *array = [[NSArray alloc]initWithObjects:BtnSpace,backButton,nil];

[toolbar setItems:array];


text:
Q: Is it possible to pass a table of rowtype from java to an oracle stored procedure? I got this type in oracle:
TYPE "RequestTable" IS TABLE OF "Requests"%ROWTYPE;

I have used this type as an IN(or out) parameter of some stored procedures, like this:
create or replace
PROCEDURE
"RegisterRequestsBulk"
(
  Par_RequestsBulk IN "TableTypes"."RequestTable"
, ErrorCodeTable OUT "TableTypes"."ErrorCodeTable"
) AS
BEGIN
...

Now, I need to call this SP from Java. How should I pass this kind of parameters?

A: The link in the comments is the "correct" way to do this.
But you could create a table on the fly in a declare begin end block, and pass that to your proc call.
In java, create a string like this
  declare
    lvTable RequestTable;
    lvError ErrorCodeTable;
  begin
      select col1, col2
      BULK COLLECT INTO lvTable
      from (
     ****
     java loop to create lvTable in java string
      SELECT col1, col2 -- row 1
       FROM dual
      union all
      SELECT col1, col2 -- row n
       FROM dual
     ****
     );
     RegisterRequestsBulk(lvTable, lvError);
     open :? for select * from table(lvError);
  end;

Then you can call your proc with this constructed string and expect the errors in a cursor.
http://docs.oracle.com/cd/A84870_01/doc/java.816/a81354/samapp2.htm
Hope that makes sense.


text:
Q: mockReturnValue is not a function error, What can I do here? I am getting the error TypeError: _loginViewModel.LoginViewModel.mockReturnValue is not a function
Here is my setup/ Its a typescript project.
import React from 'react';
import renderer from 'react-test-renderer';
import LoginView from '../src/views/loginView/loginView';
import { LoginStatus, LoginViewModel } from '../src/viewModels/loginViewModel';

// const mockLoginViewModel = LoginViewModel as jest.Mock;

jest.mock('../src/viewModels/loginViewModel', () => ({
  LoginViewModel: jest.fn(),
  // require the actual real modules for the rest of the code
  ...jest.requireActual('../src/viewModels/loginViewModel'),
}));

it('renders correctly', () => {
  (LoginViewModel as jest.Mock).mockReturnValue({
    email: 'test@gmail.com',
    setEmail: jest.fn(),
    setEmailValid: jest.fn(),
    password: 'test',
    setPassword: jest.fn(),
    setPasswordValid: jest.fn(),
    rememberMeEnabled: false,
    alwaysShowInputValid: false,
    initalLoadRememberMe: jest.fn(),
    setRememberMe: jest.fn(),
    onLoginPressed: jest.fn(),
    navigation: jest.fn(),
    loginStatus: LoginStatus.idle,
    showLoginErrorText: false,
    loginErrorText: '',
  });
  const tree = renderer.create(<LoginView />).toJSON();
  expect(tree).toMatchSnapshot();
});

Ive tried using a jestSetup.ts file as well but I get the same error.
full error
yarn run v1.22.18
$ export NODE_ENV=development && jest --detectOpenHandles --forceExit
 FAIL  tests/loginView.test.tsx
  ● renders correctly

    TypeError: _loginViewModel.LoginViewModel.mockReturnValue is not a function

      13 |
      14 | it('renders correctly', () => {
    > 15 |   (LoginViewModel as jest.Mock).mockReturnValue({
         |                                 ^
      16 |     email: 'test@gmail.com',
      17 |     setEmail: jest.fn(),
      18 |     setEmailValid: jest.fn(),

      at Object.mockReturnValue (tests/loginView.test.tsx:15:33)

What can I do here?


text:
Q: CFDictionaryGetValue() I could not able to get the value for the key.
I have a structure pt(which is the value) and a wTiId,wTiId1(which is the key).
I am sure that something wrong i'm doing in the below code but i could not figure out what
it is.
Timers.h
---------
#import <Foundation/Foundation.h>

struct session {
    int a;
    char c;
}pstruct;

@interface Timers : NSObject {
    unsigned short wTiId;
    unsigned short wTiId1;

}
-(void)timer;
@end

Timers.m
--------

#import "Timers.h"

@implementation Timers
-(id)init
{
    if (self=[super init]) {
    wTiId=71;
    wTiId1=72;
    }
    return self;
}

-(void)dealloc
{
    [super dealloc];
}

-(void)timer
{
struct session* pt = &pstruct;

pt->a=12;
pt->c='L';

CFDictionaryValueCallBacks cbvs = {0,NULL,NULL,NULL,NULL};
CFMutableDictionaryRef cfmdict = CFDictionaryCreateMutable(NULL,0,&kCFTypeDictionaryKeyCallBacks,&cbvs);

NSLog(@"Dict size:%d\n",((CFIndex)CFDictionaryGetCount(cfmdict)));

CFNumberRef tiId = CFNumberCreate(NULL,kCFNumberShortType,&wTiId);
CFNumberRef tiId1 = CFNumberCreate(NULL,kCFNumberShortType,&wTiId1);

CFDictionarySetValue(cfmdict,tiId,pt);
NSLog(@"Dict size:%d\n",((CFIndex)CFDictionaryGetCount(cfmdict)));

CFDictionarySetValue(cfmdict,tiId1,pt);
NSLog(@"Dict size:%d\n",((CFIndex)CFDictionaryGetCount(cfmdict)));

NSLog(@"The value is:%s",(CFDictionaryGetValue(cfmdict,tiId)));

CFRelease(tiId);
CFRelease(tiId1);
}
@end

main.m
------
#import <Foundation/Foundation.h>
#import "Timers.h"
int main (int argc, const char * argv[]) {
    NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
    Timers* time = [[Timers alloc]init];
    [time timer];
    [pool drain];
    return 0;
}

output
------

2011-05-15 14:52:54.857 timer[3511:a0f] Dict size:0
2011-05-15 14:52:54.861 timer[3511:a0f] Dict size:1
2011-05-15 14:52:54.861 timer[3511:a0f] Dict size:2
2011-05-15 14:52:54.862 timer[3511:a0f] The value is:

I tried with the format specifier "%@" also.Nothing gets printed when CFDictionaryGetValue
() function is called.The return type of this function is const void*.

A: The result of CFDictionaryGetValue is what you put in the dictionary.
You have to cast the result of CFDictionaryGetValue to the right pointer type to access the structure members:
struct session *value = (struct session *) CFDictionaryGetValue(cfmdict,tiId);
NSLog(@"The value is %d and %c", value->a, value->c);

A: You cannot store structs in CFDictionarys, only pointers to structs will work. You cannot print the contents of the struct with the %s format specifier.


text:
Q: Asp.Net Pass value to Modal TextBox from GridView on button click As stated above, I wanted to know how could I possibly send data from gridview to modal Asp:TextBox
GridView Button
<asp:TemplateField ShowHeader="False">
<ItemTemplate>
      <a data-id="<%#Eval("BookFile") %>"  title="Add this item" class="openDialog">Open Modal

</ItemTemplate>
</asp:TemplateField>

Script

Modal

Modal title

            <asp:Label runat="server" AssociatedControlID="bookId1" CssClass="col-md-2 control-label">Username</asp:Label>

                <asp:TextBox runat="server" ID="Id" CssClass="form-control"/>
                <asp:RequiredFieldValidator runat="server" ControlToValidate="Id"
                    CssClass="text-danger" ErrorMessage="The field is required." />

        <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
        <asp:Button runat="server" OnClick="CreateUser_Click" Text="Add User" CssClass="btn btn-Success" />

Whenever I use this, no data is populated to the textbox but whenever I use the input box the code works
<input type="text" name="Id" id="Id">

Thanks in advance!

A: Ok. I was able to solve this by simply changing the script from

to

A: Its too late to answer this one, but we have future newbies.
You can do this Html button and a JavaScript code, here is a snippet.
Gridview Code
<asp:TemplateField ItemStyle-Width="13%" HeaderText="Actions" HeaderStyle-Width="13%">
   <ItemTemplate>
       <button data-toggle="modal" data-target="#UpdateModel" class="btn btn-default source" style="width:100%"  type="button" onclick="showUpdateModel('<%#Eval("ID")%>' , '<%#Eval("Name")%>', '<%#Eval("DOB")%>','<%#Eval("Class")%>','<%#Eval("Section")%>')">Edit</button>
       <button data-toggle="modal" data-target="#DeleteModel" type="button" class="btn btn-default source" style="width:100%" onclick="showDelModel('<%#Eval("FeeRecID")%>')">Delete</button>
     </ItemTemplate>
</asp:TemplateField>

Above button will target the model to open, and onclick function will pass the values to modal fields.