text:
Q: Laravel Route cache conflicts even when only one of the said route is present in the system I have Laravel 7.28.* project working in my Windows 10 64Bit OS, which is inside the master branch of the Git repository.
Now when I run the command php artisan optimize it always ends up with this error, exactly when it runs php artisan route:cache command:
[2020-10-13 11:46:06] local.ERROR: Unable to prepare route [logout] for serialization. Another route has already been assigned name [logout]. {"exception":"[object] (LogicException(code: 0): Unable to prepare route [logout] for serialization. Another route has already been assigned name [logout]. at [ProjectRootName]_master\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\AbstractRouteCollection.php:212)

I am pretty sure there's only one /logout route in the routes/ directory's files. But still even after clearing all the caches like bootstrap/cache, storage/framework/cache, php artisan config:clear && php artisan config:cache, php artisan cache:clear etc., I still get the aforementioned error when I run php artisan route:cache or php artisan optimize.
I also tried running composer install and/or composer update before artisan commands, but in vain.
Here is the route:list that I generated thro' artisan command:
+--------+-----------+-----------------------------------------+-----------------------+------------------------------------------------------------------------+----------------------+
|[32m Domain [39m|[32m Method    [39m|[32m URI                                     [39m|[32m Name                  [39m|[32m Action                                                                 [39m|[32m Middleware           [39m|
+--------+-----------+-----------------------------------------+-----------------------+------------------------------------------------------------------------+----------------------+
[39;49m|        | GET|HEAD  | chooser                                 | chooser               | App\Http\Controllers\ChooserController@show                            | web[39;49m[39;49m                  |[39;49m
[39;49m|        |           |                                         |                       |                                                                        | [39;49m[39;49mauth[39;49m[39;49m                 |[39;49m
[39;49m|        |           |                                         |                       |                                                                        | [39;49muser_can_access_site |
[39;49m|        | GET|HEAD  | login                                   | login                 | App\Http\Controllers\Auth\LoginController@showLoginForm                | web[39;49m[39;49m                  |[39;49m
[39;49m|        |           |                                         |                       |                                                                        | [39;49mguest                |
[39;49m|        | POST      | login                                   |                       | App\Http\Controllers\Auth\LoginController@login                        | web[39;49m[39;49m                  |[39;49m
[39;49m|        |           |                                         |                       |                                                                        | [39;49mguest                |
[39;49m|        | GET|HEAD  | logout                                  | logout                | App\Http\Controllers\Auth\LogoutController@logout                      | web[39;49m[39;49m                  |[39;49m
[39;49m|        |           |                                         |                       |                                                                        | [39;49m[39;49mauth[39;49m[39;49m                 |[39;49m
[39;49m|        |           |                                         |                       |                                                                        | [39;49muser_can_access_site |
|        | POST      | logout                                  | logout                | App\Http\Controllers\Auth\LoginController@logout                       | web                  |
[39;49m|        | POST      | password/email                          | password.email        | App\Http\Controllers\Auth\ForgotPasswordController@sendResetLinkEmail  | web[39;49m[39;49m                  |[39;49m
[39;49m|        |           |                                         |                       |                                                                        | [39;49mguest                |
[39;49m|        | GET|HEAD  | password/reset                          | password.request      | App\Http\Controllers\Auth\ForgotPasswordController@showLinkRequestForm | web[39;49m[39;49m                  |[39;49m
[39;49m|        |           |                                         |                       |                                                                        | [39;49mguest                |
[39;49m|        | POST      | password/reset                          | password.update       | App\Http\Controllers\Auth\ResetPasswordController@reset                | web[39;49m[39;49m                  |[39;49m
[39;49m|        |           |                                         |                       |                                                                        | [39;49mguest                |
[39;49m|        | GET|HEAD  | password/reset/{token}                  | password.reset        | App\Http\Controllers\Auth\ResetPasswordController@showResetForm        | web[39;49m[39;49m                  |[39;49m
[39;49m|        |           |                                         |                       |                                                                        | [39;49mguest                |
[39;49m|        | POST      | register                                |                       | App\Http\Controllers\Auth\RegisterController@register                  | web[39;49m[39;49m                  |[39;49m
[39;49m|        |           |                                         |                       |                                                                        | [39;49mguest                |
[39;49m|        | GET|HEAD  | register                                | register              | App\Http\Controllers\Auth\RegisterController@showRegistrationForm      | web[39;49m[39;49m                  |[39;49m
[39;49m|        |           |                                         |                       |                                                                        | [39;49mguest                |
[39;49m|        | GET|HEAD  | site/{siteId}/campaigns                 | campaigns.index       | App\Http\Controllers\CampaignController@index                          | web[39;49m[39;49m                  |[39;49m
[39;49m|        |           |                                         |                       |                                                                        | [39;49m[39;49mauth[39;49m[39;49m                 |[39;49m
[39;49m|        |           |                                         |                       |                                                                        | [39;49muser_can_access_site |
[39;49m|        | POST      | site/{siteId}/campaigns                 | campaigns.store       | App\Http\Controllers\CampaignController@store                          | web[39;49m[39;49m                  |[39;49m
[39;49m|        |           |                                         |                       |                                                                        | [39;49m[39;49mauth[39;49m[39;49m                 |[39;49m
[39;49m|        |           |                                         |                       |                                                                        | [39;49muser_can_access_site |
[39;49m|        | GET|HEAD  | site/{siteId}/campaigns/create          | campaigns.create      | App\Http\Controllers\CampaignController@create                         | web[39;49m[39;49m                  |[39;49m
[39;49m|        |           |                                         |                       |                                                                        | [39;49m[39;49mauth[39;49m[39;49m                 |[39;49m
[39;49m|        |           |                                         |                       |                                                                        | [39;49muser_can_access_site |
[39;49m|        | GET|HEAD  | site/{siteId}/campaigns/job-count       | campaigns.job_count   | App\Http\Controllers\CampaignController@campaignJobCount               | web[39;49m[39;49m                  |[39;49m
[39;49m|        |           |                                         |                       |                                                                        | [39;49m[39;49mauth[39;49m[39;49m                 |[39;49m
[39;49m|        |           |                                         |                       |                                                                        | [39;49muser_can_access_site |
[39;49m|        | DELETE    | site/{siteId}/campaigns/{campaign}      | campaigns.destroy     | App\Http\Controllers\CampaignController@destroy                        | web[39;49m[39;49m                  |[39;49m
[39;49m|        |           |                                         |                       |                                                                        | [39;49m[39;49mauth[39;49m[39;49m                 |[39;49m
[39;49m|        |           |                                         |                       |                                                                        | [39;49muser_can_access_site |
[39;49m|        | PUT|PATCH | site/{siteId}/campaigns/{campaign}      | campaigns.update      | App\Http\Controllers\CampaignController@update                         | web[39;49m[39;49m                  |[39;49m
[39;49m|        |           |                                         |                       |                                                                        | [39;49m[39;49mauth[39;49m[39;49m                 |[39;49m
[39;49m|        |           |                                         |                       |                                                                        | [39;49muser_can_access_site |
[39;49m|        | GET|HEAD  | site/{siteId}/campaigns/{campaign}/edit | campaigns.edit        | App\Http\Controllers\CampaignController@edit                           | web[39;49m[39;49m                  |[39;49m
[39;49m|        |           |                                         |                       |                                                                        | [39;49m[39;49mauth[39;49m[39;49m                 |[39;49m
[39;49m|        |           |                                         |                       |                                                                        | [39;49muser_can_access_site |
[39;49m|        | GET|HEAD  | site/{siteId}/campaigns/{id}/delete     | campaigns.delete_form | App\Http\Controllers\CampaignController@showDeleteForm                 | web[39;49m[39;49m                  |[39;49m
[39;49m|        |           |                                         |                       |                                                                        | [39;49m[39;49mauth[39;49m[39;49m                 |[39;49m
[39;49m|        |           |                                         |                       |                                                                        | [39;49muser_can_access_site |
[39;49m|        | GET|HEAD  | site/{siteId}/companies                 | companies.index       | App\Http\Controllers\CompanyController@index                           | web[39;49m[39;49m                  |[39;49m
[39;49m|        |           |                                         |                       |                                                                        | [39;49m[39;49mauth[39;49m[39;49m                 |[39;49m
[39;49m|        |           |                                         |                       |                                                                        | [39;49muser_can_access_site |
[39;49m|        | GET|HEAD  | site/{siteId}/companies/{id}/delete     | companies.delete_form | App\Http\Controllers\CompanyController@showDeleteForm                  | web[39;49m[39;49m                  |[39;49m
[39;49m|        |           |                                         |                       |                                                                        | [39;49m[39;49mauth[39;49m[39;49m                 |[39;49m
[39;49m|        |           |                                         |                       |                                                                        | [39;49muser_can_access_site |
[39;49m|        | GET|HEAD  | site/{siteId}/feeds                     | feeds.index           | App\Http\Controllers\FeedController@index                              | web[39;49m[39;49m                  |[39;49m
[39;49m|        |           |                                         |                       |                                                                        | [39;49m[39;49mauth[39;49m[39;49m                 |[39;49m
[39;49m|        |           |                                         |                       |                                                                        | [39;49muser_can_access_site |
[39;49m|        | POST      | site/{siteId}/feeds                     | feeds.store           | App\Http\Controllers\FeedController@store                              | web[39;49m[39;49m                  |[39;49m
[39;49m|        |           |                                         |                       |                                                                        | [39;49m[39;49mauth[39;49m[39;49m                 |[39;49m
[39;49m|        |           |                                         |                       |                                                                        | [39;49muser_can_access_site |
[39;49m|        | GET|HEAD  | site/{siteId}/feeds/create              | feeds.create          | App\Http\Controllers\FeedController@create                             | web[39;49m[39;49m                  |[39;49m
[39;49m|        |           |                                         |                       |                                                                        | [39;49m[39;49mauth[39;49m[39;49m                 |[39;49m
[39;49m|        |           |                                         |                       |                                                                        | [39;49muser_can_access_site |
[39;49m|        | DELETE    | site/{siteId}/feeds/{feed}              | feeds.destroy         | App\Http\Controllers\FeedController@destroy                            | web[39;49m[39;49m                  |[39;49m
[39;49m|        |           |                                         |                       |                                                                        | [39;49m[39;49mauth[39;49m[39;49m                 |[39;49m
[39;49m|        |           |                                         |                       |                                                                        | [39;49muser_can_access_site |
[39;49m|        | PUT|PATCH | site/{siteId}/feeds/{feed}              | feeds.update          | App\Http\Controllers\FeedController@update                             | web[39;49m[39;49m                  |[39;49m
[39;49m|        |           |                                         |                       |                                                                        | [39;49m[39;49mauth[39;49m[39;49m                 |[39;49m
[39;49m|        |           |                                         |                       |                                                                        | [39;49muser_can_access_site |
[39;49m|        | GET|HEAD  | site/{siteId}/feeds/{feed}/edit         | feeds.edit            | App\Http\Controllers\FeedController@edit                               | web[39;49m[39;49m                  |[39;49m
[39;49m|        |           |                                         |                       |                                                                        | [39;49m[39;49mauth[39;49m[39;49m                 |[39;49m
[39;49m|        |           |                                         |                       |                                                                        | [39;49muser_can_access_site |
[39;49m|        | GET|HEAD  | site/{siteId}/feeds/{id}/delete         | feeds.delete_form     | App\Http\Controllers\FeedController@showDeleteForm                     | web[39;49m[39;49m                  |[39;49m
[39;49m|        |           |                                         |                       |                                                                        | [39;49m[39;49mauth[39;49m[39;49m                 |[39;49m
[39;49m|        |           |                                         |                       |                                                                        | [39;49muser_can_access_site |
[39;49m|        | POST      | site/{siteId}/feeds/{id}/run            | feeds.run             | App\Http\Controllers\FeedController@runFeed                            | web[39;49m[39;49m                  |[39;49m
[39;49m|        |           |                                         |                       |                                                                        | [39;49m[39;49mauth[39;49m[39;49m                 |[39;49m
[39;49m|        |           |                                         |                       |                                                                        | [39;49m[39;49muser_can_access_site[39;49m[39;49m |[39;49m
[39;49m|        |           |                                         |                       |                                                                        | [39;49mthrottle:1           |
[39;49m|        | GET|HEAD  | site/{siteId}/home                      | site.home             | App\Http\Controllers\HomeController@index                              | web[39;49m[39;49m                  |[39;49m
[39;49m|        |           |                                         |                       |                                                                        | [39;49m[39;49mauth[39;49m[39;49m                 |[39;49m
[39;49m|        |           |                                         |                       |                                                                        | [39;49muser_can_access_site |
[39;49m|        | GET|HEAD  | site/{siteId}/jobs                      | jobs.index            | App\Http\Controllers\JobController@index                               | web[39;49m[39;49m                  |[39;49m
[39;49m|        |           |                                         |                       |                                                                        | [39;49m[39;49mauth[39;49m[39;49m                 |[39;49m
[39;49m|        |           |                                         |                       |                                                                        | [39;49muser_can_access_site |
[39;49m|        | POST      | site/{siteId}/jobs                      | jobs.store            | App\Http\Controllers\JobController@store                               | web[39;49m[39;49m                  |[39;49m
[39;49m|        |           |                                         |                       |                                                                        | [39;49m[39;49mauth[39;49m[39;49m                 |[39;49m
[39;49m|        |           |                                         |                       |                                                                        | [39;49muser_can_access_site |
[39;49m|        | PUT|PATCH | site/{siteId}/jobs/{job}                | jobs.update           | App\Http\Controllers\JobController@update                              | web[39;49m[39;49m                  |[39;49m
[39;49m|        |           |                                         |                       |                                                                        | [39;49m[39;49mauth[39;49m[39;49m                 |[39;49m
[39;49m|        |           |                                         |                       |                                                                        | [39;49muser_can_access_site |
[39;49m|        | DELETE    | site/{siteId}/jobs/{job}                | jobs.destroy          | App\Http\Controllers\JobController@destroy                             | web[39;49m[39;49m                  |[39;49m
[39;49m|        |           |                                         |                       |                                                                        | [39;49m[39;49mauth[39;49m[39;49m                 |[39;49m
[39;49m|        |           |                                         |                       |                                                                        | [39;49muser_can_access_site |
[39;49m|        | GET|HEAD  | site/{siteId}/jobs/{job}/edit           | jobs.edit             | App\Http\Controllers\JobController@edit                                | web[39;49m[39;49m                  |[39;49m
[39;49m|        |           |                                         |                       |                                                                        | [39;49m[39;49mauth[39;49m[39;49m                 |[39;49m
[39;49m|        |           |                                         |                       |                                                                        | [39;49muser_can_access_site |
+--------+-----------+-----------------------------------------+-----------------------+------------------------------------------------------------------------+----------------------+

How can fix this with definitive steps and in what specific order I need to run commands for fixing this ?


text:
Q: Transform Dictionary with date values into Dataframe with date values as counts per each month I have been struggling with transforming the below x dictionary, into the table/dictionary below.
 x = {'John': 0,
 'Dan': 0,
 'Tim': 0,
 'Andrew': ['2022-04-10','2022-04-11','2022-06-16','2022-06-17','2022-06-18','2022-08-19','2022-08-20','2022-11-24','2022-12-12'],
 'Jack': ['2021-12-31','2022-01-01','2022-01-02','2022-03-26','2022-03-27','2022-03-28','2022-05-29','2022-06-01','2022-06-10','2022-06-12','2022-08-13']}

I want to put the names (keys) into Column 0,
the dates I would like to present just the count per each year-month column
Result:
df = pd.DataFrame(data = {'Name':['John', 'Dan', 'Tim', 'Andrew', 'Jack'],
    '2021-12':[0,0,0,0,1],
   '2022-01' :[0,0,0,0,2],
   '2022-02' :[0,0,0,0,0],
   '2022-03' :[0,0,0,0,3],
   '2022-04' :[0,0,0,1,0],
    '2022-05' :[0,0,0,0,1],
    '2022-06' :[0,0,0,3,3],
    '2022-07' :[0,0,0,0,0],
    '2022-08' :[0,0,0,2,1],
    '2022-09' :[0,0,0,0,0],
    '2022-10' :[0,0,0,0,0],
    '2022-11' :[0,0,0,1,0],
    '2022-12' :[0,0,0,1,0]})

This is the final df result(values are representing the counts per each Month):

A: IIUC, you can try something like this:
x = {'John': 0,
 'Dan': 0,
 'Tim': 0,
 'Andrew': ['2022-04-10','2022-04-11','2022-06-16','2022-06-17','2022-06-18','2022-08-19','2022-08-20','2022-11-24','2022-12-12'],
 'Jack': ['2021-12-31','2022-01-01','2022-01-02','2022-03-26','2022-03-27','2022-03-28','2022-05-29','2022-06-01','2022-06-10','2022-06-12','2022-08-13']}

dfe = pd.DataFrame.from_dict(x, 'index').explode(0).set_axis(['dates'], axis=1).rename_axis('name').reset_index()

dfe['dates'] = pd.to_datetime(dfe['dates'], format='%Y-%m-%d')

df_out = dfe.groupby(['name',pd.Grouper(key='dates', freq='M')]).size().unstack(fill_value=0)
df_out = df_out.drop('1970-01-31', axis=1)
df_out = df_out.reindex(pd.date_range(df_out.columns.min(), df_out.columns.max(), freq='M'), axis=1, fill_value=0)
df_out.columns = df_out.columns.strftime('%Y-%m')
print(df_out)

Output:
        2021-12  2022-01  2022-02  2022-03  2022-04  2022-05  2022-06  2022-07  2022-08  2022-09  2022-10  2022-11  2022-12
name
Andrew        0        0        0        0        2        0        3        0        2        0        0        1        1
Dan           0        0        0        0        0        0        0        0        0        0        0        0        0
Jack          1        2        0        3        0        1        3        0        1        0        0        0        0
John          0        0        0        0        0        0        0        0        0        0        0        0        0
Tim           0        0        0        0        0        0        0        0        0        0        0        0        0

Working with periods instead of dates and converting to strings....
x = {'John': 0,
 'Dan': 0,
 'Tim': 0,
 'Andrew': ['2022-04-10','2022-04-11','2022-06-16','2022-06-17','2022-06-18','2022-08-19','2022-08-20','2022-11-24','2022-12-12'],
 'Jack': ['2021-12-31','2022-01-01','2022-01-02','2022-03-26','2022-03-27','2022-03-28','2022-05-29','2022-06-01','2022-06-10','2022-06-12','2022-08-13']}

dfe = pd.DataFrame.from_dict(x, 'index').explode(0).set_axis(['dates'], axis=1).rename_axis('name').reset_index()

dfe['dates'] = pd.to_datetime(dfe['dates'], format='%Y-%m-%d').dt.to_period('M')

df_out = dfe.groupby(['name', 'dates']).size().unstack(fill_value=0)
df_out = df_out.drop('1970-01', axis=1)
df_out = df_out.reindex(pd.period_range(df_out.columns.min(), df_out.columns.max(), freq='M'), axis=1, fill_value=0)
print(df_out)

Output:
        2021-12  2022-01  2022-02  2022-03  2022-04  2022-05  2022-06  2022-07  2022-08  2022-09  2022-10  2022-11  2022-12
name
Andrew        0        0        0        0        2        0        3        0        2        0        0        1        1
Dan           0        0        0        0        0        0        0        0        0        0        0        0        0
Jack          1        2        0        3        0        1        3        0        1        0        0        0        0
John          0        0        0        0        0        0        0        0        0        0        0        0        0
Tim           0        0        0        0        0        0        0        0        0        0        0        0        0

redpajama_set_name: RedPajamaStackExchange


text:
Q: How to properly render SVG in React Native Hi Have the following code in our react native application:
import { SvgCssUri } from 'react-native-svg';

<SvgCssUri style={styles.osIcon} uri={'https://mon.zappiehost.com/images/os/' + props.data.icon} />

I have even tried to use simple SvgUri (instead of SvgCssUri)
But the image still load with out some of the content (Blacks colors):

Also here is the original SVG image used: https://raw.githubusercontent.com/librenms/librenms/master/html/images/os/proxmox.svg

A: Turns out the blacks were missing due to the fact that React Native SVG didnt do auto fill.
adding fill={'black'} is what was needed into the <SvgUri> tag


text:
Q: Sitecore ECM AutomationStatesStatisticsByMessage I'm using Sitecore 8.0 + EXM 3.1.1.
After installation of the QA server and some test payload, the table "Fact_AutomationStatesStatisticsByMessage" in Analitycs DB remains empty. There're no errors in Log files event in the DEBUG mode. I expect some data in the table because the table is updated on our DEV servers and reflects the number of sent/opened messages.
Any ideas, why?

A: I did figure it out.
There is a collection named "AutomationStateDefinition" in Mongo "Analytics" DB. It is supposed to be filled with all Automation States of all active Email Campaigns. It was empty on the new installed environment because I didn't copy Mongo Databases to the new environment, I just wanted them to be empty. However if this collection is empty Sitecore is not able to update the "Fact_AutomationStatesStatisticsByMessage" SQL table. Actually the log saying something like:
"ERROR Unable to get automation state definition"

That might be a problem when you install new environment. The solution for me was deactivate and then activate each Email in EXM. The Mongo "AutomationStateDefinition" collection is filled with records once you activate EXM Email.


text:
Q: 'rb') as f: PermissionError: [Errno 13] Permission denied I've a problem with the copy file with a progress bar, i've this message error :
" File "C:\Users\Sn00f\PycharmProjects\MegaProjet\mesfonctions.py", line 261, in installdreamcast
with open(src_pathdream, 'rb') as f:
PermissionError: [Errno 13] Permission denied: 'C:\Users\Sn00f\Desktop\Dreamcast"
My code :
def installdreamcast():
src_pathdream = r'C:\Users\Sn00f\Desktop\Dreamcast'
fsize = int(os.path.getsize(src_pathdream))
dest_pathdream = r'C:\AppMetier\Deamcast'
with open(src_pathdream, 'rb') as f:
    with open(dest_pathdream, 'ab') as n:
        with tqdm(ncols=60, total=fsize, bar_format='{l_bar}{bar} | Remaining: {remaining}') as pbar:
            buffer = bytearray()
            while True:
                buf = f.read(8192)
                n.write(buf)
                if len(buf) == 0:
                    break
                buffer += buf
                pbar.update(len(buf))
print("It's GOOOOOOOOOOOOOOOOOOOOOOOOD")

How to resolve this "PermissionError: [Errno 13] Permission denied"
Thank you

A: Clearly, the file you are trying to access does not have read permissions. Why not remove the second and third with blocks and try to open a file that you know has read permissions to check that the first with block is working.


text:
Q: Covariance / Contravariance in C# I have the following code:
public interface IParameter
{
   ParameterName Name { get; set; }
}

public interface IParameter<T> : IParameter
{
    T Value  { get; set; }
    T LLimit { get; }
    T RLimit { get; }
}

public class IntegerParameter : IParameter<int>
{
    public ParameterName Name { get; set; }

    public int Value  { get; set; }
    public int LLimit { get; private set; }
    public int RLimit { get; private set;}

    public IntegerParameter(ParameterName name, int value, int llimit, int rlimit)
    {
        Name   = name;
        Value  = value;
        LLimit = llimit;
        RLimit = rlimit;
    }
}

public class DoubleParameter : IParameter<double>
{
    public ParameterName Name { get; set; }

    public double Value  { get; set; }
    public double LLimit { get; private set; }
    public double RLimit { get; private set; }

    public DoubleParameter(ParameterName name, double value, double llimit, double rlimit)
    {
        Name   = name;
        Value  = value;
        LLimit = llimit;
        RLimit = rlimit;
    }
}

// ...

The code is part of a physics project I am putting together.
Now here is my problem. I would like to be able to add the parameters in a dictionary based on the ParameterName but still be able to call the Value.
var A   = new IntegerParameter(ParameterName.X1, 10, 0, 100);
var B   = new DoubleParameter(ParameterName.X2, 56.4, 0, 78.6);
var set = new Dictionary<ParameterName,IParameter>();

set.Add(A.Name, A);
set.Add(B.Name, B);

set[A.Name].Value; // I cannot do it since the Value is expressed only in the IParameter<T> part

A: Wihtout changing your arcihtecture, (which would deserve an abstract base class, by the way) you can't mix int and doubles in the same list and hope to get an int or double.
You could use reflection, or
You could dot it this way (I think that quite a bad design, but it's just for the example), adding some more info in IParameter interface
With a base abstract class
public interface IParameter
    {
        ParameterName Name { get; set; }
        object GetValue();
        Type Type { get; }
    }

public interface IParameter<T> : IParameter where T : IConvertible
{
    T Value { get; set; }
    T LLimit { get; }
    T RLimit { get; }
}
public abstract class BaseParameter<T> : IParameter<T> where T : IConvertible
{
    protected BaseParameter(ParameterName name, T value, T llimit, T rlimit)
    {
        Name = name;
        Value = value;
        LLimit = llimit;
        RLimit = rlimit;
    }
    public ParameterName Name { get; set; }
    public object GetValue(){return Value;}
    public Type Type{get { return typeof(T); }}
    public T Value { get; set; }
    public T LLimit { get; private set; }
    public T RLimit { get; private set; }
}

public class IntegerParameter : BaseParameter<int>
{
    public IntegerParameter(ParameterName name, int value, int llimit, int rlimit)
        : base(name, value, llimit, rlimit)
    {
    }
}

public class DoubleParameter : BaseParameter<double>
{
    public DoubleParameter(ParameterName name, double value, double llimit, double rlimit)
        : base(name, value, llimit, rlimit)
    {
    }
}

Usage :
var a = new IntegerParameter(ParameterName.X1, 10, 0, 100);
var b = new DoubleParameter(ParameterName.X2, 56.4, 0, 78.6);
var set = new Dictionary<ParameterName, IParameter>();

set.Add(a.Name, a);
set.Add(b.Name, b);

//ouch, ugly, isn't it ?
var test = Convert.ChangeType(set[a.Name].GetValue(), set[a.Name].Type);
var k = test.GetType();//I'm an int
test = Convert.ChangeType(set[b.Name].GetValue(), set[b.Name].Type);
k = test.GetType();//I'm a double


text:
Q: Calculate the probability that a randomly chosen claim on this policy is processed in four hours or more I'm not sure how to approach this question, can someone please help me?
An insurance policy is written to cover a loss X where X has density function
f(x) = (2/9)x for 0 ≤ x ≤ 3
       and 0 otherwise
The time (in hours) to process a claim of size x, where 0 ≤ x ≤ 3, is uniformly distributed
on the interval x to 4x. Calculate the probability that a randomly chosen claim on this policy is processed in four hours or more.
A. 0.425
B. 0.593
C. 0.666
D. 0.721
E. None of the above
Ive attempted the double integral:
1 to 3 and 4 to 4x (2/27) dy dx
since f(x,y) is 2/27 (1/3x times (2/9)x)

A: Use the law of total probability. Let $T$ be the time it takes to process a claim. Then $T\mid X=x\sim \text{Unif}(x, 4x)$. Note that $P(T\geq 4\mid X=x)=\frac{4x-4}{3x}=\frac{4(x-1)}{3x}$ for $1\leq x\leq 3$ and equal to zero otherwise.Hence
$$
P(T\geq 4)=\int P(T\geq 4\mid X=x)f_{X}(x)\, dx=\int_{1}^3\frac{4(x-1)}{3x}\frac{2}{9}x\, dx
$$
which you can compute.


text:
Q: ARKit place node where finger press is I am working on an ios app with ARKit and I am wondering how to create a node exactly where I press my finger on the screen but approximately 0.5m into the screen. I know I will have to take into account the orientation of the device but I am still very confused on where to begin. Any help would be great! Thanks.

A: The solution is simple.
Add a your required node as a child node to the camera with position vector (0,0,1).
Now, save the world position of that node you created and immediately remove the child node from the camera.
Add your node again as the child of the rootNode with the saved world position.
override func touchesEnded(_ touches: Set<UITouch>, with event: UIEvent?) {

    let boxNode = SCNNode.init()
    let boxGeometry = SCNBox.init(width: 0.1, height: 0.1, length: 0.1, chamferRadius: 0)
    boxGeometry.materials.first?.diffuse.contents = UIColor.red
    boxNode.geometry = boxGeometry
    boxNode.position = SCNVector3.init(0, 0, -0.5)
    self.sceneView.pointOfView?.addChildNode(boxNode)

    let boxPosition = boxNode.worldPosition
    boxNode.removeFromParentNode()
    boxNode.worldPosition = boxPosition
    self.sceneView.scene.rootNode.addChildNode(boxNode)

}

Edit:
The solution will need a small modification.
To get the world position, create a planeNode before your camera (you may remove it when not required). And do a hitTestResult on the sceneView to fetch the worldPosition.
    let planeGeometry = SCNPlane.init(width: 10, height: 10)
    planeGeometry.materials.first?.transparency = 0
    planeNode.geometry = planeGeometry
    planeNode.position = SCNVector3.init(0, 0, -1)
    planeNode.name = "HitTestPlane"
    self.sceneView.pointOfView?.addChildNode(planeNode)

    override func touchesEnded(_ touches: Set<UITouch>, with event: UIEvent?) {

    let loc = touches.first?.location(in: self.sceneView)
    let hitTextResult = self.sceneView.hitTest(loc!, options: [:])

    for result in hitTextResult {
        if result.node.name == "HitTestPlane" {

            let hitPosition = SCNVector3.init(result.worldCoordinates.x, result.worldCoordinates.y, result.worldCoordinates.z)
            let boxNode = SCNNode.init()
            let boxGeometry = SCNBox.init(width: 0.1, height: 0.1, length: 0.1, chamferRadius: 0)
            boxGeometry.materials.first?.diffuse.contents = UIColor.red
            boxNode.geometry = boxGeometry

            boxNode.position = hitPosition
            self.sceneView.scene.rootNode.addChildNode(boxNode)

        }
    }

}

A: To start with some simple solution there is no need for ARKit:
var scnV : SCNView!
var scnN = SCNNode()
var depthForZ = 0.50

override func touchesMoved(_ touches: Set<UITouch>, with event: UIEvent?) {
    let touch01   = touches.first!
    let t_Point   = touch01.location(in: scnV)
    scnN.position = scnV.unprojectPoint(SCNVector3(x:Float(t_Point.x), y:Float(t_Point.y), z:depthForZ))
}

If ARKit is needed you can continue somewhere in your code with:
    var trans = matrix_identity_float4x4
    trans.columns.3.x = Float(t_Point.x)
    trans.columns.3.y = Float(t_Point.y)
    trans.columns.3.z = depthForZ
    let transForA = simd_mul(scN.transform, trans)

    let newA = ARAnchor(transform: transForA)
    scnV.session.add(anchor: newA)

Or instead update the transform of a SCNNode created by ARSession with the previous transForA structure
I hope that helps you to begin with a basic project


text:
Q: AVAudioPlayer.playing crash So I have this save button and if I press it the current viewController dismisses and any sound that is playing should stop.
But it crashes as soon as I press the save button. What is the mistake in my code?
@IBAction func save(sender: UIBarButtonItem) {

    audioStopPlaying()
    dismissViewControllerAnimated(true, completion: nil)
}

func audioStopPlaying() {
    if model.audioPlayer.playing.boolValue == true {
        model.audioPlayer.stop()

    }
}

Model:
class Model: NSObject {

    var audioPlayer: AVAudioPlayer = AVAudioPlayer()
}


text:
Q: How do I deal with controller resource in laravel I am using the resource tool for my controller and my route but the store method appears not to work. Could you highlight what I did wrong. Is the controller name needs to be the same as the model one? I am confuse
FarmController
<?php

namespace App\Http\Controllers;

use App\Animal;
use Auth;
use Illuminate\Http\Request;

class FarmController extends Controller
{
    /**
     * Display a listing of the resource.
     *
     * @return \Illuminate\Http\Response
     */

    public function __construct()
    {
        $this->middleware('auth');
    }

    public function index()
    {
        $animal = Animal::all();
        return view('farms.index', compact('animal'));
    }

    /**
     * Show the form for creating a new resource.
     *
     * @return \Illuminate\Http\Response
     */
    public function create()
    {
        $user = Auth::user();
        $animal = new Animal();
        return view('farms.create', compact('user', 'animal'));
    }

    /**
     * Store a newly created resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return \Illuminate\Http\Response
     */
    public function store()
    {
        Animal::create($this->validateRequest());

        return redirect('farms.show');
    }
    private function validateRequest()
    {
        return request()->validate([
            'dateOfBirth' => 'required|date',
            'placeOfBirth' => 'required',
            'gender' => 'required',
            'user_id' => 'required',
        ]);
    }

Animal.php (controller)
<?php

namespace App;

use Illuminate\Database\Eloquent\Model;

class Animal extends Model
{
    protected $guarded = [];
    public function user(){
        return $this->belongsTo(User::class);
    }}

animals (table)

<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateAnimalsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('animals', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->unsignedBigInteger('user_id')->index();
            $table->date('dateOfBirth');
            $table->string('gender');
            $table->string('placeOfBirth');
            $table->timestamps();

            $table->foreign('user_id')->references('id')->on('users');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('animals');
    }
}

create.blade.php
@extends('layouts.app')
@section('title', 'Add Animal')
@section('content')

Farm

Welcome {{ $user->name }} Please Add an animal

            <form action="{{ url('farms') }}" method="POST">

                    Date Of Birth:
                    <input type="date" name="dateOfBirth" class="form-control" placeholder="dd/mm/yyyy">

                    {{ $errors->first('dateOfBirth') }}

                    Place Of Birth
                    <input type="text" name="placeOfBirth" class="form-control">

                    {{ $errors->first('placeOfBirth') }}

                    Gender:
                    <select name="gender" class="form-control">
                        <option value="M">Male</option>
                        <option value="F">Female</option>
                    </select>

                    User
                    <select class="form-control" name="user">
                        <option value="{{ $user->id }}" name="user">{{ $user->name }}</option>
                    </select>

                <button type="submit" class="btn btn-primary">Add Farm</button>

                @csrf
            </form>

@endsection

web.php (routes)
<?php

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/

Route::get('/', function () {
    return view('welcome');
});

Auth::routes();

Route::middleware('admin')->group(function () {

    // All your admin routes go here.

    Route::resource('/admin', 'AdminController');
});

Route::middleware('farms')->group(function () {

    // All your admin routes go here.
    Route::resource('/farms', 'FarmController');
});

When I am submitting the form, it seems like it just refreshes the page and do not add anything in my table. I have been stuck on this in two entire days. any help is welcome

A: In the validateRequest function you have
'user_id' => 'required',

But your form in the view has no field named user_id
The select element is named user
<select class="form-control" name="user">
  <option value="{{ $user->id }}" name="user">{{ $user->name }}</option>
</select>

Change one of them so they can match, I guess that the page refresh is just failed validation
You may want to check for any validation error in your view to find out what's wrong as per the docs
For example
@if ($errors->any())

            @foreach ($errors->all() as $error)

{{ $error }}

            @endforeach

@endif

Hope this helps

A: Just change your form action then it hit in correct mehtod. Here is the action for your form
{{route('farms.store')}}


text:
Q: WebDriverWait not working as expected I am working with selenium to scrape some data.
There is button on the page that I am clicking say "custom_cols". This button opens up a window for me where I can select my columns.
This new window sometimes takes some time to open (around 5 seconds). So to handle this I have used
WebDriverWait

with delay as 20 seconds. But some times it fails to select find elements on new window, even if the element is visible. This happens only once in ten times for rest of time it works properly.
I have used same function(WebDriverWait) on other places also and it is works as expected. I mean it waits till the elements gets visible and then clicks it at the moment it finds it.
My question is why elements on new window is not visible even though I am waiting for element to get visible. To add here I have tried to increase delay time but still I get that error once in a while.
My code is here
def wait_for_elem_xpath(self, delay = None, xpath = ""):
    if delay is None:
        delay = self.delay

    try:
        myElem = WebDriverWait(self.browser, delay).until(EC.presence_of_element_located((By.XPATH , xpath)))
    except TimeoutException:
        print ("xpath: Loading took too much time!")
    return myElem
select_all_performance = '//*[@id="mks"]/body/div[7]/div[2]/div/div/div/div/div[2]/div/div[2]/div[2]/div/div[1]/div[1]/section/header/div'
self.wait_for_elem_xpath(xpath = select_all_performance).click()

A: Once you wait for the element and moving forward as you are trying to invoke click() method instead of using presence_of_element_located() method you need to use element_to_be_clickable() as follows :
try:
    myElem = WebDriverWait(self.browser, delay).until(EC.element_to_be_clickable((By.XPATH , xpath)))

Update
As per your counter question in the comments here are the details of the three methods :
presence_of_element_located
presence_of_element_located(locator) is defined as follows :
class selenium.webdriver.support.expected_conditions.presence_of_element_located(locator)

Parameter : locator - used to find the element returns the WebElement once it is located

Description : An expectation for checking that an element is present on the DOM of a page. This does not necessarily mean that the element is visible or interactable (i.e. clickable).

visibility_of_element_located
visibility_of_element_located(locator) is defined as follows :
class selenium.webdriver.support.expected_conditions.visibility_of_element_located(locator)

Parameter : locator -  used to find the element returns the WebElement once it is located and visible

Description : An expectation for checking that an element is present on the DOM of a page and visible. Visibility means that the element is not only displayed but also has a height and width that is greater than 0.

element_to_be_clickable
element_to_be_clickable(locator) is defined as follows :
class selenium.webdriver.support.expected_conditions.element_to_be_clickable(locator)

Parameter : locator - used to find the element returns the WebElement once it is visible, enabled and interactable (i.e. clickable).

Description : An Expectation for checking an element is visible, enabled and interactable such that you can click it.


text:
Q: Can someone please help me with these questions on DC Chopper Circuits? I had a quiz on power electronics and the following questions were asked:

Question 1: Consider the buck chopper in Figure 1, operating at 100 kHz frequency, with the switch duty ratio of 0.5 and input voltage of 100 V(DC). The load is resistive with R = 10 ohms, put across the filter capacitor. Load voltage is found to be nearly ripple free and inductor current is continuous. What should be the smallest value of inductor to keep peak value of the inductor current within 10% of its mean value?
Question 2: Consider the Boost chopper of Figure 2. With input voltage 10Volts and a fixed duty ratio of 0.8. The converter feeds a resistive load of 10 ohms and operates with continuous inductor current. Due to some fault, the load gets disconnected. What will be the resulting output voltage under the steady state? Why?
So, in the test, I was able to think and write only for the 2nd question:
My answer was: The output voltage across capacitor keeps on rising and rising since the diode will never be reverse biased thus the capacitor gets a continuous charge current from the inductor, which ultimately will lead to burning of the components of the whole setup.
As for the 1st question, I was just able to just find that the mean Inductor current will be 0.8 Amperes.
So, I was hoping if someone could help me with what might be the right answer for Question 1.
Also, did I write my 2nd answer right? What will be the correct answer?
Please, review and help.

A: I will try to answer question 1. In "continuous operation mode" (current in coil never falls to zero), the output voltage of a buck converter is Vout=D*Vin, where D=50% is the duty cycle and Vin=100V. So you know that Vout=50V and thus Iout=Vout/R=5A.
Next, remember the inductor equation V=L* dI/dt. V is Vin-Vout=50V. dt is the time the switch is on or off. dI is 0.2*Iout.
This equation can be formed to L=V*dt/dI, where V=50V, dt=1/(2*f)=5us and dI=0.2*Iout=1A.
So Lmin=250uH

A: For giggles another approach for continuous mode is using the frequency domain.
a) if ZL(f) fundamental is 9x the load then 1/(1+9) = 0.1 load current variation so From inductor impedance at 100kHz find X=90 Ohms or  L=90 /2pi100kHz =1.4mH , close but not quite.
so Fourier harmonics must be considered in X(f) to get 1mH. Like fundamental is 24% higher than Vp dc and so on,
so time domain analysis of LdI/dt is the way to go.

A: If the converter is continuous, then the duty cycle defines the output voltage hence, with Vin = 100 volts and D = 50%, the output voltage is 50 volts and this is a power of 250 watts in the 10 ohm load.
With a buck converter, output energy is naturally transferred during the inductor charge cycle and this means that the energy storage requirement of the inductor only needs to service the second half of the switching cycle.
Given that 250 watts requires 2.5 mJ to be transferred at a switching frequency of 100 kHz every cycle, the energy storage in the inductor need only be 1.25 mJ when D = 50%.
The formula for energy transfer via an inductor operating in CCM is: -
$$W = 2\cdot L\cdot I_A\cdot I_P$$
Where: -

*

*\$I_A\$ is the inductor average current (5 amps) and,

*\$I_P\$ is the peak above or below that average current (0.5 amps)

Rearranging to solve for L, gives a value of 250 uH


text:
Q: Android activity is not created properly with Constraint Layout I created a activity layout xml file with ConstraintLayout.  It had a nice look and feel when it was designing. But when I run that on a device it missed its structure as like as in design phase.
This is my xml layout file,
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#DCDCDC"
tools:context=".ui.AdMenuActivity">

<View
    android:id="@+id/bg_gradient"
    android:layout_width="match_parent"
    android:layout_height="@dimen/_225sdp"
    android:layout_alignParentBottom="true"
    android:layout_alignParentLeft="true"
    android:layout_alignParentRight="true"
    android:layout_alignParentTop="true"
    android:background="@drawable/ic_bg_gradient_next"
    tools:layout_editor_absoluteX="0dp"
    tools:layout_editor_absoluteY="0dp" />

<ImageView
    android:layout_width="@dimen/_50sdp"
    android:layout_height="50dp"
    android:src="@mipmap/image_ssb_main"
    tools:layout_editor_absoluteX="@dimen/_23sdp"
    tools:layout_editor_absoluteY="@dimen/_15sdp"
    android:layout_marginTop="@dimen/_10sdp" />

<TextView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="Login"
    android:textColor="@color/white"
    android:textSize="@dimen/_24sdp"
    tools:layout_editor_absoluteX="@dimen/_23sdp"
    tools:layout_editor_absoluteY="@dimen/_55sdp"
    android:textStyle="bold" />

<TextView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="Login to your account"
    android:textColor="@color/white"
    android:textSize="@dimen/_12sdp"
    tools:layout_editor_absoluteX="@dimen/_23sdp"
    tools:layout_editor_absoluteY="@dimen/_90sdp" />

<LinearLayout
    android:layout_width="@dimen/_280sdp"
    android:layout_height="340dp"
    android:background="@color/white"
    android:orientation="vertical"
    tools:layout_editor_absoluteX="@dimen/_23sdp"
    tools:layout_editor_absoluteY="@dimen/_120sdp">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_margin="@dimen/_4sdp"
        android:orientation="vertical">

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginLeft="@dimen/_8sdp"
            android:layout_marginRight="@dimen/_8sdp"
            android:layout_marginTop="@dimen/_10sdp"
            android:text="Email"
            android:textColor="@color/black"
            android:textSize="@dimen/_14sdp" />

        <EditText
            style="@style/editText"
            android:layout_width="match_parent"
            android:layout_height="@dimen/_25sdp"
            android:layout_gravity="center"
            android:layout_margin="@dimen/_8sdp"
            android:background="@drawable/edit_text_background"
            android:hint="Your Email"
            android:inputType="textEmailAddress"
            android:maxLines="1"
            android:paddingLeft="@dimen/_8sdp"
            android:singleLine="true"
            android:textAppearance="@style/editText"
            android:textColor="#2C2C2C"
            android:textSize="@dimen/_14sdp" />

    </LinearLayout>

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_margin="@dimen/_4sdp"
        android:orientation="vertical">

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginLeft="@dimen/_8sdp"
            android:layout_marginRight="@dimen/_8sdp"
            android:layout_marginTop="@dimen/_10sdp"
            android:text="Password"
            android:textColor="@color/black"
            android:textSize="@dimen/_14sdp" />

        <EditText
            style="@style/editText"
            android:layout_width="match_parent"
            android:layout_height="@dimen/_25sdp"
            android:layout_gravity="center"
            android:layout_margin="@dimen/_8sdp"
            android:background="@drawable/edit_text_background"
            android:hint="Your Password"
            android:inputType="textEmailAddress"
            android:maxLines="1"
            android:paddingLeft="@dimen/_8sdp"
            android:singleLine="true"
            android:textAppearance="@style/editText"
            android:textColor="#2C2C2C"
            android:textSize="@dimen/_14sdp" />

    </LinearLayout>

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_margin="@dimen/_4sdp"
        android:orientation="vertical">

        <Button
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_marginLeft="@dimen/_8sdp"
            android:layout_marginRight="@dimen/_8sdp"
            android:layout_marginTop="@dimen/_10sdp"
            android:background="#009688"
            android:text="Login"
            android:textAllCaps="false"
            android:textColor="@color/white"
            android:textSize="@dimen/_14sdp" />

        <Button
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_marginLeft="@dimen/_8sdp"
            android:layout_marginRight="@dimen/_8sdp"
            android:layout_marginTop="@dimen/_10sdp"
            android:background="@color/white_greyish"
            android:text="Sign up"
            android:textAllCaps="false"
            android:textColor="@color/black"
            android:textSize="@dimen/_14sdp" />

    </LinearLayout>

</LinearLayout>

And this are images of its designing phase and running phase,
Designing phase

Running Phase

Is there any way to design this layout as like as in design phase ?

A: You have not used constraints properly in your layout.

*

*The closing tag is missing add

</android.support.constraint.ConstraintLayout>

at the end of your layout

*What Wesely has said is absolutely correct avoid using

tools:layout_editor_absoluteY

app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent

it is good to use constraints like this will place the view in the center of the screen

*You need to constraint
i) View
ii)ImageView
iii)TextView where you have written Login and Login to your account
iv) Linear Layout
Hope this will help you
Happy coding!

A: Although below answer is not the solution for your problem but you can try it without constraintlayout because constraintlayout is used for making complex layouts and the design you want to achieve can be achieved using linearlayout easily.
<?xml version="1.0" encoding="utf-8"?>

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@drawable/ic_bg_gradient_next"
    android:orientation="vertical">

    <ImageView
        android:layout_width="wrap_content"
        android:layout_height="50dp"
        android:src="@mipmap/image_ssb_main" />

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Login"
        android:textColor="@color/white"
        android:textSize="@dimen/_24sdp"
        android:textStyle="bold" />

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Login to your account"
        android:textColor="@color/white"
        android:textSize="@dimen/_12sdp" />

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="@color/white"
        android:orientation="vertical">

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical">

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginLeft="@dimen/_8sdp"
                android:layout_marginTop="@dimen/_10sdp"
                android:layout_marginRight="@dimen/_8sdp"
                android:text="Email"
                android:textColor="@color/black"
                android:textSize="@dimen/_14sdp" />

            <EditText
                style="@style/editText"
                android:layout_width="match_parent"
                android:layout_height="@dimen/_25sdp"
                android:layout_gravity="center"
                android:layout_margin="@dimen/_8sdp"
                android:background="@drawable/edit_text_background"
                android:hint="Your Email"
                android:inputType="textEmailAddress"
                android:maxLines="1"
                android:paddingLeft="@dimen/_8sdp"
                android:singleLine="true"
                android:textAppearance="@style/editText"
                android:textColor="#2C2C2C"
                android:textSize="@dimen/_14sdp" />

        </LinearLayout>

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_margin="@dimen/_4sdp"
            android:orientation="vertical">

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginTop="@dimen/_10sdp"
                android:text="Password"
                android:textColor="@color/black"
                android:textSize="@dimen/_14sdp" />

            <EditText
                style="@style/editText"
                android:layout_width="match_parent"
                android:layout_height="@dimen/_25sdp"
                android:layout_gravity="center"
                android:layout_margin="@dimen/_8sdp"
                android:background="@drawable/edit_text_background"
                android:hint="Your Password"
                android:inputType="textEmailAddress"
                android:maxLines="1"
                android:singleLine="true"
                android:textAppearance="@style/editText"
                android:textColor="#2C2C2C"
                android:textSize="@dimen/_14sdp" />

        </LinearLayout>

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_margin="@dimen/_4sdp"
            android:orientation="vertical">

            <Button
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:background="#009688"
                android:text="Login"
                android:textAllCaps="false"
                android:textColor="@color/white"
                android:textSize="@dimen/_14sdp" />

            <Button
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:layout_marginTop="@dimen/_10sdp"
                android:background="@color/white_greyish"
                android:text="Sign up"
                android:textAllCaps="false"
                android:textColor="@color/black"
                android:textSize="@dimen/_14sdp" />

        </LinearLayout>

    </LinearLayout>

A: You can use AndroidStudio to help you to set those constraint.
And you must avoid use absolute margin like tools:layout_editor_absoluteX
Use these kinds of constraint instead.
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="@+id/someView"
app:layout_constraintStart_toStartOf="parent"

for example, if you want to set a View in the horizontal center, and align top of parent:
android:layout_margin="16dp"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"

The tip is to set a View constraint to another views. Not all views are constraint with their parent.

A: As I noticed, your top layout is Constraint layout and you are closing it with </LinearLayout> tag(Last line in xml)
And in constraint layout, each child must have at least one horizontal constraint and one vertical constraint. Otherwise children will not place properly in the parent.
Your layout can be replaced with the following. Give proper id to each child
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#DCDCDC"
tools:context=".ui.AdMenuActivity">

<View
    android:id="@+id/bg_gradient"
    android:layout_width="match_parent"
    android:layout_height="@dimen/_225sdp"
    android:layout_alignParentBottom="true"
    android:layout_alignParentLeft="true"
    android:layout_alignParentRight="true"
    android:layout_alignParentTop="true"
    android:background="@drawable/ic_bg_gradient_next"
    tools:layout_editor_absoluteX="0dp"
    app:layout_constraintStart_toStartOf="parent"
    app:layout_constraintTop_toTopOf="parent"
    tools:layout_editor_absoluteY="0dp" />

<ImageView
    android:layout_width="@dimen/_50sdp"
    android:layout_height="50dp"
    android:id="@+id/imgView"
    android:src="@mipmap/image_ssb_main"
    tools:layout_editor_absoluteX="@dimen/_23sdp"
    tools:layout_editor_absoluteY="@dimen/_15sdp"
    app:layout_constraintStart_toStartOf="parent"
    app:layout_constraintTop_toBottomOf="@id/bg_gradient"
    android:layout_marginTop="@dimen/_10sdp" />

<TextView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="Login"
    app:layout_constraintStart_toStartOf="parent"
    app:layout_constraintTop_toBottomOf="@id/imgView"
    android:textColor="@color/white"
    android:textSize="@dimen/_24sdp"
    tools:layout_editor_absoluteX="@dimen/_23sdp"
    tools:layout_editor_absoluteY="@dimen/_55sdp"
    android:textStyle="bold" />

<TextView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="Login to your account"
    android:textColor="@color/white"
    android:textSize="@dimen/_12sdp"
    app:layout_constraintStart_toStartOf="parent"
    app:layout_constraintTop_toBottomOf="@id/textView1"
    tools:layout_editor_absoluteX="@dimen/_23sdp"
    tools:layout_editor_absoluteY="@dimen/_90sdp" />

<LinearLayout
    android:layout_width="@dimen/_280sdp"
    android:layout_height="340dp"
    android:background="@color/white"
    android:orientation="vertical"
    app:layout_constraintStart_toStartOf="parent"
    app:layout_constraintTop_toBottomOf="@id/textView2"
    tools:layout_editor_absoluteX="@dimen/_23sdp"
    tools:layout_editor_absoluteY="@dimen/_120sdp">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_margin="@dimen/_4sdp"
        android:orientation="vertical">

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginLeft="@dimen/_8sdp"
            android:layout_marginRight="@dimen/_8sdp"
            android:layout_marginTop="@dimen/_10sdp"
            android:text="Email"
            android:textColor="@color/black"
            android:textSize="@dimen/_14sdp" />

        <EditText
            style="@style/editText"
            android:layout_width="match_parent"
            android:layout_height="@dimen/_25sdp"
            android:layout_gravity="center"
            android:layout_margin="@dimen/_8sdp"
            android:background="@drawable/edit_text_background"
            android:hint="Your Email"
            android:inputType="textEmailAddress"
            android:maxLines="1"
            android:paddingLeft="@dimen/_8sdp"
            android:singleLine="true"
            android:textAppearance="@style/editText"
            android:textColor="#2C2C2C"
            android:textSize="@dimen/_14sdp" />

    </LinearLayout>

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_margin="@dimen/_4sdp"
        app:layout_constraintStart_toStartOf="parent"
    app:layout_constraintTop_toBottomOf="@id/linearLt1"
        android:orientation="vertical">

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginLeft="@dimen/_8sdp"
            android:layout_marginRight="@dimen/_8sdp"
            android:layout_marginTop="@dimen/_10sdp"
            android:text="Password"
            android:textColor="@color/black"
            android:textSize="@dimen/_14sdp" />

        <EditText
            style="@style/editText"
            android:layout_width="match_parent"
            android:layout_height="@dimen/_25sdp"
            android:layout_gravity="center"
            android:layout_margin="@dimen/_8sdp"
            android:background="@drawable/edit_text_background"
            android:hint="Your Password"
            android:inputType="textEmailAddress"
            android:maxLines="1"
            android:paddingLeft="@dimen/_8sdp"
            android:singleLine="true"
            android:textAppearance="@style/editText"
            android:textColor="#2C2C2C"
            android:textSize="@dimen/_14sdp" />

    </LinearLayout>

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_margin="@dimen/_4sdp"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@id/linearLt2"
        android:orientation="vertical">

        <Button
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_marginLeft="@dimen/_8sdp"
            android:layout_marginRight="@dimen/_8sdp"
            android:layout_marginTop="@dimen/_10sdp"
            android:background="#009688"
            android:text="Login"
            android:textAllCaps="false"
            android:textColor="@color/white"
            android:textSize="@dimen/_14sdp" />

        <Button
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_marginLeft="@dimen/_8sdp"
            android:layout_marginRight="@dimen/_8sdp"
            android:layout_marginTop="@dimen/_10sdp"
            android:background="@color/white_greyish"
            android:text="Sign up"
            android:textAllCaps="false"
            android:textColor="@color/black"
            android:textSize="@dimen/_14sdp" />

    </LinearLayout>

</ConstraintLayout>


text:
Q: Javascript macOS Error: Named parameters must be passed as an object I'm trying to implement automation for the task manager Things 3 on macOS using JXA (Javascript for macOS automation) and I'm running it to a strange error. I have spent countless hours trying to fix this myself and with the help of others. I am trying to use the following method described in the documentation:

As following:
// Set TaskApp as the app to use
var TaskApp = Application('Things3');

// Get the ToDo from toDos
var task = TaskApp.toDos["test555342343"]

// Get today as a date
var today = new Date()

// Schedule the task for Today
task.schedule(task.id(), {for: today})

This returns the error:
Error: Error: Named parameters must be passed as an object.
When using another method (like show) the specefier works as expected:

Example:
// Set TaskApp as the app to use
var TaskApp = Application('Things3');

// Get the ToDo from toDos
var task = TaskApp.toDos["test555342343"]

// Bring Things3 to the Forground
TaskApp.activate()

// Show the task
task.show(task.id())

Will show the selected todo. Creating a task with with a deadline set to the date object also produces the correct result (a task with the deadline of date).
This documentation can only be found when you have things3 installed on macOS and you reference the Script Library. I have added the documentation as PDF. The described error also apply's to the move method. Instead of parsing a date you parse a List Object to it which will resolve in the same error.
Link to documentation PDF → Link

A: The Things documentation is wrong: schedule is a method of Application, not of ToDo, which is why it asks for a todo specifier (it wouldn't need that one if it was a property of a ToDo object already). The working code hence is:
// Set TaskApp as the app to use
var TaskApp = Application('Things3')

// Get the ToDo from toDos
var task = TaskApp.toDos["test555342343"]

// Get today as a date
var today = new Date()

// Schedule the task for Today
TaskApp.schedule(task, {for: today})

Note that task already is a ToDo specifier; you don't need the detour through task.id(), which converts the ToDo specifier into an ID String before letting the schedule method cast that back to a specifier.


text:
Q: Закрывается AlertDialog Есть AlertDialog, в котором два EditText, куда вводятся данные, при этом нужно, чтобы AlertDialog не закрывался после того как данные не подходят, или не введены, а он закрывается.
fab.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            AlertDialog.Builder builder = new AlertDialog.Builder(MainActivity.this);
            ViewGroup viewGroupFab = findViewById(R.id.layoutParent);
            final View view = getLayoutInflater().inflate(R.layout.create, viewGroupFab);

            final EditText subject = view.findViewById(R.id.edit_subject);
            final EditText text = view.findViewById(R.id.edit_text);

            builder.setView(view);

            builder.setTitle(note_new);
            builder.setPositiveButton(add, new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int which) {

                    String strSub = removeSeparator(subject);
                    String strText = removeSeparator(text);

                    if (checked(strSub) && checked(strText)){
                        writable(strSub, strText);
                        prepareData();
                    } else
                        message(error);
                }
            });

            builder.setNegativeButton(cancel, new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int which) {
                    dialog.dismiss();
                }
            });

            builder.show();
        }
    });

A: В AlertDialog нажатия на кнопку всегда приводят к закрытию диалога! Для решения Вашей проблемы - Вам следует обратить внимание на DialogFragment.
https://developer.android.com/reference/android/app/DialogFragment.html
В нём Вы сможете реализовать проверку + как бонус при повороте экрана диалог никуда не пропадёт.

A: Нашел решение, вот это:
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
builder.setMessage("Test for preventing dialog close");
builder.setPositiveButton("Test",
    new DialogInterface.OnClickListener()
    {
        @Override
        public void onClick(DialogInterface dialog, int which)
        {
            //Do nothing here because we override this button later to change the close behaviour.
            //However, we still need this because on older versions of Android unless we
            //pass a handler the button doesn't get instantiated
        }
    });
final AlertDialog dialog = builder.create();
dialog.show();
//Overriding the handler immediately after show is probably a better approach than OnShowListener as described below
dialog.getButton(AlertDialog.BUTTON_POSITIVE).setOnClickListener(new    View.OnClickListener()
  {
      @Override
      public void onClick(View v)
      {
          Boolean wantToCloseDialog = false;
          //Do stuff, possibly set wantToCloseDialog to true then...
          if(wantToCloseDialog)
              dialog.dismiss();
          //else dialog stays open. Make sure you have an obvious way to close the dialog especially if you set cancellable to false.
      }
  });


text:
Q: How to pass in a list of class with FastAPI? I want to pass in a list of the class declared in the FastAPI service, something like :
@router.post("/predict")
async def predict(json_list: List[my_class])-> dict:

And I got exception: 'my_class' object is not subscriptable
What is the correct way to pass in a list of class with FastAPI?
TIA!


text:
Q: pip: These packages do mot match the hashes from the requirements file When I tried to install libraries using pip install, sometimes this error message come up.
ERROR: THESE PACKAGES DO NOT MATCH THE HASHES FROM THE REQUIREMENTS FILE. If you have updated the package versions, please update the hashes. Otherwise, examine the package contents carefully; someone may have tampered with them.

This error comes up when I am trying to build multiple images using docker-compose V2.
What I have done:

*

*pip install --no-cache-dir -r requirements.txt

*upgrading pip

*trying the old version of pip (20.0.2).

*change the version of the affected package.

*changing the dns

However, it still comes up randomly. The libraries that are referred to the error message also keep changing.
Does anyone know the reason for this issue?

A: I got the problem when installing open3d.
the --no-cache-dir method won't work.
I just used wget to download the .whl file and install it from localhost.
It's a ugly method, but really works. What you need to do is check whether the package works.

A: So I had the same issue, tried deleting the pip cache file and using the "--no-cache-dir" argument. None of those worked.
I then came across a post that said they were experiencing this error because of a networking issue. So I switched off my VPN and everything worked perfectly!
Not sure why this works, but it got the job done

A: This is pips integrated checking mechanism that is automatically checking the integrity of the downloaded package.
You can check yourself (by clicking view in the has column) that the sha256 of the whl file loaded from pypi should be
for example this:
7a2c93be4f874fd42541a1330218d2094015993420bf0bd8fbf19c88e6b49c6a

but for example your error says that you got this:
g4dd3fb13afd095a21c7dfd0d2f9bd0a3593c3c78e81ca2f475429490752e7b8

So pip is (for security reasons) not installing the package for you. I would suggest to:

*

*Check if pip is taking the whl from some tmp directory on your system with an incorrectly downloaded whl file sitting there - If so, try deleting it

*Check if you can install other packages without issues

*Try to manually download the whl file and then check the output of pip hash <whl file> (if it matches the g4dd3fb13af... sha) and if you can do pip install <whl file>
And besides, there was a similar problem for me, I tried it and it worked:
sudo pip install --no-cache-dir `YOUR_PACKAGE_NAME`

A: If --no-cache-dir is not working for your, perhaps, you cache directory has cached packages from different requirements files. So you might want to try to delete those:
rm ~/.cache/pip -rf (or just specify your env .cache directory).

A: I solved the issue by deleting the __pycache__ folder.

A: Sometimes it depends on the required packages/libraries for the package you are trying to install. For example I tried to install jupyterlab on a windows 11 machine using pip and I got the same error. The problem were two packages "babel" and "debugpy", which I installed seperately using pip and then it worked.
The error happens probably because Python's setup was run as administrator on a local machine (I am not sure about this).
I hope my answer helps.

A: I had the same problem and it worked for me:
python -m pip install --trusted-host pypi.python.org --trusted-host files.pythonhosted.org --trusted-host pypi.org --trusted-host files.pythonhosted.org pip YOUR-PACKAGE

If it doesn't work, try to get the site shown in the error and add before
"YOUR-PACKAGE" -> " --trusted-host YOUR-ERROR-SITE"

In the image above the website presented to me was
files.pythohosted.org
I just added
--trusted-host files.pythohosted.org
If still not successful, try deleting all files in site-packages/_pyinstaller_hooks_contrib
and site-packages/Pyinstaller/hooks
Check if there are any files with the name of the package to be installed inside the site-packages folder and delete them
and try install again


text:
Q: Why do these URLs without a TLD resolve to a webpage? I noticed that the URL ga resolves to a website, but without a TLD like .com, .org, etc. I wrote a script to test all the two-letter URLs:
#!/bin/bash
for a in {a..z}
do
    for b in {a..z}
    do
        curl "$a$b" -s -m 10 >> foo.txt
        if [ -s foo.txt ]
        then
            cp foo.txt "$a$b.txt"
            rm foo.txt
            echo "$a$b"
        fi
    done
done

which prints
ai
dk
pn
to
uz

The script isn't perfect (it doesn't recognize ga, for instance), but it shows that there are several more of these URLs. I did notice that these URLs are all TLDs in their own right-- ai is Anguilla, dk is Denmark, etc. Why are these URLs "valid" in the sense that they resolve to an IP address, and why do they exist?
(I'd make these into clickable links, but funnily enough, the SO formatter won't accept them as valid.)

A: They don't have a TLD, they are TLDs.
If you control a top-level domain, you can add DNS resource records for the TLD itself as well as any of its subdomains (which would be second-level domains, or typically called domains), and of the subdomains of the second-level domains (i.e., third-level domains), and so on.
While it's not so common, some TLD owners make the TLD resolvable (e.g. the to TLD: http://to/ or, if your browser {or Stack Overflow's editor ;)} has problems with it, as FQDN: http://to./).
Related question on Server Fault: How the heck is http://to./ a valid domain name?

A: I think just like a subdomain (i.e. subdomain.domain.com) is not strictly required to make the URL resolvable, the domain itself isn't required either, as it is just a subdomain of a TLD. It's just that actually registering a TLD with an IP directly isn't a common practice.


text:
Q: How can I construct 2 columns from the same data and compute ratio? I have a database with many tables and I would like to create two columns from the same data with different filtering for each. Specifically, I have the following SQL query:
select count(*), A.Column1
    from Table1 as A
    join Table2 as B
    on A.Column2 = B.Column2
    where B.Column3 in (
            select C.Column3
            from Table3 as C
            where (C.Column4=9 or C.Column4=4))
    group by A.Column1

This creates a table with 2 columns. I would like a 3rd column (another count(*)) which only differs in that there will be a 3rd qualifier in the where clause. I would also like to create a column which computes the ratio of these 2 count columns.
Can this be done in SQL or must I get the data into R or Python and do the calculations there?

A: Change the case when to match the criteria on your second filter.
select count(case when C.Column4 = 9 or C.Column4 = 4 then 1 else null end) as Count1
, count(case when C.Column4 = 9 or C.Column4 = 22 then 1 else null end) as Count2
, A.Column1
    from Table1 as A
    join Table2 as B
    on A.Column2 = B.Column2
    where B.Column3 in (
            select C.Column3
            from Table3 as C
    group by A.Column1

A: If you want a ratio of the two columns, then divide:
select count(*), A.Column1,
       avg(case when ? then 1.0 else 0 end) as ratio
from Table1 A join
     Table2 B
     on A.Column2 = B.Column2
where B.Column3 in (select C.Column3
                    from Table3 C
                    where (C.Column4 in (4, 9)
                   )
group by A.Column1;

The ? is for the condition that you care about.


text:
Q: Python dicts in a list, show highest score groupped by dictkey I'm struggling to get the result from the following code:
list_result = [{'name':'John', 'score':5}, {'name':'John', 'score':6}, {'name':'James', 'score':7}, {'name':'James', 'score':8}]

My expected result is to group them by highest score (to show highest score per user), how do I do that?
Expected Result:
[{'name': 'John', 'score': 6}, {'name': 'James', 'score': 8}]

A: Here's a way to do it with an ordered dictionary, without pandas:
list_result = [{'name':'John', 'score':5}, {'name':'John', 'score':6}, {'name':'James', 'score':7}, {'name':'James', 'score':8}]

ord_dict = collections.OrderedDict()
for i in sorted(list_result, key=lambda x: x["score"]):
    ord_dict[i["name"]] = i["score"]

print([{"name":k, "score":v} for k,v in ord_dict.items()])

The output is:
[{'name': 'John', 'score': 6}, {'name': 'James', 'score': 8}]

A: You can use pandas.DataFrame and its groupby() method like this:
>>> import pandas as pd
>>> df = pd.DataFrame(list_result)
>>> df.groupby('name').score.max().reset_index().to_dict(orient='records')
[{'name': 'James', 'score': 8}, {'name': 'John', 'score': 6}]

A: import collections
import math

list_result = [
    {'name':'John', 'score': 5},
    {'name':'John', 'score': 6},
    {'name':'James', 'score': 7},
    {'name':'James', 'score': 8}
]

max_score_by_user = collections.defaultdict(lambda: -math.inf)
for result in list_result:
    name, score = result['name'], result['score']
    max_score_by_user[name] = max(max_score_by_user[name], score)

print(*max_score_by_user.items(), sep='\n')

Which prints:
('John', 6)
('James', 8)

A: You can try:
list_result = [{'name':'John', 'score':5}, {'name':'John', 'score':6}, {'name':'James', 'score':7}, {'name':'James', 'score':8}]
output_dict = {}

for result in list_result:
    if result["name"] in output_dict:
        if result["score"] > output_dict[result["name"]]:
            output_dict[result["name"]] = result["score"]
    else:
        output_dict[result["name"]] = result["score"]

output_list = []

for output_key, output_val in output_dict.items():
    output_list.append({"name": output_key, "score": output_val})

print(output_list)

Output:
[{'name': 'John', 'score': 6}, {'name': 'James', 'score': 8}]

A: my_dict = {'x':500, 'y':5874, 'z': 560}

key_max = max(my_dict.keys(), key=(lambda k: my_dict[k]))
key_min = min(my_dict.keys(), key=(lambda k: my_dict[k]))

print('Maximum Value: ',my_dict[key_max])
print('Minimum Value: ',my_dict[key_min])

Copy
Sample Output:
Maximum Value:  5874
Minimum Value:  500


text:
Q: How to generate compressed public key in bitcoin format, using openssl and the command line? I am using this line
openssl ecparam -genkey -name secp256k1 | openssl ec -pubout -outform DER | tail -c 65 | xxd -p -c 65

which produces an uncompressed bitcoin public key, for instance:
049ddf875b4a6e57d31004926bd8331271b4b45731be5c17ea841c89353cbd13adc9cc2347ae1bcb4ed369fd6bfc44040ffda9f8e68f86a6593c94261fc42eca35

The prefix 04 indices that this public key contains both the x and y coordinates of the point on the EC. What is the correct way to create the compressed version of this key?
How do I produce a compression version of a private key?

A: Solution moved from @Anon21's question post.

found the answer:
openssl ecparam -genkey -name secp256k1 | openssl ec -pubout -conv_form compressed -outform DER | tail -c 33 | xxd -p -c 65


text:
Q: Horizontal line inline-block IE7 I would like to put 3 horizontal line in a row.
Does anyone know how to put an horizontal line displaying in inline-block in IE7 ?
Here is my CSS:
hr.small {
    width: 28.9%;
    margin-right: 6px;
    display: inline-block;
    vertical-align: top;
    zoom: 1;
    *display: inline;
    height: 3px;
    border: 0px;
    color: #7c8690;
    background-color: #7c8690;
}

but it doesnt works.
here is the JSFiddle Link: http://jsfiddle.net/sRuz3/6/
If anyone has a solution.
Thanks a lot.

A: Here you go: http://jsfiddle.net/eq3Z2/
It works in IE7 also.
Granted, they aren't HRs. They are DIVs. Trying to render the HR as an inline element
is tripping up IE7 but I don't know of a workaround.

A: Does it have to be inline-block? Can you not simply float them and set a height if necessary?
Edit - Example:
hr.small {

    float:left;
    width: 28.9%;
    margin-right: 6px; /* Choice: Use border instead or halve the margin for IE7 and lowwer (double margin float bug). */
    height: 3px;
    background-color: #7c8690;

}

Edit again - Question:
Is this going in a fluid layout and how big is the container? You are setting a dynamic width but a fixed margin, this will cause issues in small scale and introduce unwanted white space to the far right in large scale. If it is a fixed area then consider using a fixed width.

A: It seems there's a solution if you can wrap the hrs in divs.
Set the div's to display:inline (we could use spans instead but hrs are not valid in spans)¹ and also give the divs hasLayout via zoom:1
See http://jsfiddle.net/YqKDJ/1/

¹ As an aside, there's a reason why hrs are not valid in spans and it's relevant here. An hr is not primarily a way of drawing a horizontal line - it has a specific semantic meaning of "Thematic break". It makes no sense to have two or more hr elements with no content betwwen them - there's nothing for the second thematic break to break from. If you want multiple horizontal lines for presentational purposes, you should use CSS to create them, along the lines of @Cynthia's answer.


text:
Q: JavaScript Menu (Close when link clicked again) I have built a custom JS menu on my website http://mytempsite.net/t1payments
When clicked it slides down another nested UL. The orignal problem after making it was that when you clicked within the boxes the dropdown would slide backup and thats not good when one is a form. So I added to my JS and was able to make it to where that would not happen, but now I am unable to figure out how to get it to go back up when you click on the link again. Right now it goes back up if another link is clicked, but 1 will always stay down until you leave the site after the first click.
I would like some assistance making my javascript code work properly so that when the click with in the dropdown box it does not close, but if a dropdown is active and they click anywhere in the body then it closes, or if they click on the link again.
MY JS CODE

MENU HTML

     GET HELP

    <?php echo do_shortcode('[contact-form-7 id="42" title="Contact form 1"]'); ?>

      CONTACT

    Sales / Info Contact Information

         Phone # 877-240-9959

         Fax # 866-571-1690

         Email : Info@T1Payments.com

        Tech / Billing Contact Information

         Phone # 877-245-1484

         Fax # 866-245-6067

         Email : Merchant@T1Payments.com

    LOCATIONS

    Corporate Headquarters:

         410 South Rampart, Suite #390

         Las Vegas, Nevada, 89145

         (Under Construction / May, 2013)

        Sales / Support Centers:

         Nevada:

         3960 Howard Hughes Pkwy  Suite #500

         Las Vegas, NV , 89169

         California:

         9465 Wilshire Blvd Suite #300

         Beverly Hills , California , 90212

         (Under Construction / June, 2013)

         Illinois:

         180 North Stetson Street Suite #3500

         Chicago, Illinois , 60601

         (Under Construction / June, 2013)

         Florida:

         Miami (August 2013)

A: Is this what you mean?
All that I added was $(".dropdown-active ul").slideUp();
I also changed your hrefs to # in the HTML
HTML:

 GET HELP

                <?php echo do_shortcode( '[contact-form-7 id="42" title="Contact form 1"]'); ?>

 CONTACT

 Sales / Info Contact Information

Phone # 877-240-9959

Fax # 866-571-1690

Email : Info@T1Payments.com

 Tech / Billing Contact Information

Phone # 877-245-1484

Fax # 866-245-6067

Email : Merchant@T1Payments.com

 LOCATIONS

 Corporate Headquarters:

410 South Rampart, Suite #390

Las Vegas, Nevada, 89145

(Under Construction / May, 2013)

 Sales / Support Centers:

Nevada:

3960 Howard Hughes Pkwy Suite #500

Las Vegas, NV , 89169

California:

9465 Wilshire Blvd Suite #300

Beverly Hills , California , 90212

(Under Construction / June, 2013)

Illinois:

180 North Stetson Street Suite #3500

Chicago, Illinois , 60601

(Under Construction / June, 2013)

Florida:

Miami (August 2013)

JavaScript
$(function () {
    $(".dropdown, .dropdown2").click(function () {
        if ($(this).hasClass("dropdown-active")) {
            $("nav").click(function (e) {
                if (e.target.id == "wpcf7-f42-t1-o1" || $(e.target).parents("#wpcf7-f42-t1-o1").size()) {
                } else {
                    $(".dropdown-active ul").slideUp();
                    $(".dropdown-active").removeClass("dropdown-active");
                }
            });
        } else {
            $(".dropdown-active ul").slideUp();
            $(".dropdown-active").removeClass("dropdown-active");
            $(this).addClass("dropdown-active")
                .find("ul").slideDown();
        }
    });
});

On jsfiddle

A: You can bind a click handler (toggle the dropdown box)to the link itself, and bind another click handler to the dropdown box(make event stop propagation and return false).

A: you should probably use toggle function for clicking again on the menu
    $('#click').click(function() {
        $('#box').toggle('slow', function() {
        // Animation complete.
        });
     });

and hide it on mouseover/click event on the rest of the document, or some part of it

A: JSfiddle http://jsfiddle.net/4VS7p/29/
Live http://mytempsite.net/t1payments/
JavaScript
    var
    hideMenu = function(){
        $(".dropdown-active ul").slideUp();
        $(".dropdown-active").removeClass("dropdown-active");
    },
    showMenu = function(){
        $(".dropdown-active ul").slideUp();
        $(".dropdown-active").removeClass("dropdown-active");
        $(this).addClass("dropdown-active").find("ul").slideDown();
    };

    $("#website-header-wrapper").click(function (e) {
        hideMenu();
    });

    // PREVENT ANKER TO ACT ON CLICK (shorthand method)
    // BETTER THAN THE OLD "javascript:void(0);"
    $(".dropdown2 + A").click(false);

    // DON'T CLOSE THE OPEN MENU
    // WHEN WE CLICK INSIDE
    $(".dropdown2 UL").click(false);

    $(".dropdown2").click(function () {
        if ($(this).hasClass("dropdown-active")) {
            // IT'S THE ACTIVE MENU ITEM
            // SO WE HIDE IT
            hideMenu();
        } else {
            // OTHERWISE WE TOGGLE THE
            // CURRENT STATE
            // NOTE showMenu was called in context of this
            showMenu.call(this);
        }
        return false;
    });

HTML

  GET HELP

            <?php echo do_shortcode( '[contact-form-7 id="42" title="Contact form 1"]'); ?>

  CONTACT

            Sales / Info Contact Information

Phone # 877-240-9959

Fax # 866-571-1690

Email : Info@T1Payments.com

            Tech / Billing Contact Information

Phone # 877-245-1484

Fax # 866-245-6067

Email : Merchant@T1Payments.com

  LOCATIONS

   Corporate Headquarters:

410 South Rampart, Suite #390

Las Vegas, Nevada, 89145

(Under Construction / May, 2013)

            Sales / Support Centers:

Nevada:

3960 Howard Hughes Pkwy Suite #500

Las Vegas, NV , 89169

California:

9465 Wilshire Blvd Suite #300

Beverly Hills , California , 90212

(Under Construction / June, 2013)

Illinois:

180 North Stetson Street Suite #3500

Chicago, Illinois , 60601

(Under Construction / June, 2013)

Florida:

Miami (August 2013)

THIS IS TO REPRESENT MY MAIN CONTAINER THAT I AM USING TO MAKE THE DROP DOWNS GO UP WHEN YOU CLICK ANYWHERE NOT ON THEM.


text:
Q: How to generate HTML report in jmeter I ran performance test case in jmeter. Now I can see results in 'View Results in Table'. But I also want same results to be saved as html report.
By default jmeter save html report? or is there a way to generate html report?
Can anyone please help me on this.

A: JMeter provide dashboard report which is only available since JMeter 3.0.

The dashboard generator is a modular extension of JMeter. Its default
  behavior is to read and process samples from CSV files to generate
  HTML files containing graph views. It can generate the report at end
  of a load test or on demand.

To generate Dashboard report follow the instruction below:
Generating Report Dashboard.
Generation from an existing sample CSV log file:
jmeter -g <log file> -o <Path to output folder>

Generation after load test:
jmeter -n -t <test JMX file> -l <test log file> -e -o <Path to output folder>


text:
Q: Using Heroku CLI to get server.js live, entering-> "heroku create" getting-> "invalid credentials provided" error Attempting to deploy API/server.js web service, w/ postgresql db, & react frontend deployment on GitHub Pages.
Performing CRUD requests and responses based on user input & submission.
Using Heroku cloud CLI for deployment of both Database & API.Webserver portions.
I type "heroku create" on CLI and I get the following in response:

"--->  r@DESKTOP-MGEIQ49 MINGW64 ~/Desktop/FILES/DEV/WEBSERVICES/PERSON-RESOURCE/FRONT/[[[myname]]].github.io (master)
$ heroku create
»   Warning: Our terms of service have changed:
»   https://dashboard.heroku.com/terms-of-service
Creating app... !
!    Invalid credentials provided.
»   Warning: heroku update available from 7.53.0 to 7.60.2.
heroku: Press any key to open up the browser to login or q to exit: n....."

Genuises please advise...


text:
Q: Sheaf cohomology of projective spaces I came across Bott's formula in "Vector bundles on complex projective spaces" by Okonek, Schneider & Spindler.
The formula is a formula for $h^q(\mathbb P^n,\Omega^p(k))$, where $\Omega^p(k)$ is the $k$-twisted sheaf of sections in the p-th power of the cotangent bundle of $\mathbb P^n$.
Is there a duality I can use for deriving the value of, say $h^0(\mathbb P^3,\bigwedge^2 T_{\mathbb P^3})$?

A: For a 3 dimensional vector space $V$ one has a canonical nondegenerate pairing $V \otimes \bigwedge^2 {V} \rightarrow detV$. Using the general principle that everything that works canonically for vector spaces works for vector bundles, take $V = T_{\mathbb P^3}$. We have $detV=\omega_{\mathbb P^3}^*$, where $\omega_{\mathbb P^3}$ is the canonical sheaf. It is standard that $\omega_{\mathbb P^n} \cong O(-n-1)$ (see Hartshorne II.8, for example), so we have
$\bigwedge^2 {V} \cong Hom_{O_{\mathbb P^3}}(V,O(4))\cong Hom_{O_{\mathbb P^3}}(V(-4),O_{\mathbb P^3}) \cong V^*(4)$.
Thus, $h^0(\mathbb P^3,\bigwedge^2 T_{\mathbb P^3}) = h^0(\mathbb P^3, \Omega_{\mathbb P^3}(4))$, for which you say you have a formula.