prompt
stringlengths
5
14.5k
chosen
stringlengths
3
19.7k
rejected
stringlengths
1
9.05k
Dagger-Hilt: @ViewModelInject is not injecting MyViewModel and crash?
<code>@ViewModelInject</code> is deprecated in the newer <code>hilt</code> version https://developer.android.com/reference/androidx/hilt/lifecycle/ViewModelInject Use <code>HiltViewModel</code> <code>@HiltViewModel class TasksViewModel @Inject constructor( val taskRepository: TaskRepository ) : ViewModel() { } </code>
Apparently I miss out adding a kapt, which is <code>kapt 'androidx.hilt:hilt-compiler:1.0.0-alpha01'</code> The list of dependencies in my <code>build.gradle</code> is as below <code> implementation 'androidx.fragment:fragment-ktx:1.2.5' implementation "androidx.lifecycle:lifecycle-viewmodel:2.2.0" implementation "androidx.lifecycle:lifecycle-extensions:2.2.0" implementation "androidx.hilt:hilt-lifecycle-viewmodel:1.0.0-alpha01" implementation 'com.google.dagger:hilt-android:2.28-alpha' kapt 'androidx.hilt:hilt-compiler:1.0.0-alpha01' kapt 'com.google.dagger:hilt-android-compiler:2.28-alpha' </code> Just for completeness, the plugin is below <code>apply plugin: 'dagger.hilt.android.plugin' apply plugin: 'kotlin-kapt' </code>
Why use triple-equal (===) in TypeScript?
short version: <code>==</code> can do unexpected type conversions, in Javascript <code>1=="1"</code> is <code>true</code>. The <code>===</code> operator avoids this. Comparing different types with <code>===</code> is always <code>false</code>. The typescript compiler will emit an error message when you compare different types with <code>==</code>. This removes the unexpected type conversions that can happen with <code>==</code> in Javascript. This is a case where valid Javascript leads to an error message in the typescript compiler. The idea that all valid Javascript is also valid Typescript is a common misconception. This is simply not true. longer version: I think the accepted answer is misleading. Typescript actually does fix <code>==</code> vs <code>===</code> (as far as possible at least). In Javascript there are two comparison operators: <code>==</code> : When comparing primitive values, like numbers and strings, this operator will apply a type conversion before doing the comparison. <code>1 == "1"</code> evaluates to <code>true</code>. <code>===</code>: This operator does not do type conversions. If the types don't match it will always return <code>false</code>. Also, both operators will compare reference types based on their references. Two separate objects are never considered equal to each other, even if they store the same values: <code>let a = {val:1}; let b = {val:1}; c = a; a==b; // false a===b; // false a==c; //true a===c; //true </code> So there you have the two common sources of errors in Javascript comparisons: comparing different types with <code>==</code> can lead to unexpected type conversions. comparing objects and arrays is based on references not values stored inside. As the existing answer already says, Typescript is designed as a superset of Javascript. So it doesn't change the behaviour of these comparison operators. If you write <code>==</code> in Typescript, you get type conversions. So how is this fixed? With the compiler. If you actually do write code that compares incompatible types with <code>==</code> it's a compiler error. Try compiling the following sample: <code>let str = "1"; let num = 1; console.log(str == num); </code> The compiler will tell you: <code>comparisons.ts:4:13 - error TS2367: This condition will always return 'false' since the types 'string' and 'number' have no overlap. 4 console.log(str == num); ~~~~~~~~~~ Found 1 error. </code> It is a common misconception that any valid Javascript is also valid Typescript. This is not true and the code above is an example where the typescript compiler will complain about valid Javascript. This fixes the first of the two sources of errors: unexpected type conversions. It doesn't deal with the second source of errors: comparisons based on references. As far as I know, when you want to do a comparison based on values stored by the objects, you simply can't use these operators. You'll have to implement your own <code>equals()</code> method. Also, you may have noticed that the compiler error is wrong. The comparison will not always evaluate to false. I think this is a bug in typescript and have filed an issue.
Imagine you're designing TypeScript from scratch. Essentially, you're trying to optimize for making safer code easier to write (TypeScript design goal 1) with a few caveats which prevent you from doing everything you'd like. JavaScript compatibility (TypeScript design goal 7) JavaScript should be valid Typescript with no changes. CoffeeScript makes no guarantees regarding this, so it can convert all instances of <code>==</code> to <code>===</code> and simply tell users don't rely on <code>==</code>'s behavior. TypeScript cannot redefine <code>==</code> without breaking all JavaScript code that relies on its behavior (despite this having sad implications for 3). This also implies that TypeScript cannot change the functionality of <code>===</code> to, for example, check the types of both operands at compile time and reject programs comparing variables of different types. Further, compatibility is not limited to simply JavaScript programs; breaking compatibility also affects JavaScript programmers by breaking their assumptions about the differences between <code>==</code> and <code>===</code>. See TypeScript non-goal number 7: <blockquote> Introduce behaviour that is likely to surprise users. Instead have due consideration for patterns adopted by other commonly-used languages. </blockquote> JavaScript as the target of compilation (TypeScript design goal 4) All TypeScript must be representable in JavaScript. Further, it should be idiomatic JavaScript where possible. Really though, the TypeScript compiler could use methods returning booleans for all comparisons, doing away with <code>==</code> and <code>===</code> entirely. This might even be safer for users: define a type-safe equality method on each TypeScript type (rather like C++ <code>operator==</code>, just without overloading). So there is a workaround (for users comparing classes). <code>unknown</code> or <code>any</code> variables can have their types narrowed before using the type-safe equality method. Which to prefer Use <code>===</code> everywhere you would in JavaScript. This has the advantage of avoiding the pitfalls common to <code>==</code>, and doesn't require you to maintain an additional method. The output of the TypeScript compiler will be close to idiomatic JavaScript. Using <code>==</code> has very much the same pitfalls as JavaScript, particularly when you have <code>any</code>, <code>[]</code>, or <code>{}</code> involved. As an exception, using <code>== null</code> to check for <code>null</code> or <code>undefined</code> may save headaches if library code is inconsistent. A method for reference equality (behavior like <code>===</code> for classes) could be confused with a deep/value recursive equality check. Furthermore, <code>===</code> is widely used in TypeScript, and making your code fall in line with conventions is usually more important than any small bit of type safety.
How can I use the new `git switch` syntax to create a new branch?
Actually, you don't even (always) need the <code>--create</code> option when creating a new branch with <code>git switch</code>: if that branch matches a remote tracking one, it will create a local branch, and automatically track the remote one! Meaning a simple <code>git switch <branch></code> is enough. <blockquote> If <code><branch></code> is not found but there does exist a tracking branch in exactly one remote (call it <code><remote></code>) with a matching name, treat as equivalent to: </blockquote> <code>$ git switch -c <branch> --track <remote>/<branch> </code> <blockquote> If the branch exists in multiple remotes and one of them is named by the <code>checkout.defaultRemote</code> configuration variable, well use that one for the purposes of disambiguation, even if the <code><branch></code> isnt unique across all remotes. Set it to e.g. <code>checkout.defaultRemote=origin</code> to always checkout remote branches from there if <code><branch></code> is ambiguous but exists on the <code>origin</code> remote. See also <code>checkout.defaultRemote</code> in <code>git config</code>. </blockquote> Plus, if you switch by mistake to a remote tracking branch, it fails (as opposed to <code>git checkout</code>, which would create a detached HEAD from said remote branch!) <code>git switch origin/master fatal: a branch is expected, got remote branch 'origin/master' </code> Vs. <code>git checkout origin/master Note: switching to 'origin/master'. You are in 'detached HEAD' state </code>
The syntax for creating a new branch with <code>git switch</code> is <code>git switch -c branchname</code> or <code>git switch --create branchname</code>.
How to make "inappropriate blocking method call" appropriate?
Exceptions can occur that's why it shows this warning. Use <code>runCatching{}</code>. It catches any Throwable exception that was thrown from the block function execution and encapsulating it as a failure. For Example: <code> CoroutineScope(Dispatchers.IO).launch { runCatching{ makeHttpRequest(URL(downloadLocation)) } } </code>
You also get this warning when calling a suspending function that is annotated with <code>@Throws(IOException::class)</code> (Kotlin 1.3.61). Not sure if that is intended or not. Anyway, you can suppress this warning by removing that annotation or changing it to <code>Exception</code> class.
Chrome Console SameSite Cookie Attribute Warning <sep> Is anybody else getting this Chrome console warning?
This is something that the third-party cookie setters (like Stripe) need to handle on their end. I reached out to Stripe because I was getting this message for Stripe payments. Stripe support response: It looks like we're already tracking this internally as this warning comes from Stripe.js, not from react-stripe-elements. For now this is a warning and won't affect payments, and we're working on a fix which will eliminate this message and be compatible with Chrome's upcoming cookie-handling changes. (Me) So, it's all on your end? I don't need to do anything? No, this is something we have to get worked out on our end. Oh, if you're a developer at Stripe/Facebook/Pinterest/so-forth, this answer won't work for you ;)
You can disable them through chrome://flags Cookie Deprecation messages disabled.
How to run UVICORN in Heroku?
The answer(s) are correct, but to use FastAPI in production running as WSGI with ASGI workers is a better choice here is why, i ran a benchmark for this question, so here is the results. Gunicorn with Uvicorn workers <code>Requests per second: 8665.48 [#/sec] (mean) Concurrency Level: 500 Time taken for tests: 0.577 seconds Complete requests: 5000 Time per request: 57.700 [ms] (mean) </code> Pure Uvicorn <code>Requests per second: 3200.62 [#/sec] (mean) Concurrency Level: 500 Time taken for tests: 1.562 seconds Complete requests: 5000 Time per request: 156.220 [ms] (mean) </code> As you can see there is a huge difference in RPS(Request per second) and response time for each request. Procfiles Gunicorn with Uvicorn Workers <code>web: gunicorn -w 4 -k uvicorn.workers.UvicornWorker main:app </code> Pure uvicorn <code>web: uvicorn main:app --workers 4 </code>
I've tested your setup and after some checking (never used Heroku before) I'm guessing your uvicorn never binds to the appointed port (was the heroku-cli command <code>heroku local</code> working for you?) Your Procfile could look like this; <code>web: uvicorn src.main:app --host=0.0.0.0 --port=${PORT:-5000} </code> This example assumes you have your source code within a subfolder named 'src' which has an empty <code>__init__.py</code> (indicating a Python module, you probably want to add src to the PYTHONPATH instead, see app.json) and <code>main.py</code> containing your fastapi app; <code>import socket import sys from fastapi import FastAPI app = FastAPI() hostname = socket.gethostname() version = f"{sys.version_info.major}.{sys.version_info.minor}" @app.get("/") async def read_root(): return { "name": "my-app", "host": hostname, "version": f"Hello world! From FastAPI running on Uvicorn. Using Python {version}" } </code> I have added this example to github which you can view on heroku (for now)
Can you deconstruct lazily loaded React components?
Here is how I did it when I faced this problem with FontAwesome: <code>const FontAwesomeIcon = React.lazy(()=> import('@fortawesome/react-fontawesome').then(module=>({default:module.FontAwesomeIcon}))) </code>
You can if you use react-lazily. <code>import { lazily } from 'react-lazily'; const { MyComponent } = lazily(() => import("../path/to/components.js")); </code> It also allows importing more than one component: <code>const { MyComponent, MyOtherComponent, SomeOtherComponent } = lazily( () => import("../path/to/components.js") ); </code> See this answer for more options.
Can't get Root View from Data Binding after enabling safe-args plugin <sep> I'm working on an Android app using dataBinding and am currently trying to add the safe-args plugin, but after enabling the plugin, I can no longer get the root view via binding.root - Android Studio gives the error: <code>Unresolved Reference None of the following candidates is applicable because of a receiver type mismatch: * internal val File.root: File defined in kotlin.io </code> How can I get databinding and safe-args to play nice together?
I have the same issue and at last I tried File -> Invalid Caches/Restart It works for me.
I have the same issue, it's so wired for me, but just rename the layout will work again, try to it :D
What's the equivalent of this.props.history.push in gatsby?
The top answer doesn't work anymore But this does work : <code>import { navigate } from "gatsby" </code> <code>navigate(`/payment/${stripe_plan_id.id}`) </code>
Gatsby uses reach router. Try the following: <code>import { navigate } from "@reach/router" </code> <code>navigate(`/payment/${stripe_plan_id.id}`) </code>
Why eslint consider JSX or some react @types undefined, since upgrade typescript-eslint/parser to version 4.0.0 <sep> The context is pretty big project built with ReactJs, based on eslint rules, with this eslint configuration <code>const DONT_WARN_CI = process.env.NODE_ENV === 'production' ?
I had the same issue when trying to declare variables as of type <code>JSX.Element</code> in typescript. I added <code>"JSX":"readonly"</code> to <code>globals</code> in <code>.eslintrc.json</code> and the problem was gone. In your case it would be: <code>globals: { React: true, google: true, mount: true, mountWithRouter: true, shallow: true, shallowWithRouter: true, context: true, expect: true, jsdom: true, JSX: true, }, </code> From the following link, I got that you actually use several options after <code>JSX</code>. You could use <code>true</code>,<code>false</code>, <code>writable</code> or <code>readonly</code> (but not <code>off</code>). https://eslint.org/docs/user-guide/configuring
Official answer is here and it says indeed to add them to <code>globals</code> or to disable the <code>no-undef</code> rule because TypeScript already has already its own checks: <blockquote> I get errors from the <code>no-undef</code> rule about global variables not being defined, even though there are no TypeScript errors The <code>no-undef</code> lint rule does not use TypeScript to determine the global variables that exist - instead, it relies upon ESLint's configuration. We strongly recommend that you do not use the <code>no-undef</code> lint rule on TypeScript projects. The checks it provides are already provided by TypeScript without the need for configuration - TypeScript just does this significantly better. As of our v4.0.0 release, this also applies to types. If you use global types from a 3rd party package (i.e. anything from an <code>@types</code> package), then you will have to configure ESLint appropriately to define these global types. For example; the <code>JSX</code> namespace from <code>@types/react</code> is a global 3rd party type that you must define in your ESLint config. Note, that for a mixed project including JavaScript and TypeScript, the <code>no-undef</code> rule (like any role) can be turned off for TypeScript files alone by adding an <code>overrides</code> section to .eslintrc.json: <code>"overrides": [ { "files": ["*.ts"], "rules": { "no-undef": "off" } } ] </code> If you choose to leave on the ESLint <code>no-undef</code> lint rule, you can <a href="https://eslint.org/docs/user-guide/configuring/language-options#specifying-globals">manually define the set of allowed <code>globals</code> in your ESLint config</a>, and/or you can use one of the <a href="https://eslint.org/docs/user-guide/configuring/language-options#specifying-environments">pre-defined environment (<code>env</code>) configurations</a>. </blockquote>
TypeError: '&lt;' not supported between instances of 'NoneType' and 'float' <sep> I am following a YouTube tutorial and I wrote this code from the tutorial <code>import numpy as np import pandas as pd from scipy.stats import percentileofscore as score my_columns = [ 'Ticker', 'Price', 'Number of Shares to Buy', 'One-Year Price Return', 'One-Year Percentile Return', 'Six-Month Price Return', 'Six-Month Percentile Return', 'Three-Month Price Return', 'Three-Month Percentile Return', 'One-Month Price Return', 'One-Month Percentile Return' ] final_df = pd.DataFrame(columns = my_columns) # populate final_df here.... pd.set_option('display.max_columns', None) print(final_df[:1]) time_periods = ['One-Year', 'Six-Month', 'Three-Month', 'One-Month'] for row in final_df.index: for time_period in time_periods: change_col = f'{time_period} Price Return' print(type(final_df[change_col])) percentile_col = f'{time_period} Percentile Return' print(final_df.loc[row, change_col]) final_df.loc[row, percentile_col] = score(final_df[change_col], final_df.loc[row, change_col]) print(final_df) </code> It prints my data frame as <code>| Ticker | Price | Number of Shares to Buy | One-Year Price Return | One-Year Percentile Return | Six-Month Price Return | Six-Month Percentile Return | Three-Month Price Return | Three-Month Percentile Return | One-Month Price Return | One-Month Percentile Return | |--------|---------|-------------------------|------------------------|----------------------------|------------------------|-----------------------------|--------------------------|-------------------------------|-------------------------|------------------------------| | A | 120.38 | N/A | 0.437579 | N/A | 0.280969 | N/A | 0.198355 | N/A | 0.0455988 | N/A | </code> But when I call the score function I get this error <code><class 'pandas.core.series.Series'> 0.4320217937551543 Traceback (most recent call last): File "program.py", line 72, in <module> final_df.loc[row, percentile_col] = score(final_df[change_col], final_df.loc[row, change_col]) File "/Users/abhisheksrivastava/Library/Python/3.7/lib/python/site-packages/scipy/stats/stats.py", line 2017, in percentileofscore left = np.count_nonzero(a < score) TypeError: '<' not supported between instances of 'NoneType' and 'float' </code> What is going wrong?
What @Taras Mogetich wrote was pretty correct, however you might need to put the if-statement in its own for-loop. Liko so: <code>for row in hqm_dataframe.index: for time_period in time_periods: change_col = f'{time_period} Price Return' percentile_col = f'{time_period} Return Percentile' if hqm_dataframe.loc[row, change_col] == None: hqm_dataframe.loc[row, change_col] = 0.0 </code> And then separately: <code>for row in hqm_dataframe.index: for time_period in time_periods: change_col = f'{time_period} Price Return' percentile_col = f'{time_period} Return Percentile' hqm_dataframe.loc[row, percentile_col] = score(hqm_dataframe[change_col], hqm_dataframe.loc[row, change_col]) </code>
I'm working through this tutorial as well. I looked deeper into the data in the four '___ Price Return' columns. Looking at my batch API call, there's four rows that have the value 'None' instead of a float which is why the 'NoneError' appears, as the percentileofscore function is trying to calculate the percentiles using 'None' which isn't a float. To work around this API error, I manually changed the None values to 0 which calculated the Percentiles, with the code below... <code>time_periods = [ 'One-Year', 'Six-Month', 'Three-Month', 'One-Month' ] for row in hqm_dataframe.index: for time_period in time_periods: if hqm_dataframe.loc[row, f'{time_period} Price Return'] == None: hqm_dataframe.loc[row, f'{time_period} Price Return'] = 0 </code>
Test if object implements interface <sep> What is the simplest way of testing if an object implements a given interface in C#?
If you want to use the typecasted object after the check: Since C# 7.0: <code>if (obj is IMyInterface myObj) </code> This is the same as <code>IMyInterface myObj = obj as IMyInterface; if (myObj != null) </code> See .NET Docs: Pattern matching overview
This Post is a good answer. <code>public interface IMyInterface {} public class MyType : IMyInterface {} </code> This is a simple sample: <code>typeof(IMyInterface).IsAssignableFrom(typeof(MyType)) </code> or <code>typeof(MyType).GetInterfaces().Contains(typeof(IMyInterface)) </code>
C# binary literals <sep> Is there a way to write binary literals in C#, like prefixing hexadecimal with 0x?
Adding to @StriplingWarrior's answer about bit flags in enums, there's an easy convention you can use in hexadecimal for counting upwards through the bit shifts. Use the sequence 1-2-4-8, move one column to the left, and repeat. <code>[Flags] enum Scenery { Trees = 0x001, // 000000000001 Grass = 0x002, // 000000000010 Flowers = 0x004, // 000000000100 Cactus = 0x008, // 000000001000 Birds = 0x010, // 000000010000 Bushes = 0x020, // 000000100000 Shrubs = 0x040, // 000001000000 Trails = 0x080, // 000010000000 Ferns = 0x100, // 000100000000 Rocks = 0x200, // 001000000000 Animals = 0x400, // 010000000000 Moss = 0x800, // 100000000000 } </code> Scan down starting with the right column and notice the pattern 1-2-4-8 (shift) 1-2-4-8 (shift) ... To answer the original question, I second @Sahuagin's suggestion to use hexadecimal literals. If you're working with binary numbers often enough for this to be a concern, it's worth your while to get the hang of hexadecimal. If you need to see binary numbers in source code, I suggest adding comments with binary literals like I have above.
You can always create quasi-literals, constants which contain the value you are after: <code>const int b001 = 1; const int b010 = 2; const int b011 = 3; // etc ... Debug.Assert((b001 | b010) == b011); </code> If you use them often then you can wrap them in a static class for re-use. However, slightliy off-topic, if you have any semantics associated with the bits (known at compile time) I would suggest using an Enum instead: <code>enum Flags { First = 0, Second = 1, Third = 2, SecondAndThird = 3 } // later ... Debug.Assert((Flags.Second | Flags.Third) == Flags.SecondAndThird); </code>
Patterns for handling batch operations in REST web services?
A simple RESTful pattern for batches is to make use of a collection resource. For example, to delete several messages at once. <code>DELETE /mail?&id=0&id=1&id=2 </code> It's a little more complicated to batch update partial resources, or resource attributes. That is, update each markedAsRead attribute. Basically, instead of treating the attribute as part of each resource, you treat it as a bucket into which to put resources. One example was already posted. I adjusted it a little. <code>POST /mail?markAsRead=true POSTDATA: ids=[0,1,2] </code> Basically, you are updating the list of mail marked as read. You can also use this for assigning several items to the same category. <code>POST /mail?category=junk POSTDATA: ids=[0,1,2] </code> It's obviously much more complicated to do iTunes-style batch partial updates (e.g., artist+albumTitle but not trackTitle). The bucket analogy starts to break down. <code>POST /mail?markAsRead=true&category=junk POSTDATA: ids=[0,1,2] </code> In the long run, it's much easier to update a single partial resource, or resource attributes. Just make use of a subresource. <code>POST /mail/0/markAsRead POSTDATA: true </code> Alternatively, you could use parameterized resources. This is less common in REST patterns, but is allowed in the URI and HTTP specs. A semicolon divides horizontally related parameters within a resource. Update several attributes, several resources: <code>POST /mail/0;1;2/markAsRead;category POSTDATA: markAsRead=true,category=junk </code> Update several resources, just one attribute: <code>POST /mail/0;1;2/markAsRead POSTDATA: true </code> Update several attributes, just one resource: <code>POST /mail/0/markAsRead;category POSTDATA: markAsRead=true,category=junk </code> The RESTful creativity abounds.
Not at all -- I think the REST equivalent is (or at least one solution is) almost exactly that -- a specialized interface designed accommodate an operation required by the client. I'm reminded of a pattern mentioned in Crane and Pascarello's book Ajax in Action (an excellent book, by the way -- highly recommended) in which they illustrate implementing a CommandQueue sort of object whose job it is to queue up requests into batches and then post them to the server periodically. The object, if I remember correctly, essentially just held an array of "commands" -- e.g., to extend your example, each one a record containing a "markAsRead" command, a "messageId" and maybe a reference to a callback/handler function -- and then according to some schedule, or on some user action, the command object would be serialized and posted to the server, and the client would handle the consequent post-processing. I don't happen to have the details handy, but it sounds like a command queue of this sort would be one way to handle your problem; it'd reduce the overall chattiness substantially, and it'd abstract the server-side interface in a way you might find more flexible down the road. Update: Aha! I've found a snip from that very book online, complete with code samples (although I still suggest picking up the actual book!). Have a look here, beginning with section 5.5.3: <blockquote> This is easy to code but can result in a lot of very small bits of traffic to the server, which is inefficient and potentially confusing. If we want to control our traffic, we can capture these updates and queue them locally and then send them to the server in batches at our leisure. A simple update queue implemented in JavaScript is shown in listing 5.13. [...] The queue maintains two arrays. <code>queued</code> is a numerically indexed array, to which new updates are appended. <code>sent</code> is an associative array, containing those updates that have been sent to the server but that are awaiting a reply. </blockquote> Here are two pertinent functions -- one responsible for adding commands to the queue (<code>addCommand</code>), and one responsible for serializing and then sending them to the server (<code>fireRequest</code>): <code>CommandQueue.prototype.addCommand = function(command) { if (this.isCommand(command)) { this.queue.append(command,true); } } CommandQueue.prototype.fireRequest = function() { if (this.queued.length == 0) { return; } var data="data="; for (var i = 0; i < this.queued.length; i++) { var cmd = this.queued[i]; if (this.isCommand(cmd)) { data += cmd.toRequestString(); this.sent[cmd.id] = cmd; // ... and then send the contents of data in a POST request } } } </code> That ought to get you going. Good luck!
How to have favicon / icon set when bookmarklet dragged to toolbar?
After reading the tapper[ware] and Restafarian site, here's the simplest solution I could come up with: <code><a href="javascript: var title = window.location.href; if (title.indexOf('http://yourwebsite/bookmarklet/') == 0) { '<head><link rel=\'shortcut icon\' href=\'favicon.ico\'></head>Bookmarklet'; } else { (function(){document.body.appendChild(document.createElement('script')).src='http://yourwebsite/bookmarklet.js';})(); }">Click Me!</a> </code> Works great in Chrome and FF, but FF4 is the only browser that will save the icon in the bookmarks bar. Here's what it looks like: http://cl.ly/5WNR
That's not quite right: A bookmarklet has no domain, but it has a location (which is the bookmarklet itself) and you can assign an icon to that. After that it's a matter of how the browser saves icons (Firefox saves a bookmark's icon permanently, you may not be so lucky with other browsers). P.S. Security doesn't even play into it, icons can come from anywhere. There is no restriction. See http://www.tapper-ware.net/blog/?p=97
What is a practical maximum length for HTML id?
Just tested: 1M characters works on every modern browser: Chrome1, FF3, IE7, Konqueror3, Opera9, Safari3. I suspect even longer IDs could become hard to remember.
A practical limit, for me, is however long an ID I can store in my head during the time I'm working with the HTML/CSS. This limit is usually between 8 and 13 characters, depending on how long I've been working and if the names make sense in the context of the element.
Catching access violation exceptions?
At least for me, the <code>signal(SIGSEGV ...)</code> approach mentioned in another answer did not work on Win32 with Visual C++ 2015. What did work for me was to use <code>_set_se_translator()</code> found in <code>eh.h</code>. It works like this: Step 1) Make sure you enable Yes with SEH Exceptions (/EHa) in Project Properties / C++ / Code Generation / Enable C++ Exceptions, as mentioned in the answer by Volodymyr Frytskyy. Step 2) Call <code>_set_se_translator()</code>, passing in a function pointer (or lambda) for the new exception translator. It is called a translator because it basically just takes the low-level exception and re-throws it as something easier to catch, such as <code>std::exception</code>: <code>#include <string> #include <eh.h> // Be sure to enable "Yes with SEH Exceptions (/EHa)" in C++ / Code Generation; _set_se_translator([](unsigned int u, EXCEPTION_POINTERS *pExp) { std::string error = "SE Exception: "; switch (u) { case 0xC0000005: error += "Access Violation"; break; default: char result[11]; sprintf_s(result, 11, "0x%08X", u); error += result; }; throw std::exception(error.c_str()); }); </code> Step 3) Catch the exception like you normally would: <code>try{ MakeAnException(); } catch(std::exception ex){ HandleIt(); }; </code>
This type of situation is implementation dependent and consequently it will require a vendor specific mechanism in order to trap. With Microsoft this will involve SEH, and *nix will involve a signal In general though catching an Access Violation exception is a very bad idea. There is almost no way to recover from an AV exception and attempting to do so will just lead to harder to find bugs in your program.
What's a simple way to undelete a file in subversion?
for whatever reason, the <code>-r</code> arg wasn't working for me (svn version 1.6.9). I tried before and after the <code>src</code>, but kept getting a message that the file was not found in the current revision (duh). Same with --revision. Using the @ style syntax worked though: <code>svn cp url/to/removed/foo.txt@4 foo.txt </code>
To remove a file but keep it in the working copy, use <code>svn rm foo.txt --keep-local </code> To get a file back after you've committed the remove, you can use either the merge command, or the copy command - both will preserve the file history. Since the merge way is already described elsewhere, here's the copy way: <code>svn rm foo.txt svn ci foo.txt -m "removed file" (now at r5 as an example) svn cp url/to/removed/foo.txt -r4 foo.txt svn ci foo.txt -m "got file back" </code>
SVN - Reintegration Merge error: "must be ancestrally related" <sep> Using TortoiseSVN - when I use Test Merge, I get the error "http://mysvnserver/svn/main/branches/ProjectA must be ancestrally related to http://mysvnserver/svn/main/trunk/ProjectB" What can I do to resolve this?
I just went through a similar problem, wanted to add the issue and solution I hit. The branch was made from a SUBFOLDER of trunk and not the entire tree. Thus, when I tried to reintegrate, I was mismatching hierarchies. Simply restructuring the integrate to be to the proper subfolder of my trunk WD allowed the process to proceed. Adding in hopes this might aid someone who hits this Q/A. :)
Let me guess: the projects are not related? Look up the history, if one of them ever was branched or not. Immediate solution: either merge per hand or try command line with "svn merge --ignore-ancestry"
How do I get a HttpServletRequest in my spring beans?
If FlexContext is not available: Solution 1: inside method (>= Spring 2.0 required) <code>HttpServletRequest request = ((ServletRequestAttributes)RequestContextHolder.getRequestAttributes()) .getRequest(); </code> Solution 2: inside bean (supported by >= 2.5, Spring 3.0 for singelton beans required!) <code>@Autowired private HttpServletRequest request; </code>
This is kind of Flex/BlazeDS specific, but here's the solution I've come up with. Sorry if answering my own question is a faux pas. <code> HttpServletRequest request = flex.messaging.FlexContext.getHttpRequest(); Cookie[] cookies = request.getCookies(); for (Cookie c:cookies) { log.debug(String.format("Cookie: %s, %s, domain: %s",c.getName(), c.getValue(),c.getDomain())); } </code> It works, I get the cookies. My problem was looking to Spring - BlazeDS had it. Spring probably does too, but I still don't know how to get to it.
Calculate Time Remaining <sep> What's a good algorithm for determining the remaining time for something to complete?
I'm surprised no one has answered this question with code! The simple way to calculate time, as answered by @JoshBerke, can be coded as follows: <code>DateTime startTime = DateTime.Now; for (int index = 0, count = lines.Count; index < count; index++) { // Do the processing ... // Calculate the time remaining: TimeSpan timeRemaining = TimeSpan.FromTicks(DateTime.Now.Subtract(startTime).Ticks * (count - (index+1)) / (index+1)); // Display the progress to the user ... } </code> This simple example works great for simple progress calculation. However, for a more complicated task, there are many ways this calculation could be improved! For example, when you're downloading a large file, the download speed could easily fluctuate. To calculate the most accurate "ETA", a good algorithm would be to only consider the past 10 seconds of progress. Check out ETACalculator.cs for an implementation of this algorithm! ETACalculator.cs is from Progression -- an open source library that I wrote. It defines a very easy-to-use structure for all kinds of "progress calculation". It makes it easy to have nested steps that report different types of progress. If you're concerned about Perceived Performance (as @JoshBerke suggested), it will help you immensely.
Make sure to manage perceived performance. <blockquote> Although all the progress bars took exactly the same amount of time in the test, two characteristics made users think the process was faster, even if it wasn't: progress bars that moved smoothly towards completion progress bars that sped up towards the end </blockquote>
How to select an element that has focus on it with jQuery <sep> How can you select an element that has current focus?
<code>$(document.activeElement)</code> will return the currently focused element and is faster than using the pseudo selector :focus. Source: http://api.jquery.com/focus-selector/
<code>alert($("*:focus").attr("id")); </code> I use jQuery. It will alert id of element is focusing. I hope it useful for you.
Copy-paste code from Visual Studio, but paste UNFORMATTED code <sep> Is there any way to force Visual Studio to copy selected code to the clipboard as unformatted text?
This feature can be turned off by <code>editor.copyWithSyntaxHighlighting</code>.
Visual Studio does put unformatted text on the clipboard, but it also puts formatted text. (The clipboard supports multiple simultaneous formats, and the OS assumes that they're simply different representations of the same data, although there's no technical enforcement of that point.) The application you're using to paste then chooses its preferred format. In Word, and maybe Outlook as well, there is a "Paste Special" command that allows you to choose which format you want to use.
How do I do date math in a bash script on OS X Leopard?
For example, this OS X date command will add 14 days to the input string 20160826 (not the present time): <code>date -j -f %Y%m%d -v+14d 20160826 +%Y%m%d </code>
Because MacOS is based on BSD, not linux, the command is actually: <code>date -v-1d </code> The adjust switch takes the format <code>-v[+/-](number)[ymwdHMS]</code>.
How to detect IIS version using C#?
Found the answer here: link text The fileVersion method dosesn't work on Windows 2008, the inetserv exe is somewhere else I guess. <code>public Version GetIisVersion() { using (RegistryKey componentsKey = Registry.LocalMachine.OpenSubKey(@"Software\Microsoft\InetStp", false)) { if (componentsKey != null) { int majorVersion = (int)componentsKey.GetValue("MajorVersion", -1); int minorVersion = (int)componentsKey.GetValue("MinorVersion", -1); if (majorVersion != -1 && minorVersion != -1) { return new Version(majorVersion, minorVersion); } } return new Version(0, 0); } } </code> I tested it, it works perfectly on Windows XP, 7 and 2008
This is how i do it. <code>FileVersionInfo verinfo = FileVersionInfo.GetVersionInfo(System.Environment.SystemDirectory + @"\inetsrv\inetinfo.exe"); //Tip... look at verinfo.MajorVersion. </code>
Best way to export a database table to a YAML file?
There is a rake task for this. You can specify RAILS_ENV if needed; the default is the development environment: <code>rake db:fixtures:dump # Create YAML test fixtures from data in an existing database. </code>
I have been using YamlDb to save the state of my database. Install it with the following command: <code>script/plugin install git://github.com/adamwiggins/yaml_db.git </code> Use the rake task to dump the contents of Rails database to db/data.yml <code>rake db:data:dump </code> Use the rake task to load the contents of db/data.yml into the database <code>rake db:data:load </code> This is the creators homepage: http://blog.heroku.com/archives/2007/11/23/yamldb_for_databaseindependent_data_dumps/
How can I see all items checked out by other users in TFS?
The October 2008 edition of the TFS Power Tools includes "Team Members" functionality that allows you to do this, and more. There is more information on this feature on Brian Harry's blog.
I usually use TFS SideKicks for this.
Parsing an Int from a string in javascript <sep> In javascript, what is the best way to parse an INT from a string which starts with a letter (such as "test[123]")?
You could use a regular expression to match the number: <code>$(this).attr("id").match(/\d+/) </code>
<code>parseInt(input.replace(/[^0-9-]/,""),10) </code>
How to recognize bots with php?
You can check the User Agent string, empty strings, or strings containing 'robot', 'spider', 'crawler', 'curl' are likely to be robots. <blockquote> <code>preg_match('/robot|spider|crawler|curl|^$/i', $_SERVER['HTTP_USER_AGENT']));</code> </blockquote>
You should filter by user-agent strings. You can find a list of about 300 common user-agents given by bots here: http://www.robotstxt.org/db.html Running through that list and ignoring bot user-agents before you run your SQL statement should solve your problem for all practical purposes. If you don't want the search engines to even reach the page, use a basic robots.txt file to block them.
How can I embed unicode string constants in a source file?
A tedious but portable way is to build your strings using numeric escape codes. For example: <code>wchar_t *string = L""; </code> becomes: <code>wchar_t *string = "\x05d3\x05d5\x05e0\x05d3\x05d0\x05e8\x05df\x05de\x05e2"; </code> You have to convert all your Unicode characters to numeric escapes. That way your source code becomes encoding-independent. You can use online tools for conversion, such as this one. It outputs the JavaScript escape format <code>\uXXXX</code>, so just search & replace <code>\u</code> with <code>\x</code> to get the C format.
You have to tell GCC which encoding your file uses to code those characters into the file. Use the option <code>-finput-charset=charset</code>, for example <code>-finput-charset=UTF-8</code>. Then you need to tell it about the encoding used for those string literals at runtime. That will determine the values of the wchar_t items in the strings. You set that encoding using <code>-fwide-exec-charset=charset</code>, for example <code>-fwide-exec-charset=UTF-32</code>. Beware that the size of the encoding (utf-32 needs 32bits, utf-16 needs 16bits) must not exceed the size of <code>wchar_t</code> gcc uses. You can adjust that. That option is mainly useful for compiling programs for <code>wine</code>, designed to be compatible with windows. The option is called <code>-fshort-wchar</code>, and will most likely then be 16bits instead of 32bits, which is its usual width for gcc on linux. Those options are described in more detail in <code>man gcc</code>, the gcc manpage.
Python 3.7 Error: Unsupported Pickle Protocol 5 <sep> I'm trying to restore a pickled config file from RLLib (json didn't work as shown in this post), and getting the following error: <code>config = pickle.load(open(f"{path}/params.pkl", "rb")) --------------------------------------------------------------------------- ValueError Traceback (most recent call last) <ipython-input-28-c964561b863c> in <module> ----> 1 config = pickle.load(open(f"{path}/params.pkl", "rb")) ValueError: unsupported pickle protocol: 5 </code> Python Version = 3.7.0 How can I open this file in 3.7?
For pandas users who saved a dataframe to a pickle file with protocol 5 in python 3.8 and need to load it into python 3.6 which only supports protocol 4 (I'm looking at you google colab): <code>!pip3 install pickle5 import pickle5 as pickle with open(path_to_protocol5, "rb") as fh: data = pickle.load(fh) </code> Could also save into a protocol-4 pickle from python 3.6 <code>data.to_pickle(path_to_protocol4) </code> Update: If facing this when loading a model from stable-baselines3: <code>!pip install --upgrade --quiet cloudpickle pickle5 from stable_baselines3 import PPO # restart kernel if in jupyter notebook # Might not need this dict in all cases custom_objects = { "lr_schedule": lambda x: .003, "clip_range": lambda x: .02 } model = PPO.load("path/to/model.zip", custom_objects=custom_objects) </code> Tested on 2021-05-31 with env: <code>cloudpickle: 1.6.0 pickle5: 0.0.11 stable-baselines3: 1.0 </code> Reference: https://brainsteam.co.uk/2021/01/14/pickle-5-madness-with-mlflow/
Use pickle5 or load it into python 3.8+ and then serialize it to a lower version of it using the protocol parameter.
How can I run the fast-api server using Pycharm?
You can do it without adding code to main.py In <code>target to run</code> instead of <code>Script path</code> choose <code>Module name</code> In <code>Module name</code> type <code>uvicorn</code> In parameters <code>app.main:app --reload --port 5000</code>
Try to call uvicorn inside your code. e.g: <code>from fastapi import FastAPI import uvicorn app = FastAPI() @app.get("/") async def read_root(): return {"Hello": "World"} if __name__ == "__main__": uvicorn.run(app, host="0.0.0.0", port=5000, log_level="info") </code> Reference
Where can you change the batch size for an SQS queue that triggers an AWS Lambda function?
This limitation would not be related to Amazon SQS console. It would be related to AWS Lambda, since the Lambda service is responsible for polling the SQS queue and for specifying the batch size to retrieve. You are correct that there is no function to edit the batch size in the Lambda console. From update-event-source-mapping AWS CLI Command Reference, here is an AWS CLI command that can update the batch size: <code>aws lambda update-event-source-mapping \ --uuid "a1b2c3d4-5678-90ab-cdef-11111EXAMPLE" \ --batch-size 8 </code> Output: <code>{ "UUID": "a1b2c3d4-5678-90ab-cdef-11111EXAMPLE", "StateTransitionReason": "USER_INITIATED", "LastModified": 1569284520.333, "BatchSize": 8, "State": "Updating", "FunctionArn": "arn:aws:lambda:us-west-2:123456789012:function:my-function", "EventSourceArn": "arn:aws:sqs:us-west-2:123456789012:mySQSqueue" } </code> Or, just delete the trigger in the Lambda console and create a new one.
SQS is not an exception. The same goes for DynamoDB and Kinesis streams. I think the reason is that all three services work with lambda through event source mappings. Nothing else is using the mappings. However, updating <code>event source mappings</code> through console is also not possible. You can use CLI or SDK for that, but this also requires getting <code>UUID</code> of the mapping to modify. Sadly UUID is not provided in console either. To use in CLI, you have to do it in two steps. 1 Get UUID <code>aws lambda list-event-source-mappings --query 'EventSourceMappings[].[UUID, EventSourceArn]' --output table </code> <code>------------------------------------------------------------------------------------------------------------------------------- | ListEventSourceMappings | +---------------------------------------+-------------------------------------------------------------------------------------+ | 5ab44863-82c2-4acc-b9dc-b14ad368effa | arn:aws:kinesis:us-east-1:xxxxx:stream/kstream | | 7479947c-bde5-4041-a438-5eb08f350505 | arn:aws:dynamodb:us-east-1:xxxx:table/test/stream/2020-07-28T23:13:41.006 | | 40040139-32fb-4297-b094-3f08368c980c | arn:aws:sqs:us-east-1:xxxxx:Messages | | a2b22aa6-f37a-4603-895b-3a044661ebdf | arn:aws:sqs:us-east-1:xxx:test-queue | +---------------------------------------+-------------------------------------------------------------------------------------+ </code> 2. Update the mapping (e.g. for SQS) <code>aws lambda update-event-source-mapping --uuid a2b22aa6-f37a-4603-895b-3a044661ebdf --batch-size 5 </code> <code>{ "UUID": "a2b22aa6-f37a-4603-895b-3a044661ebdf", "BatchSize": 5, "EventSourceArn": "arn:aws:sqs:us-east-1:xxx:test-queue", "FunctionArn": "arn:aws:lambda:us-east-1:xxxx:function:testsfd", "LastModified": 1595978738.458, "State": "Updating", "StateTransitionReason": "USER_INITIATED" } </code>
How do I view country flags on Windows 10 through HTML?
Use Noto Color Emoji font. First, write a <code>@font-face</code> rule with the <code>unicode-range</code> property. Then add the font to the top of your font stack: (Source) <code>@font-face { font-family: NotoColorEmojiLimited; unicode-range: U+1F1E6-1F1FF; src: url(https://raw.githack.com/googlefonts/noto-emoji/main/fonts/NotoColorEmoji.ttf); } div { font-family: 'NotoColorEmojiLimited', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; }</code> <code><div> <p> </p> <p> Noto Color Emoji abcdefghijklmnopqrstuvwxyz0123456789 </p> </div></code>
Flags don't seem to work on Windows due to political reasons, see https://answers.microsoft.com/en-us/windows/forum/all/flag-emoji/85b163bc-786a-4918-9042-763ccf4b6c05?page=1 This thread seems to have found a workaround Flag Emojis not rendering
How do I make a dotted/dashed line in Jetpack Compose?
You can simply use a <code>Canvas</code> with the method <code>drawLine</code> applying as <code>pathEffect</code> a <code>PathEffect.dashPathEffect</code>: <code> val pathEffect = PathEffect.dashPathEffect(floatArrayOf(10f, 10f), 0f) Canvas(Modifier.fillMaxWidth().height(1.dp)) { drawLine( color = Color.Red, start = Offset(0f, 0f), end = Offset(size.width, 0f), pathEffect = pathEffect ) } </code> You can also apply the same pathEffect to other method as: <code> val stroke = Stroke(width = 2f, pathEffect = PathEffect.dashPathEffect(floatArrayOf(10f, 10f), 0f) ) Canvas(Modifier.fillMaxWidth().height(70.dp)){ drawRoundRect(color = Color.Red,style = stroke) } </code>
You can create a shape in Jetpack Compose like this: <code>private data class DottedShape( val step: Dp, ) : Shape { override fun createOutline( size: Size, layoutDirection: LayoutDirection, density: Density ) = Outline.Generic(Path().apply { val stepPx = with(density) { step.toPx() } val stepsCount = (size.width / stepPx).roundToInt() val actualStep = size.width / stepsCount val dotSize = Size(width = actualStep / 2, height = size.height) for (i in 0 until stepsCount) { addRect( Rect( offset = Offset(x = i * actualStep, y = 0f), size = dotSize ) ) } close() }) } </code> Usage: <code>Box( Modifier .height(1.dp) .fillMaxWidth() .background(Color.Gray, shape = DottedShape(step = 10.dp)) ) </code> Result:
Why can't I use `AnimatedVisibility` in a `BoxScope`?
One workaround is to use a fully qualified name: <code>Box { androidx.compose.animation.AnimatedVisibility(visibile = ...) { ... } } </code>
Looks like it's a bug in the language - overload resolution is not aware of <code>@DslMarker</code>s and such stuff. I couldn't find related issues on Kotlin bugtracker so I filed one myself - https://youtrack.jetbrains.com/issue/KT-48215.
How to create Binance test API key <sep> I'm trying to build a Binance trading bot, I generated an API key and can use it with a real money, but I need to test the bot using their test -sandbox- account I looked in the documentation and couldn't find out how to create a testing API key Where can I found it?
For futures testnet, register and login here: https://testnet.binancefuture.com/ You will see "API KEYS" tab in the panel just below the main chart panel (the other tabs in this panel are: Positions(0) / Open Orders(0) / Order History / Trade History / Transaction History / Assets / and, finally, API Key) I hope this will save your time
Try this : https://testnet.binance.vision/ Sign in with github and then press Generate HMAC_SHA256 Key
How to update minSdkVersion in flutter updated 2.8?
Go to android/local.properties Add the following ie define the versions flutter.minSdkVersion=21 flutter.targetSdkVersion=30 flutter.compileSdkVersion=30 Once done goto android/app/build.gradle and add the following minSdkVersion localProperties.getProperty('flutter.minSdkVersion').toInteger() targetSdkVersion localProperties.getProperty('flutter.targetSdkVersion').toInteger() Then goto android/build.gradle Update the Kotlin version ext.kotlin_version = '1.6.0'
just replace flutter.minSdkVersion with your value , <code>defaultConfig { applicationId "com.example.app" minSdkVersion 21 targetSdkVersion flutter.targetSdkVersion versionCode flutterVersionCode.toInteger() versionName flutterVersionName } </code>
Softmax vs Sigmoid function in Logistic classifier?
I've noticed people often get directed to this question when searching whether to use sigmoid vs softmax in neural networks. If you are one of those people building a neural network classifier, here is how to decide whether to apply sigmoid or softmax to the raw output values from your network: If you have a multi-label classification problem = there is more than one "right answer" = the outputs are NOT mutually exclusive, then use a sigmoid function on each raw output independently. The sigmoid will allow you to have high probability for all of your classes, some of them, or none of them. Example: classifying diseases in a chest x-ray image. The image might contain pneumonia, emphysema, and/or cancer, or none of those findings. If you have a multi-class classification problem = there is only one "right answer" = the outputs are mutually exclusive, then use a softmax function. The softmax will enforce that the sum of the probabilities of your output classes are equal to one, so in order to increase the probability of a particular class, your model must correspondingly decrease the probability of at least one of the other classes. Example: classifying images from the MNIST data set of handwritten digits. A single picture of a digit has only one true identity - the picture cannot be a 7 and an 8 at the same time. Reference: for a more detailed explanation of when to use sigmoid vs. softmax in neural network design, including example calculations, please see this article: "Classification: Sigmoid vs. Softmax."
They are, in fact, equivalent, in the sense that one can be transformed into the other. Suppose that your data is represented by a vector $\boldsymbol{x}$, of arbitrary dimension, and you built a binary classifier $P$ for it, using an affine transformation followed by a softmax: \begin{equation} \begin{pmatrix} z_0 \\ z_1 \end{pmatrix} = \begin{pmatrix} \boldsymbol{w}_0^T \\ \boldsymbol{w}_1^T \end{pmatrix}\boldsymbol{x} + \begin{pmatrix} b_0 \\ b_1 \end{pmatrix}, \end{equation} \begin{equation} P(C_i | \boldsymbol{x}) = \text{softmax}(z_i)=\frac{e^{z_i}}{e^{z_0}+e^{z_1}}, \, \, i \in \{0,1\}. \end{equation} Let's transform it into an equivalent binary classifier $P^*$ that uses a sigmoid instead of the softmax. First of all, we have to decide which is the probability that we want the sigmoid to output (which can be for class $C_0$ or $C_1$). This choice is absolutely arbitrary and so I choose class $C_1$. Then, my classifier will be of the form: \begin{equation} z' = \boldsymbol{w}'^T \boldsymbol{x} + b', \end{equation} \begin{equation} P^*(C_1 | \boldsymbol{x}) = \sigma(z')=\frac{1}{1+e^{-z'}}, \end{equation} \begin{equation} P^*(C_0 | \boldsymbol{x}) = 1-\sigma(z'). \end{equation} The classifiers are equivalent if the probabilities are the same for all $\boldsymbol{x}$, so we must impose: \begin{equation} P^*(C_i|\boldsymbol{x})=P(C_i|\boldsymbol{x}) \quad i \in \{0,1\},\; \forall \boldsymbol{x}, \end{equation} or, equivalently, $\sigma(z') = \text{softmax}(z_1)$ for all $\boldsymbol{x}$. Now, replacing $z_0$, $z_1$, and $z'$ by their expressions in terms of $\boldsymbol{w}_0,\boldsymbol{w}_1, \boldsymbol{w}', b_0, b_1, b'$, and $\boldsymbol{x}$ and doing some straightforward algebraic manipulation, you may verify that the equality above holds if and only if $\boldsymbol{w}'$ and $b'$ are given by: \begin{equation} \boldsymbol{w}' = \boldsymbol{w}_1-\boldsymbol{w}_0, \end{equation} \begin{equation} b' = b_1-b_0. \end{equation} This shows that your first classifier $P$ (i.e., the one using the softmax) had more parameters than needed. This is true also for multiclass classification and it poses difficulties to optimization. An effective solution is to set the parameters for one of the classes to a fixed value (e.g., set $\boldsymbol{w}_0 = 0$ and $b_0=0$) and optimize only the remaining parameters.
What, precisely, is a confidence interval?
I found this thought experiment helpful when thinking about confidence intervals. It also answers your question 3. Let $X\sim U(0,1)$ and $Y=X+a-\frac{1}{2}$. Consider two observations of $Y$ taking the values $y_1$ and $y_2$ corresponding to observations $x_1$ and $x_2$ of $X$, and let $y_l=\min(y_1,y_2)$ and $y_u=\max(y_1,y_2)$. Then $[y_l,y_u]$ is a 50% confidence interval for $a$ (since the interval includes $a$ if $x_1<\frac12<x_2$ or $x_1>\frac12>x_2$, each of which has probability $\frac14$). However, if $y_u-y_l>\frac12$ then we know that the probability that the interval contains $a$ is $1$, not $\frac12$. The subtlety is that a $z\%$ confidence interval for a parameter means that the endpoints of the interval (which are random variables) lie either side of the parameter with probability $z\%$ before you calculate the interval, not that the probability of the parameter lying within the interval is $z\%$ after you have calculated the interval.
I wouldn't call the definition of CIs as wrong, but they are easy to mis-interpret, due to there being more than one definition of probability. CIs are based on the following definition of Probability (Frequentist or ontological) (1)probability of a proposition=long run proportion of times that proposition is observed to be true, conditional on the data generating process Thus, in order to be conceptually valid in using a CI, you must accept this definition of probability. If you don't, then your interval is not a CI, from a theoretical point of view. This is why the definition used the word proportion and NOT the word probability, to make it clear that the "long run frequency" definition of probability is being used. The main alternative definition of Probability (Epistemological or probability as an extension of deductive Logic or Bayesian) is (2)probability of a proposition = rational degree of belief that the proposition is true, conditional on a state of knowledge People often intuitively get both of these definitions mixed up, and use whichever interpretation happens to appeal to their intuition. This can get you into all kinds of confusing situations (especially when you move from one paradigm to the other). That the two approaches often lead to the same result, means that in some cases we have: rational degree of belief that the proposition is true, conditional on a state of knowledge = long run proportion of times that proposition is observed to be true, conditional on the data generating process The point is that it does not hold universally, so we cannot expect the two different definitions to always lead to the same results. So, unless you actually work out the Bayesian solution, and then find it to be the same interval, you cannot give the interval given by the CI the interpretation as a probability of containing the true value. And if you do, then the interval is not a Confidence Interval, but a Credible Interval.
Software needed to scrape data from graph <sep> Anybody have any experience with software (preferably free, preferably open source) that will take an image of data plotted on cartesian coordinates (a standard, everyday plot) and extract the coordinates of the points plotted on the graph?
graph digitizing software There are many different options, but all basically use the same workflow: upload an image set the x and y scales by indicating the values at two points on each axis indicate if the scale is linear, log, etc, click on the points. Some of the programs automatically recognize lines or points. I am usually after points, and I find them too inconsistent to be helpful even with 100s of points. I have not found one that recognizes different symbols. This feature could be worth the trouble for digitizing lines, but I have never had to do this. The program returns each point as an x-y matrix. Often it helps selecting points if the image is zoomed, either by uploading a zoomed version of the image or using the zooming feature available in some of the programs. There are many programs, and they vary in extra features, usability, licensing, and cost. I have listed them below. All of the ones I have used work fine. Except in contexts where measurement error is very small, error from graph scraping is insignificant (e.g. error from digitization << size of error bars or uncertainty in the estimate). If have not tested the accuracy of any of these programs, but it would be interesting to compare among users, among programs, and against the results of reproduced statistical analyses. Programs I have used: Digitizer (free software, GPL) auto point / line recognition. Available in Ubuntu repository (engauge-digitizer) Get Data (shareware) has zoom window, auto point / line recognition DigitizeIt (shareware) auto point / line recognition ImageJ (open source, most extensible after R digitize) R digitize (free, open source), because it simplifies the processs of getting data from the graph into an analysis by keeping all of the steps in R. See the tutorial in R-Journal GrabIt! (free demo, $69) Excel plug-in WebPlotDigitzer (free, online). Browser based, extracts data from images. Reviewed here. Programs I have not used: GraphClick (Mac, $8) g3data (open source - GNU GPL) Has zoom window, no auto-recognition. Available in Ubuntu repository. GRABIT OpenSource (BSD) plugin that runs in a proprietary platform, Matlab TL;DR: WebPlotDigitizer is available as a web application as well as a chrome plugin
Check out the digitize package for R. Its designed to solve exactly this sort of problem.
Is there any theory or field of study that concerns itself with modeling causation rather than correlation?
Causal inference is a part of statistical inference, so it falls within the field of statistics. Causal inference generally requires inference of statistical associations under an appropriate experimental structure that limits statistical associations to certain structures. This is dealt with in specialist books that look at the interaction of causality and probability, most notably the excellent works of Judea Pearl (see e.g., Pearl 2009, Pearl 2015, and Pearl, Glymour and Jewell 2016) and the potential-outcome framework of Donald Rubin (see e.g., Holland 1986, Rubin 1991, Rubin 2005). Pearl has criticised the statistical profession for paying insufficient attention to this material (see related question here), but his works nevertheless fall within the field of statistics and they can properly be regarded as contributions in the interface of probability, causality, and statistics. As you will see from reading these works, it is possible to augment traditional probability theory by adding an operator to represent an action/intervention in the system (called the "do" operator), which allows causality to be built into the analysis at an axiomatic level. This is a useful extension of traditional probability theory. Presently, the statistics curriculum for students does not incorporate much of this material, except in some specialist classes that occur late in the program. It is my hope that this extension to probability theory will eventually be built into the statistical curriculum in a more cohesive manner, so that students become fluent in causal reasoning earlier on in their statistical studies, rather than seeing it as an add-on that they encounter only later in their career.
Adrian Keister provided a great answer. My answer continues his. It took me a while to realize that the 2 different approaches to causal inference (graphical approach and potential outcomes) are complementary. To get the best appreciation for how these 2 approaches to causal inference work together I would recommend reading Morgan & Winship "Counterfactuals and Causal Inference". From this book you will learn that there are 3 main ways to estimate causal effects: 1) backdoor criterion, 2) instrumental variables, and 3) front-door criterion. While there are 3 methods, the overwhelming majority of causal inference journal articles in econometrics and social science use method#2: instrumental variables. Incidentally, for the instrumental variable approach the DAG is in many ways unnecessary because it always has the same skeleton and can be easily described in words. One may say that for IV a DAG is crucial; yes it is because it must look like the one below (Z is the instrument). But since all IV DAGs must look like this, how crucial is the DAG in IV and what role does it play other than being a nice visualization? A DAG is crucial for method#1: backdoor criterion. But in practice, it is difficult to argue convincingly that a suitable DAG has been constructed. In econometrics or social science you will hardly find a journal article using this method. And if you do, it is almost certainly not going to contain a DAG. From what I've seen this method is used successfully quite often in the medical field. For method#3: front-door criterion the DAG is usually relatively simple, with only a couple front-door paths, and thus it can be easily described in words. So, at the end of the day, the graphical approach is a nice add-on but unless you are estimating causal effects using backdoor criterion (which I find to be rare outside the medical field) or with an elaborate front-door criterion (also relatively rare) a DAG isn't crucial. In contrast, the potential outcomes framework underlies the very substance of causal inference and, frankly, you can't even define causal inference without it. The 2 books by Angrist and Pischke are somewhat unambiguously the best introduction to the potential outcomes approach (in econometrics and social science); the book by Hernan and Robins seems to be highly valued as well, particularly in public health/medical field (but I haven't read it in full). What I consider to be the most valuable contribution of the graphical approach camp is to raise awareness around collider variables; some of its implications (e.g. endogenous selection bias) are critical, top of mind considerations in causal inference across disciplines. My favorite resources: Here is a terrific video series by Abadie, Angrist, and Walters at AEA on Cross-Sectional Econometrics, which can serve as an introduction to the potential outcome framework: https://www.aeaweb.org/conference/cont-ed/2017-webcasts Here is an equally terrific video introduction to the graphical method - an edX course by Miguel Hernan with some incredibly interesting practical examples (primarily from epidemiology) https://www.edx.org/course/causal-diagrams-draw-your-assumptions-before-your (diagram credit: https://donskerclass.github.io/EconometricsII/ControlandIV.html)
Why are parametric tests more powerful than non-parametric tests?
This answer is mostly going to reject the premises in the question. I'd have made it a comment calling for a rephrasing of the question so as not to rely on those premises, but it's much too long, so I guess it's an answer. <blockquote> Why are parametric tests more powerful than non-parametric tests? </blockquote> As a general statement, the title premise is false. Parametric tests are not in general more powerful than nonparametric tests. Some books make such general claims but it makes no sense unless we are very specific about which parametric tests and which nonparametric tests under which parametric assumptions, and we find that in fact it's typically only true if we specifically choose the circumstances under which a parametric test has the highest power relative to any other test -- and even then, there may often be nonparametric tests that have equivalent power in very large samples (with small effect sizes). <blockquote> Is the word choice of "power" the same as statistical power? </blockquote> Yes. However, to compute power we need to specify a precise set of assumptions and a specific alternative. <blockquote> I don't understand how this relates to statistical tests based on the normal distribution specifically. </blockquote> Nothing about the terms "parametric" nor "nonparametric" relate specifically to the normal distribution. see the opening paragraph here: https://en.wikipedia.org/wiki/Parametric_statistics <blockquote> Parametric statistics is a branch of statistics which assumes that sample data comes from a population that can be adequately modeled by a probability distribution that has a fixed set of parameters.$^{[1]}$ Conversely a non-parametric model does not assume an explicit (finite-parametric) mathematical form for the distribution when modeling the data. However, it may make some assumptions about that distribution, such as continuity or symmetry. </blockquote> Some textbooks (particularly ones written for students in some application areas, typically by academics in those areas) get this definition quite wrong. Beware; in my experience, if this term is misused, much else will tend to be wrong as well. Can we make a true statement that says something like what's in your question? Yes, but it requires heavy qualification. If we use the uniformly most powerful test (should such a test exist) under some specific distributional assumption, and that distributional assumption is exactly correct, and all the other assumptions hold, then a nonparametric test will not exceed that power (otherwise the parametric test would not have been uniformly most powerful after all). However - in spite of stacking the deck in favour of the parametric test like that - in many cases you can find a nonparametric test that has the same large sample power in exactly that stacked-deck situation -- it just won't be one of the common rank-based tests you're likely to have seen before. What we're doing is in the parametric case choosing a test statistic which has all the information in the statistic about the difference from the null, given the distributional assumption and the specific form of alternative. If you optimize power under some set of assumptions, obviously you can't beat it under those assumptions, and that's the situation we're in. Conover's book Practical Nonparametric Statistics has a section discussing tests with an asymptotic relative efficiency (ARE) of 1, relative to tests that assume normality. This ARE is while under that normal assumption. He focuses there on normal scores tests (score-based rank-tests which I would tend to avoid in most typical situations for other reasons), but it does help to illustrate that the claimed advantages for parametric tests may not always be so clear. It's the next section (on permutation tests, under "Fishers Method of Randomization") where I tend to focus. In any case, such stacking of the deck in favour of the parametric assumption still doesn't universally beat nonparametric tests. Of course, in a real-world testing situation such neatly 'stacked decks' don't occur. The parametric model is not a fact about our real data, but a model -- a convenient approximation. As George Box put it, All models are wrong. In this case the questions we would want to ask are (a) "is there a nonparametric test that's essentially as powerful as this parametric test in the situation where the parametric assumption holds?" (to which the answer is often 'yes') and (b) "how far do we need to modify the exact parametric assumption before it is less powerful than some suitable nonparametric test?" (which is often "hardly at all"). In that case, if you don't know which of the two sets of circumstances you're in, why would you prefer the parametric test? Let me address a common test. Consider the two-sample equal-variance t-test, which is uniformly most powerful for a one-sided test of a shift in mean when the population is exactly normal. (a) Is it more powerful than every nonparametric test? Well, no, in the sense that there are nonparametric tests whose asymptotic relative efficiency is 1 (that is, if you look at the ratio of sample sizes required to achieve the same power at a given significance level, that ratio goes to 1 in large samples); specifically there are permutation tests (e.g. based on the same statistic) with this property. The asymptotic power is also a good guide to the relative power at typical sample sizes (if you make sure the tests are being performed at the same actual significance level). (b) Do you need to modify the situation much before some non-parametric test has better power? As I suggested above, in this location-test under normality case, hardly at all. Even if we restrict consideration to just the most commonly used rank tests (which is limiting our potential power), you don't need to make the distribution very much more heavy-tailed than the normal before the Wilcoxon-Mann-Whitney test typically has better power. If we're allowed to choose something with better power at the normal (though the Wilcoxon-Mann-Whitney has excellent performance there), it can kick in even quicker. It can be extremely hard to tell whether you're sampling from a population with a very slightly heavier tail than the one you assumed, so having slightly better power (at best) in a situation you cannot be confident holds may be an extremely dubious advantage. In any case you should not try to tell which situation you're in by looking at the sample you're conducting the test on (at least not if it will affect your choice of test), since that data-based test choice will impact the properties of your subsequently chosen test.
You apply parametric tests under the assumption that the parametric model is right. This always greatly constrains the set of possibilities you are considering. Hence the power. Consider a parametric bootstrapping where you constrain all possible distributions to a particular set of distributions such as normal. So instead of infinite set of all possible distributions you are only looking at Gaussian with just two parameters. Naturally, the tests you can come up with are going to be sharper. Remember that the power comes from the assumptions, and unfortunately, assumptions are often wrong. If your assumption is wrong then the power evaporates. No free lunch here
Can I use a tiny Validation set?
Larger validation sets give more accurate estimates of out-of-sample performance. But as you've noticed, at some point that estimate might be as accurate as you need it to be, and you can make some rough predictions as to the validation sample size you need to reach that point. For simple correct/incorrect classification accuracy, you can calculate the standard error of the estimate as $\sqrt{p(1p)/n}$ (standard deviation of a Bernouilli variable), where $p$ is the probability of a correct classification, and $n$ is the size of the validation set. Of course you don't know $p$, but you might have some idea of its range. E.g. let's say you expect an accuracy between 60-80%, and you want your estimates to have a standard error smaller than 0.1%: $$ \sqrt{p(1p)/n}<0.001 $$ How large should $n$ (the size of the validation set) be? For $p=0.6$ we get: $$ n > \frac{0.6-0.6^2}{0.001^2}=240,000 $$ For $p=0.8$ we get: $$ n > \frac{0.8-0.8^2}{0.001^2}=160,000 $$ So this tells us you could get away with using less than 5% of your 5 million data samples, for validation. This percentage goes down if you expect higher performance, or especially if you are satisfied with a lower standard error of your out-of-sample performance estimate (e.g. with $p=0.7$ and for a s.e. < 1%, you need only 2100 validation samples, or less than a twentieth of a percent of your data). These calculations also showcase the point made by Tim in his answer, that the accuracy of your estimates depends on the absolute size of your validation set (i.e. on $n$), rather than its size relative to the training set. (Also I might add that I'm assuming representative sampling here. If your data are very heterogeneous you might need to use larger validation sets just to make sure that the validation data includes all the same conditions etc. as your train & test data.)
Nice discussion of this problem is provided by Andrew Ng on his Deep Learning course on Coursera.org. As he notes, the standard splits like 8:2, or 9:1 are valid if your data is small to moderately big, but many present day machine learning problems use huge amounts of data (e.g. millions of observations as in your case), and in such scenario you could leave 2%, 1%, or even less of the data as a test set, taking all the remaining data for your training set (he actually argues for using also a dev set). As he argues, the more data you feed your algorithm, the better for its performance and this is especially true for deep learning* (he also notes that this must not be the cases for non-deep learning machine learning algorithms). As already noticed in comment by Alex Burn, it is not really about size of your test set, but about its representativeness for your problem. Usually with larger size of the data we hope for it to be more representative, but this does not have to be the case. This is always a trade-off and you need to make problem-specific considerations. There is no rules telling that test set should not be less then X cases, or less then Y% of your data. * - Disclaimer: I am repeating Andrew Ng's arguments in here, I wouldn't consider myself as a specialist in deep learning.
Why don't we use significant digits?
Significant digits are used in some fields (I learned about them in Chemistry) to indicate the degree of meaningful precision that exists in a number. This is an important topic in statistics as well, so in fact we report this constantly--we just report it in a different form. Specifically, we report confidence intervals, which indicate the level of precision of an estimate (such as a mean). Once you've listed the 95% CI for an estimate, such as $(-0.12, 1.12)$, you can list as many digits for your mean as you might like, such as $0.50129519823975923$, and there is no problem. In fact, the statistician Andrew Gelman has recommended that you list at least four (2009, p. 4).
One reason for restricting the number of digits reported in many estimates, p-values, etc. is based on perception. Reporting something like p = 0.04872429 implies a level of precision in the results that causes them to be perceived as more accurate. Essentially, the use of high numbers of digits in reporting statistical results tastes too many of trying to cloak your findings in an undeserved air of authority.
Why use a z test rather than a t test with proportional data?
Short version: You don't use a t-test because the obvious statistic doesn't have a t-distribution. It does (approximately) have a z-distribution. Longer version: In the usual t-tests, the t-statistics are all of the form: $\frac{d}{s}$, where $s$ is an estimated standard error of $d$. The t-distribution arises from the following: 1) $d$ is normally distributed (with mean 0, since we're talking about distribution under $H_0$) 2) $k.s^2$ is $\chi^2$, for some $k$ (I don't want to belabor the details of what $k$ will be, since I'm covering many different forms of t-test here) 3) $d$ and $s$ are independent Those are a pretty strict set of circumstances. You only get all three to hold when you have normal data. If, instead, the estimate, $s$ is replaced by the actual value of the standard error of $d$ ($\sigma_d$), that form of statistic would have a $z-$distribution. When sample sizes are sufficiently large, a statistic like $d$ (which is often a shifted mean or a difference of means) is very often asymptotically normally distributed*, due to the central limit theorem. * more precisely, a standardized version of $d$, $d/\sigma_d$ will be asymptotically standard normal Many people think that this immediately justifies using a t-test, but as you see from the above list, we only satisfied the first of the three conditions under which the t-test was derived. On the other hand, there's another theorem, called Slutsky's theorem that helps us out. As long as the denominator converges in probability to that unknown standard error, $\sigma_d$ (a fairly weak condition), then $d/s$ should converge to a standard normal distribution. The usual one and two-sample proportions tests are of this form, and thus we have some justification for treating them as asymptotically normal, but we have no justification for treating them as $t$-distributed. In practice, as long as $np$ and $n(1-p)$ are not too small**, the asymptotic normality of the one and two-sample proportions tests comes in very rapidly (that is, often surprisingly small $n$ is enough for both theorems to 'kick in' as it were and the asymptotic behavior to be a good approximation to small sample behavior). ** though there are other ways to characterize "large enough" than that, conditions of that form seem to be the most common. While we don't seem to have a good argument (at least not that I have seen) that would establish that the t should be expected to be better than the z as an approximation to the discrete distribution of the test statistic at any particular sample size, nevertheless in practice the approximation obtained by using a t-test on 0-1 data seems to be quite good, as long as the usual conditions under which the z should be a reasonable approximation hold. <blockquote> is there a simple way to conduct an omnibus test for significant differences between more than 2 proportions (in the form of percentages) </blockquote> Sure. You can put it into the form of a chi-square test. (Indeed, akin to ANOVA you can even construct contrasts and multiple comparisons and such.) It's not clear from your question, however, whether your generalization will have two samples with several categories, or multiple samples with two categories (or even both at once, I guess). In either case, you can get a chi-square. If you are more specific I should be able to give more specific details.
The reason you can use a $z$-test with proportion data is because the standard deviation of a proportion is a function of the proportion itself. Thus, once you have estimated the proportion in your sample, you don't have an extra source of uncertainty that you have to take into account. As a result, you can use the normal distribution instead of the $t$ distribution as your sampling distribution. To learn more about this, see my answer here: The $z$-test vs the $\chi^2$-test for comparing the odds of catching a cold in 2 groups. If you have more than 2 groups, you can use logistic regression, as you note. You do have to know the $n_j$s in each group however. If you just had a set of observed proportions, but didn't know how many trials had been observed to generate those proportions, you cannot run a proper test of whether the proportions differed.
Windows equivalent of whereis?
2021 - Windows 10/11 <code>gcm <command></code> Get-Command
Please, use where command: <code>> where app.exe </code> It is the best way to achieve your goal. You can also use PowerShell command: <code>> $env:path.Split(';') | gci -Filter app.exe </code> and expanded version looks like this: <code> > $env:path.Split(';') | select -Unique | ? {$_ -and (test-path $_)} | gci -Filter app.exe </code>
Linux Bash Script, Single Command But Multiple Lines?
You can use this in bash <code>PARAMS=( -cvpzf /share/Recovery/Snapshots/$HOSTNAME_$DATE.tar.gz --exclude=`enter code here`/proc --exclude=/lost+found --exclude=/sys --exclude=/mnt # this is a comment --exclude=/media --exclude=/dev # --exclude=/something --exclude=/share/Archive / ) # the quotes are needed to preserve params with spaces tar "${PARAMS[@]}" </code>
The same command, but with comments for each line, would be: <code>tar -cvpzf /share/Recovery/Snapshots/$(hostname)_$(date +%Y%m%d).tar.gz `#first comment` \ --exclude=/proc `#second comment` \ --exclude=/lost+found `# and so on...` \ --exclude=/sys \ --exclude=/mnt \ --exclude=/media \ --exclude=/dev \ --exclude=/share/Archive \ / </code>
Word heading number blacked out <sep> When opening the document I am working on in Word 2010 this morning, the number in heading level 1 is a black rectangle: however, it still look ok in the bookmark pane: Weird, ey?
I tried all of the answers above, some worked, but... the black rectangle came back each time I reopened the document. In short : I had to remove all the numberings (A) and recreate the multilevel list(B). Here is how to do it: A: Remove the numbering Place the cursor on the first Heading 1. Click on the button Numbering in Ribbon/Home/Paragraph to remove the number (1 on the picture). Select the whole line where your Heading 1 Right-Click on Heading 1 in the Ribbon/Home/Style and select "update heading 1 to match selection" (2 on the picture) Redo step 1 to 4 for all your headings (I had to go until Heading 6). Make sure by scrolling down in the navigation/heading panel, that all the number before your headings are removed. B: recreate a multilevel list Place the cursor just before the first heading 1 Click on Multilevel list in Ribbon/Home/Paragraph and choose the format you want (3 on the picture). [In a comment, fl0w also suggests to select "Define new multilevel list" and construct a multilevel list]
I spent around 5 hours trying to fix this problem and was close to pulling my hair out. I tried every fix suggested on the net (creating new multi lists and importing uncorrupted styles etc) and the problem kept returning. The below seems to have worked for me and I hope it's a permanent solution. Firstly I did the following as has been suggested by a number of users a) Put your cursor on the heading just right of the black box b) Use the left arrow key on your keyboard to move left until the black box turns grey c). Use the keyboard combination ctrl+shift+s, the dialog "Apply Styles" should appear d) In this box, click "reapply" Once the black boxes had disappeared I saved the document as a word 1997-2003 document (document 2). I resaved document 2 as a normal word document (2013 in my case) and selected the compatibility mode option when saving (document 3) I resaved document 3 as a word document (2013) and deselected the compatibility mode option (document 4). It seems to have worked and the black boxes have disappeared. I hope this is a permanent fix otherwise I will go back to working on document 2 (word 2003 version).
How do I remove the same part of a file name for many files in Windows 7?
ReNamer can do that. In ReNamer, just add a 'remove' rule like this (a 'delete' rule will also work): And then drag and drop the files, or the folder containing the files you want renamed to its window (or use the 'Add Files/Folders' buttons), then check the preview, and once verified, click on 'Rename':
Try this software http://www.bulkrenameutility.co.uk/Main_Intro.php <blockquote> Bulk Rename Utility is a free file renaming software for Windows. Bulk Rename Utility allows you to easily rename files and entire folders based upon extremely flexible criteria. Add date/time stamps, replace numbers, insert text, convert case, add auto-numbers, process folders and sub-folders....plus a whole lot more! Rename multiple files quickly, according to many flexible criteria. Rename files in many ways: add, replace, insert text into file names. Convert case, add numbers. Remove or change file extensions. Check the detailed preview before renaming. Rename photos using EXIF meta data (i.e. "Date Picture Taken", "Resolution" and other information embedded in all JPG photo files) Rename your holiday pictures from a meaningless dsc1790.jpg to NewYork1.jpg in a flash. Rename MP3 files using ID3 tags (a.k.a. MP3 ID3 tag renaming). Change files' creation and modification time stamps. It's free. Easy to Install. Download and start renaming your files now! </blockquote>
Is there a simple method to copy an image from Google Docs to the local clipboard?
Use shift + right click Then you can download the pictures. Note: You have to double click on the image to select it first.
If you have many files, use File -> Download as -> Web Page (.html zipped) Then you can unzip on the desktop, and use the files. Otherwise, press CTRL + A (selects the entire document/page) Open Microsoft Word (if on Windows/Mac) Press CTRL + V (or right-click - insert) to paste the clipboard to Word Right-click the image in Word and choose "Save as Picture" (requires Office 2013, if you use Powerpoint it works in 2010 as well) Or as mentioned by warrax, you can use the Chrome Developer Tools (F12, or CTRL + J)
How to remove security from a PDF file?
Contrary to the other solutions, you do not need additional software. Anyone with Windows can do it with no extra software in 4 simple steps. Open the PDF Go to File > Print. From your print options choose Microsoft XPS Document Writer. Although you might expect it to print, it does not print anything, it will create an XPS Document. Open the resulting XPS file Press Print, go to Microsoft PDF Creator. It will now save it as a PDF again. Again, it will not print. In my case I had to remove the first/last page of a document so I only printed the pages required.
Print to a PostScript (PS) printer (where the printer's port is set to print to file, not to the printer -- or check the "Print to file" option in the Print dialog) Edit the resulting <code>.ps</code> file and remove: <code>mark currentfile eexec 54dc5232e897cbaaa7584b7da7c23a6c59e7451851159cdbf40334cc2600 ... cleartomark </code> Save and distill the <code>.ps</code> file
How to create a formula for every row in a column in Google SpreadSheet?
The suggested answers work well for small sheets but I had thousands of rows and using the mouse or the keyboard to select them was simply too time consuming. The ARRAYFORMULA method works but it's complicated, forces me to rewrite formula style and consider possible errors). The solution is so simple it can be done in 2 seconds: Write your new formula in the first CELL. click on the cell, press CTRL+C (copy the cell) click on the column header (for example A) to select the whole column CTRL+V -> paste the cell formula into the whole column profit
here is a another way, go ahead and delete all the formulas that are in there right now, then type in the formula in C1 having it correspond to A1 and B1 and hit enter. so now the correct formula is just in C1, now click the C1 box, a bounding box will appear, the bottom right corner of this bounding box has a dark square, double click this square and the formula will 'fill down' you will notice C2 corresponds to A2 and B2 and so on. if this is what you need and i am understanding correctly
Move a layer to specific X,Y position in Gimp <sep> How do I move a layer to a specific XY position within the canvas in Gimp?
Pick (alignment tool). Make it <code>Relative to</code> <code>Image</code>. Click on your layer (in the canvas). Enter X in the <code>Offset</code> field. Click on <code>Distribute</code> / (left arrow). Enter Y in the <code>Offset</code> field. Click on <code>Distribute</code> / (up arrow). That's it!
There is a script to do this that can be download from the GIMP Plugin registry. It is called: Move Layer To (download). To install: Move the script to <code>%USERPROFILE\.gimp-2.8\scripts</code> directory on Windows, <code>~/Library/Application Support/GIMP/2.8/scripts</code> on OS X or <code>~/.gimp-2.8/scripts</code> on Linux. (Official instructions) Clicks <code>Filters</code> -> <code>Script-Fu</code> -> <code>Refresh scripts</code>. The new menu item will appear at the bottom of the <code>Layer</code> menu <code>Move to</code>.
Routing Applications sound to different sound device?
I found : Audio Router @ the provided link on reddit. https://www.reddit.com/r/software/comments/3f3em6/is_there_a_alternative_to_chevolume/ There's a download link there, and some info on it. https://reddit.com/user/audiorouterdev - is the developer I had heaps of issues with CheVolume, and so far this works great and at the moment it's free. Added Source/Download Link: https://github.com/audiorouterdev/audio-router
I know that I'm kinda late, but maybe this can help other people. @studiohack The tool you're looking for is Chevolume (http://chevolume.com/). It allows per application audio control. Sadly it's not free, but totally worth those few bucks.
Chrome keyboard shortcut to pause script execution <sep> Is there a keyboard shortcut in Google Chrome which will break script execution?
Google's Keyboard Shortcuts Reference lists for "Pause / resume script execution": F8 or Ctrl+\ (Windows) F8 or Cmd+\ (Mac) There are easier ways to inspect things in odd states like hover or active. First, find the DOM node in the Elements pane of Chrome Dev Tools. Now you can either right-click the node and look at the "Force Element State" in the context menu, or select the node and look in the Styles tab and find the dashed-box-with-mouse-pointer icon in the top right (next to the +/plus icon which lets you add a new CSS rule to <code>element.style</code>, the element you selected). When you activate one of these states, the left margin of the elements pane gets a little circle to indicate that you've overridden the natural state of the element on that line.
I wrote a quick little Chrome Extension that allows you to press the Pause button on your keyboard to pause javascript execution How to get it: Chrome WebStore Source Code on GitHub CRX File Usage: Keep chrome developer tools open Press <code>pause/break</code> on your keyboard
Create application shortcut...' Chrome's feature in Firefox?
New Update 2020 Please see Amer's excellent answer. (If you want the icon to remain in the taskbar, right-click it and click "Pin to taskbar".) Caveats: Since the Site-Specific Browser (SSB) feature is disabled (off) by default, it might be experimental. There's no "Loading" progress indicator in the SSB window. Sometimes you'd stare at a blank window and wonder what's happening. There's no Zoom function. If you had already set Zoom level in Firefox main window, it doesn't carry to the SSB window. It's always at 100% zoom level. The window title never changes. It's always the fixed title. This is bad for web-apps that change the title to indicate something. (I suppose the icon may not change either.) If you had already enabled notifications via Firefox main window you may get them, however if you've never enabled it, I'm not sure if you can enable it from the SSB window. There's no standard right-click context menu - not even on text fields. This really hampers usability since you cannot copy, paste, refresh page, etc. without using keyboard shortcuts. (Application-specific right-click menus still work, since these are part of the website's own code, not from the browser itself.) The web app's window doesn't remember its last position and size. These caveats make the SSB solution less than ideal right now. Hopefully they fix these in future FF versions. But if all you're looking for is a dedicated window for your web-app through Firefox, it's a good solution. Previous Update 2017 You can sort-of do this now, with a small config change and a bookmarklet. (I have not experimented with desktop shortcuts, but it might be possible.) Go to <code>about:config</code> and set <code>dom.disable_window_open_feature.location</code> to false. This is optional, but it removes the disabled location bar at the top of the window. Create a bookmarklet (that's really just a regular bookmark but executes Javascript): <code> javascript:(function(){window.open("https://www.google.com/","_blank","menubar=no,location=no,toolbar=no,scrollbars=yes,left=150,top=50");})(); </code> Replace <code>https://www.google.com/</code> with your URL. When you open this bookmarklet, it will open the site in a separate dedicated window. You may want to adjust the values of <code>left</code> and <code>top</code> as needed. Bonus Tip: If you have "Show your windows and tabs from last time" enabled, when you exit and restart Firefox with the dedicated window open, it is also restored. Previous Answer Update: Support for this flag appears to have been removed from the latest versions of Firefox. Firefox has a terribly under-documented flag <code>-chrome</code>: <blockquote> <code>firefox.exe -chrome http://superuser.com </code> </blockquote> Like Chrome application shortcut: <blockquote> Creates a basic window with just the web page and the plain window chrome (no tab bar, address bar, etc). Usable as an "application". </blockquote> Unlike Chrome application shortcut: <blockquote> The window is always created with the full size of the page. For AJAX-based empty pages that only fill themselves after page-load, this would result in a very tiny window at the top-left corner of the screen. Thankfully you can manually resize the window. If you try <code>superuser.com</code>, you will get a window that's very very long. Undocumented flags <code>-width</code> and <code>-height</code> do not work. It may be possible to have a post-launch process find the window and adjust the window size automatically, but that seems too much work for the average user. Favicon is not used as the window icon. The window still has the Firefox icon. In Windows taskbar grouping, the window is grouped with Firefox's main window. In Google Chrome, an application shortcut really runs as separate Windows program and is not grouped with Chrome's main window. Due to this, if a shortcut to the app is pinned in the taskbar, the shortcut doesn't become the window of the app. Also, exiting Firefox will close the app. Launching again will not restore the app even if Firefox is set to restore all tabs and windows. No right-click menu. No back-forward functionality (even with keyboard shorcuts). Cannot reload or zoom. Doesn't remember zoom set in Firefox main window. Using arrow keys to move text caret when typing in a textbox can sometimes produce weird results. This feature sometimes causes Windows to enter a black screen and come back with "Windows Basic Color Scheme" mode (all Aero effects will be gone). I would classify this as a bug. It doesn't always happen. If this happens, open command prompt and run <code>net stop uxsms</code> followed by <code>net start uxsms</code>. </blockquote> Other than the above problems, it works fine.
Mozilla Prism (formerly WebRunner) by Mozilla Labs featured the "Create application shortcut" in Firefox: <blockquote> Mozilla Prism (formerly WebRunner) is a product which integrates web applications with the desktop, allowing web applications to be launched from the desktop and configured independently of the default web browser. Users can manually create web applications using <code>Tools > Convert Website to Application</code>. </blockquote> However, since November 2010, Prism is listed as an inactive project at the Mozilla labs website. On February 1, 2011, Mozilla labs announced it would no longer maintain Prism. There were several alternatives to Prism, but it seems that all of them have been discontinued and are no longer active or available for download. In the following question: Why is Firefox Prism not in the repositories anymore?, there are two useful answers, regarding the discontinue of Prism and possible alternatives and solutions. It was mentioned that web application support in Firefox is currently in progress. Also, some workarounds have been suggested.
How to format a drive encrypted with Bitlocker?
I figured it out - You do this: Hit Win+R to open the run dialogue box and type <code>diskpart</code> and hit OK to open a black command prompt window. Type <code>list disk</code> to display all the disks of your computer. Type <code>select disk n</code>. Here <code>n</code> stands for the disk you want to work well. Type <code>list partition</code> to display all the volumes on the hard drive. Type <code>select partition n</code>. Here n stands for the volume you want to delete. Type <code>delete partition override</code> to get rid of the volume. Type <code>exit</code> to close the window. This will wipe all the data on the USB/Partition. Take your USB out and put it back in again. You then need to go into Computer Management > Disk Management Right click the USB/partition > Make new volume. Then follow the prompts.. Next > next > next - then your done!
Start a Linux Live CD like the one from GParted and delete all (Bitlocker enabled) partitions. If that doesn't help, there is still the possibility to wipe the complete disk - after overwriting the first few megabytes the HDD will be recognized as fresh new HDD by Windows. You can do that for example using DBAN but don't forget to disconnect all the other HDDs before using it - otherwise you may delete the wrong HDD and lose all your data.
Copy current path to clipboard or select address bar in Total Commander <sep> Is there any shortcut to copy the path of the current directory in Total Commander?
Home, then Shift+F6. As molgar / randy-skretka said, and also Ctrl+P but use Shift+ and Shift+ to go to command line and cut with Ctrl+X. because that also works in Brief and Thumbnail View 'mode', not only in Full (extra: see available modes with Shift+F1).
<blockquote> Is there any shortcut to copy the path of the current directory in Total Commander? </blockquote> Ctrl+P and then OR (arrow keys) to copy the current directory to the command line and then select it for you. Then just Ctrl+C copy. <blockquote> Also, is it possible to select or highlight the address bar with a keyboard shortcut? </blockquote> Use your Home key to put you over the [..] notation at the top of the directory listing. That's the parent directory. Then use Shift+F6 to focus on and highlight the address bar (edit it if you need to!).
How to use SSH private key to log in without entering passphrase every time on Mac OS X Lion?
During the process of resolving the "problem", I've googled some related topics and write down some notes about how <code>ssh-agent</code>, <code>ssh-add</code>, <code>keychain</code>, <code>KeyChain Access.app</code> work. It finally turns out that this issue is not a problem at all, instead the issue is all about me, and so called ssh-login-without-asking-passphrase-every-time works perfectly on Mac out of box. However, this process gains me some experiences. I write down my notes here in hope that they help someone confusing about those terms. Two password terms: <code>passphrase</code> refers to the required phrase when accessing your SSH private key. <code>password</code> refers to the required phrase to log in to your Mac. Now I can figure out what these toolkits do, that is, <code>ssh-agent</code>, <code>ssh-add</code>, <code>keychain</code>, <code>Keychain Access.app</code> on Mac. <code>ssh-agent</code> is the critical service to enable using SSH private key without typing SSH passphrase. <code>ssh-agent</code> works in this way. First it stores, or cache, your SSH private key in main memory. Then at a later time in this session when your SSH private SSH key is needed for remote authentication, <code>ssh-agent</code> will find your private key in main memory and hand it to the remote process. The only chance you are asked to type your SSH passphrase is when your private key is added by <code>ssh-agent</code> initially. <code>ssh-add</code> is part of <code>ssh-agent</code> collection, which helps to manage your SSH keys in <code>ssh-agent</code>. We use <code>ssh-add</code> command to list, add, remove private keys in ssh-agent's keyring. Then <code>ssh-add</code> communicates with <code>ssh-agent</code> service to fulfill the tasks. <code>keychain</code> is script to find <code>ssh-agent</code> service (if not exist, start a new one) and call <code>ssh-add</code> to add SSH private keys. <code>keychain</code> has a simple and straight-forward idea, working fine on Linux where ssh-agent usually doesn't automatically start up. <code>Keychain Access.app</code> seems to be the most complicated component. It is Mac OS X's universal token storage service. It stores various of tokens, such as passwords, certs, et al, and serves as an token agent for those apps that request the tokens. In our SSH private key case, first it grasps the request for accessing SSH private key and pops up a window to ask you to store the SSH passphrase, which is a kind of token, into <code>Keychain Access.app</code>'s keyring. Then next time when you are to use private keys for authentication, <code>Keychain Access.app</code> pops up a window again, asking whether granting the privilege. After getting a big yes, <code>keychain Access.app</code> adds your private key into <code>ssh-agent</code>'s storage. Two things deserve your attention: Mac OS X Lion automatically starts a <code>ssh-agent</code> service at start up, listening on a socket under <code>/tmp</code>. <code>Keychain Access.app</code> stores your SSH passphrase, so it can add your private key into <code>ssh-agent</code> without interrupting you. Yes, no need to type your SSH phrase, but need to type your Mac account's login password for granting privilege when creating this entry for the first time. So, in summary, SSH-login-without-asking-passphrase should work on Mac OS X out of box.
<code>ssh-agent</code> is the piece that you want to get working, as it does exactly what you're asking about. The agent runs as a daemon, and when you "add" a private key to it, it remembers that key and automatically provides it to the remote <code>sshd</code> during the initial connection. (<code>ssh-add</code> is simply the command you run to manually add a private key to <code>ssh-agent</code>). In OS X, as of Leopard, you shouldn't ever have to run <code>ssh-agent</code> or <code>ssh-add</code> manually. It should "just happen" when you attempt to connect to a server. Once per key, it will prompt you with a UI password dialog, which (among other things) will allow you to automatically add the key to the <code>ssh-agent</code> so you never get prompted again. This is handled by having a <code>launchd</code> configuration that listens for connections on the <code>$SSH_AUTH_SOCK</code> socket, and automatically launches <code>ssh-agent</code> when it first needs to; after that, <code>ssh-agent</code> prompts you for credentials only when it needs to open a new key. If that's not working, make sure you have the correct <code>launchd</code> configuration file present: <code>/System/Library/LaunchAgents/org.openbsd.ssh-agent.plist </code> If it's still not working for you for some reason, here's the "old" way of getting things running by hand: http://timesinker.blogspot.com/2007/08/getting-ssh-agent-going-on-mac-osx.html There is also this application, which I have stopped using since Leopard came out but basically did the same thing in previous versions of Mac OS X: http://www.sshkeychain.org/
Linux: Specifying top level-directory when creating zip archive <sep> I have project with the usual directory structure (src/, bin/, ...), i.e <code>project-name/ |-- bin |-- lib |-- src `-- Makefile </code> And would like to create an archive with the following directory structure: <code>project-name-version/ |-- bin |-- lib |-- src `-- Makefile </code> Is there a neat way to do this, which avoids creating a temporary directory <code>project-name/</code> elsewhere, then copying the files inside a finally calling <code>zip -r ...</code> on that temporary directory?
This is more an advice than an answer: use Git! If you setup a Git repository for your project, the whole thing become quite straightforward: <code>git archive HEAD --prefix=project-name-version/ \ --format=zip -o project-name-version.zip </code>
Maybe this already occurred to you, but why not just use a sym link rather than copy everything? <code>ln -s project-name project-name-version </code> then use <code>zip -r</code> through the sym link (<code>zip</code> will dereference sym links by default)? When you're done you can simply <code>rm</code> the sym link. Perhaps it's not the most elegant solution, but I don't know an obvious way to do it through <code>zip</code> directly.
How do I show Filename, Line Count, and Character Count in vim?
You can get the character and line count by typing <code>g Ctrl-G</code>. To see the filename and line count as you do when you open a file, execute <code>:f</code>. See <code>:help g_CTRL-G :help :f </code>
In <code>~/.vimrc</code>, add the line: <code>set ruler</code>
Proper way to start xvfb on startup on centos?
And now, the systemd answer. It has been almost four years since these questions and answers, and the world has changed whilst they have not. Since version 7, CentOS has used systemd. Ubuntu is mentioned in the question and in comments. Since version 15, Ubuntu has used systemd too. Although one can use System 5 <code>rc</code> scripts under systemd, the scripts in answers here are highly suboptimal, to say the least. One blithely uses <code>killall</code>, whose problems for dæmon management are well known; and the other is a mess of rickety lock file and PID file logic none of which is actually necessary under a service manager, since service managers themselves keep track of dæmon processes. As I have said elsewhere, if you're starting to learn this stuff and are on CentOS Linux version 7 or later or Ubuntu Linux version 15 or later, don't begin with System 5 <code>rc</code> scripts in the first place. Begin with systemd unit files. a template for multiple Xvfb services Simple <code>xvfb.service</code> systemd unit files for xvfb can be found at https://www.centos.org/forums/viewtopic.php?f=48&t=49080#p208363 and at https://askubuntu.com/a/621256/43344 . However, as I mentioned at the latter one can also take a templatized approach: [Unit] Description=virtual frame buffer X server for display %I After=network.target [Service] ExecStart=/usr/bin/Xvfb %I -screen 0 1280x1024x24 [Install] WantedBy=multi-user.target As a locally-written, non-system non-packaged, unit file for system-wide (as opposed to per-user) services this goes into <code>/etc/systemd/system/xvfb@.service</code> of course. controlling the services One instantiates the template, into an actual named service, with the display number that is desired. For display <code>:99</code>, therefore, there is an actual service instance named <code>xvfb@:99.service</code>. Set the service to auto-start on bootstrap with <code>systemctl enable xvfb@:99.service</code> . Unset auto-starting the service with <code>systemctl disable xvfb@:99.service</code> . Start the service manually with <code>systemctl start xvfb@:99.service</code> . Stop the service manually with <code>systemctl stop xvfb@:99.service</code> . Inspect the current service status in detail with <code>systemctl status xvfb@:99.service</code> . Further reading Stephen Wadeley (2014). "8. Managing Services with systemd" Red Hat Enterprise Linux 7 System Administrators' Guide. Red Hat. Lennart Poettering (2013-10-07). <code>systemctl</code>. systemd manual pages. freedesktop.org. https://unix.stackexchange.com/a/200281/5132
I use the following init script to add and start xvfb on boot just blat that in /etc/init.d/ and run chkconfig xvfb on <code> #!/bin/bash #chkconfig: 345 95 50 #description: Starts xvfb on display 99 if [ -z "$1" ]; then echo "`basename $0` {start|stop}" exit fi case "$1" in start) /usr/bin/Xvfb :99 -screen 0 1280x1024x24 & ;; stop) killall Xvfb ;; esac </code>
Trying to understand a picture of computer buses <sep> In this picture from http://en.kioskea.net/contents/pc/bus.php3 that explains the buses in a computer I wonder whether the black line from CPU to South Bridge is also a bus?
here's a picture from Ars Technica that may be clearer
A bus is just a medium of communication with the following properties: Multiple entities can be connected to it If one entity sends a message or "does something" to the bus, every other entity can see it Bad things will happen if two entities try to communicate at the same exact time A protocol or set of rules is needed so that all components on the bus have a system where they can take turns using it. Usually this protocol is different according to the purpose and speed of the bus Some sort of addressing scheme is used where devices can say who they are and who they want to talk to Bad things will happen if multiple entities have the same address At the very least entites wanting to "talk" on the bus need to look to see if there is activity going on before they try to send data through it Entities wanting to "listen" on the bus generally need to listen for their own address and only snatch the data meaningful to them If you have any knowledge of networking and most of this sounds familiar it's pretty much similar in concept. The light blue lines represent a bus. The dark blue lines represent what is connected to the bus. To answer your questions: Looks to me like the CPU needs to go through the processor bus, northbridge and PCI bus to get to southbridge. I believe they represent connects to the busses. To me it looks like the labels are identifying the thicker light blue lines. The diagram could be a bit better IMHO. Note that AGP stands for "Accelerated Graphics Port" - technically it's not a bus as multiple components don't come into play there (one of the whole reasons AGP was invented). To software it appears as another PCI bus, though. I think so. IIRC device drivers, in order to access southbridge components, need to interact with PCI bus programmatically. See my initial paragraph. It's possible for a bus to be connected to another bus and take on responsibility of forwarding data through it. These are what "PCI-PCI bridge" devices are if you've ever seen them in Windows Device Manager or <code>lspci</code>.
After Intel's admission, should Sandy Bridge processors be used?
It appears to be a chipset issue, meaning all P67/H67 motherboards are affected - even non-Intel ones, as they share chipsets. It also seems to be limited to SATA 3GB/s ports, excluding SATA0 + 1. The CPU is fine. Wiki: <blockquote> On January 31, 2011, Intel issued a recall on all P67 and H67 motherboards. The issue is hardware related and required a silicon fix, making rolling out a fix impossible. The issue affects SATA 3 Gb/s ports, while not affecting the SATA 6 Gb/s ports. Intel claims this problem will only affect 5% of users over 3 years, however, heavier I/O workloads can exacerbate the problem. Over time, the connection for the SATA 3 Gb/s ports will degrade, causing a drop in performance and eventually loss of connection to SATA devices. The processors themselves were not affected. </blockquote>
The processor is fine, it is the Cougar Point chipset found on all H67/P67 motherboards where the problem lies. This chip set is integrated into motherboards, so it is not a replaceable part. As far as the processor itself it is perfectly fine just wait until they start releasing motherboards with the new chip set on them, it should be around April that we expect to see them. It is safe to keep and use both of them, it is only the 3Gbps SATA ports that are affected (these are SATA ports 2-5) So if you only have two SATA devices you won't notice any problems at all.
How to download video with blob url?
<code><video src="blob:https://www.example.tv/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"> <source src="https://cdn.example.tv/api/media/tv/xyzxyz/index" type="application/x-mpegurl"> </video> </code> I also had <code>blob:</code> URL in <code>video/@src</code>, but by watching <code>Developer tools</code> > <code>Network</code> during playback it turned out that <code>video/source/@src</code> was URL for <code>m3u8</code> playlist. An <code>m3u8</code>-backed video can be readily downloaded by either: <code>ffplay -i "https://cdn.example.tv/api/media/tv/xyzxyz/1080/index.m3u8"</code> <code>ffmpeg -i "https://cdn.example.tv/api/media/tv/xyzxyz/1080/index.m3u8" -codec copy file.mkv</code> tl;dr - blob URL sounds like the binary you want to get but there might be easier way to get the video. Just check out Network tab in Dev tools while you play the video to see what you are actually fetching.
This answer is for Twitter URLs - Right click on the video and click Inspect Elements - You'll find a code like this <code><div id="playerContainer" class="player-container full-screen-enabled" data-config="{&quot;is_360&quot;:false,&quot;duration&quot;:28617,&quot;scribe_widget_origin&quot;:true,&quot;heartbeatEnabled&quot;:true,&quot;video_url&quot;:&quot;https:\/\/video.twimg.com\/ext_tw_video\/844504104512749568\/pu\/pl\/e91Du5N2TZ09ZaW_.m3u8&quot;,&quot;disable_embed&quot;:&quot;0&quot;,&quot;videoInfo&quot;:{&quot;title&quot;:null,&quot;description&quot;:null,&quot;publisher&quot;:{&quot;screen_name&quot;:&quot;MountainButorac&quot;,&quot;name&quot;:&quot;Mountain Butorac&quot;,&quot;profile_image_url&quot;:&quot;https:\/\/pbs.twimg.com\/profile_images\/808318456701521920\/vBvlAASx_normal.jpg&quot;}},&quot;cardUrl&quot;:&quot;https:\/\/t.co\/SdSorop3uN&quot;,&quot;content_type&quot;:&quot;application\/x-mpegURL&quot;,&quot;owner_id&quot;:&quot;14120461&quot;,&quot;looping_enabled&quot;:true,&quot;show_cookie_override_en&quot;:true,&quot;visit_cta_url&quot;:null,&quot;scribe_playlist_url&quot;:&quot;https:\/\/twitter.com\/MountainButorac\/status\/844505243538931714\/video\/1&quot;,&quot;source_type&quot;:&quot;consumer&quot;,&quot;image_src&quot;:&quot;https:\/\/pbs.twimg.com\/ext_tw_video_thumb\/844504104512749568\/pu\/img\/FFt3qkbeOh0RlGfZ.jpg&quot;,&quot;heartbeatIntervalInMs&quot;:5000.0,&quot;use_tfw_live_heartbeat_event_category&quot;:true,&quot;video_loading_timeout&quot;:45000.0,&quot;status&quot;:{&quot;created_at&quot;:&quot;Wed Mar 22 11:05:14 +0000 2017&quot;,&quot;id&quot;:844505243538931714,&quot;id_str&quot;:&quot;844505243538931714&quot;,&quot;text&quot;:&quot;Took my Goddaughter to meet the pope. She stole his hat! https:\/\/t.co\/SdSorop3uN&quot;,&quot;truncated&quot;:false,&quot;entities&quot;:{&quot;hashtags&quot;:[],&quot;symbols&quot;:[],&quot;user_mentions&quot;:[],&quot;urls&quot;:[],&quot;media&quot;:[{&quot;id&quot;:844504104512749568,&quot;id_str&quot;:&quot;844504104512749568&quot;,&quot;indices&quot;:[57,80],&quot;media_url&quot;:&quot;http:\/\/pbs.twimg.com\/ext_tw_video_thumb\/844504104512749568\/pu\/img\/FFt3qkbeOh0RlGfZ.jpg&quot;,&quot;media_url_https&quot;:&quot;https:\/\/pbs.twimg.com\/ext_tw_video_thumb\/844504104512749568\/pu\/img\/FFt3qkbeOh0RlGfZ.jpg&quot;,&quot;url&quot;:&quot;https:\/\/t.co\/SdSorop3uN&quot;,&quot;display_url&quot;:&quot;pic.twitter.com\/SdSorop3uN&quot;,&quot;expanded_url&quot;:&quot;https:\/\/twitter.com\/MountainButorac\/status\/844505243538931714\/video\/1&quot;,&quot;type&quot;:&quot;photo&quot;,&quot;sizes&quot;:{&quot;small&quot;:{&quot;w&quot;:340,&quot;h&quot;:604,&quot;resize&quot;:&quot;fit&quot;},&quot;thumb&quot;:{&quot;w&quot;:150,&quot;h&quot;:150,&quot;resize&quot;:&quot;crop&quot;},&quot;large&quot;:{&quot;w&quot;:576,&quot;h&quot;:1024,&quot;resize&quot;:&quot;fit&quot;},&quot;medium&quot;:{&quot;w&quot;:576,&quot;h&quot;:1024,&quot;resize&quot;:&quot;fit&quot;}}}]},&quot;source&quot;:&quot;\u003ca href=\&quot;http:\/\/twitter.com\/download\/iphone\&quot; rel=\&quot;nofollow\&quot;\u003eTwitter for iPhone\u003c\/a\u003e&quot;,&quot;in_reply_to_status_id&quot;:null,&quot;in_reply_to_status_id_str&quot;:null,&quot;in_reply_to_user_id&quot;:null,&quot;in_reply_to_user_id_str&quot;:null,&quot;in_reply_to_screen_name&quot;:null,&quot;geo&quot;:null,&quot;coordinates&quot;:null,&quot;place&quot;:null,&quot;contributors&quot;:null,&quot;retweet_count&quot;:0,&quot;favorite_count&quot;:0,&quot;favorited&quot;:false,&quot;retweeted&quot;:false,&quot;possibly_sensitive&quot;:false,&quot;lang&quot;:&quot;en&quot;},&quot;show_cookie_override_all&quot;:true,&quot;video_session_enabled&quot;:false,&quot;media_id&quot;:&quot;844504104512749568&quot;,&quot;view_counts&quot;:null,&quot;statusTimestamp&quot;:{&quot;local&quot;:&quot;4:05 AM - 22 Mar 2017&quot;},&quot;media_type&quot;:1,&quot;user&quot;:{&quot;screen_name&quot;:&quot;MountainButorac&quot;,&quot;name&quot;:&quot;Mountain Butorac&quot;,&quot;profile_image_url&quot;:&quot;https:\/\/pbs.twimg.com\/profile_images\/808318456701521920\/vBvlAASx_bigger.jpg&quot;},&quot;watch_now_cta_url&quot;:null,&quot;tweet_id&quot;:&quot;844505243538931714&quot;}" data-source-type="consumer"> </code> 2.Copy Paste above code in notepad++. Replace all the <code>&quot;</code> with <code>"</code> and <code>\/</code> wth <code>/</code> in notepad++. (Use CTRL+H) You'll get something like <code>{ "is_360": false, "duration": 28617, "scribe_widget_origin": true, "heartbeatEnabled": true, "video_url": "https://video.twimg.com/ext_tw_video/844504104512749568/pu/pl/e91Du5N2TZ09ZaW_.m3u8", "disable_embed": "0", "videoInfo": { "title": null, "description": null, "publisher": { "screen_name": "MountainButorac", "name": "Mountain Butorac", "profile_image_url": "https://pbs.twimg.com/profile_images/808318456701521920/vBvlAASx_normal.jpg" } }, "cardUrl": "https://t.co/SdSorop3uN", "content_type": "application/x-mpegURL", "owner_id": "14120461", "looping_enabled": true, "show_cookie_override_en": true, "visit_cta_url": null, "scribe_playlist_url": "https://twitter.com/MountainButorac/status/844505243538931714/video/1", "source_type": "consumer", "image_src": "https://pbs.twimg.com/ext_tw_video_thumb/844504104512749568/pu/img/FFt3qkbeOh0RlGfZ.jpg", "heartbeatIntervalInMs": 5000.0, "use_tfw_live_heartbeat_event_category": true, "video_loading_timeout": 45000.0, "status": { "created_at": "Wed Mar 22 11:05:14 +0000 2017", "id": 844505243538931714, "id_str": "844505243538931714", "text": "Took my Goddaughter to meet the pope. She stole his hat! https://t.co/SdSorop3uN", "truncated": false, "entities": { "hashtags": [], "symbols": [], "user_mentions": [], "urls": [], "media": [{ "id": 844504104512749568, "id_str": "844504104512749568", "indices": [57, 80], "media_url": "http://pbs.twimg.com/ext_tw_video_thumb/844504104512749568/pu/img/FFt3qkbeOh0RlGfZ.jpg", "media_url_https": "https://pbs.twimg.com/ext_tw_video_thumb/844504104512749568/pu/img/FFt3qkbeOh0RlGfZ.jpg", "url": "https://t.co/SdSorop3uN", "display_url": "pic.twitter.com/SdSorop3uN", "expanded_url": "https://twitter.com/MountainButorac/status/844505243538931714/video/1", "type": "photo", "sizes": { "small": { "w": 340, "h": 604, "resize": "fit" }, "thumb": { "w": 150, "h": 150, "resize": "crop" }, "large": { "w": 576, "h": 1024, "resize": "fit" }, "medium": { "w": 576, "h": 1024, "resize": "fit" } } }] }, "source": "\u003ca href=\"http://twitter.com/download/iphone\" rel=\"nofollow\"\u003eTwitter for iPhone\u003c/a\u003e", "in_reply_to_status_id": null, "in_reply_to_status_id_str": null, "in_reply_to_user_id": null, "in_reply_to_user_id_str": null, "in_reply_to_screen_name": null, "geo": null, "coordinates": null, "place": null, "contributors": null, "retweet_count": 0, "favorite_count": 0, "favorited": false, "retweeted": false, "possibly_sensitive": false, "lang": "en" }, "show_cookie_override_all": true, "video_session_enabled": false, "media_id": "844504104512749568", "view_counts": null, "statusTimestamp": { "local": "4:05 AM - 22 Mar 2017" }, "media_type": 1, "user": { "screen_name": "MountainButorac", "name": "Mountain Butorac", "profile_image_url": "https://pbs.twimg.com/profile_images/808318456701521920/vBvlAASx_bigger.jpg" }, "watch_now_cta_url": null, "tweet_id": "844505243538931714" } </code> From above JSON format, see the value video_url <code>https://video.twimg.com/ext_tw_video/844504104512749568/pu/pl/e91Du5N2TZ09ZaW_.m3u8 </code> The issue here is, after August 1st, 2016, Twitter is no longer using .mp4 videos, but converting to a new HLS, adaptive-streaming format, with a .m3u8 file extension. <blockquote> .m3u8 files are basically just a text file wrapper, they are super small (300-500 bytes), and when you open them with a text editor, they contain links to different video sizes </blockquote> Open the file m3u8 in notepad++, it would contain code like this <blockquote> EXTM3U EXT-X-INDEPENDENT-SEGMENTS EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=256000,RESOLUTION=180x320,CODECS="mp4a.40.2,avc1.42001f" /ext_tw_video/844504104512749568/pu/pl/180x320/_Z42SY5zwMlLdFYx.m3u8 EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=832000,RESOLUTION=360x640,CODECS="mp4a.40.2,avc1.42001f" /ext_tw_video/844504104512749568/pu/pl/360x640/-Phfjbbx2yinirLi.m3u8 </blockquote> Copy the respective link from above as per your resolution need. Repeat the same step until you have .ts file. Download the .ts file (the video file).
Why does MIT have a /8 IPv4 block?
The key thing to understand is that the Internet started out as an experiment in interconnecting networks. The creators never expected it to grow into what it is today without major redesign work. In the early days, 8 bits were used to identify the network and 24 bits to identify the host within the network. As the Internet grew, there was concern about running out of network addresses. The original vision of the Internet had been linking a small number of large networks, but the reality was tending more towards a large number of small networks. Classes were introduced by RFC 791 in 1981 to improve address utilisation. Class A addresses had an 8 bit network number and a 24 bit host number. Class B addresses had a 16 bit network number and a 16 bit host number. Class C addresses had a 24 bit network number and an 8 bit host number. The class of an address was determined by its most significant bits (0 for A, 10 for B, 110 for C). When they again started to run out of addresses, CIDR was introduced in 1993, allowing allocations on any power of two blocksize (though, by policy, the smallest blocks routed on the internet were /24, the equivalent of the old class C) and deprecating the division of addresses into classes. Some existing allocations remained in place through these processes. Others fell by the wayside as networks were reorganised. MITs allocation is mentioned in IEN 115 which is dated 1979, so it came from the first phase where every network got what we would now call a /8. A couple of other Universities also appear to have had allocations in the pre-classes era. If we look at RFC 776 which seems to be the last allocation list from the pre-classes era, we see at least three Universities - MIT, Stanford and UCL. MIT actually had TWO allocations for different networks. As far as I can tell, two Universities kept /8 allocations from the pre-classes era into the ICANN era - MIT and Stanford. Stanford gave theirs back in 2000, apparently out of altruism. In 2017, MIT split up their allocation and sold off parts of it. Specifically, they seem to have sold a bunch of /16s to Amazon.
Trying to find a definite answerthere are a few out there like this one and this one on Quorabut basically MIT was one of the earliest/first users of the Internet and because classless inter-domain routing was still not a common thing in the years prior to 1993/94. FWIW, the <code>18.0.0.0/8</code> range was assigned to MIT from at least July 1990 according to the details gleaned in RFC 1166 and related IANA and RIR records show that MIT was recognized as controlling the whole <code>18.0.0.0/8</code> range in January 1994. MITs acquisition of the range was based on the needs of the classful network architecture that was common at the time. The simplest and most succinct answer I can find comes from Greg Skinner on Quora who states: <blockquote> MIT's assignment (<code>18.0.0.0/8</code>) is one of the original assignments created during the early research phase of the Internet. It was originally assigned to MIT-LCS (Laboratory for Computer Science). You can find more information in RFC 796 - Address mappings, and other documents that it references. </blockquote> And going even further into the history of the Internet, the first RFC referencing the assignment of network 18 to MIT-LCS (Laboratory for Computer Science)the lab at MIT that did the work on the Internet at the timecan be found in the Network Working Groups RFC 739 which is dated November 1977; look for LCS Network under the heading, Assigned Network Numbers.
How to view an SVG image on Mac OSX?
A simple way is to use Quick Look in Mac, simply press space key on the keyboard.
If you're part of the unlucky few where double clicking an .svg from Finder or opening it from the command line like <code>open filename.svg</code> just opens your svg file source in a text editor (and you wanted to see it visually), it appears possible to view them in a browser these days. What has happened is you installed a text editor and it "took over" as the default app to open for those file types. Navigate in your web browser to its location, ex: <code>file:///Users/my_username/...</code> full URL should have look like <code>file:///Users/username/folder/folder/my_file.svg</code> you can start by just putting <code>file://</code> in your browser URL then navigate to it. This will "open it" visually in any major web browser. Alternatively right click on it in <code>Finder</code> and select "open with" and select a browser.
Why is a tunnel called a "tunnel"?
Why is a tunnel called a "tunnel"? The phrase was first used (as far as I can tell) in RFC 1075 Distance Vector Multicast Routing Protocol, where it is defined as follows: <blockquote> In addition, to allow experiments to traverse networks that do not support multicasting, a mechanism called "tunneling" was developed. </blockquote> ... <blockquote> Tunnels A tunnel is a method for sending datagrams between routers separated by gateways that do not support multicasting routing. It acts as a virtual network between two routers. For instance, a router running at Stanford, and a router running at BBN might be connected with a tunnel to allow multicast datagrams to traverse the Internet. We consider tunnels to be a transitional hack. Tunneling is done with a weakly encapsulated normal multicasted datagram. The weak encapsulation uses a special two element IP loose source route [5]. (This form of encapsulation is preferable to "strong" encapsulation, i.e., prepending an entire new IP header, because it does not require the tunnel end-points to know each other's maximum reassembly buffer size. It also has the benefit of correct behavior of the originator's time-to-live value and any other IP options present.) A tunnel has a local end-point, remote end-point, metric, and threshold associated with it. The routers at each end of the tunnel need only agree upon the local and remote end-points. See section 8 for information on how tunnels are configured. Because the number of intermediate gateways between the end-points of a tunnel is unknown, additional research is needed to determine appropriate metrics and thresholds. </blockquote> Although the above states "We consider tunnels to be a transitional hack." tunneling is still used today, with essentially the same meaning - the data sent through a tunnel is encapsulated so it can be tranmitted via a protocol that would otherwise not support the transmission: <blockquote> A tunnel is a mechanism used to ship a foreign protocol across a network that normally wouldn't support it. Tunneling protocols allow you to use, for example, IP to send another protocol in the "data" portion of the IP datagram. Most tunneling protocols operate at layer 4, which means they are implemented as a protocol that replaces something like TCP or UDP. </blockquote> Source Networking 101: Understanding Tunneling
Because whatever you put in one end of the tunnel comes out the other end.
How to find out whether Hyper-V is currently enabled/running <sep> How can I find out whether Hyper-V is currently running on my Windows 8.1 Pro System?
Run Powershell as Administrator. <code>PS C:\Windows\system32> </code> Run the command: <code>Get-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V </code> If it is enabled, you'll see the answer like this: <code>FeatureName : Microsoft-Hyper-V DisplayName : Hyper-V Platform Description : Provides the services that you can use to create and manage virtual machines and their resources. RestartRequired : Possible State : Enabled CustomProperties : </code> More info here and here.
You can check if the services are running: Win+R -> <code>services.msc</code> Look in the list for all services beginning with <code>Hyper-V</code>. If any of them are <code>Running</code>, it's on. (Specifically, the core of it I believe is labelled Hyper-V Virtual Machine Management) You can check the system log to see if any activity has occurred guide here: Open Event Viewer. Click Start, click Administrative Tools, and then click Event Viewer. Open the Hyper-V-Hypervisor event log. In the navigation pane, expand Applications and Services Logs, expand Microsoft, expand Hyper-V-Hypervisor, and then click Operational. If Windows hypervisor is running, no further action is needed. If Windows hypervisor is not running, perform the following steps. Open the System log. (In the navigation pane, expand Windows Logs and then select System.) Look for events from Hyper-V-Hypervisor for more information. For example, event ID 41 indicates a problem with the BIOS configuration: Hyper-V launch failed; Either VMX not present or not enabled in BIOS. (To filter for these events, from the Actions pane, click Filter Current Log, and then for Event sources, specify Hyper-V-Hypervisor.)
Where is the Linux Subsystem's filesystem located in Windows 10?
For WSL2 you can access to home directory from windows explorer like this : <code>\\wsl$ </code> Sorry to be late at the party!
Nowadays, you can install multiple Linux distributions. Therefore, each distribution will have their own filesystem located in a different folder. If you install some linux distributions from the Windows Store, the filesystems are located under <code>%USERPROFILE%\AppData\Local\Packages\...\LocalState\rootfs</code> If you have installed, moved or duplicated a linux distribution using LxRunOffline or any version of the WSLDistroLauncher, the filesystem can be located in any folder of your computer. Obtaining the information from the Registry The location of each filesystem can be obtained from the Windows Registry. The data is located under <code>HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Lxss </code> You can start a PowerShell window and execute the following command to obtain the locations of the filesystems <code>PS> (Get-ChildItem HKCU:\Software\Microsoft\Windows\CurrentVersion\Lxss | ForEach-Object {Get-ItemProperty $_.PSPath}) | select DistributionName, @{n="Path";e={$_.BasePath + "\rootfs"}} </code> You will get a table with information like the following <code>DistributionName Path ---------------- ---- Ubuntu C:\Users\Jaime\AppData\Local\Packages\CanonicalGroupLimited.UbuntuonWindows_79rhkp1fndgsc\LocalState\rootfs Ubuntu-18.04 C:\Users\Jaime\AppData\Local\Packages\CanonicalGroupLimited.Ubuntu18.04onWindows_79rhkp1fndgsc\LocalState\rootfs mydistro C:\wsl\mydistro\rootfs </code> Using lxRunOffline LxRunOffline is a tool for managing linux distributions installed on WSL. You can use LxRunOffline to get the directory used by an installed distribution <code># lxrunoffline get-dir -n <name of the distro> C:\> lxrunoffline get-dir -n backup c:\wsl\installed\backup C:\> lxrunoffline get-dir -n Ubuntu C:\Users\Jaime\AppData\Local\Packages\CanonicalGroupLimited.UbuntuonWindows_79rhkp1fndgsc\LocalState </code>
Appdata/Local/Packages- safe to remove?
If you use Windows Subsystem for Linux (WSL) you will blow away your entire file system for any linux distribution used if you delete this folder.
AppData folders store per-user information for applications, so if you delete files from an application's applications data directory, it will likely have to recreate that data from default values. In effect the program will forget that you have used it before, configuration choices you may have made, saved files (like game savefiles), etc. I would recommend you use a tool like windirstat to determine where the space is being used, and what application(s) rely on it. From there you can then begin to determine the impact of your proposed deletion. See here for some more information related to your query: http://www.pcworld.com/article/2690709/windows/whats-in-the-hidden-windows-appdata-folder-and-how-to-find-it-if-you-need-it.html As commented, some applications like WSL and apps from the windows store will rely heavily on Application Data storage, to the extent that deleting the files from App Data is akin to uninstalling the application (in a clumbsy, unclean way), so understanding the way a particular app uses Application Data is quite important when determining what you can remove.
What is the secondary CPU Usage Graph line in the Windows 10 Task Manager <sep> I was looking at the task manager in Windows 10 and for the first time noticed a secondary dashed line below the solid?
The light blue line represents the total amount of time your CPU is spending on tasks. The dark blue line represents what percentage of that time involves the kernel. What's the difference? If an application maxes out the %CPU load but the kernel time is still low, then the system still feels responsive and snappy. This is because the kernel's primary job is to schedule CPU time for processes and it can preempt one process to run another when necessary. Only when the kernel pegs the CPU at 100% does your computer feel slow and sluggish. That's why the option is there to select because it gives a more realistic view from a performance perspective than the regular graph does.
That looks like the kernel time graph. Right-click the graph and see if this option is ticked. Kernel time has been available for a while but it was more hidden. Seems it was available from at least Windows XP : https://blog.codinghorror.com/everything-you-always-wanted-to-know-about-task-manager-but-were-afraid-to-ask/
Do hard drives really have open cases now?
This is not new. Here's an ad for a 10 MB HDD which also most definitely did not ship with open disks. https://plus.google.com/+DeryaUnutmaz/posts/hUWkX1Ukhiy Here's how a 10MB HDD looked like
It's marketing. A hard drive cover is boring; the internals look impressive. This isn't a new concept, for example this Intel processor doesn't actually have a semi-translucent heat spreader:
Vim: change label for specific tab <sep> Say I have a bunch of tabs open in Vim, with a tabline looks something like this: <code>1 v/file1.py 2 t/file.py 1 t/file.py 1 o/otherfile.py</code> See how two tabs both say "t/file.py"?
There's a nice little plugin called Taboo that makes this easy. Just install it and then you can change the tab title with: <code>:TabooRename My Tab Title </code> You can look at the source code for that plugin if you're interested in writing your own solution.
For gvim, see <code>:help 'guitablabel' :help setting-guitablabel </code> Set the option to an expression that evaluates to <code>t:mytablabel</code> (a tab-local variable) if it exists, or else to an empty string (meaning to use the default): <code>:set guitablabel=%{exists('t:mytablabel')?t:mytablabel\ :''} </code> Maybe that is already too complicated, or maybe you want to get fancier. In that case, define a function: <code>function! GuiTabLabel() return exists('t:mytablabel') ? t:mytablabel : '' endfunction :set guitablabel=%{GuiTabLabel()} :set go+=e </code> Then, in any tab where you want to override the default, do something like <code>:let t:mytablabel = 'homepage_template' </code> If you are using vim in a terminal, not gvim, then you have to set the <code>'tabline'</code> option instead of <code>'guitablable'</code>. This is a little more complicated, since you need a single expression that includes labels for all the open tabs. There is a complete example under <code>:help setting-tabline </code>
How to restart a video card driver in Windows 7?
Get the file: <code>devmanview.exe</code> from Nirsoft, move it to <code>..\windows\system32\</code> and run it. Get your device name by opening <code>devmanview.exe</code>: right mouse click and select <code>Properties</code> on your video device. Copy "DEVICE NAME" to clipboard for use in the script: for example: "NVIDIA GeForce GTX 260" or "AMD Radeon HD 7900 Series" Open notepad and copy paste this code: @echo off echo. echo *** Restarting GPU timeout /t 2 /nobreak >nul devmanview.exe /disable_enable "NVIDIA GeForce GTX 260" echo. echo *** DoNe timeout /t 2 /nobreak >nul taskkill /f /IM explorer.exe explorer.exe Remember to change "NVIDIA GeForce GTX 260" to your Graphics card name taken from ..\windows\system32\devmanview.exe Save the notepad file as a <code>nameyoulike.bat</code> . Double click to reboot your GPU and driver.
Use the <code>Devcon</code> tool from Microsoft. <blockquote> Using DevCon, you can enable, disable, restart, update, remove, and query individual devices or groups of devices. </blockquote> To list display devices use the following command: <code>devcon listclass display </code> To restart a device use the command: <code>devcon restart "class id" </code> Example: <code>devcon restart "PCI\VEN_115D&DEV_0003&SUBSYS_0181115D" </code> Examples of use.
How to configure the default app to open tel: links in MacOS X?
You can change this without an extra app via the preferences in FaceTime. On the Setting tab change the last entry "Default for calls" to Skype. At least this way works for Skype for Business.
You can change it using a utility called RCDefaultApp - freeware - which installs as a Control Panel. It's old but still works right up to El Capitan [I've not tested on Sierra but see no real reason it shouldn't still work.] Look for 'tel' in the URLs list & change...
Why does git complain that no GPG agent is running?
When this message is issued upon commiting: <blockquote> gpg: can't connect to the gpg-agent: IPC connect call failed gpg: keydb_search failed: No agent running </blockquote> The following command starts the gpg-agent on Windows: <code>gpg-connect-agent reloadagent /bye</code> After reloading the agent the signing password prompt is displayed properly. Environment Windows 11 Home 21H2 git version 2.32.0.windows.2 gpg (GnuPG) 2.3.1 gpg-agent (GnuPG) 2.3.1
It is likely that your <code>gpg-agent</code> and <code>gpg</code> binaries are from different packages. This can happen when you're using Git Bash (which ships with <code>gpg</code>) and you're installing GnuPG4Win additionally. The latter ships with a more recent version. You can verfiy if this is your problem, by checking the version of both programs: <code>% gpg-agent --version gpg-agent (GnuPG) 2.1.7 % gpg --version gpg (GnuPG) 1.4.19 </code> If this is your problem, you should tell <code>git</code> which <code>gpg</code> binary to use: <code>% git config --global gpg.program gpg2 </code>
Can I view browser history without it showing I viewed history?
Chrome stores its history in SQlite 3 database. You can simply read / modify this database file. Be sure to inform users that things done in that system will not be private and their stuff might be gone anytime. Windows: <code>C:\users\username\AppData\Local\Google\Chrome\User Data\Default\History</code> Linux: <code>~username/.config/google-chrome/Default\History</code> Open with any SQLite 3 capable software.
When viewing the history on Chrome, it does not typically get recorded. Unless the other user is a computer forensics expert, he/she will not be able to see you viewed the history, nor will they know if you delete something from the history. Note I am using Chrome version 60.0.3112.101.
How to force uninstall a software that is installed by MSI package?
It is 2017 now, I found a better way of force uninstall an application without msi. Download the Program Install and Uninstall Troubleshooter (alternate link). Run it => Uninstall => Select the program => Done With this there is no need to touch registry and no need to download third party tools that may contains Malwares.
Here is a little article I have been working on, and although it does not address your question directly, it might be useful. Just pay attention to the registry keys I mention and you can generally delete them, as well as the <code>C:\Program Files\Application</code> folder to trick the installers into think Everything You Wanted to Know about Add / Remove Programs in Windows Have you ever wondered how Windows presents and uses the Add/Remove programs? Or perhaps you have the need to enumerate these values yourself? Here is some useful information on how it works, how to use it and some neat tricks you might enjoy. Everything you see in add and remove programs (XP, Vista, 7 confirmed) is written to the registry at HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\ as a subkey. For example, I have the subkey CutePDF Writer Installation with the keys and values: Now, of interest here is the UninstallString value. When you click uninstall in Add/Remove programs, what it does is call this value and run it. You can do the same manually, for example with CutePDF if you run <code>C:\Program Files (x86)\Acro Software\CutePDF Writer\Setup64.exe /uninstall</code> from either the Run line or the command prompt, you will get the uninstaller. You could also find additional uninstall options by running the command with the <code>/?</code> switch, or run the following from the cmd prompt: <code>Cd C:\Program Files (x86)\Acro Software\CutePDF Writer Setup64.exe /? </code> Note, this is a bad example as the switch does not return anything! But generally this will work, or you can just call the uninstaller manually this way. Now, lets look at a possible problem with the Uninstall list, you will see some files that names in this format: {AFF7153F-C4AA-4C48-AEE9-8611D276CE86} This is how a MSI installer writes its name to the Registry, instead of writing the friendly name an EXE installer writes, it writes its GUID. This is not really a problem, as much as a difficulty in reading the keys. There are couple ways to read through these. One, there is a Value Name DisplayName that will have the more friendly value of (in this example) Quest ActiveRoles Management Shell for Active Directory (x64). Another approach, is Windows writes a compressed and hashed version of the GUID to another part of the Registry. To Hash the value, take the GUID {AFF7153F-C4AA-4C48-AEE9-8611D276CE86} and reverse each set of hex digits. AFF7153F becomes F3517FFA, C4AA becomes AA4C and on down the GUID until you have the following: {F3517FFA-AA4C-84C4-9EEA-68EC672D1168} Now, drop the {, -, and } to get F3517FFAAA4C84C49EEA68EC672D1168. You now have the compressed and hashed GUID that you can compare to another key. You should now be able to find this new GUID at the following location in the Registry: HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Installer\Products And sure enough, there she is: With the following keys: Again, you can then look in ProductName for the name of the application. Bonus tip: You can launch the Add/remove programs by typing <code>appwiz.cpl</code> into the start search, run line or a command prompt.
Is there any way to do a correct word count of a LaTeX document?
You can obtain <code>texcount</code> results in the own LaTeX document: Note that this MWE require the filename <code>borra.tex</code> (or modify the code accordingly). <code>% CAUTION !!! % 1) Need --enable-write18 or --shell-escape % 2) This file MUST be saved % as "borra.tex" before the compilation % in your working directory % 3) This code will write wordcount.tex % and charcount.tex in /tmp of your disk. % (Windows users must change this path) % 4) Do not compile if you are unsure % of what you are doing. \documentclass{article} \usepackage{moreverb} % for verbatim ouput % Count of words \immediate\write18{texcount -inc -incbib -sum borra.tex > /tmp/wordcount.tex} \newcommand\wordcount{ \verbatiminput{/tmp/wordcount.tex}} % Count of characters \immediate\write18{texcount -char -freq borra.tex > /tmp/charcount.tex} \newcommand\charcount{ \verbatiminput{/tmp/charcount.tex}} \begin{document} \section{Section: text example with a float} Words and characters of this example file are automatically counted from the source file when compiled (therefore generated text as \textbackslash{}lipsum[1-10] is {\bfseries not} counted). The results are showed at the end of the compiled version. Counts are made in headers, caption floats and normal text for the whole file. Subcounts for structured parts (sections, subsections, etc.) are also made. Number of headers, floats and math chunks are also counted. \begin{figure}[h] \centering \framebox{This is only a example float} \caption{This is a example caption} \end{figure} \subsection{Subsection: Little text with math chunks} In line math: $\pi +2 = 2+\pi$ \\ Display math: \[\pi +2 = 2+\pi\] %TC:ignore \dotfill End of the example \dotfill \subsubsection*{Counts of words} \wordcount %TC:endignore \end{document} </code>
You can use the word count code from Context (<code>lang-wrd.lua</code>). I took the liberty and adapted it for Plain (should work with the LaTeX format as well). The code is stripped of more Context specific features and relies on the character property definitions from <code>char-def.lua</code>. This way theres no need for external tools and as a bonus you can insert the current word count wherever you like inside the document itself. The usage example has some explanations. <code>\setwordthreshold{3} %%% min chars in a row to count as word \startwordcount %%% start callback \input knuth\par %%% counted \currentwordcount %%% => 94 with threshold == 3 \input knuth %%% counted \stopwordcount %%% deregister callback \input knuth %%% not counted \dumpwordcount %%% => 188 </code> Everything between <code>\startwordcount</code> and <code>\stopwordcount</code> picked up, the rest will be ignored, so you can manually exempt passages from being counted. The word threshold would have to be set to 1 for English. Due to the nature of thre <code>pre_linebreak_filter</code> you will get word counts only by paragraph, though.
How can I add "page # of ##" on my document?
The memoir class provides <code>\thelastpage</code> and <code>\thelastsheet</code> from their respective counters, depending on your precise needs.
There is an alternative to the <code>lastpage</code> provided by the <code>zref</code> package. It has a <code>lastpage</code> module which provides the same functionality using the modern <code>zref</code> way to make references. Simply use <code>\zpageref{LastPage}</code> instead of <code>\pageref{LastPage}</code>. For the minimal use-case this doesn't give any benefits, but with <code>zref</code> the number is not hyperlinked by default (if <code>hyperref</code> is loaded of course) and it also provides a <code>\ziflastpage{<refname>}{<true>}{<false>}</code> conditional to test if a certain label got placed on the last page. There are also further macros for package writers. See the <code>zref</code> manual for them. <code>\documentclass{article} \usepackage[lastpage,user]{zref} \usepackage{fancyhdr} \pagestyle{fancy} \cfoot{\thepage\ of \zpageref{LastPage}} \begin{document} The last page is \zpageref{LastPage}. \newpage ... \newpage ... \newpage on the last page \end{document} </code>
How can I crop included PDF documents?
You can do this with pdfpages. The following example takes a two-up scan of a book, and crops and collates it to a one-up document. <code>\documentclass[letterpaper]{minimal} \usepackage[pdftex,letterpaper]{geometry} \usepackage{pdfpages} \usepackage{ifthen} \newcounter{pg} \begin{document} \setcounter{pg}{1} %% my pdf file has 132 pages: %% my pdf file has size 780 x 610 points \whiledo{\value{pg}<133}{% \includepdf[pages=\thepg,viewport=0 0 390 610]{scan.pdf} \includepdf[pages=\thepg,viewport=390 0 780 610]{scan.pdf} \addtocounter{pg}{1} }% \end{document} </code>
Since you'd like to "...set margins from each direction, and the PDF is then cropped accordingly..." in order to "...control what portion of the included PDF is visible in the final document..." I would suggest you try Briss. It's easy to use and gives you much more control than <code>pdfcrop</code>.
Extend a language with additional keywords?
It seems that <code>morekeywords</code> also works for extending a language. For instance the Python keyword <code>super</code> isn't in the list of default keywords. In my preamble, I can set it as a keyword by doing: <code>\lstset{language=Python} \lstset{ morekeywords={super} } </code> Of course, it would be ideal to contribute those missing keywords to the listings package.
You can define the keywords in a separate file and just include it in your preamble. Here is an example of adding <code>for</code> and <code>downto</code> as new keywords: <code>\documentclass{article} \usepackage{listings}% \usepackage{xcolor} \lstset{% backgroundcolor=\color{yellow!20},% basicstyle=\small\ttfamily,% numbers=left, numberstyle=\tiny, stepnumber=2, numbersep=5pt,% }% % Add your keywords here, and have this in a separate file % and include it in your preamble \lstset{emph={% downto, for% },emphstyle={\color{red}\bfseries\underbar}% }% \begin{document} \begin{lstlisting} y = 0 for i = n downto 0 y = a_i + x * y \end{lstlisting} \end{document} </code>
How to remove the copyright box on a paper that uses the ACM sig-alternate.cls class file?
In the newest format (e.g. ACM MM 2020), you can set nonacm and authorversion in the documentclass: <code>\documentclass[sigconf,authorversion,nonacm]{acmart} </code> See also the official guide: https://www.acm.org/binaries/content/assets/publications/consolidated-tex-template/acmart.pdf. (April 2020).
I fixed the problem by writing \setcopyright{none} before \begin{document} at the top. FYI I was using overleaf.
How to colour multiple paragraphs?
<code>\textcolor</code> is similar to <code>\mbox</code>, so it doesn't typeset paragraphs; use the declarative form, instead, in a group: <code>\newcommand{\nathaniel}[1]{{\leavevmode\color{blue}[#1]}} </code>
you could make an environment form <code>\newenvironment{thisnote}{\par\color{blue}}{\par} </code> then <code>\begin{thisnote} stuff in blue \end{thisnote} </code> can take paragraphs of text
How can I remove the figures from a draft of my document?
I would simply use the <code>endfloat</code> package, which places all floats (<code>figure</code>s and <code>table</code>s) at the very end of the document. Then you can print only the leading pages with the text using the page range selection of your PDF viewer. Alternatively, you can make LaTeX ignore all <code>figure</code> environments using the <code>comment</code> package: <code>\usepackage{comment} \excludecomment{figure} \let\endfigure\relax </code> See How to exclude text portions by simply setting a variable or option? for more details. A drawback here is that the label references won't work properly.
Just add the <code>draft</code> option when you load your document class, e.g.: <code>\documentclass[draft]{article} </code> You can also add the option to the <code>graphicx</code> package: <code>\usepackage[draft]{graphicx} </code> If you want to save space, you can do as follows: <code>\renewcommand{\includegraphics}{\relax} </code> Or if you want to use the <code>ifdraft</code> package, you can do thus: <code>\documentclass[draft]{article} \usepackage{ifdraft} \ifdraft{\renewcommand{\includegraphics}{\relax}}{\relax} </code>
What's the difference between pdfTeX and pdfLaTeX?
If a .tex file starts with <code>\documentclass</code> -- or, possibly, the now-obsolete <code>\documentstyle</code> command -- it's a file that needs to be compiled by a TeX engine that loads the <code>LaTeX</code> format file rather than the <code>Plain TeX</code> format file. Format files (or, shorter, "formats") are, loosely speaking, large collections of macros. There are many TeX formats; nowadays, the best known formats -- other than the original PlainTeX format -- are LaTeX (LaTeX2e, to be a bit more precise) and ConTeXt. The LaTeX(2e) format is, to a first approximation, a large superset of the Plain-TeX format. It's not a strict superset, though, because there are some "Plain TeX" macros that aren't implemented in LaTeX. Hence, <code>.tex</code> files that contain LaTeX commands cannot be compiled if the PlainTeX format is loaded instead of the LaTeX format. Note that the <code>\documentclass</code> instruction is itself a "LaTeX"-specific macro, i.e., it is not recognized by "Plain TeX". Therefore, <code>pdftex</code> (which loads the "plain TeX" format) cannot proceed properly once it encounters the <code>\documentclass</code> instruction on line 1 of the input file. Addendum: For more information on TeX formats see, for instance, the webpage TeX formats and engines as well as the TeX.SE page List of TeX formats.
<code>pdftex</code> expects the file to be plain TeX. <code>pdflatex</code> expects it to be LaTeX. These are two different dialects of TeX. You do not expect a C compiler to work with Java, do you? Note that in practice <code>pdftex</code> and <code>pdflatex</code> are often the same command, which analyzes how it was called to switch to the proper input language. On some systems <code>gcc</code> behaves in the same way, compiling C if it is called as <code>gcc</code> or Fortran if it is called as <code>gfortran</code>.
How to change the level distance in tikz-qtree for one level only?
The modifications suggested in this answer have now been subsumed into the <code>tikz-qtree</code> package (version 1.2 or higher). See the documentation for details on how to accomplish this with the latest version. (This happened in April 2012.) Looking through the code for <code>tikz-qtree</code> then it appears* that it completely reimplements the tree-planting routines. Therefore, the standard TikZ keys for trees are not guaranteed to work. This is why <code>level 2/.style={something}</code> doesn't work for <code>tikz-qtree</code>. Whilst it might be possible to hack something together with styles and keys so that each node knows what level it is at, this seems like it would be quite a useful addition to the main code and it is certainly simpler to do by small modifications to that. The first is to the tree-generation system. The trees are generated by a recursion and the code does not currently track the level of recursion. Fortunately, that's simple to correct: we need a new count which we set to 0 at the top of the tree and increment as we go down. Our increments are local to ensure that whenever we return to a level (after processing a child's sublevels), our index is at the right place. <code>--- pgftree.tex.orig 2010-12-31 00:50:24.000000000 +0100 +++ pgftree.tex 2012-04-19 10:34:57.286252337 +0200 @@ -82,11 +82,14 @@ \newdimen\pgftree@savechildy \newcount\pgftree@childi \newcount\pgftree@savechildi +\newcount\pgftree@level %%% \pgftree{subtree} \def\pgftree#1{% \def\nodename{r}% +\pgftree@level=0\relax +\pgfkeys{/pgf/qtree/every level/.try,/pgf/qtree/level \the\pgftree@level/.try}% #1% \pgfplacesubpicture } @@ -108,6 +111,8 @@ \pgftree@savechildx=\pgftree@childx \pgftree@savechildy=\pgftree@childy \pgftree@savechildi=\pgftree@childi +\advance\pgftree@level by 1\relax +\pgfkeys{/pgf/qtree/every level/.try,/pgf/qtree/level \the\pgftree@level/.try}% % Build subpicture with all the children and their subtrees {\pgftree@childx=0pt% \pgftree@childy=0pt% </code> That now allows us to track the level of our tree. The root of the tree ends up at level 1. Now we need to use that information to execute keys according to the level. To do this, we need to insert some key processing at the relevant stages. There are a couple of places where we could do this: directly in the <code>pgftree</code> code or in the <code>tikz-qtree</code> code. I'm not sure which seems more natural, and the two places where the code makes sense have different effects (one lasts just for the level, the other also has an effect on all subsequent parts of the tree), so I've added code for both. To be consistent with the separation of PGF and TikZ, the keys in the <code>pgftree</code> part are of the form <code>/pgf/qtree/level n</code> and in the <code>tikz-qtree</code> are of the form <code>/tikz/level n</code>. I've also provided a TikZ-level access to the lower-level one by adding a <code>/pgf/qtree/every level</code> key which in <code>tikz-qtree</code> has appended to it the style <code>/tikz,level \the\pgftree@level\space onwards</code>. The inheritance factor means that to get the desired style, one either does: <code>\tikzset{level 1/.style={level distance=2cm}} </code> or one does: <code>\tikzset{level 1 onwards/.style={level distance=2cm}} \tikzset{level 2 onwards/.style={level distance=1cm}} </code> The patch for the <code>pgftree</code> part is included above. The <code>tikz-qtree</code> part follows: <code>--- tikz-qtree.tex.orig 2011-10-10 23:53:59.000000000 +0200 +++ tikz-qtree.tex 2012-04-19 10:39:02.516300095 +0200 @@ -75,9 +75,9 @@ } \def\@@@@@@subtree{% \@ifequal{\the\root@node}{\pgfutil@empty}% -\edef\act{\noexpand\@result={\noexpand\pgfsubtree{\noexpand\path coordinate (\noexpand\nodename);}{\the\child@list}}}% +\edef\act{\noexpand\@result={\noexpand\pgfsubtree{\noexpand\tikzset{level \noexpand\the\pgftree@level/.try}\noexpand\path coordinate (\noexpand\nodename);}{\the\child@list}}}% \else -\edef\act{\noexpand\@result={\noexpand\pgfsubtree{\the\root@node}{\the\child@list}}}% +\edef\act{\noexpand\@result={\noexpand\pgfsubtree{\noexpand\tikzset{level \noexpand\the\pgftree@level/.try}\the\root@node}{\the\child@list}}}% \fi \act \@return} @@ -117,7 +117,7 @@ \def\@interior.{\@result{\node[alias=\nodename][every tree node,every internal node]}\@label} \def\@leaf{\@call\@label\@@leaf} -\def\@@leaf{\edef\act{\noexpand\@result{\noexpand\pgfsubtree{\noexpand\node[alias=\noexpand\nodename][every tree node,every leaf node]\the\@result}{}}}\act\@return} +\def\@@leaf{\edef\act{\noexpand\@result{\noexpand\pgfsubtree{\noexpand\tikzset{level \noexpand\the\pgftree@level/.try}\noexpand\node[alias=\noexpand\nodename][every tree node,every leaf node]\the\@result}{}}}\act\@return} \def\@edge\edge #1;{% \@result{\edge@adapter{#1}}% @@ -179,3 +179,4 @@ % predefined roof style \tikzset{roof/.style={edge from parent path=\roof@edge{\tikzparentnode}{\tikzchildnode}}} +\pgfkeys{/pgf/qtree/every level/.append style={/tikz,level \the\pgftree@level\space onwards/.try}} </code> It is entirely possible that I've missed some places where keys should be set! So use with caution. Here's your code with these new keys included: <code>\documentclass{article} %\url{https://tex.stackexchange.com/q/39103/86} \usepackage{tikz} \usepackage{tikz-qtree} \begin{document} \tikzset{edge from parent/.style= {draw, edge from parent path={(\tikzparentnode) -- (\tikzchildnode)}}} \tikzset{got called/.code={\message{got called}}} \begin{tikzpicture}[grow=down]% game tree \tikzset{mydot/.style={circle, minimum width=2pt,fill, inner sep=0pt}} % decision node style \tikzset{mystart/.style={circle, minimum width=3pt, fill, inner sep=0pt}} % starting node style \Tree [.\node[mystart, label=above: {N}] {}; \edge node[left] {$p_1=0.5$}; [.\node[mydot, label=above left:I] {}; \edge node[left] {$a$}; \node[mydot, label=below: {$5,1$}] {}; \edge node[right] {$b$}; [.\node[mydot, label=above right:II] {}; \edge node[left] {$m$}; \node[mydot, label=below: {$1,2$}] {}; \edge node[right] {$n$}; \node[mydot, label=below: {$2,3$}] {}; ] ] \edge node[right] {$p_2=0.5$}; [.\node[mydot, label=above right:II] {}; \edge node[left] {$c$}; [.\node[mydot] (a) {}; \edge node[left] {$z$}; \node[mydot, label=below: {$1,0$}] {}; \edge node[right] {$t$}; \node[mydot, label=below: {$2,2$}] {}; ] \edge node[right] {$d$}; [.\node[mydot] (b) {}; \edge node[left] {$z$}; \node[mydot, label=below: {$3,1$}] {}; \edge node[right] {$t$}; \node[mydot, label=below: {$0,0$}] {}; ] ] ] \draw[dashed] (a)--node[label=above:I] {}(b); \end{tikzpicture} \begin{tikzpicture}[grow=down]% game tree \tikzset{mydot/.style={circle, minimum width=2pt,fill, inner sep=0pt}} % decision node style \tikzset{mystart/.style={circle, minimum width=3pt, fill, inner sep=0pt}} % starting node style \tikzset{level 1/.style={level distance=2cm}} \Tree [.\node[mystart, label=above: {N}] {}; \edge node[left] {$p_1=0.5$}; [.\node[mydot, label=above left:I] {}; \edge node[left] {$a$}; \node[mydot, label=below: {$5,1$}] {}; \edge node[right] {$b$}; [.\node[mydot, label=above right:II] {}; \edge node[left] {$m$}; \node[mydot, label=below: {$1,2$}] {}; \edge node[right] {$n$}; \node[mydot, label=below: {$2,3$}] {}; ] ] \edge node[right] {$p_2=0.5$}; [.\node[mydot, label=above right:II] {}; \edge node[left] {$c$}; [.\node[mydot] (a) {}; \edge node[left] {$z$}; \node[mydot, label=below: {$1,0$}] {}; \edge node[right] {$t$}; \node[mydot, label=below: {$2,2$}] {}; ] \edge node[right] {$d$}; [.\node[mydot] (b) {}; \edge node[left] {$z$}; \node[mydot, label=below: {$3,1$}] {}; \edge node[right] {$t$}; \node[mydot, label=below: {$0,0$}] {}; ] ] ] \draw[dashed] (a)--node[label=above:I] {}(b); \end{tikzpicture} \begin{tikzpicture}[grow=down]% game tree \tikzset{mydot/.style={circle, minimum width=2pt,fill, inner sep=0pt}} % decision node style \tikzset{mystart/.style={circle, minimum width=3pt, fill, inner sep=0pt}} % starting node style \tikzset{level distance=2cm} \tikzset{level 2 onwards/.style={level distance=1cm}} \Tree [.\node[mystart, label=above: {N}] {}; \edge node[left] {$p_1=0.5$}; [.\node[mydot, label=above left:I] {}; \edge node[left] {$a$}; \node[mydot, label=below: {$5,1$}] {}; \edge node[right] {$b$}; [.\node[mydot, label=above right:II] {}; \edge node[left] {$m$}; \node[mydot, label=below: {$1,2$}] {}; \edge node[right] {$n$}; \node[mydot, label=below: {$2,3$}] {}; ] ] \edge node[right] {$p_2=0.5$}; [.\node[mydot, label=above right:II] {}; \edge node[left] {$c$}; [.\node[mydot] (a) {}; \edge node[left] {$z$}; \node[mydot, label=below: {$1,0$}] {}; \edge node[right] {$t$}; \node[mydot, label=below: {$2,2$}] {}; ] \edge node[right] {$d$}; [.\node[mydot] (b) {}; \edge node[left] {$z$}; \node[mydot, label=below: {$3,1$}] {}; \edge node[right] {$t$}; \node[mydot, label=below: {$0,0$}] {}; ] ] ] \draw[dashed] (a)--node[label=above:I] {}(b); \end{tikzpicture} \end{document} </code> Here's the sample output: I would like to add that Ryan Reich's fantastic <code>trace-pgfkeys</code> package was absolutely essential in doing the above. In particular, it made it easy to see that the standard <code>level n</code> keys were not getting processed, which gave me the hint to look deeper into the code to see what exactly was going on. See How do I debug pgfkeys? for more on this most excellent package. * I've not gone through the code extensively so my deductions could be false. However, they agree with the results of my experiments so I'm prepared to accept them as a working hypothesis.
UPDATE Although this is the accepted answer, <code>tikz-qtree</code> was updated in 2012 to allow this. See Loop Space's answer. Original answer: There isn't a way that I know of to specify the level distance for particular levels using <code>tikz-qtree</code>. Of course you could use the regular <code>tikz</code> methods, but <code>tikz-qtree</code> is generally much more efficient in its input. The simplest solution to your problem is to simply move the labels slightly. You can do this by positioning them <code>[above left]</code> and <code>[above right]</code>. I've also made some simplification to your code which will give you less to type: you can make <code>every tree node</code> have your <code>mydot</code> style, and then just override the style for the start node. This means you don't need to add <code>mydot</code> to each of the node commands in the tree. I also removed the <code>[grow down]</code> specification on the <code>tikzpicture</code>, since that is the default growth direction for <code>tikz-qtree</code>. <code>\documentclass{article} \usepackage{tikz} \usepackage{tikz-qtree} \begin{document} \begin{tikzpicture} \tikzstyle{mydot} = [circle, minimum width=2pt,fill, inner sep=0pt] % decision node style \tikzstyle{mystart} = [circle, minimum width=3pt, fill, inner sep=0pt] % starting node style \tikzset{edge from parent/.style= {draw, edge from parent path={(\tikzparentnode) -- (\tikzchildnode)}}, every tree node/.style={mydot}} % make every tree node a decision node; then you only have to override the start node \Tree [.\node[mystart, label=above: {N}] {}; \edge node[above left] {$p_1=0.5$}; [.\node[ label=above left:I] {}; \edge node[left] {$a$}; \node[label=below: {$5,1$}] {}; \edge node[right] {$b$}; [.\node[ label=above right:II] {}; \edge node[left] {$m$}; \node[ label=below: {$1,2$}] {}; \edge node[right] {$n$}; \node[ label=below: {$2,3$}] {}; ] ] \edge node[above right] {$p_2=0.5$}; [.\node[ label=above right:II] {}; \edge node[left] {$c$}; [.\node[mydot] (a) {}; \edge node[left] {$z$}; \node[ label=below: {$1,0$}] {}; \edge node[right] {$t$}; \node[ label=below: {$2,2$}] {}; ] \edge node[right] {$d$}; [.\node[] (b) {}; \edge node[left] {$z$}; \node[ label=below: {$3,1$}] {}; \edge node[right] {$t$}; \node[ label=below: {$0,0$}] {}; ] ] ] \draw[dashed] (a)--node[label=above:I] {}(b); \end{tikzpicture} \end{document} </code>
Can I mark ends of lines with a cross?
A different idea, define a new arrow shape named for example <code>X</code> (thanks to Qrrbrbirlbel to note that <code>\pgarrowrightextend{0pt}</code> was neccessary): <code>\documentclass{article} \usepackage{tikz} \makeatletter \pgfarrowsdeclare{X}{X} { \pgfutil@tempdima=0.3pt% \advance\pgfutil@tempdima by.25\pgflinewidth% \pgfutil@tempdimb=5.5\pgfutil@tempdima\advance\pgfutil@tempdimb by.5\pgflinewidth% \pgfarrowsleftextend{+-\pgfutil@tempdimb} \pgfarrowsrightextend{0pt} } { \pgfutil@tempdima=0.3pt% \advance\pgfutil@tempdima by.25\pgflinewidth% \pgfsetdash{}{+0pt} \pgfsetroundcap \pgfsetmiterjoin \pgfpathmoveto{\pgfqpoint{-5.5\pgfutil@tempdima}{-6\pgfutil@tempdima}} \pgfpathlineto{\pgfqpoint{5.5\pgfutil@tempdima}{6\pgfutil@tempdima}} \pgfpathmoveto{\pgfqpoint{-5.5\pgfutil@tempdima}{6\pgfutil@tempdima}} \pgfpathlineto{\pgfqpoint{5.5\pgfutil@tempdima}{-6\pgfutil@tempdima}} \pgfusepathqstroke } \makeatother \begin{document} \tikz{ \draw[X-X] (0,0) -- (2,1); \draw[X-X] (0,2) -- (1,0); } \end{document} </code> Using arrow shapes instead of node shapes makes the X to be rotated according with the slope of the line drawn. This can be an advantage or a problem, depending on what do you want. Update A much simpler solution, using the same idea, is to combine two existing arrow tips, instead of defining a new one. The following code would produce exactly the same result than the one above (note this code was modified from its first version. Now it ensures that the X lies at the specified endpoints): <code>\documentclass{article} \usepackage{tikz} \usetikzlibrary{arrows} \pgfarrowsdeclarecombine[-12*(0.3pt+.25\pgflinewidth)-\pgflinewidth] {X}{X}{angle 90 reversed}{angle 90 reversed}{angle 90}{angle 90} \begin{document} \tikz{ \draw[X-X] (0,0) -- (2,1); \draw[X-X] (0,2) -- (1,0); } \end{document} </code>
Notes: I have replaced the <code>scriptsize</code> environment (that does not even exist) with the option <code>font=\scriptsize</code> on the <code>\tkzAxeXY</code> macro. I used the <code>standalone</code> class. With plain TikZ you have a few possibilities: The <code>cross out</code> shape from the <code>shapes.misc</code> library offers you the possibility to cross out a node. Normally this is used to visualize something on text (like this), but with the options <code>minimum height</code> and <code>minimum width</code> along side with a zero <code>inner sep</code> we get a well-defined cross. The line-width settings (<code>thick</code>) is recognized as well. <code>point/.style={ thick, draw=gray, cross out, inner sep=0pt, minimum width=4pt, minimum height=4pt, }, </code> This <code>point</code> node can now be applied either manually: <code>\node[point] at (1,4) {}; </code> or automatically with a special <code>to path</code> (in the <code>line</code> style): <code>to path={% works only with "to" and not "--" -- (\tikztotarget) node[at start,point] {} node [at end,point] {} \tikztonodes } </code> The <code>plot</code> paths of TikZ offers quite the same with a lot of outher marks. The <code>pline</code> style is similar to the previous <code>line</code> style. It contains also the <code>every plot</code> options: <code>pline/.style={% plot line every plot/.style={ mark=x, mark options={ gray, thick, }, mark size=4pt, }, very thick, black, }, </code> Code (shape) <code>\documentclass[tikz,border=2mm]{standalone} \usepackage{tkz-fct} \usetikzlibrary{shapes.misc} \tikzset{ line/.style={ very thick, black, to path={% works only with "to" and not "--" -- (\tikztotarget) node[at start,point] {} node [at end,point] {} \tikztonodes } }, point/.style={ thick, draw=gray, cross out, inner sep=0pt, minimum width=4pt, minimum height=4pt, }, } \begin{document} \begin{tikzpicture} \tkzInit [xmin=0,xmax=21,ymin=0,ymax=7] \tkzGrid[color = gray!30!white] \tkzAxeXY[font=\scriptsize] \draw[line] (1,4) -- (6,1); \draw[line] (2,1) to (5,4) (3,1) to (6,4) (4,1) to (8,5) (3,4) to (9,3) (7,2) to (9,3) (6,7) to (9,1); \draw[line] (11,1) to (16,5) (13,2) to (14,2) (14,1) to (14,2) (14,3) to (15,2) (15,4) to (15,3) (13,4) to (13,3); \draw[line] (17,3) to (21,3) (19,1) to (19,5); \path[every node/.style={point}] node at (1,4) {} node at (6,1) {}; \end{tikzpicture} \end{document} </code> Output (shape) Code (plot) <code>\documentclass[tikz,border=2mm]{standalone} \usepackage{tkz-fct} \tikzset{ pline/.style={% plot line every plot/.style={ mark=x, mark options={ gray, thick, }, mark size=4pt, }, very thick, black, }, } \begin{document} \begin{tikzpicture} \tkzInit [xmin=0,xmax=21,ymin=0,ymax=7] \tkzGrid[color = gray!30!white] \tkzAxeXY[font=\scriptsize] \draw[pline] plot coordinates {(1,4) (6,1)} plot coordinates {(2,1) (5,4)} plot coordinates {(3,1) (6,4)} plot coordinates {(4,1) (8,5)} plot coordinates {(3,4) (9,3)} plot coordinates {(7,2) (9,3)} plot coordinates {(6,7) (9,1)}; \draw[pline] plot coordinates {(11,1) (16,5)} plot coordinates {(13,2) (14,2)} plot coordinates {(14,1) (14,2)} plot coordinates {(14,3) (15,2)} plot coordinates {(15,4) (15,3)} plot coordinates {(13,4) (13,3)}; \draw[pline] plot coordinates {(17,3) (21,3)} plot coordinates {(19,1) (19,5)}; \end{tikzpicture} \end{document} </code> Output (plot)
Equations and Double Spacing <sep> If a document (in any class) is double spaced, how do you redefine the spacing around centered equations as if there was single spacing?
You could simply set the <code>nodisplayskipstretch</code> option of the <code>setspace</code> package, viz., write <code>\usepackage[nodisplayskipstretch]{setspace} </code> in the preamble. An advantage of this solution is that it applies automatically to all display-math environments. (Aside: In the MWE below, the <code>\namdui</code> command serves to produce some filler text -- specifically, the first few sentences of the second stanza of the <code>lipsum</code> package's text.) <code>\documentclass{article} \usepackage[nodisplayskipstretch]{setspace} \newcommand{\namdui}{Nam dui ligula, fringilla a, euismod sodales, sollicitudin vel, wisi. Morbi auctor lorem non justo. Nam lacus libero, pretium at, lobortis vitae, ultricies et, tellus.} % filler text \doublespacing \begin{document} \namdui \begin{equation} a=b. \end{equation} \namdui \end{document} </code>
If you are using the <code>setspace</code> package to change to doublespacing, you could use the <code>etoolbox</code> package and its <code>\BeforeBeginEnvironment</code> and <code>\AfterEndEnvironment</code> to append <code>\begin{singlespace}</code> before, and <code>\end{singlespace}</code> after the environments for displayed equations. The following example illustrates this approach for the <code>equation</code> and <code>align</code> environments (similar declarations will have to be made for the other environments and for their starred versions): <code>\documentclass{article} \usepackage{amsmath} \usepackage{setspace} \usepackage{etoolbox} \usepackage{lipsum}% just to generate text for the example \BeforeBeginEnvironment{equation}{\begin{singlespace}} \AfterEndEnvironment{equation}{\end{singlespace}\noindent\ignorespaces} \BeforeBeginEnvironment{align}{\begin{singlespace}} \AfterEndEnvironment{align}{\end{singlespace}\noindent\ignorespaces} \doublespacing \begin{document} \lipsum[2] \begin{equation} a=b. \end{equation} \lipsum[2] \end{document} </code>
Getting last value in tikz foreach <sep> I tried this, but it doesn't work as intended: <code>\foreach \x/\index in {4/0,5/1,19/2} { \ifnum \index > 0 % use lastx \fi \pgfmathsetmacro\lastx{\x} } </code> How do I set <code>\lastx</code> properly?
You can use the additional facilities of <code>foreach</code> macro given in the manual by adding <code>pgfmath</code> package too. For some reason, <code>(initially 4)</code> option is not working if TikZ is not fully loaded so you can define it externally. <code>\documentclass{article} \usepackage{pgffor,pgfmath} \begin{document} \def\lastx{4} \foreach \x[count=\xi from 2,remember=\x as \lastx] in {5,19,20,25} { This variable \x, the value before was \lastx\space and it is the argument \xi\space in the list.\par } \end{document} </code>
Assignments in a <code>\foreach</code> are local, so you can use <code>\xdef\lastx{\x}</code>: Code: <code>\documentclass{article} \usepackage{pgffor} \newcommand*{\lastx}{} \begin{document} \foreach \x/\index in {4/0,5/1,19/2} { \ifnum \index > 0 % use lastx \fi \xdef\lastx{\x} } Last x was \lastx \end{document} </code>
Was CTAN the first software repository?
CTAN was preceded by the Aston Archive, as reported in several TUGboat articles: "A UK-Based TeX Mail Archive Server", by Peter Abbott, November 1988 "UKTeX and the Aston Archive", by Peter Abbott, April 1989 "UKTeX and the Aston Archive", by Peter Abbott, July 1989 "The UKTeX Archive at the University of Aston", by Peter Abbott, November 1989 However, as noted in the answer by @vonbrand, DECUS was almost certainly earlier in having a formal software distribution mechanism, on tape. TeX was part of this collection, as reported in TUGboat: "The DECUS TeX Collection". by M. Edward Nieland, November 1989, pp.195-196 Several followup reports appear in later TUGboat issues. TeX was an active topic at DECUS meetings; this is the earliest report: "TeX at the 1981 Spring DECUS U. S. symposium", by Patrick Milligan, July 1981, p.29 I can't say whether the UKTeX archive was inspired by other software projects, but it was clearly something that was needed, and initiated to meet that need.
The early Linux distributions had a sort of package repositories (e.g. Slackware). Earlier you could get sources for Linux-hacked stuff on some places (forget details, that was 1992 or so for me). Earliest repositories (source) were e.g. the GNU mirrors (starting around 1985 or so), public FTP (and gopher) sites were plenty by 1990 (and probably much, much older). Binary packages were not popular, due to wild differences in architecture/operating system/setup common in the '80s. A common way to share sources (for non-Internet connected sites in the '80s) were Usenet groups like comp.sources.unix (got my first version of Perl as thirty-something posts you had to unpack an stitch together just right, configure by futzing in Makefile macros and then --hopefully-- build. First mention of software sharing I've seen documented was the custom of dropping off tapes with interesting stuff at DECUS (DEC User group) conferences, and pick them up with a compilation of everything contributed at the end. I believe IBM users had something similar going too. This was in the '70s or even earlier (sorry, away on vacation, no access to my computer now).
Convert this table to latex <sep> May anybody helps me how to convert the attached image (table) to latex format?
As shown, this is a relatively complex table to format well since it requires the following elements: rotated cells -> <code>rotating</code> package cells which span multiple columns -> <code>\multicolumn{<number of columns>}{<alignment>}{<content>}</code> cells which span multiple rows -> <code>multirow</code> package In addition, LaTeX tables do not, by default allow sufficient vertical spacing. This problem is exacerbated by the use of horizontal rules. Moreover, some horizontal rules should typically be heavier than others. To accommodate these considerations in a table with vertical rules, I used <code>makecell</code>. I also used <code>array</code> which is a basic extension of the standard LaTeX syntax and makes it a bit easier to customise things. So, in the document preamble, we have <code>\usepackage{rotating,multirow,makecell,array} </code> to load the packages. I used 3 different rule weights: standard, a bit thicker and thicker still. For convenience, we define the non-standard rule heights in one place so they can be easily modified and consistently applied. <code>\newlength\xlineht \newlength\mlineht \setlength\xlineht{1.2pt} \setlength\mlineht{.8pt} </code> We define a couple of extra column types for convenience and consistency again. <code>\newcolumntype{C}{c!{\vrule width \xlineht}} \newcolumntype{M}{c!{\vrule width \mlineht}} </code> <code>makecell</code> allows us to configure some extra spacing around cells, which we need. So we set some things up. <code>\setcellgapes{3pt} </code> We want our headers to be bold. <code>\renewcommand\theadfont{\bfseries} </code> That's it for the preamble. Now, in the document itself. <code>\begin{table} </code> Put the table in the <code>table</code> environment if you want it to float. If you do this, you probably want to use a <code>\caption{}</code> and <code>\label{}</code> so you can refer to it in the text. If you don't want the table to move from where you put it, use the <code>center</code> environment instead. <code> \makegapedcells </code> This applies our extra spacing around cells. <code> \begin{tabular}{!{\vrule width \xlineht}c|M*{3}{c|}C} </code> Here's the <code>tabular</code> specification: start at the left with a vertical rule of width thicker-still; then a centred column and a standard rule; then one of our custom columns, <code>M</code>; then 3 centred columns followed by standard rules; finally another custom column, <code>C</code>. <code> \Xhline{\xlineht} </code> A rule of height thicker-still to start. <code> \multicolumn{2}{!{\vrule width \xlineht}M}{}& \multicolumn{2}{c|}{\thead{C1}} & \multicolumn{2}{C}{\thead{C2}}\\\cline{3-6} </code> The first header row, using <code>\multicolumn</code> for cells spanning 2 columns and <code>\thead</code> for header content, followed by a partial rule. <code> \multicolumn{2}{!{\vrule width \xlineht}M}{}& \thead{P1} & \thead{P2} & \thead{P1} & \thead{P2} \\\cline{3-6} </code> The second header row. <code> \multicolumn{2}{!{\vrule width \xlineht}M}{}& {0.33} & {0.66} & {0.2} & {0.8} \\\Xhline{\mlineht} </code> The third header row with cell contents not formatted as headers, followed by a thicker rule. Now for the first cell spanning multiple rows (9), which is also rotated. We use <code>\rotatebox</code> rather than <code>makecell</code> here because I couldn't figure out how to do this with <code>makecell</code>'s own rotation wrappers. <code> \multirowcell{9}{\rotatebox[]{-90}{\theadfont Different alpha}} & 0.1 & \multicolumn{2}{c|}{9} & \multicolumn{2}{C}{25} \\\cline{2-6} </code> And some more column-spanning content and a partial rule. We continue in the same way. <code> & 0.2 & \multicolumn{2}{c|}{9} & \multicolumn{2}{C}{67} \\\cline{2-6} & 0.3 & \multicolumn{2}{c|}{9} & \multicolumn{2}{C}{890} \\\cline{2-6} & 0.4 & \multicolumn{2}{c|}{9} & \multicolumn{2}{C}{34} \\\cline{2-6} & 0.5 & \multicolumn{2}{c|}{9} & \multicolumn{2}{C}{23} \\\cline{2-6} & 0.6 & \multicolumn{2}{c|}{9} & \multicolumn{2}{C}{25} \\\cline{2-6} & 0.7 & \multicolumn{2}{c|}{69} & \multicolumn{2}{C}{54} \\\cline{2-6} & 0.8 & \multicolumn{2}{c|}{9} & \multicolumn{2}{C}{21} \\\cline{2-6} & 0.9 & \multicolumn{2}{c|}{69} & \multicolumn{2}{C}{55} \\\hline </code> Here comes the second rotated cell spanning multiple columns. <code> \multirowcell{9}{\rotatebox[]{-90}{\theadfont Different beta}} & 0.1 & \multicolumn{2}{c|}{19} & \multicolumn{2}{C}{69} \\\cline{2-6} & 0.2 & \multicolumn{2}{c|}{99} & \multicolumn{2}{C}{83} \\\cline{2-6} & 0.3 & \multicolumn{2}{c|}{99} & \multicolumn{2}{C}{35} \\\cline{2-6} & 0.4 & \multicolumn{2}{c|}{99} & \multicolumn{2}{C}{64} \\\cline{2-6} & 0.5 & \multicolumn{2}{c|}{99} & \multicolumn{2}{C}{46} \\\cline{2-6} & 0.6 & \multicolumn{2}{c|}{99} & \multicolumn{2}{C}{12} \\\cline{2-6} & 0.7 & \multicolumn{2}{c|}{99} & \multicolumn{2}{C}{16} \\\cline{2-6} & 0.8 & \multicolumn{2}{c|}{99} & \multicolumn{2}{C}{71} \\\cline{2-6} & 0.9 & \multicolumn{2}{c|}{99} & \multicolumn{2}{C}{38} \\\Xhline{\xlineht} </code> We end with a thicker-still rule. <code> \end{tabular} \end{table} </code> Complete code: <code>\documentclass{article} \usepackage{rotating,multirow,makecell,array} \newlength\xlineht \newlength\mlineht \setlength\xlineht{1.2pt} \setlength\mlineht{.8pt} \newcolumntype{C}{c!{\vrule width \xlineht}} \newcolumntype{M}{c!{\vrule width \mlineht}} \setcellgapes{3pt} \renewcommand\theadfont{\bfseries} \begin{document} \begin{table} \makegapedcells \begin{tabular}{!{\vrule width \xlineht}c|M*{3}{c|}C} \Xhline{\xlineht} \multicolumn{2}{!{\vrule width \xlineht}M}{}& \multicolumn{2}{c|}{\thead{C1}} & \multicolumn{2}{C}{\thead{C2}}\\\cline{3-6} \multicolumn{2}{!{\vrule width \xlineht}M}{}& \thead{P1} & \thead{P2} & \thead{P1} & \thead{P2} \\\cline{3-6} \multicolumn{2}{!{\vrule width \xlineht}M}{}& {0.33} & {0.66} & {0.2} & {0.8} \\\Xhline{\mlineht} \multirowcell{9}{\rotatebox[]{-90}{\theadfont Different alpha}} & 0.1 & \multicolumn{2}{c|}{9} & \multicolumn{2}{C}{25} \\\cline{2-6} & 0.2 & \multicolumn{2}{c|}{9} & \multicolumn{2}{C}{67} \\\cline{2-6} & 0.3 & \multicolumn{2}{c|}{9} & \multicolumn{2}{C}{890} \\\cline{2-6} & 0.4 & \multicolumn{2}{c|}{9} & \multicolumn{2}{C}{34} \\\cline{2-6} & 0.5 & \multicolumn{2}{c|}{9} & \multicolumn{2}{C}{23} \\\cline{2-6} & 0.6 & \multicolumn{2}{c|}{9} & \multicolumn{2}{C}{25} \\\cline{2-6} & 0.7 & \multicolumn{2}{c|}{69} & \multicolumn{2}{C}{54} \\\cline{2-6} & 0.8 & \multicolumn{2}{c|}{9} & \multicolumn{2}{C}{21} \\\cline{2-6} & 0.9 & \multicolumn{2}{c|}{69} & \multicolumn{2}{C}{55} \\\hline \multirowcell{9}{\rotatebox[]{-90}{\theadfont Different beta}} & 0.1 & \multicolumn{2}{c|}{19} & \multicolumn{2}{C}{69} \\\cline{2-6} & 0.2 & \multicolumn{2}{c|}{99} & \multicolumn{2}{C}{83} \\\cline{2-6} & 0.3 & \multicolumn{2}{c|}{99} & \multicolumn{2}{C}{35} \\\cline{2-6} & 0.4 & \multicolumn{2}{c|}{99} & \multicolumn{2}{C}{64} \\\cline{2-6} & 0.5 & \multicolumn{2}{c|}{99} & \multicolumn{2}{C}{46} \\\cline{2-6} & 0.6 & \multicolumn{2}{c|}{99} & \multicolumn{2}{C}{12} \\\cline{2-6} & 0.7 & \multicolumn{2}{c|}{99} & \multicolumn{2}{C}{16} \\\cline{2-6} & 0.8 & \multicolumn{2}{c|}{99} & \multicolumn{2}{C}{71} \\\cline{2-6} & 0.9 & \multicolumn{2}{c|}{99} & \multicolumn{2}{C}{38} \\\Xhline{\xlineht} \end{tabular} \end{table} \end{document} </code> Note, however, that professional-quality tables do not typically use vertical rules at all and use horizontal rules much more sparingly. For an informed, if possibly slightly extreme, discussion, see the manual of the <code>booktabs</code> package. For example, I would probably use something like this. This overdoes the rules a little by the standards of <code>booktabs</code>, but is much simpler and clearer than the original. As a bonus, the code is much, much simpler! Less really is more where tables are concerned and less is fortunately easier by far to typeset. In this case, we load <code>booktabs</code> instead of <code>makecell,array</code> and we roll our own header font command with <code>\newcommand*\myheadfont{\bfseries} </code> Dropping the vertical rules means that the <code>tabular</code> specifier is just <code>*{6}{c}</code> for 6 centred columns. Using <code>booktabs</code> gives us <code>\toprule</code> for the rule at the top; <code>\bottomrule</code> for the rule at the bottom; <code>\midrule</code> for rules in the middle; <code>\cmidrule(){}</code> for partial rules in the middle. In particular, we can 'trim` partial rules to the left and/or right to create a gap between consecutive rules in the header. We aren't using <code>makecell</code> now, so we use <code>\multirow</code> for the cells spanning multiple columns, with <code>*</code> specifying the natural width. Complete code: <code>\documentclass{article} \usepackage{rotating,multirow,booktabs} \newcommand*\myheadfont{\bfseries} \begin{document} \begin{table} \begin{tabular}{*{6}{c}} \toprule && \multicolumn{2}{c}{\myheadfont C1} & \multicolumn{2}{c}{\myheadfont C2}\\\cmidrule(lr){3-4}\cmidrule(lr){5-6} && \myheadfont P1 & \myheadfont P2 & \myheadfont P1 & \myheadfont P2 \\ && {0.33} & {0.66} & {0.2} & {0.8} \\ \midrule \multirow{9}*{\rotatebox[]{-90}{\myheadfont Different alpha}} & 0.1 & \multicolumn{2}{c}{9} & \multicolumn{2}{c}{25} \\ & 0.2 & \multicolumn{2}{c}{9} & \multicolumn{2}{c}{67} \\ & 0.3 & \multicolumn{2}{c}{9} & \multicolumn{2}{c}{890} \\ & 0.4 & \multicolumn{2}{c}{9} & \multicolumn{2}{c}{34} \\ & 0.5 & \multicolumn{2}{c}{9} & \multicolumn{2}{c}{23} \\ & 0.6 & \multicolumn{2}{c}{9} & \multicolumn{2}{c}{25} \\ & 0.7 & \multicolumn{2}{c}{69} & \multicolumn{2}{c}{54} \\ & 0.8 & \multicolumn{2}{c}{9} & \multicolumn{2}{c}{21} \\ & 0.9 & \multicolumn{2}{c}{69} & \multicolumn{2}{c}{55} \\\midrule \multirow{9}*{\rotatebox[]{-90}{\myheadfont Different beta}} & 0.1 & \multicolumn{2}{c}{19} & \multicolumn{2}{c}{69} \\ & 0.2 & \multicolumn{2}{c}{99} & \multicolumn{2}{c}{83} \\ & 0.3 & \multicolumn{2}{c}{99} & \multicolumn{2}{c}{35} \\ & 0.4 & \multicolumn{2}{c}{99} & \multicolumn{2}{c}{64} \\ & 0.5 & \multicolumn{2}{c}{99} & \multicolumn{2}{c}{46} \\ & 0.6 & \multicolumn{2}{c}{99} & \multicolumn{2}{c}{12} \\ & 0.7 & \multicolumn{2}{c}{99} & \multicolumn{2}{c}{16} \\ & 0.8 & \multicolumn{2}{c}{99} & \multicolumn{2}{c}{71} \\ & 0.9 & \multicolumn{2}{c}{99} & \multicolumn{2}{c}{38} \\ \bottomrule \end{tabular} \end{table} \end{document} </code>
I'll build this up gradually, I'd recommend you compile each snippet with <code>pdflatex</code> at each step: <code>\documentclass{article} \begin{document} hello world \end{document} </code> Now add the <code>tabular</code> <code>\documentclass{article} \begin{document} \begin{tabular}{cccc} & 0.1 & 9 & 24 \\ & 0.1 & 9 & 24 \\ & 0.1 & 9 & 24 \\ & 0.1 & 9 & 24 \\ & 0.1 & 9 & 24 \\ & 0.1 & 9 & 24 \\ & 0.1 & 9 & 24 \\ & 0.1 & 9 & 24 \\ & 0.1 & 9 & 24 \\ & 0.1 & 9 & 24 \\ \end{tabular} \end{document} </code> add the horizontal and vertical lines <code>\documentclass{article} \begin{document} \begin{tabular}{|c|c|c|c|} \hline & 0.1 & 9 & 24 \\ & 0.1 & 9 & 24 \\ & 0.1 & 9 & 24 \\ & 0.1 & 9 & 24 \\ & 0.1 & 9 & 24 \\ \hline & 0.1 & 9 & 24 \\ & 0.1 & 9 & 24 \\ & 0.1 & 9 & 24 \\ & 0.1 & 9 & 24 \\ & 0.1 & 9 & 24 \\ \hline \end{tabular} \end{document} </code> add the column headers <code>\documentclass{article} \begin{document} \begin{tabular}{|c@{}|@{}c@{}|@{}c@{}|@{}c@{}|} \hline & & \begin{tabular}{@{}c@{}|c@{}} \multicolumn{2}{c}{C1}\\ \hline P1 & P2 \\ \hline 0.33 & 0.62\\ \end{tabular} & \begin{tabular}{c@{}|c@{}} \multicolumn{2}{c}{C2}\\ \hline P1 & P2 \\ \hline 0.33 & 0.62\\ \end{tabular} \\\hline & 0.1 & 9 & 24 \\ & 0.1 & 9 & 24 \\ & 0.1 & 9 & 24 \\ & 0.1 & 9 & 24 \\ & 0.1 & 9 & 24 \\ \hline & 0.1 & 9 & 24 \\ & 0.1 & 9 & 24 \\ & 0.1 & 9 & 24 \\ & 0.1 & 9 & 24 \\ & 0.1 & 9 & 24 \\ \hline \end{tabular} \end{document} </code> add the <code>multirow</code> magic, with <code>rotatebox</code> from <code>graphicx</code> <code>\documentclass{article} \usepackage{multirow} \usepackage{graphicx} \begin{document} \begin{tabular}{|c@{}@{}c@{}|@{}c@{}|@{}c@{}|} \hline & & \begin{tabular}{@{}c@{}|c@{}} \multicolumn{2}{c}{C1}\\ \hline P1 & P2 \\ \hline 0.33 & 0.62\\ \end{tabular} & \begin{tabular}{c@{}|c@{}} \multicolumn{2}{c}{C2}\\ \hline P1 & P2 \\ \hline 0.33 & 0.62\\ \end{tabular} \\\hline \multirow{6}{1cm}{\rotatebox{90}{different alpha}} & 0.1 & 9 & 24 \\ & 0.1 & 9 & 24 \\ & 0.1 & 9 & 24 \\ & 0.1 & 9 & 24 \\ & 0.1 & 9 & 24 \\ & 0.1 & 9 & 24 \\ \hline \multirow{6}{1cm}{\rotatebox{90}{different beta}} & 0.1 & 9 & 24 \\ & 0.1 & 9 & 24 \\ & 0.1 & 9 & 24 \\ & 0.1 & 9 & 24 \\ & 0.1 & 9 & 24 \\ & 0.1 & 9 & 24 \\ \hline \end{tabular} \end{document} </code> Notes: <code>@{}</code> removes column space you don't have to use a <code>tabular</code> for your header, but without it, you might have to do more <code>multicolumn</code> work I'd enhance this table by using <code>siuntix</code> <code>S</code> column, and combine it with <code>booktabs</code> Here's a version of how I'd consider presenting it: <code>\documentclass{article} \usepackage{multirow} \usepackage{graphicx} \usepackage{booktabs} \usepackage{siunitx} \begin{document} \begin{tabular}{ccSS} \toprule & & {\begin{tabular}{cc} \multicolumn{2}{c}{C1}\\ \midrule P1 & P2 \\ \midrule 0.33 & 0.62\\ \end{tabular}} & {\begin{tabular}{cc} \multicolumn{2}{c}{C2}\\ \midrule P1 & P2 \\ \midrule 0.33 & 0.62\\ \end{tabular}} \\\midrule \multirow{6}{1cm}{\rotatebox{90}{different alpha}} & 0.1 & 9 & 24 \\ & 0.1 & 9 & 24 \\ & 0.1 & 9 & 24 \\ & 0.1 & 9 & 24 \\ & 0.1 & 9 & 24 \\ & 0.1 & 9 & 24 \\ \midrule \multirow{6}{1cm}{\rotatebox{90}{different beta}} & 0.1 & 9 & 24 \\ & 0.1 & 9 & 24 \\ & 0.1 & 9 & 24 \\ & 0.1 & 9 & 24 \\ & 0.1 & 9 & 24 \\ & 0.1 & 9 & 24 \\ \bottomrule \end{tabular} \end{document} </code>
How to draw a closed smooth curve from a list of nodes?
Sorry, I don't know PSTricks, but for comparison, this is the Metapost equivalent of Jake's TikZ solution: <code>\starttext \startMPpage[offset=3mm] path p; p := for i = 0 step 10 until 350 : (1 randomized 1)*dir(i) .. endfor cycle; draw p scaled 1cm; \stopMPpage \stoptext </code>
<code>\documentclass{article} \usepackage{tikz} \usetikzlibrary{hobby} \begin{document} \pgfmathsetseed{2} \edef\randompath{} \foreach \theta in {0,10,...,350} { \pgfmathsetmacro\r{rnd+1} \xdef\randompath{\randompath (\theta:\r) ..} } \begin{tikzpicture}[use Hobby shortcut] \expandafter\draw\randompath cycle; \end{tikzpicture} \end{document} </code>
How to survive a timeshare promotional trip?
My approach is to not feed them anything to work with. When I have been to one of those deals, my only commitment was to attend the presentation, not to supply any information or discuss anything. Questions about myself and my situation get response "Please continue with your presentation.". Actual sales questions get "No". If asked why not, back to "Please continue with your presentation." They plan to spend some time in relationship-establishing conversation, getting information about the target's finances, and overcoming objections. If you strictly limit the interaction to their actual presentation the sales person may run out of material in less than 2 hours.
I have gone through quite a few of these. The easiest thing to do is do a little research in the area that you are going. Then during the selling phase: Do not go into any private room to talk one on one alone with anyone. Simply say, I prefer that we talk "out here" or "in public". Remain very unimpressed with the property, setup, rate, everything. It is really easy to kill the conversation by saying "I really wouldn't want to come back here, not sure I could get renters, I am not impressed with the property." And the reason I said do homework... If you know a couple of rates or selling prices of properties nearby and do the math most of the time you will see a 2-5 times markup for the timeshare. By staying in the group or out in public most of the time the sales manager (there is always a boss and it can be someone who is selling to) will pull your sales person aside and tell them to get you out of there. The last thing they want is someone who hates the property sending negative vibes to others. Boom you are done. I have never been hassled for 15 minutes after any presentation - and some of the properties I actually liked.
In US hotels, what happens if you skip checkout and just leave the hotel?
Housekeeping reports back to the main desk when a room is empty (back in the 80s when I was a desk clerk there was an automated system using the room phone), and it gets rented again. Whether or not you checked out isn't actually the trigger. Checking out puts the room on the cleaning list, it doesn't put the room on the rent-me list. And in the mornings, by the time there's a queue at the desk for checkout (usually populated by tourists who rarely travel, not business travelers), housekeeping is working at full capacity, so actually checking out doesn't really matter. If you're checking out very early, then they'll probably clean the room early too, but then there's a clerk at the desk with no other guests to deal with. At the hotel I worked at, the key point was around 3pm; housekeeping was finishing up, and then they'd have to check the rooms that were scheduled to check out that day, but housekeeping had reported occupied + cleaned before checkout time. If they were empty, they got a fresh clean (pretty cursory) and then went on the rent-me list. (The only time you'd get charged for a late checkout was if you actually checked out at the front desk after checkout time. If you just left, we'd never know.)
You will simply get charged the pre-agreed amounts on the credit card you gave them when booking. Many frequent-travellers don't check in or out - you get your electronic room key in the app, and just leave when you are done. All major chains support something similar; I haven't visited any check-in/out desk for years.
Japanese etiquette: Most common (and offensive) mistakes?
Take name cards with two hands when given to you, give them with two hands. Look at the received card, put it in front of you on the table while you are talking to the person(s). You CAN punch with one chopstick into food and hold it with the other if it's something hard to eat (dumplings, potatoes etc). Don't stick both in however. Do not soak your sushi rice in soy sauce. Ideally, try to dip only the fish into it. Do not throw too much wasabi into the soy sauce. Ideally, just take of a small piece and put it directly on the fish before eating it. Those two rules are specially important if you are sitting at a sushi counter since both of the errors tell the chef that you need to "fix" his food. You CAN however eat sushi with your right hand if you have issues with chopsticks. Eat the pickled ginger between sushi pieces in small portions - do not gobble it up before the sushi itself arrives. In general, try to mimic the behavior of the people that are of the same status around you (co-workers, co-students) when it comes to bowing, where to sit, how loud to talk, how much to drink/eat when in presence of someone superior (boss, professor etc). Do not address yourself/introduce yourself with -san. While you say "this is mister Smith" and in Japanese say "this is Smith-san", you do NOT introduce yourself with "my name is Smith-san" but rather "my name is Smith". Dragons are lucky creatures. Do not compare something bad/dangerous to a dragon. I have seen this some times and it really shows you have no idea about Asia at large. If you try to speak Japanese, try on someone you trust to give you a good evaluation first. If you have a strong English/French accent and people do not understand what you want to say in Japanese, you make them feel uncomfortable. You can on the other hand make a really good impression by being able to make some short phrases that you can use to give positive feedback ("Oishkatta desu" after a dinner, etc) in a reasonably understandable accent. Do not open gifts that you received in front of the person who gave them unless encouraged to do so. It makes you look greedy and there is a huge risk of face loss in case you do not like what you received etc. If you have Japanese guests wherever you are, give them a small (toy/ceramic/whatever) frog as a departure gift. The word "frog" and "return" have the same pronunciation in Japanese and indicate that you want THEM to come back. Do not do that if you are at someone else's place. If you go somewhere, buy a small souvenir (such as chocolates, cookies etc) from the place where you have been, specially local stuff stuff that normally cannot be bought in a supermarket everywhere. If you are in an office in Tokyo and go to Osaka for a business trip, buy some of the stuff sold at the train station. Those are always individually packed so you can give everyone in your department on cookie/whatever. Put those on everyone's desk when you return - no need to hand them over in person. It's not so important what it is, or that it's expensive. If you are on a private trip, buy something small for your best friends only - maybe your boss, too. If you are in a restaurant, check if there is a cashier at the entrance when you come in. You will also most likely then have a paper on a clipboard at/under your table where the waiter notes down your orders. When paying, take that clipboard and go directly to the exit to pay. Otherwise, ask for the check on the table. It's completely normal to ask which sauce goes with which food. Often Japanese people on the table will not know what goes with what either since many restaurants try to make it more special by adding different dipping sauces for a course. You will most likely get 3 questions as a foreigner in Japan (in one row, asked from the same person): Do you speak/study Japanese? Do you like Japanese girls? Do you eat Natt? I think this comes from some Japanese having a certain fear that they are not Japanese "enough". They feel they speak poorly Japanese, they often prefer/admire western women and many do not like natt. If you study/like the Japanese language, fancy Japanese girls AND like natt, you are almost more Japanese then they wish to be. I speak Japanese and I like Japanese girls, but I do not like natt. Japanese people were ALWAYS relieved when I told them I do not like natt. Do not bring up topics about WWII or the island disputes with Korea/China etc. If the topic is there already, do not comment on it. If you feel you need to contribute or participate, bring an example from history/territorial disputes in your country, but do not give opinions about the Japanese topics. Chances are high that what you read in your local newspaper outside of Japan is quite different from what you read inside of Japan, and you can only appear as a fool. Do not expose any tattoos that you might have. Tattoos are traditionally linked to the Japanese Mafia. Respect food. Finish your plate. Don't walk around while eating. Do not tip people - anywhere, ever. If you need to make/receive a cellphone call, leave the room/restaurant/train compartment. If you take a picture with your cellphone or compact digital camera, make sure that the "shutter sound" is switched on. People are afraid of secretly taken pictures, specially in public places. Be very careful how you behave in general. People will politely ignore if you behave in a rude manner. This does not mean that it's ok. I have seen many people who started to become more and more rude simply because nobody told them off. It can breed a certain level of arrogance since people think whatever they do is ok. Regarding some of the comments below I would like to make a statement here regarding the accusation in the comments of me being sexist. I take any kind of discrimination very seriously and oppose them heavily. Therefore, I am even more upset when I am myself accused of being sexist. I considered this quite well and came to the conclusion that there is a need to comment on this. I perceive neither the comments nor my reply to be here in the right place, but as long as the accusation stands below, I am convinced that a proper reply from my side is absolutely necessary in respect of the weight of those accusations. About the question about putting people in the same context as food: <blockquote> "Women" in this topic are objects like Natto! </blockquote> The accusation seems to be that a person asking me in direct sequence the questions if I like a type of food and if I like Japanese women is sexist. Me answering according to the question instead of rejecting the question as sexist, was making me sexist just as well. This means however that if someone said in one sentence to someone of the opposite sex: "I love this country, and I love you, too" would make someone sexist since it also compares a person with an object. I oppose this conclusion heavily. What introduction will one have to make then before talking about people to not degrade them and being accused of sexism? About the question if the short time a tourist is in Japan matters: <blockquote> Why is your taste important as a tourist about "Women" of a country?! Women are foods or you are going to buy them or get married with them in a short period of time? Surely these are not my questions as it is not important for me your or the others tourists' reason to travel to another country but this question is "sexist". </blockquote> This question was asked by a Japanese person living in Japan to me, a foreigner living in Japan. While this page is not meant for expats, but for travelers, many people on this page return over and over to the same country and are therefore interested in the culture and mistakes one can make when having longer interactions with locals. My example does not address a weekend-tourist who only sees a few of the most famous temples in Kyoto. But regardless of this issue, nothing in this context is sexist just because the situation described does not apply to short-term tourists. The context is about comparing a preference of a visual appearance of people in one part of the world to people of another part of the world. To perceive a visual difference between Caucasians and Japanese people is not sexist since it does not compare man to women in any way. It is further not racist since it is merely the observation of a very obvious fact, not a allegation of inherent superiority of one of them. Visual attraction (i.e. when seeing but not knowing a person) towards the other sex is a biological fact - and not sexism. Combining the visual attraction with a preference to the visual appearance, being the matter of a certain body type and possibly hair color is not sexism either. It does not treat women like objects and it does not judge men being superior to women. Otherwise the mere question "Do you think this person looks attractive?" was sexist too.
Funnily enough, I read an article on askmen.com about the top 10 Japanese etiquette mistakes. Boiled down to bullet points, we have: Blowing your nose in public Pointing with your forefinger Don't pour your own beer Wearing toilet slippers outside of toilet Giving gifts in multiples of four Failing to wash first before entering a public bath Passing food with chopsticks to someone else's Sticking chopsticks upright in rice (really bad) Mishandling someone's business card (don't put it in back pocket, or fold it) Wearing your shoes into someone's home I did three years of Japanese in school, and the chopsticks in rice was definitely one we learned, as was the wearing of shoes in someone's house.
What are these boxed doors outside store fronts in New York?
That is a sidewalk vestibule. The idea is to have an extra door between the building's interior and the outside, so as to reduce the amount of air exchanged when people go in and out. In winter, warm air stays inside and cold air stays outside, reducing the building's heating costs and avoiding uncomfortable drafts for diners sitting near the door. You could also have a vestibule inside the restaurant's regular doors, but that would occupy valuable floor space, and would be useless during warmer seasons. The temporary vestibule can be put up in winter and taken down in summer.
While I do not know what they are called, their purpose is to keep heat inside by creating an extra air chamber between the inside which is heated and the outside. These are usually removed in the warmer months.
Why 'photoshop' passport photos?
I shoot RAW files and process in Lightroom. There is no such thing as an unprocessed image simply automated processing. The color rendition to match the light sources, choosing the right range of values to make a good exposure, etc. are all basic things. In the old days, prints would choose the paper grade and exposure time, and you would do dodging and burning while making the exposure, and then you chose the developer and timings for the process. So when I shot my wifes photo for example, I did it outdoors in the shade against a white reflector I just taped up to use as a background. Those are choices too! Then the first processing step is choosing which of 10 or so exposures to use. A burst taken over the span of one second will show different eye positions etc. especially if a blink was taking place. Then, I used the relevant control to indicate that the background should be neutral in color. This is not changing the color, as it would be if you started with a finished jpeg file that was blue, orange, or buff when it should be grey as it was in life. This is interpreting the raw data to match the light source. Now the background should be uniform white, not showing cloth folds or anything. That's the brightest thing in the picture, so setting the detailed exposure settings (whites and highlights, in addition to overall exposure control) can push that up while coordinating with the main slider to make the skin look exposed right. Note that this is the opposite of what an automated system might guess recovering blown out highlights, bringing out details of the wrinkles in the cloth. No Photoshop (or explicit pixel manipulation) required. That's just what a good picture takes to make.
Another issue is that (in the UK at least) it can take more effort to find somewhere to get passport photos taken than to take the pictures and get them printed. My nearest (or at least most convenient) passport photo booth is 8km from my house at the mainline railway station, because you need photocards for season tickets. It even works most of the time. In previous jobs it would have taken my entire lunch break to get to a machine and back or been completely impossible without making a special trip somewhere busy at the weekend. That sort of thing can be tricky to fit in to a busy schedule. Compare that to 5 minutes setting up the SLR on a tripod, 5 minutes cropping (etc.) and uploading, then the pictures arrive on my doorstep 3 days later. For less money.