text:
Q: Tips for understanding big project fast? I've got a job and many new things to be learned. The first thing is to understand big project, writtened mostly in C++, using Visual Studio. So, I see a statement, and I want to find its definition. Using Ctr+F to search through entire solution, and if multiple libraries have different function but same name, I would have many result that I don't know which one is the definition of the statement. And vice versal, I see a definition, but I don't know which statements are its invoker.
Is there any tips for my issue? Any suggestion is very appreciated. Thanks (And please, I don't want to go to debug mode, since It takes lot of time to build, and I'm lazy rofl).

A: You could try with a tool like doxygen.
I find it useful when I start to work on a new codebase.
Just tweak some parameter in the configuration file and run doxygen against your code. For your needs you could change:

*

*CALL_GRAPH = YES. A graphical call graph is drawn for each function showing the functions that the function directly or indirectly calls

*CALLER_GRAPH = YES. A graphical caller graph is drawn for each function showing the functions that the function is directly or indirectly called by

Probably also:

*

*EXTRACT_ALL = YES, HAVE_DOT = YES, UML_LOOK = YES to generate a class diagram (see Graphviz + doxygen to generate UML class diagrams).

The nice things is that even if the documentation isn't already available, you can extract a lot of useful information (and while learning you could start documenting the code).
Anyway it takes time.


text:
Q: RetrievePropertiesAsync and COMException E_FAIL I am having an issue on one machine. It is Windows 8.1 and x64, but it seems that it's not the real issue.
I have tested this code on devices and laptops running Windows 8 and 8.1 on all of the following platforms ARM, x86, and x64. And only this one laptop throws the COMException.
This code:
// Yes, I have checked the appropriate box in the manifest to access VideosLibrary.
StorageFolder vidFolder = KnownFolders.VideosLibrary;

var SystemFreeSpace = "System.FreeSpace";
var SystemCapacity = "System.Capacity";
var SystemPercentFull = "System.PercentFull";
var properties = new List<string>() { SystemFreeSpace, SystemCapacity, SystemPercentFull };

// THIS blows up on only one device. Though on Windows 8.1 I get null values (different issue).
var props = await vidFolder.RetrievePropertiesAsync(properties);

This is the exception message.

Error Code:
-2147467259
Error Message:
Error HRESULT E_FAIL has been returned from a call to a COM component.
Line Number:
mscorlib

So I am thingking that maybe this individual's Videos folder itself is the problem. The code works fine when I am trying to retrieve properties for a USB drive though.
Has anyone else run into this issue?

A: Seems like the issue was because the user's VideosLibrary "folder" was corrupted. This may have happened due to the upgrade process from Win7 to Win8 to Win8.1 (just a theory).
The solution was: delete the old corrupted VideosLibrary and then open up a Windows Explorer browser and right-click on "Libraries > Restore default libraries".

redpajama_set_name: RedPajamaStackExchange


text:
Q: Is there a way to detect statically deprecated modules in a Python project? I am struggling checking statically if my Python 3 project relies on deprecated libraries. As it contains many third party modules downloaded via pip, it becomes cumbersome to check them one by one.
I know that warnings appear when you execute code that contains deprecated functions, but I would like to do that statically by scanning the requirements.txt of my project. I also know that Pylint has a checker that detects imports of modules that are marked as deprecated in the pylintrc, but you need to know in advance which modules you want to mark as deprecated.
So how can I scan my project in order to check if some of the libraries I use are deprecated, and this without executing the project?
Thank you


text:
Q: Error when using 'fitdist()" function in R I would like to fit a Weibull distribution to my data using fitdist() function from the fitdistrplus package in R. My data in split into bins, and the fitting needs to happen in each bin. However, I have some bins with only one data value and fitdist() function doesn't like that. I was wondering if there is a way to "tell" fitdist() not to fit in that bin - I'm thinking something similar to what it's done to avoid negative values, i.e fitdist(x[x > 0], "weibull").
Here is a sample of my data:
structure(list(X1 = c(1.55752015113831, 1.86181771755219, 1.3730936050415,
1.47793698310852, 1.66031086444855, 1.31968522071838, 1.19886374473572,
1.63071382045746, 1.79910719394684, 1.83555865287781, 2.51496362686157,
2.77573442459106, 2.41649007797241, 2.16212272644043, 2.20722556114197,
2.22031855583191, 2.56367325782776, 2.23889565467834, 2.06307983398438,
2.04429388046265), X2 = c(5.96779193297146, 6.0423492582171,
0.145518317755237, 0.156240204303897, 0.0690296680870719, 6.24221097591206,
6.12635547901035, 6.17154346375459, 0.00877351789515712, 6.18053695875579,
6.10040350681974, 6.04536502183551, 6.16195714909474, 6.13228633875795,
6.10040350681974, 5.9043000420551, 6.05266261585455, 5.98250856115524,
5.84601250054097, 5.85279344130853), X3 = c(35, 35, 1, 1, 1,
36, 36, 36, 1, 36, 35, 35, 36, 36, 35, 34, 35, 35, 34, 34), X4 = c(2008,
2008, 2008, 2008, 2008, 2008, 2008, 2008, 2008, 2008, 2008, 2008,
2008, 2008, 2008, 2008, 2008, 2008, 2008, 2008)), row.names = 31249:31268, class = "data.frame")

The way I fit the Weibull distribution is as follows:
MLE<- aggregate(data$X1, by = list(data$X3), FUN = function(x) fitdist(x[x > 0], "weibull")$estimate)


text:
Q: How To Append Extent reports 4.1.0 using C#? I want to Achieve the below scenario
(Say if I have 2 testcases, when I run the First test it generate a Html Report
and now when I run the second Testcase if it fails it should not be appended To the existing Report but when we fix and rerun it should be appended to the Existing report if it passes).

A: After lot of research I figured out that Append feature is not available for version 4.1.0 in .Net, But will be available in version 5.0 as per the author of Extent Reports anshooarora.
version 5 and above are already available for Java


text:
Q: python equivalent of R getOption and options I am creating a python package where I want to have some options such as a data directory, a database host and port, etc. In R, I generally do this using options and getOption. Is there a way to do this in python?
I researched a little bit and looked at pandas, in which they have options such as pd.options.display.width, but I didn't find it that intuitive. (May be because I am new to writing python packages)
Thanks.


text:
Q: mDNSResponder compilation on MinGW I am trying to build mDNSResponder on MinGW for a very important project.  I have MinGW installed and I've downloaded the latest version of mDNSResponder from Apple's site.   There doesn't seem to be any way to build for MinGW.  Also, it appears to require pthreads in order to build
I also found the Bonjour SDK, but it seems like it only has MSVC compatible libraries in it and when I try to use reimp in MinGW to convert them to DLLs I get the "invalid or corrupt library" error back.  Presumably this is because MS changes it's name mangling scheme on occasion.
Any help at all would be appreciated!
Greg


text:
Q: Deduplicating observations from 2 different datasets but prioritizing one over the other? R so I have two sets of data that I am merging and duplicating. I am using the disctinct_at() function from dlpyr to deduplicate after merging the 2 datasets in R with rbind().
I discovered something interesting but I'm not sure if it's by chance. I have two datasets A & B.
There are duplicates in A & B but B has priority as far as the category I am looking for. So if an observation is in both A & B, I would like to see the category from dataset B.
Here is my code.
library(dplyr)

a <- data.frame("ID" = c(123,124,125,126),
                "Category" = c("Blue", "Blue", "Red", "Red"),
                "Helper" = c("dataset_a","dataset_a","dataset_a","dataset_a" ))

b <- data.frame("ID" = c(127,124,125,128),
                    "Category" = c("Green", "Green", "Orange", "Orange"),
                    "Helper" = c("dataset_b","dataset_b","dataset_b","dataset_b"))

bind_1 <- rbind(a,b)

bind_2 <- rbind(b,a)

bind_final_1<- bind_1 %>%
  #Unqiue
  distinct_at(vars(ID), .keep_all = TRUE)

bind_final_2<- bind_2 %>%
  #Unqiue
  distinct_at(vars(ID), .keep_all = TRUE)

The deduplication has different outputs by changing the bind order. bind_final_1 keeps the category from dataset A. While bind_final 2 keeps the category from dataset B? bind_final_2 has the desired output I am looking for but is this output by chance or is there another piece of code I can add to my distinct_at() to always get this output?

A: Here's one way to address this:
First we group by ID and use n() to count when we have multiple rows for an ID. Then we filter to where Helper == dataset_b or n == 1. n == 1 is a unique ID, so we keep it. If n > 1 then we keep the row for dataset_b
library(tidyverse)

bind_1 %>%
  group_by(ID) %>%
  mutate(n = n()) %>%
  filter(Helper == "dataset_b" | n == 1) %>%
  arrange(ID)

     ID Category Helper        n
  <dbl> <fct>    <fct>     <int>
1   123 Blue     dataset_a     1
2   124 Green    dataset_b     2
3   125 Orange   dataset_b     2
4   126 Red      dataset_a     1
5   127 Green    dataset_b     1
6   128 Orange   dataset_b     1

A: You have the correct output in bind_final_2 and it is not by chance. It would always return the correct output. distinct would always keep the 1st occurrence of unique key (ID here) since you are doing bind_2 <- rbind(b,a) the rows in b would always be ahead than rows in a.
Also you can use the following -
library(dplyr)
bind_rows(b, a) %>% distinct(ID, .keep_all = TRUE)


text:
Q: Are there any ways we can store the storage or local storage data within the subdomain of the MS teams app plugin? How we can ensure that the stored data cannot be shared between the different domains?
I have some data like personal information, and need to store it in the session storage. When I tried with MS teams web app, session storage data is shared between the domains. Is it expected?
From the console screen, set the sessionStorage.setItem('test', 123);
Check the sessionStorage data in the Application tab by inspect element where we can see sessionStorage data with test is available in the teams.microsoft.com as well as with other subdomains. Is there any ways we can restrict the sessionStorage data flow within the subdomains?

A: It's for exactly these kinds of reasons, plus others (like the user moving between devices) that I'd recommend to NOT store user information in local/session/cookie storage and rather store the state on your side (e.g. in a database or memory cache or something like that).
The one thing that is consistent across the user's journey between tabs/devices/etc. is the AadObject Id (their unique Azure Active Directory user guid), so you would use that as the key for reading/writing your state information.


text:
Q: Overlapping todonotes When adding several notes on the same line using todonotes and then one note on the line behind them, its impossible to see which notes belong to which line since the line connecting each textbox to the corresponding piece of text overlap. I made a minimal example below. Is there any way to automatically solve this problem using todonotes or any similar package?
\documentclass[10pt,a4paper]{article}
\usepackage{todonotes}
\usepackage{lipsum}

\begin{document}

\todo{Lorem}\textbf{Lorem} \todo{ipsum}\textbf{ipsum} \todo{dolor}\textbf{dolor}
sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore
et dolore magna aliqua. Ut enim ad \todo{minim}\textbf{minim} veniam, quis nostrud
exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.

\end{document}

A couple of acceptable solutions (which I do not node how to obtain in LaTeX) is the following:

A: There is the option 'fancyline' for the todo commands.
With it the notes now appear as follows.
Personally I prefer the default behaviour.

\documentclass[10pt,a4paper]{article}
\usepackage{todonotes}
\usepackage{lipsum}

\begin{document}

\todo[fancyline]{Lorem}\textbf{Lorem} \todo[fancyline]{ipsum}\textbf{ipsum}
\todo[fancyline]{dolor}\textbf{dolor} sit amet, consectetur adipisicing elit,
sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad
\todo[fancyline]{minim}\textbf{minim} veniam, quis nostrud exercitation ullamco
laboris nisi ut aliquip ex ea commodo consequat.

\end{document}


text:
Q: How to convert variable value to value with subscripts in long form data set using R? The data set is lay out in long format and doesn't have missing value, which has 4 columns-the 1st column is "id", the 2nd column is "col", the 3rd column is binary variable "vol", and the 4th column is time.
Now, I want to convert the value of "rec" in the 2nd column "col" into "rec1,rec2,rec3,..." by id.
For example, for the id from id=1 and id=6, the expected data set should look like as follows
id   col  vol time
1    rec1  1   1
1    rec2  1   2
1    rec3  0   3
2    rec1  1   1
2    rec2  1   2
2    rec3  1   3
3    rec1  0   1
3    rec2  0   2
3    rec3  0   3
4    rec1  1   1
4    rec2  0   2
4    rec3  0   3
5    rec1  1   1
5    rec2  0   2
6    rec1  1   1
6    rec2  1   2
6    rec3  0   3
6    rec4  0   4

The original data set is structured as follows,
structure(list(id = c(1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5,
5, 6, 6, 6, 6), col = c("rec", "rec", "rec", "rec", "rec", "rec",
"rec", "rec", "rec", "rec", "rec", "rec", "rec", "rec", "rec",
"rec", "rec", "rec"), vol = c(1, 1, 0, 1, 1, 1, 0, 0, 0, 1, 0,
0, 1, 0, 1, 1, 0, 0), time = c(1, 2, 3, 1, 2, 3, 1, 2, 3, 1,
2, 3, 1, 2, 1, 2, 3, 4)), row.names = c(NA, 18L), class = "data.frame")->df

A: Use paste
df$col <- with(df, paste0(col, time))

A: We could use str_c from stringr package in a tidyverse workflow:
str_c is equivalent to paste() with the difference that with str_c() the default is no separator.
library(dplyr)
library(stringr)

mutate(df, col = str_c(col, time))

   id  col vol time
1   1 rec1   1    1
2   1 rec2   1    2
3   1 rec3   0    3
4   2 rec1   1    1
5   2 rec2   1    2
6   2 rec3   1    3
7   3 rec1   0    1
8   3 rec2   0    2
9   3 rec3   0    3
10  4 rec1   1    1
11  4 rec2   0    2
12  4 rec3   0    3
13  5 rec1   1    1
14  5 rec2   0    2
15  6 rec1   1    1
16  6 rec2   1    2
17  6 rec3   0    3
18  6 rec4   0    4


text:
Q: date("10/12/0000") converting incorrect date("10/12/0000")  converting incorrect
I have filled my date of birth field ( mm/dd/yyyy) this format. I have convert to date format, its facing issue.
new Date("10/12/0000")
Thu Oct 12 2000 00:00:00 GMT+0530 (India Standard Time)
our side date is correct but value is incorrect. How valid correct date field?
I have tried momentum also, same issue faced.


text:
Q: Python Find max, average, min, and add up values in a tuple in a list I need to createa function that takes in a list of tuples then outputs the total highest, lowest, average, and totals in each tupple.
For example:
This is what it would take in:
([(99,86,70,7),(100, 96, 65, 10), (50, 40, 29, 11)])

I need a function that takes the highest int in each tuple, but only at index [0]. It needs to then average the numbers together at index [1], then find the lowest int at index [2], then just add up the values in the last index of each tupple.
So the output would look like this:
(100, 74, 29, 28)

This is what I have now. Its completely wrong and stupid and I find tuples very confusing. I'm trying to do this only using while/for loops but I'm just confused with the tuples and lists.
def grades(listt):
    count=0
    while count < len(listt):
        x=();
        for i in range(0, len(listt)):
            x(listt(0[count])) > x(listt(i[count]))
            print x[count]

print grades([(99,86,70,7),(100, 96, 65, 10), (50, 40, 29, 11)])

A: def grades(alist):
    highest, average, lowest, sumvalues = alist[0]
    for i in alist[1:]:
        if i[0] > highest: highest = i[0]
        average += i[1]
        if i[2] < lowest: lowest = i[2]
        sumvalues += i[3]
    average = average / len(alist)
    return highest, average, lowest, sumvalues

A: For the list:
grades = [(99,86,70,7),(100, 96, 65, 10), (50, 40, 29, 11)]

You would do:
toFindHighest, toFindAverage, toFindLowest, toFindSum = zip(*grades)

highest = max(toFindHighest)
average = sum(toFindAverage) / float(len(toFindAverage))
lowest = min(toFindLowest)
total = sum(toFindSum)


text:
Q: what is the difference between isomorphic and birational? From Wikipedia:

In algebraic geometry, a morphism between algebraic varieties is a function between the varieties that is given locally by polynomials. It is also called a regular map. A morphism from an algebraic variety to the affine line is also called a regular function. A regular map whose inverse is also regular is called biregular, and they are isomorphisms in the category of algebraic varieties. Because regular and biregular are very restrictive conditions – there are no non-constant regular functions on projective varieties – the weaker condition of a rational map and birational maps are frequently used as well.

What is an example of two varieties $X$ and $Y$ over the field $k=\mathbb{Q}$ that are birational, but not isomorphic?

just a few more details if possible?
E.g. $X  = \{ y^2 - x^3 = 0 \} \subset \mathbb{A}^2 $ and $Y = \{ y -x^2 = 0 \} \subset \mathbb{A}^2 $.
What would be the maps $f : X \to Y$ and $g: Y \to X$ ? Why are they birational and not inverse.


text:
Q: ScriptSharp indexer with generics I have a class that needs a generic indexer, however script# doesn't compile this.
[Imported]
public class SomeCollection<T>
{
    [IntrinsicProperty]
    public T this[int index]
    {
        get { return null; }
        set { }
    }
}

I want the 'SomeCollection' class to be a javascript Array when script# compiles it down. I only want this class + indexer with generics to make it easier when I write c# to get proper intellisense for objects.
How do I get script# to compile the above?

A: For now you'll have to write the above class in an import library, i.e. it is not just an imported type, but a type that isn't compiled by script#. Instead it is only compiled by the c# compiler, and script# simply imports the type definitions.
That said, why not just use List<T>, or T[]? Is it because you only want an indexer and no other methods?


text:
Q: Matlab best technique to remove outliers in data I have 2 columns x, y of 100 points each. I would like to remove the outliers data and refill their gap with the average value of the points near to them. Firstly, can I do that? is any Matlab function? Secondly, if yes, what is the best technique to make that?
E.g:
x = 1:1:100
y = rand(1,99)
y(end+1)=2

In this case, not so similar to my problem, I would like to remove value 2 at the end and to be replaced with one similar to their neighbor points. In my case the distribution of the [x,y] is a non linear function, having few outliers.

A: It depends on what you mean by outlier. If you assume that outliers are more than three standard deviations from the median, for example, you could do this
all_idx = 1:length(x)
outlier_idx = abs(x - median(x)) > 3*std(x) | abs(y - median(y)) > 3*std(y) % Find outlier idx
x(outlier_idx) = interp1(all_idx(~outlier_idx), x(~outlier_idx), all_idx(outlier_idx)) % Linearly interpolate over outlier idx for x
y(outlier_idx) = interp1(all_idx(~outlier_idx), y(~outlier_idx), all_idx(outlier_idx)) % Do the same thing for y

This code will just remove the outliers and linearly interpolate over their positions using the closest values that are not outliers.


text:
Q: Is there a way to clean up possibly invalid disks that only show up on Mac OS Recovery through 'diskutil list' in Terminal? Does Recovery use them? Hopefully that question is clear enough, and hopefully this is just me being silly. When I boot into the Recovery Partition, go into Terminal, and run 'diskutil list', I get quite a few tiny and seemingly invalid disks (starting at /dev/disk2):
/dev/disk0
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *121.3 GB   disk0
   1:                        EFI EFI                     209.7 MB   disk0s1
   2:                  Apple_HFS Macintosh HD            120.5 GB   disk0s2
   3:                 Apple_Boot Recovery HD             650.0 MB   disk0s3
/dev/disk1
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:     Apple_partition_scheme                        *1.3 GB     disk1
   1:        Apple_partition_map                         30.7 KB    disk1s1
   2:                  Apple_HFS OS X Base System        1.3 GB     disk1s2
/dev/disk2
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:                            untitled               *524.3 KB   disk2
/dev/disk3
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:                            untitled               *524.3 KB   disk3
/dev/disk4
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:                            untitled               *524.3 KB   disk4
/dev/disk5
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:                            untitled               *524.3 KB   disk5
/dev/disk6
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:                            untitled               *524.3 KB   disk6
/dev/disk7
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:                            untitled               *6.3 MB     disk7
/dev/disk8
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:                            untitled               *2.1 MB     disk8
/dev/disk9
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:                            untitled               *1.0 MB     disk9
/dev/disk10
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:                            untitled               *524.3 KB   disk10
/dev/disk11
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:                            untitled               *524.3 KB   disk11
/dev/disk12
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:                            untitled               *1.0 MB     disk12

I ran 'diskutil info' on each of the disks and received the following output:
   Device Identifier:        disk2
   Device Node:              /dev/disk2
   Part of Whole:            disk2
   Device / Media Name:      Apple disk image Media

   Volume Name:              untitled
   Escaped with Unicode:     untitled

   Mounted:                  Yes
   Mount Point:              /Volumes
   Escaped with Unicode:     /Volumes

   File System Personality:  HFS+
   Type (Bundle):            hfs
   Name (User Visible):      Mac OS Extended
   Owners:                   Enabled

   Content (IOContent):      None
   OS Can Be Installed:      No
   Media Type:               Generic
   Protocol:                 Disk Image
   SMART Status:             Not Supported
   Volume UUID:              C8F2576E-A234-3178-AADC-F12393BB2445

   System Image:             Yes

   Total Size:               524.3 KB (524288 Bytes) (exactly 1024 512-Byte-Units)
   Volume Free Space:        376.8 KB (376832 Bytes) (exactly 736 512-Byte-Units)
   Device Block Size:        512 Bytes

   Read-Only Media:          No
   Read-Only Volume:         No
   Ejectable:                Yes

   Whole:                    Yes
   Internal:                 No
   OS 9 Drivers:             No
   Low Level Format:         Not supported

=====================================================================
   Device Identifier:        disk3
   Device Node:              /dev/disk3
   Part of Whole:            disk3
   Device / Media Name:      Apple disk image Media

   Volume Name:              untitled
   Escaped with Unicode:     untitled

   Mounted:                  Yes
   Mount Point:              /private/var/tmp
   Escaped with Unicode:     /private/var/tmp

   File System Personality:  HFS+
   Type (Bundle):            hfs
   Name (User Visible):      Mac OS Extended
   Owners:                   Enabled

   Content (IOContent):      None
   OS Can Be Installed:      No
   Media Type:               Generic
   Protocol:                 Disk Image
   SMART Status:             Not Supported
   Volume UUID:              DC4623F9-52B3-384F-8AF4-67E833986A4E

   System Image:             Yes

   Total Size:               524.3 KB (524288 Bytes) (exactly 1024 512-Byte-Units)
   Volume Free Space:        380.9 KB (380928 Bytes) (exactly 744 512-Byte-Units)
   Device Block Size:        512 Bytes

   Read-Only Media:          No
   Read-Only Volume:         No
   Ejectable:                Yes

   Whole:                    Yes
   Internal:                 No
   OS 9 Drivers:             No
   Low Level Format:         Not supported

=====================================================================
   Device Identifier:        disk4
   Device Node:              /dev/disk4
   Part of Whole:            disk4
   Device / Media Name:      Apple disk image Media

   Volume Name:              untitled
   Escaped with Unicode:     untitled

   Mounted:                  Yes
   Mount Point:              /private/var/run
   Escaped with Unicode:     /private/var/run

   File System Personality:  HFS+
   Type (Bundle):            hfs
   Name (User Visible):      Mac OS Extended
   Owners:                   Enabled

   Content (IOContent):      None
   OS Can Be Installed:      No
   Media Type:               Generic
   Protocol:                 Disk Image
   SMART Status:             Not Supported
   Volume UUID:              AEED02C4-DF3A-35A7-BF6C-1291DB7DF5EA

   System Image:             Yes

   Total Size:               524.3 KB (524288 Bytes) (exactly 1024 512-Byte-Units)
   Volume Free Space:        364.5 KB (364544 Bytes) (exactly 712 512-Byte-Units)
   Device Block Size:        512 Bytes

   Read-Only Media:          No
   Read-Only Volume:         No
   Ejectable:                Yes

   Whole:                    Yes
   Internal:                 No
   OS 9 Drivers:             No
   Low Level Format:         Not supported

=====================================================================
   Device Identifier:        disk5
   Device Node:              /dev/disk5
   Part of Whole:            disk5
   Device / Media Name:      Apple disk image Media

   Volume Name:              untitled
   Escaped with Unicode:     untitled

   Mounted:                  Yes
   Mount Point:              /System/Installation
   Escaped with Unicode:     /System/Installation

   File System Personality:  HFS+
   Type (Bundle):            hfs
   Name (User Visible):      Mac OS Extended
   Owners:                   Enabled

   Content (IOContent):      None
   OS Can Be Installed:      No
   Media Type:               Generic
   Protocol:                 Disk Image
   SMART Status:             Not Supported
   Volume UUID:              FA0AB5AC-4A8B-3330-890A-B08290C44B83

   System Image:             Yes

   Total Size:               524.3 KB (524288 Bytes) (exactly 1024 512-Byte-Units)
   Volume Free Space:        376.8 KB (376832 Bytes) (exactly 736 512-Byte-Units)
   Device Block Size:        512 Bytes

   Read-Only Media:          No
   Read-Only Volume:         No
   Ejectable:                Yes

   Whole:                    Yes
   Internal:                 No
   OS 9 Drivers:             No
   Low Level Format:         Not supported

=====================================================================
   Device Identifier:        disk6
   Device Node:              /dev/disk6
   Part of Whole:            disk6
   Device / Media Name:      Apple disk image Media

   Volume Name:              untitled
   Escaped with Unicode:     untitled

   Mounted:                  Yes
   Mount Point:              /private/var/db
   Escaped with Unicode:     /private/var/db

   File System Personality:  HFS+
   Type (Bundle):            hfs
   Name (User Visible):      Mac OS Extended
   Owners:                   Enabled

   Content (IOContent):      None
   OS Can Be Installed:      No
   Media Type:               Generic
   Protocol:                 Disk Image
   SMART Status:             Not Supported
   Volume UUID:              21B26EE7-E7B2-310C-8ACE-AB3D85036C12

   System Image:             Yes

   Total Size:               524.3 KB (524288 Bytes) (exactly 1024 512-Byte-Units)
   Volume Free Space:        258.0 KB (258048 Bytes) (exactly 504 512-Byte-Units)
   Device Block Size:        512 Bytes

   Read-Only Media:          No
   Read-Only Volume:         No
   Ejectable:                Yes

   Whole:                    Yes
   Internal:                 No
   OS 9 Drivers:             No
   Low Level Format:         Not supported

=====================================================================
   Device Identifier:        disk7
   Device Node:              /dev/disk7
   Part of Whole:            disk7
   Device / Media Name:      Apple disk image Media

   Volume Name:              untitled
   Escaped with Unicode:     untitled

   Mounted:                  Yes
   Mount Point:              /private/var/folders
   Escaped with Unicode:     /private/var/folders

   File System Personality:  HFS+
   Type (Bundle):            hfs
   Name (User Visible):      Mac OS Extended
   Owners:                   Enabled

   Content (IOContent):      None
   OS Can Be Installed:      No
   Media Type:               Generic
   Protocol:                 Disk Image
   SMART Status:             Not Supported
   Volume UUID:              57F696D8-737A-3AAD-B917-D6B010FB437F

   System Image:             Yes

   Total Size:               6.3 MB (6291456 Bytes) (exactly 12288 512-Byte-Units)
   Volume Free Space:        4.5 MB (4456448 Bytes) (exactly 8704 512-Byte-Units)
   Device Block Size:        512 Bytes

   Read-Only Media:          No
   Read-Only Volume:         No
   Ejectable:                Yes

   Whole:                    Yes
   Internal:                 No
   OS 9 Drivers:             No
   Low Level Format:         Not supported

=====================================================================
   Device Identifier:        disk8
   Device Node:              /dev/disk8
   Part of Whole:            disk8
   Device / Media Name:      Apple disk image Media

   Volume Name:              untitled
   Escaped with Unicode:     untitled

   Mounted:                  Yes
   Mount Point:              /private/var/root/Library
   Escaped with Unicode:     /private/var/root/Library

   File System Personality:  HFS+
   Type (Bundle):            hfs
   Name (User Visible):      Mac OS Extended
   Owners:                   Enabled

   Content (IOContent):      None
   OS Can Be Installed:      No
   Media Type:               Generic
   Protocol:                 Disk Image
   SMART Status:             Not Supported
   Volume UUID:              8CC74661-9E77-32D3-8C6B-85865271D5CD

   System Image:             Yes

   Total Size:               2.1 MB (2097152 Bytes) (exactly 4096 512-Byte-Units)
   Volume Free Space:        1.2 MB (1228800 Bytes) (exactly 2400 512-Byte-Units)
   Device Block Size:        512 Bytes

   Read-Only Media:          No
   Read-Only Volume:         No
   Ejectable:                Yes

   Whole:                    Yes
   Internal:                 No
   OS 9 Drivers:             No
   Low Level Format:         Not supported

=====================================================================
   Device Identifier:        disk9
   Device Node:              /dev/disk9
   Part of Whole:            disk9
   Device / Media Name:      Apple disk image Media

   Volume Name:              untitled
   Escaped with Unicode:     untitled

   Mounted:                  Yes
   Mount Point:              /Library/ColorSync/Profiles/Displays
   Escaped with Unicode:     /Library/ColorSync/Profiles/Displays

   File System Personality:  HFS+
   Type (Bundle):            hfs
   Name (User Visible):      Mac OS Extended
   Owners:                   Enabled

   Content (IOContent):      None
   OS Can Be Installed:      No
   Media Type:               Generic
   Protocol:                 Disk Image
   SMART Status:             Not Supported
   Volume UUID:              2F53A1B0-92F3-3945-960B-82E96D9A1DA6

   System Image:             Yes

   Total Size:               1.0 MB (1048576 Bytes) (exactly 2048 512-Byte-Units)
   Volume Free Space:        901.1 KB (901120 Bytes) (exactly 1760 512-Byte-Units)
   Device Block Size:        512 Bytes

   Read-Only Media:          No
   Read-Only Volume:         No
   Ejectable:                Yes

   Whole:                    Yes
   Internal:                 No
   OS 9 Drivers:             No
   Low Level Format:         Not supported

=====================================================================
   Device Identifier:        disk10
   Device Node:              /dev/disk10
   Part of Whole:            disk10
   Device / Media Name:      Apple disk image Media

   Volume Name:              untitled
   Escaped with Unicode:     untitled

   Mounted:                  Yes
   Mount Point:              /Library/Preferences
   Escaped with Unicode:     /Library/Preferences

   File System Personality:  HFS+
   Type (Bundle):            hfs
   Name (User Visible):      Mac OS Extended
   Owners:                   Enabled

   Content (IOContent):      None
   OS Can Be Installed:      No
   Media Type:               Generic
   Protocol:                 Disk Image
   SMART Status:             Not Supported
   Volume UUID:              4F7EA62F-FC30-3C29-8FFB-C1711B2AD0EC

   System Image:             Yes

   Total Size:               524.3 KB (524288 Bytes) (exactly 1024 512-Byte-Units)
   Volume Free Space:        356.4 KB (356352 Bytes) (exactly 696 512-Byte-Units)
   Device Block Size:        512 Bytes

   Read-Only Media:          No
   Read-Only Volume:         No
   Ejectable:                Yes

   Whole:                    Yes
   Internal:                 No
   OS 9 Drivers:             No
   Low Level Format:         Not supported

=====================================================================
   Device Identifier:        disk11
   Device Node:              /dev/disk11
   Part of Whole:            disk11
   Device / Media Name:      Apple disk image Media

   Volume Name:              untitled
   Escaped with Unicode:     untitled

   Mounted:                  Yes
   Mount Point:              /Library/Preferences/SystemConfiguration
   Escaped with Unicode:     /Library/Preferences/SystemConfiguration

   File System Personality:  HFS+
   Type (Bundle):            hfs
   Name (User Visible):      Mac OS Extended
   Owners:                   Enabled

   Content (IOContent):      None
   OS Can Be Installed:      No
   Media Type:               Generic
   Protocol:                 Disk Image
   SMART Status:             Not Supported
   Volume UUID:              22FE002E-D4B9-3405-BA81-95B03A62A222

   System Image:             Yes

   Total Size:               524.3 KB (524288 Bytes) (exactly 1024 512-Byte-Units)
   Volume Free Space:        360.4 KB (360448 Bytes) (exactly 704 512-Byte-Units)
   Device Block Size:        512 Bytes

   Read-Only Media:          No
   Read-Only Volume:         No
   Ejectable:                Yes

   Whole:                    Yes
   Internal:                 No
   OS 9 Drivers:             No
   Low Level Format:         Not supported

=====================================================================
   Device Identifier:        disk12
   Device Node:              /dev/disk12
   Part of Whole:            disk12
   Device / Media Name:      Apple disk image Media

   Volume Name:              untitled
   Escaped with Unicode:     untitled

   Mounted:                  Yes
   Mount Point:              /Library/Keychains
   Escaped with Unicode:     /Library/Keychains

   File System Personality:  HFS+
   Type (Bundle):            hfs
   Name (User Visible):      Mac OS Extended
   Owners:                   Enabled

   Content (IOContent):      None
   OS Can Be Installed:      No
   Media Type:               Generic
   Protocol:                 Disk Image
   SMART Status:             Not Supported
   Volume UUID:              5BB6904E-F8BD-3D1F-99A7-F37ECDE58587

   System Image:             Yes

   Total Size:               1.0 MB (1048576 Bytes) (exactly 2048 512-Byte-Units)
   Volume Free Space:        872.4 KB (872448 Bytes) (exactly 1704 512-Byte-Units)
   Device Block Size:        512 Bytes

   Read-Only Media:          No
   Read-Only Volume:         No
   Ejectable:                Yes

   Whole:                    Yes
   Internal:                 No
   OS 9 Drivers:             No
   Low Level Format:         Not supported

=====================================================================

Some of the drives are mounted in familiar places (like /Volumes) and some of them are mounted in less familiar places (like /private/var). Nevertheless, I don't recall any of these drives showing up as mounted the first time I've had my Mac. Does anyone perhaps know why these disks show up and/or if I can remove them? Thanks!


text:
Q: How to calculate a division/quotient in octal numeric system? Im trying to make a division in octal system
$$\frac{165_{8}}{24_{8}}$$
So I have done like this using a table
$$24\times 0=0_{8}$$
$$24\times 1=30_{8}$$
$$24\times 2=50_{8}$$
$$24\times 3=74_{8}$$
$$24\times 4=120_{8}$$
$$24\times 5=144_{8}$$
$$24\times 6=170_{8}$$
$$24\times 6=214_{8}$$
Next
$$\frac{165_{8}}{24_{8}}=5.5_{8}$$
but this has a remainder of $0_{8}$
How must be done the fractional part, since when doing this in a calculator it solve the operation as $5.66_{8}$? How it was calculate the .66 fraction?
UPDATE
I was using the wrong values on the table, it was updated. So indeed
$$\frac{165_{8}}{24_{8}}=5.66_{8}$$

A: The $24_8$ in the denominator is $20_{10}$.  In your table you are multiplying by $24_{10}$ and then converting to base $8$.  We have $5_8 \cdot 24_8=144_8$, so the remainder is $21_8$.  Then $\frac {21_8}{24_8}\approx 0.663_8$


text:
Q: How to extract onChange method's String parameters using Regex? I have select elements as below
<select name="selectid1" id="selectid1" onChange="script.selectChange(this,'tr');">.......</select>

and
<select name="selectid2" id="selectid2" onChange="script.selectChange(this,'div');">.......</select>

I want to extract the selectChange method's String paramter (the 2nd paramter) tr and div of the onChange attribute of both the select elemets using regular expresssion.
I can get the value of onChange using
var selectid1 = $('#selectid1').attr('onChange'); //script.selectChange(this,'tr');

and
var selectid2 = $('#selectid2').attr('onChange'); //script.selectChange(this,'div');

What regex should I use in order to get strings 'tr' and 'div' from the variables?

A: /onChange="script.selectChange\(this,'([^']*)'/g

Demo here --> https://regex101.com/r/uW2aQ6/1

A: If it's just for test case - use the following approach with String.match function:
var selectid1 = "script.selectChange(this,'tr')",
    param = selectid1.match(/,\s?['"]([^)]+)['"]/)[1];

console.log(param);  // tr


text:
Q: Is there a way to restore KDE Activity after reboot? I have been using KDE for 2 years...I have a feeling it can do lots I don't know about.  Recently discovered activities.
I have a feeling there is no way to do what I am trying to do...but thought I'd ask. Even if there are no exact answer - there may be some other KDE way for me to achieve what I'm trying to do.

*

*I have an activity with several windows arranged in a certain way (terminals, browser & mpv).

*I can stop the activity & when I start it again, it restores the desktop

*However if I am in the activity and restart the machine, when I log in - I am placed in the activity but all the windows, etc are gone.

*Is there a way to get the same windows arrangement?

I can always switch to a default activity before reboot - is this the only way to achieve this.

A: You can save your session. In settings, enable Restore previous session. Details about saving session is answered in Ask Ubuntu. Check if it works.


text:
Q: Stop menu item appearing twice on simple html drop menu This is a very simple question and i'm sure a very simple fix. I have not really used drop menus at all and so have no idea how to change this. All I want to do is to stop the displayed menu item from appearing in the drop down results! So my code is as follows:
<form action="">
<select name="menu">
<option value="other">Other blog entries</option>
<option value="other">So you want to shoot a show...</option>
</select>
</form>

fiddle
Works fine but when the list is dropped I do not want to display "Other blog entries" as an option within the dropped list. How to I change this to have Other blog entries in the display only and not a drop item? I have googled around and cannot find a solution!
Thank you very much for any help.

A: Here's the solution:
<form action="">
  <select name="menu" value="" onchange="var opt=this.options[0];if(opt.getAttribute('role')==='placeholder'&&!opt.selected)opt.parentNode.removeChild(opt);">
   <option role="placeholder" value="" id="hiddenOption">Other blog entries</option>
   <option value="other">So you want to shoot a show...</option>
  </select>
</form>

And CSS:
#hiddenOption {display: none;}

Fiddle: http://jsfiddle.net/DSsYU/1/
Is this the desired result? :)


text:
Q: Programatically Sign a Macro in .NET I have a macro on any MS Office file format. I would like to sign it programmatically using C# and the .NET framework.
I know I can use a .NET framework tool called signTool.exe to sign ms office files on the command line. The tool runs on top of the .NET framework. I would like to be able to replicate some of this behavior on a stand alone application. In other words I would like to know if its possible to produce the digest then sign and incorporate the signature to the MS Office file programmatically, and not through the signtool.exe
I assume it has to be related to: System.Security.Cryptography?


text:
Q: How do you add an li to ul as soon as the user signs-in I am new to this form, sorry if I am interpreting a question wrong.
Say you have a basic sign_in form that uses sessions to log users in and out. The list is already created beforehand and the style is simply controlled by the boostrap classes. So if you want to add a click-able li to the the end of the ul with the same css applied as to the other existing li's in the ul, when the user  is logged in. How would you do it?  And consequently remove that page from the ul when the user sign-out.
What I am trying to get is to extra pages on my menu only when a user-signs in.
Background
I did a bit of research and I did read about DOM but the problem is I tried to apply css to it and make it in line with the other pages but it seemed so in-efficient.

example of me attempting this is below
<?php
     if(isset($_SESSION['user']))
     {
         echo " ";

Any help would be great or even examples.

A: There's no need for any JavaScript here; you simply need to have PHP echo additional lines:
$loggedIn = isset($_SESSION['user']);  // store logged state

Later, in your HTML, just add elements depending on the state:

...

...

...

...

  <?php if ($loggedIn) { ?>

members only

  <?php } ?>

There are other ways to accomplish this result, like
<?php if ($loggedIn) echo "
...
"; ?>

A: It seems to me your trying to create a login button? Or manipulating a list of items? ul (unordered list) li (list item).
I would find a secure way to store the login information. (Data base access?)
Then in your php file somehow check that the user is logged in.
If the user is logged in then find the current list item.
Javascript document.getElementById("menu-login-button"); tries to find a login-button. Then you could change the text from logged-out to logged in, maybe also change the href it goes to. etc.


text:
Q: How to transmit data with ZIGBEE using visual studio c++ HELP:How to transmit data with ZIGBEE using visual studio c++
Two xbee series 2:
XBEE 1-connected to a pc(which transmits data to my other xbee)
XBEE 2-receives data;connected to a LCD.
Thanks in advance.

A: To work with XBee connected on your pc you need:

*

*to install a driver from DIGI in order to plug your USB cable on the PC and on a socket with the XBee Mounted on (see (http://www.digi.com/support/supporttype?type=drivers) )

*then you use serial interface programming in C++

A: void XBee::XBeeOpen(String^ PortCom)
{
    // very short exemple of in a XBee Class
    try
    {
        SerialLink->PortName = PortCom;
    }
    catch (Exception^ e)
    {
     .....
    }

    SerialLink->BaudRate = 115200;
    SerialLink->Parity = Parity::None;
    SerialLink->StopBits = StopBits::One;
    SerialLink->DataBits = 8;
    SerialLink->Handshake = Handshake::None;

    // Set the read/write timeouts
    //    SerialLink->ReadTimeout = SerialPort::InfiniteTimeout;
    //    SerialLink->WriteTimeout = SerialPort::InfiniteTimeout;
    SerialLink->ReadTimeout = 20;
    SerialLink->WriteTimeout = 20;

    // Encoding
    SerialLink->Encoding = System::Text::Encoding::GetEncoding(28591);

    if ( !SerialLink->IsOpen )
        SerialLink->Open();

    SerialLink->BreakState = false;
    SerialLink->DiscardNull = false;

    Opened = SerialLink->IsOpen;
}
//---------------------------------------------------------------------------
void    XBee::XBeeClose(void)
{
    if (SerialLink->IsOpen )
        SerialLink->Close();
    Opened = SerialLink->IsOpen;
}


text: Q: .aar file not generating gradle in my project i have a library. i want to use that librarie's aar file in the project. before updating studio to 1.10 and and gradle to 1.0.0 it was working fine. an aar file was generating with name libname.aar.also libname-release.aar, libname-debug.aar will be there. now libname.aar is not generating in aar folder. now libname-release.aar, libname-debug.aar only generating. How to resolve this?


text:
Q: ld: symbol(s) not found... (NewSpeechChannel) I can't understand why this happens:
"_NewSpeechChannel", referenced from:
_main in ccOIJZkQ.o
ld: symbol(s) not found
collect2: ld returned 1 exit status

The simple code is:
#include<stdio.h>
#include<ApplicationServices/ApplicationServices.h>

int main(int argc, char **argv, char **envp, char **apple) {

  SpeechChannel speechchannel;
  NewSpeechChannel( NULL, &speechchannel );

}

Compilation steps:

Using built-in specs.
Target: i686-apple-darwin10
   Configured with: /var/tmp/gcc/gcc-5666.3~6/src/configure --disable-checking --enable-werror --prefix=/usr --mandir=/share/man --enable-languages=c,objc,c++,obj-c++ --program-transform-name=/^[cg][^.-]*$/s/$/-4.2/ --with-slibdir=/usr/lib --build=i686-apple-darwin10 --program-prefix=i686-apple-darwin10- --host=x86_64-apple-darwin10 --target=i686-apple-darwin10 --with-gxx-include-dir=/include/c++/4.2.1
Thread model: posix
gcc version 4.2.1 (Apple Inc. build 5666) (dot 3)
/usr/libexec/gcc/i686-apple-darwin10/4.2.1/cc1 -quiet -v -imultilib x86_64 -D_DYNAMIC_ first.c -fPIC -quiet -dumpbase first.c -mmacosx-version-min=10.6.8 -m64 -mtune=core2 -auxbase first -version -o /var/folders/HQ/HQEeBRxZFdOTLnWFF1cxDU+++TI/-Tmp-//ccyQukF0.s
ignoring nonexistent directory "/usr/lib/gcc/i686-apple-darwin10/4.2.1/../../../../i686-apple-darwin10/include"
#include "..." search starts here:
#include <...>  search starts here:
/usr/local/include
/usr/lib/gcc/i686-apple-darwin10/4.2.1/include
/usr/include
/System/Library/Frameworks (framework directory)
/Library/Frameworks (framework directory)
End of search list.
GNU C version 4.2.1 (Apple Inc. build 5666) (dot 3) (i686-apple-darwin10)
compiled by GNU C version 4.2.1 (Apple Inc. build 5666) (dot 3).
GGC heuristics: --param ggc-min-expand=150 --param ggc-min-heapsize=131072
Compiler executable checksum: fdbb4a71861779b5591b0cf47736cbe7
/usr/libexec/gcc/i686-apple-darwin10/4.2.1/as -arch x86_64 -force_cpusubtype_ALL -o /var/folders/HQ/HQEeBRxZFdOTLnWFF1cxDU+++TI/-Tmp-//ccRRVBTR.o /var/folders/HQ/HQEeBRxZFdOTLnWFF1cxDU+++TI/-Tmp-//ccyQukF0.s
/usr/libexec/gcc/i686-apple-darwin10/4.2.1/collect2 -dynamic -arch x86_64 -macosx_version_min 10.6.8 -weak_reference_mismatches non-weak -o a.out -lcrt1.10.6.o -L/usr/lib/gcc/i686-apple-darwin10/4.2.1/x86_64 -L/usr/lib/gcc/i686-apple-darwin10/4.2.1/x86_64 -L/usr/lib/i686-apple-darwin10/4.2.1 -L/usr/lib/gcc/i686-apple-darwin10/4.2.1 -L/usr/lib/gcc/i686-apple-darwin10/4.2.1 -L/usr/lib/gcc/i686-apple-darwin10/4.2.1/../../../i686-apple-darwin10/4.2.1 -L/usr/lib/gcc/i686-apple-darwin10/4.2.1/../../.. /var/folders/HQ/HQEeBRxZFdOTLnWFF1cxDU+++TI/-Tmp-//ccRRVBTR.o -lSystem -lgcc -lSystem
Undefined symbols:
"_NewSpeechChannel", referenced from:

_main in ccRRVBTR.o

ld: symbol(s) not found
collect2: ld returned 1 exit status

which I got by using gcc -v


text:
Q: Deploy SharePoint Hosted App I want to deploy SharePoint Hosted App in an On Premise Environment I have created the App.
Can anyone provide the detailed step how to deploy SharePoint Hosted App On Premise Environment

A: You need to publish the app to the local App Catalog. The App Catalog is managed in the Apps section of Central Administration. Go to Central Admin -> Apps -> Manage App Catalog.
If an App Catalog has not been created you will be able to create one.

If the App catalog has already been created you can access it through the link provided.

NOTE: There is one App Catalog per Web Application so, if you have multiple Web Applications, make sure the correct one is shown in the top-right of the page.
In Visual Studio, right-click your project and select Publish. When the Publish your app page appears, click Package the app to create an App Package.

A Windows Explorer window will open to the folder containing your App Package (the file will have an app extension).
Navigate to the App Catalog and click Apps for SharePoint in the Quick Launch Bar (on the left).
Click new document and select your App Package.

Add details about the app in the dialog that pops up and then click Save.

You app is now in your local App Catalog.
Now go to any site in the target Web Application, and then go to Site Contents -> Add an app -> From Your Organization. Your app will be there to add.


text:
Q: What does Kotlin ?: return expression means i want to know about the expression
val videoCapture = this.videoCapture ?: return

especially,
?: return

part.
As far as i know "?" is used for let the variable can be assigned with null.
However i cant really find the explanation related with "?: return" expression.
I found this expression in google camera basic guide in kotlin.
In case you need more code to figure it out.
 private fun captureVideo() {
    val videoCapture = this.videoCapture ?: return

    viewBinding.videoCaptureButton.isEnabled = false

    val curRecording = recording
    if (curRecording != null) {
        // Stop the current recording session.
        curRecording.stop()
        recording = null
        return
    }

If anyone knows what ?: return means, please kindly guide me.
Thanks.


text:
Q: View files in iCloud (without Pages) for iOS app testing? I am working on an app right now that is supposed to generate a text document from an NSString , save it to the app's documents foldr, and then upload it to the iCloud.
I have confirmed that a .txt file is being created with the data I want, and is then stored inside the Documents folder in my app's Sandbox on the device. My next step is to debug the iCloud upload. It looks like my app is failing to upload the document to iCloud, by looking at Settings > iCloud > Storage & Backups > ManageStorage > myAppName > files created by my app in the iCloud would be listed here.
So, to confirm this, I want to view my entire iCloud account as a normal directory of files, and look for the file I am supposed to be creating & uploading with my app. Think about how Dropbox displays their files. That's what I'm talking about.
How do you view all the raw files saved in your personal iCloud, as if it were a normal filesystem? (I cannot purchase Pages at this time.)
Update: I have now gotten my text file's name to appear in the Settings > iCloud > etc... but I still do not have a way to verify it exists in my iCloud, nor view the file's contents.

A: https://developer.icloud.com will show you what the iCloud server thinks your app container looks like. It will also let you download the files.
However, note that iOS devices also sync peer-to-peer, so the iCloud server might not have the very latest information all the time.


text:
Q: How to find the location of the .bat script being called
Possible Duplicate:
How to get folder path from file path with CMD

I have a Windows .bat script that needs to execute a file that is in the same directory as the .bat file, but the .bat script can be called from any directory.  How do you find the location of the batch file itself, not just the current directory?

A: You can write %~dp0 to get the directory containing the .bat file.


text:
Q: Tombstone disappears when ExtractField$Key transform is added to connector config I have the following connector declared with ksqldb:
CREATE
SOURCE CONNECTOR `myconn` WITH (
    "name" = 'myconn',
    "connector.class" = 'io.debezium.connector.mysql.MySqlConnector',
    "tasks.max" = 1,
    "database.hostname" = 'myconn-db',
    "database.port" = '${dbPort}',
    "database.user" = '${dbUsername}',
    "database.password" = '${dbPassword}',
    "database.history.kafka.topic" = 'myconn_db_history',
    "database.history.kafka.bootstrap.servers" = '${bootstrapServer}',
    "database.server.name" = 'myconn_db',
    "database.allowPublicKeyRetrieval" = '${allowPublicKeyRetrieval}',
    "table.include.list" = 'myconn.links,myconn.imports',
    "message.key.columns" = 'myconn.links:id',
    "tombstones.on.delete" = true,
    "null.handling.mode" = 'keep',
    "transforms" = 'unwrap',
    "transforms.unwrap.type" = 'io.debezium.transforms.ExtractNewRecordState',
    "transforms.unwrap.drop.tombstones" = false,
    "transforms.unwrap.delete.handling.mode" = 'none'
);

Tombstones are successfully sent, but the key in messages is Struct(id=00000). In order to change the key by 00000, I've used ExtractField$Key transform:
CREATE
SOURCE CONNECTOR `myconn` WITH (
    "name" = 'myconn',
    "connector.class" = 'io.debezium.connector.mysql.MySqlConnector',
    "tasks.max...

    --- I omit all the rest for convenience ---

    "transforms" = 'unwrap,extractKey',
    ---New lines added (next 3)
    "transforms.extractKey.type" = 'org.apache.kafka.connect.transforms.ExtractField$Key',
    "transforms.extractKey.field" = 'id',
    "include.schema.changes" = false
);

Just adding the last three lines, now the keys are ok but tombstones disappear; no tombstone in the topic. Do you know the reason?

A: As you can see I have more than one table allowed in the white list (table.include.list). The second one has a different id field; not 'id' but 'import_id'. Seems like internally that field couldn't be properly extracted and tombstones (for all tables) was ignored.
I'm not sure about what's the reason of that behavior (no errors reported by doing describe connector myconn; something like 'key id not found' would have been useful) but I solved the issue just handling each topic with its proper key.
Here you have the new connector definition:
CREATE
SOURCE CONNECTOR `myconn` WITH (
    "name" = 'myconn',
    "connector.class" = 'io.debezium.connector.mysql.MySqlConnector',
    "tasks.max" = 1,

    --Database config--------------------------

    "database.hostname" = 'myconn-db',
    "database.port" = '${dbPort}',
    "database.user" = '${dbUsername}',
    "database.password" = '${dbPassword}',
    "database.history.kafka.topic" = 'myconn_db_history',
    "database.history.kafka.bootstrap.servers" = '${bootstrapServer}',
    "database.server.name" = 'myconn_db',
    "database.allowPublicKeyRetrieval" = '${allowPublicKeyRetrieval}',

    "table.include.list" = 'myconn.links,myconn.imports',

    --Connector behavior------------------------

    "tombstones.on.delete" = true,
    "null.handling.mode" = 'keep',
    "include.schema.changes" = false,

    --Predicates--------------------------------

    "predicates" = 'TopicDoestHaveIdField,IsImportTopic',

    "predicates.TopicDoestHaveIdField.type" = 'org.apache.kafka.connect.transforms.predicates.TopicNameMatches',
    "predicates.TopicDoestHaveIdField.pattern" = 'myconn_db.myconn\.(imports)',

    "predicates.IsImportTopic.type" = 'org.apache.kafka.connect.transforms.predicates.TopicNameMatches',
    "predicates.IsImportTopic.pattern" = 'myconn_db.myconn.imports',

    --Transforms--------------------------------

    "transforms" = 'unwrap,extractKey,extractImportKey',

    "transforms.unwrap.type" = 'io.debezium.transforms.ExtractNewRecordState',
    "transforms.unwrap.drop.tombstones" = false,
    "transforms.unwrap.delete.handling.mode" = 'none',

    "transforms.extractKey.type" = 'org.apache.kafka.connect.transforms.ExtractField$Key',
    "transforms.extractKey.field" = 'id',
    "transforms.extractKey.predicate" = 'TopicDoestHaveIdField',
    "transforms.extractKey.negate" = true,

    "transforms.extractImportKey.type" = 'org.apache.kafka.connect.transforms.ExtractField$Key',
    "transforms.extractImportKey.field" = 'import_id',
    "transforms.extractImportKey.predicate" = 'IsImportTopic'
);

Now I have the tombstones in the topics and rows are properly removed from tables.


text:
Q: Programming for "no data found" New to VBA.  I need to enter a number in text box and search spreadsheet for that number and then return the data in columns beside the found number in text boxes in form. I have done this but the question I have is how to write an exception if the number is not found?

A: Like so. Assumptions made for sheet name, range name, textbox name, etc. Solely done for illustrative purposes to show you how to go about it:
Sub FindNumber()

Dim myNum

myNum = TextBox1.Value

Dim rng as Range

Set rng = Sheets(1).Range("A1:A100").Find(myNum,lookat:xlWhole)

If Not rng is Nothing Then

    '[Rest of Code]

Else

   Msgbox myNum & "not found in Range"

End If

End Sub

A: You can do this with a formula.
Let's assume your number is in A1 and your list of numbers is in column D. You want the text in column E if you find the number in A1 within the list in Column D.
Normally you would just use VLOOKUP().
=VLOOKUP(A1,D:E,2,FALSE)

You can add a simple IF statement and ISERROR() to check if it succeeded in finding the number or not. Normally Excel will return "#N/A" if it was an error, but let's assume you want a message.
=IF(ISERROR(VLOOKUP(A1,D:E,2,FALSE)),"ERROR",VLOOKUP(A1,D:E,2,FALSE))


text:
Q: C# determining if an IP address represents a real host Problem: there's an input field in an application where the user can enter either a host name or an IP address. I need to tell if the entered address corresponds to a real host.
I'm not talking about a simple regular expression check or an IPAddress.TryParse or Uri.CheckHostName. I don't have difficulty with checking a hostname: if it cannot be resolved to an IP address, then Dns.GetHostEntry will throw an exception. That's a piece of cake.
However. If I get an IP address input, then if I make a Dns.GetHostAddresses call it'll always succeed, even if I enter a stupid IP, like "1.1.1.1" ("1.1.1.1" is an IANA reserved IP address, our DNS server reports "non existent host/domain"). The Dns.GetHostAddresses immediately just spits back the IP I just passed in like everything would be all right whatsoever.
I cannot use the Dns.GetHostEntry either, because there are some IP addresses (like my virtual machines on the local network) which don't have any DNS host names associated with them, but they still have valid IP addresses, and Dns.GetHostEntry would throw exception to those (I guess it tries to resolve a hostname for them?).
I need a method call which actually tells me if it is a bogus IP or not, even if it looks like good IP address (by Uri.CheckHostName), but it doesn't have corresponding DNS host name.

A: The only reasonably check you can make is if IP is some sort of reserved IP. Otherwise there is not much you can do - even lack of "ping" (ICMP) responses and lack of responses on well-known ports (like HTTP - 80) means nothing.
Reserved as in:

*

*127.0.0.0/8 - loopback (may or may not be considered "valid host")

*224.0.0.0 - 239.255.255.255 - multicast (unlikely to be considered "valid host")

*all zeros/all ones in subnet (i.e. 192.168.1.0 and 192.168.1.255 for 192.168.1.0/24 subnet) are all/broadcast - clearly not associated with particular how.

Check IP4 subnetting and linked RFCs for more info on special ranges/IPs.


text:
Q: Visualforce and slickgrid saving changes I needed to create a quick-edit, excel-style page for my users and based on recommendations here and elsewhere, I chose slickgrid.  Now I have a visualforce page with a slickgrid implementation, that allows mass-excel-style editing of opportunity line items and it works beautifully.  Problem is saving those changes back to the database.  I cannot for the life of me figure out how to get it done.  I've read about using a hidden input field and JSON, but I'm really unfamiliar with JSON and the REST API.  Not to mention my grid could contain thousands of rows with only a few edited - I only want to update the rows that have changed.
I'm using dataView and onCellChange to process the updates and grab the updated rows, so I know exactly what to update.
grid.onCellChange.subscribe(function (e, args) {
    var item = dataView.getItemById(args.item.id);
    item['Est_Total_Price__c'] = item['Est_Quantity__c']*item['CPM__c']/1000;
    item['ischanged'] = true;
    dataView.updateItem(args.item.id, item);
    updateitems[item.id] = item;
});

What is the cleanest way to get my updates back to the database?  Is my updateitems object even a valid approach?  I thought about looping through it and just creating my own strings to pass back via javascript remoting, but it seems like there must be a better way.

A: If I understand your JavaScript, your updateitems is an object with fields that use the item id and values that are the items (a JavaScript form of an OpportunityLineItem). Using the item id as the key makes sure that multiple changes to the same item only produce one entry inupdateitems. You can turn that entire object into a JSON string directly in the browser:
var jsonString = JSON.stringify(updateitems);

and send that back using a RemoteAction.
Your remote action Apex method can then turn the JSON string back into a Map using JSON.deserializeUntyped and then use JSON.deserialize to reconstitute the (guaranteed unique) OpportunityLineItem objects and then update them:
@RemoteAction
global static void processChanges(String jsonString) {
    Map<String, Object> m = (Map<String, Object>) JSON.deserializeUntyped(jsonString);
    Type t = Type.forName('OpportunityLineItem');
    OpportunityLineItem[] olis = new OpportunityLineItem[] {};
    for (String id : m.keySet()) {
        String s = JSON.serialize(m.get(id));
        olis.add((OpportunityLineItem) JSON.deserialize(s, t));
    }
    update olis;
}

PS
In this case, as all the Map values are OpportunityLineItemthis simpler code should work:
@RemoteAction
global static void processChanges(String jsonString) {
    Map<String, OpportunityLineItem> m = (Map<String, OpportunityLineItem>)
            JSON.deserialize(jsonString, Map<String, OpportunityLineItem>.class);
    update m.values();
}


text:
Q: Least stressful way to check a git repo's heads using the git CLI tool What's the least stressful way to poke a git server for a listing of all the repo's head commits?
More specifically, I'll be doing this a lot to a lot of git repos, so optimizing the query time is extremely important so as to not nuke the servers.
This should be obvious, but: cloning is not an option.
(In the future, this will be done a lot more efficiently, but right now I just need a proof of concept for my federated thing.)

A: Git provides an ls-remote command that you can use. For example:
$ git ls-remote https://github.com/git/git.git
041f5ea1cf987a4068ef5f39ba0a09be85952064        HEAD
aeb582a98374c094361cba1bd756dc6307432c42        refs/heads/maint
041f5ea1cf987a4068ef5f39ba0a09be85952064        refs/heads/master
f8f6787159eebeb0fe8766e114123185ee1893ea        refs/heads/next
55070086a7b72850cce2e7e1688deb53114aac65        refs/heads/pu
be6eed6d9f1c0dfa4a732832c506318f916caf09        refs/heads/todo
f0d0fd3a5985d5e588da1e1d11c85fba0ae132f8        refs/pull/10/head
[...]

This is the cheapest option you can use, but be aware that most hosting providers will rate-limit you regardless. Your tools should learn how to back off if they're doing automated processing of repositories.
You can also make queries directly to the /info/refs?service=git-upload-pack part of the URL, which is essentially equivalent.

A: What if you clone, but not checkout any of the files?

*

*Make a new folder

*Run a git init to initialize it as a git repository

*Run git clone -n [git://path/to/repo.git]
This will make a new folder "repo" inside of your new folder, with none of the repo's files, only it's .git/ folder. Then you can take a look at whatever you need to.
Still painful and you said no cloning but this will work.


text:
Q: How to extract all objects from all ids have linked with foreign key in django? using Django 1.9
How to extract all objects from class table that linked with another class table by foreign key.
I mean not all objects from one id but i mean all objects from all ids in one page. when i'm trying it gives me just one result
For instance:
urls.py
from django.conf.urls import url

from . import views

app_name = 'music'

urlpatterns = [
    # /music/
    url(r"^$", views.HomeView.as_view(), name='home'),
    # /music/123/
    url(r'^(?P<pk>[0-9]+)/$', views.DetailView.as_view(), name='details'),
    # /music/song/
    url(r'^song/$', views.songView, name='songs'),
]

views.py
from django.views import generic
from .models import Album, Song
from django.shortcuts import render

class HomeView(generic.ListView):
    template_name = 'music/index.html'

    def get_queryset(self):
        return Album.objects.all()

class DetailView(generic.DetailView):
    model = Album
    template_name = 'music/details.html'

# Get all songs from all album (extracting songs from all of the albums in one page)
def songView(request):
    for albums in Album.objects.all():
        all_album = Album.objects.get(id=albums.id)
        all_song = all_album.song_set.all()
    return render(request, 'music/song.html', {'all_song': all_song})

songs.html
{% extends 'music/base.html' %}
{% block body %}

    {% for song in all_song %}

{{ song }}

    {% endfor %}

{% endblock %}

A: You're just iterating through the Album objects and on every interaction rewrite the all_song variable without storing it somewhere. The proper way would be:
def songView(request):
    songs = []
    for album in Album.objects.all():
        songs_per_album = album.song_set.all()
        songs.append(song_per_album)
    return render(request, 'music/song.html', {'all_song': songs})

Also, take a look at serializers it can be useful when serializing nested structures.

A: I don't understand why you doing this?
def songView(request):
    for albums in Album.objects.all():
        all_album = Album.objects.get(id=albums.id)
        all_song = all_album.song_set.all()
    return render(request, 'music/song.html', {'all_song': all_song})

You get all albums and than again make request to db to get album, and you just get all songs of specific album, if you want to get all songs just get all of them
songs = Song.objects.all()

if you want to get songs where album fk not null you can do like this:
album_ids = list(Album.objest.values_list('id', flat=True))
songs = Song.objects.filter(album_id__in=album_ids)
or
songs = Song.objects.filter(album_isnull=False)

A: Another simple way to get the values in template is:
def songView(request):
    album = Album.objects.all()
    return render(request, 'music/song.html', {'album': album})

and in your templates you can iterate this way
{% for item in album %}

{{ item.title }}

{% for song in item.song_set.all %}

{{ song.title }}

{% endfor %}
{% endfor %}


text:
Q: Calling imagemagick from java not working, direct call works I am having the following java code to blur faces in images - the variable convert is set to /usr/bin/mogrify
//String []cmd = {convert, "-region", f.w+"x"+f.h+"+"+x+"+"+y, "-blur 0.0x10.0", path};

String cmd = convert + " -region " + f.w+"x"+f.h+"+"+x+"+"+y + " -blur 0.0x10.0 " + "\"" + path + "\"";

System.out.println(cmd);
// System.out.println(strJoin(cmd, " "));
Process p = Runtime.getRuntime().exec(cmd);
    BufferedReader in = new BufferedReader(
                        new InputStreamReader(p.getInputStream()));
    String line = null;
    while ((line = in.readLine()) != null) {
        System.out.println(line);
    }
p.waitFor();

But nothing happens on the images.
The program also outputs the command line it would call, for example:
/usr/bin/mogrify -region 37x44+1759+881 -blur 0.0x10.0 "/home/self/.wine/drive_c/windows/profiles/self/My Pictures/test/pic00164.jpg"

If I call this line manually, everything works fine.
As you can see from the comments, I also tried supplying cmd as an array which should automatically escape the spaces in my path - same effect: none.

A: Never build command line by hands - there is no single portable solution for this. It works only in rare cases, where no spaces or (double) quotes are present in the command line.
Use process builder instead:
ProcessBuilder pb = new ProcessBuilder(
    convert, "-region", f.w+"x"+f.h+"+"+x+"+"+y, "-blur 0.0x10.0", path);
pb.redirectError();
Process process = pb.start();
BufferedReader in = new BufferedReader(
    new InputStreamReader(process.getInputStream()));

A: getErrorStream() - as mentioned in a comment - was the key to success. The escaping did not work the way I tried it. Then I tried it with an array and found our that I have to split up the blur option.
This works:
String []cmd = {convert, "-region", f.w+"x"+f.h+"+"+x+"+"+y, "-blur", "0.0x10.0", path};


text:
Q: Multithreading / multiprocessing with a python loop I have an script that loops through a range of URLs to pull item location based on returned json data. However, the script takes an 60 minutes to run and 55 minutes of that (per cprofile) is spent waiting for json data to load.
I would like to multithread to run multiple POST requests at a time to speed this up and have initially split up URL ranges into two halves to do this. Where I am getting stuck is how to implement multithreading or asyncio.
Slimmed down code:
import asyncio
import aiohttp

# i am not recommend to use globals
results = dict()
url = "https://www.website.com/store/ajax/search"
query = "store={}&size=18&query=17360031"

# this is default url opener got from aiohttp documentation
async def open_url(store, loop=None):
    async with aiohttp.ClientSession(loop=loop) as session:
        async with session.post(url, data={'searchQuery': query.format(store)}) as resp:
            return await resp.json(), store

async def processing(loop=None):
    # U need to use 'global' keyworld if U wan't to write to global variables
    global results
    # one of the simplest ways to parallelize requests, is to init Future, and when data will be ready save it to global
    tasks = [open_url(store, loop=event_loop) for store in range(0, 5)]
    for coro in asyncio.as_completed(tasks, loop=loop):
        try:
            data, store = await coro
            results[store] = data['searchResults']['results'][0]['location']['aisle']
        except (IndexError, KeyError):
            continue

if __name__ == '__main__':
    event_loop = asyncio.new_event_loop()
    event_loop.run_until_complete(processing(loop=event_loop))

# Print Results
for store, data in results.items():
    print(store, data)

json:
    {u'count': 1,
     u'results': [{u'department': {u'name': u'Home', u'storeDeptId': -1},
           u'location': {u'aisle': [A], u'detailed': [A.536]},
           u'score': u'0.507073'}],
     u'totalCount': 1}

A: Even if you use multithreading or multiprocessing, each thread/process will still block until the JSON data is retrieved. This could speed up things a little but it's still not your best choice.
Since you're using requests, try grequests which combines this one with gevent. This lets you define a series of HTTP requests that run asynchronously. As a result you'll get a huge speed boost. The usage is very simple: just create a list of requests (using grequests.get) and pass it grequests.map.
Hope this helps!

A: If u wan't to parallelize requests( i hope u ask for this). This code snippet will help.
There are request opener,and 2000 post requests sent via aiohttp and asyncio.
python3.5 used
import asyncio
import aiohttp

# i am not recommend to use globals
results = dict()
MAX_RETRIES = 5
MATCH_SLEEP_TIME = 3  # i am recommend U to move this variables to other file like constants.py or any else
url = "https://www.website.com/store/ajax/search"
query = "store={}&size=18&query=44159"

# this is default url opener got from aiohttp documentation
async def open_url(store, semaphore, loop=None):
    for _ in range(MAX_RETRIES):
        with await semarhore:
            try:
                async with aiohttp.ClientSession(loop=loop) as session:
                    async with session.post(url, data={'searchQuery': query.format(store)}) as resp:
                        return await resp.json(), store
            except ConnectionResetError:
                # u can handle more exceptions here, and sleep if they are raised
                await asyncio.sleep(MATCH_SLEEP_TIME, loop=loop)
                continue
    return None

async def processing(semaphore, loop=None):
    # U need to use 'global' keyworld if U wan't to write to global     variables
    global results
    # one of the simplest ways to parallelize requests, is to init     Future, and when data will be ready save it to global
    tasks = [open_url(store, semaphore, loop=event_loop) for store in range(0,     2000)]
    for coro in asyncio.as_completed(tasks, loop=loop):
        try:
            response = await coro
            if response is None:
                continue
            data, store = response
            results[store] = data['searchResults']['results'][0]['location']['aisle']
        except (IndexError, KeyError):
            continue

if __name__ == '__main__':
    event_loop = asyncio.new_event_loop()
    semaphore = asyncio.Semaphore(50, loop=event_loop)  # count of concurrent requests
    event_loop.run_until_complete(processing(semaphore, loop=event_loop))


text:
Q: TSX: Props type definition for a number input In JSX/TSX syntax from react, all inputs seems to be define with the same props declaration which is InputHTMLAttributes:
    interface InputHTMLAttributes<T> extends HTMLAttributes<T> {
        accept?: string;
        alt?: string;
        autoComplete?: string;
        autoFocus?: boolean;
        capture?: boolean | string; // https://www.w3.org/TR/html-media-capture/#the-capture-attribute
        checked?: boolean;
        crossOrigin?: string;
        disabled?: boolean;
        form?: string;
        formAction?: string;
        formEncType?: string;
        formMethod?: string;
        formNoValidate?: boolean;
        formTarget?: string;
        height?: number | string;
        list?: string;
        max?: number | string;
        maxLength?: number;
        min?: number | string;
        minLength?: number;
        multiple?: boolean;
        name?: string;
        pattern?: string;
        placeholder?: string;
        readOnly?: boolean;
        required?: boolean;
        size?: number;
        src?: string;
        step?: number | string;
        type?: string;
        value?: string | ReadonlyArray<string> | number;
        width?: number | string;

        onChange?: ChangeEventHandler<T>;
    }

I want to define a specific type for only an input of type number so that TypeScript complains if I use a checked or disabled prop on it:
<!-- invalid `checked` prop -->
<input type="number" step="any" min="0" max="100" value="22.33" checked={true} />

So is there already a type definition for that coming from React?
I know that I can just define it like the following but I would prefer to use an official source:
interface InputNumberProps {
  type: 'number';
  max?: number | string;
  min?: number | string;
  ...
}

A: I think the simplest solution would be to wrap input into your own component and provide custom type definitions. As far as I know, there is nothing like that coming from official React types. This is done because HTML itself is not strongly typed and it is valid to do something like <input type="number" checked />
As for type definition something like that would suffice:
interface NumberInputProps {
  type: "number"
  value: number
  min?: number
  max?: number
}

interface TextInputProps {
  type?: "text"
  value: string
}

interface CheckboxInputProps {
  type: "checkbox"
  checked?: boolean
}

type InputProps = NumberInputProps | TextInputProps | CheckboxInputProps

const Input: React.FC<InputProps> = (props) => <input {...props} />

That is a lot of typings for sure (and this does not event include things like events, class names etc). Also, this requires even more JS code if you want to provide stronger types for something like number fields (converting strings into numbers etc.)
If you want to modify the original InputHTMLAttributes (which is a better solution than writing your own types from scratch) interface, overriding and/or omitting some of the fields there are helper types like Omit that would allow you to do so.
type InputProps = Omit<InputHTMLAttributes<HTMLInputElement>, "type" | "value" | "checked" | "min" | "max"> & (NumberInputProps | TextInputProps | CheckboxInputProps)

You can also split different input types into different components if you find writing too much logic in one component. Do whatever suits you
P.S. on the second note. This sounds like type over-engeneering

A: You can use and extends the official types:
export type InputProps = React.DetailedHTMLProps<
  React.InputHTMLAttributes<HTMLInputElement>,
  HTMLInputElement
>;

interface NumberInputProps extends Omit<InputProps, 'checked' | 'disabled'> {
  value: number
}

Using this code you exclude checked and disabled properties and overrides value to allow only numbers instead string | ReadonlyArray | number


text:
Q: hasMany não funciona corretamente boa noite!! estou tentando lançar relacão de dados(grupos e redes) mas não funciona...o model do grupos está assim:
function Redes(){
     return $this->hasMany('App\rede','grupo_id','id');
}

no model de rede está assim:
class rede extends Model
{
  protected $table = "redes";
}

estou tentando exibir os dados assim:
function Index(grupos $grupos,rede $rede){
    $lista = $grupos->all();
    foreach($lista as $li):

        foreach($li->Redes() as $d):
            print_r($d->id);
       endforeach;

    endforeach;
}

e nada, o que está errado??
Obrigado pela constante atenção!!!


text:
Q: Property of a logarithmic function Is $x^{log(y)}$ equal to $y^{log(x)}$? If yes then how? I read it as a general property of logarithmic functions but could not understand how is it true.

A: $\log(x^{\log y}) = \log(y^{\log x}) = \log x \cdot \log y$
Now conclude, based on one-to-one nature of the log function.

A: $$x^{\log y}=y^{\log x}$$
Taking log for both sides we have
$$\log y \log x = \log x \log y$$
They are equivalent!

A: There is a formula: $$a=e^{\ln a}.$$
Hence:
$$x^{\ln y}=e^{\ln{x^{\ln y}}}=e^{\ln y\cdot \ln x}=\left(e^{\ln y}\right)^{\ln x}=y^{\ln x}.$$


text:
Q: C++ Define iterator for map with template I am trying to write a function to extract keys from map using template to be more generic. Been getting "expected ';' before iter" in the declaration of iterator then "'iter' is not declared in this scope.  Please help.  Here are listing of the function.
template<typename TK, typename TV>
std::vector<TK> extract_map_keys(std::map<TK, TV> const& input_map)
{
  std::vector<TK> retval;
  map< TK, TV >::iterator iter; // <-- first ERROR
  for ( iter = input_map.begin(); iter != input_map.end(); iter ++) { // <-- second ERROR
    retval.push_back(iter->first);
  }
  return retval;
}


text:
Q: How to insure json stays array I want to remove an array element from json array (PSObject) if value matches as follows:
$code = 12345
$myObject = @{ ArrayPair= @(@{ code = 12345; perm = "RW" }, @{ code = 23456; perm = "RW" })}

if ($true) { # $revoke
      $myObject.ArrayPair = $myObject.ArrayPair | Where-Object -FilterScript {$_.code -ne $code}
}

At the start ArrayPair has 2 array elements, after executing the filter, ArrayPair is no longer an array but rather an object with two elements.   How can I keep it as an array so I can continue to add new pairs to the array?
json Values before and After removal:
Before value:
 {"ArrayPair":  [{"perm":  "RW","code":  12345},{"perm":  "RW","code":  23456}]}

After Value removal
{"ArrayPair":  { "perm":  "RW", "code":  23456 }}

A: You can force the object to stay an array like this:
$code = 12345
$myObject = @{ ArrayPair= @(@{ code = 12345; perm = "RW" }, @{ code = 23456; perm = "RW" })}
[array]$myObject.ArrayPair = $myObject.ArrayPair | Where-Object -FilterScript {$_.code -ne $code}

$myObject.ArrayPair.GetType()
#Returns
#IsPublic IsSerial Name                                     BaseType
#-------- -------- ----                                     --------
#True     True     Object[]                                 System.Array

To add additional entries to your array you have to try it like this:
$myObject.ArrayPair += @{code = 2134; perm= "RR"}

This way you can add entries to the array and the result looks like this:
PS C:\> $myObject.ArrayPair

Name                           Value
----                           -----
code                           23456
perm                           RW
code                           2134
perm                           RR

Please be aware that += doens't really add objects to the array, but instead recreates the array with new values.
If you try to add the objects via $myObject.ArrayPair.Add(@{code = 2134; perm= "RR"}) you get an error.
Please take a look at this answer for further explanations:
PowerShell Array.Add vs +=

A: I while deleting elements if there was just one left, I found that I had to double force the object to make sure that it remained an array type:
[array]$temp = $result.data.app.roles.admin | Where-Object -FilterScript {$_.club -ne $ClubNo}
$result.data.app.roles.admin = [array]($temp)


text:
Q: "Impersonating" session in a web service call I am trying to write a web service that returns session variables. The application that calls this web service has access to the the Session ID of the current session.
I tried doing this by creating a "ASPNet_SessionID" cookie and then attaching setting it as the cookie container of a proxy class to the web service but that does not work. I did this like so,
 protected void CallService(string sessionID)
    {
        localhost.AuthService auths = new localhost.AuthService(); //Service Proxy class
        System.Net.CookieContainer cookieJar = new System.Net.CookieContainer();

        System.Net.Cookie newCookie = new System.Net.Cookie("ASPNet_SessionID", sessionID);
        newCookie.Domain = "http://localhost";
        cookieJar.Add(newCookie);
        auths.CookieContainer = cookieJar;

        string SessionData = auths.GetSessionData();

The GetSessionData web method simply returns the Session data like so:
[WebMethod(EnableSession=true)]
public string GetSessionData(string sessionID) {return ((string)Session["user"]);}

Should this approach work, or am I doing something completely wrong?
UPD:This link actually solved my problem - I was able to access all the sessions InProc and was able to select the correct one by ID:
http://weblogs.asp.net/imranbaloch/archive/2010/04/05/reading-all-users-session.aspx

A: "I am trying to enable a third party application to see what user is logged on to my website."
To achieve this goal you would be far better to use ASP.NET Membership over Session to track users.
Then, to see logged-in status you can simply do this:
bool isLoggedIn = Membership.GetUser("Joe.User").IsOnline;

A: switch AspCompatibilityMode to true

A: Is your system designed to be single user?
You suggest 'which user is currently logged on' but if that was the case there isn't much need to store anything in session, you could just stick the userid/name/details into a table in the DB, or potentially use .NET profiles to update an application level variable - http://msdn.microsoft.com/en-us/library/2y3fs9xs.aspx


text:
Q: Open Citrix receiver launcher difficulties I am investigating automating a Citrix test using Selenium, Chrome and Java.  I click on the "Open Citrix" link and get the following window (note when we start up selenium it starts up a fresh Chrome without any of the bookmarks, cookies, etc, so this will have to be done each time even if I click the "Always open these types... box":

I thought this box might be an alert, so I did (from a method I found) a wait for alert (about 10 seconds) but an alert was never found.  So then I tried counting the number of window handles before and after clicking "Open Citrix" (after waiting 5 or so seconds).  But it was 1 before and after so it is not a new window.  I could not right click on this and select "inspect".  I also searched for "Always open" in the inspect pane (which I had opened from the main window, not the notice).
Any thoughts on how to click "Open Citrix Receiver Launcher" (I don't need to click the Always box).  And yes, Citrix is installed because if I click "Open Citrix" (manually) it takes me right to the login screen.


text:
Q: How to create a multidimensional array to group by category I'm trying to create an array that looks something like this, where my products are grouped my their category.
  [
    [
      name: category_1
        products: [
          [ name: product_1 ],
          [ name: product_2 ]
        ]
    ],
    [
      name: category_2
        products: [
          [ name: product_3 ],
          [ name: product_4 ]
        ]
    ]
  ]

Here is my code
public function getProducts()
{
  $products = [];

  foreach(Category::all() as $category)
  {
    $products = [
      'category' => $category->name
    ];

    foreach($category->product()->select['id', 'name']->get() as $product)
    {
      $products[$category->name][] = $product;
    }
  }

  return $products;
}

but my code doesn't give me the array that I need. I get
  [
    'category' => 'category_1'
    'category_1' => [
      0 => [
        'name' => 'product_1'
      ]
    ]
  ]

which I think is almost there, but I think I'm missing something, because they not grouped together and I'm only getting 1 item and
not all of it

A: I guess you can get the same data from query builder by using with()
$products = Category:with('products:id,name')->get()->toArray();

A: You can try using Laravel's groupBy()
Category::all()->groupBy('category');

This returns Laravel collection. If you need an array afterwards, you can use toArray()
Category::all()->groupBy('category')->toArray();


text:
Q: Finding all the functions satisfying particular conditions.
Find all functions $f: \mathbb{N} \rightarrow \mathbb{N}$ such that for all positive integers $m$ and $n$ the number $f(m)+n-m$ is divisible by $f(n)$.

Now I wanted to verify my solution, which I feel is flawed somewhere, but I can't find the flaw. Also please refrain from providing any solution to this as I want to figure out myself. Please just point out where my method is flawed.
My Approach:
$f:\mathbb N \rightarrow \mathbb N$ such that $f(n)|f(m)+n-m$
$\Rightarrow f(n)\leq f(m)+n-m$ or $m-n\leq f(m)-f(n)$
So now when $m\geq n$ we have $f(m)\geq f(n)$
Thus $f$ is an increasing function
Now the inequality can be restated as $f(n)-f(m)\leq n-m$
Putting $n=m+1$ gives $f(m+1)-f(m)\leq 1$
Since $f:\mathbb N \rightarrow \mathbb N$, two cases are possible:
Case I: $f(m+1)=f(m)$. This means that $f(m)=k\forall\ m\in \mathbb N$, where $k$ is a constant
Case II: $f(m+1)=f(m)+1=f(m-1)+2=\cdots=f(1)+m$. This means that $f(m)=m+k-1\forall\ m\in \mathbb N$ where $k=f(1)$
Thus only two functions are possible.
Please help in finding any flaw in it, if present.
THANKS


text:
Q: why C++ operator overloading requires "having at least one parameter of class type"? The chapter 14.1 of "C++ primer 5th edition" reads,

An operator function must either be a member of a class or have at least one parameter of class type.

For example, string("hello")+"world" compiles "hello"+"world" doesn't. And when I want to overload the + on two C strings.
std::string operator+ (const char* s1, const char* s2)

I get the following error.

error: 'std::string operator+(const char*, const char*)' must have an argument of class or enumerated type

I have two questions.

*

*Is this restriction part of the language specification? If yes, why C++ designers want to do that?

*std::string has constructor like string (const char* s);, which implies that compiler can do implicit class-type conversion from char* to string. When we call "hello"+"world", why doesn't the compiler convert the two char* "s to two strings? After all, there is a overloading "+" on two std::strings.
string operator+ (const string& lhs, const string& rhs);

A:

*

*Is this restriction part of the language specification?

Yes, it is. Why? Well, the main reason is probably because redefining the usual operators for standard types is seen as obfuscating. Imagin overloading operator+(int,int) or operator+(int,char*). That would change the meaning of existing code!
You could argue that there are operators between standard types that are not defined, so you could safely override them, for example operator*(char*,int), but that is usually seen as rather useless.
Moreover, operator overloads must be global, (or be in the namespace of some of its members (argument dependent lookup), but with standard types there are no namespace to depend on), so interoperatibility between libraries that fancy to override them would be a nightmare.

*

*"hello" + "world": why doesn't the compiler convert the two char* "s to two strings?

Well, for one, std::operator+(const std::string&, const std::string&) is in namespace std; so it will not be found by default.
You could try calling the operator explicitly: std::operator+("hello", "world"), but alas, there are so many operator+() overloads, many of them templates, that the call is ambiguous.
So, taking all this into account, I think that a reasonable requirement is that at least one of the operators to be of a user-defined type. Think about it: the global and namespace problem is solved, ADL can be used (actually it was invented for this use) and it is impossible to redefine an operator with an existing meaning (except operator,() and operator&(), I think, but who wants to override these...).

A: As Bjarne said in Design and Evolution, the goal was to make it easy to extend the language, not to mutate it. If you allowed overloading only builtin types, you would change the language, and allowing that went against the design goals. (For example, it would encourage the formation of mutually incompatible dialects and fracture the community.)

A:
Is this restriction part of the language specification? If yes, why C++ designers want to do that?

Yes, it is. Quoting from N3337, §13.5.6 [over.oper]:

An operator function shall either be a non-static member function or be a non-member function and have at least one parameter whose type is a class, a reference to a class, an enumeration, or a reference to an enumeration.

About the "why" part, because removing this requirement would mean that you could overload operators for builtin types, which already have their operator semantics defined. That's something totally undesiderable.
For instance, do you think that defining this makes any sense?
int operator+(int a, int b) { return a - b; }

Does it allow more people to reason about your program when they read your code, or is it just something surprising that effectively breaks your reasoning?
What happens if we get pointers into the game?
bool operator==(const char *str1, const char *str2) {
    return strcmp(str1, str2) == 0;
}

Would you expect that operator== now dereferences memory? I wouldn't. It's surprising. It goes against what the Standard already says about these operators. It breaks what every C program in the last 25 years behaved like. The language shouldn't let you do this kind of abuses.


text:
Q: Error occurred when add new field on Elastic Search I am using Elastic Search as a database. By changing requirements, I added a new field on ES. After added it, my NodeJS application threw an error on the line which I added sortable.
My expectation is: update the index mappings for all old documents when I add a new field on ES.
Thank you very much for helping me!


text:
Q: How can i add import statement during runtime in python? I am simply creating a program which takes the object name as input for ex. list, dict, tuple etc and stores all their associated functions in a text format.
for instance:
if 'list' is entered Functions_Text_Files\list.txt will be the location
where my corresponding text file will be stored.
It is working fine for all but except for classes.
Say someone enters collections then either of the two ways must be satisfied (first anyone would not prefer):

*

*collections(or any such module must already be imported)

*if i add those modules by catching the exceptions (which i am unable to do)

The Code is given below:
import os
func_name = input("Enter the module of which you want the functions. :")
try :
    function_list = [i for i in dir(eval(func_name)) if not i.startswith("_")]
except NameError:
    eval("import "+func_name)
    function_list = [i for i in dir(eval(func_name)) if not i.startswith("_")]

file_path = 'Functions_Text_Files\\' + func_name + '.txt'
directory = os.path.dirname(file_path)
if not os.path.exists(directory):
    os.makedirs(directory)
    print("The Directory 'Functions_Text_Files' was not found.\nThis generally happens when you're running this first time."
      "\nCreating one!!")
with open(file_path , 'w') as file_object:
    file_object.write("Functions Associated with "+func_name.title()+" are :\n")
    for index, fname in enumerate(sorted(function_list)):
        file_object.write('{:>2}{} {}\n'.format(index+1,".",fname))

A: Maybe the inspect module can help you to get things done. Check out the documentation. This could be a better approach than importing a whole module just to get the list of functions.


text:
Q: Ternary operator not working in Android I have a simple question that boggles me. I am trying to use the ternary operator in java. I am new to Android and java. This code gives me the error:
amt < 0 ? lendBtn.setChecked(true) : lendBtn.setChecked(false);

"Syntax error on token "<", invalid AssignmentOperator"

So, I replace it with an if statement and it totally works:
if (amt < 0) { ... }

It's not a big deal but does anyone know why?

A: This has nothing to do with Android. You can't use a conditional expression as a statement on its own... and the second and third operands can't be void expressions either.
You should use:
lendBtn.setChecked(amt < 0);

... which is simpler to start with.