text:
Q: Pyqt5 QTableWidget not emitting currentCellChanged signal when a cell containing a QComboBox is entered I've subclassed QTableWidget to achieve a specific behavior. The first column of my table (idx=0) will contain QComboBoxes, and the second column (idx=1) will contain QLineEdits. This table will be used for user data input with an unknown number of required inputs. The default number of rows is 4. I have implemented logic so that there is always at least one row with a '' in the a QComboBox in the first column and there are never any fewer than four rows. If a user enters data and changes cells in the QTableWidget, the currentCellChanged signal fires and is connected to a checkAndExpand slot. This in turn should either add a row to the table, or remove rows that are blank - as long as there is at least one blank row.
All of this works if there is a QLineEdit in the first column. However, when I place QComboBoxes in the first column, the table's currentCellChanged signal does not fire, and checkAndExpand is not called.
Any advice here would be much appreciated.
As I mentioned above, I have a second subclassed QTableWidget that has QLine Edits (or rather, subclassed QLineEdits, called feedbackQLineEdit in this code) and that class/widget works as expected.
class skiLabelTable(qtw.QTableWidget):
    """ Class for a table that is N rows long and two columns wide. each cell in the first column holds a combobox
    and each cell in the seond column holds a feedbackQLineEdit. The ski name is selected from the combobox and the label is typed
    (or loaded) into the second column.

    There will always be at least one row with a blank in the combobox. The MINIMUM number of rows this widget can have is
    four rows.

    this class emits a signal with a bound dict. The keys of that dict are the ski labels, the values are the ski names

    ONLY complete rows are emitted. If either column of a row is blank, it will not be in the dict"""

    #signals go here
    skiLabelDataChanged=qtc.pyqtSignal(dict)
    skiListChanged=qtc.pyqtSignal(list)

    def checkAndExpand(self,curRow,curCol,prevRow,prevCol):
        # Generate a list of data in the first column of data.
        # if all cells have data, add a row and populate withe the appropriate widgets
        # if there is EXACTLY 1 empty row, do nothing
        # if there are multiple empty rows at the end of the table, Remove those rows
        firstColData=[]
        #print(f'curRow = {curRow}')
        for i in range(self.rowCount()):
            firstColData.append(self.cellWidget(i,0).currentText())
        numBlank=firstColData.count('')
        print(firstColData)
        if numBlank==0: # There are now rows with a blank first column. Add one at the end!
            curRows=self.rowCount()
            #print(f'old Row Count is {self.rowCount()}')
            self.insertRow(curRows)
            #print(f'New row count is {self.rowCount()}')
            for j in range(self.columnCount()):
                if j==0:
                    self.setCellWidget(curRows,j,qtw.QComboBox())
                    self.cellWidget(curRows,j).addItems(self.skiList)
                    self.cellWidget(curRows,j).setMaxVisibleItems(10)
                    self.cellWidget(curRows,j).addItem('')
                    self.cellWidget(curRows,j).setCurrentIndex(-1)
                    self.cellWidget(curRows,j).currentIndexChanged.connect(self.checkAndEmit)
                else:
                    self.setCellWidget(curRows,j,tableQLineEdit(60))
                    self.cellWidget(curRows,j).textChanged.connect(self.checkAndEmit)
                firstColData.append('')
        blankIndicies=[x for x,val in enumerate(firstColData) if val=='']
        print(f'Last Blank Index = {blankIndicies[-1]}. Current Row = {curRow}')
        if curRow==blankIndicies[-1]:
            #ALL PREVIOUS ENTRIES HAVE BEEN FILLED OUT. WE JUST ENTERED THE LAST BLANK ROW. ADD ANOTHER!
            curRows=self.rowCount()
            #print(f'old Row Count is {self.rowCount()}')
            self.insertRow(curRows)
            #print(f'New row count is {self.rowCount()}')
            for j in range(self.columnCount()):
                if j==0:
                    self.setCellWidget(curRows,j,qtw.QComboBox())
                    self.cellWidget(curRows,j).addItems(self.skiList)
                    self.cellWidget(curRows,j).setMaxVisibleItems(10)
                    self.cellWidget(curRows,j).addItem('')
                    self.cellWidget(curRows,j).setCurrentIndex(-1)

                    self.cellWidget(curRows,j).currentIndexChanged.connect(self.checkAndEmit)
                else:
                    self.setCellWidget(curRows,j,tableQLineEdit(60))
                    self.cellWidget(curRows,j).textChanged.connect(self.checkAndEmit)
                #set cell validation

        if numBlank>1: #Remove all blank rows except the first blank row
            remRows=blankIndicies[1:len(blankIndicies)]
            #print(f'remRows = {remRows}')
            if len(remRows)>0:
                for r in reversed(remRows): #Start at the end so indexes don't get fucked. Don't remove rows if the table is less than 4 cells deep
                    if self.rowCount()>4:
                        self.removeRow(r)

    def checkAndEmit(self):
        #Function to take data from rows of table with a completely filled in row
        #and turn them into a dict. Names are Ski Labels are the keys. ski names are the vals
        retDict={}
        for i in range(self.rowCount()):
            if self.cellWidget(i,0).currentText()=='':
                continue
            elif self.cellWidget(i,1).text()=='':
                continue
            else:
                retDict[self.cellWidget(i,1).text()]=self.cellWidget(i,0).currentText()
        print(f'Emitting skiLabelDataChanged!!!: {retDict}')
        self.skiLabelDataChanged.emit(retDict)

    def updateComboBoxList(self,newSkiList):
        #This funcion updates the values of the comboboxes in the first column of the widget. Before updating
        #this function makes a list of values currently in the comboboxes. If any of them are NOT in the
        #newSKiList, it gets added to self.skiList. This function will set the current value of any combobox
        #to '' unless there was a value in that combobox before this function was called.

        #MAKE A LIST OF CURRENT ENTRIES:
        firstColData=[]
        #print(f'curRow = {curRow}')
        print(newSkiList)
        for i in range(self.rowCount()):
            firstColData.append(self.cellWidget(i,0).currentText())
        uniquevals=list(set(firstColData))
        #print(uniquevals)
        #are there any uniquevals currently in the comboboxes that are not in the new ski list?
        addvals=[x for x in uniquevals if x not in newSkiList]
        #print(addvals)
        for v in addvals:
            if v=='':
                continue
            else:
                newSkiList.append(v)
        #remove blanks - we'll add these at the end
        #print(newSkiList)
        newSkiList=[x for x in newSkiList if not x=='']
        #print(newSkiList)
        #print(type(newSkiList))
        for i in range(self.rowCount()):
            self.cellWidget(i,0).clear()
            self.cellWidget(i,0).addItems(newSkiList)
            self.cellWidget(i,0).addItem('')
            if i<len(firstColData):
                if firstColData[i]=='':
                    self.cellWidget(i,0).setCurrentIndex(-1)
                else:
                    self.cellWidget(i,0).setCurrentIndex(newSkiList.index(firstColData[i]))
            else:
                self.cellWidget(i,0).setCurrentIndex(-1)

    def updateSkiList(self,newSkiList):
        if self.skiList==newSkiList:
            print('do nothing')
        else:
            #get a list of unique vals currently entered. Add them as a union with the new list.
            firstColData=[]
            for i in range(self.rowCount()):
                firstColData.append(self.cellWidget(i,0).currentText())
            uniquevals=list(set(firstColData))
            #are there any uniquevals currently in the comboboxes that are not in the new ski list?
            addvals=[x for x in uniquevals if x not in newSkiList]
            newSkiList=list(set(addvals+newSkiList))
            #remove blanks, if any
            newSkiList=[x for x in newSkiList if not x=='']
            self.skiList=newSkiList
            self.skiListChanged.emit(newSkiList)

    def __init__(self):
        super().__init__()
        self.skiList=[]
        self.setRowCount(4)
        self.setColumnCount(2)
        verticalHeader=self.verticalHeader()
        horizontalHeader=self.horizontalHeader()
        verticalHeader.setVisible(False)
        self.setHorizontalHeaderLabels(['Ski Name','Ski Label'])
        for i in range(self.columnCount()):
            if i == 0:
                horizontalHeader.setSectionResizeMode(i, qtw.QHeaderView.Stretch)
            else:
                horizontalHeader.setSectionResizeMode(i, qtw.QHeaderView.ResizeToContents)
        for i in range(self.rowCount()):
            for j in range(self.columnCount()):
                if j==0:
                    self.setCellWidget(i,j,qtw.QComboBox())
                    self.cellWidget(i,j).addItems(self.skiList)
                    self.cellWidget(i,j).setMaxVisibleItems(10)
                    self.cellWidget(i,j).addItem('')
                    self.cellWidget(i,j).setCurrentIndex(-1)

                    self.cellWidget(i,j).currentIndexChanged.connect(self.checkAndEmit)
                else:
                    self.setCellWidget(i,j,tableQLineEdit(60))
                    self.cellWidget(i,j).editingFinished.connect(self.checkAndEmit)
        self.setMinimumWidth(360)
        self.resize(self.sizeHint())
        self.currentCellChanged.connect(self.checkAndExpand)
        self.skiListChanged.connect(self.updateComboBoxList)

A: I'm including an answer to my question. Many thanks to @musicamante. I'm leaving quite a bit of code out for brevity and relevance to the question I originally asked. The code here creates a qComboBox editor with static data. Eventually, I will need to make this more flexible (likely by creating separate delegates for columns that get comboBoxes and connecting data from the table model to data in the delegate)
class testerTableDelegate(qtw.QStyledItemDelegate):
    def __init__(self, parent):
        super().__init__(parent)

    def createEditor(self, parent, option, index):
        if index.column()==1:
            editor=qtw.QComboBox(parent)
            editor.addItems(['M','F','N'])
            #editor.currentTextChanged.connect(lambda value: self.currentIndexChanged(index, value))
        else:
            editor = qtw.QLineEdit(parent)
        if index.column()==1:
            editor.setValidator(sexValidator())
        elif index.column()>1:
            editor.setValidator(qtg.QIntValidator())
        return editor

    def setEditorData(self, editor, index):
        value = str(index.model()._data[index.row()][index.column()])
        if isinstance(editor,qtw.QLineEdit):
            editor.setText(value)
        elif isinstance(editor,qtw.QComboBox):
            value = index.model().data(index, qtc.Qt.EditRole)
            if value:
                editor.setCurrentIndex(editor.currentIndex())

    def setModelData(self, editor, model, index):
        if isinstance(editor,qtw.QLineEdit):
            model.setData(index, editor.text(), qtc.Qt.EditRole)
        elif isinstance(editor,qtw.QComboBox):
            model.setData(index,editor.itemText(index.row()),qtc.Qt.EditRole)

    def updateEditorGeometry(self, editor, option, index):
        editor.setGeometry(option.rect)


text:
Q: Wrapping Text on Label and Vertical scrollbar on panel I have a label inside a panel. When the text exceeds, the label text should wrap. For doing that I have set mylabel's AutoSize = false and MaximumSize = 100,0.
Now since the text is being wrapped, vertical scrollbar should appear on panel. But that's not happening, please specify what I am missing here.
Is it possible this way or should I explicitly add a vertical scrollbar inside the panel?

A: 1) You need to put the label inside the panel
2) AutoSize for label should be TRUE
3) AutoSize for panel should be FALSE
4) AutoScroll for panel should be True
that is it!

A: Did you have the properties Scrollable=true or AutoScroll?
http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.panel.scrollbars.aspx
Try this:
ScrollBar vScrollBar1 = new VScrollBar();
vScrollBar1.Dock = DockStyle.Right;
vScrollBar1.Scroll += (sender, e) => { panel1.VerticalScroll.Value = vScrollBar1.Value; };
panel1.Controls.Add(vScrollBar1);

A: You should be setting AutoSize to true to automatically wrap. For the scrollbars check that you set panel.VerticalScroll.Visible = true;

A: It's long time ago about this question.
Solution :

*

*Panel1.AutoScroll = True

*Label1.AutoSize = True

*Label1.MaximumSize = New Size(Panel1.ClientRectangle.Width - 18, 0)
Impotrant thing is to define MaximumSize for Label width. Height leave 0 (zero). Height will grow with label content.
In this case, maximum width of label would be width of panel - 18px for scroller.

redpajama_set_name: RedPajamaStackExchange


text:
Q: AWS ELB doesn't distribute requests to auto scaling group EC2 instances in some cases I'm trying to do performance testing for my AWS auto scaling group using jmeter.
Firstly, I did scale-in/out testing. I set the threshold to be 70% cpu utilization for 2 periods, each period is 2 minutes. The ELB works fine, and the requests was distributed to all EC2 instances in auto scaling group, in spite of un-equality, after the system scale-out.
In next, I want to test whether the two instances' load can be twice of one instance's.
I fixed the instance number of auto scaling group, I set the min/max/desired instance count to be 2. When I push load from single JMeter, there are always just only one instance works and its cpu utilization reach almost 100 percent, but the cpu utilization of the other instance is still zero.... If I push load from an JMeter cluster which contains several slaves, all instances take load.
Somebody said, maybe the load is not heavy enough, so the ELB considered that just one instance can handle it and didn't dispatch requests to other instance. I don't think so, because I push load from just one slave of this JMeter cluster, however I increase the load, just only one instance handle requests.
I found an blog which said ELB is great in HA but not load balancing.
https://www.stackdriver.com/elb-affinity-problems
But, I don't think the behavior, only one instance handle requests, is normal.
What the hell in the ELB load balance mechanism? I'm confused.

A: Elastic Load Balancing mechanism

*

*DNS server uses DNS round robin to determine which load balancer node in a specific Availablity Zone will receive the request

*The selected load balancer checks for "sticky session" cookie

*The selected oad balancer sends the request to the least loaded instance

And in greater details:
Availability Zones (unlikely your case)
By default, the load balancer node routes traffic to back-end instances within the same Availability Zone. To ensure that your back-end instances are able to handle the request load in each Availability Zone, it is important to have approximately equivalent numbers of instances in each zone. For example, if you have ten instances in Availability Zone us-east-1a and two instances in us-east-1b, the traffic will still be equally distributed between the two Availability Zones. As a result, the two instances in us-east-1b will have to serve the same amount of traffic as the ten instances in us-east-1a.
Sessions (most likely your case)
By default a load balancer routes each request independently to the server instance with the smallest load. By comparison, a sticky session binds a user's session to a specific server instance so that all requests coming from the user during the session will be sent to the same server instance.
AWS Elastic Beanstalk uses load balancer-generated HTTP cookies when sticky sessions are enabled for an application. The load balancer uses a special load balancer–generated cookie to track the application instance for each request. When the load balancer receives a request, it first checks to see if this cookie is present in the request. If so, the request is sent to the application instance specified in the cookie. If there is no cookie, the load balancer chooses an application instance based on the existing load balancing algorithm. A cookie is inserted into the response for binding subsequent requests from the same user to that application instance. The policy configuration defines a cookie expiry, which establishes the duration of validity for each cookie.
Routing Algorithm (less likely your case)
Load balancer node sends the request to healthy instances within the same Availability Zone using the leastconns routing algorithm. The leastconns routing algorithm favors back-end instances with the fewest connections or outstanding requests.
Source: Elastic Load Balancing Terminology And Key Concepts
Hope it helps.

A: I had this issue with unbalanced ELB traffic when back end instances where in different availability zones and the ELB was receiving requests from a small number of clients. In our case we were using an internal ELB within the application tiers. In your case "push load from single JMeter" likely means a small number of clients as seen by the ELB. The solution was to enable cross zone load balancing using the API similar to this fragment:-
elb-modify-lb-attributes ${ELB} --region ${REGION} --crosszoneloadbalancing "enabled=true"
http://docs.aws.amazon.com/ElasticLoadBalancing/latest/DeveloperGuide/enable-disable-crosszone-lb.html


text:
Q: How can I enforce Basic Auth in Flask Restplus Swagger UI? I am developing a back-end and using Flask Restplus. So far the code works great and the Swagger UI looks great too. I am considering adding Basic Auth on a particular endpoint (I am planning on using a Basic Auth Decorator from a previous Flask-Restful project).
How can I make the username and password fields visible on the swagger UI as well as actually enforce it on the UI? I was poking around the restplus documentation as well as Stack Overflow and didn't really see anything.
The UI will be visible on an intranet/LAN... I don't want this endpoint to be available to everyone in the building.

A: Implement below:
authorizations = {
    'Basic Auth': {
        'type': 'basic',
        'in': 'header',
        'name': 'Authorization'
    },
}

api = Namespace('User', description='user related operations',security='Bearer Auth', authorizations=authorizations)


text:
Q: Что нужно сделать, чтобы сайт загрузил javascript? Пытаюсь достать книгу, так как в браузере читать совершенно неудобно. Написал скрипт, но он не загружает страницу полностью, до нужного мне тега, чтобы получить ссылку. С помощью selenium эмулирую загрузку, открывается браузер, визуально страница полностью прогружается, но нужный div все равно не ищется. Пишет, что не функционирует без javascript. Но ведь сайт прогружается, значит скрипты работают. Не понимаю в чем проблема.
from bs4 import BeautifulSoup
import requests
from fake_useragent import UserAgent
from selenium import webdriver
from selenium.webdriver.chrome.service import Service
from webdriver_manager.chrome import ChromeDriverManager
import time

ua = UserAgent()
userAgent = ua.random

browser = webdriver.Chrome(service=Service(ChromeDriverManager().install()))
options = webdriver.ChromeOptions()

options.add_argument('--headless')
options.add_argument("--incognito")
options.add_argument("--nogpu")
options.add_argument("--disable-gpu")
options.add_argument("--window-size=1280,1280")
options.add_argument("--no-sandbox")
options.add_argument("--enable-javascript")
options.add_experimental_option("excludeSwitches", ["enable-automation"])
options.add_experimental_option('useAutomationExtension', False)
options.add_argument('--disable-blink-features=AutomationControlled')

driver = webdriver.Chrome(options=options)
driver.execute_script("Object.defineProperty(navigator, 'webdriver', {get: () => undefined})")
driver.execute_cdp_cmd('Network.setUserAgentOverride', {"userAgent": userAgent})

def get_data(url):
    response = requests.get(
        url,
        headers={'user-agent': f'{userAgent}'}
    )
    soup = BeautifulSoup(response.content, "lxml")
    links = soup.find_all('document-view-img__container')
    print(links)

for i in range(537):
    i += 1
    url = f'https://viewer.rusneb.ru/ru/000199_000009_02000012752?page={i}&rotate=0&theme=white'
    get_data(url)
    break

try:
    browser.get(url=url)
    time.sleep(10)
except Exception as ex:
    print(ex)
finally:
    browser.close()
    browser.quit()

Вручную все картинки уже давно нашел, мог бы скачать руками, но интересно сделать это автоматически средствами python

A: Надеюсь разберетесь что чему
import requests

page = 0
while True:
    page +=1
    res = requests.get(f'https://viewer.rusneb.ru/api/v1/document/000199_000009_02000012752/page/{page}')
    if not (res.status_code == 200):
        break
    print(f'{page=}')

print('End')

Получить ссылку на скачивания pdf
import requests
from bs4 import BeautifulSoup

res = requests.get('https://rusneb.ru/catalog/000207_000017_RU_RGDB_BIBL_0000352301/')
soup = BeautifulSoup(res.content, "lxml")
ff = soup.find("a", class_="button button--full button--empty button--h52").get('href')
print(f'https://rusneb.ru{ff}')


text:
Q: How do I update Jira custom field values via REST api I need to update "matter" field (single select list). What is the best way to do that?
I have a values in bulk (more than 100) to be added to the custom field. Is there any way i can do this by using an API. I have also checked the link
But nothing is mentioned here as well.

A: Just add the customfield to the issue json like
{ "fields": {"customfield_XXXX": "value"} }

where XXXX is the customfield number. You can get it by looking at the custom field screen on Jira and look at the link shown in the browser bar by hovering you mouse on the custom field action links.
Moreover you said that is a single select list so the value will be only ONE.
If you intend to CREATE or EDIT a customfield on the fly with 100 choices it is a completely different problem.
Check this unresolved suggestion on the Atlassian website for advice. The issue contains also a workaround with a custom plugin available.


text:
Q: How to fix error in catching exception on call_user_func_array() Assuming:
$name is not existing, and $args is not empty
try() {
    $results = call_user_func_array($name, $args);
} catch(Exception $ex) {
    echo 'Catched!'
}

Expected:
prints "Catched!"

Results:
Warning: call_user_func_array() [function.call-user-func-array]: Unable to call


text:
Q: Why can one not blow a soap bubble with pure water even if its surface tension is higher? So surface tension increases as the length increases. I know that. But what doesn't make sense is if I have a bucket of water, and then suspend a needle on the top. The surface tension of the water should act like a 'membrane', the needle will then float on the top of the water. If I later add some soap to the bucket of water, the needle will sink because the surface tension of the fluid has been reduced.
My question is then, why can I not blow bubbles with pure water?

A: Soap/Detergent is amphiphilic, having molecules hydrophobic ("water hating") at one end and hydrophilic ("water liking") at the other.
This design drags dirt (and indeed needles) into the water.
Soap/Detergent reduces surface tension by a factor of 2 to 3.
But it has a stabilising effect on soap films due to the Marangoni effect.
Essentially the water will flow from regions where surface tension is low to regions where it is high. It flows away from the detergent.
As I interpret it, if there is an instability in the bubble, inter-molecular bonds in that area are stretching. This increases local surface tension, and the Maragoni effect will then flow water to that area, recovering it.

Intuitively it's hard to imagine that simply altering the tension would allow things like this...

It's a kind of negative feedback going on.


text:
Q: Minimum Spanning Tree that minimizes a function While studying discrete mathematics I came across this problem in my math book this week:
Now, I know that in an MST the sum of weights is minimal and that all MST's are included in the set of spanning trees and I tried proving this with Kruskal's algorithm but this would only work for one minimal spanning tree, not all. Any ideas how I can approach this?

A: Let $T$ be a minimum spanning tree of $G$. Suppose there exists a spanning tree $T'$ such that $f(T')<f(T)$. Let $e, e'$ be the corresponding edges of maximum weight in $T, T'$, respectively. If we remove $e$ from $T$, then $T$ is broken into two connected components. There must exist an edge $e''$ in $T'$ which connects these components. Clearly $w_{e''}\leqslant w_{e'}< w_e$. Thus the tree $T''$ obtained from $T$ by replacing the edge $e$ with $e''$ has weight $w(T'') = w(T) + w_{e''} - w_e < w(T)$, a contradiction.


text:
Q: Добавление класса при нажатии на кнопку удаление класса при нажатии на весь блок. JavaScript При нажатии на button нужно чтобы к классу content1 добавлялся selected. и при нажатии на весь блок , класс selected должен удаляться.
Я сделал добавление класса , никак не могу понять как сделать чтобы класс сразу же не удалялся при первом клике по button.
function addClickListener(card) {
var button = card.querySelector('.myBtn');
button.addEventListener('click', function () {
card.classList.add('selected');
});
}
var cards = document.querySelectorAll('.content1');
for (var i = 0 ; i < cards.length;i++){
    addClickListener(cards[i]);
}

html

           Представительский люкс

           Эксклюзивный номер с панорамным видом на центр города Москвы

           от 7900 руб./сутки

       <button  class="myBtn">Забронировать</button>

function addClickListener(card) {
  var button = card.querySelector('.myBtn');
  button.addEventListener('click', function() {
    card.classList.add('selected');
  });
}
var cards = document.querySelectorAll('.content1');
for (var i = 0; i < cards.length; i++) {
  addClickListener(cards[i]);
}
.selected {
  background: lightgreen;
}

      Представительский люкс

      Эксклюзивный номер с панорамным видом на центр города Москвы

      от 7900 руб./сутки

    <button class="myBtn">Забронировать</button>

A:

function addClickListener(card) {
  card.addEventListener('click', function() {
    this.classList.remove('selected');
  });
  var button = card.querySelector('.myBtn');
  button.addEventListener('click', function(e) {
    card.classList.add('selected');
    e.stopPropagation();
  });
}
var cards = document.querySelectorAll('.content1');
for (var i = 0; i < cards.length; i++) {
  addClickListener(cards[i]);
}
.selected {
  background: lightgreen;
}

      Представительский люкс

      Эксклюзивный номер с панорамным видом на центр города Москвы

      от 7900 руб./сутки

    <button class="myBtn">Забронировать</button>


text:
Q: Gem installation failling with "The compiler failed to generate an executable file" on cygwin Trying to install multiple gems on cygwin, I keep getting this error: /usr/share/ruby/2.2.0/mkmf.rb:456:in try_do': The compiler failed to generate an executable file. (RuntimeError)
This error is part of the full error message below:
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

    /usr/bin/ruby.exe -r ./siteconf20150603-27012-w371hi.rb extconf.rb
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers.  Check the mkmf.log file for more details.  You may
need configuration options.

Provided configuration options:
        --with-opt-dir
        [...truncated...]
        --without-pkg-config
/usr/share/ruby/2.2.0/mkmf.rb:456:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
        from /usr/share/ruby/2.2.0/mkmf.rb:541:in `try_link0'
        from /usr/share/ruby/2.2.0/mkmf.rb:556:in `try_link'
        from /usr/share/ruby/2.2.0/mkmf.rb:637:in `try_ldflags'
        from /usr/share/ruby/2.2.0/mkmf.rb:1780:in `pkg_config'
        from extconf.rb:15:in `<main>'

extconf failed, exit code 1

Gem files will remain installed in /cygdrive/d/d/.gem/ruby/gems/ffi-1.9.8 for inspection.
Results logged to /cygdrive/d/d/.gem/ruby/extensions/x86_64-cygwin/ffi-1.9.8/gem_make.out

I tried all things I could find on google, out of which some do actually work including:

*

*Installing the cygwin package corresponding to the gem through cygwin setup

*Installing more cygwin packages, depending on the failing gem

But for this very specific example, I could not find what was missing...

A: The solution for this error was (and is for all such errors) to have a look at the mkmf.log file (for me, /cygdrive/d/d/Documents/.gem/ruby/extensions/x86_64-cygwin/ffi-1.9.8/mkmf.log) and see which libraries are missing.
In my case, -lcrypt and -lgmp were failing, so I had to "cygwin-setup" libcrypt-devel and libgmp-devel.


text:
Q: consuming API httpClient I am getting error "Bad Request" trying to consum an API. I had tryed some diferents ways, but without success. Could some one help?
API Parameters must be:
FormData Parameters

*

*scope = "oob"

*grant_type = "client_credentials"

Header Parameters

*

*Content-type = "application/x-www-form-urlencoded"

*Authorization = "Basic 2xpZW50LTAxOnNlY3JldC1rZXktMDI=" (Base64 example)

[POST]
curl -X POST \
https://api-sandbox.getnet.com.br/auth/oauth/v2/token \
-H 'authorization: Basic 2xpZW50LTAxOnNlY3JldC1rZXktMDI=' \
-H 'content-type: application/x-www-form-urlencoded' \
-d 'scope=oob&grant_type=client_credentials'
    string content_type = "application/x-www-form-urlencoded";
    string scope = "oob";
    string grant_type = "client_credentials";
    string authorization = "Basic 2xpZW50LTAxOnNlY3JldC1rZXktMDI="

    using (var httpClient = new HttpClient())
    {
         var requestMessage = new HttpRequestMessage()
         {
              Method = new HttpMethod("POST"),
              RequestUri = new Uri("https://api-sandbox.getnet.com.br/auth/oauth/v2/token"),
              Content = new StringContent(
                            @"{""scope"":""oob"",""grant_type"":client_credentials}", Encoding.UTF8, content_type)};

          requestMessage.Content.Headers.ContentType =
                new System.Net.Http.Headers.MediaTypeHeaderValue("application/x-www-form-urlencoded");

          requestMessage.Headers.Add("Authorization", authorization);

          var response = await httpClient.SendAsync(requestMessage);
          var responseStatusCode = response.StatusCode;
          var responseBody = await response.Content.ReadAsStringAsync();
    }

A: You can try following code snippets
  string content_type = "application/x-www-form-urlencoded";
  string scope = "oob";
  string grant_type = "client_credentials";
  string authorization = "Basic 2xpZW50LTAxOnNlY3JldC1rZXktMDI=";

  using (var httpClient = new HttpClient())
  {
    var parameters = new List<KeyValuePair<string, string>>() {
      new KeyValuePair<string, string>("scope", "oob"),
      new KeyValuePair<string, string>("grant_type", "client_credentials")
    };

    var requestMessage = new HttpRequestMessage()
    {
      Method = new HttpMethod("POST"),
      RequestUri = new Uri("https://api-sandbox.getnet.com.br/auth/oauth/v2/token"),
      Content = new FormUrlEncodedContent(parameters)
    };

    requestMessage.Content.Headers.ContentType =
          new System.Net.Http.Headers.MediaTypeHeaderValue("application/x-www-form-urlencoded");

    requestMessage.Headers.Add("Authorization", authorization);

    var response = await httpClient.SendAsync(requestMessage);
    var responseStatusCode = response.StatusCode;
    var responseBody = await response.Content.ReadAsStringAsync();
  }


text:
Q: How do I get rid of these "Formatting" lines? My Word documents currently have these dotted boxes that show where the paragraphs/ boxes are. Is there a way to turn it off? I'm currently using a Macbook Air.

A: I'm not sure if it's entirely the same path to the setting because I'm on Windows:
Go to File > Options > Advanced and in the 'Show document content' section is a checkbox named 'Show text boundaries', turn that off and the boxes should be gone.


text:
Q: How to use EditorFor with DateTime in ASP.NET MVC5 with EF? I am building a little CRUD application in ASP.NET MVC5.
Instead of a own model I am using the autogenerated models of EF.
The table (named "tablex") accessed by EF has a DateTime value (named "inserted").
Controller:
// Show edit
public async Task<ActionResult> Edit(int? id)
{
    tablex x = await db.tablex.FindAsync(id);
    return View(x);
}

// Edit
public async Task<ActionResult> Edit([Bind(Include = "id,...,updated")] tablex x)
{
    if (ModelState.IsValid)
    {
        x.inserted = DateTime.Now;
        db.Entry(x).State = EntityState.Modified;
        await db.SaveChangesAsync();
        return RedirectToAction("Index");
    }
    return View(x);
}

This is my shortened Controller. As you can see I override my DateTime field anyway.
View:
@model DatabaseEF.Models.tablex
@using (Html.BeginForm())
{
    <div....> //more fields
    <div ...>
        @Html.Label("Inserted ", ...)
        <div ...>
            @Html.EditorFor(model => model.inserted, ...)
            @Html.ValidationMessageFor(model => model.inserted, "", ...)
        </div>
        <input type="submit" value="Save" ... />
    </div>
}

With this my EditorFor-Textbox shows the date like "28.05.2015 17:12:17" (German format). When pressing "Save" the view warns that the field mus be a date. Changing the value to e.g. "2010-10-10" works perfectly.
Now I found some solutions with annotations to the model "DataType(DataType.Date)]". But as my model is autogenerated by the EF I'm looking for a working solution.
Anybody with help for me out there?


text:
Q: Polymorphism and Class Structure for Reporting Solution I'm coding a report builder in PHP. These reports will either be shown on a web page, emailed or sent through some other communication line. I'd like to support different types of report data (currently text and tabular).
I've built this and it works, the main classes are:

*

*ReportBuilder

*ReportMailer

*ITextReport (an interface)

*ITabularReport (an interface)

My concern is that my solution is not extensible, due to my implementation of ReportBuilder:
public function addTextReport(ITextReport $report)
{
    $this->textReports[] = $report;

    return $this;
}

public function addTabularReport(ITabularReport $report)
{
    $this->tabularReports[] = $report;

    return $this;
}

public function getData()
{
    $data = ['tabularReports' => [], 'textReports' => []];

    foreach($this->tabularReports as $report)
    {
        $data['tabularReports'][] = [
            'title' => $report->getTitle(),
            'keys'  => $report->getDataTitles(),
            'data'  => $report->getData(),
        ];
    }

    foreach($this->textReports as $report)
    {
        $data['textReports'][] = [
            'title' => $report->getTitle(),
            'content'   => $report->getContent(),
        ];
    }

    return $data;
}

My problem:
If I want to add a new report type (say IGraphReport), I need to modify ReportBuilder to accept this new report type, and then parse it in the ReportBuilder::getData method. This violates the Open and Closed principle, and just seems wrong.
Some solutions I considered:

*

*Creating a more generic interface IReport, with a render method on it, and replacing the addTextReport and addTabularReport in  ReportBuilder to a more generic addReport. However, the different communication channels require different methods of rendering the data so the render method somehow accepts instruction on how to format the data. I'm not sure if this is the cleanest solution.

*Letting the communication channel decide on how to render reports, but then I envision a number of if statements checking the type of the report: if($report instanceof ITabularReport) { // handle }, which would then lead me to "replace conditionals with polymorphism" and take me back to point 1.

I'm not sure how to refactor. Any thoughts?

A: Having an addTextReport and addTabularReport method seems like you're tying yourself to the implementation logic. Why not just have an addReport method?
Have each type of Report adhere to a contract (interface) which implements the getData method. I.e. delegate the responsibility of how the data is returned, to the class.
ReportBuilder
private $reports;

public function addReport(ReportContract $report)
{
    $this->reports[] = $report;
    return $this;
}

public function getData()
{
    $data = [];

    foreach($this->reports as $report) {
        $data[] = $report->getData();
    }

    return $data;
}

ReportContract
interface ReportContract
{
    public function getData();
}

ITextReport
class ITextReport implements ReportContract
{
    public function getData()
    {
        // return some data
    }
}

Now, each new type of report (Graph for example) simply has to implement a getData method and your base ReportBuilder class requires no changes or refactoring to support it.


text:
Q: Is it possible to iterate a list with index values in the Widget tree? I have a List which is a list of image URLs, which I will then use to construct a series of Image widgets as part of a gallery.  The images will be aligned next to each other in a Wrap.
I can iterate the list and build my images inside a wrap just fine, but I also need to identify the image index in the List and pass it to my image widget
var gallery = ['image1.jpg','image2.jpg','image3.jpg']; // this is sample data, my real data set is much longer and obtained from JSON data

Wrap(
        spacing: 2,
        runSpacing: 2,
        children: [
          for (var image in gallery)
            ImageItem(image: image, index:index) <--- how can I get the index here?
        ],
      )

Is it possible to identify the index, or where the image is in my list?

A: You can do:
var gallery = ['image1.jpg','image2.jpg','image3.jpg']; // this is sample data, my real data set is much longer and obtained from JSON data

Wrap(
  spacing: 2,
  runSpacing: 2,
  children: [
    for (var i = 0; i < gallery.length; i++)
      ImageItem(image: gallery[i], index: i)
  ],
)

A: Another way is to use the mapIndexed method from the Flutter built-in collection package, so your code would be:
import 'package:collection/collection.dart'; // Importing the collection package

var gallery = ['image1.jpg','image2.jpg','image3.jpg']; // this is sample data, my real data set is much longer and obtained from JSON data

Wrap(
  spacing: 2,
  runSpacing: 2,
  children: gallery.mapIndexed((index,image) => ImageItem(image: image, index: index)).toList(),
)


text:
Q: Beginner C++: Why is this switch statement giving me an error? int menuDecision = displayMenu();

  //WHILE USER DOESN'T SELECT QUIT
while(menuDecision != 3){
/*
    if(menuDecision == 1){
        Queue myQueue;
    }
    else{
        Stack myStack;
    }
*/

    switch(menuDecision){
        case 1: Queue myQueue;
                break;
        case 2: Stack myStack;
                break;
    }

    menuDecision = displayMenu();

}

How come when I run the above as a switch statement it's giving me an error but when I use the if/else-if it works? Basically the program instantiates an object depending on what is selected in the menu.Once an object is created the constructor is called, and the constructor calls another function and so on...Basically a new object is created each pass in the while Loop. Since I'm not getting a lot of feedback in my code, would the above implementation be considered 'bad programming'?
Thanks!
Edit: The error is:
main.cpp:27:4: error: cannot jump from switch statement to this case label
                        case 2: Stack myStack;
                        ^
main.cpp:25:18: note: jump bypasses variable initialization
                        case 1: Queue myQueue;

A: C++ does not allow switches (or other similar code, such as goto) to jump over initialisations .  In the switch, both the Queue and the Stack are at the same scope, and it would be possible for the switch code  not to initialise one (or both) of them in that scope, depending on the value being switched on. This isn't so for the if/else, where they are at different scopes.


text:
Q: GitLab Pipeline is throwing an Azure CLI error I'm running a very lightweight GitLab Pipeline which executes a number of Terraform configuration. However, I have hit an absolute roadblock as the pipeline throws an Azure CLI error (screenshot below) when it attempts to run a Terraform init and I simply can't seem to resolve this. Any ideas?

This error happens at the pipeline stage: validate.
Prior to that however, I have another pipeline stage: deploy where I am able to install Azure CLI successfully, using the below commands:
deploy:
  stage: deploy
  image: mcr.microsoft.com/dotnet/core/sdk:3.1
  script:
    - curl -sL https://aka.ms/InstallAzureCLIDeb | bash

So after some further investigation, it turns out that this error only occurs when I include my terraform backend.tf file which configures an Azure backend for storing my terraform state file. Exclude this file and everything runs smoothly. I'm at a complete loss, as I definitely require that state file in Azure.
It does appear to me that the Azure CLI successful install at the pipeline deploy stage (above) isn't picked up by the Backend.tf configuration.
Below is the content of my Backend.tf file
terraform {
  backend "azurerm" {
    resource_group_name   = "rg_xxx"
    storage_account_name  = "stxxxxtfstate"
    container_name        = "terraform"
    key                   = "terraform.tfstate"
  }
}

And below is the YAML snippet from the pipeline deploy stage of my .gitlab-ci.yml file where I call terraform init and apply.
deploy:
  stage: deploy
  script:
    - terraform init
    - terraform plan -var-file=dev-settings.tfvars -out=plan.out
    - terraform apply -auto-approve plan.out

A: Thank You Cdub for pointing the OP in the right direction. Posted your valuable discussion as an Answer to help other community members.
If the backend.tf file references the Azure resource manager provider from the Terraform Configuration, then it's possible to move the Azure CLI installation step into the deploy stage where the terraform commands are being executed right before the terraform init.
Please refer to terraform-gitlab-image-no-azure-cli which shows another way to install Azure CLI in a GitHub Pipeline.


text:
Q: How to use a R seed in python for kmeans Im writing a project using the kmeans algorithm in python. I need to reproduce the result of a partner who is using R, with the seed "123"
Is there anyway to use the R seed in python for the kmeans function?
I tried to use:
import rpy2.robjects as robjects
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sb
from sklearn.cluster import KMeans
from sklearn.metrics import pairwise_distances_argmin_min
%matplotlib inline
from mpl_toolkits.mplot3d import Axes3D
plt.rcParams['figure.figsize'] = (16, 9)
plt.style.use('ggplot')

df = pd.read_excel(r'E:\Superservicios\Modelo de riesgo\Escenarios\Base_indicadores.xlsx')
df.head()

X = np.array(df[["ACTIVO","INGRESOS"]])

data = robjects.r("""
set.seed(123)
x <- runif(4)
""")

kmeans = KMeans(n_clusters=4, random_state = data).fit(X)
centroids = kmeans.cluster_centers_
print(centroids)

But i get the error
<rpy2.robjects.vectors.FloatVector object at 0x0000019B76DB5500> [RTYPES.REALSXP]
R classes: ('numeric',)
[0.287578, 0.788305, 0.408977, 0.883017] cannot be used to seed a numpy.random.RandomState instance
I´m new using python and stackoverflow, I would be very grateful to receive your help
Thanks.


text:
Q: I deleted erased all content from my emulator device in iOS, after this, i cant insert or read in my sqlite db I erased my device content and settings and since that i cant insert nothing into my sqlite db.
My query to create the table runs and the tables are created ( i can see in the db browser) but my methos to insert and read just stoped working.
What can i do ?
I already tried to create antoher db with another name ans doesnt work.
enter cclass DBHelper {
init()
{
    db = openDatabase()
    createTable()
}

let dbPath: String = "prescriptionDB.sqlite"
var db:OpaquePointer?

func createTable() {
    let createTableString = "CREATE TABLE IF NOT EXISTS prescriptions(Id INTEGER PRIMARY KEY  AUTOINCREMENT ,name TEXT ,timeToTime TEXT ,firstTime TEXT);"
    var createTableStatement: OpaquePointer? = nil
    if sqlite3_prepare_v2(db, createTableString, -1, &createTableStatement, nil) == SQLITE_OK
    {
        if sqlite3_step(createTableStatement) == SQLITE_DONE
        {
            print("prescriptions table created.")
        } else {
            print("prescriptions table could not be created.")
        }
    } else {
        print("CREATE TABLE statement could not be prepared.")
    }
    sqlite3_finalize(createTableStatement)
}

func insert(name: String, timeToTime: String, firstTime: String) {
    let insertStatementString = "INSERT INTO prescriptions (name, timeToTime, firstTime) VALUES (?, ?, ?);"
    var insertStatement: OpaquePointer? = nil

    if sqlite3_prepare_v2(db, insertStatementString, -1, &insertStatement, nil) == SQLITE_OK {
        sqlite3_bind_text(insertStatement, 1, (name as NSString).utf8String, -1, nil)
        sqlite3_bind_text(insertStatement, 2, (timeToTime as NSString).utf8String, -1, nil)
        sqlite3_bind_text(insertStatement, 3, (firstTime as NSString).utf8String, -1, nil)

        if sqlite3_step(insertStatement) == SQLITE_DONE {
            print("Successfully inserted row.")
        } else {
            print("Could not insert row.")
        }
    } else {
        print("INSERT statement could not be prepared.")
    }
    sqlite3_finalize(insertStatement)
}

func openDatabase() -> OpaquePointer? {
    let fileURL = try! FileManager.default.url(for: .documentDirectory, in: .userDomainMask, appropriateFor: nil, create: false)
        .appendingPathComponent(dbPath)
    var db: OpaquePointer? = nil
    if sqlite3_open(fileURL.path, &db) != SQLITE_OK
    {
        print("error opening database")
        return nil
    }
    else
    {
        print("Successfully opened connection to database at \(dbPath)")
        return db
    }
}

func read() -> [Prescription] {
    let queryStatementString = "SELECT * FROM prescriptions;"
    var queryStatement: OpaquePointer? = nil
    var psns : [Prescription] = []
    if sqlite3_prepare_v2(db, queryStatementString, -1, &queryStatement, nil) == SQLITE_OK {
        while sqlite3_step(queryStatement) == SQLITE_ROW {
            let id = sqlite3_column_int(queryStatement, 0)
            let name = String(describing: String(cString: sqlite3_column_text(queryStatement, 1)))
            let timeToTime = String(describing: String(cString: sqlite3_column_text(queryStatement, 2)))
            let firstTime = String(describing: String(cString: sqlite3_column_text(queryStatement, 3)))
            psns.append(Prescription(name: name, timeToTime: timeToTime, id: Int(id), firstTime: firstTime))
            print("Query Result:")
            print("\(id) | \(name) | \(timeToTime) | \(firstTime)")
        }
    } else {
        print("SELECT statement could not be prepared")
    }
    sqlite3_finalize(queryStatement)
    return psns
}ode here

A: It was a mistake. The issues is beacuse my insert method war not beeing called in this version, so, when i tried to read from db, there is no rows, so, it returns false


text:
Q: MVC with multiple data sources scenario Well, I'm developing an app using MVC Pattern, but I found MVC is used only for one scenario:
MVC is strongly dependent of an only database connection at once to follow up correctly the pattern.
But I have these different data sources:
Oracle Server (Only reading data source) (ERP)
Sql Server (Loggin database, only reading) (Human Resources)
XML (Local Dabase) Write, read and updating.
Is it possible to follow the MVC pattern properly in this scenario?
If it is possible, what I have to do?
Thanks!

A: Yes, of course, it's possible.
M in MVC means a model, i.e. any significant class of domain. You wrote about a different level, the level of data access. It's possible that domain classes are loaded from different sources at the same time. Although this solution can't be called perfect, however, it often occurs in the real world.
Judging by what you've written, you use the low-level data access classes as models. So often make small applications. However, the larger application requires implicit separation of models and data access objects.

A: MVC is a UI pattern. It's purpose is to organize your UI layer and not the whole system. Consider using other patterns for the data access layer. In MVC a Controller is responsible for constructing Models and gluing them to Views. How that construction occurs is not under the scope of MVC. Call an external data access library, a service, use a repository etc. are all valid choices and they don't interfere with the MVC pattern at all.


text:
Q: RSA C# encryption with public key to use with PHP openssl_private_decrypt(): Chilkat, BouncyCastle, RSACryptoServiceProvider i'm trying to encrypt the string in C# application for it to be decrypted on PHP side with openssl_private_decrypt().
the initial public key that i'm trying to decrypt with is obtained from within PHP's openssl_pkey_get_details($privateKey);
talking ahead, i am able to do it using chilkat, but it doesn't work in monotouch under iOS so it is useless for me (and it costs pretty much too).
there is code sample how i'm doing it:
void TestEncryption(string publicKey, string data)
{
        var bytes = Encoding.UTF8.GetBytes(data);

        //by using chilkat
        var key = new Chilkat.PublicKey();
        var result = key.LoadOpenSslPem(publicKey);
        var ck = new Chilkat.Rsa();
        ck.UnlockComponent("blablabla");
        var keyXml = key.GetXml();
        ck.ImportPublicKey(keyXml);
        var ckBytes = ck.EncryptBytes(bytes, false);

        //by using BouncyCastle
        Object obj;
        using (TextReader sr = new StringReader(publicKey))
        {
            PemReader pem = new PemReader(sr);
            obj = pem.ReadObject();
        }
        var par = obj as Org.BouncyCastle.Crypto.Parameters.RsaKeyParameters;
        RsaEngine e = new RsaEngine();
        e.Init(true, par);
        var bcBytes = e.ProcessBlock(bytes, 0, bytes.Length);

        //RSACryptoServiceProvider. don't know exectly how to initialize it, one way that must work i think is from chilkat's xml, just to test
        RSACryptoServiceProvider csp = new RSACryptoServiceProvider(1024);
        csp.FromXmlString(keyXml);

        //also tryed to initialize like this:
        //var pp = csp.ExportParameters(false);
        //pp.Modulus = byteKey; //this one is publicKey, stripped from --begin-- and --end-- sections and encoded from base64 to byte array (162 bytes)
        //csp.ImportParameters(pp);
        //
        //or if i do
        //var pp = new RSAParameters();
        //pp.Exponent = Convert.FromBase64String("AQAB");
        //pp.Exponent array is the same: {1, 0, 1};

        var cspBytes = csp.Encrypt(bytes, false); //or (bytes, true), doesn't matter

        //this function sends request to php and returns result of decryption attempt
        Debug.WriteLine(ExecRequest(ckBytes));
        Debug.WriteLine(ExecRequest(bcBytes));
        Debug.WriteLine(ExecRequest(cspBytes));
}

the output is:
success
decryption failed
decryption failed

what am i missing?

A: ok, after doing some shamanic dances with tambourine i've come to somewhat-satisfying solution.
please hold in mind, that it is all done in context of working with PHP's openssl_private_decrypt() function.
so i got next:

*

*encryption of BouncyCastle just doing it not right

*i don't know how to get modulus out of private key to use it with RSACryptoServiceProvider

*why not try to use BouncyCastle's key data and initialize RSACryptoServiceProvider
Object obj;
using (TextReader sr = new StringReader(publicKey))
{
    PemReader pem = new PemReader(sr);
    obj = pem.ReadObject();
}
var par = obj as Org.BouncyCastle.Crypto.Parameters.RsaKeyParameters;

RSACryptoServiceProvider csp = new RSACryptoServiceProvider(1024);
//var pp = csp.ExportParameters(false); //works on native .NET, doesn't work on monotouch
var pp = new RSAParameters();
pp.Modulus = par.Modulus.ToByteArrayUnsigned(); //doesn't work with ToByteArray()
pp.Exponent = par.Exponent.ToByteArrayUnsigned();
csp.ImportParameters(pp);
var cspBytes = csp.Encrypt(bytes, false);

actually, it is strange that i've came up with solution at all, cuz of these niceties.
i hope it would be helpful for someone someday.


text:
Q: Can't boot Ubuntu from USB in UEFI mode I am relatively new to Linux. I previously made a USB boot device that worked perfectly, using a single W95 FAT32 (bootable) partition. However, that disk was too small, so now I am trying to replicate the same exact partition and format on a larger USB. However, I am not able to get this to happen no matter what I try.
First, I tried to format the disk as fat32, and then used the startup disk creator in ubuntu to load the iso file to the disk. When I try to use this usb to boot, I get a black sceen. In my boot options, I see three different options corresponding to this usb. The options I see are:
1) UEFI: [name of usb]
2) UEFI: [name of usb] partition 1
3) [name of usb]

Please note that I am using an MSI z170a mobo and an intel core i7 processor, with a radeon R9 390 8gb graphics card in pcie2 and a 1000w PSU. First off, I am not sure what is going on with these three partitions -- I simply followed the exact instructions in the startup disk creator, but I have not seen in any forums a mention of it creating three different boot devices. However I did find that some people saw 2 devices, one for UEFI and one for the legacy BIOS.
I tried to look into the cause of this using the disk tool, and I found that the device has actually been partitioned into three parts -- one of them was the FAT32 partition of size about 1.6 Gb with the ISO file, one of them was about 24 mb (I believe this is for swap), and the rest is free space.
In comparison, the old usb stick that was booting properly had only a single partition. While the partition type was the same as the one I just created (W95 FAT32 (bootable)), I notices that the contents is in fact different. The old working usb had contents of FAT (32-bit version) — Mounted at /media/paul/1030-503F, while the partition with the iso on the new device had contents ISO 9660 (version Joliet Extension) — Not Mounted. I do not remember how I originally formatted the old disk image, unfortunately. But I would note that the disk is only 8 gb -- barely enough to install Ubuntu.
Question 1: how can I get my usb in the format of my old usb? I think If I could do this, everything should work. As a reminder, the config of the working partition is: just a single partition with fat32 format, and contents that say simply fat32?
Ok, so after giving up on getting the drive in the exact same format, I decided to simply push on. I tried to boot the device using the UEFI modes (both the regular and the one that has "partition 1" appended to the end), and all I got was a black screen.  I found some mentions of this issue online, and tried all of the fixes -- including but not limited to setting nomodeset instead of quiet splash, or radeon.modeset=0 -- but none of them worked. Note that when I selected uefi I was not even able to get to the bios menu so that I could select f6 to make these changes -- I had to do them by hitting e in the boot menu and then adding the parameters in grub. This path did not seem to be fruitful, so instead I decided to boot in legacy bios mode.
When I select the boot option for this usb corresponding to the legacy bios, I am able to get to the bios menu. Once I am there, I can select Install Ubuntu. and then select Download updates while installing ubuntu and Install third party software... so that I can install the driver for my gpu automatically. I get all the way to the Installation type screen. For some reason I am not able to see the three different partitions here -- only the free space, but neither the partition of the iso file nor the swap partition are showing up. I ignore this for now, and attempt to format the rest of the drive with fat32 and mount the root directory to /. Unfortunately this again proves useless; I get an error that says

The file system fat32 cannot me mounted on /, because it is not a fully-functional file system. Please choose a different file system, such as ext2.

Ok, so I try this... skip the swap partition... and... I get another error:

The ext2 file system creation in partition #1 of sc17 (0,0,0) (sda) failed.

It occurs to me now that the reason I did not see the other partitions is because the non-uefi boot option probably corresponded to the free space, which is why it still needed to be formatted. and the other two uefi boot devices must have corresponded to the other partitions on the usb: the actual boot image and the swap partition. So it appears the problem still comes back to the partitioning and formatting of the new disk vs the old one.
By the way, I tested all of these steps without the graphics card, and I get the same results.
If anyone can solve even a part of this mystery, I would be very grateful, as it would give me at least some progress. Even answering one of these questions would be considered a correct answer in my book:

*

*Why am I seeing 3 boot devices corresponding to one usb?

*How do I create a startup disk with one single fat32 partition, similar to the one I described that booted properly?

*Why are the UEFI options leading to a black screen, even while using the recommended fixes such as nomodeset?

*Why is the installation process not recognizing these multiple partitions, and instead only recognizing the one with free space?

*What does it mean that / is not a "fully-functioning" file system?

*Why does the ext2 file system creation fail?

EDIT: I realized (at least I thought) that one way to get the larger drive in the exact same format as the older working drive was to simply copy the contents of the old drive byte-by-byte to the new one. I tried this, and indeed I saw the exact same format and partitioning on the new drive. However, I noticed one tiny change: the old drive still had a lighter shade stripe above the partition graphic, whereas the new usb did not have this lighter stripe across the top. I also saw that the old drive has an addition line of metadata: partitioning: Master Boot Record. How can I get this property as well? I think this is making a difference because I still cannot boot from the new drive, but can from the old one.
Following some of the answers, I tried to install Ubuntu onto a blank stick that was plugged in to my GPU rig, using a different bootable usb. However when I try to restart and boot using only the new install, I get this very strange screen I will affectionately call "rainbow fuzz". This screen happens after I select the boot option, but before I get to the Ubuntu boot menu. I've never seen this before but maybe someone has? By the way, I don't think it is related to the graphics card, as the same thing happens with my GPU disconnected.

A: I have not been able to modify an ISO 9660 install made using SDC since 14.04.
When SDC makes a Live USB you only get 1.5 GB of usable drive no matter what the actual size of the USB drive is.
Better to use mkusb to make the drive, in that case you get a small UEFI partition, a FAT32 Grub boot partition, an ISO 9660 OS partition, an ext2 casper-rw persistent partition that will save your settings and a NTFS data partition that can be used by Linux or Windows for data. you can vary the size of the casper-rw/data partitions. Use the EFI option when making the drive.
see https://help.ubuntu.com/community/mkusb
If UEFI and BIOS booting is required and only a Windows machine is available, it is possible to make a Persistent boot drive using UNetbootin and install mkusb to it.
Another possibility is to download a Linux image that already has mkusb installed and write it to USB using Windows Image Writer, see:
https://ubuntuforums.org/showthread.php?t=2213631&page=17&p=13642568#post13642568
UNetbootin and Rufus and YUMI
It is good to see that UNetbootin 657 now supports BIOS and UEFI boot by default, however any attempt I have made to modify the partition structure, (shrink, move) has resulted in a broken BIOS boot, UEFI boot works OK but BIOS boot results in a flashing curser.
Rufus has options for UEFI boot and BIOS or UEFI boot. The later worked well for me, until an attempt to modify the partition structure had the same result as UNetbootin, a broken BIOS boot.
Yumi also suffers the same fate as SDC, UNetbootin and Rufus when the partition is modified. Files written to the root of YUMI UEFI Beta from Windows can be accessed in /isodevice and modified as root when booted from the USB. YUMI has no Persistent file size limit when installed in NTFS.
A Full install is a possibility on drives 8GB and larger.

A: I am guessing here, maybe I am right, maybe I am wrong. If In either case please let me know. If I am wrong, please describe with more details, how things are, and I might be able to give better help.

*

*1) why am I seeing getting 3 boot devices corresponding to one usb?
There are many different UEFI-BIOS systems, and they can display very different alternatives. It is difficult for me to know why your system is getting 3 boot devices for one USB drive. It is common to display one alternative for UEFI mode and one alternative for BIOS mode (alias CSM alias legacy mode). Sometimes the USB hardware is identified in clear text, sometimes not.

*2) how do I create a startup disk with one single fat32 partition, similar to the one I described that booted properly?
You can do it according to the advice by @johnnybegood in the comments (using Windows and Unetbootin (or Rufus, which is also a good tool). But the Ubuntu Startup Disk Creator in Ubuntu 16.04 LTS and newer versions is also a good tool. It is a cloning tool and clones the ISO 9660 file system of the iso file, which works well in a live drive (to 'Try Ubuntu' and to install Ubuntu).
But, and this is a big but, you should not install Ubuntu into this same drive. I think your problem might be that you try to install Ubuntu into the same drive (USB pendrive) that you are booting from. Instead you should boot from one pendrive (a 2 GB pendrive is big enough for Ubuntu), and install into an internal drive (HDD or SSD) or into another USB drive (pendrive, HDD or SSD or memory card).

*3) why are the uefi options leading to a black screen, even while using the recommended fixs such as nomodeset?
There is probably some missing software (driver or related program) for your graphics chip/card. Sometimes the software for UEFI mode is different from that in BIOS mode, and things work better in one of the modes. (Something similar happens in a Toshiba laptop that I own.)

*4) why is the installation process not recognizing these mutliple partitions, and instead only recognizing the one with free space?
Are you trying to install into the same drive as you are booting from? It seems that is what is happening according to your description. Is there an internal drive? With Windows? In that case, it might be hidden because you have hibernated or semi-hibernated Windows, which means that Ubuntu should not touch it. Instead you should turn off 'fast startup' in Windows (which is a kind of semi-hibernation), or simply reboot instead of shutdown Windows, and check if that makes the internal drive show up among Ubuntu's installer's alternatives.

*5) what does it mean that / is not a "fully-functioning" file system?
Ubuntu cannot use it as its root file system '/'. Ubuntu needs a linux file system. The standard file system is ext4.

*6) why does the ext2 file system creation fail?
I suspect that you try to create it in the the same drive as you are booting from, and the structure of the partition table, partitions and file systems on that drive is very special and also actively used by the running system.

A: There are two types of "bootable USB" setups and I couldn't be certain from your description which one it was that you were trying to create:

*

*A "live-boot" USB

*A full system built on a USB instead of a hard drive

LIVE BOOT USB
It looks like you had this pretty much right already.  This is a USB that has a boot loader, and a DVD (or CD) image, and that's it.  Every time you boot from this USB you will get a Linux system freshly built on a RAM disk.  When you shut this system down everything is lost.  If this is what you want you just have to select the option that says "try Ubuntu without installing" or whatever option is closest in meaning to that.
The partitions you could see were the boot partition (which you thought might be swap) and the DVD or CD image.
Once you've booted from that you could format the free space as another partition and mount it.  Anything you save on that will be kept.  But you would have to remount it every time you boot because the mount table would be lost.
Enough of this, I'm pretty sure you didn't want this.
FULLY BUILT SYSTEM
If this is what you want, clean off all the stuff you have on your new USB.  Delete all those partitions.  You can rebuild your desired partitions on advance if you like, or the Ubuntu install will guide you through it.  I use the install on the rare occasions I build a system.
Follow the procedure you used above to create a live-boot USB on a different USB.
Now go to the computer you're going to use the system on.  You can build on a different computer, but it's much easier if you build on the system you're going to run on.  Boot from your live-boot USB.  Select the appropriate "Install Ubuntu" option for your needs and away you go.
Once complete you will be prompted to remove the live-boot USB and restart the system.  There is a small chance that the new drive won't boot.  If so, the answer is probably this: USB MBR Damaged
Just a word on partitions...
Some types of partition must have a corresponding format.  The boot partition for instance must have the EFI file system on it.  For other types you have more discretion but some simple guidelines will help you if you don't have anything terribly complex in mind to build.
Unless you have specific, critical reasons for it, don't use FAT-anything.  It has very little integrity/consistency protection.  File, folder or even drive loss is much more probable with FAT than with any of the newer formats.
Don't use NTFS unless you intend to share the partition with Windows.  You can do this, and I have on my laptop, so that you can access the same files from either Windows or Linux.  But NTFS isn't optimised for Linux and has some shortcomings with access permissions, ownership and so on.
In general use swap for your swap partition.  Other formats can work but they have greater overhead not required for transient, non-file storage and will slow you down.
In general use ext2 for your /tmp partition.  Again, this is transient storage and is lost on shutdown, so you don't need all the journaling and logging of ext3 or ext4.
In general use ext4 for any persistent file-based data.

A: I know this question already is a little older - but maybe someone with the same problem will find this:
If you already got a working live-USB (whether Linux or not should not matter) there is another completely different approach:
Install a partitioning tool and try copying the whole (single) partition of the smaller old stick onto the new one. If it works you can either create a new partition in the remaining space (just for data etc.) or resize the copied to be bigger. Or, of course, you can do both.
You might need some luck for it to work this way but it is easier and quicker than downloading and installing some 1.5 Gb .iso. And in case it works you have some extra time because all setting and files are transferred already.


text:
Q: Uniqueness of analytic continuation to assign sum values A recent  Mathologer video about the sum $1+2+\ldots = -1/12$ reawakened some unease I have about using analytical continuation to assign values to divergent sums. Specifically, the idea that the analytic continuation of different functions gives the same result, or perhaps it doesn't and its something else that I've not understood. I'll lay out below what I think must be true, to see if anyone knows if it is true or why it doesn't have to be.
Proposition
Let $\Omega_1,\Omega_2\subset \mathbb{C}$ be open and connected, and $u_k:\Omega_1 \rightarrow \mathbb{C},v_k:\Omega_2 \rightarrow \mathbb{C}, k\in\{1,2,\ldots\}$ be analytic. Define
$$
f(z) = \sum_{k=1}^\infty u_k(z)
\\
g(z) = \sum_{k=1}^\infty v_k(z)
$$
and suppose that $u_k,v_k$ are such that both $f$ and $g$ are convergent and analytic on some (possibly different) open subsets of $\Omega_1$ and $\Omega_2$ respectively. Denote the unique analytic continuation of the functions by $\tilde{f},\tilde{g}$. In addition suppose that there exists $z_1\in \Omega_1,z_2\in \Omega_2$ such that, for a given (not necessarily convergent) sequence $a_1,a_2,\ldots$
$$
u_k(z_1)=a_k
\\
v_k(z_2)=a_k
$$
Then we can prove that $\tilde{f}(z_1) = \tilde{g}(z_2)$.
Questions
It seems to me that, if the above is true, the analytic continuation of a function has meaning with regard to infinite sums, if not then it doesn't.
Is the above true?
If yes: prove it (or, intuitively justify it, link to a proof, reference a book, etc)
If no: why are the results obtained by analytically continuing the Riemann zeta function the ones we go with?

A: It need not be the case that $\tilde{f}(z_1) = \tilde{g}(z_2)$, even when both, $f$ and $g$ can be uniquely analytically continued to the respective $z_j$.
For $k \in \mathbb{N}\setminus \{0\}$, define (using the real-valued logarithms)
$$u_k(z) = (k+1)\cdot k^z \qquad\text{and}\qquad v_k(z) = k\cdot (k+1)^z\,.$$
The $u_k$ and $v_k$ are all entire functions, and we have $u_k(1) = v_k(1) = k(k+1)$ for all $k$. For $\operatorname{Re} z < -2$, we can compute
$$f(z) = \sum_{k = 1}^{\infty} (k+1)k^z = \sum_{k = 1}^{\infty} k^{z+1} + \sum_{k = 1}^{\infty} k^z = \zeta(-z-1) + \zeta(-z)$$
and
$$g(z) = \sum_{k = 1}^{\infty} k(k+1)^z = \sum_{m = 2}^{\infty} (m-1)m^z = \sum_{m = 1}^{\infty} (m-1)m^z = \zeta(-z-1) - \zeta(-z)\,.$$
Hence $\tilde{f}(1) = \zeta(-2) + \zeta(-1) = \zeta(-1) = -\frac{1}{12}$ and $\tilde{g}(1) = \zeta(-2) - \zeta(-1) = \frac{1}{12}$.

If no: why are the results obtained by analytically continuing the Riemann zeta function the ones we go with?

We don't always. For one, this method applies only to some sequences. One cannot obtain a value for the series of fast-growing sequences with it. Even if it can be used, a different method may be more inviting.
There are a lot of summation methods for divergent series, some of which look more reasonable than others. If the more reasonable-looking methods assign the same value to a divergent series, that's an indication that this particular value makes more sense than others [for every divergent series and every complex number $w$, there are summation methods assigning the value $w$ to the series; typically, such summation methods don't even pretend to be reasonable]. That's also the case if some of these methods assign the same value, and others don't assign any value to the series in question. If the more reasonable-looking methods assign different values to the series, it's more hairy. There may be reasons to prefer one of these methods to others in particular circumstances, but a choice ought to be justified.

A: You don't even need analytic continuation. Look at
$$\frac1{(1-x)^2}-\frac{h(x)}{(1-x)^3}= \sum_{n\ge 1} n x^{n-1} (1-h(x) \frac{n+1}{2})$$ where $h(x)=(1-x)-C(1-x)^3$ vanishes at $x=1$.
Then $$\lim_{x\to 1^-} \sum_{n\ge 1}  n  x^{n-1}(1-h(x) \frac{n+1}{2})=C$$ is a "regularization" of $\sum_{n\ge 1} n$


text:
Q: div tags are floating with the codes above I am working with html. I am getting problem with html div tag.
see the code above:-

This is a header

This is a paragraph.

This is a header

This is a paragraph.

This is a header

This is a paragraph.

This is a text

Here, the divs are floated left. But the text "This is a text" is also floated with the divs. I want the text "This is a text" to be situated after the divs. Not beside them. What can I do?

A: Add a div before "This is a text" :

A: You'll need to clear the float ...
.
.
.
.
.
.

This is a header

This is a paragraph.

        This is a text


text:
Q: Session implementation Today I found out about session data. I'm building a simple database project that gets, edits and writes data to/from an MS-Sql database.
My original problem was my GridView forgetting about its original data whenever I clicked an external edit button. Because a good fistful of the program is written in the page class, clicking a button (any button) forces the page to reload.
I'm semi-following an old StackOverflow article where a user gave an example of using an entirely separate class file to implement session storage - see here
Now, I've been trying to store my singular row cell-by-cell, as strings, but I cannot get them to remain in a session.
So far, I've been using the following line to transfer a cell to a session string:
masterSession.Current.K_INVOICE = invGrid.Rows[0].Cells[0].ToString();

Which doesn't work. How on earth to I go about implementing this?


text:
Q: Cumulative Maximum, calculate for every parent record Have anyone used the Cumulative Maximum functoid and noticed performance problems?
Abstract
If one wants to map the maximum value of a field you can use the functoid Cumulative Maximum.
Problem
After we had used it for a while we noticed degraded performance on larger files.
Examining the xslt one notices that the max calculation is made for each looping record...
One could move the calculation to the grand parent, and point out the new xslt in the Custom XSL Path, but I really like to keep the possibility to map in the mapping tool.
Any suggestions?
Kind Regards
Martin Bring
http://martinbring.blogspot.com

A: By removing the Cumulative Maximum and adding 3 scripting functoids, doing the calculation in another way, the problem is solved. Mapping time decreased by a factor of 40.
11 Mb, 10 000 rows, was previously mapped in 200 minutes is now mapped in 5 minutes.
Solution
One scripting functoid, "Inline XSLT Call Template" with no input or output, containing the max() portion of the library from EXSLT Math library found here. Instead of using the whole library I unzipped the file and "extracted" the max() template.
 <xsl:template name="GetMax">
   <xsl:param name="nodes" />

    <xsl:choose>
      <xsl:when test="not($nodes)">NaN</xsl:when>
      <xsl:otherwise>
        <xsl:for-each select="$nodes">
          <xsl:sort data-type="number" order="descending" />
          <xsl:if test="position() = 1">
          <xsl:value-of select="number(.)" />
        </xsl:if>
       </xsl:for-each>
     </xsl:otherwise>
   </xsl:choose>
 </xsl:template>

One scripting functoid, "Inline XSLT Call Template" with no input or output, containing a variable which select attribute points at the template with the node set to calculate
<xsl:variable name="var:MaxValueDate">
    <xsl:call-template name ="GetMax">
            <xsl:with-param name ="nodes" select="Root//Parent/ValueToCalculate" />
    </xsl:call-template>
</xsl:variable>

One scripting functoid, "Inline XSLT" with one output, using the variable to populate an output element with its value.
<OutputElement>
        <xsl:value-of select="$var:MaxValueDate" />
</OutputElement>

Voila!


text:
Q: Ansible - Read dict items from file and use with loop I am trying to take this effort a little further and want to download multiple files from BitBucket having different parent directories.  So I am trying to use the below script.
I want to put the mappings in a separate file and read it into the script, so that at subsequent times, I can just update that file, without having to touch the script.
- name: Download connector scripts
  get_url:
    url: "http://bbserver:7990/projects/myproject/repos/myrepo/raw/{{ item.filename }}?at=refs%2Fheads%2Fmaster"
    dest: "{{ item.dest }}"
    url_username: '{{ bb_username }}'
    url_password: '{{ bb_password }}'
    force_basic_auth: yes
  loop: "{{ lookup('file', 'scriptnamesnpaths.txt').splitlines() }}"
  register: showdlstatus
  become: yes
  become_user: '{{ bb_username }}'
- debug: var=showdlstatus

And my scriptnamesnpaths.txt looks like this
{filename: 'scripts/dir1/script1.sh',      dest: "/scripts/dir1/"}
{filename: 'scripts/dir1/script2.sh',      dest: "/scripts/dir1/"}
{filename: 'scripts/dir2/script3.sh',      dest: "/scripts/dir2/"}
{filename: 'releases/file1.json',          dest: "/scripts/releases/"}
{filename: 'releases/file2.json',          dest: "/scripts/releases/"}

I basically want to download different scripts from different paths in bitbucket to different locations on the server.
The error I am getting with this construct is
 {"msg": "The task includes an option with an undefined variable.
 The error was: 'ansible.utils.unsafe_proxy.AnsibleUnsafeText object' has no attribute 'filename'

Which part am I doing wrong or missing?  I also tried with
loop: "{{ lookup('dict', 'scriptnamesnpaths.txt').splitlines() }}"
But get error about dict definition.
Any pointers or help is appreciated.
Thank you

A: Rather than using a file lookup, it might be easiest just to make a group_vars file so that Ansible reads it for you automatically.
That is, if you create a file groups_vars/all.yml  with this content:
connector_scripts:
  - {filename: 'scripts/dir1/script1.sh',      dest: "/scripts/dir1/"}
  - {filename: 'scripts/dir1/script2.sh',      dest: "/scripts/dir1/"}
  - {filename: 'scripts/dir2/script3.sh',      dest: "/scripts/dir2/"}
  - {filename: 'releases/file1.json',          dest: "/scripts/releases/"}
  - {filename: 'releases/file2.json',          dest: "/scripts/releases/"}

You could then write your task like this:
- name: Download connector scripts
  get_url:
    url: "http://bbserver:7990/projects/myproject/repos/myrepo/raw/{{ item.filename }}?at=refs%2Fheads%2Fmaster"
    dest: "{{ item.dest }}"
    url_username: '{{ bb_username }}'
    url_password: '{{ bb_password }}'
    force_basic_auth: yes
  loop: "{{ connector_scripts }}"
  register: showdlstatus
  become: yes
  become_user: '{{ bb_username }}'

If you really want to use a file lookup, you'll need to deal with the fact that for each iteration of your loop, the variable item is a string. You can't ask for something like item.filename because a string doesn't have an attribute filename (which is the source of the error you're seeing).  You would need to de-serialize each line before using it, for example:
- name: Download connector scripts
  get_url:
    url: "http://bbserver:7990/projects/myproject/repos/myrepo/raw/{{ (item|from_yaml).filename }}?at=refs%2Fheads%2Fmaster"
    dest: "{{ (item|from_yaml).dest }}"
    url_username: '{{ bb_username }}'
    url_password: '{{ bb_password }}'
    force_basic_auth: yes
  loop: "{{ connector_scripts }}"
  register: showdlstatus
  become: yes
  become_user: '{{ bb_username }}'

You could simplify that a bit by moving the from_yaml call to a vars section so you only have to do it once:
- name: Download connector scripts
  get_url:
    url: "http://bbserver:7990/projects/myproject/repos/myrepo/raw/{{ item_converted.filename }}?at=refs%2Fheads%2Fmaster"
    dest: "{{ item_converted.dest }}"
    url_username: '{{ bb_username }}'
    url_password: '{{ bb_password }}'
    force_basic_auth: yes
  vars:
    item_converted: "{{ item|from_yaml }}"
  loop: "{{ connector_scripts }}"
  register: showdlstatus
  become: yes
  become_user: '{{ bb_username }}'

...but I think it's much easier to simply use the first solution and drop a file into group_vars.

A: Is there a particular reason for favoring putting the filenames/destinations in a script rather than the task? This would be a simplified version of the task with vars included in it:
- name: Download connector scripts
  get_url:
    url: "http://example.com/{{ item.key }}"
    dest: "{{ item.value }}"
  loop: "{{ files | dict2items }}"
  vars:
    files:
      filename1: "/path/to/dest/dir/"
      filename2: "/path/to/dest/dir/"


text:
Q: Jquery mobile only loads first page in DOM and not loading css of other pages with page hide() show() Jquery mobile only loads first page in DOM I was implementing page navigation through hide() and show(), but now I am using jquery objects like google map and navbar now it stops working and dont show the page 3 in my code until I put page 3 at top  of pages but than page 1 stop showing jquery nav bars with proper jquery css. Currently I am developing in html5, jquery mobile, phonegap ,android simulator.
HTML code

Back

<input type="search" name="password" id="search" value="" data-theme="c" />

Main

Map

 LINK 1

 LINK 2

 LINK 3

        <fieldset>

 LINK 1

 LINK 2

 LINK 3

        </fieldset>

Back

        <input type="search" id="newsearch" value="" data-theme="c" />

Main

Map

 LINK 1

 LINK 2

 LINK 3

Javascript Code

        $(document).ready(function() {
        var map;
        hide();
        $('#page1').show();
        $('.ui-loader').hide();

        function hide(){
        $('#page1').hide();
        $('#page2').hide();
        $('#page3').hide();
        }

        $(document).delegate('[data-role="navbar"] a', 'click', function () {
        $(this).addClass('ui-btn-active');
        $('.content_div').hide();
        $('#' + $(this).attr('data-href')).show();
        google.maps.event.trigger(map, 'resize');
        });

        $('#first').click(function() {
        hide();
        $('#page1').show();
        LoadMap("map_canvas");
        return false;
        });

        $('#second').click(function() {
        hide();
        $('#page2').show();
        return false;
        });

        $('#third').click(function() {
        hide();
        $('#page3').show();
        LoadMap("new-map_canvas");
        return false;
        });

        function LoadMap(divcanvas) {

        var myLatlng = new google.maps.LatLng(-25.363882,131.044922);
        var myOptions = {
        center: myLatlng,
        zoom:10,
        mapTypeId: google.maps.MapTypeId.ROADMAP
        };
        map = new google.maps.Map(document.getElementById(divcanvas),
        myOptions);

        }

        });

I even tried to use triggers but I think I don't not how they would be implemented in this scenario.

A: Firstly, your HTML structure is invalid and needs to be fixed. Refer to this page to understand how you define multiple JQM pages in a single HTML document.
With JQM, you do not explicitly show/hide pages. JQM handles that for you. You can link to your pages using  links as described in this page.
Finally, for learning how to JQM can be provided with your custom JS; read this help page.


text:
Q: ARM Template - conflicting update There is ARM template for provisioning two Azure Search services
"resources": [
{
  "type": "Microsoft.Search/searchServices",
  "name": "[parameters('serviceName')]",
  "apiVersion": "[parameters('serviceApiVersion')]",
  "location": "[parameters('location')]",
  "properties": {
    "sku": {
      "name": "[parameters('sku')]"
    },
    "replicaCount": 1,
    "partitionCount": 1,
    "hostingMode": "[parameters('hostingMode')]"
  }
},
{
  "type": "Microsoft.Search/searchServices",
  "name": "[concat(parameters('serviceName'), 'secondary')]",
  "apiVersion": "[parameters('serviceApiVersion')]",
  "location": "[parameters('location')]",
  "properties": {
    "sku": {
      "name": "[parameters('sku')]"
    },
    "replicaCount": 1,
    "partitionCount": 1,
    "hostingMode": "[parameters('hostingMode')]"
  }
}]

Deployment of ARM Template provisions one search service and fails another with response:
{
  "error": {
    "code": "Unknown",
    "message": "There was a conflicting update. No change was made to the resource from this request. RequestId: b65a51b5-cd87-4dc5-82d9-9041ddd1c2dc",
    "target": null,
    "details": null
  }
}

Does anyone face issue like that?

A: Perhaps search services cannot be concurrently provisioned in the same resource group.   Try adding a "dependsOn" property to the second search service.

A: The issue
The search services don't rely on another, so a dependsOn property wouldn't be required.
I think the problem is that your arm syntax is invalid.
I don't know which apiVersion you are using, but I cannot find any that has the same syntax...
(it resembles 2015-02-28 the most, but the hostingMode field is not allowed there).
Solution
Either use apiVersion 2015-02-28 without hostingmode or (if you need that field) use a newer apiVersion where "sku" is taken outside the "properties". The following works for me!
{
  "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
  "contentVersion": "1.0.0.0",
  "resources": [
  {
    "type": "Microsoft.Search/searchServices",
    "name": "parameters('serviceName')",
    "apiVersion": "2015-08-19",
    "location": "parameters('location')",
    "properties": {
      "replicaCount": 1,
      "partitionCount": 1,
      "hostingMode": "default"
    },
    "sku": {
      "name": "basic"
    }
  },
  {
    "type": "Microsoft.Search/searchServices",
    "name": "[concat(parameters('serviceName'), 'secondary')]"
    "apiVersion": "2015-08-19",
    "location": "parameters('location')",
    "properties": {
      "replicaCount": 1,
      "partitionCount": 1,
      "hostingMode": "default"
    },
    "sku": {
      "name": "basic"
    }
  }]
}


text:
Q: Should the label wrap my input or the other way around? I have this markup:
<form name="access-form" method="post" id="grant-access-page-form">

        <input id="randomized-user-radio" type="radio" name="access-account-type" value="random">

<?php esc_html_e( 'Randomized User', 'sprout' ); ?>

<?php esc_html_e( 'Create a random username that the developers can only use once per session.', 'sprout' ); ?>

<?php esc_html_e( 'Need to re-create the account.', 'sprout' ); ?>

<?php esc_html_e( 'Best security, but slower responses.', 'sprout' ); ?>

<?php esc_html_e( 'Automatically deletes the account, strong security.', 'sprout' ); ?>

        </input>

    <input type="submit" value="<?php esc_html_e( 'Create Developer Account', 'sprout' ); ?>"></input>
</form>

And was wondering if it's correct to have the label wrap my input or it should be the other way around. Way I see it, the input should have a label inside of this, but using the W3 validator, this shows no errors whatsoever.

A: The way I normally set up my forms is using a definition list

Name

<input type="text" name="name" id="name" placeholder="John Doe" />

Labels and inputs are grouped using the for & id attributes.
PS: try and make use of htmlentities();


text:
Q: Proof of Conway's "Simplicity Rule" for Surreal Numbers A "number" in the sense of Combinatorial Game Theory is a game
 $G = \{ a,b,c,\dots | \; d,e,f,\dots \}$ such that $a,b,c < d,e,f$.  Then our game is between the left and right options:
$$  a,b,c <  G < d,e,f $$
However, we still don't know which number we are dealing with until we invoke his Simplicity Rule

If there's any number that fits, it's the simplest number that fits.

At this point, we don't necessarily know that all finite games should have denominators which are power of $2$, but it's true.  Instead we get 4 rules and  a fuzzy notion of "simplicity":

*

*$0 = \{ | \}$

*$n+1 = \{ n| \}$

*$-n-1 = \{ | -n \}$

*$\tfrac{2p+1}{2^{q+1}} = \left\{\tfrac{p}{2^q}  | \tfrac{p+1}{2^q} \right\} $

The numbers we construct kind of resemble the notches of a ruler

It is known these games generalize Dedekind cut construction of the real numbers from the Rationals.  However $\mathbb{Q}$ hasn't been constructed yet... not even $\mathbb{Z}[\tfrac{1}{2}]$.  How do we prove these simplicity rules?

A: The definition of number and integers
The definition of "number" in Combinatorial Game Theory is not "a game $G$ such that every right option is greater than every left option". For example, with $*\cong\{0|0\}$ and $\uparrow\cong\{0|*\}$, the game $\{0|\uparrow\}$ satisfies your condition (as $\uparrow>0$), but is not a number.
One definition of "number" could be Definition A: "a game $G$ such that all options are numbers and every right option is greater than every left option", but that's stronger than necessary.
I prefer defining "number" as Definition B: "a game $G$ such that all options are numbers and no right option is less than or equal to any left option" and then proving it satisfies the stronger definition.
Note that the natural numbers games you defined (e.g. $0=\{|\}$,$1=\{0|\}$,...) are numbers in the sense of either definition by an immediate induction: their option is a number by induction and they don't have a right option to violate the inequality clause.
Also note that the negative of a number (by either definition) is automatically a number (by the same definition), so that gives us the rest of the integers. I'll talk about the dyadic fractions (rationals whose denominator is a power of 2) later.

Simplicity Rule
The simplicity rule will take some work to reach. I'll use definition B in what follows and prove that numbers satisfy definition A along the way.
Lemma 1: Numbers are between their options
Proof: We'll prove that a number $G$ is greater than all of its left options; the proof that it's less than all of its right options is exactly analogous. Let $G$ be a number, and assume, as an inductive hypothesis, that lemma 1 is true for all of the options of $G$. Let $G^L$ be a left option of $G$. Then to check $G>G^L$, we need to see that Left can always win $G-G^L$. If Left goes first, she can just move to $G^L-G^L=0$ and win. If Right moves first to some $G^R-G^L$, then since $G$ is a Number, we know that $G^R\nleq G^L$ (by definition B) so that Left wins $G^R-G^L$ going first. Finally, if Right moves first to some $G+\left(-G^L\right)^R=G-\left(G^{LL}\right)$ (by this I mean that a right option of $-G^L$ is the negative of a left option of $G^L$), then Left can win by moving to $G^L-G^{LL}>0$ (inductive hypothesis applied to $G^L$).  $\square$
Corollary 1
Now we can see that definition B implies definition A. By lemma 1, which only assumed definition B, we have $G^L<G$ for all left options, and $G<G^R$ for all right options. By transitivity of $<$, we can conclude that for all pairs of options, $G^R>G^L$, as desired. $\square$
Lemma 2: Numbers are closed under sum
Proof: Let $G$ and $H$ be numbers. Recall that $G+H=\left\{\mathcal{G}^L+H,G+\mathcal{H}^L\left|\mathcal{G}^R+H,G+\mathcal{H}^R\right.\right\}$. Assume, for sake of contradiction, that some right option of $G+H$ is less than or equal to a left option. Case I: Suppose $G^R+H\le G^L+H$. Then $G^R\le G^L$ which is impossible since $G$ is a number. Case II: Suppose $G^R+H\le G+H^L$. By lemma 1, $H^L<H$, so $G+H^L<G+H$. Analogously, $G+H<G^R+H$. But then we have $G+H<G^R+H\le G+H^L<G+H$, which is a contradiction. Cases III and IV are analogous. $\square$
Lemma 3: Numbers are pairwise comparable
Proof: If $G$ and $H$ are numbers, then $-H$ is a number by the remark in the first section, and hence $G-H$ is a number by lemma 2. Since $G$ being incomparable with $H$ is equivalent to $G-H$ being a first-player win (an $\mathcal{N}$-position), it suffices to show that no number is a first-player win. Suppose for sake of contradiction that a number $G$ is a win for the first player. Then choose winning moves $G^L$ and $G^R$. To be winning moves, we must have $G^L\ge0$ and $G^R\le0$, so that $G^R\le G^L$, which is a contradiction. $\square$.
Lemma 4: Proto-Simplicity
Definition: A game $H$ "fits" for a game $G$ if $\mathcal{G}^L\ngeq H\ngeq\mathcal{G}^R$; that is, $H$ fits for $G$ if $H$ lies strictly between (or is incomparable to) the left and right options of $G$. With this definition, lemma 1 implies that a number fits for itself.
Lemma Statement: If $H$ is a number, and $H$ fits for $G$ but none of $H$'s options fit for $G$, then $G=H$.
Proof: We need to show that the second player has a winning strategy on $G-H$. If Left makes the first move to $G^L-H$, then since $H$ fits for $G$, $G^L-H\ngeq0$ and Right can win. Now suppose Left makes the first move to $G-\left(H^R\right)$. Since none of $H$'s options fit for $G$, $H^R$ doesn't fit for $G$, and there must be a witnessing (in)equality of the form $G^L\geq H^R$ or $G^R\leq H^R$. By lemma 1, $H^R>H$, and since $H$ fits for $G$, $G^L<H<H^R$, so that $G^L\geq H^R$ would be impossible. Therefore, there must be an option $G^R\leq H^R$. Thus, Right can win by moving from $G-\left(H^R\right)$ to $G^R-\left(H^R\right)\le0$. The two cases in which Right makes the first move are analogous. $\square$
Lemma 5: Simplest fitting numbers
Statement: If $G$ is a game, and any number fits for $G$, then there is a lowest birthday among birthdays of numbers $H$ that fit for $G$.
Proof: This follows immediately from the fact that the ordinals are well-ordered. $\square$
Theorem: Simplicity Rule
Statement: If $G$ is a game, and any number fits for $G$, then $G$ is equal to any minimal-birthday fitting-number.
Proof: If $H$ has the lowest birthday of any fitting number, no option of $H$ could fit, so the result follows from lemma 4. $\square$
Corollary 2
In particular, if $G$ is equal to a number $H$, lemma 1 shows that $H$ fits for itself (and hence $H$ fits for $G=H$), so $G$ is equal to any minimal-birthday fitting-number by the simplicity rule. $\square$
Note that the simplicity rule doesn't say anything about uniqueness: the number $\omega\cong\{0,1,2,3,\ldots|\}=\{0,2,4,\ldots|\}$, but both forms have minimal birthday $\omega$ (the ordinal).

All finite-birthday numbers are equal to a dyadic
Proof: Suppose that $G$ is a number with finite-birthday and all numbers of earlier birthday are equal to a dyadic. Then $G$ has finitely many options, all dyadic. Since the dyadics (and in fact all numbers, by lemma 3) are pairwise comparable, we can assume $G$ is in canonical form with at most one left option and at most one right option, both necessarily dyadic. If an integer fits, then by applying lemma 4 and induction, $G$ is equal to the smallest absolute value integer that fits. If no integer fits, then there's a unique dyadic of smallest denominator that fits, and $G$ is equal to that.

How do we get $\mathbb Q$ and $\mathbb R$
You can get elements of $\mathbb R$ that are not-dyadic on day $\omega$ by using Dedekind cuts with dyadics. In other words, if $r$ is a real that is not dyadic, then $r=\left\{\text{dyadics}<r\left|\text{dyadics}>r\right.\right\}$.
There's also a nice implicit definition of the reals: a number $G$ is real if $G$ is bounded by integers ($-n<G<n$ for some natural $n$) and $G$ is "simply approximated by dyadics" in the sense that $G=\{G-q|G+q\}$ where $q$ ranges over the positive dyadics.

Some of this was based on old blog posts I made as I was working through Winning Ways/On Numbers and Games, but a couple tricky bits are based on Aaron N. Siegel's Combinatorial Game Theory.

A: The four rules are defining what we mean by strings that look like integers and dyadic fractions.  Conway's system has some axioms which only use a few characters like $\{, \},$ and $|$.  From those we can create $\{ | \}$ and see that it meets the definition of number.  We then (per the first rule) give it a name "$0$".  In theory, we could give it any name we like, say "Alphie", but giving it the name zero tends to imply it will work like the real number zero we are accustomed to.  Even using the $n$ in the definitions rests on our understanding of the natural numbers and he owes us that $2$ in his definition will behave like the $2$ we know and love.  We can unpack the definition of $2$ and find that it is a name for $\Bigl \{\bigl\{\{ | \}|\bigr \}|\Bigr\}$.  This is similar to Peano Arithmetic where $0$ is part of the language and we define $2=S(S(0))$ to shorten presentations.  It would be perverse to define "$3$" as $S(S(0))$ because it wouldn't work right.  We need to prove the Simplicity Rule, which is independent of these definitions.  We have defined $\frac 12=\{0|1\}$.  Now we need to prove that $\{0|x\}=\frac 12$ for any number $\frac 12\lt x \le 1$.  Using his game theory formulation, we need to show that $\{0|x\}+\{0|x\}+\{|0\}=0$, in that whoever moves first loses.


text:
Q: MDM commands not reaching to iPhone I am working on an enterprise application which runs on supervised devices.
It uses MDM commands to perform certain operation for which we created our own MDM server and communication between our devices and mdm was happening smoothly till last month.
Last month our MDM server certificate got expired so as usual we renewed the MDM certificate along with APN certificate, after this the communication between the APNS and device has stopped.
Basically our logs show that MDM command is reaching the APNS but APNS is not able to wake up the device and device polling is not working, so none of the MDM commands are working.
We tried creating new MDM and APNS certificates as well with our enterprise account but the result is still the same.
So my questions are
Can we debug the APNS and device communication? If yes then please tell how.
Did anything changed with respect to MDM or APNS certificates? If yes then a link or guide to create certificates and mobileConfiguration profile on a mac will be really helpful.
Does anyone have any idea what could be going wrong?
Any help is appreciated.


text:
Q: Can I get @me.com email address when I only have @icloud.com address? Can I still (as of 03/2013) get @me.com, as an alternative to my @icloud.com email address? I would want the two email to point to the same AppleID.
The reasons are quire prosaic, @me.com just looks better than @icloud.com.

A: You cannot. Apple has retired the ability to get a new @me.com email address, just like they did for the @mac.com email addresses back in 2008. Existing accounts are grandfathered in, but you are unfortunately out of luck.