text:
Q: convert an integer variable to a string with leading zeros in VBA For starters, there are LOTS of questions that have been asked with this topic.  However all the ones I kept clicking on were in languages other than VBA and I did not understand the syntax of those languages.
When I did a google search I found this answer which seemed promising.  AH FIDDLE STICKS!  I just realized that answer for VB and probably explains why its not working in my VBA
Situation
I have a variable called DimScale that is an integer.  I want to create a string called DimName that will start with "mm-" and be following by the integer from DimScale with leading 0s such that there are a minimum of characters after "mm-".
IF DimScale = 25
Then DimName = "mm-0025"

IF DimScale = 235
Then DimName = "mm-0235"

Note Dimscale >=1 and <= 9999

What I have tried
Dim Dimscale as Integer
Dim Dimension_Style_Name as String

String.Format("{0:0000}", DimScale)

Dimension_Style_Name = DimScale$
Dimension_Style_Name.Format("{0:0000}", DimScale)

I have read the gist too that Dimscale get converted to a string and then is sent through a loop of adding a leading zero until the length of the string equals the 4 characters in my case for the integer part.
I have also seen the case with IF statments where IF Dimscale <10 then "000"& If Dimscale <100 then "00"& etc.
Is there a way to do it like like the VB method in VBA?

A: maybe:
DimName = "mm-" & format(DimScale,"0000")

As per @MathieuGuindon valuable (as usual) contribution:
Format (fully-qualified VBA.Strings.Format) takes a Variant parameter, and returns a Variant - you can also use its little brother Format$, which takes a String and returns a String, eliminating implicit conversions along the way

A: I had a similar need to apply leading zeros ( 12 to 00012 ) to a specified range. But everything I'd found thus-far used an iterative cell-by-cell approach. I found an older but still valuable posting from SiddHarth Rout. His posting pertains to case conversion ( lower to upper case ) but I found it adapted nicely to applying leading zeros.
Here is link to SiddHarth's posting:
Convert an entire range to uppercase without looping through all the cells

Here is the adaptation for applying leading zeros to a specified range:

Sub rngLeadingZeros(rng As Range, nbrZeros As Integer)
' Add leading zeros to a specified range.

    Dim strZeros As String
    Dim x As Integer

    'build string as required for text() function:
    For x = 1 To nbrZeros
        strZeros = strZeros & "0"
    Next

    'make sure the range is formatted as text:
    rng.NumberFormat = "@"

    'apply the format to the range:
    rng = Evaluate("index(text(" & rng.Address & ", """ & strZeros & """),)")

End Sub

Sub testZ()
    With ActiveSheet
        rngLeadingZeros .Range("e3:e9"), 5
    End With
End Sub


text:
Q: log4j2 configuration builder instead of xml file I have followed the instructions here almost exactly -
http://logging.apache.org/log4j/2.x/manual/customconfig.html
in the part under "Initialize Log4j Using ConfigurationBuilder with a Custom ConfigurationFactory
it says on this page that
The below example overrides the getConfiguration() method to return a
Configuration created by the ConfigurationBuilder. This will cause the
Configuration to automatically be hooked into Log4j when the LoggerContext
is created. In the example below, because it specifies a supported type of
"*" it will override any configuration files provided.

but I am not quite sure what this means...
I can't get it to use my custom configuration factory built configuration instead of the log4j2.xml one. I have tried making that file empty or deleting it and I get a "No Logging Configuration found" error.
I have tried initializing my custom configuration factory, and setting the loggercontext with Configurator.initialize with that configuration, as well as setting a configuration file to that configuration then initializing log4j2 after that but it still wont work...
    customConfigurationFactory factory = new customConfigurationFactory(true, true, 5, 2, true);
    LoggerContext loggerContext = (LoggerContext) LogManager.getContext(false);
    loggerContext = Configurator.initialize(factory.getConfiguration(loggerContext, ConfigurationSource.NULL_SOURCE));
    Configuration config;
    config = loggerContext.getConfiguration();

and it still won't accept the configuration factory configuration, even though i am initializing the logger after the code above
it is building the configuration when I call that code above, as i see the messages building it in the console, however,  even though it is building the configuration log4j2 is not using it as I am getting this error -
[Fatal Error] log4j2.xml:1:1: Premature end of file.
ERROR StatusLogger Error parsing

(I left a blank xml file when i get this error and if I remove xml file completely I get there is no configuration error)
I am told it has to be recognized as a plug in and this custom configuration factory class can be used in place of an xml file, so i added this declaration at the top -
@Plugin(name = "CustomConfigurationFactory", category = ConfigurationFactory.CATEGORY)
@Order(50)

does anyone have any idea on how you initialize log4j2 with this custom configuration factory plugin class like you are supposedly supposed to be able to do?

redpajama_set_name: RedPajamaStackExchange


text:
Q: LNK1004: Cannot open file 'Jsfwbase12D.lib' So, I'm a bit confused on this error that I'm getting while compiling/linking a C++ project.
In the Input section of the Linker configuration, we have a additional dependency with the file name Jsfwbase12D.lib.  This file was recently changed to Jsfwbase12.lib without the capital D.  I changed the references within the project to the new file name and then attempted to re-compile and got the below error message.
Error   2   fatal error LNK1104: cannot open file 'Jsfwbase12D.lib' m5gaddrs    m5gaddrs

I opened up the vcproj file in notepad and searched for the old file name and it found zero results.
Does anyone have any idea why the linker isn't looking for the correct file and instead trying to find the old one?
Edit:
I opened the obj file in notepad and found the old Jsfwbase12D.lib reference.  So it appears that's why the linker is failing.  Now the real question is, why is the compiler inserting those references for debug mode if they are not specified anywhere?
/DEFAULTLIB:"Jsfwbase12D.lib"

A: Your code likely contains #pragma comment(lib, "Jsfwbase12D.lib") somewhere. This informs the linker of a dependency which gets included during link time.


text:
Q: Prevent user from navigating through other pages Here's the scenario, I have 2 user which is the Employee and Resident.
The Employee has an account on our website wherein they can see all the Residents' documents and they can select those documents so that the Resident can fill it up.
BTW the Resident doesn't have an account on the website. The only way they can fill up the said documents is by sending an email to them which contains an API or through a device that will be given to them onsite and has a login session of an Employee.
How can I prevent the Resident from navigating through other pages (Go back) once the device is given to them because the Employee cannot always monitor the Resident's action.
Thanks.
Edit: So what I've done previously is I have separate accounts for these users but after thinking thoroughly, an account for the Resident is unnecessary specially when they're too old to use devices. Logging in/out between Resident and Employee just to fill up documents will double up the process.
I'm thinking if it's good to save a session like
$session = $_SESSION['fillUp'];
whenever the Employee picks a document for Resident filling it up, then upon saving the document (which the Employee can only do) the form will then ask for a security code to be input by the Employee so that the document will be saved and unset the session.
Having that session checked on every other page except the document page if it exists will redirect the Resident to the document thus preventing navigation when filling up a document.
// Check session 'fillUp' for every controller except controller sign
public function beforeAction($action)
{
   if (Yii::$app->controller->id != 'sign') {
      $session = Yii::$app->session;

      // session 'fillUp' contains the url of the document to be signed
      if ($session->has('fillUp')) {
         $this->redirect($session->get('fillUp'));
      }
   }
}

A: You will never stop people from using the browser's default navigation options. Whether than be browser back buttons, or swiping to navigate backwards. I've seen people in user experience testing sessions swipe to navigate backward by mistake.
Instead of trying to lock the door, we need to deal with what happens on the previous page(s) should they achieve the back navigation. Let's deal with the posibility that it may happen.
There are two pieces to what you're trying to achieve.
The first is to stop the browser from caching the previous page(s). This means any back navigation will trigger a request to the server to get the information.
We can stop this by adding headers to the page content of sensitive pages:
Send cache control: no-cache, pragma: no-cache and expire: -1 headers.
The second part is to decide what to do if somebody does navigate back, and the server gets a request for that page again.
You certainly want to mark the session as 'resident' on the first hit of the resident page. From there if the session has a 'resident' marker in the session, you may choose to show a warning with a link back to the page they should be visiting, or simply redirect them back to it without intereaction. Personally I think the warning with a link is clearer and will stop confusion.


text:
Q: 5 fold cross validation gives reverse learning curve in SVM I am looking into a numeral classification (Devanagari OCR). I am training data on PECL SVM model in php. To plot the learning curve I started testing robustness of SVM by 5 fold cross validation. I got result like below -

When less number of dataset is there it gives high accuracy but while dataset size increased accuracy decreased gradually. I know SVM works well in less number of dataset. But my project supervisor is not satisfied with that. I searched over internet then I found nothing about such problem. Is there any problem in my Model(SVM with RBF kernel provided by PECL SVM)? or is it Normal as property of SVM. Classifying new image by model is perfect.


text:
Q: Delete file on Remote Server Using WMI I'm trying to delete an existing file on the remote server using WMI.
Here's my code:
string name = @"\\servername\\OCROut\\basketball.txt";

ConnectionOptions options = new ConnectionOptions(remoteServer, "username", "password", "ntlmdomain:domainName", ImpersonationLevel.Impersonate, AuthenticationLevel.Default, true, null, System.TimeSpan.MaxValue);

                            ManagementScope scope = new ManagementScope("\\\\server\\root\\cimv2", options);
                            scope.Connect();
                            var query = new ObjectQuery(string.Format("SELECT * FROM CIM_Datafile WHERE Drive = 'D' AND Name = '{0}' AND Filename = 'basketball' and Extension = 'txt'", name));
                            ManagementObjectSearcher searcher = new ManagementObjectSearcher(scope, query);
                            var tobeDeleted = searcher.Get();

                            foreach (ManagementObject item in searcher.Get())
                            {
                                item.InvokeMethod("Delete", null);
                            }

The Query is working file but but my Count = 0  when i'm executing the searcher.Get() method. I tried everything, different slashes, without the drive, Filename and extension but nothing seem to be working and i know that the file exists.
Any help would be highly appreciated.

A: It seems which you are  passing wrong values in the params. the Name property must contain the full local path of the file, so try this :
string name = @"D:\\OCROut\\basketball.txt";
var query = new ObjectQuery(string.Format("SELECT * FROM CIM_Datafile WHERE Name = '{0}'", name));

A: WMI Script to delete single/multi files in remote server
#for single file
$file = Get-WmiObject -Query "Select * from CIM_Datafile Where Name='c:\\Desktop\\a.txt'" -ComputerName 10.14.34.81 -Credential administrator
if($file)
{
     $file.delete()|out-null
}

#For Multiple files in a directory
$files =  Get-WmiObject -Query "ASSOCIATORS OF {Win32_Directory.Name='c:\Desktop\Temp'} Where ResultClass = CIM_DataFile" -ComputerName 10.14.34.81 -Credential administrator
if($files)
{
    $files|%{$_.Delete()|out-null}
}


text:
Q: Python OrderedDict with dictionary within list? I have a list that has multiple dictionaries inside of it. I'm trying to use OrderedDict() to accomplish iterating through the dictionary/list combo in the given order. However, I am aware how to use OrderedDict, however I am unaware how to use OrderedDict() to make a ordered dictionary that's inside an list. the following with the format of storeItems. The idea is to be able to iterate through the list using for item in storeItems: for key in item: return key, item[key] Here's what I have.
storeItems = OrderedDict()
#not sure how to declare the following list into OrderedDict() format
#the original dict/format to follow
#storeItems = [{
#        "Name": "Auto-Enter",
#        "Price": 30,
#        "Max": 100
#    }, {
#        "Name": "Multiplier",
#        "Price": 100,
#        "Max": 5
#    }, {
#        "Name": "Factory",
#        "Price": 200,
#        "Max": 3
#    }]

Any ideas?
Edit
Expected output should be the following (If I were to print() and not return):
Name: Auto-Enter
Price: 30
Max: 100
Name: Multiplier
Price: 100
Max: 5
Name: Factory
Price: 200
Max: 3

So that with (a excluded function), I could find out if the given user input().upper() matches a item throughout the list, and if so, return True.

A: Since you can not create a dictionary with duplicate keys the OrderedDict is not what you want and note that you can no't get an order like what you want from your dictionaries because if you want to extract your items by order you should stored your items in an OrderedDict at first.
If you want to get the items by printing you can simply convert your dictionaries to an unified string using str.join() method :
>>> print('\n'.join(['\n'.join(['{}:{}'.format(i,j) for i,j in d.items()]) for d in storeItems]))

Demo :
>>> print('\n'.join(['\n'.join(['{}:{}'.format(i,j) for i,j in d.items()]) for d in storeItems]))
Price:30
Max:100
Name:Auto-Enter
Price:100
Max:5
Name:Multiplier
Price:200
Max:3
Name:Factory


text:
Q: Flask Migrate using different postgres schemas ( __table_args__ = {'schema': 'test_schema']}) I'm trying to use flask, sqlalchemy, and flask_migrate...
But every time run manage.py migrate, alembic always detect my model as a new table.
I think that i put  table_args in my model to store table in a different postgres schema:
class Entry(db.Model):
    __table_args__ = {'schema': app.config['BASE_SCH']}
    id = db.Column(db.Integer, primary_key=True)
    title = db.Column(db.String(100))
    slug = db.Column(db.String(100), unique=True)
    body = db.Column(db.Text)
    status = db.Column(db.SmallInteger, default=STATUS_PUBLIC)
    created_timestamp = db.Column(db.DateTime, default=datetime.datetime.now)
    modified_timestamp = db.Column(db.DateTime, default=datetime.datetime.now, onupdate=datetime.datetime.now)

If I to delete the table_args line of my model, the flask migrate works properly. Storing my table in puclic postgres schema.
So, how can I use different postgres table schemas with flask?
Thanks!

A: Finally figured this out: there is an include_schemas option in configure that you have to set to True to force Alembic to scan all schemas before generating the migration.
(Slightly) more details: http://alembic.zzzcomputing.com/en/latest/api/runtime.html#alembic.runtime.environment.EnvironmentContext.configure.params.include_schemas
It's not completely clear to me why Alembic/Flask-Migrate was generating the migrations for tables in non default schemas without this option set in the first place... or rather, the fact that it would create migrations for non default schemas but not discover these tables in the DB is a surprising behavior.


text:
Q: Independence between 3 R.V. Let us assume we have 3 R.V. $X_1,X_2,Y$, where $Y$ is independent of $X_1$ and $Y$ is independent of $X_2$, as well. $X_1$ and $X_2$ are not independent. Then we know that it may be the case that $Y$ is not independent $X_1+X_2$. Now, I have three doubts:
1) If we said that $Y$ was independent of $(X_1,X_2)$, then $Y$ would be independent of $X_1+X_2$. Right?
2) Is there any other simple example in which $Y$ is independent of $X_1$ and $Y$ is independent of $X_2$, but $Y$ is not independent $X_1+X_2$? Beyond the one in
https://stats.stackexchange.com/questions/222242/is-the-sum-of-two-variables-independent-of-a-third-variable-if-they-are-so-on-t
3) What would change if we added the information that the 3 r.v. are jointly gaussian? Would it be true that if $Y$ is independent of $X_1$ and $Y$ is independent of $X_2$ then $Y$ is independent of$X_1+X_2$?
Thank you

A: 1). Yes. This is actually argued in the first answer in the link you gave.
2). If you consider addition in say $\mathbb{F}_2$ (i.e., modulo 2), there is the very simple example of $X_1,X_2$ independent uniform on $\mathbb{F}_2$ and $Y=X_1+X_2$.
What's below is ignoring the keyword "jointly", so I'll delete.
3). Without loss of generality, we can assume $X_1,X_2,Y$ are all zero-mean and have unit variance, since subtracting a constant to all will not change the dependency structure nor Gaussianity, and renormalization won't either. Since $(X_1,X_2,Y)$ are jointly Gaussian and $X_1,Y$ (resp. $X_2,Y$) are independent, the covariance matrix is
$$\Sigma = \begin{pmatrix}
1&\alpha & 0\\
\alpha & 1& 0\\
0& 0& 1\\
\end{pmatrix}$$
where $\alpha = \mathbb{E}[X_1X_2] = \operatorname{Cov}(X_1,X_2)$.
Then $(X_1+X_2,Y)$ is jointly Gaussian (it is a linear transformation of $(X_1,X_2,Y)$):
$$
\begin{pmatrix}
X_1+X_2\\Y
\end{pmatrix} = \underbrace{\begin{pmatrix}
1&1&0\\
0&0&1
\end{pmatrix}}_{A}\begin{pmatrix}
X_1\\X_2\\Y
\end{pmatrix}
$$
and its covariance matrix is $$\Sigma' = A\Sigma A^T = \begin{pmatrix}
2(1+\alpha) & 0\\ 0&1
\end{pmatrix}$$
showing that $X_1+X_2$ and $Y$ are independent (being jointly Gaussian and uncorrelated).
4). If you remove the "jointly" from "jointly gaussian", however, this is not true. Consider $X_1,Y$ independent standard Gaussians $N(0,1)$, set $R = \operatorname{sign}(Y)$ and $X_2 = RX_1$. Then

*

*$X_1$ and $Y$ are independent (by definition)

*$X_2$ and $Y$ are independent (check it)

*$X_1+X_2=(1+R)X_2$ and $Y = R|Y|$ are not independent: $Y$ is negative iff $X_1+X_2=0$, for instance.


text:
Q: Configuring the Tomcat Plugin of Munin It would be great if anyone can share a working configuration for the tomcat_ plugin of munin. I need to monitor several tomcat instances on one machine.
So far I can't figure out:

*

*which are the available metrics for the tomcat_ plugin? (documentation is quite poor - at least what I've managed to find)

*how to configure it correctly?

A: share my experiences,hope it helps
step1: enable tomcat plugins
sudo ln -s /usr/share/munin/plugins/tomcat_access /etc/munin/plugins/tomcat_access
sudo ln -s /usr/share/munin/plugins/tomcat_jvm /etc/munin/plugins/tomcat_jvm
sudo ln -s /usr/share/munin/plugins/tomcat_threads /etc/munin/plugins/tomcat_threads
sudo ln -s /usr/share/munin/plugins/tomcat_volume /etc/munin/plugins/tomcat_volume

step2: config tomcat manager status page where the plugin read info from
edit tomcat-users.xml and add
<user username="munin" password="munin" roles="manager"/>
<role rolename="manager"/>

access http://munin:munin@localhost:8080/manager/status?XML=true to see if it works.
check official document for details:Manager App HOW-TO
step3: config tomcat plugins
edit /etc/munin/plugin-conf.d/munin-node and add
[tomcat_*]
env.ports 8080
env.user munin
env.password munin

step4: local check
run and check messages.

/etc/munin/plugins/tomcat_jvm

normally you need install simple xml support,
sudo apt-get install libxml-simple-perl
#OR
sudo yum install perl-XML-Simple

step5: update munin node
sudo /etc/init.d/munin-node restart
check you graphics, it should works.

A: First, it's a great answer! However, when you mention manually running and checking using "/etc/munin/plugins/tomcat_jvm," this doesn't pick up the environment variables from /etc/munin/plugin-conf.d/munin-node (i.e. user/password), so it fails. The correct way is to use munin-run:
$ sudo /etc/munin/plugins/tomcat_jvm
free.value U
used.value U
max.value U

$ sudo munin-run tomcat_jvm
free.value 13894584
used.value 40762440
max.value 1073741824

Also, I'm running Tomcat 7 and some of the tomcat plugins expect connectors with the name of the form http-${PORT} but my connectors are of the form http-apr-${PORT} so I also needed to add this to the [tomcat_*] stanza of munin-node:
env.connector "http-apr-8081"

A: My reputation doesn't allow commenting, but correct env.connector is crucial for other plugins than tomcat_jvm. In my case I needed to drop quotation marks ("), i.e.
 env.connector jk-127.0.0.1-8009

If you can't find the correct connector name, try either
$ lynx http://localhost:8080/manager/html

or
$ curl http://localhost:8080/manager/status?XML=true -u munin:munin | grep connector

Also note, that in tomcat 6.0.30 or later, the roles for manager are more fine-grained. I haven't yet tried myself, but according to the documentation role manager-status in tomcat-users.xml should work in this case.


text:
Q: What does overflow:hidden do besides hiding a scroll? What does overflow:hidden do besides hiding a scroll? I fixed one issue just by an accident adding overflow:hidden. I thought it just makes scroll invisible. What else does it do? I couldn't find any good explanation.

A: An overflow property not set to visible creates a new block formatting context:

Floats, absolutely positioned elements, block containers (such as inline-blocks, table-cells, and table-captions) that are not block boxes, and block boxes with 'overflow' other than 'visible' (except when that value has been propagated to the viewport) establish new block formatting contexts for their contents.

A: in layman's terms it hides the clipped (parts that extend beyond the rectangle of the div that has its visibility set) so that the contents of the div that extend beyond the boundaries of the parent rectangle, are not visible (and not scrollable to).
Conversely visible will render those parts even when they are wider/taller than the parent and auto will hide them but allow access to them via a scrollbar.
So, if you have a parent div which is 100px x 100px and you start putting content in that div, the moment that content extends beyond the 100px boundary those parts stop being visible. It is possible to force scroll to them using javascript, depending on the browser, even if the visibility is set to hidden.

A:
The overflow CSS property specifies whether to clip content, render scroll bars or display overflow content of a block-level element.

docs


text:
Q: Display the ID value in workflow Hi I have one requirement where object 'A' has a lookup of account. I have one more  field which should display the owner of account whose lookup I have given. Owner field in account also has a lookup to user.
I wrote a workflow to get owner of account field but it displays the owner id i want name to be displayed.

A: I am considering following API names for the fields you've mentioned-

*

*Account - AccountId

*OwnerID - Owner__c
*Use like that AccountId.Owner__r.name


text:
Q: Sketch phase portray of $ x'' + 3x^2 + - 3 = 0 $ I am sketching the phase portray of $ x'' + 3x^2 + - 3 = 0 $.
First of all I found the corresponding ODE system:
\begin{align*}
  x' = y \\
  y' = -3x^2 + 3
\end{align*}
The critical points are (-1,0) and (1,0). However I am going to center it in the origin so I will ignore the +3, the solution is the same anyway.
I tried to use the method of linearization but I an eigenvalue of real part equals to 0 and this does not give information.
Then I tried using Liaupnov method, so I need to find a function $V(x,y)$ such that $V(0,0)=0$, $V(x,y) \geq 0$ and $V'(x,y) \leq 0$, this would mean that the origin is stable. However I am struggling to find such a function here. Any hints?

A: Write the Jacobian at the critical points ${\bf x}^*$
$$
J({\bf x}^*) = \pmatrix{0 & 1 \\ -6x^* & 0}
$$
with eigenvalues $\lambda^2 = -6x^*$. That means that for

${\bf x}_1^* = (+1,0)$ the eigenvalues are $\lambda_1^{\pm} = \pm i \sqrt{6}$

Solution is a cycle

${\bf x}_2^* = (1,0)$ the eigenvalues are $\lambda_2^{\pm} = \pm \sqrt{6}$

Solution is a saddle point. You can find the directions of the stable and unstable manifolds by calculating the eigenvectors. I will leave that part to you
Here's a sketch


text:
Q: Nominatim-UI config.theme.js not applying? This is also logged in the project specific issues list... https://github.com/osm-search/nominatim-ui/issues/194
I'm setting up a Nominatim server, and as part of that, I've set my /theme/config.theme.js file with the defaults I want (Default Lat/Long/API Endoint location).
Unfortunately, that seems to not be being read by the nominatim-ui - so no matter what value I set, this isn't taking effect.
config.theme.js looks like:
Nominatim_Config.Nominatim_API_Endpoint = 'http://192.168.1.2';
Nominatim_Config.Page_Title = 'Local Nominatim Server';
Nominatim_Config.Reverse_Only: true;
Nominatim_Config.Reverse_Default_Search_Zoom: 15;
Nominatim_Config.Map_Default_Lat: -33.85237;
Nominatim_Config.Map_Default_Lon: 151.21129;
Nominatim_Config.Map_Default_Zoom: 16;

and yet, the Nominatim API endpoint is still showing http://localhost/nominatim/, and not taking any default position changes.
I've tried changing the config.defaults.js as well, to no avail.
Any ideas why these changes aren't being picked up by nominatim-ui?
For the record, the Web server itself is running (and answers reverse queries when submitted), so that is fine - I'm just struggling to get the UI to point to the correct location. The Documentation simply says "change the config.theme.js", but that isn't working for me.
As a test, I've set the permissions to 777 (fully open), so that doesn't seem to be it. Obviously want to set those sensibly when I'm working.
Current release I'm using is latest (v3.2.8)
https://github.com/osm-search/nominatim-ui
Ubuntu 22.04.2 (LTS) fully patched
Hosting via NginX web interface (1.18.0)
Nominatim is also latest (4.1.0) - and again, that's working when I query directly.
OSM correctly imported for my region (Aus/Oceania), and db import successfully completed.
EDIT:
Since my comment below mangles code, updating here with syntax formatting:
OK, thanks to @ionia on the github project - the syntax wasn't correct (had : instead of = so the file had invalid syntax, and thus wasn't used at all.
Corrected file looks like:
Nominatim_Config.Nominatim_API_Endpoint = 'http://192.168.1.2';
Nominatim_Config.Page_Title = 'Local Nominatim Server';
Nominatim_Config.Reverse_Only = true;
Nominatim_Config.Reverse_Default_Search_Zoom = 15;
Nominatim_Config.Map_Default_Lat = -33.85237;
Nominatim_Config.Map_Default_Lon = 151.21129;
Nominatim_Config.Map_Default_Zoom = 16;


text:
Q: Installing cURL modules for Perl on Windows I have ActivePerl 5.14.2 on my Windows machine. I have been trying to install the LWP cURL module. I have already installed the libcurl-dev library and GCC on my machine.
I also understand that LWP cURL has a dependency on the WWW-Curl-Easy module. So I installed that too. I installed all these through the command lines using the steps given in the Readme files. I ran the perl makefile.pl command followed by a make and a make install. No errors were given out during the installation.
I am trying to execute this sample code to test my LWP cURL installation:
    use LWP::Curl;
    use strict;
    use warnings;

    my $lwpcurl = LWP::Curl->new();
    my $content = $lwpcurl->get('http://search.cpan.org','http://www.cpan.org');

I am receiving the below error:

Can't locate loadable object for module WWW::Curl in @INC (@INC
  contains: C:/Perl64/site/lib C:/Perl64/lib .) at
  C:/Perl64/site/lib/WWW/Curl.pm line 11. BEGIN failed--compilation
  aborted at C:/Perl64/site/lib/WWW/Curl.pm line 11. Compilation failed
  in require at C:/Perl64/site/lib/WWW/Curl/Easy.pm line 9. Compilation
  failed in require at C:/Perl64/site/lib/LWP/Curl.pm line 5. BEGIN
  failed--compilation aborted at C:/Perl64/site/lib/LWP/Curl.pm line 5.
  Compilation failed in require at D:\Varsha\Curl.pl line 1. BEGIN
  failed--compilation aborted at D:\Varsha\Curl.pl line 1.

Where am I going wrong?

A: This is probably not the direction you want to go, but I'd advise you to consider upgrading your perl and changing distributions:

*

*Install Strawberry Perl -  5.18.2.2 is the currently recommended version.

*Install cpanm: perl -MCPAN -e "install App::cpanminus"

*Install LWP::Curl: cpanm LWP::Curl
I won't bother trying convince you of the change, but Strawberry Perl and cpanm in combination make installing modules a lot easier than having to dealing with the proprietary ppm's of ActivePerl in my opinion.
Just something to consider if you ever get tired of the occasional headaches.

A: The error means that WWW::Curl is either not installed or its path is not searchable (it's not in @INC). So the solutions are

*

*Make sure that the module is installed.

*Add the path where the module is installed to the @INC. Since you are on Windows, you can use set PERL5LIB = c:\path\to\dir
For a permanent solution follow the below:
Right-click My Computer and click Properties.
In the System Properties window, click on the Advanced tab.
In the Advanced section, click the Environment Variables button.
In the Environment Variables window in the "User variables for Foo Bar" section click on New and type in the following:
Variable name: PERL5LIB
Variable value: c:\path\to\dir
Then click OK 3 times. Windows that you open after this will already know about the new variable. Type this in the command window, to see the newly set value:
echo %PERL5LIB%

This will add the private /home/foobar/code directory (or c:\path\to\dir directory) to the beginning of @INC for every script that is executed in the same environment.
Also see: Installing perl dependency automatically in perl


text:
Q: Heroku: Cannot Get / issue for a Node project that works locally I could really use some help on an old app I started working on a long time ago when I was first teaching myself JS. It has kind of turned into a labor of love that I work on in my spare time, a project I don't want to give up on, but I am really stuck on trying to get it hosted on Heroku. It works fine locally, but all I get now is cannot get /
My Heroku Logs:
2022-05-03T03:50:03.514079+00:00 app[web.1]: at new ConnectionString (/app/node_modules/mongodb-connection-string-url/lib/index.js:86:19)
2022-05-03T03:50:03.514079+00:00 app[web.1]: at parseOptions (/app/node_modules/mongoose/node_modules/mongodb/lib/connection_string.js:217:17)
2022-05-03T03:50:03.514079+00:00 app[web.1]: at new MongoClient (/app/node_modules/mongoose/node_modules/mongodb/lib/mongo_client.js:62:63)
2022-05-03T03:50:03.514080+00:00 app[web.1]: at /app/node_modules/mongoose/lib/connection.js:784:16
2022-05-03T03:50:03.514080+00:00 app[web.1]: at new Promise (<anonymous>)
2022-05-03T03:50:03.514081+00:00 app[web.1]: at NativeConnection.Connection.openUri (/app/node_modules/mongoose/lib/connection.js:781:19)
2022-05-03T03:50:03.514081+00:00 app[web.1]: at /app/node_modules/mongoose/lib/index.js:340:10
2022-05-03T03:50:03.514081+00:00 app[web.1]: at /app/node_modules/mongoose/lib/helpers/promiseOrCallback.js:32:5
2022-05-03T03:50:03.514082+00:00 app[web.1]: at new Promise (<anonymous>)
2022-05-03T03:50:03.514083+00:00 app[web.1]: at promiseOrCallback (/app/node_modules/mongoose/lib/helpers/promiseOrCallback.js:31:10) No Connection!!  Mongo database failed!
2022-05-03T03:50:12.000000+00:00 app[api]: Build succeeded
2022-05-03T03:50:55.817350+00:00 heroku[router]: at=info method=GET path="/" host=the-lottery-genie.herokuapp.com request_id=4854045e-6313-48e1-8c2d-fe6fb75aa356 fwd="212.102.61.144" dyno=web.1 connect=0ms service=12ms status=404 bytes=619 protocol=https

Its telling me about an Invalid Schema right now, which is a new development related to trying to put database connection information as a heroku config var, not sure whats going on there, but the cannot get / issue happens even when I hardcode the login information right into the app without any enviorment vars.
Even if I had not set up the database, yet, the front end should still be working on heroku right? I am very lost with this, and suspect it dates back to an older bad habit of mine where I would use NG update and NPM update / upgrade very liberally to try and keep up with the latest versions of everything without really understanding about breaking changes and updating correctly (I've seen learned to be very careful about updating) but I cant for the life of me figure out whats going on with this project right now.
Any help would be greatly appreciated. Thank you.
Package.Json
{
  "name": "the-lottery-djinni",
  "version": "0.0.0",
  "main": "server.js",
  "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "build": "ng build",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e",
    "start:server": "nodemon server.js",
    "heroku-postbuild": "ng build --configuration production"
  },
  "private": true,
  "dependencies": {
    "@angular-devkit/core": "^13.3.2",
    "@angular/animations": "^13.3.2",
    "@angular/cdk": "^13.3.2",
    "@angular/cli": "^13.3.2",
    "@angular/common": "^13.3.2",
    "@angular/compiler": "^13.3.2",
    "@angular/core": "^13.3.2",
    "@angular/forms": "^13.3.2",
    "@angular/material": "^13.3.2",
    "@angular/platform-browser": "^13.3.2",
    "@angular/platform-browser-dynamic": "^13.3.2",
    "@angular/platform-server": "^13.3.2",
    "@angular/router": "^13.3.2",
    "ajv": "^8.11.0",
    "bcrypt": "^5.0.1",
    "body-parser": "^1.20.0",
    "bootstrap": "^5.1.3",
    "braces": "^3.0.2",
    "chalk": "^5.0.1",
    "core-js": "^3.21.1",
    "cors": "^2.8.5",
    "dotenv": "^16.0.0",
    "express": "^4.17.3",
    "handlebars": "^4.7.7",
    "hbs": "^4.2.0",
    "jquery": "^3.6.0",
    "jsonwebtoken": "^8.5.1",
    "mongodb": "^4.5.0",
    "mongoose": "^6.2.10",
    "mongoose-unique-validator": "^3.0.0",
    "multer": "^1.4.4",
    "node": "17.7.2",
    "npm": "^8.6.0",
    "path": "^0.12.7",
    "popper.js": "^1.16.1",
    "rxjs": "^7.5.5",
    "rxjs-compat": "^6.6.7",
    "save": "^2.4.0",
    "symbol-observable": "^4.0.0",
    "tar": "^6.1.11",
    "tslib": "^2.3.1",
    "zone.js": "~0.11.5"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "^13.3.2",
    "@angular/compiler-cli": "^13.3.2",
    "@angular/language-service": "^13.3.2",
    "@types/jasmine": "~4.0.2",
    "@types/jasminewd2": "^2.0.10",
    "@types/node": "^17.0.23",
    "codelyzer": "^6.0.2",
    "enhanced-resolve": "^5.9.2",
    "install": "^0.13.0",
    "jasmine-core": "~4.0.1",
    "jasmine-spec-reporter": "~7.0.0",
    "karma": "~6.3.17",
    "karma-chrome-launcher": "~3.1.1",
    "karma-coverage-istanbul-reporter": "~3.0.3",
    "karma-jasmine": "~4.0.2",
    "karma-jasmine-html-reporter": "^1.7.0",
    "nodemon": "^2.0.15",
    "protractor": "~7.0.0",
    "rxjs-tslint": "^0.1.8",
    "ts-node": "~10.7.0",
    "tslint": "~6.1.0",
    "typescript": "^4.6.3",
    "webpack": "^5.72.0"
  },
  "engines": {
    "node": "17.7.2",
    "npm": "8.1.4"
  },

Git Hub Repo:
https://github.com/AMazilu77/Lottery-Genie

A: The node backend starts correctly with the command node server.js but the Angular resources are not found.
On Heroku an application runs (listens) only on one port so you cannot run node and angular CLI at the same time.
The option I suggest is to use Docker which is nicely supported by Heroku: build an image including the Angular resources (dist) which runs the Node backend. The Dockerfile would look something like that:
note: you might have to change/adjust steps and paths
FROM node:16-alpine AS ui-build

WORKDIR /Lottery-Genie

COPY src/ ./src/
RUN cd src && npm install @angular/cli && npm install && npm run build

FROM node:16-alpine AS server-build

WORKDIR /Lottery-Genie
COPY --from=ui-build /Lottery-Genie/src/dist ./src/dist
COPY backend/ ./backend/
RUN cd node-api && npm install

WORKDIR /Lottery-Genie/backend

CMD [ "npm", "start" ]

Go ahead and deploy the application on Heroku Docker Registry
Another option is (instead of using Docker) is to package the Angular resources during the build using heroku-postbuild in the application package.json. This effectively creates a dist folder with all html and javascript files.
"heroku-postbuild": "ng build — prod"

In case you prefer option #2 this is good article: Angular app on Heroku

A: The main question to be answered.

*

*Did you whitelist ip address of heroku instance as a trusted ip inside Atlas MongoDB?

https://www.mongodb.com/developer/how-to/use-atlas-on-heroku/
You can't connected direct to clusters without whitelist the requested ip for security reasons.
Let me know if that's help.

A: Problem was in the angular.json file. I had to add the backend section to the file path. Heroku was looking for the DIST folder in the backend directory, not the root.
"outputPath": "backend/dist/The-Lottery-Djinni"

A: You need to arrange your routs before your running your html file like
then it will work get roots other wise its matches get * root
import express  from "express";
const path = require('path');
const app = express();

app.use(express.json({ limit: '500mb' }));
app.use(express.urlencoded({ extended: true, limit: '500mb' }));

app.use('/api', router); //==> u need to place it before app.get('*')

app.use(express.static(path.join(__dirname, '../public')));
app.get('*', (req, res) => {
    res.sendFile(path.join(__dirname, '../public/index.html'));
});


text:
Q: How to integrate HTML form into django view and model? I have one html file which contain submission form.
I want to use this HTML form in django with model and view.
I dont want to use form class in html like
<form method="post" action="">

{% csrf_token %}

{{ form }}

<input type="submit" value="Register"/>
</form>

I want to use complete form code in HTML and use django model to store that data in database.
How can I do that?

A: Please update the question that you want to use jQuery.Django by defaults generate id for its form element.
As avinash already said you can always inspect the element and get the id and classses but some time we need custom class in that case you can use something like.
If you want to write your own custom fields.
class myForm(forms.ModelForm):
    class Meta:
        model = ModeName
        widgets = {
            'field_one': forms.TextInput(attrs={'id':'foo', 'name':'foo'})
            'field_two': forms.TextInput(attrs={'id':'bar', 'name':'bar'})
    }


text:
Q: Allow flagging from within "New Answers to Questions More Than 30 Days Old" I frequently use the New Answers to Questions More Than 30 Days Old tool to find spam/NAA answers. A lot of them are often very obviously spam such as this, or very obviously not an answer, such as this.
To flag these, I need to open them in a new tab, flag it, shut the tab and go back to looking through the list.
Could we please have the flag link added to the answers here as well? It would streamline the process and save me, and many other users who do this, a lot of time.


text:
Q: EventBus Response inside IntentService On implementing onHandleIntent(Intent inte) of IntentService Class,i need to call a webservice  which is added in another class say "Webservices.Class".Through  EventBus.getDefault().post(new ResponseEvent()),it is delivering response in all activities / fragments etc,But it is not delivering the response inside the intentService class which i called.Does anybody came across this situation?
I Used onEventMainThread(ResponseEvent event) for receving response
Thanks in Advance.

A: IntentService is running on back thread so posting it on the main thread wont work.
I guess that u r using IntentService becuase of push notification, if u want eventbus then u need to open a Service and let it implement the EventBus.


text:
Q: how to compare words and find match words in R I have data frame like this:
     var1                           var2                     result
 c("apple", "www")            c("apple", "zzz")           "apple"
 c("dog", "cat", "kkk")       c("cat", "kkk")             "cat", "kkk"

I want to find words that overlap in these two variables(var1 and var2) in dataframe in R.

A: I don't think data.frame() can handle vectors as individual elements, so I used data_frame() from the tibble package:
df <- tibble::data_frame(var1 = list(c("apple", "www"), c("dog", "cat", "kkk")), var2 = list(c("apple", "zzz"), c("cat", "kkk")))

apply function by row, where the function takes the intersection of the first and second list elements:
apply(df, 1, function(x) intersect(x[[1]], x[[2]]))
[[1]]
[1] "apple"

[[2]]
[1] "cat" "kkk"


text:
Q: How to send POST request in JSON using HTTPClient in Android? I'm trying to figure out how to POST JSON from Android by using HTTPClient. I've been trying to figure this out for a while, I have found plenty of examples online, but I cannot get any of them to work.  I believe this is because of my lack of JSON/networking knowledge in general.  I know there are plenty of examples out there but could someone point me to an actual tutorial? I'm looking for a step by step process with code and explanation of why you do each step, or of what that step does. It doesn't need to be a complicated, simple will suffice.
Again, I know there are a ton of examples out there, I'm just really looking for an example with an explanation of what exactly is happening and why it is doing that way.
If someone knows about a good Android book on this, then please let me know.
Thanks again for the help @terrance, here is the code I described below
public void shNameVerParams() throws Exception{
     String path = //removed
     HashMap  params = new HashMap();

     params.put(new String("Name"), "Value");
     params.put(new String("Name"), "Value");

     try {
        HttpClient.SendHttpPost(path, params);
    } catch (Exception e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
 }

A: Too much code for this task, checkout this library https://github.com/kodart/Httpzoid
Is uses GSON internally and provides API that works with objects. All JSON details are hidden.
Http http = HttpFactory.create(context);
http.get("http://example.com/users")
    .handler(new ResponseHandler<User[]>() {
        @Override
        public void success(User[] users, HttpResponse response) {
        }
    }).execute();

A: Here is an alternative solution to @Terrance's answer. You can easly outsource the conversion. The Gson library does wonderful work converting various data structures into JSON and the other way around.
public static void execute() {
    Map<String, String> comment = new HashMap<String, String>();
    comment.put("subject", "Using the GSON library");
    comment.put("message", "Using libraries is convenient.");
    String json = new GsonBuilder().create().toJson(comment, Map.class);
    makeRequest("http://192.168.0.1:3000/post/77/comments", json);
}

public static HttpResponse makeRequest(String uri, String json) {
    try {
        HttpPost httpPost = new HttpPost(uri);
        httpPost.setEntity(new StringEntity(json));
        httpPost.setHeader("Accept", "application/json");
        httpPost.setHeader("Content-type", "application/json");
        return new DefaultHttpClient().execute(httpPost);
    } catch (UnsupportedEncodingException e) {
        e.printStackTrace();
    } catch (ClientProtocolException e) {
        e.printStackTrace();
    } catch (IOException e) {
        e.printStackTrace();
    }
    return null;
}

Similar can be done by using Jackson instead of Gson. I also recommend taking a look at Retrofit which hides a lot of this boilerplate code for you. For more experienced developers I recommend trying out RxAndroid.

A: I recommend using this HttpURLConnectioninstead HttpGet. As HttpGet is already deprecated in Android API level 22.
HttpURLConnection httpcon;
String url = null;
String data = null;
String result = null;
try {
  //Connect
  httpcon = (HttpURLConnection) ((new URL (url).openConnection()));
  httpcon.setDoOutput(true);
  httpcon.setRequestProperty("Content-Type", "application/json");
  httpcon.setRequestProperty("Accept", "application/json");
  httpcon.setRequestMethod("POST");
  httpcon.connect();

  //Write
  OutputStream os = httpcon.getOutputStream();
  BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(os, "UTF-8"));
  writer.write(data);
  writer.close();
  os.close();

  //Read
  BufferedReader br = new BufferedReader(new InputStreamReader(httpcon.getInputStream(),"UTF-8"));

  String line = null;
  StringBuilder sb = new StringBuilder();

  while ((line = br.readLine()) != null) {
    sb.append(line);
  }

  br.close();
  result = sb.toString();

} catch (UnsupportedEncodingException e) {
    e.printStackTrace();
} catch (IOException e) {
    e.printStackTrace();
}

A: There are couple of ways to establish HHTP connection and fetch data from a RESTFULL web service. The most recent one is GSON. But before you proceed to GSON you must have some idea of the most traditional way of creating an HTTP Client and perform data communication with a remote server. I have mentioned both the methods to send POST & GET requests using HTTPClient.
/**
 * This method is used to process GET requests to the server.
 *
 * @param url
 * @return String
 * @throws IOException
 */
public static String connect(String url) throws IOException {

    HttpGet httpget = new HttpGet(url);
    HttpResponse response;
    HttpParams httpParameters = new BasicHttpParams();
    // Set the timeout in milliseconds until a connection is established.
    // The default value is zero, that means the timeout is not used.
    int timeoutConnection = 60*1000;
    HttpConnectionParams.setConnectionTimeout(httpParameters, timeoutConnection);
    // Set the default socket timeout (SO_TIMEOUT)
    // in milliseconds which is the timeout for waiting for data.
    int timeoutSocket = 60*1000;

    HttpConnectionParams.setSoTimeout(httpParameters, timeoutSocket);
    HttpClient httpclient = new DefaultHttpClient(httpParameters);
    try {

        response = httpclient.execute(httpget);

        HttpEntity entity = response.getEntity();
        if (entity != null) {
            InputStream instream = entity.getContent();
            result = convertStreamToString(instream);
            //instream.close();
        }
    }
    catch (ClientProtocolException e) {
        Utilities.showDLog("connect","ClientProtocolException:-"+e);
    } catch (IOException e) {
        Utilities.showDLog("connect","IOException:-"+e);
    }
    return result;
}

 /**
 * This method is used to send POST requests to the server.
 *
 * @param URL
 * @param paramenter
 * @return result of server response
 */
static public String postHTPPRequest(String URL, String paramenter) {

    HttpParams httpParameters = new BasicHttpParams();
    // Set the timeout in milliseconds until a connection is established.
    // The default value is zero, that means the timeout is not used.
    int timeoutConnection = 60*1000;
    HttpConnectionParams.setConnectionTimeout(httpParameters, timeoutConnection);
    // Set the default socket timeout (SO_TIMEOUT)
    // in milliseconds which is the timeout for waiting for data.
    int timeoutSocket = 60*1000;

    HttpConnectionParams.setSoTimeout(httpParameters, timeoutSocket);
    HttpClient httpclient = new DefaultHttpClient(httpParameters);
    HttpPost httppost = new HttpPost(URL);
    httppost.setHeader("Content-Type", "application/json");
    try {
        if (paramenter != null) {
            StringEntity tmp = null;
            tmp = new StringEntity(paramenter, "UTF-8");
            httppost.setEntity(tmp);
        }
        HttpResponse httpResponse = null;
        httpResponse = httpclient.execute(httppost);
        HttpEntity entity = httpResponse.getEntity();
        if (entity != null) {
            InputStream input = null;
            input = entity.getContent();
            String res = convertStreamToString(input);
            return res;
        }
    }
     catch (Exception e) {
        System.out.print(e.toString());
    }
    return null;
}

A: In this answer I am using an example posted by Justin Grammens.
About JSON
JSON stands for JavaScript Object Notation. In JavaScript properties can be referenced both like this object1.name and like this  object['name'];. The example from the article uses this bit of JSON.
The Parts
A fan object with email as a key and foo@bar.com as a value
{
  fan:
    {
      email : 'foo@bar.com'
    }
}

So the object equivalent would be fan.email; or fan['email'];. Both would have the same value
of 'foo@bar.com'.
About HttpClient Request
The following is what our author used to make a HttpClient Request. I do not claim to be an expert at all this so if anyone has a better way to word some of the terminology feel free.
public static HttpResponse makeRequest(String path, Map params) throws Exception
{
    //instantiates httpclient to make request
    DefaultHttpClient httpclient = new DefaultHttpClient();

    //url with the post data
    HttpPost httpost = new HttpPost(path);

    //convert parameters into JSON object
    JSONObject holder = getJsonObjectFromMap(params);

    //passes the results to a string builder/entity
    StringEntity se = new StringEntity(holder.toString());

    //sets the post request as the resulting string
    httpost.setEntity(se);
    //sets a request header so the page receving the request
    //will know what to do with it
    httpost.setHeader("Accept", "application/json");
    httpost.setHeader("Content-type", "application/json");

    //Handles what is returned from the page
    ResponseHandler responseHandler = new BasicResponseHandler();
    return httpclient.execute(httpost, responseHandler);
}

Map
If you are not familiar with the Map data structure please take a look at the Java Map reference. In short, a map is similar to a dictionary or a hash.
private static JSONObject getJsonObjectFromMap(Map params) throws JSONException {

    //all the passed parameters from the post request
    //iterator used to loop through all the parameters
    //passed in the post request
    Iterator iter = params.entrySet().iterator();

    //Stores JSON
    JSONObject holder = new JSONObject();

    //using the earlier example your first entry would get email
    //and the inner while would get the value which would be 'foo@bar.com'
    //{ fan: { email : 'foo@bar.com' } }

    //While there is another entry
    while (iter.hasNext())
    {
        //gets an entry in the params
        Map.Entry pairs = (Map.Entry)iter.next();

        //creates a key for Map
        String key = (String)pairs.getKey();

        //Create a new map
        Map m = (Map)pairs.getValue();

        //object for storing Json
        JSONObject data = new JSONObject();

        //gets the value
        Iterator iter2 = m.entrySet().iterator();
        while (iter2.hasNext())
        {
            Map.Entry pairs2 = (Map.Entry)iter2.next();
            data.put((String)pairs2.getKey(), (String)pairs2.getValue());
        }

        //puts email and 'foo@bar.com'  together in map
        holder.put(key, data);
    }
    return holder;
}

Please feel free to comment on any questions that arise about this post or if I have not made something clear or if I have not touched on something that your still confused about... etc whatever pops in your head really.

(I will take down if Justin Grammens does not approve. But if not then thanks Justin for being cool about it.)
Update
I just happend to get a comment about how to use the code and realized that there was a mistake in the return type.
The method signature was set to return a string but in this case it wasnt returning anything. I changed the signature
to HttpResponse and will refer you to this link on Getting Response Body of HttpResponse
the path variable is the url and I updated to fix a mistake in the code.


text:
Q: How to include native library (JNI) in play 2.1 RC2? I am using Play Framework 2.1 RC2 to build an application that utilizes TFS Java SDK. TFS APIs require a set of native dlls (e.g. native_auth.dll) to be included.
How do I make the native libraries available when the application is running? Where can I specify the native dlls to be included?
Update:
I tried static block System.load("full path") and loaded it using
 app.classloader().loadClass("NativeUtils.class"); , but still I get the exception:
java.lang.UnsatisfiedLinkError: com.microsoft.tfs.jni.internal.platformmisc.NativePlatformMisc.nativeGetEnvironmentVariable(Ljava/lang/String;)Ljava/lang/String;
    at com.microsoft.tfs.jni.internal.platformmisc.NativePlatformMisc.nativeGetEnvironmentVariable(Native Method)
    at com.microsoft.tfs.jni.internal.platformmisc.NativePlatformMisc.getEnvironmentVariable(NativePlatformMisc.java:134)
    at com.microsoft.tfs.jni.PlatformMiscUtils.getEnvironmentVariable(PlatformMiscUtils.java:52)
    at com.microsoft.tfs.core.config.httpclient.DefaultHTTPClientFactory.shouldAcceptUntrustedCertificates(DefaultHTTPClientFactory.java:288)
    at com.microsoft.tfs.core.config.httpclient.DefaultHTTPClientFactory.configureClientParams(DefaultHTTPClientFactory.java:324)
    at com.microsoft.tfs.core.config.httpclient.DefaultHTTPClientFactory.newHTTPClient(DefaultHTTPClientFactory.java:137)
    at com.microsoft.tfs.core.TFSConnection.getHTTPClient(TFSConnection.java:1041)
    at com.microsoft.tfs.core.TFSConnection.getWebService(TFSConnection.java:874)
    at com.microsoft.tfs.core.config.client.DefaultClientFactory$9.newClient(DefaultClientFactory.java:265)
    at com.microsoft.tfs.core.config.client.DefaultClientFactory.newClient(DefaultClientFactory.java:90)
    at com.microsoft.tfs.core.TFSConnection.getClient(TFSConnection.java:1470)
    at com.microsoft.tfs.core.TFSTeamProjectCollection.getWorkItemClient(TFSTeamProjectCollection.java:370)
Thanks in advance for your inputs!

A: I had the same problem with OpenCV library. I found the solution here: http://answers.opencv.org/question/16689/jni-error-on-playframework-v211/

You MUST run your application with "play start" command, not "play run".
"play run" command starts your application in development mode and "play start" command starts in production mode. I don't know every difference between them but one obvious thing is ,
Only when we use "play start", a new JVM for you application is launched and it loads native libraries you specified by System.load(...)

If you run your play application with "play start" command it will work. Unfortunately "play run" does not load libs.

A: When using System.loadLibrary, the only thing we specify is the name of the DLL file we want. The JVM will search for it in the "Java library path." This is a path which is given by the java.library.path system property (and hence can be altered on the java.exe command line using the -D option). The default value of this appears to be related to the Windows path, though it appears to be somewhat scrambled, and I'm not quite sure how or why. In other words, I'm not sure how the Windows JVM creates the initial value of java.library.path.
So, you should simply speciry -Djava.library.path=<path to your dlls> when running your application.
More details on that is here.


text:
Q: DownloadManager with custom notification I'm hitting a wall right now, I'd like to download a file with the DownloadManager and it's working. However I'd like to custom that notification with for example instead of having the progress in percent on the right, I'd like to display: DownloadManager.COLUMN_BYTES_DOWNLOADED_SO_FAR / DownloadManager.COLUMN_TOTAL_SIZE_BYTES and also add a button when the download is done (but for that I know there is a receiver when download completed)
So far my code looks like that:
DownloadManager downloadManager = (DownloadManager) getSystemService(Context.DOWNLOAD_SERVICE);
DownloadManager.Request request = new DownloadManager.Request(Uri.parse(mpopup.apk));
NotificationCompat.Builder nBuilder = new NotificationCompat.Builder(this, "Channel_ID")
                                        .setOngoing(true)
                                        .setAutoCancel(false)
                                        .setContentTitle("DOWNLOAD FILE")
                                        .setContentText("Downloading 0MB/100MB")
                                        .setProgress(100,0,false);

request.setTitle("DOWNLOAD TITLE");
request.setVisibleInDownloadsUi(false);
request.allowScanningByMediaScanner();
request.setNotificationVisibility(DownloadManager.Request.VISIBILITY_HIDDEN);
downloadManager.enqueue(request);

How do I do to update the progress bar and the text in my notification ? While it's downloading
I've tried : DownloadManager notification displays no percentage but it's not working and only display the log once completely downloaded

A: The short answer is you can't update the Notification because you have no control over it.
The only solution is to manage the download yourself and thus the notification with it.


text:
Q: Best practices for resuming a script I have a script that processes a couple of thousand files and copies the files individual users folders.  This process takes some time as it checks for proper security on each folder and if the user associated with the file still has a valid account.  Because this takes time, there has been instances where the script was closed inadvertently while it was in the middle of processing.
Has anyone come up with a method to check if the script did not finish completely and if so continue processing where it left off?
I was thinking to add a check for a file at the start of the script and if it doesn't exist create the file.  The last part of the script would remove the file.  That way if the script  was closed without finishing the file would exist on the next run and it would 'know' to continue.
I'm just looking for advice on any method that would be better that this.


text:
Q: Cannot assign "(,)": "IPv4Manage.vlanedipv4network" must be a "VlanedIPv4Network" instance I have a IPv4Manage model:
class IPv4Manage(models.Model):
    ...
    vlanedipv4network = models.ForeignKey(
        to=VlanedIPv4Network, related_name="ipv4s", on_delete=models.DO_NOTHING, null=True)

And when I update the ipv4 instance:
        vlaned_ipv4_network = VlanedIPv4Network.objects.create(
            network_ip = ip_network_divided_obj.network_address.exploded,
            prefix = ip_network_divided_obj.prefixlen,
            gateway_ip = gateway_ip.exploded,
            broadcast_ip = ip_network_divided_obj.broadcast_address.exploded,
            ipv4networkmanage = vlanable_ipv4network.ipv4networkmanage,
        )
        ...
        ipv4 = IPv4Manage.objects.get(ip=ip)
        ipv4.netmask = bits_to_mask(ip_network_divided_obj.prefixlen)

        if ipv4.ip == gateway_ip:
            ipv4.is_gateway = True
        else:
            ipv4.is_gateway = False
        ipv4.ip_status = IPV4_STATUS.已Vlan化未配置服务器
        ipv4.vlanedipv4network = vlaned_ipv4_network,  # there comes the issue
        ipv4.save()

Cannot assign "(<VlanedIPv4Network: 103.35.203.6/31>,)": "IPv4Manage.vlanedipv4network" must be a "VlanedIPv4Network" instance.

But my vlaned_ipv4_network exactly is VlanedIPv4Network instance.

A: You have an extra comma at the end of that line.


text:
Q: How to Increase Query Speed of Large Tables in Postgres I have 2 tables I am using in a query: tableA and tableB. TableA has a row count of 80568353, and tableB is at 101806780. They both share the same 10 columns (tableB has an additional 4 columns) including p_id. My goal is to have a query that creates a new table from tableA where the p_id does not match the p_id in tableB. Here's my query:
CREATE TABLE my_schema.tableC AS
    SELECT * FROM my_schema.tableA
    WHERE p_id NOT IN (SELECT DISTINCT p_id::int FROM my_schema.tableB)

This ran overnight and never completed. I went and ran EXPLAIN to see why. Here' is the results:
 Gather  (cost=20252382.21..3330358576969.77 rows=40283932 width=89)
   Workers Planned: 7
   ->  Parallel Seq Scan on tableA  (cost=20251382.21..3330354547576.57 rows=5754847 width=89)
    Filter: (NOT (SubPlan 1))
    SubPlan 1
      ->  Materialize  (cost=20251382.21..20814813.52 rows=6107669 width=8)
            ->  Unique  (cost=20251382.21..20760416.17 rows=6107669 width=8)
                  ->  Sort  (cost=20251382.21..20505899.19 rows=101806792 width=8)
                        Sort Key: tableB.p_id
                        ->  Seq Scan on tableB  (cost=0.00..5079937.92 rows=101806792 width=8)

I'm new to PostgreSQL, but cost=20251382.21..3330354547576.57 seems extraordinarily high. I tried to go back and run the following to create an index to speed things up:
CREATE INDEX IF NOT EXISTS a_p_int_idx ON my_schema.tableA (CAST(p_id as int));
CREATE INDEX IF NOT EXISTS b_p_int_idx ON my_schema.tableB (CAST(p_id as int));

This didn't seem to help. I also ran VACUUM ANALYZE on both tables. No improvement. What am I doing wrong here; is there any way to increase the speed and get this to run Or an alternative method of achieving my goal? Note: tableA's p_id is an int and tableB's p_id is double precision. Would that affect it?
UPDATE: I was not able to get EXPLAIN ANALYZE to complete but I was able to run EXPLAIN VERBOSE
Gather  (cost=20506959.93..3330368701110.81 rows=40283932 width=89)
Output: tableA.geoid, tableA.p_id, tableA.land_use_t, tableA.prop_ind_t, tableA.story_nbr, tableA.bld_units, tableA.censuspop, tableA.hu_pop, tableA.point_x, tableA.point_y
Workers Planned: 7
->  Parallel Seq Scan on my_schema.tableA  (cost=20505959.93..3330364671717.61 rows=5754847 width=89)
    Output: tableA.geoid, tableAs.p_id, tableA.land_use_t, tableA.prop_ind_t, tableA.story_nbr, tableA.bld_units, tableA.censuspop, tableA.hu_pop, tableA.point_x, tableA.point_y
    Filter: (NOT (SubPlan 1))
    SubPlan 1
      ->  Materialize  (cost=20505959.93..21069392.95 rows=6107669 width=4)
            Output: ((tableB.p_id)::integer)
            ->  Unique  (cost=20505959.93..21014995.61 rows=6107669 width=4)
                  Output: ((tableB.p_id)::integer)
                  ->  Sort  (cost=20505959.93..20760477.77 rows=101807136 width=4)
                        Output: ((tableB.p_id)::integer)
                        Sort Key: ((tableB.p_id)::integer)
                        ->  Seq Scan on my_schema.tableB  (cost=0.00..5334459.20 rows=101807136 width=4)
                              Output: (tableB.p_id)::integer

I also tried
EXPLAIN VERBOSE
SELECT * FROM my_schema.tableA a
WHERE NOT EXISTS(SELECT p_id FROM
my_schema.tableB
WHERE p_id::int = a.p_id)

to test the NOT EXISTS suggestions but the cost came out the same (no real improvement).

A: In many Databases the command NOT IN or NOT EXISTS gets bad performance, because you can write this query using the left join and you will get very very high performance. For Example:
SELECT * FROM my_schema.tableA aa
left join my_schema.tableB bb on aa.p_id = bb.p_id
WHERE
    bb.id is null --here you must use one of the not null field of tableB (for example primary key of tableB)

And you must create a normal btree index for p_id fields in both tables.


text:
Q: Google Maps facing 'GMSServicesException' with already providing valid Key in Appdelegate I am trying to work with google maps and everything was working fine until i add these two functions for getting updated Location.
func locationManager(manager: CLLocationManager, didChangeAuthorizationStatus status: CLAuthorizationStatus)
    {
        if (status == CLAuthorizationStatus.AuthorizedWhenInUse)
        {
            vwGMap.myLocationEnabled = true
        }
    }

func locationManager(manager: CLLocationManager, didUpdateLocations locations: [CLLocation])
{
    let newLocation = locations.last
    vwGMap.camera = GMSCameraPosition.cameraWithTarget(newLocation!.coordinate, zoom: 15.0)
    vwGMap.settings.myLocationButton = true
    self.view = self.vwGMap
}

Now, when i am trying to execute my app, there is an crash with exception "Terminating app due to uncaught exception 'GMSServicesException', reason: 'Google Maps SDK for iOS must be initialized via [GMSServices provideAPIKey:...] prior to use"
My API key is valid and already placed in Appdelegate. Anyone, Has any Idea what i am doing wrong here?
I am also presenting my viewDidLoad Code of my ViewController
let camera = GMSCameraPosition.cameraWithLatitude(-33.8683,
                                                          longitude: 151.2086, zoom: 15)
        let mapView = GMSMapView.mapWithFrame(self.view.bounds, camera: camera)

        mapView.setMinZoom(8, maxZoom: 18)
        mapView.indoorEnabled = false
        mapView.settings.compassButton = true
        mapView.settings.myLocationButton = true
        mapView.myLocationEnabled = true
        mapView.camera = camera

        locationManager.delegate = self
        locationManager.desiredAccuracy = kCLLocationAccuracyKilometer
        locationManager.distanceFilter = 500
        locationManager.desiredAccuracy = kCLLocationAccuracyBest
        locationManager.requestAlwaysAuthorization()
        locationManager.startUpdatingLocation()

        self.view = mapView

A: This may happen if some of your Google Maps code runs before API key is initialized.
For example if your vwGMap variable is an instance property:
let vwGMap = GMSMapView()

It could be instantiated during construction of your class, which could happen before provideAPIKey call. If so, you need to make sure, that it initialized after provideAPIKey call, by moving initialization into some method. It concerns all similar Google Maps properties.


text:
Q: Uploading Big MySql Files in Phpmyadmin Im trying to upload a 3.8gb sql dump into phpmyadmin, in wamp. I set the max_file sizes among other things to 5gb and even restarted the server multiple times. The php_info(); also gives me 5gb as the file size.
I would like to break the file into smaller chunks so that I can upload it bit by bit,if the entire thing isnt possible, and have looked for such tools. Used one though http://www.rusiczki.net/2007/01/24/sql-dump-file-splitter/ but it gives me an error at 2gb.
Could anyone suggest anything that i could do to get my dump into mysql?
Thanks a lot

A: Traverse to your mysql bin directory (e.g. below)
D:\wamp\bin\mysql\mysql15.1.36\bin>

Then you can import any large database from your dump file giving the following command (e.g. below)
mysql -u username -ppassword database_name < dump.sql

A: You should really skip phpmyadmin and do it through the command line. The correct command is:
    $ mysql -u username -p -h localhost DATA-BASE-NAME < data.sql

If you are still unsure about that one (although try it, you'll be surprised how easy it is) you can have a go at mysql workbench.


text:
Q: Best practice for key values in translation files In general, translation methods take a key > value mapping and use the key to transform that into a value. Now I recognize two different methods to name your translation keys and within my team we do not come to consensus what seems to be the best method.
Method 1:
Use full English words or sentences:
Name => Name
Please enter your email address => Please enter your email address

Method 2:
Use keywords describing the situation:
NAME => Name
ENTER_EMAIL => Please enter your email address

I personally prefer method #1 because it directly shows the meaning of the message. If the translation is not present, you could fall back to the key and this doesn't cause any problems. However, the method is cumbersome when a translation changes frequently, because all the files need to be updated. Also for longer texts these keys become very large. This is solved by using keys like ENTER_EMAIL, but the phrasing is completely out of the context. The list of abstract translation keys would be huge, you need meta data for all the keys explaining their usage and collisions can occur much easier.
Is there a best of both worlds or a third method? How do you use translation keys in your application? In our case it is a php-based webapplication, but I think above problem is generic enough to talk about i18n in general.

A: Why not use both worlds? I use method #1 for short strings, and method #2 for long strings that are full sentences. I am not afraid to mix both in the same file.
For example, in the following string the text may change if in a new app version the user experience is modified:
"screen description" = "Tap the plus button to add a new item. Tap an item for more options or to edit its details.";

So here it makes sense to apply method #2.
However, for simple strings like in the following example, method #1 is more useful:
"Preferences" = "Preferences";

In general when people try to standardize things it often appears restrictive to me. Personally, I prefer a more "anarchistic" approach where several methods are valid (not only as in this method #1 vs method #2 thread, but also for example when a team of developers fight over coding style).

A: This is a question that is also faced by iOS/OSX developers. And for them there is even a standard tool called genstrings which assumes method 1. But of course Apple developers don't have to use this tool--I don't.
While the safety net that you get with method 1 is nice (i.e you can display the key if you somehow forgot to localize a string) it has the downside that it can lead to conflicting keys. Sometimes one identical piece of display text needs to be localized in two different ways, due to grammar rules or differences in context. For instance the French translation for "E-mail" would be "E-mail" if it's a dialog title and "Envoyer un e-mail" if it's a button (in French the word "E-mail" is only a noun and can't be used as a verb, unlike in English where it's both a noun and a verb). With method 2 you could have keys EMAIL_TITLE and EMAIL_BUTTON to solve this issue, and as a bonus this would give a hint to translators to help them translate correctly.
One more advantage of method 2 is that you can change the English text without having to worry about updating the key in English and in all your localizations.
So I recommend method 2!


text:
Q: Tomcat CORS Filter: Why is the default list of headers in "Access-Control-Allow-Headers" so arbitrarily limited? Tomcat (7.0.50) brings a special filter that implements the CORS specification. In this filter, the default list of allowed headers is the following:
Origin,Accept,X-Requested-With,Content-Type,Access-Control-Request-Method,Access-Control-Request-Headers.
I know that I can replace that list by using the filter parameter "cors.allowed.headers" and specify my own list of headers. I know that. But I have the following questions:

*

*When this filter was created, why was the list filled with this –abritrarily- short list of headers? Why these headers and not others? Why, for example, isn't the "cache-control" header in the list? How was this list chosen?

*If I want to define a more complete list, which headers should I include? There are some many headers to think about!

*Can I use a "*" instead of specifying a list? Is that something that the CORS specs allows?

*I know that the CORS specs defined this kind of list, but… Why is that necessary? Why can't we just accept any header in the pre-flight OPTIONS step, instead of returning a 403 (Forbiden) if at least one of the headers requested by the client is not in the list of allowed headers?

*Why isn't there an option in the filter to do something like this:
response.setHeader("Access-Control-Allow-Headers", request.getHeader("Access-Control-Request-Headers")  ?

I'm puzzled. One of the users of my API sent the "cache-control" header in the  in the "Access-Control-Request-Headers" list during the pre-flight step, and received an HTTP 403 error status. I can add this header to the list (using the "cors.allowed.headers" filter parameter). But what about next time some client sends another header that is not in the list?
Brian

A: I spend hours trying to understand the CORS specification (http://www.w3.org/TR/cors/). Its really hard to understand.
The cors.allowed.headers list specifies which headers are allowed in the actual request.
In the preflight-request, the client tells the server via the "Access-Control-Request-Headers" field, which headers must be allowed by the resource. If one of these values is not in the cors.allowed.headers list, the request is rejected. This behaviour is specified in the CORS specification.
I think the Access-Control-Request-Headers is used to check if the requested resource really supports these headers. If not, the actual request cannot be satisfied. The fact, that Tomcat returns "FORBIDDEN" maybe is an implementation detail.
If you need some special functionality as mentioned in your last point, you may need to implement your own CORS-filter.


text:
Q: Is there any standard function to search for identical substrings within a string? If I am having a string say for an example "ABEFAB", it would take a length parameter (eg. 2) and then return a result which would show that there ARE identical substrings of that length in my string.

A: I think you are looking for this
public static bool HasIdenticalSubStrings(string str, int len)
{
    bool returnValue = false;

    List<String> lst = new List<string>();

    for (int i = 0; i <= str.Length - len; i++)
        lst.Add(str.Substring(i, len));

    returnValue = (lst.Distinct().Count() != lst.Count);

    return returnValue;
}

and call like
HasIdenticalSubStrings("ABEFAB", 2); //return true

HasIdenticalSubStrings("ABCDEF", 2); //return false

Note: You need to put some checks like String.IsNullOrEmpty check
Efficient Method:
public static bool HasIdenticalSubStrings(string str, int len)
{
    bool returnValue = false;

    List<String> lst = new List<string>();

    for (int i = 0; i <= str.Length - len; i++)
    {
        String tempstr = str.Substring(i, len);
        if (lst.Contains(tempstr))
        {
            returnValue = true;
            break;
        }
        else
            lst.Add(tempstr);
    }

    return returnValue;
}

A: The simplest (however not that efficient) solution is
public static Boolean HasIdenticalSubStrings(String value, int length)
{
  if (length <= 0)
    return false;
  else if (String.IsNullOrEmpty(value))
    return false;
  else if (value.Length <= length)
    return false;

  // HashSet is more efficient than List for Contains() operation
  HashSet<String> subStrings = new HashSet<String>();

  for (int i = 0; i <= value.Length - length; ++i) {
    String s = value.Substring(i, length);

    if (subStrings.Contains(s))
      return true;
    else
      subStrings.Add(s);
  }

  return false;
}

Test cases:
  HasIdenticalSubStrings("AAA", 2);    // true, overlaping "AA" substrings
  HasIdenticalSubStrings("ABxyAB", 2); // true
  HasIdenticalSubStrings("ABxAB", 2);  // true
  HasIdenticalSubStrings("ABCDEF", 2); // false

A: I think Contains surves this puprose quite well. It doesn't take any length parameters, though, but I discovered that for my program it's not even necessary because there is a determined block size which I use.


text:
Q: xcode two uitabbarcontrollers one page. auto-rotate issue Summery:

*

*I have a custom UITabBarAutoRotateController which returns YES from      shouldAutorotateToInterfaceOrientation.  This has no effect.

*If I minimize and show the app again, the rotation issue goes away.

*How do I refresh the screen so the user does not have to do this (so rotation works again)?

Details (setup graphically, so no code):
I have two UITabBarController in MainWindow.xib.  I only want one to show at a time.  So I am linking graphically rootViewController = tabBarController_name1.  There is also tabBarController_name2.
I will also have an alert MessageBox for a user to choose what type of application they need, and it will choose a tab bar controller based on their request (per customer definition).  This is commented out for now.
There is a bug with Rotation when two UITabBarControllers exist on the same xib.    When I try to rotate the screen, it stays upward with wherever the main screen button (power button looking button) faces.  HandleOrientationChange does not get called on the active custom ViewController being shown.
The reason I believe it's a bug is because if I hit the main screen button (minimizing the application), and click back on the application (brings it back to the foreground), rotation works perfectly!
Sorry for making you read all that mumbo :). My true question is, "Is there anyway I could refresh the main window or likewise UITabBarController's to get rotation working (without requiring the program be minimized and shown)"?  A work-around, if you will?
p.s.  I cannot use Storyboard for backwards compatibility reasons.  The customer will be receiving this code/project.  So I would like to keep this in one graphical page, rather than hiding/showing UITabBarItem's.
EDIT:  two-uitabbarcontrollers-and-autorotation and uitabbarcontrollers-and-uinavigationcontrollers were both helpful, but did not address "why" this issue happens.  "noob" here when it comes to xcode :)

A: Tab bar controller inside a navigation controller, or sharing a navigation root view is the answer.  Do not use a TabBarViewController.  Which, as a noob, I'm not quite sure why TabBarViewController exists (or at least isn't depreciated).
Dragging two TabBarViewControllers into the same page should result in a warning saying that you probably want to implement TabBarViewController by making a custom UIViewController and attaching a plain UITabBar to it.
Frustrating...but finally making progress :)


text:
Q: How to store rich-text in database I want to store data that is being edited with Draft.js and React (in the UI) into a MySQL database.
I am not sure in which format should I store my data, so that I can fetch the data from database and display it on the page with the formatting applied while writing the text?
For example - I applied bold style to some of the text and gave some line breaks. How to store this info for later use?
Please suggest a format to store my data.

A: You could save it as a string format. To elaborate, you can use a JSON-serialized string of the ContentState as mentioned in the Draft JS docs.
Draft JS has utility methods convertFromRaw and convertToRaw to help you. Check out the docs linked above, they are pretty clear.

A: Draft.js is archiving.
A new alternative is lexical
You can find its playground here: https://playground.lexical.dev/

A: for anyone still facing this issue: You can see the solution in this video
Basically you have to convertToRaw, then JSON.stringify it. Then this can be sent to your backend as a string. To display it, make a GET request for that particular data, then JSON.parse it and then convertFromRaw. Pass this into another RichTextEditor as the editorState but set the readOnly={true}


text:
Q: How can I remove an item from a list while iterating over it? I have the following code:
while (rrProcesses.size() > 0) {
        for (Process process : rrProcesses) {
            if (process.getBurstTime() <= quantum) {
                System.out.println("@t=" + clock + ", selected for " + process.getBurstTime() + " units");
                clock += process.getBurstTime();
                rrProcesses.remove(process);
            } else {
                System.out.println("@t=" + clock + ", selected for " + quantum + " units");
                clock += quantum;
                process.setBurstTime(process.burstTime - quantum);
            }

            if (processCounter != rrProcesses.size()) {
                System.out.println("@t=" + clock + ", context switch " + contextSwitch + " occurs");
                contextSwitch++;
                clock += latency;
            }
        }
    }

I am attempting to iterate over each object within my list, remove an item based on a conditional, and keep looping until all items are removed.
When I run this in intellij, I get the following err:
Exception in thread "main" java.util.ConcurrentModificationException
at java.base/java.util.ArrayList$Itr.checkForComodification(ArrayList.java:1013)
at java.base/java.util.ArrayList$Itr.next(ArrayList.java:967)
at com.company.Main.main(Main.java:224)

I searched the issue and found this solution. enter link description here
When I changed my code it became this:
Iterator<Process> iter = rrProcesses.iterator();

    while (iter.hasNext()) {
        for (Process process : rrProcesses) {
            if (process.getBurstTime() <= quantum) {
                System.out.println("@t=" + clock + ", selected for " + process.getBurstTime() + " units");
                clock += process.getBurstTime();
                iter.remove();
            } else {
                System.out.println("@t=" + clock + ", selected for " + quantum + " units");
                clock += quantum;
                process.setBurstTime(process.burstTime - quantum);
            }

            if (processCounter != rrProcesses.size()) {
                System.out.println("@t=" + clock + ", context switch " + contextSwitch + " occurs");
                contextSwitch++;
                clock += latency;
            }
        }
    }

However, now I am receiving the following error:
Exception in thread "main" java.lang.IllegalStateException
at java.base/java.util.ArrayList$Itr.remove(ArrayList.java:980)
at com.company.Main.main(Main.java:228)

I found this answer to the error but its honestly not clarifying anything for me. How is it possible for me to then remove the object from the List?

A: You still have a for loop inside your iterator loop. Replace it with this:
Process process = iter.next();

A: Alternative to @shmosel s answer, you can also use a for loop that iterates over the iterator. With this, you can also remove the item in question.
Basically this is the same approach as yours (get iter, while iter.hasNext, iter.next) but I prefer this style, because it keeps all allocated variables inside the loop scope.
    for (final Iterator<Processes> iter = rrProcesses.iterator(); iter.hasNext();) {
        System.out.println("\t" + iter.next());
    }


text:
Q: Android apk build error Please help me resolve the following issue.
Error:Execution failed for task ':app:transformClassesWithMultidexlistForDebug'.
> java.io.IOException: Can't write [C:\...\app\build\intermediates\multi-dex\debug\componentClasses.jar] (Can't read [C:\...\app\build\intermediates\transforms\desugar\debug\69.jar] (Duplicate zip entry [69.jar:org/intellij/lang/annotations/Flow.class]))

I depend on only some Play Services libraries as follows:
// Play services
compile "com.google.android.gms:play-services-maps:${rootProject.ext.playServicesVersion}"
compile "com.google.android.gms:play-services-places:${rootProject.ext.playServicesVersion}"
//Firebase
compile "com.google.firebase:firebase-messaging:${rootProject.ext.playServicesVersion}"

A: I had a kotlin conflict with an annotation library. Replacing it with com.google.support.annotations did the trick for me.


text:
Q: Shadows created by :after and :before overlap parent onHover Background Information:
I have a page full of bootstrap 3 .thumbnail elements with content inside. I have used CSS to add a box-shadow to the element:
.thumbnail {
  display: inline-block;
  width: 97%; /*Needed to show box shadow*/
  border: 2px solid $subdued;
  margin: 0 2px 15px;
  padding: 5px 15px;
  background: $bg-color;
  background: -webkit-linear-gradient(45deg, #FFF, #F9F9F9);
  opacity: 1;
  position: relative;
  @include transition(all, 0.4s, ease);

  &:before, &:after {
    z-index: -1;
    position: absolute;
    content: "";
    bottom: 15px;
    left: 10px;
    width: 50%;
    top: 80%;
    max-width: 100%;
    background: rgba(0,0,0,0.6);
    box-shadow: 0 20px 10px rgba(0,0,0,0.6);
    @include transform( rotate(-3deg) );
    @include transition(all, 0.1s, ease);
  }

  &:after {
    @include transform( rotate(3deg) );
    right: 10px;
    left: auto;
  }
}

Note: The @include statements are just SASS mixins there for vendor prefixing; there's nothing relevant to the issue baked-into the mixin.
This CSS works well until I add some code for a hover state; when the user hovers over a .thumbnail I want all other .thumbnail elements to reduce their opacity to 0.4. To that end, I have added the following CSS:
.deckgrid:hover .thumbnail:not(:hover) { opacity: 0.4 }
.deckgrid:hover .thumbnail:not(:hover):before,
.deckgrid:hover .thumbnail:not(:hover):after { opacity: 0; }

Note: .deckgrid is just a wrapper <div> for the .thumbnails.
The Problem:
When I hover over a .thumbnail, that particular .thumbnail behaves as intended; however, all the other thumbnails on the page are overlapped by their ::before and ::after pseudo-elements for about a second before correcting themselves. This causes the transition to look jerky and weird.
Any ideas on how this might be fixed?


text:
Q: Shiny-error while trying to use tableoutput I am using a basic shiny code which gives an error while I am trying to show tableoutput but same dataframe gets printed when I change line to renderprint, I can download the file using download handler which shows there are records there.
  "Warning: Error in <-: number of items to replace is not a multiple of replacement length"
My dataset and code is below.
structure(list(Point1 = c(9999, 9999, 433.333, 9999, 1433.333,
33.333, 4283.333, 9999, 33.333, 9999, 9999, 9999, 9999, 0.033,
1323.333, 883.333, 9999, 9999, 9999, 9999, 433.333, 1433.333,
0.633, 9999, 9999, 9999, 33.333, 9999, 133.333, 433.333, 433.333,
0.003, 4023.333, 33.333, 423.333, 1323.333, 423.333, 1323.333,
4323.333, 2073.333, 1323.333, 1323.333, 1323.333, 1323.333, 1323.333,
33.333, 123.333, 3363.333, 123.333, 0.333, 423.333), Point2 = c(4433.333,
4433.333, 133.333, 4133.333, 433.333, 3.333, 1283.333, 4433.333,
3.333, 4433.333, 4433.333, 4433.333, 4433.333, 0.003, 423.333,
433.333, 4433.333, 4433.333, 4433.333, 4433.333, 133.333, 433.333,
0.333, 4358.333, 4433.333, 4433.333, 3.333, 4433.333, 33.333,
133.333, 133.333, NA, 1323.333, 3.333, 123.333, 423.333, 123.333,
423.333, 1323.333, 1323.333, 423.333, 423.333, 423.333, 423.333,
423.333, 3.333, 33.333, 1323.333, 33.333, 0.033, 123.333), OUTP1 = c(NA,
NA, 1L, NA, 1L, 1L, 1L, NA, 1L, NA, NA, NA, NA, 1L, 1L, 1L, NA,
NA, NA, NA, 1L, 1L, 1L, NA, NA, NA, 1L, NA, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L), Types = c(NA, NA, 3L, NA, 3L, 3L, 3L, NA, 3L, NA, NA,
NA, NA, 3L, 3L, 3L, NA, NA, NA, NA, 3L, 3L, 3L, NA, NA, NA, 3L,
NA, 3L, 3L, 3L, 2L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L,
3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L)), .Names = c("Point1", "Point2",
"OUTP1", "Types"), class = "data.frame", row.names = c(NA, -51L
))

    library(survival)
    library(shiny)
           ui <- bootstrapPage(
           titlePanel("Title comes here"),
           tags$hr(),
           sidebarPanel(
           fileInput("file1", "Choose CSV File",
           multiple = FALSE,
            accept = c("text/csv",
            "text/comma-separated-values,text/plain",
            ".csv")),
         tags$hr(),
        checkboxInput("header", "Header", TRUE),

        radioButtons("sep", "Separator",
                     choices = c(Comma = ",",
                                 Semicolon = ";",
                                 Tab = "\t"),
                     selected = ","),

        radioButtons("quote", "Quote",
                     choices = c(None = "",
                                 "Double Quote" = '"',
                                 "Single Quote" = "'"),
                     selected = '"'),

        tags$hr(),

        radioButtons("disp", "Display",
                     choices = c(Head = "head",
                                 All = "all"),
                     selected = "head"),

        downloadButton("downloadData", "Download")
    ),
    mainPanel(
        # plotOutput('plot'),
        tableOutput("selected_var")
    )
    )
     server <- function(input, output) {

    data <- reactive({
        req(input$file1)

        test1 <- read.csv(input$file1$datapath,
                                header = input$header,
                                sep = input$sep,
                                quote = input$quote)
        test1[is.na(test1)] <- "0"

        return(list(df = test1))
    })
    output$selected_var <- renderTable(data()$df)
    }

    shinyApp(ui = ui, server = server)
`


text:
Q: OkHttp on Android This is my code to get the JSON string from my PHP server.
When I run this the app crashes and says that there is an error with  Response response = client.newCall(request).execute();
What am I doing wrong?
public class MainActivity extends Activity {

    //private static final String TAG = "MainActivity";

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

        new AsyncTask<Void, Void, String>(){

            @Override
            protected String doInBackground(Void... params) {

                OkHttpClient client = new OkHttpClient();
                Request request = new Request.Builder()
                        .url(url)
                        .build();

                try {
                    Response response = client.newCall(request).execute();
                    Log.d("OkHttp", "doInBackground() called with: " + "params = [" + response.body().string() + "]");
                    return response.body().string();
                }
                catch (IOException e) {
                    e.printStackTrace();
                }
                return null;
            }
        }.execute();
    }
}

A: *

*You don't need to put this into an async task as you can use the call back of the OKHttp library which itself is async.

*Second thing is you are using the wrong method. Instead of execute() you should use enqueue() which has a callback as a parameter as I mentioned above.
Try this code:
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
                  .url(url)
                  .build();
Call call = client.newCall(request);
call.enqueue(new Callback() {

    @Override
    public void onFailure(Call call, IOException e) {

        // Observe reason of failure using
        e.printStackTrace();
    }

    @Override
    public void onResponse(Call call, Response response) throws IOException {
            if(response.isSuccessful()){
                // Use response here
            }
            else{
                // Observe error
            }
    }
});


text:
Q: What is Modernizr, Normalize and HTML5Boilerplate when i download a free theme or a demo tutorial in the web. I just noticed that now a days i always see those modernizr, normalise, and boilerplate thingy.
I have researched them but still i cant understand what they do? Maybe you guys can explain more or maybe use an analogy to explain it better.
It's like "Explaining New Web Development thingy for Dummies"  Really appreciate it.

A: Due to the differences in browsers and platforms, these libraries try to make is so that you don't have to use browser-specific code to take advantage of all the new HTML5 features.
Another way of saying it is, since all browsers "interpret" the HTML5 standard differently, these libraries help to smooth out the differences between interpretations.
Modernizr: http://modernizr.com/

Taking advantage of cool new web technologies is great fun, until you have to support browsers that lag behind. Modernizr makes it easy for you to write conditional JavaScript and CSS to handle each situation, whether a browser supports a feature or not. It's perfect for doing progressive enhancement easily.

Boilerplate: http://html5boilerplate.com/ (If this is the one you are referring to)

HTML5 Boilerplate helps you build fast, robust, and adaptable web apps or sites. Kick-start your project with the combined knowledge and effort of 100s of developers, all in one little package.

Basically this gives you a framework for laying out your webpages so you don't have to start from scratch every time.
Normalize.css: http://necolas.github.io/normalize.css/ (Again, assuming this is the one you're talking about)

Normalize.css makes browsers render all elements more consistently and in line with modern standards. It precisely targets only the styles that need normalizing.

Basically, this CSS file allows you to write standard CSS and then it helps to render it consistently in all browsers.
TL;DR Version
These frameworks/files make it so that you can focus on writing standard-compliant website code (HTML5, CSS or JS) without having to worry about browser-specific tweaks.  In addition, a front-end framework like Boilerplate gives you some nice "style-helpers" to make your website look great from the start.


text:
Q: Efficiently generating byte buffer without breaking strict aliasing This is such a simple pattern, there has to be a "nice" way of sorting it out.
I have a function that needs to generate a dynamically sized byte array containing arithmetic data.
// Given that I have a function that kinda looks like this:
void dispatch(std::vector<char> data); //Will take possesion of data.

// The behavior I want, but this breaks strict aliasing
void bad_foo(int c) {
  std::vector<char> real_data(c * sizeof(float));
  float* raw_data = reinterpret_cast<float*>(real_data.data());

  //Fill raw_data with usefull stuff...

  dispatch(std::move(real_data));
}

void correct_but_slow_foo(int c) {
  std::vector<float> raw_data(c);

  //Fill raw_data with usefull stuff...

  std::vector<char> real_data(c * sizeof(float));
  std::memcpy(real_data.data(), raw_data.data(), c * sizeof(float));

  dispatch(std::move(real_data));
}

Unfortunately, it seems even clang's heap elision is not managing to sort out what needs to be done here: see on godbolt
At the very worst, I can make dispatch() a template, but that would become very messy, and I'm curious to see if there is a way out of this mess I'm overlooking anyways.
Thanks!
Edit: A thought just crossed my mind (immediately after posting the question of course...) : I could treat real_data as an allocation pool and in-place new the arithmetic data on top of it:
void fixed_foo(int c) {
  std::vector<char> real_data(c * sizeof(float));
  float* raw_data = new (real_data.data()) float[c];

  //Fill raw_data with usefull stuff...

  dispatch(std::move(real_data));
}

This looks funky as hell, but I "think" it might be legal. Maybe?

A: The safest way to get around aliasing rules is to use memcpy() but you don't need to do that on a whole second copy of the data. I'd suggest doing all your float work on a local float variable and then memcpy()ing that to the appropriate location in your real_data buffer an element at a time. Most compilers will optimize that effectively in my experience.
void better_foo(int c) {
  std::vector<char> real_data(c * sizeof(float));

  //Fill raw_data with usefull stuff...
  for (int i = 0; i < c; ++i) {
    float x = my_complicated_calculation(i);
    memcpy(&real_data[i * sizeof(float)], &x, sizeof(x));
  }

  dispatch(std::move(real_data));
}


text:
Q: effort needed for developing a website using Ruby; Mongodb; JSON. Assume very basic experience with web development how much time would it take 4 beginners to develop a website (3-4 pages) using Ruby; Mongodb; JSON. Assume very basic experience with web development. Project has only 2-3 tables to be made. and focus is on providing a good user interface. business logic not complicated.

A: Estimating time is one of a developer's most challenging tasks. No one is going to be able to tell you this, and if they do, it's likely BS.


text:
Q: ValidateRequest - getting error and display on current page I have an asp.net application and I've realized, that if I set ValidateRequest to false, always a standard error page is displayed.
I've heard, that you can display a custom error page.
But I need to know if I can catch the error and display it (after postback) on the current page, that is being displayed.
Is there any way to do this?

A: I've found the following article:
http://blogs.msdn.com/b/kaevans/archive/2003/07/07/9791.aspx
The last point of the article (Overriding the OnError Method), describes how to display an error on the current page.
The OnError method has to be overwritten and the error StatusCode has to be set to 200.
protected override void OnError(EventArgs e)
{
  System.Exception oops = Server.GetLastError();

  if(oops.GetBaseException() is System.Web.HttpRequestValidationException )
  {
    System.Diagnostics.Debug.Assert(false);
    Response.Write(oops.ToString());
    Response.StatusCode = 200;
    Response.End();
  }
}


text:
Q: How to make ctrl word end or start recognize underscore In vscode, ctrl + arrow will not stop at an underscore. Is there any way to change this behaviour, or is there a shortcut to select characters between two underscores?
(I have searched through available shortcuts and extensions but could not find any)
Thanks!

A: If you add the underscore to your wordSeparators in the setting Editor: Word Separators, then

*

*Ctrl+rightArrow : move to the next word separator,

*followed by another rightArrow to move after that underscore, then

*Ctrl+Shift+rightArrow will select all word characters up to the next word separator, which might or might not be the next underscore - depends on your code.

A: You can use the extension Select By.
With a regular expression you can specify what you recognize as a word separator. Use the moveby.regex command. And then redefine the key binding for Ctrl+ArrowRight
To select some text based on regular expressions use command selectby.regex:
Add to your settings.json
    "selectby.regexes": {
      "selectUnderscores": {
        "surround": "_[^_]*_"
      }
    }

And define a keybinding:
  {
    "key": "ctrl+f10",  // or any other key combo
    "when": "editorTextFocus",
    "command": "selectby.regex",
    "args": ["selectUnderscores"]
  }