text:
Q: SQL how to structure a database where elements frequently change values I am trying to create a database for a sport which has many leagues and within those leagues there are many teams which contain players that frequently change leagues and teams.
I would like to know the best way to go about structuring a database so that I can keep track of when a player changes teams as well as knowing which teams they have been on and when.
Btw I am very new to SQL so any advice would be greatly appreciated.

A: The first thing to do is consider the core elements. You said Leagues, teams and players and you also want some means of logging a player changing teams and I'd guess also teams changing leagues.
So that could be 5 tables -

*

*a league table

*a team table

*a player table

*a history (including current) of what league a team is in

*a history of what team (including current) a player is in (and therefore has been in)

So I believe the following may be along the lines of a suitable structure (populates with some testing the data as well) :-
DROP TABLE IF EXISTS player;
DROP TABLE If EXISTS team;
DROP TABLE IF EXISTS leauge;
DROP TABLE IF EXISTS team_league_history;
DROP TABLE IF EXISTS player_team_history;

CREATE TABLE IF NOT EXISTS league (league_id INTEGER PRIMARY KEY, league_name TEXT);
-- Add some leauges
INSERT INTO league (league_name) VALUES
    ('1st Division'),('2nd Division'),('3rd Division'),('4th Division');

CREATE TABLE IF NOT EXISTS team (team_id INTEGER PRIMARY KEY, team_name TEXT);
-- Add some teams
INSERT INTO team (team_name) VALUES
    ('Team A'),('Team B'),('Team C'),('Team D'),('Team E'),('Team F'),('Team G'),('Team H'),('Team I'),('Team J'),('Team K')
;

CREATE TABLE IF NOT EXISTS player (player_id INTEGER PRIMARY KEY, player_name);
-- Add some players
INSERT INTO player (player_name) VALUES
    ('P0'),('P1'),('P2'),('P3'),('P4'),('P5'),('P6'),('P7'),('P8'),('P9'),
    ('P10'),('P11'),('P12'),('P13'),('P14'),('P15'),('P16'),('P17'),('P18'),('P19'),
    ('P20'),('P21'),('P22'),('P23'),('P24'),('P25'),('P26'),('P27'),('P28'),('P29'),
    ('P30'),('P31'),('P32'),('P33'),('P34'),('P35'),('P36'),('P37'),('P38'),('P39'),
    ('P40'),('P41'),('P42'),('P43'),('P44'),('P45'),('P46'),('P47'),('P48'),('P49')
;

CREATE TABLE IF NOT EXISTS team_league_history (
    tlh_team_reference INTEGER,
    tlh_league_reference INTEGER,
    tlh_from_date TEXT DEFAULT CURRENT_DATE,
    tlh_to_date TEXT DEFAULT '3000-12-31'
);
-- Add current standings
INSERT INTO team_league_history (tlh_team_reference,tlh_league_reference) VALUES
    (6,3), -- Team F in 3rd Div
    (1,4), -- Team A in 4th div
    (2,1),(3,1),(11,1),
  (4,2),(7,2),(9,2),
    (5,3),(10,3),
    (8,4)
;

CREATE TABLE IF NOT EXISTS player_team_history (
    pth_player_reference INTEGER,
    pth_team_reference INTEGER,
    pth_from_date TEXT DEFAULT CURRENT_DATE,
    pth_to_date TEXT DEFAULT '3000-12-31'
);
-- Add current team composition
INSERT INTO player_team_history (pth_player_reference, pth_team_reference) VALUES
    (1,1),(2,1),(3,1),(4,1),(5,1),(6,1),(7,2),(8,2),(9,2),(10,2),
        (11,3),(12,3),(13,3),(14,3),(15,4),(16,4),(17,4),(18,4),(19,4),(20,4),
        (21,5),(22,5),(23,5),(24,5),(25,5),(26,6),(27,6),(28,6),(29,6),(30,6),
        (31,7),(32,7),(33,7),(34,7),(35,7),(36,8),(37,8),(38,8),(39,8),(40,8),
        (41,9),(42,9),(43,9),(44,9),(45,9),(46,10),(47,10),(48,11),(49,11),(50,11)
;

may be more to come in the way of example uses of the above
Example based upon the above :-
Teams in each League
--List Teams in each League
SELECT league_name AS Leauge, group_concat(team_name) AS Teams
FROM team_league_history
    JOIN league ON tlh_league_reference = league_id
    JOIN team ON tlh_team_reference = team_id
GROUP BY league_id
;

*

*Results in

Players in Teams
-- Players in Teams
SELECT team_name AS Team, group_concat(player_name) AS Players
FROM player_team_history
    JOIN team ON pth_team_reference = team_id
    JOIN player ON pth_player_reference = player_id
GROUP BY team_name
;

*

*Results in

Players in teams with with league
-- Players in Teams and Leauge
SELECT team_name AS Team,
group_concat(player_name) AS Players,
 (
        SELECT league_name
        FROM team_league_history
            JOIN league ON tlh_league_reference = league_id
        WHERE tlh_team_reference = team_id
    )AS League
FROM player_team_history
    JOIN team ON pth_team_reference = team_id
    JOIN player ON pth_player_reference = player_id
GROUP BY team_name
ORDER BY league, team
;

- Results in

The perhaps consider :-
-- Making changes
-- 1 Change a Team name
UPDATE team SET team_name = 'My changed name' WHERE team_name = 'Team B';

-- Adjust some League compositions
-- DROP Team B and K down to Div 2
UPDATE team_league_history SET tlh_league_reference = 2 WHERE tlh_team_reference = 2 or tlh_team_reference = 11;
UPDATE team_league_history SET tlh_league_reference = 1 WHERE tlh_team_reference = 4 or tlh_team_reference = 9;

-- Move some players between teams (not history though)
-- Hopefully players P35-37 (id's 36-38) moved to team A
UPDATE player_team_history SET pth_team_reference = 1 WHERE pth_player_reference > 35 AND pth_player_reference < 39;

The Player, Team, League would then be :-

History
The above demonstrations are all changes to the current (cheated using DEFAULT CURRENT_DATE when inserting and DEFAULT 3000-12-31).
but history (both tables) would/could have many rows per player (pth) or team (lth) with the from_date-to_date covering the period that the situation existed (team was in league, player was in a team). The absence of a row covering a period would indicate non-existence (team broke up/disbanded, player in hospital/jail or something, although if such events could themselves potentially have a history row along with an event indicator (if that's the right term) table).
Note

*

*the above has been manipulated based upon numeric references e.g. P25 equates to player_id 26 (names were selected for convenience), which us mere mortals tend to get confused with. Typically though the user(s) would be using an graphical interface an be oblivious to the fact that Joe Bloggs is id x, they just select Joe Bloggs.

A:
You should also check out temporal tables - they would give you the ability to keep historical information about a players relationship with a given team at any moment in time.


text:
Q: Change css in a Bootbox window How can I add styling (let's say bold attribute) to the "Hello world" in this code:
bootbox.alert("Hello world!", function() {
   Example.show("Hello world callback");
});

Thank you

A: The best thing to do is to inspect the popup with firebug and you can see the HTML that makes up the modal window, so you can write css for it. Looking at the example on their website, here is the html that makes up a basic example:

Hello world!

OK

So if you wanted to change the footer colour:
.modal-footer {background:#c00;}

A: Expanding on James King's answer:
using firebug's console you can see that the response to the command:
bootbox.alert('hello world')

is a reference to the bootbox containing div element; Object[div.bootbox]
So it's very easy to totally redefine the alert when you call it by simply changing its css attributes:
bootbox.alert('Danger!!' ).find('.modal-content').css({'background-color': '#f99', 'font-weight' : 'bold', color: '#F00', 'font-size': '2em', 'font-weight' : 'bold'} );

A: You can create a 0 opacity empty div:

then you can simple use a opacity change on js:
 bootbox.alert(x, function() {
document.getElementById('msgbox').innerHTML = x; document.getElementById('msgbox').style.opacity= '1'; setTimeout(function(){ document.getElementById('msgbox').style.opacity = '0'; }, 2000);  });

and you can freely style the msgbox, with position, colors or even using some transition
#msgbox { color: #CC0000; font-weight: bold; text-align: center; transition: all 1s linear; -webkit-transition: all 1s linear; }

A: Let's sum up:
For styling text
Add directly the html to your string:
bootbox.alert("Hello world!"); // (thanks BenM)
bootbox.alert("
Hello world!
"); // (thanks Adriano)

For styling built-in bootbox elements
Use the returning jQuery object to change classes, css, etc.:
var box = bootbox.alert("Hello world!");
box.find('.modal-content').css({'background-color': '#f99'}); // (thanks Mark B)
box.find(".btn-primary").removeClass("btn-primary").addClass("btn-danger");

A: Asumming Example.show(); is putting this code somewhere on the page, wrapping the element with strong will work:
 bootbox.alert("Hello world!", function() {
   Example.show("Hello world callback");
 });

redpajama_set_name: RedPajamaStackExchange


text:
Q: Simulating Linux-like admin privilege enabling in Windows 10 In Linux, when we execute a script/application/command line which needs sudo, it ask for the password even current logged account has sudo privileges.
In Windows, if admin user account is logged in, all it asks for executing the app is clicking a button. For implementing this kind of procedure in Windows 10, I created 2 different accounts that one is normal and other is with admin privileges. So far it satisfies the needs when we execute a privilege needed process on normal account, it asks for the password of admin account. But problem starts when switching between user files (Interraction between Normal user desktop and admin user application doesn't work).
Basically, I would like to create a sudo alike user in Windows 10. Any suggestions?

A: In Windows , you can run an application as admin , even though logged in as normal user
Do a right click on application -> compatiblity -> (change settings for all users)


text:
Q: hash_hmac in using pure classic ASP I want to know, is there any way to achieve hash_hmac("sha256", $token, $signkey, true) (php) in classic ASP?
I need it to verificate the signed_request from Facebook
https://developers.facebook.com/docs/howtos/login/signed-request/
// Adding the verification of the signed_request below
$expected_sig = hash_hmac('sha256', $payload, $secret, $raw = true);
if ($sig !== $expected_sig) {
  error_log('Bad Signed JSON signature!');
  return null;
}

A: I have been using a file I found on an Amazon forum. This is the thread:
https://forums.aws.amazon.com/message.jspa?messageID=147377
It uses a .wsc file, which is just a JScript file that defines a object you can use in your ASP code. Like this:
' ### be sure to have sha256.wsc in the same folder as this script
    Dim sha256
    Set sha256 = GetObject( "script:" & Server.MapPath("sha256.wsc") )
    sha256.hexcase = 0

    Dim result
    result = sha256.b64_hmac_sha256( secretkey, stringtosign )

This is a file which was originally used to sign request to the Amazon API. For reasons I don't understand this included this line of code in .wsc file:
d=d.replace ( /\s/g, "\n");

This converts all whitespace characters, including spaces, to '\n'. Hard to believe that spaces need to be converted to "\n". Anyway, I had to comment out this line to make the code work for me! And it does work. I have been using it for a while without problems.
From the sha256.wsc file:
/*
 * A JavaScript implementation of the Secure Hash Algorithm, SHA-256, as defined
 * in FIPS 180-2
 * Version 2.2 Copyright Angel Marin, Paul Johnston 2000 - 2009.
 * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet
 * Distributed under the BSD License
 * See http://pajhome.org.uk/crypt/md5 for details.
 * Adapted into a WSC for use in classic ASP by Daniel O'Malley
 * (based on an SHA-1 example by Erik Oosterwaal)
 * for use with the Amazon Product Advertising API
 */

Direct link to the sha256.wsc file:
https://forums.aws.amazon.com/servlet/JiveServlet/download/9-34858-139271-2601/sha256.wsc
I have been unable to find an official download site.

A: have a look at the microsoft capicom.dll. you can download it here
the reference can be found here
another option is to implement the function with a .net class and make that "com visible" so you can use the .net DLL from classic asp...

A: Check how to we are using a javascript implementation of cryptography algoritms in this repository: https://github.com/ictmanagement/redsysHMAC256_API_ASP
If you open this file: https://github.com/ictmanagement/redsysHMAC256_API_ASP/blob/master/include/dvim_apiRedsys_VB.asp, you will find how we get same result as php function hash_hmac("sha256", $token, $signkey, true)
    '/******  MAC Function ******/
    'recibe String|WordArray , retorna WordArray
    Private Function mac256(ent, key)
        Dim encWA
        Set encWA = ConvertUtf8StrToWordArray(ent)
        Dim keyWA
        Set keyWA = ConvertUtf8StrToWordArray(key)
        Dim resWA
        Set resWA = CryptoJS.HmacSHA256(encWA, keyWA)
        Set mac256 = resWA
    End Function


text:
Q: Where is the energy lost in a spring? Thinking about springs, and their extensions, I recently came to a confusion which I hope this wonderful community can help me solve.

The question is this. When the block is initially attached to the spring, the spring has some extension $x_0$. Now the spring gets extended to some extension $x=\frac{mg}k$ by an external force maintaining equilibrium at all the points such that $KE=0$ at the bottom.
As my reference is the line shown in the figure, the initial potential energy $U$ is 0 due to both gravity and spring potential energy($x=0$).
Now as the block comes down, the spring potential energy is:
$U_(spring)=\frac12kx^2$.   Final extension is $\frac{mg}k$. So spring potential energy is $\frac{m^2g^2}{2k}$
But the decrease in gravitational potential energy is $mgx$ which equals $\frac{m^2g^2}k$.
This means that potential energy has decreased. Intitially, $U_{net}=0$ but finally $U_{net}=-\frac{m^2g^2}{2k}$.
Where if any, did this energy get compensated(to ensure COE is still true)?

A: You're missing a somewhat subtle point in your analysis. The block on the left in your diagram, where the spring is at its equilibrium position, is moving, so it has kinetic energy (which you're currently ignoring). I'll leave it to you to sort out what the speed needs to be and check that CoE holds.
It needs to be moving because, if it were not, then there must be some force (your hand?) holding it in place. This would count as an external force, and when such a force acts, CoE does not hold.

A: The "missing" energy you're referring to actually left the block-spring system when the external force was interacting with the block. One way to think about it is the following.
The work-kinetic energy theorem tells us that, since the KE of the block doesn't change during the lowering process, the net work done on the block is 0:
$$W_{net}=\Delta \mathrm{KE}=0,$$
but the net work done on the block may be written as
$$W_{net}=W_{grav}+W_{spring}+W_{external}.$$
Gravity, the spring, and the external agent (i.e. my hand) are all doing work on the block, and the sum of these must be 0, since KE didn't change. Gravity does positive work, since displacement is in the same direction as the force of gravity. The spring and the external agent do negative work, since their forces are applied in the opposite direction of the displacement:
$$W_{grav}=mgx=\frac{m^2g^2}{k}.$$
The work done by the spring is equal to minus the amount of potential energy it gains (in other words, the spring does negative work on the block, the block does positive work on the spring), so
$$W_{spring}=-\frac{1}{2}kx^2=-\frac{m^2g^2}{2k},$$
and, from the work kinetic energy theorem, we then have
$$0=W_{grav}+W_{spring}+W_{external}\implies W_{external}=-\frac{m^2g^2}{k}+\frac{m^2g^2}{2k}=-\frac{m^2g^2}{2k}.$$
So the external agent does negative work on the spring (or the spring does positive work on the external agent), which exactly accounts for the energy that you noticed that was "missing".

A: Imagine you extend spring from $x_0$ to x by adding a weight, rather than by pushing down with you hand. This will help to illustrate why COE only works if you take all relevant forces into account.
So, you add a weight of mass M to the original setup. Your new equilibrium position is where gravitational force = spring force.
Gravity => F=mg + Mg   (m is the original mass of the block, M is the additional).
Spring => F=kx  so...
kx = mg+Mg
(incidentally I don't think you can say that kx=mg as you do, mg is not enough force to keep the spring extended at x, mg gets you to x0, the original extension)
But how did we get to this point?  Intuitively you know that if I added a weight of mass M, the system starts moving, it has to move to reach the new extension. Hence there is now Kinetic Energy, which means we are in the wonderful world of harmonic motion unless something stops us...
But your scenario isn't moving (you make this clear in your question).  So something has happened to stop the system. An external force has stopped us (e.g. frictional losses over time).
This is your missing energy. As another answer has pointed out, an external element (e.g. hand+arm+shoulder etc) has done work to stop the block at extension X.  Or, over time the kinetic energy was lost to friction. Either way, it is gone or stored in external potential energy (see below)
Another way to think about it, is to imagine you have a steel rod holding the weight down - so no hand, no new weight.  In this scenario you'd have potential energy stored in the rod, which will have bent slightly.


text:
Q: foreignkey column in object relation model in C# why in ORM(object relation model) Model in this sample foreignkey column publisher in book class is a class of publisher,while where we could use of a long type(in database publisher is  foreignkey and Bigint)?
public class Publisher
{
    [XmlAttribute]
    public string Title { get; set; }
    [XmlAttribute]
    public string Address { get; set; }
}

public class Book
{
    [XmlElement]
    public Publisher Publisher { get; set; }  ******
    [XmlAttribute]
    public string Title { get; set; }
    [XmlAttribute]
    public short PrintYear { get; set; }
    [XmlAttribute]
    public short Pages { get; set; }
    [XmlAttribute]
    public string ISBN { get; set; }
}

A: This is to make your life easier. In your database the table BOOK has a PublisherId that is a foreign key to the table PUBLISHER. To avoid the need to write relational joins in your C# code as you need to do in SQL, your Book class has a property of the referenced type Publisher, so you can directly access it. This also conforms more to OOD principles.
Example:
If your class Book only had a public int PublisherId {get;set;}, you would need the following code to get the publisher's Title:
Book book = ...
Publisher publisher = context.Publishers
                             .Where(x => x.PublisherId == book.PublisherId)
                             .SingleOrDefault();
if(publisher != null)
    Console.WriteLine(publisher.Title);

With the current Book class, this is shorter and easier to read:
Book book = ...
Publisher publisher = book.Publisher;
if(publisher != null)
    Console.WriteLine(publisher.Title);


text:
Q: Angle between the hour and minute hands at 6:05
What is the angle between the hour and minute hands of a clock at 6:05?

I have tried this
Hour Hand:
12 hour = 360°
1 hr = 30°
Total Hour above the Clock is $\frac{73}2$ hours
In Minute Hand:
1 Hour = 360°
1 minutes = 6°
Total Minutes covered by $6\times 5= 30$
$\frac{73}{2} \cdot30-30=345^\circ$ Is it Correct?

A: Your approach is correct, but the hour is $6+\frac{5}{60}=\frac{73}{12}$, not $\frac{73}{2}$.
This yields an angle of $\frac{73}{12}\cdot30^\circ$ for the hour hand, and $6^\circ\cdot 5=30^\circ$ for the minute hand.
Thus the end result is $\frac{73}{12}\cdot30^\circ-30^\circ=152.5^\circ$

A: The hours hand revolves $360°/(12\cdot60)=0.5°$ per minute and the minutes hand $360°/60=6°$ per minute, so that the angle increases by $5.5°$ per minute.
Hence working modulo $360°$, $$(6\cdot60+5)\cdot5.5°=2007.5°\equiv-152.5°=-152°30'.$$
The negative sign is because the hours hand is ahead.

A: Let $\alpha$ be the angle in degrees of the hour hand, measured with reference to $12$ and $\beta$ be the angle in degrees of the minute hand measured with reference to $12$.
At 6:05, the minute hand has moved $\frac{1}{12}$ of the  way around the clock. Thus, $\beta=\frac{360^{\circ}}{12}=30^{\circ}$.
The hour hand has moved $\frac{1}{12}$ of the way from $6$ to $7$. In other words, $\frac{1}{12}\cdot\frac{1}{12}=\frac{1}{144}$ of the way from the $6$. Thus, $\alpha=180+\frac{360}{144}=182.5^{\circ}$.
Therefore, the angle between the two hands is $\alpha-\beta=182.5^{\circ}-30^{\circ}=152.5^{\circ}$.

A: The time in minutes (let's ignore the seconds, as there are none here) is 6*60 + 5 = 365 minutes.
The angle for a hand is 360° * time / (time per 360°)
The angle for the hour hand is
360° * [365 / (12*60)] = 182.5

The angle for the minute hand is
(360° * 365 / 60) % 360 = 30

The angle between the 2 is 152.5°

A: Think of it this way: five minutes after six, the minute hand is $\frac1{12}$ of the circle ahead from 12, while the hour hand has advanced $\frac1{12}$ of the way towards 7 from 6, or $\frac1{144}$ of the circle ahead. The initial angle between the two hands is $\frac12$ of the circle, so the solution is
$$\frac12-\frac1{12}+\frac1{144}=\frac{61}{144}=152.5^\circ$$

A:
Here is how much the hour hand travels per hour, minute, second:

*

*Per Hour:
$$\text{H}=\frac{360^{\circ}}{12\space\text{hours}}=30^{\circ}\text{/}\space\text{hour}$$

*Per Minute:
$$\text{M}=\frac{\text{H}^{\circ}}{60\space\text{minutes}}=\left(\frac{1}{2}\right)^{\circ}\text{/}\space\text{minute}$$

*Per Second:
$$\text{S}=\frac{\text{M}^{\circ}}{60\space\text{seconds}}=\left(\frac{1}{120}\right)^{\circ}\text{/}\space\text{second}$$

So, when it is $6:05$, we get:
$$6\cdot30^{\circ}+5\cdot\left(\frac{1}{2}\right)^{\circ}=182.5^{\circ}$$
But, for the 'minute hand' we got $30^{\circ}$ too much, so:
$$\text{angle}=182.5^{\circ}-30^{\circ}=152.5^{\circ}$$


text:
Q: How to change OS timezone in java? My java application is running on Ubuntu, I've a use case where I need to change OS timezone from java. I tried to achieve that by using Joda and Java.util.Timezone. but It seems, they changed just jvm timezone not the actual OS.
So, on server/machine restart I'm getting old timezone. Is there any way I can achieve that from java or I need to rely on Runtime.getRuntime().exec("os commands")?
NOTE: In this scenario, timezone will be a user specific(User will define it's own timezone). Different instances may have different timezones.

A: Assuming you have root permissions, this will change the OS timezone in Linux:
import java.io.File;
import java.nio.file.Files;
import static java.nio.file.StandardCopyOption.COPY_ATTRIBUTES;
import static java.nio.file.StandardCopyOption.REPLACE_EXISTING;

// ...

String zone = "Asia/Tokyo";
File source = new File("/usr/share/zoneinfo/" + zone);
File dest = new File("/etc/localtime");
Files.copy(source.toPath(), dest.toPath(), REPLACE_EXISTING, COPY_ATTRIBUTES);

Note that changing the OS default timezone will not affect current processes. Also note that this is not portable.
EDIT: I second Stephen C's warning about running custom code under elevated privileges.
EDIT: It would probably be better to make a symlink, but either should work.
EDIT: To permanently change a single user's timezone, write export TZ='Asia/Tokyo' into a startup script, like .bashrc. You do not need elevated permissions for that.

A: The JVM maintains its own default time zone, unconnected to the host OS time zone settings.
Most every Java implementation defaults on launch to the host OS' current default time zone. Optionally, you may pass arguments to the JVM launcher to specify another time zone. Lastly, a call to TimeZone.setDefault immediately changes the current default time zone for all code in all threads of all apps running within that JVM.

I need to change OS timezone from java.

Not possible using the bundled Java classes. No implementation of Java I know of would give that kind of power to a Java app.
You may be able to call some native app or utility from within Java that could alter the host OS time zone settings. But you would have to find such a utility, and set up the bridging call from Java to native code. Or you might be able to execute a shell script to make that OS setting change.
As far as date-time handling within your Java code, you should not rely on the default time zone of either the host OS nor the JVM. I recommend always passing the optional ZoneId (or ZoneOffset) to the various date-time methods. Omitting the argument leads to relying implicitly on the JVM's current default time zone. Better to specify your desired/expected time zone.
ZoneId z = ZoneId.of( "Africa/Tunis" ) ;
ZonedDateTime zdt = ZonedDateTime.now( z ) ;

By the way, be aware that the Joda-Time project is now in maintenance-mode. Its creator, Stephen Colebourne, went on to create its successor in the java.time classes defined by JSR 310, now bundled with Java 8 and later.

A: This is posible answer :
Calendar gmtTime = Calendar.getInstance(TimeZone.getTimeZone("GMT"));
System.out.println(gmtTime.getTime());


text:
Q: error of Taylor series for $\ln x$
Find the Taylor Polynomials for $f(x)=\ln x$ about $a=1$ and give error estimates.
Below is what I've done. There may be some mistakes.

Let $f(x) = \ln x$. Then $f(1) = 0$. $f'(x) = \dfrac{1}{x}$ so $f'(1) = 1$. $f''(x) = -\dfrac{1}{x^2},$ so $f''(1) = -1$. $f^{(3)}(x) = \dfrac{2}{x^3}$ so $f^{(3)}(1) = 2$. From this, we see that $f^{(n)}(1)$, where $n>0,$ has value $(-1)^{n-1}(n-1)!$. Hence the Taylor polynomials $P_{n,1}(x)$ for $f(x)$ about $a=1$ are given by $\displaystyle\sum_{i=1}^n (-1)^{i-1}\dfrac{(x-1)^i}{i}$. By Taylor's Theorem, we have that $f(x) - P_{n,1}(x)=\dfrac{f^{(n+1)}(x_0)}{(n+1)!}(x-1)^{n+1},$ where $1\leq x_0 \leq x$. Hence since $|f^{(n+1)}(x_0)|=|(-1)^n\dfrac{n!}{(x_0)^{n+1}}|=\dfrac{n!}{(x_0)^{n+1}}, n\in\mathbb{N}$ is a decreasing function, for $x_0\geq1$, it has a maximum of $n!$ at $x_0=1$. Thus, the absolute value of the error is given by $\dfrac{n!}{(n+1)!}|(x-1)|^{n+1}=\dfrac{|(x-1)|^{n+1}}{n+1}.$

Edit: I guess this could also be shown using the fact that the error for an alternating series is smaller than the next term and has the same sign.

A: Do yourself a favor by working with $\ g(u):=\ln(1+u)\, $ -- this would go smoother. Then substitute,
$$ f(x)\,:=\,\ln(x)\, =\, g(x-1) $$
If you were interested in a different simple power series which computes
logarithms clearly faster (the error term would converge to $0$ more
rapidly) then let me know, and I will expand my Answer.

        Here we go:

We work in the field of complex numbers $\,\Bbb C\,$ (so much
better than $\,\Bbb R\,$ alone).
While the standard polynomial power series $\,\sum a_k\cdot x^k\,$
are wonderful, the rational power series $\,\sum a_k\!\cdot\!(r(x))^k\,$
(function $r(x)$ being a quotient of two polynomials) form a much larger class hence they offer much more potential.
Let's start with standard two series
$$ \ln(1+x)\,=\,\sum_{n=1}^\infty (-1)^{n-1}\cdot\frac{x^n}n $$
and
$$ \ln(1-x)\,=\,-\sum_{n=1}^\infty \frac{x^n}n $$
The convergence radius is $1$ (in both cases; the second series is
obtained from the first one by substitution of $x$ by $-x$).
Subtract the second series from the first one:
$$ \ln\frac{1+x}{1-x}\,\,=\,\,
    2\cdot\sum_{k=1}^\infty \frac{x^{2\cdot k-1}}{2\cdot k-1} $$
The convergence radius is still $1$ and not more (as illustrated by
$\,x=1.)$ All this, so far, can be found in about all texts on
Mathematical Analysis (or Calculus) But the following useful simple
step is hardly in any of them:
substitute $\,t\,:=\,\frac{1+x}{1-x}\,\,$
so that $\,x\,=\,\frac{t-1}{t+1} $
and   (the main result!)
$$ \ln(t)\,\,=\,\,2\cdot\sum_{k=1}^\infty
   \frac 1{2\cdot k-1}\cdot\left(\frac{t-1}{t+1}\right)^{2\cdot k-1}   $$
Now, look closely (how nice!) the series converges for every
$\,t\in\Bbb C\,$ such that $\,\Re(t)>0,\,$ i.e. in the whole
half-plane of the positive real part!
EXAMPLE 1:
$$ \ln(2)\,=\,2\cdot\sum_{k=1}^\infty
      \frac 1{(2\cdot k-1)\cdot 3^{2\cdot k-1}} $$
EXAMPLE 2:
$$ \ln(10)\,=\,2\cdot\sum_{k=1}^\infty
   \frac 1{2\cdot k-1}\cdot\left(\frac9{11}\right)^{2\cdot k-1} $$
EXAMPLE 3:
$$ \ln(11)\,=\,2\cdot\sum_{k=1}^\infty
   \frac 1{2\cdot k-1}\cdot\left(\frac56\right)^{2\cdot k-1} $$
THEOREM
$$ \ln\left(\frac{s+1}s\right)\,\,=\,\,2\cdot\sum_{k=1}^\infty
      \frac 1{(2\cdot k-1)\cdot(2\cdot s+1)^{2\cdot k-1}}
    \qquad\mbox{whenever}\quad   \Re\left(\frac 1s\right)>-1  $$
Now, we can have a lot of fun by applying the above in the
context of equations like
$$ 2=\left(\frac 43\right)^2\cdot\frac 98\qquad\mbox{or}\qquad
        3=\left(\frac 43\right)^3\cdot\left(\frac 98\right)^2 $$
or
$$ 5\,=\,\left(\frac32\right)^4\cdot\frac{80}{81} $$
and a lot more.

REMARK   It follows from the above main result that

$$ \ln\left(\frac 1t\right)\,=
      \,-\ln(t)\qquad\mbox{whenever}\quad\Re(t)>0 $$


text:
Q: C# move files between directories in a SAN I am developing a winform application that moves files between directories in a SAN. The app searches a list of files in directories with over 200,000 files (per directory) in the SAN's Directory, and then moves the found files to another directory.
For example I have this path:
\san\xxx\yyy\zzz
I perform the search in \zzz and then move the files to \yyy, but while I'm moving the files, another app is inserting more files into the xxx, yyy and zzz directories.
I don't want to impact the access or performance to other applications that use these directories.
The file's integrity is also a big concern, because when the application moves the files to \yyy directory another app uses those files.
All of these steps should run in parallel.
What methods could I use to achieve this?
How can I handle concurrency?
Thanks in advance.

A: Using the published .net sources, one can see how the move file operation works Here. Now if you follow the logic you'll find there's a call to KERNEL32. The MSDN documentation for this states

To perform this operation as a transacted operation, use the MoveFileTransacted function.

Based on that I'd say the move method is a safe/good way to move a file.
Searching through a large number of files is always going to take time. If you need to increase the speed of this operation, I'd suggest think out of side of the box to achieve this. For instance, I've seen cache buckets produced for both letters and dates. Using some sort of cache system, you could search for files in a quicker manner, say by asking the cache bucket for files starting with "a" for "these files like this starting with a" file, or files between these dates - etc.

A: Presumably, these files are used by something.  For the purposes of this conversation, let's assume they are indexed in an SQL Database.
TABLE: Files

File ID        Filename
-------------- ----------------------------
1              \\a\b\aaaaa.bin
2              \\a\b\bbbbb.bin

To move them to \\a\c\ without impacting access, you can execute the following:

*

*Copy the file from \\a\b\aaaa.bin to \\a\c\aaaa.bin

*Update the database to point to \\a\c\aaaa.bin

*Once all open sessions have been closed for \\a\b\aaaa.bin, delete the old file

If the files are on the same volume, you could also use a hardlink instead of a copy.


text:
Q: Php Login issue Following is my php login script, There are one problem. If i put any password then it's doesn't validate the password and it's going to user panel page. where is the wrong in my code, can anyone tell me the right direction
N:B: I'M NEW IN PHP ALSO NEW IN THIS SITE.
<?php
if(isset($_POST['action']) && isset($_POST['action']) == 'Log In')
{
$uname = mysql_real_escape_string(trim(htmlspecialchars($_POST['uname'])));
$pass = mysql_real_escape_string(trim(htmlspecialchars($_POST['pass'])));

$crytpass = hash('sha512','$pass');
$err = array();

include_once("toplevel/content/manage/dbcon/dbcon.php");

// check username
$check_uname = mysql_query("SELECT uname FROM members WHERE uname = '$uname'");
$num_uname = mysql_num_rows($check_uname);

// check password
$check_pass = mysql_query("SELECT pass FROM members WHERE pass = '$crytpass'");
$num_pass = mysql_num_rows($check_pass);

/// userid

$userid = mysql_query("SELECT userid FROM members");
$re = mysql_fetch_array($userid);
$userid = (int) $re['userid'];

if(isset($uname) && isset($pass))
{
    if(empty($uname) && empty($pass))
        $err[] = "All field required";
    else
    {
        // username validation process....

        if(empty($uname))
            $err[] = "Username required";
        else
        {
            if($num_uname == 0)
            $err[] = "Username is not correct";
        }

        // password validaiton process...

        if(empty($pass))
            $err[] = "Password required";
        else
        {
            if($num_pass == 0)
            $err[] = "Password is not correct";
        }

    }
}

if(!empty($err))
{
    foreach($err as $er)
    {
        echo "$er
";
    }
}
else
{
     include("user/include/newsession.php");
         header("Location:user/index.php");

}

}
?>

A: So many thing are wrong here
Replace
if (isset ( $_POST ['action'] ) && isset ( $_POST ['action'] ) == 'Log In') {

With
if (isset ( $_POST ['action'] ) &&  $_POST ['action'] == 'Log In') {

Too many things to replace .. hold on while i rewrite the script for you
Edit 1
if (isset ( $_POST ['action'] ) && $_POST ['action'] == 'Log In') {
    $uname = prepareStr ( $_POST ['uname'] );
    $pass = prepareStr ( $_POST ['pass'] );
    $shaPass = hash ( 'sha512', $pass );
    $errors = array ();

    include_once ("toplevel/content/manage/dbcon/dbcon.php");

    if (! isset ( $uname ) || empty ( $uname )) {
        $err [] = "Empty Username not allowed";
    }

    if (! isset ( $pass ) || empty ( $pass )) {
        $err [] = "Empty Password not allowed";
    }

    if (count ( $err ) == 0) {
        $mysqli = new mysqli ( "localhost", "root", "", "test" ); // Replace with
                                                                  // DB
                                                                  // Information
        $result = "SELECT uname ,pass FROM members WHERE uname = '$uname' AND pass = '$shaPass'";

        if ($result->num_rows > 0) {
            $err [] = "Invalid username or Password";
        }

        if (count ( $err ) == 0 && $result) {
            $userInfo = $result->fetch_assoc ();
        /**
         * You can do what every you like here
         */
        }
    }

    if (count ( $err ) > 0) {
        /**
         * Kill the user
         */

        echo "
";

        foreach ( $err as $value ) {
            echo $value . "\n";
        }
        die ( "Die! Die! Die!" );
    }

}

function prepareStr($str) {
    $str = htmlspecialchars ( $str );
    $str = trim ( $str );
    $str = mysql_real_escape_string ( $str );

    return $str;
}

Thanks

A: You shouldnt tell your users if the username was wrong, this makes it easier for brute force attemps to break in.
<?php
if(isset($_POST['action']) && $_POST['action'] == 'Log In') {
    $userid = false;
    $uname = mysql_real_escape_string(trim(htmlspecialchars($_POST['uname'])));
    // or better
    // $uname = filter_var($_POST['uname'], FILTER_SANITIZE_STRING);
    $pass = $_POST['pass'];

    $crytpass = hash('sha512',$pass);
    $err = array();

    include_once("toplevel/content/manage/dbcon/dbcon.php");

    $q = mysql_query("SELECT userid FROM members WHERE uname = '$uname' AND pass='$cryptpass'");

    if(mysql_num_rows($q) > 0){
        $re = mysql_fetch_array($q);
        $userid = (int) $re['userid'];
    } else {
        // username or password wrong
    )

   if($userid) {
      // successfull login
   }

}


text:
Q: ND4J cosine distance больше единицы Вот код:
double dist = Transforms.cosineDistance(currentVector, publicVector);

Но значение переменной dist больше единицы. Почему?
Вот краткий пример кода:
import org.nd4j.linalg.api.ndarray.INDArray;
import org.nd4j.linalg.factory.Nd4j;
import org.nd4j.linalg.ops.transforms.Transforms;
INDArray v1 = Nd4j.create(new double[]{1, 2, -30000});
INDArray v2 = Nd4j.create(new double[]{1, 2, 3});
double dist = Transforms.cosineDistance(v1, v2);
System.out.println(dist); // 1.80173921585083

При более маленьких значениях массивов всё нормально. Но что же я делаю не так?


text:
Q: I can't seem to get overflow:"hidden" to work I am trying to disable scrolling beyond the monitor resolution by hiding overflow. I am not sure why it is not working.
App.js file:
function App() {
  return (
    <BrowserRouter>

    <Route
        exact
        path="/"
        component={DefaultView}

    ></Route>

    </BrowserRouter>
  );
}

Default View File:
render(){
        return(

        )
    }

Right now, there is no X scrolling, but I can scroll up and down.
A codesandbox of the issue:
https://codesandbox.io/s/rylyo4zy24
Thanks for any help!

A: I changed the parent div's position to absolute and my child div's positions to relative, solving the issue.

A: I'm not sure exactly what you're trying to accomplish here, but for overflow hidden to have any meaning you need to define some height and/or width for the respective element:

...


text:
Q: Delete unused indexes from Microsoft Dynamics CRM Application So I found tons of unused indexes from our CRM application with this query from Pinal:
SELECT
o.name AS ObjectName
, i.name AS IndexName
, i.index_id AS IndexID
, dm_ius.user_seeks AS UserSeek
, dm_ius.user_scans AS UserScans
, dm_ius.user_lookups AS UserLookups
, dm_ius.user_updates AS UserUpdates
, p.TableRows
, 'DROP INDEX ' + QUOTENAME(i.name)
+ ' ON ' + QUOTENAME(s.name) + '.' + QUOTENAME(OBJECT_NAME(dm_ius.OBJECT_ID)) AS 'drop statement'
FROM sys.dm_db_index_usage_stats dm_ius
INNER JOIN sys.indexes i ON i.index_id = dm_ius.index_id AND dm_ius.OBJECT_ID = i.OBJECT_ID
INNER JOIN sys.objects o ON dm_ius.OBJECT_ID = o.OBJECT_ID
INNER JOIN sys.schemas s ON o.schema_id = s.schema_id
INNER JOIN (SELECT SUM(p.rows) TableRows, p.index_id, p.OBJECT_ID
FROM sys.partitions p GROUP BY p.index_id, p.OBJECT_ID) p
ON p.index_id = dm_ius.index_id AND dm_ius.OBJECT_ID = p.OBJECT_ID
WHERE OBJECTPROPERTY(dm_ius.OBJECT_ID,'IsUserTable') = 1
AND dm_ius.database_id = DB_ID()
AND i.type_desc = 'nonclustered'
AND i.is_primary_key = 0
AND i.is_unique_constraint = 0
ORDER BY (dm_ius.user_seeks + dm_ius.user_scans + dm_ius.user_lookups) ASC
GO

I was reading about the CRM application and how it creates it's own indexes and etc.
I don't know if this is the right place to ask a question about Microsoft CRM but, is it safe to drop those indexes with 0 seeks, lookups and scans with tons of updates and rows?
I can find problems it they hard coded that index inside the source code, but, is this a good pratice that microsoft uses?
Note: I can close this post if this is not the place to ask this question.

A:
I  don't know if this is the right place to ask a question about
  Microsoft CRM but, is it safe to drop those indexes with 0 seeks,
  lookups and scans with tons of updates and rows?

That will depend on multiple factors only you will know. (Both SQL Server & Microsoft
Dynamics CRM related)

SQL Server

*

*When was the server last restarted?

Make sure this index usage data has enough history to go on as it will reset after each instance restart.
Also, since you are using sql server 2012, the data could have been reset after an index rebuild if your version is below SP2+CU12 or SP3+CU3. (Which hopefully is not the case)
More on that in this blogpost by Kendra Little
If either the data is reset or the restart was recent, consider logging the information to a table and reporting on these results instead.
You  could opt to do this regardless.

*

*Are there rarely used queries that need these indexes?

This is harder to track and is also more unlikely, but could still happen.
For more concerns in general to dropping indexes, read this and this or many more  (online) sources.

Microsoft Dynamics CRM

*

*Is it an out of the box or user created index?

According to this post there are indexes you can and can't remove.

... Be careful not to create too many indexes, which can affect the insert
  and update performance. Balance indexing needs according to business
  requirements, indexes that have a lot of writes and no reads (or very
  few) are not efficient and are considered a burden to the system
  (redundant indexes).  So it is a good idea when working with missing
  indexes to give it some time (depending on your operations cycle maybe
  a month) and off set them against a redundant indexes query.  However,
  please remember removing or editing OOB indexes is NOT supported.

This simply means that you cannot drop the indexes that are included by MS Dynamics CRM (Out of the box).
You can drop your own / user created indexes after veryfing these are, in fact, user created indexes.
As always, document any changes you make to these user created indexes and monitor the impact.


text:
Q: How can I retrieve ACF google map data and use my own custom fields and map instead? My question is whether there is a plugin capable of recovering all the coordinates, latitude and longitude generated by the google map custom field from ACF for each wordpress post ?
I would like to automatically inject them into two default custom fields (want to avoid doing it manually if possible). My goal is to permanently stop using the google map API.
I'm using mapbox for all my maps, but to get the lat lng data from all post I'm still using the ACF google map custom field. Thank you if someone could answer

A: If you have to do this with a plugin and not with some custom code, WP All Import would probably help: You do an export of the posts and then you do an import which will update existing posts. During the import, you would instruct the plugin to fill in the new fields with the values from the old ones and leave the rest of the post's data intact.
But perhaps you could use a different approach all along: since your old google maps fields remain on your database, you could adjust your code to check if the new fields have values and if they don't, do a check for the old fields as a fallback. e.g.:
$gmaps_field = get_field('acf_google_maps_field');
$old_lat = $gmaps_field['lat'];
$old_lng = $gmaps_field['lng'];
$new_lat = get_field('new_lat');
$new_lng = get_field('new_lng');

$lat = $new_lat ? $new_lat : $old_lat;
$lng = $new_lng ? $new_lng : $old_lng;

if($lat && $lng) {
// Do something.
}


text:
Q: bound the distance of two roots of multivariate polynomial systems Consider a system of multivariate polynomial equations
$\vec{x}= f(\vec{x})$ with integer coefficients, $f$ is at most of degree 2.
Suppose $\vec{x}_1$ and $\vec{x}_2$ are two real roots of $f$, is there any bound on
$||\vec{x}_1-\vec{x}_2||$ (in terms of $\infty$-norm or $1$-norm)?

A: Suppose that we have a system of $m$ polynomial equations of degree at most $d = 2$ in $x \in \mathbb{R}^n$
$$\begin{array}{rll}
f_1 (x) &:= x^T Q_1 x + r_1^T x + s_1 &= 0\\
f_2 (x) &:= x^T Q_2 x + r_2^T x + s_2 &= 0\\
        &   \vdots                    &   \\
f_m (x) &:= x^T Q_m x + r_m^T x + s_m &= 0\\
\end{array}$$
where $Q_i \in \mathbb{R}^{n \times n}$, $r_i \in \mathbb{R}^{n}$, and $s_i \in \mathbb{R}$. If $x_i, x_2 \in \mathbb{R}^n$ are solutions of the polynomial system of equations, then we have a total of $2 m$ quadratic equality constraints
$$\begin{array}{c}\displaystyle\bigwedge_{i=1}^m \left( x_1^T Q_i x_1 + r_i^T x_1 + s_i = 0 \right)\\ \displaystyle\bigwedge_{i=1}^m \left( x_2^T Q_i x_2 + r_i^T x_2 + s_i = 0 \right)\end{array}$$
and we would like to maximize $\|x_1-x_2\|$ in order to find an upper bound on the distance between any two solutions of the polynomial system. Maximizing $\|x_1-x_2\|_1$ or $\|x_1-x_2\|_{\infty}$ is not trivial, so one could maximize $\|x_1-x_2\|_2$ instead, as follows
$$\begin{array}{ll} \displaystyle\text{maximize} & \|x-x_2\|_2^2\\ \text{subject to} & \begin{array}{c}\displaystyle\bigwedge_{i=1}^m \left( x_1^T Q_i x_1 + r_i^T x_1 + s_i = 0 \right)\\ \displaystyle\bigwedge_{i=1}^m \left( x_2^T Q_i x_2 + r_i^T x_2 + s_i = 0 \right)\end{array}\end{array}$$
which is a quadratically-constrained quadratic program (QCQP). One could also use Lagrange multipliers.

A: I'm not sure if "$\infty$-norm or $1$-norm" refer to the vector $\vec{x}_1-\vec{x}_2$ or to the coefficients of polynomials. Anyway, to narrow down the possibilities I give an example where all coefficients are small but the distance between roots is large:
$$x_1^2-2x_1=0,\qquad x_{k+1}-x_{k}^2=0\quad \text{for } k=1,\dots,n-1$$
One root is $(0,0,\dots,0)$, the other is $(2,4,8,\dots, 2^n)$. So the maximum of coefficients is not enough to bound the distance.


text:
Q: How to force error on pattern match failure? For example, suppose that foo is defined like this.
foo[x_Integer, y_Integer] := x + y;

Then, any expression with head foo that does not match the pattern given above will remain "unevaluated".  E.g., foo[3] "evaluates" to foo[3].
Although I recognize that there are situations where one may want precisely this behavior, in most of my programming I don't.  Quite the contrary: I want expressions like foo[3] to be treated as malformed, IOW, as errors, and therefore to result in a loud, unequivocal failure whenever they are evaluated.
Hence, I find myself writing a lot of code of the form
foo[x_Integer, y_Integer] := x + y;
foo[___] := Abort[];

(Actually, I use a slightly embellished version of Abort[].)
But including a line like
foo[___] := Abort[];

for every function one defines adds up to a lot of hard-to-maintain clutter-code.
Does Mathematica have some other way to achieve the same thing with less clutter?

A: Instead of foo[___] := Abort[] try this
LHS_foo := RuleCondition[Developer`CheckArgumentCount[LHS, 2, 2]; Fail];

It uses lots of undocumented functions, so it might not be to your taste.
It accomplishes @m_goldberg 's suggestion in the comments.


text:
Q: How to call stopPropagation in reactjs? I want to stop the click event from bubling up. Therefore I added e.stopPropagation() in my code. I always get a mistake in the console, that says: Uncaught TypeError: e.stopPropagation is not a function
What is the right way to set the stopPropagation in reactjs?
      handleClick: function(index, e) {
        e.stopPropagation();

        ...

    },

A: The right way is to use .stopPropagation,
var Component = React.createClass({
  handleParentClick: function() {
    console.log('handleParentClick');
  },

  handleChildClick: function(e) {
    e.stopPropagation();

    console.log('handleChildClick');
  },

  render: function() {
    return

Child

;
  }
});

Example

Your event handlers will be passed instances of SyntheticEvent, a
  cross-browser wrapper around the browser's native event. It has the
  same interface as the browser's native event, including
  stopPropagation() and preventDefault(), except the events work
  identically across all browsers.
  Event System

A: export default function myComponent(){

    //buttonClicked:
    const buttonClicked = (e) => {
        e.stopPropagation();
        // your code here...
    }

    //return:
    return (

            <input type='button'
                onClick={ (e) => buttonClicked(e) }
            ></input>

    )

}


text:
Q: Secure way to edit Couchdb _user from Emberjs I'm writing an emberjs app that uses couchdb as it's backend, and I want to give users the ability to edit some of their user info (their name and emails etc.). I've created a model like so:
App.Person = DS.Model.extend({
    first_name: DS.attr(),
    last_name: DS.attr(),
    full_name: function() {
        return this.get('first_name') + ' ' + this.get('last_name');
    }.property('first_name', 'last_name')
});

App.User = App.Person.extend({
    name: DS.attr('string'), // Actually their primary email.
    customer: DS.belongsTo('customer', {async: true }),
    teacher: DS.belongsTo('teacher', {async: true }),
    roles: DS.attr(),
    type: DS.attr()
});

and I'm using this couchdb adapter.
When save the model using this.currentModel.save(); the save works great, but all of these other properties of a couchdb _user just disappear since I haven't defined them in my model:
derived_key
iterations
password_scheme
salt

This makes it impossible for that user to log in. I know I could just define them on my model, but then they would all be pulled onto the browser, and since these are security essential pieces of information, that doesn't seem like a good idea.
Any ideas about how to get my needed behavior without exposing all of this sensitive information? Or is this information not as sensitive as I think because of good encryption algorithms?
Update
Couchdb it turns out doesn't support selective updating. You have to provide the entire object as it will appear in the most recent version, as shown by this SO question


text:
Q: Display Terminal message on login I want to display something like ### this is a test ### when a new Terminal window is open (and ideally, in a way that can be disabled easily). On Linux this was straightforward; you'd create a script in /etc/profile.d/ which would be responsible for echo-ing the message when a new Terminal session is opened.
I've been playing around with launchd to try to get this to work but to no avail. I've created an agent in /Library/LaunchAgents/org.test.greeting.plist with the following code (where the greeting.sh file is responsible for doing the echo) hoping to get some output when the user logs in.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>Label</key>
    <string>org.test.greeting</string>

    <key>ProgramArguments</key>
    <array>
        <string>/Users/test/greeting.sh</string>
    </array>
    <key>RunAtLoad</key><true/>
</dict>
</plist>

This hasn't worked, as the message is lost to the ether. However, I do know that the agent is running successfully. I know it is possible to redirect the output to a file using StandardErrorPath and StandardOutPath but those are not useful to me.
Does anyone know how to get this working with launchd, or maybe have another way of doing this?

A: I like the message of the day for this.  As tradition dictates...
me@Mac ~ % echo "Welcome to the University of East Westia" > /tmp/motd
me@Mac ~ % sudo mv /tmp/motd /etc

Note: /etc/motd is only displayed in a login shell, which is typical of Terminal.app on macOS.  If you typically run non-login shells, you should handle display of /etc/motd in your shell dot files.

A: Have you tried editing your dotfiles?
As a reference, in my ~/.zshrc I have at the very top the command neofetch. Per se, it is just a command you can execute from your shell. In this way, anytime I start a new iTerm2/Terminal window or tab I get the command executed and have this displayed.

The same can be done by writing at the top of your config file something as the following: echo "### this is a test ###"


text:
Q: Android module supporting different languages (without application context) I was trying to develop an android module with support for different languages.
I can create a strings .xml file but without appropriate context i cannot access it. For the sake of simplicity and to hold on to clean architectural concepts i don't want to receive any context parameters(some parts are meant to live longer than usual).
I have also tried using Kotlin data structures for the purpose, but they doesn't look like a good practice.
so, Is there any recommended way of doing this?
or Is there anything that con be done to have asset or resource files accessible from independent modules without any application context?

A: If you want to access resource files, you have to use context. Or you can use static variables if you are determined not to use context, which is not a preferred way. You can pass resources as a param which can be provided by creating statically or by dependency injection.


text:
Q: Delete file from local commit. Can't use ammend option I have about five local commits. But in the first commit I added big file, about 150MB. When I push to github I get error about big file.
I have tried to delete this file in the last commit, but it doesnt't work. I thought that git may be understand it, but it isn't.
How can I delete this file from commit or delete the first commit entirely if it easy?

A: 'Interactive rebase' part of the answer in
How to remove/delete a large file from commit history in Git repository?
should help you.
The 'git lola' command there is an alias for 'git log --graph --decorate --pretty=oneline --abbrev-commit --all --date=local'

A: You can reset the head and then unstage the 150 mb file and delete, and commit again like this:

*

*1st - git reset --soft HEAD~1

*2nd - git reset -q HEAD -- <FILE>

*3rd - delete file

*So now just add and commit other files

A: You can use git log to display commit history, and then use git reset SHA, where SHA is the first 7 characters of a previous commit, to put that as your most recent commit
1 - git log
2 - git reset SHA


text:
Q: How to add a color to my trello card using py-trello library I want to, whenever I add a card with the add_card() function, make the cover color green for example. How can I do that?
I searched everywhere and didn't find something that could help me.
(I'm using Python 3.11)


text:
Q: Group by with multiple conditions in pandas I want to aggregate rows, using different conditions for two columns.
When I do df.groupby('[a]').agg('count'), I get the output 1
When I do df.groupby('[a]').agg('mean'), I get the output 2
Is there a way to do an aggregation that show output 1 to the column[b] and output 2 to the column[c]?

A: Code below should work:
# Import libraries
import pandas as pd
import numpy as np

# Create sample dataframe
df = pd.DataFrame({'a': ['A1', 'A1', 'A2', 'A3', 'A4', 'A3'],
                   'value': [1,2,3,4,5,6]})

# Calculate count, mean
temp1 = df.groupby(['a']).count().reset_index().rename(columns={'value':'count'})
temp2 = df.groupby(['a'])['value'].mean().reset_index().rename(columns={'value':'mean'})

# Add columns to existing dataframe
df.merge(temp1, on='a', how='inner').merge(temp2, on='a', how='inner')

# Add columns to a new dataframe
df2 = temp1.merge(temp2, on='a', how='inner')
df2


text:
Q: IS-IS Passive Interfaces I've got a question about IS-IS.
I don't really get the point of passive interfaces in IS-IS. I know passive interfaces provide a method of advertising network prefixes into IS-IS. But I don't really get the point why this is necessary. Is it for the loopback?
Thx for your help in advance.
Kind regards
Beni

A: Got the answer from my professor:
Configuring passive interfaces is a best practice to use on all the interfaces where no protocol neighborships are expected. That applies to loopback interfaces but also to interfaces where endhosts are connected.
Hope this can help someone sometime too.
.Beni


text:
Q: How to debug keybinds in Visual Studio Code I am trying to get the keybind for adding new cursors to work in Visual Studio Code (Ctrl+Alt+DownArrow / UpArrow). Currently pressing this combination of keys has no obvious effect, but is listed in my command palette as creating new cursors (and selecting the option from the command palette works as expected).
Therefore I am wondering if there is an easy way to work out why it isn't working, for example an output of what key combinations the editor receives and what commands it carries out on receiving a key combination?
Here is the command I am referring to (note that selecting it from palette works as shown),

A: You can troubleshoot keybindings by opening the Command Palette and selecting Developer: Toggle Keyboard Shortcuts Troubleshooting
You can read more in the VS Code documentation,

To troubleshoot keybindings problems, you can execute the command Developer: Toggle Keyboard Shortcuts Troubleshooting. This will activate logging of dispatched keyboard shortcuts and will open an output panel with the corresponding log file.
You can then press your desired keybinding and check what keyboard shortcut VS Code detects and what command is invoked.

A: I fixed my original issue by bringing up the dev tools in VSCode (Help > Toggle Developer Tools) and noticing the warning:
"Ctrl+Alt+ keybindings should not be used by default under Windows."
This was being thrown by a package unrelated to multi-cursor but highlighted the issue. It simply seems that you cannot use keybinds of that type under Windows, though I could not find any documentation on reserved Windows keybindings.
For debugging keybinds I ended up pulling down the vscode source and there is a promising looking interface IKeybindingService. I imagine a break-point in the lookupKeybindings function on a class implementing this interface would be useful for debugging keybinds, but having fixed my original issue I am not looking any further into this.


text:
Q: how to get license key from c# I am trying to create my own license system for my applications. Therefore, I am trying to read registry key but I couldnt do it succesfully.
I have created a registry key manually and the code below doesnt read it.
here is the regedit screen

here is my code below
// The Registry key we'll check

// *********** it returns null**********************
RegistryKey licenseKey = Registry.CurrentUser.OpenSubKey("Software\\Acme\\HostKeys");

if ( licenseKey != null )
{
    // Passed the first test, which is the existence of the
    // Registry key itself. Now obtain the stored value
    // associated with our app's GUID.
    string strLic = (string)licenseKey.GetValue("test"); // reflected!
    if ( strLic != null )
    {
        // Passed the second test, which is some value
        // exists that's associated with our app's GUID.
        if ( String.Compare("Installed",strLic,false) == 0 )
        {
            // Got it...valid license...
            return new RuntimeRegistryLicense(type);
        } // if
    } // if
} // if

what am I doing wrong?

A: You need to open the test key first and then read null.
RegistryKey licenseKey = Registry.CurrentUser.OpenSubKey("Software\\Acme\\HostKeys\\test");

if ( licenseKey != null )
{
    string strLic = (string)licenseKey.GetValue(null); // GetValue(null) will return the default of the key.
    if ( strLic != null )
    {
        if ( String.Compare("Installed",strLic,false) == 0 )
        {
            return new RuntimeRegistryLicense(type);
        }
    }
}

What you were trying to do was read a value called test under the HostKeys Key.


text:
Q: Oracle User defined type inside package definition is it possible to have a User Defined Type inside Oracle package definition? When I try following
CREATE OR REPLACE PACKAGE AF_CONTRACT AS  -- spec
   -- PROCEDURE my_rpcedure (emp_id NUMBER);
   TYPE DTO_GRID AS OBJECT
   (
     ROWKEY    NVARCHAR2(200),
     COLUMNKEY NVARCHAR2(200),
     CELLVALUE NVARCHAR2(200),
     OLDVALUE  NVARCHAR2(200),
     TAG       NVARCHAR2(200)
   );
END AF_CONTRACT;
/
CREATE OR REPLACE PACKAGE BODY AF_CONTRACT AS  -- body

--   PROCEDURE my_procedure (emp_id NUMBER) IS
--   BEGIN
--
--   END my_procedure;

END AF_CONTRACT;

I always get an error
Error: PLS-00540: object not supported in this context.

in the type definition.

A: Object types have to be declared at the database level. You could declare a collection type in a package specification.
Possible duplicate of:
Possible to create Oracle Database object types inside of PL/SQL?

A: No, it's not permitted:
SQL> CREATE OR REPLACE PACKAGE AF_CONTRACT AS  -- spec
   -- PROCEDURE my_rpcedure (emp_id NUMBER);
   TYPE DTO_GRID AS OBJECT
   (
     ROWKEY    NVARCHAR2(200),
     COLUMNKEY NVARCHAR2(200),
     CELLVALUE NVARCHAR2(200),
     OLDVALUE  NVARCHAR2(200),
     TAG       NVARCHAR2(200)
   );
END AF_CONTRACT;
/
  2    3    4    5    6    7    8    9   10   11   12

Warning: Package created with compilation errors.

SQL> SQL> sho err
Errors for PACKAGE AF_CONTRACT:

LINE/COL ERROR
-------- -----------------------------------------------------------------
3/4      PLS-00540: object not supported in this context.
SQL>

If you want to create a type which is just passing data between PL/SQL procedures then use the PL/SQL RECORD syntax:
SQL> CREATE OR REPLACE PACKAGE AF_CONTRACT AS  -- spec
   -- PROCEDURE my_rpcedure (emp_id NUMBER);
   TYPE DTO_GRID IS RECORD
   (
     ROWKEY    NVARCHAR2(200),
     COLUMNKEY NVARCHAR2(200),
     CELLVALUE NVARCHAR2(200),
     OLDVALUE  NVARCHAR2(200),
     TAG       NVARCHAR2(200)
   );
END AF_CONTRACT;
/
  2    3    4    5    6    7    8    9   10   11   12
Package created.

SQL>

However, if you want a type which you can use in a SQL statement - that is, as the input to a TABLE() function - you will need to create it as a SQL type.  SQL and PL/SQL use two different engines, and only SQL types are visible to the SQL engine.

My advice about the necessity of SQL Types is no longer true for later versions of Oracle. Certainly in 11gR2 and 12c the SQL engine will support SQL in PL/SQL packages which uses PL/SQL tables in a TABLE() clause. The Types have to be declared in the package spec, hence public and visible to the SQL engine. Under the covers Oracle generates SQL types for each declaration. You can spot these Types because their names start SYS_PLSQL_ followed by numeric identifiers.


text:
Q: FATAL ERROR: Scavenger: semi-space copy Allocation failed - JavaScript heap out of memory I am running a node app that crashes with FATAL ERROR: Scavenger: semi-space copy Allocation failed - JavaScript heap out of memory despite the fact that there is still plenty of memory to allocate. Here is the command I run to launch the app:
node --max-old-space-size=32768 ./cron/jobs.js

But the app dies after using up about 17GB of memory and the error I get is:
***normal output of the app stops here***

<--- Last few GCs --->

[2523:0x2f96e10] 29365810 ms: Scavenge 17205.5 (17305.7) -> 17205.1 (17305.7) MB, 825.0 / 0.0 ms  (average mu = 0.992, current mu = 0.994) allocation failure
[2523:0x2f96e10] 29366658 ms: Scavenge 17205.5 (17305.7) -> 17205.4 (17305.7) MB, 845.6 / 0.0 ms  (average mu = 0.992, current mu = 0.994) allocation failure
[2523:0x2f96e10] 29367515 ms: Scavenge 17205.5 (17305.7) -> 17205.5 (17305.7) MB, 856.3 / 0.0 ms  (average mu = 0.992, current mu = 0.994) allocation failure

<--- JS stacktrace --->
Cannot get stack trace in GC.
FATAL ERROR: Scavenger: semi-space copy Allocation failed - JavaScript heap out of memory
Segmentation fault

And that's it, there is no trace.
When I run it via PM2, it also confirms that the memory usage of the app is right around 17GB at the time of its crash.
The server has plenty of RAM (64GB) and most of it is available. I must be missing something here because the --max-old-space-size=32768 part should ensure that my app has 32GB to play with, but somehow it doesn't.
Does anybody have any suggestions?


text:
Q: I am getting an error of: not enough values to unpack (Expected 2, got 1) im following a tutorial but it just wont work This is the code I have used from a tutorial
def view():
    with open('My coding stuff\\passwords.txt', 'r') as f:
        for line in f.readlines():
            data = line.rstrip()
            user, passw = data.split("|")
            print("User:",user, ", password:", passw)

I have no idea what is wrong with the code
I was trying to make a password manager by following a tutorial and i am just confused

A: Please save data in password.txt in below format
User|pwd

A: The problem in your code that you are assigning one value in tuple user, passw instead of 2 values which is returned by data.split("|").
I think that the file you are reading doesn't contain data in the format user | pass (each record seperated by | ) so it gives you this exception Error.
I suggest to check the format of data in your file then edit your code according to it.


text:
Q: Float(s) lost in newly defined environment (possible \vbox/\hbox problem) The following gives me LaTeX Error: Float(s) lost. I saw on Lost float in exam class that this might have to do with the \vbox. Replacing it with an \hbox gives Something's wrong--perhaps a missing \item. How can this be solved?
\documentclass{scrartcl}

\usepackage[american]{babel}

\usepackage{ifthen}
\usepackage{xparse}

\newboolean{sol}
\setboolean{sol}{false}

% solution environment
% see https://tex.stackexchange.com/questions/172404/solution-environment-via-true-false-switch?noredirect=1#172408
\NewDocumentEnvironment{solution}{O{sol}}{%
  \ifthenelse{\boolean{#1}}{\par\noindent{\sffamily\bfseries Solution}\par}{\setbox0=\vbox\bgroup}
}{\ifthenelse{\boolean{#1}}{}{\egroup}}

\begin{document}
\begin{solution}
  \begin{enumerate}
  \item foo
    \begin{figure}[!htbp]
    \end{figure}
  \end{enumerate}
\end{solution}
\end{document}

A: You're using the wrong tool.
\documentclass{scrartcl}

\usepackage[american]{babel}

\usepackage{ifthen}
\usepackage{environ}

\newboolean{sol}
\setboolean{sol}{false}

\NewEnviron{solution}[1][false]{%
  \csname if#1\endcsname
    \trivlist
    \item\relax\textbf{Solution.}\enspace
    \BODY
    \endtrivlist
  \fi
}

\begin{document}
\begin{solution}
  \begin{enumerate}
  \item foo
    \begin{figure}[!htbp]
    \end{figure}
  \end{enumerate}
\end{solution}

\begin{solution}[true]
  \begin{enumerate}
  \item foo
    \begin{figure}[!htbp]
    \centering
    \Huge A
    \caption{An A}
    \end{figure}
  \end{enumerate}
\end{solution}
\end{document}


text:
Q: Understanding an application of Riemann-Roch in an article I saw the following in an article:
Let $C$ be an irreducible smooth projective curve over an algebraically closed field $K$ and let $g$ be its genus.
By Riemann-Roch, if N is large enough for every line bundle $\mathcal{L}$ on $C$ of degree $\leq g+1$, $\mathcal{O}(N)|_C\otimes\mathcal{L}^{-1}$ is generated by its global sections. It follows that, for $N$ large enough any function on $C$ with at most $g+1$ poles is the quotient of two homogeneous polynomials of degree $N$.
Why is this true? What is the connection two the fact that it is generated by global sections?
(crossposted from: Understanding an application...)

A: The poles of your function determine an effective divisor of degree at most $g+1$ which in turn determines a line bundle $\mathscr L$ of degree at most $g+1$ and with an appropriate embedding of $\mathscr L$ into $\mathscr K_C$, the constant sheaf determined by $K(C)$ the original function corresponds to a global section of this $\mathscr L$.
The statement you would like follows if you can embed $\mathscr L$ into $\mathscr O(N)|_C$, since the global sections of the latter correspond to quotients of homogenous polynomials of degree $N$. (Here I am assuming that $C$ is embedded into a projective space $\mathbb P^n$ and $\mathscr O(1)=\mathscr O_{\mathbb P^n}(1)$, which you never said, but you should have!). Well, actually you need a little more, because you want to do this as subsheaves of $\mathscr K_C$.
An embedding of of $\mathscr L$ into $\mathscr O(N)|_C$ is the same as a global section of $\mathscr O(N)|_C\otimes \mathscr L^{-1}$. In other words, every global section of $\mathscr O(N)|_C\otimes \mathscr L^{-1}$ gives you an embedding of of $\mathscr L$ into $\mathscr O(N)|_C$. You need global generation to guarantee that you can do this inside $\mathscr K_C$.


text:
Q: finding contours of a plant root I have an image which has roots like this:

I want to crop each root individually out.
I initially thought of heavy dilation followed by erosion and contour detection of the blob, but since the roots are thin, it does not work well.
I also directly applied canny edge and contour detection like this image below. It has around 62000 contours, but I cannot use it to get the outline of each root.

I also thresholded the image using HSV followed by some median blurring. But it did not reduce much noise. Further blurring only leads to losing the root features.

Can anyone suggest me a better approach to tackle this problem? Will any Machine Learning based approach work better? Thanks

A: Use Cv2.BoundingRect(), it gets the rectangle area of your contour. Also you can use MedianFilter to get rid of "salt and pepper" noise in your picture.

A: First step detect big root, by user select or big erosion.
Second step base on previous big area center coordinate, make a fill algorithm (like Paint Bucket Tool in Paint) on this original threshold image


text:
Q: validation tells that all my email addresses are invalid I do not know why it is telling me always that is an invalid email address even when it is correct.Any ideas?   Demo on JSfiddle
my form
  <form id="FormViewForm" method="post" action="/NewsletterMailer/subscribe/4" accept-charset="utf-8">
                <input type="hidden" name="_method" value="POST" />
                <input type="hidden" name="data[Form][id]" value="4" id="FormId" />
                <input type="hidden" name="data[Form][type]" value="1" id="FormType" />
                <input type="email" name="data[Form][e-mail]" value="" id="subscribe-email" placeholder="Enter your email..." required>
                    <input type="submit" value="+" class="large" id="subscribe-submit">
                        </form>

my custom.js
$('#FormViewForm').submit(function() {
    validateEmail($('input').val());
    return false;
});

function validateEmail(email) {
    var re = /^\s*[\w\-\+_]+(\.[\w\-\+_]+)*\@[\w\-\+_]+\.[\w\-\+_]+(\.[\w\-\+_]+)*\s*$/;
    if (re.test(email)) {
        if (email.indexOf('@c-e.com', email.length - '@c-e.com'.length) !== -1) {
            alert('Submission was successful.');
        } else {
            alert('Email must be a CE e-mail address (your.name@c-e.com).');
        }
    } else {
        alert('Not a valid e-mail address.');
    }
}

A: Simply a jQuery selector issue, you're missing a #.
validateEmail($('#subscribe-email').val());

Your function receives undefined as an e-mail and the regex fails.
You could also use pure JavaScript. (Note that document.getElementById does not require the #, which might have caused the confusion.)
validateEmail(document.getElementById('subscribe-email').value);

A: Please use right selector like
If you want to user id as selector
validateEmail($('#subscribe-email').val());

Or you can also use input tag as selector
validateEmail($('input[type=email]').val());

The id selector will be strong to all browser and also safe to use
Please try this code
$('#FormViewForm').submit(function() {
    validateEmail($('#subscribe-email').val());
    return false;
});

function validateEmail(email) {
    var re = /^\s*[\w\-\+_]+(\.[\w\-\+_]+)*\@[\w\-\+_]+\.[\w\-\+_]+(\.[\w\-\+_]+)*\s*$/;
    if (re.test(email)) {
        if (email.indexOf('@c-e.com', email.length - '@c-e.com'.length) !== -1) {
            alert('Submission was successful.');
        } else {
            alert('Email must be a CE e-mail address (your.name@c-e.com).');
        }
    } else {
        alert('Not a valid e-mail address.');
    }
}


text:
Q: what is the significance of having a UITextView in a UIScrollview? I have come across many sample codes where the UITextView is embedded within UIScrollView. However, UITextView itself has scrolling properties. So what additional advantage does this set-up i.e UITextView within UIScrollView provide?

A: UITextView is a subclass(inherits from) of UIScrollView only. For more info.
How do you approach, if you want to display a page of text but you might have only little space in UIView?
For ex: You have more than 5 pages of T&C, Can you possible to display in a page of View without scrollable way?

A: It depends, when you only want to show text, there is no point of embedding a UITextView inside of a UIScrollView. But think about a more complex setup, where you might have more view components inside your view, maybe some more buttons, labels, text fields,... All these together need to fit onto a scrollable area, which is why you would use a UIScrollView as the container, and then add all the additional views (incl the UITextView) to it


text:
Q: How to know which language the user is writing in Javascript? I have a text area where user can write his SMS. You all know that There is a different in message length between Arabic and English characters.
I would like to know how to know what is the language the user is writing in Javascript?
Kind Regards,

A: Well a simple solution would be to regex the message for special characters. If your pattern matches the arabic format then you can impose one SMS message length, either leave it with the default size.
EDIT:
And your regex could be like:
/\p{Arabic}/


text:
Q: How to detect from client which ports are being blocked? The issue I have currently is with Windows (WindowsXP --> Windows 2003) but I would be interested also in how resolving it in a linux client.
I work with a network split in several subnetworks and there is a firewall between those that is managed by the parent company. Sometimes, when troubleshooting/installing new applications, we find that it does not work due to some port being blocked, and everytime it is a lengthy process to contact the firewall people and agree for a time for a test so we replicate the action and they check the log of the firewall.
As they are pretty much overworked and I would like some more flexibility, I would like to know if there is some way to, from the client, detect attempted connections dropped or denied by the firewall (or at least, all connections from a process/to a server so we can revise them).
I have tried logging things with wireshark, but (if it is the way) I do not know what to look for in the dump. I don't think netstat or PortView would work as these connections are not established.

A: There are good scanning tools like nmap that can show you what ports on a target system are reachable, and which are not.


text:
Q: How can I identify ARIMA model for this data? My data, its ACF, PACF looks like this
The data is daily data and has period of 365 days though with varying mean.
I tried fitting ARIMA (0,1,1) model (following suggestion from ESACF), it cannot pass the Ljung-Box test and the residual distribution does not have normal distribution.
When to take into account seasonality I add seasonal differencing
identify var=x(1,365)
the data looks like this-

When I fit (0,1,1) (0,1,1)_365 seasonal ARIMA model to it, the residual diagnostic again cannot pass the Ljung-Box test. I also tried taking logarithm of x, but no luck there either.
No matter which model I fit, It cannot pass the Ljung-Box test
Any suggestion on how to model this data so the residuas would be white noise?

A: I took your 1461 observations (4 years) into AUTOBOX ( a software package that I have helped to develop) and obtained the ACF of the original series  . Standard (i.e. almost always naive ) model identification strategy assumes no outliers/level shifts/seasonal pulses/special causes are present. AUTOBOX developed a first-pass model that identified a plethora of pulse outliers for the months of September and October for the first 2 years.
We have seen retails sales buildup starting about Nov 15th of each year and lasts about 60 days requiring model structure to deal with this recurring phenomenon. In a similar way I suggested that a similar variable be considered/ used for a 75 day window stating at 9/1 for each of the first 2 years.
The fully resolved model combining this "special variable" , month of the year and ARIMA structure and allowances for identified pulses is here in two images  and   . The statistical summary is here  . The residuals from the model are plotted here  with an ACF here . The Actual/Fit and Forecast graph is here  with the Actual and Cleansed presented here
Finally the ARIMA model (in concert with other structure) is essentially a (0,1,0)(0,0,0) as the AR(1) coefficient is nearly 1.0 .
EDITED AFTER OP REEQUSTED SOME ADDITIONAL DETAILS OF THE ANALYSIS"
I added one series call M_DYN175 and placed 0's everywhere except for 9/1/09 and 9/1/2010 . For example this is a snapshot around 9/1/09 . AUTOBOX has a feature that enables a "long polynomial" .. in this case up to lag75 providing a shortcut to estimate 75 individual coefficients .In this example some 46 were found to be statistically significant and the others deleted. You can effect the same solution by creating 46 individual pulse indicators (0/1) in your regression model. Now as to how PULSE VARIABLES (OUTLIERS) were found this is accomplished by enabling Intervention Detection procedures following Tsay  http://onlinelibrary.wiley.com/doi/10.1002/for.3980070102/abstract ( a feature of AUTOBOX and elsewhere ).


text:
Q: CSS float ul lists and paragraphs I tried to do this http://prntscr.com/cdbzsu but looks like I'm not so good with css float :(.
I tried to look on others tutorials but I still couldn't do it.
Please someone give some help.
This is what I did so far.

.edit-text {
  font-size: 13px;
}
.edit-text p {
  width: 100%;
}
.edit-text ul {
  float: left;
}
.edit-text ul li {
  list-style: circle inside;
}
.edit-text img {
  float: right;
  width: 102px;
  height: 130px;
}
.edit-text a {
  clear: both;
  background-color: #002B0F;
  color: #FFFFFF;
  padding: 3px 15px;
}
<!DOCTYPE html>

 <title></title>

Vous-voulez nous consulter pour vous aider à réviser votre vitrine commerciale?

Ce service inclut:

La révision

La mise en page de la vitrine commerciale

La correction et l'adaptation de mots clés pour le SEO

Service payant

  Cliquez ici pour envoyer la demande de consultation

A: Shift your img above the green text and clear the float by using:

after the img tag and I think you can move it forward from here. Cheers!

.edit-text {
  font-size: 13px;
}
.edit-text p {
  width: 100%;
}
.edit-text ul {
  float: left;
}
.edit-text ul li {
  list-style: circle inside;
}
.edit-text img {
  float: right;
  width: 102px;
  height: 130px;
}
.edit-text a {
  clear: both;
  background-color: #002B0F;
  color: #FFFFFF;
  padding: 3px 15px;
}
<!DOCTYPE html>

 <title></title>

Vous-voulez nous consulter pour vous aider à réviser votre vitrine commerciale?

Ce service inclut:

La révision

La mise en page de la vitrine commerciale

La correction et l'adaptation de mots clés pour le SEO

Service payant

  Cliquez ici pour envoyer la demande de consultation

A: I have an easier solution to get it to look exactly how you portrayed on that image (minus the red writing). Took the liberty of providing a codepen for you.
http://codepen.io/Ballard/pen/ambGQA
Although Kukkuz answer seems to resolve what you are trying to do, It involves specifying the style in the HTML exactly, rather than using it on your CSS sheet, you will also have problems trying to align the image and the clickable link properly. Have a look at my snippet below, for an easier better solution.

.edit-text {
  font-size: 13px;
  width: 490px;
  background-image: url(http://www.holidaymood.com/images/ContactGirl.png);
  background-repeat: no-repeat;
  background-position: 350px 40px;
  background-size: 100px 115px;
}
.edit-text p {
  width: 100%;
  margin: 0 auto;
}

.edit-text ul li {
  list-style: circle inside;
}
.edit-text a {
  background-color: #002B0F;
  color: #FFFFFF;
  padding: 3px 15px;
}

Vous-voulez nous consulter pour vous aider à réviser votre vitrine commerciale?

Ce service inclut:

La révision

La mise en page de la vitrine commerciale

La correction et l'adaptation de mots clés pour le SEO

Service payant

  Cliquez ici pour envoyer la demande de consultation


text:
Q: Omit matched object between Arrays I'm trying to compare newProp (Array of objects) with prop (Another array of objects), and when there is a match, it will be removed off newProp array.
prop = [{ id: 1, name: 'John Doe}, {id: 2, name: 'Jane Doe'}, {id: 3. name: 'Baby Doe'}]

newProp = [{id: 4, name: 'Johnny Doe' }, {id: 1, name: 'John Doe'} ....]

Here is what I have tried, wonder if there is better / cleaner way of solving this problem.

  let prop = [{ id: 1, name: 'John Doe'}, {id: 2, name: 'Jane Doe'}, {id: 3, name: 'Baby Doe'}]

  let newProp = [{id: 4, name: 'Johnny Doe' }, {id: 1, name: 'John Doe'}]

prop.map( (i,Iindex) => {
    newProp.map((o, oIndex ) => {
      if (i.id == o.id) {
        prop.splice(Iindex, 1);
        console.log(prop);
      }
    })
})

A: One way to do it is to filter() out the items you don't need.
It's cleaner and more readable (you'd see it all over the place in code of folks who follow functional programming), however it produces a new array, thus negatively affecting performance if called very frequently on very large input arrays.
newProp = newProp
  .filter(newPropElement =>
     prop.every(propElement => newPropElement.id !== propElement.id)
  )


text:
Q: How do I send data to Smart Contract via Ethers? I am able to deposit amount of Ether into my smart contract via the depositFunds function like below:
async function depositFunds() {
  console.log(`Depositing Funds...`);
  if (typeof window.ethereum !== "undefined") {
    const provider = new ethers.providers.Web3Provider(window.ethereum);
    const signer = provider.getSigner();
    const contract = new ethers.Contract(contractAddress, abi, signer);
    const transactionResponse = await contract.depositFunds({
      value: ethers.utils.parseEther("1"),
    });
  }
}

I am now trying to withdraw a portion of the funds (i.e. not all of them), but I cannot figure out how to pass the data to the withdrawFunds function of my contract.
async function withdrawFunds() {
  console.log(`Withdrawing Funds...`);
  if (typeof window.ethereum !== "undefined") {
    const provider = new ethers.providers.Web3Provider(window.ethereum);
    const signer = provider.getSigner();
    const contract = new ethers.Contract(contractAddress, abi, signer);
    const transactionResponse = await contract.withdrawFunds({
      data: "0.5",
    });
  }
}

Below is the ABI for my withdrawFunds function:
{
    inputs: [
      {
        internalType: "uint256",
        name: "_weiToWithdraw",
        type: "uint256",
      },
    ],
    name: "withdrawFunds",
    outputs: [],
    stateMutability: "nonpayable",
    type: "function",
  }

Any ideas on how to approach this? Thanks!

A: await contract.depositFunds({
  value: ethers.utils.parseEther("1"),
});

This snippet builds the transaction object in a way that already contains the depositFunds() function selector at the beginning of the data field, followed by 0 arguments.
The object containing the value property is called the overrides parameter. It allows you to override some other fields of the transaction, such as its value. It does not allow you to override the data field, as that's already build from the function name and arguments.
The parseEther() function converts an amount of ETH into its corresponding wei amount. In your case, that's 1000000000000000000 wei. So the actual value that you're sending with the transaction is this "1 and 18 zeros".

The withdrawFunds(uint256) function accepts the number of wei, that you want to withdraw, as an argument. So you need to convert the "0.5 ether" to the amount of wei, and simply pass it as the function argument.
const transactionResponse = await contract.withdrawFunds(
  // the function argument
  // note that it's not wrapped in curly brackets
  ethers.utils.parseEther("0.5")
);

You can also optionally specify some overrides, but it's not needed in this case.
const transactionResponse = await contract.withdrawFunds(
  ethers.utils.parseEther("0.5"),
  {
    // this is the `overrides` object after all function arguments
    gasPrice: "1000000000" // 1 billion wei == 1 Gwei
  }
);


text:
Q: C# Generics with concrete implementation Is it possible in C# to create a generic method and add also a concrete implementation for given type?
For example:
void Foo<T>(T value) {
    //add generic implementation
}
void Foo<int>(int value) {
   //add implementation specific to int type
}

A: In your specific example you wouldn't need to do this.  Instead, you'd just implement a non-generic overload, since the compiler will prefer using that to the generic version.  The compile time type is used to dispatch the object:
void Foo<T>(T value)
{
}

void Foo(int value)
{
   // Will get preferred by the compiler when doing Foo(42)
}

However, in a general case, this doesn't always work.  If you mix in inheritance or similar, you may get unexpected results. For example, if you had a Bar class that implemented IBar:
void Foo<T>(T value) {}
void Foo(Bar value) {}

And you called it via:
IBar b = new Bar();
Foo(b); // Calls Foo<T>, since the type is IBar, not Bar

You can work around this via dynamic dispatching:
public void Foo(dynamic value)
{
    // Dynamically dispatches to the right overload
    FooImpl(value);
}

private void FooImpl<T>(T value)
{
}
private void FooImpl(Bar value)
{
}


text:
Q: C# Save PictureBox Image to Remote Server I have my own server with local IP is 172.23.1.66 with CentOS 7
So in my program, I can call image from my server with string imageLocation = "http://172.23.1.66/img/978979892782.jpg";
In other case, I want to save it in to my remote server. I can't access it in windows explorer, I only can access it on browser. I remote it using WinSCP.
I have try like this:
picImage.Image.Save(@"\\172.23.1.66\img\" + clsLibrary.throwCode + ".jpg", System.Drawing.Imaging.ImageFormat.Jpeg); // throwCode is my file name

but it throw An unhandled exception of type 'System.Runtime.InteropServices.ExternalException' occurred in System.Drawing.dll
I also have try delete \\ in the first of IP.
Everything is fail, can anyone help?

A: Use Server MapPath to make sure you can use your URL on your server:
picImage.Image.Save(Server.MapPath("~/img/") + clsLibrary.throwCode + ".jpg", System.Drawing.Imaging.ImageFormat.Jpeg);

A: -you are only allowed to get Image using IP address.To save Image on IP address-
 public string TEMP_PATH = "~/Temp/ImagesPath/";

Make sure that you have proper right to access /Temp/ImagesPath/.
After That
try
        {
            FileInfo fileDatails = new FileInfo(AsyncImageUpload.PostedFile.FileName);/* here you can get file using you source like OFD or FileUpload Controls */
            string exten = fileDatails.Extension;
            Stream fs = this.AsyncImageUpload.FileContent;
            BinaryReader br = new BinaryReader(fs);
            Byte[] bytes = br.ReadBytes((Int32)fs.Length); /* convert file to byte */
            String Base64file = Convert.ToBase64String(bytes);
            destinationPath = Server.MapPath(TEMP_PATH + fileDatails.Name);
            Byte[] frombytes = Convert.FromBase64String(Base64file);
            File.WriteAllBytes(destinationPath, frombytes); /*write file to destination folder on server */
        }
        catch (Exception exp)
        {
            throw exp;
        }


text:
Q: How to delete Line in the datagrid? I need to remove first three lines from the datagrid group "DFP" and remaining lines comes in the place of 1st 2nd and third respectively.
put the dgHilitedLines of group "DFP"  into theLine
   DeleteLine theLine

I used the above code, but its shows the following error
button "Pass": execution error at line 22 (Handler: can't find handler) near "DeleteLine", char 1

A: Daatgrids have more properties than normal controls, see: http://livecode.wikia.com/wiki/Datagrid_API
I suggest you to use the dgText property, like the following code:
put the dgText of group "DFP" into temp
delete line 1 to 2 of temp
set the dgText of group "DFP" to temp


text:
Q: Rotary Switches - 4 Positions, Two Outputs - How to determine the selected "mode"? My apologies for not such a great description.. so I will clarify here.
I have a rotary switch from an old aircraft panel that has 4 positions and two outputs.
Using my voltmeter's resistance mode I can see the following on the outputs:
OFF
OUTPUT1: OPEN  OUTPUT2:  OPEN
ALIGN
OUTPUT1: CLOSED  OUTPUT2:  OPEN
NAV
OUTPUT1: CLOSED  OUTPUT2:  CLOSED
ATT
OUTPUT1: OPEN  OUTPUT2:  CLOSED

I am just beginning into transistors and associated ICs, so let's say I am quite green in this area.
What I want to do is run +5V into the switch and then somehow determine which of the four modes is active and then pass that back to one of four pins (or really 3 due to the OFF condition) on a microcontroller so it knows which one is selected.
Would I use some kind of logic gates for this or some kind of transistor array?

A: Simply connect the two outputs to two microcontroller inputs.  Software can easily determine the switch position from the states of the inputs.
If you apply +5V to the switch input, you will need pull-down resistors of 5K - 10K from each microcontroller input to ground, so the inputs will be Low when the switch is not pulling them High.


text:
Q: Laravel 5.6 - How to get auth()->user() or $response->user() in api controller? In api.php routes file below, there are public routes and private routes:
Route::group(['namespace' => 'API'], function() {

     // Public routes (auth not required)
     Route::group([], function() {
         Route::get('/testauth1', 'TestController@testauth1');
         // more public routes...
     });

     // Private routes (auth required)
     Route::group(['middleware' => 'auth:api'], function() {
         Route::get('/testauth2', 'TestController@testauth2');
         // more private routes...
     });

});

In the TestContoller these are the 2 methods  called above:
class TestController extends Controller {

    public function testauth1(\Request $request) {
      // return auth()->user(); // does not return user
      return $request->user(); // does not return user
    }

    public function testauth2() {
      return auth()->user(); // returns user
    }

}

Since the private route group has the auth:api middleware, we will ensure the user is authenticated by checking the token supplied in the Authorization Bearer header. Only if a valid token is present will the private routes be rendered to the authenticated user. This is why TestController@testauth2 returns the auth user correctly.
Now, anyone can access the public routes, with or without token. If there is no token supplied in the Authorization Bearer header, then we'll have no authenticated user, which makes sense. This is why TestController@testauth1 does not return an auth user. However, when a logged in user accesses /testauth1 public route, they provide their token in the Authorization Bearer header and therefore should be returned in TestController@testauth1 if not with auth()->user() at least with the $request->user() but we can't seem to access the user with their supplied token in that method.
Any idea how we can access the valid token user in all public route methods?

A: You are referencing Request from a root namespace: \Request. Instead, you should reference the Illuminate\Http\Request class.
You should remove the \ from your parameter and add the following line to your imports.
use Illuminate\Http\Request;
Alternatively, you could also reference the request class directly in your method:
class TestController extends Controller {

    public function testauth1(Illuminate\Http\Request $request) {
        return $request->user();
    }

    public function testauth2() {
        return auth()->user(); // returns user
    }

}

The auth() helper method or Auth Facade is globally available. It doesn't depend on the request that you are trying to access. The same goes for the request() and Request:: helpers I believe. In the case you are giving, you are referencing a wrong Request instance, hence giving a unexpected result.

A: Pass the api guard as a parameter to fetch the authorized user without the middleware protecting the request.
$request->user('api');

// Or

auth('api')->user();


text:
Q: How to handle browser back button when the user is logged in grails app? I want that whenever any user is logged into my grails app and as soon as he presses the browser back button he should be automatically redirected to landing page(after login one).
The code I am using on back button is :
var oldURL = document.referrer;
            alert(oldURL);
            var url1="http://localhost:8080/interviewbuddy/";
            var url2="http://localhost:8080/interviewbuddy/signup/signup";
            var url3="http://localhost:8080/interviewbuddy/login/auth";
            if(oldURL==url1||oldURL==url2||oldURL==url3){
                window.location="http://localhost:8080/interviewbuddy/company/dashboard";
            }

On my view gsp. Please help.

A: You can handle it with javascript or jquery specifically
$(window).on("navigate", function (event, data) {
  var direction = data.state.direction;
  if (direction == 'back') {
    // redirect to landing page
    window.location="http://localhost:8080/interviewbuddy/company/dashboard";
  }
  if (direction == 'forward') {
    // do something else
  }
});


text:
Q: Python serial checks refactoring Ho can this code be optimized?
Maybe it is possible to write it shorter, make it more 'pythonic'?
...
check_pass = 0

if key == 'media':
    size_check_pass = 0
    if some_check_func(xxx): size_check_pass = 1
    ...

    format_checks_pass = 0
    if...some_checks... : format_checks_pass = 1

    if size_check_pass and format_checks_pass: check_pass = 1

if key == 'text':
    line_end_check_pass = 0
    if (((some checks))): line_end_check_pass = 1

    lenght_check_pass = 0
    if len(file) < 1000: lenght_check_pass = 1

    if line_end_check and lenght_check_pass: check_pass = 1

if check_pass:
    ...

The background of the code is to check each file type for different conditions.

A: You could use a dictionary as a sort of dispatch table perhaps. Something like
def media_checks(f):
  ...
  return pass

def text_checks(f):
  ...
  return pass

_dispatch = {}
_dispatch['media'] = media_checks
_dispatch['text'] = text_checks

dispatch_func = _dispatch[key]
check_pass = dispatch_func(your_file)

This would split you code up so it is easier to read and maintain. It also isolates the code for checking each file type in an individual function.

A: First, for your first if, your code suffers from conditional complexity code smell. You can fix with inline method refactoring: you don't need your size_check_pass and format_checks_pass booleans, and can evaluate both conditions directly in the final if statement, with if ...some_checks... and some_check_func(xxx) instead of if size_check_pass and format_checks_pass. which gives you
check_pass = 0

if key == 'media':

    if ...some_checks... and some_check_func(xxx):
         check_pass = 1

Then, do this for the second if also. And you don't want to check if key = 'text' if you had already that key = 'media', so in the end
check_pass = 0

if key == 'media':
    if some_check_func(xxx)and ...some_checks...:
         check_pass = 1

else if key == 'text':
    if (((some checks)))and len(file) < 1000:
         check_pass = 1

if check_pass:
...

A: So you always have a sequence of checks.
First, you can shorten your conditions:
...
check_pass = False # to make it more boolean

if key == 'media':
    size_check_pass = some_check_func(xxx)
    format_checks_pass = ...result of your checks...
    check_pass = size_check_pass and format_checks_pass

if key == 'text':
    line_end_check_pass = (((some checks)))

    length_check_pass = len(file) < 1000

    check_pass = line_end_check and length_check_pass

if check_pass:
    ...

or compress them even more:
...
check_pass = False # to make it more boolean

if key == 'media':
    check_pass = some_check_func(xxx) and ...result of your checks...

if key == 'text':
    check_pass = (((some checks))) and len(file) < 1000

if check_pass:
    ...

And then you could apply a system like the one from jamesj, but maybe with lists of conditional expressions:
def some_checks():
  ...
  return True or False

def other_checks(f):
  ...
  return ...

_dispatch = {
    'media': [lambda: some_check_func(xxx), some_checks],
    'text' : [other_checks, lambda: len(file) < 1000]
}

dispatch_list = _dispatch[key]
check_pass = all(func() for func in dispatch_list)