Should I clean the mechanical disk brake rotors on my new bike

Question: New Bike Day for me tomorrow! It's the first time I will have bought something like this. I have heard some places to leave everything alone until a problem starts, and I have also heard that you can greatly lessened the brakes squeaking if you clean the rotors before with isopropyl alcohol. Any thoughts?
Comment: Try the brakes first. Why do you think the rotors need to be cleaned, without seeing the bike? Where are you getting it from? Depending on the source, you may be pleasantly surprised, or right to be worried.
Comment: @SamA first of all, bed them in
Answer: Cleaning the brake disks as you describe won't do any harm and it is good practice. While in transport, a greasy hand could have touched the disks and that would contaminate the brake pads which can be harder to clean afterwards. Cleaning the rotors is also recommended as part of regular short interval maintenance, that is, the kind of cleaning and inspection you should do every few rides.
However, "Leave everything alone until a problem starts" depends a great deal on where are you obtaining the bike. A well reputed bicycle dealer (bike shop) should have the bike properly assembled and adjusted prior to handing it to the new owner. That include tightening all bolts to a proper torque and checking all major components are properly installed for use.
On the other extreme, you can get a bike that arrives in a box, partially assembled and needs some assembly and proper adjustment before it is safe to ride.
Somewhere in between is to buy a bike from a store that does not specialize in cycling equipment and may or may not have a good mechanic in charge of assembling the bikes prior to hand them to customers. This may lead to a situation where the bike seems to be fine to ride, but some pieces may no be in proper orientation or not properly tightened.
So, for cases 2 and 3, if you are not experienced in doing basic bike maintenance yourself, it is best to have it professionally serviced/adjusted prior to use, or at very least, take it to a experienced and trusted friend to inspect.
Disclaimer: I have never bought a new bike for myself, but a couple of very close family members have, both from well reputed stores and the bikes where of very known brands and indeed, the store handed the bikes after a thorough inspection by the shop's mechanic. Those where both cases where "leave everything alone" was the thing to do. If anything would have failed, that would be covered under warranty.
On the other hand, I have seen "Big box stores" selling bikes (or should I say bicycle shaped objects) that are poorly assembled. At the moment of the sale, they just call "some guy" from the store to check the bike and then this person struggles to "kind of" adjust and tighten screws with general use tools and what not.
Comment: @SamA No, it is good advice. WHY is explained in the first paragraph. The components may have been touched by greasy hands or similarly contaminated during storage, during bike building or during packaging. Especially when sold in a box. There is no risk in cleaning metallic rotors before first use and is often the first step in the instruction for bedding-in new brakes. See step 1. at https://www.bikeradar.com/advice/workshop/how-to-bed-in-new-disc-brake-pads/
Comment: I'm not sure this is good advice. Attempting to clean or do other maintenance on a component, without knowing WHY, seems unnecessarily risky.


Can a adb revoke WRITE_SECURE_SETTINGS command make my device unrecoverable?

Question: I was looking at the permissions that many system apps and some user apps have access to mic and phone. I don't remember granting those. I think that some apps have WRITE_SECURE_SETTINGS permission and are misusing it.
My device is Vivo V2029 running Android S. I know that now this permission cannot be granted to a non system app without adb or root. My device used to run older android version before, maybe it was granted then.
I was thinking of using adb to revoke it for each app one by one and check if the device functions properly. But I am concerned that what if I revoke it for some important app and then even after re-granting, the phone becomes unusable.
Answer: Okay, it did make it unusable. Don't disable system apps.


need a solution that the user can perform any admin activity but it should not able to query any data from tables

Question: We have MSSQL DB in EC2, where we are using generic user (Active Directory User) for SQL to perform any activity inside the server.
This user is having "sysadmin" permission and it requires to perform all admin tasks .But, as xyz company being GDPR complaint, We should not have access to customer's data.
So, we need solution that this user can perform any admin activity but it should not able to query any data from tables.
Comment: Can you please provide  official documentation links for the same!
Answer: The SQL Server feature Always Encrypted is for this:

Always Encrypted is a feature designed to protect sensitive data, such as credit card numbers or national/regional identification numbers (for example, U.S. social security numbers), stored in Azure SQL Database, Azure SQL Managed Instance, and SQL Server databases. Always Encrypted allows clients to encrypt sensitive data inside client applications and never reveal the encryption keys to the Database Engine. This provides a separation between those who own the data and can view it, and those who manage the data but should have no access - on-premises database administrators, cloud database operators, or other high-privileged unauthorized users.
...
Always Encrypted makes encryption transparent to applications. An Always Encrypted-enabled driver installed on the client computer achieves this by automatically encrypting and decrypting sensitive data in the client application. The driver encrypts the data in sensitive columns before passing the data to the Database Engine, and automatically rewrites queries so that the semantics to the application are preserved. Similarly, the driver transparently decrypts data, stored in encrypted database columns, contained in query results.
Comment: Thanks JD, I was rather terse before


Safely clone a Hibernate Spring JPA entity - Javassist

Question: I'm cloning an entity using Spring BeanUtils.copyProperties(source, target, excludes) method and the issue is there is a method called setHandler that gets called and it basically resets all the properties I set in my exclusion list during the copy. If I exclude handler, then I get an exception saving the new object.
I just want to do a clone of a Hibernate object, excluding 10 properties and save the new object.
<code>    public static <T> T cloneClass(T existing, Class<? extends Annotation> ignores)
        throws Exception {

    final Collection<String> excludes = new ArrayList<>();

    Set<Method> annotated = getMethodsWithAnnotation(ignores, existing.getClass());

    for (Method method : annotated) {

        if (!method.getName().startsWith("get") && !method.getName().startsWith("is"))
            continue;
        String exclude = ReflectUtil.decap(method.getName());
        log.debug("Exclude from copy: " + exclude);
        excludes.add(exclude);
    }

    excludes.add("handler"); <-- must have this
    Object newInstance = existing.getClass().newInstance();
    String[] excludeArray = excludes.toArray(new String[excludes.size()]);

    BeanUtils.copyProperties(existing, newInstance, excludeArray);

    return (T) newInstance;
}
</code>
If I don't include
<code>excludes.add("handler"); <-- must have this
</code>
Then what happens is the target object gets all the properties from the source and basically makes my exclude list useless, but once I try to save that object, Hibernate throws an internal hibernate error.
Is there an easier way to clone an object than what I am doing?
Comment: what exception is hibernate throwing?
Comment: Actually nevermind the error... .There is no error... The cloned instance just comes out exactly the same as the original. Reflection gets to setHandler and the entire object becomes populated for some reason.
Answer: I don't think you really need to do any cloning. Simply retrieve the object and then remove the object from the session and it is effectively a clone: Is it possible to detach Hibernate entity, so that changes to object are not automatically saved to database?. Start another session again once you want to update the instance.


Is it wrong to say that a company only has a single stock?

Question: I'm a newbie to investing and I was doing some research regarding the difference between stocks and shares. According to Investopedia stock simply refers to partial ownership of a company, whereas a share is partial ownership of a specific company. However, I've also heard stock being defined as the entirety of shares of a company. So my question is, if I say "I own stocks", it simply means "I have partial ownership of one or more (unspecified) companies" and not "I own the entirety of shares of several companies", right?
Comment: This is arguably a question for an English-language stack rather than here, but.
Comment: There are also different *classes* of stock
Answer: The business definition of stock is a quantity of goods or merchandise.
And one of the definitions of share is "a fraction" (like when you get your fair share of a pie).
Now, generalize that to a quantity of pieces of paper saying that you own a fraction of a company.  Of course now that's all digital, but there was a time when you actually got a certificate saying that you, John Q Everyman, owned 100 shares of AT&T.
That's why I own shares of stock in AT&T.  Saying that I own AT&T stock is shorthand for owning shares of stock.
Comment: "I own [some number of shares of] XYZ stock". I also own [] land, [] paintings, and [] computers.". Leaving the quantity and unit of measure unspecified when not immediately relevant is a fairly common English idiom; it's not just shares of stock which may be phrased this way. This is a language question, not an investment question.
Comment: @keshlam most people who own land, paintings and computers don't (explicitly) own shares of land, paintings and computers.  Thus, I think your example is invalid.
Comment: Just a matter of appropriate units. Shares, acres, number of prints out of a series or portfolio... We agree that we disagree.
Comment: @keshlam "Just a matter of appropriate units".  No.  They are fundamentally different, since shares are fractions of whole ownership, while an acre is not a fraction of anything.
Comment: Most of us own fractional acres, at least in my area of the world.  And those were subdivided from larger units of land. Ok, I grant shares are fungible while the others typically aren't, but I'm not convinced that's a linguistic difference, just a different context. Your mileage will vary.


Preprocess function for targeting the home page

Question: What's the preprocess function for targeting the home page in a Drupal 8 site? Can I use a preprocess function that is called only for the home page?
Comment: The home/front page is now a page view called **Frontpage** with url/path of `/node` so you may have to give more details on what you're trying to achieve with the preprocess.
Answer: To target the front page in a preprocess function you need a condition, because for preprocess you can't use name suggestions:
function mytheme_preprocess_page(&$variables) {
  if ($variables['is_front']) {
    // your code
  }
}

Comment: not working on latest today D9
Answer: What you call home page, for Drupal is the front page. The suggestion given by system_theme_suggestions_page(), an implementation of hook_theme_suggestion_HOOK() from the System module, is page__front; similarly, system_theme_suggestions_html() suggests html__front. Both the suggestions are for the preprocess functions and the template files.
If by home page you mean a page that is not the front page, you need to write your own hook_theme_suggestions_HOOK() implementation that gives the right suggestion for that page. Keep in mind that the suggested template file is used only if it exists; otherwise, Drupal will use a different suggestion, or the default template file, if none of the suggested template files exist.
Answer: On today  latest D9, you have:
 function THEMENAME_preprocess_html(&$variables) {
   if (\Drupal::service('path.matcher')->isFrontPage()) {
      // do something for your frontpage
   }
 }


How do I get rid of these weird clumps in sculpts?

Question: Whenever I'm sculpting I notice these clumps of verts mostly on edges sharp or smooth. What do I do? (Also smoothing doesn't help)
Answer: maybe remesh and then smooth? you can remesh by clicking remesh is the right top corner in a sculpting window. the lower the voxel size the more resolution. so watch out that blender doesn't crash. and then hit remesh. hope that it works.
Comment: Yes, I have tried remesh + smooth but It is already pretty high poly count and still doesn't work. There are some areas that can be fixed with the scrape and fill brush but that doesn't work for everything like smooth faces.


Restrict user providing asterisk * on the prompt ansible awx

Question: I am trying to create a self service job template for our users through Ansible AWX , and want to restrict the users to mention the exact host detail where they want to run the job.
During testing I have noticed , If on the limit ( I have enabled prompt on launch ) one provides "*" , it executes on every node in the inventory , which is something I want to avoid and not let happen.
So let me explain you my requirement first

User will login as themselves and run a job template . This job template needs to be run on node or pattern of node or group mentioned by that user.
So I do not want to restrict execution of this playbook to a single group or multiple groups , I would like to promt user to provide hostname where they want to execute this playbook.

How I am trying to achieve this

This is my playbook ( again just a example )

---
- hosts: "{{ target }}"
  gather_facts: no

  tasks:

  - name: Gather Hostname information
    shell: hostname
    register: hostname_result

  - debug: var=hostname_result.stdout_lines

I have created one job template , with Survey to provide hostname where they want to run this job .

I see when we put * on that survey , this job template gets executed on all the hosts , which we do not want that.
Can anyone let me know how we can restrict users to put exact host details, not any regex or * ?
Appreciate your help.
Answer: Below solution worked for me ....

---
- hosts: "{{ target }}"
  gather_facts: no

  tasks:

  - name: You cannot pass asterisk as target hosts
    meta: end_play
    when: target == '*'

  - name: Gather Hostname information
    shell: hostname
    register: hostname_result

  - debug: var=hostname_result.stdout_lines


How to reuse production code - for writing supporting tools?

Question: A little history - skip to the TL;DR if you so wish to.
So I have an UWP application written in C++ that utilizes V8 and have synthetic module which allows calling native methods from the embedded JS code.
Now until recently I was writing Node.JS tool that parses C header files and creates JS modules which can be used by my production JS code to ease calling COM methods (i.e. instead of raw_call(object, 5, ...) you can do something like raw_call(object, Interface.Method_Name, ...) or even in the future just object.Method_Name(...). Anyway that is not important. The important part is that for creating this modules I use regular expressions - it turned out that however JS Regular Expressions doesn't support recursion - so I sneaked some php executer solely for the purpose of executing PHP regular expressions inside my tool (so I can utilize recursion). Then later on I realized that PHP regex doesn't support capturing groups inside recursion and that is a feature only present in pcre2.
Pcre2 is C only which is fine for my production code - I can just use my already created infrastructure to invoke those directly from JS - problem is that this is a feature for my tool not production code.
I'm using MSVC 2019 Preview and I can probably do some shenanigans with multiple projects but like I would have to support two identical code bases - one for production and one for a tool. Hmm maybe I can include the same source files?
TL;DR - How to most efficiently reuse production code in writing supporting tools for your application?
Comment: I didn't cast a downvote, but your question reads like "I've had some problems, how can I avoid them in the future?"  Your tl;dr is too vague to clarify what you're actually asking.  Overall your post could benefit by being more specific.  By more specific, I don't mean more detail; I'm not sure adding detail would clarify your question any further unless it focused your question's core concept better.
Comment: Anyone care to explain down-votes please?
Answer: Where I work we have a similar situation where we have the code base for a product A which is sold externally, and another code base B for internal use only. Over the years, we run sometimes into situations where we want to reuse parts from the former inside the latter. We solve this in the following way:

We strictly forbid dependencies from A to B. Product development, maintenance and versioning for A shall intentionally stay independend from any internal development.

When we reuse parts from A inside B, we only use code which related to a released and deployed version from A, no half-baked intermediate versions.

We only reuse full libraries from A, with (ideally) stable interfaces, not just some loosely taken source code files. So when a new version of A is published, cases where we have to adapt B because of this are rare.

Since the code of A is in one repository, and the code of B in a different one, and not all devs in the team have full access rights on both, we mirror the source code parts which are required inside B by some script from repo A to repo B, which pulls a tagged revision from code base A and puts it into B. We also have added some measures to prevent any direct editing of the mirrored source, so any changes have to be done in the codebase / repo A.  I guess for this purpose it could also be possible to utilize Microsoft's C++ package manager vcpkg.

So in short, we have a split development where the part of the team which develops A takes also the role of a component vendor, and the components are reused in a black-box manner by the (part of) the team which develops B.
I guess that model could work for your situation, too.
Answer: In my organisation we have both Code, and Binary repositories. (Git, and Artifactory though any equivalent will do).
When a code repository is updated, our CI tool builds the code and runs some Unit and Module level tests. If they pass the binaries are pushed into the binary repository.
In our other projects that need these binaries we have a package manager pull the dependencies down, and we check them in alongside the code in the repo. This way it can always be built, even if we were to: clean up the binary repo, or change tools entirely. Both have happened over the last 10 years. The CI never grabs packages itself, just the one commit from the repo its building.
You'll quickly find that you have:

a few amalgmation repositories where many components are brought together with a little glue to make some tool or product.
a few interface libraries that describe the communication models, like how task look, or  what Data and endpoints are avialble for an API.
a number of service and implementation libraries providing those API's and infrastructure services.


How Spring decide which Base Controller class need to be extend (like MultiActionController, AbstractController etc )

Question: In Spring 3.0 we use @Controller to inform Spring container to treat bean as controller .
Question  How Spring decide which Base Controller class need to be extend (like MultiActionController, AbstractController etc )?
Answer: You're not extending a Controller base class when you use @Controller. Spring uses reflection to inspect the methods on a class annotated with @Controller and wire them up.


Is the minimum mass of a black hole the planck mass?

Question: Leonard Susskind said "It's thought to be the mass of the smallest black hole that can form" (or something like that when referring to the planck mass in his string theory lectures) and I've always been told that the planck mass is the mass of the least massive possible micro-black without ever researching whether or not it was true. I just came across a paper http://cds.cern.ch/record/519241/files/0109057.pdf (Sec. 1, eq. 7) that says, unless I'm drastically misinterpreting it, that the minimum mass of a black hole is $10^{12}$ kg. Is this the lower limit in the Standard Model? Did the lower limit of 1 planck mass come from string theory or loop wquantum gravity? Or does it just not exist?
Comment: I can't answer your specific question, but any statement regarding the Planck scale necessarily depends on a theory of quantum gravity, and we haven't decided on one yet. IOW, according to some theories it might be, but we don't know if those theories are correct.
Comment: This question was attacked by the following paper:
https://arxiv.org/abs/gr-qc/0609055
Answer: In our currently accepted theory of black holes, general relativity, the Planck units do not carry any particular significance. General relativity has no problems with theoretically describing a black hole of mass smaller than the Planck mass. See also e.g. this question and this question for refutations of the common misconception that the Planck units represent lower bounds on anything.
Once you introduce quantum field theory into the mix, it is predicted that black holes will radiate Hawking radiation, and that such micro black holes will evaporate almost instantly, making it practially impossible for them to exist. There is no experimental test of Hawking radiation so far (only of certain hydrodynamic analogues). Again, the Planck units do not carry any particular significance here except that they set the scale for being "very small".


Cleaning Shavings from Tapped Hole

Question: I have a hole that contains metal shavings after I have tapped it. Is there a common method to clean out metal shavings from between the threads of the tapped hole?
Comment: I changed the wording of your question some to make it fit a little better with how the site works. Basically, it now asks for a solution instead of a comprehensive list.
Answer: There are a few ways to do this obviously it's easier to clean a through hole than a blind one.

Run a clean second or plug tap through the hole. If you keep a tap just for this purpose it also has the benefit of keeping one 'fresh' tap which clean clean up any burrs of defects from worn taps when initially cutting the thread.
Flush the hole with cutting fluid, suds  or degreaser.
Scrub the thread with a cylindrical nylon or brass brush of the appropriate diameter, a brush mounted in a cordless drill can be an effective way to clean multiple threads.
Cut a slot down the length of a bolt or stud of the appropriate size and carefully run it into the thread
Hold the part inverted and tap with a nylon or hide hammer.

Edit : good point about compressed air. A probe type air duster (either from a compressor or a hand held aerosol)  or even a manual blower can be effective, especially where threads are hard to get at by other means. This tends to work best when the hole is reasonably free of oil and grease so flushing with something like a solvent or alkaline degreaser first may help. Obviously care needs to be taken not to blow solvents or debris from the hole into your own (or anybody else's) face and eyes.
Comment: Nice list. Only addition would be spray compressed air into it. Works even better if you've got a really thin nozzle and can get to the base of a blind hole so then all the air is rushing out of the hole.
Comment: Yeah, I think the compressed air was the first thing I thought of. Wish I had that and BEFORE i tried putting a tap through it with a bunch of thick grease... i tried using pressurized spray, but even after washing it out first, didnt look like its doing much at all...
Comment: Typically if you blow shop air across the opening, chips will tend to work their way up and out. No special nozzle is required.

Cleaning Shavings from Tapped Hole


How to integrate theme from html to magento

Question: How to make custom theme in magento from html pages like as i have html theme. I want to integrate html to magento.
Answer: Your question is expecting a much too large answer. Magento theme development is a pretty complex matter and there are literally books written on the topic, you can get started with a tutorial like this one but eventually you should probably purchase a book if you really want to get going quick, as there are not that many good online resources on the matter.
Many Magento 1 books are getting a bit older, but they will still largely be valid for Magento 1.9. Suggestions would be Alan Storm's "No Frills Magento Layout" (which covers a lot) and Richard Carter's "Magento 1.4 Themes Design".


Renaming Namespace for a Managed Beta package

Question: I have a Managed Beta Package in Dev. Org. with a Namespace.  How can I rename the Namespace in the same org.  I'm trying to avoid opening a new Dev. Org and migrating components and code to the new Org.
Comment: You can't. It even tells you when creating it that it cannot be changed. Only hope would be to see if SF support has some magic they could offer
Comment: Would an alternative be to create a new package in the same org with a different namespace.  Then Add the components to the new package?  Can I have two Managed packages in the sames org?
Comment: An org currently can only have one namespace so that would not be possible
Comment: So it appears that I have to create the new Dev. Org and migrate the components over.  Thanks.
Answer: To work with multiple namespace, it is a good idea to have two separate folders, one without namespace (unmanaged code) and another with namespace (managed packaged code) and create script to prepend namespace where it is appropriate (wipe out packaged folder, copy unpackaged folder to packaged and prepend namespaces where needed).
In such case, change of namespace is a simple configuration change in sfdx-project.json file for 2GMP and rerunning the script to prepend namespaces.
However, for 1GMP you still have to create a separate Dev Edition org and migrate code there manually.


What is the differences and similarities between refinement type and liquid types?

Question: Looking at the examples here and here both refinement type and liquid types look very similar. What are the differences and similarities?
Comment: They're essentially the same; from a quick browse it seems neither insists on there being a proof object ---if it's there, you get dependent types.
Answer: They are, to a first approximation, the same thing. "Liquid types" come from LiquidHaskell (1, 2), which is a programming language and verification framework based on refinement types. The Scala repository that you link to is an implementation of refinement types for Scala.
In terms of programming language theory, refinement types is the technically correct and more general term. LiquidHaskell and the Scala repository are examples of implementations of refinement types.
Answer: Your second link gives an answer, in 'The Liquid Story (Further Reading)':

a dependant type depends on an arbitrary expression
a refinement type depends on a logical predicate of a specification language
a liquid type depends on a logical predicate of a decidable specification language
Comment: What difference does `decidable specification language` and just `specification language` make?
Comment: The link details: "implication checking is decidable". That means that there is an algorithm that is able to conclude by yes or no, for any predicates P1 and P2 of the specification language, if P1 is a logical consequence of P2. This is of course possible only by restricting what can be expressed in the specification language.


If $M[G]\cap M[H]=M$, must $G\times H$ be generic?

Question: Assume that $M$ is a countable transitive model of ZFC, $\mathbb{P}\in M$ is a forcing notion, and $G,H$ are two $\mathbb{P}$-generic filters over $M$. As it was shown in the answer to this question, if $G\times H$ is $\mathbb{P}\times\mathbb{P}$-generic over $M$ then $M[G]\cap M[H]=M$. Now the question is if the converse is true. Does $M[G]\cap M[H]=M$ imply that $G\times H$ is $\mathbb{P}\times\mathbb{P}$-generic over $M$?
Answer: No, and there is an example with Cohen forcing.
Consider the pairs $(s,t) \in 2^{<\omega} \times 2^{<\omega}$ with $\vert s \vert = \vert t \vert$ and for any $n < \vert s \vert$, $s(n) = 1 \rightarrow t(n) = 1$. Denote the tree of such $(s,t)$ with $T$.
Now forcing with $T$ gives a pair of Cohen reals $(c_0,c_1)$ which are not generic for $2^{<\omega} \times 2^{<\omega}$.
Now suppose $\tau_0$, $\tau_1$ are (Cohen forcing) names for sets of ordinals so that $\tau_0[c_0] = \tau_1[c_1]$. Then this is forced by $(s,t) \in T$, $s \subseteq c_0$, $t \subseteq c_1$.
Claim. Suppose $s' \leq s$ and $s' \Vdash \alpha \in \tau_0$. Then any $s'' \leq s$ with $\vert s'' \vert = \vert s' \vert$ forces $\alpha \in \tau_0$. Similarly for $\alpha \notin \tau_0$.
Proof.
Let $s''$ be arbitrary with $\vert s'' \vert = \vert s' \vert$. Note that for any $t' \leq t$ so that $(s',t') \in T$, $t' \Vdash \alpha \in \tau_1$ (because $(s',t') \leq (s,t)$). Let $t' \leq t$ so that for $n \in [\vert t \vert,\vert s' \vert)$, $t'(n) = 1$. Then obviously $(s',t') \in T $ and $(s',t') \leq (s,t)$, so $t' \Vdash \alpha \in \tau_1$. Now notice again that for any $s_0 \leq s$ so that $(s_0,t') \in T$, $s_0 \Vdash \alpha \in \tau_0$. But now we can simply take $s_0 =s''$ and we have that $s'' \Vdash \alpha \in \tau_0$.
By the claim $\tau_0[c_0] \in M$.
Now to consider sets of ordinals is of course enough, because for an example $A \in (M[c_0] \cap M[c_1]) \setminus M$ with minimal rank we can consider a bijection in $M$ from $V_\delta$ to some ordinal for suitable $\delta$ and consider $A$ as a set of ordinals. Also the use of choice in $M$ can be avoided by considering names for subsets of $M$ instead of names for sets of ordinals.
Comment: Finally an argument that I (more or less) understand, and which shows me what is important. Although I am slightly confused by the claim, I can imagine a Solovay-style argument ("A model of set-theory in which every set of real is Lebesgue measurable", Lemma 2.5).
Comment: @PeterElias I don't see what this has to do with Solovay's model. The argument here relies mostly on the way in which I defined $T$.
Comment: When trying to mimic the proof of Solovay's lemma I have finally understood what your claim is claiming and how it is proved. Nice trick, I like it a lot. Thank you!
Comment: Solovay's lemma just shows that a set of ordinals belongs to $M$ whenever it is in $M[G_1]\cap M[G_2]$ and $G_1$, $G_2$ are mutually generic. As you have proved, mutual genericity is not necessary, some weaker condition is enough.
Comment: In the claim we could equally well define $t_0(n)=1$ for each $n\ge |t|$, am I right?
Comment: @PeterElias Oh you're completely right! That makes the argument much easier.
Answer: The answer is no. Consider any two forcings $\mathbb Q_1, \mathbb Q_2$ with generic filters $H_1,H_2$ such that $M[H_1] \cap M[H_2] = M$, yet $H_1 \times H_2$ is not $\mathbb Q_1 \times \mathbb Q_2$-generic. Now let $\mathbb P = \mathbb Q_1 \oplus \mathbb Q_2$ be the lottery sum.
Comment: Do you also have an example of such $\Bbb Q_i$?
Comment: @AsafKaragila I'm certain there are simpler examples but taking $\mathbb Q_1$ to be Cohen forcing with mutually generic, disjoint Cohen reals $c,d$ and $\mathbb Q_2$ being a countable product of lottery sums of products that alter the GCH pattern high up in different ways works. Let $d$ determine in each factor which forcing is to be considered for the $\mathbb Q_2$-generic to ensure that $H_1 \times H_2$ is not $\mathbb Q_1 \times \mathbb Q_2$-generic. (Consider the dense set that says that for some index the lottery sum in $\mathbb Q_2$ was chosen according to the left forcing condition.)
Comment: Argh, I meant to say finite support product (of countably many factors) in the above comment.
Comment: Right. Probably a Cohen and a Random real work better. Or a Cohen real and a Suslin tree.
Comment: Or Cohen and Sacks. Or ..
Comment: @Andrés: Or Cohen and a supercompact extender based diagonal Radin forcing with guiding generics...


Cannot enable Digital Experience

Question: I have come across a very strange error while trying to enable Digital Experience. I access Digital Experiences > Settings, check Enable Digital Experiences and type an available domain name, but I cannot save it. I simply click the Save button and nothing happens. Any ideas? I did create a brand new org as per instructions in the Trailhead.
Comment: Do you have pop-up blocker enabled in your browser? If so, can you disable and retry?Thanks
Answer: This is due to a bug on Salesforce due to a recent update from Chrome (and Edge).
Here is the issue on the trailblazer website : https://trailblazer.salesforce.com/issues_view?id=a1p4V000002BRMXQA4
Here are workarounds suggested on the previous link :
Workaround

Impacted users can use an alternate supported browser such as
Firefox or Safari
Chrome 92 users can workaround this issue by adding the following flag to your Google Chrome Shortcut:
--disable-features="SuppressDifferentOriginSubframeJSDialogs"

We've included instructions for how to complete this below. More information on how to make this change can be found here: https://support.google.com/chrome/a/answer/6271282?hl=en#zippy=%2Cwindows
NOTE: This change will not work unless you fully close out of all Chrome Windows and relaunch.
Windows:

Quit all running instances of Chrome.
Right-click your Chrome shortcut.
Select Properties.
At the end of the Target: line, add the command line flags: --disable-features="SuppressDifferentOriginSubframeJSDialogs"
With that example flag, it should look like: chrome.exe --disable-features="SuppressDifferentOriginSubframeJSDialogs"
Click Apply > OK.
Launch Chrome using your shortcut.

Mac:

Quit all running instances of Chrome.
Run the terminal application.
In the terminal, run the command:
/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --disable-features="SuppressDifferentOriginSubframeJSDialogs"
Press Enter.

Cannot enable Digital Experience


Control flash system from a c++ program

Question: I'm currently building a c++ program (with Qt) to take picture from a camera device. This part is actualy done, now I need to control 8 flashs divided in two groups in an automatic way.
The flash I already use are from ELINCHROM http://www.elinchrom.com/ and this device seems to be perfect for what I need but I could not find anywhere a way to control it from a different application than the one elinchrom propose.
Do you know if what I intend to do is even possible? If a solution exist with another brand I will also take it.
Thank you in advance for any replies, and please excuse my english.
Answer: Should be possible; the driver guide states that the driver is really a USB serial port driver. That means you can probably reverse-engineer the protocol.

Control flash system from a c++ program


static analysis vs static typing

Question: I'm learning Elixir, and the tool 'dialyzer' lets you do static analysis - annotate the function definition with the type specification of the parameters it expects and the output it returns. It's completely optional, but if it were to be used to the full extent possible, how does it match up to good 'ol static typing?
Answer: My impression was that dialyzer is not as exact as static typing, meaning that it sometimes doesn't report an error, although it should.
On the plus side, if a dialyzer complains, it's almost always my fault. More often than not, errors are usually due to incorrect typespec.
So, while I don't think dialyzer is as good tool as static typing, it still helps. In particular, I find typespecs very useful, since they can serve as a documentation. Recently I've switched job, and the project I joined is a complex Erlang project. Owing to typespecs it was easy to find my way around the codebase.
So my advice is to use typespecs in larger projects. We write them only for exported (public) functions and records, and it's a big help, without taking up too much time. I usually first make the code work, and when I'm happy with it, add specs, and run dialyzer to verify all is fine.
Answer: While static typing takes care of a whole class of bugs, static analysis tools like dialyzer can tell you a lot more about potential pitfalls in your code. Assuming you used specs to their fullest extent, dialyzer would probably be more useful than static typing would be on it's own, at least compared to languages like Go, C#, etc. Something with a much more powerful type system like Haskell still can benefit from static analysis, but less so than a language with a more naive type system like Go. Static analysis is most useful when combined with a static type system though, and since Erlang and Elixir are both dynamic languages, static analysis can only do so much. That said, dialyzer is extremely powerful and useful, and if used consistently, should offer at least the same level of protection, if not more, as the type systems you are probably already familiar with.
I would take a look at the dialyzer docs (http://www.erlang.org/doc/man/dialyzer.html), they can tell you a lot more about what you can expect from the tool with respect to Erlang and Elixir. Hopefully that helps!
Comment: I've heard that Haskell has one of the most robust type systems, so I agree on that. But could you elaborate how Dialyzer (if used to the full extent possible) can provide the same level of protection as static typing in Go?
Comment: Dialyzer's typespecs allow you to define the exact constraints of a function's arguments and return value. You can define your own types to use in the typespecs, and those types are patterns, just like you would write for a case statement or destructuring function params. This is more powerful than Go's type system, because it allows you to define not just the structure of a type, but constraints of that type, such as a Date type that only allows valid dates. Dialyzer also analyzes your code for dead or unreachable regions, and other mistakes that a type system alone may not catch.
Answer: For one thing static typing is built into the compilation phase--sort of impossible to miss. Static analysis on the other hand is something that a developer has to run voluntarily.
Likewise, one doesn't have to annotate anything in Elixir; it's entirely down to programmer discretion.  In statically typed languages it's impossible to avoid.
I would say your question is sort of broad and therefore hard to answer with any rigor.  You might want to put this over on Programmers.Stackechange.
Comment: I should've clarified, I meant in terms of functionality. I'm sure one could create a lint that checks for type specifications for each function, and set it as a pre-commit hook. Assuming static analysis used to the full extent possible, how does it match up to static typing?
Comment: And, again, broad question and hard to give a definite answer. Since Elixir doesn't use static typing but does use Dialyzer, which static typing versus Dialyzer?
Comment: If you've used Golang, I'd be interested in a comparison with that.

static analysis vs static typing


SharePoint site style

Question: Is there a way to edit the master page without using SharePoint Designer?
I tried to use the Oslo theme but it doesn't show on my site, i looked in the internet and using Desinger may be the only solution.
Comment: Please ask only one question per a question post. It is alright to post separate questions for different requirements.
Answer: You can edit a master page with any text editor of your choice.
For example: I always download the default master page (seattle.html or oslo.html) and do my stuff with notepad++. After that just rename the file so I don't overwrite the default file and upload it.
After that just publish master page so it will be converted to .master-file.
You can also check if anything is right with your new master page by calling
https:///_layouts/15/previewwithstatus.aspx?Url=%2F%5Fcatalogs%2Fmasterpage%2FNameOfYourFile%2Ehtml
Answer: You can download the file from the Page Layouts and Masterpage gallery. After you have obtained it from the website, you can edit it in any text-editor you like (notepad, VSCode, etc.). When you are done you can upload the file again and see your changes.
Same question for your reference:
How to edit a sharepoint master page without using sharepoint designer?

SharePoint site style


Immediate family vs Extended family

Question: I am little bit confuse with the definition of extended family and immediate family. I have been living with my husband for three years in a apartment. Now in respect to this statement which one is my immediate family and which one is my extended family? My husband and me is it my immediate family? My parents' family and in laws family, are those my extended families?
Comment: Pretty sure that there's a legal definition of this, though you might want to ask the Law StackExchange for that.
Answer: If you were looking at a family tree, your immediate family would be those who are directly linked to you. (Parents, siblings, children, spouse)
Whereas your extended family is anyone you are related too but would have to draw more than one line on a family tree to get from them to you. (Grandparents, cousins, uncles, aunts, etc.)
Comment: Welcome to English Language Learners and thanks for your answer. Just a couple of suggestions for you: While your answer is correct it might be a little obscure for a non-native speaker who might not know what a family tree is. Because the questioner asks about her husband, parents and in-laws it might be a good idea to explain in terms of those relatives for her.
Comment: "extended family" can also be used to mean people to whom one is not related at all, but who serve in the social role of a family member, particularly if they live with or near one, or are frequently present in one's life.
Answer: Generally, your parents, siblings, spouses, and children are considered immediate family. Any grandparents/children, cousins, uncles, aunts, or otherwise would be your extended family.
You living with your husband is living with immediate family. Your parents are still considered immediate family.
I, personally, would would consider your in-laws to be extended family, but could see a possible argument for them to be considered immediate family upon marriage.

Immediate family vs Extended family


Executing script on device shutdown

Question: For custom scripts at boot, we have init.d. I want to know if there's a possibility of executing a custom script when shutting down, something similar to init.d or by using an APK?
Comment: You could make an app that receives the SHUTDOWN intent.
Comment: I think you can create a xposed framework module for that purpose.
Answer: Our default answer on questions like this is tasker – whenever it comes to automation, this is the most powerful tool to be mentioned. Tasker combines Contexts (Events, states, location, time) with Tasks to be fired when such a context is met. For your case, there's an event called Device Shutdown – which you could combine with the task Code › Run Shell to execute your shutdown scripts.
For further reading, I strongly recommend you visiting our tasker tag-wiki, which also links to additional resources like the tasker user-guide or my collection of tasker resources.
Answer: This is not easy. especially for scripts that have to run after zygote was stopped. Try to digg /*.rc scripts. may be attaching to the swapoff action help you. There are some mod projects at xda too https://forum.xda-developers.com/showthread.php?t=1387692

Executing script on device shutdown


How to set or clear USB keyboard LEDs

Question: I am using Ubuntu 12.04 and i need to control my customized USB keyboard keys & LEDs.
The Keys are working well. When I tried with a standard keyboard(having NUM, SCROLL, CAPS lock LEDs), i couldnt succeed with writing LED status bits.
I dont want to use console based kb ioctl calls to control LEDs. Is there any way to control directly using ioctl or write function at driver space.
Below is the code i tried:
kb = open(/dev/input/event2, O_RDWR );
char kbname [256] = "key-x123";
char LedStatus = 0;

ioctl (kb, EVIOCGNAME (sizeof (kbname)), kbname);

ioctl (kb, EVIOCGBIT (EV_LED,sizeof (LedStatus)), &LedStatus);

ioctl (kb, EVIOCGLED (sizeof (LedStatus)), &LedStatus);

All these calls are working well and i could reak keys. But unable to set any LEDs. Do not find any macros like EVIOCGLED to set LEDs through ioctl(2).
I tried below code as well which throws "invalid parameter" error.
struct input_event event;
event.type  = EV_LED;
event.code  = LED_NUML | LED_CAPSL | LED_SCROLLL;
event.value = 7;

  if (write (kb, &event, sizeof (struct input_event)) < 0)

Comment: `setleds` can do that from the command line.  Can you call out to your shell from your program?
Comment: i need to control from a program directly. now its working well
Answer: It's working fine with code below:
event.type  = EV_LED;
event.code  = LED_CAPSL; /* or any other LEDs */
event.value = 0; /* or 1 */

if (write (kb, &event, sizeof (struct input_event)) < 0)

How to set or clear USB keyboard LEDs


Can i execute a Linux command on shell script?

Question: Can i execute a linux command on my bash shell script. for example how can i execute ifconfig on shell script. when i execute the shell the output of ifconfig should come on terminal. is there any possibilities. Thanks in advance.
Comment: Bash shell script consists of Linux commands. ifconfig executed in a shell script will slow its result in terminal as usual. What's your REAL question?
Comment: Can you show your shell script please?
Answer: This might well be the heart of the issue:
The main thing to remember is that (as vulgar approximation) the "prompt" where you run your commands is a shell.  When you run a script on that prompt, it is run as a sub-process of the shell.  The shell becomes the parent process.
Or, to quote Mendel Cooper in the Advanced Bash Scripting Guide:

A subshell is a separate instance of the command processor -- the
  shell that gives you the prompt at the console or in an xterm window.
  Just as your commands are interpreted at the command-line prompt,
  similarly does a script batch-process a list of commands. Each shell
  script running is, in effect, a subprocess (child process) of the
  parent shell.

http://www.tldp.org/LDP/abs/html/subshells.html
That guide has excellent information relative to your question.
What does that mean?
One of the most common issues when transferring a command-line to a script format is that when it is a script that is run as part of a larger command, the script must RETURN the value to the parent process (the shell).  If it does not, then the script executes quietly and it is as if it wasn't in the shell command.
Often this type of problem can be solved by echo'ing a value or return'ing a value.  Sometimes values are export'ed to global variables, and you can make your own.  This does not sound like a case for global variables at all but just to give some examples.
I'll answer your questions directly as best I can with the information presented.
Q. Can i execute a linux command on my bash shell script?
A.  Yes.
Q. for example how can i execute ifconfig on shell script.
A.  Here is an example (assuming BASH):
cat NEW_NIC
    #!/bin/bash
    my_new_nic=enp101
    echo my_new_nic

chmod 744 NEW_NIC
ifcfg NEW_NIC

Q. when i execute the shell the output of ifconfig should come on terminal.
A.  Here is an example (assuming BASH):
cat SHOW_IF
    #!/bin/bash
    ifcfg

chmod 744 SHOW_IF
SHOW_IF

More details about the script would allow for a better answer.
Answer: Yes you can execute any basic and complex commands on shell or terminal.
Incase you are confused remember :
terminal = text input/output environment and
shell = command line interpreter
You can refer below link if you need more explaination.
https://askubuntu.com/questions/506510/what-is-the-difference-between-terminal-console-shell-and-command-line


How can i reduce __TEXT segment size in iOS App?

Question: My App failed to submit due to app size problem before, and the following build options were applied.
So I could submit an app.
*. Dead Code Stripping(DEAD_CODE_STRIPPING) : YES
*. Enable C++ Exceptions(GCC_ENABLE_CPP_EXCEPTIONS) : NO
But at this time, I can not submit my App architecture because of the following issue in arm64 architecture.
ERROR ITMS-90122 : "Invalid ExecutableSize. The size of your app`s executable file '******' is 60948500 bytes for architecture 'arm64', which exceeds the maximum allowed size of 60MB."
Exactly, the size of the '__TEXT,__text' section`s size is overflow.
Is there a way to solve this problem while keeping  Deployment Target(8.0)?

[My App Build Settings]
iOS Deployment Target : 8.0
Devices : Universal
Validate Architecture : arm64 armv7 arm7s
Build Active Architecture Only : NO
Strip Debug Symbols During Copy : YES
Strip Linked Product : YES
Strip Style : All Symbols
DeadCode Stripping : YES
Optimization Level : Fastest, smallest(-Os)
Enable C++ Exceptions : NO
Answer: 1.reduce template usage.
2.convert some data code in _TEXT to _DATA by remove const and static.
3.move template class shared data to base class.


Using xfce by keyboard

Question: I'm using Xfce as my default desktop. I was wondering if one can use it completely by keyboard without mouse? Such that some button combinations simulate mouse movements and some other simulates button presses. I have a handicap so I can work more accurate by keyboard than by mouse.
Comment: I'm not familiar with `xfce`, but I have configured `fvwm2` on my laptop to work mostly with the keyboard (switching between windows, resizing windows, etc.), in case it doesn't work with `xfce`. I'm sure the remaining functions that need a mouse could also be replaced somehow.
Answer: Use xorg native mouse keys:
<code>$ setxkbmap -option keypad:pointerkeys
</code>
Press Alt+Left Shift+Num Lock, then you can navigate mouse pointer with numpad.

More information at: https://en.wikipedia.org/wiki/Mouse_keys

Using xfce by keyboard


Can I buy Cataclysm if I have a 10-day free trial of Wrath of the Lich King?

Question: If I have a 10-day free trial of Wrath of the Lich King, can I buy Cataclysm and install it  too?
Answer: If you use the 10 day free trial for Wrath of the Lich King, you can then go on to also install the 10 day free trial of Cataclysm. However, you will not be able to associate a Cataclysm game with your account if you do not already have a Wrath of the Lich King game on your battle.net account.
The WotLK 10-day trial is not enough -- you must buy the full game in order to then go on and own Cataclysm.
Comment: If I'm not mistaken, in order to buy WotLK, you have to buy Burning Crusade and the original game as well.
Comment: @Anna Lear - as of recently, The Burning Crusade is given free to all new accounts.
Answer: You're certainly able to buy Cataclysm regardless of whatever else you own. The question of associating/installing is a different matter.
Cataclysm content is split into two parts: the old world revamp and the new endgame content. The old world revamp contains updated zones and quests in the Kalimdor and Eastern Kingdom continents between levels 1 and 60, as well as significantly revamped class mechanics; all of this content is included in the game for all players. The new endgame content (plus the new worgen and goblin playable races) are only available to players who are able to associate the full Cataclysm expansion with their account, which (as Raven Dreamer says above) can only be done by owning and associating Wrath of the Lich King.
You may be able to play the game for free up to level 20 as goblins or worgen (or any other race) even without a subscription after you've purchased and associated both expansion packs, however.
Comment: Hm. That last paragraph raises an intriguing point. Someone should experiment!


JPA distributed cache vs JDBC

Question: I have to make an application with multiple nodes connected to a single database in the backend.
all nodes need to be in sync as any client can go through any node and should expect the same result.
my question is if anywone has used some JPA distributed cache(something like eclipselink coorinated cache) for this and knows what the benefits of use JPA would be in this situation vs just using JDBC.
I understand i would get the caching benefits but would there be any other reason ?
Answer: If your question is, what are the advantages of JPA distributed cacheing over simply turning on cacheing in your database/driver - recognize there is still work to marshal/unmarshall objects that the JPA implementation does after the data has been retrieved from/sent to the database. This effort can be eliminated if the distributed cacheing can simply share the latest version of those objects without hitting the database.

JPA distributed cache vs JDBC


Why do B and C resonate sympathetically?

Question: While experimenting with piano acoustics I came across this weird phenomenon. Having an open B string and then hitting the C above will cause the B to resonate! This also works with open C and playing B below or B above! I cannot explain this with overtones since there isn't any close harmonic relationship between m2 or M7. Also how can any note produce frequencies below the fundamental?
Comment: Yeah, it's not a harmonic relationship just the piano resonating. Imagine how difficult it would be to stop the B resonating when you play the C. The dampers are there because they're necessary.  .
Comment: If that's the case, it should happen for every two notes which are a semitone apart. Does it? How are you 'having an open G string? Holding the damper pedal down? Is the piano properly in tune?
Comment: Does it happen when you play another note besides C (with open B)? I'm thinking if it happens with C, it should happen with every other note too.
Comment: In order to open a string I lightly press the corresponding note without hitting it until the damper is up. About my piano I had it properly tuned a few weeks ago so I guess this isn't the reason. Also this phenomenon occurs in almost every m2 relationship but in some cases  (especially in the lowest area) the following happens: "while G1 is open and I hit A1b  then the A1b resonates inside G1". I tried also hard hitting other intervals Tritone m6 m7 and it seems something similar happens but with lower intensity . It might be the case that something else inside piano transfers the vibrations.
Comment: Yea but still what is transferring the vibrations of ex. D4b  lowered in order to match the fundamental frequency of C4? And also how is it possible for a ex. A1 to resonate in the frequency of B1b?
Comment: I think Carl nails it in his answer. The whole piano vibrates, and pretty much at all available frequencies. .
Answer: The answer lies in a mixture of engineering and "pure" physics.  And a lot of Fourier Transforms :-) .
As we all know, the strongest resonances happen when the second string's pitch is an integral multiple of the first string.  To see why, let's start with just the sound wave in air reaching the second string. The first crest excites the string, and just as the string's natural resonance pulls it back, the first valley helps "pull" the string in that direction as well. Thus the second string absorbs lots of energy from the sound wave.  Next, look at an emitted frequency of F and a string resonating at 2F. Here the energy transfer matches the resonance only half the time (roughly speaking).
Now, if the second string's resonance is something like 12/11 *F, the sound wave is almost aligned with the resonant frequency, so the string will absorb energy for a few cycles -- and then it will dump energy as it goes out of phase!  This leads to the "beat" phenomenon we all hear when two instruments are close but not exactly in tune.
Now to the engineering part: a physical piano does not have perfect acoustic reflection of the first string's travelling wave at the two ends of the string.  Some energy, both acoustic and mechanical, gets into the sound board and the piano body. This energy starts dispersing (i.e. into random frequencies) and feeding back into the posts of all the other strings, thus exciting every string to some extent.  How much energy makes it into a given note depends on the resonant profile of the entire system, not just the acoustic wave generated directly from the first string.
Comment: Thanks for the answer! Two more question tho, is it possible to hear the beat phenomenon in piano? And also can any string produce lower frequencies than fundamental due to some nonlinear effect combined with strong hitting? I was hopping this to be the case in order to explore it some more :D


Can you use a stave with the use magic device skill?

Question: Is it possible to use a stave with Use Magic Device? If it's possible, what is do you use as caster level and casting stat modifier for the spells, since it normally uses the casting stat modifier and caster level of the user?
Answer: A creature can employ the skill Use Magic Device to activate a magic staff
The following is one of the uses of the skill Use Magic Device:

Use a Wand, Staff, or Other Spell Trigger Item: Normally, to use a wand, you must have the wand's spell on your class spell list. This use of the skill allows you to use a wand as if you had a particular spell on your class spell list. Failing the roll does not expend a charge.

(Emphasis mine.) This Use Magic Device skill use's Difficulty Class is 20. By default, the spell from the magic staff will be cast at the staff's listed caster level using the normal saving throw DCs appropriate to the spell (e.g. a creature that makes a Use Magic Device skill check to activate a staff of the woodlands sees the staff's charm animal effect generated at a caster level of 13 with a likely saving throw DC of 14; that is, DC 10 base +1 for spell's level +3 for the minimum ability score of 17 necessary to cast the staff's highest level spell).
A generous GM may allow a second Use Magic Device skill check to emulate the class feature spells of a casting class that has on its spell list the spell stored in the staff, making "your effective level in the emulated class [equal to] your Use Magic Device check result minus 20." Likewise, the GM may allow a further Use Magic Device skill check to emulate an ability score, making "[y]our effective ability score [equal to] your Use Magic Device check result minus 15"; note that typically such a check is only demanded when attempting to use a magic scroll, making this particular use a very nonstandard use of the skill. Even if allowed, these options are, obviously, only attractive to creatures with high Use Magic Device skill modifiers. Most should be satisfied with merely activating the magic staff.
Comment: thanks, but do i need to make the checks to emulate an ability score/caster level each time i umd the staff, or do i do it just one time and it's works each time i umd the staff ? If not, can i do all the checks in one action ?
Comment: If the GM's allows Use Magic Device skill checks to emulate a class feature and emulate an ability score when making a check to activate the staff, I'd expect all three checks to be needed each time an attempt was made to activate the staff (rather than the normal lone check needed to activate the staff), *but*, as the first two checks *are* nonstandard uses of the skill, you'll have to ask the GM. However, all three checks should be *not an action*, made when the bearer attempts to activate the staff.


Grails layouts and meta tags

Question: I defined a layout, myLayout that has a left and center content.
I apply my layout to all pages and the layout is composed of a series of other components (Another layout, templates ...)
In a page A, there is a component part of the layout that should not be displayed in the page. To solve that i had two solutions

define a new layout only for that page
I didn't like to create a whole layout just for one page,
define a meta tag with a specific value in the page A and I used the pageProperty to check if the value is set and hide or show the component accordingly

The meta tag in page A index.gsp
<code><meta name="foo" content="myContent"/>
</code>
And myLayout
<code> <g:if test="${pageProperty(name:'meta.foo')!='myContent'}">
 // Render template
</g:if>
</code>
is this a good way to deal with this problem ? is there a better way ?

ken
Answer: my vote is for pageProperty

Grails layouts and meta tags


SharePoint Online multi line rich text field

Question: We have a search webpart which gets the values from 3 lists and displays it in a format on a page. Now when a user click on the ShareMe button. It copies the item description and title and open a email window from outlook with the title and description in subject and body respectively. The body with description doesnt preserve the html i.e the spacing, links etc. Any suggestions
Answer: This has nothing to do with SharePoint.
Section 2 of RFC 2368 says that the body field is supposed to be in text/plain format, so you can't do HTML.
However even if you use plain text it's possible that some modern mail clients would render a URL as a clickable link anyway, though.
Reference - Is it possible to add an HTML link in the body of a MAILTO link

There is a workaround for that. You will have to modify your code somewhat as below. Render your HTML in a div and then send the innerHTML.

 https://google.com

<input type="button" value="SendMail" onclick="sendMail();">

W3Schools - tryhtml_link_mailto - tested the code here and it somewhat works with anchor tags.
However, if it's a full html text and then it would be better to use SPUtility's SendMail method like the solution provided here - Send Mail using CSOM/REST


Finding middle point (midpoint) of line in QGIS

Question: How can I locate the coordinates of the middle point (midpoint) of a line feature in QGIS?
Comment: looks like you can do it in GRASS, see link http://lists.osgeo.org/pipermail/grass-user/2006-June/034795.html
Comment: For QGIS 3 see https://gis.stackexchange.com/a/258317/98170, but change the last line from `QgsMapLayerRegistry.instance().addMapLayer(temp)` to `QgsProject.instance().addMapLayer(temp)`
Answer: Since this question was asked, an interpolate function has been added to PyQGIS on the QgsGeometry object.
Here is a quick example of how to use this in the Python console inside of QGIS (Plugins -> Python Console).
layer = iface.activeLayer() #layer selected in your layers panel
feature = layer.selectedFeatures()[0] #the first feature of selected features
geom = feature.geometry() #QgsGeometry representing your line
length = geom.length() #length of geometry in the layer CRS. If EPSG:4326 this will be degrees
point = geom.interpolate(length/2.0) #QgsGeometry representing the mid point
x = point.geometry().x() #X coordinate in layer CRS
y = point.geometry().y() #Y coordinate in layer CRS

An even easier option...
In the processing toolbox there is a QGIS function under Vector Geometry that is called Interpolate point on line that is most likely using the interpolate function described above.
For your input layer select the line layer you want to find the midpoints
Warning! Make sure you are using a projected coordinate system appropriate for the area where you are finding midpoints. Geographic coordinate systems like EPSG 4326 (WGS 84) are not accurate for measuring distances, and a world wide projected coordinate system like EPSG 3857 (WGS 84 / Pseudo-Mercator) will not be as accurate as a projected coordinate system for a specific region.
For distance, this is the distance to be interpolated along the line by the given units. If you give a distance of 10 and meters is selected, then a point will be created 10 meters along the line for every line in your layer. What we want here is a calculated value, not a static value like 10. To calculate a value for distance, click on the drop down to the far right (shown circled in red below) and select edit...

In the expression box, put in the expression $length / 2.0 This will calculate half the length of the given line feature in the coordinate reference system for that layer (hence the warning above). Select OK.
Run the Interpolate Point on Line function, and it will then create a point layer with a point at the midpoint of every line feature in the selected layer, and each midpoint will have the attributes of the original line feature copied over to it.
Comment: @GeorgeC for layer.selectedFeatures()[0] to work, you literally have to have features selected in QGIS. Get the selection tool and select something. The code above is just a very quick and dirty proof of concept.
Comment: @GeorgeC it had been awhile since I had looked at this question, and looking into it again I found `Interpolate Point on Line` that I have described above, that I think will do what you are looking for.
Comment: Rokefellar - Does QGIS 3.8 handle the feature = layer line differently? I get index out of range.
Comment: I tried this -what would I need to do to get it to run on the whole dataset?
Comment: @GeorgeC This is just a proof of concept. What you are asking does not have a trivial answer that can be explained in a comment. You will need to research writing Python scripts in QGIS and possibly ask a more detailed question on this site. You will need to automate looping through all features and figure out what you want your output to be, I'm assuming a point layer?
Answer: If you bring your line feature into spatialite, you can use the Line_Interpolate_Point() function to find the mid point.
SELECT AsText(Line_Interpolate_Point(your_line.geomemtry, 0.5))

The second parameter 0.5 indicates the fraction of the line length where the point will be located.
Answer: It is a pure geometry problem that can be solved in the Python console
The problem:

Find the midpoint of a segment x1,y1,x2,y2 is easy
x = (x1 + x2)/2
y = (y1 + y2)/2

so in the Python console
def mid(pt1, pt2):
    x = (pt1.x() + pt2.x())/2
    y = (pt1.y() + pt2.y())/2
    return QgsPoint(x,y)

def pair(list):
    '''Iterate over pairs in a list '''
    for i in range(1, len(list)):
        yield list[i-1], list[i]

def create_geometry(point, pr):
    # create geometry record
    seg = QgsFeature()
    seg.setGeometry(QgsGeometry.fromPoint(point))
    pr.addFeatures( [seg] )

# memory layer
pt_layer = QgsVectorLayer("Point", "midpoint", "memory")
pr = pt_layer.dataProvider()

for elem in mylayer.selectedFeatures():
    line = elem.geometry()
    for seg_start, seg_end in pair(line.asPolyline()):
        line_start = QgsPoint(seg_start)
        line_end = QgsPoint(seg_end)
        # midpoint
        midpt = mid(line_start, line_end)
        # add midpoint point to layer
        create_geometry(midpt,pr)
        pt_layer.updateExtents()

QgsMapLayerRegistry.instance().addMapLayers([pt_layer])

Result
Comment: Just a note that this approach finds the mid point of each line segment, not the line itself.
Comment: @gene I think the following line is missing in your code: mylayer = qgis.utils.iface.activeLayer()
Answer: One way I would address this is to use a 2 step approach with the MMQGIS plugin. The first is to install and use the MMQGIS to find the middle point or center of each line.
Then by creating new columns, I can use the longitude and latitude functions from the field calculator to get the coordinates accordingly.
Comment: I'm using QGIS 3.22 and MMQGIS plugin but I can't see the option to get the midpoint. Need help.
Answer: In PyQGIS 3 there are several handy methods available, particularly for:
Straight Lines
Since QGIS 3.0 there is midpoint() method from the QgsGeometryUtils class.

Returns a middle point between points pt1 and pt2.
Z value is computed if one of this point have Z. M value is computed
if one of this point have M.

# imports
from qgis.core import QgsProject, QgsGeometryUtils

# referring to the original line layer
line_layer = QgsProject.instance().mapLayersByName("lines")[0]

# getting geometry of one single line feature
line_geom = line_layer.getFeature(5).geometry()

# extracting line first and last point
first_vertex = line_geom.vertexAt(0)
last_vertex = line_geom.vertexAt(1)

# finding the midpoint
midpt = QgsGeometryUtils.midpoint(first_vertex, last_vertex)
print(midpt)

it will lead to the following output:
<QgsPoint: Point (6362964.60043694637715816 6156695.3789755143225193)>

The same result can be achieved with the pointOnLineWithDistance() method.

Returns a point a specified distance toward a second point.

midpt = QgsGeometryUtils.pointOnLineWithDistance(first_vertex, last_vertex, line_geom.length()/2)

Curved Lines
Since QGIS 3.4 there is interpolatePoint() method of the QgsLineString class.

Returns an interpolated point on the curve at the specified distance.
If z or m values are present, the output z and m will be interpolated
using the existing vertices' z or m values.
If distance is negative, or is greater than the length of the curve,
nullptr will be returned.

# imports
from qgis.core import QgsProject, QgsLineString

# referring to the original line layer
line_layer = QgsProject.instance().mapLayersByName("lines")[0]

# getting geometry of one single line feature
line_geom = line_layer.getFeature(4).geometry()

# converting this line feature to a QgsLineString
line_string = QgsLineString(line_geom.asPolyline())

# finding the midpoint
midpt = line_string.interpolatePoint(line_string.length()/2)
print(midpt)

it will lead to the following output:
<QgsPoint: Point (6363044.65252993814647198 6156648.31500245165079832)>

Curved Multi-part Lines
Since QGIS 3.0 there are childCount()

Returns number of child geometries (for geometries with child
geometries) or child points (for geometries without child geometries -
i.e. curve / point)

and childGeometry() methods from the QgsAbstractGeometry class.

Returns pointer to child geometry (for geometries with child
geometries - i.e. geom. collection / polygon)

# imports
from qgis.core import QgsProject, QgsLineString, QgsMultiLineString

# referring to the original line layer
line_layer = QgsProject.instance().mapLayersByName("lines")[0]

# getting geometry of one single line feature
line_geom = line_layer.getFeature(3).geometry()

# converting this multi-line feature to a QgsMultiLineString
multi_line_string = QgsMultiLineString()
for line in line_geom.asMultiPolyline():
    multi_line_string.addGeometry(QgsLineString(line))

# finding the midpoint for each part
for part in range(multi_line_string.childCount()):
    part_geom = multi_line_string.childGeometry(part)
    midpt = part_geom.interpolatePoint(part_geom.length()/2)
    print(part, midpt)

it will lead to the following output:
0 <QgsPoint: Point (6362897.59699867479503155 6156682.89629040285944939)>
1 <QgsPoint: Point (6363044.65252993814647198 6156648.31500245165079832)>

References:

PyQGIS Geometry manipulation
Difference between QgsPoint, QgsPointXY and QgsGeometry.fromPointXY() in PyQGIS
Answer: In QGIS 3.12 I found the Vector->Geometry Tools->Centroids function to be the quickest/easiest way to do this. You can create a temporary or permanent feature of a single line selection or an entire line feature in just a couple of clicks. I do wish that a Snap-To-Midpoint button is added to QGIS Snapping Toolbar soon though!
Answer: To get midpoints close to half the length of line objects, the Centroids function in QGIS 3.10.10 doesn't for sure create the midpoint on the line if the line object is not strait. So instead I buffered the road centre lines 5 meter, used Centroids on the polygons created from the buffered lines and got points at very good positions.
Answer: You can use an expression:
line_interpolate_point( geometry:=$geometry, distance:=$length/2)
It will return the point half way along the line length.
You can label it:
geom_to_wkt(geometry:=
line_interpolate_point( geometry:=$geometry, distance:=$length/2),
precision:=1)

If you want to calculate x and y fields you can do:
x(line_interpolate_point( geometry:=$geometry, distance:=$length/2)) and y.


Fixing water leak without turning off water. (Water pipe busted, can't get company to turn off water) Please Help

Question: Trying to fix a water line that froze then busted, I can't get the water company to cut off the water, the valve at the meter no longer shuts off water to the home (I was not informed that the new policy states that the homeowner must provide own shutoff). Water company said they would send someone at 1pm yesterday, almost 24 hrs later, water still flowing heavily. My question is, is it possible to glue this cpvc line while water is flowing? My thought process is to just cut the line before the break and install a shutoff valve until a plumber can get out to fix it (Which will be days from what I've been told by the landlord). I am open to any suggestions. Please Help.
Comment: *Might* have a better chance with a Sharkbite. If the break is a full-flow break then you've got nothing to lose. If the break is much less than that (perhaps a couple gallons a minute) then you risk going from "bad" to "worse".
Comment: Are you the homeowner or a renter?  If a renter keep pictures and have all communications recorded and kept.  It is landlords responsibility to fix and repairs.  If a homeowner then there pipe freeze kits to freeze water to work on pipes.  If leak is bad then cutting the pipe to install valve probably won't get stuff wetter.
Comment: It might be helpful to provide information and/or photos of where the leak is, the volume of water coming out, photos of your access to the leak, etc.  Also, I've never seen a water meter that doesn't have valves before and after to isolate the meter for change-outs, etc. Are you sure there's no cut-off valves? These would be located at the actual water meter not a remote readout device.
Comment: My father is the renter, we contacted the landlord and the water company as soon as the pipe broke approximately 1pm yesterday. The break is about 1 foot long, and I'm certain it's full flow, because of the length is why I thought of just putting a temporary shutoff valve but I can't find a cpvc glue that works when wet. In this case, it would be very wet.
Comment: @gnicko I will try to get pics in a bit, the shutoff at the road/meter use to stop flow, I've used it before when replacing water heater elements and it's where the company told me to stop the water before, but they have since had a "Policy Change" and now the homeowner is responsible for providing a shutoff and the valve does nothing when turned. Thanks Aqua.
Answer: I think you've got nothing to lose by trying a Sharkbite. Something like this one from Home Depot:

It won't be easy, but it is better than continuing with a flood. Make sure you get the right size - if you're not sure, get every size that looks close and return whatever you don't use (Home Depot and similar stores are very good about that - I've had employees tell me to do that.)
Answer: There are a few products that come to mind...
Resin-permeated fiberglass tape. This stuff is a fiberglass tape enpregmented with a water-activated resin adhesive. Basically, you wrap the pipe with this stuff and the water causes the resin to fuse into a "permanent," fiberglass reinforced patch. I'd use this for a temporary fix and then replace the broken length of pipe later.
A mechanical pipe patch fitting. This goes around the pipe and clamps down to seal the leak with a rubber gasket. This might be too short for your situation, but they do make various sizes. Again, this will be a good temporary fix until you can fix it permanently.
A combination of Sharkbite fittings and a length of replacement pipe. Cut out the broken length of pipe and replace it using the push-fit Sharkbite fittings. The straight couplings are probably what you'll need, but while you're at it, depending on the location of the burst pipe, this might be a good opportunity to install a cut-off valve. This is going to get you plenty wet and could require some "gymnastics" to get things together, but you already have water flowing freely, so that might not be as bad as it sounds.
Answer: I would give a Push fit valve a try similar to the ones shown below. You would install it with the valve open and then close it afterwards to stop the water.

There are also emergency repair sleeves from Home depot that could also work it the slit is not too big. See picture below.


Why do child elements cause 'dropleave' to be called (drag-n-drop file upload)?

Question: I have a HTML5 drag-n-drop script that allows users to drop files in #droparea. The #droparea div has child elements that are also div elements.

Drag files here!

Drop the files!

The associated javascript/jquery is:
var droptarget = "#droparea";
$(droptarget).live('dragenter', dragEnter);
$(droptarget).live('dragleave', dragExit);
$(droptarget).live('dragover', nothing);
$(droptarget).live('drop', dropGo);

(Side question: should I use .live(), .on() or .bind() here?)
I have created a sample jsFiddle with some additional code here: http://jsfiddle.net/PwFr9/3/
If you look at the console, you will notice that as you drag a file within #droparea, dragenter() and dragleave() are called multiple times, even though the drag is still inside #droparea. If you remove the child elements (#child1 and #child2), the problem is gone because the child elements are gone. How can I keep the child elements and prevent them from messing up the drag events?
I have searched Stackoverflow and Google for hours without much help. I found this questions here at Stackoverflow: How to keep child elements from interfering with HTML5 dragover and drop events?
I don't know why it works, though.
I have tried placing 2 div elements on top of each other (via CSS positioning). The top-most div has the drag events attached whereas the bottom-most div has the child elements. I do not like this approach because it doesn't work with the rest of my page and does not allow mouse-click interaction with the bottom-most div.
Answer: Its a problem with the HTML5 drag-n-drop spec. Read over this lengthy article for an explanation...
http://www.quirksmode.org/blog/archives/2009/09/the_html5_drag.html


mysql stop slave forever

Question: I used replication to migrate all data to a new server, and then I commented out master_host,master_port etc(basically all lines related to master) in my.cnf, I issued stop slave.  However I after restarted mysqld, the replication process is running again!  how to stop it for good.
Answer: The procedure is different based on the MySQL server version.

For version 5.0 and 5.1, run STOP SLAVE, CHANGE MASTER TO MASTER_HOST='' and then RESET SLAVE.

In these versions the RESET SLAVE command will remove files master.info and relay-log.info and most of the settings, however some of the settings will just be reset to default values and this is dangerous. If replication is started again, it will start without knowing the master position and so would re-apply all the logs still still available on the master. To to correctly remove all the info about master you need to run also the CHANGE MASTER command.

For versions 5.5, 5.6 and 5.7 it is easier, just run STOP SLAVE and then RESET SLAVE ALL.

Here the RESET SLAVE (without the ALL keyword) behaves in the same way - not removing all the info. However also the CHANGE MASTER doesn't help for 5.5+, so you have to be careful and know on which MySQL version you are currently working.
Comment: `RESET SLAVE ALL`  - the `ALL` is what I was missing, thanks! :)
Answer: The proper way to do this is stop slave; reset slave;
The 'reset slave' is the part that will wipe the config and keep it from reconnecting.
Comment: is the config stored in the database?
Comment: I'm not sure. I believe part of it is stored in master.info as lynxman mentioned, but this command controls that file (at least thats what the doc says). Anyway I've used it and its worked for me.
Comment: This is not correct anymore - see http://serverfault.com/a/788912/299496
Answer: In order to completely stop replication you have two ways

Issue a 'CHANGE MASTER` command with fake info, that'll break the replication for good
Remove the file master.info that sits on root of your mysql, that'll remove replication info

In any of those cases you'll need to redo your replication later, write down all the replication data like last position and last source-bin file just in case you want to start replication again.
Comment: Can a "master.info" file be deleted safely from a running master-DB. I know it's supposed to be there on a slave, but it's a left-over from an import where "CHANGE MASTER" was set on the master...
Comment: no master.info is found on my system
Answer: I usually do an STOP SLAVE; CHANGE MASTER TO MASTER_HOST=''; to kill off a slave.
Comment: This no longer works. I get `Incorrect arguments to MASTER_HOST` on mysql 5.5.38

mysql stop slave forever


I have paper-filed my federal tax but I am not sure if IRS has received it. Should I file an extension?

Question: Because of my immigration status in the US, I have to paper-file my tax form 1040NR-EZ. Then I lost my USPS tracking number and IRS's Where's My Refund doesn't have my info. Should I file an extension before April 15? Is there any drawback from filing an extension if IRS has already received my tax form but not processed it yet?
Comment: You're almost certainly safe; USPS does a good job of delivering mail. But as you are due a refund (i.e. overpaid), even if they do somehow manage to lose or destroy your return you can just file another copy up until April 2019 with no penalty.
Comment: That sounds like a bad idea to me, as they'll get the extension after they receive your completed return. Call the IRS @ 800-TAX-1040 and see what they recommend. Were it me, I would just chillax - it's unlikely the IRS didn't receive your return.
Comment: How long ago did you send it in?
Comment: I mailed in around Mar 15. IRS website says it may take up to 6 weeks but that will be after April 15.
Comment: Quick observation,: if you are going to worry about whether delivery occurred, the US postal service offers several options that give you receipts proving that you mailed something to a particular address on a specific date, or that deliver a receipt back to you proving that it reached that address or that it's delivery was acknowledged by the recipient.  Those receipts can be used as evidence that you submitted the forms on time, if necessary. I don't usually feel a need for that proof, but it's worth knowing the option exists, and it can be done less expensively than paying for Priority Mail
Answer: There is supposedly an online service offered by the IRS that will tell you if they have received your form. In not 100% sure it works with paper filings, but that's what I'd suggest investigating if you need reassurance. There's an IRS-to go application, or a "where's my refund" web tool. See https://www.irs.gov/Individuals
Comment: When I had to amend one year, that site took about nine weeks to update after USPS said they had received it.
Comment: I tried Where's My Refund but there's no info.
Comment: Paper reaching them, and the envelope being opened and scanned into the database, may be _very_ different. And that difference is much worse the later you file, since their backlog gets worse as volume increases. Don't expect them to acknowledge receipt until that second hurdle has been passed. Electronic filing's biggest advantage may be that since it goes directly into their databases, they can confirm receipt within a few days.
Answer: Any paper returns postmarked on or before the official filing date are not considered late.  That being said, it's common practice to send returns via registered mail with some form of delivery confirmation.  This is so that, should some IRS technician accidentally drop your return in the shredder (or any other unforeseen mishap), that you have some evidence in your defense when they come after you.  Most of the time though (in 99.9999% of occurrences), such steps are not needed because everything shows up in the official records, even if it seems to move at a glacial pace.
If I were in your situation, I'd set a calendar reminder to log in on April 15th to check for "received" or "accepted" status, and then not think about it again until that date.  If the return is not shown online on that date, then you still have time to call the IRS, file an extension, and even start going about recreating your paper documents.
Comment: Certified gives same proof of delivery cheaper. Registered is only worth it for things that can't be replaced, which a tax return can. Although a _first year_ nonresident may need to file W-7 and include passport or other valuable documents as evidence and that could justify registered.
Answer: If IRS received your paper return, but they haven't processed it yet, there is no confirmation.
With IRS understaffed, it can take a while to process paper returns. So, to be on the safe side, you might want to file for extension.
You should be able to do it online. Check here: https://www.irs.gov/filing/extension-of-time-to-file-your-tax-return
Filing for extension won't cause any problems - if IRS receives your paper return on time, they will ignore extension request.
Comment: Was my answer downvoted because it was too short? I elaborated it - is it better now?
Comment: and after I elaborated my answer I received another downvote? Can someone please explain what you don't like about my answer?
Comment: I don't understand it either.  I have upvoted.  It seems the commonsense approach.


Do you swirl or twirl a little oil around the frying pan?

Question: In my ears, swirl sounds better but I don't know why. I tried looking up the definition for both verbs but I couldn't find anything particularly unique for each, eg something like one of them being used only with inanimate objects.
Does anyone happen to know some general rules of thumb when to use each of the verbs?
Comment: Twirling is more akin to spinning something around around an axis (you twirl a baton in marching band, you can twirl your hair around your finger), whereas swirl is about making something move in a more fluid, whirly or eddying motion. Liquids always swirl; twirling a liquid conjured up an image of someone magically able to control that liquid and make it move in very unnatural ways.
Comment: Thank you, @JanusBahsJacquet. This answer was very helpful.
Answer: You would use swirl for causing the liquid to move around the pan. Twirl could be used for a ribbon, hair, or even a person spinning. It makes more sense for something moving on an axis.


Stuck on The Key to Redemption - Find the Archon

Question: In Darksiders 2, I'm trying to do the quest The Key to Redemption. I'm at the Crystal Spire and unable to go any further from the second floor. I have defeated the 2 corrupt angels and can't seem to utilize that yellow explosive sphere correctly. How can I proceed?
Answer: You need to use the Soul Splitter.
The issue here is that the shadowbomb needs to be carried across a gap, which Death can't do by himself.  Split Death's soul midway between the shadowbomb and the Corruption crystals, have one copy of Death run to the shadowbomb and pick it up, then with the other copy on the other side of the gap, throw the shadowbomb so that the other copy catches it.  Then switch to the other copy of Death, move towards the Corruption crystals, and blast it apart.
Edit: I dug out an old save file from my private SVN repository of saves (edit: now a Git repository) in order to replay the segment in question, so that I can provide some screenshots.
Click on an image to view it in full size.


What ISO should I use on unbranded film?

Question: I bought a bag of unbranded film. It was 60 dollars for 15 rolls so I couldn't pass up. But obviously I don't know the exposure or the ISO. Does anyone have a suggestions on the ISO/ASA I should shoot on? I was thinking 250 but I'm new to film photography.
Answer: Use one of the rolls for testing.
Choose a variety of scenes, and take several shots of each, with a range of settings for each scene (the same range for each scene) and make a note of the settings.
Get the film developed and see which settings were generally the best.
You may be able to get an idea of the ISO from the grain of the prints too.
Comment: Clearly the best suggestion. After the film has been developed, chances are also relatively high that the film type is imprinted along the border of the negatives (outside the sprocket holes).
Answer:
Shoot one film at ISO 200 (as a nice middling speed)
Include some test shots at known EV; your phone is a good enough meter here.
Get the film developed.
Check if the test shots are correctly exposed. Correct if they're not.
Hope all the other films in the bag are the same speed (this may be a big ask. Do they all look the same?)
Answer: There is no EI setting that is sure to be a good fit for any/all film of unknown ISO. First thing you should do is ask the seller if possible. Then, you need to use trial and error - you can start with 200 and see how the results turn out. Assuming (and that's a big assumption) that all the rolls are the same ISO, then you would adjust the EI as appropriate. If you wanted, you could do what's called a "clip test", where you expose only a couple of frames first, and get a (pro) lab to clip off and develop just those first few exposed frames - this would allow you to make adjustments before you've shot through an entire roll of film. Also - if you're lucky - the film may have edge markings that give away its true ISO value.
If you are new to film photography, then I would suggest not buying cheapo film of unknown ISO just to save money. You will probably waste more money in the long run - paying for film and development and potentially getting no useful results and not really learning a whole lot. Buy the cheapest fresh C-41 film you can find (or B&W if you intend to develop yourself) from a reputable brand and reputable retailer. All hobbies are going to involve some cost unfortunately, and this is the cost of getting into film photography.
Answer: Some ideas.
Does the cartridge have big squares on it? Some chrome natural metal (conductive), some with paint on it (Non-conductive). It is a type of "barcode" which identifies the ISO speed. Take a look and see if you can identify it or post an image so someone can identify it. If your camera has some electric connectors where you put the film, it will probably automatically define the ISO speed.
The code can also be located in the film itself.
35 mm film Dx Code

From Wikipedia https://en.wikipedia.org/wiki/DX_encoding
Does it have any name on it? There is a chance they have a name similar to some films that had specific name prefixes that reference the speed. For example, if I recall correctly, on Black and white film "Tri-x" was ISO speed 400, and "Pan-x" was ISO 100. So if the name is something like TrixBanana, it is probably ISO 400.


Event Driven Programming?

Question: I have been looking into event driven programming in C and the language doesn't seem to have support for it. This has led me to wonder about the nature of event driven programming. Is it correct to say that an event handler basically spawns a thread that waits for a response from I/O and sets a variable? Or is there something more complicated to the process.
Comment: Might want to look into [GLib](https://developer.gnome.org/glib/2.38/).
Comment: There are multiple solutions for doing event driven programming in C. In particular, [libuv](http://nikhilm.github.io/uvbook/) was used to write node.js.
Comment: Can you cite where you got the idea that C can't handle event driven programming?
Comment: Half the reason for the question was to help in finding out about event driven programming, I don't claim to have found evidence I have just been unable to find a decent place to learn about it
Comment: http://en.wikipedia.org/wiki/Finite-state_machine AKA State/Event machines are widely used in telephony. I have lost count of the number of handset projects I have worked where we coded in C.
Answer: Event driven architecture simply means, that the main loop AKA event loop does not understand much about the data a program processes. It understands only enough, that it can dispatch the right events for the data.
So for example, if event is triggered by data coming from a socket, all the event loop needs to know is, what callback to call, when data comes from that particular socket.
Typically the event loop is in some library, such as libevent. So application code consists of just setup code and event handlers which are called by the event loop in the library.

Since you mention threads: a classic simple event driven application is single threaded. Each event handler or callback just does its thing as fast as it can, when it gets called, and returns. Blocking or waiting or sleeping is a big no no, it will block all other events!
Threads are often used, when there is some processing which takes long time. If it were done in the main thread with event loop, the long operation would have to be chopped into small pieces, so other events could be handled too. So it's simpler to have a worker thread, which can do the processing without interfering with event processing, and then generate event for main event loop when done.
Other case of using threads is, when there is something which must block. It may for example be some other library, which only provides a blocking API. If that API was to be used from the main thread event loop, it would block other events. Solution is to use that library from another thread, which can block, and then generate event for the main event loop when there's something interesting for other parts of the application.
But in a sense, event driven architecture is sort of opposite of multi-threaded architecture:

In straightforward multi-threaded architecture, each thread waits for one kind of thing to process (a wait condition or a blocking queue or a blocking socket read or whatever, possibly with timeout to periodically check something), then does the processing, possibly signals other threads, and goes back to waiting. One thread does one thing, and there's a thread for each different kind of thing to do.
In event driven architecture there's just one main event loop (usually from a library) which waits for all kinds of events and calls handlers, all in the same thread. One thread does everything, and there's a non-blocking event handler for each different things to do. The good thing about this is, no synchronization is needed, because it's all in one thread, which avoids all-too-common multi-threading bugs, keeps code simpler and avoid synchronization overhead. Downside is not taking advantage of multiple CPU cores, and risk of blocking event loop if developer is careless.

Of course a complex application can have several event loops in different threads, and also threads which do just single thing, so these can be mixed.
Comment: *...event driven programming is sort of opposite of multi-threaded programming.* How, exactly, is event-driven programming the opposite of multi-threaded programming?
Comment: @FrustratedWithFormsDesigner did `s/programming/architecture/`, which maybe is better word. But just because event driven and multi-threaded programming/architecture/whatever can be mixed in same application does not mean they can't be opposite. I wouldn't say they're orthogonal, because same thing can be done in either style, but not at the same time. Like reading from a socket, it can either be in its own thread, or socket+callback can be given to event loop, but not both.
Comment: @FrustratedWithFormsDesigner Edited last paragraph of the answer to clarify
Comment: Your last point about complex applications with multiple threads running multiple event loops completely disproves your point about multi-threaded programming being the opposite of event-driven programming. I'd say they're orthogonal: an application can be written with either paradigm, or both, if necessary. Trying to claim that they're opposites... doesn't make much sense to me.
Answer: An event loop library could be single-threaded if it uses some multiplexing facility to wait for several events, inputs (and outputs, e.g. ability and readiness to write some bytes on some pipe or socket).
On Linux and POSIX systems, you could use some multiplexing syscall like poll(2) or select(2). So you can have single-threaded event loop libraries, and (at least historically, e.g. in the previous century) several event-looping libraries (like libev, libevent, Glib from GTK) are -or have been- single threaded (so they don't spawn new threads).
Even recent GUI frameworks like Qt5 or GTK3/Gnome still require (on Linux) the graphical user code to be in the main thread.
You could also have some event loop, even in free-standing C programs like those driving microcontrollers. Then they would use some code (perhaps in assembly) to wait for events or interrupts, etc.

Event Driven Programming?


How to celebrate birthdays as per Panchanga if births had taken place in Adhika Masa?

Question: How do I celebrate birthday as per Panchanga, if we are born in Adhika Masa? For example, my son is born in Adhika Vaishaka, but this year there is no Adhika for Vaishaka.
Answer: Can celebrate birth day in respective Nija masa (moon month). No need to wait for adhika masa in next coming years. Same thing applies to birth day on february 29. make a note of the tithi and masa (Moon month) and celebrate every year.