text:
Q: altium designer - Could not find port 'PA0' on model 'tm4c1294_01' for pin 'PA0' I am designing my very first PCB. I need a PCB with a cortex M4 core in a qtf package. I tried to follow this tutorial: https://www.youtube.com/watch?v=0n6k6GYu_V0&index=2&list=LLwe2piHB5wGY6Mycs0n3TZg
But get the following error when compiling at the end:
[Error] tm4c1294ncpdt.SchLib    Compiler    tm4c1294xl_01: Could not find port 'PA0' on model 'tm4c1294_01' for pin 'PA0'
Where did I do the error and/or how can I solve it?
Here you have a preview of the schematic and footprint I made.

A: Your 'Designator' fields on the schematic symbol pins have to agree with the pads on the footprint. Otherwise, how would the program know where the pin numbers are on the footprint?
You can make the 'Display Name' whatever you like- it's just for human use.
Where you have PA0 etc. one would normally have the physical pin number, matching exactly the pin numbers on the footprint.
You can fix it by editing each of the schematic pins, and that should do it, if your footprint is numbered correctly.


text:
Q: How to update Node version in Codespace I am trying to use Node version 16 in a codespace.
First I ran nvm install-latest-nvm.
Then I ran nvm use 16 which returned Now using node v16.18.1 (npm v9.1.1)
However, node -v then returns v14.20.1.
And I'm still getting the same errors from dependencies which require Node v16.
How do I get the codespace to show that it is using v16, via node -v?

redpajama_set_name: RedPajamaStackExchange


text:
Q: Animation classes VS Canvas drawing I always wonder, when would you use Animation classes VS using Canvas (and loading bitmaps..etc by code)?
Is there a rule of thumb or is the specific advantage/disadvantages? I always  go by animations as  I find it its all ready made and easier but I am not sure if I am missing out on advantaes
Thanks

A: Usual animations are for View
Canvas is for messive use like games which require Hardware with Surfaceview class.
At least from the view of my point.

A: Well you need to understand the difference between the role of a View and a the role of an Animation.  A view is meant to capture a snapshot of some data and render it.  Sure, the data can change rapidly and the view might frequently need to re-draw, but once the draw is complete, the view's state should be valid until it's data or state is changed.
An Animation is a method by which you define a set of linking, or progressive, changes that should be made to a view to get from a begin state to an end state.  On top of this, there are different types of animations.  You can have an animation where you simply draw one bitmap at a time from a set in quick succession, as you suggest.  You can also have an animation that changes a property of a view over time to get a dynamic effect.
Edit
So to answer your question, you should probably just animate the translation property on your ImageView if you want to "slide a view around".


text:
Q: Getting historical imagery of Google Maps? I want to show historical images of google map of particular location and images will change when we click previous next button according to its published date ?

A: That feature is not available on Maps. You can do it easily in Google Earth. Click the "clock" icon at the top of the window and you'll see a time slider. Next and previous buttons will walk through the dates of the imagery -- not the publication date, but the date the image was acquired.


text:
Q: How to get the max length of the record size of a dataframe effectively How to know the size of longest record (row) of a dataset in bytes.
I have quite a big dataframe with variable length of record (row) and I want to know the length of the row with largest payload.
It has millions\billions of rows, so I want to know a way which is effective and won't affect the performance.
I have DataFrameWriter as an input.

A: Check below code.
scala> import org.apache.commons.io.FileUtils
import org.apache.commons.io.FileUtils

scala> val bytes = udf((length:Long) => FileUtils.byteCountToDisplaySize(length)) // To disply human readable size.
bytes: org.apache.spark.sql.expressions.UserDefinedFunction = UserDefinedFunction(<function1>,StringType,Some(List(LongType)))

scala> df
.withColumn("size",length(to_json(struct($"*"))))
.orderBy($"size".desc)
.select(bytes($"size").as("size_in_bytes"))
.show(10,false)
+-------------+
|size_in_bytes|
+-------------+
|49 KB        |
|49 KB        |
|49 KB        |
|48 KB        |
|48 KB        |
|48 KB        |
|43 KB        |
|43 KB        |
|43 KB        |
|42 KB        |
+-------------+
only showing top 10 rows

scala> df
.withColumn("size",length(to_json(struct($"*"))))
.orderBy($"size".desc)
.select($"size".as("size_in_bytes"))
.show(10,false)// Without UDF.
+-------------+
|size_in_bytes|
+-------------+
|50223        |
|50219        |
|50199        |
|50079        |
|50079        |
|50027        |
|44536        |
|44488        |
|44486        |
|43836        |
+-------------+
only showing top 10 rows

scala>

A: Perhaps this is helpful-
bit_length
val df = Seq((1, 2, "hi", "hello")).toDF()

    df.selectExpr("max(bit_length(concat_ws('', *)))/8 as bytes")
      .show(false)
    /**
      * +-----+
      * |bytes|
      * +-----+
      * |9.0  |
      * +-----+
      */


text:
Q: jnlp file without .jnlp extension? Is jnlp responsible to launch the sandbox? If jnlp is written in xml then can we have jnlp file with the .xml extension and without any taf of jnlp? Which javascript method is responsible for launching sandbox? may be createWebStartLaunchButton: function(jnlp) or there is some other method?

A: createWebStartLaunchButton in the deployJava script does simply create a button that when clicked executes javascript-functions that make sure JRE is installed and also allows browser to download and open the jnlp file.
DeployJava documentation: http://docs.oracle.com/javase/6/docs/technotes/guides/jweb/deployment_advice.html#deplToolkit
The 'sandbox' or rather the jvm is launched when the jnlp-file is opened by the os-default-handler of jnlp-file-type, usually javaws.exe on windows
If the jnlp file is stored as an .xml on the server it is likely that a servlet or some equivalent is serving it contents by seting response-type
response.setContentType("application/x-java-jnlp-file");

Which helps the browser to determine how the served file should be opened.


text:
Q: Synchronize project source code between 2 team servers I work on a project stored on 2 team servers : a local team server where several coders are working, and a codeplex project where I send the updates.
I have on my computers 2 copies of the source code, and I copy the modification from one to the other.
What is the best way to synchronize the source code between the two servers ? (with only one copy of the source code, or a tool who can compare the two versions and automatically sends update to codeplex)


text:
Q: R Best way to merge large dataframes of the same size I have one huge dataframe (400k rows by 8000 cols), another dataframe that's 400k rows by 3 cols, and a third dataframe that's 402k rows by 3 cols. Each df has 2 key columns. Label them:
dfBig - biggest df
dfSmall1 - the df with 402k rows
dfSmall2 - the df with the same number of rows
when I try to compile all the information with the following dplyr solution my RStudio session gets aborted:
dfCompile <- dfBig %>%
  left_join(dfSmall1, by = c('Key1', 'Key2')) %>%
  left_join(dfSmall2, by = c('Key1', 'Key2')) %>%
  select(Key1, Key2, newCol1, newCol2, everything())

I can't even run dfBig %>% arrange(Key1, Key2) without it blowing up. What I've done instead to make it work is:
# Grab only the keys to cut down on size
dfInfo <- dfBig %>% select(Key1, Key2)

# Merge other dfs to the info DF
dfInfo <- dfInfo %>%
  left_join(payoutMap, by = c('Key1', 'Key2')) %>%
  left_join(ranks, by = c('Key1', 'Key2')) %>%
  select(-Key1, -Key2)

# Cbind the rest of the columns back in since I know they'll be in the same order (arrange(.) blows it up)
dfBig <- cbind(dfBig, dfInfo) %>%
  select(Key1, Key2, newCol1, newCol2, everything())

It works, but it doesn't feel very eloquent, and I don't want to have to mess with it again if it breaks down with an even bigger dataframe. Can sqldf or data.table handle this better? Just want to understand the best path to go down before I start learning for myself.

A: I believe using data.frame() would be fastest, but will only work properly when there is complete intersection between the two data frames you are joining.  You just have to give it a key = such as in the example below (this might be what you want since you were left merging your larger longer data set onto your shorter data set, thus chopping off at least two unmatched values assuming you only have unique values):
dfCompile <- dfBig %>%
  data.frame(dfSmall1, key = c('Key1', 'Key2')) %>%
  data.frame(dfSmall2, key = c('Key1', 'Key2')) %>%
  select(Key1, Key2, newCol1, newCol2, everything())

Otherwise, using the data.table R package is probably the way to go.
library(data.table)
setDT(dfBig)
setDT(dfSmall1)
setDT(dfSmall2)
dfCompile <- dfBig %>%
  merge(dfSmall1, by = c('Key1', 'Key2'), all = TRUE) %>%
  merge(dfSmall2, by = c('Key1', 'Key2'), all = TRUE) %>%
  merge(Key1, Key2, newCol1, newCol2, everything())

Note: if you plan to use the method using the data.table package, in order to left join, as was in your example, you want to change all = TRUE to all.x = TRUE in your merge() functions.
I hope this helps!

A: It sounds like the size of the data is too large to fit into memory and R is crashing.  Here are a few ideas to work around it.

*

*It sounds like you've tried dplyr::left_join and data.table::merge, one other option would be to try base::merge, although admittedly it is a longshot if the others didn't work.

*Do you need all of the columns in your data -- can you remove some unneeded ones before performing the merge?

*Another approach you could take is to add swap space to your system.  You can make your swap space as large as you want, but your application may crawl to a near-halt if too much swap is required.

*You try to use a package like disk.frame which performs the operation one chunk at-a-time.  See https://diskframe.com/.

*Can you find a machine with more memory?  You could rent a machine on a cloud provider such as AWS, GCP, Azure, or elsewhere.


text:
Q: Deleting/Removing a rectangle from a vector C++ (SDL2) I'm building Breakout for a project. I'm nearly done but I have one issue, deleting the bricks from the vector when they have taken enough hits. This is the function I'm currently working with:
void HandleBlockCollision()
{
    for (auto &p : enemies)
    {
        p.hits--;
        if (p.hits == 0)
        {
        enemies.erase;
        }
    }
}

The error I'm getting is:

Error  1   error C2664: 'std::_Vector_iterator>> std::vector>::erase(std::_Vector_const_iterator>>,std::_Vector_const_iterator>>)' : cannot convert argument 1 from 'SDL_Rect' to 'std::_Vector_const_iterator>>'

I'm not sure what's going wrong.
Cheers!


text:
Q: Declaring collection accessor methods in Objective-C necessary? I've got a quickie today. Say I have a class called BSDHistoryManager. It's a simple state history recorder like in a web browser (aka a History object [window.history]). Here are simplified examples of the .h/m files:
BSDHistoryManager.h
@interface BSDHistoryManager : NSObject

@property (nonatomic, copy) NSArray *states;

@end

BSDHistoryManager.m
@implementation BSDHistoryManager {
    NSMutableArray *_states;
}

- (NSArray *)states
{
    return _states.copy;
}

- (void)setStates:(NSArray *)states
{
    if ( [states isEqualToArray:_states] )
        return;
    _states = states.mutableCopy;
}

@end

As you can see, I have a standard mutable collection on the inside which is copied when accessed with the getter so the internals don't get messed up. At this point, I want to add some public accessor methods like -addState:, -removeState:, etc. For example, I like to make my own accessors like this:
- (void)addState:(BSDState *)state;
- (void)insertState:(BSDState *)state atIndex:(NSUInteger)index;

However, I want to define KVC methods, too. You know, the ones that look like this:
- (void)addStatesObject:(id)object;
- (void)insertObject:(id)object inStatesAtIndex:(NSUInteger)index;

Now I have both, and that's cool, but I want my class interface to be nice and clean, so it's easier to read and understand. My question is: when implementing the KVC accessor patterns, do I need to declare those methods or do I get KVC-compliance "for free" by just implementing the methods? Or a better question is: do I even need to implement the KVC methods if I make my own custom-named ones?
Hopefully this makes sense, but if not, I'll try to explain it a little better. Thanks for reading!


text:
Q: How can I control the ui material table height automatically? I am using the Table component available in material-ui in my React JS code with a single row. I have an "Add" icon button for adding desired  number of rows. How can I expand and shrink the table height, depending on the number of rows.  If the number of rows (excluding header and footer) exceed 20, then I want to put a scroll on the right. How can I handle this?

A: Please take a look at this solution:
https://codesandbox.io/s/basictable-material-demo-with-scroll-jsxwk?file=/demo.js.
It has a default row size of 4 that can be changed by a text field and will automatically resize the table accordingly, the scroller appears depending on the content, you don't have to worry about it.
The trick is customizing the TableContainer and Table's CSS:
const useStyles = makeStyles({
  tableContainer: {
    overflowY: "auto"
  },
  table: { //...
    height: "100%",
    overflowY: "scroll"
  }, //...
});

And control the table container's height here:
const classes = useStyles();
const [maxRows, setMaxRows] = useState(4);
//...
return <TableContainer
        component={Paper}
        className={classes.tableContainer}
        style={{
          maxHeight: maxRows * ROW_HEIGHT + HEAD_ROW_HEIGHT
        }}
      >
  <Table stickyHeader className={classes.table}>
    {/*...*/}
  </Table>
</TableContainer>


text:
Q: Openid forbidden error After I was able to get it (open id library) installed properly, I am facing some problems in getting it to work. I am using the open id selector a jquery plugin.
The problem is that when I click on any open id provider image I get an error message saying something like this (after the form is posted to try_auth.php with necessary parameters).

'Forbidden
You don't have permission to access /Auth/try_auth.php on this server.
Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.'

what is wrong with my configuration.? please help.
I have hosted my site on a shared hosting.
Does openid implementation has something to do with this.?
I am asking this because I am not able to set the PHP settings through this method 'ini_set()' in my script.
thanks

A: Well It took me quite a long time to find a solution for this one.
Actually I had to contact the webhosting service provider support for this because the rules implemented by openid library were interfering with the mod rewrite rules of hosting provider.
They resolved this problem by adding my site to their whitelist.
And then all worked fine (thank God)
hope it helps someone facing this similar problem.

A: You say auth_try.php in your description.
The server error says try_auth.php.
Are you sure the file is there? Can you access http://yourserver/Auth/try_auth.php ? If not, you most probably have a configuration problem in your web server and you'll have to provide more information for others to be able to help.
One question that comes to mind: is this the only PHP file that's not working?


text:
Q: Parsing a script tag with dicts in BeautifulSoup Working on a partial answer to this question, I came across a bs4.element.Tag that is a mess of nested dicts and lists (s, below).
Is there a way to return a list of urls contained in s without using re.find_all?  Other comments regarding the structure of this tag are helpful too.
from bs4 import BeautifulSoup
import requests

link = 'https://stackoverflow.com/jobs?med=site-ui&ref=jobs-tab&sort=p'
r = requests.get(link)
soup = BeautifulSoup(r.text, 'html.parser')

s = soup.find('script', type='application/ld+json')

## the first bit of s:
# s
# Out[116]:
# <script type="application/ld+json">
# {"@context":"http://schema.org","@type":"ItemList","numberOfItems":50,

What I've tried:

*

*randomly perusing through methods with tab completion on s.

*picking through the docs.

My problem is that s only has 1 attribute (type) and doesn't seem to have any child tags.

A: You can use s.text to get the content of the script. It's JSON, so you can then just parse it with json.loads. From there, it's simple dictionary access:
import json

from bs4 import BeautifulSoup
import requests

link = 'https://stackoverflow.com/jobs?med=site-ui&ref=jobs-tab&sort=p'
r = requests.get(link)

soup = BeautifulSoup(r.text, 'html.parser')

s = soup.find('script', type='application/ld+json')

urls = [el['url'] for el in json.loads(s.text)['itemListElement']]

print(urls)

A: More easy:
from bs4 import BeautifulSoup
import requests

link = 'https://stackoverflow.com/jobs?med=site-ui&ref=jobs-tab&sort=p'
r = requests.get(link)
soup = BeautifulSoup(r.text, 'html.parser')

s = soup.find('script', type='application/ld+json')

# JUST THIS
json = json.loads(s.string)


text:
Q: Android AOSP build failing in build_image.py for android-10.0.0_r39 On Ubuntu 20.04 LTS.  I have an AOSP tree checked out at android-10.0.0_r39.  The tree builds fine for walleye - I can build an run on a device, no issues.  I have no new files in the AOSP repo tree.  If I switch to blueline, though, I get:
lunch aosp_blueline-userdebug
...
[ 99% 67222/67226] Target system fs image: out/target/product/blueline/obj/PACKAGING/systemimage_intermediates/system.img
FAILED: out/target/product/blueline/obj/PACKAGING/systemimage_intermediates/system.img
/bin/bash -c "(if [ -d out/target/product/blueline/system/vendor ] && [ ! -h out/target/product/blueline/system/vendor ]; then echo 'Non-symlink out/target/product/blueline/system/vendor detected!' 1>&2; echo 'You cannot install files to out/target/product/blueline/system/vendor while building a separate vendor.img!' 1>&2; exit 1; fi ) && (ln -sf /vendor out/target/product/blueline/system/vendor ) && (if [ -d out/target/product/blueline/system/product ] && [ ! -h out/target/product/blueline/system/product ]; then echo 'Non-symlink out/target/product/blueline/system/product detected!' 1>&2; echo 'You cannot install files to out/target/product/blueline/system/product while building a separate product.img!' 1>&2; exit 1; fi ) && (ln -sf /product out/target/product/blueline/system/product ) && (( cd out/target/product/blueline/system && findres=\$(find lib* -path \"lib/bootstrap\" -prune -o -path \"lib64/bootstrap\" -prune -o -path \"lib/arm\" -prune -o -path \"lib/arm64\" -prune -o -path \"lib/vndk-*\" -prune -o -path \"lib64/vndk-*\" -prune -o -type f \\( -false -o -name libadbconnection.so -o -name libadbconnectiond.so -o -name libandroidicu.so -o -name libandroidio.so -o -name libart-compiler.so -o -name libart-dexlayout.so -o -name libart-disassembler.so -o -name libart.so -o -name libartbase.so -o -name libartbased.so -o -name libartd-compiler.so -o -name libartd-dexlayout.so -o -name libartd.so -o -name libartpalette.so -o -name libc.so -o -name libdexfile.so -o -name libdexfile_external.so -o -name libdexfiled.so -o -name libdexfiled_external.so -o -name libdl.so -o -name libdt_fd_forward.so -o -name libdt_socket.so -o -name libicui18n.so -o -name libicuuc.so -o -name libjavacore.so -o -name libjdwp.so -o -name libm.so -o -name libnativebridge.so -o -name libnativehelper.so -o -name libnativeloader.so -o -name libnpt.so -o -name libopenjdk.so -o -name libopenjdkjvm.so -o -name libopenjdkjvmd.so -o -name libopenjdkjvmti.so -o -name libopenjdkjvmtid.so -o -name libpac.so -o -name libprofile.so -o -name libprofiled.so -o -name libsigchain.so -o -name libjavacrypto.so \\) -print) && if [ -n \"\$findres\" ]; then echo \"APEX libraries found in system image (see comment for check-apex-libs-absence\" 1>&2; echo \"in build/make/core/main.mk for details):\" 1>&2; echo \"\$findres\" | sort 1>&2; false; fi; ) ) && (mkdir -p out/target/product/blueline/obj/PACKAGING/systemimage_intermediates/ out/target/product/blueline/obj/PACKAGING/systemimage_intermediates && rm -rf out/target/product/blueline/obj/PACKAGING/systemimage_intermediates/system_image_info.txt ) && (echo \"system_other_size=2952790016\" >>  out/target/product/blueline/obj/PACKAGING/systemimage_intermediates/system_image_info.txt ) && (echo \"system_journal_size=0\" >>  out/target/product/blueline/obj/PACKAGING/systemimage_intermediates/system_image_info.txt ) && (echo \"ext_mkuserimg=mkuserimg_mke2fs\" >>  out/target/product/blueline/obj/PACKAGING/systemimage_intermediates/system_image_info.txt ) && (echo \"fs_type=ext4\" >>  out/target/product/blueline/obj/PACKAGING/systemimage_intermediates/system_image_info.txt ) && (echo \"extfs_sparse_flag=-s\" >>  out/target/product/blueline/obj/PACKAGING/systemimage_intermediates/system_image_info.txt ) && (echo \"squashfs_sparse_flag=-s\" >>  out/target/product/blueline/obj/PACKAGING/systemimage_intermediates/system_image_info.txt ) && (echo \"ext4_share_dup_blocks=true\" >>  out/target/product/blueline/obj/PACKAGING/systemimage_intermediates/system_image_info.txt ) && (echo \"selinux_fc=out/target/product/blueline/obj/ETC/file_contexts.bin_intermediates/file_contexts.bin\" >>  out/target/product/blueline/obj/PACKAGING/systemimage_intermediates/system_image_info.txt ) && (echo \"avb_avbtool=avbtool\" >>  out/target/product/blueline/obj/PACKAGING/systemimage_intermediates/system_image_info.txt ) && (echo \"avb_system_hashtree_enable=true\" >>  out/target/product/blueline/obj/PACKAGING/systemimage_intermediates/system_image_info.txt ) && (echo \"avb_system_add_hashtree_footer_args=--prop com.android.build.system.os_version:10 --prop com.android.build.system.security_patch:2020-06-05\" >>  out/target/product/blueline/obj/PACKAGING/systemimage_intermediates/system_image_info.txt ) && (echo \"avb_system_other_hashtree_enable=true\" >>  out/target/product/blueline/obj/PACKAGING/systemimage_intermediates/system_image_info.txt ) && (echo \"avb_system_other_add_hashtree_footer_args=--rollback_index 1591315200\" >>  out/target/product/blueline/obj/PACKAGING/systemimage_intermediates/system_image_info.txt ) && (echo \"avb_system_other_key_path=external/avb/test/data/testkey_rsa4096.pem\" >>  out/target/product/blueline/obj/PACKAGING/systemimage_intermediates/system_image_info.txt ) && (echo \"avb_system_other_algorithm=SHA256_RSA4096\" >>  out/target/product/blueline/obj/PACKAGING/systemimage_intermediates/system_image_info.txt ) && (echo \"avb_vendor_hashtree_enable=true\" >>  out/target/product/blueline/obj/PACKAGING/systemimage_intermediates/system_image_info.txt ) && (echo \"avb_vendor_add_hashtree_footer_args=--prop com.android.build.vendor.os_version:10 --prop com.android.build.vendor.security_patch:2020-06-05\" >>  out/target/product/blueline/obj/PACKAGING/systemimage_intermediates/system_image_info.txt ) && (echo \"avb_product_hashtree_enable=true\" >>  out/target/product/blueline/obj/PACKAGING/systemimage_intermediates/system_image_info.txt ) && (echo \"avb_product_add_hashtree_footer_args=--prop com.android.build.product.os_version:10 --prop com.android.build.product.security_patch:2020-06-05\" >>  out/target/product/blueline/obj/PACKAGING/systemimage_intermediates/system_image_info.txt ) && (echo \"avb_product_services_hashtree_enable=true\" >>  out/target/product/blueline/obj/PACKAGING/systemimage_intermediates/system_image_info.txt ) && (echo \"avb_product_services_add_hashtree_footer_args=--prop com.android.build.product_services.os_version:10 --prop com.android.build.product_services.security_patch:2020-06-05\" >>  out/target/product/blueline/obj/PACKAGING/systemimage_intermediates/system_image_info.txt ) && (echo \"avb_odm_hashtree_enable=true\" >>  out/target/product/blueline/obj/PACKAGING/systemimage_intermediates/system_image_info.txt ) && (echo \"avb_odm_add_hashtree_footer_args=--prop com.android.build.odm.os_version:10\" >>  out/target/product/blueline/obj/PACKAGING/systemimage_intermediates/system_image_info.txt ) && (echo \"recovery_as_boot=true\" >>  out/target/product/blueline/obj/PACKAGING/systemimage_intermediates/system_image_info.txt ) && (echo \"root_dir=out/target/product/blueline/root\" >>  out/target/product/blueline/obj/PACKAGING/systemimage_intermediates/system_image_info.txt ) && (echo \"use_dynamic_partition_size=true\" >>  out/target/product/blueline/obj/PACKAGING/systemimage_intermediates/system_image_info.txt ) && (echo \"skip_fsck=true\" >>  out/target/product/blueline/obj/PACKAGING/systemimage_intermediates/system_image_info.txt ) && (PATH=out/host/linux-x86/bin/:\$PATH build/make/tools/releasetools/build_image.py out/target/product/blueline/system out/target/product/blueline/obj/PACKAGING/systemimage_intermediates/system_image_info.txt out/target/product/blueline/obj/PACKAGING/systemimage_intermediates/system.img out/target/product/blueline/system || ( mkdir -p \${DIST_DIR}; cp out/target/product/blueline/installed-files.txt \${DIST_DIR}/installed-files-rescued.txt; exit 1 ) )"
2020-06-18 22:52:22 - build_image.py - ERROR   : Failed to build out/target/product/blueline/obj/PACKAGING/systemimage_intermediates/system.img from out/target/product/blueline/system
Out of space? Out of inodes? The tree size of /pool/james/aosp/out/soong/.temp/tmpceCvjm is 153844736 bytes (146 MB), with reserved space of 0 bytes (0 MB).
The max image size for filesystem files is 73134080 bytes (69 MB), out of a total partition size of 73134080 bytes (69 MB).
Traceback (most recent call last):
  File "build/make/tools/releasetools/build_image.py", line 789, in <module>
    main(sys.argv[1:])
  File "build/make/tools/releasetools/build_image.py", line 781, in main
    BuildImage(in_dir, image_properties, out_file, target_out)
  File "build/make/tools/releasetools/build_image.py", line 423, in BuildImage
    BuildImageMkfs(in_dir, prop_dict, out_file, target_out, fs_config)
  File "build/make/tools/releasetools/build_image.py", line 334, in BuildImageMkfs
    mkfs_output = common.RunAndCheckOutput(build_command)
  File "/pool/james/aosp/build/make/tools/releasetools/common.py", line 252, in RunAndCheckOutput
    args, proc.returncode, output))
common.ExternalError: Failed to run command '['mkuserimg_mke2fs', '-s', '/pool/james/aosp/out/soong/.temp/tmpceCvjm', 'out/target/product/blueline/obj/PACKAGING/systemimage_intermediates/system.img', 'ext4', '/', '73134080', '-j', '0', '-D', 'out/target/product/blueline/system', '-L', '/', '-i', '3256', '-M', '0', '-c', '--inode_size', '256', 'out/target/product/blueline/obj/ETC/file_contexts.bin_intermediates/file_contexts.bin']' (exit code 4):
22:52:21 mkuserimg_mke2fs.py INFO: Env: {'MKE2FS_CONFIG': './system/extras/ext4_utils/mke2fs.conf'}
22:52:21 mkuserimg_mke2fs.py INFO: Running: mke2fs -O ^has_journal -L / -N 3256 -I 256 -M / -m 0 -E android_sparse -t ext4 -b 4096 out/target/product/blueline/obj/PACKAGING/systemimage_intermediates/system.img 17855
22:52:21 mkuserimg_mke2fs.py INFO: Env: {}
22:52:21 mkuserimg_mke2fs.py INFO: Running: e2fsdroid -p out/target/product/blueline/system -s -S out/target/product/blueline/obj/ETC/file_contexts.bin_intermediates/file_contexts.bin -f /pool/james/aosp/out/soong/.temp/tmpceCvjm -a / out/target/product/blueline/obj/PACKAGING/systemimage_intermediates/system.img
22:52:22 mkuserimg_mke2fs.py ERROR: Failed to run e2fsdroid_cmd: __populate_fs: Could not allocate block in ext2 filesystem while writing file "com.android.runtime.debug.apex"
e2fsdroid: Could not allocate block in ext2 filesystem while populating file system

mke2fs 1.44.4 (18-Aug-2018)
Creating filesystem with 17855 4k blocks and 3264 inodes

Allocating group tables: done
Writing inode tables: done
Writing superblocks and filesystem accounting information: done

__populate_fs: Could not allocate block in ext2 filesystem while writing file "com.android.runtime.debug.apex"
e2fsdroid: Could not allocate block in ext2 filesystem while populating file system

22:52:33 ninja failed with: exit status 1

#### failed to build some targets (01:27:37 (hh:mm:ss)) ####

Suggestions?

A: This is likely due to the file system you are writing your image to.  In particular, I received the same problem when writing to a zfs drive.  As soon as I redirected my build to an ext4 device, my build completed.
To redirect where your image is written, set the environment variable OUT_DIR_COMMON_BASE, i.e.
export OUT_DIR_COMMON_BASE=/ext4/path/to/builds

A:
Out of space? Out of inodes? The tree size of
/pool/james/aosp/out/soong/.temp/tmpceCvjm is 153844736 bytes (146
MB), with reserved space of 0 bytes (0 MB). The max image size for
filesystem files is 73134080 bytes (69 MB), out of a total partition
size of 73134080 bytes (69 MB).

Please modify BOARD_SYSTEMIMAGE_PARTITION_SIZE := , where  in your error log must be more than 73134080. For example BOARD_SYSTEMIMAGE_PARTITION_SIZE = 73134080 + 100MB
In another scenario, I was able to get this error fixed after freeing up some space in host machine (Build PC)

A: Setting $(BOARD_USERDATAIMAGE_FILE_SYSTEM_TYPE) to ext4 may help you.
In the BoardConfig.mk file add the following snippet:
BOARD_USERDATAIMAGE_FILE_SYSTEM_TYPE := ext4

A: For me, it was caused by the ROM I was building, including gapps.  I solved it by removing some of the google apps that do not neccessarily need to be inbuilt in the ROM from vendor/gms/gms_full.mk. I removed drive, chrome, calendar, calculator, youtube and youtube music.

A: These issues happen mostly when system partition is exceeding the threshold size, removing APK's might solve it but it can not be permanent fix.
The size overflow also happen because of AOT compilation (PreDexOpt), A little twisting with ART config might help.
One way is to use WITH_DEXPREOPT_BOOT_IMG_AND_SYSTEM_SERVER_ONLY.
Refer to https://source.android.com/devices/tech/dalvik/configure for more ideas.


text:
Q: How can I use a command line parameter to access a text file? I'm trying to use 3 command line parameters such as:
java program textfile.txt test 3

The first one should access a textfile, the second one should print the name, and the third one should be a numeric key that is parsed as an integer.
import java.util.Scanner;
import java.io.*;

public class Program
{

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

        String textfile=null;
        String outtextfile=null;
        String enteredKey=null;
        for(String parameter: args) {
            textfile = parameter;
            outtextfile = parameter;
            enteredKey = parameter;
        }

        Scanner s = new Scanner(new File(textfile));

        //gets a string to encrypt
        String str = s.nextLine();

        //print outtextfile
        System.out.println(outtextfile);

        //gets a key
        int key = Integer.parseInt(enteredKey);

However, that code yields this error:
-bash-4.1$ java Program sample.txt test 3
Exception in thread "main" java.io.FileNotFoundException: 3 (No such file or directory)
        at java.io.FileInputStream.open(Native Method)
        at java.io.FileInputStream.<init>(FileInputStream.java:138)
        at java.util.Scanner.<init>(Scanner.java:656)
        at Program.main(Caesar.java:19)

A: You're running into a scoping problem:
The textFile variable is only visible within the for loop and is invisible outside of this loop. Are you sure that you even want to have a loop? And if so why? If the text file String is the first parameter, then get rid of the loop and only use the first parameter, args[0]:
public static void main(String[] args) throws IOException {
  if (args.length == 0) {
     // exit program with an error message
  } else {
     String textFile = args[0];
     Scanner scanner = new Scanner(new File(textFile));
     // do work with Scanner
  }

A: You are declaring textfile in your loop, meaning it is only limited to the scope of your loop. You are trying to access it outside the loop. I would offer a suggestion, but I'm not really sure what you are trying to accomplish.

A: Try this :
String textfile=null;
for(String parameter: args) {

    textfile = parameter;
}

Scanner s = new Scanner(new File(textfile));


text:
Q: Access denied finding property "persist.camera.cfa.packagelist" On NOKIA 6.1
Getting this issue: Access denied finding property "persist.camera.cfa.packagelist" on above mobile and i am using camera2 Api with given os : Android 8.1 and CameraHardwareLevel: Level supported: level 3
Please help any one have solution.


text:
Q: How to extarct values from automl.show_models() in Python I am using AutoSklearn library
Here is my code
automl = autosklearn.classification.AutoSklearnClassifier(
include={'feature_preprocessor': ["no_preprocessing"],
  },
exclude={ 'classifier': ['random_forest']},
time_left_for_this_task=60*3,
per_run_time_limit=60*1,
#memory_limit = 1024 * 10,
n_jobs=-1,
#metric=autosklearn.metrics.f1_macro,
        )
automl.fit(X_train, y_train)

automl.show_models()

This function automl.show_models() shows these values
{6: {'model_id': 6, 'rank': 1, 'cost': 0.16666666666666663, 'ensemble_weight': 0.24, 'data_preprocessor': <autosklearn.pipeline.components.data_preprocessing.DataPreprocessorChoice object at 0x7fd1a5610550>, 'balancing': Balancing(random_state=1), 'feature_preprocessor': <autosklearn.pipeline.components.feature_preprocessing.FeaturePreprocessorChoice object at 0x7fd100267cd0>, 'classifier': <autosklearn.pipeline.components.classification.ClassifierChoice object at 0x7fd1002678e0>, 'sklearn_classifier': ExtraTreesClassifier(criterion='entropy', max_features=231, min_samples_split=3, n_estimators=512, n_jobs=1, random_state=1, warm_start=True)},

14: {'model_id': 14, 'rank': 2, 'cost': 0.17803030303030298, 'ensemble_weight': 0.3, 'data_preprocessor': <autosklearn.pipeline.components.data_preprocessing.DataPreprocessorChoice object at 0x7fd1036b7b20>, 'balancing': Balancing(random_state=1, strategy='weighting'), 'feature_preprocessor': <autosklearn.pipeline.components.feature_preprocessing.FeaturePreprocessorChoice object at 0x7fd0f9c51250>, 'classifier': <autosklearn.pipeline.components.classification.ClassifierChoice object at 0x7fd0f9c510a0>, 'sklearn_classifier': HistGradientBoostingClassifier(early_stopping=True,
                                   l2_regularization=5.027708640006448e-08,
                                   learning_rate=0.09750328007832798, max_iter=16,
                                   max_leaf_nodes=1234, min_samples_leaf=25,
                                   n_iter_no_change=1, random_state=1,
                                   validation_fraction=0.08300813783286698,
                                   warm_start=True)},

28: {'model_id': 28, 'rank': 3, 'cost': 0.2007575757575758, 'ensemble_weight': 0.02, 'data_preprocessor': <autosklearn.pipeline.components.data_preprocessing.DataPreprocessorChoice object at 0x7fd15aaf3220>, 'balancing': Balancing(random_state=1), 'feature_preprocessor': <autosklearn.pipeline.components.feature_preprocessing.FeaturePreprocessorChoice object at 0x7fd0ffc75970>, 'classifier': <autosklearn.pipeline.components.classification.ClassifierChoice object at 0x7fd0ffcafd00>, 'sklearn_classifier': DecisionTreeClassifier(max_depth=7231, min_samples_leaf=19,
                           min_samples_split=12, random_state=1)},

8: {'model_id': 8, 'rank': 4, 'cost': 0.23484848484848486, 'ensemble_weight': 0.16, 'data_preprocessor': <autosklearn.pipeline.components.data_preprocessing.DataPreprocessorChoice object at 0x7fd10032a910>, 'balancing': Balancing(random_state=1, strategy='weighting'), 'feature_preprocessor': <autosklearn.pipeline.components.feature_preprocessing.FeaturePreprocessorChoice object at 0x7fd161407160>, 'classifier': <autosklearn.pipeline.components.classification.ClassifierChoice object at 0x7fd161407b80>, 'sklearn_classifier': DecisionTreeClassifier(class_weight='balanced', max_depth=7231,
                           min_samples_leaf=4, min_samples_split=20,
                           random_state=1)},

16: {'model_id': 16, 'rank': 5, 'cost': 0.26515151515151514, 'ensemble_weight': 0.06, 'data_preprocessor': <autosklearn.pipeline.components.data_preprocessing.DataPreprocessorChoice object at 0x7fd1620c8370>, 'balancing': Balancing(random_state=1, strategy='weighting'), 'feature_preprocessor': <autosklearn.pipeline.components.feature_preprocessing.FeaturePreprocessorChoice object at 0x7fd161f8a6a0>, 'classifier': <autosklearn.pipeline.components.classification.ClassifierChoice object at 0x7fd0f9b16250>, 'sklearn_classifier': MLPClassifier(alpha=1.1952772240345466e-06, beta_1=0.999, beta_2=0.9,
                  early_stopping=True, hidden_layer_sizes=(103,),
                  learning_rate_init=0.04431671753867657, max_iter=32,
                  n_iter_no_change=32, random_state=1, verbose=0, warm_start=True)},

3: {'model_id': 3, 'rank': 6, 'cost': 0.2765151515151515, 'ensemble_weight': 0.08, 'data_preprocessor': <autosklearn.pipeline.components.data_preprocessing.DataPreprocessorChoice object at 0x7fd0f9c51a30>, 'balancing': Balancing(random_state=1), 'feature_preprocessor': <autosklearn.pipeline.components.feature_preprocessing.FeaturePreprocessorChoice object at 0x7fd0f9d146d0>, 'classifier': <autosklearn.pipeline.components.classification.ClassifierChoice object at 0x7fd0f9d141c0>, 'sklearn_classifier': ExtraTreesClassifier(bootstrap=True, max_features=28, min_samples_leaf=2,
                         min_samples_split=3, n_estimators=512, n_jobs=1,
                         random_state=1, warm_start=True)},

17: {'model_id': 17, 'rank': 7, 'cost': 0.2803030303030303, 'ensemble_weight': 0.14, 'data_preprocessor': <autosklearn.pipeline.components.data_preprocessing.DataPreprocessorChoice object at 0x7fd1001fa5e0>, 'balancing': Balancing(random_state=1, strategy='weighting'), 'feature_preprocessor': <autosklearn.pipeline.components.feature_preprocessing.FeaturePreprocessorChoice object at 0x7fd0f9bf1a00>, 'classifier': <autosklearn.pipeline.components.classification.ClassifierChoice object at 0x7fd0f9bf12e0>, 'sklearn_classifier': SVC(C=21.59109048521139, cache_size=1805.4296875, class_weight='balanced',
        gamma=5.060493057005212, max_iter=-1.0, random_state=1, shrinking=False,
        tol=0.00012027336497045934)}}

I found that automl.show_models() is not a dataframe and not sure what structure it is.
I want the values of sklearn_classifier in the rank 1 record which are in this case
ExtraTreesClassifier(criterion='entropy', max_features=231, min_samples_split=3, n_estimators=512, n_jobs=1, random_state=1, warm_start=True)

I can treat these output of automl.show_models() as string and find ExtraTreesClassifier
in that string but I don't think this is the best way to do so.
is anyone know a better way to get these values?
Thanks

A: I found the answer by using values() in dictionary
Thanks @Fabio
here is the code that worked for me
list(list(automl.show_models().values())[0].values())[8]


text:
Q: How to write data into a .SLK File I have a very simple ETL job - a simple file conversion from .txt to another. Five minutes, right? Well, except for one thing - the output file needs to be .SLK.
I Googled a bit and it seems to be a "programmed" format, with format data embedded into the file itself. Anybody have any links regarding the details of the format? Help me out here, guys!

A: .SLK is the file extension but what you want is probably better known as "SYLK" format.  It can be generated using only ASCII text. An overview of the format is here: http://hernk.wordpress.com/2007/06/23/the-sylk-file-format/
And here's is a program that generates SYLK files, although it's probably is not usable for your purposes since your source is a .TXT file rather than an an Oracle database: PL/SQL program at asktom.oracle.com.  From that link, SYLK files offer "... the ability to do much fancier stuff like fonts, headings, formulas and such."


text:
Q: Printing values from a System.String[] using foreach loop My goal is to get the IP addresses alongside the NIC names,
Here is my sample code, I want to get the value of the IPAddress object which is of type System.String[], I see a lot of internet post and try to copy their code for a foreach loop, but it is not working for me, what could be the problem?
I am still getting used to the foreach loop since it is new to me just this week
My error is highlighted at the foreach Error which is :

foreach statement cannot operate on variables of type 'object' because 'object' does not contain a public definition for 'GetEnumerator'

ManagementObjectSearcher searcher = new ManagementObjectSearcher("select * from Win32_NetworkAdapterConfiguration ");

int ram = 1;
foreach (ManagementObject obj in searcher.Get())
{
     if (obj["MACAddress"] != null)
     {
         Console.WriteLine(String.Format("NIC #{0}:", ram));

         if (obj["IPAddress"] != null) // IPAddress is of type System.String[]
         {
             foreach (string s in obj["IPAddress"])
             {
                 Console.WriteLine(s);
             }
         }
     }
}

A: This error is telling  you that obj["IPAddress"] is returning an object and that foreach doesn't know how to iterate through an object.
Therefore, you must first cast your obj to an iterable collection :
 String[] addresses = (String[])obj["IPAddress"];
 foreach (string s in addresses)
 {
     Console.WriteLine(s);
 }

Taken from msdn documentation:

The foreach statement repeats a group of embedded statements for each element in an array or an object collection that implements the System.Collections.IEnumerable or System.Collections.Generic.IEnumerable interface.

Hence the fact that foreach isn't supported for the object type.

A: You need to convert it into String Array first and then Change your code as below.
if (obj["IPAddress"] != null) // IPAddress is of type System.String[]
     {
        string[] newStringArray = (String[])obj["IPAddress"];
         foreach (string s in newStringArray )
         {
             Console.WriteLine(s);
         }
     }

Hope this helps...!!!

A: I think you need to cast obj["IPAddress"] explicitly into a String[] type.


text:
Q: Parallax effect based on image position I'm still working on a Parallax website for a client based around 3 levels. I've encountered a problem that makes it impossible for me to add in the third top level.
The site itself has a full screen background that scrolls at one speed. Its a very long vertical image scrolling slowly. On top of that is the content which scrolls at the standard speed.
The third level is simply position: absolute graphics that sit on top of certain content areas. Floating images basically.
The problem I'm having is that with the majority of parallax plugins I've tried the floating third level images don't have anything to disappear behind. Meaning while I can set them based on the screen size as soon as I change it, I see it disappearing behind an invisible line.
Are there any plugins or methods I can use to stop this happening? So essentially I want to set a position where the image would be, if the parallax effect wasn't working, and it parallaxs around that point.

A: You need to write your own code, based on pure jquery/javascript.
Plugins are created for simple operations.
You need to create JS application based on current $(document).scrollTop()
And main code pattern will be:
$(window).on('scroll resize',function(){
  var Top = $(document).scrollTop();
  if(Top < 200){ /*slide1 actions*/ }
  else if(Top >= 200 && Top < 400){ /*slide2 actions*/ }
  else if(Top >= 400 && Top < 600){ /*slide3 actions*/ }
  // etc
});

Also use this tips https://stackoverflow.com/a/11709360/1136141 for more performance

A:
The problem I'm having is that with the majority of parallax plugins I've tried the floating third level images don't have anything to disappear behind.

Is the issue that you do want the third level images to disappear at certain points? I had a similar issue with a long single scrolling background, then constructed a page of divs on top of that, with no backgrounds, then placed the images in the various divs up and down the page with the div overflow set to hidden. Made for easier placement of the third-level images, and also meant you could hide them at specific points.

A: if you can get it working on screen size just use jquery to get and set object position based on screen size,
jQuery(document).ready(function($) {

    jQuery.event.add(window, "load", resizeFrame);
    jQuery.event.add(window, "resize", resizeFrame);

    function resizeFrame()

    {
        var h = $(window).height();

        $('#foo1') .css({'top': (h-30)});
        $('#foo2') .css({'left': (h-67)});

    }
});

for example.


text:
Q: Determine number of images to place in a fixed layer Just as the title explains.
I need to determine how many images from a collection of images I can place in a div, that is for example 100px x 100px and the width and height of each image.
I've been trying to figure the algorithm out for this but my brain is fried.
What I have so far (JavaScript) is to take the width + height (minus padding) / the number of images I have, so let's say I have 13 images to place in 100x100 I can place a maximum of 4, for example, but how do I determine the height (width will be 100px) for each image to make the proportionally fit?
Update
Okay, I have 20+ images that I want to display in a 100x100  block without cutting off images on either the left or right. So, how do I determine, via code that I can only display 4 images, each of 25px x 25px. How do I determine the appropriate width*height of 4 images to fit optimally within 100*100 .

A: The short answer is WidthOfYourDisplayArea \ NumberOfImagesYouWantToFitInThatArea. Where "\" signifies integer division but there's a little bit more to that.
At its base, that would be a tiling problem i.e. Fill a 100x100 rectangle with 20 thumbnails at various sizes (please see below). But, since you are fixing the dimensions of the thumbnails it ends up being an easier problem to deal with.
Due to the images having an aspect ratio, you will have to work with just one dimension and have the other one "work itself out".
Your thumbnails will still have to measure 25x25 anyway, but the images inside them will have to be resized for the content to appear undistorted. So what you could do would be to wrap your imgs inside divs. The divs will be 25x25 but the imgs dimensions will be different.
If the original image for which you are trying to work the thumbnail out is 1024x768 (for example) then its aspect ratio is Width / Height = 1024/768 = 1.33333 . What you would be trying to find out is the height of the image by fixing its width. Therefore you are looking at something like 25 * (Height / Width) (notice the reversal) which works out to something like 25 * (1/1.33333) = 18.75004. So, this thumbnail will look a bit like a "band" going across the 25x25 square and living a space of about 3 pixels at the top and at the bottom.
I hope this helps.


text:
Q: Add "task switcher" to desktop panel I upgraded from Ubuntu 18.04 to 22.04. I used to have an icon on the bottom-panel that showed a list of all the application windows that were active on the desktop. That was particularly useful for finding apps that were still running but whose windows had been minimized.
I can't figure out how to enable this with the 22.04 image. Note that I don't want an icon for each application-window to be shown on the  bottom-panel, it turns into junk that way. I want them bundled into a vertical list that only shows up when I click on the icon.
Also, I don't mean the "Application Launcher" that shows what applications are available to be run. I only want the list of applications that really are running. I'm not sure what the name of the list is, I believe it was called the "task switcher".
I'm running gnome-shell 42.5.

A: After some wait time, I think you are referencing the gnome extension "Window List" of which there is one with gnome-shell 42 and 43 compatibility.
https://extensions.gnome.org/extension/602/window-list/
You should be able to download and install the extension for shell 42 and regain the tool you expect.
https://itsfoss.com/gnome-shell-extensions/#:~:text=Installing%20GNOME%20Shell%20Extensions%201%20Use%20gnome-shell-extensions%20package,3%20Install%20GNOME%20Shell%20Extensions%20manually.%20See%20More.

A: This seems to give me what I want:
https://extensions.gnome.org/extension/4833/all-windows-saverestore-window-positions/


text:
Q: EF not creating table for virtual properties I'm using EF with code-first. My model contains two virtual properties like:
ClassA

public int Id { get; set; }
public string Name { get; set; }
public virtual List<int> Teams { get; set; }
public virtual List<int> Levels { get; set; }

EF has created db tables for me there is only ClassA table. There is no table I can store Teams and Levels data. When I run Add-Migration command, created migration file is empty is EF thinks there is no pending changes. Also when I run Update-Database command EF says there is no pending changes.
What am I missing here?

A: Why not do:
public class Team {
    public int Id { get; set; }
    public virtual ICollection<Player> Players { get; set; }
}
public class Level {
    public int Id { get; set; }
    public virtual ICollection<Player> Players { get; set; }
}
public class Player {
    public int Id { get; set; }
    public string Name { get; set; }
    public virtual ICollection<Team> Teams { get; set; }
    public virtual ICollection<Level> Levels { get; set; }
}

In case you really want 'light weight' (please don't) you could do:
public class Player {
    public int Id { get; set; }
    public string Name { get; set; }
    //use comma separated values (starting and ending with ,)
    public string Teams { get; set; }
    public string Levels { get; set; }
}

Say you have these in your context
var player1 = new Player(){Teams = ",1,2,"}
var player2 = new Player(){Teams = ",3,2,"}

Now, you could get both in team 2 by
var players = context.Players.Where(p=>p.Teams.Contains(",2,"));


text:
Q: Is it advised to not play Hearthstone Android not on WiFi Generally I have been quite lucky and had matches that worked fine, however I have had several arena matches fail to connect or become glitched in ways that make it impossible to do anything.
I have been in games where I cannot interact with my cards. But most annoying was the last game where it didnt even give me a turn, I got to sit and watch the opponent take his turn then mine, all whilst the normal timer continued to tick down.
Have blizzard given any warnings about the performance of this version? Also does anyone know how to rectify any of these glitches?

A: Hearthstone's reconnect feature, along with any of the connectivity in the game, is appallingly designed or at least based on security over usability. Consequently, a short disconnect or dropping a single packet of data can be enough to desync the game.
Wifi is naturally going to be less reliable and mobile data will be even less so. However, there are other factors at work here. Switching to a wired connection might fix the problem but it will do nothing if the problem is with the internet connection itself.
Blizzard have responded to these complaints on different occasions by pointing out that the desyncs are the user's fault for not using a perfect connection. They also warn that they do not give refunds for any disconnection related issues.


text:
Q: How get value in the object in the array, if array is in the object and the object in the next array? Expected effect: iterate objects in array, get value example 'email' in objects in array comments.
I would like to spell the array and nested objects and arrays and return the 'email' value. When I get array comments I try to get value email in object I have error email is undefined
let scores =  [
  {
    "userId": 1,
    "id": 1,
    "title": "bbbb",
    "project": "JS",
    "completed": false,
    "comments": [
      {
        "itemId": 1,
        "id": 1,
        "name": "provident id voluptas",
        "email": "Meghan_Littel@rene.us",
        "body": "sdsdsd"
      },
      {
        "itemId": 1,
        "id": 2,
        "name": "provident id voluptas",
        "email": "fdfdfdf_Littel@rene.us",
        "body": "sdsdsd"
      }
    ]
  },
 {
    "userId": 1,
    "id": 2,
    "title": "ggggg",
    "comments": [
      {
        "itemId": 2,
        "id": 1,
        "name": "odio adipisci rerum aut animi",
        "email": "Nikita@garfield.biz",
        "body": "dsdsdsd"
      }
    ]
  }
]

let obj;

for (var key in scores) {
      obj = scores[key];
      console.log(obj.comments); //return objects array
    }

 for (var key in ob) {
      let ob1 = ob[key];
      console.log(ob1[email]); //return email is undefined
    }

A: You need to iterate comments as well and get the property email.
With for ... of statement and destructuring assignment.

let scores = [{ userId: 1, id: 1, title: "bbbb", project: "JS", completed: false, comments: [{ itemId: 1, id: 1, name: "provident id voluptas", email: "Meghan_Littel@rene.us", body: "sdsdsd" }, { itemId: 1, id: 2, name: "provident id voluptas", email: "fdfdfdf_Littel@rene.us", body: "sdsdsd" }] }, { userId: 1, id: 2, title: "ggggg", comments: [{ itemId: 2, id: 1, name: "odio adipisci rerum aut animi", email: "Nikita@garfield.biz", body: "dsdsdsd" }] }];

for (let { comments } of scores) {
    for (let { email } of comments) {
        console.log(email);
    }
}

With Array#forEach

let scores = [{ userId: 1, id: 1, title: "bbbb", project: "JS", completed: false, comments: [{ itemId: 1, id: 1, name: "provident id voluptas", email: "Meghan_Littel@rene.us", body: "sdsdsd" }, { itemId: 1, id: 2, name: "provident id voluptas", email: "fdfdfdf_Littel@rene.us", body: "sdsdsd" }] }, { userId: 1, id: 2, title: "ggggg", comments: [{ itemId: 2, id: 1, name: "odio adipisci rerum aut animi", email: "Nikita@garfield.biz", body: "dsdsdsd" }] }];

scores.forEach(({ comments }) => comments.forEach(({ email }) => console.log(email)));

A: You would need a nested loop for all emails, but if you know the index of the email you are looking for then just pass that index to the comments[index]
scores[current_iteration].comments[current_iteration].email


text:
Q: How to get verbose output for undefined reference error using -v in clang (Android-Studio) Whenever you get a linker error in Android Studio it suggests you to use -v to see invocation, but where to put the -v command to get the "verbose output" (according to llvm clang command guide)?
Already tried:
externalNativeBuild {
            cmake {
                cppFlags "-frtti -fexceptions -v"
            }
        }

which is not changing anything in the output as far as i noticed and

--stacktrace --debug

in
Settings > Compiler > Command-line Options

Which is showing way more output but not what I am looking for!
Thank you very much for your help in advance!
EDIT
Since i am compiling C files i obviously had to use cFlags. Now the gradle file looks as follows (thx to @Alex Cohn):
apply plugin: 'com.android.application'

android {
    compileSdkVersion 25
    buildToolsVersion "25.0.3"
    defaultConfig {
        applicationId "<my_id>"
        minSdkVersion 16
        targetSdkVersion 25
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        externalNativeBuild {
            cmake {
                cFlags "-v"
            }
        }
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    externalNativeBuild {
        cmake {
            path "CMakeLists.txt"
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    compile 'com.android.support:appcompat-v7:25.3.1'
    compile 'com.android.support.constraint:constraint-layout:1.0.1'
    testCompile 'junit:junit:4.12'
}

EDIT 2
Adding following pre-processor command in a few C-classes i did not notice they were missing it, i was able to get rid of my linker error about the missing reference:
#ifdef __cplusplus
extern "C"
{
#endif

// your includes and your code here

#ifdef __cplusplus
}
#endif

A: *

*cppFlags "-frtti -fexceptions -v" works as well as cppFlags "-frtti", "-fexceptions",  "-v" for clang++ tasks, that is, to get verbose output for .cpp or .cxx files compilation.

*cFlags "-v" works to produce verbose output for .c files compilation.

*To produce verbose output for link step, edit your CMakeLists.txt file, add -v to the relevant target_link_libraries statement, e.g.
target_link_libraries(myjnilib android log -v)

*All above may not be enough to understand and fix undefined reference error.


text:
Q: Powershell force 5 digit format in a string pattern So what I have now will (below) will search for XX-##-# and force it to XX-##-#0000.
How can I do this to return XX-##-0000#?
Is there a way to force 5 digits at the end, filling preceding 0s, to cover the other possibilities (XX-##-##, XX-##-###, XX-##-####)? As opposed to copying this 4 times, slightly adjusting for each.
$Pattern1 = '[a-zA-Z][a-zA-Z]-[0-9][0-9]-[0-9]'
Get-ChildItem 'C:\path\to\file\*.txt' -Recurse | ForEach {
     (Get-Content $_ |
     ForEach  { $_ -replace $Pattern1, ('$1'+'0000')}) |
     Set-Content $_
}

Thanks.
EDIT: I would like to do the following
Search           Replacement
XX-##-#          XX-##-0000#
XX-##-##         XX-##-000##
XX-##-###        XX-##-00###
XX-##-####       XX-##-0####

A: Unfortunately, PowerShell's -replace operator doesn't support passing an expression (script block) as the replacement string, which a succinct solution would require here.
However, you can use the appropriate [regex] .NET type's .Replace() method overload:
Note: This solution focuses just on the regex-based replacement part, but it's easy to embed it into the larger pipeline from the question.
# Define sample array.
$lines = @'
Line 1 AB-00-0 and also AB-01-1
Line 2 CD-02-22 after
Line 3 EF-03-333 it
Line 4 GH-04-4444 goes
Line 5 IJ-05-55555 on
'@ -split "`n"

# Loop over lines...
$lines | ForEach-Object {
  # ... and use a regex with 2 capture groups to capture the substrings of interest
  #     and use a script block to piece them together with number padding
  #     applied to the 2nd group
  ([regex] '\b([a-zA-Z]{2}-[0-9]{2}-)([0-9]+)').Replace($_, {
    param($match)
    $match.Groups[1].Value + '{0:D5}' -f [int] $match.Groups[2].Value
  })
}

The above yields:
Line 1 AB-00-00000 and also AB-01-00001
Line 2 CD-02-00022 after
Line 3 EF-03-00333 it
Line 4 GH-04-04444 goes
Line 5 IJ-05-55555 on

A:
This is ancillary information that should help you fix your current
  code and come to the correct conclusion.

https://technet.microsoft.com/en-us/library/ee692795.aspx
I recommend utilizing a combination of the techniques listed in this documentation.  The example provided is very helpful in numeric formatting:
$a = 348
"{0:N2}" -f $a
"{0:D8}" -f $a
"{0:C2}" -f $a
"{0:P0}" -f $a
"{0:X0}" -f $a

Output
348.00
00000348
$348.00
34,800 %
15C

You can also utilize [String]::Format and add in some assertions to insure the item is formatted properly; If a specific value is not specified for example you could simply default it to 0.
https://blogs.technet.microsoft.com/heyscriptingguy/2013/03/11/understanding-powershell-and-basic-string-formatting/
Hope this helped.

A: Create capturing groups. Combine them while applying the formatting to the second.
Edit: Updated to remove the assumption that the line is only the matching string. Note, the assumption that there is only one match per line still exists.
$Pattern1 = '^(.*?)([a-zA-Z][a-zA-Z]-\d\d-)(\d+)(.*)$'
Get-ChildItem 'C:\path\to\file\*.txt' -Recurse |
    ForEach-Object {
        (Get-Content $_ |
            ForEach-Object {
                if ($_ -match $Pattern1) {
                     "{0}{1}{2:D5}{3}" -f $matches[1],$matches[2],[int]$matches[3],$matches[4]
                } else {
                    $_
                }
            }) | Set-Content -Path $_
    }

A: Use a look-ahead:
$Pattern1 = '(?<=[a-zA-Z][a-zA-Z]-\d\d-)(?=\d)(?!\d\d)'
Get-ChildItem 'C:\path\to\file\*.txt' -Recurse | ForEach {
(Get-Content $_ |
ForEach  { $_ -replace $date_pattern1, ('000')}) |
Set-Content $_

The look-ahead (?=\d) asserts, without consuming, that the next char is a digit.
The negative look-ahead '(!\d\d) asserts there are not 2 digits at the end, so you don't end up with XX-##-0000##.
Also note that \d (a "digit") is exactly the same as [0-9] (but easier to code.
I think you have to do the replacement 4 times.

A: #example of the text we'd load in from file / whereever
$value = @'
this is an example of a value to be replaced: 1AB-23-45 though
we may also want to replace 0CD-87-6 or even 9ZX-00-12345 that
'@

#regex to detect the #XX-##-##### pattern you mentioned (\b word boundaries included so we don't pick up these patterns if they're somehow part of a larger string; though that seems unlikely in this case)
$pattern = '\b(\d[A-Z][A-Z])-(\d\d)-(\d{1,5})\b'
#what we want our output to look like; with placeholders 0, 1, & 2 taking values from our captures from the above.
$format = '{0}-{1}-{2:D5}'

<#
 # #use select-string to allow us to capture every match, rather than just the first
 # $value | Select-String -Pattern $pattern -AllMatches | %{
 #     #loop through every match replacing the matched string with the reformatted version of itself
 #     $_.matches | %{
 #         #NB: we have to convert the match in group#3 to int to ensure the {2:D3} formatting from above will be applied as expected
 #         $value = $value -replace "\b$($_.value)\b", ($format -f $_.Groups[1].Value,$_.Groups[2].Value,([int]$_.Groups[3].Value))
 #     }
 # }
#>

#or this version's a little more efficient; using the matched positions to replace the strings in those positions with our new formatted value
$value | Select-String -Pattern $pattern -AllMatches | %{
    $_.matches | sort index -Descending | %{
        $value = $value.remove($_.index, $_.value.length).insert($_.index, ($format -f $_.Groups[1].Value,$_.Groups[2].Value,([int]$_.Groups[3].Value)))
    }
}

$value

A: Simple example.  Search numbers at the end of a string.
$text = 'aa-11-123'
$text -match '\d+$'  # sets $matches
$result = ($matches.0).padleft(5,'0')
$text -replace '\d+$', $result  # \d* won't work right

aa-11-00123


text:
Q: Could power cycling a modem 24 times a day for over 3 years (>30,000 times) cause the modem to lose its settings? Could power cycling a modem 24 times a day with it being on for 10mins at a time for over 3 years (>30,000 times) cause the modem to lose its setting and revert to factory?
This modem.

A: Sure, depending on how the firmware was written it may have worn out the EEPROM (typically good for >100,000 writes). That's not normal operation and they may not have tested for it.
On the other hand, a cheaply designed reset circuit and memory protection could result in corruption and therefore revert to defaults from a single upset.


text:
Q: Allocation of individuals by probability distribution I've got a problem of allocation of individuals by zones. To simplify this, let's say we have 5 sets, each one with a given (and decreasing) population.
S1=1000
S2=100
S3=50
S4=25
S5=5

I'd like to allocate these populations to zones (say, 10 zones Z1-Z10). Each zone has a given probability of hosting the individuals from the sets.
In a matrix form:
N<-matrix(prob,nrow=5,ncol=10)

N probabilities per set being something like:
0.15  0.05  0.1  0.05 0.05  0.2  0.01 0.09  0.15  0.15
...........
0.15  0.05  0.1  0.05 0.05  0.2  0.01 0.09  0.15  0.15

I'd like to know the resulting population, for each set, for each zone. In the first row there's no problem, because the population is high. Just multiplying 1000 by the probabilities:
S1 allocation is OK:
150  50  100  50 50 200 10  90  150  150  (individuals)

but, when you get to set S3, popul. 50, rounding is not easy as some zones would get less than 1 individual:
S3 allocation:
7.5   2.5  5  2.5  2.5  10  0.5 4.5 7.5  7.5 (individuals)

You may even get to potential sets with only 1 individual to be allocated to one of 10 zones.
How can I use the sample function in R (sample(data,size,prob)), or a similar one, to produce the allocation matrix that calculates an integer number of individuals per zone?
NB: obviously in the real problem the no. of zones is much higher, and probabilities vary for each zone.
Thanks in advance,          dev

A: You can use rmultinom to sample. For example rmultinom(1, S1, prob). And to get the desired matrix, just use it inside sapply.
t(sapply(c(S1, S2, S3, S4, S5),
         rmultinom,
         n=1,
         prob=prob))

EDIT: It is not entirely clear what your criteria for rounding is. Here are two possibilities:
fct <- function(s, prob, method=c("multinom", "maxima")){
  method <- match.arg(method)
  sp <- s*prob
  res <- floor(sp)
  if (sum(res) < s) {
    size <- s-sum(res)
    prob <- sp-res
    if (method=="multinom")
      # rmultinom version
      res <- res + rmultinom(n=1, size=size, prob=prob)
    if (method=="maxima"){
      # maximum version
      rnk <- rank(prob, ties="random")
      res[rnk <= size] <- res[rnk <= size] + 1
    }
  }
  return(res)
}
t(sapply(c(S1, S2, S3, S4, S5), fct, prob=prob, method="mult"))
t(sapply(c(S1, S2, S3, S4, S5), fct, prob=prob, method="max"))


text:
Q: Kotlin extension with parameters On an Android project with both Kotlin and java, I want to use the Kotlin functions substringBeforeLast(delimiter) and substringAfterLast(delimiter) in some java files.
So i thought of using extensions. I did the following which works,
fun String.getStringAfterLast(): String{
    return this.substringAfterLast(".")
}

however i was thinking of passing the delimiter as a parameter, but it gives me an error when trying to use in java "remove 2nd argument..."
fun String.getStringBeforeLast(delimiter: String): String{
    return this.substringBeforeLast(delimiter)
}

Is the approach correct ? Can it be done ?

A: Your approach to this problem is correct and it should work. For example, with this Kotlin code:
fun String.getStringBeforeLast(delimiter: String): String{
    return this.substringBeforeLast(delimiter)
}

You should be able to invoke the function from Java like this:
ExtensionKt.getStringBeforeLast(str, ",");

If it didn't work then I guess there had to be some small mistake, like for example: you added delimiter param to getStringBeforeLast() function, but mistakenely tried to invoke getStringAfterLast() function from Java.
Also, you can always invoke functions of Kotlin stdlib directly from Java. Just note that substringBeforeLast()/substringAfterLast() actually receive one additional, optional parameter and you need to provide it from Java, making the code a little more verbose:
StringsKt.substringBeforeLast(str, ",", str);


text:
Q: Verifying a $K$-basis for a primitive extension $K\subset K(\alpha)$ Let $K\subset L:=K(\alpha)$ be a primitive field extension of degree $n$ and we define $c_i\in L$ as
\begin{align*}
    \sum_{i=0}^{n-1}c_i x^i=\frac{f^{\alpha}_K}{(x-\alpha)}\in L[x]\quad(1)
\end{align*}
where $f^{\alpha}_K$ is the minimal polynomial of $\alpha$ over $K$. The goal is to prove that $\{c_i\}_{i\in\{0,\ldots,n-1\}}$ is a $K$-basis for $L$. The book (considering introductions to Galois theory) does not define what a $K$-basis for $L$ is but I suppose it is defined as follows: for a (primitive) field extension $K\subset L$ of degree $n$, a $K$-basis for $L$ is defined as a set $\{c_i\}_{i\in\{0,\ldots,n-1\}}$ such that every element $l\in L$ can be written as a unique (because basis elements are independent) combination $k_0c_0+k_1c_1+\ldots+k_{n-1}c_{n-1}$ with $k_i\in K$. Is this a plausible definition?
Now let's look at how to manipulate the equation at (1). This can be written as $$(x-\alpha)=\frac{f^{\alpha}_K}{\sum_{i=0}^{n-1}c_i x^i}.$$ Since the linear term $(x-\alpha)$ is definitely in $L[x]=K(\alpha)[x]$, the RHS must also be. We make the remark that $\deg f^{\alpha}_K=n$ because $K\subset L$ is a field extension of degree $n$ and also that the degree of the polynomial in $L[x]$ in the denominator is at most $n-1$. Hence, at most a quantity of $n-1$ basis elements $c_i$ is needed. Whether these elements are independent, I wouldn't know; maybe it is shown by contradiction, or by long division arguments. Can someone pull me into the right direction? Thanks for the time!

A: Yes, your definition of basis is correct. Here, "basis" is just the usual linear algebra definition of basis, which applies here because $L$ is indeed a $K$-vector space.
Your long division idea is the right direction to head towards. Setting $f^\alpha_K(x) = x^n + d_{n-1}x^{n-1} + \ldots + d_0$, the first few terms of $f^\alpha_K / (x - \alpha)$ are
$$ \frac{f^\alpha_K}{x-\alpha} = x^{n-1} + (d_{n-1} + \alpha)x^{n-2} + (\alpha(d_{n-1} + \alpha) + d_{n-2})x^{n-3} + \ldots$$
Note that the coefficients are increasing degree polynomials in $\alpha$ with $K$-coefficients. Thus, it's easy to construct $1, \alpha, \alpha^2, \ldots, \alpha^{n-1}$ as $K$-linear combinations of them. So we conclude that they are a $K$-basis for $L$.


text:
Q: Convert random tree to directed tree in netwokx I have generated a random tree using networkx.
A = nx.random_tree(15)

I am trying to convert it to a directed graph (i.e. tree).
G = nx.to_directed(A)

However, the result is a graph with two directions.
I would like to get the output as one direction tree.

A: According to official documentation:

Returns:  G – A directed graph with the same name, same nodes, and with each edge (u, v, data) replaced by two directed edges (u, v, data) and (v, u, data).

If you want to delete reversed edges, you can write something like this:
G = nx.random_tree(10)
H = nx.DiGraph([(u,v) for (u,v) in G.edges() if u<v])

So H will be the tree you needed:


text:
Q: Query to Select Existing Key I have a table with the following data
key     code
============
key1    220
key1    221
key2    220
key2    221
key2    222
key3    220
key4    255
key5    220
key5    221

A combination of key and code cannot repeat in the table (the 2 columns are used as composite primary keys).
I will like a query that will select the matching keys for a given set of codes e.g. for codes 220, 221, the expected result will be key1 and key 5 because only these match exactly these code set.

A: Are you looking for something like this??
DECLARE @Test TABLE (TblKey CHAR(4), code INT)

INSERT INTO @test VALUES('key1', 220),('key1', 221),('key2', 220),('key2', 221),
                        ('key2', 222),('key3', 220),('key3', 220),
                        ('key4', 255),('key5', 220), ('key5', 221)

SELECT TblKey FROM @Test WHERE Code = 220
INTERSECT
SELECT TblKey FROM @Test WHERE Code = 221

When I run this, I get an output of key1, key2, key5 - all of which have an entry with both values 220 and 221 in your sample.

A: Insert the values you are looking for to a table variable @Match and use that in a query against your table @T.
declare @T table
(
  [key] char(4),
  code int,
  primary key([key], code)
)

insert into @T values
('key1',    220),
('key1',    221),
('key2',    220),
('key2',    221),
('key2',    222),
('key3',    220),
('key3',    333),
('key4',    255),
('key5',    220),
('key5',    221)

declare @Match table (code int)
insert into @Match values (220),(221)

select T.[key]
from @T as T
  left outer join @Match as M
    on T.code = M.code
group by T.[key]
having count(*) = (select count(*) from @Match) and
       count(M.code) = (select count(*) from @Match)

https://data.stackexchange.com/stackoverflow/q/119432/

A: Just to throw another option on the table:
declare @KeyCode Table
(
    [Key] nvarchar(10),
    Code nvarchar(10)
)

insert into @KeyCode values('key1',    220)
insert into @KeyCode values('key1',    221)
insert into @KeyCode values('key2',    220)
insert into @KeyCode values('key2',    221)
insert into @KeyCode values('key2',    222)
insert into @KeyCode values('key3',    220)
insert into @KeyCode values('key3',    220)
insert into @KeyCode values('key4',    255)
insert into @KeyCode values('key5',    220)
insert into @KeyCode values('key5',    221)

select [Key]
from @KeyCode
where Code = 220

intersect

select [Key]
from @KeyCode
where Code = 221

except

select [Key]
from @KeyCode
where Code not in (220,221)

Returns key1 and key5.
Working example.

A: Do you mean something like this?
SELECT key
FROM tblKeyCodes
where code in (220,221)


text:
Q: Why do Here Maps JS events stop firing when loaded into a .NET WebBrowser control? I have an interactive Here Maps map running in Legacy mode, with a tap event listener added, like so:
<!DOCTYPE html>

    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />

    <link rel="stylesheet" type="text/css" href="https://js.api.here.com/v3/3.1/mapsjs-ui.css" />

This works all well and fine in browsers like Chrome and IE11, with the map being draggable and tap event details being logged to the console. However, as soon as this page is added as the URL for a .NET WebBrowser control in a WinForms project, the map dragging and tap events suddenly stop working, with no errors being logged to the console. It's almost as if something there is preventing the map events from firing for some reason.
I've already tried the registry hack detailed in this post to force the WebBrowser in the WinForms app to use IE11 without IE7 Compatibility Mode (and verified this was applied properly with a user agent checker), to no avail. I've also tried running the page as it's loaded into the WinForms app in the Visual Studio debugger, and it's definitely hitting the addEventListener line with no problems. The last thing I tried was adding a button to the page with a click event, and this works fine too.
I feel like I'm running out of options here. Is there something I'm overlooking, or is there some weird behaviour in WebBrowser controls that would prevent these events from firing? If so, is there a way around it?

A: Legacy support1:
Internet Explorer 9, 10, 11
iOS WebView desktop
iOS 11+
To know more about the browser support for JS APIs, please refer : https://developer.here.com/documentation/maps/3.1.17.0/dev_guide/topics/why-use.html


text:
Q: Is a *self-contradictory self-referential* statement false? Fitch concludes in his paper "A Goedelized formulation of the prediction paradox" that the following is a self-contradictory self-referential statement:
P: The prisoner will be hanged next week and its date will not be deducible the night before using this statement as an axiom.
Let's assume that this statement is false, no matter what the hanging day is. A judge has said this statement to two prisoners, and has chosen Monday and Tuesday as the hanging days.
Prisoner 1 is hanged on Monday, then ~P implies that it's deducible from P that the hanging day is Monday.
Prisoner 2 is hanged on Tuesday, then ~P implies that it's deducible from P that the hanging day is Tuesday.
It's a contradiction. Where's the fault?

A: We often use "self-contradictory" to mean simply "contradictory".
In this case: yes, a contradictory statement is always false.
If with "self-contradictory" we assume some form of "self-reference", we have to consider that self-reference is a thorny issue:

In the context of language, self-reference is used to denote a statement that refers to itself or its own referent. The most famous example of a self-referential sentence is the liar sentence: "This sentence is not true."

Thus, if with "self-contradictory" we mean the paradigmatic Liar-example :

"This sentence is not true",

the answer is that both assumptions about its truth-value lead to contradiction.


text:
Q: Interface Builder: Enabled1,2 property with OR operator I need to set the property Enabled of a control in interface builder, depending on 2 booleans int he preferences.
However the operator should be OR and not AND. If one of the two is true, than my control should be enabled.
Currently, I can only make it work with an AND operator, (See screenshot).

Thanks

A: Unfortunately, in IB, you're stuck with and.   My suggestion would be to add a new property to an object accessible to your NIB (possibly your owner for the NIB), which is dependent on changes to the other objects in order to enable your control/view.
It looks like you're using the Shared User Defaults Controller, so I would suggest that in the owner you create a new boolean property for your combined user defaults (perhaps downloadingCastOrCrew), and then you'll need to make sure that when either of the defaults change, you change the value of downloadingCastOrCrew:
In your Interface:
@property BOOL downloadingCastOrCrew;

In the implementation as you're setting up your controller or after awakeFromNib:
 [[NSUserDefaultsController sharedUserDefaultsController] addObserver:self
      forKeyPath: @"values.kSearchPreferencesDownloadCast"
      options:NSKeyValueObservingOptionNew
      context:NULL];
 [[NSUserDefaultsController sharedUserDefaultsController] addObserver:self
      forKeyPath: @"values.kSearchPreferencesDownloadCrew"
      options:NSKeyValueObservingOptionNew
      context:NULL];

In the implementation as you're tearing down your controller:
     [[NSUserDefaultsController sharedUserDefaultsController] removeObserver: self
          forKeyPath: @"values.kSearchPreferencesDownloadCast"];
 [[NSUserDefaultsController sharedUserDefaultsController] removeObserver: self
      forKeyPath: @"values.kSearchPreferencesDownloadCrew"];

Add an observer if you don't already have one:
 - (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object
      change:(NSDictionary *)change context:(void *)context
 {
     NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
     self.downloadingCastOrCrew = [defaults boolForKey: @"kSearchPreferencesDownloadCast"]
         || [defaults boolForKey: @"kSearchPreferencesDownloadCrew"];
 }

By using the accessor method, you'll trigger kvo and you'll be able to use the controller's downloadingCastOrCrew as your boolean to check instead of the NSUserDefaults values directly.
Obviously, if you already have an observeValueForKeyPath, you will likely want to add a context value to the addObserver:forKeyPath:options:context call and check it in the observeValueForKeyPath:ofObject:change:context call.

A: You can do it in this way :
Create a third property
@property BOOL isFirst;
@property BOOL isSecond;

@property BOOL isTextFieldVisible;//this one is your third

- (IBAction)isSec:(id)sender;
- (IBAction)isFir:(id)sender;

In implementation
- (id)init
{
    self = [super init];
    if (self) {
        self.isFirst=NO;
        self.isSecond=NO;
    }
    return self;
}

- (IBAction)isSec:(id)sender {
    self.isSecond=!self.isSecond;
    [sender setTitle:[NSString stringWithFormat:@"isSecond: %d",self.isSecond]];

    self.isTextFieldVisible=self.isFirst || self.isSecond;

    self.isTextFieldVisible=!self.isTextFieldVisible;

    NSLog(@"->%d",self.isTextFieldVisible);
}

- (IBAction)isFir:(id)sender {
    self.isFirst=!self.isFirst;
    [sender setTitle:[NSString stringWithFormat:@"isfirst: %d",self.isFirst]];

    self.isTextFieldVisible=self.isFirst || self.isSecond;

     self.isTextFieldVisible=!self.isTextFieldVisible;

    NSLog(@"->%d",self.isTextFieldVisible);
}
@end

And in the binding just bind the textField to third property,
Check the running application here.
EDIT 1:
Change  ValueTransformer NSNegateBoolean in IB. so that my two lines self.isTextFieldVisible=!self.isTextFieldVisible; is not required in both the IBAction.


text:
Q: fullCalendar renderEvent not sticking I'm trying to insert an event to my fullcalendar and let it be there when i refresh the page but it's disappeared for some reason.
    <script>
$(document).ready(function() {

    // page is now ready, initialize the calendar...

    $('#calendar').fullCalendar({
    header: {
            left: 'prev,next today',
            center: 'title',
            right: 'month,basicWeek,basicDay'
        },
        selectable: true,
        selectHelper: true,
        select: function(start, end) {
            var title = prompt('Event Title:');
            var eventData;
            if (title) {
                eventData = {
                    title: title,
                    start: start,
                    end: end
                };

                $('#calendar').fullCalendar('renderEvent', eventData, true);

            }
            $('#calendar').fullCalendar('unselect');
        },
    })

});
</script>

I have try to change the code as well so it look samthing like this
                    if (title)
                {
                    calendar.fullCalendar('renderEvent',
                        {
                            title: title,
                            start: start,
                            end: end,
                            allDay: allDay                          },
                        true
                    );
                }
                calendar.fullCalendar('unselect');
            },

but i just got nothing on the page like i missing something

A: The data disappears when you refresh the page because you haven't saved the new event anywhere, nor do you have any functions to retrieve the previously-saved events. The new event exists solely within browser document. As soon as you leave the page, the document's data is discarded.
You need to save the data somewhere—client-side or server-side—then you need to retrieve that saved data each time the page loads. Traditionally programmers store data server-side, usually in databases. Client-side storage stores data in the browser and can be useful if users only need to access their own data but comes with many limitations (e.g., your work computer and home computer will have different saved data).


text:
Q: SpelParseException: After parsing a valid expression, there is still more data in the expression: 'lcurly({)' I am trying to condtionally create a component using @ConditionalOnExpression("not ${service.synchronous} && not ${service.disabled}").
I based this on Spring Boot SpEL ConditionalOnExpression check multiple properties, which provides a multi-property conditional as follows: @ConditionalOnExpression("${properties.first.property.enable:true} && ${properties.second.property.startServer:false}")
However, I keep getting:
Caused by: org.springframework.expression.spel.SpelParseException: EL1041E: After parsing a valid expression, there is still more data in the expression: 'lcurly({)'
Those properties are always set in my .properties file so I did not provide a default value with the colon notation. What am I doing wrong?

A: You will need to provide the default values for your properties like in the example you followed, so update the expression to be:
@ConditionalOnExpression("not ${service.synchronous:false} && not ${service.disabled:true}")

A: In most such cases the properties your app is reading are not what you expect them to be.
Set a breakpoint on all constructors of SpelParseException. In the debugger you will see the expression that is parsed, that will give show you exactly which properties you are really using.
Maybe you have to go search a little in the stack until you find the right location where you can see the expression.

A: My mistake was that I had not imported the test properties file in a Spring test.
After I added @TestPropertySource("classpath:/application.properties") to the test class, the properties from the properties file were used.


text:
Q: Centering navigation bar won't work I have made a navigation bar and I am trying to make it centered to fit all screens, with position absolute and then use left: 50%; and then place it by margin-left: 100px; to get it exactly where I want it. I have done this to all my buttons and it worked, but when I try doing it on my navigation bar, it moves the whole bar to the middle and when I then move it, it won't work.
html code:

test

test

test

test

css code as it is normally:
 #navBarTop {
    width: 100%;
    float: left;
    padding: 0;
    background-color: #FFB700;
    border-bottom: 1px solid #4c4c4c;
    position: absolute;
    bottom: 0;
}

#navBarTop ul {
    list-style: none;
    width: 800px;
    margin: 0 auto;
    padding: 0;
    margin-left: 350px;
}

#navBarTop li {
    float: left;
}

#navBarTop li a {
    display: block;
    padding: 10px 25px;
    text-decoration: none;
    font-family: "Arial";
    color: #4c4c4c;
    border-right: 1px solid #4c4c4c;
}

#navBarTop li:first-child a {
    border-left: 1px solid #4c4c4c;
}

#navBarTop li a:hover {
    background-color: #ffffff;
}

css when I am trying to make it centered(doesn't work):
#navBarTop {
    width: 100%;
    float: left;
    padding: 0;
    background-color: #FFB700;
    border-bottom: 1px solid #4c4c4c;
    position: absolute;
    left: 50%;
    margin-left: 100px;
    bottom: 0;
}

#navBarTop ul {
    list-style: none;
    width: 800px;
    margin: 0 auto;
    padding: 0;
    margin-left: 350px;
}

#navBarTop li {
    float: left;
}

#navBarTop li a {
    display: block;
    padding: 10px 25px;
    text-decoration: none;
    font-family: "Arial";
    color: #4c4c4c;
    border-right: 1px solid #4c4c4c;
}

#navBarTop li:first-child a {
    border-left: 1px solid #4c4c4c;
}

#navBarTop li a:hover {
    background-color: #ffffff;
}

A: I think you're trying too hard.

#navBarTop {
    padding: 0;
    background-color: #FFB700;
    border-bottom: 1px solid #4c4c4c;
    position: absolute;
    text-align: center;
    top: 50px;
    left: 0;
    right: 0;
}
#navBarTop ul {
    list-style: none;
    margin: 0 auto;
    padding: 0;
    display: inline-block;
}
#navBarTop li {
    display: inline-block;
}
#navBarTop li a {
    display: block;
    padding: 10px 25px;
    text-decoration: none;
    font-family:"Arial";
    color: #4c4c4c;
    border-right: 1px solid #4c4c4c;
}
#navBarTop li:first-child a {
    border-left: 1px solid #4c4c4c;
}
#navBarTop li a:hover {
    background-color: #ffffff;
}

test

test

test

test


text:
Q: WinRT C# - out of memory - reading image files I have a fairly simple program that tries to read all the graphic files in my Picture Library.  I create a bitmapImage for each file and I never use it or reference it.  After reading 61 files, I get an Out of Memory exception - it is reproducible, it always dies on the 61st file.
BitmapImage bitmapImage = new Windows.UI.Xaml.Media.Imaging.BitmapImage();
Windows.Storage.Streams.IRandomAccessStream fileStream =
      await pic.OpenAsync(Windows.Storage.FileAccessMode.Read);
      await bitmapImage.SetSourceAsync(fileStream);

The above code snippet shows the gist of what I am doing.  I create a bitmapImage in a method, return it to the caller and never keep it or reference it.
Given that I have kept no references to the bitmapImages, shouldn't GC collect the unreferenced bitmapImages?
Any help or pointers would be much appreciated.
Thanks,
Frank
-----  here is the expanded code ------
    private IEnumerator<StorageFile> hdEnum = null;

    /*
     * Initialize to read all the pic files in the PicturesLibary.
     *
     */

    private async Task initializeEnum()
    {
        if (hdEnum != null)
        {
            // I have already been initialised so go away
            return;
        }

        folder = Windows.Storage.KnownFolders.PicturesLibrary;

        // Set query options with filter and sort order for results
        List<string> fileTypeFilter = new List<string>();
        fileTypeFilter.Add(".jpg");
        fileTypeFilter.Add(".png");
        fileTypeFilter.Add(".bmp");
        fileTypeFilter.Add(".gif");
        var queryOptions = new QueryOptions(CommonFileQuery.OrderByName, fileTypeFilter);

        // Create query and retrieve files
        var query = folder.CreateFileQueryWithOptions(queryOptions);

        // Query the folder.
        var fileList = await query.GetFilesAsync();
        hdEnum = fileList.GetEnumerator();
    }

    /*
     * Read and return the next picture file in the PicturesLibrary
     */

    public async Task<BitmapImage> next()
    {
        BitmapImage bitmapImage = new Windows.UI.Xaml.Media.Imaging.BitmapImage(); ;

        StorageFile pic = null;

        if (hdEnum == null)
        {
            await initializeEnum();
        }

        if (hdEnum.MoveNext())
        {
            pic = hdEnum.Current;   // hdEnum is an enumerator on the list of image files
        }

        if (pic != null)
        {
            // come here if I have an image to read
            String path = pic.Path;

            Windows.Storage.Streams.IRandomAccessStream fileStream =
            await pic.OpenAsync(Windows.Storage.FileAccessMode.Read);
            await bitmapImage.SetSourceAsync(fileStream);
            fileStream.Dispose();

            // force a GC - this makes no difference, it still dies after the 61st file
            GC.Collect();
            Debug.WriteLine("Read: " + ++fileCount + " " + pic.Path + " " + GC.GetTotalMemory(true));
        }

         bitmapImage = null;  // EXPLICITLY MAKING IT NULL - no references
        return (bitmapImage);
    }


text:
Q: How to render **local** image in pandas dataframe I have referenced this question many times regarding how to render linked images in pandas data frame
And it is quite easy to implement. However, I have come across a scenario where I would like to render a local image in my current working directory in a pandas dataframe. I figured I could just replace the image link(s) in the snippet below (credit to @chitown88 with this code from the linked question) with the image path, but that doesn't appear to work.
import pandas as pd
from IPython.core.display import display,HTML

df = pd.DataFrame([['A231', 'Book', 5, 3, 150],
                   ['M441', 'Magic Staff', 10, 7, 200]],
                   columns = ['Code', 'Name', 'Price', 'Net', 'Sales'])

# your images
images1 = ['https://vignette.wikia.nocookie.net/2007scape/images/7/7a/Mage%27s_book_detail.png/revision/latest?cb=20180310083825',
          'https://i.pinimg.com/originals/d9/5c/9b/d95c9ba809aa9dd4cb519a225af40f2b.png']

images2 = ['https://static3.srcdn.com/wordpress/wp-content/uploads/2020/07/Quidditch.jpg?q=50&fit=crop&w=960&h=500&dpr=1.5',
           'https://specials-images.forbesimg.com/imageserve/5e160edc9318b800069388e8/960x0.jpg?fit=scale']

df['imageUrls'] = images1
df['otherImageUrls'] = images2

# convert your links to html tags
def path_to_image_html(path):
    return ''

pd.set_option('display.max_colwidth', None)

image_cols = ['imageUrls', 'otherImageUrls']  #<- define which columns will be used to convert to html

# Create the dictionariy to be passed as formatters
format_dict = {}
for image_col in image_cols:
    format_dict[image_col] = path_to_image_html

display(HTML(df.to_html(escape=False ,formatters=format_dict)))

There has to be a rather easy way to accomplish this I would think. I also tried using PIL to open the image first but to no avail.

A: If I export the dataframe to an HTML file which is in the same directory as another directory called pic_dir, which includes two files: pic.png, pic2.png, this simple solution seems to work (I see the pictures rendered in the HTML table).
import pandas as pd
from IPython.core.display import display,HTML

df = pd.DataFrame([['A231', 'Book', 5, 3, 150],
                   ['M441', 'Magic Staff', 10, 7, 200]],
                   columns = ['Code', 'Name', 'Price', 'Net', 'Sales'])

# your images
images1 = ['pic_dir/pic.png',
           'pic_dir/pic2.png']

images2 = ['pic_dir/pic.png',
           'pic_dir/pic2.png']

df['imageUrls'] = images1
df['otherImageUrls'] = images2

# convert your links to html tags
def path_to_image_html(path):
    return ''

pd.set_option('display.max_colwidth', None)

image_cols = ['imageUrls', 'otherImageUrls']  #<- define which columns will be used to convert to html

# Create the dictionariy to be passed as formatters
format_dict = {}
for image_col in image_cols:
    format_dict[image_col] = path_to_image_html

df.to_html('df.html', escape=False ,formatters=format_dict)


text:
Q: Problem Converting Caffe model to dlc using SNPE I am facing an issue in converting my caffe model to dlc using SNPE.
Specifically in the "Scale" layer.
The first two layers are as follows
name: "First"
  input: "data"
  input_shape {
  dim: 1
  dim: 3
  dim: xxx
  dim: xxx
}

layer {
  name: "data/Scale"
  type: "Scale"
  bottom: "data"
  top: "data/Scale"
  scale_param {
    filler: {
      value: 0.0078125
    }
    bias_term: true
    bias_filler: {
      value: -1
    }
  }
  param {
    lr_mult: 0
    decay_mult: 1
  }
  param {
    lr_mult: 0
    decay_mult: 0
  }
}

layer {
  name: "Conv2d_0/convolution"
  type: "Convolution"
  convolution_param {
    num_output: 32
    pad: 1
    kernel_size: 3
    stride: 2
  }
  bottom: 'data/Scale'
  top: "Conv2d_0/convolution"
}

I get the following error:
('Encountered Error:', 'list index out of range')

Stack Trace:
Traceback (most recent call last):

  File "/home/nithin.ga/SNPE_19/snpe-1.19.2/bin/x86_64-linux-clang/snpe-caffe-to-dlc", line 115, in <module>
    args.enable_strict_validation)

  File "/home/nithin.ga/SNPE_19/snpe-1.19.2/lib/python/snpe/snpe_caffe_to_dlc.py", line 1145, in convert
    self.convert_caffe_new(self.spec)

  File "/home/nithin.ga/SNPE_19/snpe-1.19.2/lib/python/snpe/snpe_caffe_to_dlc.py", line 1327, in convert_caffe_new
    layer_seq = self._blob_connectivity_map.check_s_folding(layer)

  File "/home/nithin.ga/SNPE_19/snpe-1.19.2/lib/python/snpe/snpe_caffe_to_dlc.py", line 459, in check_s_folding

output_layer = self._blobs[prev_layer_output_blob]['output_of_layers'][0]
IndexError: list index out of range

A: Here is the documentation for the Scale layer limitation of SNPE:
https://developer.qualcomm.com/docs/snpe/limitations.html

Batch normalization (+ Scaling)

*

*Caffe: Scaling (scale_layer) is optional. If present, it extends functionality of Batch normalization (batch_norm_layer). If not present, batch_norm_layer will still be converted as per Caffe specification. scale_layer used anywhere else in the network but immediately after the batch_norm_layer is not supported.

There is support for scaling, but only if it's part of the data layer:
https://developer.qualcomm.com/docs/snpe/network_layers.html

Scale (Image)
Input image scaling, maintains aspect ratio. This function is
  primarily intended for images, but technically any 2D input data can
  be processed if it makes sense. Scaling parameters are provided as an
  option to the model converter tool.
There is no such Caffe layer by itself. This functionality is
  technically part of the Caffe data provider.


text:
Q: Are some Flame Body/Magma Armor Pokémon better at hatching eggs? I have a level 50 female Talonflame to make my eggs hatch faster, but I'd like it to be even faster.
I'm aware that Flame Body doesn't stack with Magma Armor.
I'm wondering if any Pokémon with Flame Body or Magma Armor hatches eggs the fastest, or maybe if gender and level matters.

A: The level or gender of the pokemon does not matter. Any pokemon with flame body or magma armor will halve the needed steps until the egg hatches.

A: There is no sliding scale, either a party member has Flame Body or Magma armor and the time is halved, or you don't have Flame Body or Magma armor and it's the full time.
Flame Body and Magma armor DO NOT STACK, it is impossible to reduce it to less than half through this method alone.
However if you use the Hatching Power O-Power, this DOES STACK with Flame Body or Magma armor, allowing quicker hatching - and as you use it, it'll level up to be even faster.
http://bulbapedia.bulbagarden.net/wiki/O-Power

A: they both work. I use my lv. 91 talon flame when hatching eggs and I ride on my bik up and down the day care road. it definitely makes it faster. even magma armor. it doesn't matter about level or gender.


text:
Q: Birt Report Engine Command Line (genReport.sh) - How to output in Excel? I see the web viewer has this option but I don't see an option in genReport.sh.  Does anyone know?  Surely it is possible.

A: Script genReport.sh should accept -f XLS option for rendering Excel output. Take a look at this birt exchange post describing more formats available in genReport.