text:
Q: react-native run-android build crashes on launch without red screen I'm trying to build the debug version of my app on android. the offline version works alright. (with the react-native bundle ...). But of course, it doesn't trigger the metro bundler. Also, the bundler is listening for build and when https://localhost:8081/index.bundle?platform=android is called on the browser, it starts to bundle.
I've tried:

*

*Removing the build folder

*Generating a new debug.keystore

*Running ./gradlew clean

*watchman watch-del-all

*rm -rf .gradle

*rm -rf node_modules

*rm -rf package-lock.json

*npm i

*Run with npx react-native run-android
And almost all sorts of cleaning and resetting. But still no chance. It's a highly customized project and I can not update the react-native version or clean the android folder.
This is my react-native info result:
System:
    OS: macOS Mojave 10.14.6
    CPU: (8) x64 Intel(R) Core(TM) i5-8257U CPU @ 1.40GHz
    Memory: 417.64 MB / 8.00 GB
    Shell: 5.3 - /bin/zsh
  Binaries:
    Node: 12.14.1 - /usr/local/bin/node
    Yarn: 1.22.4 - /usr/local/bin/yarn
    npm: 6.14.7 - /usr/local/bin/npm
    Watchman: 4.9.0 - /usr/local/bin/watchman
  SDKs:
    iOS SDK:
      Platforms: iOS 13.2, DriverKit 19.0, macOS 10.15, tvOS 13.2, watchOS 6.1
    Android SDK:
      API Levels: 28, 29
      Build Tools: 28.0.3, 29.0.2
      System Images: android-28 | Intel x86 Atom_64, android-29 | Intel x86 Atom_64
  IDEs:
    Android Studio: 3.6 AI-192.7142.36.36.6392135
    Xcode: 11.3.1/11C504 - /usr/bin/xcodebuild
  npmPackages:
    react: 16.9.0 => 16.9.0
    react-native: 0.61.5 => 0.61.5

And this is my logcat when I launch the app on the emulator:
09-03 14:48:11.523  8400  9820 I ActivityTaskManager: START u0 {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=com.myapp.demo/com.myapp.MainActivity bnds=[35,503][237,780]} from uid 10083
09-03 14:48:11.751  8400  8440 I ActivityManager: Start proc 12348:com.myapp.demo/u0a111 for activity {com.myapp.demo/com.myapp.MainActivity}
09-03 14:48:11.751 12348 12348 I m.myapp.dem: Not late-enabling -Xcheck:jni (already on)
09-03 14:48:11.782 12348 12348 E m.myapp.dem: Unknown bits set in runtime_flags: 0x8000
09-03 14:48:11.783 12348 12348 W m.myapp.dem: Unexpected CPU variant for X86 using defaults: x86_64
09-03 14:48:11.857 12348 12348 I m.myapp.dem: The ClassLoaderContext is a special shared library.
09-03 14:48:12.303  1652  1652 E Layer   : [Surface(name=AppWindowToken{71e8676 token=Token{370511 ActivityRecord{b1c4138 u0 com.myapp.demo/com.myapp.MainActivity t37}}})/@0x93ca15a - animation-leash#0] No local sync point found
09-03 14:48:12.303  1652  1652 E Layer   : [Surface(name=AppWindowToken{71e8676 token=Token{370511 ActivityRecord{b1c4138 u0 com.myapp.demo/com.myapp.MainActivity t37}}})/@0x93ca15a - animation-leash#0] No local sync point found
09-03 14:48:12.321  1652  1652 E Layer   : [Surface(name=AppWindowToken{71e8676 token=Token{370511 ActivityRecord{b1c4138 u0 com.myapp.demo/com.myapp.MainActivity t37}}})/@0x93ca15a - animation-leash#0] No local sync point found
09-03 14:48:12.422 12348 12376 I FA      :   adb shell setprop debug.firebase.analytics.app com.myapp.demo
09-03 14:48:12.452 12348 12348 D SoLoader: adding application source: com.facebook.soloader.DirectorySoSource[root = /data/app/com.myapp.demo-tzqejRbWBgXm8igk7j-Npw==/lib/x86_64 flags = 0]
09-03 14:48:12.453 12348 12348 D SoLoader: adding backup source from : com.facebook.soloader.ApkSoSource[root = /data/data/com.myapp.demo/lib-main flags = 1]
09-03 14:48:12.453 12348 12348 D SoLoader: Preparing SO source: com.facebook.soloader.DirectorySoSource[root = /data/app/com.myapp.demo-tzqejRbWBgXm8igk7j-Npw==/lib/x86_64 flags = 0]
09-03 14:48:12.453 12348 12348 D SoLoader: Preparing SO source: com.facebook.soloader.ApkSoSource[root = /data/data/com.myapp.demo/lib-main flags = 1]
09-03 14:48:12.455 12348 12348 V fb-UnpackingSoSource: locked dso store /data/user/0/com.myapp.demo/lib-main
09-03 14:48:12.456 12348 12348 I fb-UnpackingSoSource: dso store is up-to-date: /data/user/0/com.myapp.demo/lib-main
09-03 14:48:12.456 12348 12348 V fb-UnpackingSoSource: releasing dso store lock for /data/user/0/com.myapp.demo/lib-main
09-03 14:48:12.583 12348 12404 W m.myapp.dem: Accessing hidden method Lsun/misc/Unsafe;->objectFieldOffset(Ljava/lang/reflect/Field;)J (greylist,core-platform-api, linking, allowed)
09-03 14:48:12.584 12348 12404 W m.myapp.dem: Accessing hidden method Lsun/misc/Unsafe;->getInt(Ljava/lang/Object;J)I (greylist, linking, allowed)
09-03 14:48:12.584 12348 12404 W m.myapp.dem: Accessing hidden method Lsun/misc/Unsafe;->getObject(Ljava/lang/Object;J)Ljava/lang/Object; (greylist, linking, allowed)
09-03 14:48:12.584 12348 12404 W m.myapp.dem: Accessing hidden method Lsun/misc/Unsafe;->getLong(Ljava/lang/Object;J)J (greylist,core-platform-api, linking, allowed)
09-03 14:48:12.587 12348 12404 W m.myapp.dem: Accessing hidden method Lsun/misc/Unsafe;->putInt(Ljava/lang/Object;JI)V (greylist, linking, allowed)
09-03 14:48:12.588 12348 12404 W m.myapp.dem: Accessing hidden method Lsun/misc/Unsafe;->putObject(Ljava/lang/Object;JLjava/lang/Object;)V (greylist, linking, allowed)
09-03 14:48:12.589 12348 12404 W m.myapp.dem: Accessing hidden method Lsun/misc/Unsafe;->allocateInstance(Ljava/lang/Class;)Ljava/lang/Object; (greylist, linking, allowed)
09-03 14:48:12.589 12348 12404 W m.myapp.dem: Accessing hidden method Lsun/misc/Unsafe;->arrayBaseOffset(Ljava/lang/Class;)I (greylist,core-platform-api, linking, allowed)
09-03 14:48:12.589 12348 12404 W m.myapp.dem: Accessing hidden method Lsun/misc/Unsafe;->arrayIndexScale(Ljava/lang/Class;)I (greylist, linking, allowed)
09-03 14:48:12.592 12348 12404 W m.myapp.dem: Accessing hidden method Llibcore/io/Memory;->peekLong(JZ)J (greylist, reflection, allowed)
09-03 14:48:12.592 12348 12404 W m.myapp.dem: Accessing hidden method Llibcore/io/Memory;->pokeLong(JJZ)V (greylist, reflection, allowed)
09-03 14:48:12.592 12348 12404 W m.myapp.dem: Accessing hidden method Llibcore/io/Memory;->pokeInt(JIZ)V (greylist, reflection, allowed)
09-03 14:48:12.592 12348 12404 W m.myapp.dem: Accessing hidden method Llibcore/io/Memory;->peekInt(JZ)I (greylist, reflection, allowed)
09-03 14:48:12.592 12348 12404 W m.myapp.dem: Accessing hidden method Llibcore/io/Memory;->pokeByte(JB)V (greylist, reflection, allowed)
09-03 14:48:12.592 12348 12404 W m.myapp.dem: Accessing hidden method Llibcore/io/Memory;->peekByte(J)B (greylist, reflection, allowed)
09-03 14:48:12.592 12348 12404 W m.myapp.dem: Accessing hidden method Llibcore/io/Memory;->pokeByteArray(J[BII)V (greylist, reflection, allowed)
09-03 14:48:12.592 12348 12404 W m.myapp.dem: Accessing hidden method Llibcore/io/Memory;->peekByteArray(J[BII)V (greylist, reflection, allowed)
09-03 14:48:12.592 12348 12404 W m.myapp.dem: Accessing hidden method Lsun/misc/Unsafe;->putLong(Ljava/lang/Object;JJ)V (greylist, linking, allowed)
09-03 14:48:12.592 12348 12404 W m.myapp.dem: Accessing hidden method Lsun/misc/Unsafe;->getLong(Ljava/lang/Object;J)J (greylist,core-platform-api, reflection, allowed)
09-03 14:48:12.592 12348 12404 W m.myapp.dem: Accessing hidden field Ljava/nio/Buffer;->address:J (greylist, reflection, allowed)
09-03 14:48:12.593 12348 12404 W m.myapp.dem: Accessing hidden method Lsun/misc/Unsafe;->getInt(Ljava/lang/Object;J)I (greylist, reflection, allowed)
09-03 14:48:12.593 12348 12404 W m.myapp.dem: Accessing hidden method Lsun/misc/Unsafe;->putInt(Ljava/lang/Object;JI)V (greylist, reflection, allowed)
09-03 14:48:12.593 12348 12404 W m.myapp.dem: Accessing hidden method Lsun/misc/Unsafe;->getLong(Ljava/lang/Object;J)J (greylist,core-platform-api, reflection, allowed)
09-03 14:48:12.593 12348 12404 W m.myapp.dem: Accessing hidden method Lsun/misc/Unsafe;->putLong(Ljava/lang/Object;JJ)V (greylist, reflection, allowed)
09-03 14:48:12.593 12348 12404 W m.myapp.dem: Accessing hidden method Lsun/misc/Unsafe;->getObject(Ljava/lang/Object;J)Ljava/lang/Object; (greylist, reflection, allowed)
09-03 14:48:12.593 12348 12404 W m.myapp.dem: Accessing hidden method Lsun/misc/Unsafe;->putObject(Ljava/lang/Object;JLjava/lang/Object;)V (greylist, reflection, allowed)
09-03 14:48:13.115 12348 12393 W m.myapp.dem: Accessing hidden method Lsun/misc/Unsafe;->getObject(Ljava/lang/Object;J)Ljava/lang/Object; (greylist, linking, allowed)
09-03 14:48:13.121 12348 12393 W m.myapp.dem: Accessing hidden method Lsun/misc/Unsafe;->getObject(Ljava/lang/Object;J)Ljava/lang/Object; (greylist, linking, allowed)
09-03 14:48:13.121 12348 12393 W m.myapp.dem: Accessing hidden method Lsun/misc/Unsafe;->putObject(Ljava/lang/Object;JLjava/lang/Object;)V (greylist, linking, allowed)
09-03 14:48:13.122 12348 12393 W m.myapp.dem: Accessing hidden method Lsun/misc/Unsafe;->getInt(Ljava/lang/Object;J)I (greylist, linking, allowed)
09-03 14:48:13.122 12348 12393 W m.myapp.dem: Accessing hidden method Lsun/misc/Unsafe;->putInt(Ljava/lang/Object;JI)V (greylist, linking, allowed)
09-03 14:48:13.122 12348 12393 W m.myapp.dem: Accessing hidden method Lsun/misc/Unsafe;->getLong(Ljava/lang/Object;J)J (greylist,core-platform-api, linking, allowed)
09-03 14:48:13.122 12348 12393 W m.myapp.dem: Accessing hidden method Lsun/misc/Unsafe;->putLong(Ljava/lang/Object;JJ)V (greylist, linking, allowed)
09-03 14:48:13.127 12348 12393 W m.myapp.dem: Accessing hidden method Lsun/misc/Unsafe;->putLong(Ljava/lang/Object;JJ)V (greylist, linking, allowed)
09-03 14:48:13.129 12348 12404 W m.myapp.dem: Accessing hidden method Lsun/misc/Unsafe;->getInt(Ljava/lang/Object;J)I (greylist, linking, allowed)
09-03 14:48:13.139 12348 12348 W RenderThread: type=1400 audit(0.0:54): avc: denied { write } for name="property_service" dev="tmpfs" ino=8201 scontext=u:r:untrusted_app:s0:c111,c256,c512,c768 tcontext=u:object_r:property_socket:s0 tclass=sock_file permissive=0 app=com.myapp.demo
09-03 14:48:13.263 12348 12348 D SoLoader: libjscexecutor.so not found on /data/data/com.myapp.demo/lib-main
09-03 14:48:13.263 12348 12348 D SoLoader: libjscexecutor.so found on /data/app/com.myapp.demo-tzqejRbWBgXm8igk7j-Npw==/lib/x86_64
09-03 14:48:13.277 12348 12413 D SoLoader: libhermes.so not found on /data/data/com.myapp.demo/lib-main
09-03 14:48:13.277 12348 12413 D SoLoader: libhermes.so found on /data/app/com.myapp.demo-tzqejRbWBgXm8igk7j-Npw==/lib/x86_64
09-03 14:48:13.295 12348 12413 D SoLoader: libhermes-executor-release.so not found on /data/data/com.myapp.demo/lib-main
09-03 14:48:13.295 12348 12413 D SoLoader: libhermes-executor-release.so found on /data/app/com.myapp.demo-tzqejRbWBgXm8igk7j-Npw==/lib/x86_64
09-03 14:48:13.317 12348 12413 D SoLoader: libfb.so not found on /data/data/com.myapp.demo/lib-main
09-03 14:48:13.317 12348 12413 D SoLoader: libfb.so found on /data/app/com.myapp.demo-tzqejRbWBgXm8igk7j-Npw==/lib/x86_64
09-03 14:48:13.320 12348 12413 D SoLoader: libfb.so not found on /data/data/com.myapp.demo/lib-main
09-03 14:48:13.320 12348 12413 D SoLoader: libfb.so found on /data/app/com.myapp.demo-tzqejRbWBgXm8igk7j-Npw==/lib/x86_64
09-03 14:48:13.320 12348 12413 I m.myapp.dem: Thread[39,tid=12413,Native,Thread*=0x7d6527e8b800,peer=0x16f77c58,"create_react_context"] recursive attempt to load library "/data/app/com.myapp.demo-tzqejRbWBgXm8igk7j-Npw==/lib/x86_64/libfb.so"
09-03 14:48:13.320 12348 12348 W m.myapp.dem: Accessing hidden method Landroid/view/View;->computeFitSystemWindows(Landroid/graphics/Rect;Landroid/graphics/Rect;)Z (greylist, reflection, allowed)
09-03 14:48:13.321 12348 12348 W m.myapp.dem: Accessing hidden method Landroid/view/ViewGroup;->makeOptionalFitsSystemWindows()V (greylist, reflection, allowed)
09-03 14:48:13.329 12348 12348 D FirebasePerformance: onResume(): com.myapp.MainActivity: 1089086 microseconds
09-03 14:48:13.332 12348 12348 W m.myapp.dem: Accessing hidden method Lsun/misc/Unsafe;->getObject(Ljava/lang/Object;J)Ljava/lang/Object; (greylist, linking, allowed)
09-03 14:48:13.332 12348 12348 W m.myapp.dem: Accessing hidden method Lsun/misc/Unsafe;->putObject(Ljava/lang/Object;JLjava/lang/Object;)V (greylist, linking, allowed)
09-03 14:48:13.335 12348 12404 W m.myapp.dem: Accessing hidden method Lsun/misc/Unsafe;->getInt(Ljava/lang/Object;J)I (greylist, linking, allowed)
09-03 14:48:13.335 12348 12404 W m.myapp.dem: Accessing hidden method Lsun/misc/Unsafe;->putInt(Ljava/lang/Object;JI)V (greylist, linking, allowed)
09-03 14:48:13.336 12348 12404 W m.myapp.dem: Accessing hidden method Lsun/misc/Unsafe;->getLong(Ljava/lang/Object;J)J (greylist,core-platform-api, linking, allowed)
09-03 14:48:13.403 12348 12413 W InstanceID: Instance ID SDK is deprecated, com.myapp.demo should update to use Firebase Instance ID
09-03 14:48:13.437 12348 12413 I m.myapp.dem: The ClassLoaderContext is a special shared library.
09-03 14:48:13.598  8400  8438 I ActivityTaskManager: Displayed com.myapp.demo/com.myapp.MainActivity: +2s74ms
09-03 14:48:13.622 12348 12420 W m.myapp.dem: Accessing hidden method Landroid/content/Context;->bindServiceAsUser(Landroid/content/Intent;Landroid/content/ServiceConnection;ILandroid/os/Handler;Landroid/os/UserHandle;)Z (greylist, reflection, allowed)
09-03 14:48:13.658  8400  8440 I ActivityManager: Start proc 12425:com.android.webview:sandboxed_process0:org.chromium.content.app.SandboxedProcessService0/u0i12 for  {com.myapp.demo/org.chromium.content.app.SandboxedProcessService0}
    09-03 14:48:13.815 12348 12413 D SoLoader: libreactnativejni.so not found on /data/data/com.myapp.demo/lib-main
09-03 14:48:13.815 12348 12413 D SoLoader: libreactnativejni.so found on /data/app/com.myapp.demo-tzqejRbWBgXm8igk7j-Npw==/lib/x86_64
09-03 14:48:13.910 12348 12361 I m.myapp.dem: Background young concurrent copying GC freed 72355(9202KB) AllocSpace objects, 26(776KB) LOS objects, 65% free, 3229KB/9373KB, paused 2.318ms total 125.689ms
09-03 14:48:13.912 12348 12413 E AndroidRuntime: Process: com.myapp.demo, PID: 12348
09-03 14:48:13.939 12348 12376 W m.myapp.dem: Accessing hidden method Lsun/misc/Unsafe;->getInt(Ljava/lang/Object;J)I (greylist, linking, allowed)
09-03 14:48:13.939 12348 12376 W m.myapp.dem: Accessing hidden method Lsun/misc/Unsafe;->getObject(Ljava/lang/Object;J)Ljava/lang/Object; (greylist, linking, allowed)
09-03 14:48:13.939 12348 12376 W m.myapp.dem: Accessing hidden method Lsun/misc/Unsafe;->putObject(Ljava/lang/Object;JLjava/lang/Object;)V (greylist, linking, allowed)
09-03 14:48:13.939 12348 12376 W m.myapp.dem: Accessing hidden method Lsun/misc/Unsafe;->putInt(Ljava/lang/Object;JI)V (greylist, linking, allowed)
09-03 14:48:13.944 12348 12376 W m.myapp.dem: Accessing hidden method Lsun/misc/Unsafe;->getLong(Ljava/lang/Object;J)J (greylist,core-platform-api, linking, allowed)
09-03 14:48:13.946 12348 12376 W m.myapp.dem: Accessing hidden method Lsun/misc/Unsafe;->putLong(Ljava/lang/Object;JJ)V (greylist, linking, allowed)
09-03 14:48:13.954 12348 12376 W m.myapp.dem: Accessing hidden method Llibcore/io/Memory;->pokeByte(JB)V (greylist, reflection, allowed)
09-03 14:48:13.954 12348 12376 W m.myapp.dem: Accessing hidden method Llibcore/io/Memory;->peekByte(J)B (greylist, reflection, allowed)
09-03 14:48:13.955 12348 12376 W m.myapp.dem: Accessing hidden method Lsun/misc/Unsafe;->getLong(Ljava/lang/Object;J)J (greylist,core-platform-api, reflection, allowed)
09-03 14:48:13.955 12348 12376 W m.myapp.dem: Accessing hidden method Lsun/misc/Unsafe;->getInt(Ljava/lang/Object;J)I (greylist, reflection, allowed)
09-03 14:48:13.956 12348 12376 W m.myapp.dem: Accessing hidden method Lsun/misc/Unsafe;->putInt(Ljava/lang/Object;JI)V (greylist, reflection, allowed)
09-03 14:48:13.956 12348 12376 W m.myapp.dem: Accessing hidden method Lsun/misc/Unsafe;->getLong(Ljava/lang/Object;J)J (greylist,core-platform-api, reflection, allowed)
09-03 14:48:13.956 12348 12376 W m.myapp.dem: Accessing hidden method Lsun/misc/Unsafe;->putLong(Ljava/lang/Object;JJ)V (greylist, reflection, allowed)
09-03 14:48:13.956 12348 12376 W m.myapp.dem: Accessing hidden method Lsun/misc/Unsafe;->getObject(Ljava/lang/Object;J)Ljava/lang/Object; (greylist, reflection, allowed)
09-03 14:48:13.956 12348 12376 W m.myapp.dem: Accessing hidden method Lsun/misc/Unsafe;->putObject(Ljava/lang/Object;JLjava/lang/Object;)V (greylist, reflection, allowed)
09-03 14:48:13.980  8400 10689 W ActivityTaskManager:   Force finishing activity com.myapp.demo/com.myapp.MainActivity
09-03 14:48:14.039  8400  8493 W InputDispatcher: channel 'a546a57 com.myapp.demo/com.myapp.MainActivity (server)' ~ Consumer closed input channel or an error occurred.  events=0x9
09-03 14:48:14.039  8400  8493 E InputDispatcher: channel 'a546a57 com.myapp.demo/com.myapp.MainActivity (server)' ~ Channel is unrecoverably broken and will be disposed!
    09-03 14:48:14.062  8400 10382 I ActivityManager: Process com.myapp.demo (pid 12348) has died: vis+99 TOP
09-03 14:48:14.096  8400  8841 I WindowManager: WIN DEATH: Window{a546a57 u0 com.myapp.demo/com.myapp.MainActivity}
09-03 14:48:14.096  8400  8841 W InputDispatcher: Attempted to unregister already unregistered input channel 'a546a57 com.myapp.demo/com.myapp.MainActivity (server)'

And this is the build.gradle setup for debug:
buildTypes {
        debug {
            signingConfig signingConfigs.debug
            applicationIdSuffix ".demo"
            versionNameSuffix " - Dev"
            resValue "string", "app_name", "My App"
        }

I believe somehow the customizations made some changes that the build version is not actually a debug one that shows the debug red screen and is connected to the development server. But I can not find the source to change.
I also installed a react-native init --version 0.61.5 on my laptop and it installs and runs and connects to the metro server like a charm.
So if you have any suggestions to check further deep inside the configurations and android folder I'll be deeply grateful. I've tried so many questions on StackOverflow and issues on the react-native, react-native-CLI, and metro repos, but couldn't find any advanced guides that I need.

A: The magic of posting the question on StackOverflow worked and I found the answer after a few tries after it.
Apparently, the problem was with the imported BuildConfig file at the MainApplication.java. This causes the program to use the imported build config and not the debug one that is in this file:
@Override
    public boolean getUseDeveloperSupport() {
      return BuildConfig.DEBUG;
    }

Because the libraries use the production config in their build config and when we import it the compiler prevents debug features. That's why it can not get connected to the metro bundler.
So if you're viewing this question and have the same problem make sure to check the MainApplication.java and remove any external BuildConfigs that you find, such as:
import com.facebook.react.BuildConfig;
import androidx.multidex.BuildConfig;

In my case, the second was there in the code.
After doing this make sure to remove the offline bundle if you've got any:
rm android/app/src/main/assets/index.android.bundle

And remove the android build folder:
rm -rf android/app/build

or:
cd android && ./gradlew clean

Now you can run react-native run-android and it will hopefully build and run and connect to the bunder successfully.


text:
Q: Using Python + BeautifulSoup to pick up text in a table on webpage I want to pick up a date on a webpage.
The original webpage source code looks like:

Expiry Date2016

I want to pick up the '2016' but I fail. The most I can do is:
page = urllib2.urlopen('http://www.thewebpage.com')
soup = BeautifulSoup(page.read())

a = soup.find_all(text=re.compile("Expiry Date"))

And I tried:
b = a[0].findNext('').text
print b

and
b = a[0].find_next('td').select('td:nth-of-type(1)')
print b

neither of them works out.
Any help? Thanks.

A: There are multiple options.
Option #1 (using CSS selector, being very explicit about the path to the element):
from bs4 import BeautifulSoup

data = """

                            Expiry Date

                        2016

"""

soup = BeautifulSoup(data)
span = soup.select('tr.odd table.zp > tbody > tr > td > span')[0]
print span.next_sibling.strip()  # prints 2016

We are basically saying: get me the span tag that is directly inside the td that is directly inside the tr that is directly inside tbody that is directly inside the table tag with zp class that is inside the tr tag with odd class. Then, we are using next_sibling to get the text after the span tag.

Option #2 (find span by text; think it is more readable)
span = soup.find('span', text=re.compile('Expiry Date'))
print span.next_sibling.strip()  # prints 2016

re.compile() is needed since there could be multi-lines and additional spaces around the text. Do not forget to import re module.

A: An alternative to the css selector is:
import bs4

data = """

                            Expiry Date

                        2016

"""

soup = bs4.BeautifulSoup(data)
exp_date = soup.find('table', class_='zp').tbody.tr.td.span.next_sibling
print exp_date # 2016

To learn about BeautifulSoup, I recommend you read the documentation.

redpajama_set_name: RedPajamaStackExchange


text:
Q: React Konva: onMouseOver doesn't trigger when a shape above it is removed? I have a project with two <Rect/> on top of each other.
The <Rect/> at the bottom changes its color when the cursor is hovering over it.
export const BottomSquare = () => {
  const [color, setColor] = useState("green");
  return (
    <Rect
      width={100}
      height={100}
      opacity={1}
      fill={color}
      onMouseOver={() => {
        setColor("blue");
      }}
      onMouseLeave={() => {
        setColor("green");
      }}
    />
  );
};

the <Rect/> at the top changes its position to be away from the bottom <Rect/> when it's clicked. This <Rect/> is smaller than the bottom one.
export const TopSquare = () => {
  const [position, setPosition] = useState({ x: 0, y: 0 });

  return (
    <Rect
      {...position}
      width={50}
      height={50}
      opacity={1}
      fill="grey"
      onClick={(event) => {
        setPosition({ x: 100, y: 100 });
      }}
    />
  );
};

Hovering over the top <Rect/> does not trigger the color changing logic of the bottom <Rect/>, which is the expected behavior.
However, when clicking on the top <Rect/>, and it's moved away, making the cursor to hovering over the bottom <Rect/>, the onMouseOver() logic doesn't trigger unless I move the cursor for at least 1 pixel. This feels like a onMouseMove() behavior rather than onMouseOver().

What I want is for the bottom <Rect/> to be able to trigger the onMouseOver() logic when the top one is removed.
I tried onMouseEnter() and onMouseMove(), but the issue is still there.
How can I solve this issue?
reproduced example on codesandbox.io

A: You could e.g. get the reference to the bottom rect by applying some id to it and then programatically start the mouseover event when user clicks on the top rect.
Working example: https://codesandbox.io/s/gracious-hugle-bzj4jx
export const TopSquare = () => {
  const [position, setPosition] = useState({ x: 0, y: 0 });

  return (
    <Rect
      {...position}
      width={50}
      height={50}
      opacity={1}
      fill="grey"
      onClick={(event) => {
        const stage = event.target.getStage();
        const node = stage?.findOne('#bottomRect');
        node?.fire('mouseover');
        setPosition({ x: 100, y: 100 });
      }}
    />
  );
};

export const BottomSquare = () => {
  const [color, setColor] = useState("green");
  return (
    <Rect
      width={100}
      height={100}
      id="bottomRect"
      opacity={1}
      fill={color}
      onMouseOver={() => {
        setColor("blue");
      }}
      onMouseLeave={() => {
        setColor("green");
      }}
    />
  );
};


text:
Q: Adding image in to 'ui-dialog-buttonpane' I'm new to jQuery and html and I'm working on a popup dialog. I need to add an image in to 'ui-dialog-buttonpane'. There are already two buttons in that section.
Is it possible?
I tried following code but didn't get the result.
jQuery(".ui-dialog-buttonpane").append("");

A: It worked after I added a time out.
jQuery("#ow-logindiv").dialog({
                      open: function(event, ui) {
                        setTimeout(function () {
                          jQuery('#ow-logindiv').parent('div').children('.ui-dialog-buttonpane').append('');
                        }, 0);

                      }
                    });


text:
Q: Cannot set default value of path `stats` to a mongoose Schema instance Probably this issue arose due to mongoose compatibility. I am working on an existing app. Today, all of sudden this issue started to appear when I tried to restart the app but it failed for the following error
Cannot set default value of path stats to a mongoose Schema instance
The stack trace took me to line number 47 of my User model. The line said.
stats: { type: UserStatsSchema, default: UserStatsSchema },

Right above the new Schema() call in user.js modal file, UserStatsSchema is defined
const UserStatsSchema = new Schema({
    numLikes: { type: Number, default: 0 },
    numPosts: { type: Number, default: 0 }
}, {_id: false});

I tried to figure out by searching over the internet. Since I am new to mongoose and it's Schema typecasting I am not sure what do I need to fix this issue.

A: You should make your nested schema default to returning a function that returns an empty object. Mongoose will handle type-casting that to your UserStatsSchema type and ensure the defaults you configured.
stats: { type: UserStatsSchema, default: () => ({}) },

This is based on these 2 issues from Mongoose's official Github

*

*https://github.com/Automattic/mongoose/issues/9104

*https://github.com/Automattic/mongoose/issues/8751

We made a small improvement in 8fea1d9 that removes most of the performance impact, but the above script still ends up being 2x slower than if you don't have the default. So in 32c5ed0 we made Mongoose throw an error if you set a path's default to a Mongoose schema instance. There's no reason to ever do that anyway.

Later describes why it was not pushed as a Major Version update

I admit this change is a bit heavy for a patch, but seeing as how (1) setting a default to a schema instance doesn't do anything useful, and (2) it has a significant performance impact, I figured it was worth it to get this change out sooner rather than later. Sorry for any trouble.

A: Replaced:
stats: { type: UserStatsSchema, default: UserStatsSchema }

with
stats: [ UserStatsSchema ]


text:
Q: Как подписать компонент на извменения в store? Есть 2 компонента-список и дейт пикер. Они связаны с двумя сторами. Первый стор  возвращает объекты ля заполнения списка, второй стор принимает дату и сетит внутри себя объект, значением которого является эта дата. Нужно сделать следующее. Выставили дату, в сторе обновился объект -> компонент-списка обновляется(то есть повторно срабатывает getItems). Из того, что видел в сети я понял,что надо каким-то образом подписать компонент списка на изменения стора дейтпикера. Например, тут похожий вопрос, но я не совсем понимаю эту конструкцию(как ее использовать и где прописывать):
CommonStore.addChangeListener(render);

Как я понял эта строка подписывает компонент на изменения стора,но тут она прописана в index.js. У меня же нужные компоненты находятся  в других файлах. Подскажите пожалуйста, как это реализовать


text:
Q: Find the value which satisfies these equations $$C = 0.6Y +50$$
$$I=10$$
We want to find the $Y$ for which $Y=C+I$. This is a question in a chapter about discrete dynamic models, so we have to use an appropriate method.
I tried to rewrite it and ended up with $y = 1\dfrac{2}{3} C - 73 \dfrac{1}{3}$, but that was a dead end.

A: Not really familiar with DDMs, but algebra says:
$$
\begin{align}
Y &= C + I \\
\implies Y &= 0.6Y + 50 + 10 \\
\implies 0.4 Y &= 60 \\
Y &= \dfrac{60*10}{4} \\
&= 150
\end{align}
$$

A: You want $C+I=Y$, so note that $I=10$.
$C+10=Y\implies 0.6Y+50+10=Y\implies 0.6Y+60=Y\implies0.6Y-1Y=-60\implies -0.4Y=-60\implies 0.4Y=60\implies Y=\frac{60}{0.4}=150$

A: I don't think there is anything complicated about this problem.  Just straightforward method.  All you need to do is to perform the substitution for $Y = C + I$.  You should get:
$$Y = C + I$$
$$Y = (0.6Y + 50) + 10$$
$$Y = 0.6Y + (50 + 10)$$
$$Y = 0.6Y + 60$$
$$Y - 0.6Y = 60$$
$$0.4Y = 60$$
$$2Y/5 = 60$$
$$Y = 60 * 5/2$$
$$Y = 150$$


text:
Q: How to prevent Android notifications from overwriting themselves? I am using XMPP (smack) to create a messaging application and I am sending notifications whenever I receive a new message. The problem is that if I receive messages from two different users I can only see the last notification. How can I change it? Here is my code.
Intent thisIntent = new Intent(mApplicationContext, ChatActivity.class);
thisIntent.putExtra("EXTRA_CONTACT_JID",contactJid);
PendingIntent contentIntent = PendingIntent.getActivity(mApplicationContext, 0, thisIntent, PendingIntent.FLAG_UPDATE_CURRENT);

NotificationCompat.Builder b = new NotificationCompat.Builder(mApplicationContext);

b.setAutoCancel(true)
        .setDefaults(Notification.DEFAULT_ALL)
        .setWhen(System.currentTimeMillis())
        .setSmallIcon(R.drawable.fab_bg_mini)
        .setTicker("Hearty365")
        .setContentTitle("New message")
        .setContentText(" You received a new message from " + contactJid)
        .setContentIntent(contentIntent)
        .setContentInfo("Info");
if(!ChatActivity.active){
    b.setDefaults(Notification.DEFAULT_LIGHTS| Notification.DEFAULT_SOUND);
}

NotificationManager notificationManager = (NotificationManager) mApplicationContext.getSystemService(Context.NOTIFICATION_SERVICE);
notificationManager.notify(1, b.build());

And as you can see I put an extra contactJid which is important to me. I need to set it in such a way that if a user clicks one notification its contactJid will be this and if another its contactJid will be another.

A: notificationManager.notify(1, b.build()); is your problem - you need to supply a unique identifier for this notification, as per the documentation:

If a notification with the same id has already been posted by your application and has not yet been canceled, it will be replaced by the updated information.

You are supplying the constant 1 for each notification, instead of a unique ID. I'd suggest using a hash of the contact JID (which I assume is a string):
notificationManager.notify(contactJid.hashCode(), b.build());


text:
Q: Rails: New entry to a model that belongs_to two other In my app, a Product has_many opinions, which are written by many clients. Here are models with associations:
class Product < ActiveRecord::Base
    attr_accessible :name, :desc, :price

    has_many :opinions
end

class Client < ActiveRecord::Base
    attr_accessible :name, :bio

    has_many :opinions
end

class Opinion < ActiveRecord::Base
    attr_accessible :rate, :comment

    belongs_to :client, :product
end

In parameters, I have the evaluation invitation id, which helps me to get both product_id and client_id (so consider I have both of them).
The form contains only the rate (radio_button, from 1 to 5) and the comment (text_field).
How does the method opinion#create create the new opinion, which belongs to two models: client and product?
I tried to pass directly client_id and product_id, but I get MassAssignment error:
# Remember: I have product_id and client_id
product = Product.find_by_id product_id

opinion = product.opinions.build params[:opinion]
opinion.product_id = product_id
opinion.client_id = client_id

opinion.save

Just in case it can be useful: in the first version of my app, the opinion belongs only to product, which works well using the above code (remove opinion.client_id = client_id line), that's why I used product to build the opinion). So, this is only an enhancement.
Any idea? Thanks in advance.

A: product.opinions.build params[:opinion] will build a new opinion that already has its product_id set to product.id. It knows to do this because of the association belongs_to :product. However, it does not yet know what client it belongs to, so you have to set this manually. But you need to add attr_accessible :client_id to Opinion to do this.


text:
Q: How to fix 'TypeError: argument of type 'URL' is not iterable' when trying to look for values in a url with aiohttp When using AIOHTTP and returning the url of a request, im trying to iterate and look for certain values in the url. If theres a certain value it has to do something with the url.
I have already tried parsing over the requrl.url using for loops but that also doesnt work. When i append the requrl.url to a list it appends the link like so: [URL('https://twitter.com/home')]
async with session.get(https://twitter.com/) as requrl:
    print (requrl.url)

    if 'home' in requrl.url:
        #do something

The expected results would be to obviously meet the condition if home is in the requrl.url but when doing through this code, the condition is not met.
The error given is TypeError: argument of type 'URL' is not iterable
Again, if i append the requrl.url to a list the list reads as so [URL('https://twitter.com/home')]
Im assuming because of the URL part it the list above when parsing it for a value it cant find do it.
Any help is appreciated!

A: Solved. Had to change the value to a string.
async with session.get(https://twitter.com/) as requrl:
    print (requrl.url)

    if 'home' in str(requrl.url):
        #do something


text:
Q: In Laravel while Seeding tables it throw error: with property [id] does not exist I can't seed table with factory(num)->create().
$user = User::factory(10)->create();

It is show me error message :

but  I can seed the table with this statement
$user = User::create([ 'name' => 'noraddin','email' => 'noordeen@gmail.com', 'password' => 'nor1234']);

Can you help with seeding by factory() method, so I don't need to entering data by hand for testing stuff?
And this is my UserFactory class

use App\Models\User;
use Illuminate\Database\Eloquent\Factories\Factory;
use Illuminate\Support\Str;

class UserFactory extends Factory
{
    /**
     * The name of the factory's corresponding model.
     *
     * @var string
     */
    protected $model = User::class;

    /**
     * Define the model's default state.
     *
     * @return array
     */
    public function definition()
    {
        return [
            'name' => $this->faker->name(),
            'email' => $this->faker->unique()->safeEmail(),
            'email_verified_at' => now(),
            'password' => '$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi', // password
            'remember_token' => Str::random(10),
        ];
    }
}

and this is migarate file of user
class CreateUsersTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('users', function (Blueprint $table) {
            $table->id()->autoIncrement();
            $table->string('name');
            $table->string('email')->unique();
            $table->timestamp('email_verified_at')->nullable();
            $table->string('password');
            $table->rememberToken();
            $table->timestamps();
        });
    }

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


text:
Q: Multiple !important class declarations and precedence Theoretically speaking, if you had this scenario:

Test

Which color should take precedence? How do browsers determine precedence in this scenario?

A: Since classes are all "equal important" when added to an element it doesn't matter in which order you assign them to your paragraph.
In this case, color in .class1 and .class2 are both declared as important, but because .class2 was declared after .class1 the browser will show your paragraph in blue, since it overwrites the declared color from .class1
Also, have a look at this: http://jsfiddle.net/3uPXx/1/
You can see it doesn't matter in which order you declare the class on your paragraph. Since both classes define the same attribute (color) it will be overwritten be the class which is declared last.
The only thing that can overwrite this is an inline-style with !important as you can see in the fiddle.

A: According to this source: http://www.boogiejack.com/CSS_4.html
class2 should override the class1 styling.

Order of Specification: As a last
  resort, when all other conflict
  resolution specifications cannot
  determine which style should take
  precedence, the last style specified
  will be the style used.

A: With two equally weighted selectors, the behavior is the same whether you apply !important to both or omit it from both.

The order of classes in the html class attribute is irrespective of each class selector's specificity level.

Test X

Test Y

Output

*

*Test X → blue

*Test Y → blue

If you use !important on just one selector class, then that one will take precedence (because it takes on a higher level of specificity).


text:
Q: Is it possible to use Mono static compilation on Windows? I was wondering if it is possible to use Mono static compilation on Windows. If so,  what should I do?

A: To statically compile your code, you use the tool `mkbundle'.
The mkbundle tool requires a cygwin setup (it needs the assembler, linker and compiler) to generate the static binary.

A: Yes it is possible,
http://www.mono-project.com/AOT#Supported_Platforms


text:
Q: why is loopback IP address from 127.0.0.1 to 127.255.255.254? I do know that 127.0.0.1 ~ 127.255.255.254 are the loopback IP addresses for most modern operating systems and we could use these IP addresses to refer to our own computer. But isn't 127.0.0.1 enough?!?! why a wide range? why from 127.0.0.1 to 127.255.255.254?

A: The 127/8 network can be used for a number of things.
1) Simulating a large number of different computers in a fast network (simply bring up more interfaces and bind services to them) without using virtual machines.  This might be helpful if you wanted to have a number of different web servers running locally on port 80 for some reason.
2) Permitting more locally running services than the 64k TCP would permit (though it seems unlikely that you would hit that limit rationally)
3) Playing games with people who aren't familiar with this factoid; "Hey, you're a loser hacker, I bet you can't even hack me.  Go ahead and try; I'm at 127.45.209.66"
Probably other things too.

A: Back when this standard was designed, it probably made sense to have as many bits in the loopback subnet as the largest classful subnet possible, which is 24 bits.  Of course we don't care about classful subnets much anymore.  This is why IPv6 merely allocates one address to this purpose.

A: http://www.ietf.org/rfc/rfc1700.txt
Back in the day, IP addresses were considered as plentiful, with entire /8 and /16 blocks being given to whoever asked for them.
Mind you, even though 127/8 is reserved, the RFC states that only 127.0.0.1/32 is ordinarily used (http://www.ietf.org/rfc/rfc3330.txt).


text:
Q: Using the request scope to store an object I'm using CFWheels to develope an application in ColdFusion.
I have a model called Vote.cfc. Before a Vote object can be created, updated, or deleted, I need to fetch a post object from another model: Post.cfc. A Vote belongs to a Post. A post has many votes.
Using data from the post object, I need to validate the vote object across multiple criteria and several functions. The only way I can think of persisting the post object so that it's available to those functions is by storing it in the request scope.
Others have said this is bad practice. But I was not able find out why. I thought the request scope was thread safe, and it would make sense to use it in this situation.
My other alternative is to load a new instance of the post object in every function that requires it. Although Wheels uses caching, doing this caused request times to spike by 250%.
UPDATE
Here's some samples. First, the controller handles looking to see if a vote object already exists. If it does, it deletes it, if it does not, it creates it. The controller function is essentially a toggle function.
Votes.cfc Controller
   private void function toggleVote(required numeric postId, required numeric userId)
    {
    // First, we look for any existing vote
    like = model("voteLike").findOneByPostIdAndUserId(values="#arguments.postId#,#arguments.userId#");

    // If no vote exists we create one
    if (! IsObject(like))
    {
        like = model("voteLike").new(userId=arguments.userId, postId=arguments.postId);
    }
    else
    {
        like.delete()
    }
}

Model VoteLike.cfc
After that, a callback registered in the model fires before validation. It calls a function that retrieves the post object the vote will belong to. The function getPost() stores the post in the request scope. It is now made available to a bunch of validation functions in the model.
// Load post before Validation via callback in the Constructor
beforeValidation("getPost");

private function getPost()
{
    // this.postId will reference the post that the vote belongs to
    request.post = model("post").findByKey(this.postId);
}

// Validation function example
private void function validatesIsNotOwnVote()
{
    if (this.userId == request.post.userId)
    {
       // addError(message="You can't like your own post.");
    }
}

The alternative to the getPost() function is to use a scoped call "this.post().userId" to get the post object, as such:
private void function validatesIsNotOwnVote()
{
    if (this.userId == this.post().userId)
    {
        addError(message="can't vote on your own post")
    }
}

But I would then have to repeat this scoped call this.post().userId for EVERY function, which is what I think is slowing down the request!

A: Update with new answer based on comment thread in OP
Since you're extending the base Vote object form VoteLike.cfc, the CFCs share a local thread-safe variables scope (so long as you're not storing this in Application or Server scope where it can be fiddled with by others). This means that you set a value, such as Variables.Post, once, and reference that in any function within the stack of CFCs.
So change your getPost() function to this:
beforeValidation("getPost");

private function getPost(){
    Variables.Post = model("post").findByKey(this.postID);
}

Now, within any function in either VoteLike.cfc, you can reference Variables.Post. This means that you have a single instance of Post in the local CFCs variables scope, and you don't have to pass it around via arguments or other scopes.
Original Answer below
The "most correct" way to handle this would be to pass the object to each individual function as an argument. That, or add the Post as a property of the Vote object, so that the Vote object has access to the full Post object.
<cffunction name="doTheValidation">
    <cfargument name="ThePost" type="Post" required="true" />
    <cfargument name="TheVote" type="Vote" required="true" />
    <!--- do stuff here --->
</cffunction>

The reason this is a bad practice is because you're requiring that your objects have access to an external scope, that may or may not exist, in order to do their work. If you decided that you wanted to deal with multiple votes or posts on a single page, you then have to fiddle with the external scope to get things to work right.
You're far better off passing your object around, or using composition to piece your objects together in such a fashion that they're aware of each other.
Update
Regarding performance issues, if you use composition to tie your objects together, you end up with just two objects in memory, so you don't have to instantiate a bunch of unnecessary Post objects. Also, passing a CFC into a function as an argument will pass the CFC by reference, which means that it's not creating a duplicate of the CFC in memory, which should also take care of your performance concerns.
Code Sample Update
To illustrate the "by reference" comment above, set up the following files and put them in a single directory on their own.
TestObject.cfc:
<cfcomponent output="false">
    <cfproperty name="FirstName" displayname="First Name" type="string" />
    <cfproperty name="LastName" displayname="Last Name" type="string" />

</cfcomponent>

index.cfm:
<!--- Get an instance of the Object --->
<cfset MyObject = CreateObject("component", "TestObject") />

<!--- Set the initial object properties --->
<cfset MyObject.FirstName = "Dan" />
<cfset MyObject.LastName = "Short" />

<!--- Dump out the object properties before we run the function --->
<cfdump var="#MyObject#" label="Object before passing to function" />

<!--- Run a function, sending the object in as an argument, and change the object properties --->
<cfset ChangeName(MyObject) />

<!--- Dump out the object properites again, after we ran the function --->
<cfdump var="#MyObject#" label="Object after passing to function" />

<!--- Take a TestObject, and set the first name to Daniel --->
<cffunction name="ChangeName">
    <cfargument name="TheObject" type="TestObject" required="true" hint="" />
    <cfset Arguments.TheObject.FirstName = "Daniel" />
</cffunction>

You'll notice when you run index.cfm, that the first dump has the FirstName as Dan, while the second has the FirstName as Daniel. That's because CFCs are passed to functions by reference, which means that any changes made within that function are made to the original object in memory. Hence no recreation of objects, so no performance hit.
Dan

A: request is a global scope, confined to the page request (i.e. thread safe), that lives for the duration of that page request. So it's bad practice in the same way that global variables are a bad practice, but of a short lived duration. I think of it as throwing the data up in the air or over the fence in the situation you described, where any other code can just pluck out of mid air.
So for your situation it's probably just fine - add some useful reference at the point of consumption perhaps about where the data's being placed into the request scope in the first place. That stated, if you are going back to the same source method each time , consider caching inside whatever function is responsible creating that object therein (e.g. getVote()) And, you could use the request scope for that as such:
<cfparam name="request.voteCache" default="#structNew()#"/>
<cffunction name="getVote" output="false" access="public" returntype="any">
    <cfargument name="voteId" type="string" required="true"/>
    <cfif structKeyExists(request.voteCache, arguments.voteId)>
        <cfreturn request.voteCache[arguments.voteId]>
    </cfif>

    <!--- otherwise get the vote object --->
    <cfset request.voteCache[arguments.voteId] = vote>
    <cfreturn vote>
</cffunction>

Downside is if something else changes the data during the request you'll have a stale cache, but it appears you don't expect any changes during the execution.


text:
Q: The Boolean algebra associated to a Stone space contains only principal ultrafilters This is a needed fact in order to prove Stone's Representation Theorem, but I'm struggling to prove it. I tried using the fact that every two points on a Stone space can be separated by disjoint clopen sets and the fact that every non-principal ultrafilter contains only infinite sets to construct a contradiction, but I couldn't do it.
Edit: Given a Stone space $T$, define its associated Boolean algebra as the algebra of clopen sets in $T$. On the other side, given a Boolean algebra $B$ define its associated Stone space as the set of Ultrafilters in $B$, in which each basic open set is the collection of all ultrafilters containing a certain element of $B$.
We (firstly) need to prove that every Stone space $T$ is homeomorphic to $SB(T)$ (which is the Stone space associated to the Boolean algebra associated to $T$). The homeomorphism takes each element in $T$ and assigns it to the principal ultrafilter generated by this element. Using the fact that every two distinct points in $T$ can be separated by disjoint clopen sets one can prove that this function is injective. I'm having trouble on the next step.

A: When you say "the Boolean algebra associated to a Stone space contains only principal ultrafilters", I guess you mean that for every ultrafilter $U$ on $Cl(S)$ (the Boolean algebra of clopen subsets of the Stone space $S$), there is some point $x$ in $S$ such that $U = \{X\in Cl(S)\mid x\in X\}$.
Terminological quibble: I'm not sure I would call such an ultrafilter "principal". I would reserve the term "principal ultrafilter" for an ultrafilter on a powerset algebra (i.e. $\{X\in \mathcal{P}(S)\mid x\in X\}$), or (more generally) for an ultrafilter on an abstract Boolean algebra $B$ which is of the form $(\uparrow b) = \{a\in B\mid b\leq a\}$ when $b$ is an atom. But unless $S$ is finite, $Cl(S)$ is not the full powerset algebra, and for many Stone spaces it will have no atoms, and hence no principal ultrafilters in my sense. For your notion, I would prefer to say that every ultrafilter on $Cl(S)$ is the restriction of a principal ultrafilter on $\mathcal{P}(S)$ along the inclusion $Cl(S)\to \mathcal{P}(S)$.
Now for how to prove it: Let $U$ be an ultrafilter on $Cl(S)$. Use compactness to show that $\bigcap_{X\in U} X$ is nonempty (take the complement of this big intersection...), and use total disconnectedness and the fact that $U$ is an ultrafilter to show that $\bigcap_{X\in U} X$ contains at most one point.

A: You are confusing two things here. Unless the Stone space in question has isolated points, there will be no principal ultrafilters on the Boolean algebra of clopen sets. Every ultrafilter is the ultrafilter of sets containing given point, yes, but it is not principal.
Under the Stone correspondence, ultrafilters correspond to points. A principal filter corresponds to a clopen set. A principal ultrafilter corresponds to a clopen, i.e. isolated point.
In other words, every point in the Stone space give you an ultrafilter, but it will only be principal if the point is isolated.
The point is that the intersection of every ultrafilter, principal or not, is a single point, or rather, pendantically speaking, the singleton of a single point. It follows from the fact that you have compactness on clopen sets (to have a point in the intersection) and the fact that clopen sets separate points (to have no more than one point in the intersection). But typically, this singleton is not a clopen set, so not a member of the algebra.

A: Let $X$ be a Boolean space, i.e. compact Hausdorff and having a base of clopen sets.
You want to see that every ultrafilter $\mathcal{U} \subset \operatorname{Clop}(X)$ is determined by a point,i.e. there is some $p \in X$, such that
$$\mathcal{U} = \{ A \in  \operatorname{Clop}(X): p \in A \}$$
Recall that the Boolean Algebra $\operatorname{Clop}(X)$ has $\cap,\cup$ and complementation as its BA operations, and an ultrafilter on a BA is a maximal  subset of the BA (by inclusion) which is, non-empty, upwards closed and closed under finite meets and does not contain $0$ (here $\emptyset$).
This immmediately implies that $\cap\{A \in \mathcal{U}\}$ is non-empty, as the members of $\mathcal{U}$ form a family of closed sets with the finite intersection property (see wikipedia) in a compact space (from having finite meets (intersections, here) and $\emptyset \notin \mathcal{U}$) . Suppose that the intersection contains two points $p \neq q$ of $X$. By Hausdorffness and having a base of clopen sets, there are $U_p, U_q$ clopen in $X$ such that $p \in U_p$, $q \in U_q$ and $U_p \cap U_q = \emptyset$. Then as we have an ultrafilter (see here under Boolean algebra) we know that either $U_p \in \mathcal{U}$ or $X \setminus U_p \in \mathcal{U}$.
In the former case, $q \notin \cap\{A \in \mathcal{U}\}$ , in the latter $p \notin \cap\{A \in \mathcal{U}\}$, which is contrary to the original assumption that both were in the intersction. So $\cap\{A \in \mathcal{U}\}$ can only have a single point, say $p$.
By the same type of argument ,any clopen set $C$ with $p \in C$ is in $\mathcal{U}$ (it contains either $C$ or $X \setminus C$, but $p$ must be in it). So we have the equality from the beginning: $\mathcal{U}$ is determined by $p$.
Now, if $X$ is any Boolean space (as defined above), we define the map
$$F : X \rightarrow \operatorname{Stone}(\operatorname{Clop}(X)) \text{ by }
F(x) = \{A \in \operatorname{Clop}(X): x \in A\}$$
Then we have just shown above that $F$ is a surjection: any element of $\operatorname{Stone}(\operatorname{Clop}(X))$, which is by definition an ultrafilter in the Boolean Algebra $\operatorname{Clop}(X)$ is in the image of $F$. The 1-1 ness follows from $X$ being Hausdorff again: if $x \neq y$ find separating clopen sets $x \in C_x, y \in C_y, C_x \cap C_y = \emptyset$. Then $C_x \in F(x), C_y \in F(y)$ by definition, and so by disjointness $C_y \notin F(x), C_y \notin F(x)$, showing that $F(x) \neq F(y)$ (we found two points of $\operatorname{Clop}(X)$ to distinguish the two subsets $F(x)$ and $F(y)$ of it).
By compactness and Hausdorffness of $X$ and $\operatorname{Stone}(\operatorname{Clop}(X))$ rspectively, we only need to show continuity of $F$ to get a homeomorphism between them.
This is clear because the definition of the topology on a stone space $\operatorname{Stone}(A)$ of any Boolean Algebra $A$, is that a (clopen in fact)
base for its topology is given by all sets of the form
$$B(a) = \{\mathcal{U} \in \operatorname{Stone}(A): a \in U\}$$
where the $\mathcal{U}$ are ultrafilters on $A$, and $a$ ranges over all elements of $A$. For continuity of $F$, it suffices to check that any
basic set $B(C)$ of $\operatorname{Stone}(\operatorname{Clop}(X))$, where $C \subset X$ is clopen (we apply the above to $\operatorname{Clop}(X)$ whose points are clopen subsets of $X$):
$$x \in F^{-1}[B(C)] \leftrightarrow F(x) \in B(C) \leftrightarrow F(x) \in \{\mathcal{U} \in \operatorname{Stone}(\operatorname{Clop}(X)): C \in \mathcal{U}\} \leftrightarrow \\
 C \in F(x) \leftrightarrow x \in C$$
So that $F^{-1}[B(C)] = C$ is indeed open, and continuity has been shown.


text:
Q: Difficulty deleting registry keys under HKEY_Local_Machine\System\CurrentControlSet\Enum\USBSTOR We are able to create and delete other registry keys but unable to delete subkeys under HKEY_Local_Machine\System\CurrentControlSet\Enum\USBSTOR. We've tried it on Windows 10 Enterprise where we are in the Administrators group as well as a command prompt and regedit in administrator mode. We have also tried it on Windows 10 Home editions but to no avail.
Has anyone else run into this? Anyone have a solution?

A: @John's link is my answer because that tool is amazing and will ultimately be part of my solution. thanks for all the advice!
https://www.sciencedirect.com/topics/computer-science/window-registry

A: Enum\USBSTOR is a list of devices plugged into the computer. I use USB but do not have the keys. It may depend on the particular computer.
It also may not be on my machine because of cleanups and/or no USB errors.
Here is a good article on the USBSTOR properties
USBSSTOR (Science Direct Topics

Connected USB Devices Windows® keeps a history of all connected USB
removable storage devices (thumb drives, iPods, digital cameras,
external HDD, etc.). This information is vital to know which devices
were previously (or currently) connected to the suspect's machine and
by which user.
Windows® stores USB history-related information using five registry
keys, and each one offers a different set of information about the
connected device. When combining this information, investigators can
formulate a clear view of how a suspect has used removable storage to
commence an incident.

A: You can obtain PsExec utility from learn.microsoft, This allows you to run a process with with System permissions.
You can use it to run RegEdit as System and manually delete mentioned keys in the registry, use the following cmd command:
PsExec.exe -s -d -i "C:\Windows\regedit.exe"

*

*-s    Run the remote process in the System account.

*-d    Don't wait for process to terminate (non-interactive).

*-i    Run the program so that it interacts with the desktop of the specified session on the remote system. If no session is specified the process runs in the console session. This flag is required when attempting to run console applications interactively (with redirected standard IO).


text:
Q: change chartSeries margin is being cut off Below are the left and right margins for my chartSeries

You can see the yaxis is being cut off.  How do I adjust the margin so the entire number appears.
   chartSeries(mydata, major.ticks = "minutes", TA=myTA, pars.text= list(mar = c(10,10,10,10) ))

I tried to do pars.text= list(mar = c(10,10,10,10) )  but that does not work. Thank you.


text:
Q: Simple data structure in tiddlywiki I would like to use TW to keep track of the genealogy of some characters in a story.
I would like each character tiddler to have a couple of standard fields: father, mother, date-of-birth, sex, spouse, children
I am trying to figure out how to have some sort of form which it would create the fields automatically when I create a new character tiddler.
I found a couple of relevant tutorials but they are very outdated and in the end they confused me more.
Any help is really appreciated.

A: Really late, however, check out Memory Keeper, a genealogical solution, that can be used to define characters or real people. You could define events (scenes) and places (settings)—all in TiddlyWiki.
You could write your story in this too.
http://craigsturgeon.com/mk/help/mkhelp.html
An example usage:
http://craigsturgeon.com/mk/example/Churchill-Example.html

A: Make a characterTiddler, add those fields you said and add the characterTags Save it as $:/_newCharacter.
Then have a tiddler that is used to create new characters add a button that uses the characterTiddler as a template.
In the body of the Character Dashboard type:
//This will make a button that creates your tiddler//
<$button message="tm-new-tiddler" param="$:/_newCharacter">
New character
</$button>
//This is make a list of all tiddlers with the characterTags//
<<list-links "[!is[system]tag[characterTags]">>


text:
Q: Svelte: refs undefined I'm using Svelte (v2.7) and Sapper (v0.12). According to the docs, this.refs should be available, but it's undefined for me, both in oncreate and custom methods.
My index.html looks like this:
<select id="wifi-ssid" ref="wifi-ssid">
...

<script>
    export default {
        oncreate() {
            console.log('this.refs is undefined here', this.refs);
        },
        methods: {
            getIsValid() {
                console.log('this.refs is undefined here too', this.refs);
                // ...
            },
            // ...
        }
    };
</script>

(Full code here).
I'm presuming this isn't a bug (otherwise everyone would have run into it?) and I've got something wrong as it's my first time using it.

A: This is deprecated, I believe the new syntax is <select bind:this={wifissid}>

A: The syntax for a ref directive is ref:name, rather than ref="name". It must be a valid JavaScript identifier, e.g. <select ref:wifissid> rather than wifi-ssid.
The refs object isn't created if no refs are declared.


text:
Q: Reverse engineer Amiga monitor files The files found in Devs:Monitors in AmigaOS, what do they contain?
What is their internal format?  How do you go about patching one or creating one from scratch?

A: The Amiga program MonEd (http://aminet.net/package/driver/moni/MonEd3a) is an editor for these files. It comes with source, which may well indicate something about the structure.
It also notes:

Then click on save to store this information in the TOOL TYPES of monitor which is stored in DEVS:Monitors/

which may have something to do with the file size.

A: They are the monitor drivers for AmigaOS and contain the various parameters needed to interface the Amiga to different displays.  As far as the internal format goes, I've no idea, there may be something in the old RKM manuals or the Amiga Developer CD.


text:
Q: PHP Striping/Exporting single strings from an array I have an array, like this:
)array (
  'date' => '2015-12-10T00:16:58+0000',
  'from' =>
  array (
    'name' => 'Joe Bloggs',
    'user_id' => 3220562,
  ),
  'message' => ':ip=1.1.1.1',
)

And here's my code:
$string = var_export($h, true);
echo $string;

And finally, here's what I would like to achieve:
I would like to export single strings from the array (for example I want to export 'message', and then I would get an output of ":ip=1.1.1.1").
I have tried things like $h['message'] and this doesn't work, so I'm just wondering what's the easiest / cleanest way to do this.
Any help would be greatly appreciated.


text:
Q: Preserving the links between files when exporting multiple powerpoint files to PDF files I have a presentation with many rich slides (about 150) and many internal links to navigate between the slides. The internal links are preserved when exporting the file to PDF (I provide the presentation in PDF, not in PPTX).
The problem is that Powerpoint tend to be unresponsive (mainly when saving or autosaving, it can take 10 seconds) as this presentation gets bigger and bigger. So I'd like to split it into several smaller files. I can edit the links when needed to transform them to crosslinks (from one file to another), but the cross-links are broken once the files are exported to PDF: they point to the original PPTX files and not to the PDF files...
Question: is there a way to have the crosslinks automatically updated to point to the PDF files (and ideally to point to specific slides of the files)? This somehow assumes that the Powerpoint export function has the ability to process several PPTX files as a group, and I can't see such a feature. Optionally, a single final PDF file would be OK, as large PDF file are not a problem.


text:
Q: AWK: What is the regular expression to match any string?
I assume the regular expression would be the same in any case (eg:
  grep), but I am testing this using awk.

Case example:
$ cat Test.csv
2018-03-31,22:39,Test,2,4,2
2018-03-31,22:40,Test02,2,4,2
2018-03-31,22:40,Test03,2,4,2
2018-03-31,22:40,Test04,2,4,2
2018-03-31,22:59,Test03,5,4,2
2018-03-31,23:00,Test07,6,4,2
2018-03-31,23:00,Test08,2,2,2

I would like to know how to match any value (any string) at, say, field 3:
$ awk -F ',' '$3 == *' Test.csv
awk: syntax error at source line 1
 context is
        $3 == >>>  * <<<
awk: bailing out at source line 1

-
$ awk -F ',' '$3 == .*' Test.csv
awk: syntax error at source line 1
 context is
        $3 == >>>  . <<< *
awk: bailing out at source line 1

-
$ awk -F ',' '$3 == /*/' Test.csv
awk: illegal primary in regular expression * at
 source line number 1
 context is
        $3 == >>>  /*/ <<<

-
$ awk -F ',' '$3 == /.*/' Test.csv
[No results]

-
$ awk -F ',' '$3 == /^*/' Test.csv
[No results]

Even when there could be other methods to solve the problem, how can I match every possible string by using regular expressions at a specific field (CSV assumed) by using AWK?
If possible, it could be useful some method to include the NUL string (for empty fields like 2018-03-31,23:00,,2,2,2) so AWK returns every line.

Why do I need this?

(upon requestion; a bit awkward to explain, sorry; only for those
  interested)

Basically for code simplification (readability). My shell script is structured in a manner that I would prefer to execute the search like this:
awk -F ',' -v AL__AWK="$AL" -v VL__AWK="$VL" -v DL__AWK="$DL" -v Codigo__AWK="$Codigo" -v SubCodigo__AWK="$SubCodigo" '$4 == AL__AWK && $5 == VL__AWK && $6 == DL__AWK && $8 ~ Codigo__AWK && $9 ~ SubCodigo__AWK' "$LogFile"

As can be seen (er... or so I hope) the search for fields inside the CSV file is variable-based. Some of these variables are initialized with a specific value and some come from parameter input. So, having a generic "any string" value would prevent me from writing this AWK line in multiple different manners.
I.E: Sometimes the script will receive the Codigo=Ptt value via input parameter , and some the Codigo variable will not be defined by parameter inputing; in this second case, I will do Codigo=".*", so the above AWK line will still be valid.
Sorry, but the complete explanation is very long.

A: As easy as (note the ~ instead of the == operator):
$ awk -F ',' '$3 ~ /.*/' Test.csv
2018-03-31,22:39,Test,2,4,2,,,
2018-03-31,22:40,Test02,2,4,2,,,
2018-03-31,22:40,Test03,2,4,2,,,
2018-03-31,22:40,Test04,2,4,2,,,
2018-03-31,22:59,Test03,5,4,2,,,
2018-03-31,23:00,Test07,6,4,2,,,
2018-03-31,23:00,Test08,2,2,2,,,

Without explaining the reasons to do this kind of search (original poster told it was harsh to describe), it seems just some sort of academic question, but I guess someone could probably need it someday.
For the case (as explained on the question) of using variables as a pattern:
$ foo="03"
$ awk -F ',' -v foo__AWK="$foo" '$3 ~ foo__AWK' Test.csv
2018-03-31,22:40,Test03,2,4,2,,,
2018-03-31,22:59,Test03,5,4,2,,,

$ foo=".*"
$ awk -F ',' -v foo__AWK="$foo" '$3 ~ foo__AWK' Test.csv
2018-03-31,22:39,Test,2,4,2,,,
2018-03-31,22:40,Test02,2,4,2,,,
2018-03-31,22:40,Test03,2,4,2,,,
2018-03-31,22:40,Test04,2,4,2,,,
2018-03-31,22:59,Test03,5,4,2,,,
2018-03-31,23:00,Test07,6,4,2,,,
2018-03-31,23:00,Test08,2,2,2,,,

$ foo=""
$ awk -F ',' -v foo__AWK="$foo" '$3 ~ foo__AWK' Test.csv
2018-03-31,22:39,Test,2,4,2,,,
2018-03-31,22:40,Test02,2,4,2,,,
2018-03-31,22:40,Test03,2,4,2,,,
2018-03-31,22:40,Test04,2,4,2,,,
2018-03-31,22:59,Test03,5,4,2,,,
2018-03-31,23:00,Test07,6,4,2,,,
2018-03-31,23:00,Test08,2,2,2,,,

So, .* works like `` as "match any pattern" regexp.

A: @SopalajodeArrierez now I see your rationale I understand what it is you're trying to do and you don't need to come up with a regexp that matches any string, your unset shell variable already IS such a regexp. Look:
$ echo 'a' | awk -v x='.*' '$1 ~ x'
a

$ echo 'a' | awk -v x='' '$1 ~ x'
a

So if your shell variable is unset, just leave it unset as any string will partially match the null string on a regexp comparison.


text:
Q: Read JAVA text file and get total for each ID I'm a Java beginner.. So please keep that in mind when answering this question.
I have a basic knowledge of Java but don't have a clue how to start this?
(I know this is not a general question. But I can't wrap my head around this)
I have a text file like this
ID AMOUNT

001 20.20
002 10.20
003 11.10
003 15.20
002 10.56
001 42.52
001 45.00
004 94.36
005 86.25
005 45.36
004 12.66
006 45.36
006 123.32
002 125.22
001 85.22

I need to generate a out put file with total value for each ID
Example -
001 192.94
002 145.98......

I'm able to read line by line using JAVA scanner and while loop..
Please give me a simple code to do this...

A:
I'm able to read line by line

Then

*

*Create a Map<Integer, Double> that will hold your values

*Read line by line then use String.split to split your string by whitespaces to get the id and the amount

*Parse the id as an Integer and the amount as a Double

*Search for the id in your map. If it already exists get the amount to the specified id and add the new amount to it

*Otherwise add a new entry that will have the new id and the amount

A: Will give you a hint, read from text file using InputStream, Put ID in a map key, and value in value, upon getting same key again, retrieve old value, add new value and put in map again.
Now, you should be able to figure out as you said you have basic java knowledge.

A: 1) Read the file using Scanner.
2) Split the line using String.split
3) Use a dataStructure like a Hashmap to store key,value pairs.
The key looks unique to me. If so, add the next available value.
HashMap
Note: You can expect to get best guidelines to your question, but No one is going to 'write' code for you!


text:
Q: Unable to connect to my mail Server (java) public class ConnectGmail {

  public static void main(String args[]) throws Exception {

    PasswordAuthentication authentication;

    Properties props = System.getProperties();
    props.setProperty("mail.store.protocol", "imap");

    Session session = Session.getDefaultInstance(props);
    Store store = session.getStore("imap");

    try {

      store.connect(host , user , "password");
    } catch (Exception e) {
      e.printStackTrace();
    }
  }
}

Got this ERROR .. I almost tried with all the protocol
javax.mail.MessagingException: Connection refused: connect;
  nested exception is:
    java.net.ConnectException: Connection refused: connect
    at com.sun.mail.imap.IMAPStore.protocolConnect(IMAPStore.java:571)
    at javax.mail.Service.connect(Service.java:288)
    at javax.mail.Service.connect(Service.java:169)
    at ConnectGmail.main(ConnectGmail.java:26)

any help ??

A: You need to enable the mail authentification before you can use it:
Set property mail.smtp.auth to true to enalbe authentification.

If true, attempt to authenticate the user using the AUTH command. Defaults to false.

@see Javadoc of Package com.sun.mail.smtp

A: Does your ISP allow you to connect to that port?
Do you have to go through a proxy?
Try opening a direct connection to the mail server with the right port using a simple telnet <host> <port> command. If you can't then it's not your connection that fails, it's your ISP that disallows it. If you can, check if you use specific proxy options and add them in your program.


text:
Q: Changing name servers for website only I want to change the nameservers in 123-reg so that the website points to my webserver, but the email is being hosted by someone else.
Should I leave the @ and Mail records pointing to the present email hosting provider and just update the nameservers? Or should I add my nameservers to the records also?

A: Change @ and www to point your webserver(or only www, if don't use only domain name).
Do not change MX(mail) record, If you do not want to change ISP mail.


text:
Q: How to display the single-product page in full width woocommerce? a link for the single product page:
http://umsi.me/uniikmedia/?product=versailles-courtyard
I wanted to know if there is a way to sterch the product summary drop down menus all the way to the right without affecting the mobile site?
thank you,

A: I am not sure if this is what you wanted
#content-shop{width:100%}

This css will move the product dorpdown all the way to right side


text:
Q: Get SPListItem in another format I want to get different Rows from an SPListItem. I'll show you my problem with an example.
This code
Console.WriteLine(SPItemName["Created By"]);
or
Console.WriteLine(SPItemName["Created By"].ToString);

returns "8;UserName" (8 is the User ID).
If I look up the row in SharePoint Designer, i can choose even a format for this data field.
So i could get the html code of this field.
How to set the format (like html code or text) of a datafield in c#?
thanks

A: Use Either SPFieldLookupValue
If you need just the username, use SPFieldLookupValue to seperate id from value:
var userValue = new SPFieldLookupValue(SPItemName["Created By"] as string)
Then you can:

*

*userValue.LookupValue to return UserName

*userValue.LookupId to return Id

Or SPFieldUserValue
Or better yet, you can create SPFieldUserValue object to access any other user properties like email, login name, etc..
SPFieldUserValue objUserFieldValue = new SPFieldUserValue(web, SPItemName["Created By"].ToString());

Afterwards you can use:
objUserFieldValue.User.LoginName;
objUserFieldValue.User.Name;
objUserFieldValue.User.ID;
objUserFieldValue.User.Groups;
objUserFieldValue.User.Roles;
objUserFieldValue.User.Email;
objUserFieldValue.User.Sid;
objUserFieldValue.User.UserToken;

http://www.sharepointkings.com/2009/04/spfielduservalue-and.html
Note: to create SPFieldUserValue you must pass reference to web, that's because SharePoint has to get additional user information from user information list to construct SPFieldUserValue object.


text:
Q: JQuery: addClass not working on element with multiple classes. Why? I'm puzzled! This is very frustrating. This is part of some code written for a form.  The input element that is associated with a validation error should display a red border. It works with the .css method, but I'd be grateful if someone could show me why the .addClass method isn't working.

...
Email Address

            <input id="element_1" name="email" class="element text medium" type="text"/>
                {% if form.email.errors %}

{{form.email.errors}}

                {% endif %}

                      ..etc..

If assign "element_1" only one class, it works just fine.
I can also do this instead:
$('.field_error').siblings().css("border", "1px solid red");

However, I plan on adding a lot of content to the class I will add.  Is there a way to get the addClass method to work?
Thanks!!
Matt
IMPORTANT EDIT
I forgot to add in the multiple classes on my code. No wonder some people are confused.  Please review code again.
<input id="element_1" name="email" class="element text medium" type="text"/>

Solved
The problem was that I had css file that defined the borders of the text input element already.  Fixed now. Thanks to all who brain stored with me.

A: Works for me: http://jsfiddle.net/JAAulde/KPckC/1/ (updated with your multiple class correction)
You do have a typo in your code, though:
<input id="element_1" name="email" class="element type="text"/>

should be
<input id="element_1" name="email" class="element" type="text"/>

Maybe that exists in your live site?


text:
Q: Does a user become a Meta moderator by default the moment when he or she becomes a mod for SO? I just saw 2014 SO election was ending with fire crackers. Two out of 3 mods were extremely familiar faces in SO. I noticed now both of them have SO as well as Meta diamonds...the moderator status.
Does it mean, when one is elected as a mod for SO, that person becomes a Meta mod by default?

A: As the Meta About page says:

Any community moderator from Stack Overflow is also a moderator here.

However, the process is not automatic, AFAIK. As Yannis mentions in a comment on related question, a part of this process is manual and diamonds are awarded manually.
The reason for this is mentioned in the answer by BoltClock's a Unicorn (on the same question):

Meta Stack Overflow is currently a separate Stack Exchange site from Stack Overflow, and they're not exactly linked in the same way as other Stack Exchange sites (like the other trilogy sites, or the other SE 2.0 sites) are linked to their per-site metas.
As such, users who are promoted to moderators on SO won't automatically have diamonds on MSO; they have to be manually appointed in order to receive their meta-diamonds here. And that will come in a bit.

A: Yes.  Elected mods for a site are made mods on the corresponding meta site.


text:
Q: What does it mean to "Implement an empty logic" for a function in ue4? I'm following a tutorial for setting up a character interaction, and part of it says to make a header file with the following code:
public:
/*This property will be used in order to bind our subtitles
Binding will make sure to notify the UI if the content of the following
variable change.*/
UPROPERTY(BlueprintReadOnly)
FString SubtitleToDisplay;

/*Updates the displayed subtitles based on the given array*/
UFUNCTION(BlueprintCallable, Category = DialogSystem)
void UpdateSubtitles(TArray<FSubtitle> Subtitles);

/*This array will populate our buttons from within the show function*/
UPROPERTY(VisibleAnywhere, BlueprintReadWrite)
TArray<FString> Questions;

/*Adds the widget to our viewport and populates the buttons with the given questions*/
UFUNCTION(BlueprintImplementableEvent, BlueprintCallable, Category = DialogSystem)
void Show();

Then, it tells me to "Implement an empty logic for the UpdateSubtitles function for now." I have no idea what this means, and considering that UpdateSubtitles was the one thing to give me an error when I compiled this code, it's probably something important. Does anyone know what this terminology refers to?

A: It means to just leave the contents of the function blank or return an empty result such as:
FString AMyCharacter::GetNickname()
{
    return "";
}

in the case where the return type isn't void.

A: I figured it out thanks to your comment! However it was a little different than what you described, it was actually:
void UDialogUI::UpdateSubtitles(TArray<FSubtitle> Subtitles)
{}
And only this line; adding a definition for Show() as suggested actually threw an error.


text:
Q: How to run application from war? I have a big war file, that contains many classes with main method.
How I can point Java to run main specific class?

A: Exactly like running application from jar file:
java -cp yourwarfile.war com.yourcompany.YourMainClass


text:
Q: Adding any number of integers in spring boot application using postman I want to add any number of integers in spring boot application. I have made application which can add two integers but i want to add any number of integers.Below is the code for two integers. Input and output is given using postman.
My Helloworld.java controller class :-
 package com.example.HelloWorld.controller;

import com.example.HelloWorld.model.Numbers;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
 @RestController
public class HelloWorldController
 {

  @PostMapping(path = "/addition", consumes = "application/json", produces = "application/json")
  public int addMember(@RequestBody Numbers number) {
    //code

    int num = number.getNumber_One();
    int numTwo = number.getNumber_Two();
    System.out.println("NUMBERs :: "+ num + " "+ numTwo);
    return num+numTwo;

  }

}

Numbers.java POJO is

package com.example.HelloWorld.model;

public class Numbers {
public int number_One;
public int number_Two;

public int getNumber_One() {
    return number_One;
}

public void setNumber_One(int number_One) {
    this.number_One = number_One;
}

public int getNumber_Two() {
    return number_Two;
}

public void setNumber_Two(int number_Two) {
    this.number_Two = number_Two;
    }
}

A: Why don't you change your POJO like:
public class Numbers {

    private List<Integer> numbers;

    public List<Integer> getNumbers() {
        return numbers;
    }

    public void setNumbers(List<Integer> numbers) {
        this.numbers = numbers;
    }
}

And you can send a JSON request like:
{
    "numbers": [1, 2, 3, 4]
}

Your controller, if you want to sum the numbers, could look like:
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class HelloWorldController {

    @PostMapping("/addition")
    public int addMember(@RequestBody Numbers numbers) {
        return numbers.getNumbers().stream().reduce(0, Integer::sum);
    }

}


text:
Q: Python multiprocessing: Process object not callable So, recently, I've been experimenting with the multiprocessing module. I wrote this script to test it:
from multiprocessing import Process
from time import sleep

def a(x):
    sleep(x)
    print ("goo")

a = Process(target=a(3))
b = Process(target=a(5))
c = Process(target=a(8))
d = Process(target=a(10))

if __name__ == "__main__":
    a.start()
    b.start()
    c.start()
    d.start()

However, when I try to run it, it throws this error:
goo
Traceback (most recent call last):
  File "C:\Users\Andrew Wong\Desktop\Python\test.py", line 9, in <module>
    b = Process(target=a(5))
TypeError: 'Process' object is not callable

...And I can't tell what's going on.
Does anyone know what happened, and how I can fix it?

A: Pass arguments to the function that is ran by a Process is done differently - looking at the documentation it shows:
from multiprocessing import Process

def f(name):
    print 'hello', name

if __name__ == '__main__':
    p = Process(target=f, args=('bob',)) # that's how you should pass arguments
    p.start()
    p.join()

Or in your case:
from multiprocessing import Process
from time import sleep

def a(x):
    sleep(x)
    print ("goo")

e = Process(target=a, args=(3,))
b = Process(target=a, args=(5,))
c = Process(target=a, args=(8,))
d = Process(target=a, args=(10,))

if __name__ == "__main__":
    e.start()
    b.start()
    c.start()
    d.start()

Addition:
Good catch by Luke (in the comments below) - you're overriding the function a with the variable name a when doing:
a = Process(target=a, args=(3,))

You should use a different name.


text:
Q: Wondering why my JQuery array loop is not setting my href's correctly So let me give you an idea of what I am doing. This is some homework I am working on and now have become stuck. I am creating a page wherein you can select from a bunch of different check boxes. Depending on the check boxes you can click on a "show resources" button that I have programmed to open a new window with the corresponding check boxes to show their values, their values also being the URL to those particular resources. Sounds easy right? Here is the basic structure of things.

//this is the main function that is making an array of the checked check boxes and displying them on the new window, problem is I am only able to set the href attibute to only the first array item...
$(function() {
    $(":checkbox").change(function() {
      var arr = $(":checkbox:checked").map(function() { return $(this).val(); }).get();
            $("#messagepop").html('' + arr.join('
') + '');
      for (var i = 0; i < arr.length; i++){
        $("#resourceLink").attr('href', arr[i]);
      }
    });
  });

//these are functions for the new window
  function deselect(e) {
  $('.pop').slideFadeToggle(function() {
    e.removeClass('selected');
  });
  }

  $(function() {
    $('#contact').on('click', function() {
      if($(this).hasClass('selected')) {
        deselect($(this));
      } else {
        $(this).addClass('selected');
        $('.pop').slideFadeToggle();
      }
      return false;
    });

    $('.close').on('click', function() {
      deselect($('#contact'));
      return false;
    });
  });

  $.fn.slideFadeToggle = function(easing, callback) {
    return this.animate({ opacity: 'toggle', height: 'toggle' }, 'fast', easing, callback);
  };
.messagepop {
  background-color:#FFFFFF;
  border:1px solid #999999;
  cursor:default;
  display:none;
  margin-top: 15px;
  position:absolute;
  text-align:left;
  width:394px;
  z-index:50;
  padding: 25px 25px 20px;
}

label {
  display: block;
  margin-bottom: 3px;
  padding-left: 15px;
  text-indent: -15px;
}

.messagepop p, .messagepop.div {
  border-bottom: 1px solid #EFEFEF;
  margin: 8px 0;
  padding-bottom: 8px;
}

Resources

(Select the resources you wish to receive information about. Click on the "Show Resources" button when you are ready)

    <form action="">
      <input type="checkbox" value="https://google.com/search?q=CareerPreparation">Career Preparation

      <input type="checkbox" value="https://google.com/search?q=CollegeAdvising">College Advising

      <input type="checkbox" value="https://www.google.com/search?q=financial+aid">Financial Aid

      <input type="checkbox" value="https://www.google.com/search?q=fitness+recreation">Fitness & Recreation

      <input type="checkbox" value="https://www.google.com/search?q=health+services">Health Services

      <input type="checkbox" value="https://www.google.com/search?q=housing">Housing

      <input type="checkbox" value="https://www.google.com/search?q=library">Library

      <input type="checkbox" value="https://www.google.com/search?q=parking">Parking

      <input type="checkbox" value="https://www.google.com/search?q=housing">Scholarships

      <input type="checkbox" value="https://www.google.com/search?q=student+employment">Student Employment

      <input type="checkbox" value="https://www.google.com/search?q=student+organization">Student Organizations

      <input type="checkbox" value="https://www.google.com/search?q=tutoring">Tutoring Support

      <input type="checkbox" value="https://www.google.com/search?q=writing">Writing Support

    </form>

Close

Show Resources

So the problem that I am running into is that I am not able to correctly set the href attributes on the new  tags that are being shown in the new div window. The kicker for all of this is that I have to make an array with the checked checkboxes and have them link to their appropriate resources.
So the real question is, what am I missing? I can see that the array has the right element links, so why are they not showing up on the rest of the displayed elements. Hope this makes sense, please let me know if what I am showing you here is confusing or if I need to clarify, thanks!

A: You are setting same ID to multiple elements and that's a SIN.
      $("#messagepop").html('' + arr.join('
') + '');

      for (var i = 0; i < arr.length; i++){
        $(".resourceLink").eq(i).attr('href', arr[i]);
      }

A: There's no need to use an id at all - at least not in the code shown.

$(":checkbox").change(function() {
      var messagepop = $("#messagepop");

      // remove all child nodes
      messagepop.empty();

      // add the checked items as anchor tags
      $(":checkbox:checked").each(function() {
          var val = $(this).val();

          $('')
              .attr("href", val)
              .text(val)
              .appendTo(messagepop);
      });
});

Resources

(Select the resources you wish to receive information about. Click on the "Show Resources" button when you are ready)

  <form action="">
    <input type="checkbox" value="https://google.com/search?q=CareerPreparation">Career Preparation

    <input type="checkbox" value="https://google.com/search?q=CollegeAdvising">College Advising

    <input type="checkbox" value="https://www.google.com/search?q=financial+aid">Financial Aid

    <input type="checkbox" value="https://www.google.com/search?q=fitness+recreation">Fitness & Recreation

    <input type="checkbox" value="https://www.google.com/search?q=health+services">Health Services

    <input type="checkbox" value="https://www.google.com/search?q=housing">Housing

    <input type="checkbox" value="https://www.google.com/search?q=library">Library

    <input type="checkbox" value="https://www.google.com/search?q=parking">Parking

    <input type="checkbox" value="https://www.google.com/search?q=housing">Scholarships

    <input type="checkbox" value="https://www.google.com/search?q=student+employment">Student Employment

    <input type="checkbox" value="https://www.google.com/search?q=student+organization">Student Organizations

    <input type="checkbox" value="https://www.google.com/search?q=tutoring">Tutoring Support

    <input type="checkbox" value="https://www.google.com/search?q=writing">Writing Support

  </form>


text:
Q: Xamarin ("old") Navigation side by side with Shell-Navigation I am searching for hours and wondering if it is possible to use the old navigation and the shell navigation in one Xamarin APP.
Background:
The reason for that is, that I am maintaining an old app with 40+ sites - with different Navigation through the sites and sometimes complex data passing through them.
Try to achieve:
Now I've to implement some new sites and just wanted to put them into the Shell-Navigation. Those "Shell-Sites" should also be available in the "old navigation".
So yes - I could try to put it all to shell, but don`t have the resources yet AND: never touch a running system...

A: Yes, its possible.
First, understand that AppShell starts up by doing this in App.xaml.cs:
MainPage = new AppShell();
To reach individual pages from AppShell, see:
XF Shell Navigation / Register detail page routes.
To navigate away from AppShell into old-style navigation, do either:
Application.Current.MainPage = new SomePage();
OR
Application.Current.MainPage = new NavigationPage();,
depending on how your old navigation was done.
To return to AppShell, do:
Application.Current.MainPage = new AppShell();
To return to a specific page within AppShell, I'm not sure the exact details. Maybe after setting MainPage to appshell, execute a shell "Route".
CAVEAT: When you think through the above, you'll soon realize that you can't leave the old pages "completely" untouched. You need to decide what user will do to go "back and forth". Then decide how to only include that in the "AppShell" version of the code. But that is no longer an AppShell-related topic. Its a standard c# .net build question, plus making some UI decisions.


text:
Q: How to show data using Angularjs? I am new in Angularjs. I want to show the list of customers after login. After login I get the access token which I want to save in cookie. When I am using console.log(data), data is coming but in view page it is coming blank.
index.html

    <link rel="shortcut icon" href="img/favicon.html">

    <title>Vizavoo</title>

    <link href="css/bootstrap.min.css" rel="stylesheet">
    <link href="css/bootstrap-reset.css" rel="stylesheet">
     <link href="assets/font-awesome/css/font-awesome.css" rel="stylesheet" />

   <link href="css/slidebars.css" rel="stylesheet">

    <link href="css/style.css" rel="stylesheet">
    <link href="css/style-responsive.css" rel="stylesheet" />

app.js
(function(window){

var app= angular.module('customersApp',['ngRoute','ngCookies']);

app.config(['$routeProvider',
  function ($routeProvider) {
        $routeProvider.
        when('/login', {
            title: 'Login',
            controller: 'loginController',
               templateUrl: 'app/views/loginuser.html'
        })
            .when('/logout', {
                title: 'Logout',
                templateUrl: 'partials/login.html',
                controller: 'loginController'
            })

            .when('/dashboard', {
                title: 'Dashboard',
                templateUrl: 'app/views/dynamic_table.html',
                controller: 'dashboard'
            })
            .when('/signup', {
                title: 'Signup',
                templateUrl: 'app/views/registration.html',
                controller: 'loginController'
            })

            .otherwise({
                redirectTo: '/login'
            });
  }]);
   window.app = app;

}(window));

loginController.js
app.controller('loginController', function ($scope,$http,$cookies,$cookieStore) {
    //initially set those objects to null to avoid undefined error
    $scope.login = {};
    $scope.signup = {};
    $scope.doLogin = function (customer) {

  $.post("http://54.173.65.120:2500/admin_login",
  {

     user_email : $scope.login.email,
      password : $scope.login.password

  },
  function(data,status){

      data = JSON.parse(data);
      console.log(data);

//var accessToken = data.access_token;

    var someSessionObj = { 'accesstoken' : data.access_token};
   //console.log(someSessionObj);

    $cookies.dotobject = someSessionObj;
    $scope.usingCookies = { 'cookies.dotobject' : $cookies.dotobject, "cookieStore.get" : $cookieStore.get('dotobject') };

    $cookieStore.put('obj', someSessionObj);
    $scope.usingCookieStore = { "cookieStore.get" : $cookieStore.get('obj'), 'cookies.dotobject' : $cookies.obj, };

    console.log($cookieStore.get('obj').accesstoken);

     if(data.flag==10)
      {
          alert(data.error);
      }
      else
      {

         window.location.href = "#/dashboard";

      }

  });

    };

    $scope.logout = function () {
        Data.get('logout').then(function (results) {
            Data.toast(results);
            $location.path('login');
        });
    }

$scope.toggle = true;

    $scope.$watch('toggle', function(){
        $scope.toggleText = $scope.toggle ? 'Unblock' : 'Block';
        $scope.buttonStyle=$scope.toggle ? 'success' : 'danger';
    })

});

   app.controller('dashboard', function ($scope,$http,$cookies,$cookieStore) {
    var d = new Date()
var n = d.getTimezoneOffset();
      console.log("in dash board");
    $.post('http://54.173.65.120:2500/customer_list',{

     access_token : $cookieStore.get('obj').accesstoken

  },function(data){

        console.log("hiiiii");
       console.log(data);
        var dataArray = [];
    //     console.log(data["aaData"]);
    //    console.log(data["aaData"].length);
        data = JSON.parse(data);

       data.forEach(function(column){

           var d = {

               user_id: "" ,
                user_name: "" ,
                email: "",
                mobile: "",
                created_at: "",
                is_block: "",

            };

             d.user_id = column.user_id;
            d.user_name = column.first_name+" "+column.last_name;

            d.email = column.email;
            d.mobile = column.mobile;
            d.created_at = column.created_at;
            d.is_block = column.is_block;

            console.log(d)
            dataArray.push(d);

       });

   console.log(data);

        $scope.list = data;
        $scope.currentPage = 1; //current page
        $scope.entryLimit = 5; //max no of items to display in a page
        $scope.filteredItems = $scope.list.length; //Initially for no filter
        $scope.totalItems = $scope.list.length;
    });
    $scope.setPage = function(pageNo) {
        $scope.currentPage = pageNo;
    };
    $scope.filter = function() {
        $timeout(function() {
            $scope.filteredItems = $scope.filtered.length;
        }, 10);
    };
    $scope.sort_by = function(predicate) {
        $scope.predicate = predicate;
        $scope.reverse = !$scope.reverse;
    };

});
 app.filter('startFrom', function() {
    return function(input, start) {
        if(input) {
            start = +start; //parse to int
            return input.slice(start);
        }
        return [];
    }

});

dynamic_table.html

          VizaVoo

 Log Out

                          Customers

                          Artists

Verified

New Requests

                          Services

                          Sessions

Upcoming

Past

                          Reports

                          Payment

Home > Customers

                  Customers Table

            <select ng-model="entryLimit" class="form-control">
                <option>5</option>
                <option>10</option>
                <option>20</option>
                <option>50</option>
                <option>100</option>
            </select>

            <input type="text" ng-model="search" ng-change="filter()" placeholder="Search" class="form-control" />

                  S.No
                  Name
                  Phone No.
                  Email ID
                  Registration Date
                  Status

                  {{data.user_id}}
                  {{data.user_name}}
                  {{data.mobile}}
                  {{data.email}}
                  {{data.created_at}}
                  {{data.is_block}}

              2013 © FlatLab by VectorLab.

Where am I doing a mistake? Why data is not showing in view section?

A: You need to include angular-cookie.js as a module depedency in app.js...
var app= angular.module('customersApp',['ngRoute','ngCookies']);

A: You missed a dependency for ngCookies:
var app= angular.module('customersApp',['ngRoute', 'ngCookies']);

I recommend using another style guide. It will be less messy than your current code. Check it here: https://github.com/johnpapa/angularjs-styleguide


text:
Q: Is it bad to create constants on every API call or does the compiler optimizes it Is it safe to have a constant created everytime an API call is made?
For example, in the below code the is IsValueInRange function is used for validation by the WriteToDataBase function and the WriteToDataBase is called by the API to save the data to the table.
I am curious about the memory implications of having the constants defined in the function IsValueInRange over having them defined as a member variables in the class. Which is the better option and Why?
private bool IsValueInRange(double val)
{
    const int valMax = 10000000000;
    const int valMin = 10;
    return val >= valMin && val <= valMax;
}

public void WriteToDataBase(double val)
{
    if(IsValueInRange(val))
    {
        writeToDb(val);
    }
}