text:
Q: What is the best way in terms of space efficiency to make a List of objects immutable? Prompted by the example provided at 37:19 of this talk by Stuart Marks on Java Collections, I was wondering what is the best way to make a List of objects immutable from a space efficiency perspective.
In my example, I have a List of objects that I retrieve from a database:
List<MyObject> myObjects = myRepository.getMyObjectsThatFitCriteria();
To make this List immutable I can think of three ways to do it

*

*Wrap it in Collections.unModifiableList() but this creates another object and the underlying list itself is still modifiable

*Stream over the myObjects list and collect it to an unmodifiable list but this might have a performance impact, particularly if the list is large

*Use the List.copyOf() static factory method introduced in Java 9 but this creates another copy of the myObjects list, impacting memory and storage.

A: As mentioned by @VGR in the comment, Collections.unmodifiableList will not copy the elements into a new list, but rather wrap it and prevent modifications on it.
If you're using Spring Data JPA for repository support, it's a good idea to leverage its support for streams: https://www.baeldung.com/spring-data-java-8
Streams are a good way to avoid large memory consumption if the list is large. It does not change the source collection and allows lazy consumption.

A:
Wrap it in Collections.unModifiableList() but this creates another object and the underlying list itself is still modifiable.

You still need to create a list so there is no way around that.  But you can always reassign to the same list to effectively remove the reference from access.
list = Collections.unModifiableList(list);

The original list internally is simply referred to (thus not copied) for immutable methods like size().  Any other methods that would allow changes are overridden with methods that throw exceptions if they are invoked.  So the overhead is minimal.
Note that unless the contained objects are immutable, they are still subject to alteration.


text:
Q: the best way to organize interface to private member vector> Supposing, I have a class:
class Class
{
private:
   std::vector <std::vector <Type>> vec2d;
   // Or, for example, something like this:
   std::vector <std::vector <std::shared_ptr <Type>> vec2dptr;
}

And I need to organize interface to a private vector. The size of a vector may rich thousands elements. What is the best solution (memory/performance)?
As a variant, I can return a pair of iterators from getter (begin(), end()):
std::pair <std::vector <const std::vector <const Type>>::iterator,
           std::vector <const std::vector <const Type>>::iterator>
           GetPrimaryVectorRange();

// To get an element from sub-vector, pass iterator of main vector to getter
std::pair <std::vector <const Type>::iterator,
           std::vector <const Type>::iterator>
           GetSecondaryVectorRange(
           std::vector <const std::vector <const Type>>::const_iterator primary_elem );

The simpliest way is to return a vector by constant value, but then a copy constructor will be called, not move constructor from C++11, am I right? Is there any standart approach or pattern in this case?

A: Your API returning a pair of std::vector iterators already makes it public knowledge that the rows of your 2d array are std::vectors, so you might as well keep it simple and do something like
std::vector<Type> const &operator[](size_t i) const { return vec2d[i]; }
std::vector<Type> &operator[](size_t i) { return vec2d[i]; }

And let your callers extract the iterator themselves if they need iterators:
auto row = arr[i];
auto iter = std::find(row.begin(), row.end(), 42);

If all the rows of your array are the same length, consider writing a simple 2D array class (or using mine) that allocates all the memory in one block.  Performance will be better, especially in the case where you want to iterate over every single element of the array.  (I think C++ should have included such a class in the standard.)
EDIT: I realized that my solution does have one weakness compared to yours.  If you decided to use one huge std::vector for all the rows instead of separate std::vectors, it wouldn't break your iterator-based API, but it would break my version.
Another option would be to return raw a pair of raw pointers instead of iterators.  They work in all the same places iterators do.  That would still expose the fact that rows are stored contiguously, so you could never store the elements of a single row in a linked list for example. But in my opinion, contiguous storage is so fundamental, and so important for anything that cares about performance, that it's totally fine to expose contiguousness in an API.
However, if it applies to your needs, I still think using a 2D array wrapper class is the best solution.

redpajama_set_name: RedPajamaStackExchange


text:
Q: CSS background stripes with 1px white, the rest transparent I've read CSS background stripes tutorials, but I don't seem to find a solution to this problem. What if I want diagonal white lines of just 1px wide alternating with transparent stripes of about 10px wide? Like this:

The code I have now is:
.stripes {
    background: repeating-linear-gradient(
      45deg,
      transparent 46%, #fff 49%, #fff 51%, transparent 55%
    );
    width: 180px;
    height: 56px;
    z-index: 99;
    position: absolute;
    left: 0;
    top: 0;
}

But this makes blurry, thick white lines. I'm new on this concept.

A: To get exact pixel dimensions, you can use pixels instead of percentages:

body {
    background: #222;
}

.stripes {
    background: repeating-linear-gradient(
      -75deg,
      #fff, /* White, starting at pixel 0 */
      #fff 1px,  /* White, continuing to pixel 1 */
      transparent 1px, /* Transparent beginning at pixel 1 */
      transparent 10px /* Transparent ending at pixel 11 (10 + 1) */
    );
    width: 180px;
    height: 56px;
    z-index: 99;
    position: absolute;
    left: 0;
    top: 0;
}

.stripes2px {
    background: repeating-linear-gradient(
      -75deg,
      #fff, /* White, starting at pixel 0 */
      #fff 2px,  /* White, continuing to pixel 2 */
      transparent 2px, /* Transparent beginning at pixel 2 */
      transparent 12px /* Transparent ending at pixel 14 (12 + 2) */
    );
    top: 56px;
}

.stripes-fade {
    background: repeating-linear-gradient(
      -75deg,
      #fff, /* White, starting at pixel 0 */
      #fff 1px,  /* White, continuing to pixel 1 */
      transparent 2px, /* Transparent beginning at pixel 2 */
      transparent 10px /* Transparent ending at pixel 12 (10 + 2) */
    );
    top: 112px;
}

An alternative method, but gives the same results.  Something to do with the way browsers render (no anti-aliasing):

body {
    background: #222;
}

.stripes {
    width: 180px;
    height: 56px;
    z-index: 99;
    position: absolute;
    left: 0;
    top: 0;
    overflow: hidden;
}

.stripes:before {
    content: '';
    display: block;
    background: repeating-linear-gradient(
      0deg,
      #fff, /* White, starting at pixel 0 */
      #fff 1px,  /* White, continuing to pixel 1 */
      transparent 1px, /* Transparent beginning at pixel 1 */
      transparent 10px /* Transparent ending at pixel 11 (10 + 1) */
    );
    position: absolute;
    /* Just a bunch of random numbers to get it to cover - no thought went into these. */
    top: -100%;
    left: -200%;
    width: 400%;
    height: 1000%;
    transform: rotate(-75deg);
}


text:
Q: How to set flyway path configuration for test using filesystem in configuration file? I have setup flyway task for Local using a configuration file and wiring up to my task like
tasks.create<FlywayMigrateTask>("migrateLocal") {
    configFiles = arrayOf("config/flyway/flyway.conf")
}

This task runs okay and the scripts are executed well, However when I try running integration tests with an application-TEST.yaml file where I define the configuration paths, I get the error below
Flyway failed to initialize: none of the following migration scripts locations could be found:

    - classpath:db/migration

The thing is I dont want to redefine the same configurations in the test folder, I want to reference them from file system using my application-TEST.yaml in the resources folder of test package like this
flyway:
    schemas: public
    locations: filesystem:doc/flyway/migrations,filesystem:config/flyway/archive,filesystem:config/flyway/post_migrations

If I try that, I get the same Flyway failed to initialize when I ran a single test, infact context fails to load
java.lang.IllegalStateException: Failed to load ApplicationContext

Any help would be highly appreciated

A: For anyone trying to set up something similar, You have to annotate the integration test with
@ActiveProfiles("TEST")

"TEST" is the configuration profile ("application-TEST.yaml").
Everything worked okay after that.

A:
I fixed that error by creating in the src/main/resources project´s folder another that would be named db which in turn contains another folder called migration and there I placed the script for creating the table my_table. The schema I declared in tag spring.flyway.schemas of the application.properties file and flyway will add my_table and another table flyway_schema_history.


text:
Q: How to sort csv by columns using batch scripting? I have a csv file in the following format:
COLUMN1,COLUMN2,COLUMN3
2,1,0
1,0,0
3,2,0
1,4,1
4,3,0
1,1,4
5,6,0
6,5,0

I want to sort it by 1st and 3rd columns using a bat file. The result I want to get is:
COLUMN1,COLUMN2,COLUMN3
1,0,0
1,4,1
1,1,4
2,1,0
3,2,0
4,3,0
5,6,0
6,5,0

In unix this can be done using sort -n -k1,1 -k3,3 xx.csv > sorted.csv.
I tried to do sort /+1 /+3 xx.csv > sorted.csv in windows, but it didn't work... Thanks for your help

A: Perhaps this is the simplest and fastest way to achieve this:
@echo off
setlocal

set /P "header=" < input.txt
echo %header%
for /F "skip=1 tokens=1-3 delims=," %%a in (input.txt) do set a[%%a,%%c]=%%b
for /F "tokens=2-4 delims=[,]=" %%a in ('set a[') do echo %%a,%%c,%%b

Output:
COLUMN1,COLUMN2,COLUMN3
1,0,0
1,4,1
1,1,4
2,1,0
3,2,0
4,3,0
5,6,0
6,5,0

Previous program assume that there are not records with the same COLUMN1 and COLUMN3, and that the contents of the columns are just one digit. These limitations may be fixed, if needed.

A: There is probably a more elegant and robust solution, but this is my 5 minute solution.
@echo off
> sorted.csv set /p "=" <nul
> unsorted.tmp set /p "=" <nul
for /f "delims=" %%A in (unsorted.csv) do for /f "tokens=1,3 delims=," %%B in ("%%~A") do >>unsorted.tmp echo %%B,%%C,%%A
sort unsorted.tmp > sorted.tmp
for /f "tokens=2,* delims=," %%A in (sorted.tmp) do >>sorted.csv echo %%B
del unsorted.tmp
del sorted.tmp

This takes the first and third columns, prepends them to the beginning of the line, sorts the file, and then removes the added columns.  Note that the sort command weights numbers before letters.
Output
1,0,0
1,4,1
1,1,4
2,1,0
3,2,0
4,3,0
5,6,0
6,5,0
COLUMN1,COLUMN2,COLUMN3

A: @ECHO OFF
SETLOCAL
SET "outfile=sorted.csv"
:: make a tempfile
:maketemp
SET "tempfile=%temp%\%random%"
IF EXIST "%tempfile%*" (GOTO maketemp) ELSE (ECHO.>"%tempfile%a")
SET "header="
(
FOR /f "delims=" %%a IN (xx.csv) DO (
 IF DEFINED header (
  CALL :proc %%a
 ) ELSE (SET header=Y&>%outfile% ECHO(%%a)
)
)>"%tempfile%a"

FOR /f "tokens=2delims=#" %%a IN ('sort ^<"%tempfile%a"') DO >>%outfile% ECHO(%%a
del "%tempfile%a"

GOTO :EOF

:proc
SET /a c1=%1+1000000000
SET /a c3=%3+1000000000
ECHO %c1% %c3%#%1,%2,%3
GOTO :eof

I've assumed that other than the header, your data is all-numeric and 3 columns.
You don't specify whether the numbers involved would exceed 9 or whether if they do, you want the sort-sequence in magnitude of the columns or not.
I've assumed that the three columns are to be sorted in order of magnitude, column 1 then column 3, that the data is all-numeric and there are no negative numbers. Also that the numbers involved are all less than 1000000000.


text:
Q: Jquery UI Accordion not working with nested table I'm trying to include a table inside my jQuery UI accordion.
For some reason, the section ('Download Assignments') which contains the table does not slide down/up smoothly.
Other sections of the accordion seem to work just fine.
Best way to understand the problem is to have a look - please see http://testing.xenongroupadmin.com/docman/admin/Assignments/assignments.html
Whilst on the subject, there appears to be a slight CSS glitch on the accordion as well. If you look at the bottom of the 'Download Assignments' tab, there's a small break in the border just above the next tab. This seems to have something to do with the table. If anyone has any ideas I'd love to hear them!

A: Tables don't really "do" explicit heights, once you can see 'em, you see everything. Their visibility is all or nothing.
Now a div that contains a table is a different story. Simply wrap your table in a div, let that div be the sibling to the triggering link, and you should have an easy time of it.

  Download Assignments


text:
Q: How does this Fibonacci function work? Can anybody tell me how the following function works?
Especially the fibu'-thing and the tuples? Thanks!
fibu :: Integer -> Integer
fibu x = fst (fibu' x)
      where fibu' 0 = (0, 0)
            fibu' 1 = (1, 0)
            fibu' n = (a + l, l)
                      where (l, a) = fibu' (n-1)

A: You may have seen the naïve implementation of the Fibonacci sequence:
fibo :: Integer -> Integer
fibo 0 = 0
fibo 1 = 1
fibo n = fibo (n-1) + fibo (n-2)

Well, the problem with this is that the function calls itself twice, recursively. And each of these calls calls itself twice again... so you end up with exponentially many calls.
What the implementation you're asking about does to solve this problem: it returns not only the n-th Fibonacci number, but both the n-th and n−1-th. Then the n+1-call only needs one extra invocation, not two, because that one invocation gives it all that's needed to calculate the next element of the sequence.
For the final result, you don't want two numbers but only one though, therefore the penultimate value is discarded using fst.

A: Let us first analyze
fibu' 0 = (0, 0)
fibu' 1 = (1, 0)
fibu' n = (a + l, l)
    where (l, a) = fibu' (n-1)

Here we have a function that takes as input a number i, and returns a 2-tuple with two numbers. The two numbers are (Fi, Fi-1) with Fi the i-th Fibonacci number.
The first two numbers (for i = 0, and i = 1) are hardcoded (as (0, 0) and (1, 0)). But of course we can not keep hardcoding Fibonacci values. In case i is not 0 or 1, the last line will be fired. This case is implemented to handle the i-1 case.
In that case we recursively calculate fibu' (n-1) (so the tuple that contains (Fn-1, Fn-2), we calculate this in the two previous Fibonacci numbers. We then know that (this is the Fibonacci inductive relation Fn = Fn-1 + Fn-2). So that means that we can return (a+l, l). So if we call for instance fibu' 5, it will call fibu' 4, fibu' 3, etc. until we reach fibu' 1 and then we will each time construct a new tuple that will keep calculating the last two Fibonacci numbers, until we have reached the Fibonacci numbers with index 5.
Now the only problem with fibu' is that it returns a 2-tuple, and a user usually wants to get a simple number (the i-th Fibonacci number). So now we define a function:
fibu :: Integer -Integer
fibu x = fst (fibu' x)

This will return the first item of the 2-tuple (which is the i-th Fibonacci number).


text:
Q: Tensorboard callback on keras gives InvalidArgumentError when training multiple networks I have a method train_model which gets a keras model object as input and trains it. I have a loop somewhere else in my code that creates a new model in each iteration and passes it to this method. If I don't pass a TensorBoard Callback my code works fine. However, when I do pass the TensorBoard Callback, the first network gets trained but for the second one I get this error:

tensorflow.python.framework.errors_impl.InvalidArgumentError: You must feed a value for placeholder tensor 'dense_7_target' with dtype float and shape [?,?]
       [[{{node dense_7_target}} = Placeholderdtype=DT_FLOAT, shape=[?,?], _device="/job:localhost/replica:0/task:0/device:CPU:0"]]

after calling .fit method. (the network i'm building is 5 layers)
and there is more unexpected behaviors:
When I run this code for a second time, the first network won't need training (since I have already saved the model and it will just load that) and the second network gets trained with no errors but I get the same error for the third network.
In this case, when I check the TensorBoard graphs, I see that the first network has been created correctly, but the second network has twice the layers it should have (as if the first model has been loaded first and then the second network was built on it).
here is my train_model method:
def train_model(model, data, dataname, MODEL_DIR, LOG_DIR, BS, EP, callbacks):
X_train, Y_train, X_test, Y_test = data
if not os.path.exists(MODEL_DIR):
    os.makedirs(MODEL_DIR)
model_callback = tf.keras.callbacks.ModelCheckpoint(MODEL_DIR + dataname + '/',
                                                    monitor='mse',
                                                    verbose=1,
                                                    save_weights_only=True)
tb_callback = tf.keras.callbacks.TensorBoard(log_dir=LOG_DIR + dataname,histogram_freq=10)
callbacks += [model_callback, tb_callback]
if not os.path.exists(MODEL_DIR + dataname + '/'):
    model.fit(X_train, Y_train, batch_size=BS, epochs=EP, verbose=0, callbacks=callbacks, validation_split=0.2)
validation_split=0.2)
    else:
        model.load_weights(MODEL_DIR + dataname + '/')
    return model

I have done everything I could and i'm really out of ideas about what's wrong with my code.
Any help is appreciated. thanks in advance.


text:
Q: .NET MVC3 - Folders Within /Content Folder Missing When Publishing WebSite I have a folder in my /Content folder which is not being included when I build and publish my website. Only the standard CSS, Images, Scripts and themes folders have been included. I also have a Downloads folder containing .doc files that has not been included.
Am I limited to the standard set at the level below /Content?

A: Empty folders typically don't get deployed.
For the Downloads folder, what's the "Build Action" set to for the items that it contains? They should be set to "Content" for anything that you want deployed. This isn't automatically set for some file types, such as PDF, etc.
The only items that get deployed have to be both referenced in the project (that is, they have to appear in the solution explorer, not just present in the folder on disk)
, and have the correct build action set.

You might also set the "Copy To Output Directory" setting to True and see what happens.

A: In Visual Studio, right click on every folder underneath /Content folder, and choose Include In Project. Else, the files are only physically there on disk but the project doesn't know they are there and doesn't publish them.


text:
Q: How to read in c# oracle XmlType from store procedure I'm trying to create a XML in stored procedure in this way:
PROCEDURE DeviceSearched(
   xml_out OUT XMLTYPE
)
IS
BEGIN

    SELECT
      XMLELEMENT("Values",
          XMLFOREST(de_brand)
    )
    INTO xml_out
    FROM
      tbldevice de
    ;

END DeviceSearched;

And I trying to read xml_out in c# in this way:
...
OracleCommand command = new OracleCommand(name, conn);
command.CommandType = CommandType.StoredProcedure;
command.BindByName = true;
...
command.Parameters.Add(new OracleParameter("xml_out", OracleDbType.XmlType, ParameterDirection.Output));

With this approach the issues are two:

*

*Oracle exception: "ORA-01422: exact fetch returns more than requested number of rows"

*If I modify the query to obtain one row, the procedure is ok (I think), but in c# I don't have any result.

What am I doing wrong?
Thanks in advance

A: *

*Running SELECT XMLELEMENT("Values",XMLFOREST(de_brand)) FROM tbldevice de
In plsql will NOT result a single value, So trying to fetch the result in to single variable (INTO xml_out) will result run time error ORA-01422

*Using a store procedure to select data in Oracle is not apperciated, its a SQL Server approch, why not using a simple select

*Examples here and here will show how ODP.Net works with XML
You may need to mix using ref corsur and XMLType to solve the matter


text:
Q: automatically scroll down page when div opens with toggle I have a hidden div whichs is opened/closed via a slidetoggle function (see below) when I click on a button. This works well. However, I want that the bottom of my page scrolls down/up automaticcaly when the div is opened/closed. The bottom of my page must be aligned with the bottom of the opened div + some extra margin below the div, such that the opened div is seen by the visitor of my page. How can I do this?

A: Try wrapping your div in another div. You'll have to do some additional CSS with the outer div, but that should keep everything in check. Now, you'll apply the slideToggle() to the inner div, not the outer div. I've made a jsBin to help out:
http://jsbin.com/pacecibugu/edit?html,output
It's going to look something like this:

Here's my div


text:
Q: Can't get favicon to display no matter what I do I do realize there's 50 other questions like this, but nothing works for some reason. All links below are to the actual site in question to keep everything as clear as possible.
I uploaded my favicon here:
http://fantasy-premier.com/favicon.ico
Uploading the icon to the home directory used to be enough for it to show up in most browsers, but not anymore it seems. So I took the advice of some SO answers and put this in the header, first with a relative path but now with an absolute one to make sure I'm hitting the right URL (because there's a lot of .htaccess SEO action on the site):
<link rel="shortcut icon" href="//www.fantasy-premier.com/favicon.ico"/>

I tried using http:// but switched to // to make sure it's not an issue with https. I then saw a different answer and switched to
<link rel="icon" href="//www.fantasy-premier.com/favicon.ico"/>

Still nothing. It's been about 3 days of attempts now, this last version has been on the site for more than 24 hours, so it's certainly not a case of "wait a while or clear the cache". Speaking of which, I have cleared the cache and tried different browsers. So, how do I get this icon to finally show up?

A: If you've tried all of the different HTML options for referencing the icon, then perhaps there's a problem with the icon itself.
Check that the icon file is actually an icon file (i.e. not just a PNG or other image file type renamed to have a .ico file extension).
Try taking another .ico file from a website that works, and saving it on yours to see whether that works.
There are multiple tools online for creating .ico files from other image types. A quick Google search yields http://www.rw-designer.com/image-to-icon for example.

A: I can see the favicon using Google Chrome 36, but maybe you should try to convert the .ico to .png and then follow the W3 guide:
http://www.w3.org/2005/10/howto-favicon


text:
Q: v.voronoi.skeleton error Recently, I was looking for way to skeletonize buffer and besides solution with PostGIS and Postegre solutions there is algortihm v.voronoi.skeleton. I have tried to use it with different road/rail buffers as described in this tutorial (unfortunatelly in polish, though the best source I got).
Despite following instructions with different parametres and input layers I always get error with output and no layer is created.
2019-07-01T20:50:58     WARNING    Duplicate output OUTPUT_HTML_FILE registered for alg build_generic_plot
2019-07-01T20:50:58     WARNING    Duplicate output OUTPUT_JSON_FILE registered for alg build_generic_plot

A: I assume you are referring to the GRASS module v.voronoi, with the -s option to create a voronoi diagram around polygons.  There is an open issue with this module.
I suggest that you first create centroids, and then try to run v.voronoi around those centroid points.


text:
Q: Как создать свой кастомный row в visual composer? Добрый, помогите пожалуйста с шорткодом для visual composer.
Я создал пару кастомных элементов для вывода информации в пост, но ряд и секция в композер по умолчанию, можно ли как-то создать свой ряд или свою секцию, те кастомную обертку компонент для компонента.
Например я создал компонент слайдер и он выводит только слайды в цикле, в свое время компонент слайдер я кладу в компонент ряд или секцию, в идеале я бы хотел создать совю секцию со своими классами и своей струкрутой в дальнейшем в котрою я закину мой кастомный компонент slider.
Скрин кастомных компонентов:

Скрин дефолтныхм компонентов: ряд и секция.

A: Надо делать свой шорткод. Я выносил куски кода в проекте таким шорткодом (в functions.php):
// Shortcode to output any post
function block_shortcode( $atts ) {
    $p = get_page_by_title($atts['title']);
    if ( function_exists('icl_object_id') ) {
        $id = icl_object_id( $p->ID, 'post', true );
        $p = get_post($id);
    }
    return do_shortcode($p->post_content);
}
add_shortcode('block', 'block_shortcode');

Функция получает название страницы и выводит ее содержимое целиком в то место, где указан шорткод. Код внутри if - для мультиязычного сайта с WPML. Если WPML не установлен, код внутри if будет проигнорирован.
Пример использования:

Шорткод [block title="название_страницы"] должен быть помещен в текстовый блок. В других блоках Visual Composer не обрабатывает шорткоды.


text:
Q: Where do I start with Django when I have a development server running and have a GET request from API? I'm running a Django development server instance and working with the LinkedIn API.
Right now, I have a python script that I can run that will open a new tab in the default web browser and ask the user to sign in with their LinkedIn account, much like a web app would open a popup window to ask for your credentials.
The python script has the Django dev server instance as the redirect URI, so the following message comes up when I authenticate:
[19/Jul/2013 08:24:33] "GET /?code=xxxxxxxxx&state=xxxxxxxxxxxxx HTTP/1.1" 200 1954

Right now, I have to manually copy the code into command line before receiving the proper OAuth access token to make API calls.
I want to make the authentication process automated and in a Django app to integrate with the front end I'll be building. I've read through django.http docs and I'm pretty sure I need to start by making a new app and using that in the views.py file of the app.
How do I extract the query using Django (or Python if I can still integrate this into the app) and use it properly?

A: You can read the parameters of the url with the Request object you have access to in your views.py.
https://docs.djangoproject.com/en/dev/ref/request-response/
def my_view(request):
  code = request.GET.get('code')
  state = request.GET.get('state')
  # do something


text:
Q: xcode and java code I want to ask if it is possible to add "Java" code in my Xcode?
since I want to import "Mahout apache" for recommendation algorithm which is written in Java.
or if you have any other idea which help me to get related "object"

A: Have you seen this document ?
http://developer.apple.com/library/mac/#documentation/Java/Conceptual/Java14Development/02-JavaDevTools/JavaDevTools.html
Keep in mind that Java is not a first class citizen of Xcode anymore.
This is from a maling list

Mike Swingler
Fri Mar 11 16:00:50 2011
On Mar 10, 2011, at 10:37 AM, Jeremy E. Denton wrote:

Sorry, I may have missed it because I only look at it every once in a while
  but did XCode stop supporting Java? Or do I just have to download some sort
  of extension?

Xcode is an Objective-C IDE first, and it's support for Java in it's build
system is equivalent to calling any other command line tool. The Java team at
Apple uses Xcode for native development of JNI libraries and light Java
editing, but to be most productive you will want to use a real Java IDE like
Eclipse, IDEA, or NetBeans.
We have also transitioned the JNI Library template in Xcode 3.x to sample code,
which shows how to build a bundled Java Mac app with a JNI library:
http://developer.apple.com/library/mac/#samplecode/MyFirstJNIProject
Regards,
Mike Swingler
Java Engineering
Apple Inc.

Do not post admin requests to the list. They will be ignored.
Java-dev mailing list      ([EMAIL PROTECTED])
Help/Unsubscribe/Update your Subscription:


text:
Q: SVG works locally, but not on remote server wordpress This gives migraine. I just finished my website locally and moved it to my server. Now I've setup the theme with enabled SVG plugin locally and it worked like a charm. On my external server it does not (www.mantasmilka.com  > single post is the one I am working on.
<?php
        // check if the repeater field has rows of data
        if( have_rows('info_tools') ):
       ?>

          <?php
           // loop through the rows of data
             while ( have_rows('info_tools') ) : the_row();
                // vars
                $tool_image = get_sub_field('image');
                $tool_name = get_sub_field('name');
          ?>
          <a href="#" class="<?php echo $tool_name ?>">
            <svg viewbox="0 0 50 50">
              <?php echo $tool_image;
              echo file_get_contents($tool_image); ?>
            </svg>

            <?php get_template_part(images/inline, 'http://www.mantasmilka.com/wp-content/uploads/2016/05/photoshop.svg.php'); ?>

        <?php endwhile; ?>

      <?php endif; ?>

I've tried numerous solutions and nothing seems to work... Does anybody have any idea what I am missing here?

A: Not really answer your exact question, but this is one of few question that pops up on Google search "svg works locally but not on server". Hope it help future researchers.
In my case the reason was simple to understand and fix.
Locally I was working on a file directly, but on remote that file was included. So locally I had file.php and image.svg in "root" and I called it with

which worked great.
When on server the file structure was something like
[root]
+-[includes]
| +-[MY_INCLUDE_FOLDER]
|   +-image.svg
|   +-file.php
+-index.php

and somewhere in index.php there was this line
include_once __DIR__ . '/includes/MY_INCLUDE_FOLDER/file.php';

Now since this was not just a simple call to PHP script, with PHP output, but an entire webpage with HTML, it also had a line <base href="https://example.com/">.
This means that  source was actually https://example.com/image.svg instead of https://example.com/includes/MY_INCLUDE_FOLDER/image.svg.


text:
Q: Why Daenerys isn't considered a witch by these people? In Game of Thrones S06E04

 Daenerys burns all the Dothraki Khals and then comes out of the burning house. Then all the Dothraki that came to see what was happening knelt before her, considering her the new leader of the horde because she 'defeated' the other Khals.

Why would she be considered a Khaleesi and not a witch? Why did the Dothraki decide to follow her? It's seems like witches are a bad thing in Westeros, Essos and especially in the Dothraki culture. In the eye of a Dothraki man, I feel like she should be seen as a witch for surviving/creating the fire.
Also, there are probably a lot of Dothraki/Khalasars that probably don't want to be ruled by some foreign girl.
EDIT : I think the Dothraki in the show does not believe she is a witch because I think Dothraki would not follow a witch. Witches seem to be a very bad thing in the eyes of this culture (see how the Dothraki girls in S06E03 were saying that Daenerys was a witch and that they should kill her, and after the event of the season 1 also).
So, if you think that the Dothraki might think that she's a witch but decide to follow her nonetheless, why would they agree to follow a witch even though witches are known to be a bad thing in this culture?

A: The Dothraki have no other option. Daenerys has just created a power vacuum where she is the only one to fill the void.
When Khal Drogo died and the dragons were hatched by the fire Daenerys used to burn the witch Mirri Maz Duur, Drogo's khalassar still had other options. They had a choice to stay with Daenerys or join a new khalassar that was formed by Drogo's Bloodrider.
Now, all the other Khals are gone. Daenrys emerges as the one who defeated them. The Dothraki will only follow a winner, a disgraced Khal is no Khal at all.
I think the horde in general will see her more as a god than a witch. She is not performing blood magic or any types of spells. She is immune to fire and can control dragons!


text:
Q: Receiving 401.1 Unauthorized from IIS on server on everything except Swagger I have set up a REST API in .NET 5 which is deployed on IIS.
The API works perfectly for when deployed on local IIS but when I deploy it to a target server it shows some odd behaviour.
When I call the API with a .NET client application or with Postman I receive a 401.1 response. However if I use the Swagger page everything is completely fine. Can anyone explain why this could be the case?
Startup.cs
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
    if (env.IsDevelopment())
    {
        app.UseDeveloperExceptionPage();
        app.UseSwagger();
        app.UseSwaggerUI(c => c.SwaggerEndpoint("v1/swagger.json", "ITS.Mailing.API v1"));
    }

    app.UseHttpsRedirection();
    app.UseRouting();
    app.UseAuthorization();

    app.UseEndpoints(endpoints =>
    {
        endpoints.MapControllers();
    });
}

All the topics I've come across so far indicate issues with the order of statements in the Startup.cs but that doesn't seem to be the issue. I'm currently at my wits end, any help would be appreciated.


text:
Q: Need to serialize Bitmap in Windows32 mode I'm using gdi32 Bitmap...
Need some Win32 solution to serialize gdi32 Bitmap into stream, then pass its buffer to upper level C# code, and to be able to make deserialization...
I know how to do that in MFC, but need Windows 32..
the reason is -
Being not so strong with linking Managed C# code to Unmanaged MFC Dll, I need help and sample of how to bind that kind of link.
Thanks for ya help

A: By far the simplest way to do this is to pass your HBITMAP to the C# code and use Image.FromHbitmap.


text:
Q: QGIS field calculator or paste from .CSV I have a QGIS Geopackage for a layer and I want to update the "Coverage" column based on the contents of the "ID_1" column. In the example below, the ID_1 column contains 1,2,3 or 4 separate entities (each starting  with "E" and separated by "|"). I'd like the Coverage column to represent that number, e.g. 1,1,2,1,2,3 for the first few rows.
In Excel I would just count the number of "E" in the column.  How can I do that in QGIS, I have tried 'count' in the field calculator, but for every row, I get to total number of rows in the whole ID_1 column, not the number of E in each row.
The other option would be to paste the column from my Excel into the coverage column in QGIS, but I can't select a whole column in the QGIS Table - is that possible?
This layer contains geometry so exporting it as a csv and then reimporting it won't work (I assume).

A: The count() function is not what you are looking for, since it is an aggregate function (it looks across all features in your layer).
How about this:
length( regexp_replace( "ID_1", '[^E]+' ,''))

Basically it deletes all characters (except for the E), than the lenght function counts the number of surviving characters ;)


text:
Q: Get Max of len(string) in nested dictionary if string can be None I'm trying to get the max length of a string from a nested dictionary. The field can be a string or None.
When doing this with a list from a nested dictionary, the following works:
max_value = max(dict, key=lambda d: len(dict[d]["list_key"]))
When I run this on the string field, code is:
max_value = max(dict, key=lambda d: len(dict[d]["string_key"]))
because the string can be None, I receive the following error:
TypeError: object of type 'NoneType' has no len()
How can I incorporate is not None into the second function?

A: If you insist on a single lambda expression, something like:
max_value = max(dict, key=lambda d: len(dict[d]["string_key"]) if dict[d]["string_key"] is not None else 0)
However this starts to look pretty messy. How about
strs = (dict[d]["string_key"] for d in dict)
maxlen = max(len(s) for s in strs if s is not None)

A: please do not use python built-in class/type to name your variables, instead of using dict you can use my_dict:
max_value = max(my_dict, key=lambda k: len(my_dict[k]["string_key"] or ''))


text:
Q: Filtering in Mongoose / MongoDB 'find' with non-existent value returns all results I am using Mongoose v6.3.8. I might have a basic misunderstanding about how Mongoose / MongoDB works, but if I do...
model.find({ nonExistentKey: 'anyValue' });

it returns all documents, even though nonExistentKey doesn't show up anywhere in my database.
I was expecting it to return no documents since no documents use nonExistentKey.
Can someone please explain this behavior?
Thank you.

A: To find all docs which have nonExistentKey with any value you can try
model.find({ nonExistentKey: { $exists: 1 } });

To find all docs which have not to key named nonExistentKey
model.find({ nonExistentKey: { $exists: 0 } });


text:
Q: The person version of second country The person version of second country
Like average looking, average money, average car, average house...
Not best of me. Not just about money
Sum of living in the middle
How to call this?
Edit: It's like I am in a middle class without class concept. More vague.

A: Such a person is an 'average Joe' or 'average Jane' (depending on their gender - I'm not aware of an equivalent expression for non-binary persons).

The terms average Joe, ordinary Joe, Joe Sixpack, Joe Lunchbucket, Joe Snuffy, Joe Schmo (for males) and ordinary Jane, average Jane, and plain Jane (for females), are used primarily in North America to refer to a completely average person, typically an average American. It can be used both to give the image of a hypothetical "completely average person" or to describe an existing person. Parallel terms in other languages for local equivalents exist worldwide.

(source: Wikipedia)

A: Collins dictionary:

Tom, Dick, and/or Harry:  an ordinary, undistinguished, or common person

e.g. We don't want our daughter marring any Tom, Dick, or Harry (meaning an average person but in a disapproving way. They'd rather see their daughter marry someone distinguished)


text:
Q: Selenium: Testing interaction between users on different browsers I am implementing a suite to test the behavior of a chat. Each user performs different actions to log in into the chat on different browsers.
I have implemented each test case separately and work fine. I also implemented one suite which includes both cases, one first and then the other and it runs but it looks like both browsers are not sharing the information, because it does not show the user logged in. Here is an example of that I am implementing in java:
public class connect_facebook extends SeleneseTestCase{
Selenium sele1 = null;
Selenium sele2 = null;

@Before
public void setUp() throws Exception {
//Establish the first browser
sele1 = new DefaultSelenium("localhost", 4444, "*firefox", "http://www.google.es/");
//Establish the second browser
sele2 = new DefaultSelenium("localhost", 4444, "*googlechrome " , "http://www.facebook.com");
//Start the first test case
sele1.start();
//Start the second test case
sele2.start();

}

//Send the message to a friend in Facebook
@Test
public void testConnect_facebook_nocookies() throws Exception {
    ...
}

I don't stop sele1
//Open Facebook, check the message and open Zaraproxy to start Connect
@Test
public void testCheck_mail_facebook() throws Exception {
    ...

}
NOTE: What it does is at the very beginning opens FF and Chrome, then closes Chrome and runs sele1. After that does not close FF but opens another FF and Chome browser, closes FF and then runs sele2 with Chrome.
When sele2 opens the chat panel, the user of sele1 (FF) appears offline.
I am using selenium server as a HUB and started another server as a node (not using selenium grid). Want to resolve with selenium RC first before passing to selenium Grid because installation of the Grid have been given me some problems.
Any help is welcome! Thanks in advance!
B


text:
Q: How to read specific lines of codes in another sub? I was wondering if there is a way to run specified lines of code in another sub , say execute only line 1 through line 10 of Sub_2 before executing the code in say, Sub_1.
I have done some background research and found up a code suggested by @Andrew below.
Private Sub Sub_1(sender As System.Object, e As System.EventArgs) Handles Button1.Click

    'Call the Save Sub
    Call Sub_2(sender, e)
    'Proceed to execute the rest of the this Sub_1

What the above code does at the moment is execute the entire sub I have called, which is not what I want to achieve.
I have also read about the using a shared routine common to both Subs as suggested by @Henry , but the problem for me is that variables are declared in the shared routine which are required at various stages in Sub_2, but which cannot be used as the program says they are not declared (in Sub_1).
Again, what I want to achieve is execute only a few lines of code from Sub_2 in Sub_1.
I am using Visual Basic 2010 Express.

A: I very much doubt you will be able to do that.  A function is a unit of code which can be called via Reflection if required, however statements within a function are not exposed via Reflection and when optimised often may not even execute in the order that they are written.
Such a process would break a lot of bad practises - what if the code changes in the future for example?  An implementation can change, although one wouldn't expect the function's definition to.
I would question why you are wanting to do this and look for an alternative means of achieving your goals.
If you were hell bent on such a implementation, then you could potentially break open the CLR code and decompile and then select certain aspects to compile and run - however it would be a lot of hard work, unsustainable and very bad practise.

A: What you are trying to do is technically possible (in various really hackish ways), but would easily become a code structure nightmare. Instead, consider an alteration to the way you are building your routines.
Subs and Functions are intended to be independent 'islands' of code, which can execute (generally) without knowing anything about the rest of the program. You can pass variables into them, and get variables back, but they should operate the same time after time.
Consider this theoretical code from the scenario you are proposing:
Dim variable_1

Private Sub Sub_1()
    Dim variable_2
    Call Sub_2()
End Sub

Private Sub Sub_2()
    'lines 1-10
    'lines 11-20
End Sub

Here we have the setup for what you're looking at. Both Subs can 'see' variable_1, but Sub_2 can't see variable_2. This is called scope. Finally, there is the issue of only wanting to execute lines 1-10 inside Sub_2 when being called from Sub_1.
The first thing to do is to separate our code into logical groups. According to what you're describing, lines 1-10 of Sub_2 make sense when looked at on their own, so this automatically means that they should be grouped together. Lines 11-20 may be a different story, but since they are sometimes relevant and others not, we should separate them as well.
Private Sub Sub_2()
    'lines 1-10
End Sub

Private Sub Sub_3()
    Call Sub_2()
    'lines 11-20
End Sub

The change looks simple, but is actually quite powerful. When we only want to execute lines 1-10, we call Sub_2. If we want to execute lines 1-20, we call Sub_3. Sub_3 will automatically call Sub_2 (lines 1-10) to execute first, and then execute lines 11-20. Easy.
Now we just have to figure out what to do about the variables. There are quite a few ways you can handle this situation, but the easiest thing to do is to expand their scope. If all the variables you need to access are declared outside of these Subs (one "level up"), then they can all access them. For example:
Dim variable_1
Dim variable_2

Private Sub Sub_1()
    Dim variable_3
    'can access 1, 2, 3 but NOT 4, 5
    Call Sub_2()
End Sub

Private Sub Sub_2()
    Dim variable_4
    'can access 1, 2, 4 but NOT 3, 5
End Sub

Private Sub Sub_3()
    Dim variable_5
    'can access 1, 2, 5 but NOT 3, 4
End Sub

This should get you started. Once you've got this down, you can read about the various ways to pass variables into Subs and Functions (which also gives some hints about how to get them out, as well).


text:
Q: Trying to check user against database using PDO Hello I am trying to check the username and password of a user after they have submitted a login form to check if they exist on the database using PDO but it returns false.
Here is the code I am using:
<?php
//import all of the available functions
require_once('func/functions.php');

//create a connection to the database
$database = new database('localhost', 'root', 'usbw');
$database->connect();
$database->select('mjbox');

//Check if the user is logged in
loggedin();

//Check if the submit button has been clicked first
if ( isset( $_POST['submit'] ) ){
    //Check if user exists on database
    match_login($_POST['username'],$_POST['password']);
}
?>

//Check if user is logged in
function loggedin(){
    //Check if the loggedin status is set to true, meaning that user is logged in.
    if ( isset ( $_SESSION['loggedin'] ) && $_SESSION['loggedin'] == true  ) {
        echo '
Hello '. $_SESSION['username'] . ', Logout.
';
    }else{
        //If the user is not logged in display a login form
        echo '<form action="index.php" method="post">';
        echo '<input type="text" name="username">';
        echo '<input type="text" name="password">';
        echo '<input type="submit" name="submit" value="submit">';
        echo '<form>';
    }

}

//Check users login details
function match_login($username, $password){
        //If the button has been clicked get the variables
        $dbh = new PDO("mysql:host=localhost;dbname=mjbox","root", "usbw");
        $stmt = $dbh->prepare("SELECT * FROM mjbox WHERE username=':name' AND password=':pword'");
        $stmt->bindParam(":name", $_POST['username']);
        $stmt->bindParam(":pword", $_POST['password']);
        $stmt->execute();

        if( $stmt->rowCount() > 0 ){

            echo 'There is a match!';
        }else{
            echo 'nooooo';
        }
}

This is the first time I've attempted to use PDO, have I used it correctly? All the details appear to be correct and the user exists within the database so can't undertand why it doesn't return true.
Thanks

A: Binding a string in PDO automatically adds quotes for you. Just remove the quotes around :name and :pword in the query and that should fix it.


text:
Q: Inline div causing uneven layout I'm working with Twitter and have pulled a list of all my followers and their screen names down using the API. I'm trying to display them in a nice 'grid' on my web page. However, it currently looks like this:

The issue happens when the person's screen name is so long that it goes on to two lines. I don't know why it sometimes puts a single person on a line like that...
Here's my CSS code:
div.inline {
float:left;
padding-left: 40px;
padding-bottom: 20px;
text-align: center;
font-family: sans-serif;
width: 90px;
}

And the HTML code:

    <?php echo $userName; ?>

    <?php echo ""; ?>

    <select name = "choice">
        <option value = "blank"></option>
        <option value = "cool">Cool</option>
        <option value = "uncool">Uncool</option>
    </select>

Can anyone help? Perhaps there is a way to put in a blank line after the first line of their name or something if it's less than two lines long?

A: The reason someone is on a single line is because each div is different heights.  Either wrap the username in an element (div for example) and set a height to that or set a height to the entire inline div.  I think it would be nice to have the images aligned though, so the first option is best.

<?=$userName;?>

    <?='';?>

    <select name="choice">
        <option value="blank"></option>
        <option value="cool">Cool</option>
        <option value="uncool">Uncool</option>
    </select>

For 2 lines use the following:
.username {
   height: 30px;
   line-height: 15px;
}

Increase height by line-height value for each line you want.

A: Try something like this:

<?php echo $userName; ?>

    <img src=" <?php echo userImage; ?> " class=" <?php echo $class; ?> " />

    <select name="choice">
        <option value="blank"></option>
        <option value="cool">Cool</option>
        <option value="uncool">Uncool</option>
    </select>

The divs height should be equivalent to two lines of text.

A: Specify a fixed height for the name and image. Your problem will be solved.
Update your markup as this:

<?php echo $userName; ?>

<?php echo ""; ?>

    <select name = "choice">
        <option value = "blank"></option>
        <option value = "cool">Cool</option>
        <option value = "uncool">Uncool</option>
    </select>

And CSS to something similar.
.name { height: 30px; }
.image { height: 200px; }

A: A simple solution is to remove float:left and replace with display:inline-block, since you really do want inline elements (as kind of hinted at with your class="inline").
inline-block elements will naturally align to the text baseline, which means that longer names that spill onto new lines will push the vertical position of all elements down, therefore the person with the longest name will determine the vertical positioning of the other elements.
See demo or example code below:
CSS
div.inline {
    display:inline-block;
    padding-left: 40px;
    padding-bottom: 20px;
    text-align: center;
    font-family: sans-serif;
    width: 90px;
}

HTML

    short-ish username

    <select name="choice">
        <option value="blank"></option>
        <option value="cool">Cool</option>
        <option value="uncool">Uncool</option>
    </select>

    name

    <select name="choice">
        <option value="blank"></option>
        <option value="cool">Cool</option>
        <option value="uncool">Uncool</option>
    </select>

    A really, really long username

    <select name="choice">
        <option value="blank"></option>
        <option value="cool">Cool</option>
        <option value="uncool">Uncool</option>
    </select>

    Short again

    <select name="choice">
        <option value="blank"></option>
        <option value="cool">Cool</option>
        <option value="uncool">Uncool</option>
    </select>

    V.short

    <select name="choice">
        <option value="blank"></option>
        <option value="cool">Cool</option>
        <option value="uncool">Uncool</option>
    </select>


text:
Q: How to compile using boost.python? I am trying to compile a project using boost.python as documented on this page. My platform is MacOS X, i386 architecture. I am using the current version of boost, v1.55. The example provided in ${BOOST}/libs/python/example/tutorial/ compiles and works properly. However, when setting up my own project in a different directory outside of the boost root directory, I run into the following problem: when I type ${BOOST}/bjam toolset=darwin architecture=x86 address-model=32 I get the following error message:
Unable to load Boost.Build: could not find "boost-build.jam"
---------------------------------------------------------------
Attempted search from ${CURRENT_PATH} up to the root at ${SOME_OTHER_PATH} and in these directories from BOOST_BUILD_PATH and BOOST_ROOT: /usr/share/boost-build.
Please consult the documentation at 'http://www.boost.org'.
make: *** [all] Error 1

The documentation of the bjam tool is not referenced, bjam --help only returns an error message and Googling only finds this page (which doesn't talk about the problem at all) and this page (which seems to be outdated as indicated by the link at the top of the page).
Question: How do I specify the path of the boost-build.jam file? Or, alternatively, is there any other way to use boost.python with standard tools?
Update 3: The option -d4 lets bjam print verbose debugging output. If the name of the compiler is known, the output can be grepped for the compiler invocation. This can then be used to construct a "regular" Makefile. See e.g. this post for an example of how to do so (albeit it assumes that the compile and linker commands are known).


text:
Q: What is the point of using archive.php instead of index.php? Dumb Questions Ahead:

*

*If index.php and archive.php are practically the same thing, what's the point of having archive.php?

*When should I ever want to use archive.php over index.php?

*If I use front-page and Blog, it doesn't switch to archive.php which you might expect to and then use index.php in the place of front-page.php.

A: index.php and archive.php might be the same but don't have to be the same. index.php will display your blog post archive and in the absence of archive.php (or other more specific archive files) it will display your date, author, etc. archives as well. But it doesn't have to.
You can, if you want, display your archived differently that your main blog index. That is the point of those specialized files-- they allow you to alter the look of specific pages without having to write complicated conditionals into the index.php file.
The difference between the two files is what you make of it. That difference can be a lot or none.
Reference
http://codex.wordpress.org/Template_Hierarchy


text:
Q: PHPUnit Eclipse Configuration: No Tests Found In attempting to set up Eclipse with PHPUnit as a unit testing library, I've gotten myself stuck attempting to run a simple test case.  For reference, I followed this tutorial to set up Eclipse with PHPUnit/Xdebug/Makegood, the only deviation from the guidelines given was setting up the following configuration file for PHPUnit/Makegood:
config.xml:
    <phpunit backupGlobals="true"
         backupStaticAttributes="false"
         cacheTokens="false"
         colors="false"
         convertErrorsToExceptions="true"
         convertNoticesToExceptions="true"
         convertWarningsToExceptions="true"
         forceCoversAnnotation="false"
         mapTestClassNameToCoveredClassName="false"
         printerClass="PHPUnit_TextUI_ResultPrinter"
         processIsolation="false"
         stopOnError="false"
         stopOnFailure="false"
         stopOnIncomplete="false"
         stopOnSkipped="false"
         testSuiteLoaderClass="PHPUnit_Runner_StandardTestSuiteLoader"
         strict="false"
         verbose="false">
    <testsuites>
        <testsuite name="My Test Suite">
            <directory suffix=".php">/path/to/application/tests/</directory>
        </testsuite>
     </testsuites>
</phpunit>

Now, the root of the problem lies in the fact that I can't seem to run PHPUnit tests from Eclipse with Makegood.  The only test I've written (located in the "/path/to/application/tests/" folder under the name "test.php") looks like the following (taken directly from the PHPUnit Manual):
<?php
class StackTest extends PHPUnit_Framework_TestCase
{
    public function testPushAndPop()
    {
        $stack = array();
        $this->assertEquals(0, count($stack));

        array_push($stack, 'foo');
        $this->assertEquals('foo', $stack[count($stack)-1]);
        $this->assertEquals(1, count($stack));

        $this->assertEquals('foo', array_pop($stack));
        $this->assertEquals(0, count($stack));
    }
}
?>

In order to run the tests, I right-click on the "tests" folder and hit "Run All Tests" in Eclipse, which prints to the console:

PHPUnit 3.7.15 by Sebastian Bergmann.
Configuration read from
  /path/to/application/config.xml
Time: 0 seconds, Memory: 5.00Mb
No tests executed!

Now, when I attempt to run these tests from the command line with the command "phpunit test.php" in the "path/to/application/tests/" directory, I get the following console output:

PHPUnit 3.7.15 by Sebastian Bergmann.
.
Time: 0 seconds, Memory: 3.25Mb
OK (1 test, 5 assertions)

It's evident that I'm not correctly telling Makegood where to find the test files/how to run the tests, but I can't seem to identify how to fix this.  I undoubtedly have a bad mental model for how all the PHPUnit components are fitting together within Eclipse, so any help in the way of aiding my understanding of the architecture would be greatly appreciated.  Thanks in advance!

A: 'Run All Tests' doesn't work the way you're trying to use it. 'Run all tests' runs which ever tests you have selected as one of your 'Test Folders' (see below)

I actually changed my tests folder to this

And it only ran the tests in the RuleData folder. You can click anywhere you like and 'Run All Tests' will behave this way. If you want to run only the tests in a folder just select 'Run Tests'
Also Here's my phpunit xml config which is in the tests directory.
<?xml version="1.0" encoding="UTF-8"?>
<phpunit
         backupStaticAttributes="false"
         backupGlobals="false"
         bootstrap="./../application/third_party/CIUnit/bootstrap_phpunit.php"
         cacheTokens="false"
         colors="false"
         convertErrorsToExceptions="true"
         convertNoticesToExceptions="true"
         convertWarningsToExceptions="true"
         forceCoversAnnotation="false"
         mapTestClassNameToCoveredClassName="false"
         printerClass="PHPUnit_TextUI_ResultPrinter"

         processIsolation="false"
         stopOnError="false"
         stopOnFailure="false"
         stopOnIncomplete="false"
         stopOnSkipped="false"
         testSuiteLoaderClass="PHPUnit_Runner_StandardTestSuiteLoader"

         strict="false"
         verbose="true"

         >
    <php>
        <ini name="memory_limit" value="2047M" />
    </php>

    <testsuites>
        <testsuite name="AllTests">
            <directory>.</directory>
        </testsuite>
    </testsuites>

    <filter>
      <blacklist>
        <directory suffix=".php">./../../</directory>
        <file></file>
        <exclude>
          <file></file>
        </exclude>
      </blacklist>
      <whitelist processUncoveredFilesFromWhitelist="true">
          <directory suffix=".php">./../application/models</directory>
          <directory suffix=".php">./../application/controllers</directory>
          <directory suffix=".php">./../application/libraries</directory>
          <directory suffix=".php">./../application/helpers</directory>
        <file></file>
        <exclude>
          <directory suffix="index.php">./../application</directory>
          <file></file>
        </exclude>
      </whitelist>
    </filter>
</phpunit>


text:
Q: JSF EL i18n in CSS files In my html pages I use the Spring message bean like so:
#{ms.my_text_label}
ms is of type ReloadableMessageSourceBundle and will translate my_text_label by looking in some resource bundle files. Can I make it possible to use this in my CSS files as well?

A: Disclaimer: I'm ignoring the Spring WebFlow part in the question and do as if the JSF project doesn't use any Spring artifacts.

You can just use EL in CSS files the usual way if you load the CSS file via <h:outputStylesheet> instead of plain HTML <link rel="stylesheet">:
<h:outputStylehseet name="some.css" />

Note: this doesn't work for JS files, even not the ones loaded via <h:outputScript>. EL is supported in CSS files for actually only one technical reason: being able to reference CSS background images via #{resource} mapping without the need to hardcode whole library and JSF mapping.
See also:

*

*How to reference CSS / JS / image resource in Facelets template?

*How to reference JSF image resource as CSS background image url


text:
Q: Calcular la matriz de covarianza Tengo una dataframe de retornos anuales yearly_return y quiero hacer la matriz de covarianza. Entonces utilisé  cov(yearly_return) pero me parece que no me da la respuesta esperada porque parece que la diagonal no está llena de 0 o 1. Supongo que la columna de las fechas esta la razón de este problema. Sin embargo cómo hacer la matriz de covarianza con R?
> yearly_return
                 .SXQR       .SXTR        .SXNR        .SXMR       .SXAR       .SX3R
2000-01-01 -0.04211651 -0.01692493 -0.134079012 -0.110542652 -0.13658011  0.27697419
2001-01-01 -0.06170831 -0.06020640 -0.270292443 -0.244983557  0.03086915 -0.01268035
2002-01-01 -0.13181676 -0.31916713 -0.370798530 -0.450515898 -0.28119776 -0.11107462
2003-01-01  0.12010929  0.23596541  0.195487179  0.091163773  0.18582579 -0.02995400
2004-01-01  0.09574009  0.07114804  0.093577436  0.079726746  0.02328106  0.06988229
2005-01-01  0.32241764  0.24503874  0.346011845  0.137005650  0.20891419  0.26745187
2006-01-01  0.19390175  0.25618254  0.255671803  0.095515590  0.25897784  0.17402985
2007-01-01  0.07151176 -0.15668573  0.099268407 -0.043097704  0.24907118  0.12253799
2008-01-01 -0.39909398 -0.43417808 -0.454896057 -0.374645801 -0.42310256 -0.28321255
2009-01-01  0.37555060  0.15490882  0.376812650  0.197982252  0.15445790  0.33306810
2010-01-01  0.29645850  0.26603074  0.331675002  0.157542404  0.43139233  0.21087586
2011-01-01  0.02689063 -0.13311326 -0.152939580 -0.082821116 -0.25170969  0.07262980
2012-01-01  0.23297708  0.33254856  0.236761181  0.200574474  0.34626234  0.20785336
2013-01-01  0.15758295  0.28226061  0.224889270  0.352383599  0.36813147  0.09852600
2014-01-01  0.12771485  0.20728740  0.007498316  0.106319669  0.07123982  0.14959034
2015-01-01  0.23221073  0.22357015  0.082448980  0.156892993  0.15695521  0.20384265
2016-01-01  0.07382496 -0.07403532  0.141806854 -0.027957980  0.02966412 -0.01935074
2017-01-01  0.11678507  0.15511923  0.162564962 -0.003737683  0.14260345  0.12560078
                  .SX6R       .SXFR        .SXOR       .SXDR       .SX4R
2000-01-01  0.104681337  0.15999703 -0.043590105  0.26370803  0.05147042
2001-01-01 -0.071406543 -0.15554701  0.019947448 -0.07791252 -0.13987785
2002-01-01 -0.230112301 -0.34337396 -0.289506263 -0.28954601 -0.21697798
2003-01-01  0.107872960  0.13056199  0.244542568  0.08783802  0.04559812
2004-01-01  0.281793979  0.23979186  0.242456556  0.02901212  0.15874338
2005-01-01  0.292232260  0.33659939  0.326988422  0.29211304  0.31711918
2006-01-01  0.393387562  0.47290317  0.378672907  0.04249343  0.23364378
2007-01-01  0.200444605 -0.11887693 -0.008781149 -0.09816185  0.26299600
2008-01-01 -0.355704066 -0.53960190 -0.449588567 -0.16008695 -0.36264681
2009-01-01  0.041725299  0.29868730  0.372961769  0.16775463  0.45728827
2010-01-01 -0.047881523  0.16608250  0.027759902  0.08104497  0.23118616
2011-01-01 -0.127988837 -0.19952875 -0.188775294  0.14888869 -0.08247720
2012-01-01  0.023502640  0.24994212  0.176444777  0.15020270  0.30207712
2013-01-01  0.111748340  0.36818622  0.221097462  0.22388398  0.15067803
2014-01-01  0.197105509  0.12921216  0.076237379  0.21724504  0.07132732
2015-01-01  0.006913529  0.21694561  0.190190108  0.17151173  0.07280142
2016-01-01 -0.027294030 -0.01439982  0.141503689 -0.06332644  0.09755300
2017-01-01  0.088810599  0.19514217  0.099277978  0.03878557  0.12007593
                  .SXRR        .SXER        .SXKR        .SX7R       .SX8R
2000-01-01 -0.225365403  0.043774723 -0.361583644  0.128316144 -0.17028728
2001-01-01 -0.009904841 -0.009732258 -0.283345384 -0.060287204 -0.39441865
2002-01-01 -0.291441728 -0.150425114 -0.365582268 -0.236771176 -0.55863189
2003-01-01  0.088919239  0.022473035  0.151242142  0.210549933  0.26432695
2004-01-01  0.125110885  0.138461912  0.121153901  0.121524454 -0.02500651
2005-01-01  0.106820548  0.343225228  0.003708784  0.243734200  0.22048081
2006-01-01  0.273049830  0.063976954  0.216590444  0.220488172  0.03986477
2007-01-01 -0.007858586  0.093594463  0.172031349 -0.154626065 -0.01157508
2008-01-01 -0.412050836 -0.374351734 -0.327785050 -0.626580865 -0.47660446
2009-01-01  0.323031727  0.243966979  0.152915965  0.471351371  0.20212243
2010-01-01  0.120842042  0.013476388  0.078833242 -0.115211802  0.16435588
2011-01-01 -0.049966570  0.039481850 -0.009725331 -0.310751184 -0.12290388
2012-01-01  0.117352173 -0.013181300 -0.061099921  0.258543547  0.22139256
2013-01-01  0.208803171  0.056021733  0.351386970  0.187817561  0.24531130
2014-01-01 -0.011008923 -0.114184021  0.127413678  0.008276349  0.09512400
2015-01-01  0.106651835 -0.037800910  0.129595315 -0.008791811  0.15368136
2016-01-01 -0.018977205  0.306591774 -0.099367626 -0.002784941  0.08031547
2017-01-01 -0.013230032  0.010090399 -0.003590741  0.111173975  0.19937089
                 .SXIR       .SXPR
2000-01-01  0.21292564 -0.18061961
2001-01-01 -0.28494845  0.18713470
2002-01-01 -0.49789995 -0.17531545
2003-01-01  0.07890223  0.19142430
2004-01-01  0.09043759  0.12806068
2005-01-01  0.32582934  0.52502544
2006-01-01  0.19226424  0.38868295
2007-01-01 -0.10726150  0.28007157
2008-01-01 -0.43832446 -0.63296576
2009-01-01  0.15149087  0.88588641
2010-01-01  0.03285816  0.25505589
2011-01-01 -0.11482104 -0.28741280
2012-01-01  0.36427523  0.06243915
2013-01-01  0.30237368 -0.14556775
2014-01-01  0.14390280 -0.02503591
2015-01-01  0.18403687 -0.31307481
2016-01-01  0.01939247  0.71674991
2017-01-01  0.10445053  0.22769644

Aquí pueden ver la matriz de covarianza:
> head(covMat)
           .SXQR      .SXTR      .SXNR      .SXMR      .SXAR      .SX3R      .SX6R
.SXQR 0.03345763 0.03498086 0.04185753 0.03245136 0.03497776 0.02324828 0.02081399
.SXTR 0.03498086 0.04974472 0.04619830 0.04159817 0.04420657 0.02401824 0.02689768
.SXNR 0.04185753 0.04619830 0.06097311 0.04537355 0.05011720 0.02686316 0.03057380
.SXMR 0.03245136 0.04159817 0.04537355 0.04287405 0.04017447 0.02191462 0.02405812
.SXAR 0.03497776 0.04420657 0.05011720 0.04017447 0.05465295 0.02184147 0.02625680
.SX3R 0.02324828 0.02401824 0.02686316 0.02191462 0.02184147 0.02318865 0.01733667
           .SXFR      .SXOR      .SXDR      .SX4R      .SXRR      .SXER      .SXKR
.SXQR 0.04086303 0.03468033 0.01823918 0.03342966 0.03033003 0.02051229 0.02694061
.SXTR 0.05423479 0.04174388 0.02550628 0.03293408 0.03421856 0.01525291 0.03196615
.SXNR 0.05599539 0.04790487 0.02203189 0.04631396 0.04020604 0.02833009 0.03950701
.SXMR 0.04781758 0.03778244 0.02453928 0.03373207 0.03334523 0.01743750 0.03682066
.SXAR 0.04785298 0.03958789 0.01603731 0.03772380 0.03561357 0.01769105 0.03574271
.SX3R 0.03177379 0.02265676 0.01815483 0.02582638 0.01863272 0.01464734 0.01394396
           .SX7R      .SX8R      .SXIR      .SXPR
.SXQR 0.03635913 0.03991513 0.03508348 0.04456718
.SXTR 0.04453817 0.04959444 0.04831080 0.03223030
.SXNR 0.04871591 0.05847244 0.04905516 0.06505796
.SXMR 0.03789661 0.04934120 0.04555107 0.03031465
.SXAR 0.03882093 0.04838590 0.04046836 0.04557004
.SX3R 0.02804067 0.02522826 0.02949463 0.02648925

Por ejemplo SXQR varía consigo mismo por 0.04086303
Actualización
Para reproducir el error aqui esta lo que retorna dput(head(yearly_return))
> dput(head(yearly_return))
structure(c(-0.0421165123033923, -0.0617083091226032, -0.131816755569501,
0.120109285789344, 0.0957400900067813, 0.322417643774428, -0.0169249318983612,
-0.0602063954833634, -0.319167127697028, 0.235965409696626, 0.0711480448517274,
0.245038735010082, -0.134079011941763, -0.2702924428144, -0.370798529903107,
0.19548717948718, 0.0935774360717017, 0.346011845242674, -0.110542651522903,
-0.244983557489711, -0.450515898083807, 0.0911637733076145, 0.0797267463656433,
0.137005649717514, -0.136580114822547, 0.0308691499522444, -0.28119775606494,
0.18582578531509, 0.0232810615199035, 0.208914188351921, 0.276974190672987,
-0.0126803533973178, -0.111074619022596, -0.029954000507081,
0.069882291782704, 0.267451871749836, 0.1046813369317, -0.071406542832064,
-0.230112300861844, 0.107872959801132, 0.281793979111202, 0.292232260407681,
0.159997028378981, -0.155547010190348, -0.34337395766517, 0.130561994148269,
0.239791860002651, 0.336599392938921, -0.0435901050109238, 0.0199474482809667,
-0.289506262743956, 0.244542567969835, 0.242456556082149, 0.326988421847471,
0.263708030479369, -0.0779125192766018, -0.289546012748289, 0.0878380192808617,
0.0290121189864121, 0.292113042450041, 0.051470416208502, -0.13987784564131,
-0.216977981038514, 0.0455981235340108, 0.158743380734218, 0.317119184193754,
-0.225365403148089, -0.00990484092618038, -0.29144172753255,
0.0889192394781297, 0.125110884778395, 0.106820548420687, 0.0437747229932033,
-0.0097322584687356, -0.150425114453891, 0.0224730348607323,
0.138461912046818, 0.343225227534931, -0.361583644073633, -0.283345383672315,
-0.365582268299222, 0.151242142064746, 0.121153901298999, 0.00370878423004628,
0.128316144184622, -0.0602872043484647, -0.236771176027587, 0.210549932691828,
0.121524453588088, 0.243734200072228, -0.170287283323371, -0.394418648502133,
-0.558631889568851, 0.264326947209905, -0.0250065121125294, 0.220480807544162,
0.212925636847071, -0.284948446239345, -0.497899952214482, 0.0789022298456261,
0.0904375871687588, 0.325829336926796, -0.180619608268678, 0.187134698239872,
-0.175315448448335, 0.191424297822835, 0.12806067767732, 0.525025437278938
), class = c("xts", "zoo"), .indexCLASS = "Date", tclass = "Date", .indexTZ = "UTC", tzone = "UTC", index = structure(c(946684800,
978307200, 1009843200, 1041379200, 1072915200, 1104537600), tzone = "UTC", tclass = "Date"), .Dim = c(6L,
18L), .Dimnames = list(NULL, c(".SXQR", ".SXTR", ".SXNR", ".SXMR",
".SXAR", ".SX3R", ".SX6R", ".SXFR", ".SXOR", ".SXDR", ".SX4R",
".SXRR", ".SXER", ".SXKR", ".SX7R", ".SX8R", ".SXIR", ".SXPR"
)))

A: El problema no está en las fechas, que son metadatos y no intervienen en el cálculo de la covarianza. De hecho el resultado que estás obteniendo es el que "correcto" para el cálculo de una matriz de covarianza: la diagonal te arroja la varianza de cada columna, entendiendo a la varianza como un caso especial de covarianza de una variable con sigo misma.
Para obtener 1 en la diagonal deberías usar cor(), que calcula una matriz de correlaciones (por defecto el coeficiente de determinación r de Pearson).
La covarianza de x y x es igual a la varianza de x
cov(yearly_return$.SXQR, yearly_return$.SXQR)

      .SXQR
.SXQR 0.02704784

var(yearly_return$.SXQR)
      .SXQR
.SXQR 0.02704784

La matriz de correlación tiene 1 en la diagonal
cor(yearly_return[,1:4])  #primeras 4 columnas

.SXQR     .SXTR     .SXNR     .SXMR
.SXQR 1.0000000 0.8808104 0.9654083 0.8785866
.SXTR 0.8808104 1.0000000 0.9416833 0.9599468
.SXNR 0.9654083 0.9416833 1.0000000 0.9551311
.SXMR 0.8785866 0.9599468 0.9551311 1.0000000

En https://es.wikipedia.org/wiki/Covarianza#Propiedades hay una escueta formulación de esa propiedad.
De todos modos se entiende facilmente mirando las ecuaciones de cada una.
La varianza se define como la sumatoria de los desvíos a la media (x-media_de_x) al cuadrado entre la n. La covarianza como la sumatoria del producto de los desvíos a la media de x y y entre la n. Si es la covarianza de x y x entonces ese producto es lo mismo que el cuadrado en la ecuación de la varianza. Por eso dan el mismo resultado: son matemáticamente equivalentes.

Sería útil mathJAX en SO.


text:
Q: how to parse an expression step by step in c# (preferably visitor pattern) I am new to c#. I have a question about parsing a string. If i have a file that contains dome lines such as PC: SWITCH_A == ON or a string like PC: defined(SWITCH_B) && SWITCH_C == OFF. All the operators(==, &&, defined) are string here and all the switch names(SWITCH_A) and their values are identifiers(OFF). How do i parse these kind of string? Do i first have to tokenize them split them by new lines or white spaces and then make an abstract syntax tree for parsing them? Also do i need to store all the identifiers in a dictionary first? I have no idea about parsing can anyone help? an tell me with an example how to do it what should be the methods and classes that should be included? Thanks.

A: Unfortunately, Yes. You have to tokenize them if the syntax that you are parsing is something custom and not a standard syntax where a compiler already exists for parsing the source.
You could take advantage of Expression Trees. They are there in the .NET Framework for building and evaluating dynamic languages.
To start parsing the syntax you have to have a grammar document that describes all the possible cases of the syntax in each line. After that, you can start parsing the lines and building your expression tree.
Parsing any source code typically goes a character at a time since each character might change the entire semantics of the piece that is being parsed.
So, i suggest you start with a grammar document for the syntax that you have and then start writing your parser.
Make sure that there isn't anything already out there for the syntax you are trying to parse as these kind of projects tend to be error-prone and time consuming
Now since your high-level grammar is

Expression ::= Identifier | IntegerValue | BooleanExpression

Identifier and IntegerValue are constant literals in the source, so you need to start looking for a BooleanExpression.
To find a BooleanExpression you need to look for either BooleanBinaryExpression, BooleanUnaryExpression, TrueExpression or FalseExpression.
You can detect a BooleanBinaryExpression by look for the && or == operators and then taking the left and right operands.
To detect a BooleanUnaryExpression you need to look for the word defined and then parse the identifier in the parantheses.
And so on...
Notice that your grammar supports recursion in the syntax, look at the definition of the AndExpression or EqualsExpression, they point back to Expression

AndExpression ::= Expression '&&' Expression
EqualsExpression ::= Expression '==' Expression

You got a bunch of methods in the String Class in the .NET Framework to assist you in detecting and parsing your grammar.
Another alternative is that you can look for a parser generator that targets c#. For example, see ANTLR


text:
Q: Extract data (date) from a string to use as a filter in python using for loops and if statements I am trying to use this date information:
date_of_report = "Wednesday, May 25, 2022"

to use in an if statement that will determine which range of cell to use:
months = {
    "Jan": 31,
    "Feb": 28,
    "Mar": 31,
    "Apr": 30,
    "May": 31,
    "Jun": 30,
    "Jul": 31,
    "Aug": 31,
    "Sep": 30,
    "Oct": 31,
    "Nov": 30,
    "Dec": 31,
}

days = [
    "Sun",
    "Mon",
    "Tue",
    "Wed",
    "Thu",
    "Fri",
    "Sat",
]

weeks = [
    "Week 1",
    "Week 2",
    "Week 3",
    "Week 4",

days_of_the_month_cells = {
    "Week 1": {
        "Sun": "D6:D22",
        "Mon": "E6:E22",
        "Tue": "F6:F22",
        "Wed": "G6:G22",
        "Thu": "H6:H22",
        "Fri": "I6:I22",
        "Sat": "J6:J22",
    }, "Week 2": {
        "Sun": "D23:D39",
        "Mon": "E23:E39",
        "Tue": "F23:F39",
        "Wed": "G23:G39",
        "Thu": "H23:H39",
        "Fri": "I23:I39",
        "Sat": "J23:J39",
    }, "Week 3": {
        "Sun": "D40:D56",
        "Mon": "E40:E56",
        "Tue": "F40:F56",
        "Wed": "G40:G56",
        "Thu": "H40:H56",
        "Fri": "I40:I56",
        "Sat": "J40:J56",
    }, "Week 4": {
        "Sun": "D57:D73",
        "Mon": "E57:E73",
        "Tue": "F57:F73",
        "Wed": "G57:G73",
        "Thu": "H57:H73",
        "Fri": "I57:I73",
        "Sat": "J57:J73",
    }

}

I have this code as a base but I cannot figure out how to use an if statement to filter the information from the string I have which is a date (I beleive this would need to be done in steps)
for item in days_of_the_month_cells.values():
            for day, range in item.items():
                for index, cells in enumerate(ws[range]):
                    for cell in cells:
                        if index == 0:
                            # if ?
                            cell.value = day

any help would be appreciate
Thanks!

A:

days = {
    "mon":1,
    "tue":2,
    "wed":3,
    "thu":4,
    "fri":5,
    "sat":6,
    "sun":7,
}

days_of_the_month_cells = {
    1: {
        "sun": "D6:D22",
        "mon": "E6:E22",
        "tue": "F6:F22",
        "wed": "G6:G22",
        "thu": "H6:H22",
        "fri": "I6:I22",
        "sat": "J6:J22",
    }, 2: {
        "sun": "D23:D39",
        "mon": "E23:E39",
        "tue": "F23:F39",
        "wed": "G23:G39",
        "thu": "H23:H39",
        "fri": "I23:I39",
        "sat": "J23:J39",
    }, 3: {
        "sun": "D40:D56",
        "mon": "E40:E56",
        "tue": "F40:F56",
        "wed": "G40:G56",
        "thu": "H40:H56",
        "fri": "I40:I56",
        "sat": "J40:J56",
    }, 4: {
        "sun": "D57:D73",
        "mon": "E57:E73",
        "tue": "F57:F73",
        "wed": "G57:G73",
        "thu": "H57:H73",
        "fri": "I57:I73",
        "sat": "J57:J73",
    }

def get_cell_address(datetime_str):
    dow, date = [x.strip() for x in date_of_report.split(",", 1)]
    dt = datetime.datetime.strptime(date, "%M %d, %Y")
    dow = dow[:3].lower()

    wk = dt.isocalendar()[1]
    assert dow == days[dt.isoweekday()], "Invalid day name"

    wom = wk % 4  # Get week number
    return days_of_the_month_cells[wom+1][days[dow]]

date_of_report = "Wednesday, May 25, 2022"
cell = get_cell_address(date_of_report)


text:
Q: Error Failure sending mail with smtpexception I am trying to send email via my web, I research for help no luck.
Still receive error:  smtpexception was unhandled by user code
 protected void Button1_Click(object sender, EventArgs e)
    {

        MailMessage msg = new MailMessage();
        msg.From = new MailAddress("abc@gmail.com");
        msg.To.Add(TextBox3.Text);
        msg.Subject = TextBox4.Text;
        msg.Body = TextBox5.Text;
        msg.IsBodyHtml = true;

        SmtpClient smtp = new SmtpClient();
        smtp.Host = "smtp.gmail.com";

        System.Net.NetworkCredential netCred = new System.Net.NetworkCredential();
        netCred.UserName = "abc@gmail.com";
        netCred.Password = "11111111";

        smtp.UseDefaultCredentials = true;
        smtp.Credentials = netCred;
        smtp.Port = 465;
        smtp.EnableSsl = true;
        smtp.Send(msg);
        try
        {
            smtp.Send(msg);
            Label1.Text = "Your E-Mail Sent Great Job!!!!";
        }
        catch (Exception ex)
        {
            //Handle your exception here
            Label1.Text = ex.Message + " " + "Oeps, something when wrong when we tried to send the email";
            return;
        }
    }

when i run it shows me this error highlighting smtp.Send(message);:
SmtpException was unhandled by the user code and Failure sending mail.
System.Net.Mail.SmtpException: Failure sending mail. ---> System.IO.IOException: Unable to read data from the transport connection: net_io_connectionclosed. at System.Net.Mail.SmtpReplyReaderFactory.ProcessRead(Byte[] buffer, Int32 offset, Int32 read, Boolean readLine) at System.Net.Mail.SmtpReplyReaderFactory.ReadLines(SmtpReplyReader caller, Boolean oneLine) at System.Net.Mail.SmtpReplyReaderFactory.ReadLine(SmtpReplyReader caller) at System.Net.Mail.SmtpConnection.GetConnection(ServicePoint servicePoint) at System.Net.Mail.SmtpTransport.GetConnection(ServicePoint servicePoint) at System.Net.Mail.SmtpClient.GetConnection() at System.Net.Mail.SmtpClient.Send(MailMessage message) --- End of inner exception stack trace --- at System.Net.Mail.SmtpClient.Send(MailMessage message) at IntroAsp.net.EmailMsg.Button1_Click(Object sender, EventArgs e) in c:\Users\Regev\Documents\Visual Studio 2013\Projects\IntroAsp.net\IntroAsp.net\EmailMsg.aspx.cs:line 46

A: Possible solutions:
1) Make smtpClient.UseDefaultCredentials = false;
2) The credentials "UserName" and "Password" are valid for sending an email.
3) Check port 465 is not blocked by a firewall.
4) Instead of using port number 465 use port 587.
Hope, this might help you.
Thank you.


text:
Q: How can I implement comparable interface in go? I've recently started studying Go and faced next issue. I want to implement Comparable interface. I have next code:
type Comparable interface {
    compare(Comparable) int
}
type T struct {
    value int
}
func (item T) compare(other T) int {
    if item.value < other.value {
        return -1
    } else if item.value == other.value {
        return 0
    }
    return 1
}
func doComparison(c1, c2 Comparable) {
    fmt.Println(c1.compare(c2))
}
func main() {
    doComparison(T{1}, T{2})
}

So I'm getting error
cannot use T literal (type T) as type Comparable in argument to doComparison:
    T does not implement Comparable (wrong type for compare method)
        have compare(T) int
        want compare(Comparable) int

And I guess I understand the problem that T doesn't implement Comparable because compare method take as a parameter T but not Comparable.
Maybe I missed something or didn't understand but is it possible to do such thing?

A: Your Interface demands a method
compare(Comparable) int
but you have implemented
func (item T) compare(other T) int { (other T instead of other Comparable)
you should do something like this:
func (item T) compare(other Comparable) int {
    otherT, ok := other.(T) //  getting  the instance of T via type assertion.
    if !ok{
        //handle error (other was not of type T)
    }
    if item.value < otherT.value {
        return -1
    } else if item.value == otherT.value {
        return 0
    }
    return 1
}


text:
Q: Using usleep to perform action every second I have that pseudo crone scheduler implemented in PHP. The heart of the project is a simple while loop acting like this:
while((time()-$start)<$time_limit) {
  //Perform jobs
     ...
  //Sleep a second
  sleep(1)
}

Now obviously, if the job part takes some significant amount of time, like 0.5 seconds, sooner of later one second might be skipped. Here I assume it will always be less than a second.
Just for you to imagine:
Timeline:
 +0    0
 +0.4  0.4 - execution
 +1    1.4 - sleep
 +0.3  1.7 - execution
 +1    2.7 - sleep
 +0.6  3.3 - execution

So, I decided to make a smarter sleep algorithm. My idea was taking current micro-second time and seeking how much micro seconds do I have to sleep to the next second:
  /*Sleep exactly to the next whole second*/
  //Get current microtime as xxxxx.yyyyy (so the whole part is seconds)
  $utime = microtime(true);
  //Get the next whole second by rounding this up
  $utime_next = ceil($utime);
  //Find some 0.xxx of time that makes the difference
  //this+exec time of the scripts in this iteration should be 1
  $diff = $utime_next-$utime;
  //Sleep for that ammount of usecs
  usleep($diff*1000000);
  //Log for debug
  $this->log("Slept for $diff seconds.");

Now the results seem to be very disturbing. While in the past, the log had some seconds missing:

[2.3.2014    2:13:08] -> INFO:       >> include 'script.php';
  [2.3.2014    2:13:10] -> INFO:       >> include 'script.php';
  [2.3.2014    2:13:11] -> INFO:       >> include 'script.php';

The new version with usleep seems to ignore mathematics, which is much worse:

[2.3.2014    2:44:54] -> INFO:     Slept for 0.67506289482117 seconds.
  [2.3.2014    2:44:54] -> INFO:       >> include 'script.php';
  [2.3.2014    2:44:54] -> INFO:     Slept for 0.67906403541565 seconds.
  [2.3.2014    2:44:54] -> INFO:       >> include 'script.php';

So what the hell? My calculator confirms that just the sleep time is 0.67506289482117+0.67906403541565 = 1.35412693023682. I'm using date to generate dates in the log.
Note: This is a fun project. No need to explain why this is a bad idea.


text:
Q: Vim Delete From the Character Directly After the First Character of a Word Until the End of the Word Say I have
word
^ Cursor Here

and I want it to be
w

If I use de I end up just deleting the entire word. I could just press the right arrow key once but that requires me to lift my hands defeats the purpose. I Need a way to delete from the character directly following until the end of the word. I could be overdoing it a little here though.

A: If you do a remap, then you can create a shortcut for it. For instance:
noremap <C-t> :norm lde<Cr>
will remap ctrl+t to move right with l, delete to end de, then enter <CR>. This assumes your cursor is at the beginning of a word.

A: The problem here is that you're using the arrow keys to move rather than hjkl
keys.
While it feels very wrong to use them when you've been used to the arrow
keys from so many other programs, it only takes a week or two of forcing
yourself to use hjkl. Once that's done, the benefits are with you for every
extra second, minute, hour you spend in vim for as long as you use it as your editor.
In your case you would just type lde to move right one character, and delete to the
beginning of the next word.


text:
Q: Subgroups of $S_4$ generated by cycles I am new with abstract algebra and I trying to find all the subgroups of $S_{4}$ generated by the cycles :
a) $(13)$ and $(1234)$
b) all cycles of length $3$
I am not sure how to start so I would very much appreciate some hints or at least some material to get started. Thank you

A: $a)$ subgroup generated by $(13) $ and $(1234)$ is isomorphic to $D_4$. Write its elements precisely and then you will at once see it, four rotations of square (including $0$ degree) and four flips.
b) Subgroup of $S_4 $ generated by all $3$ cycles is $A_4$, it is true for any $S_n$, but sorry man, you will have to work out explicitly all elements for $S_4$ (or you won't learn) as there are not many elements and without much time consumption you can write both subgroups you asked for.
I have told you the answer, now verifying is your job

A: I assume that in each case you're actually looking for answers to a two-part question:

*

*What is the set of elements in the subgroup?

*What well-known group is the subgroup isomorphic to?

Answering #1 is relatively easy.  Start with the set of elements you've been given.  So, in (a), start with the set $\{(13), (1234)\}$, and in (b), start with the set of all cycles of length 3.  Then, multiply arbitrary pairs of elements together (multiplying an element with itself is also allowed).  In the context of the symmetric group $S_4$, "multiplication" just means function composition.
Consider case (a), and let $x = (13)$ and $y = (1234)$.  You'll start by computing all possible pairs of multiplications $xx$, $xy$, $yx$, and $yy$.
Write the results in cycle notation, and determine whether any of those results represent permutations that aren't in your set.  If they're new, add them to the set, and continue the process.  You may end up computing results such as $xyyxxy$, but eventually you'll run out of "new" results; that is, you'll only find results that simplify to elements that are already in your set.  When you can't find any way combine elements in your set to generate a value that lies outside of your set (in other words, as soon as the set becomes "closed" with respect to the group operator), you'll have found the full subgroup.
For #2, you can try to determine whether your group is isomorphic to any well-known group, such as those listed here: http://en.wikipedia.org/wiki/List_of_small_groups
Roughly speaking, "isomorphic to" means "behaves like".  So, to answer this part of the question, you can use tricks like the ones listed in other answers to narrow down the possibilities.

A: $a)$ Let $H=\langle(1,2,3,4)\rangle$ and $k=(1,3)$ you can show that $kHk^{-1}=H$ which means $H\langle k\rangle$ is agroup of order $8$.
$b)$ Notice that a three cycle is an even permutation so group generated by three cycles must be a subgroup of $A_4$. And this group has elements of order three and two. Since $A_4$ has no subgroup of order $6$, this group is $A_4$.


text:
Q: Call form's method which is inside a frame I am developing a software which have a main form and a "content" form.
The content form is inside a frame of the main form.
What I have to do is to call a method of the content form from the main form.
Code from MainWindow.xaml:
<StackPanel>
  ...
  <Frame x:Name="contentFrame" x:FieldModifier="public" Height="500" Width="600" />
  ...
</StackPanel>

Code from MainWindow.xaml.cs:
contentFrame.Source = new Uri("contentForm.xaml", UriKind.Relative);

What I would like to do:
FormInsideFrameInstance.method();

A: You should be able to cast the Content property of the Frame to whatever the type of the current Content is, e.g.:
contentForm cf = contentFrame.Content as contentForm;
if (cf != null)
{
    cf.Method();
}


text:
Q: ¿Cuál sería la máxima dimensión de las imágenes para cada caso particular? ¿A qué me refiero?
Yo estoy haciendo un juego en ASP.NET. Cada página aspx la estoy llenando de imágenes:

*

*Imagen de fondo (full size)

*Imagen al costado arriba

*Imagen arriba en el medio (tipo titulo)

*Imagen que cubre un 65% de la pantalla

*Imagen que cubre 25% de la pantalla (esta al lado de la imagen 65%), etc.

¿Existe algun estandar de tamaño para cada uno de estos casos?
Por ejemplo:
"Si yo sé que una imagen la voy a usar de fondo de pagina full size, no tiene sentido que supere 1920x1080 ya que con esa resolución se verá muy bien, inclusive en los monitores más grandes".

PD: Por ahora no me importaba mucho la resolución de mis imágenes,
  pero se volvió muy lento el juego al momento de cargarlo. Creo que el
  problema viene por ese lado.


text:
Q: Simple Applet Game Bug I'm having trouble with my applet. It's purpose is to create a game where you can move a block at the bottom of the screen to fit through holes in blocks that are falling down from up above. I've already implemented the block but I can't get the block to move when I press a key.
Here is my source code:
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class MathewBorumGame extends JApplet
{
    public void init()
    {
        Dimension dim = getSize();
        MathewBorumGamePanel avoidance = new MathewBorumGamePanel(dim);
        add(avoidance);
        Thread game = new Thread(avoidance);
        game.start();
    }
}// end of the extended JApplet class

class MathewBorumGamePanel extends JPanel implements Runnable{
    protected int x = 225;
    protected int y = 450;
    private int speed = 0;
    private boolean isPlaying = false;
    private boolean hasHit = false;
    private String instructions = "Press 'Enter' to start survive as long as"
        + " as possible.";
    private String keyInstructions = "Use arrow keys to move.";
    private String test;
    private Dimension dim = null;
    private Thread game = null;
    private Timer timer = new Timer(1000, new TimerListener());
    public MathewBorumGamePanel(Dimension paramDimension) {
        this.dim = paramDimension;
        setBackground(new Color(255, 255, 204));
        setForeground(Color.black);
        addKeyListener(new KeyAdapter() {
            public void keyPressed(KeyEvent e) {
                        switch (e.getKeyCode()) {
                    case KeyEvent.VK_LEFT:
                        if(x >= 10) x = x - 10;
                        repaint();
                        break;
                    case KeyEvent.VK_RIGHT:
                        if(x <= 490) x = x + 10;
                        repaint();
                        break;
                    default:
                        repaint();
                        break;
                }
            }
        });
    }
    public void run() {
        for (;;) {
            repaint();
        }
    }
    public void paintComponent(Graphics paramGraphics) {
        super.paintComponent(paramGraphics);
        paramGraphics.fillRect(x, y, 50, 15);
        paramGraphics.setFont(new Font("Serif", Font.BOLD, 15));
        paramGraphics.drawString(this.instructions, 30, 30);
        paramGraphics.drawString(this.keyInstructions, 30, 50);
        test = test.valueOf(x);
        paramGraphics.drawString(test, 30, 70);
    }

    private class TimerListener implements ActionListener {
        public void actionPerformed(ActionEvent e) {
            repaint();
        }
    }
}//end of the extended JPanel class

Thanks

A: See comments in code for some further tips..
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;

// <applet code='MathewBorumGame' width=400 height=400></applet>
public class MathewBorumGame extends JApplet
{
    public void init()
    {
        Dimension dim = getSize();
        MathewBorumGamePanel avoidance = new MathewBorumGamePanel(dim);
        add(avoidance);
        /*
        Thread game = new Thread(avoidance);
        game.start();*/
    }
}// end of the extended JApplet class

class MathewBorumGamePanel extends JPanel { //implements Runnable{
    protected int x = 225;
    protected int y = 450;
    private int speed = 0;
    private boolean isPlaying = false;
    private boolean hasHit = false;
    private String instructions = "Press 'Enter' to start survive as long as"
        + " as possible.";
    private String keyInstructions = "Use arrow keys to move.";
    private String test;
    private Dimension dim = null;
    private Thread game = null;
    private Timer timer = new Timer(1000, new TimerListener());
    public MathewBorumGamePanel(Dimension paramDimension) {
        this.dim = paramDimension;
        setBackground(new Color(255, 255, 204));
        setForeground(Color.black);
        addKeyListener(new KeyAdapter() {
            public void keyPressed(KeyEvent e) {
                        switch (e.getKeyCode()) {
                    case KeyEvent.VK_LEFT:
                        System.out.println("Go left");
                        if(x >= 10) x = x - 10;
                        repaint();
                        break;
                    case KeyEvent.VK_RIGHT:
                        System.out.println("Go right");
                        if(x <= 490) x = x + 10;
                        repaint();
                        break;
                    default:
                        //repaint();
                        break;
                }
            }
        });
        // Must be focusable!
        setFocusable(true);
        // very important!  Must have focus..
        requestFocusInWindow();
        timer.start();
    }

    /*  THIS IS NOT HOW TO DO ANIMATION!
    @Override
    public void run() {
        for (;;) {
            repaint();
        }
    }*/

    public void paintComponent(Graphics paramGraphics) {
        super.paintComponent(paramGraphics);
        paramGraphics.fillRect(x, y, 50, 15);
        paramGraphics.setFont(new Font("Serif", Font.BOLD, 15));
        paramGraphics.drawString(this.instructions, 30, 30);
        paramGraphics.drawString(this.keyInstructions, 30, 50);
        test = test.valueOf(x);
        paramGraphics.drawString(test, 30, 70);
    }

    private class TimerListener implements ActionListener {
        public void actionPerformed(ActionEvent e) {
            repaint();
        }
    }
}//end of the extended JPanel class


text:
Q: Exchange EWS: class "DistinguishedFolderIdType" not defined I'm using Exchange web services, trying to create a calendar entry in another user's mailbox. My account in EWS has rights to do this, and I can successfully use Impersonation to create thes appointment in any mailbox.
However, some examples I've seen of doing this, use an instance of DistinguishedFolderIdType, not impersonation, to set the mailbox for the appointment.
Problem is, this class simply isn't appearing in my installation of the EWS SDK for Visual Studio. It's v1.1, obtained here, but can't be found in Object Explorer. What am I missing?

A: The type DistinguishedFolderIdType is not part of the EWS Managed API.
If you do not use the EWS Managed API but generate your own SOAP client proxy manually from Visual Studio by adding a reference to the EWS .asmx service, the generated proxy will contain DistinguishedFolderIdType.
However, depending on what you are trying to accomplish, you should be able to do it using the classes provided på EWS Managed API 1.1 and you won't need DistinguishedFolderIdType.


text:
Q: az login command fails - Azure cli Installed Azure CLI on windows, ran az login command and running into following error

Version I am running is : 2.0.37

A: Azure cli 2.0 is written in python, it will verify ssl certificate when setting request. Make sure you don't have any proxy setting. I met same error when fiddler is running.
To work with proxy, we have to set REQUESTS_CA_BUNDLE env variable to certificate path.  See related issue comment.
Make a complete example of fiddler.

*

*Exported fiddler's certificate to desktop.
Tools -> Options, HTTPS tab, Actions -> Export Root Certificate to Desktop.

*Use OpenSSL to convert to .pem file as Python doesn't accept .cer file.
openssl x509 -inform der -in FiddlerRoot.cer -out FiddlerRoot.pem.

*Configure env variable in PS: $env:REQUESTS_CA_BUNDLE= '{folderpath}\FiddlerRoot.pem'
Then everything should work.

A: If you are using a command
az login

then it will try to take you though the browser and you have to provider your username and password there only.
If you want to login in the hell only then use
az login -u your_username -p your_password

This should work.

A: I was getting this with Azure CLI v2.3.2, what worked for me was copying the link it opened into a new incognito Chrome window and logging in as normal


text:
Q: Slow Down SymPy's Computations into Smaller Steps I'm playing around with SymPy and it is very powerful. However, I would like to get it to 'slow down' and solve pieces of an equation at a time instead of most of the equation. For instance, given an input string equation (assuming the correct form) like
9x-((17-3)(4x)) - 8(34x)

I would like to first solve
9x-((14)(4x)) - 8(34x)

And then
9x-(56x) - 8(34x)

and then
9x-(56x) - 272x

And so on.
Another example,
from sympy import *
s = (30*(5*(5-10)-10*x))+10
s2 = expand(s, basic=False)

Gives me -300*x - 740 in one step, and I just want a single * done at a time

A: Reading the ideas document produced as a result of the Google Summer of Code, this appears to be something yet to be added to the library. As it stands there is no way of doing this for your example, without completely coding something yourself.
The issue of converting algorithms that are not equivalent to human workings, into discrete steps, is discussed and highlighted in the above document. I'm not sure if that'd be an issue in the implementation of expansion, but it's certainly an issue for other algorithms, which machines compute differently for reasons of efficiency.
tl;dr This library doesn't support step-by-step breakdowns for your example. Only the manualintegrate function currently has step-by-step workings.