text:
Q: How to loop over XML elements in a MySQL stored procedure? The MySQL documentation has this example:
mysql> DELIMITER |

mysql> CREATE PROCEDURE myproc ()
    -> BEGIN
    ->   DECLARE i INT DEFAULT 1;
    ->   DECLARE xml VARCHAR(25) DEFAULT 'XYZ';
    ->
    ->   WHILE i < 4 DO
    ->     SELECT xml, i, ExtractValue(xml, '//a[$i]');
    ->     SET i = i+1;
    ->   END WHILE;
    -> END |

Is there a way to accomplish this without hard-coding the number of elements (the value 4 in this example)?
UPDATE
I'm looking for a general solution. Don't be distracted by the specific XML shown in the question, it's just an example straight out of the MySQL manual page.

A: If you have a simple XML structure then you can extract the details in a single query using a recursive CTE. The following has only been tested on MySQL 8 so I can't guarantee if it works on earlier versions.
SET @xml =
'<objects>
    <object>
        <objectid>101</objectid>
        <objecttype>T1</objecttype>
    </object>
    <object>
        <objectid>102</objectid>
        <objecttype>T2</objecttype>
    </object>
    <object>
        <objectid>103</objectid>
        <objecttype>T3</objecttype>
    </object>
</objects>';

WITH RECURSIVE RowGenerator (SeqNum)
AS (
    SELECT 1

    UNION ALL

    SELECT SeqNum + 1
    FROM RowGenerator
    WHERE SeqNum < ExtractValue(@xml, 'count(/objects/object)')
)
SELECT @RowNum := SeqNum
, ExtractValue(@xml, '/objects/object[$@RowNum]/objectid')
, ExtractValue(@xml, '/objects/object[$@RowNum]/objecttype')
FROM RowGenerator;

A: Don't.
SQL does not have XML parsing functionality.
Pass the data as a string to an environment with XML parsing functionality.
If you are trying to filter your query based on the XML data, then the answer is that you should not have stored XML in your database in the first place and are now in a lot of trouble (look up normalisation).

A: If you're trying to batch process large XML files with rich, non-relational structures, then I'd say that the only challenge you're facing in processing it in MySQL is handling 1–N relationships.
Obviously, I find the example of processing 2D row-fields structured XML completely irrelevant as equally as efficiently you should be able to process raw CSV files (and any first-grader can write an XSL stylesheet to do the conversion). Instead, I'm interested in XML such as this one:
<batch>
  <tx id="12483" timestamp="2016-04-23 14:40:42"
      uuid="5395db0c-0984-11e6-b4b6-e0f427e40467">
    <shop id="78" location="238 Park Ave, NYC"/>
    <items>
      <book isbn="9780062409867"
            title="Go Set a Watchman"
            author="Lee, Harper"
            unitprice="11.52"
            quantity="1"/>
      <book isbn="9781593080259"
            title="The Picture of Dorian Gray"
            author="Wilde, Oscar"
            unitprice="7.99"
            quantity="1"/>
      <book isbn="9780143039020"
            title="The Quiet American"
            author="Greene, Graham"
            unitprice="5.56"
            quantity="1"/>
      <book isbn="9780307277770"
            title="The Painted Veil"
            author="Maugham, W. Somerset"
            unitprice="7.05"
            quantity="1"/>
      <bluray asin="B017S3OP34"
            title="The Martian"
            year="2015"
            discs="1"
            language="English"
            unitprice="17.93"
            quantity="1"/>
    </items>
  </tx>
</batch>

with eg. heterogeneous collections (book and bluray), all of which may be mapped into the relational database according to a specific business logic.
Now back to your question. The number of rows of any 1–N relationship within your XML can be retrieved using XPath, ie. extractValue('..', 'count(path/to/element)') and then iterate over this by constructing index-specific XPath queries (alas, very imperative). For instance, you could process the above in a stored procedure such as
delimiter ;;
DROP PROCEDURE IF EXISTS `import_xml`;;
CREATE PROCEDURE import_xml(xml_input MEDIUMTEXT)
BEGIN
  DECLARE k INT UNSIGNED DEFAULT 0;
  DECLARE row_count INT UNSIGNED;
  DECLARE xpath TEXT;

  DROP TEMPORARY TABLE IF EXISTS `books`;
  CREATE TEMPORARY TABLE books (tx_id BIGINT, isbn BIGINT, title VARCHAR(255), author VARCHAR(63), unit_price DECIMAL(6,2), quantity TINYINT(4));

  -- process books
  -- book count in the collection
  SET row_count := extractValue(xml_input,'count(//items/book)');

  -- iterate over books
  WHILE k < row_count DO
    SET k := k + 1;
    SET xpath := concat('//items/book[', k, ']');

    INSERT INTO books VALUES (
      extractValue(xml_input, '//tx/@id'),
      extractValue(xml_input, concat(xpath,'/@isbn')),
      extractValue(xml_input, concat(xpath,'/@title')),
      extractValue(xml_input, concat(xpath,'/@author')),
      extractValue(xml_input, concat(xpath,'/@unitprice')),
      extractValue(xml_input, concat(xpath,'/@quantity'))
    );
  END WHILE;

  -- all books are in the temporary table `books` ready for further processing
  SELECT * FROM books;
END;
;;
delimiter ;

CALL import_xml(@xml);

That being said, before jumping head down into parsing large XML into MySQL however, you may want to take a moment to contrast writing a long stored procedure with writing a sleek XSLT stylesheet that transforms an XML into a batch of SQL statements neatly wrapped into a transaction that you may readily load into MySQL. I'd say both approaches are worth your while.
Or perhaps: XML + XSLT that you run straight from MySQL?
HTH

A: Thanks to @DaveB for mentioning the count() function, I'm now able to write this:
mysql> DELIMITER |

mysql> CREATE PROCEDURE myproc ()
    -> BEGIN
    ->   DECLARE i INT DEFAULT 1;
    ->   DECLARE xml VARCHAR(25) DEFAULT 'XYZ';
    ->   SELECT @count := ExtractValue(@xml, 'count(//a)');
    ->
    ->   WHILE i < @count + 1 DO
    ->     SELECT xml, i, ExtractValue(xml, '//a[$i]');
    ->     SET i = i+1;
    ->   END WHILE;
    -> END |


text:
Q: How to pass id database into jquery in codeigniter? Hi all I am a new codeigniter I want to pass ID Database into jquery but I can not do I try to search google youtube but I still can not
I have stuck this code a few day who can help me please ?
And this is the original code:

          >>
          <

<img src="<?php echo base_url().'./images/events/ll.png' ?>">

<img src="<?php echo base_url().'./images/events/blue.jpg' ?>">

<img src="<?php echo base_url().'./images/events/red.jpg' ?>">

And I try to pass ID but its not working help me please:
My database: events

           id image image2 image3
           1  1a.jpg 2a.jpg  3a.jpg
           2  1b.jpg 2b.jpg  3b.jpg
           3  1b.jpg 2c.jpg  3c.jpg

     <?php $query = $this->db->get('events'); ?>
<?php foreach($query->result() as $val): ?>

<div id="slider<?php echo $val->id; ?>" class="slider">
  <a href="#" id="control_next" class="control_next<?php echo $val->id; ?>">>>
  <a href="#" id="control_prev" class="control_prev<?php echo $val->id; ?>"><

<img src="<?php echo base_url().'./images/events/'.$val->image; ?>">

<img src="<?php echo base_url().'./images/events/'.$val->image2; ?>">

<img src="<?php echo base_url().'./images/events/'.$val->image3; ?>">

<?php endforeach; ?>

A: Where ever you are using the id you should use concatenation operator. And alse remo parenthesis for id. No need to have that.
var slideCount = $(id + ' ul li').length;
                      ^  ^// add a space here.
var slideWidth = $(id + 'ul li').width();
var slideHeight = $(id + 'ul li').height();

I have given only for 3 rows, please change it in all required places in your jquery
$('a.' + idb).click(function () {
    moveLeft();
});

$('a.' + ida).click(function () {
    moveRight();
});

redpajama_set_name: RedPajamaStackExchange


text:
Q: Using PreferenceDataStore with Firebase Database I want to use PreferenceDataStore to fetch the settings of the user that are being saved in a Firebase database.
The set- function works like a charm, because there is no listener:
override fun putString(key: String?, value: String?) {
    if(key != null && value != null){
        val userId = UserUtils.getCurrentUser()?.uid.orEmpty()
        val preferencesReference = database.getReference("users/$userId/preferences")

        preferencesReference.updateChildren(HashMap<String,String>().apply {
            this.put(key,value)
        }.toMap())
    }
}

The get- function is a more complicated, because, as you may know, the firebase databaes gives us a callback method where the data is being returned. Is there  still a way to get the values? Do you have any ideas?
override fun getString(key: String?, defValue: String?): String? {
    if(key == null){
        return defValue
    }

    val userId = UserUtils.getCurrentUser()?.uid.orEmpty()
    database.getReference("users/$userId/preferences/$key").addListenerForSingleValueEvent(object: ValueEventListener{
        override fun onDataChange(p0: DataSnapshot) {
           //the return value is here, but i am not able to return it cause it's a listener

        }

        override fun onCancelled(p0: DatabaseError) {}
    })

    return "wot";
}


text:
Q: Why am I getting a System.InvalidOperationExpression error when using If Else in C#? I have 3 Booleans that I need to have checked: Show, Editable and Clear on Submit. Sometimes the Booleans are already checked and I just want the program to leave them checked (= yes). My code works fine when they are not checked from the start but I get the following error if they are already checked (System.InvalidOperationExpression). The Error occurs on the first if statement.
Here is my code
        Page.Control("Editable").Activate();
        if (Page.Control("Editable").Equals(false))
            TestScenario.SaveValueWithDelay(Page.Control("Editable"), true);

        Page.Control("Show").Activate();
        if (Page.Control("Show").Equals(false))
            TestScenario.SaveValueWithDelay(Page.Control("Show"), true);

        Page.Control("Clear on Submit").Activate();
        if (Page.Control("Clear on Submit").Equals(false))
            TestScenario.SaveValueWithDelay(Page.Control("Clear on Submit"), true);

A: It turned out that one of my steps in my unit test, was overwriting the values that I was setting making it difficult for me to debug. So the best approach was to  remove the If condition statement altogether and create a cleanup routine (ie. Disable Interfaces)that clears the Booleans after each run.   Here is the final code:
public class Interfaces

{
    internal static void EnableInterfaces(UserContext userContext,  ClientLogicalForm Page)

    {
        Page.Activate();

        Page.Control("Editable").Activate();
        Page.Control("Editable").SaveValue(true);

        Page.Control("Show").Activate();
        Page.Control("Show").SaveValue(true);

        Page.Control("Clear on Submit").Activate();
        Page.Control("Clear on Submit").SaveValue(true);

    }

    internal static void DisableInterfaces(UserContext userContext, ClientLogicalForm Page)

    {
        Page.Activate();

        Page.Control("Editable").Activate();
        Page.Control("Editable").SaveValue(false);

        Page.Control("Show").Activate();
        Page.Control("Show").SaveValue(false);

    }

}


text:
Q: PHP Form, If Statements Looking for any help, I'm very new to coding and am struggling big time.  I am trying to write a program that asks a user to enter a 10 digit ISBN.  I need to check that its all numbers and is ten digits.  then I need to make sure its a valid ISBN by multiplying each digit by its position from the end, getting the total of all and dividing by 11.  I am trying to do it step by step, i.e. enter an instruction, test, enter next, test, etc. as I was told when learning that's the best way.  I haven't gotten as far as the mathematical test of the array cause I have no clue how to go about that, but also, even if I enter ten digits I'm being prompted to to enter exactly ten.
<!DOCTYPE html>

        <title></title>

Enter a ten digit number

        <?php
            if(empty($_POST['isbn'])){
                echo "Please enter a ten digit number";
            } elseif (strlen($_POST['submit'] !==10)){
                echo "Please enter exactly ten digits";
            } else {
                echo "You have entered the correct number of digits";
                $array = str_split($_POST['submit']);
            }
        ?>
        <form action="Qu2.php" method="post">
        ISBN: <input type="number" name="isbn">
        <input type="submit" name="submit" value="Go">
        </form>

A: You can check if all characters in a string are numerical using ctype_digit().
To check if the given string is valid ISBN-10 you can use the following function.
function isIsbn10($isbn) {
    $check = 0;

    for ($i = 0; $i < 10; $i++) {
//  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ loops through all numbers in the "ISBN"
        $check += (int)$isbn[$i] * (10 - $i);
//      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ multiplies the number with the position from the last character
    }

    return (0 === ($check % 11)) ? true : false;
//  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ checks if total is divisible by 11
}

var_dump(isIsbn10("0198526636")); // bool(true)

Your code will look like this (fixed some mistakes that were in your code):
if (isset($_POST['submit'])) {
    if(empty($_POST['isbn'])){
        echo "Please enter a ten digit number";
    } elseif (strlen($_POST['isbn']) !== 10) {
        echo "Please enter exactly ten digits";
    } elseif (!ctype_digit($_POST['isbn'])) {
        echo "You have nonnumerical characters in your ISBN!";
    } elseif (!isIsbn10($_POST['isbn'])) {
        echo "ISBN is invalid!";
    } else {
        echo "ISBN is VALID!";
    }
}


text:
Q: pam_mount error "crypt_activate_by_passphrase: Operation not permitted" I'm trying to set up encrypted home directories on OpenSuSE.
Everything works fine for direct login, but I want the home directories to get mounted via ssh as well. When I try to ssh to the machine, and provide a password, the following shows up in /var/log/messages.
Sep 20 16:03:16 linux-bd9o sshd[11921]: Accepted keyboard-interactive/pam for test from ::1 port 37227 ssh2
Sep 20 16:03:16 linux-bd9o sshd[11921]: pam_mount(pam_mount.c:172): conv->conv(...): Conversation error
Sep 20 16:03:16 linux-bd9o sshd[11921]: pam_mount(pam_mount.c:476): warning: could not obtain password interactively either
Sep 20 16:03:16 linux-bd9o sshd[11921]: pam_mount(mount.c:65): Messages from underlying mount program:
Sep 20 16:03:16 linux-bd9o sshd[11921]: pam_mount(mount.c:69): NOTE: mount.crypt does not support utab (systems with no mtab or read-only mtab) yet. This means that you will temporarily need to call umount.crypt(8) rather than umount(8) to get crypto volumes unmounted.
Sep 20 16:03:16 linux-bd9o sshd[11921]: pam_mount(mount.c:69): /usr/sbin/mount.crypt: dmcrypt cipher ignored for LUKS volumes
Sep 20 16:03:17 linux-bd9o sshd[11921]: pam_mount(mount.c:69): crypt_activate_by_passphrase: Operation not permitted
Sep 20 16:03:17 linux-bd9o sshd[11921]: pam_mount(pam_mount.c:521): mount of /home/test.img failed

The same error, crypt_activate_by_passphrase: Operation not permitted, shows up when I try to run
cd /home
mount test.img test

To clarify, I'd like to fix the error first, since I can probably at least follow the SSH recipe given by this sister question, if not modifying /etc/pam.d/sshd. Not being able to mount via command line is annoying.
The key is in CBC. I re-encoded it using these instructions, but the behavior is the same – local login works, SSH or command line mount fails. (Oddly, the octal dump did change, perhaps there is random information to prevent table lookups in the key.)


text:
Q: Inconsistent behavior selecting a text region within emacs I am trying to narrow down the causality for intermittent behavior that I am experiencing in Emacs.
In both cases below, I am hitting C-<space> to set the mark, subsequently followed up by one or more C-n's to move down lines to select a region. The trouble is that it doesn't seem to always work in the same manner, as shown in the two gifs below:
Expected behavior:

But what I am often seeing:

While this may be difficult to remotely diagnose, any help directing me in the right direction wrt to resolving this inconsistent behavior would be much appreciated. I am not an expert in Emacs and Elisp but can stumble my way around. I know there's not too much context here, but would this result from something odd happening within my .emacs? Or would it be more likely to stem from modes clashing? Fww, it has happened frequently in other major modes and is repeatable with the similar key sequence of consecutive C-N's
Thanks!

A: This is roughly about higlighting the region. However, there are many commands and variables which may affect this. No way to decide it from the pictures given. Suggest to send a bug report, which will include the settings and last commands called, so you may get help even in case of user-error.


text:
Q: Mocking when inheriting from pyserial I have a class that inherits from pyserial's serial.Serial class that looks something like this:
class SYM1(serial.Serial):
    def __init__(self, *args, debug=None, baudrate=4800, timeout=1, **kwargs):
        super().__init__(*args, baudrate=baudrate, timeout=timeout, **kwargs)
        LOG.info('using port %s', self.port)

    def read(self, count):
        ...
        return super().read(count)

    def write(self, data):
        ...
        return super().write(data)

    def connect(self):
        ...

    def send_command(self, cmd, *args):
        ...

I would like to write unit tests for the class, but I'm unsure how best to set things up such that (a) methods defined on the SYM1 class are callable normally, while (b) methods inherited from serial.Serial are mocked out.
I started with this:
import pytest
import serial

from unittest import mock

serial.Serial = mock.MagicMock
from symtool import symtool  # NOQA

@pytest.fixture
def sym(monkeypatch):
    s = symtool.SYM1('TESTDEV')
    s.connect()
    return s

def test_connect(sym):
    pass

But that fails here:
LOG.info('using port %s', self.port)

With:
AttributeError: Mock object has no attribute 'port'

and that puzzles me, because if it's a mock.Mock object, I would expect:
>>> from unittest import mock
>>> m = mock.Mock()
>>> m.port
<Mock name='mock.port' id='139910315631568'>

It's not just simple attributes; if I comment out the line causing the first AttributeError, it will instead fail later on when calling super().write:
AttributeError: 'super' object has no attribute 'write'

What's going on here, and what's the right way to do it?


text:
Q: How do i connect and do the ajax with get or post method? I have this JQuery code but its not getting success always giving following:
XMLHttpRequest cannot load http://localhost:8080/. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:8383' is therefore not allowed access. (17:21:10:896 | error, javascript)
  at win_1.html
Error: undefined (17:21:10:902)
  at win_1.html:18
Debugging session with browser was closed.

index.html:

response here:
fill me in

nodejs-server.js:
var http = require('http');
var util = require('util')
http.createServer(function (req, res) {
  console.log('Request received: ');
  util.log(util.inspect(req))
  // this line helps you inspect the request so you can see whether the data is in the url (GET) or the req body (POST)
  util.log('Request recieved: \nmethod: ' + req.method + '\nurl: ' + req.url)
  // this line logs just the method and url

  res.writeHead(200, { 'Content-Type': 'text/plain' });
  req.on('data', function (chunk) {
      console.log('GOT DATA!');
  });
  res.end('callback(\'{\"msg\": \"OK\"}\')');

}).listen(8080);
console.log('Server running on port 8080');

A: Add this after your console.log():

    console.log('Request received: ');
    if (req.method === 'OPTIONS') {
        //add needed headers
        var headers = {};
        headers["Access-Control-Allow-Origin"] = "*";
        headers["Access-Control-Allow-Methods"] = "POST, GET, PUT, DELETE, OPTIONS";
        headers["Access-Control-Allow-Credentials"] = true;
        headers["Access-Control-Max-Age"] = '86400'; // 24 hours
        headers["Access-Control-Allow-Headers"] = "X-Requested-With, Access-Control-Allow-Origin, X-HTTP-Method-Override, Content-Type, Authorization, Accept";
        // respond to the request
        res.writeHead(200, headers);
        res.end();
    } else {
        //rest of your code
    }

Source:
https://annasob.wordpress.com/2012/01/11/getting-around-cors-with-node-js/


text:
Q: Why does moving the adverb to the front remove ambiguity? Take the sentence

Students who study physics rigorously learn math.

As it stands, 'rigorously' can modify either 'study' or 'learn'. But if we move the adverb to the front to get

Rigorously, students who study physics learn math.

'rigorously' unambiguously modifies 'learn' and not 'study.' This should be clear to any native speaker of English. However, when I think about it this phenomena, it's not clear at all why this must be the case. After all, might it not be more logical for the adverb to modify the closest verb? What are the (scientific) explanations of this sort of syntactic behavior?

A: Moving the adverb immediately in front of the verb instead of the sentence eliminates the ambiguity, and also produces a structure that sounds like something a native speaker of English, and not a Martian, might generate **:

"Students who rigorously study physics learn math".

Incidentally, the assertion that in the sentence

"Rigorously, students who study physics learn math",

'rigorously' unambiguously modifies 'learn' and not 'study', is incorrect.
It doesn't modify either of those verbs (unambiguously or otherwise), because very few native speakers with normal cognitive abilities exist who would ever think of uttering (or writing) such a barbarism. Insofar as it can be said to modify anything at all, it modifies the entire sentence.

** Though the Martian would at least deserve some credit for effort.

A: The complex NP constraint, a grammatical principle discovered by John Ross, prohibits moving something from within a relative clause (RC) to a position outside the NP which contains the relative clause.  So, starting from

[S [NP students [RC ... rigorously ] ] ... ]

to get to

[S rigorously [NP students [RC ... __ ] ] ... ]

would require breaking this constraint.  However, starting from

[S [NP students [RC ... ] ] rigorously ... ]

moving "rigorously" to the beginning of the sentence does not break the law.
Thus, assuming the sentence is structurally ambiguous depending on whether "rigorously" is interpreted as part of the RC modifying "students" or not, the version with the adverb at the beginning could only have come from a sentence structure with the adverb outside of the RC.
John Lawler has a nice account of the Ross constraints on line -- see number 4 in his list.


text:
Q: Skype for Xubuntu 16.04 I have little problem with my skype client (Xubuntu 16.04). On skype.com we can download skype but for Ubuntu 12.04 or 10.04. My system version is not available but ok, I just downloaded version 12.04. Installed, all works good but I couldn't see my conference group. I have two system and on Windows everything work good. I thought it's wrong version so I removed and installed skype by command line:
sudo add-apt-repository "deb http://archive.canonical.com/ $(lsb_release -sc) partner"
sudo apt-get update
sudo apt-get install skype

Skype was well installed but problem returned with first start the application. Again I don't see my conference groups. My friend tell me: "You are in group", when I'am on Windows and start skype, yes I'am on group but Linux client don't show me this group. Why?! It's an application error?


text:
Q: Here Map Javascript API turn by turn navigation I am developing a HTML5 app where needs to show vehicle location according to coordinate and also the route(list of received customised coordinates) on the map in real time. Coordinates received via third party device.
I have tried leaflet library, google map, but didn't find a way to rotate/adjust the map(inside a div) according to the heading(the future coordinates).
The requirement is to have the vehicle icon always on the bottom center of the page and the route/heading points upwards. Similar to navigation apps. Any people know if it's possible in Here map Javascript API? Is it called turn by turn navigation?

A: There is a new release of the JS API planned which will provide this kind of scenario.
Please watch out for the JS API API release 3.1 on developer.here.com (roughly estimated by the end of May)


text:
Q: Hadoop map() function not being called My map() function doesn't seem to be called at all during my codes execution and I can't understand why. Below is my Job's class...
public class MyHadoopJob extends Configured implements Tool{

static class MyMapper extends Mapper<LongWritable, Text, LongWritable, Text>{

    public MyMapper(){
        System.out.println("Mapper init!");
    }

    @Override
    protected void map(LongWritable key, Text value,
                       org.apache.hadoop.mapreduce.Mapper<LongWritable, Text, LongWritable, Text>.Context context)
            throws java.io.IOException, InterruptedException {
        System.out.println("MAP!");
        context.getCounter("mygroup", "jeff").increment(1);
        context.write(key, value);
    };
}

@Override
public int run(String[] strings) throws Exception {

    Configuration conf = MYOBJ.getHadoopConf();
    this.setConf(conf);

    Job job = new Job(conf, "MyJob");
    job.setJarByClass(MyHadoopJob.class);
    job.setMapperClass(MyMapper.class);
    job.setOutputKeyClass(Text.class);
    job.setOutputValueClass(Text.class);
    job.setMapOutputKeyClass(LongWritable.class);
    job.setMapOutputValueClass(Text.class);

    FileInputFormat.setInputPaths(job, new Path(strings[0]));
    FileOutputFormat.setOutputPath(job, new Path(strings[1]));

    job.waitForCompletion(true);

    for(int i = 0; i < 10; i++){
        log.info("Progress -> " + job.mapProgress());
        Thread.sleep(15000);
    }

    return 0;
    }

}

I'd really appreciate some help figuring out why does the map() class or indeed the class initialization never get called?

A: It seems that you're using System.out.println statements to debug Hadoop jobs.
The problem with this approach is that println statements don't go to your console. They go to the job logs. That's why you don't see "Mapper init!" in your console.
You need to look at the job logs.
To quote a great man (and this answer):

Easy way to access the logs is
  http://example.com:50030/jobtracker.jsp->click on the completed
  job->click on map or reduce task->click on tasknumber->task
  logs->stdout logs.


text:
Q: Prove $\sum_{j=1}^{n}{j\cdot j!} = (n+ 1)!−1$ I got to the point in my proof by induction of (k+1+1)! -1 but I don't know where to go from there.

A: Hint: the induction step is just:
$$
(n+1)\cdot(n+1)!+(n+1)!-1=[(n+1)+1]\cdot(n+1)!-1=(n+2)!-1.
$$

A: you can use this
$$j.j! = (j+1)! - j! $$


text:
Q: Simple Query Help Using XRMToolbox I am using XRMToolbox and its tool "Bulk Data Updater" with Microsoft Dynamics CRM. I need to update a boolean value of multiple accounts after searching for them by account number. I believe it requires some type of JOIN.
I believe I have constructed the proper query, but when I try to Bulk Update (see picture), the attribute of the boolean value I need is not listed in the dropdown menu.
When I run this query:

*

*I get the results needed

*I get the specific user_id values I need, and I get their status "approved" which is the boolean value I need to change, but I can not edit these values because "approved" attribute is not listed in the dropdown menu

<fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="false" >
  <entity name="contact" >
    <attribute name="user_id" />
    <link-entity name="application" from="applicant" to="contactid" >
      <attribute name="approved" />
      <link-entity name="contact" from="contactid" to="applicant" >
        <filter type="or" >
          <condition attribute="user_id" operator="eq" value="0000021" />
          <condition attribute="user_id" operator="eq" value="0000055" />
        </filter>
      </link-entity>
    </link-entity>
  </entity>
</fetch>

A: When you want to set fields on an account, you need to query accounts, but you query contacts.

A: You already chose the XrmToolBox plugin to use for bulk update, but the query is not the expected one to update back the results - i.e., you mentioned account but the query only has contact and application entities joined. So obviously the query is not composed from the right direction.
If you want to update the application entity, build the query in FetchXML builder starting from application entity rather than from related contact side.
Or you can build the Advanced find query to use, (or download the fetchxml from there or even save that Adv.find query as CRM view to use in Bulk Data updater) you can simply export/bulk edit the records in Excel online to save back. You can select 250 records at once to Bulk edit wizard or to run Workflow to update.
Every single approach need the parent entity list from query to update the field. Start over.


text:
Q: Curl Get with site some and save csv i get in site picture title description image path etc and wants to save in csv file can help for this.
i get the preg_match_all with curl and i can print in screen.
How can i save and write .csv format

    function get_web_page( $url )
    {
        $options = array(
            CURLOPT_RETURNTRANSFER => true,     // return web page
            CURLOPT_HEADER         => false,    // don't return headers
            CURLOPT_FOLLOWLOCATION => true,     // follow redirects
            CURLOPT_ENCODING       => "",       // handle all encodings
            CURLOPT_USERAGENT      => "spider", // who am i
            CURLOPT_AUTOREFERER    => true,     // set referer on redirect
            CURLOPT_CONNECTTIMEOUT => 120,      // timeout on connect
            CURLOPT_TIMEOUT        => 120,      // timeout on response
            CURLOPT_MAXREDIRS      => 10,       // stop after 10 redirects
            CURLOPT_SSL_VERIFYPEER => false     // Disabled SSL Cert checks
        );

        $ch      = curl_init( $url );
        curl_setopt_array( $ch, $options );
        $content = curl_exec( $ch );
        $err     = curl_errno( $ch );
        $errmsg  = curl_error( $ch );
        $header  = curl_getinfo( $ch );
        curl_close( $ch );

        $header['errno']   = $err;
        $header['errmsg']  = $errmsg;
        $header = $content;
        return $header;
    }

For loop categories page
    $products = array();

    for ($i = 1; $i <= 1; $i++) {                 // Page categories

        $url = "https://www.sitename.com/pages?tp=$i";
        $c = get_web_page($url);

        $mylinks = '@showcasePicture">(.*?)<a href="/(.*?)"@si';
        preg_match_all($mylinks, $c, $dgetlinks);  // Get Page link
        array_push($array_link, $dgetlinks);

    }

Get image title etc but cant get in csv format
    for ($i = 1; $i <2 ; $i++) {              // Count categories Page
        for ($j = 0; $j < 2; $j++) {                   // Count Products Categories
            $dgetlinks = $array_link[$i][2][$j];
            $linked = "https://sitename.com/" . $dgetlinks;
            $d = get_web_page($linked);

            $price = '@
(.*?)
@si';
            $img_regex = '@lightbox-link="\/\/(.*?)"@si';
            $description_regex = '@
(.*?)
@si';
            $title_regex = '@
(.*?)
	@si';

            $products[] = [
                'title' => preg_match_all($title_regex, $d, $title),
                'description' => preg_match_all($description_regex, $d, $description),
                'picture' => preg_match_all($img_regex, $d, $img),  //Get Picture
                'price' => preg_match_all($price, $d, $price) // Get price
            ];

        }
    }

Create and save csv file

//Create CSV file
//$decoded_file = json_decode($products, true);
$fp = fopen(__DIR__.'/file2.csv', 'w');

fputcsv($fp, array_keys($products[0]));

//foreach ($decoded_file as $fields) {
foreach ($products as $fields) {
    fputcsv($fp, $fields);
}
fclose($fp);

i found this way


text:
Q: query to select a default value if a select comes empty It is a simple question but I am having serious problems to make it work in Access.
I have a query to do:
Select * from Rates where client="Jhonsons"

But if it doesn't exist Jhonsons as client, it needs to select a general, running this query:
Select * from Rates where client="General"

That is it. It seems a simple task but is giving me really much challenging and I would appreciate some help on this.
Thanks for you help!

A: You can use top and order by:
select top 1 r.*
from Rates as r
where client in ("Jhonsons", "General")
order by iif(client = "General", 2, 1)

There are other methods as well, such as:
select r.*
from Rates as r
where r.client = "Jhonsons" union all
select r.*
from Rates as r
where r.client = "General" and
      not exists (select 1 from Rates as r2 where r2.client = "Jhonsons") ;

A: You can use a conditional iif statement with the exists operator to test for the existence of the client record as part of the where clause, e.g.:
select r1.* from rates r1
where r1.client =
iif(exists (select 1 from rates r2 where r2.client = "Jhonsons"), "Jhonsons", "General")


text:
Q: Why my angualar.js filter runs 4 times? I am trying to do pagination for the list of students to be displayed.
Though the code is incomplete.
but still i am a little puzzled about why the filter which i have created run's 4 times,
and splice's my student array.
please follow the code,
below is StudentListAppFour.js
angular.module("StudentListApp")
    .constant("elementsPerPage","4")
    .constant("startIndex","0")
    .controller("StudentListCntrl",function($scope,elementsPerPage,startIndex){
$scope.data = [
    {
        id : 123,
        name : "John Grisham",
        major : "Computer Graphics",
        College : "Texas University",
        Grade : "A"
    },
    {
        id : 124,
        name : "Suzane Abignale",
        major : "Sociology",
        College : "Kellogs University",
        Grade : "B"
    },
    {
        id : 125,
        name : "Timothy Simsons",
        major : "Anthropology",
        College : "Nixxon Trust of Education",
        Grade : "B"
    },
    {
        id : 126,
        name : "Rick Sullivan",
        major : "Software Engineering",
        College : "Masachussate Institute of Technology",
        Grade : "A"
    },
    {
        id : 127,
        name : "Nathan Gonzales",
        major : "International Business",
        College : "Cambridge University",
        Grade : "A"
    },
    {
        id : 128,
        name : "Ridley Scott",
        major : "Computer Animation",
        College : "Masachussate Institute of Technology",
        Grade : "A"
    },
    {
        id : 129,
        name : "Jack Nicholson",
        major : "Market Grading and Statistics",
        College : "Cambridge University",
        Grade : "A"
    },
    {
        id : 130,
        name : "Jimmy Carlson",
        major : "Aironautics",
        College : "Prince of Walles University",
        Grade : "A"
    },
    {
        id : 131,
        name : "Jimmy Carlson",
        major : "Aironautics",
        College : "Prince of Walles University",
        Grade : "A"
    },
    {
        id : 132,
        name : "Garry Karlson",
        major : "Wealth Managment",
        College : "Keshav University",
        Grade : "C"
    }
];

$scope.studentsPerPage = parseInt(elementsPerPage);
$scope.studentFirstIndex = parseInt(startIndex);
$scope.studentLastIndex = parseInt(elementsPerPage);

$scope.getNextBatch = function(){
    var totalStudents = $scope.data.length;
    var firstIndex = $scope.studentFirstIndex + $scope.studentsPerPage;
    var lastIndex = firstIndex + $scope.studentsPerPage;
    if(lastIndex > totalStudents){
        lastIndex = totalStudents;
    }
    $scope.studentFirstIndex = firstIndex;
    $scope.studentLastIndex = lastIndex;
}

});

below is paginationFilter.js,
angular.module("PaginationModule",[])
    .filter("paginationFilter",function(){
        return function(students,firstIndex,lastIndex){
            console.log("-First Index "+firstIndex);
            console.log("-Last Index "+lastIndex);
            console.log(students.splice(firstIndex,lastIndex).length);
            return students;
        };
});

below is Ext04.html
<!DOCTYPE html>

    <title>Filter in Controller</title>

                Name
                Course
                College
                Grade

                    {{student.name}}
                    {{student.major}}
                    {{student.College}}
                    {{student.Grade}}

                        <input id="prevBTN" type="button" value="<"  />
                        <input id="nextBTN" type="button" value=">" ng-click="getNextBatch()" />

the javaScript log is as follows,
-First Index 0
-Last Index 4
4
-First Index 0
-Last Index 4
4
-First Index 0
-Last Index 4
2
-First Index 0
-Last Index 4
0

Please tell me why my array is getting spliced in 4 times and i get a 0 length array,
this happens at the first load of the page.

A: See this answer for an explanation for the filter being triggered multiple times.
You get a 0-length array because you are using splice with two parameters, the first one being the first element of the array, the second one being the length of it. You add no more parameters, which means no elements are added.
See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/splice


text:
Q: How can I simulate the middle mouse button on Linux? I just got a 4-button trackball mouse without a mousewheel (many of those don't have a mousewheel, for some reason), and I would like to make one of those buttons act like the middle mouse button (for the purpose of autoscrolling). The 4-buttons, by default, are for left click, right click, back and forward (i.e. back/forward a page while web browsing). I changed the back/forward buttons to act like page-up and page-down (using xte and xbindkeys as suggested in an answer to a question somewhere on StackExchange), but I wasn't completely satisfied with that; so, I'd like to turn one of those buttons (the back button) into the middle mouse button, and do something creative with the other one, but I don't know how to make one mouse button simulate another (nor do I know the name of the middle mouse button). I do, however, know how to make a mouse button represent a key or key combination on a keyboard (or how to make it launch a program or script). Edit: I found out a way to remap mouse buttons, but it doesn't seem to work with Button-2 (that's the right button, right? I'm wanting the button that makes a circle with arrows appear and when you move the mouse it scrolls in the direction you move it; also, when you click a link with it, it opens it in a new tab, and such).
Anyway, here's what I attempted putting in my .xbindkeysrc file:
"xte 'mouseclick 2'"
    b:8

Note: Pressing left-click and right-click at the same time doesn't simulate the middle mouse button on my OS (Xubuntu 17.04) with my mouse.

A: This can be solved by mapping mouse buttons to keyboard keys via xkbset: see Use keys for mouse buttons on linux. Alternative to AHK?


text:
Q: Is it possible to play sound from one iOS device to another? I'd like to somehow play music from one iOS device simultaneously on another, sort of like AirPlay, but from device to device.
It seems that by leveraging existing BT tech I should be able to make this happen, but I just haven't seen any examples nor have I read anything that suggests it's possible.

A: Check the following threads which might help to answer your question.
iOS Stream Audio from one iOS Device to Another
How do I stream AVAsset audio wirelessly form one iOS device to another?


text:
Q: What is the difference between Date and last modified in S3 bucket item?
I am trying to figure out the difference Last Modified and Date in headers of an S3 item.
Looks like Date was when the request was made and last modified was when it got created on S3.Am I reading it wrong?

A: Correct, Date is the timestamp of the response to your query:

The date and time Amazon S3 responded

And Last-Modified is the timestamp of, well, the last modification:

Object creation date or the last modified date, whichever is the latest.


text:
Q: the role of div in creating jquery objects I'm trying to create a grid of circles which change color when clicked. The code I currently have to create the grid visually (which works) is this:
var color = null;
for (var r = 0; r < 5; r++) { // row
    for (var c = 0; c < 5; c++) { // column
        var myCircle = document.createElement('div');
        myCircle.id = "circle";

        myCircle.style.left = r * 56 + "px";
        myCircle.style.top = c * 56 + "px";

        document.getElementById('grid').appendChild(myCircle); //maybe error
    }
}

I want to turn this into its jquery equivalent to handle the change in state on clicking. Here's what I've got so far:
var color = null;
for (var r = 0; r < 5; r++) { // row
    for (var c = 0; c < 5; c++) { // column

        var $myCircle = $("#circle");
        $myCircle.style.left = r * 56 + "px";
        $myCircle.style.top = c * 56 + "px";
        $(document).ready(function () {
        $($myCircle).click(function() {
         $($myCircle).css('backgroundColor', 'color');
               });
         });
        $('#grid').append($mycircle);
    }
}

Any idea where I'm going wrong? Do I need to introduce the 'div' somewhere in the above code? How?

A: you are selecting an element and not creating here
$("#circle");

try this
   $(document).ready(function () {
     for (var r = 0; r < 5; r++) { // row
      for (var c = 0; c < 5; c++) { // column
         var $myCircle = $("<div />").attr({class:"circle"}).css({left:r * 56 + "px" ,top :c * 56 + "px"}));  //creating a div element with its attributes...
         $('#grid').append($mycircle); //appending it to grid
      }
     }

      $('#grid').on('click','#circle',function() { //using on delegate for dynamically added  div
            $(this).css('backgroundColor', 'color');
       });
     });

for click event to work for dynamically added element, we need to delegate it to closest static parent. and ID should always be unique so its better to change your ID to class which i am doing here.
updated
updated some errors in your fiddle check it out..
remove the  . in mycircle
 var $myCircle = $('<div />').addClass('circle').css({
                        //-------------^---removed the `.`..

and changed all you javascript to jquery..
working fiddle

A: var $myCircle = $("#circle");

Should be:
var myCircle = $("#circle")[0];

Because you use the DOM native functions, but it's a jQuery wrapper.
Note that I removed the $ prefix from myCircle because now it's a DOM element.

A: When you're doing a bunch of appends like this, it performs better to use a document fragment. The code would look like this:
var frag = document.createDocumentFragment();
for (var r = 0; r < 5; r++) { // row
    for (var c = 0; c < 5; c++) { // column
        var $circle = $('<div/>').addClass('circle').css({left: r*56, top: c*56});
        frag.appendChild($circle.get(0));
    }
}
$('#grid').append(frag).on('click', '.circle', function(){
    $(this).css('backgroundColor', 'red');
});

But I suggest going with an inline-block approach to layout your circles. The Compass mix-in is really handy for this. Also, the border-radius Compass mix-in. This way, your code is reduce to:
var frag = document.createDocumentFragment();
for (var i = 0; i < 25; i++)
    frag.appendChild($('<div/>').addClass('circle').get(0));

$('#grid').append(frag).on('click', '.circle', function(){
    $(this).css('backgroundColor', 'red');
});

Also, you don't need to specify + 'px' on jQuery css props. Don't forget the / before the > in $('<div/>') either. I created a jsFiddle here with the last solution.
And here's the supporting SCSS:
$radius: 50px;
$gap: 6px;

#grid {
    width: ($radius + $gap) * 5;
}

.circle {
    display: inline-block;
    float: left;
    border-radius: $radius;
    width: $radius;
    height: $radius;
    border: $gap/2 solid white;
    background-color: yellowgreen;
}

Even better, have the click do a toggleClass('active') and set the CSS .active {color: red; }


text:
Q: Java generics. Type mismatch: cannot convert from object to I have the following generic Java class:
class A<T> {
    List<A> list;

    List<A> getList() {
        return list;
    }
}

When I try to get the first element of the list
A a = new A();
A b = a.getList().get(0);

I have the compiler error:
Type mismatch: cannot convert from Object to A

If I introduce an intermediary list:
A a = new A();
List<A> sameList = a.getList();
A b = sameList.get(0);

the error disappears, but the warning appears:
Type safety: The expression of type List needs unchecked conversion to conform to List<A>

The variable sameList has the same type as the method getList(). I am ready to put up with it, but I want to understand the reason. Why is there is a conversion?

A: This is one of the fun parts about raw types. Not only do you not get generic checks on the raw type itself, but it also causes generic checks for all interacting code to be skipped too.
Thus, when you use the raw type A, the List<A> you defined inside A is actually erased to List, so that getList returns a raw type List, and get(0) would return an Object.
This is also why you get an "unchecked conversion" warning. getList() returns a List, not a List<A>. So assigning a raw type List to a List<A> will produce an unchecked conversion warning.

The variable sameList has the same type as the method getList()

So you're actually wrong, here. sameList has a different type as the return type of getList() for the raw type A.
To solve this you'll need to parameterize all uses of A in your code.


text:
Q: Content of button adapts size according to button?
I want to resize content within a button so that when I "resize" my window, buttons also gets resized but size of content within button remains unchanged?
What should I do in order to make contents resized WRT button size.
Thanks, Faisal
PS: I am using GRID layout in WPF.

A: The easiest way that I can think of you doing that is for you to use a ViewBox element inside your Buttons:
<Button>
    <ViewBox>
        <!--Your Button content-->
    </ViewBox>
</Button>

A: I believe the best approach to this issue would be to actually make a tiny converter which would be dynamically controlling the text size.
Here is an example of such a converter:
C#
using System.Globalization;

public class FontSizeConverter : IValueConverter
{
    public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
    {
        double actualHeight = System.Convert.ToDouble(value);
        int fontSize = (int)(actualHeight * .5);
        return fontSize;
    }

    public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
    {
        throw new NotImplementedException();
    }
}

And then here is the usage of this class within your xaml:
XAML
...
<Window.Resources>
    <l:FontSizeConverter x:Key="FSConverter" />
</Window.Resources>
...
<Grid>
    <Button Content="Dat Button" FontSize="{Binding Path=ActualHeight, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=Grid}, Converter={StaticResource FSConverter}}"/>
</Grid>

Hope this helps, let me know if you will have any issues with that.
K.


text:
Q: iframe is not loaded in puppeteer My code:
async () => {
   const browser = await puppeteer.launch();
   const page = await browser.newPage();

   await page.goto('https://example.com' , {
      waitUntil: 'networkidle2'
   });

   await page.screenshot({path: 'home.png', fullPage: true});
   let frames = await page.frames();
   await page.screenshot({path: 'home.png', fullPage: true});
   var iFrame = frames.find(f => f.url().indexOf("https://accounts.") > -1);
   const usernameInput = await iFrame.waitForSelector("[name=username]" , {visible : true});
   await usernameInput.type(email);
   const passwordInput = await iFrame.waitForSelector("[name=password]" , {visible : true});
   await passwordInput.type(password);
   const navigationPromisePortal = page.waitForNavigation();
   await iFrame.click(".primary");
   await navigationPromisePortal;
   var cookies = await page.cookies();
   await browser.close();

   return cookies;
}

I'm trying to get cookies from example.com. But every time it accounts iFrame is not loaded. This page is built by react. How do I solve this problem?


text:
Q: How to resize RTF images I am writing an image to an RTF document using ColdFusion 9 and I want to size the images to a certain size. How would I do that in the RTF? I cannot change the stored image size or make a new one.
#reportData.image#\nestcell{\*\nesttableprops\trowd\trgaph108\trbrdrt\brdrs\brdrw10\brdrcf1 \trpaddl108\trpaddr108\trpaddfl3\trpaddfr3

A: you need to do this on the server side first using cfimage as just constraining the image to a particular size in the RTF document (which is what you are really asking in your question) does nothing to reduce the actual physical size of the image. As such, constraining a 1MB image that's 1024x768 to 240x320 in the RTF, still embeds a 1MB image in your file and wastes bandwidth and make opening the document slower.


text:
Q: In microcontroller (AVR), the interrupt vector take address $0000 to $003A so the program is start after that address? I'm studying microcontroller using Atmel 8-bit microcontroller datasheet, According to the datasheet, there's 3 types of internal memory in microcontroller

*

*Flash memory = program memory

*SRAM: 32 general purpose register as well as I/O register is located here

*EEPROM

So, when program counter (PC) fetchs instruction, it will fetch from flash memory where the program (instructions) is stored, starting from $0000 but then when I read interrupt chapter (ATmega 2560) , it says that interrupt vectors is stored at $0000 to $003A in program memory then does it mean when the microcontroller starts, PC will go through the interrupt vector list first and then instructions later?
Moreover, the interrupt is enabled by instruction which come after $003A so when the PC start from $0000 to $003A, microcontroller do nothing because at that time, intteruption haven't enabled yet?
I'm currently use two datasheet, Atmel ATmega 2560 and ATmega 16A

A: The first vector in the interrupt vector table (located at 0x0000) is the "Reset Vector". This is the first program memory address which is read by the CPU on power up1. The location in memory is usually filled with a JMP or RJMP instruction where the jump address is the start of your program.
If the reset vector is not correctly programmed (e.g. with an RJMP instruction or whatever), the CPU will simply keep counting along executing instructions as they appear - e.g. executing other interrupt vectors if there. If there are any other interrupt routines programmed into the vector table, these would all be executed in turn regardless of whether it's interrupt source was enabled or disabled.
When using something like avr-gcc, it is aware of the interrupt vector table and its structure, and will make sure that the reset vector points to the start of your program. In this case, the start of the program is actually not your main() function, but a load of stuff the compiler adds to initialise variables and whatnot. But after all of the initialisation stuff, your main() function would be called.

As an example, this is the disassembled vector table for one of my programs:
   0:   0c 94 72 00     jmp 0xe4    ; 0xe4 <__ctors_end>
   4:   0c 94 8f 00     jmp 0x11e   ; 0x11e <__bad_interrupt>
   8:   0c 94 8f 00     jmp 0x11e   ; 0x11e <__bad_interrupt>
   c:   0c 94 8f 00     jmp 0x11e   ; 0x11e <__bad_interrupt>
  10:   0c 94 4f 03     jmp 0x69e   ; 0x69e <__vector_4>
  14:   0c 94 8f 00     jmp 0x11e   ; 0x11e <__bad_interrupt>
  18:   0c 94 ef 03     jmp 0x7de   ; 0x7de <__vector_6>
  1c:   0c 94 8f 00     jmp 0x11e   ; 0x11e <__bad_interrupt>
  ...
  6c:   0c 94 8f 00     jmp 0x11e   ; 0x11e <__bad_interrupt>

Notice how avr-gcc adds a jump at address 0x0000 to what it calls __ctors_end which is basically a memory address after the end of the vector table where it's initialisation stuff starts. All unused vectors jump to something called __bad_interrupt - located at the destination of that jump is basically another jump instruction back to 0x0000 such that any occurrence of an unhandled interrupt resets the processor.

1. Some AVRs have a bootloader space and can be programmed to have the interrupt vector table at a different address than 0x0000, but the same still applies.

A: When an interrupt is triggered during a program execution(after you must have set and programmed it for interrupt of course) there are unique addresses in which your program counter will point to which is specific for each specific interrupts of your AVR microcontroller. These addresses just happens to be designated at the beginning of your flash memory, like you said from 0x0000(reset interrupt) to 0x003A.
Now when you program your AVR uC and then start your program with
.ORG 0
 what you have done is tell your assembler to start placing your program from address 0x0000, downwards..meanwhile you have actually written your programs on top of those interrupt addresses downwards.
Now what do you think will happen, if paraventure during the course of execution of your program you have set an interrupt?. By design, your Program Counter(PC) is to point to the unique address of that particular interrupt that just triggered which is usually among those specified addresses at the beginning of your flash memory. Then on pointing to that address it see an instruction and then starts to execute, that is the logic.
so therefore, what programmers do is avoid those address and then just place a function call on those
interrupt address if there is need for any interrupt in your program that you have written.
 I hope this helps

A: You can place your start point anywhere after the reset vector address.
If you use interrupts, you will want to at least steer clear of the interrupt vectors you use.  Unplanned interrupts, if they occur, will jump into your code and would likely be bad. (!)
Best practice is to start your code after the whole block of interrupt vectors. I typically start a project with all int vectors populated with a JMP or RJMP (depending on processor) to a trap for bad interrupts, where I set a breakpoint during development.   As I populate the ISRs, they get vectors to the appropriate locations.  When done, all unused ints are trapped, and then trigger a fault in my sanity check routine.
You could place the entry point anywhere past the int vector block. You might want to place tables between the int vector block and the code, but unless I have a specific reason to do otherwise, I typically allocate tables starting past the end of the code.


text:
Q: Navigation Drawer and Page Viewer in android EDIT :
After the recommendation of using TabStrip instead, I have been searching for it and I decided to used it instead of I was trying to do.
So the problem is still the same but different code:
In my navigation drawer I have a switch, which gives a Fragment fragment a Fragment value, and when I extend my TodayFragment with FragmentActivity I can´t make the last assignment because it throws a type mismatch error.
So here is part of the code (TodayFragment is now TodayFrag because I'm trying things without erasing classes):
Fragment fragment = null;
switch (position) {
case 0:
    fragment = new HomeFragment();
    break;
case 1:
    fragment = new TimetablesFragment();
    break;
case 2:
    fragment = new SubjectsFragment();
    break;
case 3:
    fragment = new TodayFrag();
    break;
case 4:
    fragment = new Others2Fragment();
    break;

default:
    break;
}

And now I have my PagerTabStrib from http://blog.pboos.ch/android-pagertabstrip-viewpager/ class:
public class TodayFrag extends FragmentActivity {}
ORIGINAL QUESTION:
I have my navigation drawer done, and in a certain point, i switch a position variable to determine which fragment I need to set in the view:
Fragment fragment = null;
switch (position) {
case 0:
    fragment = new HomeFragment();
    break;
case 1:
    fragment = new OneFragment();
    break;
case 2:
    fragment = new TwoFragment();
    break;
case 3:
    fragment = new TodayFragment();
    break;
case 4:
    fragment = new Others2Fragment();
    break;

default:
    break;
}

All fragments are classes that just extends Fragment except for TodayFragment(). TodayFragment() extends Fragment and implements ActionBar.TabListener because I'm trying to achieve a tab swipeable view in one of the fragments of the Navigation drawer:
public class TodayFragment extends Fragment implements ActionBar.TabListener {}

The problem comes in the first part of the code, it says "Type mismatch: cannot convert from TodayFragment to Fragment"
I don't know too much Java, and I'm stuck.
I hope someone could help
Thanks in advance

A: A better approach for tabs in a Fragment is to use a combination of ViewPager and PagerTabStrip as per the example at http://blog.pboos.ch/android-pagertabstrip-viewpager/
Keep in mind that ViewPager is from the support library, so you'll also have to use Fragments from the support library.

Original (incorrect) answer:
You need to cast your TodayFragment to a Fragment:
fragment = (Fragment) new TodayFragment();

A: As said Myanimal in his answer's comments, I think you have imported different classes of Fragment.

*

*this android.app.Fragment

*and this android.support.v4.app.Fragment
The ActionBar.TabListener you implemented or the TabStrip you are using are not the causes of the issue.
When an A class extends/implements a B class, the A class (the subclass) has the "same" properties as B (the base class):
public class A extends B  ==>  B b = new A(); is possible.
So try to remove all your imports and do CtrlShiftO to organize the imports. Then chose the same class of Fragments. The issue may disappear.


text:
Q: No WiFi / Intel Centrino Advanced-N 6205 [Missing Drivers/ Firmware] Ubuntu 16.04.2 First an foremost: I am a absolute Linux beginner, so have mercy if my problem seems easy to you.
My Brother gave me his old T420, so I decided to learn Linux and install Ubuntu on it. Unfortunately I can't establish a WiFi connection (my brother assured me it worked when he used it) so I'm pretty positive it's not a Hardware problem. In the terminal he finds the Network adapter when I type
lspci
03:00.0 Network controller: Intel Corporation Centrino Advanced-N 6205 [Taylor Peak] (rev 34)

I'm pretty sure I'm missing the required drivers, but I cant find a way to download them, as I'm used to just download them directly from the manufacturers site under windows.
Sorry if I seem so super stupid, but this is all pretty new for me. Here are the commands I found in other threats:
ifconfig
enp0s25   Link encap:Ethernet  HWaddr 00:21:cc:5e:b2:30
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:3069 errors:0 dropped:0 overruns:0 frame:0
          TX packets:2616 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:2298050 (2.2 MB)  TX bytes:316024 (316.0 KB)
          Interrupt:20 Memory:f2500000-f2520000

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:3819 errors:0 dropped:0 overruns:0 frame:0
          TX packets:3819 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1
          RX bytes:257315 (257.3 KB)  TX bytes:257315 (257.3 KB)

sudo rfkill list
0: tpacpi_bluetooth_sw: Bluetooth
    Soft blocked: yes
    Hard blocked: yes
1: phy0: Wireless LAN
    Soft blocked: no
    Hard blocked: yes

sudo lshw -class network
*-network
       description: Ethernet interface
       product: 82579LM Gigabit Network Connection
       vendor: Intel Corporation
       physical id: 19
       bus info: pci@0000:00:19.0
       logical name: enp0s25
       version: 04
       serial: 00:21:cc:5e:b2:30
       size: 1Gbit/s
       capacity: 1Gbit/s
       width: 32 bits
       clock: 33MHz
       capabilities: pm msi bus_master cap_list ethernet physical tp 10bt 10bt-fd 100bt 100bt-fd 1000bt-fd autonegotiation
       configuration: autonegotiation=on broadcast=yes driver=e1000e driverversion=3.2.6-k duplex=full firmware=0.13-3 ip=192.168.178.29 latency=0 link=yes multicast=yes port=twisted pair speed=1Gbit/s
       resources: irq:24 memory:f2500000-f251ffff memory:f252b000-f252bfff ioport:5080(size=32)
  *-network DISABLED
       description: Wireless interface
       product: Centrino Advanced-N 6205 [Taylor Peak]
       vendor: Intel Corporation
       physical id: 0
       bus info: pci@0000:03:00.0
       logical name: wlp3s0
       version: 34
       serial: a0:88:b4:4b:94:3c
       width: 64 bits
       clock: 33MHz
       capabilities: pm msi pciexpress bus_master cap_list ethernet physical wireless
       configuration: broadcast=yes driver=iwlwifi driverversion=4.8.0-36-generic firmware=18.168.6.1 latency=0 link=no multicast=yes wireless=IEEE 802.11
       resources: irq:29 memory:f2400000-f2401fff

dmesg | grep iwl
[   10.492168] iwlwifi 0000:03:00.0: can't disable ASPM; OS doesn't have ASPM control
[   10.702888] iwlwifi 0000:03:00.0: loaded firmware version 18.168.6.1 op_mode iwldvm
[   10.914050] iwlwifi 0000:03:00.0: CONFIG_IWLWIFI_DEBUG disabled
[   10.914052] iwlwifi 0000:03:00.0: CONFIG_IWLWIFI_DEBUGFS enabled
[   10.914052] iwlwifi 0000:03:00.0: CONFIG_IWLWIFI_DEVICE_TRACING enabled
[   10.914054] iwlwifi 0000:03:00.0: Detected Intel(R) Centrino(R) Advanced-N 6205 AGN, REV=0xB0
[   10.915537] iwlwifi 0000:03:00.0: L1 Enabled - LTR Disabled
[   10.915748] iwlwifi 0000:03:00.0: RF_KILL bit toggled to disable radio.
[   10.950926] ieee80211 phy0: Selected rate control algorithm 'iwl-agn-rs'
[   12.287868] iwlwifi 0000:03:00.0 wlp3s0: renamed from wlan0

sudo iwlist scan
enp0s25   Interface doesn't support scanning.

lo        Interface doesn't support scanning.

wlp3s0    Interface doesn't support scanning : Network is down

Sorry for spamming, I just wanted to make sure you got everything you might need. Also, as another piece of information, when I start the PC, right before he boots Ubuntu, the screen shows the Intel Boot Agent. He shows a new line, saying:
DHCP...
and waits there for 30 seconds, after that he states that something is missing (too short for me to read) and goes on.
Everywhere I look it says, that most of the drivers are included in Ubuntu and if someone had this problem, he was running on an old release. Im using 16.04.2, but I also tried 17.04 - without a change. Even Intel states, that this device is supported by Ubuntu.
Ethernet is working fine, btw.
If anyone is willing to help me - thanks. I'm sitting here for 6 hours and cant figure it out. Thanks in advance.

A: Now I'm feeling even dumber then 5 mins ago when posting this. There was indeed a tiny little switch on the side of the Notebook, disabling all wireless traffic. If I knew about this, the last hours wouldnt have been such a struggle. Thanks Pilot6 for the hint.
I'm feeling to ashamed leaving this post, but I will, maybe it will help others...
Case closed.


text:
Q: How to pass value from get_queryset() to get_context_data() As get_queryset() returns only one queryset and I need the length of the queryset search_store to the template file. So, I'm trying to send the value to the template through get_context_data.
I know I can get a length of a queryset through {{ queryset|length }}, but for some reason, it only returns a length of queryset separated by pagination, so I only get a partial length.
As you see the code, I'm trying to print search_stores.count(), and I need get it in get_context_data from get_queryset. Can anyone let me know how I can do that?
class SearchListView(ListView):
    model = Store
    template_name = 'boutique/search.html'
    paginate_by = 2
    context_object_name = 'search_stores'

    def get_context_data(self, **kwargs):
        context = super().get_context_data(**kwargs)
        context['search_text'] = self.request.GET.get('search_text')
        context['sorter'] = self.request.GET.get('sorter')
        if not context['sorter']:
            context['sorter'] = 'popularity'
        return context

    def get_queryset(self):

        search_text = self.request.GET.get('search_text')
        sorter = self.request.GET.get('sorter')

        if not sorter:
            sorter = 'popularity'

        if search_text:
            search_stores = Store.objects.filter(Q(businessName__icontains=search_text) | Q(mKey__icontains=search_text))
            if sorter == 'businessName':
                search_stores = search_stores.order_by(sorter)
            else:
                search_stores = search_stores.order_by(sorter).reverse()
        else:
            search_stores = ''

        for store in search_stores:
            store.mKey = store.mKey.split(' ')

        print(search_stores.count())
        return search_stores

A: if question is "How to pass value from get_queryset() to get_context_data()",
then get_queryset() returns object_list and you can access it following way:
    def get_context_data(self):
        .....
        something = self.object_list
        .....

A: When a list view is paginated, you can access the paginator in the template context with paginator.
Therefore you can access the length of the entire (unpaginated) queryset with:
{{ paginator.count }}

As an aside, your get_queryset method should always return a list or a queryset. When search_text is not specified, you could return an empty queryset, Store.objects.none().
def get_queryset(self):
    ...

    if search_text:
        ...
    else:
        search_stores = Store.objects.none()

    return search_stores

I would also avoid looping over the queryset to set store.mKey = store.mKey.split(' '). This will evaluate the entire queryset, not just the page that you are displaying. It might be better to add a property to your model, for example:
class Store(models.Model):
    ...

    @property
    def mkey_list(self):
        return self.mKey.split(' ')

Then in your template you can do something like:
{% for key in store.mkey_list %}
   {{ key }}
{% endfor %}

A: You can use {{ queryset.count }} instead of {{ queryset|length }}


text:
Q: How many steps are required for double transitivity? Let $A$ be a set of generators of $S_n$, or of a doubly transitive
subgroup of $S_n$. Assume $e\in A$, $A=A^{-1}$. What is the least $k$
such that $A^k$ is doubly transitive as a set? That is, what is the least $k$ such that there is a pair $x = (i,j)$, $i,j\in \{1,\dotsc,n\}$, $i\ne j$, for which $A^k x$ is
the set of all pairs of distinct elements of $\{1,2,\dotsc, n\}$?
The bound $k = O(n^2)$ is very easy. Can we prove $k =
O(n \log n)$? $k = O(n)$? As a starting exercise, can we at least
prove $k = O(n^{3/2})$?
Alternatively, can one construct a counterexample to $k=O(n)$? (Note the classical example $A = \{(1 2), (1 2 \dotsc n)\}$ is not a counterexample.)

A: It seems that this is a lower bound of $\Omega(n^2)$.
Take an $n$ and an $a=\Theta( n) $ coprime with $n$ (with $a<n/2$). Then the permutations $\sigma=(12\dots n) $ and $\tau=(1, a+1) $ generate $S_n$.
On the other hand, all residues modulo $n$ form a cycle where the neighbors differ by $a$. The only way to change this cyclic order is to apply $\tau$. If you need to shift a residue several times along the cycle, you need to apply $\sigma^a$ between $\tau$'s. You may need to perform $\Theta(n) $ such shifts, hence the bound.


text:
Q: How can I do CRUD operations through CrudRepository in Spring? I'm working with PostgresSQL and I have the following interface:
@Repository
public interface ExampleRepository extends CrudRepository<ExampleEntity, Long> { }

Then I try to get the bean:
ExampleRepository repository = ctx.getBean(ExampleRepository.class);

Of course, I can't do that, because there's no implementation and eventually I get
NoSuchBeanDefinitionException: No qualifying bean of type 'ExampleRepository'

I know this is a wrong approach, but since I'm not enough experienced, I've got no idea how I can communicate with my database. Any example I searched only explained how to implement services & controllers in order to interact with db through Browser. But I want to do CRUD operation inside the java code.
Could anyone explain it to me? Any related sources would also be fine.

A: I am not sure how you are getting context (ctx) here.
But the common approach is @Repository is not needed instead, @EnableJPARepositories should be used in the @Configuration file. Then use @Autowired to inject the repository into your service class (where you want to execute operation from your repository bean)
You can refer below link for more details
https://mkyong.com/spring-boot/spring-boot-spring-data-jpa/

A: You don't need to create bean. It will created by the spring framework because you annotated your interface as @Repository .You need only @Autowired in your service class or where do you want to use this reference.
@Autowired
private ExampleRepository exampleRepository;


text:
Q: UIControl actions based on mode I have over 100 IBActions in my app and I already implemented all the actions. Now the issue is my app can run two modes (called client and server modes) with the same UI. One way to update the app to support the two modes is:
@IBAction button_n_Action(_ sender:Any?) {

 if self.mode == server {
    // Server code
 } else {
    // Client code
 }

}

Only problem is n varies from 1 to 100, which to me sounds ugly, complex, repetitive code. Is there a cleaner, better, or clever way in Swift/XCode that I can easily separate client & server code?


text:
Q: Book about two kids sucked into a video game who fight evil radishes Trying to recall a book I frequently read as a child.
The plot revolves around two kids getting sucked into a video game, and the major thing that's sticking out to me is that they fought evil radishes.
The artwork was 8-bit style.


text:
Q: How to get numerical value from String containing digits and characters Is there any built in method to get which can parse int from string ("23px")?
I know I can use substring and then parseInt but I want to know if there is any other way available to do this.

A: parseInt will grab the first set of contiguous numbers:
parseInt('23px');

returns 23.
If there is any chance there will be leading zeros, use a radix:
parseInt('23px', 10);

which is a good habit in general.

A: parseInt can do it. Just use:
var num = parseInt("23px", 10);

It will parse the integer part and ignore the rest.


text:
Q: vb.net code is not running on asp.net page I wanted to make a simple asp.net example page with just shows "Hello, World!" and current time.
but it shows only "Hello, world!", not time. This is my code:
<html xmlns="http://www.w3.org/1999/xhtml">
 <head>
  <title>
   This is a test
  </title>
  <script language="VB" runat="server">
   Sub Page_Load(ByVal Sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    lblMessage.Text = DateTime.Now.ToString()
   End Sub
  </script>
 </head>
 <body>
  <p> Hello, World! </p>
  <asp Labelid="lblMessage" runat="server" />
 </body>
</html>

Why does this happen and what's cure for it?

A: The issue is probably the malformation of the label.
Not sure why you're using a label here in the first place (typically they're used for labeling form inputs)
<asp Labelid="lblMessage" runat="server" />

Should be
<asp:Label id="lblMessage" runat="server" />


text:
Q: How to make photo fill column size (Bootstrap)? As title says, I want image to fill column size, here is the photo:
https://i.stack.imgur.com/GBGrm.png
I tried with adding img-responsive but it doesn't work or I did it wrong.

A: As I can see your image size is too small, So you have 2 options for achieving what you want
1: Just use high resolution image and apply img-responsive class to img tag.
2: Or apply width:100% and height:auto to img tag, but in this case your image will be blurred.

.myImg {
  display: block;
  width: 100%;
  height: auto;
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">


text:
Q: Uso de bucles en Java, imprimir los días del año Me mandaron un trabajo practico de mi facultad, lo pude resolver pero me parece que no es lo que busca el profesor.
El enunciado es este:

Sabiendo que el 1/1/2021 fue viernes, imprimir todos los días del año 2021 de la siguiente manera:
viernes 1 de enero de 2021
hasta
viernes 31 de diciembre de 2021

Y para hacer eso tengo que usar bucles, estuve pensando y googleando lo mas que pude pero no se me cae una idea de como expresar la lógica T.T lo único que se me ocurrió lo adjunto a mi pregunta.
Estoy recién aprendiendo a programar con java y en la facultad vimos: switch, if else y bucles.
public class Tp7 {
    public static void main(String[] args) {
        for (int e = 1; e < 29; e += 7) {
            System.out.println("viernes " + e + " de enero de 2021");
            System.out.println("sabado " + (e + 1) + " de enero de 2021");
            System.out.println("domingo " + (e + 2) + " de enero de 2021");
            System.out.println("lunes " + (e + 3) + " de enero de 2021");
            System.out.println("martes " + (e + 4) + " de enero de 2021");
            System.out.println("miercoles " + (e + 5) + " de enero de 2021");
            System.out.println("jueves " + (e + 6) + " de enero de 2021");

        }
        System.out.println("viernes 29 de enero de 2021");
        System.out.println("sabado 30 de enero de 2021");
        System.out.println("domingo 31 de enero de 2021");

        for (int f = 1; f <= 22; f += 7) {
            System.out.println("lunes " + f + " de febrero de 2021");
            System.out.println("martes " + (f + 1) + " de febrero de 2021");
            System.out.println("miercoles " + (f + 2) + " de febrero de 2021");
            System.out.println("jueves " + (f + 3) + " de febrero de 2021");
            System.out.println("viernes " + (f + 4) + " de febrero de 2021");
            System.out.println("sabado " + (f + 5) + " de febrero de 2021");
            System.out.println("domingo " + (f + 6) + " de febrero de 2021");

        }

        for(int m = 1; m < 29; m += 7){
            System.out.println("lunes " + m + " de marzo de 2021");
            System.out.println("martes " + (m + 1) + " de marzo de 2021");
            System.out.println("miercoles " + (m + 2) + " de marzo de 2021");
            System.out.println("jueves " + (m + 3) + " de marzo de 2021");
            System.out.println("viernes " + (m + 4) + " de marzo de 2021");
            System.out.println("sabado " + (m + 5) + " de marzo de 2021");
            System.out.println("domingo " + (m + 6) + " de marzo de 2021");
        }
        System.out.println("lunes 29 de marzo de 2021");
        System.out.println("martes 30 de marzo de 2021");
        System.out.println("miercoles 31 de marzo de 2021");

        for(int a = 1; a < 29; a += 7){
            System.out.println("jueves " + a + " de abril de 2021");
            System.out.println("viernes " + (a + 1) + " de abril de 2021");
            System.out.println("sabado " + (a + 2) + " de abril de 2021");
            System.out.println("domingo" + (a + 3) + " de abril de 2021");
            System.out.println("lunes " + (a + 4) + " de abril de 2021");
            System.out.println("martes " + (a + 5) + " de abril de 2021");
            System.out.println("miercoles " + (a + 6) + " de abril de 2021");
        }
        System.out.println("jueves 29 de abril de 2021");
        System.out.println("viernes 30 de abril de 2021");

A: Una forma simple de imprimir un rango de fechas es utilizar un formato de fecha junto a una variable de fecha he ir incrementando el día en 1, de esta forma simplificaremos la complejidad del Código ya que no tendremos que manejar si el mes es de 28, 29, 30 o 31 ni variables extras:
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;

public class ImprimirDias {
    public static void main(String[] args) {
        // Definimos el formato de fecha a utilizar
        DateTimeFormatter formato = DateTimeFormatter.ofPattern("EEEE d 'de' MMMM 'de' yyyy");
        // Creamos las variables con el rango de fechas a imprimir
        LocalDate fecha = LocalDate.of(2021, 1, 1);
        LocalDate fechaFinal = LocalDate.of(2021, 12, 31);

        // Evaluamos que la fecha inicial sea anterior a fecha final,
        // como se quiere incluir la fecha final en los datos a mostrar se le suma un día.
        while (fecha.isBefore(fechaFinal.plusDays(1))){
            // Pasamos el formato de fecha deseado
            System.out.println(fecha.format(formato));
            // Se suma un día a la fecha para evaluar en el bucle si aun está en rango.
            fecha = fecha.plusDays(1);
        }
    }
}

Para el formato: "EEEE d 'de' MMMM 'de' yyyy"
EEEE: muestra el nombre del día completo "lunes, martes, miércoles, etc".
d: muestra el día del mes.
MMMM: muestra el nombre del mes completo "enero, febrero, etc"
yyyy: muestra el año en formato de 4 digitos.
'de': lo que esta entre comillas es texto que se agrega al formato.
Ejemplo de ejecución:
viernes 1 de enero de 2021
sábado 2 de enero de 2021
domingo 3 de enero de 2021
lunes 4 de enero de 2021
martes 5 de enero de 2021
miércoles 6 de enero de 2021
jueves 7 de enero de 2021
viernes 8 de enero de 2021
sábado 9 de enero de 2021
domingo 10 de enero de 2021
lunes 11 de enero de 2021
.
.
.

viernes 31 de diciembre de 2021

Tambien se puede utilizar DateTimeFormatter formato = DateTimeFormatter.ofLocalizedDate(FormatStyle.FULL); pero decidí
crear el formato de fecha para enseñar una forma más flexible.
Otro punto a tener en cuenta es que este método toma en cuenta el
idioma del PC donde de ejecuta, para definir el idioma para los
textos se debe utilizar DateTimeFormatter.ofPattern("EEEE d 'de' MMMM 'de' yyyy", Locale.ENGLISH).

A: Se me ocurre una solución con mucho menos código.
Para empezar definiría arrays con las cadenas con los nombres de los meses y los días de la semana, porque lo vas a repetir muchas veces y va a servir para ir recorriéndolos:
String[] semana = {"viernes", "sabado", "domingo", "lunes", "martes", "miercoles", "jueves"};
String[] meses = { "ene", "feb", "mar", "abr", "may", "jun", "jul", "ago", "sep", "oct", "nov", "dic"};

También definiría un array con los días que tiene cada mes:
int[] diasmes = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};

Y un índice diasemana que empezará en 0 y se incrementará hasta llegar a la longitud del array que guarda los nombres de los días de la semana. Con ese índice podremos recuperar el nombre de cada día:
int diasemana = 0;
//Recorremos todos los meses que hay en el array de meses:
for( int i = 0; i < meses.length; i++) {
    //Recorremos los días que tenga ese mes, que están en diasmes, cada mes 28, 30 o 31 días.
    for( int j = 0; j < diasmes[i]; j++) {
        //Cuando el día de la semana haya llegado al último, tenemos que volver a empezar con el primero.
        if( diasemana == semana.length)
            diasemana = 0;
        //j + 1 es el día del mes, meses[i] es el nombre del mes y semana[diasemana] el nombre del día de la semana.
        System.out.println( j + 1 + " de " + meses[i] + ", " + semana[diasemana ]);
        //Una vez usado un día de la semana, pasamos al siguiente.
        diasemana++;
    }
}


text:
Q: A question about loadCollections() in Milvus In the loadCollection() method, the first time I load four partitions (test1,test2,test3,test4), and the memory is full. Then I load a partition (test5) in the second time. Will the memory only contain the data from the newly loaded partition test5, or will the some data from the previous partitions (test1,test2,test3,test4) be swapped out?

A: Your second suppose is correct. When the memory is full, calling loadCollection() will result in a data swap.


text:
Q: Why is the "developmentMode" flag set on a library ignored? I have a randomly occurring issue (haven't yet really managed to figure out how to reproduce this, it happens erratically) with GAS libraries where development mode simply isn't working.
The static version of the library is always loaded regardless of the actual state of saved files in the library. The manifest files are in order, I have two scripts on two accounts (A and B) that use library C as a resource.
Script A manifest:
{
  "timeZone": "Europe/Paris",
  "dependencies": {
    "libraries": [{
      "userSymbol": "lib",
      "libraryId": "<id>",
      "version": "33",
      "developmentMode": true
    }]
  },
  "exceptionLogging": "STACKDRIVER"
}

Script B manifest:
{
  "timeZone": "Europe/Paris",
  "dependencies": {
    "libraries": [{
      "userSymbol": "lib",
      "libraryId": "<id>",
      "version": "33",
      "developmentMode": false
    }]
  },
  "exceptionLogging": "STACKDRIVER"
}

The library is at a static version 33 with dozens of changes and saves following the static version. I would expect script A to load the latest changes, but it's as static as script B.
I can't figure out what's going on.
I'm using clasp for sync if that matters. If I ditch clasp and use the built-in editor to do everything, after saving a new version manually, doing a few edits and then loading script A, it seems to magically start to work in development mode.
Using clasp after that (even to create newer static versions from the command line) will work for a period of time, and then randomly stop. One random clasp version command at a random period of time later will freeze the library at the newly created static version, and subsequent clasp push will be done, the files synced, but the development mode will cease to be enforced (even though it's on).
This would imply that clasp isn't syncing properly, but that's not true - opening the script in the browser editor shows that all the files are properly synced, saved, and showing changes well past the static version and the "development mode" switch follows the manifest files accordingly.

Upon further analysis, I suspect that it might have something to do with Google's caching servers? In this scenario: same Spreadsheet, two users on two different Google accounts accessing the Library in development mode, one is actually seeing development, the other is static. Clearing local browser cache and app data doesn't help, so it must be on the delivery end.
Google is having delays updating the development version across all users and all projects that use the library, maybe?
Summary
What makes the library START working in development mode again?
Opening the Library in the browser editor and saving a new version manually. Sometimes it has to be done multiple times to work.
What makes the library STOP working in development mode?
From what I can tell, clasp version, but not always. Yesterday I saved 5-6 versions with "clasp version" from the command line and subsequent clasp push commands did show up in development mode. It was the random Nth clasp version that broke stuff.

A: Based on the attempted steps to solve this, there is no clear solution.
Attempted steps:
Republish after push from clasp
Running clasp deploy -V <version> -id <deployment-id>
Outcome:
If you are a subscriber to a G Suite account, please contact the G Suite support for assistance.


text:
Q: Connecting C++ backend to Javascript I was hoping to make a website that displays a google map with points based of information returned by a C++ function.  I know you can use Java Server Pages to call java methods on the server with javascript.  Would there be a way to connect C++ code on the server with javascript in order to produce the same result as java server pages?

A: Since JavaScript runs at a completely different environment which is separated from the webserver by a HTTP connection, your best bet is to fire a HTTP request to the server side on a specific URL which has the particular C++ code attached.
You can fire asynchronous HTTP requests in JavaScript using XMLHttpRequest, the core technique behind "Ajax". The w3schools provides a concise introduction to Ajax. To make it all less verbose and bloated, you may consider to grab the jQuery library which has under each an $.ajax function for this purpose.

That said, Java Server Pages is absolutely not to be compared with JavaScript. JSP is a Java based server side view technology which provides a template to write HTML/CSS/JS in and offers capabilities to control the page flow dynamically and interact with backend Java code using taglibs and expression language. It runs all on the server machine, produces a HTML page and sends it over HTTP to the client side. The C++/C#/NET counterpart of JSP is ASP.


text:
Q: Vue.js data transfer between child and parent I am confused about components data.
Parent to Child use props.
Child to Parent use emit.
I am thinking about difference.
What I have learned, emit need event to transfer data.
So, the example, I learned it  always combine event like 'click'
This is point what I confused.
Why child to parent need emit event to send data.
I am think about are there certain way send data from child to parent no use event?


text:
Q: Sum rows from different conditions in Mysql The original table is large so I will simplify it:
mytable:
CONDITION SIZE
1          10
9          10
9          10
1          20
9          20
1          20
1          30

With a query similar to
SELECT
  CASE WHEN CONDITION=1 THEN 'OK' ELSE 'BAD' END AS Status,
  SUM (CASE WHEN SIZE=10 THEN 1 ELSE 0 END) AS Small,
  SUM (CASE WHEN SIZE=20 THEN 1 ELSE 0 END) AS Medium,
  SUM (CASE WHEN SIZE=30 THEN 1 ELSE 0 END) AS Large,
FROM mytable GROUP BY Status

Then we have this result
Status    Small    Medium    Large
OK         1         2         1
BAD        2         1         0

What is the proper code to get:
Status    Small    Medium    Large
OK         1         2         1
BAD        2         1         0
TOTAL      3         3         1

A: You can add a WITH ROLLUP clause to your GROUP BY condition like this:
SELECT
  CASE WHEN CONDITION=1 THEN 'OK' ELSE 'BAD' END AS Status,
  SUM (CASE WHEN SIZE=10 THEN 1 ELSE 0 END) AS Small,
  SUM (CASE WHEN SIZE=20 THEN 1 ELSE 0 END) AS Medium,
  SUM (CASE WHEN SIZE=30 THEN 1 ELSE 0 END) AS Large,
FROM mytable
GROUP BY Status WITH ROLLUP

This would yield a result set like:
Status    Small    Medium    Large
OK         1         2         1
BAD        2         1         0
[NULL]     3         3         1

You would need to understand the behavior that there would not be any Total value in the Status column. Instead the Status column would have a NULL value indicating that this is where the rollup is made.
For more information you can read the documentation here: http://dev.mysql.com/doc/refman/5.6/en/group-by-modifiers.html

A: If I understand correctly you need union in a total query since you cannot aggregate in different ways at the same time.
SELECT
  CASE WHEN CONDITION=1 THEN 'OK' ELSE 'BAD' END AS Status,
  SUM (CASE WHEN SIZE=10 THEN 1 ELSE 0 END) AS Small,
  SUM (CASE WHEN SIZE=20 THEN 1 ELSE 0 END) AS Medium,
  SUM (CASE WHEN SIZE=30 THEN 1 ELSE 0 END) AS Large,
FROM mytable GROUP BY Status

UNION

SELECT
  'Total' AS Status,
  SUM (CASE WHEN SIZE=10 THEN 1 ELSE 0 END) AS Small,
  SUM (CASE WHEN SIZE=20 THEN 1 ELSE 0 END) AS Medium,
  SUM (CASE WHEN SIZE=30 THEN 1 ELSE 0 END) AS Large,
FROM mytable


text:
Q: how to assign the result of a batch command to a variable If on the command line I execute:
c:\digitemp.exe -t0 -o%C -q  > res1.txt

res1.txt contains correctly the numerical temperature in Celsius (say: 24.23456). But if the same command is executed inside a bat file (say: test.bat):
@ECHO OFF
ECHO Hola pootol!
ECHO.
c:\digitemp.exe -t0 -o%C -q  > res1.txt
rem set pootol = < res1.txt
rem set pootol
ECHO Prem una tecla per sortir.
pause > null

res1.txt contains a wrong Celsius value that I suspect is related to the argument " -o%C ". As you can see I rem the variable assing cause pootol var is wrong assigned with the Celsius value before it is mentioned. What am I doing wrong?

A: The problem in your case is the % sign, as it's evaluated different in the cmd-line and in batch files.
In batch files you can escape it with doubling it.
So your code looks like
c:\digitemp.exe -t0 -o%%C -q  > res1.txt

A: In batch files % is used to denote variables.  So %C is interpreted inside the batch file as a variable and replaced with its value.  Since it doesn't have a value it is replaced with an empty string.
Use the caret ^ character to escape the % so that the interpreter treats the % as a normal character.
c:\digitemp.exe -t0 -o^%C -q  > res1.txt


text:
Q: VS2015 Load testing - How can a request take longer than the max time generated by load test analysis results? In my test mix if my simulated users are all making the same exact request over and over, how is possible for me in the detailed tab to see that a individual request had a longer duration than the max page response time shown by the load test analysis?

A: The two values are not comparable.
The details tabs does not show page times, it shows test durations. A test can contain several requests. Each request can cause several pages (ie dependant requests) to be loaded. Each request can have think times.


text:
Q: how to render component from onclick function in react? i am working on react application.i need to render a gallery of photo when user click..i want to render from onclick function.But i am not able to handle.. my code is:
   <div onClick={this.handleClick}
    style={{ backgroundColor: 'lightgoldenrodyellow', float: 'right' }}>
   </div>

my handle click function is this:
handleClick() {
    let images = [];
    {

      _.filter(this.props.data.gallery).map((photo) => {
        if (photo === null) {
          images.push(
            {
              src: emptyImage,
              thumbnail: emptyImage
            }
          )
        } else {
          images.push(
            {
              src: photo,
              thumbnail: photo
            }
          )
        }

      });
      console.log('1');
    console.log(images)
    console.log('2');
    return <Gallery images={images} enableImageSelection='true'  isOpen= {true} rowHeight='120' />;
    }

}

i am using react grid gallery for that.but onclick its not working.WHere I am doing wrong??


text:
Q: Spring boot and Zuul proxy DeferringLoadBalancerExchangeFilterFunction Error I have a simple app that uses Netflix Zuul as an API gateway
I added the Zuul dependency in the pom.xml file as follows:
<dependency>
    <groupId>org.springframework.cloud</groupId>
    <artifactId>spring-cloud-starter-netflix-zuul</artifactId>
    <version>2.2.10.RELEASE</version>
</dependency>

and @EnableZuulProxy for the main class of the app
The problem is that whenever I try to run the API, It fails to start and shows in the console:

Consider defining a bean of type
'org.springframework.cloud.client.loadbalancer.reactive.DeferringLoadBalancerExchangeFilterFunction'
in your configuration.

I couldn't solve the issue, what's the problem?

A: The issue was solved when I added the following dependency in pom.xml:
    <dependency>
        <groupId>org.springframework.cloud</groupId>
        <artifactId>spring-cloud-starter-loadbalancer</artifactId>
    </dependency>

and as a result, spring also asked me to add this to my app configuration:
spring.main.web-application-type=reactive

Then my API ran successfully without failing or throwing any exception


text:
Q: pca analysis using factominer and factoextra packages / libraries library(factoextra)
library(FactoMineR)

res.pca = PCA(clin.oc[,1:14], graph = TRUE)
scree = fviz_screeplot(res.pca, ncp=5, addlabels=TRUE, size=0.5, title='Scree
plot')
loadings = plot(res.pca, choix = "var", title='Loadings')

n = fviz_contrib(res.pca, choice = "var", axes = 1, top = 5, title='Variable
contributions')
scores = fviz_pca_ind(res.pca, label="none", habillage=as.factor(clin),
                      tittle='scores')
ggarrange(scree, loadings, n, scores)

and ggarange function wont work, says it is not found.

A: I think the error is already in res.pca because your 'identifier' variable is of type character.  Take those out (guess: PCA(clin.oc[,2:14], …).


text:
Q: Python internal implementation I am new to Python, I am coming from Java. I just want to see the python internal implementation like how I can see the java internal codes in eclipse by importing lib.
I was just trying to open print() method implementation in spider for python. But I don't know how to do this.


text:
Q: How to implement cheap LFF 3.5" SATA storage on a HP ProLiant ML350 G6 with 2.5" SFF SAS In a series of bad, hasty decisions, a HP ProLiant ML350 G6 server was bought for file server use at my place of work. The intention was to build a FreeNAS 8 server using cheap 3.5" SATA drives.
Only the HP ProLiant ML350 G6 unit we got is equipped for 2.5 SAS drives. Smooth.
2.5" SAS drives are very expensive and not roomy enough for a NAS. We can't return the (over-specced) machine either so it's currently serving as an expensive door stop.
Someone suggested that I buy a device like the "MicroStorage Multi raid box 5hdd SATA Hdd", an ESATA drive enclosure and an ESATA controller for the server. Only this device is out of stock everywhere in Northern Europe and apparently no longer manufactured.
The ProLiant ML350 G6 does have five bays for optical drives and I could probably find some parts to make 3.5" SATA hdds fit in there.
Any suggestions as to what I should do to get a functioning file FreeNAS server out of this?
EDIT: Our reseller bluntly claimed that the ML350 G6 SFF can't be converted to support LFF drives when I explicitly asked about something I thought was a drive cage replacement spare part mentioned in a manual. This answer suggests otherwise.

A: Get "cheap" 2.5" SATA drives, they work in SAS enclosures. If you're using a Pxxx series controller (the norm in HP servers) it might not work with just any drives, and is guaranteed to not run at optimum (HP uses custom firmware on their drives to get the most out of them). I really could not recommend one particular drive over another, though I've had good luck with Seagate and Western Digital drives and Pxxx SA Controllers.
If you're willing to spend a bit more (usually worth it) you can even get HP 2.5" SATA drives and they'll run as intended with the Pxxx SA Controller; and be warrantied under the server's warranty.
HP 2.5" SATA Drives:

*

*1.0TB PN: 625609-B21

*0.5TB PN: 507750-B21

A: We just did it. You need just 2 parts at a cost of around 100 EUR/USD: the backplane (511787-001) and the cage (511784-001). Additional cables were not needed.
Some sites say that the SFF cage can be converted to LFF by removing a metallic inset, but this is not true. The SFF cage included with the server cannot be altered. Maybe in the past the conversion was possible, but at present it isn't.

A: You need a one or two of HP Part Number 487936-B21, it's a 'HP ML350/ML/DL370G6 2 Large Form Factor Drive Kit' and your server can take two of them for up to 8 LFF disks. It'll be easy to replace the drive cages if you've got a screwdriver and some time.
Oh and you might want some HP P/N: 389015-001 LFF blanking plates if you want it to look pretty too.

A: You have several options.
You could use 2.5" nearline SAS drives with capacities up to 1TB.
You could also convert your ML350 to accommodate the large form-factor disks.
Refer to the ML350 G6 quickspecs, but it should be possible to shift to LFF drives.

A: all you need is this, the power adapter to adapt molex to sata power and the right length sata cable to plug into the motherboard, I bought 4 of these , work perfectly
https://smile.amazon.com/gp/product/B000KS8S9W/ref=oh_aui_detailpage_o04_s00?ie=UTF8&psc=1


text:
Q: How to call WIN32 DLL in C# project - EntryPointNotFoundException I have created a WIN32 DLL project and its dllmain.cpp is as follows;
BOOL APIENTRY DllMain( HMODULE hModule,
                       DWORD  ul_reason_for_call,
                       LPVOID lpReserved
                     )
{
    switch (ul_reason_for_call)
    {
    case DLL_PROCESS_ATTACH:
    case DLL_THREAD_ATTACH:
    case DLL_THREAD_DETACH:
    case DLL_PROCESS_DETACH:
        break;
    }
    return TRUE;
}

_declspec(dllexport) float RGBCompare()
{
    return 100;
}

My target is to call method RGBCompare from a C# project and as per rule I have mentioned dllexport tag before it.
On the other side in C# project I have defined an entry point as follows;
namespace LogoFinderWrapper
{
    public class LogoFinder
    {
        [DllImport("LogoIdentifier.dll", EntryPoint = "RGBCompare")]
        private static extern float Api_RGBCompare();

        public static float RGBCompare()
        {
            return Api_RGBCompare();
        }
    }
}

When I call DLL it raises exception System.EntryPointNotFoundException.
Please could any one help me in this regard?

A: Your native code is C++ and the name is mangled before export. Possible solutions:

*

*Use the mangled name in the EntryPoint parameter. Find out the mangled name with dumpbin or Dependency Viewer.

*Use a .def file rather than __declspec(dllexport) to control which functions are exported.

*Suppress mangling with extern "C" in your C++ source code.

The final option would look like this:
extern "C"
{
    __declspec(dllexport) float RGBCompare()
    {
        return 100;
    }
}