How to search all the fields in address as one string

Question: Kindly help us with address search builder please. We wanted to make all the fields in the address as one string and then search for the address using reg expression.
Answer: This isn't a feature that exists out of the box - but addresses support custom fields, so if you're comfortable writing an extension, you could do this.  Create an extension with a hook_civicrm_pre that looks something like this:
function sharedaddresschanges_civicrm_pre( $op, $objectName, $id, &$params ) {
  if (($op == 'create' || $op == 'edit') && $objectName == 'Address') {
    $result = civicrm_api3('CustomValue', 'create', array(
      'entity_id' => $id,
      'custom_xx' => "street_address supplemental_address_1 city etc etc."
    );
  }

Answer: Stepping outside civi you could do this in Drupal Views via a Views Block using a Global "Combine Fields Filter", and set the resulting records with a link back to their civi contact.
Answer: You could use the Full Text Search feature which offers some of what you requested. It supports sql wildcards but not regex, and it does search across multiple tables and columns, although it doesn't concatenate them together first.


Homotopy limit of model categories in the category of categories

Question: Say $$\mathcal{C'}\to \mathcal{C}\leftarrow \mathcal{D}$$ is a diagram of model categories and (e.g. Left) Quillen functors. I want to write down a (hopefully simple) model category $\mathcal{D}'$, or at least a category with weak equivalences, such that its $\infty$-categorical localization is the homotopy limit of the localizations of this diagram in the $(\infty,1)$ category of $(\infty, 1)$ categories. Is there a nice way to do this? I'm willing to impose any reasonable niceness conditions on the categories in the diagram.
Comment: Maybe you could have a look at this paper : https://arxiv.org/abs/1010.0717 if you don't know it already.
Answer: Philippe Gaucher is right. This problem was solved by Julie Bergner, here. I recently asked a question that summarized some of her work on this problem. The point is that the homotopy limit of your diagram is a category $M$ whose objects are 5-tuples $(x_1,x_2,x_3,u,v)$ with $x_1 \in C'$, $x_2 \in D$, $x_3\in C$, and $F(x_1) \stackrel{u}{\to} x_3 \stackrel{v}{\gets} G(x_2)$ in $C$, where $F$ and $G$ are the two functors in your diagram. The morphisms in this category of 5-tuples are obvious. This category $M$ can be given a model structure where the weak equivalences and cofibrations are levelwise (on each $x_i$), and that model structure can be localized if desired to force $u$ and $v$ to be weak equivalences in the local objects of $M$. Bergner then proves $M$ has the correct homotopy type, meaning that, upon passage to complete Segal spaces (i.e. $(\infty,1)$-categories), it becomes the actual homotopy pullback of the diagram. She has to assume the model categories she starts with are combinatorial, but this seems a standard assumption now from the $\infty$-categorical perspective (i.e. assuming presentability). Bergner uses a right Bousfield localization, so you need to assume right properness, or pass to right semi-model categories like Barwick does in this paper. The difference between a semi-model structure and a full model structure is invisible to the underlying $(\infty,1)$-category.
EDIT (in answer to comments): Bergner uses the notation $L_DX$ for the category I called $M$ above. It's the lax homotopy limit. The homotopy limit is the full subcategory where the maps $u$ and $v$ have been forced to be weak equivalences. She does not claim it has a model structure in general, but it does in some special cases, e.g. if $L_DX$ is right proper and combinatorial. This occurs if each of your categories $C,C',D$ is combinatorial and has all objects fibrant, for example. This assumption can be avoided (and Bergner points this out, right after Theorem 3.2 in the linked paper) by using Barwick's method of right Bousfield localization without right properness. The result is a right semi-model structure on $Lim_DX$, and such categories have associated $(\infty,1)$-categories just like model categories do. And Bergner proves that the associated $(\infty,1)$-category is the homotopy limit in the category of $(\infty,1)$-categories, as you'd expect (working in the model of Complete Segal Spaces).
Comment: Where exactly in her paper does Julie Bergner prove that "This category M can be given a model structure where the weak equivalences and cofibrations are levelwise (on each x_i)"?  In Theorem 3.2 she assumes that "L_D X has the structure of a right proper model category" without giving any indications as to its existence.
Comment: This is a little surprising: it sounds like you're describing the Grothendieck construction, which is some kind of (infinity, 2)-categorical pullback, and not the (infinity, 1) categorical pullback. Are you sure your u, v are not required to be weak equivalences of some kind?
Comment: @DmitriPavlov: She gives the indications about existence directly after finishing the proof of Theorem 3.2. Her first sentence there is "Of course, the di±culty in using this theorem lies in the difficulty in establishing
that the model category $L_DX$ is right proper."
Comment: @DmitryVaintrob: u and v are forced to be weak equivalences once we pass to cofibrant objects.
Comment: @DavidWhite: She says there: "In practice, when the conditions of this theorem cannot be verified, we can still use the original levelwise model structure on L_D X and simply restrict to the appropriate subcategory when we want to require u and v to be weak equivalences."  I fail to see how such a claim could possibly solve the problem of constructing the pullback as a model category.


Protein binds to DNA and just stays there, what will happen next?

Question: If I hypothetically make an inactive version of Cas9 or ZFN (that will bind to the DNA but does not apply the cleavage reaction). What will happen after the protein bound to DNA? Will it be stuck in there forever and disrupt the transcription/translation process? Or will it be self-unbound after a while?
Comment: Welcome to Biology SE. You could visit the [tour-page](http://biology.stackexchange.com/tour) for basic informations, the [help-page](http://biology.stackexchange.com/help) for more detailed informations about what [could be asked](http://biology.stackexchange.com/help/on-topic) or [could not be](http://biology.stackexchange.com/help/dont-ask). For formatting tasks in command prompt, visit [this](http://biology.stackexchange.com/help/formatting) help sub-page. Thanks
Answer: All binding reactions are reversible. The binding and unbinding (association and dissociation) are usually in equilibrium. How much of the protein is bound to the DNA and how much time a single molecule spends in the bound state depends on the kinetic parameters. In case of the non-catalytic Cas, the protein may inhibit transcription if it is bound at the promoter. In fact, such inactive variants have been developed and used for targeted inhibition of transcription (Himeda et al., 2015).
If the CRISPR-Cas is blocking a binding site for a transcriptional activator, then the degree of inhibition would depend on the competition between the activator and the CRISPR-Cas-inhibitor for the binding sites. This competition would be dependent on the kinetic parameters as well as the concentration of the competing species.
Similarly, you can design proteins/RNAs that can bind to mRNAs (at RBS in prokaryotes or Kozak sequences in eukaryotes) and inhibit translation.
Another interesting fact: CRISPR-Cas system has been engineered to work like transcriptional activator, as well (Didovyk et al., 2016).


Regular expression for parsing string inside ""

Question:

What should be the regular expression for parsing the string inside "". In the above sample it is 'SystemTemperatureOutOfSpec'
Comment: What have you written so far? We aren't here to do your job for you...
Comment: then look better with Google: there is a lot of question about that exact problem
Comment: check out this question, it looks pretty similar:
http://stackoverflow.com/questions/5412835/regular-expression-value-in-between-quotes
Answer: In JavaScript, this regexp:
/"([^"]*)"/

ex.
> /"([^"]*)"/.exec('')[1]
  "SystemTemperatureOutOfSpec"

Similar patterns should work in a bunch of other programming languages.
Answer: try this
string Exp = "\"!\"";

Comment: Wtf? This is no expression I know of. ;)
Answer: I am not sure I understand your question well but if you need to match everything between double quotes, here it is: /(?<=").*?(?=")/s
Answer: (?<=<A\s")(?<content>.*)(?="\s>)

Answer: Regular expressions don't get much easier than this, so you should be able to solve it by yourself. Here's how you go about doing that:
The first step is to try to define as precisely as possible what you want to find. Let's start with this: you want to find a quote, followed by some number of characters other than a quote, followed by a quote. Is that correct? If so, our pattern has three parts: "a quote", "some characters other than a quote", and "a quote".
Now all we need to do is figure out what the regular expressions for those patterns are.
A quote
For "a quote", the pattern is literally ". Regular expressions have special characters which you have to be aware of (*, ., etc). Anything that's not a special character matches itself, and " is one of those characters. For a complete list of special characters for your language, see the documentation.
Characters other than a quote
So now the question is, how do we match "characters other than a quote"? That sounds like a range. A range is square brackets with a list of allowable characters. If the list begins with ^ it means it is a list of not-allowed characters. We want any characters other than a quote, so that means [^"].
"Some"
That range just means any one of the characters in the range, but we want "some". "Some" usually means either zero-or-more, or one-or-more. You can place * after a part of an expression to mean zero-or-more of that part. Likewise, use + to mean one-or-more (and ? means zero-or-one). There are a few other variations, but that's enough for this problem.
So, "some characters other than a quote" is the range [^"] (any character other than a quote) followed by * (zero-or-more). Thus, [^"]*
Putting it all together
This is the easy part: just combine all the pieces. A quote, followed by some characters other than a quote, followed by a quote, is "[^"]*".
Capturing the interesting part
The pattern we have will now match your string. What you want, however, is just the part inside the quotes. For that you need a "capturing group", which is denoted by parenthesis. To capture a part of a regular expression, put it in parenthesis. So, if we want to capture everything but the beginning and ending quote, the pattern becomes "([^"]*)".

And that's how you learn regular expressions. Break your problem down into a precise statement composed of short sequences of characters, figure out the regular expression for each sequence, then put it all together.
The pattern in this answer may not actually be the perfect answer for you. There are some edge cases to worry about. For example, you may only want to match a quote following a non-word character, or only quotes at the beginning or end of a word. That's all possible, but is highly dependent on your exact problem. Figuring out how to do that is just as easy though -- decide what you want, then look at the documentation to see how to accomplish that.
Spend one day practicing on regular expressions and you'll never have to ask anyone for help with regular expressions for the rest of your career. They aren't hard, but they do require concentrated study.
Answer: Are you sure you need regular expression matching here? Looking at your "string" you might be better off using a Xml parser?
Comment: That's not a valid XML fragment.


Other Mac storage taking up 90GB! Help!

Question: I currently have other storage around 90GB on a 120GB internal drive so pretty much all of it. I have optimised to iCloud and deleted all large extra files and documents etc. However, on the omnidisksweeper it is showing there is 20gb just in updates and 13gb on system but I am unsure what I can delete. Any help will be appreciated!
Comment: Does this answer your question? [How can I figure out what's slowly eating my drive space?](https://apple.stackexchange.com/questions/5353/how-can-i-figure-out-whats-slowly-eating-my-drive-space)
Answer: I woudn't be concerned too much with those two since they are only 33 gigs total. The 90 GB space should be of more concern. I suggest you get Daisy Disk or Grand Perspective to give you a color graphical mapping of your disk drive. These color maps make it easy to see what is hogging your disk drive. Daisey Disk, if obtained from developers site has a free trial.  Grand Perspective is free.
I'm not familar with omnidisksweeper.
Comment: OmniDiskSweeper is the granddaddy of disk browsers, made by Omni Group (OmniOutliner, etc). It orders the whole drive by size, allowing you to drill down, identify, and delete large files. It's just as good as the others you mention.
Comment: @benwiggy  - thanks.  i've heard of Omnidisksweeper but have never used it.  This kind of makes my answer redundent.
Answer: If you have Updates pending, then installing them should remove the packages.
13Gb for the system is to be expected - don't delete anything from there!
Check for iPhone/iPad backups, which get stored in your user Library. You can manage and delete them in iTunes.

Other Mac storage taking up 90GB! Help!


Disable console logging in JWPlayer

Question: JWPlayer outputs a lot of events in the browser console. How do I disable logging entirely?
Answer: It's not a configuration option for JWPlayer.
Right-click on the player (Flash version here), then change the menu option "Logging to ..." until it's "Logging to none".
Answer: While this question is quite old (2012), it is still the first Google result I found when looking for the answer.
Since I found out the answer myself I still want to post it here for other people looking for it:
In the JWPlayer config object there may be a part like this:
<code>{
    playlist   : [...],
    title      : 'Some title',
    ... more options ...

    debug: {
        'levels' : 'all'
    },

    ... more options ...
}
</code>
Simply remove the debug-part completely and it will no longer output to the console (or at least not excessively).

Disable console logging in JWPlayer


Inserting Object ID's into array in existing Mongoose schema with Node.js

Question: I have an existing News articles section that I want to add categories to for more refined searching, my Schema's are as follows:
<code>var ArticleSchema = new Schema({
title: String,
body: String,
author: {
    type: Schema.Type.ObjectId,
    ref: 'User',
    required: true
},
image: String,
catagories: [{
    type: Schema.Types.ObjectId, ref: 'Catagory'
}],
meta: {
    created: {
        type: Date,
        'default': Date.now,
        set: function(val) {
            return undefined;
        }
    },
    updated: {
        type: Date,
        'default': Date.now
    }
}
});

ArticleSchema.statics.search = function (str, callback) {
var regexp = new RegExp(str, 'i');
return this.find({'$or': [{title: regexp}, {body: regexp}]}, callback);
};

module.exports = ArticleSchema;

var CatagorySchema = new mongoose.Schema({
name: { type: String, unique: true },
});

module.exports = CatagorySchema;
</code>
I want a user friendly input for selecting categories (don't even know what is best here, be it check-box's or a simple comma separated text input etc.). My question is what is the best practice for obtaining this kind of input and translating that into the Article Schema (providing the categories exist). If anyone could point me in the right direction it would be much appreciated. Thanks.
Answer: Keep the category names you want to search for in an array
<code>{
  categories: ["cat1", "cat2"]
}
</code>
then you can add an index to it and do a $in query. the current schema is not very good because you cannot look for the category in a single query but need to resolve all the "categories" links first.


With Razer BlackWidow, can you control which keys are backlit?

Question: With Razer BlackWidow, can you control which keys are backlit or is it all keys or no keys are lit?
Comment: Hey Matt. I've removed the "bonus" question about what other keyboards could do this, since shopping questions are off topic and leaving it in would probably have gotten the whole question closed.
Comment: I actually debated this myself but since they are gaming keyboards, I opted for Arqade.
Comment: Wouldn't this be more suitable for SuperUser than here on Arqade?
Comment: The website says "individually lit keys" which would make you think you could set which ones are lit, but I'm not sure how. Is there anything in the manual?
Comment: Are you talking about the BlackWidow Ultimate?  I don't think the "regular" BlackWidow is backlit...
Answer: Short answer:
It's all keys or no keys.  With levels of brightness.
Longer (warranty voiding) answer:
There is no way to customize the brightness of keys individually... Unless you want to mod your keyboard.
As advertised, each key is lit individually meaning there is at least one LED per key.  However, every single one of these LEDs is connected to the same controller, which makes them all do the same thing at the same time.
In order to have individually customizable key brightness you will need to take your keyboard apart, solder things, rewire the LEDs, possibly setup your own controller for each individual key, make sure everything fits, and eventually put everything back together...  cocasdaneve has great instructions for modding the BlackWidow and chart/explanation of how the LEDs are wired.
This mod does not make each key unique, it is, however, a great place to get started.
There are very few keyboards I can think of off the top of my head that have keys that are individually customizable; However, if you are after complete customization and have very deep pockets, check out the Optimus line of keyboards.
Comment: http://www.corsair.com/k70 is backlit and has indivudially customizable keys. although the brightness is the same for every key


Would the fast be invalid?

Question: I have a question, if a woman had a sexual thought and uncontrollably some fluid may have came out because of this (without touching herself) is her fast still valid and would she have to do ghusl?
Answer: Pre seminal fluid does not break one's fasting according to the preferred opinion of jurists. If it was a full ejaculation, then it would.

Would the fast be invalid?


Appropriate datatype for holding percent values?

Question: What is the best datatype for holding percent values ranging from 0.00% to 100.00%?
Comment: Also found this related post: http://stackoverflow.com/questions/1602318/what-should-be-the-best-way-to-store-a-percent-value-in-sql-server
Answer: Assuming two decimal places on your percentages, the data type you use depends on how you plan to store your percentages:

If you are going to store their fractional equivalent (e.g. 100.00% stored as 1.0000), I would store the data in a decimal(5,4) data type with a CHECK constraint that ensures that the values never exceed 1.0000 (assuming that is the cap) and never go below 0 (assuming that is the floor).
If you are going to store their face value (e.g. 100.00% is stored as 100.00), then you should use decimal(5,2) with an appropriate CHECK constraint.

Combined with a good column name, it makes it clear to other developers what the data is and how the data is stored in the column.
Comment: Shouldn't it be `decimal(5,2)` where 2 denotes the number of digits after the decimal separator?
Comment: I assume this originally had `decimal(5,4)` and was changed to `decimal(5,2)` after the above comment... I think `decimal(5,4)` would be the better definition - i.e. you want to store 0 to 1 with 2 decimal places, not 0 to 100. The reason being a percentage is out of 100; so 100% is 100/100 which is 1. Doing it this way makes more sense for most cases (e.g. `100% * 100% = 100%`, not `10000%`; `1 * 1 = 1`).
Comment: @JohnLBevan - It spends on how they are being stored. If the values are going to stored as displayed (e.g. `100.00`) then you need `decimal(5,2)`. If the values are going to be stored as fractions (e.g. `1.0000`), then you need `decimal(5,4)`. Will update the post.
Comment: @BorisCallens - Can't believe I missed that all these years. Yes, that's a typo. `decimal(5,2)` is what should be captured with a check constraint.
Comment: @MichaelHanon - Depends on the requirement. The OP showed 2 decimal places so I assumed that 99.99% and 100.00% are valid values. If you want percents with 0 decimal places, then you can use `decimal(3,2)` to store them as fractions or a tinyint if you are going to store whole numbers.
Comment: Can anyone explain why you need 4 decimal places? Cant you use 2? Like .91===91% or 1.00===100%. I'm implementing this now and was wondering the gain with 4 places. Something like Pct decimal(10, 2) CHECK (Pct>=.01 AND Pct<=1). Thanks in advance.
Answer:
Hold as a decimal.
Add check constraints if you want to limit the range (e.g. between 0 to 100%; in some cases there may be valid reasons to go beyond 100% or potentially even into the negatives).
Treat value 1 as 100%, 0.5 as 50%, etc.  This will allow any math operations to function as expected (i.e. as opposed to using value 100 as 100%).
Amend precision and scale as required (these are the two values in brackets columnName decimal(precision, scale).  Precision says the total number of digits that can be held in the number, scale says how many of those are after the decimal place, so decimal(3,2) is a number which can be represented as #.##; decimal(5,3) would be ##.###.
decimal and numeric are essentially the same thing.  However decimal is ANSI compliant, so always use that unless told otherwise (e.g. by your company's coding standards).

Example Scenarios

For your case (0.00% to 100.00%) you'd want decimal(5,4).
For the most common case (0% to 100%) you'd want decimal(3,2).
In both of the above, the check constraints would be the same

Example:
if object_id('Demo') is null
create table Demo
    (
        Id bigint not null identity(1,1) constraint pk_Demo primary key
        , Name nvarchar(256) not null constraint uk_Demo unique
        , SomePercentValue decimal(3,2) constraint chk_Demo_SomePercentValue check (SomePercentValue between 0 and 1)
        , SomePrecisionPercentValue decimal(5,2) constraint chk_Demo_SomePrecisionPercentValue check (SomePrecisionPercentValue between 0 and 1)
    )

Further Reading:

Decimal Scale & Precision: http://msdn.microsoft.com/en-us/library/aa258832%28SQL.80%29.aspx
0 to 1 vs 0 to 100: C#: Storing percentages, 50 or 0.50?
Decimal vs Numeric: Is there any difference between DECIMAL and NUMERIC in SQL Server?
Comment: Hey @nacholibre; the examples are correct.  The important thing to note is that `100%` is held as `1.00`; not as `100.00`.  i.e. 100% of 5 is 5 => `1 x 5 = 5`.  50% of 90 is 45.  `0.5 x 90 = 45`.  Hope that helps to clarify.
Comment: Hmm, I think your example scenarios are wrong. For `(0.00% to 100.00%)` you need  `decimal(5,2)` and for `(0% to 100%) ` it's better to use int if you don't need decimal points.
Answer: I agree with Thomas and I would choose the DECIMAL(5,4) solution at least for WPF applications.
Have a look to the MSDN Numeric Format String to know why :
http://msdn.microsoft.com/en-us/library/dwhawy9k#PFormatString

The percent ("P") format specifier multiplies a number by 100 and converts it to a string that represents a percentage.

Then you would be able to use this in your XAML code:
DataFormatString="{}{0:P}"

Answer: If 2 decimal places is your level of precision, then a "smallint" would handle this in the smallest space (2-bytes). You store the percent multiplied by 100.
EDIT: The decimal type is probably a better match. Then you don't need to manually scale. It takes 5 bytes per value.
Answer: Use numeric(n,n) where n has enough resolution to round to 1.00. For instance:
declare @discount numeric(9,9)
    , @quantity int
select @discount = 0.999999999
    , @quantity = 10000

select convert(money, @discount * @quantity)

Comment: This question has a fairly high rated accepted answer from over three years ago. If you are looking for old questions to answer, please refer here: http://stackoverflow.com/unanswered


Parallel in Perl for a related serial jobs

Question: I had a perl script to implement a serial jobs that the following job taking previous job's output. I am wondering if I can implement it in parallel? Which module should I use? Thanks.
Comment: Nope, you cannot turn something that requires serial execution magically into parallel execution.
Answer: Based on what you've said thus far I really don't know if this will help you, but just for the sake of trying this documentation can at least provide information on how you would have communication between your processes:
http://perldoc.perl.org/perlipc.html
Furthermore, if you're starting to create parallel Perl software, making sure that you know event driven programming can be very helpful. Here is the AnyEvent module that makes event driven programming very slick and simple:
https://metacpan.org/pod/AnyEvent
But more to your point about suggesting modules for parallel jobs, AnyEvent has a simple wrapper around fork() which could also be useful to your cause. This is the module that specifically deals with getting information back from "children":
https://metacpan.org/pod/AnyEvent::Fork::RPC
If none of that is actually helpful and you just are looking for some simple steps into parallel software writing, this module makes that easy:
https://metacpan.org/pod/Parallel::Simple


How to share same data between multiple activities

Question: I have a login session ID which multiple activities need to use. How do I share this common data between multiple activities? Presently, I'm passing the data in the Intent but it is not working properly. For some activities, I pass some other data, and the common data is lost.
Comment: what you want to pass exactly? And post your code here
Comment: You can either share data via intent or you can make 1 global class and access data through that..sending data via intent is very simple..u just have to put your data in intent.putExtra(suitable datatype) method and share it over multiple activities...
Comment: I have Login in my application in that i'll get sessionid i need to use it across all the activities which ever comeing after login also i need to pass some other data to next activities(including sessionid).Now i'm trying with intent but it's diverting sometimes to other activities.
Answer: Use shared preferences like this:
SharedPreferences myprefs= this.getSharedPreferences("user", MODE_WORLD_READABLE);
myprefs.edit().putString("session_id", value).commit();

You can retrieve this info across your app like this:
SharedPreferences myprefs= getSharedPreferences("user", MODE_WORLD_READABLE);
String session_id= myprefs.getString("session_id", null);

You should use intents when you want to start another activity from your current activity... also if the child activity is totally dependent on data from parent activity ...use intents
Answer:
Use the Application class to share common data.
Use Shared Prefrences or databases or some sort of persistant storage.
Answer: Use Singleton class for sharing.
sample code
public class Category {

    private static final Category INSTANCE = new Category();
    public String categoryName = "";
    public int categoryColor = 0;
    public boolean status = false;
    // Private constructor prevents instantiation from other classes
    private Category() {}

    public static Category getInstance() {
        return INSTANCE;
    }
}

in other Activity/Class for setting the value as:
Category cat;
cat=Category.getInstance();

cat.categoryName="some name";
cat.status=ture;

for getting the values every where you want in your application.
Category cat;
cat=Category.getInstance();

String sq=cat.categoryName;
boolean stat=cat.status;

Answer: You should use sharedpreferences as per below details ,
http://developer.android.com/guide/topics/data/data-storage.html#pref
Answer: After reading doc about SharedPreferences and the nearly to flamewar discussion about Singleton vs Application in android.
I conclude: Please disprove any conclusion

SharedPreferences: Good if you plan to keep only primitives, and easy to keep different parcels.
Parcelable: A low level solution, with a lot of boilerplate code, you can use in Extras
Serializable: If you don't want to bother with Parcelable. See this
Singleton: My choice. Simple, quick and no boilerplate. My contribution is to use a Map inside for flexibility.
public class Config {

    private static Config instance;
    private HashMap<String, Object> map;

    /*Keep doc about keys and its purpose if needed*/

    public static final String TOKEN = "token";
    public static final String SESSION = "sessionId";

    /** A bean with A LOT of useful user info */
    public static final String USER_BEAN = "userBean";

    private Config() {
        map = new HashMap<String, Object>();
    }

    public static final Config getInstance() {
        if (instance == null) {
            instance = new Config();
        }
        return instance;
    }

    public void setKey(String key, Object value) {
        map.put(key, value);
    }

    public Object getKey(String key) {
        return map.get(key);
    }
}

Application: Almost the same as singleton, but for some hide-to-me reason, ease the testing and more android standarized way of doing things.
Answer: I dont know what exactly the code is you are dealing with, but have you tried like this
in your current activity, create an intent
Intent i = new Intent(getApplicationContext(), ActivityB.class);
i.putExtra(key, value);
startActivity(i);

then in the other activity, retrieve those values.
Bundle extras = getIntent().getExtras();
if(extras !=null) {
    String value = extras.getString(key);
}

Answer: One way to do it is to extend Application, and then call getApplication in your activities. This site has some examples.
Comment: bad solution, but it was written long time ago.. so I nudge author to improve it ;)
Answer: The way that I do is that I extend a global class from Activity, and then extend all actual activities that the user will interact with from it. That's how I learned to do it with some "learn to code for android" books I bought.
This is pretty much like using the Application class though.
Comment: What about memory leak ? how do you share data ?
Answer: You can store it in SharedPreferences or in Singleton class.
where i would suggest to use singleton class.

SharedPreferences :

Write value
SharedPreferences mPref= this.getSharedPreferences("session", MODE_WORLD_READABLE);
mPref.edit().putString("session_id", your_session_value).commit();

Read Value
SharedPreferences mPref= getSharedPreferences("session", MODE_WORLD_READABLE);
String sSession_id= mPref.getString("session_id", null);

Singleton class
public class Session {

    private static Session session = null;

    private String mSessionId;

    private Session() {
    }

    public static Session getInstance() {
        if (session == null) {
            session = new Session();
        }
        return session;
    }

    public String getSessionId() {
        return mSessionId;
    }

    public void setSessionId(String pSessionId) {
        this.mSessionId = pSessionId;
    }
}

Write to singleton
Session mSession  = Session.getInstance();
mSession.setSessionId("your_session_id");

Read from singleton
Session mSession  = Session.getInstance();
String mSessionId = mSession.getSessionId();


Converting a rails+nginx webapp to use HTTPS

Question: I am currently doing a web app for my company. Suddenly, we were told to change the server to https. We are using rails + nginx server.
I have made changes to the nginx conf as I read in the nginx wiki:
listen 443;
ssl on;
ssl_certficate .......;
ssl_key ....;

Upon further research, I came to know that I have to make certain changes in the rails . So I installed the ssl_requirement plugin, and added these lines in the config file:
"include SslRequirement"

in my application.rb file. So when I start my server and type the host name, I either get "a plain HTTP request sent" or "This page isnt redirecting properly".
Please tell me where I am going wrong here.
PS : I have to make the entire application https.
Answer: Test your application first by redirecting one of the methods in your application.... as like...
In controller.rb
ssl_required :action_name

thanks.....


Transaction Log Backup Cleaning

Question: If you back up your transaction log every hour through a maintenance plan, why does your log file continue to grow? I would think the system would delete or shrink the log after the backup. Is this something I want to do?
Answer:
Because the size of it is not big enough to handle the size of the transactions every hour.

or

Something is preventing the log from getting cleared after the log backup completes. Check the log_reuse_wait_desc column in master.sys.databases to see why it isn't clearing out.

Consider backing up the transaction logs more frequently than hourly. I recommend every 1-5 minutes.
Answer: Other than the reasons @Tara mentioned, you also need to ensure that your backup succeeds.
Usually you need to ensure two things

There is no open transaction hungup there in the database using dbcc opentran

DBCC OPENTRAN helps to identify active transactions that may be preventing log truncation. DBCC OPENTRAN displays information about the oldest active transaction and the oldest distributed and nondistributed replicated transactions, if any, within the transaction log of the specified database

Before / after each log backup, run dbcc sqlperf(logspace) to see whether the [Log Space Used(%)] column has changed from big to small.

Transaction Log Backup Cleaning


Pawnshop in TN transfered my pawned firearm without my prior consent

Question: I pawned my firearms and the pawnshop had their FFL suspended. They own two stores and, when I went to pay on my pawn, I was told about the suspension, that all firearms had been transfered to their other location, and that I would have to travel almost 40 miles to redeem.
Then I discovered that, when they were transfered, not only had the date changed on when payments/redemption was due, but, they were now charging me more than what I originally borrowed.
Originally, I was to payback $122 on the $100 I borrowed plus $10 for the background check. Now, my payback was just over $200. So it's principal on money I didn't borrow.
They're refusing to adjust the amount. They swear they mailed out letters, however I, nor any other customer I've talked to, received one.
I'm sure the charging for money I didn't borrow is illegal, however, it's the transfer of the weapons without consent that I am most curious about.
I am working on gathering others together and seeking a lawyer to find out what our options are. I would just like to inform other customers of what laws were broken before we do so.
Answer: A financial institution (including a pawnbroker) cannot unilaterally change the terms of an agreement and obeying the law. This section in particular limits the interest rate to 2% per month. It would be illegal and a misdemeanor to raise the interest rate above the statutory limit. They also cannot change (shorten or lengthen) the maturity date of the loan, nor can they obligate you to wait until the maturity date to pay off the loan.
They are in a bit of a bind if they lost their FFL. There is nothing illegal about transferring inventory to another store. They cannot compel you to redeem the item immediately, and you cannot compel them to violate the law and keep the item without the required license.
In case what happened is that you went past the original maturity date because there is no viable public transportation to the new location and you've gone over the 30 day "grace" period (hence the extra charges), you might successfully argue in (small claims) court that the shop is responsible for your tardiness. The fact that the item is located 40 miles away is not per se an unconscionable burden on you, but if it is impossible or very expensive for you to get there because of the new location, they could have some responsibility to mitigate the situation (e.g. give you a ride to and from).
Comment: Thank you for your response. I am working on gathering other customers who are experiencing the same issues. A few lost their firearms because of the maturity date changing. I did see a copy of the letter they sent out. It stated that the firearms could be picked up at their other store, which still has an FFL under one of the partner's names. It said if the firearms pawned were not picked up, they would be transferred. It did not, however, state they would be changing the maturity date or the payback amount. Again, thank you for your helpful response.


How to synchronize two git repositories

Question: I have two git repositories on different PCs. I have some local branches on every one of them. I don`t want to send this branches to remote server, just keep them local. How can I synchronize then without using a web? Can I just zip repository on one PC and move to another? Is that safe? Maybe I can export somehow newest changes from every branch?
Comment: The only difference between the git repository on "the server" (if there is a difference) is that the repo on the server is probably bare.  Think of the other PC exactly the same way you think of the server.
Answer: Rather than making a bare clone, I prefer making a bundle (see "How can I email someone a git repository?"), which generates one file, easier to copy around (on an USB stick for instance).
The bonus is that it does have some of the characteristics of a bare repo: you can pull from it or clone it, but you only have to worry about one file.
machineB$ git clone /home/me/tmp/file.bundle R2

This will define a remote called "origin" in the resulting repository that lets you fetch and pull from the bundle. The $GIT_DIR/config file in R2 will have an entry like this:

[remote "origin"]
    url = /home/me/tmp/file.bundle
    fetch = refs/heads/*:refs/remotes/origin/*

To update the resulting mine.git repository, you can fetch or pull after replacing the bundle stored at /home/me/tmp/file.bundle with incremental updates.

After working some more in the original repository, you can create an incremental bundle to update the other repository:

machineA$ cd R1
machineA$ git bundle create file.bundle lastR2bundle..master
machineA$ git tag -f lastR2bundle master

You then transfer the bundle to the other machine to replace /home/me/tmp/file.bundle, and pull from it.

machineB$ cd R2
machineB$ git pull

Answer: See this blog post "Synchronizing Git repositories without a server " (by Victor Costan).

This post describes a method for pushing changes between two repositories without using a server with network connections to both hosts having repositories

Start up by creating a repository on the USB stick.
mkdir /path/to/usb/stick/repository.git
git clone --local --bare . /path/to/usb/stick/repository.git

Then register the repository on the USB stick as a remote repository, and push the desired branch to it (if you don't want to push master, substitute your desired branch).
git remote add usb file:///path/to/usb/stick/repository.git
git push usb master

In the future, you can treat the USB repository as any other remote repository. Just make sure it's mounted :) For instance, the following pushes new changes to the USB repository.
git push usb

On the receiving end, mount the USB stick, and use a file URL for the repository
file:///path/to/usb/stick/repository.git

A few handy commands:
# cloning the repository on the USB stick
git clone file:///path/to/usb/stick/repository.git
# updating a repository cloned from the USB stick using the above command
git pull origin
# adding the USB stick repository as a remote for an existing repository
git remote add usb file:///path/to/usb/stick/repository.git
# updating from a remote repository configured using the above command
git pull usb master

Comment: Never rely *completely* on an external link: you don't know how long it will last. With http://blog.stackoverflow.com/2009/06/stack-overflow-creative-commons-data-dump/ , that information will be available forever.
Comment: would that first "git clone --local" be better as "git clone --no-hardlinks" to make it explicitly clear that it needs to be a deep copy?
Comment: I believe it would. On OSX, I got unix link-failure errors until I switched that. I also switched to --no-local in the same vein, although I'm not certain it's necessary. Command that worked for me: `git clone --no-local --no-hardlinks --bare . /path/to/repository.git/
`. After that, two of us were able to push and pull like with any other remote.
Comment: @VonC at least we hope it will last forever - there's no guarantee that SO will be about in 10 years time.
Comment: I get `fatal: repository '.' does not exist` at this stage: git clone --local --bare . /path/to/usb/stick/repository.git
Answer: Direct copy of a repository to the other file system is an alternative to bare clone or to bundle.  After copying you can set the copied repo up directly as a local remote - unintuitive as local remote may seem - to fetch and merge into the first repository.
I.e. to merge repo2 from a second computer into ~/repo1, first copy repo2 to the repo1 file system at ~/repo2 (memory stick, network copy, etc.) and then you can use the answer to Git pulling changes between two local repositories:
~/repo1 $ git remote add repo2 ~/repo2
~/repo1 $ git fetch repo2
~/repo1 $ git merge repo2/foo

This works because as the wikipedia article on git says: "A Git repository — data and metadata — is completely contained within its directory, so a normal system-level copy (or rename, or delete) of an entire Git repository is a safe operation. The resulting copy is both independent of and unaware of the original."
Comment: @nutty - Direct copying does work fine for transferring the repo in its exact state and I often do that.  However, for some use cases I find it preferable to be able to pull/merge from one disk location to another (e.g., when I have edited both repo locations and I want to sync them up).  Git is delightfully accommodating in this regard. :-)
Comment: can anyone with more knowledge than me confirm this? @sage if I just want to backup my directory (which contains my .git) by copy-pasting to a USB-stick, would that not be enough?
Answer: I'd just like to add a little twist to things. The information in other posts seems right, but I'd like to mention a few extra things I do in practice.
If I do
git remote -v

I get information like this
USB_F   file:///f/Git_repositories/projectname.git (fetch)
USB_F   file:///f/Git_repositories/projectname.git (push)
USB_G   file:///g/Git_repositories/projectname.git (fetch)
USB_G   file:///g/Git_repositories/projectname.git (push)

Basically I have defined several remotes with USB names rather than just one as suggested since the drive letter allocated to my USB device changes depending on the port I insert it into.
I then run a script with contents like this
cd /path/to/projectname

if [ -d /f/Git_repositories/projectname.git ]
then
    git push USB_F --all
    git push USB_F --tags
fi
if [ -d /g/Git_repositories/projectname.git ]
then
    git push USB_G --all
    git push USB_G --tags
fi

The intention is to push all branches and all tags to the USB repository if it exists and where ever it is. (The -d flag is checking for existence of the git repository directory and conditional code only executes if the directory exists.)
The original question said: I have some local branches on every one of them. I don`t want to send this branches to remote server, just keep them local. How can I synchronize ...
The push -all and push --tags command do this synchronizing, making sure that all the branches and tags are pushed to the USB repository, even new ones that the USB repository was unaware of. There is no defaulting to master or needing to know the names of branches and handling them one by one.
I run this for backup purposes so I've only shown the push side of things, and reduced the number of projects and repositories. In reality I backup multiple projects to multiple locations, but it's only the repeated USB items that are relevant here.
Another thing that is rather obvious but that I have not seen mentioned, is that in order to sync PC A and PC B, you'd need to
1. sync PC A and the USB device
2. sync PC B and the USB device
3. sync PC A and the USB device again!

Or viewed differently, go
PC A -> USB -> PC B
PC B -> USB -> PC A

so that ultimately the branches and tags are the same on the two machines.

How to synchronize two git repositories


What is difference between adit and advenit?

Question: In LLPSI I was introduced to two verbs "adit" and "advenit", but what is difference between them if both of them mean "to go to"? Same to "abit" and "exit".
Comment: Have you checked a dictionary? [adeo](https://en.wiktionary.org/wiki/adeo#Latin) and [advenio](https://en.wiktionary.org/wiki/advenio#Latin) don't both mean "go to".
Comment: @BenKovitz I cannot recommend that at all. Not checking a dictionary is a recipe for trouble in *any* language, but especially one that you're learning. How many people misunderstand the word "morbid" or "travesty"? Suggesting to forego a dictionary is intentionally handicapping yourself with zero benefit.
Comment: @Cairnarvon When I was reading LLPSI, I never checked a dictionary for any word in the book. I gradually found out that my interpretations of words were wrong sometimes, but my memory of every word is well anchored in context! I recommend it, especially if supplemented by asking people when you can't unravel a confusion on your own.
Comment: @cmw When reading words without a context that makes their meanings clear, yes. LLPSI, though, is thoughtfully designed to bring you every new word in a context that makes it clear. This is the main idea of Ørberg's "natural method". Going without a dictionary keeps you from grounding your understanding of the words in your native language. BTW, I never _needed_ to check a dictionary while reading _Familia Romana_ (though a few words had me puzzled for a day or two).
Answer: It sounds like you've figured out that adit and advenit are just it and venit with ad added as a prefix. If you're not clear on the difference between it and venit, see chapter VI, line 20 for it and chapter III, line 21 for venit:

Ecce Iūlius et quattuor servī in viā. Iūlius ab oppidō ad vīllam suam it.

Iūlia plōrat et Aemiliam vocat: "Mamma! Mam-ma!
Mārcus mē pulsat!"
Aemilia venit.

By the way, the first occurrence of each word is listed in the index. Sometimes it's hard to look up, though, because each verb is listed in its infinitive form; e.g. it is listed under īre.
If the difference is still not clear, look at the context of the use of "Venī!" at chapter IV, line 27. Notice that it's not "Ī!"
If, even after looking at these contexts, you're still not sure of the difference, reply in a comment and I'll translate it and venit into English.

With abit and exit, the difference is the preposition. If you're not yet sure of the difference between ab and ex, look up their first occurrences in the index, and if that doesn't work, then reply in a comment and I'll explain that in English, too.

You might be surprised, if you are just starting, to see how easy it is to pick up differences in meaning between Latin words just by noticing the contexts where they occur in LLPSI. Ørberg usually takes care to introduce each new word in a context that makes its meaning especially appropriate or easy to grasp.
Ørberg often includes a marginal note in Latin at the first occurrence of a word. Sometimes, as with ex, the marginal note includes a diagram. Often when people ask me the meaning of a word in LLPSI, I point them to its first occurrence and then we discover that they never saw the marginal note.
Answer: I looks as if Ben Kovitz's answer intends for you to look through your book to infer those word meanings. If you still wish to try that, ignore my answer. Otherwise, here is my take:
I believe that adit means to go towards an extent or a location without external prompting, while advenit means to come towards (hence venit) a physical location with either prompting or some form of intention. Of course, that ad in the front of these words means "to/towards".
Abit and exit just have different prepositions attached to them. The preposition ab means "away [from]", while ex means "out of". They simply imply different situations, and will be more appropriate for some than others.
In conclusion, their translations would be:

adire, to go towards
abire, to go away from
exire, to go out of
advenire, to come towards

I have put advenire at the bottom to differentiate it, as it has a different "stem".
Hope that this helps!


How to plant avocado tree outside?

Question: Avocado tree is approx. 24" with numerous leaves at the top.
How should I plant it outside (big pot because they say Seattle soil isn't good)?
Do I need to bring it in in the winter?
Answer: There is advice at California Avocados:

Remember that avocado trees do best at moderately warm temperatures
(60-85F) with moderate humidity. They can tolerate temperatures, once
established, to around 32-28F with minimal damage. Avoid freezing
temperatures.
Plant your tree from March through June. If you plant during the
summer, there is always the risk of sun damage, because the avocado
trees can't take up water very well when young. Plant in a non-lawn
area, and away from sidewalks. And if you can, plant your tree in a
spot protected from wind and frost. Remember, full sun is best.
Dig a hole as deep as the current root ball and just as wide as the
width plus a little extra so you can get your hands into the hole to
plant it. The avocado is a shallow-rooted tree with most of the feeder
roots in the top 6" of soil, so give it good aeration. Its root system
is very sensitive and great care should be taken not to disturb the
root system when transplanting. If the tree is root-bound, however,
loosen up the soil around the edges and clip the roots that are going
in circles.
Soil
Avocado trees like the soil pH around 6-6.5. If you have a heavy clay
soil, elevate the tree in a mound for better drainage. Make the mound
1-2 feet high and 3-5 feet around.
Don't put gravel or anything else like planting media in the hole. The
sooner the roots get out into the bulk soil, the better the tree will
do.
Watering
Typically trees need to be watered 2-3 times a week. As the roots
reach out into the bulk soil, more water can be applied and frequency
of watering diminishes to about 1 time per week by the end of a year.:
When watering the tree, soak the soil well, then, allow it to dry out
somewhat before watering again. Of course, like most plants, you don't
want the tree to get too dry! The rule of thumb for mature trees is
about 20 gallons of water a day during the irrigation season.
Seedlings will require quite a bit less water, of course. Check the
soil before watering each time to make sure it has dried somewhat. If
the soil from around the roots can still hold the impression of the
hand when squeezed, it still has enough water.
Mulching and Fertilizing
Mulch with coarse yard mulch. Redwood bark will work or cocoa bean
husks and shredded tree bark. Choose something that is woody and about
2 inches in diameter. Coarse yard mulch is available at some garden
supply centers or through tree trimming operations. They sometimes
have material that has been pruned from the tops of trees and don't
contain any diseased roots. Use the yellow pages to find a local tree
service.
Put 20 pounds of gypsum spread around the tree base and mulch the area
with 6 inches of the mulch, keeping the material about 6-8 inches away
from the tree trunk.
Fertilize your young avocado trees with1/2 -1 pound of actual Nitrogen
per tree per year. You can spread it out over several applications as
long as it totals 1/2 to 1 pound of Nitrogen. The other important
nutrient for avocado trees is Zinc. Ordinary home fertilizer for
houseplants normally should work. Back to top Other growing tips
Be patient about seeing fruit. If you have purchased and planted a
tree, you can probably expect to see your first fruit 3-4 years after
planting. If you are growing from seed, it can take anywhere from 5 to
13 years before the tree is mature enough to set fruit. When the tree
does flower, expect a lot of flowers to fall from the tree without
setting fruit. This is natural.

However, I suspect you are around Zone 8b (plants hardy down to 15 to 20 degrees) and that is too cold for an avocado to stay outside. Yet your avocado won't appreciate being dug up every winter. So you would really need it to be in a pot so it can be relocated, without much root disturbance, to a warmer location, such as a greenhouse. Back indoors might not suit both because of the climate change (eg possibly too dry), likely reduction in sunlight and, possibly, sheer size.
On balance I fear growing avocados in Seattle does not promise much prospect of success.
Comment: I had 2 large ( 8 ft + ) potted avocado trees grown in a green house. They could not tolerate zone 9A ( Houston TX).

How to plant avocado tree outside?


IP Addresses for Domains and their Subdomains the same?

Question: I would like to know. When a domain example.com has an IP address: 22.214.171.124, would any of its subdomains (sub.example.com, mail.example.com etc) have the same IP address listed in the DNS records? Or does it work like this: A request is sent from the browser to the DNS server for sub.example.com. The DNS server returns the IP address for example.com, and the split/differentiation is made when the request for sub.example.com hits the example.com host server? So the host server basically know what to do with sub.example.com and not the DNS server?
Answer: It can kind of be a combination of both.  Ultimately, though, the decisions are made based on what you set your DNS settings to be.  Your host (or hosts) will then get whatever traffic you determined they should get in your DNS settings.
So for example...
You can set your DNS settings to take [anything].example.com and always direct that to your server.  You would do this by adding a wildcard entry to your DNS subdomains.  Wildcard entries use a * symbol to mean "anything".  You would then need to configure your server to know what to do with all these different potential subdomains it could be receiving.
At the same time, you can set specific subdomains to go to other hosts.  For example, if you wanted mail.example.com to go to some other webmail host, you would set up in your DNS the subdomain "mail" and have that traffic redirected to wherever you were hosting your webmail.
Comment: No, the DNS settings are all done at your domain name registrar.  Like GoDaddy, NetworkSolutions, Register.com, etc...
Comment: Thank you, but that kinda answer one part of my question, you just explained to me what happens once the request hits the host server. What happens when the request for sub.example.com is passed to a user's browser and in turn passed to that user's ISP DNS server? what IP will it assign? The IP for example.com?
Comment: It will assign the same IP as example.com if you have set in your DNS for that to be the case.  However, if you've set the IP for sub.example.com to go somewhere else, the traffic will go somewhere else.  The host for example.com won't be involved at all.
Comment: oh I see, so the DNS settings you talk about is set on your host web server right?


How to solve a time delay from an FIR filter?

Question: I have designed a FIR high-pass filter $\{h_n\}$ with length 257 to filter a signal $\{f_n\}$ with length 512. To convolve signal with filter in time,
I performed an FFT with length 768, padding zeroes at tail of $\{h_n\}$ and $\{f_n\}$, and then I multiplied their frequency responses $\{H_n\}$ and $\{F_n\}$ . To convert it back to time I performed an IFFT producing a filtered signal $\{\tilde{f}_n\}$.
However, $\{\tilde{f}_n\}$ has a time shift comparing to the origin signal, and their amplitudes also have a deviation.
I know there is an 'Overlap-Add Method' to solve this problem, but my calculation resources are limited.
Is there any method to solve such problem using minimal times of FFT/IFFT?
Comment: To make any filter minimum phase, simply take all of the zeros in the z-domain that are outside the unit circle and replace them with zeros at the location of their reciprocals. Same frequency response but smaller group delay
Comment: What do you mean "their amplitudes have a deviation?" Also, the time-shift may simply be inherent in the group delay of your filter, so one thing you could do is try the minimum-phase version of your filter.
Comment: 1. Did you take care of the FFT shift operations while doing IFFT/FFT?
2. Did you take care of the fact that **multiplication in the frequency domain** is **circular convolution in time domain** (not linear convolution)? 3. What tool are you using for this experiment? Matlab?
Answer:
However, {f~n} has a time shift comparing to the origin signal, and their amplitudes also have a deviation.

Any causal system has a non-zero group delay. That's to be expected from systems theory!
So, yes, you've got a shift. And, unless your ${h_n}$ is a linear-phase filter, that delay isn't even constant for different frequencies.
This has nothing inherently to do with your method of convolution – it's just how the math works out.
If your filter is a linear-phase filter, then you can just time-shift the result back by half its length to compensate the group delay.
The usual way, however, is simply to be aware of the math behind all this and to work with the signal knowing that filtering is an operation with a group delay.


I have no internet access on my laptop. I have a private ip 169.252.x.x

Question: I have a windows 10 Asus x555lab and I have connectivity issues to both my university network and my home network.  I have a private ip address 169.254.253.110 and no default gateway.  I know this is to do with the DHCP but on two different networks? I have tried restarting everything. Renewing ip address etc
Comment: 169.254.0.0/16 is a link-local (i.e. self-assigned) IP address. Check your DHCP settings. If you're on wireless, try wired, and vice versa.
Comment: Title says 169.252.x.x, question body says 169.254.253.110. Did you mean 169.254.x.x in the title? Note: You can [edit] your question to fix this, and please do. 169.252 is a real, globally routable, assigned IP range (184.108.40.206/15, or 220.127.116.11 through 18.104.22.168, is assigned to the US Department of State as of today).
Answer: I have no internet access on my laptop
Try reinitialising the network states. Run the following commands in an elevated cmd shell:

Reset WINSOCK entries to installation defaults:
netsh winsock reset catalog

Reset TCP/IP stack to installation defaults:
netsh int ip reset reset.log

Reset Firewall to installation defaults:
netsh advfirewall reset

Flush DNS resolver cache:
ipconfig /flushdns

Renew DNS client registration and refresh DHCP leases:
ipconfig /registerdns

Flush routing table (reboot required):
route /f

Further Reading

An A-Z Index of the Windows CMD command line - An excellent reference for all things Windows cmd line related.
ipconfig - Configure IP (Internet Protocol configuration)
netsh - Configure Network Interfaces, Windows Firewall, Routing & remote access.
route - Manipulate network routing tables. Route packets of network traffic from one subnet to another by modifying the route table.


Volume enclosed by $(x^2+y^2+z^2)^2 = a^2(x^2+y^2-z^2)$

Question: My math problem is the find the volume enclosed by the surface
$$(x^2+y^2+z^2)^2 = a^2(x^2+y^2-z^2)$$
I used spherical coordinate substitution,
$$\left\{\begin{matrix}x=\rho\cos{\phi}\cos{\theta}\\ y=\rho\cos{\phi}\sin{\theta}\\ z=\rho\sin{\phi} \end{matrix}\right.$$
which gives me $\rho = a \sqrt{\cos{2\phi}}$.
So then I tried evaluating the integral:
$$V=\int_{0}^{2\pi}\int_{-\pi/4}^{\pi/4}\int_{0}^{a\sqrt{cos2\phi}}\rho^2\cos{\phi} \space \space d\rho d\phi d\theta$$
which gives me $\frac{\pi^2a^3}{4\sqrt{2}}$. However, when I plot the surface in a graphing calculator, it seems like the surface likes like a horn torus and the volume should be $V=2\pi^2r^3=\frac{\pi^2a^3}{4}$. Why would I have the extra $\sqrt{2}$ in the denominator? Did I setup my integral incorrectly?
Comment: It is NOT [a horn torus](https://mathworld.wolfram.com/HornTorus.html). That has cross-sections formed by two circles touching at the origin. Your surface has cross-sections that look like [a lemniscate](https://mathworld.wolfram.com/Lemniscate.html).
Comment: More importantly (IMHO), why did you think it would be a horn torus? There are infinitely many different shapes. The next exercise may always involve a shape you have never seen earlier. It is not the point of these exercise to build you a database of shapes containing every possible shape in use. Learning a method for calculating the volume is more important than the formula you end up with.
Comment: I didn't mean to "build a database of shapes" in my mind. It's just that when I put the surface into a graphing calculator, it looks like a torus to me at first, so I had doubts about my answer. But thank you for your comment anyway. :)
Comment: Using symmetry, the volume is equal to eight times the volume of the first octant,let $ x=\rho \cos \theta \sin \phi,y=\rho \sin \theta \sin \phi,z=\rho \cos \phi $,In the first octant, $ \frac{\pi}{4}\leq \phi \leq \frac{\pi}{2} $
Answer: In spherical coordinates, the surface is
$$r^2= a^2(1-2\cos^2\theta)\>\>\>\>\>\theta\in [\frac\pi4, \frac{3\pi}4]$$
The volume integral is then
\begin{align}
V& =2\pi \int_{\frac\pi4}^{\frac{3\pi}4}\int_0^{r(\theta)}r^2\sin\theta drd\theta \\
& = \frac{2\pi}3 a^3\int_{\frac\pi4}^{\frac{3\pi}4}
(1-2\cos^2\theta)^{3/2}\sin\theta d\theta \\
 & \overset{t=\cos\theta }= \frac{2\pi}3 a^3\int_{-\frac1{\sqrt2}}^{\frac1{\sqrt2}}
(1-2t^2)^{3/2}dt \\
 & = \frac{2\pi}3 a^3 \cdot \frac{3\pi}{8\sqrt2}=
 \frac{\sqrt2\pi^2}{8}a^3\\
\end{align}


Are ARMA-GARCH-type models suitable for monthly data?

Question: I understand that ARMA-GARCH models and their variations are usually applied to daily time series. While I know that such models can be also estimated on monthly data, I have seen few applications in the literature. Is there a specific reasons why such models are not common for monthly data? If so, which kind of models (for the mean and the volatility) can be used, in general as alternative?
Comment: Typically, there isn't enough monthly data to estimate a reasonable ARMA-GARCH model. However, if one can trust certain aspects of certain previous studies, estimation can be achieved in a [Bayesian fashion](http://stanfordphd.com/Bayesian_Statistics.html). More generally, some form of regularization can be applied.
Answer: Technically there is no reason to avoid ARMA-GARCH for low-frequency (e.g. monthly) data. When Robert Engle introduced the ARCH model in 1982, his application was on quarterly data of inflation.
Different but no less important questions are

whether ARMA and GARCH patterns in monthly data are statistically prominent

and/or

whether they are interesting from the subject-matter perspective.

Regarding 1., the phenomenon of momentum in stock prices suggests ARMA can be relevant. I am not sure if volatility clustering is prominent in monthly stock returns; I suppose not as much as for daily ones. Cont "Empirical properties of asset returns: stylized facts and statistical issues" (2001) mentions volatility clustering in daily and sometimes weekly data but he stops there.
Regarding 2., I do not know.


Mac status bar item but not on Dock

Question: I'm trying to make a java application on Mac that puts an icon in the status bar, but I don't want the jar icon on the Mac dock (the one that has the coffee cup on the paper). So I tried to use the System.setProperty(java.awt.headless, true) technique, but then I can't put anything in the SystemTray menubar because I get an HeadlessException. If anybody knows a way to get around this, help would be appreciated.
Comment: Because of the "headlessexception", I'm wondering if this is something that ***cannot be worked around*** because of Apple security concerns (i.e. the potential of silent & malicious Java apps being spawned by infected web sites).
Comment: Ideally, you'd want your app to be a "UI element". For a Cocoa app, that would mean having the `LSUIElement` key in the Info.plist, set to 1. Don't know about for a Java app.
Comment: By "status bar" you mean menu bar?  You can obviously change the dock icon but I don't know of any way to programmatically remove the dock icon.  That requires native Cocoa code and admin privileges.
Comment: I just figured that if other apps can do it and you can remove both, you can remove just one.I feel like that would make sense considering if it was a security reason, they wouldn't let you do both.
Answer: it's easy... if you know how :)
first wrap your jar file in a mac application bundle

either use the "jar bundler" app that comes with the mac developer tools
or use the -unrelated- jarbundler ant task http://jarbundler.sourceforge.net/

then go into the contents of your generated package and open the info.plist.
there just add the LSUIElement property and set it to 1. this removes the application from the dock when started.
also see the apple docs here: http://developer.apple.com/library/ios/#documentation/general/Reference/InfoPlistKeyReference/Articles/LaunchServicesKeys.html

for completeness: there's also another way to do this, but it's much more painful.
there is a cocoa command that allows you to show/hide the dock icon dynamically:
SetSystemUIMode (https://developer.apple.com/library/mac/#documentation/Carbon/reference/Dock_Manager/Reference/reference.html)
you could either try to call this command using rococoa or write your own jni lib.
alternatively i would have an xcode project which does something very similar -hide the menu bar- in my github account: https://github.com/kritzikratzi/jAppleMenuBar/
you'd only have to change some parameters in the src/native/jAppleMenuBar.m file.
Comment: Thank you so much! This was a big help.
Comment: Pretty cool, but now as an unintended side-effect, when I try to launch the app when it's already running, it doesn't launch. Is there a way to know in the originally running app when someone tries to launch it again? I want to open the UI if they double click the app when it's already running.
Comment: either dig through eawt [1] and/or lwawt [2]. those are classes for osx that come bundled with the jdk for mac (disable forbidden references in your IDE).

or see if you can implement NSApplicationDelegate [3] (eg using Rococoa)

LINKS:
[1] http://hg.openjdk.java.net/macosx-port/macosx-port/jdk/file/65910faed942/src/macosx/classes/com/apple/eawt
[2] http://hg.openjdk.java.net/macosx-port/macosx-port/jdk/file/65910faed942/src/macosx/classes/sun/lwawt
[3] https://developer.apple.com/library/mac/documentation/cocoa/reference/NSApplicationDelegate_Protocol/Reference/Reference.html
Answer: This avoids anything in the dock:
<code>System.setProperty("apple.awt.UIElement", "true");
</code>
And this adds the tray icon, as shown in https://docs.oracle.com/javase/tutorial/uiswing/misc/systemtray.html
<code>//Check the SystemTray is supported
        if (!SystemTray.isSupported()) {
            System.out.println("SystemTray is not supported");
            return;
        }
        final PopupMenu popup = new PopupMenu();
        final TrayIcon trayIcon =
                new TrayIcon(createImage("images/bulb.gif", "tray icon"));
        final SystemTray tray = SystemTray.getSystemTray();

        // Create a pop-up menu components
        MenuItem aboutItem = new MenuItem("About");
        CheckboxMenuItem cb1 = new CheckboxMenuItem("Set auto size");
        CheckboxMenuItem cb2 = new CheckboxMenuItem("Set tooltip");
        Menu displayMenu = new Menu("Display");
        MenuItem errorItem = new MenuItem("Error");
        MenuItem warningItem = new MenuItem("Warning");
        MenuItem infoItem = new MenuItem("Info");
        MenuItem noneItem = new MenuItem("None");
        MenuItem exitItem = new MenuItem("Exit");

        //Add components to pop-up menu
        popup.add(aboutItem);
        popup.addSeparator();
        popup.add(cb1);
        popup.add(cb2);
        popup.addSeparator();
        popup.add(displayMenu);
        displayMenu.add(errorItem);
        displayMenu.add(warningItem);
        displayMenu.add(infoItem);
        displayMenu.add(noneItem);
        popup.add(exitItem);

        trayIcon.setPopupMenu(popup);

        try {
            tray.add(trayIcon);
        } catch (AWTException e) {
            System.out.println("TrayIcon could not be added.");
        }
</code>

Mac status bar item but not on Dock


Redox reactions

Question: First semester chem student and I am wondering about redox reactions. For example, when copper is oxidized by silver ions in the reaction:
Cu + 2Ag+(aq)----->Cu2+(aq) + 2Ag(s) what is causing the copper to transfer 2 electrons (oxidize) to the silver ? At first I thought this was an ionic bond but learning that metals dont combine, that is not true. Does the transfer of electrons always imply a bond? If not, what causes this oxidation reaction, oxygen? And if so why isnt it written in the reaction itself? Fundamental I know, but I am trying to understand this.
Answer: There is no bond between them. If you dip Cu wire in AgNO3 solution then silver just deposits on top of Cu. The standard explanation involves the "activity of metals" and the redox potentials. In a sense it is similar to a question "why reaction 2NaI + Br2 -> 2NaBr + I2 goes in forward direction, but not the other way around?"
Please read a chapter on redox potential. Please ask a new question if something remains unclear.
Comment: Hi @Sixtytrees Thanks so much for the answer! Weirdly I can't find anything further about redox potential in my book (chemistry the central science 13e.d Brown). It simply talks about redox reactions but nothing about the actual redox potential or the science that explains it in what factors affect the potential. Again im in 1st semester chemistry perhaps this is an advanced topic? Secondly, in my original question does the aqueous solution (specifically the oxygen) have play any role in redox reactions that causes the copper to transfer electrons to the silver. Thanks in advance!

Redox reactions


Weird shadow behavior on mesh

Question: I have some weird shadows on my objects. More specific it changes when the angle of view has changed. You can see in the first image the middle cushion is lightened and in the second image is darkened. In the middle view is the same as the others but the problem appears on the sides of the couch. I had checked already the normals (face orientation), double vertices, double faces, I don't have any modifier, smooth shading in the entire object is on, the material is simple as you can see in the fourth image, I have turned off the ambient occlusion, the size is close to normal size of a couch, I have only a point lamp (power 1000w size 1m). In the last image, you can see the appearance of the object in edit mode in render view.
I have windows 10 64 - blender 2.82
I can't get what it causes this issue.

[2

Thanks in advance
Comment: I have added the blend file with textures (compressed to reduce the file size) I had checked for double faces.
Comment: Did you check for duplicated faces? Is your camera's frustrum appropriate? If you could post your file it would be helpful https://blend-exchange.giantcowfilms.com/
Comment: It's a shame the three cushions are a single mesh, otherwise you could have flipped one over to make all three look the same. : )  If you rotate the entire cushion object so the bottom becomes the top, the light-dark-pattern gets inverted. But only if you rotate it around the x-axis, not if you rotate around the y-axis. It made me think it was a normal map UV problem but (as far as I can tell) those seem fine at first glace. (maybe they warrant closer inspection though)
Answer: Wrong color space for the normal map
First of all you have some object with the normal pointing inside the surface, you can enable the Face Orientation overlay to spot them. I suggest to fix them by recalculating the normals.
Your node setup would be correct if you were using a common Normal Map you can find around the web. Your normal map has been baked with different settings, as you can easily spot by comparing the shades of blue between yours (on the left) and another normal map made from a professionist.
Your is simply baked in another color space. You should ask the person who did it which one exactly is, but if you switch to sRGB instead of Non-Color, all seems fine, so we can assume sRGB is the one.

Here's some normal map from the web: your nuance is clearly lighter.

Solution:
Change this parameter.
Comment: You can find more ingo at https://www.creativeshrimp.com/normal-map-blender-tutorial.html
Answer: The weird shading was caused due to wrong UV unwrapping . The middle one is unwrapped wrongly unwraped:
It cant be corrected in blender as far as I know . I guess the textures was created in substance painter . So you gotta unwrap your mesh properly and redo it in substance painter (if i am right)
Comment: Both suggestions are interesting. I have baked them in Blender 3D, so I will unwrap them properly (the same direction for all parts) and I will try to find which settings are suitable for normal baking through the blender. I will keep you informed.
Answer: Thanks, Carlo
That worked
I will choose the Non-Color in the baking image slot and I can keep it for the final object as Non-color or I will turn it in sRGB in the final object as you mentioned.
I will keep the different directions of UVs for a variety.

Weird shadow behavior on mesh


Is it possible to simulate Iphone 3g?

Question: my question is: with the simulator, is possible to simulate the other type of iphone?(3g, 3gs) or only iphone 4?
Thanks
Answer: iPhone Simulator only simulates a small portion of the software. It does not emulate hardware at all (otherwise it would have been called iPhone Emulator).
The only way to test your apps on real-world hardware constraints is to get a paid program account and install your apps on real devices.
Answer: Because the hardware differences between the iPhone 3G and the 3GS doesn't affect in the test of applications. The simulator doesn't limit memory usage or CPU speed based on what hardware you've selected, the accelerometer cannot be simulated, so the only difference of consideration is the screen size, that changes between iPhone 4 and 3G/3GS, but not between 3GS and 3G.
Good luck!
Answer: No, it's not possible. If you try to detect device type on simulator with the following code it'll never return you any version except 'iPhone Simulator'.
<code>#import <sys/utsname.h>
+ (NSString *)getDeviceType {
  struct utsname systemInfo;
  uname(&systemInfo);

  return [NSString stringWithCString:systemInfo.machine
                            encoding:NSUTF8StringEncoding];
}
</code>

Is it possible to simulate Iphone 3g?


Send a single mail to fundraising responsible

Question: I want to send a single mail to a responsible address when a certain event occur in my extension.
I had a look to some API (Email, Mailing, MailingAB) but but none of these seem to be the right one.
There is an API or a class I can use to send mails?
Answer: The Email API extension will have example code for you to use for your extension.  Its code is available on github: https://github.com/CiviCooP/org.civicoop.emailapi
Answer: Finally I used the following code for send a mail:
<code>    $mailParams = array(
        'groupName' => '...',
        'from' => '...',
        'toName' => '...',
        'toEmail' => '...',
        'subject' =>  '....',
        'text' => ''....,
    );

   $result = CRM_Utils_Mail::send($mailParams);
</code>
Answer: You may want to have a look at the extension CiviRules that allows you to configure triggers, conditions, and actions such as sending out an email on a certain event.
Comment: Thanks Fabian, I'm writing my own extension, so I would like to send an email regardless of the presence of CiviRules extension.
I looking for a code example, an API or a Class call, usefull for sending a mail.
Answer: Take a look at this extension that Sarah Gladstone wrote. It sounds similar to what you're doing and you might be able to get some example code from it.
https://github.com/sgladstone/com.fountaintribe.scheduledcommunication


What is the difference between damping and friction?

Question: What is the difference between damping and friction? Both of them slows down any moving system. So what's the conceptual difference between them?
Comment: You're right. From one point of view, friction is a particular type of damping. That said, in more advanced contexts people say "friction" to mean "damping".
Comment: Who said there were a difference?
Comment: They are different terms. arent they ?
Comment: Damping, as in your link, usually refers to the $x'$ term in $mx''-bx'-kx=0$ (here, spring-mass-damper model). It refers to viscous friction, either caused by hydraulics or air resistance. Friction, on the other hand, is independent of velocity (Coulomb's law of friction) and most often refers to the resistance between two solids moving against each other (cars on the road, boxes on inclined planes, etc.).
Answer: They are entirely different concepts. Your question is like asking "What is the difference between "temperature" and "weather"?" The term "damping" in physics typically refers to an effect that causes a reduction in the rate at which some process takes place. For the case of harmonic motion this can result in a reduction (over time) of the amplitude of a harmonic oscillation. "Friction" typically refers to a (dissipative) force acting on a system. Friction can be the cause of damping in a system.
Answer: So there are different kinds of damping on simple harmonic oscillators, but the most common type is a force linearly proportional to velocity acting in the direction opposite to the direction of motion of the oscillator. This works for a vertically oriented spring with an object hanging at the end, since that single damping force is drag, which is a type of friction for objects moving in fluids, but for that same unit oriented horizontally on a surface, there is additional kinetic friction between the surfaces opposing the motion of the object. That means there are multiple distinct 'damping forces', one drag and one of kinetic friction, and so the usual model of a damped oscillator no longer works.
In other words, different kinds of friction can be forms of damping.


Word for something post-contextualisation

Question: Let me use an analogy to clarify what I mean. You obtain 2000 user inputs from a survey. You have data. This data becomes information when it is processed, contextualized and understood in a particular setting. Is there a phrase / word communicative of this transition from data to information?
Comment: Your terms *process*, *contextualise* and *understand* are good candidates for the transition you describe.
Comment: The title asks for a word denoting the transformed data (which is _information_ as per the body of the question), the body asks for a word denoting the _transition_. Which one do you actually seek?
Answer: This Wikipedia article uses the word infer to describe the process of transforming data to knowledge.
They quote from Organizing Knowledge: An Introduction to Managing Access to Information:

"Information is inferred from data"


Show system files / Show git ignore in osx

Question: By default it is not possible to see .gitignore files in osx. What is command to reveal these files?
Answer: Open the terminal and type

on OS X 10.8:
defaults write com.apple.Finder AppleShowAllFiles TRUE

on OS X 10.9:
defaults write com.apple.finder AppleShowAllFiles TRUE

Then you must relaunch finder:
killall Finder

Any file name in OS X prefixed with a '.' is considered "hidden".
Comment: This command will show all hidden files, is there a way to actually make the specific files always visible ?
Comment: @CanPoyrazoğlu lower vs uppercase "F" in `com.apple.Finder`
Comment: See prodigitalson's answer.
Comment: So there is no way to make it global unfortunatelly, thanks @snarf
Comment: Check out [this post](http://apple.stackexchange.com/a/115009/77639) on AskDifferent that has AppleScript for toggling hidden files. You can use Automator to create a service that runs that script and assign a keyboard shortcut to that service so you can quickly toggle on and off hidden files.
Comment: This command isn't working on Yosemite or El Capitan.This is the right answer http://stackoverflow.com/a/29219426/1803863
Comment: Even after showing hidden files, if your are not able to found .gitignore file then simply in terminal type `touch .gitignore` in this directory. This will create new gitignore file.
Comment: just out of curiosity, what is the difference between the commands for OS X 10.8 and 10.9? they look exactly the same, am I missing something?
Comment: You can also restart the finder by going to Apple -> Force quite -> Finder -> restart
Answer: You can use the shortcut in Finder:
Command + Shift + .
It will show the hidden files.
To hide the files again, use the same shortcut.
Comment: Thank you! This should be number 1 here.
Comment: This is the only thing that worked for me (on catalina)
Comment: Thank god for this, deffo should be number 1
Answer: ⌘⇧. will toggle the AppleShowAllFiles setting.
This key combo will work from open/save dialogue boxes in all apps, not just the finder. Use this and you'll never be confused when on someone else's Mac or a new Mac, and you can avoid mucking around with defaults write.
I use the nemonic of "use a dot to show a dot file" to remember it, because of hidden dot files in unix.
Comment: Much better because of "Use this and you'll never be confused when on someone else's Mac or a new Mac".
Answer: if you just want to look at them you can always use the command line:
ls -al path/to/dir
If you want to always view all files from the finder you can do:
defaults write com.apple.Finder AppleShowAllFiles YES
If you just want to view a .gitignore from the finder you can:
chflags nohidden /path/to/dir/.gitignore
But youll have to call that command on every .gitignore its not global.
Answer: (more recent, for 10.10.2:)
The above commands didn't work for me. I'm using OSX Yosemite: 10.10.2.
This worked though:
defaults write com.apple.finder AppleShowAllFiles -boolean true;
killall Finder;

Source:
http://www.idownloadblog.com/2014/08/04/how-to-show-hidden-files-folders-finder-mac/
Comment: hey there thanks for the post.  If someone is trying to use this, then I had success using the following command line: "defaults write com.apple.finder AppleShowAllFiles -boolean true ; killall Finder".  Otherwise, it does not work.
Comment: Is there a way to show just the file starting by dot "." but not the system file?
Answer: You can edit hidden file in terminal using this command
open -a TextEdit .gitignore

Answer: If you just want to view a .gitignore from the console just type "nano .gitignore" in that directory. This command "nano" simply opens any textfile in nano console environment for viewing or editing
Answer: In addition to the accepted answer, you can create an alias to easily show/hide the hidden files in Terminal. This is how I set it up (tested/working on macOS Mojave 10.14.1).
In my user directory I created a new file .custom_aliases and wrote this in:
# Show/hide files
alias showall='defaults write com.apple.finder AppleShowAllFiles -boolean true; killall Finder'
alias hideall='defaults write com.apple.finder AppleShowAllFiles -boolean false; killall Finder'

Next I opened .bash-profile (should also be in your user directory, if not just create it there) and added this to the top of the file:
# Load custom aliases
source ~/.custom_aliases

And that's it! Now whenever I need to view the hidden files I just type showall in Terminal and hideall when I'm done. You could also define the aliases directly in the .bash_profile, but I have some other stuff so I like to keep all the aliases together in a separate file.
Answer: Show hide file and folder on MacOs Mojave 10.14.4

Apply at Terminal

defaults write com.apple.finder AppleShowAllFiles -boolean true;
killall Finder;

Answer: It's possible you might just not have a .gitignore file. If you don't have one, you can create it like this:
>touch ~/.gitignore

And then edit it however you'd like. Git will automatically check this file, without any additional configuration!


Group Policy is blocking exe files

Question: I teach programming in Visual Studio. We want to run it on a terminal server. The problem is that whenever we compile our programs, the Windows refuses to start the created exe file. (I didn't even know the ability to block all exe files exists. And it is not very funny when we do programming.) A message box is shown, saying that running exe files is blocked by group policy. It applies to both .NET and plain Win32 exe programs. The problem is that our IT administrators say they don't know why does this happen and how to turn the blocking off. Can anybody help?
Answer: First off, I hope your terminal server is a virtual machine. Before you continue, make sure you have a clean snapshot of the VM. One of your students will take advantage of the ability to run arbitrary applications and screw up your server. You should revert to the snapshot periodically, and always revert immediately before applying patches or installing or upgrading software. Then take a snapshot after that's done but before anyone can use the server. That way when some hoses your server, all you have to do is revert the snapshot.
There are a couple of ways to restrict programs from running.

In group policy, there are two areas to look under Policies -> Windows Settings -> Security Settings: Application Control Policies and Software Restriction Policies.
There is also the RestrictRun registry key.
And finally, third-party applications can use the registry key Appinit_DLLs.
Comment: I believe in Server 2008 r2 you can be being blocked by either SRP (as @longneck mentioned above) or AppLocker which was introduced in 2008 R2. Ask your IT administrator to check for either of those in Computer policy -> Windows Settings -> Security Settings -> Application Control Policies ; or RSOP with admin privs
Comment: If your machine is in a domain, and if you do use VM snapshots (or anything like it) to revert the machine to an earlier state, make sure you disable automatic machine password change...
Answer: All exe files icluding calc.exe, notepad.exe and explorer.exe or just some exe files?
There are different approaches to this.
If you're trying to block a single executable that you're familiar with you can disable it from a GPO using the setting:
User Configuration/Administrative Templates/System/Don't run specified Windows applications
Another option is to specify only the applications you want to allow Using:
User Configuration/Administrative Templates/System/Run only specified Windows applications
This one would probably take a lot of work to populate for a system with many applications installed or for a corporate environment.
None of the two mentioned settings takes into account that a user can name their exe file what they want so renaming mydangerousapp.exe to explorer.exe would make it a perfectly legitimate executable.
Comment: Please read the actual question before you try to answer. We program i.e. create new exe files in Visual Studio. And want to run them.

Group Policy is blocking exe files


How do I convert Mathematica's suggestions to usable code

Question: I enter an image and in the suggestions bar under the image, one of the suggestions is "Edge detect". I click on it and a nice cell with all the options comes up. How do I get the code for all of what Mathematica returns? Clicking "Done" merely returns the value of the variables on the sliders.
Comment: There should be a button called "roll up inputs". Clicking on that should give you the code.
Answer: After you get the image (or the data) the way you want it, choose the "roll up" icon and it writes the Mathematica code for you.

The roll-up icon is the little squiggle just to the right of the word "more". If you want to roll your own, you can do it easily using Manipulate
Manipulate[EdgeDetect[img, r, t, Method -> meth], {r, 1, 5}, {t, 0, 1},
          {meth, {"ShenCastan", "Sobel", "Canny"}}]

where img is the name of the image you are processing.
Comment: Right, if I wanted all of the variables fixed that would do. In this case I want exactly what Mathematica has generated with manipulate and the tree main EdgeDetecors in place.  That is if I hit Done it fixes the variables and I loose the ability to Manipulate everything. I'm wanting the code that Mathematica generated. Any way to get that?
Comment: Learning to use `Manipulate` is a surefire way to be able to get this kind of thing, and then you can customize and have exactly the controls you want. It's not that hard and there are lots of examples in the documentation and at the wolfram demonstration site.
Comment: Exactly my point. The original question was, What are the min and max ranges for EdgeDetect. The answer was off. As examples of it in the documentation have values going as high is 6, 7 and more. So a range between 0 and 1 is not the correct answer.   I used the Suggestion EdgeDetect and It came back with all of the variables in Manipulate form. Exactly what I am looking for. I can use Manipulate as long as I have the ranges.  Mathematica generated them for the result but I don't know how to get it to generate all of the code insted of making me chose fixed variables from its sliders.
Comment: The range can be as large as you are willing to wait (it's how big the blocks are that are processed simultaneously). To be explicit, you can use values larger than 5. The threshold is between 0 and 1. These are clearly stated in the documentation.


Merge [race] into [racing]

Question: We don't need both racing and race.
Answer: There's a possible split here between

[race] watching a race, questions about someone else's approach
[racing] competing in a race, strategy/tactics or fueling etc.

However on looking closer, there's 47 questions in [race] and 168 in [racing] and based on title there's a blend of both in either tag and likely some dupes too.
IMO they're close enough for synonomising.

<code>race will be removed from 47 posts
racing will be added to 43 posts
</code>
Done
Comment: @Michael That sounds like work.
Comment: If you would rather give them different scopes and sort questions, I'm fine with that, too.
Comment: @DavidW concur - and it will clutter the home page with edits.   I suggest combining the two, with [race] as the root and racing as the synonom.

Merge [race] into [racing]


VBoxManage: error: Failed to create the host-only adapter (II)

Question: This error has previously been reported in post: VBoxManage: error: Failed to create the host-only adapter and it keeps reoccurring for new versions of Windows/vagrant/OracleVB as described below. If anyone has identified a solution to this problem for the setup that is described below, please share here:

host: Windows 10 Home version 1607 ; OS build 14939.105
guest: using the "bento/ubuntu-14.04" image
Vagrant: 1.8.5
Oracle VB: 5.1.4 r110228 (Qt5.5.1)

I installed Oracle VB and then Vagrant (both fresh installs) and then ran vagrant up as usuas in one of my workspaces. After vagrant had finished downloading the virtual box, it gave the following error output when attempting to start the VM:
C:\Users\AHL\workspace>vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Box 'bento/ubuntu-14.04' could not be found. Attempting to find and install...
    default: Box Provider: virtualbox
    default: Box Version: >= 0
==> default: Loading metadata for box 'bento/ubuntu-14.04'
    default: URL: https://atlas.hashicorp.com/bento/ubuntu-14.04
==> default: Adding box 'bento/ubuntu-14.04' (v2.2.9) for provider: virtualbox
    default: Downloading: https://atlas.hashicorp.com/bento/boxes/ubuntu-14.04/versions/2.2.9/providers/virtualbox.box
    default: Progress: 100% (Rate: 74436/s, Estimated time remaining: --:--:--)
==> default: Successfully added box 'bento/ubuntu-14.04' (v2.2.9) for 'virtualbox'!
==> default: Importing base box 'bento/ubuntu-14.04'...
==> default: Matching MAC address for NAT networking...
==> default: Checking if box 'bento/ubuntu-14.04' is up to date...
==> default: Setting the name of the VM: workspace_default_1473571560144_68182
==> default: Clearing any previously set network interfaces...
There was an error while executing `VBoxManage`, a CLI used by Vagrant
for controlling VirtualBox. The command and stderr is shown below.

Command: ["hostonlyif", "create"]

Stderr: 0%...
Progress state: E_FAIL
VBoxManage.exe: error: Failed to create the host-only adapter
VBoxManage.exe: error: Operation canceled by the user
VBoxManage.exe: error: Details: code E_FAIL (0x80004005), component VirtualBoxWrap, interface IVirtualBox
VBoxManage.exe: error: Context: "enum RTEXITCODE __cdecl handleCreate(struct HandlerArg *)" at line 71 of file VBoxManageHostonly.cpp

C:\Users\AHL\workspace>

Vagrantfile:
Vagrant.configure(2) do |config|
  config.vm.box = "bento/ubuntu-14.04"
  config.vm.network "private_network", ip: "192.168.33.10"
end

Answer: The solution to this problem appears to be the same as reported in the related post:
Although the VM in the Oracle VB GUI appears as not running, you must manually start it through Oracle VB GUI (this should work and allow you to login to the box) and then manually power it off again (also through Oracle VB GUI). Then, run vagrant up again and it should work.
If you're having issues with this setup then please add comments to this post.
Answer: On Windows 10

Navigate to Program Files > Oracle > VirtualBox > drivers > network > netadp6
Right click "VBoxNetAdp6.inf" and select "Install".

You may have to shut VirtualBox down before taking these steps and then re-run vagrant up, or possibly even vagrant destroy.
Answer: Try to execute
C:\HashiCorp\Vagrant\bin\vagrant.exe as administrator and then
vagrant up in command line.
It worked for me.
Answer: Just launch the virtual box. That's it
Answer: UPDATE 2020.10: STEPS BELOW DO NOT WORK ANYMORE.
If you installed VirtualBox without Network support or if you don't has Network support installed.
Try:

open VirtualBox
Menu File ---> Settings ---> Network
On the right side, click  button "add new network"
Assume the default settings
At Terminal type: vagrant up

For me, it worked. Good luck there!


ASP.net application deployment in Windows Azure

Question: I have developed my application in C# (asp.net) using Microsoft Visual Studio 2008 and SQL Server 2005. Can i deploy it using Windows Azure? Also can i migrate the same code from Visual Studio 2008 to 2010 and the same for SQL Server 2005 and 2005 ?
Thank You
Answer: This is an older post but should get you pointed in the right direction:
http://blogs.msdn.com/b/jnak/archive/2010/02/08/migrating-an-existing-asp-net-app-to-run-on-windows-azure.aspx
And yes, you should be able to migrate your solution from VS 2008 to 2010.  VS will run a conversion wizard and notify you of any changes.


Use of Lamport's Signature as a primitive

Question: Is Lamport's One Time Signature used as a primitive to construct any other cryptographic protocols?
Answer: I don't know of a use of Lamport's scheme precisely as Lamport originally published it; however if we include generalizations of the idea (such as Winternitz signatures), then it has been used as the basis of Hash Based Signatures, such as this proposal
Comment: thanks, this helps.. if i don't get any other answers, i will close the question with this answer.
Answer: Two caveats:

Lamport itself isn't fundamental; it's just the prototypical example of a one-way signature.
A one-way signature isn't a "primitive" any more than an RSA signature is; it might be more accurate to describe it as a "building block".

However, yes, one-time signatures are a keystone operation in Lu, Au, and Zhang's 2019 Linkable Ring Signature scheme.
(Ring Signatures allow users to sign a message as an anonymous member of a set of users; Linkable Ring Signatures allow multiple such signatures by the same anonymous signer to be shown to be such.)


From configure scripts to Makefiles?

Question: I'd like to build my own GNU/Linux system from scratch using cross-compilation (just like the CLFS project). Most of the packages I would use are distributed with a configure script, and you just have to run it with the right arguments. For various reasons, I'd like to skip this step, and run make instead. Of course I need a custom Makefile for this to work. The question is: is it feasible to create custom Makefiles without having to read and comprehend all the source code? Is it possible to just read the configure.ac files or something like those? Thanks.
Answer: Probably not. What happens is that configure tests which of a number of options are most suited for your environment then substitutes them into Makefile.in to build the Makefile, config.h.in to build config.h etc. You could skip running configure and just determine what these values should be from simple cases of configure.ac (or just keep one huge cache if your environment won't change) but I think packages can define extra inline checks in configure.ac that you'd have to parse and implement correctly. It's going to be a lot easier to just run configure, even if you do have to figure out the correct parameter values for your cross-compiled environment without runtime checks.
However hopefully you only need to build a small number of packages cross (kernel, glibc, gcc, make, bash, etc.), then you can switch into your new environment and build the remaining packages there using configure? If you want inspiration as to what switch values you should be using you can always look at the parameters in Fedora SRPMs or Debian source-debs.

From configure scripts to Makefiles?