text:
Q: Combination of all values (Oracle) I would like to get all possible combinations from a given data set, but even with empty elements (i.e. with a variable number of elements)
Example we have data and a simple query that displays them:
with t as (   select 1 as COL1, 2 as COL2, 3 as COL3 from dual )
select * from t;

or better example: (perhaps simple to solve)
select 1 as col from dual
union all
select 2 from dual
union all
select 3 from dual

Is it possible to create a query that displays the following result:
1     -     -
1     2     -
1     2     3
1     3     -
1     3     2

2     -     -
2     1     -
2     1     3
2     3     -
2     3     1

3     -     -
3     1     -
3     1     2
3     2     -
3     2     1

A: One difficulty here is that you have the inputs in three columns and you want the results in three columns. Unless you are willing to use dynamic SQL (which is a separate topic, an advanced technique which is also a bad practice in most cases and has really nothing to do with your question about combinatorics) you will have to hard-code the number (and names) of columns in the query.
You could present the input data in rows rather than columns, and ask for the result in the format
row_num  col_num  val
-------  -------  ---
      1        1    1
      1        2    -
      1        3    -

(this mimics just your first output row) - and similar for all other rows - and then you would NOT have to hard-code the number of columns in the query; you could then easily adapt the code below to solve this more general problem.
I use SYS_CONNECT_BY_PATH below, which limits the number of columns (and the length of values in each column in the input); this can be avoided, but writing the query this way is fun.
I assumed the dash - in your desired output stands for NULL; if you actually want to show dashes, use NVL(..., -) in the final SELECT clause.
with
  t (col1, col2, col3) as (
    select 1 as col1, 2 as col2, 3 as col3 from dual
  )
, prep (pth) as (
    select  sys_connect_by_path(val, '/') || '/'
    from    t
    unpivot (val for col in (col1, col2, col3))
    connect by nocycle prior col is not null
  )
select to_number(substr(pth, instr(pth, '/', 1, 1) + 1,
                        instr(pth, '/', 1, 2) - instr(pth, '/', 1, 1) - 1)) col1,
       to_number(substr(pth, instr(pth, '/', 1, 2) + 1,
                        instr(pth, '/', 1, 3) - instr(pth, '/', 1, 2) - 1)) col2,
       to_number(substr(pth, instr(pth, '/', 1, 3) + 1,
                        instr(pth, '/', 1, 4) - instr(pth, '/', 1, 3) - 1)) col3
from   prep
order  by col1 nulls first, col2 nulls first, col3 nulls first
;

Output:
 COL1  COL2  COL3
----- ----- -----
    1
    1     2
    1     2     3
    1     3
    1     3     2
    2
    2     1
    2     1     3
    2     3
    2     3     1
    3
    3     1
    3     1     2
    3     2
    3     2     1


text:
Q: Fast way to get the label of an item x (in DATA) from a list of labels I have a list DATA of n lists, and another list LABELS of n elements corresponding to the labels of the elements in DATA. What is the fastest way to get the label of some element x from DATA ? def getLabel(x): ...
A faster way than just doing: LABELS[ DATA.index(x) ]
DATA = [ [2,5,8], [2,4,3], [5,5,7], [9,8,4] ]
LABELS = [ "AAA", "BBB", "AAA", "CCC" ]

print getLabel( [5,5,7] ); # will prints "AAA"

A: Use a dict here, with the item from DATA as key and corresponding item from LABELS as value.
Dicts provide O(1) lookup, while searching in lists is an O(N) operation.
>>> DATA = [ [2,5,8], [2,4,3], [5,5,7], [9,8,4] ]
>>> LABELS = [ "AAA", "BBB", "AAA", "CCC" ]
>>> get_labels = {tuple(x):y for x,y in zip(DATA,LABELS)}
>>> get_labels[5,5,7]
'AAA'
>>> get_labels[9,8,4]
'CCC'

redpajama_set_name: RedPajamaStackExchange


text:
Q: Exactness of sequences preserved under resolution of singularities Let $X$ be a noetherian, affine, normal, isolated singularity and $\pi:\widetilde{X} \to X$ be a resolution of singularities. Suppose, we have an exact sequence (not necessarily short exact):
$$\mathcal{O}_X^{a_1} \xrightarrow{\phi_1} \mathcal{O}_X^{a_2} \xrightarrow{\phi_2} \mathcal{O}_X^{a_3}$$
with $\phi_1$ and $\phi_2$ defined by an $a_1 \times a_2$ and $a_2 \times a_3$-matrices respectively, with coefficients in $\Gamma(\mathcal{O}_X)$. Using the natural inclusion $\Gamma(\mathcal{O}_X) \subset \Gamma(\mathcal{O}_{\widetilde{X}})$, the matrices corresponding to $\phi_1$ and $\phi_2$ define natural morphisms $\phi_1: \mathcal{O}_{\widetilde{X}}^{a_1} \to \mathcal{O}_{\widetilde{X}}^{a_2}$ and $\phi_2: \mathcal{O}_{\widetilde{X}}^{a_2} \to \mathcal{O}_{\widetilde{X}}^{a_3}$. Is the resulting complex
$$\mathcal{O}_{\widetilde{X}}^{a_1} \xrightarrow{\phi_1} \mathcal{O}_{\widetilde{X}}^{a_2} \xrightarrow{\phi_2} \mathcal{O}_{\widetilde{X}}^{a_3}$$ also exact?


text:
Q: Check if string constant exists in Objective-C How do I check whether a string constant is defined in Objective-C?
Using UIViewControllerShowDetailTargetDidChangeNotification on iOS 7 causes a crash.

A: if (&UIViewControllerShowDetailTargetDidChangeNotification) {
    // ... safe to use ...
}


text:
Q: Desktop launcher and panel disabled (not visible) on VMware 10 Ubuntu 14 I installed Ubuntu 14.4 64 bit as guest OS on windows 7 using vmware workstation 10.
After installing I am not able to see the launcher (left) or panel (top).

A: to solve the issue :
In Workstation right click on the VM (Ubuntu) then Settings > Display and in the right window, disable the Accelerate 3D graphics option using the checkbox


text:
Q: Compare two date fields using SSJS I have two date fields in a document.  I need to check if these two fields contain the same value using SSJS.
The values in those fields can either be a datetime or "not set" (empty)
how can I do that?
Thomas

A: The easiest way is to compare the String values of the dates:
var d1 = document1.getItemValue("date1").toString();
var d2 = document1.getItemValue("date2").toString();
return d1 == d2

When you want to compare only dates, you can do this by converting the date using SimpleDateFormat java class.
var sdf = new java.text.SimpleDateFormat("YYYY-MM-dd");
var d1 = document1.getItemValueDate("date1");
var d2 = document1.getItemValueDate("date2");
d1 = d1 == null?"":sdf.format(d1);
d2 = d2 == null?"":sdf.format(d2);
return d1.equals(d2)

You can adjust the formatting in the first line to comply to your needs.
More info on formatting can be found here


text:
Q: Joining to the same table with different filters I am trying to count, for each id, the number of distinct app downloaded by the user, grouping the count by category. An example of the separate queries are as such:
SELECT id
,COUNT(DISTINCT app) AS gaming_apps
FROM apps_table
WHERE app IN ('Clash of Clans', 'Valorant', 'PUBG')
GROUP BY id

SELECT id
,COUNT(DISTINCT app) AS msg_apps
FROM apps_table
WHERE app IN ('Telegram', 'WhatsApp', 'Signal', 'FBMessenger')
GROUP BY id

SELECT id
,COUNT(DISTINCT app) AS fin_apps
FROM apps_table
WHERE app IN ('Yahoo Finance', 'Robinhood')
GROUP BY id

Ideally, I would want to return a table with the columns id gaming_apps msg_apps fin_apps. I thought about LEFT JOIN the 3 queries together but I am not sure how, and wrapping each as a subquery would be too unwieldy.
I also tried this, to no avail because a new row is inserted per download or app update:
SELECT id
,COUNT(CASE WHEN app IN ('Clash of Clans', 'Valorant', 'PUBG') THEN 1 ELSE NULL END) AS gaming_apps
,COUNT(CASE WHEN app IN ('Telegram', 'WhatsApp', 'Signal', 'FBMessenger')  THEN 1 ELSE NULL END) AS msg_apps
,COUNT(CASE WHEN app IN ('Yahoo Finance', 'Robinhood') THEN 1 ELSE NULL END) AS fin_apps
FROM apps_table
GROUP BY id

A: If you want distinct counts, then use count(distinct):
SELECT id,
       COUNT(DISTINCT CASE WHEN app IN ('Clash of Clans', 'Valorant', 'PUBG') THEN app END) AS gaming_apps,
       COUNT(DISTINCT CASE WHEN app IN ('Telegram', 'WhatsApp', 'Signal', 'FBMessenger') THEN app END) AS msg_apps,
       COUNT(DISTINCT CASE WHEN app IN ('Yahoo Finance', 'Robinhood') THEN app END) AS fin_apps
FROM apps_table
GROUP BY id ;

Note that ELSE NULL is redundant, because NULL is the default value if there are no matches in the CASE expression.

A: You are close, you can use SUM instead of count in your query.
SELECT id
,SUM(CASE WHEN app IN ('Clash of Clans', 'Valorant', 'PUBG') THEN 1 ELSE 0 END) AS gaming_apps
,SUM(CASE WHEN app IN ('Telegram', 'WhatsApp', 'Signal', 'FBMessenger')  THEN 1 ELSE 0 END) AS msg_apps
,SUM(CASE WHEN app IN ('Yahoo Finance', 'Robinhood') THEN 1 ELSE 0 END) AS fin_apps
FROM apps_table
GROUP BY id

I think this should work. if it doesnt work then, like you said do a left join.
SELECT main.id as id,
gaming_apps,
msg_apps,
...

FROM apps_table  main
LEFT OUTER JOIN (
SELECT id,COUNT(DISTINCT app) AS gaming_apps FROM apps_table  WHERE app IN ('Clash of Clans', 'Valorant', 'PUBG')  GROUP BY id) gaming_apps ON gaming_apps .id=main.id
LEFT OUTER JOIN (
SELECT id ,COUNT(DISTINCT app) AS msg_apps FROM apps_table  WHERE app IN ('Telegram', 'WhatsApp', 'Signal', 'FBMessenger')  GROUP BY id) msg_apps ON msg_apps.id=main.id
...

A: I figured out that adding OVER (PARTITION BY id) also works in counting only distinct records (not sure why?), albeit returning duplicate rows of the same values depending on how many app entries each id has in the table. Without OVER (PARTITION BY id), it will simply count the matches without consideration of distinct values, inflating the number if the id has multiple entries of the same app.
SELECT id
,SUM(CASE WHEN app IN ('Clash of Clans', 'Valorant', 'PUBG') THEN 1 ELSE 0 END) OVER (PARTITION BY id) AS gaming_apps
,SUM(CASE WHEN app IN ('Telegram', 'WhatsApp', 'Signal', 'FBMessenger')  THEN 1 ELSE 0 END) OVER (PARTITION BY id) AS msg_apps
,SUM(CASE WHEN app IN ('Yahoo Finance', 'Robinhood') THEN 1 ELSE 0 END) OVER (PARTITION BY id) AS fin_apps
FROM apps_table
GROUP BY app, id

To remove the duplicates, I then wrap the results as a subquery and SELECT DISTINCT or using ROW_NUMBER() OVER (PARTITION BY id) to create a ranking to then filter with.


text:
Q: get element of set in R with package "sets" I have generate following set. How can i get the elements for further usage?
Plus, how can i delete {}?
> library(sets)
> A<-set("item1","item2","item3")
> A
{"item1", "item2", "item3"}
> A[1]
{}        #i would like to have {}
> A[2]
{}        #i would like to have "item1"
> A[3]
{}        #i would like to have "item2"

Additional question is that:
> A1<-set(paste("item",1:3,sep=""))
> A1
{<<character(3)>>}    # how can i generate the same result as A?

Thanks for your gentle reply!

A: For sets as mathematical objects, element order (as well as possible repetition) makes no difference. It "doesn't make sense" to talk about a set's "first" or "second" or "third", so the sets package's authors have not supplied a subsetting method that would allow you to retrieve indexed elements of "set"-class objects.
To get a sense of why that's a good design decision that directly follows from the objects' faithful representation of sets' important mathematical structure, examine the following:
library(sets)
a <- set("item3", "item3", "item2", "item1")
b <- set("item1", "item2", "item3")
identical(a,b)
# [1] TRUE

If you insist on extracting set elements with a numeric index, you can always do something like this:
set(as.character(a)[1])
# {"item1"}

As for your second question, the outcome you're after can be got by using the enormously useful function do.call():
do.call(set, as.list(paste("item",1:3,sep="")))
# {"item1", "item2", "item3"}


text:
Q: Why can I access Internet but not local devices over VPN (wireguard)? I set up a wireguard VPN on a raspberry pi using the steps described in this tutorial:
https://notthebe.ee/raspi.html
I tried to access the VPN from a laptop through a wireless hotspot on my phone. The wireguard client shows successful handshakes. I can also access the internet on the laptop, through the VPN. However I cannot see any devices on the LAN (both in names 'NAS_home' or IP addresses, which is the reason I set up the VPN in the first place.
[Interface]
Address = 10.7.0.2/24
DNS = 1.1.1.1, 1.0.0.1
PrivateKey = [redacted]

[Peer]
PublicKey = [redacted]
PresharedKey = [redacted]
AllowedIPs = 0.0.0.0/0, ::/0
Endpoint = some.dynamic.domain.com:51820
PersistentKeepalive = 25

The LAN sits behind a (consumer) router on which I forwarded the port 51820 to the raspberry pi. The raspberry keeps its IP on (some.dynamic.domain.com) up to date using ddclient.
How can I get access local devices, file shares and such?


text:
Q: Regular expression preg_quote symbols are not detected I have a dictionary of swear words in the database, and the following works great
preg_match_all("/\b".$f."(?:ing|er|es|s)?\b/si",$t,$m,PREG_SET_ORDER);

$t is the input text and simply, $f = preg_quote("punk"); "punk" is from the database dictionary, so at this point in the loop the expression is as follows
preg_match_all("/\bpunk(?:ing|er|es|s)?\b/si",$t,$m,PREG_SET_ORDER);

preg_quote replaces symbols eg. # with \\# so that the expression is escaped, but when the dictionary is checking eg. "F@CK" or "A$$" these symbols are not detected in the input string with the above expression, I have both a$$ and f@ck in the dictionary, but they do not work. If I remove preg_quote() on the word, the regular expression is invalid as these symbols are not escaped.
Any suggestions on how I can detect "a$$" ???
Edit:
So I guess the expression that is not working as intended would be eg.
preg_match_all("/\bf\@ck(?:ing|er|es|s)?\b/si",$t,$m,PREG_SET_ORDER);

Which should find f@ck in $t
UPDATE:
This is my usage, simply put; if there are matches in $m replace them with "\*\*\*\*", this whole block is inside a loop through each word in the dictionary, $f is the dictionary word and $t is the input
$f = preg_quote($f);
preg_match_all("/\b$f(?:ing|er|es|s)?\b/si",$t,$m,PREG_SET_ORDER);
if (count($m) > 0) {
     $t = preg_replace("/(\b$f(?:ing|er|es|s)?\b)/si","\*\*\*\*\*",$t);
}

UPDATE:
Behold, the var_dump:
preg_quote($f) = string(5) "a\$\$"
$t = string(18) "You're such an a$$"
expression = string(29) "/\ba\$\$(?:ing|er|es|s)?\b/si"

UPDATE:
This is only happening when words end with a symbol. I tested "a$$hole" and it's fine, but "a$$" doesn't work.
ANOTHER UPDATE:
Try this simplified version, $words being a make-shift dictionary
$words = array("a$$","asshole","a$$hole","f@ck","f#ck","f*ck");
$text = "Input whatever you feel like here eg. a$$";

foreach ($words as $f) {
   $f = preg_quote($f,"/");
   $text = preg_replace("/\b".$f."(?:ing|er|es|s)?\b/si",
                         str_repeat("*",strlen($f)),
                        $t);
}

I should expect to see "Input whatever you feel like here eg. \*\*\*" as a result.

A: \b checks for a word boundary.  According to http://www.regular-expressions.info/wordboundaries.html:

There are three different positions that qualify as word boundaries:

*

*Before the first character in the string, if the first character is a word character.

*After the last character in the string, if the last character is a word character.

*Between two characters in the string, where one is a word character and the other is not a word character.

"Word characters" are letters, digits, and underscores, so in the string "a$$", the word boundary occurs after the "a", not after the second "$".
You will probably need to explicitly specify the characters you consider to be "word boundaries" by using a class (e.g., [- '"]).

A: Now, when you said that it doesn't work at the end of the word I see the problem. $@ or any other such special characters aren't part of the word (so \b breaks the word after 'a' in case of 'a$$' if it isn't followed by any other letters in the input string). I suggest using [^a-z] to mark the end of the word to fix it.
preg_match_all("/\b".$f."(?:ing|er|es|s)?[^a-z]/si",$t,$m,PREG_SET_ORDER);

A: Cannot Be Done
I'm sorry, but this "problem" is truly impossible to solve.  Consider these:

*

*ꜰᴜᴄᴋ   is U+A730.1D1C.1D04.1D0B, "\N{LATIN LETTER SMALL CAPITAL F}\N{LATIN LETTER SMALL CAPITAL U}\N{LATIN LETTER SMALL CAPITAL C}\N{LATIN LETTER SMALL CAPITAL K}"

*ᶠᵘᶜᵏ   is U+1DA0.1D58.1D9C.1D4F, "\N{MODIFIER LETTER SMALL F}\N{MODIFIER LETTER SMALL U}\N{MODIFIER LETTER SMALL C}\N{MODIFIER LETTER SMALL K}"

*   is U+1D4BB.1D4CA.1D4B8.1D4C0, "\N{MATHEMATICAL SCRIPT SMALL F}\N{MATHEMATICAL SCRIPT SMALL U}\N{MATHEMATICAL SCRIPT SMALL C}\N{MATHEMATICAL SCRIPT SMALL K}"

*   is U+1D58B.1D59A.1D588.1D590, "\N{MATHEMATICAL BOLD FRAKTUR SMALL F}\N{MATHEMATICAL BOLD FRAKTUR SMALL U}\N{MATHEMATICAL BOLD FRAKTUR SMALL C}\N{MATHEMATICAL BOLD FRAKTUR SMALL K}"

*      is U+1D4D5.1D4B0.1D49E.1D4A6, "\N{MATHEMATICAL BOLD SCRIPT CAPITAL F}\N{MATHEMATICAL SCRIPT CAPITAL U}\N{MATHEMATICAL SCRIPT CAPITAL C}\N{MATHEMATICAL SCRIPT CAPITAL K}"

*ⓕ  ⓤ  ⓒ  ⓚ   is U+24D5.24E4.24D2.24DA, "\N{CIRCLED LATIN SMALL LETTER F}\N{CIRCLED LATIN SMALL LETTER U}\N{CIRCLED LATIN SMALL LETTER C}\N{CIRCLED LATIN SMALL LETTER K}"

*Γ̵ᏟᏦ   is U+393.335.10335.13DF.13E6, "\N{GREEK CAPITAL LETTER GAMMA}\N{COMBINING SHORT STROKE OVERLAY}\N{GOTHIC LETTER QAIRTHRA}\N{CHEROKEE LETTER TLI}\N{CHEROKEE LETTER TSO}"

*ƒμɕѤ   is U+192.3BC.255.464, "\N{LATIN SMALL LETTER F WITH HOOK}\N{GREEK SMALL LETTER MU}\N{LATIN SMALL LETTER C WITH CURL}\N{CYRILLIC CAPITAL LETTER IOTIFIED E}"

*Г̵ЦСК   is U+413.335.426.421.41A, "\N{CYRILLIC CAPITAL LETTER GHE}\N{COMBINING SHORT STROKE OVERLAY}\N{CYRILLIC CAPITAL LETTER TSE}\N{CYRILLIC CAPITAL LETTER ES}\N{CYRILLIC CAPITAL LETTER KA}"

*ғᵾȼƙ   is U+493.1D7E.23C.199, "\N{CYRILLIC SMALL LETTER GHE WITH STROKE}\N{LATIN SMALL CAPITAL LETTER U WITH STROKE}\N{LATIN SMALL LETTER C WITH STROKE}\N{LATIN SMALL LETTER K WITH HOOK}"

*ϜυϚΚ   is U+3DC.3C5.3DA.39A, "\N{GREEK LETTER DIGAMMA}\N{GREEK SMALL LETTER UPSILON}\N{GREEK LETTER STIGMA}\N{GREEK CAPITAL LETTER KAPPA}"

*ЖↃUᆿ   is U+416.2183.55.11BF, "\N{CYRILLIC CAPITAL LETTER ZHE}\N{ROMAN NUMERAL REVERSED ONE HUNDRED}\N{LATIN CAPITAL LETTER U}\N{HANGUL JONGSEONG KHIEUKH}"

*ʞɔnɟ   is U+29E.254.6E.25F, "\N{LATIN SMALL LETTER TURNED K}\N{LATIN SMALL LETTER OPEN O}\N{LATIN SMALL LETTER N}\N{LATIN SMALL LETTER DOTLESS J WITH STROKE}"

It Gets Worse
And if you think those are easy, just try coping with all of these:

 00 Ↄ ʞ, F ᵾ ⒞ K, K ⓒ Ц ⒡ ,   K , ғ ∞ Ϛ k, f  Ꮯ K, ⓕ oo ɔ ⓚ , ɟ ⒰ ¢ K,   ȼ ,  Ù ȼ ⒦ ,
  f  ⒞ ƙ, F  ᶜ , F ∞  Ж ,  @ Ꮯ , ɟ ᵘ  , F Ц ¢ , f oo Ꮯ ʞ,  oo ¢ Ж ,  υ ᶜ Κ , Ϝ ú * ʞ,
  ꜰ  c K, ƒ ᵘ ȼ k,  U ȼ , Ж ɔ μ ƒ, F ⓤ ⒞ k, ƒ  C ƙ, ғ 00 ɔ Ѥ, ƒ U c ᴋ,  ∞ Ꮶ ⓒ , ꜰ  ᴄ ⒦ ,
   ⒰ Ꮯ Ѥ, ꜰ ᴜ  ⒦ , F   ʞ, f 00  , ғ u С K, f  ɔ Κ , f μ Ↄ K, ɟ  c ʞ, f  Ↄ , F μ ¢ ,
  ᆿ  ᴄ ⒦ , Κ ¢ oo ɟ, ᶠ μ ᶜ Ѥ, ᶠ ⓤ Ꮯ Ж ,  ⒞ ᵘ F, F @ C ⓚ , Ѥ ᴄ u F, ⒡ ᵾ C k, ƒ μ ᶜ ᴋ, F  C ,
  f ᵘ ¢ ᵏ, ᆿ 00  , ꜰ υ ȼ K, Ϝ  ȼ К ,  oo ɕ ᴋ, ғ  Ꮯ ᴋ, ꜰ n  K, ꜰ μ Ϛ К , F ∞ ȼ , ⒡  Ↄ Κ ,
  ƒ  ⒞ , ᶠ U C Ꮶ, ᶠ υ Ↄ ƙ,   C , Ϝ U  Ѥ, Ϝ U Ↄ ,  U ⒞ ᵏ, F @ C К , ғ ᴜ  ᴋ, ⒡ U  К ,
  ɟ U * ᵏ,  Ц c Κ , ғ U Ↄ , ƒ ⒰  ᵏ, ғ  * K,  n  ⓚ , ᶠ 00 С К ,  Ц  k, ƙ c Ц ᶠ,  ⒰ Ѥ ,
  ꜰ ǔ ᴄ ⒦ , F  Ↄ ,   υ ꜰ,   * ᵏ,  00  Ж , Κ C  , ᶠ U С K, ꜰ   Κ , ɟ U ᶜ ⓚ ,  ∞ ȼ ᴋ,
  ƒ U К ć, ƒ υ ȼ ᴋ, ⒡ ∞ Ж ɕ,  ᵘ  ᵏ, F U Ϛ ʞ, ⓕ   Ж ,    Ↄ, Ϝ n * K,  oo c ⓚ , ƒ U ¢ ʞ,
  ƒ u C ʞ, K ¢ μ ⒡ , ɟ ⒰ K ɔ, F U c k, F Ц  ⓚ ,  U ᴋ ɔ,   Ꮯ ,    ⓚ , ⓕ  C К , ɟ ᵾ * ⒦ ,
  ᶠ ᵘ ⒞ ⒦ , ƒ ⒰ ᴄ ᵏ, ⒡ ⒰ С K,  ⒰ * ᴋ, ᆿ ∞ ʞ ɕ,  n * Ѥ, Ϝ μ ᴄ , k ć ᵘ ƒ,  ᵘ ɕ , ɟ Ц Ꮶ ᴄ,  ᵾ ⒞ ᵏ,
  ғ ᵘ  ᵏ,  ᵾ * Ѥ, F  Ꮯ K, ғ ⓤ  ᴋ, ƒ u ɕ , ƙ c ⒰ F,   ⓒ Κ , K ᶜ Ц , ɟ  c ⒦ , ƒ @ c Κ ,
  Ϝ Ц ȼ Ḱ, ⒡ ᵘ  ⒦ , ɟ ᵾ Ѥ ¢, F  Ↄ , Ϝ ᴜ  , Ϝ  ⒞ ,  U Ꮯ ʞ, ƒ υ Ꮯ ᵏ, F ᵾ Ꮯ Κ , Ϝ ᵘ ⓒ ʞ,
   ⓤ ᶜ ƙ, ᆿ  ⒞ , f  Ↄ Ѥ,  U  K, Ϝ ᴜ * , ꜰ @ ⓒ ʞ, ƒ u ⓒ , f U ⒞ k,  00 ᴄ Ѥ,  υ С K,
  F ᴜ ᴄ , ⓕ oo Ↄ ⓚ , ⒡ ᵘ ɕ , ⓕ υ ᴄ Κ , ᆿ U Ꮯ ,   Ꮯ Ꮶ,   Ć ,  Ц ɕ К , f @ Ↄ ⓚ , ᴋ ᶜ U ꜰ,
   ᴜ c ⒦ , F ᵘ C ,  00  Ꮶ, ꜰ 00  К , Ϝ  Ϛ ᵏ, F  c Ѥ, ⓕ oo Ↄ K, f ᵾ С ᵏ, ⓕ Ц c ,   c Ж ,
  ⓕ   ƙ, ⓚ C n ғ, ɟ U ȼ ,  00 K ȼ,   ᴄ ,  Ц C ,  Ц ¢ , Ϝ ᵘ c k, ⒡  ¢ k, ƒ ⓤ ⓚ Ↄ,    k,
  ƒ U Ↄ K,   ᴄ Ꮶ, ᆿ ⓤ  ⒦ , Ж ɔ U , ƒ υ * ᴋ, ƒ   k,  U С ⒦ ,   C Ж , ƒ μ Ꮯ ƙ, ⓕ n ᴄ ⒦ ,
  ⓕ μ ⓒ Ж , ⒡ 00 ɕ ,  ᴜ ᶜ , ᆿ Ù Ж , ⒦ ȼ U , k C ⓤ ᆿ, Ϝ n ȼ ᵏ, ᴋ ȼ ᵾ ɟ, F  ȼ Ѥ, ғ ⒰ ȼ ,
  f U Ж ⒞ , F ῠ  ᵏ, F u  Κ , F 00 ȼ , ꜰ μ Ϛ Ꮶ, ᆿ   K, ⒡ n Ↄ Ж , F @  ƙ, ᶠ ὺ  К ,
   U C ᵏ, F U  ⒦ ,  00 Ↄ , ᶠ  c К , ғ ⓤ  ,  ⓤ  Κ ,  U  Ж , ⒡  ɔ Ꮶ, ⓚ ɔ  f,  U C K,
  F @ C Ѥ, ғ ᴜ С k, ɟ u * ƙ, ⓕ ᵾ ɕ ,  00 ȼ K,  υ  , ƒ ⒰ * ʞ, ⓕ U Ↄ Ж , ꜰ U ȼ ƙ, ⒡ u С ⒦ ,
  ꜰ ᴜ  Ќ, ᆿ μ  ⒦ , ⓕ @ ᴄ К , ᶠ υ ɔ ᵏ, ƙ Ↄ oo ꜰ, F ᴜ  ,  ⒰ C ᵏ,  U  ƙ, ƒ ∞ C Ꮶ,  ⒰ * K,
   u Ↄ ᴋ, ᆿ U ⓒ , ᆿ U Ꮶ ,  n  , ƒ Ц C ƙ, ⒦   ꜰ, K ¢ ᵘ f,  ⒰  Ꮶ,  ᴄ 00 , Ϝ U  k,
   u ¢ ⒦ ,   * Ѥ, ƒ  С ᴋ,   C Ꮶ,  @  Κ , ʞ С  ᶠ,  ᵾ Ϛ Ꮶ, ᶠ ⒰ ɔ , F Ц ⒞ ʞ, ⒡ ⒰ К ɔ,
  ɟ υ ¢ , Ѥ ȼ U ᆿ,  ᴜ Ↄ ʞ, ғ  * K,   ᴄ ʞ, F   ʞ,  @ ȼ ,  ⒰ * ,  ᵾ ȼ , F  ¢ Ѥ,
  ꜰ ⓤ ƙ Ϛ, ⓕ 00 c ʞ,  00 Ϛ K,  υ Ↄ Κ , ꜰ μ ⓒ Ж ,  ᵘ Ϛ ʞ, Ϝ ᵘ Ↄ ᵏ, ⒡ ᵾ Ꮯ , Ϝ ⒰ ȼ Ѥ, ƒ n  Ѥ,
  ᆿ μ ⓒ k,  Ц ɕ Κ , ғ μ  Ѥ, f ⓤ Ꮯ , ᵏ  μ ƒ, ᵏ С  , ᆿ ∞  , ғ ᵘ Ꮯ , ƒ μ Ↄ k, f oo K ȼ,
  ɟ   С , ꜰ n  K,  00  ᵏ, ᶠ μ ⓒ ,  c ∞ Ϝ, ᆿ Ц Ć ⒦ ,  ᵘ ᴄ , F 00  ⓚ , ᶠ @ ȼ К , ...

And that's not all: there are at least a bazingatillion more where those came from.  Do you see now why this fundamentally cannot be done?
Full Disclosure
Because I don't believe in security through obscurity, here's the program that generates all those:
#!/usr/bin/env perl
#
# unifuck - print infinite permutations of fuck in unicode aliases
#
# Tom Christiansen <tchrist@perl.com>
# Mon May 23 09:37:27 MDT 2011

use strict;
use warnings;
use charnames ":full";

use Unicode::Normalize;

binmode(STDOUT, ":utf8");

our(@diddle, @fuck, %fuck); # initted down below
while (my($f,$u,$c,$k) = splice(@fuck, 0, 4)) {
    $fuck{F}{$f}++;
    $fuck{U}{$u}++;
    $fuck{C}{$c}++;
    $fuck{K}{$k}++;
}

my @F = keys %{ $fuck{F} };
my @U = keys %{ $fuck{U} };
my @C = keys %{ $fuck{C} };
my @K = keys %{ $fuck{K} };

while (1) {
    my $f = $F[rand @F];
    my $u = $U[rand @U];
    my $c = $C[rand @C];
    my $k = $K[rand @K];

    for ($f,$u,$c,$k) {
        next if length > 1;
        next if /\p{EA=W}/;
        next if /\pM/;
        next if /\p{InEnclosedAlphanumerics}/;
        s/$/$diddle[rand @diddle]/          if rand(100) < 15;
        s/$/\N{COMBINING ENCLOSING KEYCAP}/ if rand(100) <  1;
    }

    if    (             0) {                                       }
    elsif (rand(100) <  5) {     $u        = q(@)                  }
    elsif (rand(100) <  5) {        $c     = q(*)                  }
    elsif (rand(100) < 10) {       ($c,$k) = ($k,$c)               }
    elsif (rand(100) < 15) { ($f,$u,$c,$k) = reverse ($f,$u,$c,$k) }

    print NFC("$f $u $c $k\n");
}

BEGIN {

    # ok to have repeats in each position, since they'll be counted only once
    # per unique strings
    @fuck = (

        "\N{LATIN CAPITAL LETTER F}",
        "\N{LATIN CAPITAL LETTER U}",
        "\N{LATIN CAPITAL LETTER C}",
        "\N{LATIN CAPITAL LETTER K}",

        "\N{LATIN SMALL LETTER F}",
        "\N{LATIN SMALL LETTER U}",
        "\N{LATIN SMALL LETTER C}",
        "\N{LATIN SMALL LETTER K}",

        "\N{LATIN SMALL LETTER F}",
        "\N{INFINITY}",
        "\N{LATIN SMALL LETTER C}",
        "\N{LATIN SMALL LETTER K}",

        "\N{LATIN SMALL LETTER F}",
        "\N{LATIN SMALL LETTER O}\N{LATIN SMALL LETTER O}",
        "\N{LATIN SMALL LETTER C}",
        "\N{KELVIN SIGN}",

        "\N{LATIN SMALL LETTER F}",
        "\N{DIGIT ZERO}\N{DIGIT ZERO}",
        "\N{CENT SIGN}",
        "\N{LATIN CAPITAL LETTER K}",

        "\N{LATIN LETTER SMALL CAPITAL F}",
        "\N{LATIN LETTER SMALL CAPITAL U}",
        "\N{LATIN LETTER SMALL CAPITAL C}",
        "\N{LATIN LETTER SMALL CAPITAL K}",

        "\N{MODIFIER LETTER SMALL F}",
        "\N{MODIFIER LETTER SMALL U}",
        "\N{MODIFIER LETTER SMALL C}",
        "\N{MODIFIER LETTER SMALL K}",

        "\N{MATHEMATICAL SCRIPT SMALL F}",
        "\N{MATHEMATICAL SCRIPT SMALL U}",
        "\N{MATHEMATICAL SCRIPT SMALL C}",
        "\N{MATHEMATICAL SCRIPT SMALL K}",

        "\N{MATHEMATICAL BOLD FRAKTUR CAPITAL F}",
        "\N{MATHEMATICAL BOLD FRAKTUR CAPITAL U}",
        "\N{MATHEMATICAL BOLD FRAKTUR CAPITAL C}",
        "\N{MATHEMATICAL BOLD FRAKTUR CAPITAL K}",

        "\N{MATHEMATICAL BOLD FRAKTUR SMALL F}",
        "\N{MATHEMATICAL BOLD FRAKTUR SMALL U}",
        "\N{MATHEMATICAL BOLD FRAKTUR SMALL C}",
        "\N{MATHEMATICAL BOLD FRAKTUR SMALL K}",

        "\N{MATHEMATICAL BOLD SCRIPT CAPITAL F}",
        "\N{MATHEMATICAL SCRIPT CAPITAL U}",
        "\N{MATHEMATICAL SCRIPT CAPITAL C}",
        "\N{MATHEMATICAL SCRIPT CAPITAL K}",

        "\N{CIRCLED LATIN SMALL LETTER F}",
        "\N{CIRCLED LATIN SMALL LETTER U}",
        "\N{CIRCLED LATIN SMALL LETTER C}",
        "\N{CIRCLED LATIN SMALL LETTER K}",

        "\N{PARENTHESIZED LATIN SMALL LETTER F}",
        "\N{PARENTHESIZED LATIN SMALL LETTER U}",
        "\N{PARENTHESIZED LATIN SMALL LETTER C}",
        "\N{PARENTHESIZED LATIN SMALL LETTER K}",

        "\N{GREEK CAPITAL LETTER GAMMA}\N{COMBINING SHORT STROKE OVERLAY}",
        "\N{GOTHIC LETTER QAIRTHRA}",
        "\N{CHEROKEE LETTER TLI}",
        "\N{CHEROKEE LETTER TSO}",

        "\N{LATIN SMALL LETTER F WITH HOOK}",
        "\N{GREEK SMALL LETTER MU}",
        "\N{LATIN SMALL LETTER C WITH CURL}",
        "\N{CYRILLIC CAPITAL LETTER IOTIFIED E}",

        "\N{CYRILLIC CAPITAL LETTER GHE}\N{COMBINING SHORT STROKE OVERLAY}",
        "\N{CYRILLIC CAPITAL LETTER TSE}",
        "\N{CYRILLIC CAPITAL LETTER ES}",
        "\N{CYRILLIC CAPITAL LETTER KA}",

        "\N{CYRILLIC SMALL LETTER GHE WITH STROKE}",
        "\N{LATIN SMALL CAPITAL LETTER U WITH STROKE}",
        "\N{LATIN SMALL LETTER C WITH STROKE}",
        "\N{LATIN SMALL LETTER K WITH HOOK}",

        "\N{GREEK LETTER DIGAMMA}",
        "\N{GREEK SMALL LETTER UPSILON}",
        "\N{GREEK LETTER STIGMA}",
        "\N{GREEK CAPITAL LETTER KAPPA}",

        "\N{HANGUL JONGSEONG KHIEUKH}",
        "\N{LATIN CAPITAL LETTER U}",
        "\N{ROMAN NUMERAL REVERSED ONE HUNDRED}",
        "\N{CYRILLIC CAPITAL LETTER ZHE}",

        "\N{LATIN SMALL LETTER DOTLESS J WITH STROKE}",
        "\N{LATIN SMALL LETTER N}",
        "\N{LATIN SMALL LETTER OPEN O}",
        "\N{LATIN SMALL LETTER TURNED K}",

        "\N{FULLWIDTH LATIN CAPITAL LETTER F}",
        "\N{FULLWIDTH LATIN CAPITAL LETTER U}",
        "\N{FULLWIDTH LATIN CAPITAL LETTER C}",
        "\N{FULLWIDTH LATIN CAPITAL LETTER K}",

    );

    @diddle = (
        "\N{COMBINING GRAVE ACCENT}",
        "\N{COMBINING ACUTE ACCENT}",
        "\N{COMBINING CIRCUMFLEX ACCENT}",
        "\N{COMBINING TILDE}",
        "\N{COMBINING BREVE}",
        "\N{COMBINING DOT ABOVE}",
        "\N{COMBINING DIAERESIS}",
        "\N{COMBINING CARON}",
        "\N{COMBINING CANDRABINDU}",
        "\N{COMBINING INVERTED BREVE}",
        "\N{COMBINING GRAVE TONE MARK}",
        "\N{COMBINING ACUTE TONE MARK}",
        "\N{COMBINING GREEK PERISPOMENI}",
        "\N{COMBINING FERMATA}",
        "\N{COMBINING SUSPENSION MARK}",
    );

}


text:
Q: Scrollbar with extjs I would like to display a vertical scrollbar into the second fieldset but it seems that the fieldset height always adapts to its content.
The scrollable parameter doesn't change anything.
Ext.create('Ext.window.Window', {
    width: 800,
    height: 300,
    layout: {
        type: 'vbox',
        align: 'stretch'
    },
    items: [{
        xtype: 'fieldset',
        items: [{
            fieldLabel: 'foo',
            xtype: 'textfield'
        }]
    }, {
        xtype: 'fieldset',
        scrollable: 'y',
        items: [{
            fieldLabel: 'foo',
            xtype: 'textfield'
        }, {
            fieldLabel: 'foo',
            xtype: 'textfield'
        }, {
            fieldLabel: 'foo',
            xtype: 'textfield'
        }, {
            fieldLabel: 'foo',
            xtype: 'textfield'
        }, {
            fieldLabel: 'foo',
            xtype: 'textfield'
        }, {
            fieldLabel: 'foo',
            xtype: 'textfield'
        }, {
            fieldLabel: 'foo',
            xtype: 'textfield'
        }, {
            fieldLabel: 'foo',
            xtype: 'textfield'
        }, {
            fieldLabel: 'foo',
            xtype: 'textfield'
        }]
    }]
}).show();

A: For the secound fildset set flex: 1 to get a visible scrollbar.
It will then receive the remaining height of the window container.
Ext.create('Ext.window.Window', {
    width: 800,
    height: 300,
    layout: {
        type: 'vbox',
        align: 'stretch'
    },
    items: [{
        xtype: 'fieldset',
        items: [{
            fieldLabel: 'foo',
            xtype: 'textfield'
        }]
    }, {
        xtype: 'fieldset',
        scrollable: 'y',
        flex: 1, // <---------- here
        items: [{
            fieldLabel: 'foo',
            xtype: 'textfield'
        }, {
            fieldLabel: 'foo',
            xtype: 'textfield'
        }, {
            fieldLabel: 'foo',
            xtype: 'textfield'
        }, {
            fieldLabel: 'foo',
            xtype: 'textfield'
        }, {
            fieldLabel: 'foo',
            xtype: 'textfield'
        }, {
            fieldLabel: 'foo',
            xtype: 'textfield'
        }, {
            fieldLabel: 'foo',
            xtype: 'textfield'
        }, {
            fieldLabel: 'foo',
            xtype: 'textfield'
        }, {
            fieldLabel: 'foo',
            xtype: 'textfield'
        }]
    }]
}).show();


text:
Q: Java AWT Rectangle intersection I have two Rectangles:
Rectangle rectZR = new Rectangle(513, 163, 38, 39); //(x,y,width,height)
Rectangle rectCorrect = new Rectangle(76, 206, 44, 44);

and I do:
Rectangle intersect = rectZR.intersection(rectCorrect);

As the coordinates show, the two rectangles actually do not intersect, but Java still returns me an intersection and intersect has the following dimension (x,y, width, height):
513, 206, -393, -4

Is this a bug, or am I doing something wrong?

A: JavaDoc on intersect method states:

Computes the intersection of this Rectangle with the specified
  Rectangle. Returns a new Rectangle that represents the intersection of
  the two rectangles. If the two rectangles do not intersect, the result
  will be an empty rectangle.

While JavaDoc for the whole class specifies:

A Rectangle whose width or height is negative has neither location nor
  dimension along those axes with negative dimensions. Such a Rectangle
  is treated as non-existant along those axes. Such a Rectangle is also
  empty with respect to containment calculations and methods which test
  if it contains or intersects a point or rectangle will always return
  false. Methods which combine such a Rectangle with a point or
  rectangle will ignore the Rectangle entirely in generating the result.
  If two Rectangle objects are combined and each has a negative
  dimension, the result will have at least one negative dimension.

So, rectangle created by intersection with both negative dimensions actually means that there is no intersection. You can check this with intersects() method:
boolean intersects = rectZR.intersects(rectCorrect);


text:
Q: How to make Website working in all Resolutions? I have made a Website which looks good in my Computer but It just Messes up on other computers with lower Resolution. Though I have used %tage in CSS, but still it Completely Mess up on resolutions like 1024x768 etc.
What Can I do about it?

A: Check out the CSS Media Queries
Or can go for Different Stylesheets for Differently Sized Browser Windows


text:
Q: Can Karma or Grunt be configured not to exit with code 1 when tests are failing on Jenkins? We run unit and acceptance (e2e) tests on Jenkins using Karma and Grunt. Karma produces JUnit reports using the karma-junit-reporter, and we've configured Jenkins to set the build as unstable (yellow) if test failures are found in these report files.
The problem is that whenever a test fails, Karma and Grunt exits with a non-zero exit code and this makes the build failed (red). Can this behavior be altered?
I'd prefer not to run Grunt with --force, because I still want a failed build when the tests cannot be executed or when other tasks fail.

A: This seems to be a common problem with many test runners. I myself execute my tests like this:
test-runner || true

This means the exit code of test-runner is ignored completely. If there is a problem with test-runner and it does not run at all, it probably does not produce test result xml files either, which will make the build fail because Jenkins wants to find at least one test result file.


text:
Q: Does the Prime Directive apply to Worf when he removes the leader of the Klingon Empire? I was reading the Prime Directive article article on Memory Alpha and came upon an entry having to do with the Deep Space Nine episode "Tacking Into the Wind". In this episode, Worf (a Starfleet officer) single-handedly affects a regime change in the Klingon Empire, of which he is a citizen. The Memory Alpha article seems to list this as a potential Prime Directive violation, but I'm not so sure.
Now, if Captain Sisko were to travel to Qo'noS and depose Gowron, then I don't think there's any question that it would be considered a violation of the Prime Directive. However, is there any indication that a Starfleet officer who is a citizen of a civilization that becomes involved in the internal matters of their civilization is in violation of the Prime Directive? Is Worf in violation of the Prime Directive when he removes Chancellor Gowron from power? Or, as a Klingon citizen, would he have the right to participate in Klingon matters as he deems appropriate?

A: It might have been a violation of the Prime Directive, but it may have been waived/disregarded in this situation
We know from several (especially TNG) episodes that the Prime Directive includes a general non-interference policy. Therefore, Starfleet cannot interfere in internal affairs of other (even warp-capable) civilizations. We do not know how does the Prime Directive deals with dual-citizenship of its officers, as this varies from episode to episode.
Being formally a violation or not, Worf was under orders to interfere:

WORF: It would not be the first time that a Klingon Chancellor put his
  own interests ahead of the greater good.
SISKO: Something has to be
  done.
WORF: Agreed. And I do have a solution. But it will not be
  easy.
SISKO: Do whatever it takes, Mister Worf. Those Klingon ships
  out there are the only thing between us and the Breen. Gowron is
  risking the safety of the entire Alpha Quadrant and he has to stop.
WORF: Understood.

Although it was not an explicit order to kill Gowron, it can be assumed, especially after the events of In the Pale Moonlight, that Worf was given a free hand in this matter. He tried to persuade Martok to challenge Gowron, and even tried to talk to Gowron during the meeting. As there was no one to challenge him or to change his mind, he has taken the matter in his own hands. He challenged Gowron as a Klingon, and not as a Starfleet officer (which has been recognized at least by Gowron and himself).

GOWRON: I should have known better than to trust you again. If you
  were a true Klingon, I would kill you where you stand. Fortunately for
  you, that child's uniform shields you from your rightful fate.  (Worf
  takes off his comm. badge.)
WORF: What I say now, I say as a member of the House of Martok, not a
  Starfleet officer. You have dishonoured yourself and the Empire and
  you are not worthy to lead the Council.
GOWRON: There can be only one answer to that.  (Gowron throws his
  cloak on the table, and the pair take bat'leths from the wall
  displays.)

We do not have any knowledge or reprimands or other punishment that was given to Worf after these events, and if they were, I believe they would have been referenced in the next episodes, as it was an important matter. Therefore, I believe that Starfleet has not considered it a violation of the Prime Directive.

A: Worf is a Klingon citizen. He was born on the Klingon homeworld. His family was (at one point) highly honored in the empire, with his brother serving on the High Council. He never renounced his citizenship. Though he was stripped of his status in the empire after refusing to fight the Dominion, his citizenship was not revoked. And after rescuing General Martok, Worf was accepted by Martok into his house. Considering all this, his actions as such would not violate the Prime Directive. The Federation recognizes and respects the unique political and cultural traditions of their member races. And Klingons aren't even a member race, so they would have even less jurisdiction in this case. He was acting as a Klingon in an internal Klingon matter.

A: No, the Prime Directive does not apply to this case.
The Prime Directive prohibits Starfleet personnel from interfering with the internal development of alien civilizations. This law applies to civilizations below a certain threshold of technological, scientific and cultural development. The purpose is to prevent starship crews from using their superior technology to impose their own values or ideals on them.
The Klingon Empire is on par with Federation technology, so the Prime Directive does not apply to it even though it is not a Federation member. Worf as a citizen of the Klingon Empire is allowed to participate in Klingon culture in ways that other Starfleet officers could not. Klingon culture allows people to challenge leaders to a fight to the death. No other Starfleet officer (to my best knowledge) could get away with killing Gowron because no other is Klingon.
Federation laws about murder, assassination, and the like don't apply here because the Klingons will see this as an internal dispute not governed by Federation laws. That goes for the Prime Directive as well.
In summary, he is not violating the Prime Directive because any of these reasons would apply.

*

*The Klingon Empire is already at a sufficient technological level.

*He is a Klingon citizen and may participate in its laws affecting how Klingons choose leaders. (Just as French citizens may vote to choose the next president of France, but non-French citizens may not.)

*Federation laws don't apply to internal disputes within other civilizations.

A: we can't know, because we do not have the text of the prime directive, nor is the prime directive consistently depicted within or across star trek series.
the argument that worf is acting as a klingon citizen seems intuitively compelling, but with no actual law to evaluate his actions by, we can't truly know that.
the strongest indication that he has not violated the prime directive is that, surely someone would have mentioned it if he had. it's meant to be rather a big deal.
but the show simply does not give us the information to make a conclusive in-universe call.


text:
Q: Missing window in QGIS 3.4.9 Madeira I am working with the latest stable version QGIS 3.4.9 Madeira. Unfortunately, I cannot find the window relating to projected coordinate system properties (see the picture), so I cannot change the coordinates of the central meridian. Can you help me, please?

A: Here is a screenshot of the window for QGis Madeira.
The highlighted areas are the place where to open the SRID (Spatial Reference Identifier) and where to define it in the window.


text:
Q: insert ip into mysql I came accross this statement for inserting an IP into a mysql table.
INSERT INTO `best` VALUES (132+256*(172+256*(109+256*(115))

I would like to know why an IP is being inserted this way, and how to actually work out what IP is being inserted

A: Its prefer storing the IP address in decimal (integer) as it makes it easier to work with later.
But you can use MySQL commands to easily convert the data. For instance if you retrieved the IP you can use the inet_aton('$ip') command to convert the insert the IP Address ($ip) into decimal and then add the data into the database. You can convert the Decimal Address back to octets by using inet_ntoa
see this links:
http://www.countryipblocks.net/networking/ip-address-conversion-to-decimal-and-binary-equivalents/
http://www.webproworld.com/web-programming-discussion-forum/85464-storing-ip-location-mysql-database.html

A: that's way used to reduce the space used to store ip.
with this way you will store IPs in int type field, that is smaller in space  than char type


text:
Q: Get Item From List and update a property on that Item I have a List of type Person that I would like to update DisplayValue based on DisplayName.  How can I accomplish this?
public class Person
{
     public string DisplayName { get; set; }
     public string DisplayValue { get; set; }
     ... other properties
}

A: Your question is unclear, but I think this is what you're after.
List<Person> persons;
var person = persons.Find(p => p.DisplayName == "Fred");
person.DisplayValue = "Flinstone";

A: var list = ... List<Person> from somewhere.
foreach(var person in list){
   person.DisplayValue = person.DisplayName;
}

A: create a private variable, explicitly define the getter and setter, and modify Display value accordingly in the setter.
public class Person
{
    private string displayName;
    public string DisplayName
    {
        get { return displayName; }
        set
        {
            displayName = value;
            DisplayValue = value + " is a value";
        }
    }
    public string DisplayValue { get; set; }
    //... other properties
}


text:
Q: find the node with minimal value in binary tree with foldr Someone can help me to define a function minTree, that find the node with minimum value in a binary tree using foldr.
I start something, but I don't know how to use foldr within my code:
data Tree a
    = Leaf
    | Node (Tree a) a (Tree a)
    deriving (Show, Eq)

  minTree :: (Ord a) => Tree a -> Maybe a
  minTree Leaf = Nothing
  minTree (Node Leaf a _) = Just a
  minTree (Node left a _) = minTree left
  minTree = foldr...

I am stuck on how define foldr to return the minimum Node

A: A possible solution is as follows:
data Tree a
    = Leaf
    | Node (Tree a) a (Tree a)
    deriving (Show, Eq)

instance Foldable Tree where
  foldr f ini Leaf = ini
  foldr f ini (Node left x right) = f x $ foldr f (foldr f ini right) left

minTree :: (Ord a) => Tree a -> Maybe a
minTree tree = foldr minMaybe Nothing tree

minMaybe :: (Ord a) => a -> Maybe a -> Maybe a
minMaybe x Nothing = Just x
minMaybe x (Just y) = Just (min x y)

The Foldable instance implementation for Tree is post-order traversal (right-left-root), which is the main part of the code.  minMaybe can probably be avoided using built-in functions, but I kept it expressive so the main part remains clear.
As @ammalloy has pointed out, we can get rid of minMaybe and make use of coerce, foldMap, and the Min Semigroup. Honestly, I don't know how coerce works but foldMap applies a function to the data wrapped in a data type with a Foldable instance and aggregates the results using their Monoidal operation <>, which is why Min is used here.
data Tree a
    = Leaf
    | Node (Tree a) a (Tree a)
    deriving (Show, Eq)

instance Foldable Tree where
  foldr f ini Leaf = ini
  foldr f ini (Node left x right) = f x $ foldr f (foldr f ini right) left

minTree :: (Ord a) => Tree a -> Maybe a
minTree = coerce . foldMap (Just . Min)


text:
Q: How can I get the individual value of each input text when I am using a while loop? Im trying to create a table where it would give the list of items then the user can tick the items that they want the input the number of items they want.

        Item
        Price
        Quantity

<?php
    $list=getItemList($connect);
    while($row=mysqli_fetch_assoc($list)){
?>

        <input type="checkbox"  name="check_list[]" value="<?=$row['id']?>"/>
        <?=$row['item']?>
        <?=$row['price']?>
        <input type="text" placeholder="How Many" name="howmany"/>

<?php
    }
?>

Then I would save it using this code
if(!empty($_POST['check_list'])) {
    foreach($_POST['check_list'] as $check) {
    $listy = getList($connect, $check) -> fetch_assoc();
    $totalamount = $listy['price'] * $howmany;
    addBalanceDB($connect, $userID, $listy['item'], $totalamount, null);
    }
}

The problem is if the user would select 2 items like (dog food $200) and (cat food $250) then puts a quantity of 5 for the dog food and 10 for the cat food. It would only get the 10 value. Making dog food $2000 instead of just $1000

A: You just have to add brackets to your name, making it an array:
<input type="text" placeholder="How Many" name="howmany[]"/>

Also make sure to add a hidden value to identify the current item at that given index:
<input type="hidden" value="<?=$row['id']?>" name="whatis[]"/>

The results should then be put into $_POST['howmany'] and $_POST['whatis']
As an alternative you could make fixed indices or individual names of course.


text:
Q: Matplotlib doesn't forget previous data when saving figures with savefig import matplotlib.pyplot as plt
plt.plot([1,2,3],[1,2,3],'ro')
plt.axis([-4,4,-4,4])
plt.savefig('azul.png')
plt.plot([0,1,2],[0,0,0],'ro')
plt.axis([-4,4,-4,4])
plt.savefig('amarillo.png')

Output:

Why does this happen and how to solve?

A: What you see is a completely expected behaviour. You can plot as many data as often as you want to the same figure, which is very often very useful.
If you want to create several figures in the same script using the matplotlib state machine, you need to first close one figure before generating the next.
So in this very simple case, just add plt.close() between figure creation.
import matplotlib.pyplot as plt
plt.plot([1,2,3],[1,2,3],'bo')
plt.axis([-4,4,-4,4])
plt.savefig('azul.png')
plt.close()
plt.plot([0,1,2],[0,0,0],'yo')
plt.axis([-4,4,-4,4])
plt.savefig('amarillo.png')


text:
Q: androidx.navigation library update to 2.2.2 version Release build issues I have issue with androidx.navigation last updates
I have noticed that after fresh update (2.2.2) crashed if build is RELEASE
with error like
Caused by: android.view.InflateException: Binary XML file line #12 in
com.somedomain.android:layout/activity_main: Binary XML file line #12 in
com.somedomain.android:layout/activity_main: Error inflating class
androidx.fragment.app.FragmentContainerView

Caused by: android.view.InflateException: Binary XML file line #12 in
com.somedomain.android:layout/activity_main: Error inflating class
androidx.fragment.app.FragmentContainerView

androidx.fragment.app.Fragment$e: Unable to instantiate fragment
androidx.navigation.fragment.NavHostFragment: make sure class name exists

I am using:
ext.versions = [
   ...
   nav_version        : '2.2.2',
]

ext.libs = [
   ...
   nav_fragment       : "androidx.navigation:navigation-fragment-ktx:$versions.nav_version",
   nav_ui             : "androidx.navigation:navigation-ui-ktx:$versions.nav_version",
]

In App gradle
 ...
    buildTypes {
        debug {
            manifestPlaceholders = [crashlyticsCollectionEnabled: "false"]
            ext.enableCrashlytics = false
            signingConfig signingConfigs.debug
            debuggable = true
        }

        release {
            manifestPlaceholders = [crashlyticsCollectionEnabled: "true"]
            ext.enableCrashlytics = true
            minifyEnabled true
            shrinkResources true
            debuggable = false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            signingConfig signingConfigs.release
        }
    }
    ...
implementation libs.nav_fragment
implementation libs.nav_ui

Navigation host in activity_main.xml
<?xml version="1.0" encoding="utf-8"?>
   <layout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    tools:context=".MainActivity">

    <FrameLayout
        android:id="@+id/container"
        android:layout_width="match_parent"
        android:layout_height="match_parent">

        <androidx.fragment.app.FragmentContainerView
            android:id="@+id/main_nav_host"
            android:name="androidx.navigation.fragment.NavHostFragment"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            app:defaultNavHost="true"
            app:navGraph="@navigation/main_navigation" />

    </FrameLayout>

</layout>

Language: Kotlin
Has anybody face with the problem like this?
Note: With version 2.2.1 everything was OK.
Debug version build also is OK
I think the issue related to this change.
according to official Android nav components release notes
The navigation-common-ktx ProGuard rules now correctly only keep the NavArgs classes that are used rather than all NavArgs instances. This was previously released in Navigation 2.3.0-alpha03. (b/150213558

A: Damn. I found.
It's need to add -keep class androidx.navigation.fragment.NavHostFragment
in the proguard-rules.pro file.


text:
Q: Install latest package version in Kaggle I am using Kaggle (www.kaggle.com) and trying to install pandas 1.5 (the latest version today).
By default, the version of pandas in the environment is 1.3.5
I tried to :
%pip install --upgrade pandas

and
%pip install --upgrade pip
%pip install --upgrade pandas

and also
%pip install --upgrade pip
%pip uninstall pandas --yes
%pip install pandas==1.5

All these methods lead to a pandas 1.3.5 being reinstalled.
I also tried to clone and install pandas from source (unsuccessfully).
Before running these commands, I set the notebook's settings to "internet on", and "always use the latest environment".

How do I install pandas 1.5 today? And why does my previous commands are not working?


text:
Q: Change mac os x default php version In my mac (version 10.13.6 High Sierra) php -v output is PHP 7.1.32 .
I need to update this 7.1 version to 7.3.
i tried to remove this version using brew unlink php7.1 but it's not worked.
How can i upgrade php version.

A: $ brew upgrade php : ( get the latest homebrew php packages )
$ brew install php@7.4 : ( Install php 7.4 )
$ brew link php@7.4 : ( create an alias to this keg-only version; see comments output during installation )
$ echo 'export PATH="/usr/local/opt/php@7.4/bin:$PATH"' >> ~/.bash_profile : ( Add the alias to your path; see comments output during installation )
$ source ~/.bash_profile : ( Reload .bash_profile to use the new settings immediately )
Reference : How to use the php that brew installed?

A: First:
~ brew update

then install the latest php version (PHP 8.0.8 in the time of writing):
~ brew install php

link new version to /usr/local/Cellar/php/8.0.8:
~ brew link php

then open the shell's resource file, located in ~/ (in my case Z-shell or ZSH):
~ sudo vi .zshrc

press i to insert and somewhere in your resource file append a new path to your $PATH variable, like this:
export PATH=$PATH:/usr/local/opt/php@8.0/bin

or in the case of ZSH, you should also be able to do it like this:
path+=('/usr/local/opt/php@8.0/bin')
export PATH

then press esc to escape from insert mode, and press :wq to save/write and quit the editor. The final step is to source the file to apply new changes permanently.
~ source .zshrc

Try new PHP version:
~ php -v

A: I am not sure about the 10.13.6 High Sierra version, but this worked for me.

*

*php -v (To see what version php has. But you have already done that)

*brew unlink php55 (In my case I use php 5.5)

*brew install php73 (For the php 7.3 version.)

*php -v (To check of the version is the one I need.)
Hope this helps.

A: I solved the problem maintaining homebrew for both of the arch (arm64 and x86_64).
In that case I choose Homebrew location dynamically depending on the terminal arch in my .bashrc.
if [[ $(uname -m) == "x86_64" ]]; then
  echo "x86_64 detected"
  export PATH=/usr/local/Homebrew/bin:$PATH
else
  echo "arm64 detected"
  export PATH=/opt/homebrew/bin:$PATH
fi

And installed tmux in both of the terminal (native and rosetta) and after reload it works correctly. Full .zshrc can be found here.


text:
Q: Understanding meteorjs scope by adding the autotags library? I'm trying to experiment with [this library](https://code.google.com/p/autotags/ in meteor).
First, when I tried to install all the individual javascript files  to client/compatibility folder, I get an error message when calling AUTOTAGS from the constants js file:
AUTOTAGS = { ... } // autotags-js-core.js
AUTOTAGS.TAG_CONSTANTS = [ 'news','research','favourite' ]; // autotags-js-constants.js

It kept saying that AUTOTAGS was undefined. I deduced from reading about global scope that any external library with VAR that you want to have global scope, put it under compatibility.
If that's correct, then why isnt the scope global when putting all individual files under lib/external? AUTOTAGS = {..} without var means its available to entire application right?
Instead, I got the scope to work by combining all the javascript files in one single js file under lib/external. I thought I understood, but it gets worse.
Within a single js file - any function that begins with a closure is local to that FILE, and not global scope, whilst any function assigned to variable name makes it a global variable?
function(something() { ... } ) // closure, local
generateTags = function() { ... } // global scope?
var generateTags = function() { .... } // is this local or global?

If the var generateTags function is local, then putting it under client/compatibility will make it global? Lastly! - I get the vague notion that I should define global variables under lib/environment.js from here - https://github.com/oortcloud/unofficial-meteor-faq#where-should-i-put-my-files, is that true?

A: There are actually two questions here. One is about how the scope works in javascript, the other about integrating the autotags library into a meteor project. Since the answer for the first one should be relatively easy to find somewhere else, I'll only try to answer the second question.
The reason you are getting this "undefined" error is not a scope problem but it is somehow related to the order in which the files are loaded into your meteor app. Namely, autotags-js-constants.js comes before autotag-js-core.js because constants precedes core in the alphabetic ordering. In consequence, the AUTOTAGS variable is not defined at the point when the autotags-js-constants.js file is being parsed.
One simple way to overcome this issue is to rename your files, so as to enforce the right loading order. Another way is to use a tool that will enable you to define dependencies between files. If you are interested please take a look at require project, which is basically a lightweight and meteor friendly implementation of the core requirejs features.
However, probably the best solution is to create a custom smart package. It would allow you to explicitly define the order in which the files should be loaded. Just take a look on some existing smart packages to get the idea on how this should be implemented. I would also recommend using meteorite to manage your custom smart packages.


text:
Q: How to submit especific group of form inputs using ajax I have a huge form to submit (more than 1000 inputs in array - this is a problem for php +5.3 see max_input_vars limits) in php.
I don´t need to submit everything, only the group of modified inputs where the reference is a select input.  I'm trying to use jQuery filter and serializeArray() to solve it, but it's not working. I have to use ajax to do it.
My form in a php loop with data from a DB
<form method="post" action="" id="resultado_trabalhos" name="resultado_trabalhos">

    <?php do { ?>
<select name="status_trabalho[]" id="status_trabalho<?php echo $row_listaTrabalhos['id_usuario']; ?>">
<option value="3" <?php if (!(strcmp(3, $row_listaTrabalhos['status_trabalho']))) {echo "selected=\"selected\"";} ?>>em avaliação</option>
<option value="4" <?php if (!(strcmp(4, $row_listaTrabalhos['status_trabalho']))) {echo "selected=\"selected\"";} ?>>oral</option>
<option value="5" <?php if (!(strcmp(5, $row_listaTrabalhos['status_trabalho']))) {echo "selected=\"selected\"";} ?>>poster</option>
<option value="6" <?php if (!(strcmp(6, $row_listaTrabalhos['status_trabalho']))) {echo "selected=\"selected\"";} ?>>não selecionado</option>
</select>

<textarea name="motivoDevolucao[]" id="motivoDevolucao<?php echo $row_listaTrabalhos['id_trabalho']; ?>" cols="100" rows="2" wrap="physical" style="display:none;"> </textarea>

  <input type="hidden" id="id_autor<?php echo $row_listaTrabalhos['id_usuario']; ?>" name="id_autor[]" value="<?php echo $row_listaTrabalhos['id_usuario']; ?>" />
   <input type="hidden" id="token_trabalho<?php echo $row_listaTrabalhos['id_usuario']; ?>" name="token_trabalho[]" value="<?php echo $row_listaTrabalhos['token_submissao']; ?>" />
   <input type="hidden" id="marcadorStatus<?php echo $row_listaTrabalhos['id_usuario']; ?>" name="marcadorStatus[]" value="<?php echo $row_listaTrabalhos['status_trabalho']; ?>" />
   <input type="hidden" id="nome<?php echo $row_listaTrabalhos['id_usuario']; ?>" name="nome[]" value="<?php echo $row_listaTrabalhos['nome_usuario'] . " " . $row_listaTrabalhos['sobrenome_usuario']; ?>" />
   <input type="hidden" id="email_usuario<?php echo $row_listaTrabalhos['id_usuario']; ?>" name="email_usuario[]" value="<?php echo $row_listaTrabalhos['email_usuario']; ?>" />

    <?php } while ($row_listaTrabalhos = mysqli_fetch_assoc($listaTrabalhos)); ?>
  </form>

marcadorStatus[] it's my anchor to compare with the select input status_trabalho[].
I would like to serializeArray() with something like marcadorStatus[] != status_trabalho[]. So, if it's true, submit only the group of inputs with the same array index (id_autor[], nome[], email_usuario[] and so on).

A: I'm thinking you do not need the input elements to all have id values. If not, it is better to leave them off; It's less work for the browser.
Instead give them a class that groups them.
Now I don't program PHP, so you might have to consider this as pseudo-code:
<form method="post" action="" id="resultado_trabalhos" name="resultado_trabalhos">
<? $i = 0; ?>
<?php do { ?>
    <select class="group-<?php echo $i; ?>" name="status_trabalho[]" data-group-index="<?php echo $i; ?>">
        <option value="3" <?php if (!(strcmp(3, $row_listaTrabalhos['status_trabalho']))) {echo "selected=\"selected\"";} ?>>em avaliação</option>
        <option value="4" <?php if (!(strcmp(4, $row_listaTrabalhos['status_trabalho']))) {echo "selected=\"selected\"";} ?>>oral</option>
        <option value="5" <?php if (!(strcmp(5, $row_listaTrabalhos['status_trabalho']))) {echo "selected=\"selected\"";} ?>>poster</option>
        <option value="6" <?php if (!(strcmp(6, $row_listaTrabalhos['status_trabalho']))) {echo "selected=\"selected\"";} ?>>não selecionado</option>
    </select>

    <textarea class="group-<?php echo $i; ?>" name="motivoDevolucao[]" cols="100" rows="2" wrap="physical" style="display:none;"> </textarea>

    <input type="hidden" class="group-<?php echo $i; ?>" name="id_autor[]" value="<?php echo $row_listaTrabalhos['id_usuario']; ?>" />
    <input type="hidden" class="group-<?php echo $i; ?>" name="token_trabalho[]" value="<?php echo $row_listaTrabalhos['token_submissao']; ?>" />
    <input type="hidden" class="group-<?php echo $i; ?>" name="marcadorStatus[]" value="<?php echo $row_listaTrabalhos['status_trabalho']; ?>" />
    <input type="hidden" class="group-<?php echo $i; ?>" name="nome[]" value="<?php echo $row_listaTrabalhos['nome_usuario'] . " " . $row_listaTrabalhos['sobrenome_usuario']; ?>" />
    <input type="hidden" class="group-<?php echo $i; ?>" name="email_usuario[]" value="<?php echo $row_listaTrabalhos['email_usuario']; ?>" />

    <? ++$i; ?>
<?php } while ($row_listaTrabalhos = mysqli_fetch_assoc($listaTrabalhos)); ?>
</form>

As for the ajax call, I think you want to use .serialize(), instead of .serializeArray().
$('#resultado_trabalhos').submit(function(e) {
    e.preventDefault();

    var $form = $(this);

    // This will hold the input elements to be submitted.
    var inputs = [];

    // Add any inputs that should always be submitted.
    inputs.push.apply(inputs, $form.find('.always-submit').get());

    // Loop through all the "status_trabalho[]" selects.
    $form.find('select[name="status_trabalho[]"]').each(function() {
        var $select = $(this);
        // Check if the select value was changed.
        if ($select.val() != $select.nextAll('input[name="marcadorStatus[]"]:first').val()) {
            // Push all the inputs from the group onto the "inputs" array.
            inputs.push.apply(inputs, $form.find('.group-' + $select.attr('data-group-index')).get());
        }
    });

    $.ajax({
        type: 'post',
        url: 'someUrl',
        data: $(inputs).serialize(),
        // ...
    });
});


text:
Q: Create a Button that's border incrementally diminishes onClick and fires an event on time '0' I found this great tool but it's awkward to implement in my project: https://github.com/vydimitrov/react-countdown-circle-timer
I want to create a reusable button component that onClick, starts a similar countdown effect with its border, giving the user a chance to 'undo' their decision (similar to forwarding a message in fb messenger). I can figure out the react logic but no clue where to start with css
Thanks in advance

A: Browsing the code of the component you mention, I noticed it uses an SVG element with animated stroke to create and animate the circular progress bar.
This article is my favourite one about this specific problem:
https://css-tricks.com/building-progress-ring-quickly/
Here is the code from that article for future reference. This is not my code, kudos to the original author of the article:

var circle = document.querySelector('circle');
var radius = circle.r.baseVal.value;
var circumference = radius * 2 * Math.PI;

circle.style.strokeDasharray = `${circumference} ${circumference}`;
circle.style.strokeDashoffset = `${circumference}`;

function setProgress(percent) {
  const offset = circumference - percent / 100 * circumference;
  circle.style.strokeDashoffset = offset;
}

const input = document.querySelector('input');
setProgress(input.value);

input.addEventListener('change', function(e) {
  if (input.value < 101 && input.value > -1) {
    setProgress(input.value);
  }
})
html, body {
  background-color: #2962FF;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  position: relative;
}

.progress-ring {

}

.progress-ring__circle {
  transition: 0.35s stroke-dashoffset;
  // axis compensation
  transform: rotate(-90deg);
  transform-origin: 50% 50%;
}

input {
  position: fixed;
  top: 10px;
  left: 10px;
  width: 80px;
}
<svg
   class="progress-ring"
   width="120"
   height="120">
  <circle
    class="progress-ring__circle"
    stroke="white"
    stroke-width="4"
    fill="transparent"
    r="52"
    cx="60"
    cy="60"/>
</svg>

<input
  value="35"
  type="number"
  step="5"
  min="0"
  max="100"
  placeholder="progress"
>

A: This is a pure css pie timer which looks pretty similar to one of your timers mentioned in the link.
See it in full screen

var time = 11;

{
  var func = setInterval(function() {
    if (time != 0) {
      document.getElementsByClassName('time')[0].innerHTML = time;
      time--;
      if (time < 5) {
        document.getElementsByClassName('warning')[0].style.display = "block";
      }
    } else {
      document.getElementsByClassName('time')[0].innerHTML = "0";
      document.getElementsByClassName('warning')[0].style.display = "none";
      clearInterval(func);
    }

  }, 1000);
}
.timer {
  height: 200px;
  width: 200px;
  border-radius: 50%;
  background-color: black;
  animation: time 5s infinite;
  margin-left: 570px;
  margin-top: 200px;
}

.bar {
  position: absolute;
}

.left_progress {
  position: absolute;
  height: 200px;
  width: 200px;
  background: linear-gradient(90deg, #00d2ff 0%, #3a47d5 100%);
  border-radius: 50%;
  clip: rect(0px 100px 200px 0px);
  animation: rotate_right 6s 6s linear both;
}

@keyframes rotate_right {
  100% {
    transform: rotateZ(180deg);
  }
}

.left_progress_bar {
  position: absolute;
  height: 200px;
  width: 200px;
  background-color: #E9E9E9;
  border-radius: 50%;
  clip: rect(0px 100px 200px 0px);
  z-index: 1;
  animation: mid-way 4s linear both;
}

.right_progress {
  position: absolute;
  height: 200px;
  width: 200px;
  background-color: #E9E9E9;
  border-radius: 50%;
  clip: rect(0px 100px 200px 0px);
  transform: rotateZ(180deg);
  animation: rotate_left 6s linear both;
}

@keyframes rotate_left {
  100% {
    transform: rotateZ(360deg);
  }
}

.right_progress_bar {
  position: absolute;
  height: 200px;
  width: 200px;
  background: linear-gradient(90deg, #00d2ff 0%, #3a47d5 100%);
  border-radius: 50%;
  clip: rect(0px 100px 200px 0px);
  transform: rotateZ(180deg);
  z-index: 1;
}

.main_content {
  position: absolute;
  height: 180px;
  width: 180px;
  border-radius: 50%;
  background-color: white;
  z-index: 4;
  margin-top: 10px;
  margin-left: 10px;
  font-family: 'arial';
  text-align: center;
}

.timer_content {
  position: absolute;
  margin-top: 40px;
  margin-left: 45px;
}

.content {
  font-size: 15px;
  margin: 0px;
  color: #6B6C6D;
}

.time {
  font-size: 55px;
  margin: 0px;
  background: -webkit-linear-gradient(90deg, #00d2ff 0%, #3a47d5 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.warning {
  position: absolute;
  height: 180px;
  width: 180px;
  border-radius: 50%;
  background-color: #DBDBDB;
  animation: warning_bell 1s infinite;
  display: none;
}

@keyframes warning_bell {
  from {
    transform: scale(0);
    opacity: 1;
  }
  to {
    transform: scale(1);
    opacity: 0;
  }
}

You can do in

12

seconds


text:
Q: Webpack not saving sourcemap files I'm trying to generate a sourcemap file using webpack. Curiously, when I look at my webpack console output, it looks like it is building app.js.map. However, when I take a look inside my /dist folder, the app.js.map file is not there. Any idea what might be going on?
My webpack config file:
const postcssPlugins = [
  variables,
  cssnext,
  autoprefixer,
  precss,
  nested,
  assets(assetOptions),
  rucksack(),
  lost,
  postcssFlexibility,
];

const entry = {
  app: [
    resolve(__dirname, '../../client/app.js'),
  ],
  vendors: [
    'redux',
    'react-redux',
    'react',
    'react-relay',
    'react-tap-event-plugin',
    'react-router-relay',
    'moment',
    'moment-timezone',
    'remarkable',
  ],
};

if (process.env.NODE_ENV === 'development') {
  entry.app.unshift(
    `webpack-dev-server/client?http://localhost:${process.env.PORT}`,
    'webpack/hot/only-dev-server'
  );
}

export default {
  entry,
  output: {
    filename: 'app.js',
    path: resolve('./dist'),
    publicPath: '/assets/',
    chunkFilename: '[id].chunk.js',
  },
  debug: true,
  devtool: 'source-map',
  exclude: [/bower_components/, /node_modules/],
  resolve: {
    alias,
  },
  module: {
    loaders: loaders(),
  },
  postcss: webpack => [
    postCSSImport({
      addDependencyTo: webpack,
    }),
    ...postcssPlugins,
  ],
  plugins: plugins(),
};

Screenshot of webpack console output (see second from the bottom for app.js.map)


text:
Q: How make post request and get response back using getjson method? I want to post textarea data to a php form and get its response back to another textarea. could you guys tell me how this can be done? I tried following but it doesn't work!
$.post(url, dataToBeSent, function(data, textStatus) {

   url="./doit.php";
   var dataToBeSent = $("myform").serialize();

var siteContents2 = data.contents;
document.myform2.outputtext2.value = siteContents2 ;

}, "json");

forms:
<form id="myform" name="myform" action="./ok1.php?Id=&title=" method="post">
<textarea rows="7" cols="15" name="outputtext" style="width: 99%;"></textarea>

</form>

<form id="myform2" name="myform2" action="./ok2.php?Id=&title=" method="post">
<textarea rows="7" cols="15" name="outputtext2" style="width: 99%;"></textarea>

</form>

php get data passed beg getjson:
$passed3 = $_post['dataToBeSent'];
echo $passed3;

A: You define the URL and data in the callback function. You need to define them before you call $.post(). You can try it with the code below, this is the 'shorthand' version with $.ajax().
JS
$.ajax(
{
    type: 'POST',
    url: './doit.php',
    data: $("#myform").serialize(),
    success: function(data)
    {
        $('.result').html(data);
        $('textarea[name="outputtext2"]').val(data);
    }
});

PHP
$formData = $_POST;
echo $formData['outputtext'];

More information about POST-requests with jQuery: http://api.jquery.com/jQuery.post/


text:
Q: How do I get javascript to write to the screen every time a prompted input is entered? My code is below.  My objective is to write a javascript code that will prompt a user to enter 1 for addition, 2 for subtraction, or 0 to quit.  When you enter 1 or 2 for addition or subtraction it is supposed to write to the screen "You have selected addition (or subtraction)", then prompt you to enter first number, then second number, then displays the result " (num1) added to (num2) the result is (sum)", all under a title in blue with a goldenrod background(that part I figured out).  I am a javascript newby.  What is happening is that it is writing everything on to the screen all at once when I input the last number.  How do I get it to write each part to the screen as it is being input?

<!DOCTYPE html>

        <meta charset="UTF-8">
        <title>Jeremy's Assignment 4 Solution</title>

         <button style="height:25px;width:100px" onclick="window.location='index.html'">HOME</button>


text:
Q: ASP.Net MVC 2 - Need To Add A Default Property To A Strongly Typed Html.Textbox Helper In Asp.Net MVC 2 I'm having a problem with something that I'm sure is very simple. I have been using Asp.Net MVC and I decided to start using Asp.Net MVC 2. Something has changed and now I need a little help. The strongly typed helpers are now written like this -
<%= Html.TextBoxFor(model => model.State) %>

I need to add a default value to a textbox. In the prior version of Asp.Net MVC it was easy to assign a default value. I thought doing the following would work in MVC 2-
<%= Html.TextBoxFor(model => model.CountyId, new{ value = 840 })%>

This, however, does not work for me in Asp.Net MVC 2. The value is still blank for the textbox. I want to make sure that this isn't some random error that I am having. Has anyone else encountered the same problem? I have searched and searched to find more information on the default property for the html helpers in MVC 2, but I can't find anything. Does anyone out there know how to correctly assign a default value to a textbox in Asp.Net MVC 2?

A: Actually, in case anyone else has this problem, using Value instead of value works. I think the issue is that value with a common v is a c# keyword.

A: If it's a constant value you could assign the default value to the property in your model instead (you can set it in your constructor or in a backing field if you use 'old-style' properties). Something like:
public class Model
{
   public int CountryId { get; set; }

   public Model()
   {
      this.CountryId = 840;
   }
}

Or if it varies per request, then set it in a View Model that you pass to your view from your controller.

A: OK. I have found the answer to my problem - sort of. The new Html.TextBoxFor in MVC 2 doesn't allow the setting of the value property using the object htmlattributes even though it retains the ability to set all of the other properties using this syntax-
<%= Html.TextBoxFor(model => model.CountryName, new { maxlength = "40" })%>

So to get around this issue, if you need to set a default value on a textbox field, you need to use the old syntax -
<%= Html.TextBox("CountryName", "Enter your country name")%>

That will add a default value property appropriately in the html.
The new TextBoxFor specification can't be used in this instance, but the value will still be returned back to the controller in the same way as the lambda expression. ALL of the other properties of the textbox can be set using textboxfor (maxlength, etc.) using the new { whateverProperty = value } syntax - just not the value property.

A: @Html.TextBoxFor(model => model.CountyId, new{ @value = 840 })

works in asp.net mvc3 razor syntax


text:
Q: Using Xnest between Mac OS X (Snow Leopard) and Ubuntu 10.10 I just installed an Ubuntu 10.10 desktop on a system to do some development work.  I would like to run the X server environment on my MacBook instead of keyboard hopping (the graphics system on the Ubuntu box is not so great).
Poking around on the web I uncovered the following command that I can run from a terminal in Mac OS X:
/usr/X11/bin/Xnest -geometry 1280x900 :1 & DISPLAY=:1 ssh -X -Y grog@ubuntusys gnome-session

Note I have ssh set up so authentication happens automatically.
This seems to work great -- the Ubuntu desktop appears on my Mac OS X screen! (It seems to be smart enough to start X11 if it isn't running already). However if I try to open any program, it dies out.  So close.
Any suggestions appreciated.
Update:  Thanks to the answer below that provides a tutorial link I learned how to do basic X forwarding.  You can do this from an X terminal window on the Mac simply like this:
ssh -X -Y username@targetsystem

then you can start X applications that run on the remote system but their windows are on the Mac X server.  The issue that I now have is I want to start the gnome desktop session:
gnome-session

but the problem there is that the session takes over the whole Mac desktop.  You cannot resize it or move it.  Worse, the top part of the windows managed by the window manager end up underneath the menu bar that Mac OS puts up there so you cannot access those controls.  I think this is a problem that Xnest was intended to solve, or am I misunderstanding what it is all about?

A: Use Xnest or Xephyr this way on your Mac OS X:
Xnest :1 -geometry 1280x800 -query 10.0.1.x
Xephyr :1 -screen 1280x1024 -query 192.168.1.x
The only thing you have to do is to enable remote login in your Linux by manually editing /etc/gdm/custom.cfg or using the gdmsetup GUI program. Here CentOS 5 is taken as an example. In Ubuntu things will be a little differrent.
This approach is very different to VNC which is like Microsoft's RDP (screen capture) while XDMCP utilizes the graphic power of your Mac to assist Linux system.
Remember that X11 was specifically designed to be used over network connections rather than on an integral or attached display device. X features network transparency: the machine where an application (the client application, for instance Firefox on Linux) runs can differ from the user's local machine (the display server, that is the X11 on your Mac). This approach allows both 2D and 3D operations to be fully accelerated on the user's local X server.

A: Depending on which version of OSX you're running, the best bet is probably the native Mac X11 Distribution.  It's on the install CD (or if you're like me you got Lion through the App Store, it is available in the Utilities folder by default).
Launching it (Applications > Utilities > X11) brings up a specific X11 x-terminal, which you can use to ssh forward over to your Ubuntu system.  That link in Answer 1 is pretty old, I found this one to be more helpful: http://www.craigryder.com/linux-ubuntudebetc/x11-forwarding-and-ssh-for-remote-linux-ubuntu-desktop/
The only extra option I use is the -C flag to enable compression when I run my ssh command.  Please note that you do NOT have to run a full gnome-session to use the X features - you can simply run the program you want (ie, $ gedit&).  This gets you out of using the whole desktop, but it is kind of weird since your Mac desktop still gets blacked out.  You can find more on this technique @ http://ubuntuforums.org/showthread.php?t=1373823&page=2
I also noticed that on 10.10 Ubuntu, my system showed the same odd UI control behaviors you mention, but those disappeared when I upgraded my distribution to Ubuntu 11.  I didn't really go to deep to see if simply upgrading X to the latest version on the 10.10 Ubuntu system would have fixed that issue, but I can confirm that it does not appear in 11.
One final note, this still seems to force the Mac X11 server into Full-Screen mode, but if you press COMMAND-ALT-A it immediately takes you out of the X desktop and back into your Lion desktop, which allows me to have both running and still be productive when I need to jump out of my Ubuntu system.  I seem to be able to always access all the title and menu bars for all of my X apps just as though I was sitting at the Ubuntu desktop.
One caveat - I'm running the above to connect to a VMWare Workstation VM running Ubuntu (with 3D acceleration enabled) on my workstation - connecting to actual hardware may (though I can't fathom how) result in slightly different behavior.
Hope this helped!

A: Is VNC not working for you?
Or regular X forwarding over SSH.


text:
Q: 'rbind' and 'lapply' work just fine, unless I need to append the filename I'm reading some csv files to create a dataframe, and append an additional column to it with the file name, using the following code:
wd <- "Working directory"
file_list <- list.files(wd)

### Function: read data ###
read_data <- function(file){
  d <- read.csv(paste(wd,file,sep=""), stringsAsFactors = FALSE, strip.white = TRUE, na.strings = c("NA","")); # read in every file in the working directory
  d$FileName <- substr(file,20,29); # append part of file name
  d # return the dataframe
}

### Call rbind: merge data ###
df <- do.call(rbind, lapply(file_list,read_data))

But this error comes up:
 Error in `$<-.data.frame`(`*tmp*`, "FileName", value = "2016010209") :
  replacement has 1 row, data has 0

What am I doing wrong?
Cheers

A: Always check the data! The file was corrupted, therefore empty!
Thanks for your help!


text:
Q: How to suppress warnings when plotting with ggplot When passing missing values to ggplot, it's very kind, and warns us that they are present. This is acceptable in an interactive session, but when writing reports, you do not the output get cluttered with warnings, especially if there's many of them. Below example has one label missing, which produces a warning.
library(ggplot2)
library(reshape2)
mydf <- data.frame(
  species = sample(c("A", "B"), 100, replace = TRUE),
  lvl = factor(sample(1:3, 100, replace = TRUE))
)
labs <- melt(with(mydf, table(species, lvl)))
names(labs) <- c("species", "lvl", "value")
labs[3, "value"] <- NA
ggplot(mydf, aes(x = species)) +
   stat_bin() +
   geom_text(data = labs, aes(x = species, y = value, label = value, vjust = -0.5)) +
   facet_wrap(~ lvl)

If we wrap suppressWarnings around the last expression, we get a summary of how many warnings there were. For the sake of argument, let's say that this isn't acceptable (but is indeed very honest and correct). How to (completely) suppress warnings when printing a ggplot2 object?

A: You need to suppressWarnings() around the print() call, not the creation of the ggplot() object:
R> suppressWarnings(print(
+ ggplot(mydf, aes(x = species)) +
+    stat_bin() +
+    geom_text(data = labs, aes(x = species, y = value,
+                               label = value, vjust = -0.5)) +
+    facet_wrap(~ lvl)))
R>

It might be easier to assign the final plot to an object and then print().
plt <- ggplot(mydf, aes(x = species)) +
   stat_bin() +
   geom_text(data = labs, aes(x = species, y = value,
                              label = value, vjust = -0.5)) +
   facet_wrap(~ lvl)

R> suppressWarnings(print(plt))
R>

The reason for the behaviour is that the warnings are only generated when the plot is actually drawn, not when the object representing the plot is created. R will auto print during interactive usage, so whilst
R> suppressWarnings(plt)
Warning message:
Removed 1 rows containing missing values (geom_text).

doesn't work because, in effect, you are calling print(suppressWarnings(plt)), whereas
R> suppressWarnings(print(plt))
R>

does work because suppressWarnings() can capture the warnings arising from the print() call.

A: A more targeted plot-by-plot approach would be to add na.rm=TRUE to your plot calls.
E.g.:
  ggplot(mydf, aes(x = species)) +
      stat_bin() +
      geom_text(data = labs, aes(x = species, y = value,
                                 label = value, vjust = -0.5), na.rm=TRUE) +
      facet_wrap(~ lvl)

A: In your question, you mention report writing, so it might be better to set the global warning level:
options(warn=-1)

the default is:
options(warn=0)


text:
Q: Not Understood an Aspect of Django So you see I'm learning the basics of Django from a course on YouTube by Rafeh Qazi.  In that course we were making a polls application following the Django at a glace documentation.  So on the third video we talked about something called Namespacing URL names. And I didn't quit understand it. Can anyone please tell me about it You See here is how the tree view of my project look like:

    ## Django Crash Course ##
       -> ### mysite ###
          > folder: _pycache_
          > __init__.py
          > asgi.py
          > settings.py
          > urls.py
          > wsgi.py

       -> ### polls ###
          > folder: _pycache_
          > folder: migrations
          > folder: templates
             > folder: polls
                 > index.html
                 > detail.html
          > __init__.py
          > admin.py
          > apps.py
          > models.py
          > test.py
          > urls.py
          > views.py
       > .gitignore
       > db.sqlite
       > manage.py

I may not be able to show you the images of my code I can take you there:
follow this link: My Github project

A: As your project grows you may have up to 20 or so apps and each one of those apps can have different URLs.
For example, you can have a page called home under your polls app and a page called the same under another app called someapp.
If you don't use namespaces a call to home page in a template can have issues but with namespaces, you can use them in templates by mentioning the app name before it (like 'polls:home').


text:
Q: Use mocked function return value in real function call Is it possible to use a mocked function inside a real function call? Both functions are in the same object. So for example, if I have
obj A {
  def mockThis(value: Int): Int = {
    value*5
  }

  def realFuncIWantToTest(value: Int): Int = {
    val v = mockThis(value)
    v
  }
}

Obviously this is an extremely simple case and this isn't what my code is doing (v is actually a complicated object). Essentially I want realFuncIWantToTest to use the mocked function return value that I define.
Thanks!

A: You might be able to do this using Mockito's spies; see here for an example on that.
Spies basically work by having that spy wrapping around a real object of your class under test.
But one word here: even when it is possible, please consider changing your design instead. This "partial mocking" is often a good indication that your class is violating the single responsibility principle. Meaning: a class should be responsible for "one" thing. But the idea that you can / have to partially mock things within your class indicates that your class is responsible for at least two, somehow disconnect aspects.
In that sense: the better approach would be that mockThis() would be a call on another object; which could be inserted via dependency injection into this class.
Long story short: at least on a Java level your idea should work fine (where I have certain doubts that Mockito will work nicely with your scala objects) from a technical perspective; but from a conceptual point point; you should rather avoid doing it this way.


text:
Q: Why is the output of the following code not zero? {
    double A = 373737.0;
    double B;

    B = A*A*A + 0.37/A - A*A*A - 0.37/A;
    printf("The value of B is %f.\n", B);
}

In this C code, why is the value of B not zero, but instead -0.000001?

A: Several people have mentioned in comments that neither 0.37 nor 0.37/373737.0 can be represented accurately in binary floating point, which is true. But that's a bit of a red herring. You could replace 0.37/A with 1, which is clearly representable accurately in floating point, and you'd still get an odd result. Perhaps that odd result would be more revealing. It's certainly worth trying the experiment yourself.
Floating point arithmetic might turn out differently on different machines (although these days, that's uncommon) but under most circumstances, in a single program run on a single machine, 0.37/373737.0 will always be the same value. So you might expect that the two instances of 0.37/A will cancel out.
And they would have, had you written A*A*A - A*A*A + 0.37/A - 0.37/A. But that's not the order you did the operations, and the result is the round-off error that you experienced. The problem is that A*A*A is quite a large number, well outside the range of integers which can be represented accurately in a 64-bit double. And moreover, 0.37/A is a small number. Consequently, A*A*A + 0.37/A is exactly the same as A*A*A; the exact sum is quite a bit smaller than the next larger double-precision value.
Thus, A*A*A + 0.37/A - A*A*A is 0; the 0.37/A simply vanishes. And then A*A*A + 0.37/A - A*A*A - 0.37/A is -0.37/A, which is approximately 0.000001 (if you printed it with more precision, you'd see a more accurate output).
Standard C does not allow the compiler to regroup floating point computations, because it would make it impossible to predict the result. If you need a particular order of evaluation to avoid numeric instability, you have to do it yourself. (GCC does provide the -funsafe-math-optimizations flag, which can violate the C standard, produce unpredictable results, and sometimes accidentally produce the result you expected. Don't use it. It's unsafe.)
And part of learning how to write numerical programs is learning how to reorder your computations to avoid this type of error. One rule is, never subtract two large but similar numbers, since that will produce a wildly inaccurate result. (That's the rule which your expression breaks.)
Any good text book on numerical computation should go into much more detail about these issues. You could also start with the venerable essay, already mentioned in comments, What every computer scientist should know about floating point arithmetic.

A: If your math gives irrational or repeating numbers after one or more opraters is done, the computer will cut it off or rounded, therefor, it's not 0. This is called round off error.

A: There are many reason may be you expression opration become out of range of double variable.You are printing double value using float format pacifier.Resolve this may it will give you desired output.


text:
Q: Prolog DCG read from file with separotr I'm making my first steps in Prolog, but I have encountered a problem.
I'm trying to read from a file records separated by comma
upto_comma(Codes) --> string(Codes), ",", !.
list_w([W|Ws]) --> upto_comma(W), [W] ,list_w(Ws).
string([]) -->  [].
string([H|T]) -->[H],string(T).

but all I got is a list with the single characters, while what I wanted is a list of element. For example from
cat,dog,table

I want [cat,dog,table] and I got [c,a,t,d,o,g,t,a,b,l,e].
I have tried to change upto_comma in
upto_comma(Atom) --> string(Codes), ",", !,{ atom_codes(Atom, Codes) }.

but nothing changed.
I think there's some basic concept I misunderstood, anybody can help?
I'm using SWIProlog

A: Your grammar misses the base case of list_w//1, and I can't understand why after upto_comma(W) you require the same thing just read.
I would write this way
list_w([W|Ws]) --> string(W), ",", !, list_w(Ws).
list_w([W]) --> string(W).

string([]) -->  [].
string([H|T]) -->[H],string(T).

test:
?- phrase(list_w(S),"cat,dog").
S = [[99, 97, 116], [100, 111, 103]] ;
false.

A: Interesting; I don't get that result from the code you show; I just get a failure to parse the input.
First, think about what your string rule recognizes.  Does it recognize any string of characters? Or only strings of characters that don't have a comma?
Then think about how the list_w terminates.  What code handles the case of the final "table" in your input?  It can't be upto_comma, because that requires that "table" be followed by a comma.  And list_w doesn't have any right hand side that doesn't include upto_comma.


text:
Q: Почему обрезает изображение? При медиа запросе на адаптив:

/*Reviews - Slider*/
.section--top{
 margin-top: -80px;
}
.reviews{
 position: relative;
}

.reviews .slick-slider{
 padding: 0px 70px;
}

.reviews__item{
 min-height: 210px;
 padding-left: 260px;
 position: relative;
}
.reviews__photo{
 display: block;
 width: 210px;
 height: 210px;
 border-radius: 50%;
 position: absolute;
 top: 50%;
 transform: translateY(-50%);
 left: 0px;
 z-index: 1;
}
.reviews__text{
 font: 300 italic 24px/1.5 'Roboto', sans-serif;
}
.reviews__author{
 font: 400 24px 'Kaushan Script', sans-serif;
 color: #333;
 margin-top: 10px;
}
.reviews__author:before{
 content: "";
 display: inline-block;
 vertical-align: middle;
 width: 60px;
 height: 3px;
 margin-right: 10px;
 background-color: #f38181;
}

.slick-arrow{
 font-size: 0;
 color: transparent;

 position: absolute;
 top: 50%;
 z-index: 1;

 border: 0;
  background: 0;
  cursor: pointer;
}

.slick-arrow:focus{
 outline: 0;
}

.slick-arrow:after{
 content:"";
 display: block;
 width: 16px;
 height: 16px;

 border-top: 2px solid #ccc;
 border-right: 2px solid #ccc;
}

.slick-prev{
 left: 0;
 transform:  rotate(-135deg);
}

.slick-next{
 right: 0;
 transform:  rotate(45deg);
}

@media screen and (max-width: 860px){
 .reviews__text{
  font-size: 18px;
 }
 .reviews__photo{
  width: 150px;
  height: 150px;
 }
 .reviews__item{
  padding-left: 190px;
 }
}
@media screen and (max-width: 768px){
 .section--gray{
  padding: 50px 0;
 }
 .reviews__photo{
  position: static;
  transform: translateY(-15%);
  margin: 0 auto;
  min-height: 150px;
 }
 .reviews__item{
  padding-left: 0;
 }
}
@media screen and (max-width: 576px){
 .reviews .slick-slider{
  padding: 0px 25px;
 }
 .reviews__author{
  font-size: 20px;
 }
 .slick-arrow{
  top: 18%;
 }
}

        "Lorem ipsum dolor sit amet,
        consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
        Ut enim ad minim veniam, quis nostrud exercitation."

Jon Doe

Изображение вставлено в Slick-Slider может он обрезает? Как исправить?
Тут нормально http://prntscr.com/r2oiil
a тут обрезает
 http://prntscr.com/r2o8mp

A: Проблема скорее всего здесь translateY(-15%);
Для моб версии сделайте так
@media screen and (max-width: 768px){
    .reviews__photo{
        position: static;
        transform: translateY(0); // делаем равным 0
        margin: 0 auto 15px auto; // делаем отступ снизу 15px
        min-height: 150px;
    }
}

A: Если правильно понимаю вопрос, то так должно быть?
ps Поспешил дать ответ и не обратил внимание, @soledar10 правильно уже написал. Дело в этом:

Для мобильной версии пропишите
@media screen and (max-width: 768px){
      .section--top{
          margin-top: 0;
      } }

translateY(-15%); здесь не причем.

/*Reviews - Slider*/
.reviews{
 position: relative;
}

.reviews .slick-slider{
 padding: 0px 70px;
}

.reviews__item{
 min-height: 210px;
 padding-left: 260px;
 position: relative;
}
.reviews__photo{
 display: block;
 width: 210px;
 height: 210px;
 border-radius: 50%;
 position: absolute;
 top: 50%;
 transform: translateY(-50%);
 left: 0px;
 z-index: 1;
}
.reviews__text{
 font: 300 italic 24px/1.5 'Roboto', sans-serif;
}
.reviews__author{
 font: 400 24px 'Kaushan Script', sans-serif;
 color: #333;
 margin-top: 10px;
}
.reviews__author:before{
 content: "";
 display: inline-block;
 vertical-align: middle;
 width: 60px;
 height: 3px;
 margin-right: 10px;
 background-color: #f38181;
}

.slick-arrow{
 font-size: 0;
 color: transparent;

 position: absolute;
 top: 50%;
 z-index: 1;

 border: 0;
  background: 0;
  cursor: pointer;
}

.slick-arrow:focus{
 outline: 0;
}

.slick-arrow:after{
 content:"";
 display: block;
 width: 16px;
 height: 16px;

 border-top: 2px solid #ccc;
 border-right: 2px solid #ccc;
}

.slick-prev{
 left: 0;
 transform:  rotate(-135deg);
}

.slick-next{
 right: 0;
 transform:  rotate(45deg);
}

@media screen and (max-width: 860px){
 .reviews__text{
  font-size: 18px;
 }
 .reviews__photo{
  width: 150px;
  height: 150px;
 }
 .reviews__item{
  padding-left: 190px;
 }
.section--top{
 margin-top: -80px;
}
}
@media screen and (max-width: 768px){
 .section--gray{
  padding: 50px 0;
 }
 .reviews__photo{
  position: static;
  transform: translateY(-15%);
  margin: 0 auto;
  min-height: 150px;
 }
 .reviews__item{
  padding-left: 0;
 }
}
@media screen and (max-width: 576px){
 .reviews .slick-slider{
  padding: 0px 25px;
 }
 .reviews__author{
  font-size: 20px;
 }
 .slick-arrow{
  top: 18%;
 }
}

        "Lorem ipsum dolor sit amet,
        consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
        Ut enim ad minim veniam, quis nostrud exercitation."

Jon Doe


text:
Q: Any tool to automatically de-normalize a database? I have got a normalized transactional database. I am setting up a data warehouse for reporting purposes. Are there any tools which will automatically make de-normalization suggestions? Or something to automate database changes in that manner?

A: Not that I know of.  However, Kimball's design method is relatively straightforward, so it should be able to be suported with some kind of semi-automation if you identify the facts and have foreign key relationships defined in your database.
I built a tool which flattens out Kimball stars based on the FK metadata in the database to build views which can be used in the application, so I image something similar could work on a normalized DB - it just wouldn't be as simple as starting from the fact table and starring out based on the FK relationships.


text:
Q: read pyspark json files and concat I have 999 gz files located in s3 bucket. I wanted to read them all and convert pyspark dataframe into pandas dataframe, it was impossible due to large files. I am trying to take a different approach - reading each single /gz file THEN convert it to pandas df - reduce number of columns and then concatenate it into one big pandas df.
spark_df = spark.read.json(f"s3a://my_bucket/part-00000.gz")

part-000000.gz - this is zipped json, 0000 is the first one and 00999 is the last one to read. COuld you please help me unpack them all and later on concatenate pandas df.
Logic:

*

*Read all json files:
spark_df = spark.read.json(f"s3a://my_bucket/part-00{}.gz")

*convert to pandas
pandas_df = spark_df.toPandas()

*reduce columns (only few needed column)
pandas_df = pandas_df[["col1","col2","col3"]]

*merge all the 999 pandas df into one
full_df = pd.concat(for loop, to go through all the pandas dataframes)
This is the logic in my head, but I have difficulties to code it.
EDIT:
I started writing the code but it does not show me pandas_df:
for i in range(10,11):
    df_to_predict = spark.read.json(f"s3a://my_bucket/company_v20_dl/part-000{i}.gz")
    df_to_predict = df_to_predict.select('id','summary', 'website')
    df_to_predict = df_to_predict.withColumn('text', lower(col('summary')))
    df_to_predict = df_to_predict.select('id','text', 'website')
    df_to_predict = df_to_predict.withColumn("text_length", length("text"))
    df_to_predict.show()
    pandas_df = df_to_predict.toPandas()
    pandas_df.head()

Also I've notice this solution will be faulty for part00001 / part00100 etc <- range does not "fill up" with zeros.

A: Your end dataframe is 200k rows * 4 cols * 999 files ~= 200M * 4 cols which is still large dataset for Pandas.
Now that Pyspark can run Pandas code (distributed), unless there is any specific reason, I would recommend keep it in Pyspark dataframe or convert it to Pandas-on-Spark dataframe in case you need specific Pandas opertaions.
Pseudo code
df = spark.read.json(f"s3a://my_bucket")  # Read all, Spark will distribute your data and apply operations.
df = df.select('col1', 'col2', 'col3')
# df = df.withColumn('something', ...)

# Convert to Pandas-on-Spark dataframe which can apply Pandas operation but is distributed
pdf = df.to_pandas_on_spark()
pdf.groupby('col1').min()

Ref: https://spark.apache.org/docs/3.2.0/api/python/user_guide/pandas_on_spark/pandas_pyspark.html

A: here is a possible solution:
s3 = session.resource('s3')
my_bucket = s3.Bucket("bucket-name")
for obj in my_bucket.objects.filter(Prefix=f"/output/"): ##path to folder where parts are located.
    do something with obj
    my_bucket.download_file(obj.key,f'download/filename.gz')

refer to Listing contents of a bucket with boto3
convert them all to a dataframe and append to the root dataframe. I hope this helps


text:
Q: How to get image path in text format using PHP? How to get image path in text format using PHP?
I have text format like this:

TEST  TEST

My code is:
<?php
$str='
TEST  TEST

';

libxml_use_internal_errors( true );
$dom=new DOMDocument;
$dom->validateOnParse=false;
$dom->standalone=true;
$dom->strictErrorChecking=false;
$dom->recover=true;
$dom->formatOutput=false;
$dom->loadHTML( $str );
libxml_clear_errors();
$xp=new DOMXPath( $dom );
$col=$xp->query('//img');
$images=array();
foreach( $col as $img ) $images[]=$img->getAttribute('src');
echo $images[0];
?>

When I test my code, it shows:
\"https://www.google.co.th/images/branding/googlelogo/2x/googlelogo_color_272x92dp.png\"

I want to know how to change my code to show:
https://www.google.co.th/images/branding/googlelogo/2x/googlelogo_color_272x92dp.png

A: echo substr($images[0],2,strlen($images[0])-5);
If I am not wrong if $images[0] =\"https://www.google.co.th/images/branding/googlelogo/2x/googlelogo_color_272x92dp.png\"
Then substr function will take $images[0] string to be sliced, it will start from index 2 and get strlen($images[0])-5 pieces of char which is strlen($images[0]) is the size of the string - 5 then it will produce the result you want.

A: Can should use stripslashes to remove the and if you want html entities in their applicable characters, use html_entity_decode.
So, your echo should look something like:
echo stripslashes(html_entity_decode($images[0]));

OR
echo stripslashes($images[0]);

depending upon if you want to convert html entities as well.