text:
Q: License on papers published at universities? I've done some searching around on how to interpret morse code inputted by a human. I haven't found any existing libraries or applications that do this, but I found some academic papers on how it can be done.
Before embarking on the journey of trying to interpret the academic language and advanced topics I have to know if it is okay for me to use these papers? What kind of license do they have? One I'm thinking of specifically is "A Morse-code recognition system with LMS and matching algorithms for persons with disabilities." but also others floating around. The paper mentioned appears to cost money to read, but then what? Can it have been patented? What rules apply here?

A: If the patent had been applied for before the paper was written, it would probably say in the paper.  But it might have been patented AFTER the paper was written, so you'd best look up the authors at the USPTO website.
I am not a lawyer, but I don't think there is any license at all on algorithms that are published in academic papers.  There would be a license on software that was produced by an academic institution, but that's a different thing.
However, what Academia just about always cares about more than licensing is getting proper credit for their discoveries.  Thus you should credit that paper's authors and their institution in your app's About Box (if it has one), in the online help if it's a command-line program, or on your app's website if it's a web app.  Also credit them in your documentation.
Finally email the authors to tell them that you are using their algorithm.  The chances are pretty good that they didn't expect to make money from it, but the fact that their invention is being put to good use in industry will help them get grants, advanced in rank (say from associate professor to full professor) or maybe even get tenure.
I have seen an academic source code license that more or less says you can do what you want with the code provided the original authors get visible credit for their work.  To do otherwise would be just like using their paper's results in your own paper without providing a citation, which is a form of plagiarism.

A: Basically, that's dependent on the institution where the work was done and the issuers of the grants that funded it.  There's no overall policy for that sort of thing.  Contacting the author(s) would probably be your best option at this point.


text:
Q: Recode a numeric variable with many values including NAs How to recode a numeric variable with many values including missing values, to have numbers 0:n-1 where n is the number of unique values including NA, in a tidy way?
Example:
df <- tibble(x = c(1000, 1000, NA, 1001, 1002, 1003, NA, 1003))

Required output (though it can be any recoding scheme as long as the values are 0:n-1):
# A tibble: 8 x 2
      x     y
  <dbl> <dbl>
1  1000     0
2  1000     0
3    NA     4
4  1001     1
5  1002     2
6  1003     3
7    NA     4
8  1003     3

I am able to do this in a tidy way by first converting x to a factor then using fct_recode() with a named list (created automatically because remember there are many values in x), then back to numeric:
df <- df %>% mutate(x_fct = factor(case_when(
    is.na(x) ~ "level_na",
    TRUE ~ str_c("level_", x)
  )))
x_levels <- levels(df$x_fct)
n_levels <- length(x_levels)
names(x_levels) <- as.character(0:(n_levels - 1))
df <- df %>%
  mutate(y = as.numeric(fct_recode(x_fct, !!!x_levels)) - 1)
df

# A tibble: 8 x 3
      x x_fct          y
  <dbl> <fct>      <dbl>
1  1000 level_1000     0
2  1000 level_1000     0
3    NA level_na       4
4  1001 level_1001     1
5  1002 level_1002     2
6  1003 level_1003     3
7    NA level_na       4
8  1003 level_1003     3

But this seems very cumbersome. Surely there's a simpler way, preferably in a single pipe.

A: One way would be to use match + unique. You can add sample to add randomness
library(dplyr)

df %>%
  mutate(level = paste('level', x, sep = '_'),
         y = match(x, sample(unique(x))) - 1)

#      x level          y
#  <dbl> <chr>      <dbl>
#1  1000 level_1000     4
#2  1000 level_1000     4
#3    NA level_NA       2
#4  1001 level_1001     0
#5  1002 level_1002     1
#6  1003 level_1003     3
#7    NA level_NA       2
#8  1003 level_1003     3

redpajama_set_name: RedPajamaStackExchange


text:
Q: rotateing without using XML animation file i want rotate a image without use xml file.
it is my xml animation code:
<rotate
xmlns:android="http://schemas.android.com/apk/res/android"
android:fromDegrees="0"
android:toDegrees="360"
android:pivotX="50%"
android:pivotY="50%"
android:duration="10000"
android:fillAfter="false"
android:startOffset="0"
android:interpolator="@android:anim/linear_interpolator"
/>

A: try this:
 View needRotateView;// That needRotateView must make sure had measured
 float w = needRotateView.getWidth();
 float h = needRotateView.getHeight();
 int type = Animation.RELATIVE_TO_SELF;//sorry,if not work find,try the

follow type value
// int value_type = Animation.RELATIVE_TO_PARENT;
// int value_type = Animation.ABSOLUTE;
RotateAnimation anim = new RotateAnimation(0, 360, type, w / 2, type,h / 2);
anim.setDuration(1000 * 10);
anim.setFillAfter(false);
anim.setStartOffset(0);
anim.setInterpolator(new LinearInterpolator());

A: A real easy way is to use a ProgressBar item and set it to use your drawable:
Add a ProgressBar widget to your layout (mine is in a RelativeLayout):
<ProgressBar
    android:id="@+id/mp4_progressBar1"
    style="?android:attr/progressBarStyleLarge"
    android:layout_width="200dp"
    android:layout_height="200dp"
    android:layout_centerInParent="true"
    android:layout_marginLeft="160dp"
    android:indeterminate="true"
    android:indeterminateDrawable="@drawable/progress_spinner_anim" />

The last line points to a drawable XML, like this:
// progress_spinner_anim.xml
<rotate xmlns:android="http://schemas.android.com/apk/res/android"
    android:drawable="@drawable/spinner"
    android:fromDegrees="0"
    android:pivotX="50%"
    android:pivotY="50%"
    android:toDegrees="1080" />

That file points to your image file (mine is drawable/spinner.png).


text:
Q: Multiplying lists together Been working on a small class project to make a blackjack game.  I realize that there are a billion how to's on this, but I'm trying to understand coding and build my own...that being said, I've messed up a lot.  This conundrum is confusing to me though...while setting up my deck, I tried this:
suits = ['spades', 'hearts', 'clubs', 'diamonds']
ranks = ['ace', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight',     'nine', 'ten', 'Jack', 'Queen', 'King']

decks = []

for suit in suits:
    for rank in ranks:
        decks += (rank, suit)
print decks

I get the expected outcome of the two lists ordering together:
['ace', 'spades', 'two', 'spades', 'three', 'spades', 'four'...]
However, when I try to combine them into a dictionary as follows:
b = dict(zip(decks[1::2], decks[0::2]))
print b

I get: {'hearts': 'King', 'clubs': 'King', 'spades': 'King', 'diamonds': 'King'} Why does it only do the King values?
When I tried to rectify with the following code:
spade = ['spades']

ranks = ['ace', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine', 'ten', 'Jack', 'Queen', 'King']

spades = []

for rank in ranks:
    spades += (rank, spade)
print spades

I got this as the output:
['ace', ['spades'], 'two', ['spades'], 'three', ['spades'],...]
So what gives? Help a noob out!  My intention was to create a deck somewhat elegantly through lists, append values to the cards, create a dictonary and use the values to calculate scores...and trying to understand Python coding better!
Thanks!

A: Talking about multiplying lists should compel you to use itertools.product, and force iteration by converting to list
import itertools

suits = ['spades', 'hearts', 'clubs', 'diamonds']
ranks = ['ace', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight',     'nine', 'ten', 'Jack', 'Queen', 'King']

decks = list(itertools.product(suits,ranks))

print(decks)

result
[('spades', 'ace'), ('spades', 'two'), ('spades', 'three'), ('spades', 'four'), ('spades', 'five'), ('spades', 'six'), ('spades', 'seven'), ('spades', 'eight'), ('spades', 'nine'), ('spades', 'ten'), ('spades', 'Jack'), ('spades', 'Queen'), ('spades', 'King'), ('hearts', 'ace'), ('hearts', 'two'), ('hearts', 'three'), ('hearts', 'four'), ('hearts', 'five'), ('hearts', 'six'), ('hearts', 'seven'), ('hearts', 'eight'), ('hearts', 'nine'), ('hearts', 'ten'), ('hearts', 'Jack'), ('hearts', 'Queen'), ('hearts', 'King'), ('clubs', 'ace'), ('clubs', 'two'), ('clubs', 'three'), ('clubs', 'four'), ('clubs', 'five'), ('clubs', 'six'), ('clubs', 'seven'), ('clubs', 'eight'), ('clubs', 'nine'), ('clubs', 'ten'), ('clubs', 'Jack'), ('clubs', 'Queen'), ('clubs', 'King'), ('diamonds', 'ace'), ('diamonds', 'two'), ('diamonds', 'three'), ('diamonds', 'four'), ('diamonds', 'five'), ('diamonds', 'six'), ('diamonds', 'seven'), ('diamonds', 'eight'), ('diamonds', 'nine'), ('diamonds', 'ten'), ('diamonds', 'Jack'), ('diamonds', 'Queen'), ('diamonds', 'King')]

or since you seem to need a flat list, just flatten it using chain.from_iterable:
decks = list(itertools.chain.from_iterable(itertools.product(suits,ranks)))

A: You can use a list comp to create a deck of cards like [[rank,suits]]. And dict() creates an object from only 2 values [value1,value2]. The reason you keep getting {'hearts': 'King', 'clubs': 'King', 'spades': 'King', 'diamonds': 'King'} is because a dict has unique {key:value} pairs and the last item to be assigned those keys is King in the ranks array.
suits = ['spades', 'hearts', 'clubs', 'diamonds']
ranks = ['ace', 'two', 'three', 'four', 'five', 'six', 'seven',
         'eight',     'nine', 'ten', 'Jack', 'Queen', 'King']

print [(rank, suit) for suit in suits for rank in ranks]

solution
You can make the keys to the dick the ranks and the values an array of the (rank,suit) with the same rank
card_dict = {}
suits = ['spades', 'hearts', 'clubs', 'diamonds']
ranks = ['ace', 'two', 'three', 'four', 'five', 'six', 'seven',
         'eight', 'nine', 'ten', 'Jack', 'Queen', 'King']
deck = [(rank, suit) for suit in suits for rank in ranks]

map(
    lambda rank: card_dict.update(
        {
            rank: filter(lambda card: rank in card, deck)
        }
    ), ranks
)

print card_dict

result
{
  'King': [('King', 'spades'), ('King', 'hearts'), ('King', 'clubs'), ('King', 'diamonds')],
  'seven': [('seven', 'spades'), ('seven', 'hearts'), ('seven', 'clubs'), ('seven', 'diamonds')],
  'Queen': [('Queen', 'spades'), ('Queen', 'hearts'), ('Queen', 'clubs'), ('Queen', 'diamonds')],
  'ace': [('ace', 'spades'), ('ace', 'hearts'), ('ace', 'clubs'), ('ace', 'diamonds')],
  'ten': [('ten', 'spades'), ('ten', 'hearts'), ('ten', 'clubs'), ('ten', 'diamonds')],
  'nine': [('nine', 'spades'), ('nine', 'hearts'), ('nine', 'clubs'), ('nine', 'diamonds')],
  'six': [('six', 'spades'), ('six', 'hearts'), ('six', 'clubs'), ('six', 'diamonds')],
  'two': [('two', 'spades'), ('two', 'hearts'), ('two', 'clubs'), ('two', 'diamonds')],
  'three': [('three', 'spades'), ('three', 'hearts'), ('three', 'clubs'), ('three', 'diamonds')],
  'four': [('four', 'spades'), ('four', 'hearts'), ('four', 'clubs'), ('four', 'diamonds')],
  'five': [('five', 'spades'), ('five', 'hearts'), ('five', 'clubs'), ('five', 'diamonds')],
  'Jack': [('Jack', 'spades'), ('Jack', 'hearts'), ('Jack', 'clubs'), ('Jack', 'diamonds')],
  'eight': [('eight', 'spades'), ('eight', 'hearts'), ('eight', 'clubs'), ('eight', 'diamonds')]
}

or if you map by suits instead of ranks
{
  'clubs': [('ace', 'clubs'),
    ('two', 'clubs'),
    ('three', 'clubs'),
    ('four', 'clubs'),
    ('five', 'clubs'),
    ('six', 'clubs'),
    ('seven', 'clubs'),
    ('eight', 'clubs'),
    ('nine', 'clubs'),
    ('ten', 'clubs'),
    ('Jack', 'clubs'),
    ('Queen', 'clubs'),
    ('King', 'clubs')
  ],
  'diamonds': [('ace', 'diamonds'),
    ('two', 'diamonds'),
    ('three', 'diamonds'),
    ('four', 'diamonds'),
    ('five', 'diamonds'),
    ('six', 'diamonds'),
    ('seven', 'diamonds'),
    ('eight', 'diamonds'),
    ('nine', 'diamonds'),
    ('ten', 'diamonds'),
    ('Jack', 'diamonds'),
    ('Queen', 'diamonds'),
    ('King', 'diamonds')
  ],
  'hearts': [('ace', 'hearts'),
    ('two', 'hearts'),
    ('three', 'hearts'),
    ('four', 'hearts'),
    ('five', 'hearts'),
    ('six', 'hearts'),
    ('seven', 'hearts'),
    ('eight', 'hearts'),
    ('nine', 'hearts'),
    ('ten', 'hearts'),
    ('Jack', 'hearts'),
    ('Queen', 'hearts'),
    ('King', 'hearts')
  ],
  'spades': [('ace', 'spades'),
    ('two', 'spades'),
    ('three', 'spades'),
    ('four', 'spades'),
    ('five', 'spades'),
    ('six', 'spades'),
    ('seven', 'spades'),
    ('eight', 'spades'),
    ('nine', 'spades'),
    ('ten', 'spades'),
    ('Jack', 'spades'),
    ('Queen', 'spades'),
    ('King', 'spades')
  ]
}

shuffling
import random
random.shuffle(deck)
print deck


text:
Q: Do php variables persist (using AJAX)? This is my first question on this site, so I'm going to try to be as specific as i can... By the way, excuse me for my perfect knowledge of English... which isn't perfect at all..
So what I was wondering is: do php variables persist if you change your page's content, using AJAX methods?
Let me explain: I want to code a web app which has to contain a main layer, containing a few tabs. The user has to be able to write stuff into text areas in one tab, switch the tab, and if he wants so, come back to the first tab to complete what he wrote before (also the app has to keep the php variables that it created previously right?). The app also has to put all the data, entered in all the different tabs, in one or many databases, when a summit button is clicked; so it has to access all the variables created before.

I just don't have any code at this moment, but I want to do a specification file before starting to code, because what I am about to do is kinda massive app, so i hope you will be able to explain me this point.

I still thank you for your help.

A: You would be best to consider the PHP script as a one-off thing.  It does what it is asked to, then terminates.  Nothing is preserved.
However, if you NEED to preserve something to pass back with an AJAX call, you can do it by including:
<INPUT type='hidden' id='my_variable' value='my_value'>

This can be referenced by the javascript that calls your AJAX PHP page and thus be passed back.
For what you require, as @AlexP said, you can simply change the visibility of each tab content area with:
Tab Name

or similar.  Your JS function might include something like:
for(n=1;n<=numberOfTabs;n++)
{
document.getElementById("div_"+n).style.display="none";
}
document.getElementById("div_"+passedid).style.display="block";

though there are other ways of doing it.
Perhaps what you REALLY want to do is save the entered data into a database field frequently (or even continuously).


text:
Q: How to calculate time difference of args in awk I have input in below format
0001580-160219044548744-oozie-oozi-W@:start:    -       -       -       -       OK      :start: 0       -       :START: 2016-02-24 13:34:46 GMT OK      2016-02-24 13:34:46 GMT
0001580-160219044548744-oozie-oozi-W@PrepareHDFS        -       -       -       -       OK      PrepareHDFS     0       -       fs      2016-02-24 13:34:46 GMT OK  2016-02-24 13:34:47 GMT

Using awk I am trying to print the required columns positioned in 7,12,16 Columns as below using the below command
cat input |  awk '/^000/ {printf "%-40s %-10s %-10s",$7,$12,$16}'

and the output is
:start:                                  05:35:56   05:35:56
PrepareHDFS                              05:35:56   05:35:57

My requirement is along with the above output I need time difference also.
I tried below one inside a script
cat intput | awk '/^000/ {printf "%-40s %-10s %-10s",$7,$12,$16;
T1=`date +%s -d $12`;T2=`date +%s -d $16`;
DIFF=`expr ${SEC2} - ${SEC1}`; print `date +%H:%M:%S -ud ${DIFF}` }'

But I am getting errors as invalid syntax. How can I achieve the time difference so that output should be
PrepareHDFS                              05:35:56   05:35:57  00:00:01
ScheduleStart                            05:35:57   05:36:11  00:00:14

EDIT:
For time difference, I have below script
TIME1=05:36:27
TIME2=05:36:51
SEC1=`date +%s -d ${TIME1}`
SEC2=`date +%s -d ${TIME2}`
DIFFSEC=`expr ${SEC2} - ${SEC1}`
echo `date +%H:%M:%S -ud @${DIFFSEC}`
00:00:24

Can I use this set of lines inside a function, and call that function from awk?

A: You can do it using awk, it's just a bit … unweildy:
awk -v cmd='date +%s -d ' -v cmd2='date +%H:%M:%S -d ' '/^000/ {
  cmd $12 | getline T1; close(cmd $12);
  cmd $16 | getline T2; close(cmd $16);
  cmd2 (T2 - T1) | getline T1; close(cmd2 (T2 - T1));
  printf "%-40s %-10s %-10s%-10s\n", $7, $12, $16, T1
}'

You can't use the shell's backtick process substitution in awk. awk has its own way of getting the output of a command - via getline and coprocesses. The syntax is roughly:
command | getline var-name
close(command)

Where command is a variable or string containing the command. cmd $12 is just the concatenation of cmd and $12, so the command would become date +%s -d 13:34:46, for example.
date interpretation of pure numbers as input is complex. It would be best to force it see the input number as a Unix timestamp, by using a leading @:
awk -v cmd='date +%s -d ' -v cmd2='date +%H:%M:%S -d @' '/^000/ {
  cmd $12 | getline T1; close(cmd $12);
  cmd $16 | getline T2; close(cmd $16);
  cmd2 (T2 - T1) | getline T3; close(cmd2 (T2 - T1));
  printf "%-40s %-10s %-10s%-10s\n", $7, $12, $16, T3
}'


text:
Q: create vbscript vbdataobject I am using a program which makes it possible to customize dialogues via vbscript. Now, the form has an attribute which seems to be a vbDataObject (VarType returns 13).
How can I read the content and create a new vbDataObject to assign it to the attribute?

A: Don't know if this is exactly the answer, but it seems that vbDataObject's are indeed COM objects, but they just do not expose an IDispatch interface (so they're not true automation objects).  As such, VBScript just isn't capable of accessing their content, since it needs an IDispatch interface for it.  It just has an IUnknown interface which it doesn't know what to do with.
Passing them around should be possible, though, so if another true automation COM object can manipulate them for you (maybe there is such an object in the app designed to do this?), you could use that to make an object with the correct settings and pass that to the form.
Another option is to contact the authors of the app and ask them if they're willing to give this one object an IDispatch interface as well.  Since they presumably went the length to put IDispatch interfaces on most of their objects, this omission might just be an oversight on their part.


text:
Q: git resume rebase using reflog I aborted in the middle of a long interactive rebase process since a conflict resolution went terribly wrong.
I notice that the reflog has refs to each time a rebase was git rebase --continued.
How can I resume rebasing from the last successful --continue point such that the previous conflict resolutions from the rebase are kept?  (If I were to run the rebase command again from scratch, I would have to manually resolve all the conflicts that I already resolved the first time I went through it)
Example:
Suppose an interactive rebase went as follows (where 000002 was resolved successfully and 0000004 was such an utter disaster that the rebase was aborted)
edit 000001 Edit to this commit
pick 000002 Easy merge conflict, resolved
pick 000003 Commit 3
pick 000004 Really ugly merge conflict, Abort!
pick 000005 Commit 5

The reflog now looks like this
HEAD@{0}: rebase: aborting
HEAD@{1}: rebase -i (pick): updating HEAD
HEAD@{2}: rebase -i (pick): updating HEAD
HEAD@{3}: rebase -i (edit): updating HEAD
HEAD@{4}: rebase -i (start): checkout 000000

What I want to do is git reset --hard HEAD@{1} and continue the original rebase process, giving "Really ugly merge conflict" another try (and continuing to pick 000005).

A: Rebase does not have anything built in to do this, and it's a bit tricky to do it "right", but there's an easy way to do it "wrong" by creating a new branch pointing to the part of the rebase you liked:
$ git branch newbr HEAD@{1}

Now you can check out branch newbr and use git cherry-pick to start in on the ugly-merge-conflict version.  The downside is that you must manually git cherry-pick the set of commits you want to bring in (in this case, 4 and 5).
(Once you have everything cherry-picked in to the new branch, just re-point the original branch to your new final commit—that's the tip of your new branch—just as git rebase would have on success.  You can then delete the new branch since your manual-mode rebase is complete.)


text:
Q: Confusion in the derivation of the potential of a magnetic shell I am reading an old book on electromagnetism (THE MATHEMATICAL THEORY OF ELECTRICITY AND MAGNETISM) and I have some confusion in the following pages:

First let me clarify what a "magnetic shell" is:
A magnetic shell is a thin sheet of magnetic material of uniform thickness magnetized at every point in a direction perpendicular to the surface of sheet. It may be of any shape (plane, circular or curved). One face of the sheet exhibits north polarity and the other face exhibits south polarity. The magnetic shell may be considered as a polar sheet consisting of a large number of short magnetic or magnetic dipoles close to each other with their axes perpendicular to the face of the shell. The length of each magnetic dipole is the thickness of the shell. If the distribution of the magnetic dipoles over the surface of the shell is uniform, the shell is said to be uniform magnetic shell.
Now onto my main question:
On the first highlighted line it is written "$\phi dS$ is the pole strength of element $dS$"
Then on the next highlighted line its written "we regard any element $dS$ of the shell as a magnetic particle of moment $\phi dS$"
I say the moment should be "pole strength ($\phi dS$)" times "the infinitesimal length of the axis i.e. the thickness of the shell ($\tau$)".
We also cannot assume "the infinitesimal length of the axis i.e. the thickness of the shell ($\tau$)" to be unity since it is infinitesimal
Then how could the moment be $\phi dS$ instead of $\tau\phi dS$
In other words, how can the pole strength($=IdS$) become ($I\tau$)

A: The first highlighted text refers to the strength of the magnet (aka. magnetic moment) not to the strength of a pole.
The intensity of magnetisation $I$ refers to the strength of a pole per unit area.
Thus we have a pole of strength $+I$ at one end and of strength $-I$ at the other end, separated by a distance $T$.
This will give a magnetic moment per unit area of our shell of $I.T = \phi$.
For an area $dS$ then the magnetic moment is $I.T.dS = \phi.dS$.

A: What is meant here is simple. An area element $dS$ of thin sheet is associated with a vector normal to surface and equal to $I$ times volume element, which is $dS \cdot t \cdot I$.
In calculating effect of this dipole of moment $I\,dS
\, t$, vector nature must be considered, it is along $I$. If take it per unit area, $dS$ will go.

A: $I$ has the unit $\text{ampere}/\text{meter}$, same as that of $H$.
So, $$I=\frac{\text{pole strength}}{\text{area}} =\frac{\text{Magnetic moment of the shell}}{\text{volume}}$$
$$I=\frac mA = \frac MV$$
where $A$ is area and $V$ is volume.
$\text{Strength}= It$ (thickness) (from definition)
ie.
$$\text{Strength} = \frac{\text{Magnetic moment}}{\text{area}}$$
$$M = \int (It\,\mathrm ds) = It\pi R^2$$ (in case of a magnetic shell in the form of a circular disc)
($\mathrm ds =$ elemental surface area)


text:
Q: Rs232 serial from Windows 10 App I have a Panasonic Tablet that runs Windows 10 x64, and it has a UHF RFID chip inside that's made available through a virtual COM  PORT (like a USB - rs232 cable)  - 19200 bps, 8 bits, no parity, 1 stop bit.
How can I access this COM port from a Windows App? I want to develop a simple touch app, I know how to communicate to this chip, but I can't find out how to just open the connection. Which language is better for developing an app (for tablet use)  that has this hardware communication?

A: Windows OS has a set of API functions that allows to work with any COM port:
https://msdn.microsoft.com/en-us/library/windows/desktop/aa363194%28v=vs.85%29.aspx
The CreateFile API function allows to open the necessary port and communicate through it.
You may use any popular programming language. Most of them has a build-it or 3-rd party library.


text:
Q: connect remotely with mysql database stored on server using c#.net in visual studio 2008 Hello I want to connect remotely with mysql database which is stored on server and I want to display all table names of that database on console how to do that ?
Information about database is like this
 server = "50.62.82.40";database = "db_admin"; uid = "db_usr";password = "wowow";

A: using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using MySql.Data.MySqlClient;
using System.Data.SqlClient;

namespace ConsoleApplication2
{

    class Program
    {
        public static void Main()
        {
            string myConnectionString = "SERVER=50.62.82.40;" +
                            "DATABASE=db_admin;" +
                            "UID=db_usr;" +
                            "PASSWORD=wowow`enter code here`;";

            MySqlConnection connection = new MySqlConnection(myConnectionString);
            MySqlCommand command = connection.CreateCommand();
            command.CommandText = "SHOW TABLES;";
            MySqlDataReader Reader;
            connection.Open();
            Reader = command.ExecuteReader();
            while (Reader.Read())
            {
                string row = "";
                for (int i = 0; i < Reader.FieldCount; i++)
                    row += Reader.GetValue(i).ToString() + ", ";
                Console.WriteLine(row);
            }
            connection.Close();
            Console.ReadLine();
        }
    }
}


text:
Q: function with 'load.Rdata' in for loop I write a function with for-loop and the for-loop is using load.Rdata. Here is my sample function.
tmp_fun = function(list_dtaname){
  for (ii in 1:length(list_dtaname)) {
    filename0 = paste(list_dtaname[ii],'.RData',sep = '')
    miceadds::load.Rdata(filename0, "dta00")
    rm(dta00)
  }

}
When I use this function
tmp_fun(samplelist)
I get this result
tmp_fun(list_pot_dtaname$out)
Warning messages:
1: In rm(dta00) : object 'dta00' not found
2: In rm(dta00) : object 'dta00' not found
3: In rm(dta00) : object 'dta00' not found
4: In rm(dta00) : object 'dta00' not found
5: In rm(dta00) : object 'dta00' not found
6: In rm(dta00) : object 'dta00' not found
7: In rm(dta00) : object 'dta00' not found

why the function is not working?

A: We could change it to load.Rdata2 where there is an option to specify the path (instead of 'objname' to be created) and the assignment can be done on the lhs of <- to a temporary object which we rm
tmp_fun <- function(list_dtaname){
  for (ii in 1:length(list_dtaname)) {
    filename0 = paste(list_dtaname[ii],'.RData',sep = '')
   dta00 <- miceadds::load.Rdata2(filename=
          paste(list_dtaname[ii],'.RData',sep = ''))
    rm(dta00)
  }
}

The issue in load.Rdata would be where the object gets saved.  According to ?load.Rdata

The function load.Rdata saves the loaded object in the global environment while load.Rdata2 loads the object only specified environments


text:
Q: How do I gather OS information about all users in AD? I'm looking to make a script or something along those lines which will allow me to check the OS version of all users within the AD, without interrupting daily operations.
So far i've found this script which finds OS information, http://www.windowsadminscripts.com/coding/networking/osinfo/.
But, I have no idea on how to apply this script to all users in the AD.
Any advice?

A: You can achieve this goal by using a PowerShell command.
Open up a PowerShell cmd window and enter the following command:
Get-ADComputer -Filter * -Property * | Format-Table Name,OperatingSystem,OperatingSystemServicePack,OperatingSystemVersion -Wrap –Auto

This command is filtering all computers for all their properties. It then redirects the output into a formatted table.
The only attributes that the table contains are the computer name, operating system description, service pack, and OS version. It also automatically sizes and wraps the data.
In order to find all servers in the domain, run the following command:
Get-ADComputer -Filter {OperatingSystem -Like "Windows Server*"} -Property * | Format-Table Name,OperatingSystem,OperatingSystemServicePack -Wrap -Auto

In order to find all servers running Windows Server 2008, run:
Get-ADComputer -Filter {OperatingSystem -Like "Windows Server*2008*"} -Property * | Format-Table Name,OperatingSystem,OperatingSystemServicePack -Wrap -Auto

In order to find all servers running Windows Server 2008 R2, run:
Get-ADComputer -Filter {OperatingSystem -Like "Windows Server*r2*"} -Property * | Format-Table Name,OperatingSystem,OperatingSystemServicePack -Wrap -Auto

I hope this answers your question.
Edit:
In order to run the Get-ADComputer command, you will have to install "Remote Server Administration Tools for Windows".
Follow This guide in order to do so.
Then, while in a PowerShell Terminal, type:
import-module activedirectory

And then re-run the Get-ADComputer command.
Check the following screenshot, you see an error there because the first time I ran the command I didn't have the Active Directory module for PowerShell installed:

A: Assuming you're referring to the Computers your users use, then this information is already stored in AD for any Domain Joined PC.  You should be able to script pulling these attributes from the Computer Objects:  operatingSystem, operatingSystemServicePack, & operatingSystemVersion.

A: In addition to the powershell commands posted above, you can also use a gui based tool called PowerGUI. This is pretty handy tool to have which makes ActiveDirectory management a lot easier. You can accomplish what you are asking in this question and much more. While you are using the gui, it actually runs powershell commands in the background. You can view the scripts that it runs.
I would also recommend checking out Quest Active Roles which provide a wealth of powershell cmdlets.


text:
Q: how to know from adapter if the item of ListView is visible or not? I have an adapter that connected to ListView, e.g.
mJournalAdapter = new JournalAdapter();
journalEntryList.setAdapter(mJournalAdapter);

and I want to know inside of my JournalAdapter if some view (item of ListView) is visible or not, is it possible?

A: You can get callback , overriding OnDetachedFromWindow(); method in View

A: If you know the postion of that item then you can use
int last = listView1.getLastVisiblePosition();

int first = listView1.getFirstVisiblePosition();

A: You can use getFirstVisiblePosition() will give you the first visible Item in the ListView, so you can use that in your case.


text:
Q: Function's parameters in JS ext It's my first time with JS Ext (Sencha) and I've one problem. I 've define a test function, which receives a parameter, that is a string, it is as follows:
function testlistener(p) {
       Ext.Msg.alert('testing', p.toString());
}

What I see into the alert pop up is just "object object" istead of the string, I have the same result if i just use:
Ext.Msg.alert('testing', p);

and I have tried many other ways, but none of them work, so I don't know how is the object structure, and I'm not able to find it on the api.
Can someone help me?
Thank you.

A: This means that you're not actually passing a string to your function but something different. See what typeof p returns, I'm guessing "object". Make sure you are actually passing a string and not an object.


text:
Q: I want to get rid of all white spaces from my website in html I want to get rid of all white spaces from my website in html , the more I move my text to the right the more the space whitespace it creates on the right side of the page. Like you see in the photos there are a lot of whitespaces I suspect it is the elements creating these spaces , can someone tell me how to get rid of it . if anyone can help me please do so.

.btn_earnmoney {
    height: 100px;
    width: 100px;
    position: relative;
    top: 350px;
    left: 710px;
    padding: 0;
    border: none;
    background: none;
  }

  .Balance_Text {
    font-size: 150%;
    position: relative;
    top: -800px;
    left: 10px;
    background-repeat: no-repeat;
  }

  * {
    margin: 0;
    padding: 0;
    background-color: #f1dd84;
    background-repeat: no-repeat;
  }

  .Background_img {
    /* non available image replaced with dummy image */
    background-image: url("https://dummyimage.com/300x300/d936d9/000000&text=some+background+image");
    background-size: cover;
    background-repeat: no-repeat;
    height: 100vh;
    background-color: #f1dd84;
  }
<!DOCTYPE html>

  <meta charset="UTF-8" />
  <meta http-equiv="X-UA-Compatible" content="IE=edge" />
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  <title>BuzzMoney</title>

  <button class="btn_earnmoney" onclick="button_pressed()">

  </button>
  <button class="btn_withdraw" onclick="withdraw_button_pressed_()"> </button>

0 $

A: What I would do:
index.html
<!DOCTYPE html>

  <meta charset="UTF-8" />
  <meta http-equiv="X-UA-Compatible" content="IE=edge" />
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  <title>BuzzMoney</title>

  <button class="btn_earnmoney" onclick="button_pressed()">

  </button>
  <button class="btn_withdraw" onclick="withdraw_button_pressed_()"> </button>

0 $

style.css
body {
  background-image: url("yourUrlHere");
  background-position: center; /* Center the image */
  background-repeat: no-repeat; /* Do not repeat the image */
  background-size: cover; /* Resize the background image to cover the entire container */
}

You can find those properties for the background in this W3 link


text: Q: EF Core - What are the default isolation levels for context.SaveChanges() and context.Database.BeginTransation()? I've read here https://coderwall.com/p/jnniww/why-you-shouldn-t-use-entity-framework-with-transactions that Database.BeginTransaction() uses serializable by default, but I can't confirm this anywhere else.


text:
Q: AngularJS list not updating when changes are made I think I know why the list isn't changing so this question is probably more "how can I do this in a way that 2 way binding will work?"
I have this view:

                        Name

                        Description

                        Address 1

                        Address 2

                        Address 3

                        Address 4

                        Post code

                        <input type="checkbox" ng-checked="controller.isSelected($index)" />

                    {{ center.name }}

                    {{ center.description }}

                    {{ center.address1 }}

                    {{ center.address2 }}

                    {{ center.address3 }}

                    {{ center.address4 }}

                    {{ center.postCode }}

                    <button class="btn btn-success" ng-click="controller.add($event, $index)" ng-if="!controller.contains(controller.userCenters, center)">

                    </button>
                    <button class="btn btn-danger" ng-click="controller.remove($event, $index)" ng-if="controller.contains(controller.userCenters, center)">

                    </button>

<dir-pagination-controls></dir-pagination-controls>

(truncated for brevity)
Now, you can see that the action buttons are shown depending on a function. This function checks the centers and sees if they are a part of the users centers. If they are, then the remove button is shown, if they are not, then the add button is shown.
The controller for that looks like this:
.controller('UserCentersController', ['$stateParams', 'ArrayService', 'CenterService', 'toastr', 'centers', 'userCenters', function ($stateParams, arrayService, service, toastr, centers, userCenters) {

    var self = this;

    // Get our user Id
    var userId = $stateParams.userId;

    // Assign our centers
    self.centers = centers;
    self.userCenters = userCenters;
    self.selected = [];

    // Create our page sizes array
    self.pageSizes = [10, 20, 50, 100];

    // For filtering and sorting the table
    self.pageSize = self.pageSizes[0];
    self.predicate = 'name';
    self.reverse = false;
    self.filter = '';

    console.log(centers);

    // Select method
    self.select = function (index) {

        // Get our index
        var i = self.selected.indexOf(index);

        // If our index is in our array
        if (i > -1) {

            // Remove from our array
            self.selected.splice(i, 1);

            // Else, our index is not in our array
        } else {

            // Add our index to our array
            self.selected.push(index);
        }
    };

    // Check to see if the row is selected
    self.isSelected = function (index) {

        // If our item is in our array, return true
        return (self.selected.indexOf(index) > -1);
    };

    // Function to check if a center is in an array
    self.contains = function (array, center) {

        // Check to see if our center is in the array
        return arrayService.indexOf(center) > -1 ? true : false;
    };

    // Adds the current center to the users list
    self.add = function (e, index) {

        // Stop propagation
        e.stopPropagation();

        console.log(index);

        // If we have an index
        if (typeof index !== 'undefined') {

            // Get our center
            var center = self.centers.data[index];

            console.log(center);

            // Make our call
            //var save = service.addToUser(center, userId);

            // Push to our user centers if it's not already there
            arrayService.modify(self.userCenters.data, center);

            console.log(self.userCenters.data);
        }
    };
}]);

Now, when add is pressed, the center is added to the user centers (by pushing the current center to the userCenters array). I would expect that when that is done, the view would update and the add button would be replaced with the remove button, but it is not.
I think this is because the self.centers.data array is not changed, so the view stays the same. Can anyone suggest a solution?

A: You need to use $scope.$watch on the self.centers.data like this one :
$scope.$watch('self.userCenters.data',function(newValue,oldValue){

   if(!newValue)return;
   if(newValue==oldValue)return;
   if(!$scope.$$phase){
      $scope.$apply();
   }

});

A: You have two ways of doing what you want.
1) your list of centers is controlled by the service, and the variable in the controller is just a reference to the array on the service. Your call to the service can be just arrayService.modify(center); since the service already knows the array.
2) you have two separate lists of centers, one in the service and other in the controller. And when you update the one in the service, you need to update the one in the controller:
arrayService.modify(self.userCenters.data, center);
self.userCenters.data = angular.copy(arrayService.getCenters());

Since I don't know how you coded your service, I don't know which one is better in your case, but I prefer option 1.


text:
Q: Rotate columns and rows in matrix how can I rotate columns and rows in a matrix n times. For example:
If I have matrix
A= [1,2,3;
    4,5,6;
    7,8,9]

and want to rotate all rows n = 1, it should give me
R= [7,8,9;
    1,2,3;
    4,5,6].

The program should work for every n x n matrix and it should also be possible to rotate columns.

A: You can use circshift to shift all of the rows down one
R = circshift(A, [1 0]);

The second input specifies the shift to apply in the first (rows) and second (columns) dimensions. In your initial case since you don't want to shift columns, we leave that as zero.
If instead we want to shift the rows by 1 and the columns by 2 we could do:
R = circshift(A, [2 1])


text:
Q: Will Sharing=ReadOnly allow my user to Delete or Clone a record I have Lightning Quickactions for Delete and Clone on a CustomObject__c and I want to ensure that only users with the right permission can use it.
From reading this documentation I understand that I have to check CRUD permissions before doing DML with isDeletable and isCreatable.
But what about sharing? My Controllers use with sharing as recommended but what if my user has ReadOnly Sharing.

*

*Will he be able to delete or clone or do I need to add complicated tests of Sharing tables?

*How do Standard Clone and Delete buttons on Lightning Record pages behave?

*Will they allow a user with CRUD permission by only ReadOnly Sharing see them and what will happen on click?

A: My understanding of ReadOnly is that they would be able to clone if they have IsCreateable permission, but not delete even if they had the CRUD access, because typically, only the owner or someone above the user in the role hierarchy can delete a record
But I usually end up having to verify that via the UI to actually know if that happens.
But I think you probably want to also consider using the UserRecordAccess permission to determine what behavior you want to use. Not sure if you are querying for the record, but if you are, you can then include the values like UserRecordAccess.HasDeleteAccess in order to know if they can delete that particular record without having to navigate the sharing rules, or perhaps the Maximum Access Level field, since that will give you a better idea of their level of access (None,Read,Edit,Delete,Transfer,All)

A: *

*Sharing Rule only works with Record Level Security, not with Object Level. If the user has delete permission at profile level then the user will be able to delete the record. So, it is recommended to use CRUD Check

*If the user does not have Edit/Create Record permission buttons will not appear on the layout.

*Sharing rule works with record level security only. Object and Field Level security controlled by Profile.


text:
Q: Evaluating time complexity for the binomial coefficient I'm new to Theoretical Computer Science, and I would like to calculate the time complexity of the following algorithm that evaluates the binomial coefficient defined as

nf = 1;
for i = 2 to n do nf = nf * i;
kf = 1;
for i = 2 to k do kf = kf * i;
nkf = 1;
for i = 2 to n-k do nkf = nkf * i;
c = nf / (kf * nkf);

My textbook suggests to use Stirling's approximation

However, I can get the same result by considering that for i = 2 to n do nf = nf * i; have complexity O(n-2)=O(n), that is predominant.
Stirling's approximation seems a little bit overkill. Is my approach wrong?

A: In your first approach you calculate n!, k! and (n-k)! separately and then calculate the binomial coefficient. Therefore since all of those terms can be calculated with at most operations you have O(n) time complexity.
However, you are wrong about the time complexity of calculating the Stirling's formula. You only need log(n) in base 2 operations to calculate it. This is because when trying to calculate p'th power of some real number, instead of multiplicating it p times, you can instead keep squaring the number to calculate it quickly. For example:
If you want to calculate 2^17, instead of doing 17 operations like this:
return 2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2

you can do this:
a = 2*2
b = a*a
c = b*b
d = c*c
return d * 2

which is only 5 operations.
Note: However keep in mind that the Stirling's formula is not equal to the factorial. It is only an approximation but a good one.
Edit: Also you can consider a^n as e^(log(a)*n) and then calculate it by the  quickly converging series expansion
1 + (log(a)n) + ((log(a)n)^2)/2! + ((log(a)n)^3)/3! + ...
Since the series converges very quickly you can get really close approximations in no time.


text:
Q: C# WinForm - How To Make Semi Transparent Loading Screen? First of all, I would like to talk about the application very briefly. There is a child form inside the main form in my application, and this child form also contains a datagridview. You can see the structure I'm talking about in the picture below.
Application Structure
I have a very secret and magic function. This function works with hotkey and the working time of the function is a bit long so I want to make a standby screen. When I press the hotkey, I want the datagridview to darken a little and the message "Please wait" appears in the middle of the childform. If you don't understand, please take a look at the picture below.
It's what I want it to be
For this, I put a panel on the datagridview and set it to
panel.BackColor = Color.FromArgb(50, Color.Black);
panel.Visible = false;

also myFunction() does this.
private void myFunction()
{
  panel.Visible = true;
  // Top secret codes {...}
  panelVisible = false;
}

But this method didn't work. The panel appears but it deletes the gridview behind it like this.
----- :'( -----
I searched a lot but couldn't solve the problem. Does anyone have a better method or solution suggestion?

A: You can have a function that you call when the operation starts. This function displays the label "Please wait" and fills gridview columns with the desired color:
private void standbyScreen()
{
        foreach (DataGridViewColumn col in dataGridView1.Columns)
        {
            col.DefaultCellStyle.BackColor = Color.FromArgb(50, 50, 50);
            col.DefaultCellStyle.ForeColor = Color.FromArgb(80,80,80);
        }
        pleaseWaitLbl.Show();
}

This code make a standby screen for DataGridView:

and a function to end the operation that turns standby screen into normal:
private void normalScreen()
{
        foreach (DataGridViewColumn col in dataGridView1.Columns)
        {
            col.DefaultCellStyle.BackColor = Color.Gray;
            col.DefaultCellStyle.ForeColor = Color.White;
        }
        pleaseWaitLbl.Hide();
}

This was just an example, you can choose better colors for standby screen.
I hope this helps


text:
Q: Problems with calling unoconv from a django app, running in an virtualenv I have a django app that calls unoconv using subprocess. It works fine when I run in my development environment, but errors out when run in the production environment.
It gives this error

"unoconv: Cannot find a suitable pyuno library and python binary combination in /usr/lib/libreoffice
  ERROR: No module named uno
unoconv: Cannot find a suitable office installation on your system.
  ERROR: Please locate your office installation and send your feedback to:
  http://github.com/dagwieers/unoconv/issues"

But unoconv runs just fine from the command line.
Since I run the django app as a uwsgi vassal, it might have something to do with privileges, though for the life of me I can't figure out how to fix it.
PS - The django app does not start a unoconv listener, there one already running.
EDIT - It wasn't a permissions issue rather, but a path issue as unoconv was being called from the wrong python interpreter(the virtualenv one)

A: Since the app is running in an virtualenv, unoconv is being called with the virtualenv python interpreter instead of the system one.
The fix is pretty simple if you have virtualenvwrapper - just call the add2virtualenv command with the path to the directory containing uno.py and unohelper.py as the argument (/usr/share/pyshared) in my case.

A: Are you sure that you absolutely need unoconv for your use case? It is powerful, but since it needs a full-fledged LibreOffice to run, it is: 1) somewhat slow to convert files; 2) slow to start; 3) uses a lot of RAM; 4) not very scalable.
Why don't you try Apache Tika (which is based on Apache POI)? It is somewhat more lightweight and more than good enough for most of the day-to-day tasks.
Launch Tika to process PDF files too, or use magic to distinguish between file types and go with a separate pdftotext utility or something similar. Here's a simplified version of what you can use to convert office files to, let's say, text:
import subprocess
from django.db import models
import magic  # https://github.com/ahupp/python-magic

PDFTOTEXT_COMMAND = '/usr/bin/pdftotext'
JAVA_COMMAND = '/usr/bin/java'
TIKA_PATH = '/path/to/tika.jar'
PDFTOTEXT_OPTIONS = [u'-', ]
JAVA_OPTIONS = [ u'-jar', TIKA_PATH, u'--text', ]

mime = magic.Magic(mime=True)

class UploadedFileModel(models.Model):
    file = models.FileField(upload_to='files/')

    def get_txt(self):
        if not ('application/pdf' in mime.from_file(
                self.file.path.encode('utf-8'))):
            option_list = [JAVA_COMMAND, ] + JAVA_OPTIONS + [self.file.path, ]
        else:
            option_list = [PDFTOTEXT_COMMAND, ] + [self.file.path, ] +\
                PDFTOTEXT_OPTIONS

        pipe = subprocess.Popen(option_list, stdout=subprocess.PIPE)
        txt = pipe.communicate()[0]
        if pipe.returncode:
            return None
        else:
            return txt

P.S.
The error unoconv: Cannot find a suitable pyuno library and python binary combination can be related to a broad number of issues. It is impossible to tell for sure without you providing additional information. For example, it could be a problem with paths.
Be sure to check out the relevant unoconv troubleshooting guides:

*

*Python and pyuno incompatibilities;

*Troubleshooting instructions.

A: Just try adding this in ur linux termimnal(after activating the environment) URE_BOOTSTRAP=vnd.sun.star.pathname:/usr/lib64/libreoffice/program/fundamentalrc
UNO_PATH=/usr/lib64/libreoffice/program
PATH=/usr/lib64/libreoffice/program:/home/graaff/bin:/usr/local/bin:/usr/bin:/bin:/opt/bin:/usr/x86_64-pc-linux-gnu/gcc-bin/4.5.3:/opt/android-sdk-update-manager/tools:/opt/android-sdk-update-manager/platform-tools:/usr/games/bin ,or atleast try UNO_PATH and PATH

A: I had this problem when using a virtual environment.
cp /usr/lib/python3/dist-packages/unohelper.py /path/to/env/lib/python3.6/site-packages/
cp /usr/lib/python3/dist-packages/uno.py /path/to/env/lib/python3.6/site-packages/


text:
Q: RoR app crashed, logs referrencing lots of different libraries I used to do a lot of Ruby on Rails programming on bash but since changing over to robby russells zsh, I have not done any production level work.
I recently did a change and pushed it to heroku and I got this error when I checked heroku logs:
2020-04-07T01:51:58.557111+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.4.0/gems/activesupport-5.1.6.2/lib/active_support/inflector/methods.rb:269:in `const_get'
2020-04-07T01:51:58.557111+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.4.0/gems/activesupport-5.1.6.2/lib/active_support/inflector/methods.rb:269:in `block in constantize'
2020-04-07T01:51:58.557112+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.4.0/gems/activesupport-5.1.6.2/lib/active_support/inflector/methods.rb:267:in `each'
2020-04-07T01:51:58.557115+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.4.0/gems/activesupport-5.1.6.2/lib/active_support/inflector/methods.rb:267:in `inject'
2020-04-07T01:51:58.557118+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.4.0/gems/activesupport-5.1.6.2/lib/active_support/inflector/methods.rb:267:in `constantize'
2020-04-07T01:51:58.557136+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.4.0/gems/activesupport-5.1.6.2/lib/active_support/dependencies.rb:583:in `get'
2020-04-07T01:51:58.557144+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.4.0/gems/activesupport-5.1.6.2/lib/active_support/dependencies.rb:614:in `constantize'
2020-04-07T01:51:58.557145+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.4.0/gems/devise-4.7.1/lib/devise.rb:320:in `get'
2020-04-07T01:51:58.557148+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.4.0/gems/devise-4.7.1/lib/devise/mapping.rb:83:in `to'
2020-04-07T01:51:58.557149+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.4.0/gems/devise-4.7.1/lib/devise/mapping.rb:78:in `modules'
2020-04-07T01:51:58.557149+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.4.0/gems/devise-4.7.1/lib/devise/mapping.rb:95:in `routes'
2020-04-07T01:51:58.557152+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.4.0/gems/devise-4.7.1/lib/devise/mapping.rb:162:in `default_used_route'
2020-04-07T01:51:58.557167+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.4.0/gems/devise-4.7.1/lib/devise/mapping.rb:72:in `initialize'
2020-04-07T01:51:58.557167+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.4.0/gems/devise-4.7.1/lib/devise.rb:350:in `new'
2020-04-07T01:51:58.557168+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.4.0/gems/devise-4.7.1/lib/devise.rb:350:in `add_mapping'
2020-04-07T01:51:58.557170+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.4.0/gems/devise-4.7.1/lib/devise/rails/routes.rb:243:in `block in devise_for'
2020-04-07T01:51:58.557184+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.4.0/gems/devise-4.7.1/lib/devise/rails/routes.rb:242:in `each'
2020-04-07T01:51:58.557184+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.4.0/gems/devise-4.7.1/lib/devise/rails/routes.rb:242:in `devise_for'
2020-04-07T01:51:58.557196+00:00 app[web.1]: from /app/config/routes.rb:5:in `block in <top (required)>'
2020-04-07T01:51:58.557199+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.4.0/gems/actionpack-5.1.6.2/lib/action_dispatch/routing/route_set.rb:436:in `instance_exec'
2020-04-07T01:51:58.557199+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.4.0/gems/actionpack-5.1.6.2/lib/action_dispatch/routing/route_set.rb:436:in `eval_block'
2020-04-07T01:51:58.557202+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.4.0/gems/actionpack-5.1.6.2/lib/action_dispatch/routing/route_set.rb:418:in `draw'
2020-04-07T01:51:58.557217+00:00 app[web.1]: from /app/config/routes.rb:1:in `<top (required)>'
2020-04-07T01:51:58.557217+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.4.0/gems/activesupport-5.1.6.2/lib/active_support/dependencies.rb:286:in `load'
2020-04-07T01:51:58.557220+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.4.0/gems/activesupport-5.1.6.2/lib/active_support/dependencies.rb:286:in `block in load'
2020-04-07T01:51:58.557222+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.4.0/gems/activesupport-5.1.6.2/lib/active_support/dependencies.rb:258:in `load_dependency'
2020-04-07T01:51:58.557236+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.4.0/gems/activesupport-5.1.6.2/lib/active_support/dependencies.rb:286:in `load'
2020-04-07T01:51:58.557236+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.4.0/gems/railties-5.1.6.2/lib/rails/application/routes_reloader.rb:55:in `block in load_paths'
2020-04-07T01:51:58.557239+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.4.0/gems/railties-5.1.6.2/lib/rails/application/routes_reloader.rb:55:in `each'
2020-04-07T01:51:58.557242+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.4.0/gems/railties-5.1.6.2/lib/rails/application/routes_reloader.rb:55:in `load_paths'
2020-04-07T01:51:58.557256+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.4.0/gems/railties-5.1.6.2/lib/rails/application/routes_reloader.rb:18:in `reload!'
2020-04-07T01:51:58.557256+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.4.0/gems/railties-5.1.6.2/lib/rails/application.rb:164:in `reload_routes!'
2020-04-07T01:51:58.557270+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.4.0/gems/devise-4.7.1/lib/devise/rails.rb:17:in `block in <class:Engine>'
2020-04-07T01:51:58.557277+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.4.0/gems/activesupport-5.1.6.2/lib/active_support/lazy_load_hooks.rb:67:in `block in execute_hook'
2020-04-07T01:51:58.557280+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.4.0/gems/activesupport-5.1.6.2/lib/active_support/lazy_load_hooks.rb:60:in `with_execution_control'
2020-04-07T01:51:58.557281+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.4.0/gems/activesupport-5.1.6.2/lib/active_support/lazy_load_hooks.rb:65:in `execute_hook'
2020-04-07T01:51:58.557283+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.4.0/gems/activesupport-5.1.6.2/lib/active_support/lazy_load_hooks.rb:50:in `block in run_load_hooks'
2020-04-07T01:51:58.557301+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.4.0/gems/activesupport-5.1.6.2/lib/active_support/lazy_load_hooks.rb:49:in `each'
2020-04-07T01:51:58.557301+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.4.0/gems/activesupport-5.1.6.2/lib/active_support/lazy_load_hooks.rb:49:in `run_load_hooks'
2020-04-07T01:51:58.557304+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.4.0/gems/railties-5.1.6.2/lib/rails/application/finisher.rb:66:in `block in <module:Finisher>'
2020-04-07T01:51:58.557305+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.4.0/gems/railties-5.1.6.2/lib/rails/initializable.rb:30:in `instance_exec'
2020-04-07T01:51:58.557307+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.4.0/gems/railties-5.1.6.2/lib/rails/initializable.rb:30:in `run'
2020-04-07T01:51:58.557321+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.4.0/gems/railties-5.1.6.2/lib/rails/initializable.rb:59:in `block in run_initializers'
2020-04-07T01:51:58.557321+00:00 app[web.1]: from /app/vendor/ruby-2.4.0/lib/ruby/2.4.0/tsort.rb:228:in `block in tsort_each'
2020-04-07T01:51:58.557324+00:00 app[web.1]: from /app/vendor/ruby-2.4.0/lib/ruby/2.4.0/tsort.rb:350:in `block (2 levels) in each_strongly_connected_component'
2020-04-07T01:51:58.557326+00:00 app[web.1]: from /app/vendor/ruby-2.4.0/lib/ruby/2.4.0/tsort.rb:431:in `each_strongly_connected_component_from'
2020-04-07T01:51:58.557340+00:00 app[web.1]: from /app/vendor/ruby-2.4.0/lib/ruby/2.4.0/tsort.rb:349:in `block in each_strongly_connected_component'
2020-04-07T01:51:58.557346+00:00 app[web.1]: from /app/vendor/ruby-2.4.0/lib/ruby/2.4.0/tsort.rb:347:in `each'
2020-04-07T01:51:58.557349+00:00 app[web.1]: from /app/vendor/ruby-2.4.0/lib/ruby/2.4.0/tsort.rb:347:in `call'
2020-04-07T01:51:58.557350+00:00 app[web.1]: from /app/vendor/ruby-2.4.0/lib/ruby/2.4.0/tsort.rb:347:in `each_strongly_connected_component'
2020-04-07T01:51:58.557350+00:00 app[web.1]: from /app/vendor/ruby-2.4.0/lib/ruby/2.4.0/tsort.rb:226:in `tsort_each'
2020-04-07T01:51:58.557364+00:00 app[web.1]: from /app/vendor/ruby-2.4.0/lib/ruby/2.4.0/tsort.rb:205:in `tsort_each'
2020-04-07T01:51:58.557364+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.4.0/gems/railties-5.1.6.2/lib/rails/initializable.rb:58:in `run_initializers'
2020-04-07T01:51:58.557367+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.4.0/gems/railties-5.1.6.2/lib/rails/application.rb:353:in `initialize!'
2020-04-07T01:51:58.557369+00:00 app[web.1]: from /app/config/environment.rb:5:in `<top (required)>'
2020-04-07T01:51:58.557388+00:00 app[web.1]: from config.ru:3:in `require_relative'
2020-04-07T01:51:58.557389+00:00 app[web.1]: from config.ru:3:in `block in <main>'
2020-04-07T01:51:58.557392+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.4.0/gems/rack-2.0.6/lib/rack/builder.rb:55:in `instance_eval'
2020-04-07T01:51:58.557392+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.4.0/gems/rack-2.0.6/lib/rack/builder.rb:55:in `initialize'
2020-04-07T01:51:58.557400+00:00 app[web.1]: from config.ru:in `new'
2020-04-07T01:51:58.557402+00:00 app[web.1]: from config.ru:in `<main>'
2020-04-07T01:51:58.557405+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.4.0/gems/rack-2.0.6/lib/rack/builder.rb:49:in `eval'
2020-04-07T01:51:58.557407+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.4.0/gems/rack-2.0.6/lib/rack/builder.rb:49:in `new_from_string'
2020-04-07T01:51:58.557422+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.4.0/gems/rack-2.0.6/lib/rack/builder.rb:40:in `parse_file'
2020-04-07T01:51:58.557423+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.4.0/gems/rack-2.0.6/lib/rack/server.rb:319:in `build_app_and_options_from_config'
2020-04-07T01:51:58.557426+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.4.0/gems/rack-2.0.6/lib/rack/server.rb:219:in `app'
2020-04-07T01:51:58.557428+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.4.0/gems/railties-5.1.6.2/lib/rails/commands/server/server_command.rb:24:in `app'
2020-04-07T01:51:58.557441+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.4.0/gems/rack-2.0.6/lib/rack/server.rb:354:in `wrapped_app'
2020-04-07T01:51:58.557442+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.4.0/gems/rack-2.0.6/lib/rack/server.rb:283:in `start'
2020-04-07T01:51:58.557444+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.4.0/gems/railties-5.1.6.2/lib/rails/commands/server/server_command.rb:44:in `start'
2020-04-07T01:51:58.557450+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.4.0/gems/railties-5.1.6.2/lib/rails/commands/server/server_command.rb:135:in `block in perform'
2020-04-07T01:51:58.557452+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.4.0/gems/railties-5.1.6.2/lib/rails/commands/server/server_command.rb:130:in `tap'
2020-04-07T01:51:58.557455+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.4.0/gems/railties-5.1.6.2/lib/rails/commands/server/server_command.rb:130:in `perform'
2020-04-07T01:51:58.557469+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.4.0/gems/thor-0.20.3/lib/thor/command.rb:27:in `run'
2020-04-07T01:51:58.557470+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.4.0/gems/thor-0.20.3/lib/thor/invocation.rb:126:in `invoke_command'
2020-04-07T01:51:58.557473+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.4.0/gems/thor-0.20.3/lib/thor.rb:387:in `dispatch'
2020-04-07T01:51:58.557475+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.4.0/gems/railties-5.1.6.2/lib/rails/command/base.rb:63:in `perform'
2020-04-07T01:51:58.557489+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.4.0/gems/railties-5.1.6.2/lib/rails/command.rb:44:in `invoke'
2020-04-07T01:51:58.557489+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.4.0/gems/railties-5.1.6.2/lib/rails/commands.rb:16:in `<top (required)>'
2020-04-07T01:51:58.557492+00:00 app[web.1]: from bin/rails:9:in `require'
2020-04-07T01:51:58.557494+00:00 app[web.1]: from bin/rails:9:in `<main>'
2020-04-07T01:51:58.563811+00:00 app[web.1]: => Booting Puma
2020-04-07T01:51:58.563812+00:00 app[web.1]: => Rails 5.1.6.2 application starting in production
2020-04-07T01:51:58.563813+00:00 app[web.1]: => Run `rails server -h` for more startup options
2020-04-07T01:51:58.563813+00:00 app[web.1]: Exiting
2020-04-07T02:36:56.635446+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/robots.txt" host=dancortes-portfolio.herokuapp.com request_id=d7acd72b-3465-4461-b067-0f51f55a289e fwd="77.88.5.192" dyno= connect= service= status=503 bytes= protocol=https

Prior to the app crashing once pushing to Heroku, I saw various warnings, one about Procfile missing, which I have never had, another about the ruby version being outdated. Could this mean I need to update my ruby version?


text:
Q: How to split a string on every 25th line break(\n) if it contains multiple \n I've read a file and stored its content into a std::string variable BUF and now want to split the data into small blocks where each block would contain 25 lines.

A: I see two options:

*

*construct std::istringstream from BUF (or use the stream with which you read the file) and use std::getline to read line by line and append to previous lines, while counting up to 25 and so on...

*use std::string::find in a loop counting to 25 and then use std::string::substr or std::find and construction from an iterator range.

I think that's sufficient hint.

A: I made it!
    if(N>25) \\N no of lines
     {
         int i=0;
         std::istringstream ss(text);
         text="";
         string splited,part="";
         while(std::getline(ss, splited, '\n')) {
              part+=splited+"\n";
              if(i==24)
              {
                i=0;
                part.erase(part.size() - 1);
                d.Insert(part,time);
                cout<<part;
                part="";
                continue;
              }
              else{
              ++i;
              continue;
              }
           }
           if(i!=0)
              {
                 d.Insert(part,time);
              }
     }
else{
        d.Insert(text,time);
     }


text:
Q: How to get two subplots to have the same height? I need to add a grayscale image and its histogram to a figure.
The two subplots should be the same size, but the histogram is displayed twice as high as the image. How can I make both subplots to have the same height?
Here's my code:
import numpy as np
from skimage import io
import matplotlib.pyplot as plt

L = 256
img = io.imread('https://i.stack.imgur.com/ywPGr.png')
edges = np.arange(L+1)
hist, _ = np.histogram(img, bins=edges)
centers = edges[:-1]

fig, [ax1, ax2] = plt.subplots(1, 2)
ax1.imshow(img, cmap=plt.cm.gray)
ax1.axis('off')
ax2.fill_between(centers, hist)
fig.tight_layout()
plt.show(fig)

I've tried the solutions proposed in the accepted answer to this similar question, but none of them worked for me.
Using automatic aspect on the image changes its aspect ratio (which is not acceptable):
ax1.imshow(img, cmap=plt.cm.gray, aspect='auto')

Adding these two lines does not yield the desired result either:
asp = np.diff(ax2.get_xlim())[0] / np.diff(ax2.get_ylim())[0]
ax2.set_aspect(asp)


text:
Q: E2E - how to test that confirmation email is being sent by register process? I do have a register process/form which passes email, password, confirmPass and a tc checkbox which has a boolean value.
When the user submits the form, an open dialogue with a text opens and in the other hand an email is being sent to the user to confirm his registration. Everything works fine.
To run an E2E protractor test for this process I wrote wrote the following code:
it("Should register the user and send confirmation email", () => {

    page.getInputFields().userEmailInput.sendKeys("myFirstName.myLastName@domain-xxx.com");
    page.getInputFields().userPassInput.sendKeys('!Q2w3e4r');
    page.getInputFields().userConfirmPass.sendKeys('!Q2w3e4r');
    element(by.tagName('mat-checkbox')).click();

    expect( page
        .getInputFields()
        .userEmailInput.getAttribute("value") ).toEqual("myFirstName.myLastName@domain-xxx.com");

    expect(page
        .getInputFields()
        .userPassInput.getAttribute("value") ).toEqual('!Q2w3e4r');

    expect(page
        .getInputFields()
        .userConfirmPass.getAttribute('value') ).toEqual('!Q2w3e4r');

    element( by.tagName('mat-checkbox') ).isSelected().then(function(selected) {
        if (selected) {
            element( by.name('mat-checkbox') ).click();
            expect( page.getInputFields().userAccept.isSelected() ).toBe(true);
            page
        .getInputFields()
        .submitButton.click();
        }
    });
});

The test also runs without error(s). But my issue is that I'am expecting after the test that I get the confirmation email in my inbox, which prove me in the other hand that the test was 100% successful, but I just don't get the confirmation email which means that the test isn't really running as expected.

*

*Is it possible to run the test so that a confirmation email is being sent?

*Is the code for the test wrong and I do have a logic error in it?

*Has it to do with the open dialogue window which should be opened after clicking on submitButton and I'am not testing it (in my code)?

One thing I still have to mention is that the button is disabled if user data are missing and the tc (checkbox) isn't checked.

A: Issue is fixed and here is the working code:
it("Should register the user and send confirmation email", () => {

    page.getInputFields().userEmailInput.sendKeys("myFirstName.myLastName@domain-xxx.com");
    page.getInputFields().userPassInput.sendKeys('!Q2w3e4r');
    page.getInputFields().userConfirmPass.sendKeys('!Q2w3e4r');
    element(by.tagName('mat-checkbox')).click();

    expect( page
        .getInputFields()
        .userEmailInput.getAttribute("value") ).toEqual("myFirstName.myLastName@domain-xxx.com");

    expect( page
        .getInputFields()
        .userPassInput.getAttribute("value") ).toEqual('!Q2w3e4r');

    expect( page
        .getInputFields()
        .userConfirmPass.getAttribute('value') ).toEqual('!Q2w3e4r');

    browser.wait(protractor.ExpectedConditions.elementToBeClickable( element( by.name('submitForm') ) ), 100000)
            .then ( () => {
                browser.actions().mouseMove( element( by.name('submitForm') ) ).click().perform();
            }).then ( () => {
                browser.sleep(500);
                browser.actions().mouseMove( element( by.name('submitForm') ) ).click().perform();
            });

});

The following posting was very helpful!


text:
Q: Regex for matching words enclosed in some pattern (that can be dynamically added) and should also return words between enclosed matched words Let's have the sample string:
"Hello @{MATCH 1} My @[MATCH 2] Wonderful #{MATCH 3} World"

Assuming the following regexes were registered:
[/@\{.+\}/, /@\[.+\]/, /#\{.+\}/]

What I need is for the regex to return the following matches:
["Hello ", "@{MATCH 1}", " My ", "@[MATCH 2]", " Wonderful ", "#{MATCH 3}", " World"]

Currently what I do is compile the registered regexes by joining them with '|' and join a '.+?' pattern at the end. It will turn into something like:
/@\{.+\}|@\[.+\]|#\{.+\}|.+?/g

However this would return these matches:
["H", "e", "l", "l", ..., "@{MATCH 1}", " ", "M", ..., "@[MATCH 2]", ...]

I can live with the current matches, just need to perform extra processing with them. However, I am worried about the performance impact of such number of returned matches. Anyone knows a better regex for returning the matches that I desire? Please do note that the patterns CAN BE DYNAMICALLY REGISTERED. Thanks!

A: The following works:
([@#]\{[^}]+\}|@\[[^\]]+\]|[^@#]+)

per this Rubular
Update: Combined the two {} alternatives per @jkshah's helpful comment.


text:
Q: How to replace images in 2nd page when an anchor from 1st page was clicked ? in JavaScript I have 2 two pages in my website. Page 1 contains few images and page 2 containers another few images. When I click on a particular image in page 1 I want to change all images in page 2.
I am able to redirect to the page 2 but couldn't make changes affect.Please help.
--Page 1 --

--Page 2 --

-- JavaScript --
let colImgRed=document.querySelectorAll(".collections-cont a");
let vertImg=document.querySelectorAll(".vertical-suba img");
let newProImg=["images/collections/f.jpeg","images/collections/g.jpeg","images/collections/h.jpeg","images/collections/i.jpeg","images/collections/j.jpeg",]
let i;

colImgRed[0].onclick=function(){

  for(i=0;i<vertImg.length;i++){
    vertImg[i].src=newProImg[i];
  }

  location.href="html/product.html";
}

A: Well, what i would do is making each anchor have a specific fragment (#), like this

And then in your javascript for page 2, checking the fragment and updating your images accordingly
let vertImg = document.querySelectorAll(".vertical-suba img");
let newProImg=["images/collections/f.jpeg","images/collections/g.jpeg","images/collections/h.jpeg","images/collections/i.jpeg","images/collections/j.jpeg",]

switch (location.hash) {
  case "#a":
  for(let i=0;i<vertImg.length;i++){
    vertImg[i].src=newProImg[i];
  }
  break;
}

What i did here is matching the fragment in a switch statement
case "#a": checks if the fragment matches "#a", and if so it changes the images to the new images


text:
Q: How to convert my Native PHP Code to Codeigniter code I want to convert my native php code about graphical statistic, the chart is filled with total amount of student per class, im using chart.js for my statistic , please help me to convert my code to the CodeIgniter code guys, Thanks.
i'ver been try to put all folder and code to controller, but nothing show. and i dont know how to convert it to CI.
this is my koneksi.php code :
<?php
    $koneksi = mysqli_connect("localhost","root","","grafik_mahasiswa");
?>

And this is my index.php code :
<!DOCTYPE html>

    <title>Test and Try</title>

Try me

    <?php
    include 'koneksi.php';
    ?>

        <canvas id="myChart"></canvas>

                No
                Nama Mahasiswa
                NIM
                Fakultas

            <?php
            $no = 1;
            $data = mysqli_query($koneksi,"select * from mahasiswa");
            while($d=mysqli_fetch_array($data)){
                ?>

                    <?php echo $no++; ?>
                    <?php echo $d['nama']; ?>
                    <?php echo $d['nim']; ?>
                    <?php echo $d['fakultas']; ?>

                <?php
            }
            ?>

A: Have a read at https://www.codeigniter.com/userguide3/database/connecting.html, this might help you you getting started with CI. Good luck!
If you have other questions, try to be as specific as possible, as this makes it easier to answer. How to convert native PHP to CI is quite broad for example, and not easy to answer in a few lines.

A: when u have installed codeigniter go on config-> database.php and change the existing code to get this :
$db['default']['hostname'] = 'localhost';
$db['default']['username'] = 'root';
$db['default']['password'] = '';
$db['default']['database'] = 'grafik_mahasiswa';
$db['default']['dbdriver'] = 'mysqli';
$db['default']['dbprefix'] = '';
$db['default']['pconnect'] = TRUE;
$db['default']['db_debug'] = TRUE;
$db['default']['cache_on'] = FALSE;
$db['default']['cachedir'] = '';
$db['default']['char_set'] = 'utf8';
$db['default']['dbcollat'] = 'utf8_general_ci';
$db['default']['swap_pre'] = '';
$db['default']['autoinit'] = TRUE;
$db['default']['stricton'] = FALSE;

Create a model with all ur sql and a controller to make link between ur model and ur view.
This will help you :
https://codeigniter.com/user_guide/tutorial/create_news_items.html


text:
Q: iPhone Application Design Question I have done some iPhone application development but still am relatively new at it. My question is, how do I design an interface like the face interface, where you have icons that you click that take you to certain things? Is there a template for this in xcode?
Thanks

A: There are no templates or UIKit classes that constructs a matrix of views. You will have to implement them yourself, or read about Three20 library (specifically launcher module) if it's relevant to what you want to implement.
link : http://three20.info/showcase/launcher


text:
Q: Tagging fans of a fanpage without user login. How can I work around this? As far as I know, you can only tag friends of the account associated with the access_token currently in use. This means that if I want to be able to make an app to share photos on facebook with a tagging functionality, it's mandatory that I make an authentication system, where the user needs to type his password to login on FB and I request and store his sixty_days_access_token. This approach is fine for web apps, but is troublesome if I have to implement a desktop touchscreen interface where the users interact with the system in an environment where anyone can watch him typing his user and password. I'm facing this problem with a public touchscreen, where the users can take pictures and send it to Facebook. The interface is implemented with C++ and the curl library. As the touch is in a very crowded environment and the screen is big, we experienced that the users are intimidated to enter his acc/pass. We worked around this problem by creating a fan page to the event where we store all the photos. As we already have the fan page admin access token stored, we don't need to login the users but clearly we are not able to tag any of the user friends, which vastly reduce the viralization potential of the solution.
So, having this problem in mind, how can I face this?

*

*Do I really need to make an authentication of the users to be able to
tag their friends?

*Is there any creative solution?

A: Yes, if you want to tag a user or their friends in a post, you need them to log in - this is a requirement of the Photo tagging API.
The only alternative i can think of is to give the user a URL they can go to later (e.g. on their phone or PC) which will prompt them to authorise your app and do the tagging at that time.


text:
Q: Image with overlay captions I have a problem with image descriptions. I have HTML structure like this:

        @foreach($projects as $project)

                id) !!}">
                    cover_image_name !!}" height="250px" width="auto">

        @endforeach

It creates a nice looking gallery with horizontal scrollbar. But I need to add descriptions to images that will be placed at the bottom of the pictures covering whole their widths and they should have to be transparent to some degree.
The problem is, whatever I do, I either get description that takes 100% width of the page, or it has width of the text inside it.
I have tried doing it with div, span, different combinations of position absolute/relative, everything and I couldn't manage to make it work.
It should look something like this:

How can I do that?

A: use position:relative/absolute

body {
  margin: 0
}
.scrollable-content {
  padding: 0;
  overflow-x: auto
}
ul {
  list-style: none;
  white-space: nowrap;
  padding: 0;
  margin:0
}
li {
  position: relative;
  display:inline-block
}
span {
  background: rgba(0, 0, 0, .5);
  display: inline-block;
  height: 50px;
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%
}
img {
  display: block
}
a {
  color: #fff
}

        description

        description

        description

A: You have two options (wich produce the same result):
1- A div with a image as background, and a subtitle inside this div;

#image {
  width:550px;
  height:150px;
  position:relative;
  background: url('http://i.imgur.com/HNj6tRD.jpg');
  background-repeat: no-repeat;
  background-size:100% 100%;
}

.coverdown {
  color: white;
  width: 100%;
  height: 30%;
  position:absolute;
  bottom:0%;
  background: rgba(0,0,0,0.5);
  text-align: center;
}

Subtitle here with a description.

2- The image and a subtitle with position:absolute inside a position:relative container;

#container {
  width:550px;
  height:150px;
  position:relative;
}

img {
  width:550px;
  height:150px;
  position:absolute;
  top:0px;
  left:0px;
}

.subtitle {
  color: white;
  width: 100%;
  height: 30%;
  position:absolute;
  bottom:0%;
  background: rgba(0,0,0,0.5);
  text-align: center;
}

Subtitle here with a description.

A: basicly, you need relative/absolute as @dippas's answer.
as I advised, use inline-block, so it gets sized by content and will allow easily to position your description.
example below with figure and figcaption.
figure can be wrap in a link displayed inline-block and figure as a block then to avoid a gap underneath.

figure {
  display: inline-block;
  position: relative;
  margin: 0;
}
img {
  display: block;
  max-height:80vh;height:250px/*snippet demo purpose */
}
figcaption {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  /* makeup*/
  background: rgba(0, 0, 0, 0.5);
  color: white;

}
/* demo purpose */

div {
  white-space: nowrap;
  overflow:auto;
}
figure {
  white-space: normal;
  text-align: center;
}

these are wolves

these are wolves

these are wolves

these are wolves


text:
Q: AWS s3 cp cannot find file from a gitlab build? I'm working on a Gitlab CI project where i have to push the APK to our aws S3 Bucket for that i have specified the keys in environment variables in the project setting of our repository, now here is my gitlab-ci.yml file:
stages:
  - build
  - deploy

variables:
  AWS_DEFAULT_REGION: us-east-2 # The region of our S3 bucket
  BUCKET_NAME: abc.bycket.info         # bucket name
  FILE_NAME: ConfuRefac.apk

assembleDebug:
  stage: build
  script:
    - export ANDROID_HOME=/home/bitnami/android-sdk-linux
    - export ANDROID_NDK_HOME=/opt/android-ndk
    - export PATH=$PATH:/home/bitnami/android-sdk-linux/platform-tools/
    - export JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-amd64
    - export PATH=/usr/lib/jvm/java-1.8.0-openjdk-amd64/bin:$PATH
    - chmod +x ./gradlew
    - ./gradlew assembleDebug
    - cd app/build/outputs/apk/debug
    - mv app-debug.apk ${FILE_NAME}
  artifacts:
    paths:
      - app/build/outputs/apk/debug/${FILE_NAME}

deploys3:
  image: "python:latest"  # We use python because there is a well-working AWS Sdk
  stage: deploy
  dependencies:
    - assembleDebug
  script:
    - pip install awscli
    - cd app/build/outputs/apk/debug/
    - ls && pwd
    - aws s3 cp ${FILE_NAME} s3://${BUCKET_NAME}/${FILE_NAME} --recursive

So when the deploy stage starts kicking in it cannot find the file even though in ls you can clearly see that the file is indeed there.

Collecting futures<4.0.0,>=2.2.0; python_version == "2.7" (from s3transfer<0.4.0,>=0.3.0->awscli)
       Using cached https://files.pythonhosted.org/packages/d8/a6/f46ae3f1da0cd4361c344888f59ec2f5785e69c872e175a748ef6071cdb5/futures-3.3.0-py2-none-any.whl
     Collecting six>=1.5 (from python-dateutil<3.0.0,>=2.1->botocore==1.16.13->awscli)
       Using cached https://files.pythonhosted.org/packages/65/eb/1f97cb97bfc2390a276969c6fae16075da282f5058082d4cb10c6c5c1dba/six-1.14.0-py2.py3-none-any.whl
     Installing collected packages: urllib3, docutils, jmespath, six, python-dateutil, botocore, pyasn1, rsa, futures, s3transfer, PyYAML, colorama, awscli
     Successfully installed PyYAML-5.3.1 awscli-1.18.63 botocore-1.16.13 colorama-0.4.3 docutils-0.15.2 futures-3.3.0 jmespath-0.10.0 pyasn1-0.4.8 python-dateutil-2.8.1 rsa-3.4.2 s3transfer-0.3.3 six-1.14.0 urllib3-1.25.9
     You are using pip version 8.1.1, however version 20.1.1 is available.
     You should consider upgrading via the 'pip install --upgrade pip' command.
     $ cd ${PWD}/app/build/outputs/apk/debug/
     $ ls && pwd
     ConfuRefac.apk
     /home/gitlab-runner/builds/CeGhSYCJ/0/root/confu-android/app/build/outputs/apk/debug
     $ aws s3 cp ${PWD}/${FILE_NAME} s3://${BUCKET_NAME}/${FILE_NAME} --recursive
     warning: Skipping file /home/gitlab-runner/builds/CeGhSYCJ/0/root/confu-android/app/build/outputs/apk/debug/ConfuRefac.apk/. File does not exist.

    Running after_script
    00:00
    Uploading artifacts for failed job
    00:01
     ERROR: Job failed: exit status 1

A: As I indicated in the comments, the issue was caused because --recursive is treating ${FILE_NAME} as a directory, not file.
Which of course would make sense, because one can't recursively copy a single file.


text:
Q: Three.sj rotation sending info via network not fit Any suggestion please , dont hate flag this Q.
I not familiar with quaternion/eruler.
I figure that object.rotation. is not axis angle of local rotation.
There is the rotaion only on operation += . Something like velocity in physics..
My net player is fbx animation initialy i have 0 rotation.
I wanna very simple information. Information about for example X and Z axis local rotation current angle.
If i know that info i will easly limit rotation when local player(net emiter) look in the sky...
Note : I now that methods not passing via net in same way we cant pass instace of any class. but x,y,z,w comes normally (simle vars), thats ok.
Visual presentation:
Link : https://www.youtube.com/watch?v=92wKZpgwFhs&ab_channel=javascriptfanatic
If i use normal rotation.y = datafromNet_Y_CAMERA;
It rotate only from -70 to 70 deegres... so strange.
Link :
https://www.youtube.com/watch?v=UgSAAt82QTU&ab_channel=javascriptfanatic
PLACE WHERE I SEND INFO :
       if(this.net.connection) this.net.connection.send({
          netPos: {x: i.position.x, y: i.position.y, z: i.position.z},
          netRot: {
            x: this.camera.rotation.x,
            y: this.camera.rotation.y,
            z: this.camera.rotation.z,
            w: this.camera.quaternion.w
          },
          netQuaternion: this.camera.quaternion,
          netObjId: this.net.connection.userid || i.name,
          netType: 'netPlayer' // can be shared or enemy comp
        });

RECEIVE NET DATA

 // IN THIS CASE WORKS FINE BUT I CANT LIMIT ROTATION
 const quaternion = new THREE.Quaternion();
 // quaternion.fromArray ([
 //   e.data.netQuaternion._x,
 //   e.data.netQuaternion._y,
 //   e.data.netQuaternion._z,
 //   e.data.netQuaternion._w]);
 //   this.root.netPlayers['net_' + e.data.netObjId].rotation.setFromQuaternion(quaternion)

 // IN THIS CASE NOT FULLY WORK ROTATION MANIFEST
 this.root.netPlayers['net_' + e.data.netObjId].rotation.y = e.data.netRot.y;

I tried:
quaternion.setFromAxisAngle(new THREE.Vector3(0,0,1).normalize(), 0);
or
quaternion.setFromAxisAngle(new THREE.Vector3(1,0,0).normalize(), 0);

More data:
Source : https://github.com/zlatnaspirala/magic-three


text:
Q: OnClickListener not responding I can't get my click listeners working. The ImageButton is retrieved correctly.
Listener (Extending my custom Activity which is setting the view):
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    Log.d("UserActivity", "Loading imagebutton...");
    ImageButton iButton = (ImageButton) findViewById(R.id.user_button_ratings);
    Log.d("UserActivity", "Button " + iButton);
    iButton.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            Log.e("Button", "Image was clicked");
        }
    });
}

BaseActivity
@Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(getLayoutId());

        drawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);

        drawerToggle = new ActionBarDrawerToggle((Activity) this, drawerLayout,
                R.drawable.ic_drawer, 0, 0) {
            public void onDrawerClosed(View view) {
                getActionBar().setTitle(R.string.app_name);
            }

            public void onDrawerOpened(View drawerView) {
                getActionBar().setTitle(R.string.menu);
            }
        };
        drawerLayout.setDrawerListener(drawerToggle);

        getActionBar().setDisplayHomeAsUpEnabled(true);
        getActionBar().setHomeButtonEnabled(true);

        layers = getResources().getStringArray(R.array.layers_array);
        drawerList = (ListView) findViewById(R.id.left_drawer);

        drawerList.setAdapter(new ArrayAdapter<String>(this,
                R.layout.adapter_navigation, R.id.navigation_text, layers));

        final BaseActivity activity = this;
        drawerList.setOnItemClickListener(new OnItemClickListener() {
            @Override
            public void onItemClick(AdapterView<?> arg0, View arg1, int pos,
                    long arg3) {
                // Do something
            }
        });

        drawerList.setBackgroundColor(Color.LTGRAY);
    }

Layout:
<ImageButton
    android:id="@+id/user_button_ratings"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_gravity="center_horizontal"
    android:background="@color/transparent"
    android:scaleType="fitCenter"
    android:src="@drawable/mmb_rating_big" />

Manifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.panic.xenira.mmb"
    android:versionCode="2"
    android:versionName="0.1.1" >

    <uses-sdk
        android:minSdkVersion="14"
        android:targetSdkVersion="19" />

    <uses-permission android:name="android.permission.INTERNET" />

    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >

        <activity
            android:name=".MainActivity"
            android:label="@string/app_name"
            android:theme="@style/NoActionBar" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <activity
            android:name=".SearchActivity"
            android:label="@string/title_activity_search" >
        </activity>
        <activity
            android:name=".BaseActivity"
            android:label="@string/title_activity_base" >
            <intent-filter>
                <action android:name="android.intent.action.SEARCH" />
            </intent-filter>

            <meta-data
                android:name="android.app.searchable"
                android:resource="@xml/searchable" />
        </activity>
        <activity
            android:name=".UserActivity"
            android:label="@string/title_activity_user" >
        </activity>
        <activity
            android:name=".UserViewerActivity"
            android:label="@string/title_activity_user_viewer" >
        </activity>
    </application>

</manifest>

There is no error in the LogCat and the onClick method is not caled.
I've tryed different methods of using the listener but never got any response. I also tryed a code that worked for me befor but no response.
Would be great if you culd help me out ;)

A: When using a DrawerLayout, there should be only one main content View, with the drawer View - in this case, your ListView - listed after it. Using a DrawerLayout in any other way will result in incorrect, unpredictable behavior, often preventing normal interaction with other layout elements.
A tutorial with links to a sample and docs can be found on this developer page.

A: Here I am giving an example of Image button. If it is also giving error then clean projects of eclipse and try again.
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context=".MainActivity" >

<ImageButton
    android:id="@+id/imageButton1"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignRight="@+id/textView1"
    android:layout_below="@+id/textView1"
    android:layout_marginRight="35dp"
    android:layout_marginTop="32dp"
    android:contentDescription="image"
    android:src="@drawable/ic_launcher" />

 import android.app.Activity;
 import android.os.Bundle;
 import android.view.Menu;
 import android.view.View;
 import android.view.View.OnClickListener;
 import android.widget.ImageButton;
 import android.widget.Toast;

 public class MainActivity extends Activity {

ImageButton imgButton;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    addListenerOnButton();
}

private void addListenerOnButton() {

    imgButton = (ImageButton) findViewById(R.id.imageButton1);

    imgButton.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View view) {
            Toast.makeText(MainActivity.this, "Clicked", Toast.LENGTH_SHORT)
                    .show();
        }
    });
}
}


text:
Q: XE5, JNI - How would I add (install) JNI support to Delphi XE5 I am looking to add JNI libraries into my XE5, but I had no luck.
When I call out to the units in the uses (eg. Androidapi.JNI.GraphicsContentViewText, Androidapi.JNI.Net...) I get a message that XE5 can't resolve unit name.
I have located the JNI files I need (C:\Program Files (x86)\Embarcadero\RAD Studio\12.0\source\rtl\android), but I don't know how to link to them in XE5.
This is my first time in XE5 and I'm doing this for a school project, so please, be gentle.
Thanks in advance!

A: You need to add ${BDSDIR}\Lib\${PLATFORM}\${Target} to your library path, which in the case of an Android platform debug target will end up adding C:\Program Files (x86)\Embarcadero\RAD Studio\12.0\lib\android\debug to the library path during a build; in the case of an Android release build it will automatically change to C:\Program Files (x86)\Embarcadero\RAD Studio\12.0\lib\android\release.


text:
Q: Creating file in python indicating if integer in in another list I have a list of integers, say [2, 4, 9], then I need to create a csv file like this:
1,0
2,1
3,0
4,1
5,0
6,0
7,0
8,0
9,1

Basically, for each integer, I need to check if the integer is in the list, if it is I write 1, otherwise 0.
I could create a double list, do a for loop, check if the integer is in the list, and then append the (i,0) or (i,1) depending on whether i is in the list, but I am sure there is a far more efficient way to do this. These lists are big, a billion integers or so.
I looked if there was something in numpy to help me, but could not find anything.

A: Use list comprehensions to create your data and use the module csv to write to a csv file.
s = set([2, 4, 9])
lists = [(i, 1) if i in s else (i, 0) for i in range(1, 10)]

# write to a csv file
import csv
with open('test.csv', 'w') as f:
    writer = csv.writer(f)
    writer.writerows(lists)

Since your data size is quite big, it is better to write to a file while creating, as shown below.
import csv

s = set([2, 4, 9])
with open('test.csv', 'w') as f:
    writer = csv.writer(f)

    for i in range(1, 10000000):
        t = (i, 1) if i in s else (i, 0)
        writer.writerow(t)

A: A linear time solution would be to simply check if the current number is literally "in" a list of integers.
example:
sample_list = [2,4,9]
for i in range(5):
    if (i in sample_list):
        print("%d,1"%i)
    else:
        print("%d,0"%i)

Output:
 0,0
 1,0
 2,1
 3,0
 4,1

A: Assuming the list is sorted, you can use a generator function, which might be quite efficient.
def bitstream(sorted_list_of_integers):
    index = 0
    for number in sorted_list_of_integers:
        while number > index:
             yield (index, 0)
             index += 1
        yield (index, 1)
        index += 1

stream = bitstream([3,4,7,9])
list(stream)

output:
[(0,0),(1,0),(2,0),(3,1),(4,1),(5,0),(6,0),(7,1),(8,0),(9,1)]

You should also be able to pass in another generator, as long as the output is incremental. So you can do bitstream(range(0, 10**8, 9**3)) or something like that.
To write to a file, just loop over the bitstream:
with open('numbers.data') as fp:
    for item in bitstream(range(0,500000,1000)):
        fp.write('%i,%i\n' % item)

Using a generator could potentially save a lot of memory compared to some alternative implementations.


text:
Q: Keeping a branch up to date with master I have a remote repository that I've pulled and am branching from.  I want to keep the new branch up to date with changes done to master.  I'm thinking about the workflow below, does it make sense or are there are better ways to do this?

*

*Initial branching and checkout:
git checkout master

git pull

git checkout -b my_branch

*Do some work in my_branch, then periodically:
git checkout master

git pull

git checkout my_branch

git merge master --no-ff

Repeat step 2 as needed, with periodic pushes to the remote my_branch.
Then when ready for a merge back:
git checkout master

git merge my_branch --no-ff

Sound ok?

A: You can simplify your commands:
1.
git fetch
git checkout -b my_branch origin/master

2.
git fetch
git merge origin/master

git fetch updates your remote branches, there usually is no need to have a local copy of a branch when your are not planning to work on this branch.
You can omit the --no-ff after setting git config --global merge.ff false.
git help config says:
   merge.ff
       By default, Git does not create an extra merge commit when merging
       a commit that is a descendant of the current commit. Instead, the
       tip of the current branch is fast-forwarded. When set to false,
       this variable tells Git to create an extra merge commit in such a
       case (equivalent to giving the --no-ff option from the command
       line). When set to only, only such fast-forward merges are allowed
       (equivalent to giving the --ff-only option from the command line).

Be aware that git pull is just a combination of git fetch and git merge.
Usually you just want git pull --rebase which is essentially git fetch plus git rebase, and creates a much cleaner history.
Is there any reason for your "periodic pushes"? If no one else is working on the same branch it would be perfectly fine, just to push after finishing everything.

A: I would advise to use a rebase workflow. So instead of using git pull you should use git pull --rebase.
I would do the same with the feature branch. So instead of doing a git merge master --no-ff I would use a git rebase master. However, if the feature branch is meant to be shared with co-workers during development, then you are better off to merge the master branch periodically into the feature branch.
But to be honest, I work on a small team and if we need to work on a feature branch together and we need to get it up to date with master then we just suspend our work for a short moment (and communicate the process clearly), rebase on master and force push the feature branch. But yep, that doesn't scale for bigger teams. However, I find it much more convenient to  work with a feature branch that is rebased on master instead of having to deal with merges from master.
Make sure to read this.
Git workflow and rebase vs merge questions