text:
Q: Ubuntu 15.10: share internet connection over WiFi Having two WiFi interfaces I'd like to use one as a hotspot, but the simple instructions found here don't work, no new wireless network is detected by any device (neither Android nor Windows PC).
Any clue? Are in Ubuntu 15.10 still required additional softwares as suggested by some answers to similar questions regarding older Ubuntu version? If so, which one should be used with Ubuntu 15.10?


text:
Q: Did Darth Vader ever return to Tatooine? Did Darth Vader ever return to Tatooine for any reason?  (For example: to hunt Jedi?)
I know mention is made in a couple of the EU books that Tatooine would make a good place to hide Luke because it was such a painful place for Vader, but I never heard whether or not that actually stopped him from ever returning there.

A: Main Canon
Within the main canon of Star Wars (the 6 theatrical movies, Clone Wars TV series and film and Rebels TV series) there was no account of Anakin returning to Tatooine after becoming Darth Vader however in the latest Marvel comic series Star Wars : Darth Vader, we learn that he did indeed travel to Tatooine to converse with Jabba the Hutt and hire bounty hunters to search out the identity of the "mysterious pilot".

"Legends" canon
The main EU novel dealing with Darth's rise to power is Dark Lord: The Rise of Darth Vader. This book was written in consultation with LucasArts and contains a considerable amount of information about the gap between Revenge of the Sith and A New Hope. In it, Obi-Wan learns (from Qui-Gon's force ghost) that Vader will never set foot on Tatooine again, supposedly making it an ideal place to hide young Luke:

"Qui-Gon!" he said. "Master!" Realizing that the locals were quickly
  going to brand him a madman if they heard him talking to himself, he
  ducked into the narrow alley between two stores. "Master, is Darth
  Vader Anakin?" he asked after a moment.
Yes. Although the Anakin you and I knew is imprisoned by the dark
  side.
"I was wrong to leave him on Mustafar. I should have made sure he was
  dead."
The Force will determine Anakin's future. Obi-Wan: Luke must not be
  told that Vader is his father until the time is right. "Should I take
  further steps to hide Luke?"
The core of Anakin that resides in Vader grasps that Tatooine is the
  source of nearly everything that causes him pain. Vader will never set
  foot on Tatooine, if only out of fear of reawakening Anakin.
Obi-Wan exhaled in relief. "Then my obligation is unchanged. But from
  what Yoda told me, I know that I have much to learn, Master."
You were always that way, Obi-Wan.

Obviously in light of the recent canon changes, this assurance now seems rather more hollow.

A: Unless further stories altering this are written in the future, Darth Vader does not return to Tatooine after the events of Revenge of the Sith and before the events of A New Hope.

A: Vader returned to Tatooine at least once between 19BBY and 0BBY. He was an ally of Jabba the Hutt, and a canon Star Wars comic shows Vader inside of Jabba's Palace with several Stormtroopers. At the beginning of Episode IV, Vader was very near Tatooine during his incursion of the Rebel ship Tantive IV, the vessel that C3PO and R2-D2 escaped from. I believe that Vader chose not to pursue the droids on Tatooine himself because he didn't particularly care about the Death Star battle station or its success.
"Don't be too proud of this technological terror you've constructed. The ability to destroy a planet is insignificant next to the power of the Force." — Darth Vader, Episode IV.
Vader had no compelling reason to go to Tatooine during the events of Episodes IV, V, and VI.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Need to understand how Row() Function works under SUMPRODUCT I had an issue and that is already solved by someone. I want to understand how they solved it.
Here is the link
https://www.excelforum.com/excel-formulas-and-functions/1314166-need-formula-to-post-payments-with-different-dates-frequency-than-column-headers.html#post5320639
I got solution there but I think this platform provides extra explanation of solution, so asking here.
The formula that did the job is as follows:
=IF(MATCH($B7,$C$4:$L$4)<=COLUMNS($C7:C7),IFNA(SUMPRODUCT(--(ABS($B7+(MATCH($A7,{"Weekly","Bi-Weekly"},)*7)*(ROW($A$1:$A$99)-1)-AVERAGE(C$4:C$5))<=(C$5-C$4)/2))*$B$1,$B$1*OR(INDEX(ABS(EDATE($B7,(ROW($A$1:$A$50)-1)*MATCH($A7,{"Monthly","Bi Monthly","Quarterly"},))-(C$4+7))<=7,))),0)

What I don't understand about this formula is why don't we just put 1 in place of '''ROW($A$1:$A$99)''' or '''ROW($A$1:$A$50)'''
It is throwing me nuts

A: ROW($A$1:$A$99) gives 99 results rather than just one result.
The result would be {1;2;3;.......;99}.
So when he entered ROW($A$1:$A$99)-1 the result would be
{0;1;2;.........;98}.
Lets say the result of AVERAGE(C$4:C$5) is 5. Then ROW($A$1:$A$99)-1)-AVERAGE(C$4:C$5) would give
{-5;-4;-3;.......;93}.
MATCH($A7,{"Weekly","Bi-Weekly"},) will give a number. So $B7+(MATCH($A7,{"Weekly","Bi-Weekly"},)*7 will also result in a number. Lets say 10.
Then $B7+(MATCH($A7,{"Weekly","Bi-Weekly"},)*7)*(ROW($A$1:$A$99)-1)-AVERAGE(C$4:C$5) will give 10 * {-5;-4;-3;.......;93} which will give {-50;-40;...;930}.
ABS($B7+(MATCH($A7,{"Weekly","Bi-Weekly"},)*7)*(ROW($A$1:$A$99)-1)-AVERAGE(C$4:C$5)) will remove all minus signs and give {50;40;...;930}.
Lets say (C$5-C$4)/2 is 40. Then (ABS($B7+(MATCH($A7,{"Weekly","Bi-Weekly"},)*7)*(ROW($A$1:$A$99)-1)-AVERAGE(C$4:C$5))<=(C$5-C$4)/2) will result in {FALSE;TRUE;....;FALSE}.
Hope you got the point.


text:
Q: TextBlob --- The `text` argument passed to `__init__(text)` must be a string, not  I faced some issues when I tried to use textblob to analyze 10million data.
For the data, I've also used Vader packages to handle the same data, it worked well.
My original code was:
def textblob_polarity(text):
    polarity = []
    for mess in text:
        mood = TextBlob(mess)
        polarity.append(mood.sentiment.polarity)
    return polarity

textblob_polarity = textblob_polarity(data['body'])
data['textblob_polarity'] = textblob_polarity

However I've got TypeError: The text argument passed to __init__(text) must be a string, not <class 'float'>
I have tried:
def remove_floats(row):
    if isinstance(row, str):
        return row
    else:
        return None

for i in data['body']:
    data['body'].apply(lambda i: remove_floats(i))

But it takes forever and didn't work out.
I also tried:
for i in data['body']:
    i = str(i)

It doesn't work as well. I'll get the same error as I stated in the title of this question.
This is a small sample of the data.

Do you have any ideas? Thank you so much in advance!

A: an update, I've solved the issues.
Simply by adding encoding='utf8' when you read the dataset.


text:
Q: How to transfer POJO object to Ignite table? public class JSONmapper {
    public static class Person{
        @QuerySqlField(index = true)
            int id;
        @QuerySqlField(index = true)
            String name;

    }
    public static void main(String[] args) {
        Map<String,Object> serdeProps =  new HashMap<>();
        serdeProps.put("json.value.type",Person.class);
        final Deserializer<Person> PersonDeserializer = new KafkaJsonDeserializer<>();
        PersonDeserializer.configure(serdeProps, false);

        Properties prop = new Properties();
        prop.put(ConsumerConfig.BOOTSTRAP_SERVERS_CONFIG,"localhost:9092");
        prop.put(ConsumerConfig.KEY_DESERIALIZER_CLASS_CONFIG, StringDeserializer.class.getName());
        prop.put(ConsumerConfig.VALUE_DESERIALIZER_CLASS_CONFIG, PersonDeserializer.getClass().getName());
        prop.put(ConsumerConfig.GROUP_ID_CONFIG,"JSONmapper1");
        prop.put(ConsumerConfig.AUTO_OFFSET_RESET_CONFIG,"earliest");
        KafkaConsumer<String,Person> consumer = new KafkaConsumer<>(prop);
        consumer.subscribe(Collections.singleton("JsonMapper1"));

        IgniteConfiguration config = new IgniteConfiguration();
        Ignite ignite = Ignition.start(config);

        CacheConfiguration<String, Person> cc = new CacheConfiguration<>("PersonCache");
        cc.setCacheMode(CacheMode.PARTITIONED);
        cc.setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL);
        cc.setIndexedTypes(String.class,Person.class);
        IgniteCache<java.lang.String,Person> cache = ignite.getOrCreateCache(cc);

        Map<String, Person> batch = new HashMap<>();
        while(true)
        {
            ConsumerRecords<String, Person> records = consumer.poll(Duration.ofMillis(100));
            for (ConsumerRecord<String, Person> record:records){
                batch.put(record.key(),record.value());
            }
            cache.putAll(batch);
            batch.clear();
        }
    }
}

Hi all I am trying to send JSON data coming out of Kafka to Ignite cache and view it as a table. After running this code I could observe that data is transferred to cache, confirmed this with visorcmd. I triggered sqlline.bat from setup with PersonCache schema as it was showing !tables. But unable to query "Select * from Person". It is giving me error that "Failed to set schema for DB connection for thread".
Please enlight and help regarding this.
SEVERE: Failed to execute SQL query [reqId=2, req=JdbcQueryExecuteRequest [schemaName=PERSONCACHE, pageSize=1024, maxRows=0, sqlQry=select * from PersonCache.PERSON, args=Object[] [], stmtType=ANY_STATEMENT_TYPE, autoCommit=true, partResReq=false, super=JdbcRequest [type=2, reqId=2]]]
class org.apache.ignite.internal.processors.query.IgniteSQLException: Failed to set schema for DB connection for thread [schema=PERSONCACHE]
    at org.apache.ignite.internal.processors.query.h2.H2ConnectionWrapper.connection(H2ConnectionWrapper.java:81)
    at org.apache.ignite.internal.processors.query.h2.QueryParser.parseH2(QueryParser.java:319)
    at org.apache.ignite.internal.processors.query.h2.QueryParser.parse0(QueryParser.java:210)
    at org.apache.ignite.internal.processors.query.h2.QueryParser.parse(QueryParser.java:131)
    at org.apache.ignite.internal.processors.query.h2.IgniteH2Indexing.querySqlFields(IgniteH2Indexing.java:1103)
    at org.apache.ignite.internal.processors.query.GridQueryProcessor$3.applyx(GridQueryProcessor.java:2406)
    at org.apache.ignite.internal.processors.query.GridQueryProcessor$3.applyx(GridQueryProcessor.java:2402)
    at org.apache.ignite.internal.util.lang.IgniteOutClosureX.apply(IgniteOutClosureX.java:36)
    at org.apache.ignite.internal.processors.query.GridQueryProcessor.executeQuery(GridQueryProcessor.java:2919)
    at org.apache.ignite.internal.processors.query.GridQueryProcessor.lambda$querySqlFields$1(GridQueryProcessor.java:2422)
    at org.apache.ignite.internal.processors.query.GridQueryProcessor.executeQuerySafe(GridQueryProcessor.java:2460)
    at org.apache.ignite.internal.processors.query.GridQueryProcessor.querySqlFields(GridQueryProcessor.java:2396)
    at org.apache.ignite.internal.processors.query.GridQueryProcessor.querySqlFields(GridQueryProcessor.java:2354)
    at org.apache.ignite.internal.processors.odbc.jdbc.JdbcRequestHandler.executeQuery(JdbcRequestHandler.java:615)
    at org.apache.ignite.internal.processors.odbc.jdbc.JdbcRequestHandler.doHandle(JdbcRequestHandler.java:310)
    at org.apache.ignite.internal.processors.odbc.jdbc.JdbcRequestHandler.handle(JdbcRequestHandler.java:247)
    at org.apache.ignite.internal.processors.odbc.ClientListenerNioListener.onMessage(ClientListenerNioListener.java:195)
    at org.apache.ignite.internal.processors.odbc.ClientListenerNioListener.onMessage(ClientListenerNioListener.java:49)
    at org.apache.ignite.internal.util.nio.GridNioFilterChain$TailFilter.onMessageReceived(GridNioFilterChain.java:279)
    at org.apache.ignite.internal.util.nio.GridNioFilterAdapter.proceedMessageReceived(GridNioFilterAdapter.java:109)
    at org.apache.ignite.internal.util.nio.GridNioAsyncNotifyFilter$3.body(GridNioAsyncNotifyFilter.java:97)
    at org.apache.ignite.internal.util.worker.GridWorker.run(GridWorker.java:120)
    at org.apache.ignite.internal.util.worker.GridWorkerPool$1.run(GridWorkerPool.java:70)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at java.lang.Thread.run(Thread.java:748)
Caused by: org.h2.jdbc.JdbcSQLException: Schema "PERSONCACHE" not found [90079-197]
    at org.h2.message.DbException.getJdbcSQLException(DbException.java:357)
    at org.h2.message.DbException.get(DbException.java:179)
    at org.h2.message.DbException.get(DbException.java:155)
    at org.h2.engine.Database.getSchema(Database.java:1808)
    at org.h2.engine.Session.setCurrentSchemaName(Session.java:1317)
    at org.h2.jdbc.JdbcConnection.setSchema(JdbcConnection.java:1989)
    at org.apache.ignite.internal.processors.query.h2.H2ConnectionWrapper.connection(H2ConnectionWrapper.java:76)
    ... 25 more

At SQLline end :
Error: Failed to set schema for DB connection for thread [schema=PERSONCACHE] (state=50000,code=1)
java.sql.SQLException: Failed to set schema for DB connection for thread [schema=PERSONCACHE]
        at org.apache.ignite.internal.jdbc.thin.JdbcThinConnection.sendRequest(JdbcThinConnection.java:901)
        at org.apache.ignite.internal.jdbc.thin.JdbcThinStatement.execute0(JdbcThinStatement.java:231)
        at org.apache.ignite.internal.jdbc.thin.JdbcThinStatement.execute(JdbcThinStatement.java:559)
        at sqlline.Commands.execute(Commands.java:823)
        at sqlline.Commands.sql(Commands.java:733)
        at sqlline.SqlLine.dispatch(SqlLine.java:795)
        at sqlline.SqlLine.begin(SqlLine.java:668)
        at sqlline.SqlLine.start(SqlLine.java:373)
        at sqlline.SqlLine.main(SqlLine.java:265)

A: First of all, in order to have an Apache Ignite SQL table based on some POJO, you must do one of the following:
1)If you are going to configure the cache via XML, you must create a custom QueryEntity based on the required POJO types:
https://ignite.apache.org/docs/latest/SQL/sql-api#query-entities
Or you can use special annotations in your POJO object:
https://ignite.apache.org/docs/latest/SQL/sql-api#querysqlfield-annotation
2)Using SQL syntax, you must set the correct key and value types using the following properties:
CREATE TABLE IF NOT EXISTS Person (
  id int,
  city_id int,
  name varchar,
  age int,
  company varchar,
  PRIMARY KEY (id, city_id)
) WITH "template=partitioned,backups=1,affinity_key=city_id, key_type=com.test.PersonKey, value_type=com.test.MyPerson"

https://ignite.apache.org/docs/latest/sql-reference/ddl


text:
Q: Uploading Multiple Attachments into Access and allocating automatically Two days on and I'm ripping my hair out.
I need to upload hundreds of 'png' attachments into a table (i.e. not one by one to each account code) where they automatically find the relevant account code in the table by matching the account code to the attachment file name.
Alternatively I need to upload all the attachments to a single place and then have a search query that allocates these attachments to their specific account codes in a table.
I have been able to come up with a query that allocates ALL of the attachments to ALL of my relevant account codes  but cannot allocate specific attachments using the data filename for reference to a specific account code.
I have also been able to create a form that shows the relevant attachment under the data filename but this will not open from this field when I double click it. When I open the attachment itself from the form it just gives the 'manage attachment' box showing every single attachment for me to select the one I want. This is of no use for my customer.
I'm sure it has to be simple but I have spent ages on this so can anyone please help.
Graham


text:
Q: How to publish data to QuickBook Online using REST or SDK I am trying to build a near to realtime data push to QuickBook Online using SpringBoot. I am very interested to know the possibilities.
Please refer me some samples or documents covering the alternatives.
Thanks in advance...


text:
Q: RightFax 10.5 java integration issue I am trying to do some POC on Rightfax integration with JAVA API. Installed all required components in Rightfax Server (JAVA/XML API) and configured the IIS (took care while installing the rightfax server) while running the sample java program getting following message
here are the details of the output in debug mode

<XML_FAX_SUBMIT java="1" stylesheet="XML_FAX_SUBMIT.xslt" xmlns="x-schema:XML_FAX_SUBMIT.xdr">
<INCLUDE_BEG>xml.beg</INCLUDE_BEG>
    <SENDER>
        <RF_USER>ADMINISTRATOR</RF_USER>
    </SENDER>
    <DESTINATIONS>
        <FAX>
            <TO_FAXNUM>555-7777</TO_FAXNUM>
        </FAX>
    </DESTINATIONS>
    <BODY>
How about some body text.
Line 2
Line 3
    </BODY>
<INCLUDE_END>xml.end</INCLUDE_END>
</XML_FAX_SUBMIT>

Initiating Connection to: http://<name>/rfxml/rfwebcon.dll
RETURN XML:
<?xml version="1.0"?>
<XML_FAX_SUBMIT_REPLY>
    <FAX unique_id="unknown">
        <STATUS_CODE>-1</STATUS_CODE>
        <STATUS_MSG>Failed to load XML into DOM tree.</STATUS_MSG>
    </FAX>
</XML_FAX_SUBMIT_REPLY>
Message Successfully Transported
ID: unknown
`Code`: -1
**Msg: Failed to load XML into DOM tree.**
Ended

could anyone help me if you come across this type of issue or any configuration is missing at Fax Server or IIS side.

A: //Create a outbound fax object
RFaxSubmit faxSubmit= new RFaxSubmit();
//set XMLNS and make sure you have XML_FAX_SUBMIT_schema.xml in your classpath.
faxSubmit.m_FaxDocument.setXMLNS("classpath:XML_FAX_SUBMIT_schema.xml");

This file must be available on your RightFax server, @ this location \RightFax\Production\xml\schemas\XML_FAX_SUBMIT_schema.xml download this file or ask server support and add it in your classpath.


text:
Q: How to pass config file section names as argument in shell script I want to pass the config file section name as a argument or parameter to .sh file.
Can anyone please help me on this?
Below is my shell script and a conf file.
test.sh
#!/bin/bash
    CONFIG=app.conf
    myuser=$(awk '/^\[user1\]/{f=1} f==1&&/^user/{print $3;exit}' "${CONFIG}")
    mypassword=$(awk '/^\[user2\]/{f=1} f==1&&/^password/{print $3;exit}' "${CONFIG}")
    echo $myuser
    echo $mypassword
app.conf
[user1]
user = root
password = root123
[user2]
user = root2
password = root123
[user3]
user = root3
password = root12345

I want a script to be like when I run test.sh user2 It should print the variable values under the [user2] section.
Please help me with this

A: Please take a look
#!/bin/bash
    CONFIG=app.conf
    myuser=$(awk '/^\['$1'\]/{f=1} f==1&&/^user/{print $3;exit}' "${CONFIG}")
    mypassword=$(awk '/^\['$1'\]/{f=1} f==1&&/^password/{print $3;exit}' "${CONFIG}")
    echo $myuser
    echo $mypassword

pass user as an argument.


text:
Q: Has Bose-Einstein theory been considered for dark matter? Has Bose-Einstein theory been considered for dark matter?
The theory would explain why no measurable radiation is emitted due to zero temperature--its lack of interaction with other matter and its gravitational lensing. Yet I haven't seen it considered. Am I missing something or have I totally misunderstood dark matter and/or Bose-Einstein theory?

A: Dark matter is generally believed to be dark because it only interacts with "normal" matter through the weak (and gravity) force. It is interacting, but only weakly so.
BECs interact strongly with normal matter. Indeed one of the problems with making BECs is stopping their interactions with the experimental apparatus from destroying them.
As Ron says, dark matter could form a BEC, at least in patches, but it wouldn't make any significant difference to it's effects on the rest of the universe.
Response to Clive's comment:
As anyone who has watched the Discovery channel will know, there are four forces: electromagnetic, strong, weak and gravity. Normal matter (by normal I mean the stuff around us) interacts using all four forces, but it's conjectured that dark matter does not interact with the electromagnetic and strong forces i.e. it only feels the weak force and gravity. Dark matter was first suggested precisely because in galaxies and globular clusters the gravity seemed to be higher than it should be, so the gravitational interactions of dark matter are extremely important on the large scale. However when you're looking at individual particles the masses are so low that gravity can be ignored, and you're left with just the weak force.
Actually the weak force isn't that weak, but it's extremely short range so two particles interacting by only the weak force would have to get extremely close to interact. The best known of the "weak force only" particles are neutrinos, and they can pass through the entire Earth and hardly notice. Detecting them at all requires enormous detectors like Super Kamiokande. Dark matter particles are expected to interact as weakly as neutrinos, hence the great difficulty in detecting them.
Re the Bose Einstein condensate: a BEC is made from normal matter, but the atoms in it need to be cooled to extremely low temperature so they all fall into the lowest quantum energy state. The spacing between energy levels in a typical BEC is small, so even a small amount of energy will raise atoms above the ground state and destroy the BEC. That's why they are so hard to make. The first BEC had to be cooled to 170 nanokelvin. That's 0.00000017 degress above absolute zero!
A BEC made from dark matter should be easier to make, because it wouldn't be excited and destroyed by passing photons (because photons don't interact with dark matter). With normal matter you need to take extreme care of your BEC.

A: Yes, but for different reasons. Axions are a dark matter candidate predicted to Bose condense.
Reference: P. Sikivie, Q. Yang, "Bose-Einstein Condensation of Dark Matter Axions", Phys. Rev. Lett. 103, 111301 (2009), arXiv:0901.1106.


text:
Q: How to print an array in an array from JSON in Javascript so i am trying to print all the names of the friends array in a single line with commas , ( I am trying to learn JS and JSON and have very less programming knowldge)
here is my data file from the internet
http://www.json-generator.com/
my array
    [
      {
        "age": 25,
        "eyeColor": "blue",
        "name": "Leon Pickett",
        "phone": "+1 (834) 535-2787",
        "balance": "$3,632.41",
        "address": "856 Woodhull Street, Southmont, Wisconsin, 373",
        "friends": [
          {"id": 0,"name": "Bonnie Dudley"},
          {"id": 1,"name": "Blair Hopkins"},
          {"id": 2,"name": "Burris Lara"}
        ],},
      {
        "age": 29,
        "eyeColor": "brown",
        "name": "Rosales Raymond",
        "balance": "$3,632.41",
        "phone": "+1 (935) 462-3887",
        "address": "745 Havens Place, Norvelt, Florida, 6999",
        "friends": [
          {"id": 0,"name": "Theresa Burt"},
          {"id": 1,"name": "Mooney Whitney"},
          {"id": 2,"name": "Hebert Gill"}
        ]}]
here is my code

var xmlhttp = new XMLHttpRequest();
var txt = "jsontst1.txt";

xmlhttp.onreadystatechange = function() {
  if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
    var myArr = JSON.parse(xmlhttp.responseText);
    myFunction(myArr);
  }
};

xmlhttp.open("GET", txt, true);
xmlhttp.send();

function myFunction(arr) {
  var out = "";
  var out2 = "";
  var i, j;
  for (i = 0; i < arr.length; i++) {
    var frndlngth = arr[i].friends.length;

    for (j = 0; j < frndlngth; j++) {
      var frnds = arr[i].friends[j];
      out2 += frnds.name;
    }

    out +=
      "Name = " + arr[i].name + "
" +
      "Age = " + arr[i].age + "
" +
      "Phone = " + arr[i].phone + "
" +
      "Balance = " + arr[i].balance + "
" +
      "Eyecolor = " + arr[i].eyeColor + "
" +
      "Address = " + arr[i].address + "
" +
      "Friends = " + out2 + "
";
  }

  document.getElementById("id01").innerHTML = out;
}

in output the Friends displays value of previous array also ? what am i doing wrong here ?

A: You could use
var stringresult = JSON.stringify(yourobject or array);
Now you could print or alert it like alert(stringresult).

A: Reason is out2 variable is global hence value is being appended in it, not resetting it after outer loop.
Make it local in a for-loop

function myFunction(arr) {
  var out = "";
  var i, j;
  for (i = 0; i < arr.length; i++) {
    var out2 = "";
    var frndlngth = arr[i].friends.length;
    for (j = 0; j < frndlngth; j++) {
      var frnds = arr[i].friends[j];
      out2 += frnds.name;
    }
    out +=
      "Name = " + arr[i].name + "
" +
      "Age = " + arr[i].age + "
" +
      "Phone = " + arr[i].phone + "
" +
      "Balance = " + arr[i].balance + "
" +
      "Eyecolor = " + arr[i].eyeColor + "
" +
      "Address = " + arr[i].address + "
" +
      "Friends = " + out2 + "
";
  }
  document.getElementById("id01").innerHTML = out;
}
var input = [{
  "age": 25,
  "eyeColor": "blue",
  "name": "Leon Pickett",
  "phone": "+1 (834) 535-2787",
  "balance": "$3,632.41",
  "address": "856 Woodhull Street, Southmont, Wisconsin, 373",
  "friends": [{
    "id": 0,
    "name": "Bonnie Dudley"
  }, {
    "id": 1,
    "name": "Blair Hopkins"
  }, {
    "id": 2,
    "name": "Burris Lara"
  }],
}, {
  "age": 29,
  "eyeColor": "brown",
  "name": "Rosales Raymond",
  "balance": "$3,632.41",
  "phone": "+1 (935) 462-3887",
  "address": "745 Havens Place, Norvelt, Florida, 6999",
  "friends": [{
    "id": 0,
    "name": "Theresa Burt"
  }, {
    "id": 1,
    "name": "Mooney Whitney"
  }, {
    "id": 2,
    "name": "Hebert Gill"
  }]
}];
myFunction(input);

Fiddle Demo


text:
Q: Dynamic pivot of Row Value to Column header in Hive I have date value row wise like in this format
7/7/2017
7/14/2017
7/21/2017
7/28/2017
8/4/2017
8/11/2017
8/18/2017
8/25/2017
9/1/2017
9/8/2017
9/15/2017
9/22/2017
9/29/2017
10/6/2017
10/13/2017
10/20/2017
10/27/2017
11/3/2017
11/10/2017
11/17/2017
11/24/2017
12/1/2017
12/8/2017
12/15/2017
12/22/2017
12/29/2017

I want to transform it as column header without manually entering each value in my Hive code. Can i able to do it if yes please help me out.


text:
Q: prove the definition of limits of function Let a ∈ R and let f be a real-valued function defined J \ {a} where J is an open interval containing a.
Also, let L ∈ R. Then
limx→a
f(x) = L
if and only if for all  > 0 there exists δ > 0 such that
|f(x) − L| <  whenever 0 < |x − a| < δ
for x ∈ J
I was trying to prove this theorem, but I just used "f is continuous at a iff limf(x)=f(a)=L". Is it correct?

A: Well, I'm not sure what definition you are using, because what you have to prove is what I have learned as the definition. So I'm only assuming that the definition you're working with is the following: the limit of function in a point $a$ is $L$ iff for each sequence $(x_n)$ in $J\setminus\{a\} $ with limit $a$ we have that $\lim_{n\to\infty}f(x_n)=L$.
So what I would do is assume that $\lim_{x\to a}f(x)=L$, yet there exists $\epsilon>0$, such that for each $\delta>0$, we have that $0<\vert x-a\vert<\delta$ and yet $\vert f(x)-f(a)\vert\geq\epsilon$. Now what kind of sequence can you construct with this? We can consider the sequence $(x_n)$ in $J\setminus\{a\}$ such that for all $n\in\mathbb N$, it holds that $0<\vert x_n-a\vert<\frac{1}{n}$. (Why can we do this?) From there on it is possible to derive a contradiction. (Note: this only proves the "$\implies$" direction!)


text:
Q: Why do we need Monad Transformers in Scala? My understanding is the following:
Suppose M1 and M2 are monads, i.e. they provide functions unit and flatMap that comply to the monadic laws. Unfortunately we cannot create unit and flatMap for M1[M2] . It looks like the unit and flatMap don't always exist for any M1 and M2. I do not know if we need to prove it.
So the solution is to create a wrapper W for M1[M2], so that W[M1, M2] is a monad, and use it instead. This wrapper W is called Monad Transformer.
Do I understand it correctly ?

A: You are right. Typically they are used in for-comprehension constructions where you need to combine monads properties.
Monad transformers "step-by-step" here.


text:
Q: ImportError nltk.corpus :pil I cannot import pil (The Patient Information Leaflet (PIL) Corpus) and I already checked my nltk's version is 3.2.5.
    import nltk
    from nltk.corpus import pil

I can import other corpus libraries (like brown, twitter_samples etc), but I have no idea why I cannot import this one >.<
    from nltk.corpus import pil
    ImportError: cannot import name pil

The downloader shows this package has downloaded.
downloader screenshot


text:
Q: How to Override standard close (X) button in a Windows Form How do I go about changing what happens when a user clicks the close (red X) button in a Windows Forms application (in C#)? I want to add a simple DialogResult and Messagebox to ask user if he's sure about closing the form.

A: You should handle the FormClosing event on the Form class. In the handler, you are able to set the value of the CancelEventArgs.Cancel property to true to prevent closure of the form.
Example:
private void Form1_FormClosing(object sender, FormClosingEventArgs e)
        {
            if (MessageBox.Show("Close?", "Close", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
                e.Cancel = true;
        }

You can create the handler method by double-clicking the event in the Properties tab while the Windows Forms designer is open:

See https://learn.microsoft.com/en-us/dotnet/api/system.windows.forms.form.formclosing?view=windowsdesktop-6.0


text:
Q: Supporting the new Android plugins APIs I'm working with flutter and I'm getting this error while I was trying to add lutter_bluetooth_serial to the pubspec.yaml. This is the error that I get.-->"The plugin flutter_bluetooth_serial uses a deprecated version of the Android embedding.
To avoid unexpected runtime failures, or future build failures, try to see if this plugin supports the Android V2 embedding. Otherwise, consider removing it since a future release of Flutter will remove these deprecated APIs.
If you are plugin author, take a look at the docs for migrating the plugin to the V2 embedding: https://flutter.dev/go/android-plugin-migration."
---->I don't know how to solve this issue Can you help???

A: try this, add this line flutter run --no-sound-null-safety
Run → Edit Configurations → Add Additional Run args → --no-sound-null-safety


text:
Q: Programming Practice: Java Logger (log4j) In Java, for creating a logger, instead of calling
private static final Logger logger = LoggerFactory.getLogger("ClassName");

I have created a utility method which returns the class name from the stack trace and call that method.
private static final Logger logger = LoggerFactory.getLogger(Utilities.getInvokingClassName());

Utilities.java:
public static String getInvokingClassName()
{
    return new Throwable().getStackTrace()[1].getClassName();
}

The cons is obviously that I am using a resource-intensive process while the pros is that I have higher modularity while coding. The question is how big is the impact on performance by this? If it is not too resource-consuming, then why is it not a standard practice?

A: It's not a large performance hit, but it's probably not used because it overcomplicates a pretty simple scenario. Your code might be a little more modular, but it becomes harder to read and understand.

A: you can create a loggers by passing them a Class object.  whenever I get a logger, I usually do this:
public class Foo {
    private static final Logger LOG = LoggerFactory.getLogger(Foo.class);
...

which is easier than typing the class name, and usually benefits from quick find replace and IDE code assist.  I think your approach might be a bit too tricky and hard to read for its own good.

A: Indeed I think you are over complicating your self a bit, since you can do something easier like this:
this.getClass().getName()

Then you could just re-write it to this:
Logger logger = LoggerFactory.getLogger(this.getClass().getName());

And that's it.


text:
Q: Change value of specific textbox by using pulldown menus and javascript hope someone can help me out here.
i would like 2 pulldown menus to change the value of a textbox, but with certain conditions.
ill explain after the code, as a start this is what i have now, but im struggling :
    <select class="select" name="pafgifte" id="pafgifte" onchange="updateInput()">
    <?php for ($i = 0; $i <= 500; $i++) : ?>
        <option value="<?php echo $i; ?>"><?php echo $i; ?></option>
    <?php endfor; ?>
</select>

<select class="select" name="pstatus1" onchange="updateInput()">
<option selected value="2">Order</option>
<option value="1">Onstock</option>
</select>

<input type="text" maxlength="6" name="pontvangen" size="1" value="0">

<script>
function updateInput(){
    var pafgifte = document.getElementsByName("pafgifte")[0].value;
    var pstatus1 = document.getElementsByName("pstatus1")[0].value;
    document.getElementsByName("pontvangen")[0].value = pafgifte;

}

</script>

If you change the value of the selectbox pafgifte i would like that value to be copied to textbox pontvangen value (ok this is easy)
but then when i change the selectbox pstatus1 and the selected value=1 (Onstock) i want the textbox value pontvangen to be 0, but then when i reselect value=2 (Order) i want the textbox pontvangen value to be the selected value of pafgifte.
I would like the values of pstatus1 (1 and 2) intact because these are saved into a table in the database.
Is there an easier way to do this?
Could someone help me out here?, help would be appreciated :-)

A: You can do with this function:
function updateInput(){
    var pafgifte = document.getElementsByName("pafgifte")[0].value;
    var pstatus1 = document.getElementsByName("pstatus1")[0].value;
    document.getElementsByName("pontvangen")[0].value = pstatus1 == 1 ? '0' : pafgifte;
}


text:
Q: Box-Cox, Exogenous Variables and Time Series Models I am building time series models using SARIMAX from Statsmodels (Python).
The independent variables in my models include 3 to 5 exogenous variables that are other than the target variable I am trying to predict.
I am finding that there is some value in using Box-Cox to transform my target (i.e. independent) variable.
In these cases, should I also be applying the same Box-Cox transformation to my exogenous variables?
(I believe the answer is no.)


text:
Q: How to get swfupload to work with Asp.Net MVC 2 I'm trying to use the swfUpload jquery/flash plugin for uploads, and I'm following the approach by Steven Sanderson (http://blog.stevensanderson.com/2008/11/24/jquery-ajax-uploader-plugin-with-progress-bar/ ). But I can't get it to work. It works fine in the sample application I downloaded from his site. Just to try to get it to work I have tried to copy his page and everything directly in my application, but it still doesn't work.
Here's the page:
<%@ Page Language="C#" Inherits="System.Web.Mvc.ViewPage" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

    <title>File upload</title>
        <link rel="Stylesheet" href="../../Content/Site.css" />
<%--        --%>

            <form enctype="multipart/form-data" method="post">

Your profile

(In a real app, other form controls would appear here)

                    Upload your photo: <input type="file" id="photo" name="photo" />

                <input type="submit" value="Save my profile" />
            </form>

And here's the action method:
    public Guid AsyncUpload()
    {

        return _fileStore.SaveUploadedFile(Request.Files[0]);
    }

This is in a CustomersController controller, and I have this at the beginning of the controller:
private IFileStore _fileStore = new DiskFileStore();

Just as he does in his sample. Of course I also have the IFileStore interface and DiskFileStore class in place.
I have all the references to the js files and css in the head tag:

<title>File upload</title>
    <link rel="Stylesheet" href="../../Content/Site.css" />

(Although I have used the latest jQuery I have, rather than 1.2.6 which he had in his sample). I know at least that the scripts are triggered, because in FireBug I can see that the input is dynamically changed to a flash object, as it's supposed to be.
The thing is, AsyncUpload() is never even called. I set a breakpoint there which is never reached. And I'm getting different errors. The first time I tried it I got a 302 error in an alert box from the script. (At that time I had other jQuery scripts on the same page, so I started over with a cleaner page using just these scripts). But now I'm not getting any error, I can choose image and all, but then it just stops at the stage where the text says "Uploading...", but I don't see the progress bar or anything, and it never finishes.
Any ideas what I'm doing wrong?

A: use below CSS for fixing Firefox issue
DIV.ProgressBar {
    width: 100px; padding: 0; border: 1px solid black; margin-right: 1em;
    height:.75em; margin-left:1em; display:-moz-inline-stack;
    display:inline-block; zoom:1; *display:inline;
}
DIV.ProgressBar DIV {
    background-color: Green; font-size: 1pt; height:100%; float:left;
}
SPAN.asyncUploader OBJECT {
    position: relative; top: 5px; left: 10px;
}

A: It turned out the problem was it didn't work in Firefox, only IE (for a change...). Something with cookies. For anyone that's interested, see the comments section in Steven Sanderson's blog that I referred to above!


text:
Q: Occupancy Sensor for Arduino I working on a home (rather room) automation system using a Raspberry Pi as 'brain' and an Arduino as sensor board.
I find it quite difficult to come up with a solution to reliably track if a person is currently inside the room or not (to trigger the lights).
Here are my current ideas and what I think about them:

*

*PIR: only for movement detection, probably can't see when I'm sitting at my desk: would need to wave to the sensor every once in a while.

*Door counter: not reliable if someone decides to turn on his heels.

*camera: too difficult to program reliably.

*IR thermo array: probably the most reliable, but expensive for high resolution, not sure if something about 4x16 would be enough.  [Edit] I have found that the Panasonic Grid Eye 8x8 thermopile sensor (~30$)  is advertised by Panasonic themselves as that it could span a whole room and indicate the position of a person in the room. Even though I think that this won't work for the entire room, it will surely be enough to get a nice movement vector in the area of the door if someone enters or leaves the room (if the sensor is faced more to the door instead into the whole room).

*microwave sensor: haven't really found information about sensitivity in comparison to PIR.

Does anybody have some more ideas or thoughts on the ones listed above?

A: Combining the outputs from a few simple sensors such as a PIR, sound sensor, door switch, etc., might work well.  You could set a different delay time for each and OR the results.  So if you haven't moved, burped, or opened a door in a long while your either sleeping, not home, or just plain dead.  (Its lights out in all cases.)

A: This subject is called presence detection and is very tricky. As stated in other answer, you should combine different inputs to try guessing if someone is in the room or not.
I recommend you go for higher level of programming (meaning interfase the arduino with a PC or rpi), and use some more calculations like probabilities and such, to enrich the output. I don't think a simple OR would do the trick.
Is it acceptable for people accesing the room to have an RFID tag or other wireless form of identification on them? Have you consider using ambient noise as an input too?

A: One way would be using a person's smartphone's Wi-Fi to track where he/she is. It is an existing technology called Wi-Fi positioning system (WPS). The way it works is that you connect to the Wi-Fi hub (use the R-Pi for this, loads of material online on how to convert it into a Wi-Fi hub) in the house/room and then the Wi-Fi hub keeps measuring the intensity of the receiving signal from your smartphone. Then based on the intensity of the signal it approximately detects your position in a house/room.
One more way is a through a similar thing called Bluetooth positioning system (BPS). I believe Apple had used this technology in manufacturing a product called iBeacon. It works on the same principle as the WPS. I think bluetooth is better suited to your application since it uses less power and detects proximity instead of location. I guess if you only want to switch on the lights in a room, detecting proximity would be enough.
Both of these methods would be implementable with the help of an Arduino and a Raspberry Pi.
The only drawback of these methods are that if you go for a large scale implementation .i.e for the whole house, then you end up using a large amount of Wi-Fi/Bluetooth nodes for better accuracy. But for a room it's a good enough solution.


text:
Q: Master pages through design manager, how to manage different sharePoint controls on different places in the master page In SharePoint 2013, Client has a requirement to place different SharePoint controls on different places in the master page. How to control this situation when through design manager we can manage how to place different SharePoint controls on different places in the master page?

A: In SharePoint 2013, you have the flexibility to use HTML file to edit the master page and it will be converted to .master file automatically.
That means you can edit the .html version of master page in any Editor (Text editor or Html editor like Notepad++, Dreamweaver, Visual Studio etc.). During editing you can place different SharePoint controls on different location and upload this .html file in SharePoint master page library with correct content type. From design manager you can convert your .html version of master page to .master file and check preview. On preview you have the option to move to Snippet Gallery, this gallery allows you to generate SharePoint controls to place in .html version.

A: Yes you can, You need to build custom master pages using visual studio 2013. deploy the wsp to server.


text:
Q: Mac App: 'Auto Loading' the last used Document I'm currently writing a document based application, and was curious to how I would load the most recently used document ('File > Open Recent'section) by default at application startup? Any good info on this or code snippets? New to Obj-C
Thanks,
Zach

A: In your application delegate, you'd want to implement applicationShouldOpenUntitledFile:
- (BOOL)applicationShouldOpenUntitledFile:(NSApplication *)sender
{
    NSURL *lastURL=[[[NSDocumentController sharedDocumentController] recentDocumentURLs] objectAtIndex:0];
    if (lastURL!=nil)
    {
        [[NSDocumentController sharedDocumentController] openDocumentWithContentsOfURL:lastURL display:YES error:nil];
        return NO;
    }

    return YES;
}

Apparently, the default NSDocument-based cocoa app in XCode doesn't come with an AppDelegate.  Weird.  To add one:

*

*Add a new class to your Project, call it MyAppDelegate, or whatever you want.

*In the interface for MyAppDelegate, add the protocol NSApplicationDelegate, it should look something like this:
@interface MyAppDelegate : NSObject<NSApplicationDelegate>
{
}

*Open up MainMenu.xib

*Drag an Object instance to the xib's window, the Object instance looks like a blue box.

*Select the Object instance and in the inspector, go to the Identity tab (the blue i)

*Set the Class to MyAppDelegate

*Select the "Application" in the xib

*In the inspector, click on the Connections tab (the blue arrow icon) and drag from "delegate" to the application delegate you just set up.

You are good to go now.

A: So the above code is almost perfect.  The only problem I ran into is that if this is a new application, then the list of recentDocumentURL's may be empty (or nil), so the ask to get objectAdIndex:0 of a nil array will cause problems.  I would suggest putting the following code right after the method declaration.
NSArray *list = [[NSDocumentController sharedDocumentController] recentDocumentURLs];
if ((list == nil) || ([list count] == 0))
    return YES;

The error I am trying to avoid is as follows:

2014-01-28 17:02:33.042 jNotebook[8144:303] * -[__NSArrayM objectAtIndex:]: index 0 beyond bounds for empty array


text:
Q: Remove old attribute code This is my first time asking a question on the forum whereas I've found many answers before I haven't been able to find an answer to the following:
I am working for an online store and have been working with configurable products, creating attributes and so on. The problem came up when I had created an attribute for a product and everything was fine until I deleted the attribute before disassociating it from the product itself. Now I have quite a few products that are crashing the store when I enable them as the old attribute code is still being associated with these products.
I was able to find on Stack that this is what is causing it and have found the errant attribute code. I tried recreating the old attribute but obviously it assigns a new code.
I used Magento store Manager CustomSQL to discover the attribute code but it wont let me change anything or delete.
My question: How can I delete the old attribute code from the database?

A: Thanks Fabian for your answer.
This is the solution I found:
It turns out that it was a problem with orphaned attributes. The deleted attribute's association to the products was still in the catalog_product_super_attribute database. Which was causing the crash.
Based on other answers to other questions in the forum this is the solution I found:
The first 2 are from this link https://stackoverflow.com/questions/16942701/getid-on-a-non-object
The 3rd comes from this post https://stackoverflow.com/questions/5291572/in-magento-is-there-a-way-to-remove-attribute-from-configurable-product-after-a

*

*I used this SQL command

select * from catalog_product_super_attribute where product_id=productid

to identify the attributes associated with the products

*I then used

select attribute_id,attribute_code from eav_attribute where
  attribute_id=ID or attribute_id=id

to show the name associated with ID to verify I found the correct
attribute.

*Lastly this command

DELETE FROM catalog_product_super_attribute WHERE attribute_id =ID

to remove the problem orphaned attribute ID

A: This sounds as you have a problem with your database.
Theoretically all entries in catalog_product_entity_* should be deleted, because they all have a foreign key on the eav_attribute.
You should check, whether theses foreign keys exists.
What you can try is query the different catalog_product_entity_* tables and check for entries which doesn't have any representation in eav_attribute, delete these entries.


text:
Q: What is the difference between quiet and quiescent? What is the difference between quiet and quiescent (adjectives)?

A: Someone or something that is quiescent is quiet and inactive (mind that the word is literary and not used as frequently as "quiet" is). For example:

Strikes were headed by groups of workers who had previously been quiescent (= they were not so active and didn't express their
  dissatisfaction).

"Quiet" can describe a person, thing, place, situation, time or even colors (consult the Dictionary for all the meanings).
If it comes to making little noise, "quiet" is commonly used:

Tania kept the children reasonably quiet and contented (= the children didn't make much noise).

So, if you are quiet, you don't make noise or you don't say anything at all. If you are quiescent, you are inactive, you "go with the flow".


text:
Q: How can I pass a lambda/std::function/Functor to a variadic function I have a variadic function like this:
template <class... PickComponents, size_t... PickComponentIndices>
void iterateEntitiesInternal(
  const std::function<void(Entity, const PickComponents &...)> &iterFn,
  std::index_sequence<PickComponentIndices...> sequence
);

template <class... PickComponents>
void iterateEntities(const std::function<void(Entity, const PickComponents &...)> &iterFn) {
  iterateEntitiesInternal(iterFn, std::index_sequence_for<PickComponents...>{});
}

I want to be able to call the function like this:
iterateEntities<A, B, C>([](Entity entity, const auto &c1, const auto &c2, const auto &c3) {
  // ...
});

Is there a way I can make this work? I tried creating a template structure like:
template <typename T> struct IterFnType { typedef T type; };

and using it like this:
template <class... PickComponents>
void iterateEntities(const typename IterFnType<std::function<void(Entity, const PickComponents &...)>>::type &iterFn);

But it gives me a compiler error in GCC:

error: 'typename liquid::EntityStorageSparseSet::IterFnType' names 'template<class ... ComponentTypes> template struct liquid::EntityStorageSparseSet::IterFnType', which is not a type

What is the correct way of passing lambdas to variadic functions?


text:
Q: What is netgear ProSAFE and where can I find documentation of this feature? I have several netgear switches with ProSAFE feature, but the only piece of official information about ProSAFE i found is this:
https://kb.netgear.com/31233/What-is-a-ProSAFE-Web-Managed-Switch

NETGEAR ProSAFE Web Managed Switches (previously called ProSAFE Unmanaged Plus Switches) are an upgrade from unmanaged switches. ProSAFE Web Managed Switches are plug-and-play for easy deployment, but also support additional configuration and monitoring features using a web browser-based GUI.

But nowhere can I find information on how to use it or what the feature set is.
Can anyone explain the feature, how to use it and maybe where to find documentation on it?

A: It's not a feature, it's simply a name for that product line of switches.


text:
Q: Opening site links new tabs causes IE8 to render them in quirks mode I having an issue with a ASP.NET site, and after searching for a couple of hours I could not find the answer.
I am working on a intranet site, and in both the production and the development enviroments, when I middle click a link to open in a new tab, that tab is rendered in quirks mode in IE8. Chrome opens fine, and if I followed the link without opening in a tab it opens in the normal mode.
There were a few tests that I did where I opened multiple tabs to the same page quickly, and every now and then the page would open fine.
I can't find any reason for this, the only thing that come to mind is maybe the server is not serving the pages correctly all the time when the page is opening in a tab, but I do not see how it would work sometimes, and not others.
Thanks,
Phil
P.S. I ensured that there is no blankspace above my DOCTYPE tag.

A: Turns out it was the LastPass Extension that was causing my problems. After I created a basically empty site and I was still having difficulties, I decided on a whim to goto Google and middle click one of there internal links. Sure enough it came up in Quirks mode. I went to another computer of mine, same thing. So I reset all settings on browsers, disabled all extensions and voila! links opened up fine.
I'll be writing a support request to LastPass, as I love this extention. Thanks for all your help!

A: You are on an inTRAnet site.
IE by default thinks you want this site to render in compatibility mode.
Ok, so there are a few approaches.

*

*Turn off compatibility in IE for the site in question

*Add a meta tag

*Get real funky... Force "Internet Explorer 8" browser mode in intranet
In depth:

*

*Alt > Tools Menu > Compatibility view settings > Uncheck: "Display intranet sites in Compatibility View".

*Adding the following META tag as one of the first lines in the page's head section should do the trick.
<meta http-equiv="x-ua-compatible" content="IE=8">
The meta element can appear below a title element and other meta elements; however, it must precede other elements in the section.

Unfortunately there really isn't an easy answer to this question. I wish MSFT had gone standards by default across all sites in IE8 - and let sites (internal or external) opt out as desired.
For full-on scary OMG fun... check out this flow chart of how IE determines document/rendering mode:


text:
Q: Read value of non-blocking update in current simulation time When writing testcases for synchronous register updates in Verilog, I would like to verify the values assigned to those registers in the current time step. For example (although $display is used in this example, I would like to be able to substitute it with any code that evaluates counter):
reg clk = 'b0;
always #10 clk = !clk;

reg [7:0] counter = 0;
always @(posedge clk) counter <= counter + 1;

initial begin
    $monitor("monitor %0t, %0d", $time, counter);

    @(posedge clk);
    $display("display %0t, %0d", $time, counter);

    @(posedge clk);
    $display("display %0t, %0d", $time, counter);

    $finish;
end

Simulating this code will print

monitor 0, 0
display 10, 0
monitor 10, 1
display 30, 1
monitor 30, 2

So, at any particular time step, $display sees a different value of counter than $monitor. Importantly, the value seen by $display is the previous value of the register. This makes writing testcases difficult.
The reason for this behavior is that evaluation events (e.g., the evaluation of counter inside display) are executed before non-blocking assignment events (e.g., the update of counter) and $monitor events are executed after that (IEEE Standard Verilog® HardwareDescription Language, Chapter 5)
I came up with the following work-around:
reg non_blocking_reg = 'b0;
always @(posedge clk) non_blocking_reg <= !non_blocking_reg;
reg updates_done;
always @* #0 updates_done = non_blocking_reg;

What this code does is the following:

*

*non_blocking_reg is a register that gets synchronously updated on every clock cycle;

*updates_done is a register that is procedurally assigned to non_blocking_reg. This causes an update of non_blocking_reg to schedule an update event for updates_done. The explicit zero delay (#0) ensures that this update event is scheduled in the inactive event queue and thus executed after all non-blocking assignment events;

*Therefore, waiting for change events of updates_done waits until all synchronous register updates are executed.

Using this work-around, my original code can be written as follows:
initial begin
    $monitor("monitor %0t, %0d", $time, counter);
    @(updates_done);

    @(updates_done);
    $display("display %0t, %0d", $time, counter);

    @(updates_done);
    $display("display %0t, %0d", $time, counter);

    $finish;
end

And prints what I want:

monitor 0, 0
display 10, 1
monitor 10, 1
display 30, 2
monitor 30, 2

Since a assume this is a common problem when writing test cases in Verilog, my first question is whether there is a better way of doing this? And if not, is my approach correct?

A: This is exactly what $strobe is for. Both $strobe and $monitor wait until the postponed event region to render their output. The postponed event region is the last point before the simulation time gets updated to the next timestamp.


text:
Q: Webscraping using VBA excel Which code should I use to extract price from this HTML code? I would like to get element either by

*

*Id

*tagname

*classname

Website url: https://www.tatacliq.com/vivo-v5-32gb-gold-4-gb-ram-dual-sim-4g/p-mp000000000734559
Let's say I want to fetch data for "price" in below HTML (i.e. get this "14999"):

    14999.00
    INR
    <meta itemprop="itemCondition" content="http://schema.org/NewCondition"
    />
    <meta itemprop="availability"
    content="http://schema.org/InStock"/>Available online</meta>

Here is my code:
    Function Scraptatacliq(tatacliq_url As String, the_display_price As String, the_display_seller As String)

    ''MsgBox "Inside the function"

    'Dim objIE As New InternetExplorerMedium
    Scraptatacliq = ""
    If tatacliq_url = "" Then Exit Function

     the_display_price = ""
     the_display_seller = ""

    'MsgBox tatacliq_url
     the_start:

    Dim objIE As Object
    Set objIE = CreateObject("InternetExplorer.Application")
   'Set objIE = New InternetExplorerMedium
    objIE.Top = 0
    objIE.Left = 0
    objIE.Height = 800
   'objIE.Visible = True
    objIE.Navigate (tatacliq_url)

  'MsgBox tatacliq_url

  Do
  DoEvents
  If Err.Number <> 0 Then
  objIE.Quit
  Set objIE = Nothing
  GoTo the_start:
  End If
  Loop Until objIE.ReadyState = 4

 'Loop
  Count = 500000
  Do
  If Count <> 0 Then
  Count = Count - 1
  End If
  Loop Until Count = 0

 'EXTRACT DISPLAY PRICE
 'On Error Resume Next
 'MsgBox "I am about to extract display price"
  Set the_input_element =       objIE.Document.getElementById("spPriceId").getElementsbyTagName("price")
  product_display_price = the_input_element.innertext
 'MsgBox product_display_price
 'If product_display_price = "" Then
   '    Set the_input_element =
   objIE.Document.getElementById("product_list_price")
 '      product_display_price = the_input_element.innertext
  'End If

[ Placeholder to explain what is currently going wrong with my code ]

A: There is something happening with javascript that I cannot understand, and might change the way you can scrap your thing.
Here, it is possible to scrape the price with outertext once you have objIE.Document.getElementById("spPriceId"):
Function Scraptatacliq(tatacliq_url As String)
  Scraptatacliq = ""
  If tatacliq_url = "" Then Exit Function
  the_display_price = ""
  the_display_seller = ""

the_start:
    Dim objIE As Object
    Set objIE = CreateObject("InternetExplorer.Application")
    objIE.Top = 0
    objIE.Left = 0
    objIE.Height = 800
    objIE.Navigate (tatacliq_url)

  Do
    DoEvents
    If Err.Number <> 0 Then
      objIE.Quit
      Set objIE = Nothing
      GoTo the_start:
    End If
  Loop Until objIE.ReadyState = 4

  objIE.Visible = True
  Set the_input_element = objIE.Document.getElementById("spPriceId")
  product_display_price = the_input_element.outertext
  MsgBox product_display_price

End Function

Another solution might be cleaner if you can see what happens if you deactivate javascript


text:
Q: What is the next step to take when receiving this mysqldiff error? I have a MySQL database that has been in production and saved and restored  a few times with phpmyadmin and mysqldump/restore.
I suspect the "production activity" has introduced some discrepancies  between this DB structure and any new "pristine" database that was created from the original schema defining SQL.
when I try to compare the production DB against a brand new instance, using mysqldiff, I get:
$ mysqldiff --server1=root@localhost dev_si_brand_new:prod_si
# server1 on localhost: ... connected.
# Comparing `dev_si_brand_new` to `prod_si`                        [FAIL]
# Object definitions differ. (--changes-for=server1)
#

--- `dev_si_brand_new`
+++ `prod_si`
@@ -1 +1 @@
-CREATE DATABASE `dev_si_brand_new` /*!40100 DEFAULT CHARACTER SET latin1 */
+CREATE DATABASE `prod_si` /*!40100 DEFAULT CHARACTER SET latin1 */
Compare failed. One or more differences found.

From the mysqldiff documentation

When a database pair is specified, all objects in one database are compared to the corresponding objects in the other. Any objects not appearing in either database produce an error.

Is it possible to get debug info?
What do I need to do to generate a useful diff report?
Note: I am running

*

*mysql  Ver 14.14 Distrib 5.5.43

*Ubuntu linux

A: mysqldiff is just telling you that you have a difference between both DB, regarding the DB name : dev_si_brand_new versus prod_si.
If you don't want mysqldiff stops at the first difference encountered and continue the comparison, just add the --force argument to your command line :

--force
Do not halt at the first difference found. Process all objects to find
  all differences.

mysqldiff --force --server1=root@localhost dev_si_brand_new:prod_si


text:
Q: How do I sort the files by name? Can NiFi sort the retrieved files by filename?
I'm trying to use the EnforceOrder processor but cannot figure this out.
There are no questions in this forum on something as basic as 'sort by filename' 'sort by file name'.
I'm using a GetFile to pull in *.json files.
I'm just looking into how to do some basic things such as sort by name, if filename contains a date then sort by that file name converted to a date, sort by actual date of file, group by regexp and then sort etc.
Update
I've tried to use the "UpdateAttribute" to carry through the file name and specify that as the initial order but that is invalid as it is not a number.
I've tried to also use the file.lastModifiedTime in the Initial Order but that fails too.
How do you sort the files by their name?


text:
Q: Is the "Moebius Stairway" Graph Already Known? It is a wellknown fact, that Moebius Ladder Graphs have $2n$ vertices, but nowhere could I find any hint of how to generalize them to Graphs with $2n+1$ vertices.
Last week I had the idea of giving up the restriction to cubic graphs and arrived at glueing together the two ends of triangle strips with $2n+1$ triangles in the "Moebius manner", i.e. with a twist.
The result is

*

*a $4$-regular graph

*with exactly two edge-disjoint Hamiltonian cycles if $2n+1\ge 7$ , which contrasts the situation of Moebius Ladders, where the number of Hamiltonian cycles is different for each size and given by A124356 - OEIS and none contains a pair of edge-disjoint Hamiltionian cycles.

*the chromatic number is $5$ for $5$ vertices and $4$ for all other cases of $2k+1$ vertices, again contrasting the situation of Moebius Ladders, where it is $2$ for $4k+2$ vertices and $3$ for $4k$ vertices (for 4 vertices it would also be $4$, but $K_4$ is normally not considered to be a Moebius Ladder)

Question:
Have those Moebius Stairway graphs been described or studied already, i.e.  are further special properties known?

As a remark let me explain the  name "Moebius Stairway" graph: if the triangles are chosen to be isosceles right triangles and the strip is then drawn in an ascending $45^{\circ}$ angle, it looks somewhat similar to a stairway and, besides that, I liked the idea of providing an alternative to ladders.

A: I don't know if this family has a special name, but it is a simple type of circulant graph. Consider this way to draw it (for 9 vertices).

I don't know why you say it has only two hamiltonian cycles as it has many (82 in fact).  Here's one beyond the two obvious ones: 0,1,5,4,3,2,6,7,8.
For $n=5,7,9,\ldots,37$, the number of hamiltonian cycles is 24,46,82,158,316,650,1364,2892,6170,13206,28314,60760,130446,280120, 601600,1292102,2775226,5960822.
Not in OEIS.  Can you fit a formula or recurrence to it?
[Added] David Zhang has found an empirical recurrence for the numbers, which I'm sure is correct. Also, he is correct that I counted each cycle once in each direction -- I used a program designed for digraphs.  I'll divide by 2 from now on. We can solve the recurrence with Maple's help.  Let $\omega_1,\omega_2,\omega_3$ be the zeros of $x^3+2x^2+x-1$.  Then the number of cycles for $n=2k+1$ (if the recurrence is correct) is
$$ 2 + 2k + \sum_{j=1}^3 \frac{1}{(\omega_j+1) \omega_j^{k+1}}.$$
Approximate values are: $\omega_1=0.4655712319$,
$\omega_2,\omega_3 = 1.232785616\pm 0.7925519925i$.
Obviously the terms with $\omega_2$ and $\omega_3$ quickly become negligible. From $n=7$ onwards, the number of cycles is the nearest integer to
$$ 2 + 2k+ \frac{1}{(\omega_1+1) \omega_1^{k+1}}.$$

A: I think Gerry's right; this is the construction that Kocay & Kreher in Graphs, Algorithms, and Optimization call the Möbius lattice (definition 13.18 on p. 365 of the 2004 edition, definition 15.21 on p. 403 of the 2016 edition, just after Möbius ladder).  Their projective embedding of $L_7$ below corresponds to your graph (with appropriate vertex labels).

(The dotted line and $D_i$ are about changing this to a toroidal embedding.)
It doesn't seem like their name for this family of graphs is widely used; I found one undergraduate thesis mention it in an aside and some possibly relevant physics research.
As to further study, Möbius lattices come up in two exercises of Kocay & Kreher:
(1) Show that the Möbius ladder $L_{2n-2}$ is a minor of the Möbius lattice $L_{2n+1}$ for $n \ge 3$.
(2) Show that the Möbius lattice $L_{2n-1}$ has an embedding on the torus in which all faces are quadrilaterals.

A: This is the square of an odd cycle.  If you found it as a spanning subgraph of another graph you might call it the square of a Hamilton cycle.  There are lots of results about powers of cycles from this opposite perspective; for example, they appear at minimum degree $2n/3$ or in random graphs at $p = 1/\sqrt n$.

A: They are called quartic Möbius ladders.
They are one of the fundamental classes in Johnson & Thomas's classification of internally 4-connected graphs, and crop up in matroid theory for the same reason.
http://dx.doi.org/10.1006/jctb.2001.2089


text:
Q: Handle with overflowing memory in matlab I have a problem about overflowing memory in Matlab. I am working in channel coding using Ludy code. The encoding symbol y is created as following
y=x*G

where G is matrix n-by-m and x is input symbol that size 1-by-n
My problem is that I want to work with number of input symbols is large. Hence, I must allocate a G matrix that its size is very large. However, it occurs overflow memory problem. I am using Matlab 2012a to do it. Could you suggest to me some method to resolve my problem
For example my G matrix is 40000-by-60000
This is my code
function G = gen_matrix(n,m)
    G = zeros(n,m);
    for i=1:m
        d=randi(n/2);
        column = [ones(1,d) zeros(1,n-d)];
        column = column(randperm(n));
        G(:,i) = column';
    end
end

This is my memory information
[userview systemview] = memory;

systemview.VirtualAddressSpace

ans =

    Available: 1.4074e+14
        Total: 1.4074e+14

A: Try using a sparse matrix:
function G = gen_matrix(n,m)
    G = sparse(zeros(n,m));
    for i=1:m
        d=randi(n/2);
        column = [ones(1,d) sparse(zeros(1,n-d))];
        column = column(randperm(n));
        G(:,i) = column';
    end
end


text:
Q: How to display a SVG image in shiny I would like to display in my web application an SVG image that I have hosted in the images folder. First I tried to display it with a tag but it didn't work:
ui <- fluidPage(
  tags$img(src = "./images/SVG_Logo.svg", width = "99px")
)

Then I used the rsvg and htmltools packages:
library(shiny)
library(htmltools)
library(rsvg)

#Load SVG image
miLogo <- rsvg_svg("./images/SVG_Logo.svg", width = 99)
miLogo_html <- as.character(miLogo)

ui <- fluidPage(
  HTML(miLogo_html)
)

server <- function(input, output, session) {

}

shinyApp(ui = ui, server = server)

But I couldn't get it to work either. In both cases the browser displays this:

But if I replace the source path for example by: https://upload.wikimedia.org/wikipedia/commons/4/4f/SVG_Logo.svg

It works correctly
Could someone help me, please?
Best regards,
Wardiam

A: This code works for me. I had to create an images folder inside the www folder. Have you created a www folder to store your assets?
library(shiny)
library(htmltools)

ui <- fluidPage(
  # tags$img(src = "https://raw.githubusercontent.com/paladinic/data/main/LINEA_black.svg", width = "99px")
  tags$img(src = "./images/logo.svg", width = "99px")
)

server <- function(input, output, session) {

}

shinyApp(ui = ui, server = server)


text:
Q: Creating a list based on the values from a dictionary which satisfy a condition I have this dictionary and I want to make a list with the Id .. If their hasCategory is True.
categories = [{'Id': 1350, 'hasCategory': True},
              {'Id': 113563, 'hasCategory': True},
              {'Id': 328422, 'hasCategory': False}]

In this example my result list should be this
list = [1350, 113563]

I am trying with the above code
list =[]
for item in categories:
    if item.hasCategory is True:
        list.push(item.Id)

But when I am trying to run my application I am having an error
for item in categories
                       ^
SyntaxError: invalid syntax

A: Basic problems found in the code

*

*You actually need to use : to mark the end of if and for statements, like this

*Don't use any of the built-in names as your variable names. In this case, list.

*To get a value from the dictionary, you need to get it with ["key"] method only. The dot notation will not work.

So your fixed code would look like this
result = []                      # list is a built-in name. Don't use that
for item in categories:          # : at the end
    if item["hasCategory"]:      # : at the end
        result.push(item["Id"])

Apart from that, the Pythonic way to check if a variable is Truthy, is just
if expression:

That is why we are not checking
if item["hasCategory"] == True:

or
if item["hasCategory"] is True:    # Never use `is` to compare values

Quoting PEP-8, the Style Guide for Python Code,

Don't compare boolean values to True or False using ==.
Yes:   if greeting:
No:    if greeting == True:
Worse: if greeting is True:

The best way to solve this problem is to use list comprehension with a filtering condition, like this
>>> [item["Id"] for item in categories if item["hasCategory"]]
[1350, 113563]

It will just create a new list, based on your old iterable, in this case categories.

A: You could use list_comprehension here.
>>> categories=   [{ 'Id': 1350, 'hasCategory': True},
               { 'Id': 113563, 'hasCategory': True},
               { 'Id': 328422, 'hasCategory': False}]
>>> [i['Id'] for i in categories if i['hasCategory'] == True]
[1350, 113563]

A: you should have ":" after your loop:
for item in categories:


text:
Q: Running script in package.json works but includes errors I just installed ESLint and I can successfully run it by doing this at the terminal window:
./node_modules/.bin/eslint app

Note: app is the root folder I want lint to inspect.
I then put that exact command in my package.json:
  "scripts": {
    "lint": "./node_modules/.bin/eslint app"
  }

I expected to be able to run it in the terminal window like this:
npm run lint

Note: I know how to fix the no-undef error. My question is about the many errors lines after that.
It actually works, but it also produces a bunch of errors after showing me the correct output:

Why is that happening?

A: This is the default way of how the npm script runner handles script errors (i.e. non-zero exit codes). This will always happen, even if you only run a script like exit 1.
I'm not sure why this feature exists, it seems annoying and useless in most cases.
If you don't want to see this, you can add || true at the end of your script.
Example:
lint: "eslint app || true"
As you might've noticed, I've omitted the part to the eslint binary. The npm script runner already includes local binaries as part of the path when trying to run the script so there is no need to use the full path.

A: document is a global, so eslint thinks you are missing an import somewhere. For those cases, you can adapt your config so that the error is not reported, Something like this:
module.exports = {
  "globals": {
    "document": true
  }
}

this should be saved as .eslintrc.js and be at the same level where your package.json is


text:
Q: How is Hashtable different to Hashmap
Possible Duplicate:
Differences between HashMap and Hashtable?

I've seen hash tables and hash maps used in different code but they look like they do the same thing. Is there a difference between them? Which one should I use in my code?

A: Hashtable is synchronized, where as HashMap is not. This means if you only have a single thread accessing the data, use a HashMap, otherwise use a Hashtable.

A: java.util.Hashtable methods are synchronized , java.util.Hashmap methods are not. If you use Hashtable there will be a performance hit as no two threads will be able to access its methods at the same time.
If you care about Thread safety in your app Hashtable is the way to go. if you dont care about thread safety Hashmap is the way to go as it is mor eefficient then hashtable.
also java.util.Hashtable doesnt allow any null keys, where as java.util.HashMap allows one null key.

A: HashTable dont't allow null keys where as hashmap allows one null key


text:
Q: Updated to VS 2015, Azure 2.7, publish fails 'Access to path ... denied' I have a cloud service project with three worker roles. Previously (VS 2013, Azure 2.5) everything published fine. When VS 2015 was available, I installed it on a clean VM and then installed Azure 2.7. I promoted my old solution and I can build and run locally just fine. I can build the cloud service project. But when I try to publish or package, I get the following error and the build fails.
Error:

Access to the path
  'C:\Users[username]\AppData\Local\Temp\3xhd2e4m.wlw\roles[rolename]\base\x86\msshrtmi.dll'
  is denied. C:\Program
  Files\MSBuild\Microsoft\VisualStudio\v14.0\Windows Azure
  Tools\2.7\Microsoft.WindowsAzure.targets 3003

When I go to Temp - there is no directory corresponding to 3xhd2e4m.wlw.
My resolution attempts so far include:
Removing the worker roles from the solution and trying to publish - fails with same error for the remaining project.
Removed read-only from temp
Tried to set everything to build x64
I really need some help since this blocking deployment and testing.

A: I have the same problem. According to an answer in another post (Deploying to Azure: "Access to the path ... msshrtmi.dll is denied"), the problem is related with an issue with the Azure SDK 2.7 and will be solved in version 2.7.1, supposed to be released shortly.
The problem occurs only when you try to publish from a 32-bit machine. Changing to a 64-bit machine should work.

A: I can't offer a specific solution as I haven't taken the plunge and upgraded to VS2015 yet, however I imagine this has something to do with the project file for the Worker Role's Cloud Service.
So, two options come to mind:

*

*Create a new blank Worker Role Project with a single boilerplate Worker Role and check that it publishes/packages correctly. This will confirm whether this functionality works in VS2015 with Azure SDK 2.6.

*If (1) works, consider adding one of your existing Worker Role Projects to the blank Worker Role Project in (1) and try the publish/package process again.

I find it hard to believe that the chaps at Microsoft have tried the upgrade path from v2.5 -> v2.6 of the SDK for Worker Roles... I've checked the v2.6 Release Notes and there doesn't appear to be any breaking changes related to this issue: https://azure.microsoft.com/en-gb/documentation/articles/azure-sdk-dotnet-release-notes-2_6/

A: I just got hit with this same issue and lost a few brain cells from it.
I have a defined directory in my ServiceDefinition.csdef that contains all the files I'm trying to copy out during my cloud service publish for my startup tasks, and I ended up including some .dll files as well.  I was getting the same error as the OP of this question and after some time found out that I just couldn't include the *.dll files in my SourceDirectory path.  I was able to include .cmd files just fine, but .dll and .config's were no good.
It wasn't good enough to exclude them from my project either, just the fact that the files were in that directory was enough to make VS yell at me.
For now I've just put all the offending files in a zip and I'm sending the zip file in my deployment, so it's a workaround, but was a painful one until I figured this much out.
Hope this helps..


text:
Q: Filesystem for NOR flash I have a flash device with 6114 blocks of 1024 bytes data. I have the two following functions to access the flash:
long WriteData (long StartBlock, long Count, void *ptr)
long ReadData  (long StartBlock, long Count, void *ptr)

Is there some open source code to simulate a filesystem on top of these two functions?
Thanks!


text:
Q: Error while trying to program a discord bot using pycharm I had a problem with making a discord bot with python im using pycharm
I this happens when I try to run my script
  Traceback (most recent call last):
  File "C:/Users/czeni/PycharmProjects/Molta Bot/main.py", line 21, in <module>
    client.run(os.getenv('TOKEN'))
  File "C:\Users\czeni\PycharmProjects\Molta Bot\venv\lib\site-packages\discord\client.py", line 723, in run
    return future.result()
  File "C:\Users\czeni\PycharmProjects\Molta Bot\venv\lib\site-packages\discord\client.py", line 702, in runner
    await self.start(*args, **kwargs)
  File "C:\Users\czeni\PycharmProjects\Molta Bot\venv\lib\site-packages\discord\client.py", line 665, in start
    await self.login(*args, bot=bot)
  File "C:\Users\czeni\PycharmProjects\Molta Bot\venv\lib\site-packages\discord\client.py", line 511, in login
    await self.http.static_login(token.strip(), bot=bot)
AttributeError: 'NoneType' object has no attribute 'strip'

A: Explanation
It appears as though you have not passed a value to the 'TOKEN' environment variable. When loading an environment variable os.getenv will return None if the key passed (in this case 'TOKEN') does not exist.
Fix

*

*Create a file called '.env' in the same directory as your main.py file.

*Add TOKEN='your_token' to the file.

*In your environment, run pip install python-dotenv

*Add the following code to your main.py file:

from dotenv import load_dotenv

load_dotenv()

Reference
os.getenv
python-dotenv and load_dotenv


text:
Q: Groups of order 12 that aren't isomorphic Give examples of four groups of order 12 no two of which are isomorphic.
So far I've thought of $Z_{12}$ and $D_6$.
Thanks!

A: Consider $\mathbb{Z}_2\times \mathbb{Z}_2\times \mathbb{Z}_3$ and  $A_4$.

A: Hints for you to prove:
The two abelian ones: $\;C_{12}\;,\;\;C_2\times C_6\cong C_2\times C_2\times C_3\;$ , and now two non-abelian ones which is easy to see aren't isomorphic: $\;A_4\;,\;\;C_2\times S_3\;$

A: There is also $T=C_3\rtimes C_4$, since ${\rm Aut}\, C_3\simeq C_2$ is isomorphic to a subgroup of $C_4$. In fact, the only non-abelian groups of order $12$ are $A_4$, $D_{12}$ and $T$.

A: Okay, here is my reasoning.
Take $Z_{12}$, $Z_2 x Z_2 x Z_3$, $D_6$ and $A_4$.
$Z_{12} \not\cong Z_2 x Z_2 x Z_3$ since $Z_{12}$ is cyclic.
$Z_{12} \not\cong D_6$ since $Z_{12}$ is cyclic.
$Z_{12} \not\cong A_4$ since $Z_{12}$ is cyclic.
$D_6 \not\cong A_4$ since $D_6$ has an element of order $6$.
$D_6 \not\cong Z_2 x Z_2 x Z_3$ since $D_6$ is non-Abelian and Z_2 x Z_2 x Z_3$ is an abelian group
$A_4 \not\cong Z_2 x Z_2 x Z_3$ since $A_4$ has elements of order $2$.


text:
Q: How to refer to several paragraphs or articles §§ in law or pages in books As a non-native English speaker, I came to the problem, how to refer to several articles or pages in law for an essay I have to write.
I did some research here and found the page Is there reference material for dictionary abbreviations used in the first half of the 20th century? which was only partially helpful to me as the Wikipedia-webpage did not exist anymore and a similar one, https://de.wikipedia.org/wiki/Liste_lateinischer_Abk%C3%BCrzungen only offered Latin terms.
So I refuse to use abbreviations and I am not satisfied with the results of translators like DeepL, that say "and following" is to use. It seems to me like word-for-word translation without considering common speech.
So, please help me to replace "and following": (Thanks in advance)
Please refer to code of law page XYZ "and following" - especially to Article ABC "and following".


text:
Q: Why does VScode wont show large SVG file as an option to use for background-image? Why does VScode wont show large SVG file as an option to use for background-image?
I created a large animation using animator expressive. However, when I try to use it as a background-image for a div, it won't appear on my options even though it is on the same file as other small animations created on the same app.
Any ideas why this is happening?


text:
Q: jquery tooltip IE problem I am using jquery tooltip in area which is reloaded with ajax. So I bind the js for tooltip and all work fine for most browser but not for IE 7 and 8. There is a problem with position and it give me error like "left is NULL or not an object" and here is the problematic part of the script `
    var left = helper.parent[0].offsetLeft;
    var top = helper.parent[0].offsetTop;
    if (event) {
        // position the helper 15 pixel to bottom right, starting from mouse position
        left = event.pageX + settings(current).left;
        top = event.pageY + settings(current).top;
        var right='auto';
        if (settings(current).positionLeft) {
            right = $(window).width() - left;
            left = 'auto';
        }
        helper.parent.css({
            left: left,
            right: right,
            top: top
        });
    }`

when I close error popup if I move mouse quickly to that area it start working normal. Can someone say what`s the problem. The reloaded area is with fixed width.

A: Did you also use the optional plugin? http://plugins.jquery.com/project/bgiframe

A: $(document).ready(function(){
    $('body').append('

');
    $('[tooltip]').each(function(){
        $(this)
            .mouseover(function(){ $("#tooltip").css("display","block").html($(this).attr("tooltip")); })
            .mouseout(function(){ $("#tooltip").css("display","none"); })
            .mousemove(function(e){ $("#tooltip").css({"left": e.pageX, "top": e.pageY}); })
    });
});

Here you can see how it works: http://jsfiddle.net/au4Lt/


text:
Q: Recibir multiples datos selected en datatable con Laravel Estoy intentando registrar en mi bd multiples select obtenidos del datatable en laravel, pero hasta ahora solo puedo registrar 1 y cuando intente seleccionar varios, solo se registra el ultimo seleccionado
Tengo mi boton que manda ha llamar a la función
<button type="button" class="btn btn-primary" id="cotizar" onclick="mod.cotizar();">
                        <i class="fa fa-save"></i>
                        Cotizar Seleccionados
                    </button>

Este mod.cotizar tiene la condicional si detecta varios seleccionados
mod.cotizar = function (id) {
            if (id != null) {
                ......
            } else {
                var data = mod.tblItems.rows({selected: true}).data();
//Debo validar que selecciono más de 1 para que se active esta funcion
//Si selecciono solo 1 se cumple la primera condicion
                if (data.length > 1) {

                    Swal.fire(
                        {
                            title: "Cotizar",
                            text: "¿Desea cotizar todos estos items?",
                            type: "warning",
                            showCancelButton: true,
                            confirmButtonText: "Si"
                        }).then(function (result) {
                        if (result.value) {
                            $.ajax({
                                url: "{!! route('P0027.cotizar.item',['']) !!}/" + data[0].id,
                                method: 'GET',
                                success: function () {
                                    Swal.fire('', 'Items Cotizados', 'success');
                                    mod.tblItems.ajax.reload();
                                }
                            });
                        }
                    });

                } else {
                    Swal.fire('', 'Debe seleccionar una registro de la tabla', 'warning');
                }
            }

        };

En mi controlador recibo la información y la inserto
Y hasta ahora todo bien pero solo obtiene 1 resultado
public function cotizaritem($id)
    {
        try {
        //Verifico que el id obtenido exista
            $item = dt_proyectos_partidas_items::find($id);
            if ($item != null) {
                //Creo un codigo para la cotizacion
                $cor = dt_cotizacion::select(DB::raw('count(*) as total'))
                    ->whereRaw(DB::raw('month(created_at) = month(now())'))
                    ->whereRaw(DB::raw('year(created_at) = year(now())'))
                    ->first();
                $codigo = sprintf("CT%04s%04s", Carbon::now()->format('ym'), $cor->total + 1);
                $cotizacion = new dt_cotizacion();
               .....
                //Guardo la cotizacion
                $cotizacion->save();
                return response()->json(['ok' => true, 'message' => __('Registro almacenado')], 200);
            } else {
                return response()->json(['ok' => false, 'message' => __('Registro no encontrado')], 404);
            }

        } catch (\Exception $e) {
            return response()->json(['ok' => false, 'message' => $e->getMessage(), 'ln' => $e->getLine(), 'fl' => $e->getFile(), 'c' => $e->getCode()], 404);
        }

    }

He intentado usar el foreach, pero creo que no me esta recibiendo todos los id seleccionados y tambien intente con cambiar de GET a POST pero tampoco me funciona
Sera que estoy recibiendo mal los datos? o no los estoy almacenando correctamente?

A: Encontre la solución!
Para poder enviar un array obtenido de un datatable se debe hacer lo siguiente:
Creamos 2 variables, la primera que recoge los multiple select del datatable y otro para contar esos select
 var data12 = mod.tblItems.rows({selected: true}).data();
 var count = mod.tblItems.rows({selected: true}).count();

Luego inicializamos un array donde meteremos toda la data
var data = [];

Luego hacemos un for donde me valide que el numero actual sea menor al contado en los select
 for (var i = 0; i < count; i++) {
//Añadimos un push (una asociación) para cada dato obtenido
                        data.push(i);
//Y para cada dato obtenido le asignamos el id del datatable a cada asociación del array
                       data[i] = data12[i].id;
                    }

Luego en el ajax pasamos el array a json
 data: JSON.stringify({array: data}),
 dataType:'json',
 contentType: 'application/json; charset=utf-8',

Y por ultimo dentro del controlador o donde quieran, recibimos el array con foreach
 foreach ($request->array as $datas )

Y para el que no entendio donde va cada cosa aqui el codigo completo para registrar en un array (que por lo menos me funciono ami) para pasarlo a un controlador en laravel
var data12 = mod.tblItems.rows({selected: true}).data();
                var count = mod.tblItems.rows({selected: true}).count();
                if (data12.length > 1) {
                    var data = [];
                    for (var i = 0; i < count; i++) {
                        data.push(i);
                       data[i] =
                        data12[i].id
                       ;
                    }
                    console.log(data);

                    Swal.fire(
                        {
                            title: "Cotizar",
                            text: "¿Desea cotizar todos estos items?",
                            type: "warning",
                            showCancelButton: true,
                            confirmButtonText: "Si"
                        }).then(function (result) {
                        if (result.value) {
                            $.ajax({
                                url: "{!! route('P0027.cotizar.item1',['']) !!}/" + data12[0].id,
                                method: 'POST',
                                data: JSON.stringify({array: data}),
                                dataType:'json',
                                contentType: 'application/json; charset=utf-8',
                                success: function () {
                                    Swal.fire('', 'Items Cotizados', 'success');
                                    mod.tblItems.ajax.reload();
                                }
                            });
                        }
                    });

                } else {
                    Swal.fire('', 'Debe seleccionar una registro de la tabla', 'warning');
                }


text:
Q: Capture part or whole using regex with same capturing name Given the two following strings :
\06086-afde-4e46-8886-@xxx.com\0xxx7ccd-6293-4343-8e50-xxx

\0name.surname@xxx.com\0xxx6293-4343-8e50-e1d5-xxx

I try to extract 6086-afde-4e46-8886- (id it is a guid) or name.surname@xxx.com (if it is not a guid). The difficulty here is that the captured groups must have the same name.
So far, I have
 (?<name>(?:\w{4}-){4}|[a-zA-Z.]{1,}@xxx\.com), but this also captures 7ccd-6293-4343-8e50- or 6293-4343-8e50-e1d5- which I don't want.
I was also thinking about something like \\\0(?<name>(?:\w{4}-){4}|[a-zA-Z.]{1,}@xxx\.com)(?:(?:@xxx\.com)?\\\0),
but then is there a way not to repeat the xxx.com part (because it is more complicated than that). Also, this relies on finding \\0, which I'd like not to, as I don't really know if this will be found somewhere else in the string.
Thanks..

A: The following regular expression is matching the number 6086-afde-4e46-8886- and the email name.surname@xxx.com into the same group name without using the start sequence \0
(?<_name_>[A-Za-z]+\.[A-Za-z]+@xxx\.com|(?:[\w]{4}-){4}(?=@xxx\.com))

This regular expression uses a positive look ahead (?=@xxx\.com) for matching the number without taking @xxx.com.

A: try this
\\0(?<_name_>(?:[\w\-\.]+))@xxx\.com

And add all allowed characters inside the square parentheses
demo: http://regexhero.net/tester/?id=be0fed5e-1d24-43cc-9db9-812311c17d61

A: Seems like you're trying to get the first match. If yes then try the below regex.
^.*?(?<name>(?:\w{4}-){4}|[a-zA-Z.]{1,}@xxx.com)

http://regex101.com/r/jC3uR4/5


text:
Q: Design pattern for mapping data fields I have seen this problem a few times and never can come up with a solution i like.
System A
    Sales Order Entity
        order_id
        created
        line_items_count

System B
    Sales Order Entity
        sales_order_id
        created_At
        num_line_items

The problem is, that sales orders are created in System A - for example an e-commerce website.  The sales orders need to be exported and stored in another system, for example a warehouse system - System B.  They both store the same data but under different field names.
Is there a design pattern or collection of patterns typically used to solve such problem?
I always end up with an associative array containing the mapped fields - but it feels like there must be a better solution.
In the example above, not only sales orders might require this, also customers, products, inventory levels etc - so a generic pattern would be best.

A: Though probably not recognised as a design pattern, what you describe would be called a Mapper.
It translates one object into another.
Implementations can be found at AutoMapper.org and at CodeProject.

A: The Web Ontology Language (OWL) implements a description logic with sameAs and other relations between descriptions of entity types as a solution for this problem. 'Description logic' is arguably the design pattern for two-way mappings, as other representations are sub-sets of what a description logic can describe.
If the mapping is single way, then there are many transformation languages in which it can be specified, for example XSLT if the data has an XML representation.


text:
Q: Trouble getting device token into global variable I am trying to get the device token and then put that device token into a global variable (or access it from another view). The code in my AppDelgate is as follows:
- (void)application:(UIApplication*)application didRegisterForRemoteNotificationsWithDeviceToken:(NSMutableData*)deviceToken
{
    DataClass *obj=[DataClass getInstance];

    obj.userDevice = deviceToken;

      NSLog(@"%@",obj.userDevice);

}

This displays the token. But when I try to access it through the global variable in another view, it displays "null". The code for that is as follows:
 DataClass *obj=[DataClass getInstance];

NSLog(@"%@",obj.userDevice);

Any ideas? Or another solution? I just want to access the token from another view so I'm open to other suggestions.
EDIT: DataClass
   static DataClass *instance =nil;
    +(DataClass *)getInstance

{
    @synchronized(self)
    {
        if(instance==nil)
        {

            instance= [DataClass new];
        }
    }
    return instance;
}


text:
Q: Calling RSV Validation with .click() I'm using Benjamin Keen's RSV (Really Simple Validation), however the way Im structuring my site I have the javascript at the bottom of the page which is causing an error with a horrible inline js on the form I'm validating..
currently the form has:
onSubmit="return RSV(this, rules);

I want to change it to something like this:
registerForm.click(function(e){
    e.preventDefault();

    //alert("fired!");
    return RSV($(this), rules);

});

However the console is reporting a Uncaught ReferenceError: rules is not defined
I would rather not use inline javascript, has anyone come across this or understand enough to help - anyhelp will be much appreciated.
Link to examples of the validation code on Benjamin's website
This is an example of the rest of the code required to make the plugin work.
$(document).ready(function() {
    $("#demo_form5").RSV({
      onCompleteHandler: myOnComplete,
      errorFieldClass: "errorFieldDemo5",
      displayType: "display-html",
      errorHTMLItemBullet: "— ",
            rules: [
                    "required,first_name,Please enter your first name.",
                    "required,last_name,Please enter your last name.",
                    "required,email,Please enter your email address.",
                    "valid_email,email,Please enter a valid email address.",
                    "required,any_integer,Please enter your age.",
                    "digits_only,any_integer,The age field may only contain digits.",
                    "required,marital_status,Please enter your marital status."
]
    });

});

A: Using prevent default doesn't really work as intended here. It may work in some browsers it may also stop the form from submitting altogether so I would omit it.
    e.preventDefault();
The following does work as you pointed out...
$('#btnSubmit').submit(function(){
    return RSV(this, rules);
});

...your button in the form needs to be an input field with type submit and the matching id as you have it:
<input type="submit" id="btnSubmit" >

I've found some older browser versions, cough IE 8, will occasionaly allow the form to submit twice giving you two new records in the db. To ensure this doesn't happen change your myOnComplete to:
function myOnComplete(){
      $(this).find("input[type='image'],input[type='submit']").click(function(){
        return false;
    });
}

A: I have found the solution:
I was targeting the form not the submit button, and also using .click() where I should of been using .submit().
the correct code for this is as follows:
    $('#btnSubmit').submit(function(e){
        e.preventDefault();
        return RSV(this, rules);
    })


text:
Q: How to create Swift async-await function as a wrapper for function with callbacks? As you can see I have a very complicated function:
func save(records: [CKRecord], recordIDsToDelete: [CKRecord.ID], handler: CountHandler?, completion: RequestsHandler?) {}

That function in future I will rewrite to async-await. But for now, I need to inject it into current code. How can I do it to make it work?
private func save(records: [CKRecord], handler: ProgressHandler?) throws -> Bool {
    save(records: records, recordIDsToDelete: []) { count in
        handler?("Saving\n\(count)\nrecords.")
    } completion: { _, _, _, error in
        guard let error = error else {
            return true
            return
        }
        throw error
    }
}

What do I need to have? I need to know if there was a success or failure, and if failure, I need to know the error.


text:
Q: DD-WRT new router firmware block ad serving hostnames I found an excellent link of hosts serving ads and tracking cookies. I'd like to run a DNS server on my (newly reflashed) router running the DD-WRT firmware, and re-route all connections to any of these hostnames to 0.0.0.0.
I see options for DNSMasq on the interface to my router, but I don't think it gives me the capability to enter specific DNS entries.
Thanks!

A: I don't know about rerouting them to the default gateway. In theory, that would only send them back to you. You could use the list as suggested on the web page and make all those hosts appear as 127.0.0.0 which would effectively prevent them from sending you any data.
This can be done in DNSMasq: Services > Additional DNSMasq Options
address=/some.local.hostname/192.168.1.1
address=/another.local.hostname/192.168.1.2
addn-hosts=/some/file/somewhere

This info is from a dd-wrt discussion


text:
Q: While debugging, can Eclipse render values in a human-readable way? I have a Julian day value in a double variable, like 2456707.5.  I want to view it while debugging as a readable calendar date string like 6 Feb 2014.  Is there a way I can set this up in Eclipse?
More generally, is there a way to reformat a human-unreadable value in app I'm debugging, so that I can understand its value as it changes?

A: There are several answers to the more general question "How do I view in Eclipse the current value of a variable, in a format of my choosing".  I prefer to use the Expressions view (Window > Show View > Other... > Debug > Expressions) and enter a java snippet that presents the variable the way I want.
This view is fairly powerful.  Here's a trivial example that you might be able to expand on:
new java.text.SimpleDateFormat("dd").format(java.util.Calendar.getInstance().getTime())

Put that into the Expressions view and it'll show you today's date.  The Expressions view has full access to all variables in scope while you're debugging.
For your particular case, you'll need a class somewhere that converts the Julian Day value to a Date or time (epoch), since Java natively doesn't support the value (as far as I'm aware).  Assuming that your class is called JulianDayFormat and extends DateFormat, then you can use
new java.text.SimpleDateFormat("dd MMM yyyy").format(new your.package.JulianDateFormat().parse(julianDayString))