Incorrect browser output for simple Javascript - trying to test alert() function

Question: I am just starting out on my JavaScript tutorial and it says to test this simple script out. However, I get the wrong output.
Does anyone know what the problem is? I should be getting an alert dialogue box. I have tried the following code on Chrome and Safari web browsers:
<code><!DOCTYPE HTML>
<HTML>
    <HEAD>
        <TITLE>Template</TITLE>
    </HEAD>

    <BODY>

    <SCRIPT LANGUAGE = "Javascript">

        alert("Hello World");

    </SCRIPT>

    </BODY>
</HTML>
</code>
And the browser output I am getting is:

{\rtf1\ansi\ansicpg1252\deff0\deflang1033{\fonttbl{\f0\fswiss\fcharset0
  Arial;}} {*\generator Msftedit
  126.96.36.1995;}\viewkind4\uc1\pard\f0\fs20 \par \par \tab \par \tab\tab \par \tab \par \tab\par \tab \par \tab\tab\par \tab \par \par \tab
  \par \par }

Please does anyone know what the problem is? Thank you.
Comment: What you have done is, you might have created the file in microsoft word and saved as RTF?
Comment: Are you saving your code as an RTF file? (You should save it as a plain text file.)
Comment: Yes basically I was using word pad although it appeared that I was saving it as a html file it did not give me the option to select 'All files' but now using 'note pad' and problem solved. Thanks
Answer: Sounds like you're using an evil Windows product to write your code.  Try using notepad instead.  Long story short: you're capturing hidden characters inserted by your editor.
Comment: Awesome man. Yes you are right I was using 'wordpad' instead Of 'notepad', ahh something so simple yet we learn. cheers
Comment: @Mr_leighman: you can use WordPad if you want, just save the file as plain text. (Notepad is a "Windows product" as well, although I don't know what its evil quotient is, compared to WordPad.)


Can't open Nuxt.js starter template at Cloud9

Question: Can't open Nuxt.js starter template in the browser (I see Cloud9 page: No application seems to be running here! Cloud9 can't get you to your requested workspace...).
Сhosen template is Blank.
Node.JS installed by NVM and I choose version v6.10.2 (Latest LTS: Boron)
Little editing package.json of nuxt.js starter template, cause default port is 3000, but in c9 available only 8080, 8081, 8082 :
  "config": {
    "nuxt": {
      "port": "8080"
       }
  },

Then I run app (npm run dev) and see everything is ok in console:
firstname.lastname@example.com dev /home/ubuntu/workspace/mytemplateapp
> nuxt

nuxt:build App root: /home/ubuntu/workspace/mytemplateapp +0ms
nuxt:build Generating .nuxt/ files... +1ms
Ready on http://127.0.0.1:8080
nuxt:build Generating routes... +14ms
nuxt:build Generating files... +9ms
nuxt:build Adding webpack middleware... +17
Build completed in 4.204s

DONE
Compiled successfully in 4210ms
Open http://127.0.0.1:8080

I've already tried all three available ports.
Well, I am stuck. I would appreciate any advice
Comment: I found main issue: it's adress of host! Should be like http://0.0.0.0:8080
Comment: I stuck at the same point.. please teach me how you fix that :(
Answer: try this:
1. in your package.json
"config": {
  "nuxt": {
   "port": 8080,
   "host": "0.0.0.0"
  }
}

run npm run dev (if it doesn't work use sudo npm run dev)
click the link which shows on cloud9 terminal

then you get it
Comment: This worked. Here some additional docs: https://nuxtjs.org/faq/host-port/


Open new link in existing browser keeping master page displayed

Question: I have a default site created when I started a new project. It also created a master page that uses an Menu control for navigation.
I am trying to add a link to an external forum, and I want to embed the forum in one of my content pages. I've tried setting the Target of the MenuItem, but no luck.
Any ideas  or suggestions is appreciated.
Comment: So you want the other site to display inside of your site?
Comment: Yes.  I've tried using IFrame like answer below suggested but it still does not appear inside of my site.

I have
in my asp:Menu.

Inside my ContentPlaceHolder where I want the forum page to appear, I have

It still opens a new window though.  Any help?
Answer: I would think you are stuck with using an IFrame


The number $2^{3^n}+1$ is divisible by $3^{n+1}$ and not divisible by $3^{n+2}$.

Question:
Prove that for every $n\in \mathbb N$, $2^{3^n}+1$ is divisible by $3^{n+1}$ and not divisible by $3^{n+2}$.

I was able to prove that $2^{3^n}+1$ is divisible by $3^{n+1}$ using induction.
First, I check whether the statement is true for $n=1$. The statement holds since:
$$2^{3^1}+1=9$$ $$3^{1+1}=9$$
Second, I assume that the statement is true for every $n\in \mathbb N$.
Finally, I take that $n=n+1$. From that, the original expression becomes $(2^{3^n})^3+1$, which is a sum of cubes, and the same as:
$$(2^{3^n}+1)((2^{3^n})^2-2^{3^n}+1)$$
As I assumed that $2^{3^n}+1$ is divisible by $3^{n+1}$, and one of the factors is $2^{3^n}+1$, the entire expression must be divisible by $3^{n+1}$, and so the statement is true for every $n\in \mathbb N$.
Now, I don't know how to prove that $2^{3^n}+1$ isn't divisible by $3^{n+2}$. Please explain how I can do so step-by-step, without using complicated terms.
Comment: So, $$2^{3^n} = (-1) + k\cdot 3^{n+1}$$ with $k$ not a multiple of $3$.
Comment: You missed the `+1`...
Comment: Yes, I skipped a part while typing it, it's ${2^3}^n+1$ instead of ${2^3}^n$. Edited the question.
Comment: @Rafflesiaarnoldii , yes, that's right. Sorry, I'm new this. I'll try to edit the question again with more details about what I already did and what kind of answer I am looking for.
Answer: Let
$$A_n = 2^{3^n}+1.$$
The claim holds for $n=0$, and since:
$$ A_{n+1} = (A_n-1)^3+1 = A_n^3 -3A_n(A_n-1) $$
we have that $\nu_3(A_{n+1}) = 1+\nu_3(A_n)$, since $9\mid A_n^3$ and $3\mid 3A_n$ but $3\nmid (A_n-1)$.


How many people can a Telegram bot serve at the same time

Question: I did not find information on limits on the simultaneous use of telegram bots, I mean how much people can use my telegram bot at the same time? I use webhook btw.
Answer: Well, the overall performance mostly depends on your server performance.
However, there are limits on sending messages to users:

When sending messages inside a particular chat, avoid sending more than one message per second. We may allow short bursts that go over this limit, but eventually you'll begin receiving 429 errors.

You can read about it in this section of API documentation.
Comment: I saw that by default webhook can serve only 40 users, is it true?
Comment: 40 is the default value for `max_connections` parameter of `setWebhook` method. You can set it explicitly by yourself, the maximum value is 100.
Comment: It represents the *Maximum allowed number of simultaneous HTTPS connections to the webhook for update deliver*.


does ping work behind squid proxy?

Question: I wonder if it is possible to use ping command behind a proxy?
I'm really confused because this page says:
how does ping work over proxy?
that it is not possible to use ping command behind proxy.
but this page says  can not ping google using proxy
it is possible.
which one is correct? I also must mention that curl and wget work correctly but ping doesn't work at all. I also have to add that the only way that I can access to internet is through proxy.
is there setting in squid to let the ICMP pass through
Comment: Did you try `httping` mentioned in an answer in your second link? Ping itself uses another IP protocol (not TCP) and will not work through a proxy, even a socks proxy.
Comment: @FedonKadifeli no i didn't. the point is that there are other servers  can ping correctly and they use this proxy server too.
Answer: No, Squid will not proxy ICMP traffic.  If the network you are on prohibits ICMP, then you will need to ssh to some other machine that is permitted to send/receive ICMP traffic.
Comment: could you please give me a reference ?
Comment: From the Squid docs (http://www.squid-cache.org/Intro/):

```Squid is a fully-featured HTTP/1.0 proxy which is almost (but not quite - we're getting there!) a fully-featured HTTP/1.1 proxy. Squid offers a rich access control, authorization and logging environment to develop web proxy and content serving applications. Squid offers a rich set of traffic optimization options, most of which are enabled by default for simpler installation and high performance.```

... Squid is an HTTP proxy, while ICMP is at a lower level of the protocol stack.

does ping work behind squid proxy?


Play SWF file in webViewClient on ICS?

Question: I tried to open an SWF file in webViewClient and it works on Android 2.1 and 2.3.3.
But when I try to play the same SWF file on 4.0.4, it causes an error and a green screen appears in the videoPlayer page.
oWebView = (WebView) findViewById(R.id.wvhPlayer);
oWebView.setWebViewClient(new KhWebClient());
oWebView.getSettings().setJavaScriptEnabled(true);
oWebView.getSettings().setPluginsEnabled(true);
oWebView.getSettings().setAllowFileAccess(true);
oWebView.getSettings().setBuiltInZoomControls(true);

String html = " <object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" width=\"100%\" height=\"100%\" id=\"vPlayer\" align=\"middle\">"
            + " <param name=\"movie\" value=\"http://mysite.com/sites/all/modules/player/player.swf?id=0CYj9tI0hpQ"
            + "\" />"
            + "  <param name=\"quality\" value=\"high\" />"
            + " <param name=\"bgcolor\" value=\"#000000\" />"
            + " <param name=\"play\" value=\"true\" />"
            + " <param name=\"loop\" value=\"true\" />"
            + " <param name=\"wmode\" value=\"window\" />"
            + " <param name=\"scale\" value=\"showall\" />"
            + " <param name=\"menu\" value=\"true\" />"
            + " <param name=\"devicefont\" value=\"false\" />"
            + " </object>";

oWebView.loadDataWithBaseURL("null", html, "text/html", "utf-8", null);

Comment: In case you missed the news, Adobe plans to drop support for Flash on Android. I'd recommend finding an alternative to Flash if you want this change to continue to work on JellyBean and later releases of Android.

Please see (http://lifehacker.com/5922466/remains-of-the-day-adobe-dropping-flash-from-android) for more information.
Answer: according to this Question, i used to load the swf file instead of loading a html.
its work like a charm.

Add to AndroidManifest.xml

android:hardwareAccelerated="true"
2.
oWebView = (WebView) findViewById(R.id.wvhPlayer);
oWebView.getSettings().setJavaScriptEnabled(true);
oWebView.getSettings().setPluginState(WebSettings.PluginState.ON);
oWebView.loadUrl("http://mysite.com/sites/all/modules/player/player.swf?id=0CYj9tI0hpQ");

Comment: hardwareAccelerated="true" was added from Android 3.0. I want to play it on Android 2.3. Is there any work around ?
Comment: try the above solution without hardwareAccelerated="true"
Answer: I found a bug(one of them) in android 4.0 with hardware acceleration in WebViewClient. By default they set it to true, so try setting it to false in your manifest and tell me what happen.
*If this fix the problem please consider moving to Iphone...
Comment: Nothing change android:hardwareAccelerated="false"

Play SWF file in webViewClient on ICS?


Join two maps by key

Question: I have two maps:
Map<Integer, String> mapOne = {(1,"a"), (2, "b")};
Map<Integer, Double> mapTwo = {(1,10.0), (2,20.0)};

and I want to combine this maps into one by Integer value, so the result map is
Map<String, Double> mapResult = {("a",10.0), ("b",20.0)};

Is there any way to do this easier than iterate over entry set?
Comment: For me, this part: "Is there any way to do this easier than iterate over entry set?"
Comment: +3! What's so interesting about this question?
Comment: Strange requirement! What about a map that contains `{ (1,"a"), (2,"b") , (3,"a") }`? Which _a_ should be mapped?
Answer: Assuming that the keys of the two maps match and that the maps have the same number of entries, with Java 8 you can write it in one line with:
Map<String, Double> map = mapOne.entrySet().stream()
                            .collect(toMap(e -> e.getValue(),
                                           e -> mapTwo.get(e.getKey())));

So you start from the first map and create a new map where the keys are the values of mapOne and the values are the corresponding values in mapTwo.
Technically this is somewhat equivalent to iterating over the entry set of the first map though.
Note: requires import static java.util.stream.Collectors.toMap;
Comment: Assuming Java8, and 1-to-1 match of all int keys in each map. (Not that mines any better at avoiding that) =P
Answer: Looks like only iteration:
@Test
public void testCollection() {
    Map<Integer, String> mapOne = new HashMap<Integer, String>();
    mapOne.put(1, "a");
    mapOne.put(2, "b");
    Map<Integer, Double> mapTwo = new HashMap<Integer, Double>();
    mapTwo.put(1, 10.0);
    mapTwo.put(2, 20.0);

    Map<String, Double> mapResult = new HashMap<String, Double>();
    Set<Integer> keySet = mapOne.keySet();
    keySet.retainAll(mapTwo.keySet());
    for (Integer value : keySet) {
        mapResult.put(mapOne.get(value), mapTwo.get(value));
    }
    System.out.println(mapResult);
}

Answer: If the maps were the same type, you could use a putAll(), but since you are changing the key value pairs, it looks like you are going to have to iterate over each integer, get() from each map, then put(mapOneVal,mapTwoVal)
for(int i=0;i<max;i++){
    String key = mapOne.get(i);
    Double val = maptwo.get(i);
    if(key!=null && val!=null)
        map3.put(key,val);
}

Comment: This could potentially lead to a lot of misses, if the maps have gaps in the sequence.
Comment: It could, and that can be easily null checked. Otherwise its a matter of iterating over mapone.keySet() and mapTwo.keySet() separately, then combining the answer.

Join two maps by key


lync + Exchange on Same Server?

Question: I'm attempting to build a test infrastructure Active Directory + Lync + Exchange.  After installing Lync on my Exchange Server, I was unable to connect to Exchange.  I don't know for sure that I was able to connect to Exchange before I installed Lync though.  Rather than go through the installation process again, I'm hoping if someone can tell me for sure if Lync 2010 and Exchange 2010 can exist on the same server.
Answer: I'm fairly sure from previous discussions with our infrastructure guys that this is a big no-no (I thought about doing the same), although can't find any evidence to back up this assertion!
This ServerFault question might help you with a possible workaround - its for OCS 2007 R2, but may apply to Lync too
You might get a better response asking this specific question on serverfault, given that it's more infrastrucure than dev related

lync + Exchange on Same Server?


Changing data depending on mysql

Question: I am getting data from a MySql database, although I don't know if there could be 1 or more hits from the query.
So, i am echoing something from the database, for example like this:
$code = "

'$data'

";
echo $code;

Now, since it is absolute; it is overlapping.
How could I change the 'top:' attribute if there are more results?(For every hit from the database, 'top:' would increment by some amount)
Comment: Why specify the `top` in the first place? Seems like this may be better achieved with `` each of your elements as an ``, then you use CSS to space them as needed.
Answer: $top = 100; // top default value
$query = mysqli_query($link, 'SQL query is going to be here');

while (null !== ($data = mysqli_fetch_assoc($query)))
{
    $code = "

    ".$data."

";
    echo $code;

    $top += 20; // increment top
}

Changing data depending on mysql


How to parse xml and get the corresponding values using Stax Iterator ?

Question: I would like to parse xml node using STAX Iterator API and get the values of each id node. In the below code, how do I get the corresponding value of id type=id2 or id3. How can I do this?
<entity>
   <id type="id1">8500123</id>
   <id type="id2">8500124</id>
   <id type="id3">8500125</id>
   <link idType="someId">99369</link>
 </entity>

STAX Iterator API code below;
XMLEventReader xmlEventReader = xmlInputFactory.createXMLEventReader(new FileInputStream(fileName));
    while (xmlEventReader.hasNext()) {
        XMLEvent xmlEvent = xmlEventReader.nextEvent();
        if (xmlEvent.isStartElement()) {
            StartElement startElement = xmlEvent.asStartElement();
            if (startElement.getName().getLocalPart().equals("entity")) {
                XMLEvent xmlEvent2 = xmlEventReader.nextEvent();//has to forgo this bcoz it always return a new line.
                XMLEvent xmlEvent3 = xmlEventReader.nextEvent();
                if (xmlEvent3.isStartElement()) {
                    StartElement startElement2 = xmlEvent3.asStartElement();
                    if (startElement2.getName().getLocalPart().equals("id")) {
                        connector = new Connector();
                        Attribute idAttr = startElement2.getAttributeByName(new QName("type"));
                        if(idAttr.getName().equals("id1")){
                            connector.setId1(idAttr.getValue());
                        }
                    }
                }
            }
        }
    }

Comment: By "corresponding value" do you mean the text between the start and end tags of the element?
Comment: Yes, values 8500123, 8500124 etc
Comment: @teppic- Yes I would like to get the values / text between the start and end tag of the elements. Have you got suggestion on how to get ?
Answer: Since the question is old there is probably no longer an issue, but I was just trying to do the same thing. The sample code was almost there; the missing step was to check for an event type of XMLStreamConstants.CHARACTERS which corresponds to either:

The data between an opening and closing tag.
Whitespace between tags.

So in your case you want to extract the data only if all of these conditions are met:

The event type being processed is XMLStreamConstants.CHARACTERS (in which case EventType.isCharacters() returns true).
The immediately preceding event processed was of type XMLStreamConstants.START_ELEMENT.
The value of the type attribute of that preceding start element was "id2" or "id3".

It's possible to do that by tweaking your existing code, but a cleaner and more generic approach is to iteratively process the events returned by XMLEventReader using a case statement. To get the value of the data between a start tag and end tag:
Characters characters = xmlEvent.asCharacters();
String data = characters.getData();

Here's a working example, where the file sample.xml contains the data in the OP:
package pkg;

import java.io.FileReader;
import java.io.IOException;
import java.io.Reader;

import javax.xml.namespace.QName;
import javax.xml.stream.XMLEventReader;
import javax.xml.stream.XMLInputFactory;
import javax.xml.stream.XMLStreamConstants;
import javax.xml.stream.XMLStreamException;
import javax.xml.stream.events.Attribute;
import javax.xml.stream.events.Characters;
import javax.xml.stream.events.EndElement;
import javax.xml.stream.events.StartElement;
import javax.xml.stream.events.XMLEvent;

public class StaxDemo {

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

        try (Reader reader = new FileReader("sample.xml");) {
            XMLInputFactory xmlInputFactory = XMLInputFactory.newFactory();
            XMLEventReader xmlEventReader = xmlInputFactory.createXMLEventReader(reader);
            parseXml(xmlEventReader);
        }
    }

    static void parseXml(XMLEventReader xmlEventReader) throws XMLStreamException {

        String typeValue = null;

        while (xmlEventReader.hasNext()) {
            XMLEvent xmlEvent = xmlEventReader.nextEvent();
            switch (xmlEvent.getEventType()) {

            case XMLStreamConstants.START_DOCUMENT:
                System.out.println("XMLEvent.START_DOCUMENT");
                break;

            case XMLStreamConstants.START_ELEMENT:
                StartElement startElement = xmlEvent.asStartElement();
                Attribute typeAttribute = startElement.getAttributeByName(new QName("type"));
                if (typeAttribute != null) {
                    typeValue = typeAttribute.getValue();
                }
                System.out.println("XMLEvent.START_ELEMENT: <" + startElement.getName() + "> " + "type=" + typeValue);
                break;

            case XMLStreamConstants.CHARACTERS:
                Characters characters = xmlEvent.asCharacters();
                if ((typeValue != null)) { // Non-null if preceding event was for START_ELEMENT.
                    if ((typeValue.equals("id2")) || (typeValue.equals("id3"))) {
                        String data = characters.getData();
                        System.out.println("XMLEvent.CHARACTERS:    data=[" + data + "]");
                    }
                    typeValue = null;
                }
                break;

            case XMLStreamConstants.END_ELEMENT:
                EndElement endElement = xmlEvent.asEndElement();
                System.out.println("XMLEvent.END_ELEMENT:   </" + endElement.getName() + ">");
                break;

            case XMLStreamConstants.END_DOCUMENT:
                System.out.println("XMLEvent.END_DOCUMENT");
                break;

            default:
                System.out.println("case default: Event Type = " + xmlEvent.getEventType());
                break;
            }
        }
    }
}

I added a few println() calls just to clarify how the file is processed by XMLEventReader. Here's the output:
XMLEvent.START_DOCUMENT
XMLEvent.START_ELEMENT: <entity> type=null
XMLEvent.START_ELEMENT: <id> type=id1
XMLEvent.END_ELEMENT:   </id>
XMLEvent.START_ELEMENT: <id> type=id2
XMLEvent.CHARACTERS:    data=[z8500124]
XMLEvent.END_ELEMENT:   </id>
XMLEvent.START_ELEMENT: <id> type=id3
XMLEvent.CHARACTERS:    data=[z8500125]
XMLEvent.END_ELEMENT:   </id>
XMLEvent.START_ELEMENT: <link> type=null
XMLEvent.END_ELEMENT:   </link>
XMLEvent.END_ELEMENT:   </entity>
XMLEvent.END_DOCUMENT

Oracle provides a tutorial for StAX. While all the basic information is there, I found it a bit disorganized.


How do I calculate a mean from a subset?

Question: I am new to R so my title might not even make sense. Basically, I have this data set, which is the length of insects collected at 2 different sites. When I used the 'summary' function, I got values for both sites, and I'd like to do calculate the mean of each site:
> ls()
[1] "simulies"
> ls.str()
simulies : 'data.frame':        615 obs. of  2 variables:
 $ Site  : Factor w/ 2 levels "Lovering","Orford": 2 2 2 2 2 2 2 2 2 2 ...
$ Length: num  4.1 2.8 2.2 3.2 3.2 3.1 3.1 4.1 4.1 3.2 ...
> summary(simulies)
   Site         Length
Lovering:398   Min.   :0.600
Orford  :217   1st Qu.:1.300
               Median :1.600
               Mean   :2.034
               3rd Qu.:2.700
               Max.   :5.000

Comment: Using just base R one can use the tapply function: `tapply(simulies, simulies$Site, FUN=mean)`
Comment: Well, in base that would be `tapply(simulies$Length, simulies$Site, FUN = mean)`. Ben, I see you edited your question - are you having trouble applying the answers from the dupe to your own case? Or are you good?
Comment: Yes I was trying to refer to the duplicate and it didn't work either. However, I got some help in the comments below, I was missing the capital S in "Site".
Answer: There are many different options. Two of them:
To get the mean of one site:
mean(simulies$Length[simulies$Site=="Lovering"])

Or using ddply to get output for both sites:
library(plyr)
ddply(simulies, .(Site), summarize, Mean=mean(Length))

Comment: For the first option, I get [1] NaN
Comment: I updated my answer becuase I noticed that Site should have a capital letter. It should work now.
Comment: Now it works!Thank you.


Can I reuse a Spring MVC View instance?

Question: I created a custom view that uses Json.Simple to serialize the model and write the JSON to the response directly.
For some requests, I need to send back a static JSON message, so I am wondering can I reuse a View instance I created earlier (with the message already set)?
My View class is thread-safe.
Answer: Sure.  As long as you make sure it's thread-safe, as you say, there's no reason that your controller can't return the same View object multiple times. Unorthodox, but valid.
Answer: I do not see any problem in reusing an already created view since the render method gets current response object.

Can I reuse a Spring MVC View instance?


What other software is available to remove old files/kernels to increase space and cleanup drive?

Question: Like many others users, I need to remove files/kernels to increase space because I'm getting the error message that says I can't update because I have don't have enough space in /boot. I've searched for months, and I've found many answers that are similar to each other, but most are not applicable to Ubuntu 14.04 LTS, or the instructions are not beginner-friendly. Ubuntu-tweak is no longer supported by the dev, and I don't know if anyone else is picking that up. I found Synaptic Package Manager, so I'm studying that for now, but I'd like to know if there are any other programs that serve a similar purpose. Is there anything else out there? (I'd welcome updated info for command-line for 14.04 LTS as well.) Thanks for your input.
Comment: Installation worked, and now I'm trying to figure everything out. While researching here, I've found that a lot of people have lost configurations, desktops, menus, etc after using janitor in U-T. I'm not sure what they did, but I want to avoid that if possible, so I'm thoroughly reading those posts, and also trying to find out what some of my packages are before I mess with them. It may seem like a lot of unnecessary work to those who understand all of this, but I need to understand it and I'm really enjoying this process.
Comment: Why do you think Ubuntu tweak not supported ? It does the job.
Comment: Hi. I did find a link to download it, but the dev is no longer supporting it. (The site has to be translated. Previous ubuntu-tweak links now go there.) [Formally closed the Ubuntu Tweak Related Sites](http://imtx.me/archives/1947.html). I've never installed using the command line (a learning newbie), so once I figure that out, I will try it. I've read a lot of good things about it in forums.
Comment: Please check the details and release notes on this page. In the very last release the support for 14.04 was added. [Ubuntu Tweak Tool, launchpad-release notes](https://launchpad.net/ubuntu-tweak/0.8.x/0.8.7) I am using 0.8.7 version on 14.04
Comment: Thanks for that link @ankit7540. That is the version I downloaded the other day, so yay, and I'll give it a go after I figure out the install process.
Comment: this learning is addictive ;)
Comment: Yes, it surely is. :)
Comment: May I ask why you chose to have `/boot` on a separate partition and how much space it holds? That doesn't seem like a sensible choice for a Linux beginner.
Comment: I didn't make that choice. There wouldn't be any reason for me to even attempt something like that- especially as a beginner. This was a new install on a new 480 GB SSD. The boot partition is set to 255 MB. From what I remember, I was asked if I wanted to partition the drive, and I said NO. There was no need as I wasn't going to dual boot or anything like that.  I don't know why it happened, but I'm upset about it, and I'm trying to figure out how to change it.
Answer: I'd recommend letting apt handle this for you, using the command:
sudo apt-get autoremove

That should do everything you need. Once the process is complete, it's worthwhile checking the filesystem locations that Zanna has mentioned in her answer.
On a sidenote, I prefer to keep at least one old kernel version that I know works, just incase the current kernel suddenly stops working. I'm probably just being paranoid, but it's nice to have one to revert to.
Comment: Thanks for your input, Arronical! I'm nervous about removing anything, so having a "backup" kernel seems like a good idea to me.
Comment: I've found that `apt-get autoremove` leaves me with the current kernel and the most recent previous version. It lists what will be removed and asks you to confirm that you want to continue. For your usage it's probably best to see which version numbers are in `/boot` then check that the command won't remove any you want to keep. It does remove all of the files mentioned by Zanna, and update grub for you too. Good luck!
Comment: Yes, I'm checking to see what versions are in /boot now. Trying anyway. I'm pulling it all together in my head (a risky venture), and I'll update all of you when I've succeeded. Thanks so much!
Comment: I have used this 2 (possibly 3) times now, and it has worked very well each time. I used it when I couldn't update, and after using it, I could update. Yay, and thank you again!
Comment: Good stuff, glad it's working well for you. It's always nice to have a reliable way to do common tasks, especially when it doesn't involve installing another package!
Comment: Definitely! I actually refer back to this page every time I need to do this. :) I'm so grateful for your help, and everyone else's here, too. :)
Answer: I agree with @Arronical that autoremove does everything you want. In the interest of getting to know your system better, you could do all the work that autoremove does yourself. Start by opening a terminal and typing
uname -r

Write it down & for whatever you love most, do not hurt anything with that release number, or you will nuke yourself. And in general,  type carefully and check what you entered before sudo rming anything ;)
I recommend always keeping at least 1 'spare' kernel that I know works well installed, in case of bugs (or just wanting to fiddle around)
dpkg --list | grep linux-image

to identify kernels currently installed, then purge:
sudo apt-get purge linux-image-x.x.x-x-generic

replacing x with the correct numbers for the release you want to remove
sudo update-grub

which seems to happen automatically when purging anyway. But no problem to run it again just in case. Next
ls /boot

and if anything remains relating to the kernel version(s) you removed just remove it
sudo rm /boot/name-of-file-to-remove

(replace with the actual name obviously). Next
ls /lib/modules

and if the kernel(s) you removed still has a directory in there
sudo rm -r /lib/modules/name.of.directory.to-remove

next
ls /usr/src

and if the kernel(s) you removed still has headers in there
sudo rm -r /usr/src/linux-headers-name.of.version.to.remove

finally (usually gets updated but just in case)
ls /var/lib/initramfstools

and once again remove anything with the version(s) you're deleting.

Mostly from this answer but I have added all the places for completeness.
Comment: Thanks so much for your detailed response, Zanna. It's much appreciated. I'm going to try it this weekend. Thanks again!
Comment: You're more than welcome, enjoy tidying up!
Answer: I am still using ubuntu-tweak on 14.04.
It works nicely, and its janitor only requires a single click and two times typing the sudo password; and old modules and kernel stuff is gone for good. I find that far better than the other "manual procedures" listed so far.
Comment: Thank you for sharing that. I've heard a lot of good things about ubuntu-tweak, but I was sad to hear the dev decided to terminate the project, and I don't know whether or not anyone picked it up. Many of the previous links only point to this site now. [Formally closed the Ubuntu Tweak Related Sites](http://imtx.me/archives/1947.html)
Comment: But I have to add: you are fully correct: the PPA page for ubuntu-tweak explicitly says: no longer maintained. And on 16.04, the 0.87 deb won't install (cleanly) any more.
Comment: Thanks! I appreciate that. I wish I was wrong. Sadly, the links I posted to the devs info don't work anymore either. As I mentioned above, I've seen recent posts from people who say they've lost configurations, desktops, menus, etc after using janitor. They didn't mention what they did from A to Z, so I'm a little scared to try it now. I chickened out at the last second.  Since it won't install cleanly on 16.04, I guess no one has taken over the project.
Comment: Lets be precise: I used the janitor for packages/kernels ... and never had problems!
Comment: That's awesome, and I'm glad to hear it. I hope that will be my result as well.
Comment: @CodingMama Fyi: I am using the ucaresystem-core since lately on 16.04; and I am quite happy with it.
Comment: Great! Thanks for letting me know. It's definitely something else to consider.
Answer: https://utappia.org/2016/03/28/ucaresystem-core-v3-0-released-and-available-in-ppa/
this one works quite well and thorough and safely.
Comment: I hadn't heard of that one. Thanks so much for the information. I really appreciate it!


Gridview Freeze Pane header not freezing after page loads

Question: Browser - IE 9
Using the Latest Version of Microsoft's AdventureWorks2012 sandbox database (AdventureWorks2012_Data.zip) for SQL related Data.
I had to put this project on the backburner a few months ago due to various job interrupts and whatnot.  What I'm looking for is a GridView that when it loads has a frozen header while the enduser scrolls the large amounts of data.  Where I left off was a product that, upon first load would look good but when the data was scrolled the header I want frozen would scroll up along with the data.
Now the SQL Data is solid and performs as expected.  This is mainly a cosmetic challenge that I've been scratching my head over for a bit.  I've attempted to tweak every possible ASP/CSS/Javascript option that I know of with no success.
Here's what I've got so far code wise (no C# page behind leveraged at all):
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="sample.aspx.cs" Inherits="sample" %>

<!DOCTYPE html>

<title></title>

<form id="form1" runat="server">

<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:AdventureWorks2012ConnectionString %>" SelectCommand="SELECT [BusinessEntityID],[NationalIDNumber],[LoginID],[OrganizationNode],[OrganizationLevel],[JobTitle],[BirthDate],[MaritalStatus],[Gender],[HireDate],[SalariedFlag],[VacationHours],[SickLeaveHours],[CurrentFlag],[rowguid],[ModifiedDate] FROM [HumanResources].[Employee]" UpdateCommand="UPDATE [HumanResources].[Employee] SET SELECT [NationalIDNumber] = @NationalIDNumber,[LoginID] = @LoginID,[OrganizationNode] = @OrganizationNode,[OrganizationLevel] = @OrganizationLevel,[JobTitle] = @JobTitle,[BirthDate] = @BirthDate,[MaritalStatus] = @MaritalStatus,[Gender] = @Gender,[HireDate] = @HireDate,[SalariedFlag] = @SalariedFlag,[VacationHours] = @VacationHours,[SickLeaveHours] = @SickLeaveHours,[CurrentFlag] = @CurrentFlag,[rowguid] = @rowguid,[ModifiedDate] = @ModifiedDate WHERE [BusinessEntityID] = @BusinessEntityID">
<UpdateParameters>
        <asp:Parameter Name="NationalIDNumber" />
        <asp:Parameter Name="LoginID" />
        <asp:Parameter Name="OrganizationNode" />
        <asp:Parameter Name="OrganizationLevel" />
        <asp:Parameter Name="JobTitle" />
        <asp:Parameter Name="BirthDate" />
        <asp:Parameter Name="MaritalStatus" />
        <asp:Parameter Name="Gender" />
        <asp:Parameter Name="HireDate" />
        <asp:Parameter Name="SalariedFlag" />
        <asp:Parameter Name="VacationHours" />
        <asp:Parameter Name="SickLeaveHours" />
        <asp:Parameter Name="CurrentFlag" />
        <asp:Parameter Name="rowguid" />
        <asp:Parameter Name="ModifiedDate" />
        <asp:Parameter Name="BusinessEntityID" />
</UpdateParameters>

</asp:SqlDataSource>

        <%--Div contains the new header of the GridView--%>

              <%--Wrapper Div which will scroll the GridView--%>

<asp:GridView ID="GridView1"  runat="server" AllowSorting="True" HeaderStyle-CssClass="GridViewStyle"  AutoGenerateColumns="False"  DataKeyNames="BusinessEntityID" DataSourceID="SqlDataSource1"  ForeColor="#333333" GridLines="None">
    <HeaderStyle CssClass="GridViewHeaderStyle" />
    <AlternatingRowStyle BackColor="White" />
    <Columns>
        <asp:CommandField ShowEditButton="True" />
        <asp:BoundField HeaderStyle-CssClass="GridViewHeaderStyle"  HeaderStyle-BackColor="#507CD1" DataField="BusinessEntityID" HeaderText="Business Entity ID" ReadOnly="True" SortExpression="BusinessEntityID" InsertVisible="False" ShowHeader="False" >
<HeaderStyle BackColor="#507CD1" CssClass="GridViewHeaderStyle"></HeaderStyle>
        </asp:BoundField>
        <asp:BoundField DataField="NationalIDNumber" HeaderText="National ID #" SortExpression="NationalIDNumber" ShowHeader="False" />
        <asp:BoundField DataField="LoginID" HeaderText="Login ID" SortExpression="LoginID" ShowHeader="False" />
        <asp:BoundField DataField="OrganizationNode" HeaderText="Organization Node" SortExpression="OrganizationNode" ShowHeader="False" />
        <asp:BoundField DataField="OrganizationLevel" HeaderText="Organization Level" SortExpression="OrganizationLevel" ShowHeader="False" />
        <asp:BoundField DataField="JobTitle" HeaderText="Job Title" SortExpression="JobTitle" ShowHeader="False" />
        <asp:BoundField DataField="MaritalStatus" HeaderText="Marital Status" SortExpression="MaritalStatus" ShowHeader="False" />
        <asp:BoundField DataField="HireDate" HeaderText="Hire Date" SortExpression="HireDate" ShowHeader="False" />

        <asp:BoundField DataField="SalariedFlag" HeaderText="Salaried Flag" SortExpression="SalariedFlag" ShowHeader="False" />

        <asp:BoundField DataField="VacationHours" HeaderText="Vacation Hours" SortExpression="VacationHours" InsertVisible="False" ReadOnly="True" ShowHeader="False" />

        <asp:BoundField DataField="CurrentFlag" HeaderText="Current Flag" SortExpression="CurrentFlag" ShowHeader="False" />
        <asp:BoundField DataField="rowguid" HeaderText="Row Guid" SortExpression="rowguid" ShowHeader="False" />
        <asp:BoundField DataField="ModifiedDate" HeaderText="Modified Date" SortExpression="ModifiedDate" ShowHeader="False" />

        <asp:CommandField ShowEditButton="True" />
    </Columns>
    <EditRowStyle BackColor="#2461BF" />
    <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />

    <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
    <RowStyle BackColor="#EFF3FB" />
    <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />

    <SortedAscendingCellStyle BackColor="#F5F7FB" />
    <SortedAscendingHeaderStyle BackColor="#6D95E1" />
    <SortedDescendingCellStyle BackColor="#E9EBEF" />
    <SortedDescendingHeaderStyle BackColor="#4870BE" />
    </asp:GridView>

</form>

As much as I'd like a solution for this, I would like more to learn why this page isn't behaving as designed.  I know the solution may be something simple I overlooked but I'd like to learn the theory behind fixing it as well.
Here's the latest result with the suggestions from @afzalulh  The white space is a blank header without any sort of text at all.
Answer: I got frustruated with trying to find a javascript solution so I found one that is CSS based and works perfectly.  For anyone who needs it moving forward, here's the article I referenced.
Scrollable GridView With Fixed Headers Asp.Net
Answer: You are almost there. You should name the javascript function Onscrollfnction().
EDIT:

You replace the HeaderDiv content with tr html.
You have to apply style to HeaderDiv.

Here's the script:
</style>

Further improvements:

I would apply fixed width to GridView Columns and apply the widths
to headers in the HeaderDiv column headers.
I would hide the GridView's header and display the HeaderDiv
instead, to avoid the annoying transition in the beginning of
scrolling.
Comment: Thanks for the help but after trying this, it didn't fix anything.  Same result.
Comment: Probably you forgot to replace this`` with physical path of jquery. I have tested the code above before posting and I have used this path:``.
Comment: Ok I'll give it a try.
Comment: I tried this and the freeze pane works as I want BUT all the header information is missing.  Where the column titles should be is just white blank space.  There's no text, no links, nothing.
Comment: I uploaded an image with what I'm seeing to the first post in this thread.


angularjs what is the best way to rewrite span  as anchor

Question: I have a problem where I retrieve a string with  elements in them, I need to rewrite them a  elements.  The values I need are in attributes of the  element.
e.g.

The way to find your answer is to go to Stack Flows Home webpage.

I had done it in JQuery with a technique like:
jQuery.fn.makeA = function() {
    var attrs = {};
    $.each(this[0].attributes, function(idx, attr) {
         attrs[attr.nodeName] = attr.value;
    }
    this.replaceWith(function() {
          var jqThis = $(this);
          return $(document.createElement("a"))
                      .attr("href", encodeURI(jqThis.attr("resource")))
                      .attr(attrs)
                      .append(jqThis.contents());
    });
}

and then doing this to the string:
var element = $(spanText);
$("span[rel='webResource']",element).makeA();
return (element[0].outerHTML);

Since I have had to create a Custom Directive in AngularJS for this, is there a good way while in the directive code to implement the same technique without JQuery?
Well, some progress..
I created a customer directive for handling the insertion of the original string:
.directive('displayString'...)
and then after reading this: [http://blog.timsommer.be/using-compile-to-compile-html-strings-in-angular/], I recognize that doing an element.html(databaseString) will render correctly in the browser, but I needed to use $compile to get the string to be fully "jammed" into the DOM.  Once I added the $compile, like Tim Sommer suggested!, the .directive('rel'...) is now firing!  But, when the .directive gets the compiled  the element value is now "empty", e.g.:
Stack Flows Home is now
Interestingly, the $compile actually triggers the 'rel' directive immediately and it runs before the next statement in the 'displayString' executes.
Any idea why the value/text of the  has gone missing?
So, progress, but still stuck!
Comment: Would your directive be on the `span` or on the `div`?
Comment: `span`. Actually, I have a version that was `.directive('rel', [function(){...})`, hanging a custom directive on a standard attribute seemed like a bad idea.
Comment: Well, some progress... Reading this: [http://blog.timsommer.be/using-compile-to-compile-html-strings-in-angular/}, I recognize that doing an element.html(databaseString) will render correctly in the browser, I needed to use $compile to get the string to be fully "jammed" into the DOM.  Once I added the $compile, like Tim Sommer suggested!, the .directive('rel'...) is now firing!
Comment: [ng-transclude](http://stackoverflow.com/a/24725520/1795795) might be what you're looking for
Answer: It takes two directives.

$compile in the first directive to deal with the retrieve HTML from the database and also to trigger the pushing of the HTML elements in the answer text into the DOM…
transclude:yes AND the use of template with the ng-transclude directive and use of {&} in the scope variable, so Angular knows to hold onto the contents of the fact string's embedded s (and Angular does NOT like the ng-transclude directive in the strings passed to $compile!) and replace the value of the href from the specific context.

Putting a directive on @rel is very dangerous, because it's a standard RDFa property and is used with  and  HTML instructions.  However, with the guard conditionals it's ok.
app.$module.directive('displayFact', ['$compile', function($compile){
   return {
      restrict: 'E',
      scope: { fact : '@'},
      link: function (scope, element, attrs) {
            var templateInASense = $compile('' + scope.fact + '')(scope);  // this triggers the 'rel' directive below,  is required to allow $compile to deal with it..
            element.replaceWith(templateInASense);
          }
}}]);

and directive 2:
app.common.$module.directive('rel', [function(){
 return {
    restrict: 'A',
    scope : { reference : '&'},
    transclude: true,
    template: '',
    link: function (scope, element, attrs) {
            if (typeof attrs.resource !== "undefined") {
                   scope.reference= attrs.resource;
            }
          }
}}]);

The snippet of the Template HTML looks like this:
<display-fact fact={{fact.label}}></display-fact>

That seems to work pretty well.  It handles multiple s in a single string.  And it seems pretty quick.


How to get rid of  objects when Parsing JSON data

Question: For now, I have a working web service calls that returns the titles of the cheapest objects i searched for. For instance if i searched "book", it would return the cheapest books in my area. However, sometimes, I get  objects, like this:
2014-06-26 13:14:12.008 FindTheCheapestOne[2244:60b] The Little Book of Champagne
2014-06-26 13:14:12.009 FindTheCheapestOne[2244:60b] The Holy Bible
2014-06-26 13:14:12.010 FindTheCheapestOne[2244:60b] <null>
2014-06-26 13:14:12.010 FindTheCheapestOne[2244:60b] Books of the Hebrew Bible (Study      Guide): Book of Proverbs, Book of Job, Book of Esther, Book of Jeremiah, Book of Isaiah, Song of Songs
2014-06-26 13:14:12.010 FindTheCheapestOne[2244:60b] Book of Job : A Short Reading
2014-06-26 13:14:12.010 FindTheCheapestOne[2244:60b] Book of Jeremiah

When I get these objects, I store them into an array, and pass this array to my TableViewController. However, I can't pass these  objects, and therefore I get SIGABRT as a consequence.
Here is how i attempted to fix it:
 for (NSDictionary *theItem in itemCallArray)
    {
        NSString *titleString = theItem[@"title"];

        if (titleString !=NULL)
        {

        [titleArray addObject:titleString];

        NSLog(@"%@", titleString);

        }
    }

    ResultsTableViewController *tableVC = (ResultsTableViewController *)segue.destinationViewController;
    [tableVC setArray:titleArray];

}

I still get SIGABRT, and it doesn't fix the problem.
All help would be appreciated, and thanks in advance :)
Comment: What you're getting is not a `nil` but an NSNull object.
Answer: A good test for checking a NULL value can be:
if (title == (id)[NSNull null] || title.length == 0 )

Hope this will help. Happy Coding :)
Comment: Ah nevermind, I edited your answer to this: if (titleString != (id)[NSNull null] && titleString.length != 0 ) and now it's working. I'll accept your answer regardless for pointing me in the right direction :)
Comment: I'm not getting any null objects anymore, but now it's saying Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSNull length]:


Unable to access bitbucket repository on macos

Question: Suddenly SourceTree(on mac) started giving below error
fatal: unable to access : SSL peer handshake failed, the server most likely requires a client certificate to connect.
Have updated Current version of openssl to: OpenSSL 1.1.1g
But still facing the same issue.
Comment: You might want to re-generate that key.
Answer: Try and regenerate key, adding them to your BitBucket profile setting page
<code>ssh-keygen -t rsa -P ""
</code>
See if by using those new keys, the issue persists.


Ubuntu 14.04 second monitor's screen overflowing

Question: Im seeking help with this very weird issue. I have been using my ubuntu 14.04 with an extra monitor for quite q while now with no problem, although when I turned my laptop on today, the linked picture shows how my monitors looked. Somehow the second screen is overflowing on the right side and continues on the left side. The reason why I didn't post a print screen is that it displays correctly on the print. Although Im sure its not a monitor issue, because if I display the screen only on the monitor it looks fine.
Any idea?
Comment: Could you please provide a bit more information on your hardware?  What GPU are you using? What driver version?  If you don't know how to provide these, just leave a comment, otherwise you're going to attract low-quality answers...
Comment: Its a Samsung rf-511 laptop with NVIDIA GeForce GT540M (Optimus). Im not sure about the driver, but it should be the default. But I didn't mess around with it. it was working before.
Comment: `nvidia-settings --version` ?
Comment: nvidia-settings:  version 331.20  (buildd@roseapple)  Mon Feb  3 15:07:22 UTC 2014
Comment: How technical are you?
Comment: Web developer, basic ubuntu... I use it for LAMP
Comment: I'll be adding an answer in the next few minutes.  As you're a developer you should be acquainted with rolling back to a previous version...  ;-)
Comment: I would really appreciate that :) Thanks already!
Comment: Don't thank me!  If it works, please accept the answer by clicking the grey check-mark icon below 0 (turning it green)  ;-)
Answer: Check running the below command from your terminal window and see whether this helps,
Resetting an out-of-range resolution
<code>rm ~/.config/monitors.xml
</code>
You can direct xrandr to set a different resolution like this:
<code>$ xrandr --output LVDS --mode 1024x768
$ xrandr --output VGA1 --mode 1024x768
</code>
Hope this helps
Comment: Thanks for the tip, but it did not seem to help :S I even rebooted. I use LVDS1 and HDMI1... I set the proper resolutions too... nothing changed unfortunately. Although rm ~/.config/monitors.xml did delete the file, but it still didnt get recreated after reboot... Isnt this weird?
Answer: I have to same problem too.
It seems to happen after the latest Nvidia update.
Anyhow I tried the following and that worked for me:

Go to Nvidia control panel (e.g Nvidia X server setting)
Go to PRIME Profiles tab and select "Intel(Power saving mode)" instead of NVIDIA(Performance Mode).

I don't really understand what was happening, hope something ask give us a better answer.
Comment: This is not an answer to the problem, merely a work-around.  What you did was de-activate the NVidia card.
Comment: Yes definitely this is not a real solution. Do you have any idea on how to investigate the root of the problem?
Comment: Depends on how technical you are...  I have a solution, but it's cutting edge.  Please describe your technical expertise...  (definitely not for newbies)
Comment: Thanks Fabby, I see what you did there. User286678, I use ubuntu for LAMP stack, I know some stuff, not an expert, but please have a try.
Answer: The standard Ubuntu NVidia drivers generate some problems on slightly older and slightly newer NVidia hardware.
If you want more then the standard Ubuntu repository drivers, install the xorg.edgers PPA.  As the xorg.edgers group ask not to give installation instructions directly without linking to their page, this is the best I can do.
If you don't know what a PPA is or need some guidance after reading their page, leave a comment below.
Comment: Ill have a go with this asap. should i try installing version 331.113-0ubuntu1~xedgers15.04.1 u think?
Comment: That's the problem.  From now on, you're on your own.  I've been using them for 6 months now and am *currently* using version 346.22 and very happy with it!  Try to install the whole (as advertised) and not individual ones as then you can pick and choose (as some things will become better with newer versions, but other things might become worse and then you'll have to roll back!)


Slicer modifiying properties

Question: Trying to use VBA to generate a pivot table and associated slicers. I am able to generate the table and slicers just fine, but I am getting error 5 when I am trying to modify the Slicer Properties. The error is in the "With" line. What do I currently have wrong?
Attempted to change the name values to the actual Slicer_ShipQuantity. And have looked around online, but I do not see any solutions. The one that I did find was from this website, https://www.microsoft.com/en-us/microsoft-365/blog/2011/01/27/control-slicers-by-using-vba/ however, this does not seem to work when I use it/type-copy it.
'This works to create slicer
ActiveWorkbook.SlicerCaches.Add2(ActiveSheet.PivotTables("MasterPivot"), "ShipQuantity") _
        .Slicers.Add ActiveSheet, , "ShipQuantity", "ShipQuantity", _
        RowLocation, ColumnLocation, width, Height

'this does not work to modify slicer settings. And I have no idea why.
With ActiveWorkbook.SlicerCaches("ShipQuantity").Slicers("ShipQuantity")
        .NumberOfColumns = 3
        .RowHeight = 13
        .ColumnWidth = 70
End With

Expecting to get have the code modify the displayed slicer, without having any errors appear. Please and Thanks!
Answer: Slicers.Add returns a reference to the added slicer, so you could use that reference directly
https://learn.microsoft.com/en-us/office/vba/api/excel.slicers.add
Dim slcr

Set slcr = ActiveWorkbook.SlicerCaches.Add2(ActiveSheet.PivotTables("MasterPivot"), "ShipQuantity") _
        .Slicers.Add(ActiveSheet, , "ShipQuantity", "ShipQuantity", _
        RowLocation, ColumnLocation, width, Height)

With slcr
        .NumberOfColumns = 3
        .RowHeight = 13
        .ColumnWidth = 70
End With

Slicer modifiying properties


How can I avenge my friends' deaths?

Question: Today when I started up Shadow of Mordor, it told me that my death has been avenged by one of my friends. What does this mean? How can I return the favor and avenge my friends' deaths?
Comment: This generally means that someone has killed your killer, and you can do the same for them.
Comment: I figured as much, but how? Did the same named captain happen to also spawn in his instance of the game, and Steam knew to tell me that "it's cool, that guy's dead", or... what?
Answer: When you die, there is a chance a "bounty" will be placed on your killer:

This is available for anyone in the game. Even randoms. So by default, if you ever see any of these, you will be avenging the deaths of friends by killing the target.
Comment: Implausible. Chuck Norris can't die.
Answer: you are avenging the deaths of total players that are playing it i would say...non of my friends have shadow of mordor and the avenge trials pop up for me as well so i asume its world wide not just friends

How can I avenge my friends' deaths?


How to identify and kill hanging process, when system hangs and reacts slowly on user input?

Question: Recently when I tried to open a video with VLC, my system slowed down, the open applications webbrowser, VLC and filemanager and others didn't react any longer. The mouse just reacted still very slowly.
On a windows machine i would press a keycombi CTRL-ALT-DEL to open the taskmanager, search the process which caused the hang and kill it.
Since i'm fairly new with the use of linux i haven't figured out the best practice for solve such a situation in Ubuntu.
Which quick and effective way would you recommend to identify the hanging process and close it, when the system already reacts very slowly on user input?
Answer: There are two primary ways to identify hung processes. One is via the System Monitor GUI and the other is via top in command-line.
System Monitor
This can be found in System > Administration

You can also create a keyboard shortcut for this in this article.
Once the GUI launches you can select the Processes tab which will list all the running processes. Sort by the CPU column to find the most CPU intensive task

Lastly you can right click that task and choose to end it, stop it, or kill it. Killing it will immediately stop and remove that process from the system.

Command-Line
If you have a terminal open you can simply type top this will list all the running processes similar to that of the Processes tab in the GUI

Within top it is CPU sorted by default - so the top most CPU intensive tasks are at the top. At anytime you can press the letter k to kill a process

Simply type the PID of the process you wish to kill and press enter. It will ask for a Kill signal to send. To kill the process nicely use the default 15 - to kill it right away "Do not pass go, do not collect $200" use 9.

The process will then be terminated.
If you are experiencing sluggish interface you can try to SSH in remotely if that is enabled - or switch to a virtual console via Ctrl+Alt+F# Where F# is a Function Key (F3, F4, F5, etc). To return to the Desktop environment switch to either F7 or F8 depending on your version of Ubuntu.
Comment: Great answer. I usually assign the CTRL+ESC shortcut to the System Monitor. This gives me a quick access to kill process.
Comment: +1 for System Monitor. It could kill/stop a hanging VLC process, which htop could'nt do.
Comment: @malisokan Are you sure `htop` can't do it? You can send SIGKILL to kill any hanging process you have rights to.
Comment: Debian to turn back to desktop Ctrl+Alt+F7
Answer: Add the System Monitor applet to your panel (right click on the panel, select Add to Pannel and search for System Monitor) the  and right click on it to open the System Monitor application.
You can launch the System Monitor application by pressing Alt+F2 and start the program gnome-system-monitor.
Go to the "Processes" tab and right click the appliction you intent to kill.
Answer: Most already said (I like Marco Ceppi's answer) but there also is a "Force Quit" applet you can add to your GNOME Panel. Right click on the panel and choose "Add to panel...":

This lets you quit a hanging application by simply clicking on it's window. Very fast and efficient.

When running Unity in 11.04 of course this application will no longer be available. There is a replacement project Indicator-Forceclose but it is not included in the repositories.
Alternatively we could run xkill from a terminal.
Comment: Does it only destroy window or also kill the process?
Comment: @val it kills the process that created the window.
Comment: Just tested: it does not. I made a program that hangs inside GTK callback and killed it with xkill. Window disappeared, but program continued to run (or hang if you prefer). So answer is no, it may not kill the program if it is seriously stuck.
Comment: @val naturally after your  program had called another process for creating a window `xkill` will kill this additional process only. This is especially important to know for programs that run without an X-server but call X for windowing. Obviously, it would be impossible to kill any such program from the X server.
Comment: My program didn't called another process for it. I made a program which is same as any GTK application out there and made it hang. `xkill` doesn't affect such processes (GTK will cause exit if I'll later exit "hanging" and make it handle loss of window). GTK callbacks have nothing to do with multiprocessing.
Comment: It sure is a fun exercise to write programs that can't easily be killed, but seriously, yes, of course we need our graphical programs to also terminate after their last window got lost.
Comment: Important thing is that there are real world programs I met that were seriously stuck in their calculations and didn't reacted to the loss of window (like my example did). On other hand, those would be easily killed with `top`, `htop`, task manager, `kill`, `pkill`, `killall` and others, but not `xkill` which only destroy window. Also, force-closing not-responding window (at least in Cinnamon) actually send SIGKILL to target process and not simply destroy window.
Answer: $ ps -el|grep ProcessName

above command list out all processes named ProcessName. then kill process with its PID.
Example. To kill vlc mediaplayer.
step 1)
$ ps -el|grep vlc

above command output somthing like : 0 S  1000  5980  2324  1  80   0 - 256647 do_sig tty2    00:00:00 vlc. Here 5980 is process id. To kill vlc media player type following command.
step 2)
$ kill -9 5980

above command will kill vlc mediaplayer.
Answer: A decade later--programs still hang.  You would have thought they would have done something about it by now.  This advice is fine for when a program is stuck, but not sucking up all of your available CPU resources--in which case you may not be able to do anything with a GUI client.
To see who is hogging your processor:
ps fu -e --sort -%cpu | head -n5
Often you don't know who is hanging up your system (e.g. with the dreaded kworker ACPI storms). You can change the -n to be however many lines, usually 5 is enough to include the init process and the top few CPU hogs.
It is best to try and kill with SIGTERM 15.  Well written code will catch this, and free up memory and close files as part of destructor code.  If that doesn't work, then SIGKILL 9, which cannot be caught, is fair game.
Sometimes kill likes a little more, either
kill -n 15  or kill -s SIGKILL as it seems that some versions don't like just the -SIGNUM.  You can get a list of all the signals with kill -l.
If you just type kill  PID then my distro's version defaults to SIGTERM.
If your whole UI is wedged, then you probably want to CTL-ALT-F3.
It might take a while, so go pour yourself a cup of coffee or let the dog out before trying something more drastic.
If that doesn't work, you might need to try and kill your XWindows server (e.g. CTL-ATL-BACKSPACE) but don't get your hopes up too high.  Go make some tacos, or take the dog for a walk this time, and hopefully you will return to a log-in.
If not, then hopefully you have the Magic SysRq key set up.  You probably want to take a few minutes and RTFM before you need to use this so you have an idea of what is going on.
On my computer, which uses a wireless ThinkPad keyboard (but is not a ThinkPad which may use Alt+Fn+S+), it's Alt+PrtSc+.  In some cases it may depend on which Alt key you use (not on my machine, but I have read thhis has been an issue if you have R-alt and L-alt send different decodes).
First:
Alt+PrtSc (or whatever your key combo is) + r all at the same time.

This Returns keyboard control to you.

Most guides will then have you send a series of commands, but there may be some other options worth trying.

I will try Ctrl+Alt+F1 first.

The "usual and customary" sequence is REIUSB

You have to type each with whatever your Magic SysRq key combo is

One of the problems that will wedge you is the bad habit of opening too many tabs in your browser and sucking up all of your memory, including swap space.  Rather than change your behavior, you can just call the out of F'ing memory killer (OOM) and it will snuff Firefox (or chrome or...) e.g.  ALt+PrtSc+f.

I have rarely had cases where the file system was frozen (and, presumably, there was a good reason for this in the first place, which is why getting up off your butt and doing something between steps is a good idea--if there was something getting fixed and needed to freeze the file system I probably want to give it a chance to flush and close things before I yank the plug) using Alt+PrtSc+j which is supposed to Just unthaw the file system and I will use this as my first step before calling the OOM, unless I have 85 open tabs in Firefox (yeah, I know, why???).

I have not had great results with E and I working when running XWindows. You might need to check and see if the bitmask it set to allow them.

You can tell Everything (except init) to quit using Alt+PrtSc+e (using SIGTERM)

Since you probably finished your coffee, maybe time for a bathroom break.  Give it a few minutes to work.  If your processor is stuck it might take a while for this command to make it through the various buffers and acted on.

If that does not do the trick, then you can repeat it with SIGKILL with Alt+PrtSc+i

When that has not worked for me in the past, I have found that Killing everything with Alt+PrtSc+k has worked, and ended me up with a log-in prompt. If you end up at a log-in prompt, you can continue to restart your system by Unmounting (and give it some time) and Synching your drives before your Boot up again.
NOTE: the sync hasn't taken place until you see
the "OK" and "Done" appear on the screen.

What also has worked is then Ctl+Alt+Backspace which restarted XWindows and gave me the graphic login.

I have not had good luck with the options to Get my framebuffer console back or to Very nicely ask to get my framebuffer back.

Other useful guides:

https://www.maketecheasier.com/the-usage-of-sysrq-key-in-linux/
https://www.howtogeek.com/119127/use-the-magic-sysrq-key-on-linux-to-fix- -  - frozen-x-servers-cleanly-reboot-and-run-other-low-level-commands/
https://linuxconfig.org/how-to-enable-all-sysrq-functions-on-linux
https://superuser.com/questions/106006/linux-how-do-i-diagnose-isolate-whats-causing-random-hangs-and-spontaneous
https://unix.stackexchange.com/questions/31818/what-to-do-when-a-linux-desktop-freezes


Form.Show() is "Not Responding..."

Question: I have a little trivial problem in my application. I have a dialog (d1) that inherits from Form. And in Main, if I call
d1.ShowDialog

,it works fine. But calling
d1.Show()

opens a bad form with pale labels and textboxes, and when I try to drag that window form it says "Not Responding."
What's going on? I think I need "Show" and not "ShowDialog," because the user should be dealing with several simultaneous forms.
Answer: It sounds like the problem is that the message loop is not being properly hooked up to the form.  Not my area of expertise but my first thought would be to make sure the parent form was properly set.

Form.Show() is "Not Responding..."


How to add some variables to Django Admin index.html

Question: I Want to show objects from a model in a custom list in the Django Admin index.html.
I have the custom templates/admin/index.html, but i can't find a way to override the variables that go to index.html.
Thanks in advance.
Comment: too broad question: about what variables are you talking about? there are so many variables in index.html to override..
Comment: I have a model Messages that have a field destinator as User Foreign Key, and I want to show a messages list for the user in the index.
Comment: I know how to override the add_view, change_list view, etc for the apps in the admin, but not how to override the index view to send the queryset to the template  `templates/admin/index.html`
Answer: You could override/subclass the appropriate functions or classes from the admin package. Or, depending on what variables you need to pass, you could drop them in as extra option kwargs in the url pattern where you include the admin urls.


Android: CountDownTimer equivalent in Flutter SDK

Question: I have a custom View in Android Studio that updates every x milliseconds using a custom animation. I'm now trying to implement this behaviour in Dart. This is how the animation is implemented in Android Java. (It represents only the animation logic and does nothing else)
public class ItemAnim extends CountDownTimer {

    public ItemAnim(long millisInFuture, long countdownInterval){
       super(millisInFuture, countdownInterval);
    }

    @Override
    public void onTick(long millisUntilFinished) {
        // do anim stuff like setting a rotation angle variable etc...
        // listener.animate(...) code
    }
}

I'm now looking for a very similar class in Dart/Flutter SDK.
i.e. a class that calls onTick(millisUntilFinished) every countdownInterval milliseconds
Answer: You can use the

Timer.periodic(duration, callback)

It will repeat the task until cancelled
Example
var timer = Timer.periodic(Duration(seconds: 1), (Timer t){
      //your code here
    });

To cancel use

timer.cancel();


How do I tell whether Ubuntu phone is using 2G or 3G?

Question: I have a bq Aquaris E4.5 Ubuntu Edition. There's a signal indicator in the top bar, but I can't see any indication whether it's got a GSM/EDGE/3G signal. How do I find this out?
Answer: As you can see, in the status bar, you must see 3G
(Note that your wifi must be disconnect)
Please, check if the tick 2G/3G (see red dot) is marked at System Settings > Mobile:
Comment: Would it be too much trouble to add in an image in english? :)
Comment: Yep... Of course :)
Comment: I only see the "2G only (saves battery)" option on my phone, there's no "2G/3G (faster)" option to select.
Comment: Oops! Maybe your simcard doesn't support this feature. Do you check it in another phone (i.e. with android...)?


JQuery: Dynamically-created html not responding to JQuery functions

Question: I'm using this code to generate a div dynamically:
// my html string :)
var myString = '<id="newDiv"div> hello </div>';

// html decode the string
myString = $("
").html(myString).text();

// appending the string
$("#parentDiv").append(myString);

It appends just fine (it shows up on the screen). And also doing $('#newDiv').length correctly shows a value of 1. But then when I try to call remove() on it (or any function) like
$('#newDiv').remove()

nothing happens. What is going on?
Answer: there is a bit of extra work there.  and the <id="newDiv"div> hello </div> is actually <id="newDiv"div> hello
  which is not normal html to my understanding.
//here is what I think you wanted:
    $('
hello
').appendTo("#parentDiv");
    alert($("#newDiv").length);
    $("#newDiv").remove();

edit - decode the html text, then attach it:
var emptyDivNeverAppendedToDom = $('
');
//per the other so.com question
    var html = emptyDivNeverAppendedToDom.html('<div id="newDiv"> world </div>').text();
//just being verbose.
    var elem = $(html);
    //the actual work
    elem.appendTo("#parentDiv");
    //elem.remove();

a js fiddle uncomment the elem.remove()  lin to watch it work.
Comment: I'm following the green-checked answer here http://stackoverflow.com/questions/8437352/jquery-append-html-string-as-html/8437392#8437392 because the HTML is encoded. It seems to be perfectly valid once its decoded (it appends just fine).    Is that not correct?
Comment: You put your id in the wrong place. should be ` hello `
Comment: edited with the html decode option you wanted.  tested `' world !'` too.
Answer: Works great as soon as you put the id at the right place :
var myString = '<div id="newDiv"> hello </div>';

http://jsfiddle.net/NN9v2/1/


Preg_match, if  formatted correctly

Question: if(preg_match("/(.*(<code>).*(<\/code>).*)*/", $string))

I was trying many hours already, but I can't make it work. I want that if user formatted text correctly like:
(any_string*any_string*any_string*)*

Only then I would format text with * meaning empty string or many times. What's wrong with my expression?
edit: I want to match lalala text dlalala lala code lalalal. If it's lala  lalala or lalal   lalala alala then we don't want to match it.
Comment: Your regex isn't incorrect at all. However, are you trying to match multiple-line content between the tags? Then remember the dot matches anything BUT newlines.
Comment: Can you post some examples of the string that you want to match?
Comment: It is not correct, it makes it always true.
Comment: Does any_string* has to be the same in front, middle and after the code tags?
Comment: I think the reason it is always true is that the entire thing is contained within a subpattern with an asterisk after it, which means the entire pattern can match zero times and still be considered a match.
Answer: This works with the 2 given test cases:
$arr = array('lalala text dlalala lala code lalalal.',
             'lala  lalala or lalal   lalala alala');
foreach ($arr as $str) {
    echo "$str\n";
    if (preg_match('#^(?<!).*.*?(?!.*)#', $str)) {
        echo "===> Match\n";
    } else {
        echo "===> Not match\n";
    }
}

output:
lalala text dlalala lala code lalalal.
===> Match
lala  lalala or lalal   lalala alala
===> Not match

Some explanation about the regex:
#           : regex delimiter
^           : begining of string
  (?<!      : start negative lookbehind
      : literally
  )         : end of lookbehind
  .*        : any char any number of time
      : literally
  .*?       : any char any number of time not greedy
     : literally
  (?!       : start negative lookahead
    .*      : any char any number of time
      : literally
  )         : end of lookahead
#           : regex delimiter

You can find some usefull informations about lookaround here
Comment: It seems to work. Can you describe how it works just a little bit?
Answer: You probably could use greed killer ? in your code expression (more info here: Matching text between delimiters: greedy or lazy regular expression? ), so if you have a code like this:
foo another bar

It will match just foo and bar not foo another bar, also you should use preg_match_all() (with flag PREG_OFFSET_CAPTURE) and write your own parser. Or rather use preg_replace_callback() like this:
// Just strtolower example (this would do formatting)
function myCallback( $matches){
    return strlower( $matches[2]);
}

$string = preg_replace_callback("/(<code>).*?(<\/code>)/si", 'myCallback', $string)

Note the question-mark in .*?. You also should use s and i modifiers so your code would work on codes like this:
lorem ipsum
foo
 bar

If you need validation you can use this:
$string = preg_replace("/(<code>).*?(<\/code>)/si", '', $string);
if( (strpos( $string, '<code') !== false) || (strpos( $string, '</code') !== false){
    echo 'Invalid code';
}

Answer: <?php
$string = "aaaasdaaaasd";
if (preg_match("#[a-zA-Z ]+[a-zA-Z ]+<\/code>[a-zA-Z ]+#", $string))
{
echo "It's a match!\n";
} else {
echo "No match, sorry.\n";
}

Answer:     $string = "aaadlalala lala codeaaa";
    if (preg_match("#.*.*<\/code>.*#", $string)) {
            echo "OK\n";
    } else {
            echo "NOK\n";
    }

Answer: try these
$string = "lalala text dlalala lala code lalalal";

if(strlen($string)>0){
    preg_match("/\(.*)\<\/code\>/",$string, $code);
    echo $code[1];
}else{
    echo "no code found";
}

output will be:

dlalala lala code

Good luck :)
Answer: <?php
$sample_text = <<<EOF
blah blah
one
footwothree
fourbar
fivefoobar
six
blah blah blah
EOF;

preg_match_all('/(?\'code\'((?!<\/?code>).)*)<\/code>/', $sample_text, $codes);

print_r($codes);
?>

i believe is what you're looking for.  i referred to here and tested the regex here.
Answer: You'd be better off using strpos for simple string comparisons like this, which means you don't have to worry about escaping special characters, and it's faster.
This will work
EDITED TO GET POSTION OF TAGS.
$string = "This string has 'Anything  anything  anything' in it in the right order.";
$start = strpos($string, '');
$end = strpos($string, '');
if ($start !== FALSE && $end !== FALSE && $end > $start){
     echo $string;
}else{
    echo 'incorrectly formatted';
}

IF YOU WANT TO USE PREG_MATCH
if(preg_match("/.*().*(<\/code>).*/", $string)){
       echo $string
  }

Note - you don't want to use HTML entities unless you are sure the string is formatted using HTML entities. You don't need the outer set of parentheses.
Comment: If this answer does not do what you want, can you tell me why and in what way?
Comment: You may have reasons for preferring preg_match, but your comment takes me back to strpos. Strpos makes sure that there isn't a  in front of a  because it stops checking after the first match. Otherwise I'd refer you to the first answer at http://stackoverflow.com/questions/1732348/regex-match-open-tags-except-xhtml-self-contained-tags and suggest an xml parser. In other words - regex sucks at validating HTML and is best avoided.
Comment: Final answer - try http://querypath.org/ I've never used it, but it looks a much better way to handle HTML input and get rid of the garbage.

Preg_match, if  formatted correctly


How to sync 2 folders every day?

Question: I am moving a Firefox profile folder on my SSD disk to fully utilize SSD's speed. However to prevent accidental formatting of this folder, I also want to have a daily sync with another folder on internal hard disk which I never format.
How can I do this? Am I forced to use rsync with cron or there is a tool which can do all this automatically? I have never used rsync or cron before.
Comment: Rsync and cron are the right tools. I am sorry you feel that way about them, 'forced' sounds a bit negative to me. You can also try backup software like deja-dup.
Answer: I use rsync over ssh with chron to keep an up-to-date copy of my entire /home over the internet every couple of hours. It takes seconds and works flawlessly. If you take an hour to figure it out, you'll never have to think about it again.
To make it a little easier to manage, you can create a fill called firefox-settings-backup.sh somewhere with the rsync command line, and use Scheduled tasks from the repos as a simple cron management tool to run firefox-settings-backup.sh
Answer: For all those who have writing cron and rsync command, I recommend this app: http://gnome-schedule.sourceforge.net/
It has a GUI and creating a repetitive cron job is a piece of cake.

How to sync 2 folders every day?


How many players are required to play the Jackbox party games?

Question: I'm looking at purchasing the Jackbox party games (a bundle containing the first three party packs) and am wondering, how many players are required to play? Is it possible for just two people to play, or is a larger group needed?
Answer: The minimum varies from game-to-game. Generally each game is more fun with larger groups, but none of them require more than 3 players. (With the exception of Push The Button)
Aside from the original Fibbage and games from Jackbox Party Pack 1, each game allows extra players to join as audience members who can influence the game. (Usually up to 10,000)

Fibbage

Fibbage (2-8 players)

The Jackbox Party Pack

You Don't Know Jack 2015 (1-4 players)
Fibbage XL (2-8 players)
Drawful (3-8 players)
Word Spud (2-8 players)
Lie Swatter (1-100 players)

Quiplash

Quiplash (3-8 players)

The Jackbox Party Pack 2

Fibbage 2 (2-8 players)
Earwax (3-8 players)
Bidiots (3-6 players)
Quiplash XL (3-8 players)
Bomb Corp. (1-4 players)

Drawful 2

Drawful 2 (3-8 players)

The Jackbox Party Pack 3

Quiplash 2 (3-8 players)
Trivia Murder Party (1-8 players)
Guesspionage (2-8 players)
Tee K.O. (3-8 players)
Fakin' It (3-6 players)

The Jackbox Party Pack 4

Fibbage 3 & Fibbage: Enough About You (2-8 players)
Survive the Internet (3-8 players)
Monster Seeking Monster (3-7 players)
Bracketeering (3-16 players)
Civic Doodle (3-8 players)

The Jackbox Party Pack 5

You Don't Know Jack: Full Stream (1-8 players)
Split the Room (3-8 players)
Mad Verse City (3-8 players)
Patently Stupid (3-8 players)
Zeeple Dome (1-6 players)

The Jackbox Party Pack 6

Trivia Murder Party 2 (1-8 players)
Dictionarium (3-8 players)
Push The Button (4-10 players)
Joke Boat (3-8 players)
Role Models (3-6 players)

The Jackbox Party Pack 7

Quiplash 3 (3-8 players)
The Devils and the Details (3-8 players)
Champ'd Up (3-8 players)
Talking Points (3-8 players)
Blather 'Round (2-6 players)

The Jackbox Party Pack 8

Drawful Animate (3-10 players)
The Wheel of Enormous Proportions (2-8 players)
Job Job (3-10 players)
The Poll Mine (2-10 players)
Weapons Drawn (4-8 players)

The Jackbox Party Pack 9

Fibbage 4 (2-8 players)
Junktopia (3-8 players)
Nonsensory (3-8 players)
Roomerang (4-9 players)
Quixort (2-10 players)

The Jackbox Party Pack 10

Fixy Text (3-8 players)
Tee K.O. 2 (3-8 players)
DodoReMi (1-9 players)
Time Jinx (1-8 players)
Hypnotorious (4-8 players)
Answer: It depends on the game. For example, Jackbox Party Pack 1 contains 5 games.

You Don't Know Jack 2015 (1-4 players)
Fibbage XL (2-8 players)
Drawful (3-8 players)
Word Spud (2-8 players)
Lie Swatter (1-100 players)

More details can be found on the jackbox website.


How do I move my spawn point?

Question: I am spawning too far from my home. How do I move my spawn point?
Comment: In Survival MP, use /sethome
Comment: In Notch's March 28 blog [post](http://notch.tumblr.com/post/4159257708/full-steam-ahead-captain) he says next update will include spawn change.
Answer: In Minecraft Beta 1.4 and later, sleeping in a bed will set your spawn point.
On older SMP servers running Minecraft Beta 1.3, spawn points can be changed using the /setspawn command, provided the server is running any of the common mods to provide this functionality. Sometimes this command is called /sethome, and sometimes the /sethome command has a different purpose.
There is no way to set the spawn point ingame on Single Player Minecraft Alpha/Beta < 1.4. Some third party tools will change it for you however.
For Minecraft Classic, pressing Enter sets the spawn point.
Comment: Good find, that twitter post.
Comment: As 1.4 is now out, the changelog confirms this: " Sleeping in a bed now resets your spawn position" (also added to my answer, below)
Answer: Simply make a bed and lay into it. If you're in multiplayer mode, you don't need to wait for all others to also get in a bed in order to sleep - laying down is enough to change your spawn point so long as your bed doesn't get destroyed.
Comment: Also, Nether Portals!
Comment: I have a network of tunnels and houses, but no mine tracks as yet, though I think I've got enough iron now.
Comment: a video to nether portals http://www.youtube.com/watch?v=A7pySDFxCCc
Answer: You can't do this without cheating.
If you're okay with cheating, you can use NBTEdit using this guide.
Comment: MC Edit also has this functionality, I believe.
Comment: As of the time of this comment, the functionality appears to not work in MCEdit.
Answer:
The location of the spawn point can be changed if the player digs 3 spaces downwards from it. This will however only move the spawn point a few blocks away from the original location; it is not possible, using this method, to dramatically or controllably alter the location of the spawn point but there is tools that allows you to change the spawn point.

From https://minecraft.wiki/w/Spawn
Comment: @Tobias: Also: the answer -> *your own answer*
Comment: @Tobias, maybe, if you dig the *whole chunk* around your spawnpoint, down to **bedrock** - you can *slowly* push your spawnpoint to your house... :)
Comment: Ah, cool - I'd remove my downvote, but it gets locked in after an hour, or until the post is edited again (so if you modify the post I can un-downvote).
Answer: An idea similar to the badp answer:
Build a river from somewhere near your spawn point to your house. This way, the water flow will help you move fast toward your house. It's also very cheap to build.
Answer: In the next minecraft update, players will be able to move their spawn point.
Source: http://notch.tumblr.com/

I've been able to focus on development
  a lot the last couple of weeks, and
  we're hoping to get the new update out
  soon. It will include the wolves, the
  ability to change your spawn point,
  and a rather ambitious statistics
  tracking and achievement system.

And, officially, from the changelog:

Sleeping in a bed now resets your
  spawn position
Answer: If you don't wanna spawn too far away from your house
make a bed:
(wool wool wool)
(wood wood wood)

or put up a signal thats above the clouds, it will be like a pin on a treasure map.
Answer: In the newer versions of Minecraft (tested on 1.8.9) you can use
/setworldspawn X Y Z

where X, Y and Z are coordinates, where you want to set the spawn point. You can easily check your current coordinates e.g. with debugging screen (press F3).
You can learn more about the command with
/help setworldspawn

Answer: /setworldspawn
(works if you have commands on)
Comment: Do you think you could explain why `/setworldspawn` works? Clue: Added feature in 1.7
Answer: Create a bed in a well lit, well protected area.
Beware: a natural occurrence called "nightmares" might occur.Nightmares are random spawning of spiders, skeletons, or zombies near your bed. Sometimes sleeping underground solves the problem of too many nightmare occurrences. Make sure the area is well lit!
Comment: Nightmares actually only happen if you sleep in an unsafe bed. See: [How can I avoid mobs spawning in my house while I sleep?](http://gaming.stackexchange.com/questions/17377/how-can-i-avoid-mobs-spawning-inside-my-house-while-i-sleep)
Comment: This answer is obsolete -- Now you cannot sleep if monsters are near

How do I move my spawn point?


Alternating factorial terms using Java

Question: I'm trying to write a loop in Java that can output the sum of a series which has this form... 1! -3! + 5! – 7! + ... up to n (user gives n as a positive odd number). For example, if the user inputs 5 for n, then the series should calculate the sum of 1! -3! + 5! (hard part) & display it to the user with a basic print statement (easy part). If the user gives 9, then the sum calculated would come from 1! -3! + 5! - 7! + 9!.
For ease, just assume the user always puts in a positive odd number at any time. I'm just concerned about trying to make a sum using a loop for now.
The closest code I've come up with to do this...
int counter = 1;
int prod = 1;
n = console.nextInt();
while (counter <= n)
{
    prod = prod * counter;
    counter++;
}
System.out.println(prod);

This does n!, but I'm finding it hard to get it do as specified. Any pointers would be great.
Comment: Consider creating a function that computes the factorial and use the function?
Comment: @devnull From programming style point of view this would be the correct thing to do. However, this would increase the runtime significantly.
Answer: As you calculate the factorials, keep a running total of the series so far.  Whenever counter % 4 == 1, add the factorial to the running total.  Whenever counter % 4 == 3, subtract the factorial from the running total.
You said "any pointers" - I assume that means you don't want me to write the code for you.
Update
This is closely based on your original code, so that it would be as easy as possible for you to understand.  I have changed the bare minimum that I needed to change, to get this working.
int counter = 1;
long prod = 1;
long total = 0;

n = console.nextInt();

while (counter <= n)
{
    prod = prod * counter;
    if( counter % 4 == 1 ) {
        total += prod;
    } else if (counter % 4 == 3) {
        total -= prod;
    }

    counter++;
}

System.out.println(total);

First up, notice that I have changed prod to a long.  That's because factorials get very big very fast.  It would be even better to use a BigInteger, but I'm guessing you haven't learnt about these yet.
Now, there are those two conditions in there, for when to add prod to the total, and when to subtract prod from the total.  These both work by checking the remainder when counter is divided by 4 - in other words, checking which factorial we're up to, and doing the right operation accordingly.
Comment: Turns out pointers aren't enough. I started loops yesterday & trying to create sums from loops is still very hard for me.
Comment: OK, give me a few minutes, I'll turn this into code.  Or would you prefer for me to spend some time trying to talk you through this?
Answer: First of all, you need to introduce a variable int sum = 0; to  store the value of the alternate series.
To only sum every second value, you should skip every second value. You can check that using the modulo operation, e.g. if( counter % 2 == 1 ).
If that is true, you can add/subtract the current value of prod to the sum.
To get the alternating part, you can use a boolean positive = true; like this:
if( positive ) {
    sum += prod;
} else {
    sum -= prod;
}
positive = !positive;

Based on the boolean, the prod is either added or subtracted. The value is altered afterwards.
Because factorials become very large very fast, it would be better to use variables of type long.

Alternating factorial terms using Java


How to send Message only Two user in SignalR

Question: I want when I send message to one another two will got that message like signalR groups but I doesn't use group I do this thing without group
Please Anyone can tell  how to do that
Answer: You could try
public async Task SendMessage(string user, string message)
{
    await Clients.Others.SendAsync("ReceiveMessage", user, message);
}

I tried with the codes in this document,just modified the codes in hub
And the result:

Send message to specific user you could check this document.
Update
I add the codes in chat.js:
document.getElementById("sendButton1").addEventListener("click", function (event) {
    var user = document.getElementById("userInput").value;
    var message = document.getElementById("messageInput").value;
    connection.invoke("SendMessage1", user, message).catch(function (err) {
        return console.error(err.toString());
    });
    event.preventDefault();
});

Add another button in page:

    <input type="button" id="sendButton1" value="Send Message" />

Add this code in Hub:
public async Task SendMessage1(string user, string message)
{
    var a = Context.UserIdentifier;
    await Clients.All.SendAsync("ReceiveMessage", user, message);
}

Result:
Comment: I have one question can you tell me the Answer
Comment: what's your question?
Comment: how do i define all the client belong to a different method
Comment: I check when all the client of different method i send mesage from server the same message got all the client like if any client use http put they got same msg
Comment: hey can you please tell?
Comment: it use websocket by default ,you could check https://learn.microsoft.com/en-us/aspnet/core/signalr/introduction?view=aspnetcore-6.0#transports
Comment: You could write another method in chat,js,and write another method in hub
Comment: Can you explain with some example
Comment: I've updated my answer ,please check it
Comment: And How we know client are using which one method
Comment: codes in chat.js like  connection.invoke("SendMessage1"...) invokes the  method with the same name "SendMessage1" in hub, so as your clinet receive the message,And i'm going to have  a rest,if you have other questions,i would answer you tomorrow