text:
Q: domdocument throws error as "user-defined type not defined" in vb6.0 windows 10, i referred the xml 6.0 in my project In VB 6.0 (Windows 10) I am facing compile time error at DOMDocument:

User-defined type not defined

The same code compiled in XP. I need to know the reason and fix for this issue.
Friend Sub Load(xDocvar As DOMDocument)

Actual result: it throws error message as "user-defined type not defined".
Expected result: it shouldn't throw error.

A: The XML 6.0 is not exactly backward compatible: some classes now have different names. For example, you should use:
Friend Sub Load(xDocvar As DOMDocument60)


text:
Q: Определить битая таблица или нет Доброго всем времени суток, господа.
repair table table - чудесная команда для восстановления таблицы, есть правда нюанс.. Вот работаете вы работаете, и раз.. таблица сдохла.. понятное дело надо восстановить.. но ведь не понятно когда она сдохнет.
Можно ли каким то образом настроить, что бы таблица перед любым запросам автоматом проверялась на "не_битость" и если она "битая" - восстановить автоматом.
P.s. конечно трайКэч можете посоветовать, но тогда как определить "битость" таблицы ?
A: CHECK TABLE есть такой запрос:
http://dev.mysql.com/doc/refman/5.1/en/check-table.html
Нужно сверить Msg_type на error.
А такое будет в Msg_text: Table upgrade required. Please do "REPAIR TABLE tbl_name" to fix it

redpajama_set_name: RedPajamaStackExchange


text:
Q: Acer Aspire V5-571G Recovery Partition I bought an Acer Aspire V5-571pg early last year. I remembered at the time that the C drive was too big. I normally have a large collection of data which I store in the E (data) drive away from the OS drive. So naturally I used partition magic to resize. Little did I know that it is causing me such grief when I try to do a restore.
At this point, I need to restore the system to the factory default. In doing so, I get this error:
"Hard drive configuration is not set to the factory default. Restore aborted."
Upon checking the partition, the drive structure appears to be:

*

*Unallocated: 1MB

*OEM Partition: 400MB

*EFI System Partition: 300MB

*Other: 128MB

*ACER C: 194.55GB

*Recovery Partition: 350MB

*DATA E: 488.28GM

*Push Button Reset: 14.65GB

*Unallocated: 871KB

Why the hell does ACER need so many bloody partitions? And why did they put the recovery drive smack bang in between drive C and E. In any case, I believe that it could be the fact that I resized the drive and shifted the Recovery Partition to the left causing the restore to fail to read the start of the recovery section.
I can't even begin to fathom where it originally was, as there is no manual to cover such issue. Does anyone know how Acer Recovery Utility determine what section of the drive to look for? And if so, what section is it so that I can use the Partition magic to put it back in the right place?

A: What comes to mind:

*

*Go back in time and burn recovery DVDs.

*Try asking Acer support / forums, that's probably your best chance of finding someone who really knows about Acer recovery partitions.

*Forget about it and reinstall windows yourself.
Download windows iso from microsoft (possible for windows 7, probably for windows 8 as well) and reinstall using the key on your laptop sticker. Install missing drivers.

A: Badly managed partitioning structure, causes system to work slower too; unalocated space assigned by OS will be higher than on your drive, but all the other drives highly advisable to wipe out.
 The recovery drive can be active partition- nowadays there are plenty better solutions, no reasons keeping this mess if you can manage it yourself.


text:
Q: Krypton Components Textbox - How to Change Font Size and Textbox Size Can anyone help me change the font of a textbox in my krypton ribbon control.  There is no simple property like there is for a windows control.  Looks like i may need to use the pallete control  can anyone help me!!! using VB.net

A: You can do it from the properties window of the KryptonTextBox1 :
StateCommon => Content => Font


text:
Q: For loop causes page to crash Index.php
<?php
    require_once("inc/db.php");
    require_once("inc/map.php");

    $db = new Database();
    $map = new Map($_POST['x'], $_POST['y']);
    $map->createMap();
    $map->battle();
    $map->move();
?>

<link rel="stylesheet" type="text/css" href="css/style.css"/>

Db.php
<?php
    class Database{
        private $config;
        protected $sql;

        public function __construct(){
            $this->Connect();
        }

        public function Connect(){
            $this->config  = parse_ini_file("config.ini");
            $con = $this->config;
            $this->sql = new PDO("mysql:host={$con['host']}; dbname={$con['dbname']}",
            $con['username'],$con['password']);
            $this->sql->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
        }
    }
?>

Map.php
<?php
    class Map extends Database{

      public $x;
      public $y;
      public $width = 5;
      public $height = 5;

      public function __construct($x,$y){
            $this->x = $x;
            $this->y = $y;
      }

      public function createMap(){
          for($x=0; $x < $this->width; $x++){
              for($y=0; $y < $this->height; $y++){
                  Database::Connect();
                  echo "
";
                  echo "
";
                  $this->spawnPlayers($x,$y);
                  echo "
";
              }
              echo "

";
          }
      }

      public function spawnPlayers($x,$y){
          $stmt = $this->sql->prepare('SELECT * FROM user WHERE x = "'.$x.'" AND y = "'.$y.'"');
          $stmt->execute();
          while($rows = $stmt->fetch(PDO::FETCH_ASSOC)){
              echo "";
          }
      }

      public function battle(){
          $stmt = $this->sql->prepare("SELECT * FROM user GROUP BY x,y HAVING count(*) > 1");
          $stmt->execute();
          $rows = $stmt->fetch(PDO::FETCH_ASSOC);
          if($rows){
              echo "<input type='submit' id='battle-btn' value='Fight'>";
          } else{
          }
       }

       public function move(){
         if(isset($this->x) && isset($this->y)){
            $stmt = $this->sql->prepare("UPDATE user SET x = '$this->x', y = '$this->y' WHERE name = 'Wiz'");
            $stmt->execute();
         }
       }
    }
?>

Index.js
$(document).ready(function(){
    $(document).on("click", ".map_columns", function(){
        var x = $(this).attr("data-x");
        var y = $(this).attr("data-y");
        $.post('./index.php', {x: x, y: y}, function(){

        });
    });

    setInterval(function(){
        $("#map").load("./index.php");
    }, 1000);
});

So I made a map using for loops and the data being outputted is the user coordinates.  Wherever I press on the map, it will update the users coordinates to that location.  This works as intended but I have an issue. I need the map to auto refresh / update when a users coordinates have been updated.
So my approach was to use .load() in ajax as I use in most projects but the difference here is the for loop.  I'm assuming because it reinterates the for loop a second time, it causes everything to crash. How can I solve this problem? I know games have done the same but I can't think of a counter-solution.  The code written is pretty understandable.
I re-wrote the original version so it's clean and understandable for stackoverflow, the original looks as below:
https://i.gyazo.com/a34793a0af0344b867f0537830da5cd3.mp4
It's being auto updated using the html  which isn't viable.  So please how can I update the div with new information(players axis) without the page crashing?

A: The problem is that you're loading the entire page into the #map DIV, but you just want to replace its own contents. Change it to:
    $.get("index.php", function(response) {
        $("#map").replaceWith($(response).find("#map"));
    });

It would probably be better to create a new script that just returns what you want, instead of using index.php and then ignore all the other contents.


text:
Q: Make cat command to operate recursively looping through a directory I have a large directory of data files which I am in the process of manipulating to get them in a desired format. They each begin and end 15 lines too soon, meaning I need to strip the first 15 lines off one file and paste them to the end of the previous file in the sequence.
To begin, I have written the following code to separate the relevant data into easy chunks:
#!/bin/bash

destination='media/user/directory/'
for file1 in `ls $destination*.ascii`
do
    echo $file1
    file2="${file1}.end"
    file3="${file1}.snip"
    sed -e '16,$d' $file1 > $file2
    sed -e '1,15d' $file1 > $file3
done

This worked perfectly, so the next step is the worlds simplest cat command:
cat $file3 $file2 > outfile

However, what I need to do is to stitch file2 to the previous file3. Look at this screenshot of the directory for better understanding.
See how these files are all sequential over time:
*_20090412T235945_20090413T235944_*    ### April 13
*_20090413T235945_20090414T235944_*    ### April 14

So I need to take the 15 lines snipped off the April 14 example above and paste it to the end of the April 13 example.
This doesn't have to be part of the original code, in fact it would be probably best if it weren't. I was just hoping someone would be able to help me get this going.
Thanks in advance! If there is anything I have been unclear about and needs further explanation please let me know.

A:
"I need to strip the first 15 lines off one file and paste them to the end of the previous file in the sequence."

If I understand what you want correctly, it can be done with one line of code:
awk 'NR==1 || FNR==16{close(f); f=FILENAME ".new"} {print>f}' file1 file2 file3

When this has run, the files file1.new, file2.new, and file3.new will be in the new form with the lines transferred.  Of course, you are not limited to three files: you may specify as many as you like on the command line.
Example
To keep our example short, let's just strip the first 2 lines instead of 15.  Consider these test files:
$ cat file1
1
2
3
$ cat file2
4
5
6
7
8
$ cat file3
9
10
11
12
13
14
15

Here is the result of running our command:
$ awk 'NR==1 || FNR==3{close(f); f=FILENAME ".new"} {print>f}' file1 file2 file3
$ cat file1.new
1
2
3
4
5
$ cat file2.new
6
7
8
9
10
$ cat file3.new
11
12
13
14
15

As you can see, the first two lines of each file have been transferred to the preceding file.
How it works
awk implicitly reads each file line-by-line.  The job of our code is to choose which new file a line should be written to based on its line number.  The variable f will contain the name of the file that we are writing to.

*

*NR==1 || FNR==16{f=FILENAME ".new"}
When we are reading the first line of the first file, NR==1, or when we are reading the 16th line of whatever file we are on, FNR==16, we update f to be the name of the current file with .new added to the end.
For the short example, which transferred 2 lines instead of 15, we used the same code but with FNR==16 replaced with FNR==3.

*print>f
This prints the current line to file f.
(If this was a shell script, we would use >>.  This is not a shell script. This is awk.)
Using a glob to specify the file names
destination='media/user/directory/'
awk 'NR==1 || FNR==16{close(f); f=FILENAME ".new"} {print>f}'  "$destination"*.ascii

A: You could store the previous $file3 value in a variable (and do a check if it is not the first run with -z check):
#!/bin/bash

destination='media/user/directory/'
prev=""
for file1 in $destination*.ascii
do
    echo $file1
    file2="${file1}.end"
    file3="${file1}.snip"
    sed -e '16,$d' $file1 > $file2
    sed -e '1,15d' $file1 > $file3
    if [ -z "$prev" ]; then
       cat $prev $file2 > outfile
    fi
    prev=$file3
done

A: Your task is not that difficult at all. You want to gather a list of all _end files in the directory (using a for loop and globbing, NOT looping on the results of ls). Once you have all the end files, you simply parse the dates using parameter expansion w/substing removal say into d1 and d2 for date1 and date2 in:
stuff_20090413T235945_20090414T235944_end
     |    d1  |      |    d2  |

then you simply subtract 1 from d1 into say date0 or d0 and then construct a previous filename out of d0 and d1 using _snip instead of _end. Then just test for the existence of the previous _snip filename, and if it exists, paste your info from the current _end file to the previous _snip file. e.g.
#!/bin/bash

for i in *end; do         ## find all _end files
    d1="${i#*stuff_}"     ## isolate first date in filename
    d1="${d1%%T*}"
    d2="${i%T*}"          ## isolate second date
    d2="${d2##*_}"
    d0=$((d1 - 1))        ## subtract 1 from first, get snip d1
    prev="${i/$d1/$d0}"   ## create previous 'snip' filename
    prev="${prev/$d2/$d1}"
    prev="${prev%end}snip"
    if [ -f "$prev" ]     ## test that prev snip file exists
    then
        printf "paste to : %s\n" "$prev"
        printf "    from : %s\n\n" "$i"
    fi
done

Test Input Files
$ ls -1
stuff_20090413T235945_20090414T235944_end
stuff_20090413T235945_20090414T235944_snip
stuff_20090414T235945_20090415T235944_end
stuff_20090414T235945_20090415T235944_snip
stuff_20090415T235945_20090416T235944_end
stuff_20090415T235945_20090416T235944_snip
stuff_20090416T235945_20090417T235944_end
stuff_20090416T235945_20090417T235944_snip
stuff_20090417T235945_20090418T235944_end
stuff_20090417T235945_20090418T235944_snip
stuff_20090418T235945_20090419T235944_end
stuff_20090418T235945_20090419T235944_snip

Example Use/Output
$ bash endsnip.sh
paste to : stuff_20090413T235945_20090414T235944_snip
    from : stuff_20090414T235945_20090415T235944_end

paste to : stuff_20090414T235945_20090415T235944_snip
    from : stuff_20090415T235945_20090416T235944_end

paste to : stuff_20090415T235945_20090416T235944_snip
    from : stuff_20090416T235945_20090417T235944_end

paste to : stuff_20090416T235945_20090417T235944_snip
    from : stuff_20090417T235945_20090418T235944_end

paste to : stuff_20090417T235945_20090418T235944_snip
    from : stuff_20090418T235945_20090419T235944_end

(of course replace stuff_ with your actual prefix)
Let me know if you have questions.


text:
Q: FireBase cloud messaging открыть ссылку по клику на уведомлении шлю вот такие данные
{
  'title' : "title",
  'body'  : "http://google.com",
}
"data" : { "url" : "http://google.com"  }

пробую сделать вот так:
Intent resultIntent = new Intent(Intent.ACTION_VIEW);
resultIntent.setData(Uri.parse( remoteMessage.getData().get("url") ));
Log.e("msg", remoteMessage.getData().get("url"));
PendingIntent pending = PendingIntent.getActivity(this, 0, resultIntent, PendingIntent.FLAG_UPDATE_CURRENT);
builder.setContentIntent(pending);

урл парсится видно в логах D/MainActivity: Key: url Value: http://google.com
но при клике по уведомлению открывается программа
вот по сути весь код программы:
@Override
public void onMessageReceived(RemoteMessage remoteMessage) {
    Uri sound= RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
    NotificationCompat.Builder builder = new NotificationCompat.Builder(this);
    builder.setSound(sound);
    NotificationManager notificationManager =
            (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);

    // pending implicit intent to view url
    Intent resultIntent = new Intent(Intent.ACTION_VIEW);
    resultIntent.setData(Uri.parse( remoteMessage.getData().get("url") ));
    Log.e("msg", remoteMessage.getData().get("url"));
    PendingIntent pending = PendingIntent.getActivity(this, 0, resultIntent, PendingIntent.FLAG_UPDATE_CURRENT);
    builder.setContentIntent(pending);

    notificationManager.notify(0, builder.build());

}


text:
Q: Why don't we take this term $D_{\mu}D_{\nu}F^{\mu\nu}$ in Lagrangians? Why don't we take
$$D_{\mu}D_{\nu}F^{\mu\nu}$$
in Lagrangians?

A: We do if there is a color trace. The term $D_{\mu}D_{\nu}F^{\mu\nu}=\frac{1}{2}[D_{\mu},D_{\nu}]F^{\mu\nu}$ is proportional to $F_{\mu\nu} F^{\mu\nu}$.

A: As the more upvoted answer said, if there are color indices then the covariant derivative doesn't commute with itself and the expression you wrote makes sense.  If not, symmetry arguments about the symmetric nature of the derivative and the connection and the anti-symmetric nature of the curvature tensor are enough to reason like I did below that the argument is zero.  The two derivatives are symmetric, and the curvature is anti-symmetric, and so you are contracting a symmetric matrix with an anti-symmetric one, which is zero.
$$
D_{\mu}D_{\nu}F^{\mu \nu} = -D_{\mu}D_{\nu}F^{\nu\mu} = -D_{\nu}D_{\mu}F^{\nu\mu} =-D_{\mu}D_{\nu}F^{\mu \nu} \implies D_{\mu}D_{\nu}F^{\mu \nu} = 0
$$


text:
Q: Are there any easy ways to extract data in Balance Sheet/Income Statement? I try to extract qualitative data from companies' balance sheet / income statement. They are excel(.xls) file.
Unfortunately, the content structures vary from one company to another.
For example,
To extract revenue value:

In company A, it locates next to "Revenue" column.
In company B, it locates next to "Income from goods and sales" column and it is listed as thousand dollar per unit.
In company C, it is even worse. You need to look for the row that contains wording "Revenue from sales of goods and" and move down the next row that contains wording "rendering of services", add value next to that column to the data in a row that contains wording "Scrap sales", "Gain on exchange rates" and "Gain on equipment disposal".

With more than 500+ available companies, and more than 20 yeas of past data to extract(the content can be varied from year to year, too), this become problematic. I don't know how to handle each case. The data is so unstructured.
So, what I wanna ask is that are there any library/API out there(preferably JAVA) that extract this kind of fuzzy information? I don't want reinvent the wheel if someone already done this. Are there any ready-to-use machine learning API for this kind of thing? Also, theses companies are not listed in US or other well-known stock exchanges so there is no available data provider.
Thank you for your reply.

A: The bad news: I'm pretty sure that there is no such library/API, because the things you want are too complicated and (at least now) cannot be done automatically, especially in cases like C: there is too much domain-specific semantics that is very hard to be encoded.
The good news: I suppose that 80/20 rule remains true for your case - most tables have clear structure like A or B and you can write simple scripts for extracting values for them, while others have to be done manually. I'd advise to develop such scripts incrementally: start for the case A, then launch program for all tables. For failed tables, choose the simplest cases and adapt the code for them; and so on. I believe this way to be the fastest, although not so exciting.
A little more interesting approach for semi-automatic extraction of needed info from tables is described in this paper (sorry for self-citation). Unfortunately, there is no working library or API, but the idea is rather simple and can be easily coded, I guess.

A: Companies often provide this information in a computer-readable format based on XML called XBRL.  This format allows you to programmatically extract the semantic information you're talking about.  Being related to XML, the spec is naturally pretty dense, but the information is there.
As a random example, ExxonMobil freely publishes their data on their investors site.


text:
Q: Custom circle copper fill in Proteus ARES My work needs to design a custom circle like in the picture below.

I need to copper-fill the portion inbetween the two circles. I've tried zone select mode, but it doesn't work efficiently as I need. Is there any option to do it?

A:
I did it like this (2D Graphic circle mode) in combination with (Zone mode) in this case the pad zone is defined as compatible and the outer zone is defined as solid 4 arcs make a part circle outer-edge in my case.
You can use (Zone mode) /-solid- to fill space in between circles as long as you increase the (2D Graphic circle mode) /-width- to cover the edge of (Zone mode) /-Boundary-, also you can thicken and dilute the grid with F2 F3 F4 keys and manipulate the vertexes in such a way that they stay inside the circle boundary.

A:
I drew multiple circles within the limits to fill it up.


text:
Q: Could account association cheapen the Yearling badge? According to the badges page, the requirements for Yearling are:

Active member for a year, earning at least 100 reputation

However, the bonus for associating SO-family accounts is 100 rep, as long as one of the accounts has at least 200 rep to begin with.  I'm curious if that means someone could get the badge simply by being active on another SO-family site and logging in every few days.
For an example, look at me: I have SO, SF, SU and Meta accounts, all associated.  I'm a frequent participant on SO, SU and Meta but have never posted on SF despite visiting every day.  I certainly don't deserve Yearling.
So, to make this an actual question, could someone earn Yearling on a given site without really doing anything at all?  Or, phrased differently, what is the definition of
"active member"?
I know this may actually already be accounted for in the code, and therefore not a bug, but I couldn't find documentation and I was curious.

A: 200 reputation doesn't really work to determine if someone is "active".  I haven't asked a question on SO since "Jun 15 '09 at 20:33" and I answered one question in 2010 (+10 reputation) and none since.  But I did get a Yearling in 2011, 2010, and 2009.  I asked (a few) good questions early on and provided (a few more) good answers.  As search delivers one or two upvotes every few days, I collect +5 and +10 like clockwork.  (I'm not the most extreme example either.)  It's not a bad thing, but it doesn't mean much.
The solution is quite simple.  Rephrase the badge text:

Member for a year, earning at least 200 reputation

Unless you really mean to include "active" members, in which case the solution is to change the criteria to earn at least 200 reputation on posts submitted in that year.

A: 100 rep is nothing. It is just there to sort out the drive by users.

A: Possibly, but the account has to exist for a year -- and each account must be created independently on each site.
I suppose we could make the threshold 150 / year or something to account for this?
EDIT: I'm making the Yearling threshold 200 just to cover this edge condition, and ensure that people are actually participating each year.


text:
Q: Foreach loop with ArrayList does nothing I have a problem using a foreach loop with an ArrayList. The ArrayList is initialized in my program in this class :
    public class FonctionnementGlobal {

    /**
     * Contient tout le calendrier, séparé en semestres
     */
    public static ArrayList<DateSemestre> liste_semestre = new ArrayList<DateSemestre>();

Then elements are added in my function init() :
private static void init() throws SQLException{

[...]
GregorianCalendar dateDebutS = new GregorianCalendar(DS_annee,DS_mois,DS_jour);
            GregorianCalendar dateFinS = new GregorianCalendar(FS_annee,FS_mois,FS_jour);
            GregorianCalendar dateRemiseCheque = new GregorianCalendar(RC_annee,RC_mois,RC_jour);
            GregorianCalendar dateDebutCommande = new GregorianCalendar(DC_annee,DC_mois,DC_jour);
            GregorianCalendar dateFinCommande = new GregorianCalendar(FC_annee,FC_mois,FC_jour);
            liste_semestre.add(new DateSemestre(dateDebutS, dateFinS, dateRemiseCheque, dateDebutCommande, dateFinCommande));

My problem is when I want to access it in a method in an other class :
public class EcranVicePresident {
[...]
private static void ajouterSemestre() throws SQLException {
[...]
for(DateSemestre sem : FonctionnementGlobal.liste_semestre){
                if(debutS.after(sem.getDateDebutS()) && sem.getDateFinS().after(debutS)){
                    dateok = true;
                }
            }

The foreach loop does nothing. I don't understand why, whereas I use this ArrayList without any problem in other methods in my EcranVicePresident class ; and when I check with the isEmpty() method, it returns false.
Do you have any idea ?
Thanks for your help !


text:
Q: sqlite3.OperationalError: near " ": syntax error vocês sabem o quer dizer esse erro?
Erro:
sqlite3.OperationalError: near " ": syntax error

Código:
def alterturma(self):

        bancoturmas = Bancoturmas()
        #try:

        c = bancoturmas.conexao.cursor()

        c.execute("update turmas set codigoturma = '" + self.codigoturma + "', periodo= '" + self.periodo + "', turmacodigodisciplina = '" + self.turmacodigodisciplina + "', turmacpfprofessor = '" + self.turmacpfprofessor + "', lista_cpf_alunos = '" + self.lista_cpf_alunos + "' where idturma = " + self.idturma)

        bancoturmas.conexao.commit()
        c.close()

        return "Turma atualizada com sucesso!"
        #except:
            #return "Ocorreu um erro na alteração da turma"

A: Tentei reformatar a parte do seu código que está dando erro, pra tornar um pouco menos confuso, é apenas um erro de sintaxe relacionado as aspas, então deve resolver:
self.c.execute("""
        UPDATE turmas
          codigoturma = ?,
          periodo = ?,
          turmacodigodisciplina = ?,
          turmacpfprofessor = ?,
          lista_cpf_alunos = ?,
        WHERE idturma = ?
        """, (self.codigoturma, self.periodo,self.turmacodigodisciplina,self.turmacpfprofessor,self.lista_cpf_alunos,self.idturma))

Note que esta consulta está usando parametrização (ao invés de interpolação de strings simples como no seu exemplo). Isso possui várias vantagens: Livra você de ter que colocar as aspas certas, impede injeção de código SQL nas variáveis, e tem performance melhor, pois uma vez que a interpolação é feita pelo banco de dados, a consulta compilada pode ser armazenada em cache.


text:
Q: Java - overridden method not getting called I'm working on a Java exercise and can't figure out what I am doing wrong. I made a Movie class (with variables: rating, title, movieId and a constant for FEE_AMT) and then extended the class with: Action, Comedy and Drama. These derived classes have no other variables, just a different FEE_AMT.
In Movie (and derived classes) there is a method to calculate the late fees due:
/**
* Returns the late fee due on a Movie rental
*   @param  days the number of days for late fee calculations
*   @return   true or false depending on the evaluation of the expression
**/
public double calcLateFees(int days){
    return(days * FEE_AMT);
}

If I just call the method outright with the object, for ex: comedy1.calcLateFees(2)  - it will generate the correct fee amount based on the differing constant value in the derived method.
Now I needed to create a Rental class and in main() create an array of type rental class to hold Rental objects (which consist of a Movie object, renterId and daysLate).
Here is the method that takes in an array of Rental objects and returns the late fees due on all rentals in the array:
/**
 * lateFeesOwed returns the amount of money due for late fees on all movies
 *  which are located in an array of Rentals.
 *
 *  @return feeDue the amount of money due for late fees.
 */
public static double lateFeesOwed(Rental[] rentalArray){
    double feeDue = 0;

    for(int i = 0; i < rentalArray.length; i++)
    {
        feeDue += rentalArray[i].calcFees();  //This is part of the problem??

    }

    return feeDue;
}

and this method calls:
/**
 * CalcFees returns the amount of money due for late fees on a movie rental.
 *
 *  @return feeDue the amount of money due for late fees.
 */
public double calcFees(){
  double feeDue = rentalName.calcLateFees(this.daysLate);
  return feeDue;
}

But the problem is that the calcFees() method is calling calcLateFees() but instead of calling the derived class, it is calling the Movie class and returning the incorrect amount.
I'm not sure where my issue is preventing the overridden method calcLateFees() from being called.
Thank you.

A:
These derived classes have no other variables, just a different FEE_AMT.

This is the problem. Data members are not polymorphic. What you need to do is turn FEE_AMT into a method, and override that method in the derived classes.
// Movie

public double calcLateFees(int days){
    return(days * getFeeAmt());
}

protected abstract double getFeeAmt(); // or implement if you wish

// Action etc

@Override
protected double getFeeAmt() { return ...; }


text:
Q: Why does this ContourPlot3D not give the result I expect? ContourPlot3D[(mod[x, 10]-5)^2 + y ^2+z ^2 ==1, {x, -20, 20}, {y, -20, 20}, {z, -20, 20}]

shows blank

rather than the array of balls I expect. Why?

A: ContourPlot3D[(Mod[x, 10] - 5)^2 + y^2 + z^2 == 1,
 {x, -20, 20},
 {y, -20, 20},
 {z, -20, 20}]


text:
Q: Openssl DSA sign I am trying to sign some data using a DSA certificate. I am saving the certificate in memory (it was generated with the openssl gendsa command).
My function looks like this, and my problem is with res = EVP_SignFinal. Here the function returns 0, and sets the signature_len on 0.
bool my_dsa_sign(const Certificate& certificate, const char* messageData, size_t messageLength, Signature &outSignature) {
    bool resultOk = false;
    BIO* bio = BIO_new_mem_buf((void*) certificate.getPEMData(), certificate.getSize());
    if(NULL != bio) {
        EVP_PKEY *pkey = NULL;
        if(NULL != (pkey = PEM_read_bio_PrivateKey(bio, NULL, NULL, NULL))) {
            unsigned int signature_len;
            EVP_MD_CTX ctx;
            int res = EVP_SignInit(&ctx, EVP_sha512());
            if(1 == res) {
                res = EVP_SignUpdate(&ctx, messageData, messageLength);
                if(1 == res) {
                    unsigned char* s = (unsigned char*)malloc(EVP_PKEY_size(pkey));

                    // problem here
                    res = EVP_SignFinal(&ctx, s, &signature_len, pkey);
                    if(1 == res) {
                        resultOk = true;
                        signature.setData(s, signature_len);
                    }
                }
            }
            EVP_PKEY_free(pkey);
            EVP_MD_CTX_cleanup(&ctx);
        }
        BIO_free(bio);
    }
    return resultOk;
}

any idea what the problem might be ?
I have checked with the debugger, the value of the certificate is correct, in the form:
-----BEGIN DSA PRIVATE KEY-----
MIID....
.......
-----END DSA PRIVATE KEY-----

Also the length is correct, matches with that of the file.

A: Not knowing much of OpenSSL, I don't see anywhere that you are using DSA in your code.
int res = EVP_SignInit(&ctx, EVP_sha512());

The manual page to EVP_SignInit says:

EVP_SignInit() initializes a signing context ctx to use the default implementation of digest type.

The manual page to EVP_sha512 says:

[...], EVP_sha512(), [...] return EVP_MD structures for the [...], SHA512 , [...] digest algorithms respectively.
  The associated signature algorithm is RSA in each case.

Highlight by me.
So it looks like you are trying to do an RSA signature with a DSA key, which will not work (or spit out nonsense).
After some browsing through the documentation, I didn't quite find a way to use SHA512 together with DSA, though, even though the documentation now states:

The link between digests and signing algorithms was fixed in OpenSSL 1.0 and later, so now EVP_sha1() can be used
  with RSA and DSA, there is no need to use EVP_dss1() any more.


text:
Q: DLL Add-in won't run in Excel 2010 64-bit I have a DLL add-in for Excel that adds an API for another program I have.  Add-in had an installer package and after install I can't find it in the Excel add-ins list.  I have a suspicion that it is a 32-bit addin that may be causing the problem.  Is there a way to check if the DLL is 32-bit?  Even if it is 32-bit should it cause a problem to run on 64-bit Excel?  Help!

A:
Is there a way to check if the DLL is 32-bit?

You can refer to the question, How can I find out if a given program is 64 or 32 bit version?, for that. That will work for DLLs and libraries, too.

Even if it is 32-bit should it cause a problem to run on 64-bit Excel?

Yes. 32-bit programs cannot load a 64-bit library, and vise-versa. So if you have a 32-bit Add In that you need to use, then you need to install the 32-bit Excel.


text:
Q: No audio from DAC I'm no longer getting any sound out of my FiiO Q1 DAC.  The headphone port and monitor speakers still work and the DAC still works when in windows 10.  I've tried rebooting and fiddling with the settings in puleaudio.  The DAC appears in pulse audio and I can see that it's being sent audio - see the screenshot
Output from inxi -Fx
will@will-manjaro ~> inxi -Fx
    System:    Host: will-manjaro Kernel: 5.10.68-1-MANJARO x86_64 bits: 64 compiler: gcc v: 11.1.0 Desktop: i3 4.19.1
               Distro: Manjaro Linux base: Arch Linux
    Machine:   Type: Desktop Mobo: ASUSTeK model: ROG STRIX X370-F GAMING v: Rev X.0x serial: <superuser required>
               UEFI: American Megatrends v: 4024 date: 09/07/2018
    CPU:       Info: 8-Core model: AMD Ryzen 7 2700X bits: 64 type: MT MCP arch: Zen+ rev: 2 cache: L2: 4 MiB
               flags: avx avx2 lm nx pae sse sse2 sse3 sse4_1 sse4_2 sse4a ssse3 svm bogomips: 118220
               Speed: 3938 MHz min/max: 2200/3700 MHz boost: enabled Core speeds (MHz): 1: 3938 2: 2457 3: 3244 4: 3194
               5: 2126 6: 2128 7: 2134 8: 2143 9: 2239 10: 2200 11: 2162 12: 2188 13: 4186 14: 4211 15: 3236 16: 3208
    Graphics:  Device-1: NVIDIA GA102 [GeForce RTX 3090] driver: nvidia v: 470.63.01 bus-ID: 0a:00.0
               Device-2: Logitech Webcam C270 type: USB driver: snd-usb-audio,uvcvideo bus-ID: 1-14:4
               Display: x11 server: X.Org 1.20.13 driver: loaded: nvidia resolution: 1: 2560x1440~60Hz 2: 2560x1440
               OpenGL: renderer: NVIDIA GeForce RTX 3090/PCIe/SSE2 v: 4.6.0 NVIDIA 470.63.01 direct render: Yes
    Audio:     Device-1: NVIDIA GA102 High Definition Audio driver: snd_hda_intel v: kernel bus-ID: 0a:00.1
               Device-2: Advanced Micro Devices [AMD] Family 17h HD Audio vendor: ASUSTeK driver: snd_hda_intel v: kernel
               bus-ID: 0c:00.3
               Device-3: SAVITECH FiiO USB DAC Q1 type: USB driver: hid-generic,snd-usb-audio,usbhid bus-ID: 1-11:2
               Device-4: Logitech Webcam C270 type: USB driver: snd-usb-audio,uvcvideo bus-ID: 1-14:4
               Sound Server-1: ALSA v: k5.10.68-1-MANJARO running: yes
               Sound Server-2: JACK v: 1.9.19 running: no
               Sound Server-3: PulseAudio v: 15.0 running: yes
               Sound Server-4: PipeWire v: 0.3.37 running: yes
    Network:   Device-1: Intel I211 Gigabit Network vendor: ASUSTeK driver: igb v: kernel port: e000 bus-ID: 05:00.0
               IF: enp5s0 state: up speed: 100 Mbps duplex: full mac: 18:31:bf:b8:c0:37
    Bluetooth: Device-1: Cambridge Silicon Radio Bluetooth Dongle (HCI mode) type: USB driver: btusb v: 0.8 bus-ID: 5-2:3
               Report: rfkill ID: hci0 rfk-id: 0 state: up address: see --recommends
    Drives:    Local Storage: total: 2.5 TiB used: 310.57 GiB (12.1%)
               ID-1: /dev/nvme0n1 vendor: Sabrent model: N/A size: 476.94 GiB temp: 28.9 C
               ID-2: /dev/sda vendor: Crucial model: CT256MX100SSD1 size: 238.47 GiB
               ID-3: /dev/sdb vendor: TeamGroup model: L5Lite3D480G size: 447.13 GiB
               ID-4: /dev/sdc vendor: Seagate model: ST3500418AS size: 465.76 GiB
               ID-5: /dev/sdd vendor: Western Digital model: WD10EZEX-00RKKA0 size: 931.51 GiB
    Partition: ID-1: / size: 66.79 GiB used: 36.68 GiB (54.9%) fs: ext4 dev: /dev/sda6
               ID-2: /boot/efi size: 195.9 MiB used: 302 KiB (0.2%) fs: vfat dev: /dev/sda3
               ID-3: /home size: 468.45 GiB used: 273.89 GiB (58.5%) fs: ext4 dev: /dev/nvme0n1p1
    Swap:      ID-1: swap-1 type: partition size: 66.41 GiB used: 0 KiB (0.0%) dev: /dev/sda5
    Sensors:   System Temperatures: cpu: 44.0 C mobo: N/A gpu: nvidia temp: 34 C
               Fan Speeds (RPM): N/A gpu: nvidia fan: 0%
    Info:      Processes: 373 Uptime: 20m Memory: 47.06 GiB used: 3.62 GiB (7.7%) Init: systemd Compilers: gcc: 11.1.0
               clang: 12.0.1 Packages: 1523 Shell: fish v: 3.3.1 inxi: 3.3.06

Output from pacmd list-cards
will@will-manjaro ~> pacmd list-cards                                                                                (base)
4 card(s) available.
    index: 0
    name: <alsa_card.usb-262a_FiiO_USB_DAC_Q1-01>
    driver: <module-alsa-card.c>
    owner module: 6
    properties:
        alsa.card = "2"
        alsa.card_name = "FiiO USB DAC Q1"
        alsa.long_card_name = "FiiO USB DAC Q1 at usb-0000:02:00.0-11, full speed"
        alsa.driver_name = "snd_usb_audio"
        device.bus_path = "pci-0000:02:00.0-usb-0:11:1.1"
        sysfs.path = "/devices/pci0000:00/0000:00:01.3/0000:02:00.0/usb1/1-11/1-11:1.1/sound/card2"
        udev.id = "usb-262a_FiiO_USB_DAC_Q1-01"
        device.bus = "usb"
        device.vendor.id = "262a"
        device.vendor.name = "SAVITECH Corp."
        device.product.id = "100d"
        device.product.name = "FiiO USB DAC Q1"
        device.serial = "262a_FiiO_USB_DAC_Q1"
        device.string = "2"
        device.description = "FiiO USB DAC Q1"
        module-udev-detect.discovered = "1"
        device.icon_name = "audio-card-usb"
    profiles:
        output:analog-stereo: Analog Stereo Output (priority 6500, available: unknown)
        output:iec958-stereo: Digital Stereo (IEC958) Output (priority 5500, available: unknown)
        off: Off (priority 0, available: unknown)
    active profile: <output:analog-stereo>
    sinks:
        alsa_output.usb-262a_FiiO_USB_DAC_Q1-01.analog-stereo/#4: FiiO USB DAC Q1 Analog Stereo
    sources:
        alsa_output.usb-262a_FiiO_USB_DAC_Q1-01.analog-stereo.monitor/#6: Monitor of FiiO USB DAC Q1 Analog Stereo
    ports:
        analog-output: Analog Output (priority 9900, latency offset 0 usec, available: unknown)
            properties:

        iec958-stereo-output: Digital Output (S/PDIF) (priority 0, latency offset 0 usec, available: unknown)
            properties:

    index: 1
    name: <alsa_card.usb-046d_0825_9D2BA270-02>
    driver: <module-alsa-card.c>
    owner module: 7
    properties:
        alsa.card = "3"
        alsa.card_name = "USB Device 0x46d:0x825"
        alsa.long_card_name = "USB Device 0x46d:0x825 at usb-0000:02:00.0-14, high speed"
        alsa.driver_name = "snd_usb_audio"
        device.bus_path = "pci-0000:02:00.0-usb-0:14:1.2"
        sysfs.path = "/devices/pci0000:00/0000:00:01.3/0000:02:00.0/usb1/1-14/1-14:1.2/sound/card3"
        udev.id = "usb-046d_0825_9D2BA270-02"
        device.bus = "usb"
        device.vendor.id = "046d"
        device.vendor.name = "Logitech, Inc."
        device.product.id = "0825"
        device.product.name = "Webcam C270"
        device.serial = "046d_0825_9D2BA270"
        device.form_factor = "webcam"
        device.string = "3"
        device.description = "Webcam C270"
        module-udev-detect.discovered = "1"
        device.icon_name = "camera-web-usb"
    profiles:
        input:mono-fallback: Mono Input (priority 1, available: unknown)
        off: Off (priority 0, available: unknown)
    active profile: <input:mono-fallback>
    sources:
        alsa_input.usb-046d_0825_9D2BA270-02.mono-fallback/#1: Webcam C270 Mono
    ports:
        analog-input-mic: Microphone (priority 8700, latency offset 0 usec, available: unknown)
            properties:
                device.icon_name = "audio-input-microphone"
    index: 2
    name: <alsa_card.pci-0000_0a_00.1>
    driver: <module-alsa-card.c>
    owner module: 8
    properties:
        alsa.card = "0"
        alsa.card_name = "HDA NVidia"
        alsa.long_card_name = "HDA NVidia at 0xf7080000 irq 89"
        alsa.driver_name = "snd_hda_intel"
        device.bus_path = "pci-0000:0a:00.1"
        sysfs.path = "/devices/pci0000:00/0000:00:03.1/0000:0a:00.1/sound/card0"
        device.bus = "pci"
        device.vendor.id = "10de"
        device.vendor.name = "NVIDIA Corporation"
        device.product.id = "1aef"
        device.product.name = "GA102 High Definition Audio Controller"
        device.string = "0"
        device.description = "GA102 High Definition Audio Controller"
        module-udev-detect.discovered = "1"
        device.icon_name = "audio-card-pci"
    profiles:
        output:hdmi-stereo: Digital Stereo (HDMI) Output (priority 5900, available: no)
        output:hdmi-surround: Digital Surround 5.1 (HDMI) Output (priority 800, available: no)
        output:hdmi-surround71: Digital Surround 7.1 (HDMI) Output (priority 800, available: no)
        output:hdmi-stereo-extra1: Digital Stereo (HDMI 2) Output (priority 38468, available: unknown)
        output:hdmi-stereo-extra2: Digital Stereo (HDMI 3) Output (priority 38468, available: unknown)
        output:hdmi-stereo-extra3: Digital Stereo (HDMI 4) Output (priority 5700, available: no)
        output:hdmi-surround-extra3: Digital Surround 5.1 (HDMI 4) Output (priority 600, available: no)
        output:hdmi-surround71-extra3: Digital Surround 7.1 (HDMI 4) Output (priority 600, available: no)
        output:hdmi-stereo-extra4: Digital Stereo (HDMI 5) Output (priority 5700, available: no)
        output:hdmi-surround-extra4: Digital Surround 5.1 (HDMI 5) Output (priority 600, available: no)
        output:hdmi-surround71-extra4: Digital Surround 7.1 (HDMI 5) Output (priority 600, available: no)
        output:hdmi-stereo-extra5: Digital Stereo (HDMI 6) Output (priority 5700, available: no)
        output:hdmi-surround-extra5: Digital Surround 5.1 (HDMI 6) Output (priority 600, available: no)
        output:hdmi-surround71-extra5: Digital Surround 7.1 (HDMI 6) Output (priority 600, available: no)
        output:hdmi-stereo-extra6: Digital Stereo (HDMI 7) Output (priority 5700, available: no)
        output:hdmi-surround-extra6: Digital Surround 5.1 (HDMI 7) Output (priority 600, available: no)
        output:hdmi-surround71-extra6: Digital Surround 7.1 (HDMI 7) Output (priority 600, available: no)
        off: Off (priority 0, available: unknown)
    active profile: <output:hdmi-stereo-extra1>
    sinks:
        alsa_output.pci-0000_0a_00.1.hdmi-stereo-extra1/#1: GA102 High Definition Audio Controller Digital Stereo (HDMI 2)
    sources:
        alsa_output.pci-0000_0a_00.1.hdmi-stereo-extra1.monitor/#2: Monitor of GA102 High Definition Audio Controller Digital Stereo (HDMI 2)
    ports:
        hdmi-output-0: HDMI / DisplayPort (priority 5900, latency offset 0 usec, available: no)
            properties:
                device.icon_name = "video-display"
        hdmi-output-1: HDMI / DisplayPort 2 (priority 5800, latency offset 0 usec, available: yes)
            properties:
                device.icon_name = "video-display"
                device.product.name = "BenQ LCD
    "
        hdmi-output-2: HDMI / DisplayPort 3 (priority 5700, latency offset 0 usec, available: yes)
            properties:
                device.icon_name = "video-display"
                device.product.name = "AG241QG4
    "
        hdmi-output-3: HDMI / DisplayPort 4 (priority 5600, latency offset 0 usec, available: no)
            properties:
                device.icon_name = "video-display"
        hdmi-output-4: HDMI / DisplayPort 5 (priority 5500, latency offset 0 usec, available: no)
            properties:
                device.icon_name = "video-display"
        hdmi-output-5: HDMI / DisplayPort 6 (priority 5400, latency offset 0 usec, available: no)
            properties:
                device.icon_name = "video-display"
        hdmi-output-6: HDMI / DisplayPort 7 (priority 5300, latency offset 0 usec, available: no)
            properties:
                device.icon_name = "video-display"
    index: 3
    name: <alsa_card.pci-0000_0c_00.3>
    driver: <module-alsa-card.c>
    owner module: 9
    properties:
        alsa.card = "1"
        alsa.card_name = "HD-Audio Generic"
        alsa.long_card_name = "HD-Audio Generic at 0xf7800000 irq 91"
        alsa.driver_name = "snd_hda_intel"
        device.bus_path = "pci-0000:0c:00.3"
        sysfs.path = "/devices/pci0000:00/0000:00:08.1/0000:0c:00.3/sound/card1"
        device.bus = "pci"
        device.vendor.id = "1022"
        device.vendor.name = "Advanced Micro Devices, Inc. [AMD]"
        device.product.id = "1457"
        device.product.name = "Family 17h (Models 00h-0fh) HD Audio Controller"
        device.string = "1"
        device.description = "Family 17h (Models 00h-0fh) HD Audio Controller"
        module-udev-detect.discovered = "1"
        device.icon_name = "audio-card-pci"
    profiles:
        input:analog-stereo: Analog Stereo Input (priority 32833, available: unknown)
        output:analog-stereo: Analog Stereo Output (priority 6500, available: no)
        output:analog-stereo+input:analog-stereo: Analog Stereo Duplex (priority 6565, available: unknown)
        output:analog-surround-21: Analog Surround 2.1 Output (priority 1300, available: no)
        output:analog-surround-21+input:analog-stereo: Analog Surround 2.1 Output + Analog Stereo Input (priority 1365, available: unknown)
        output:analog-surround-40: Analog Surround 4.0 Output (priority 1200, available: no)
        output:analog-surround-40+input:analog-stereo: Analog Surround 4.0 Output + Analog Stereo Input (priority 1265, available: unknown)
        output:analog-surround-41: Analog Surround 4.1 Output (priority 1300, available: no)
        output:analog-surround-41+input:analog-stereo: Analog Surround 4.1 Output + Analog Stereo Input (priority 1365, available: unknown)
        output:analog-surround-50: Analog Surround 5.0 Output (priority 1200, available: no)
        output:analog-surround-50+input:analog-stereo: Analog Surround 5.0 Output + Analog Stereo Input (priority 1265, available: unknown)
        output:analog-surround-51: Analog Surround 5.1 Output (priority 1300, available: no)
        output:analog-surround-51+input:analog-stereo: Analog Surround 5.1 Output + Analog Stereo Input (priority 1365, available: unknown)
        output:iec958-stereo: Digital Stereo (IEC958) Output (priority 38268, available: unknown)
        output:iec958-stereo+input:analog-stereo: Digital Stereo (IEC958) Output + Analog Stereo Input (priority 38333, available: unknown)
        off: Off (priority 0, available: unknown)
    active profile: <output:iec958-stereo+input:analog-stereo>
    sinks:
        alsa_output.pci-0000_0c_00.3.iec958-stereo/#2: Family 17h (Models 00h-0fh) HD Audio Controller Digital Stereo (IEC958)
    sources:
        alsa_output.pci-0000_0c_00.3.iec958-stereo.monitor/#3: Monitor of Family 17h (Models 00h-0fh) HD Audio Controller Digital Stereo (IEC958)
        alsa_input.pci-0000_0c_00.3.analog-stereo/#4: Family 17h (Models 00h-0fh) HD Audio Controller Analog Stereo
    ports:
        analog-input-front-mic: Front Microphone (priority 8500, latency offset 0 usec, available: no)
            properties:
                device.icon_name = "audio-input-microphone"
        analog-input-rear-mic: Rear Microphone (priority 8200, latency offset 0 usec, available: yes)
            properties:
                device.icon_name = "audio-input-microphone"
        analog-input-linein: Line In (priority 8100, latency offset 0 usec, available: no)
            properties:

        analog-output-lineout: Line Out (priority 9000, latency offset 0 usec, available: no)
            properties:

        analog-output-headphones: Headphones (priority 9900, latency offset 0 usec, available: no)
            properties:
                device.icon_name = "audio-headphones"
        iec958-stereo-output: Digital Output (S/PDIF) (priority 0, latency offset 0 usec, available: unknown)
            properties:


text:
Q: Autofac - Registering instance type that takes interface as parameter I am very new to Autofac and not able to understand the syntax for registration. I have following calsses/interfaces :
//Interface
public interface ISender
{
    void Send();
}

//implementations
public class Post : ISender
{
    public void Send()
    {
        //Post implementation
    }
}

public class Email : ISender
{
    public void Send()
    {
        //Email implementation
    }
}

And a class that calls these implementations
public class Consumer
{
    ISender Sender;

    public Consumer(ISender sender)
    {
        Sender = sender
    }

    public void Act()
    {
        Sender.Send();
    }
}

Now, which implementation to call is to be decided in a controller, so I tried using IIndex from this page like:
public calss PostController
{
    Consumer ConsumerObject;
    public PostController(IIndex<string, Consumer> consumer)
    {
        ConsumerObject = consumer["post"];
    }

}

public class EmailController
{
    Consumer ConsumerObject;
    public PostController(IIndex<string, Consumer> consumer)
    {
        ConsumerObject = consumer["email"];
    }
}

Firstly, is it correct or doable? Now the problem is I don't understand how to register in Autofac. So, How can we register Consumer and ISender in Autofac ?? Please suggest if there is any better/alternative way.

A: The way of registering components in Autofac is described widely in the documentation here. And how to use keyed services is described in the documentation you linked.
Basically you have to create ContainerBuilder, register all your components and build the container itself, based on the project type you have.
In your situation you need to use the following registrations:
var builder = new ContainerBuilder();
builder.RegisterType<Post>().Keyed<ISender>("post");
builder.RegisterType<Email>().Keyed<ISender>("email");
builder.RegisterType<Consumer>();

If you use ASP.NET WebApi (I assume that based on the fact you are using Controllers), you need to register your controllers
builder.RegisterApiControllers(Assembly.GetExecutingAssembly());

or for MVC
builder.RegisterControllers(typeof(MvcApplication).Assembly);

Now, there are various way to pick the Consumer with proper ISender implementation (I assume you want to pick proper implementation in controller).
One would be to inject IIndex<string, ISender> to Consumer class and pass the proper key string to it as well:
public class Consumer
{
    ISender Sender;

    public Consumer(string type, IIndex<string, ISender> sender)
    {
        Sender = sender[type];
    }

    public void Act()
    {
        Sender.Send();
    }
}

Then, in controller you could use Func injection:
public class PostController
{
    Consumer ConsumerObject;
    public PostController(Func<string, Consumer> consumer)
    {
        ConsumerObject = consumer("post");
    }
}

public class EmailController
{
    Consumer ConsumerObject;
    public EmailController(Func<string, Consumer> consumer)
    {
        ConsumerObject = consumer("email");
    }
}

Another could be registering Consumer twice with Register method and resolving ISender in registration time.


text:
Q: iPhone Target Linking Error So I'm getting this error on build:
alt text http://grab.by/1lw1
This obviously has something to do with linking, but I just can't get what exactly. I have 2 targets, and I only get this error when I compile for the device target (other target is for simulator use). I compared the linking settings for each target and everything seems fine.
InfoView is the last class I added to the project.

A: Well if you're getting that error, you most likely just forgot to include that file in the target. Get info on the file that's giving the error (in this case InfoView.m) > targets > check the appropriate targets.
alt text http://grab.by/1lwF


text:
Q: infix notation in Lean Is there an infix notation that would allow to rewrite those proofs
example (h₀ : a ≤ b) (h₁ : b < c) (h₂ : c ≤ d) (h₃ : d < e) :
  a < e := lt_trans (lt_of_lt_of_le (lt_of_le_of_lt (h₀) h₁) h₂ ) h₃

example (h₀ : a ≤ b) (h₁ : b < c) (h₂ : c ≤ d) (h₃ : d < e) :
  a < e := by
  { apply lt_trans,
    {apply lt_of_lt_of_le,
      {apply lt_of_le_of_lt, apply h₀, apply h₁}
     , apply h₂},
    apply h₃
 }

more naturally as
example (h₀ : a ≤ b) (h₁ : b < c) (h₂ : c ≤ d) (h₃ : d < e) :
  a < e := ((h₀ `lt_of_le_of_lt` h₁) `lt_of_lt_of_le` h₂) `lt_trans` h₃

A: You can use Lean's dot notation to make an infix version of the argument, for example
example (h₀ : a ≤ b) (h₁ : b < c) (h₂ : c ≤ d) (h₃ : d < e) :
  a < e :=  (h₀.trans_lt h₁).trans (h₂.trans_lt h₃)

What's going on here is that the type of h₀ is le a b (in the has_le namespace), so h₀.trans_lt means le.trans_lt h₀, and you can see in order.basic in mathlib that le.trans_lt is just an abbreviation for lt_of_le_of_lt.


text:
Q: how to deal with `yum repolist is 0` and `yum list empty`? I run a docker image (gitlab-runner) on a centos 7 host machine. In the container, it is strange that it has apt command but has no yum command.But the system seems to be a centos but not ubuntu?
root@vultr:/usr/local/java# uname -r
3.10.0-1062.4.1.el7.x86_64

I used apt-get install yum to install yum and then I want to do yum update, but I get the following problems, how to deal with it?
    root@vultr:/usr/local/java# yum update
    There are no enabled repos.
    Run "yum repolist all" to see the repos you have.
    You can enable repos with yum-config-manager --enable <repo>
    root@vultr:/usr/local/java# yum repolist all
    repolist: 0
    root@vultr:/usr/local/java# yum list
    root@vultr:/usr/local/java#
    root@vultr:/usr/local/java#
    root@vultr:/usr/local/java# yum-config-manager --enable
    Error: Trying to enable already enabled repos.
    ==================================================================================================== main ====================================================================================================
    [main]
    alwaysprompt = True
    assumeyes = False
    bandwidth = 0
    bugtracker_url = http://yum.baseurl.org/report
    cache = 0
    cachedir = /var/cache/yum
    clean_requirements_on_remove = False
    color = auto
    color_list_available_downgrade = dim,cyan
    color_list_available_install = normal
    color_list_available_reinstall = bold,underline,green
    color_list_available_upgrade = bold,blue
    color_list_installed_extra = bold,red
    color_list_installed_newer = bold,yellow
    color_list_installed_older = bold
    color_list_installed_reinstall = normal
    color_search_match = bold
    color_update_installed = normal
    color_update_local = bold
    color_update_remote = normal
    commands =
    debuglevel = 2
    diskspacecheck = True
    distroverpkg = redhat-release
    enable_group_conditionals = True
    enabled = True
    enablegroups = True
    errorlevel = 2
    exactarch = True
    exactarchlist = kernel,
       kernel-smp,
       kernel-hugemem,
       kernel-enterprise,
       kernel-bigmem,
       kernel-devel,
       kernel-PAE,
       kernel-PAE-debug
    exclude =
    exit_on_lock = False
    failovermethod = roundrobin
    gaftonmode = False
    gpgcheck = False
    group_package_types = mandatory,
       default
    groupremove_leaf_only = False
    history_list_view = single-user-commands

A: The GitLab Runner images are based on either Ubuntu or Alpine Linux. This is stated in the docs:

The following Docker images are available:

*

*gitlab/gitlab-runner:latest based on Ubuntu.

*gitlab/gitlab-runner:alpine based on Alpine with much a smaller
  footprint (~160/350 MB Ubuntu vs ~45/130 MB Alpine
  compressed/decompressed).

Both Ubuntu and Alpine Linux have their own package management systems - apt and apk respectively. You can use these package managers to add/remove packages inside your container. yum is a package manager for RHEL/Fedora class of Linux distributions, and is not used by either Ubuntu or Alpine Linux.


text:
Q: Creating Java conversion table from Fahrenheit to Celsius I am new to this site and new to programming I just started a week a go. I've been tasked with making a conversion table from degrees Fahrenheit to Celsius. the table needs to start at 0 Celsius and stop at 100 degrees Celsius and go by increments of 5.
I am really trying to make it work but I can't seem to get the for loop working correctly. Can someone explain to me what I am doing wrong and how I can finish this program to work the way I need it?
public class Table
{
    public static void main(String[] args)
    {
        System.out.println("Conversion Table");
        final int TOTAL = 100;
        for (int c = 0; c <= TOTAL; c+=5)
        {
            System.out.println((c*9/5)+32 +"\t");
            {
                System.out.println();
            }
        }
    }

https://ideone.com/llmOER

A: Currently you are only printing the values of the Fahrenheit to standard out. If the idea is that you want to print to standard out the table then you probably want to add the Celsius value as well.
Add something like
System.out.println(c +  "\t" + ((c*9/5)+32) +"\t");

to your output and you'll be sweet.

A: 1-You have one less closing brace.
2-For making conversion table you have to show both Fahrenheit and Celsius value. Code for this would be.
public class A
{
    public static void main(String[] args)
    {
        System.out.println("Conversion Table");
        final int TOTAL = 100;
    System.out.println("Fahrenheit"+"\t Celsius");
        for (int c = 0; c <= TOTAL; c+=5)
        {
            System.out.println((c*9/5)+32 +"\t \t" + c);
            {
                System.out.println();
            }
        }
     }
}


text:
Q: What does it mean when all the values of a row in a matrix are 0? I'm fairly new to linear algebra and I'm trying to make sense of what I'm being taught in class. I'm a little confused as to what happens when all the values of a matrix's row are equal to $0$: does this mean that the matrix has infinite solutions, no solutions, or something completely different?

A: Geometrically, if you have an all zero vector in a matrix (row or column; doesn't matter), it means that it represents a dimension-crushing transformation. For instance, a three-dimensional matrix with an all zero row will take three-dimensional vectors and project them into a some two-dimensional plane in three-dimensional space.
The converse isn't true: not all dimension-crushing matrices announce themselves by exhibiting such obvious zeros.
Such transformations are trap door functions: they have no inverse. Therefore, the corresponding matrices are not invertible.  Matrices which have no inverse have a determinant of zero (and it's obvious from the way the determinant is calculated that this is so for matrices that are cross-cut by an all-zero row or column). Non-invertible matrices are called singular, or degenerate.
So, if you understand this dimension-crushing aspect, it's easy to see that $Ax = b$ might have no solutions, or many solutions, if $A$ is degenerate. Suppose that $A$ is a 3D matrix that crushes vectors into a 2D plane. Now suppose that vector $b$ lies outside of the plane. Well, then there are no solutions! There is no vector $x$ such that the matrix $A$ will project it onto $b$, because $A$ takes everything into some particular plane, and $b$ is not in that plane.   Now suppose that $b$ is inside that plane. Then there are many solutions, because many vectors from 3D space project to any given point on that plane, including $b$.
So all of this gives you a whole new geometric view on systems of linear equations.

A: If you are interested in $Ax=b$, with $A$ of dimension $n \times n$ and $x,b$ of dimension $n \times 1$ with the first row of $A$ all $0$'s, when we do $Ax=b$ the first component of $x$ doesn't matter at all to $b$.

A: I love Linear Algebra!
I realize that the question has already been answered in the most basic way for the beginning of your course, but this might help you later, when you're given a matrix A, where one row is all 0's, then you are rank deficient. Which means that the dimension of the Column Space is not equal to the dimension of your matrix, say n (which also happens if your matrix is not square). It also means that there's a pivot value missing. A pivot value is, essentially, the values on the main diagonal of your matrix. With a pivot value missing, you can do Gaussian Elimination to solve for the x-values, and there's a theorem, when I took Linear Algebra, that is very useful when solving for x. However, my professor did not give the theorems he discussed in class names, so this theorem is true, but I'm not entirely sure what it's called.
Theorem: If $x_{part}$ is a solution to $Ax = b$,then every solution is of the form $x = x_{part}+x_{null}$ for some $x_{null}\in N(A)$. If you would like to see the proof of this, I will be happy to type it up later.
There are 4 fundamental subspaces: Column Space, Null Space, Left Null Space, and Row Space, denoted $C(A)$, $N(A)$, $N(A^{T})$, and $C(A^{T})$, respectively. You will learn more about this later, when determining which part of the matrix will form a basis (which is a subspace which is linearly independent vectors within it, and the span of the basis is the entire space). The Null Space takes your b-vector to be 0, and it sends x to 0. It is trivial if the only vector that is sent to 0 is the zero vector. However, if there is a row of all zeros in your matrix, then that means that $N(A)$ is nontrivial and there's a free variable.
Ex: Let A = \begin{array}{cccc}
1 & 0 & -1 & 0\\
0 & 1 & 2 & 0\\
0 & 0 & 0 & 1\\
0 & 0 & 0 & 0\end{array}
b = \begin{array}{c}
5\\
-7\\
0\\
0\end{array}
This example gives you that $x_{3}$ is the only free variable, and you know that:
$x_{1} - x_{3} = 5$
$x_{2}+2x_{3} = -7$
$x_{4} = 0$
$0= 0$
x = \begin{array}{c}
x_{1}\\
x_{2}\\
x_{3}\\
x_{4}\end{array}
= \begin{array}{c}
5+x_{3}\\
-7-2x_{3}\\
x_{3}\\
0\end{array}
= \begin{array}{c}
5\\
-7\\
0\\
0\end{array} + $x_{3}$*\begin{array}{c}
1\\
-2\\
1\\
0\end{array}
So this means that each $x$ in your x-vector, whether they are all x's or other different variables, can be written such that $x_{part}$ are the constants left over after Gaussian Elimination was done on A concatonated with b. Sorry I couldn't figure out how to type the matrix and vectors for a more appealing viewing.
A row of all zeros also implies that A is not invertible, which is important when you start learning about how to take the inverse of a matrix, which must always be square to take the inverse, but the inverse is irrelevant when solving for x in the system of equations, unless you're using Matlab to solve for x.
Side note: Did you do Gaussian Elimination to get the row to become all 0's? If so, then that means that the rows of your matrix weren't linearly independent, which also implies that the dimension of your column space is also not the dimension of your matrix, so you are not full rank.
Side Note2: If you have any questions later on, feel free to ask me.

A: A system of linear equations, as Gerry noted, is represented by a matrix equation, not the matrix itself. An example of such a "matrix equation" and its corresponding system of equations is the following:
$$\begin{bmatrix} 0 & 0 \\ 1 & 2 \end{bmatrix} \vec{x} = \begin{bmatrix} a \\ 3 \end{bmatrix}$$
$$0x_1 + 0x_2 = a$$
$$x_1 + 2x_2 = 3$$
By the convention of matrix multiplication, the top row of the above matrix equation imposes the linear equation $0x_1 + 0x_2 = a$. So if $a \neq 0$, the system makes no sense and has no solution. If $a = 0$, the equation gives us no new information and we really just have one useful equation, given by the second row; depending on the rest of the matrix, there could still be zero, one, or infinitely many solutions to the system of equations.
Additionally, consider multiplication by a matrix $A$ whose $i$th row consists of all 0s. Because of the row-vector rule of matrix multiplication, the $i$th entry of $A\mathbf{x}$ will be $\sum_j a_{ij}x_j = \sum_j 0x_j = 0$. In other words, if $A\mathbf{x} = \mathbf{b}$, and $A$'s $i$th row consists solely of 0, $b_i = 0$ always. For more information, I recommend looking up the rules of matrix multiplication and perhaps trying some examples by hand.


text:
Q: property of a given subset $ A $ of $\mathit{l}^2 $ I was given this exercise

Let $\lbrace e_n \rbrace $ be the canonical basis of $\mathit {l}^2 $ (the space of square sommable series with the usual norm) and set $$ A:= \lbrace \sum_{n \ in \mathbb{N}} a_ne_n : a_n\geq 0 \forall n, 1 \leq \sum_{n \in \mathbb{N}}\mid a_n \mid ^2 \leq 2 \rbrace $$

(i) Is A strong closed?
I think yes, because it is the intersection of 2 strong closed subsets, namely the closed ball with Radius 2 and the complementary of the open ball with radius 1. I didn't found a way to manage the condition about positivity of the coefficients :/
(ii) Is A strong compact?
Here i wanted to found an absurd using a proof of Riesz theorem that started with a finite cover of the unit ball and ended creating a set of finite element whose span is the entire space.  But i didn't found the proof to check his suitability.
(iii) What is the strong-interior of A?
I suppose that (i) is true and again according to me is the set with $<,> $ replacing $\leq, \geq $
(iv) Is A sequentially weakly compact?
Here my attempt is to make heavy use of Riesz representation theorem and reflexivity of the space.  So if I prove the weak closure, i can conclude by Banach-Alaoglu. If (i) is true, but without Mazur (A is not convex) i don't have any idea to prove weak-closureness.
(v) What is the weak interior of A?
According to me is empty. Argued by absurd, suppose that A contained a weak-neighborhood of a point. Then it would contain at least an entire affine subspace passing throught that point, but A is bounded so this is impossible.
Just an observation, what is the canonical base in $\mathit{l}^2 $ in this case? It can't be the Hamel one because it seems to be numerable and my space is banach therefore complete. I think my teacher means the hilbert base (even though hilbert spaces are introduced later than this exercise)
I need help for all my doubts please. Maybe is just the fact that i need to make mine the correct reasoning and observations that on must do when solving this kind of exercises. Thanks in advance

A: Yes, the basis is the Hilbert basis.
Let $P=\{\sum_na_ne_n\in\ell^2:\ a_n\geq0\}$. Then $P$ is closed; indeed, $\ell^2$-convergence implies pointwise convergence, so the entries of the limit will again be non-negative.
(i) We have $A=P\cap C$, where $C$ is a closed set as you say. So $A$ is closed.
(ii) The set $A$ cannot be compact, because it contains the set $\{e_n\}$, where the distance between any two elements is $\sqrt2$.
(iii) No. If $a\in A$ with $1<\|a\|<\sqrt2$ then any $b$ sufficiently close to $a$ will satisfy $1<\|b\|<\sqrt2$. But you can choose $b$ carefully to have some negative coefficient, thus putting outside $A$. This shows that the interior of $A$ is empty.
(iv) Note that $A$ is not even weakly closed. Indeed, the sequence $\{e_n\}$ is in $A$ and it converges weakly to zero.
(v) Correct.


text:
Q: Thunderbird thread view - sort by star then date So far I've been sorting my emails in non-threaded view, by star, then by date. Understand, first all starred message (sorted by date) then non-starred message (also sorted by date)
Either this doesn't work in TB 38.6.0 or there is clearly a bug, but the above gets wrecked in a weird way when using threaded view :
Suppose I have initially the aforementionned non-threaded view sorted by star then date. Now I click the thread button. Messages gets threaded in the right way: pseudo-starred threads first (ie. if the thread contains at least one message that is starred it still appears as a threaded message even though the "façade" email is not starred) and then non-starred threads also by date.
Now I switch to a random view, and then I switch back to the view I had just "threaded". That view is now completely destroyed. The messages are only sorted by star (and, only if the façade message of the thread is starred), the date sorting went to the trash, I have emails from 2009 next to 2016 =_=.
Seems like a bug, but I couldn't find it on the bugtracker ?

A: This appears to have been open in Bugzilla from 2000 to at least 2015. Some users claim that sorting on the secondary column and then the primary works, but others users don't. It's current status is "RESOLVED FIXED", though

A: *

*Click the Date header once or twice, in order to sort it in the direction you want.

*Click the Star header once or twice, in order to sort starred messages on top.

When you sort by a column by clicking on it, that column will become the highest priority column. The priority of columns, as determined by the order in which they are clicked, persists. If two messages have identical sorting weight, the column of next priority will be tested, and so on, in order to determine which is heavier.
I just confirmed that this works with a threaded view in Thunderbird 52.4.0


text:
Q: Add Image Dimensions to Cache Thumbnail According to gtmetrix.com, I need to specify image dimensions on /media/catalog/product/cache/1/thumbnail/300x300/......
I know what I need to do; in that I need to add 'width="300" height="300" but I can't find where I need to add this to? I tried app/design/frontend/THEME/template/catalog/product/view.phtml but no luck.
Any ideas?

A: The file which contains the images for the product view is in a separate file. You will find it in catalog/product/view/media.phtm. It sounds like your wanting to resize the gallery images? If so they are towards the bottom of the file.
You can use the resize function to resize to the desired size and then set the width and size of the img element using the syntax in your question.
Hope this helps.
Josh


text:
Q: How to support external UTIs on the iPhone I have been working on this for awhile for an app that I have been working on.  The app is able to open up different files from other apps like mail for example.  I have it working on the iPad but I need it to work on the iPhone as well.  I ran into a problem with testing it on the iPhone, however, because the exported file extensions that I have in the UTExportedTypeDeclarations section in the info.plist file of the app are not able to be touched in mail on the iPhone.
Here is what I have in the UTExportedTypeDeclarations section:
       <key>UTExportedTypeDeclarations</key>
<array>
    <dict>
        <key>UTTypeIdentifier</key>
        <string>com.myapp.ext</string>
        <key>UTTypeDescription</key>
        <string>Generic</string>
        <key>UTTypeConformsTo</key>
        <array>
            <string>public.data</string>
            <string>public.content</string>
        </array>
        <key>UTTypeTagSpecification</key>
        <dict>

            <key>public.filename-extension</key>
            <array>
                <string>ext</string>
    </array>
        </dict>
    </dict>

</array>

I also have this in this in the corresponding CFBundleDocumentTypes :
     <dict>
        <key>CFBundleTypeName</key>
        <string>Generic</string>
        <key>LSHandlerRank</key>
        <string>Alternate</string>
        <key>LSItemContentTypes</key>
        <array>
            <string>com.myapp.ext</string>
        </array>
    </dict>

In conclusion it is not reading the .ext file extension on the iPhone but it is on the iPad.
Any help would be much appreciated.
Thank you


text:
Q: Strange gap at the bottom of the HTML video element, when using object-fit: cover; In some cases, when one of the parent elements in HTML is having margin of padding defined at the bottom or at the top, it will happen that your video object can't stretch the source media to the fullest within itself. Even if you define the object-fit:cover you will still have the small gap at the top or the bottom of the video tag. This is happening only in Google Chrome as far as I know.

A: In my case, setting display: block; on video element solved the issue.

A: The only thing that helped me solve this issue is to set the object-position: top or object-position: bottom; on the video tag. It depends where the gap is.


text:
Q: Number of transitive relations We have a set $A$ with cardinality $n$. How to find the number of transitive relations on $A$?
Also how do we get the following results?
Number of reflexive relations on $A=2^{n^2-n}$
Number of symmetric relations on $A=2^{\frac{n(n+1)}{2}}$

A: We can think of binary relations as something like an ordered pair mapped to $\{0,1\}$. So, to fully characterize a binary relation, we just need to determine whether a certain pair $(a,b)$ is mapped to $0$ or $1$. That is why the number of all binary relations on set $A$ with cardinality $n$ is $2^{n^2}$. We first have $n^2$ ordered pairs, then there are $2^{n^2}$ mappings.
Following this thought, we can actually find the number of non-reflexive relations. There are $n$ pairs in form $(a,a)$, so there are only $n^2 - n$ pairs with distinct two elements. Those are the pairs we have to consider, resulting in $2^{n^2 - n}$ reflexive relations.
For the symmetric relations, consider it this way. Once we have determined $(a,b)$, we have determined $(b,a)$ as well. So we only need to work on $\frac{n^2 - n}{2}$ pairs. But hold on, we are forgetting $n$ pairs in form $(a,a)$. So we need to work on $\frac{n^2 - n}{2} + n = \frac{n(n+1)}{2}$ pairs, resulting in $2^{\frac{n(n+1)}{2}}$ relations.
I haven't thought of a clever way of computing number of transitive relations yet but I hope this help.

A: The problem of finding the number of transitive relations on a set of n elements is non-trivial. The number of relations defined on the set itself grows exponentially ($2^{n^2}$)
For finding the other two, lets consider a matrix form of representing relations (assume rows & columns are ordered by the elements - where a 1 corresponds to existence of an element (ordered pair) & a 0 corresponds to non-existence).
On a set n elements, the matrix is a square matrix with n rows & n columns (where each element corresponds to an ordered pair of elements from the set).
Make the following observations -

All of the diagonal elements correspond to Reflexive Relation.
The mirror elements across the diagonal correspond to Symmetric Relation.
Total no of diagonal elements is $n$
Total no of non-diagonal elements is $n^2 - n$
Total no of mirror-element pairs is $\frac{n^2 - n}{2}$

Now, for a Relation to be Reflexive, all of the diagonal elements must be 1, the other elements may or may not exist (either 0 or 1).
In Symmetric Relations, all of the mirror elements occur in pairs i.e., either both 1 or both 0, the diagonal elements may or may not exist (either o or 1).
Counting this way, its clear that the number of Reflexive relations is $2^{\frac{n^2 - 2}{2}}$ and the number of Symmetric Relations is $(2^n)(2^{\frac{n^2 - n}{2}})$ which is equal to $2^{\frac{n^2 + n}{2}}$


text:
Q: Access a cookie that was set on a javascript file, but not on the HTML I have a script that needs some external information to work with. It fetches this using Ajax requests. So far so good.
However, the script needs some of it's data right from the start. So I have been pondering a few options to supply it with that initial data at page load time:

*

*Simplest: Just have it perform an Ajax request for the data right away. Downside of this is extra latency and more requests than strictly needed.

*Ugly: Add a small script fragment at HTML render time that provides the initial data

*Bad caching properties: Create the whole JS file dynamically and add the data right then.

*Impossible: Something with headers... but unfortunately it seems we can't access them (see e.g. this question). Doing the extra Ajax request is not useful here as in that case we might just as well use option #1.

*Something with cookies...

*Not tried yet: Create a dynamic 'initial-data.js' script whose sole purpose it is to load the initial data. This would at least only send the data when needed, but it would require all users of my script to include 2 script files instead of one.... Also it will cause an extra request...

I am trying out the 4th option of using cookies to transport the initial data but so far not having any success. What I am trying to do:

*

*When the browser requests the .js file, have the server add a Set-Cookie header with the initial data in it in the response.

*In the JS file, read out the cookie.

It doesn't work. It seems I need to set the cookie on the response for the .html instead of the .js for the browser to make it available to the script... That's too bad as it would involve adding the Set-Cookie header to each page, even though it's only needed by that particular piece of JS.
I was actually very happy with the solution I thought I found because it let me send the initial data along with the request for the script only to those pages that actually use the script... Too bad!
Is there any way to do what I'm trying to do using cookies, headers or some similar mechanism?
Do you guys have any tips for this situation?
Background:
I am trying to write a semi-offline application. Semi-offline in that it should continue to work (apart from some functions that just need connectivity) when offline, but is expected to have periods with connectivity regularly. So I'm using local storage and synching with the server when possible.
To be able to have the client generate new items when offline, I am including an ID generator that gets handed out ID blocks by the server, consuming them as it generates ID's. The data I was trying to send to the script in a cookie is the initial list of ID blocks and some settings and looks like this:
/suid/suid.json:3:3:dxb,dyb,dzb
       ^        ^ ^      ^
      url     min max   blocks

Where:
url = path to JSON for subsequent Ajax requests
min = minimum amount of ID blocks to keep in local storage
max = maximum amount of ID blocks to keep in local storage
blocks = comma separated list of ID blocks

The ID blocks are encoded as sort-of Base32 strings. I'm using a custom formatting schema because I want 53-bit ID's to be as short as possible in text format while still being easily human readable and write-able and URL-safe.


text:
Q: upload image from gallery or camera to rest api (error: status: false, message: User Does Not Exists!, data: null) I want upload image from gallery to api here is my image api
Future  profileImageUser(String user_id, String image) async {

      String url = 'api';
      final response = await http.post(Uri.parse(url),
          body: {
            'user_id': user_id,
            'image': image
          }
      );
      var convertedDataJson = jsonDecode(response.body);
      return convertedDataJson;
    }

Here is how i am getting user id and image to upload it through rest api
 ImagePicker picker = ImagePicker();
  Future _imgFromCamera() async {
    final image = await ImagePicker().pickImage(source: ImageSource.camera);

    setState(() {
      _image = image;
      final bytes = File(_image!.path).readAsBytesSync();
      String img64 = base64Encode(bytes);
     print(img64);
    });
    SharedPreferences prefs = await SharedPreferences.getInstance();
    if (_formKey.currentState!.validate()) {
      var myProfile = _image;
      print(myProfile);
      var myId = prefs.getString('user_id');
      print(myId);
      var rsp = await profileImageUser(
        myProfile.toString(),
        myId.toString(),
      );
      print(rsp);
       if (rsp['status'] == true) {
        print(rsp);
      } else {
        print('failed');
      }
    }
  }

when i upload image from gallery or camera it print id and image as follow
I/flutter ( 6665): Instance of 'XFile'
I/flutter ( 6665): 111

but it also show error that user doest not exist
I/flutter ( 6665): {status: false, message: User Does Not Exists!, data: null}

kindly provide a solution.

A:  Future  profileImageUser(String image,String user_id) async {

  String url = 'http://bitborgtech.com/appss/api/update_profile_image';
  final response = await http.post(Uri.parse(url),
      body: {
        'user_id': user_id,
        'image': image
      }
  );
  var convertedDataJson = jsonDecode(response.body);
  return convertedDataJson;
}


text:
Q: Materialized View Query Rewrite Usage? So I have been working with Oracle support over an Materialized view compile issue with our dataguard standby database and they recommended turning off query rewrite (setting query_rewrite_enabled=false). We have many MV's that have "enable query rewrite" in them, so I am a little hesitant to turn it off and cause potential performance problems..
Is there any way to tell if the MV's are in fact using query rewrite (perhaps a V$ view or something?)? When I tested querying one of the base tables it did not use the materialized view and an explain plan showed a full table scan. I am thinking that most our the queries wouldn't be rewritten, but I wanted to be sure before making a change.
Also, are there any other big impacts I should be aware off if I turn off query_rewrite_enabled?


text:
Q: Google sheet and Appsheet Inventory App: Logic for Logging in remaining stock instead of recording one item sold at a time. App to determine sales I need to develop logic for an Inventory Management app for a small business using google sheet and appsheet.
The app to allow recording of remaining stock everyday morning and any additional stock that comes in, the app to internally determines sales made the previous day and keep a record of this day after another.
In a small retail shop, it is convenient to count remaining stock every morning rather than recording every sale every time during the day.
Unlike other POS systems where each items are scanned or recorded one by one as they are being sold, I want to just record the remaining stock and additional stock, the app to do the rest.
Here is a google drive link to the folder containing the google sheet and product images.
Google drive folder
The spreadsheet contains 3 sheets:

*

*Stock list: Contains products available in the store and their prices.

*Stock Review: Used for logging remaining stock every morning. Currently contains remaining stock logged for 30th 31th May 2022

*Add Stock: For logging in additional stock


text:
Q: This is hard to say concisely...but I'm having issues with my if/else javascript. "if" won't happen after "Else" does I just started learning Javascript, so maybe this is doing exactly what it's supposed to be doing, but this is what I think is a problem.
I have a text box and submit button. I have a
 of text that is hidden.
IF the user's text entered is what I want it to be, the
 of text shows on submit.
ELSE (any other user's text), the text shows up, but
document.getElementById("id").innerHTML="Incorrect!";
document.getElementById("id").style.display="block;"

So, it works that if you enter the CORRECT word first, the
 shows up.
If INCORRECT, it shows up, but with different text, ie, "incorrect!" So far, so good...
THE PROBLEM: After you get the text wrong, you can't try again, you have to refresh.
If you get it right, the right text shows, if you enter something else in after, the proper
 follows, too, but if you try AFTER the wrong text is entered, it doesn't go back.
So once it's incorrect, you can't go back. So if someone got it wrong, and then put in the right word, they wouldn't be able to tell unless they refreshed and tried it again first.... Does this make sense? I hope I'm clear.

A: You haven't posted much code so I'll make some assumptions in this answer, which I hope are clear
Say you have your "text box" <input type="text" id="textbox"/> which I'll call box and your message area
sometext
 which I'll call msg
var box = document.getElementById('textbox'),
    msg = document.getElementById('id');

Then in the code which handles the submit you have, say
if (box.value === 'foo') { // contains the right thing
    // ...
} else { // contains the wrong thing
    msg.innerHTML = 'Incorrect!';
    msg.style.display = 'block';
}

Which you say works fine the first time around, but not the second, then you'll need to consider what has actually changed between these two invocations? Perhaps you should re-set the defaults before the if, for example I'm guessing your message starts hidden, so you could add the following before the if line to make sure you're starting from where you expect
msg.style.display = 'none';


text:
Q: Sticky side bar component won't stick to the top - React + SCSS I have a nav bar component coded in my React app's JSX with a class of column-left:
<animated.div className="column-left" style={anim}>

Hello, {user.firstName}

                                <button id="new-note">+ New Note</button>

                                <button onClick={() => setAcctSettingsVis(true)}>Account Settings</button>
                                <button onClick={handleClick}>Log Out</button>

</animated.div>

And I'm then targeting that element with the class name in my SCSS and applying the position: sticky attributes as well as a top position of 0 to tell it where to stick:
.column-left {
        position: -webkit-sticky;
        position: sticky;
        top: 0;
        display: flex;
        flex-direction: column;
        justify-content: space-between;
        align-items: center;
        height: 100vh;
        min-width: 20rem;

        //...
}

But when main content of my page extends beyond the window view height and I scroll down, the nav bar does not stick. I'm confused because I've used this set up on other projects before and it worked just fine. What am I missing here?

A: You could set up a css (or scss) file that has this code snippet:
.fixed-top {
     position: fixed;
     top: 0;
     right: 0;
     left: 0;
     z-index: 1030;
}

You could then attach the fixed-top attribute to one of your tags. Once you do this, you might have to add some top padding or bottom padding to your content (sometimes it will get covered), but nonetheless, this is a solution that should work!


text:
Q: How can I return vector by reference in C++ I want to make the function that returns a vector by reference. But the returned vector(returned_v) is not same as vec.v, but a copied vector. It means the vector is returned by value.  How can I get the referenced vector from vector_reference()?
class Vec {
  public:
    std::vector<int> v = {1, 2, 3};
    std::vector<int>& vector_reference() {
        return v;
    }
};

int main() {
    Vec vec;
    std::vector<int> returned_v = vec.vector_reference();
    returned_v.clear();
    std::cout << returned_v.size() << std::endl; // result: 0
    std::cout << vec.v.size() << std::endl; // result: 3

    return 0;
}

A: returned_v is an independent object which gets copied from the return value of vec.vector_reference(). You should declare it as reference too.
std::vector<int>& returned_v = vec.vector_reference();

A: The reference in the function vector_reference() is the reference of vec.v. However, returned_v is a copy of vec.v, not a referrence of it. Two ways can help you:

*

*std::vector<int>& returned_v = vec.vector_reference();

*std::vector<int> returned_v = std::move(vec.vector_reference());  //C++ 11


text:
Q: Django REST Framework on Heroku not saving created objects I am running a Django app on Heroku that uses Django REST Framework to store data from scanners, which are devices which send a JSON POST request to the framework whenever it detects a new scan. The request is serialized and creates a new scan object. The models are as follows:
class Location(models.Model):
    address = models.CharField(max_length=300)
    city = models.CharField(max_length=50)
    state = models.CharField(max_length=100)
    zipcode = models.IntegerField(null=True, blank=True)
    latitude = models.FloatField(null=True, blank=True)
    longitude = models.FloatField()
    _current_occupancy = models.IntegerField(default=0, db_column='current_occupancy')
    def __str__(self):
        return self.address
    @property
    def current_occupancy(self):
        scanner_objs = Scanner.objects.filter(location=self)
        num_scans = 0
        for s in scanner_objs:
            today_min = datetime.datetime.combine(datetime.date.today(), datetime.time.min)
            today_max = datetime.datetime.combine(datetime.date.today(), datetime.time.max)
            scan_objs = Scan.objects.filter(scanner=s, datetime__range=(today_min,today_max))
            num_scans += len(scan_objs)
        return num_scans

class Scanner(models.Model):
    location = models.ForeignKey(Location, on_delete=models.CASCADE, null=True, blank=True,related_name='scanner')
    description = models.CharField(max_length=300, null=True, blank=True)
    def __str__(self):
        return self.location.address + ": " + self.description + " (id=" + str(self.pk) + ")"

class Scan(models.Model):
    scanner = models.ForeignKey(Scanner, on_delete=models.CASCADE, null=True, blank=True,related_name='scan')
    datetime = models.DateTimeField(null=True, blank=True, default=datetime.datetime.now)
    def __str__(self):
        if self.scanner != None:
            return self.scanner.description + ": " + str(self.datetime)
        else:
             return "None: " + str(self.datetime)
    class Meta:
        ordering = ('datetime',)

I'm writing code locally and pushing to Heroku with Git. When I create any object locally and push it, the object saves correctly, but when I try to create a new object on Heroku by serializing a POST request it seems to save the object for a few minutes and then abruptly drops it. I check the list of objects on Django REST Framework's browsable API and it seems to forget I created the new object after a few minutes, as if it is not saving in the database correctly. What might be the problem here? Is Heroku not saving new objects in the PostgreSQL database because my local DB file is writing over it?


text:
Q: What for is the node_modules folder that is created by running npm install create-react-app for? When I run npm install create-react-app in any folder, it creates a node_modules folder. What is the node_modules folder for? How is it related to create-react-app?

A: create-react-app should be installed using npm install -g create-react-app that will make the create-react-app command available in any directory.
See the npm documentation for a complete description of the various folders that npm creates or writes to.
Whe you run npm install create-react-app (without the global (-g) modifier) npm executes a local dependency install and puts the results in  ./node_modules of the current directory.

A: You can install globally by npm install -g create-react-app if you want to avoid creating node_modules directory.

A: Short answer: yes.
Long answer: create-react-app should be installed globally, then run inside the folder in which you wish to put your app.

A: Basically is the folder that contains all the node packages that your app requires, nmp install create-react-app depends on other node packages that will be installed in the node_modules folder.


text:
Q: Quartz trigger does not fire immediately I'd like to execute the job ~immediately with quartz scheduler using jdbc datastore. However I have like 20-30 seconds delay between the scheduling and trigger fire even though I schedule with now() or calling triggerJob.
I tried to execute the job with a simple trigger:
JobKey key = //...
        JobDetail jobDetail = newJob(jobBean.getClass())
                .withIdentity(key)
                .usingJobData(new JobDataMap(jobParams))
                .storeDurably()
                .build();

        Trigger trigger = newTrigger()
                .withIdentity(key.getName(), key.getGroup())
                .startNow()
                .withSchedule(SimpleScheduleBuilder.simpleSchedule()
                        .withMisfireHandlingInstructionFireNow()
                        .withRepeatCount(0))
                .build();

        scheduler.scheduleJob(jobDetail, trigger);

And I also tried to trigger with scheduler:
 JobKey key = // ...
        JobDetail jobDetail = newJob(jobBean.getClass())
                .withIdentity(key)
                .storeDurably()
                .build();
        scheduler.addJob(jobDetail, true);

        scheduler.triggerJob(key, new JobDataMap(jobParams));

Here are the listener logs that shows the delay.
2019-05-15 13:59:52,066Z  INFO  [nio-8081-exec-2] c.m.f.s.logger.SchedulingListener                  : Job added: newsJobTemplate:1557928791965
2019-05-15 13:59:52,066Z  INFO  [nio-8081-exec-2] c.m.f.s.logger.SchedulingListener                  : Job scheduled: newsJobTemplate:1557928791965
2019-05-15 14:00:18,660Z  INFO  [eduler_Worker-1] c.m.f.s.logger.TriggerStateListener                : Trigger fired: QUARTZ_JOBS.newsJobTemplate:1557928791965 {}
2019-05-15 14:00:18,703Z  INFO  [eduler_Worker-1] c.m.f.s.logger.JobExecutionListener                : Job will be executed: QUARTZ_JOBS.newsJobTemplate:1557928791965
2019-05-15 14:00:19,284Z  INFO  [eduler_Worker-1] c.m.f.s.logger.JobExecutionListener                : Job was executed: QUARTZ_JOBS.newsJobTemplate:1557928791965

A: I found crumbs here and there that suggested that the problem is transaction related.
So I removed @Transactional from the service method and voila it worked.
Looks like when you call trigger the scheduler thread asyncronously tries to look up schedules and triggers from the DB but the transaction is not committed at that time. Later the scheduler thread looks up the db again and it finds it finally.

A: zolee's answer describes the problem perfectly, but there are also a few things one can do to solve it.
One imperfect solution is to reduce org.quartz.scheduler.idleWaitTime. In fact, the problem itself is described, though somewhat obliquely, in the quartz configuration doc, org.quartz.scheduler.idleWaitTime section.

Normally you should not have to 'tune' this parameter, unless you're
using XA transactions, and are having problems with delayed firings of
triggers that should fire immediately.

That will allow you to reduce 30-second delay to 5 seconds or even less.
A full solution is to extend QuartzScheduler to add transaction support. Exact implementation will depend on what library/code you're using for transaction support, but it worked for us perfectly.
class TransactionAwareScheduler extends QuartzScheduler {
    @Override
    protected void notifySchedulerThread(long candidateNewNextFireTime) {
        if (insideTransaction) {
            transaction.addCommitHook(() -> {
                super.notifySchedulerThread(candidateNewNextFireTime);
            });
        }
    } else {
        super.notifySchedulerThread(candidateNewNextFireTime);
    }
}


text: Q: Shape detection in bmp file using java I need to detect shape in a .bmp in java. The image can have any shape oval, ellipse or a circle. It'll be like a circle with black boundaries on a white background. I tried using boofCV but couldn't get the desired result. Any other library which will help in this case.


text:
Q: using jQuery in PebbleJS apps How can I add the jQuery library to my PebbleJS apps?
Here's my code:
var UI = require('ui');
var ajax = require('ajax');
var $=require('jQuery');

$.getJSON(URL);
var card = new UI.Card({
  title:'last.fm stat',
  subtitle:'Fetching...'
});
card.show();

Here's the error I receive:
[INFO] ocess_manager.c:368: Heap Usage for App <lastfm sta: Total Size <48584B> Used <6256B> Still allocated <28B>
[PHONE] pebble-app.js:?: JavaScript Error:
Error: Cannot find module 'jQuery'
    at Object.loader.require (loader.js:34:11)
    at require (loader.js:41:48)
    at Object.loader (app.js:9:7)
    at Object.loader.require (loader.js:44:10)
    at require (loader.js:41:48)

A: You cannot use jQuery. PebbleJS uses the jQuery Mobile specifications of jQuery natively. You do not need to require it in the app as it is already a part of it.
That said, you may want to research and understand the difference between the two, as some functionality has been removed for the mobile side. One specific instance I remember the most is jQuery Mobile has responseText but not responseXML. This is why many people have a lot of work arounds in place to manage XML feeds in their apps when they are unable to retrieve JSON from an API.