[Solved] How to cha...
 
Notifications
Clear all

[Solved] How to change the default (binary) python version in a FreeBSD jail?

0 Posts
1 Users
0 Likes
6 Views
0
Topic starter
zezollo Asks: How to change the default (binary) python version in a FreeBSD jail?
In a jail, I have installed python3.6 along python3.4. Both were installed using pkg install, no ports. I want to keep the 3.4 version for some time, but set the 3.6 as default.

Answers found in internet, like this one or this one either involve to myself link /usr/local/bin/python to python3.6 (what must be done again after any upgrade of the default python, what I'd like to avoid; plus there's no such link anyway); or to set DEFAULT_VERSIONS in /etc/make.conf, what has no effects on binaries installation (I've tried, nevertheless).

Moreover, the virtual environment is not an option, since I want to run uwsgi, what requires the system wide default python to match the one in the python virtual environment of the python application it "monitors" (in my case, Django), in order to start correctly. Even if I start from inside the Django's virtual environment (providing python3.6), uwsgi detects python3.4 as the default python version.

Cannot find if there is any environment variable missing neither.

For information, inside the jail (and virtual environment):

Code:
# printenv 
USER=root
LOGNAME=root
HOME=/root
SHELL=/bin/csh
BLOCKSIZE=K
MAIL=/var/mail/root
PATH=/usr/local/venv/dj1/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/games:/usr/local/sbin:/usr/local/bin:/root/bin
TERM=xterm-256color
HOSTTYPE=FreeBSD
VENDOR=amd
OSTYPE=FreeBSD
MACHTYPE=x86_64
SHLVL=1
PWD=/var/log
GROUP=wheel
HOST=dev_web0
EDITOR=vi
LANG=fr_FR.UTF-8
MM_CHARSET=UTF-8
PAGER=more
VIRTUAL_ENV=/usr/local/venv/dj1

Ten-tools.com may not be responsible for the answers or solutions given to any question asked by the users. All Answers or responses are user generated answers and we do not have proof of its validity or correctness. Please vote for the answer that helped you in order to help others find out which is the most helpful answer. Questions labeled as solved may be solved or may not be solved depending on the type of question and the date posted for some posts may be scheduled to be deleted periodically. Do not hesitate to share your response here to help other visitors like you. Thank you, Ten-tools.

 

 


 

Unreplied Posts

[Solved] How do I know if specific city is located between several other cities or not ? laravel-8

Malak Mamdouh Asks: How do I know if specific city is located between several other cities or not ? laravel-8
by using google map , when I select city , I want to determine if this city located between three or four another cities or not

Ten-tools.com may not be responsible for the answers or solutions given to any question asked by the users. All Answers or responses are user generated answers and we do not have proof of its validity or correctness. Please vote for the answer that helped you in order to help others find out which is the most helpful answer. Questions labeled as solved may be solved or may not be solved depending on the type of question and the date posted for some posts may be scheduled to be deleted periodically. Do not hesitate to share your response here to help other visitors like you. Thank you, Ten-tools.
 
 
 

[Solved] How to while loop correctly in bash script?

frodo Asks: How to while loop correctly in bash script?
I have wrote this script which takes a stop and start number and counts out the numbers in between – I am yting to get it to keep increasing no matter whether the “stop” number is reaced or not so it keeps counting until ctrl+z is pressed but it is not recognising the while condition for me – could anyone correct the syntax for me please ?

Code:
  #!/bin/sh

stopvalue=$1
startvalue=$2

if [ $# -ne 2  ]
then
   echo "Error - You must enter two numbers exactly - using default start value of 1"
#exit 0
fi

echo ${startvalue:=1}

while (test "$startvalue" -le "$stopvalue" ||  "$startvalue" -ge "$stopvalue")
do
       startvalue=$((startvalue+1))
        echo $startvalue
done

Ten-tools.com may not be responsible for the answers or solutions given to any question asked by the users. All Answers or responses are user generated answers and we do not have proof of its validity or correctness. Please vote for the answer that helped you in order to help others find out which is the most helpful answer. Questions labeled as solved may be solved or may not be solved depending on the type of question and the date posted for some posts may be scheduled to be deleted periodically. Do not hesitate to share your response here to help other visitors like you. Thank you, Ten-tools.

 

 


 

[Solved] Javasacript Countdown timer in Days, Hours, Minute, Seconds

Phoenix Ryan Asks: Javasacript Countdown timer in Days, Hours, Minute, Seconds
I’m trying to create a time-based count down clock. It is not based upon current_dates. The initial time that will be pulled will be from a separate php file. This will be for a browser based-game. When someone clicks the button to initiate this script. it will check if certain requirements are met and if so then this script will initiate. Based upon the level of the object it will pull the initial timer for that proceeding level. Hope that makes sense. Anyhow I based the timer script off of the first code I provide.

This script only accounts for minutes and seconds. I modified it to include days and hours as well. Somewhere in the process I have messed up and the script doesn’t even work at all. I’m also not quite sure if this would be the best method to calculate this. So, if you have a cleaner method at doing this please share. Thank you in advance.

This script is based off of a minutes / seconds script I saw. Here’s the original source:

Code:
<span id="countdown" class="timer"></span>
<script>
   var seconds = 60;
   function secondPassed() {
   var minutes = Math.round((seconds - 30)/60);
   var remainingSeconds = seconds % 60;
   if (remainingSeconds < 10) {
      remainingSeconds = "0" + remainingSeconds; 
   }
   document.getElementById('countdown').innerHTML = minutes + ":" + remainingSeconds;
   if (seconds == 0) {
    clearInterval(countdownTimer);
    document.getElementById('countdown').innerHTML = "Buzz Buzz";
   } else {
    seconds--;
   }
   }
   var countdownTimer = setInterval('secondPassed()', 1000);
</script>

Here is the modified script that I am trying to include days, hours, minutes and seconds.

Code:
<span id="countdown"></span>
<script>
     var current_level = 93578;

     function timer() {

        var days = Math.round(current_level/86400);
        var remainingDays = Math.round(current_level - (days * 86400));

        if (days <= 0){
             days = current_level;
        }

        var hours = Math.round(remainingDays/3600);
        var remainingHours = Math.round(remainingDays - (hours * 3600));

        if (hours >= 24){
             hours = 23;
        }

        var minutes = Math.round(remainingHours/60);
        var remainingMinutes = Math.round(remainingHours - (minutes * 60));

        if (minutes >= 60) {
             minutes = 59;
        }

        var seconds = Math.round(remainingMinutes/60);

        document.getElementById('countdown').innerHTML = days + ":" + hours ":" + minutes + ":" + seconds;

        if (seconds == 0) {
             clearInterval(countdownTimer);
             document.getElementById('countdown').innerHTML = "Completed";
        }
     }
     var countdownTimer = setInterval('timer()', 1000);
</script>

Ten-tools.com may not be responsible for the answers or solutions given to any question asked by the users. All Answers or responses are user generated answers and we do not have proof of its validity or correctness. Please vote for the answer that helped you in order to help others find out which is the most helpful answer. Questions labeled as solved may be solved or may not be solved depending on the type of question and the date posted for some posts may be scheduled to be deleted periodically. Do not hesitate to share your response here to help other visitors like you. Thank you, Ten-tools.

 

 


 

[Solved] How to create a LoggerFactory with a ConsoleLoggerProvider?

0xced Asks: How to create a LoggerFactory with a ConsoleLoggerProvider?
The ConsoleLoggerProvider has four constructors:

  1. ConsoleLoggerProvider(IConsoleLoggerSettings)
  2. ConsoleLoggerProvider(IOptionsMonitor<ConsoleLoggerOptions>)
  3. ConsoleLoggerProvider(Func<String,LogLevel,Boolean>, Boolean)
  4. ConsoleLoggerProvider(Func<String,LogLevel,Boolean>, Boolean, Boolean)

Three of them are declared obsolete with this message:

This method is obsolete and will be removed in a future version. The recommended alternative is using LoggerFactory to configure filtering and ConsoleLoggerOptions to configure logging options.

With constructor #3, creating a LoggerFactory with a ConsoleLoggerProvider is straightforward (as documented on Entity Framework Core – Logging):

Code:
var loggerFactory = new LoggerFactory(new[] { new ConsoleLoggerProvider((category, level) => level >= LogLevel.Information, true) });

But since it’s deprecated, we are left with constructor #2. Here’s what I found to be equivalent:

Code:
var configureNamedOptions = new ConfigureNamedOptions<ConsoleLoggerOptions>("", null);
var optionsFactory = new OptionsFactory<ConsoleLoggerOptions>(new []{ configureNamedOptions }, Enumerable.Empty<IPostConfigureOptions<ConsoleLoggerOptions>>());
var optionsMonitor = new OptionsMonitor<ConsoleLoggerOptions>(optionsFactory, Enumerable.Empty<IOptionsChangeTokenSource<ConsoleLoggerOptions>>(), new OptionsCache<ConsoleLoggerOptions>());
var loggerFactory = new LoggerFactory(new[] { new ConsoleLoggerProvider(optionsMonitor) }, new LoggerFilterOptions { MinLevel = LogLevel.Information });

This seems overly complicated, am I missing something simpler?

Ten-tools.com may not be responsible for the answers or solutions given to any question asked by the users. All Answers or responses are user generated answers and we do not have proof of its validity or correctness. Please vote for the answer that helped you in order to help others find out which is the most helpful answer. Questions labeled as solved may be solved or may not be solved depending on the type of question and the date posted for some posts may be scheduled to be deleted periodically. Do not hesitate to share your response here to help other visitors like you. Thank you, Ten-tools.

 

 


 

[Solved] duplicate symbol ‘folly::exception_wrapper::from_exception_ptr(std::exception_ptr&&)’ React Native 0.66 with hermes enabled

cuongtd Asks: duplicate symbol ‘folly::exception_wrapper::from_exception_ptr(std::exception_ptr&&)’ React Native 0.66 with hermes enabled
After updating my app to react-native v0.66.0, I keep getting this error if hermes is enabled. I tried to delete DerivedData folder, podfile podfile.lock… but nothing helped

terminal output

Code:
duplicate symbol 'folly::exception_wrapper::from_exception_ptr(std::exception_ptr&&)' in:
    /Users/cuongtd/Library/Developer/Xcode/DerivedData/MyApp-ekbbcdnefrapxuertuowclstsjop/Build/Products/Debug-iphonesimulator/Flipper-Folly/libFlipper-Folly.a(ExceptionWrapper.o)
    /Users/cuongtd/Library/Developer/Xcode/DerivedData/MyApp-ekbbcdnefrapxuertuowclstsjop/Build/Products/Debug-iphonesimulator/RCT-Folly/libRCT-Folly.a(ExceptionWrapper.o)
duplicate symbol 'folly::exception_wrapper::from_exception_ptr(std::exception_ptr const&)' in:
    /Users/cuongtd/Library/Developer/Xcode/DerivedData/MyApp-ekbbcdnefrapxuertuowclstsjop/Build/Products/Debug-iphonesimulator/Flipper-Folly/libFlipper-Folly.a(ExceptionWrapper.o)
    /Users/cuongtd/Library/Developer/Xcode/DerivedData/MyApp-ekbbcdnefrapxuertuowclstsjop/Build/Products/Debug-iphonesimulator/RCT-Folly/libRCT-Folly.a(ExceptionWrapper.o)
duplicate symbol 'folly::exception_wrapper::onNoExceptionError(char const*)' in:
    /Users/cuongtd/Library/Developer/Xcode/DerivedData/MyApp-ekbbcdnefrapxuertuowclstsjop/Build/Products/Debug-iphonesimulator/Flipper-Folly/libFlipper-Folly.a(ExceptionWrapper.o)
    /Users/cuongtd/Library/Developer/Xcode/DerivedData/MyApp-ekbbcdnefrapxuertuowclstsjop/Build/Products/Debug-iphonesimulator/RCT-Folly/libRCT-Folly.a(ExceptionWrapper.o)
duplicate symbol 'folly::exceptionStr(folly::exception_wrapper const&)' in:
    /Users/cuongtd/Library/Developer/Xcode/DerivedData/MyApp-ekbbcdnefrapxuertuowclstsjop/Build/Products/Debug-iphonesimulator/Flipper-Folly/libFlipper-Folly.a(ExceptionWrapper.o)
    /Users/cuongtd/Library/Developer/Xcode/DerivedData/MyApp-ekbbcdnefrapxuertuowclstsjop/Build/Products/Debug-iphonesimulator/RCT-Folly/libRCT-Folly.a(ExceptionWrapper.o)
duplicate symbol 'folly::exception_wrapper::uninit_' in:
    /Users/cuongtd/Library/Developer/Xcode/DerivedData/MyApp-ekbbcdnefrapxuertuowclstsjop/Build/Products/Debug-iphonesimulator/Flipper-Folly/libFlipper-Folly.a(ExceptionWrapper.o)
    /Users/cuongtd/Library/Developer/Xcode/DerivedData/MyApp-ekbbcdnefrapxuertuowclstsjop/Build/Products/Debug-iphonesimulator/RCT-Folly/libRCT-Folly.a(ExceptionWrapper.o)
duplicate symbol 'folly::exception_wrapper::ExceptionPtr::ops_' in:
    /Users/cuongtd/Library/Developer/Xcode/DerivedData/MyApp-ekbbcdnefrapxuertuowclstsjop/Build/Products/Debug-iphonesimulator/Flipper-Folly/libFlipper-Folly.a(ExceptionWrapper.o)
    /Users/cuongtd/Library/Developer/Xcode/DerivedData/MyApp-ekbbcdnefrapxuertuowclstsjop/Build/Products/Debug-iphonesimulator/RCT-Folly/libRCT-Folly.a(ExceptionWrapper.o)
duplicate symbol 'folly::exception_wrapper::SharedPtr::ops_' in:
    /Users/cuongtd/Library/Developer/Xcode/DerivedData/MyApp-ekbbcdnefrapxuertuowclstsjop/Build/Products/Debug-iphonesimulator/Flipper-Folly/libFlipper-Folly.a(ExceptionWrapper.o)
    /Users/cuongtd/Library/Developer/Xcode/DerivedData/MyApp-ekbbcdnefrapxuertuowclstsjop/Build/Products/Debug-iphonesimulator/RCT-Folly/libRCT-Folly.a(ExceptionWrapper.o)
ld: 7 duplicate symbols for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

ios/podfile

Code:
platform :ios, '11.0'
require_relative '../node_modules/react-native/scripts/react_native_pods'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'

target 'MyApp' do
  config = use_native_modules!

  use_react_native!(
    :path => config[:reactNativePath],
    # to enable hermes on iOS, change `false` to `true` and then install pods
    :hermes_enabled => true
  )

  # Pods for MyApp
  pod 'Firebase/Analytics'
  pod 'AFNetworking', '~> 4.0', :source => 'https://github.com/ElfSundae/CocoaPods-Specs.git'

  use_flipper!()
  post_install do |installer|
    react_native_post_install(installer)
    __apply_Xcode_12_5_M1_post_install_workaround(installer)

    installer.aggregate_targets.each do |aggregate_target| 
      aggregate_target.user_project.native_targets.each do |target|
        target.build_configurations.each do |config|
          config.build_settings['LIBRARY_SEARCH_PATHS'] = ['$(SDKROOT)/usr/lib/swift', '$(inherited)']
        end
      end
      aggregate_target.user_project.save
    end

    installer.pods_project.targets.each do |target|
      target.build_configurations.each do |config|
        config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '11.0'
       end
    end
    `sed -i -e  $'s/__IPHONE_10_0/__IPHONE_12_0/' #{installer.sandbox.root}/RCT-Folly/folly/portability/Time.h`
  end
end

I want to use flipper to debug my app and hermes is enabled, thank all.

Edit: I can build the project from Xcode

Ten-tools.com may not be responsible for the answers or solutions given to any question asked by the users. All Answers or responses are user generated answers and we do not have proof of its validity or correctness. Please vote for the answer that helped you in order to help others find out which is the most helpful answer. Questions labeled as solved may be solved or may not be solved depending on the type of question and the date posted for some posts may be scheduled to be deleted periodically. Do not hesitate to share your response here to help other visitors like you. Thank you, Ten-tools.

 

 


 

[Solved] Flutter App not working smoothley after playstore push

Anju mohan Asks: Flutter App not working smoothley after playstore push
I am beginner at flutter development.Completed my first app and also pushed to playstore.But after downloading the the app each click take more time to get the response and also the UI is incomplete.How can i find out the isuues with my app? For each click its takes around 20 seconds respond In my app using number picker dialog it popup after 20 seconds delay

Steps followed :

  1. Tested with apk in numerous emulators and found no issues
  2. tested in local android phone and found no issues
  3. released in play store with .aab format and performance issue pops up Thanks in adavance

Ten-tools.com may not be responsible for the answers or solutions given to any question asked by the users. All Answers or responses are user generated answers and we do not have proof of its validity or correctness. Please vote for the answer that helped you in order to help others find out which is the most helpful answer. Questions labeled as solved may be solved or may not be solved depending on the type of question and the date posted for some posts may be scheduled to be deleted periodically. Do not hesitate to share your response here to help other visitors like you. Thank you, Ten-tools.

 

 


 

[Solved] iPhone is busy: Making iPhone ready for development – iOS 15 – Xcode 13

StackGU Asks: iPhone is busy: Making iPhone ready for development – iOS 15 – Xcode 13
I’m trying to run an app on iPhone 7 with iOS 15.0.2 but I receive this error:

Code:
iPhone is busy: Making iPhone ready for development

I searched online and did everything that was told me to do including:

  1. Clean Build (CMD+SHIFT+K)
  2. restart both devices
  3. wait for 40 plus minutes

But nothing changed, I still receive the same loading error

Ten-tools.com may not be responsible for the answers or solutions given to any question asked by the users. All Answers or responses are user generated answers and we do not have proof of its validity or correctness. Please vote for the answer that helped you in order to help others find out which is the most helpful answer. Questions labeled as solved may be solved or may not be solved depending on the type of question and the date posted for some posts may be scheduled to be deleted periodically. Do not hesitate to share your response here to help other visitors like you. Thank you, Ten-tools.

 

 


 

[Solved] Reload django template into ajax response

Flo Asks: Reload django template into ajax response
is it possible to reload a Django template after an ajax call? This is my code.

script.js

Code:
$('.test').click(function(){
    var platform = $('#testModal').attr('test-attr');
    $.ajax(
      {
        type:"POST",
        url:"unlink",
        headers: {
          'X-CSRFToken': TOKEN
        },
        dataType: "json",
        cache : false,
        processData : false,
        contentType : false,
        data: string,
        success: function(data) {
          location.reload();
        }
      });
  });

view.py

Code:
return render(request, "user_interface/index.html", {'my_var': 'abc', 'my_var_2': 'cde'})

I tried to use return HttpResponse(json.dumps ({'res': 'Ok', 'err': None}), content_type = "application / json") but when i reload the page it fails.

Ten-tools.com may not be responsible for the answers or solutions given to any question asked by the users. All Answers or responses are user generated answers and we do not have proof of its validity or correctness. Please vote for the answer that helped you in order to help others find out which is the most helpful answer. Questions labeled as solved may be solved or may not be solved depending on the type of question and the date posted for some posts may be scheduled to be deleted periodically. Do not hesitate to share your response here to help other visitors like you. Thank you, Ten-tools.

 

 


 

[Solved] CSS: What are the behavior rules for a “width: auto” container with inline-flex?

O. Aroesti Asks: CSS: What are the behavior rules for a “width: auto” container with inline-flex?
I was trying to create a list / table view with dynamic width using flexbox, and encountered a behavior I couldn’t really wrap my head around. The result I’m trying to achieve is a width that fits the content of the list, at its’ widest point.

Code:
  .main {
      width: auto;
      background: rgb(233, 148, 148);
      display: inline-flex;
      flex-wrap: wrap;
    }
  .container {
    display: flex;
    width: 100%;
  }
  .label, .value {
    flex: 1;
    padding: 4px;
  }
  .label {
    text-align: end;
    border-right: 2px solid red;
  }
  .value {
    text-align: start;
  }

Code:
<div>
  <div class="main">
    <div class="container">
      <div class="label">Some Label</div>
      <div class="value">Some value</div>
    </div>
    <div class="container">
      <div class="label">Some label 2</div>
      <div class="value">Other val</div>
    </div>
    <div class="container">
      <div class="label">Third label</div>
      <div class="value">
        <div>N/A</div>
      </div>
    </div>
  </div>
</div>

What it boils down to, is that the width seems to be determined by the total characters count, and not the widest point, as I would expect. You can edit the HTML and remove the N/A, for example, and the width will decrease.

When I switch to display: inline-block with white-space: nowrap, the width is as expected, but the “columns” are not aligned.

Code:
  .main {
      width: auto;
      background: rgb(233, 148, 148);
      display: inline-block;
      white-space: nowrap;
  }
  .container {
    display: flex;
    width: 100%;
  }
  .label, .value {
    flex: 1;
    padding: 4px;
  }
  .label {
    text-align: end;
    border-right: 2px solid red;
  }
  .value {
    text-align: start;
  }

Code:
<div>
  <div class="main">
    <div class="container">
      <div class="label">Some Label</div>
      <div class="value">Some value</div>
    </div>
    <div class="container">
      <div class="label">Some label 2</div>
      <div class="value">Other val</div>
    </div>
    <div class="container">
      <div class="label">Third label</div>
      <div class="value">
        <div>N/A</div>
      </div>
    </div>
  </div>
</div>

What causes the large width to occur when the display is inline-flex? Is there a way to get the behavior I’m trying to achieve? I know it can probably be resolved with display: grid, but I’m looking for a simpler solution.

Ten-tools.com may not be responsible for the answers or solutions given to any question asked by the users. All Answers or responses are user generated answers and we do not have proof of its validity or correctness. Please vote for the answer that helped you in order to help others find out which is the most helpful answer. Questions labeled as solved may be solved or may not be solved depending on the type of question and the date posted for some posts may be scheduled to be deleted periodically. Do not hesitate to share your response here to help other visitors like you. Thank you, Ten-tools.

 

 


 

[Solved] What is the difference between production and development in babel?

volume one Asks: What is the difference between production and development in babel?
I am running into problems between development and production environments using Webpack and babel-loader.

If I set process.env.NODE_ENV = "development", then this informs Webpack to use mode: "development" which in turn also sets babel-loader to work in development mode. In this mode I am getting different bundled code in my final app.js file than if I use process.env.NODE_ENV = "production".

When in production mode, the app.js file gets built correctly and I can then import it into my server.js file like this:

Code:
const serverApp = require('../dist/server/app.js').default;

However in development mode, I run into this error:

var serverApp = require(“../dist/server/app.js”).default;

Code:
                                         ^

TypeError: Cannot read property ‘default’ of undefined

If I open the app.js file created in development mode, it looks significantly different to the production version. But because its all bundled code I have no idea why it is different.

I assume that babel-loader transpiles differently in each mode but I cannot find any documentation to show how it differs.

In my Webpack configuration I have this rule for babel-loader:

Code:
 {
        // Transpiles ES6-8 into ES5
        test: /.m?jsx?$/,
        exclude: ['/node_modules/', /bcore-jsb/, /bwebpack/buildinb/, /@babel/runtime-corejs3/],
        use: {
            loader: 'babel-loader',
            options: {
                babelrc: false,
                sourceType: "unambiguous",
                presets: [
                    ["@babel/preset-env", {
                        // Webpack supports ES Modules out of the box and therefore doesn’t require
                        // import/export to be transpiled resulting in smaller builds, and better tree
                        // shaking. See https://webpack.js.org/guides/tree-shaking/#conclusion
                        modules: false,

                        corejs: {
                            version: "3.9.0",
                            proposals: true
                        },
                    }
                    ]
                ],
            }
        }
    }

Ten-tools.com may not be responsible for the answers or solutions given to any question asked by the users. All Answers or responses are user generated answers and we do not have proof of its validity or correctness. Please vote for the answer that helped you in order to help others find out which is the most helpful answer. Questions labeled as solved may be solved or may not be solved depending on the type of question and the date posted for some posts may be scheduled to be deleted periodically. Do not hesitate to share your response here to help other visitors like you. Thank you, Ten-tools.

 

 


 

Share: