"Play All" option in Ubuntu that's similar to Windows 7?

Question: Is there any GUI(gnome3,kde,xfce etc.) or PPA with an addition to Unity or other GUI userland to have the same functionality as Windows 7? For example- in Windows 7 you can go to a folder with movie files or mp3 files and simply click "play all" and it will automatically open the default media player with all the files added to the playlist based on the naming convention and play them.
Answer: rhythmbox-folderview Will help you to play all the music that are in a particular folder.
But the problem is it only applicable to the files that can be played on rhythmbox player.
To install this plugin:(Ubuntu 9.10, 10.04 and 10.10)
<code>sudo add-apt-repository ppa:zedtux/rhythmbox-folderview
sudo apt-get update
sudo apt-get install rhythmbox-plugin-folderview
</code>
To install this the for latest version of Ubuntu you can download the source and install
More info about this plugin can be found here


How do you properly sticky jump?

Question: I've taken a sticky jumper for a test run from the store as I have to admit I'm not really good at sticky jumping. (It also makes a great combo with the pain train for back capping purposes.)
What I try to do is place a sticky on the ground, walk over, jump and ignite when I'm at the peak of my jump. Most of the times, that only gives me a lot of self damage and barely any propulsion. Other times, I can cover great distances.
I've tried using two stickies instead of one, but that ends either with a suicide through self damage or a suicide through that and fall damage.
What's the idea behind a textbook perfect sticky jump?
Comment: As an add on to the two answers below, once you are in the air, do not touch your forward/backward buttons, they will slow you down.  Use the right and left buttons to steer while looking forward.  Use surf maps to get used to high speed flying.
Comment: @tugs This is a crucial part of the technique, and I cannot believe it wasn't mentioned in either answer.
Answer: Sticky jumping requires practice.  I'd suggest practicing on a map like ctf_convoy, where falling means you die and you can respawn and try again quickly.  If you're good at sticky jumping, you should be able to cross between the two convoy trains from a variety of positions.  2fort is another good 'live' training map.  From the front entrance, you should be able to sticky jump to the battlements with a single sticky.  2 stickies should take you across from one battlements to the other.
In addition to these maps, there are jump challenge maps (usually that start with jump_ so you can find them on the server browser more easily) where you'll be presented with a set of difficult jumps to attempt.  It can be good practice, although it is sometimes frustrating.
What you want to do is, put one sticky down in front of you, and then run at it full speed, and jump + crouch, then detonate it.  Depending on your timing, you'll either go up at a high rate of speed, or forward for a good distance.  You'll have to practice so that you understand the correct timing for doing either move.
In general though, the later you detonate, the more forward momentum you'll get, and detonating sooner will result in more upward momentum.  Using more stickes will take you further, but at a cost of more of your health.  You'll have to balance the advantage of getting somewhere tactically useful with the disadvantage of having less ability to fight when you arrive.
This article on the TF2 Wiki is also a good source of information.
Comment: On a good sticky jump, using crouching and timing it right, you should be able to shoot clear across from one battlement to the other on 2Fort with just one sticky.  Another good testing ground is Badlands second point.  If you can sticky jump from the set of stairs leading up to the house all the way to the spire with just one sticky, you're doing it right.  More impressive, though less useful, is with two stickies strafing AROUND the spire and onto the enemy battlements.
Comment: @agent86 Sorry to bump up an old question, but I'm just getting the hang of sticky jumping. You have effectively said that the correct way to sticky jump is to run, jump, crouch and detonate a sticky (i.e. the exact same mechanic as rocket jumping, but with a stick bomb). DrFish has contrarily said that you should jump first, and then detonate the sticky bomb in mid-air (as oppose to simultaneously jumping and detonating). Which is the correct method? Which will result in me travelling further/faster?
Answer:
Crouching while in the air lets you travel higher and further than normal.
Let yourself be overhealed by a medic before you sticky-jump to minimize the risk of not landing alive.
And lastly, as you also mentioned, the more stickies, the higher and further the jump. You will need to overheal to perform sticky jumps of three.

The technique is simple:
Walk to your sticky, jump over it, and when you are just about to reach peak height, detonate. You should be in front of the sticky to boost yourself forward when you detonate, so jump accordingly.
There is a training weapon called The Sticky Jumper with which you can train jumps, or even just use them in the game to fast travel.It can either be crafted, traded or bought in the store.
Comment: Sticky Jumper CAN be crafted. Look at the wiki page. That's the only way to get a trade-able one. If you check trade servers/sites, you can get one for around 1 refined (maybe less), so it can be bought with metal if you'd rather not spend the cash.
Comment: Thx. Corrected my answer.
Answer: Jump, Crouch and detonate. This should get you much farther. Be in front of the stickies to get the most.
Comment: While correct, this adds nothing to the existing answers.

How do you properly sticky jump?


Setting ability points in one tree?

Question: The fun thing about The Secret World is that you can use any weapon you want. As my beginning weapon I have chosen the pistols.
Now I've been placing all my ability points in pistols. Just focussing on that afterwards I'm going to place my points in blood magic (the assassin deck for Dragons).
The question is, is placing the points in one tree good? You need more ability points to go futher, and that means waiting a few (quest/levels) to get the ability, or alternatively you can also go directly for some first blood abilities.
Answer: No it's not. You should also put points into the secondary skill tree at least to the point you get a good consumer ability.
The reason this is better is because most builder abilities are building up point for both weapons you wield. This way you will be able to double the output of consumer abilities and this will increase your damage (or heal) output at least by 15%.

builder ability: Abilities that build up points for your weapon (up to a maximum of 5).
consumer ability: Abilities that spend these points and usual do more damage/heal than builder abilities.

Other source:

Why do I need two weapons? What's wrong with just one?
The game is balanced around the type of damage output you can do with one builder ability to create 5 resources for two different weapons, followed by using consumer abilities from each weapon back-to-back, and then repeating this general process. If you have only one weapon, then you have only one build cycle followed by one consumer, and you are essentially putting out only 60-70% of the total DPS that you could do if you were using two weapons.
So don't try to skill up only one weapon to "max" Skill 10 ASAP, because you're seriously gimping yourself by doing so. Right from the start, as soon as you roll into the Sheriff's office in Kingsmouth for the first time, you will receive your choice of a second weapon, and you should always roll with two weapons at all times. Three of your active abilities in any 7/7 build should always be: A) some type of builder that will build for both weapons with each hit, B) A hard-hitting consumer for Weapon 1, and C) a hard-hitting consumer for Weapon 2.

Source: http://yokaiblog.wikidot.com/guides:tswfaq
Comment: Yokai's page has tons of excellent info.
Comment: Yep, thanks for the page, it has indeed loads of information.

Setting ability points in one tree?


Folder created, owned by root (android create project)

Question: I'm running a script provided in the Android SDK, to create a project folder. But the folder is created with root ownership, and I need to work within it.
I had the audacity not to install the SDK under my home folder, but rather under usr/local/lib... and I am wondering, since this is a priveleged location which I usually have to use sudo su to access, could this be the reason the project folder is owned by root? Or do the permissions assigned on folder creation fall entirely to the script that creates the project folder?
Any other tips would be appreciated since I don't want to spend my days having to sudo incessantly... I need to set up some complex build scripts and would prefer it if that can be achieved by the user i.e. me, not root. P.S. I'm not sure if it's appropriate to go fiddle with these permissions if this is what has been set by whatever application / script, or I'd just do so.
Answer: Generally anything in /usr/local is either owned by root or by the group "staff" in Debian distros. You can create a group that can write to that directory and add yourself to it if you want.
sudo groupadd usrlocal
sudo usermod -a -G usrlocal $user
sudo chown -R /usr/local/* root:usrlocal
sudo chmod 750 /usr/local

Also you can use the setuid bit to ensure that the SDK is always launched by root.
sudo chmod +t /usr/local/sdk/script

I think that may be what's causing your problem, if I understand correctly. If you need write access use '770' instead.
Edit: (For the sake of completeness) Unless configured otherwise, any files a program it creates will be owned by the user that's running the program. If the script/program does not need root privileges, change the ownership to yourself:
sudo chown /path/to/exec $user:$user

Comment: That is likely because it is running as root, so the files that it saves are also owned by root. I'd suggest maybe changing the permisions to 755 or perhaps saving them in a different directory, like /root/development or something. Does it need to be ran as root? It's better if it does not have to be...
Comment: If it doesn't need to run as root, than just do:

`chown $user:$user /path/to/executable`

And than it will run as you.
Comment: Thanks Chev, this looks helpful. However, can you answer the part about whether or not the script _in_ usr/local is likely to be the culprit for causing the project folder (which is created under home) to be owned by root? Or is creating folders with root ownership a kind of system default in Debian? This is something I'd like to know for future reference.
Comment: In that case, I could probably extract the SDK and NDK folders into home and keep ownership for myself, preventing any of this tomfoolery. If not, I have your fallback method with user groups. Thank you, this should give me everything I need. :)


Nested routes in Ember

Question: I want my settings area to look like this:
..
/settings/:accountId/users
/settings/:accountId/users/:userId

I have my router defined as follows:
Router.map(function() {
    this.route('login');
    this.resource('settings', { path: 'settings/:settings_id' }, function() {
        this.route('overview');
        this.route('users');
    });
});

This works for displaying the users listing page. I'm not sure how to take it to the next step though and have both a route and a resource for /users and /users/1.
Thanks.
Answer: In the latest versions of Ember, route's can have sub routes (for namespace sake).
Router.map(function() {
    this.route('login');
    this.resource('settings', { path: 'settings/:settings_id' }, function() {
        this.route('overview');
        this.route('users', function(){
          this.route('user', {path:':user_id'});
        });
    });
});

http://emberjs.jsbin.com/cutayuniga/1/edit?html,js,output
If you're in an older version, you will have to make users a resource.
Router.map(function() {
    this.route('login');
    this.resource('settings', { path: 'settings/:settings_id' }, function() {
        this.route('overview');
        this.resource('users', function(){
          this.route('user', {path:':user_id'});
        });
    });
});

Comment: Will accept in 4 minutes. Thanks a lot for your help with my questions.

Nested routes in Ember


Zend framework URLs not working in local environment

Question: I finally got a basic framework set up and working, however now when I wish to add an action in the 'IndexController.php', it doesn't seem to be working.
I used the following terminal command to add an "about" action:
zf create action about index

It appears that worked, as I opened 'IndexController.php' back up and the new action function is there. And a corresponding 'about.phtml' file was created in 'views/scripts/index', alongside 'index.phtml' that was already there.
When I access the index at
http://localhost3:8888/

the page opens properly.
However if I now try to access the about page at
http://localhost3:8888/index/about

I get a "404 not found" error.
Any ideas?
Comment: Do you have a view script corresponding to the about Action?
Comment: Do you have mod_rewrite turned on? Check that `AllowOverride` is set to `All` in your httpd.conf
Answer: Looks like a mod_rewrite problem.
Try http://localhost3:8888/index.php/index/about. If it works, then it definitely means that mod_rewrite wasn't correctly set up.


Why does removing `END{print ""}` not print the last line?

Question: I am reading an example from https://stackoverflow.com/a/34685332/156458
$ seq 5 | awk '{printf "%s%s",sep,$0; sep=",\n"} END{print ""}'
1,
2,
3,
4,
5

I thought END{print ""} is superfluous, so
$ seq 5 | awk '{printf "%s%s",sep,$0; sep=",\n"} '
1,
2,
3,
4,

Why does removing END{print ""} not print the last line?
Answer: Because you're removing {print ""} which effectively prints a new line.
the 5 should appear just before your prompt, but your shell may not allow that and just drops it all together.
$ seq 5 | awk '{printf "%s%s",sep,$0; sep=",\n"} END{print ""}' prints:
1,
2,
3,
4,
5
$>

and $ seq 5 | awk '{printf "%s%s",sep,$0; sep=",\n"} prints:
1,
2,
3,
4,
5$>

Comment: Why doesn't `{printf "%s%s",sep,$0; sep=",\n"}` print the last line?
Answer: how about making it simpler:
seq 5 | awk -v RS="\0" -v OFS=",\n" '{$1=$1}7'

Comment: This is actually a great answer for the referenced question http://stackoverflow.com/questions/34684958/make-the-record-seperator-in-awk-not-apply-after-the-last-record/34685332#34685332


Benchmarking the UX on five different airlines

Question: This might be a bit academic, which actually true. But, the question is how to benchmark and compare five different airlines websites? which criteria should I use?
Right now, am counting how many clicks would it take to complete purchasing a ticket, I'm also looking for number of languages and currencies they offer. Am I on the right track? whether yes or no, how should I continue?
Best
Comment: What is the goal of the comparison?
Comment: to evaluate and rank (usability benchmark) thier consumer interfaces.
Comment: If you're trying to evaluate usability, then you need to focus on the overall experience...not specific (and somewhat arbitrary) criteria like click-count.
Answer: Usability is not the same as UX. From your comment, you need to conduct usability benchmark. To make benchmark, you need to:

Define some metrics
Get the metrics
Compare the metrics

Sounds simply, right?
.
1. Usability Testing
According to ISO standard, usability has three metrics:

Effectiveness -- the number of errors
Efficiency -- time for the task completion
Satisfaction -- users' comfort and acceptance (use SUS to measure it).

The best way to benchmark is to conduct usability testing with 3-5 participants and to measure and compare these metrics. You need to develop several typical scenarios and test these with users.
The results should be presented in a comparison table.
Reference:

Procedure: the description and results are in the Usability Metrics by J. Nielsen
Documentation: all documents/templates you need for usability testing are on the Usability.gov
.

2. Heuristic evaluation
Another way to benchmark usability are Heuristic evaluation, or Cognitive Walkthrough. The metric is the number of issues you'll find and their severity ratings.
Reference:

How to Conduct a Heuristic Evaluation
How to Conduct a Cognitive Walkthrough
.
Comment: What you are saying makes alot of sense, our supervisor talked about metrics but didnt difine them!
Comment: @MajaHansson yes, the metrics translate an abstract task to the very simple task of comparing numbers )
Answer: Benchmarking of the websites are totally connected to the service of these five companies. For instance x company can handle cancelation in a different way than y company. Additionally, finding a ticket(with exact date) at z company may be totally different than k company. Lost luggage application can be another differentiation point.
For a good comparison, you have to benchmark first their services. After understanding the main differences as service, you can also compare the same common tasks and how they are designed.
X company's purchasing flow can be best. Company Z is very successful how to handle complaints. According to who? Users...
So what can you do?
1- Draw service map of these five companies and features at their website.Create hypothesis and test your hypothesis.
2- Compare them with users.
Try to make hypothesis about your decision. Why do you think that language number is important for usability? For example, an airline that has lines to 150 countries can have 150 language while an airline to 40 countries can have 34 languages? Number of languages may be not that important...
Answer: If you're testing for usability, you're on the wrong track altogether.  Counting clicks is a terrible measure of ease-of-use; "number of languages and currencies" is a feature comparison, not a usability comparison.
Usability benchmarking is a big subject, but in general you want to identify one or more core tasks that can be performed on all the sites you're comparing, and for each, measure things like the average amount of time it takes a new user to complete the task (including what percentage of them fail to complete it at all), or the number of errors or wrong turns that are encountered in the process (though this last can be somewhat subjective, as it's not always clear what constitutes an error).
A single tester going through all five sites in sequence will not give meaningful results, as knowledge gained while working with the first site will affect the results on later ones; you really need a large enough set of testers for each site to account for variations in individual users' skill and knowledge, with each tester assigned to a random one of the sites you're comparing.


Is it a bad idea to move the content on the right of the page?

Question: I recently discovered a blog which has an original layout:

The left half of the page contains by the name, two menus, the social buttons and the copyright. Most of the space is not used, and is filled with a useless background image.
The right half of the page is an actual blog article, i.e. the content which actually matters.

download bmml source – Wireframes created with Balsamiq Mockups
At first, I found it a very bad idea because half of the page is wasted. But after imagining how would I format the content differently, I ended up with virtually no space gain:

download bmml source
The copyright and social buttons move to the bottom of the article (since the reader is expected to first read the article, and only then think about sharing it or care about copyright).
I still find there is something inherently wrong with the original layout. My new reasons would be:

The fact that it's different from other websites where the primary content is either on the middle or practically middle of the page (like StackExchange sites), or on the left.
The dark background of the left pane attracts even more unnecessary attention and distracts from the actual content.

However, it doesn't seem like a strong argument against such layout. So:
Are two layouts I illustrated below (i.e. the original one and my modification) equally valid? Why?
Comment: I'm assuming this site is also responsive with mobile first...? If it is, then your first design might not be a good responsive design.
Comment: @Majo0od: The site is responsive and displays quite well on small screens: the left pane just moves to the top, letting the article fill the whole width of the page.
Comment: How big is the author/blog information? Does it take all of the screen?
Comment: @Majo0od: you mean on mobile? It's OK: too much height for the title and the menu in my humble opinion, but not even one third of the screen. Social buttons and copyright are not shown (at least not in the header).
Answer: Most of us are conditioned to start reading on the left. That's why I would put the main content (here, blog text) on the left (assuming one of the "western" LTR languages).
The page split needs not be at 50%, so there's no reason to waste space as you show in your second example.
Another consideration is line length: If lines get too long (i.e., paragraphs get too wide), it gets difficult for readers to follow the line and return to the beginning of the next line. So you should limit line length, which might result in paragraphs much smaller than the screen width. Due to variable width and height of the screen and the way scrolling works, it's difficult to arrange text in smaller columns (as newspapers do).
As an example, see http://practicaltypography.com/line-length.html for width recommendations - there are certainly more discussions of this.
Answer: Whilst this layout might be less common on websites, it's rapidly becoming more common in high volume usage apps. And for good reason, it's great at providing navigation and content, and matches how we conceive (mentally) of addressing evolvement, from left to right:

On Mac and iPad: Mail & Notes are probably two of the most used apps, both of which put the content to the right and controls to the left.
Historically, navigation was often on the left of websites, and content to the right. Mac's Finder and Windows Explorer also offer ways to operate in this manner, and are probably the most used apps on their respective systems.
So this might be the webification of UI/UX ideas from desktop apps ;)
In direct answer to your question, is this a good idea? I think so. I think it's very good, instinctually comprehensible and intuitive. So long as the responsiveness can adjust to the focus on content when the screen is rotated or resized, I don't see a problem.


Master bedroom is unbearably hot and stuffy - what do I do?

Question: My master bedroom leaves me SO STUFFY every morning. I wake up feeling like I have a cold.
The room sits at the top of the stairs on the second floor, directly across from the foyer. There is a large window that streams hot sunlight into the room if I leave the French doors open, so I keep them closed. Even so, it is by far the hottest room in the house. It's a west-facing room, so I keep the blinds drawn and have temperature control curtains on the windows. My two dogs sleep in there with me, but they live in my lap and their dander/fur doesn't bother me anywhere else. I've tried deep cleaning the whole room - washing the walls, the carpets, and the linens, and making sure the cieling fan doesn't collect dust. I've had my HVAC serviced to make sure the vents are clean. I have an air purifier running at all times.
I'm wondering if the master bedroom is simply an air trap and all the dust, pet dander, and humidity is sticking and settling there. What can I do to breathe better?
Comment: It might be worth adding a bit of detail about day and night outside temperatures and humidity, and ideally the inside temperature in the evening and morning. Also you hint at air conditioning - when does it run?
Answer: Have you checked all your supply and return registers to make sure they are open? Are all your dampers open? What about adjusting registers in the cool rooms to allow more cool air upstairs?
There are duct fans available that can be installed in your existing duct work that will force more air through them, just a thought.
We had a similar problem with a hot upstairs and finally added a whole house to vent from the upstairs into the attic. It drew cool air from the downstairs to the upstairs. Checking the insulation levels in the attic might help too.
Last but not least, You might decide to add a second AC unit, mini split, to take care of the upstairs.
Answer: First, have the HVAC system checked out make sure ducts are not blocked, clogged with dust, and the like.  But most likely this is not the core problem.
Let me ask you a few questions about weather.  Suppose you like your house thermostat set to 70 degrees F or 20°C.  If the weather report says 70F (20C) outside, and your thermometer outside your north-facing window says 70F (20C),  does your heater need to run? Nope.  Of course. Now here's a trick question: Does your air conditioner need to run?  It's 70F outside and 70F inside, remember.
Answer: Yes, very much.  WHY? Because the need for cooling isn't about the outside air temperature.  It's about the sun.
Sunlight is heat. How much heat? 1000 watts per square meter or 300 BTU per square foot.   It's a lot of heat.  A LOT.  and it only bears on the sunward facing sides of the house. Yes, this makes it difficult to "balance" ducting systems so that heating is balanced but cooling is balanced too.
Now, to make matters worse, there's insulation. That should help, but on most houses, most of the structure of the building is outside the insulation layer.  That structure has physical mass - and because it has mass, it stores heat.  So it soaks up the sunlight all day, and after the sun goes down it is still hot.  So it continues to radiate heat for hours, both out to the night sky and also inside through the insulation to your room.
And that's why people run their air conditioners long after the sun sets.  This is also why I got into the habit of going to bed very late - because it takes that long for the room to cool off at night, for the building to shed all its stored heat.
Closing the French doors, closing blinds, using "temperature control curtains" - they still catch almost all the solar heat. You hope a little reflects or radiates back outdoors, but mostly they release the heat into the room actually. That can be proven by looking at the reflectivity aka albedo of the materials. 100% is total reflection; the brightest white paint I have is 83% albedo.  Typical pastel house colors are in the 50s of albedo (not great) and anything in a middle or darker color has an albedo near zero. Aesthetically preferred roofs are the worst offenders. So yeah, those indoor treatments are doing next to nothing, other than making you feel like you're trying.
Comment: I would hope that if temperatures are close to your example, it could be solved by less power-hungry means. Like ventilation. Convection (not helped by the extractor in the en suite) and evening sun make my bedroom hot; the solution is just opening front and back windows in the late evening. Early morning fresh air helps too, lowering the temperature of the whole house
Comment: @ChrisH the problem there is humidity.  Everyone thinks of A/C as a temperature thing - actually temp and humidity go hand in hand because human skin is sensitive to evaporative cooling. That's what "wind chill" is.  So humidity has a huge part in *perceived* temperature, so it's part of air conditioning.  Reducing 1 pound of air 1 degree F only costs you 0.24 BTU, but removing 1 pound of water from air costs you 1000 BTU.  Talk about "power-hungry means!"
Comment: That's why I asked the OP to clarify the humidity under the question.  Your example temperatures are typical for summers here, where we're currently at around 60%, and home air conditioning is rare.  When it gets hotter it's not generally too humid.
Comment: @ChrisH yeah, I've lived in that climate... however America is mostly either a) muggy when it's hot (Great Lakes, Northeast corridor, plantation states) or b) dry but lethally hot (Arizona, California more than 20 miles from the coast). As such, mechanical air is viewed as pretty important. Hardly needs to be energy guzzling, 36 SEER A/Cs exist (of course we don't make em lol).  With a tiny bit of brains, we could run the A/C when the solar is producing, and we have incentive to do so since the power company pays very little for solar power anymore.
Comment: That does cover most of the American population (though the limited areas I've visited in hot weather weren't all like that), and probably extends to Canada too. But though we can guess that the OP is your side of the Atlantic, we still don't know their climate. Certainly using the internal thermal mass of a building as an energy store is a great idea. It's the only way I'd go for home air conditioning, but here a heatwave is merely uncomfortable with insulation, careful use of shade and night ventilation. Rooftop solar of course also reduces solar thermal gain
Answer: If you've got a lot of solar gain from glass, shading it from outside will be very effective.
This could mean installing an awning, but even a large parasol can do a good job, or tall potted plants.
You might find that even while they're catching the sun, opening the French doors while leaving the curtains shut makes a useful difference. Opening something on the other side of the home will get airflow. Not if you've got air conditioning running of course.
For the stuffiness specifically, assuming opening the bedroom windows overnight isn't an option (too much intermittent noise here) opening internal doors help, possibly into better-ventilated parts of the house. Just opening the door into my en suite, and opening the window in there just a little, makes a huge difference.


How to patch long strip on drywall?

Question: My room had a chair rail which I stripped out.
It was glued and left a long strip on the drywall.
The strip is just paper and I am not sure how to patch them ...
Also, there are some glue left on the wall and not sure how to remove them.
Can someone give me advises?
Comment: If it wasn't over a seam in the drywall it doesn't need tape. Scrape the glue (go ahead and damage the wall a little), apply spackle, sand it, (repeat?), paint.
Comment: @Mazura That's an answer. Why not add it.
Answer: Sounds like you tore off some of the paper on the face of the drywall. This is cosmetic damage and if it wasn't over a seam it doesn't need tape. Scrape the glue (go ahead and damage the wall a little), apply spackle, sand it, (repeat?), paint.
Anywhere with crumpled up paper sticking-out (will not sand flat) needs to be bashed in (using the corner on the butt of a small trowel) and filled; circles with a wet sponge never worked for me. Which is the trick for dealing with the fuzzies where the paper has delaminated and you're looking at a brown spot. Attempt to sponge these types of areas and then apply a skim coat of plaster or it will show in the finish paint. Use a damp sponge, DO NOT saturate the wall, or the entire section may bubble.
An 8-12" trowel makes doing large patches much easier, try not to leave too much at the edges where it meets the old work (this is the most important area to bevel sand). While sanding it, you should begin to feel a nice feather once the old paint starts showing through in spots.

This is kind you want, not a flat trowel with an in-line handle. Those require a bit more experience to use and you still need one of these. If you do buy both, a good tip is to bend the flat trowel a tiny bit, making it ever so slightly concave. This facilitates a nice build-up along the center and gives you an already good taper at the edges.
Comment: Thanks I will try that. For those papers, guess I will have to apply multiple layers of compounds.
Comment: I did this exact sort of reno recently and @KoziroKun outlined exactly what I did to get the wall finished up. The biggest help was the 12" trowel that I bought specifically for this task.
Comment: Professionals I've dealt with will have two of both trowel types; one of each, bent.
Comment: I've done multiple layers. Thanks. The only issue I'm having now is those areas with papers are bubbling up. Should I cut them out and do another run of layers?
Comment: Bubbles in paper need to be cut out, bash-in anywhere a *tag* sticks out (even a tiny one). If you haven't discovered sanding sponges yet, do so. @KoziroKun
Comment: It's been a while since I've used that trick. Don't saturate the wall, or it bubbles, sorry about that. @KoziroKun

How to patch long strip on drywall?


How do I stub the HttpSessionState in MVC RC1 with rhino mocks?

Question: I'm trying to take advantage of the recent ControllerContext refactoring in asp.net mvc rc1. I should be able to stub the session rather simply but I keep getting a System.NullReferenceException on line 2 when running the following code:
var mockContext = MockRepository.GenerateStub<ControllerContext>();
mockContext.Stub(x => x.HttpContext.Session["MyKey"]).Return("MyValue");

What am I doing wrong?
Edit: I just verified I have the latest version of rhino as of this post.
Answer: You need to mock HttpContext too to make this working.
I'm using a mock of HttpContext for this:
public class HttpContextMock
{
    private readonly HttpContextBase _contextBase;
    private readonly HttpRequestBase _requestBase;
    private readonly HttpResponseBase _responseBase;
    private readonly HttpSessionStateBase _sessionStateBase;
    private readonly HttpServerUtilityBase _serverUtilityBase;

    public HttpContextBase Context { get { return _contextBase; } }
    public HttpRequestBase Request { get { return _requestBase; } }
    public HttpResponseBase Response { get { return _responseBase; } }
    public HttpSessionStateBase Session { get { return _sessionStateBase; } }
    public HttpServerUtilityBase Server { get { return _serverUtilityBase; } }

    public HttpContextMock()
    {
        _contextBase = MockRepository.GenerateStub<HttpContextBase>();
        _requestBase = MockRepository.GenerateStub<HttpRequestBase>();
        _responseBase = MockRepository.GenerateStub<HttpResponseBase>();
        _sessionStateBase = MockRepository.GenerateStub<HttpSessionStateBase>();
        _serverUtilityBase = MockRepository.GenerateStub<HttpServerUtilityBase>();

        _contextBase.Stub(x => x.Request).Return(_requestBase);
        _contextBase.Stub(x => x.Response).Return(_responseBase);
        _contextBase.Stub(x => x.Session).Return(_sessionStateBase);
        _contextBase.Stub(x => x.Server).Return(_serverUtilityBase);

        _requestBase.Stub(x => x.IsAuthenticated).Return(true);

        _contextBase.User = new GenericPrincipal(new GenericIdentity("firstname.lastname@example.com"),
                                                 new string[] {"Admin"});

    }
}

And in SetUp of test I create an instance of a controller:
    [SetUp]
    public override void TestSetUp()
    {
        base.TestSetUp();

        repository = MockRepository.GenerateMock<IFooRepository>();
        controller = new FooController()
                         {
                             FooRepository = repository,
                             UserRepository = userMockRepository
                         };

        controller.ControllerContext = new ControllerContext(context.Context, new RouteData(), controller);
    }

And all is working fine, I can add parameters to session and many other things.
Hope this helps.


How to play android sounds NOT in activity class

Question: How can I play sound from a class that DOES NOT extend activity? I've been searching for a while and in every tutorial or answers from stackoverflow I've seen that sounds are always implemented in an activity class.
But in this case I have a class thas has the logic of my game, in which I have a gameUpdate() function; and in that function I want to make a specific sound play if something happens (for example a collision).  How can I possibly access the activity that is currently running, from this class?  Is there any way to do that?
Thanks.
Comment: Take a look at SoundPool from this thread: http://stackoverflow.com/questions/9656853/the-correct-way-to-play-short-sounds-android
Comment: How can you comment with 1 reputation? :p Anyway, that does not answer my question. in that example sound is played in the activity class, which I don't want
Answer: So you actually just need a Context, not specifically an Activity (which is a Context). I would recommend that the class that should play sounds has a constructor which requires a Context. Keep a reference, not directly to the Context that you receive, but to the Application context using getApplicationContext() to get a Context that is safe to retain without the risk of memory leaks.
public class MySoundPlayingClass {
    private final Context mContext;

    public MySoundPlayingClass(Context ctx) {
        // Since ctx could be an Activity, and this class
        // could exist outside of the lifecycle of the Activity,
        // grab the Application context to get a safe reference.
        mContext = ctx.getApplicationContext();
    }
}

Answer: Have a Util class and do something similar to below one. You can pass the context (it can be Activity instance) and the resource id to play it
Usage:
Util.play(context, R.raw.soundFile);

Sample Util class:
public class Util {
   public static void play(final Context context, int resource) {
    MediaPlayer mp = MediaPlayer.create(context, resource);
    if (null != mp) {
        mp.setOnCompletionListener(new OnCompletionListener() {
            @Override
            public void onCompletion(MediaPlayer mp) {
                mp.release();
            }
        });
        mp.start();
    }
  }
}

Answer: getActivity() or if is inside a fragment getFragment().getActivity()
Or alternativelly you can make add a Context to your class and get the activity reference from the constructor of the class.
Ex:
public class MyClass {
    Context mContext();
    public MyClass(Context context){
        this.context = context;
    }

}
and in your Activity class when you call MyClass:
MyClass myClass = new MyClass(this);

Inside your custom lass you can reference activity methods using its context.
Comment: none of these functions getActivity() or getFragment().getActivity() were recognised in my class, nor in the view class

the error is "function is undefined for the type *Classname* "
Comment: If you are not inside a fragment or an activity you need a Context. Add a Context to your constructor and pass it from the activity or fragment. You can also pass it through a button as explained in the answer from @Abdul Fair
Answer: If you need to get the current Activity instance or context you need to pass it to your other classes so that you can use it. For example:
class ABC extends Activity
{
    public void onCreate(Bundle b)
    {
        XYZ xyz=new XYZ(this); // Sending the current Activity instance
    }
}

class XYZ
{
    ABC activity;
    public XYZ(ABC activity)
    {
        this.activity = activity; //Now you can use it in this class
    }
}

Comment: thanks, i thought about that approach thing is, I have some classes chained (the activity creates a view, the view creates this class i was talking about), so I wanted to avoid "ping-ponging" my activity in all constructors. Thanks anyway :)


WPF Scrollviewer not adjusting to content

Question: I need to show an image in my WPF application, overlay it with transparent canvas and allow user to draw on it. User must be able to zoom image (in and out) and "navigate" in image while zoomed in using some kind of scrollbars docked to bottom and right of the window. To enable image zoom, I used ZoomBorder control, described in second answer. So this is my XAML code:
<ScrollViewer x:Name="imageScroll" HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto"  >
  <local:ZoomBorder x:Name="backgroundZoomBorder" ClipToBounds="True" HorizontalAlignment="Center" VerticalAlignment="Center"  Width="{Binding CurrentImageWidth}" Height="{Binding CurrentImageHeight}"  >
     <Grid x:Name="gridDrawing" MouseLeftButtonDown="background_MouseLeftButtonDown" MouseMove="background_MouseMove" MouseLeftButtonUp="background_MouseLeftButtonUp">
       <Image  x:Name="mainImage"  Source="{Binding Path=WriteableBmp}" />
       <Canvas x:Name="canvasDrawing"  Background="Transparent" />
     </Grid>
  </local:ZoomBorder>
</ScrollViewer>

This works, however, the scollviewer is not adjusting to content's size, it's still the same, if the image is zoomed in to maximum, or is zoomed out to minimum. It should disappear if the image is smaller than window area, or have bigger range when image is zoomed. Can I anyhow bind ScrollViever to Image's transformed size or something? Or is there any better control for this instead of ScrollViewer?
Thank you
Answer: A ScrollViewer will never work with the ZoomBorder control because it is using a RenderTransform. A RenderTransform manipulates what you see after it has gone through the layout system. Because of this, its size never changes and thus the ScrollViewer will never activate.
By modifying the ZoomBorder to use LayoutTransform, you can get the zooming (scroll wheel) functionality to work and the ScrollViewer will activate. However, getting panning to work with the mouse will take more significant modifications.
Here is some example code that works:
ZoomBorder using LayoutTransform
using System.Linq;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
using System.Windows.Media;

namespace SO
{
    public class ZoomBorder : Border
    {
        private FrameworkElement child;

        private ScaleTransform GetScaleTransform(FrameworkElement element)
        {
            return (ScaleTransform)((TransformGroup)element.LayoutTransform)
              .Children.First(tr => tr is ScaleTransform);
        }

        public override UIElement Child
        {
            get => base.Child;
            set
            {
                if (value != null && value != Child)
                    Initialize(value);
                base.Child = value;
            }
        }

        public void Initialize(UIElement element)
        {
            child = (FrameworkElement)element;

            if (child == null) return;

            var group = new TransformGroup();
            var st = new ScaleTransform();

            @group.Children.Add(st);

            child.LayoutTransform = @group;
            child.RenderTransformOrigin = new Point(0.0, 0.0);

            MouseWheel += child_MouseWheel;
            PreviewMouseRightButtonDown += child_PreviewMouseRightButtonDown;
        }

        public void Reset()
        {
            if (child == null) return;

            // reset zoom
            var st = GetScaleTransform(child);
            st.ScaleX = 1.0;
            st.ScaleY = 1.0;
        }

        #region Child Events
        private void child_MouseWheel(object sender, MouseWheelEventArgs e)
        {
            if (child != null)
            {
                var st = GetScaleTransform(child);

                var zoom = e.Delta > 0 ? .2 : -.2;

                if (!(e.Delta > 0) && (st.ScaleX < .4 || st.ScaleY < .4)) return;

                st.ScaleX += zoom;
                st.ScaleY += zoom;
            }
        }

        void child_PreviewMouseRightButtonDown(object sender, MouseButtonEventArgs e)
        {
            Reset();
        }
        #endregion
    }
}

ScrollViewerPanBehavior
A behavior that handles panning by dragging with the mouse.
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
using System.Windows.Interactivity;

namespace SO
{
    public class ScrollViewerPanBehavior : Behavior<ScrollViewer>
    {
        private UIElement content;
        private Point scrollMousePoint;
        private double scrollHorizontalOffset;
        private double scrollVerticalOffset;

        public ScrollViewerPanBehavior()
        {
        }

        protected override void OnAttached()
        {
            base.OnAttached();
            AssociatedObject.Loaded += OnLoaded;
        }

        private void OnLoaded(object sender, RoutedEventArgs e)
        {
            content = (UIElement)AssociatedObject.Content;
            content.MouseLeftButtonDown += OnMouseLeftButtonDown;
            content.MouseMove += OnMouseMove;
            content.MouseLeftButtonUp += OnMouseLeftButtonUp;
        }

        private void OnMouseLeftButtonDown(object sender, System.Windows.Input.MouseButtonEventArgs e)
        {
            content.CaptureMouse();
            AssociatedObject.Cursor = Cursors.Hand;
            scrollMousePoint = e.GetPosition(AssociatedObject);
            scrollHorizontalOffset = AssociatedObject.HorizontalOffset;
            scrollVerticalOffset = AssociatedObject.VerticalOffset;
        }

        private void OnMouseMove(object sender, System.Windows.Input.MouseEventArgs e)
        {
            if (content.IsMouseCaptured)
            {
                var newVerticalOffset = scrollVerticalOffset + (scrollMousePoint.Y - e.GetPosition(AssociatedObject).Y);
                var newHorizontalOffset = scrollHorizontalOffset + (scrollMousePoint.X - e.GetPosition(AssociatedObject).X);

                AssociatedObject.ScrollToVerticalOffset(newVerticalOffset);
                AssociatedObject.ScrollToHorizontalOffset(newHorizontalOffset);
            }
        }

        private void OnMouseLeftButtonUp(object sender, System.Windows.Input.MouseButtonEventArgs e)
        {
            content.ReleaseMouseCapture();
            AssociatedObject.Cursor = Cursors.Arrow;
        }
    }
}

Example usage:
<ScrollViewer
    HorizontalScrollBarVisibility="Auto"
    VerticalScrollBarVisibility="Auto">

        <local:ScrollViewerPanBehavior />

    <local:ZoomBorder
        HorizontalAlignment="Center"
        VerticalAlignment="Center">
        <Grid>
            <Image Source="ThumbsUp.png" />
        </Grid>
    </local:ZoomBorder>
</ScrollViewer>

This was fun to work on!
Comment: Allright, problem was in my XAML, silly mistake, I was binding images' width and height to ZoomBorder size, now I moved it to Grid tag, and it's working perfectly. You saved me, I can't thank you enough, God bless you.
Comment: alright, I will give it a try with LayoutTransform, thank you very much
Comment: Thank you again, really good job with that code. However it's not working for me. Image is not zooming, and scroll viewer is still not adjusting. the only thing that seems to do zooming is Canvas placed in  after Image tag. I can;t understand why is this happening, I will let you know if I find out.


How can I make /etc/rc.local run on startup?

Question: I have a script I would like to run when my system starts and have put it in /etc/rc.local, but it doesn't work. How can I enable it to run on startup?
Comment: Using **systemd** as startup manager  make sure the rc.local compatibility is running: `systemctl status rc-local.service`
Comment: Where is the xsetwacom command? /etc/rc.local is executed with a very simple PATH at startup. It probably differs from the PATH you have logged in at the terminal. In the terminal, type: type -p xsetwacom then replace the "xsetwacom" command in /etc/rc.local with the full path as returned by the "type -p". Do you have to do any manual initializations before xsetwacom works for you?
Comment: waltinator's comment was my problem.  Because of the minimal path, it didn't know how to run the scripts I wanted to be run.  The path loaded on my Ubuntu 14.04 system at the time of runninig /etc/rc.local was the following: /sbin:/usr/sbin:/bin:/usr/bin... you could check yours by putting `echo $PATH > /home/rc_local_path` into your /etc/rc.local and then checking the file after it's been run on startup.
Comment: Keep in mind that if your script needs to **run continuously** [you have to start it as a daemon](http://askubuntu.com/a/191715/323990) in the `rc.local` file!
Comment: Use `sudo systemctl enable rc-local.service` to ensure that `/etc/rc.local `is executed during the server startup
Answer: Can you run your script manually; if not, it's a problem with that script, otherwise look more at rc.local. If that script needs to run as root,  sudo must be used to manually run it.

Ensure /etc/rc.local, and the script it call, is executable:
ls -l /etc/rc.local
  -rwxr-xr-x 1 root root 419 2010-08-27 11:26 /etc/rc.local

Ensure rc.local has a shebang line, which is the default:
head -n1 /etc/rc.local
  #!/bin/sh -e

Comment: I've tried the "ls -l /etc/rc.local" and it is executable, but I cannot make it run on startup... Any idea?
Comment: @pedroo: That needs the X server running, which doesn't happen when rc.local executes.  Running it from rc.local will just make it exit without doing anything (though I hope it puts a message in syslog or elsewhere).  You need to put the xsetwacom commands in ~/.xinitrc or /etc/X/xinit/xinitrc instead.
Comment: @pedroo: Because rc.local contains commands intended to run at a different time.  Create a new file, you can put it in [~/bin](http://askubuntu.com/questions/9848/what-are-path-and-bin-how-can-i-have-personal-scripts), mark it executable (chmod or properties in Nautilus), make the first line "#!/bin/bash", then put your commands on later lines.
Comment: Yes, I can run the script manually. How can I make sure /etc/rc.local is executable? What do I have to type? Is it "$ ls -l /etc/rc.local
-rwxr-xr-x 1"? Thanks!
Comment: @pedroo: I've copied exactly what I *see* in my terminal (so you see the prompt, input, and output all above).  The command is "ls -l /etc/rc.local" and if it's executable, it will have those Xs in the output.
Comment: @pedroo: What does this script do? Does it write to any log files that you need to check? (I think it's time to update the question with more details.)
Comment: It's a xsetwacom command. When I run it in terminal, it works. But it doesn't run automatically when booting...
Comment: The commands in .xinitrc didn't work too. But I've managed to get it to work by putting the 'rc.local' on StartUp Applications. Problem Solved! Thanks for your input!
Comment: @pedroo: Do *not* put rc.local on Startup Applications.  Instead put the xsetwacom command you want to run there, or create a new script with multiple commands and call it from Startup Applications.
Comment: I'm kind of a newbie to linux. How do I create a new script with multiple commands? Why can't I put rc.local on Startup Applications? Thanks.
Comment: It works. Nice!
Answer:
In my case, none of the instructions were a perfect solution, so try this detailed one:

Save all executing code in a separate text file with an arbitrary name, such as foo.sh
Add #!/bin/sh as the first line in foo.sh, executing it via sudo foo.sh to check for errors
In /etc/rc.local, place the full pathname to foo.sh, prefaced with sh, before exit 0:
sh '/path/to/your/script/foo.sh'

Verify the first line in /etc/rc.local is #!/bin/sh -e
Ensure /etc/rc.local is executable:
sudo chown root /etc/rc.local
sudo chmod 755 /etc/rc.local

Verify everything works fine:
sudo /etc/init.d/rc.local start

Reboot to test
Comment: Step #8 was the key, verifying that the script will run under the startup environment.  In my case I need to give the full path to the command.
Comment: In 6 and 7, you write about /etc/rc.local, but in 8, it's /etc/init.d/rc.local. On my 18.04, I have neither of these, shall I create them? Are you talking about different files or is it a mistake?
Comment: Prefect and step to step greats, it's works on centos but `sudo /etc/rc.local start` first run.
Comment: Thanks - this break down really helped for me and as above step #8 was the key for me too! Without that it woudn't redirect +1 (for reference, node app running on bitnami cloud server using [forever](https://www.npmjs.com/package/forever) for continuous running).
Comment: Step 8 was a good tip, But i think step 7 might be what fixed mine, I was trying to run the script using cron to open a tunnel but it was failing randomly
Answer: On newer Ubuntu versions systemd is used and /etc/rc.local is not loaded always by default.
Check if the Compatibility service is loaded with
systemctl status rc-local.service

If it contains active (exited) your setting seems fine and you could have another error in your /etc/rc.local file (this could be a command that fails for example).
Comment: if rc-local.service is not activated,  check this post that explains [How to Enable /etc/rc.local with Systemd](https://www.linuxbabe.com/linux-server/how-to-enable-etcrc-local-with-systemd)
Answer: 2 suggestions.

Ensure that the target script file is also marked executable.
Is the target script running a sudo command? If so you might want to supply the sudo password to it.

My bad. Just check one then. Thanks for the correction enzotib :)
Comment: `rc.local` is run as root, so no password is necessary.


Mounting USB disk with LUKS encrypted partion fails with a cryptsetup "Device already exists" error

Question: I've got an external USB drive with an encrypted LUKS partition. I generally have no problems mounting the device; I click it from the xfce4 desktop and get a dialog where I enter the password.
When I try to mount the drive now, I type in the password and get the error:
Error unlocking /dev/sdc1: Command-line `cryptsetup luksOpen "/dev/sdc1" "luks-..."' exited with non-zero exit status 5: Device luks-... already exists

What do I need to do in order to mount the drive? Is it somehow corrupted? How can the device already exist if it's not mounted (and wasn't plugged in until a short time ago)?
Comment: is the name of the luks device in /dev/mapper/ ?
Comment: Rebooting works, of course, but it'd be nice to know if there's a way to un-munge the situation. I suspect the external device may not have been cleanly unmounted at a suspend operation or something.
Comment: @cegfault Well that's a good question; I suspect so, but I don't know for sure. I have since rebooted. I didn't know to check that; I apologize. If it happens again and I check that, what does the answer (there or not there) mean?
Answer: Yes, this happens when luks encrypted device was not cleanly deactivated with cryptsetup close.
You can try to remove the mapping using
dmsetup remove /dev/mapper/luks-... if you want to avoid rebooting.
Comment: but this answer didn't even work for me - I just get `device-mapper: remove ioctl on [device] failed: Device or resource busy`
Comment: @Hitechcomputergeek I got the same and had to close an old terminal I had left open to the drive.
Comment: you can also do `dmsetup remove_all`
Comment: @Hitechcomputergeek See https://askubuntu.com/questions/429612/device-mapper-remove-ioctl-on-luks-xxxx-failed-device-or-resource-busy for how to find and close all the resources that are using the device.
Comment: OK thank you! I will try that the next time it happens. (In fact maybe I'll make it happen on purpose.)
Comment: Thanks, after my encrypted external hard drive shut down due to a defective power supply, with a different power cord I got the same message as OP. This fixed it.
Answer: From my side, when it happened the dmsetup remove /dev/mapper/luks- command didn't work due to the fact that the specified mapped disk is no more present under /dev/mapper ...
So I had to manually close the old mapping with:
cryptsetup luksClose /dev/sdxx /dev/mapper/luks-...

(where sdx correspond to the luks partition you have identified with fdisk -l
Comment: I manually deleted the file trying to tackle the issue in the question, it resulted in this situation. Also I deleted some other files, so `fdisk` no longer displayed "hanged" disk. But `dmsetup remove_all` helped (it was suggested by Hitechcomputergeek as comment to accepted answer).
Answer: This one worked for me (change sde1 with your disk label):
sudo cryptsetup luksOpen /dev/sde1 lukslvm


Compiling a windows service with an output type of Exe

Question: Currently when developing a windows service I modify the csproj to set the OutputType to Exe in debug mode so that I get a console window and I can easily debug the service.
What I'm curious about is, is there any issue with putting it into production like this in release mode?  I don't see the console window, it seems to be not shown or hidden or not created when the service is installed via InstallUtil and then started.
Any thoughts?
Comment: Trace output would be just as easy for debugging purposes, and would not require the service to create a console window. You could even leave it in in release builds.
Comment: I do use Trace output, as well as a lot of other configurable logging options.  The point was simply if there was a negative impact to building it as a console app when deploying in production.
Answer: Most services are usually exe output types. And yes, there will be no console when it is running as a service but as long as you are not reading from the console for anything it should not be a problem. You can write to the console as a service and the text will just be ignored by the system.
Usually what I do is I make the program watch for the string --debug to be passed in as a command line parameter, if it is it starts up the serivce as a console app and if not it starts it up as a service. Here is a example of how to do it:
static void Main(string[] args)
{
        var debugMode = args.Contains("--debug", StringComparer.InvariantCultureIgnoreCase);

        if (!debugMode)
        {
            ServiceBase[] servicesToRun =
            {
                new MyService();
            };
            ServiceBase.Run(servicesToRun);
        }
        else
        {
            var service = new MyService();
            service.StartService(args);
            Console.WriteLine("Service is now running, press enter to stop...");
            Console.ReadLine();
            service.StopService();
        }
    }
}

Then inside the service code I do
public partial class MyService : ServiceBase
{
    internal void StartService(string[] args)
    {
        OnStart(args);
    }

    internal void StopService()
    {
        OnStop();
    }

    //... The rest of the code here
}

Comment: Thanks for this answer.  You nailed it on the top portion, and the bottom half I think will help other developers.  I do something similar but we don't use command line arguments.    Here's a gist showing how we start our stuff up with dependency injection and the conditional attribute.

https://gist.github.com/jsheldon/95ee922088abf28eb6ec04dcdd1e1fb2


Safely and cleanly remove mirror stuck with silicone adhesive from wooden frame

Question: I have a 27" wide mirror that has been glued with a silicone adhesive on a plywood frame that's about 10mm thick. The height of the mirror is roughly 36". I'm looking for some advice on how I could loosen the glue and remove the mirror from the frame.
Comment: If it is stuck on with silicone there will be nothing clean about the removal, silicone is some of the most contrary stuff to separate, especially in this case a mirror. I have used a strong thin wire, like a piano wire or guitar string to run behind objects and saw them off. If you are wanting to salvage the mirror, this will surely affect the silvering on the back of the mirror.
Comment: if you don't care about the plywood, soak the whole thing in water for several days and you can probably delaminate the mirror.
Answer: 5 feet of braided fishing line, and a couple of dowels for handles, if it's "on" the "frame" - if it's "in" the frame you'll probably have to decide whether you want to salvage the mirror or the frame, and destructively remove the other, as getting the line behind it won't be practical, most likely.
Getting the whole thing very warm may make cutting it easier.
Comment: With great joy, I would like to inform you that the operation was successful. What worked was a combination of WD40 to soften the silicone, braided fishing line, heat from a hair dryer and an important ingredient that I was seriously running low on - patience. Thank you for all the suggestions. I plan to reframe the recovered mirror.
Comment: Dental floss works for me and most have that if it can be slipped behind the glass then it can work like a saw pulling back and forth, and I also agree nothing will do it clean additional steps to remove the silicone will be needed.


Do skin makers with lower-rarity skins get more money?

Question: Not sure if this goes in gamedev.SE or gaming.SE, but here goes.
Apparently users who contribute skins to the game that Valve adds will receive a small profit every time a user gets their gun.  Does this mean that since higher rarity guns will spread out far less than lower rarity guns, do the contributors who contribute lower rarity guns get more money? Or is the profit solely derived from the user unboxing the crate?
Comment: Pretty sure supply and demand would matter
Answer: It all depends on the rarity of the gun and how many people obtain it. If it is a low level gun, then a lot of people will have a chance at obtaining it, but the payout to you may not be that big.
If it is say a Restricted Rifle or better than you will get a higher payout if more people get ahold of it.
But as user1337 also stated, it is also based on Supply and Demand. A lot of people getting it means a lot of pay for you. But if not a lot of people are getting it, not a lot of pay for you, but each time you do get paid it will be higher.
I may not be entirely correct on this, it is just what I have noticed in the time I have played CS:GO


$f(x)= (x+y) \sin(\frac{1}{x}+ \frac{1}{y}), x\neq0, y\neq0$ Limit as $x\to0, y\neq0$

Question: let $$f(x)= (x+y) \sin(\frac{1}{x}+ \frac{1}{y}), x\neq0, y\neq0$$ else $f(x,y)=0$. I need to show that $f(x,y)$ is continuous at $(0,0)$ and that $\lim_{x\to0}f(x,y)$ for $y\neq0$ exists.
Continuity at $(0,0)$ is easily shown by observing that $|f(x,y)|<|x+y|$. However, I think that the second part is incorrect and the asked limit doesn't esists. (as there will be $\sin(\infty)$ in the expression.) Can please someone confirm if thats correct or show how the $\lim_{x\to0}f(x,y)$ for $y\neq0$ exists.
Answer: Your arguments for the continuity at $(0,0)$ are o.k.
Indeed , the second part is incorrect. Let $y \ne 0$ and define
$$x_n:=\frac{y}{y n \frac{\pi}{2}-1}$$
for $n$ so large such that $y n \frac{\pi}{2}-1>0.$ Then $x_n \to 0$, but
$f(x_n,y)=(x_n+y) \sin (n \frac{\pi}{2})$ does not converge.


UIWebView: How to tell when part of the HTML is visible?

Question: Is there a callback offered by UIWebView that is called when scrolling occurs, and if so, how can I get the current content offset?
Thanks.
Answer: You can using this property available in ios 5.0:
@property(nonatomic, readonly, retain) UIScrollView *scrollView

Or prior to iOS 5.0:
NSArray *subViews = [NSArray arrayWithArray:[myWebview subviews]];
UIScrollView *webScroller = (UIScrollView *)[subViews objectAtIndex:0];

You can then implement the UIScrollViewProtocol and do something like this:
UIScrollView *webScrollView = myWebView.scrollView;
webScrollView.delegate = self;

//implement method from delegate..

- (void)scrollViewDidScroll:(UIScrollView *)scrollView
{
    //Scrolled
}

To get the contentOffset all you have to do is:
CGPoint offSet = webScrollView.contentOffset;

Comment: Wait, are you serious? With UIScrollView I've used scrollViewDidScroll. Why would that not work in iOS 4.x?
Comment: @Mithras What is new is the property in UIWebView :). See my updated answer on how to get a reference to the scrollView before 5.0.
Comment: Yep, that's what I was planning to do. Thanks.


Turan number of cycles of length at most $2k$ for $k\geq 2$.

Question:
Theorem (short even cycles)
For any integer $k\geq 2$, we have
$\text{ex}(n,\{C_4,\dots,C_{2k}\})=O_k(n^{1+1/k}).$

Remark: $\text{ex}(n,\{C_4,\dots,C_{2k}\})$ is the maximal number of edges in the $n$-vertex graph which does not contains an even cycle of length at most $2k$.
To prove this theorem we need the following two technical lemmas.

Lemma 1 (Large bipartite subgraph)
Every $G$ has a bipartite subgraph with at least $e(G)/2$ edges.

Lemma 2 (Large average degree implies subgraph with large minimum degree)
Let $t>0$. Every graph with average degree $2t$ has a
subgraph with minimum degree greater than $t$.

Proof of Theorem. Suppose that the graph $G$ is the maximizer, i.e. $\text{ex}(n,\{C_4,\dots,C_{2k}\})=e(G)$. Applying Lemma 1, we find a bipartite subgraph $G'$ of $G$ such that $e(G')\geq \dfrac{e(G)}{2}$. Now applying Lemma 2, we find a subgraph $G''$ of $G'$ such that $$\delta(G'')>\underbrace{\dfrac{d_{\text{ave}}(G')}{2}}_{=t}=\dfrac{e(G')}{\nu(G')}\geq\dfrac{e(G)}{2\nu(G)}.$$
Notice that $G''$ is a bipartite subgraph of $G'$ (and hence of $G$) with $\delta(G'')>t\geq\dfrac{e(G)}{2\nu(G)}$.
Let $u$ be an arbitrary vertex of $G''$. For each $i=0,1,\dots,k$, let $A_i$ denote the set of vertices at distance exactly $i$ from $u$.

For each $i=1,\dots,k-1$, every vertex of $A_i$ has:

no neighbors in $A_i$ (or else $G''$ would not be bipartite),

exactly one neighbor in $A_{i-1}$ (else we can backtrace through two neighbours which must converge at some point to form an even cycle of length at most $2k$),

and thus $>t-1$ neighbors in $A_{i+1}$ (by the minimum degree assumption on $G''$).

Therefore, each layer $A_i$ expands to the next by a factor at least $t-1$. Hence
$$\nu(G)\geq |A_k|\geq (t-1)^k\geq \left(\frac{e(G)}{2\nu(G)}-1\right)^k.$$
And thus $$e(G)\leq 2\nu(G)^{1+1/k}+2\nu(G).$$
I understand the idea of the proof but there are some technical moments which I did not understand:
Questions.

"every vertex of $A_i$ has no neighbors in $A_i$". Am I right that if this happens then we have an odd cycle in bipartite graph $G''$ which is absurd?

Here $A_1$ is basically the neighbors of $u$, i.e. $N(u)$ which exists because $|A_1|=\deg(u)\geq \delta(G'')>t>0$ and hence $|A_1|\geq 1$. But how do we know that $A_2,\dots, A_k$ exist? I think that it follows if $t>1$ but I cannot prove that $t>1$.

Thanks a lot!
Comment: Isn't it a bit inconsistent to use $\nu(G)$ for the number of vertices and $e(G)$ for the number of edges? Some people write Latin letters for both ($v(G)$ and $e(G)$), and some people write Greek letters for both ($\nu(G)$ and $\epsilon(G)$), but I've never seen anyone mix the two. (More on the notation [here](https://faculty.math.illinois.edu/~west/igt/notat.html).)
Comment: @MishaLavrov, Hmm very interesting! Most of the questions which I am asking they are from Yufei Zhao's book "Graph Theory and Additive Combinatorics" and he uses the notation $e(G)$ and $\nu(G)$. However, I am also reading the book of Reinhard Diestel and he uses the notations $|G|$ and $\lVert G\rVert$ for the number of vertices and edges, respectively. To be honest, I personally like $e(G)$ and $\nu(G)$.
Answer: First question. Yes: whenever there is an edge between $v,w \in A_i$, this creates an odd cycle. There is some largest $j<i$ (possibly $j=0$, possibly not) such that $v$ and $w$ have a common ancestor in $A_j$; going from $v$ back to that ancestor, forward to $w$, and then directly to $v$ is a cycle of length $2(i-j)+1$.
Second question. We cannot guarantee $t>1$ just from assuming that $G$ does not have an even cycle of length $2k$ or shorter. But remember: our goal is to prove that $G$ can't have too many edges, and having $t\le 1$ should help us with that.
If $t \le 1$, that means $G'$ has average degree at most $2t \le 2$, so $e(G') \le v(G')$, and therefore $e(G) \le 2 v(G)$. If $t>1$, you can proceed with your proof and obtain $e(G) \le 2v(G)^{1+1/k} + 2v(G)$. So the weaker of these two bounds, $e(G) \le 2v(G)^{1+1/k} + 2v(G)$, holds no matter what $t$ is.
Comment: It makes sense now! But after some deep thoughts I am confused how to prove rigorously that each $A_i$ is nonempty.
Comment: Well, if a vertex in $A_i$ has at least $t-1$ neighbors in $A_{i+1}$, and $t-1 > 0$, that means $A_{i+1}$ is nonempty.
Comment: Yes, but in order to prove that a vertex in $A_i$ has at least $t-1$ neighbors in $A_{i+1}$ we rely on the fact that $A_i\neq \varnothing$.
Comment: Induct! You know that $A_0 \ne \varnothing$.
Comment: Yeah now it makes sense (that was a stupid question actually on my side). Thank you for your help, Misha! +1


Loading strategy: when should I fetch images?

Question: I redesigned my data loading strategy following this answer. My page displays a list of objects components (on a single page, between 30 and 150 items, sorted by section of one to 5 items maximum). Each of these objects have an image component.
The loading order is as follows:

The objects data isn't loaded, so I use a placeholder like this:

The objects data is here so I display the objects components, but since I have not the image yet, I use a dataUrl low definition placeholder, as described here. FYI, the placeholder is 120 Bytes and shipped with the original data, the real image is 1.7 Kbyte so this is a nice deal.
I have several parameters attached to my image component. One of them is lazy loading: if it is on, it will fetch the image only when its related object is in screen.

The final result is awesome, very clean and fast. The initial load has this "wait for it... coming...." feeling that helps a lot with the loading times related user experience.
However, I noticed that on the big websites such as Quora, Medium, etc. images are not lazy loaded, or at least not the way I do it: after the page has been loaded, even if it is not in the screen, the image is fetched in order to avoid to rely on the low definition placeholder everywhere.
That makes sense to complete the closest off-screen elements when you can, in preparation of the next user moves.
I would like to know if the options have been studied and if there is a consensus on how to do it right. As I see it it can be done 3 ways (possibly all-together):

You load only what the user can see (what I do)
After x second on the page, you load (some or all of) the off-screen assets
You load the closest off-screen assets, e.g. those placed x pixels below the current position.
Answer: The best solution is typically option 3. Say the screen holds roughly 10 items, on page load send out the request for those 10 items and the 10 items immediately proceeding them (20 total). Then when the user scrolls past your first 10 items send the request for the third set of 10 items and load those in. This way the user will always have a buffer as they scroll and will be none the wiser that you're lazy loading content.
Of course you can play with numbers to best optimize depending how likely users will scroll through content and how much data you can send downstream without slowing the application.


Can we copy files from $(System.DefaultWorkingDirectory) to Azure Iaas server using Agent Pool "Hosted VS2017"

Question: We are using CI/CD pipeline in OneITVSO. Earlier we had an agent pool which was internally created. Now we are asked to use "Hosted VS 2017". We have a Database solution, ETL solution and Tabular Model solution that needs to get deployed. Additionally we have certain scope scripts.
We are able to build the solution using "Hosted VS 2017". But we are not able to deploy using "Hosted VS 2017" In the release pipeline we have a task "Windows Machine File Copy" which copies either artifacts/dacpac/ispac/.sql files from build server to dev/uat servers.
Using the earlier agent pool this pipeline was getting deployed successfully. But now when we use "Hosted VS 2017" we are getting below error:
Failed to connect to the path \AZDEVSERVERSQL01 with the user ***domain\servicecredentialdwd* for copying. System error 53 has occurred.**
1) Can "Hosted VS 2017" be used for task like "Windows Machine File Copy" (We are using Microsoft Azure Virtual Machine(Iaas) )
2) If we can use "Hosted VS 2017" even for Iaas Azure machines, are we missing any credential access. Should we give any access to domain\servicecredentialdwd for the agent pool "Hosted VS 2017". If so what permissions has to be given and how.
NOTE: Same pipeline gets deployed when "private" agent is used. gets failed when "Hosted VS 2017" is used.
Answer: If your IaaS server has a public IP configured, then yes. If not, then no. The build agent has to be able to establish a network route to your virtual machine. If the VM is isolated in a private network, then the build server can't send traffic to it.
Comment: Hi Daniel, Thanks for the response. Earlier we had private agent and then this "Windows Machine File Copy" was working fine. Do you mean for private agent, we did not require such setting of public IP configuration

Can we copy files from $(System.DefaultWorkingDirectory) to Azure Iaas server using Agent Pool “Hosted VS2017”


How do I prove $2$ is prime (or irreducible) in all $Z[\sqrt{d}]$ with $d < -7$?

Question:
How do I prove $2$ is prime (or irreducible) in all $Z[\sqrt{d}]$ with $d < -7$?

I feel like the answer is right under my nose, but I just can't see it.
Comment: My understanding is that elements can only be prime and irreducible in a UFD, otherwise they are irreducible but not prime. And there is no unique factorization for $d < -163$, so then 2 can be irreducible but not prime in those.
Comment: Do you know about the norm on $\mathbb{Z}[\sqrt{d}]$? (And it must be "irreducible", $2$ is prime only if $d\equiv 5 \pmod{8}$.)
Comment: The norm? I saw that in the book somewhere... And how do you make that nice Z?
Comment: `\mathbb{Z}`. What do you remember about the norm?
Comment: Let $d\ne 1$ be square-free. The integers in $Q(\sqrt{d})$ has either shape $\gamma=a+b\sqrt{d}$, where $a$ and $b$ are integers, except that in the case $d\equiv -1\pmod{4}$, $\gamma=(1/2)(a+b\sqrt{d})$, where $a$ and $b$ are odd integers, is allowed. If $d$ is negative and less than $-7$, and $b\ne 0$, then $a^2+|d|b^2$ and $(1/4)(a^2+|d|b^2)\gt 2$. So the norm of $\gamma$ is greater than $2$.
Answer: For convenience, let's say $-d$ instead of $d$, with $d \in \mathbb{Z}^+$ and $\mu(d) \neq 0$.
If 2 is composite or reducible in $\mathbb{Z}[\sqrt{-d}]$, that means $x^2 + dy^2 = 2$ has a solution in integers, or, if $d \equiv 3 \mod 4$, the equation $\frac{x^2}{4} + \frac{dy^2}{4} = 2$ holds. For the former, the only solutions are $1^2 + 1 \times 1^2$ and $0^2 + 2 \times 1^2$. And for the latter, $\frac{1^2}{4} + \frac{7 \times 1^2}{4}$. These solutions correspond to the factorizations $(1 - i)(1 + i)$, $(-1)(\sqrt{-2})^2$ and $\left(\frac{1}{2} - \frac{\sqrt{-7}}{2}\right)\left(\frac{1}{2} + \frac{\sqrt{-7}}{2}\right)$.
If $d > 9$ and $y \neq 0$, then clearly $x^2 + dy^2 \geq 10 > 2$ or $\frac{x^2}{4} + \frac{dy^2}{4} \geq \frac{5}{2} > 2$.


Use CEILING Without the Effect of Rounding Error

Question: I'm trying to use the intrinsic function 'CEILING', but the rounding error makes it difficult to get what I want sometimes. The sample code is just very simple:
PROGRAM MAIN

  IMPLICIT NONE

  INTEGER, PARAMETER        ::      ppm_kind_double = KIND(1.0D0)
  REAL(ppm_kind_double)     ::      before,after,dx

  before = -0.112
  dx = 0.008
  after = CEILING(before/dx)

  WRITE(*,*) before, dx, before/dx, after

  END

And I got results:
The value I give to 'before' and 'dx' in the code is just for demonstration. For those before/dx = -13.5 for example, I want to use CEILING to get -13. But for the picture I show, I actually want to get -14. I have considered using some arguments like
 IF(ABS(NINT(before/dx) - before/dx) < 0.001)

But that's simply not beautiful. Is there any better way to do this?
Update:
I was surprised to find that the problem won't occur if I set the variables to constants in ppm_kind_double. So I guess this 'rounding error' will only happen when the number of digits for rounding accuracy of the machine I use is more than what's defined in ppm_kind_double. I actually run my program(not this demo code) on a cluster, which I don't know about the machine precision. So maybe it's quad precision on that machine that leads to the problem?
After I set constants to double precision:
before = -0.112_ppm_kind_double
dx = 0.008_ppm_kind_double

Comment: Given precision is part of the issue here, it is worth noting that your literal constants are only single precision - e.g. `-0.112` should probably be written `-0.112_ppm_kind_double`.  This change won't solve the underlying issue though.
Comment: BTW your interpretation is wrong. What actually happened is that originally you were setting your variables to inaccurate single precision and with the kind suffix you are using the correct precision. I highly suggest you to read about numerical accuracy of expressions in Fortran. Default numbers are single precision. And your *"rounding accuracy of the machine"* does not exist.
Comment: You threw me a bit off with wanting -14. It took my a while to realise that -0.112 / 0.008 is exactly -14, but because of rounding errors, the result is slightly more, and the `CEILING` then amplifies this minuscule error.
Comment: @chw21, actually I saw your earlier comment and was waiting for you to find that. :)
Comment: In addition to making the constants of consistent data type, it's difficult to guess why you didn't use ANINT rather than CEILING.
Comment: @lanH Thanks for the remainder.
Comment: @tim18 Because I also want to get for example -13 from -13.6
Comment: You don't have to do any `--- UPDATE 10/11/2016------`, this site has an automatic version control. Just see the link "edited ..." below your post.
Answer: This is a bit tricky, because you never know where the rounding error comes from. If dx was just a tiny bit larger than 0.008 then the division before/dx might still be rounded to the same value, but now -13 would be the correct answer.
That said, the most common method around that that I have seen is to just nudge the previous value ever so little into the opposite direction. Something like this:
program sign_test
    use iso_fortran_env
    implicit none
    real(kind=real64) :: a, b
    integer(kind=int32) :: c
    a = -0.112
    b = 0.008
    c = my_ceiling(a/b)
    print*, a, b, c
contains
    function my_ceiling(v)
        implicit none
        real(kind=real64), intent(in) :: v
        integer(kind=int32) :: my_ceiling
        my_ceiling = ceiling(v - 1d-6, kind=int32)
    end function my_ceiling
end program sign_test

This won't have any impact on the vast majority of values, but there are now a few values that will get rounded up by more than intended.
Comment: Thanks chw21, give the initial guess a reasonable shift is also a good way.
Answer: note if your reals are notionally "exact" to a specified precision you might do something like this:
 after=nint(1000*before)/nint(1000*dx)

this works for your example.. you haven't said what you'd expect for both values positive and so on so you might need to work it a bit.


How do I implement Enumerations in my rails app?

Question: Rails version: 4.2.0
OS:            Windows 7 (64-bit)
Hello, For example lets say I have a rails app with a posts model.
If I wanted the post model to have a permissions column, which could take on one of several values [public, private, unlisted]
The way I would implement this would be to add a integer column to the posts model, but checking this value would quickly become confusing because I would have to memorize which value corresponds to which permission.
how could I implement an enumeration into this so I could do checks like
if post.visibility == POST_PUBLIC or post.visibility == POST_PRIVATE

Comment: There's a feature in Rails designed exactly for this purpose: http://api.rubyonrails.org/v4.1.0/classes/ActiveRecord/Enum.html
Answer: Since Rails 4.1 you can have enum attributes in ActiveRecord models. For example:
class Post < ActiveRecord::Base
  enum visibility: [:public, :private, :unlisted]
  ..
end

http://edgeapi.rubyonrails.org/classes/ActiveRecord/Enum.html


How to use freelancer api for android app

Question: I am making an android app i want to add a feature that user can operate their freelancer account with my app. I searched that freelancer provides api but i don't know that how to use that api.
Some source to get stated and tutorials for how to use that are appreciated.
thanks
Answer: Freelancer API is REST webservice API type. For example `link.
Firstly connect and download data from specific URI then parse it with JSON or XML parser.


How to use HMVC for Codeigniter 2.1.* when index.php is moved?

Question: I am trying to build a CodeIgniter application with my index.php inside a "public" folder /Applications/MAMP/htdocs/public/ in the website root. I have setup my vhosts etc to point to this index.php file. I wanted to go for a module based approach and so ended up using Modular Extensions - HMVC . I placed the core files and the third party files in the corresponding folders, and created a modules folder in the application folder. I then proceeded to create a "login" module inside the modules folder alongwith the required "controllers/login.php" , "models" and "views"
class Login extends MX_Controller{
    public function index()
    {
        log_message('error','reached module');
    }
}

Now when i try to load http://localhost/login , I get an error log in apache_error.log saying
File does not exist: /Applications/MAMP/htdocs/public/login

http://localhost works fine displaying the welcome screen of CodeIgniter
gniter
This is the path structure :
application/modules
└── login
    ├── config
    │   └── routes.php
    ├── controllers
    │   └── login.php
    └── views
        └── login.view.php

Content of modules/login/config/routes.php
<?php
$route['login'] = 'login';

httpd-vhosts config :
<VirtualHost *:80>
    DocumentRoot "/Applications/MAMP/htdocs/public"
    SetEnv APP_ENV development

    <Directory "/Applications/MAMP/htdocs/public">
        Options Indexes FollowSymLinks Includes execCGI
        AllowOverride All
        Order Allow,Deny
        Allow From All
    </Directory>
</VirtualHost>

Comment: Aren't you supposed to use modules::run('module/login', $params, $...) instead of $this->load->view ?
Comment: try some thing  $application_folder = '../application'; just a idea might work, think of where your applications folder is.
Comment: have updated `$application_folder` .. otherwise it would not work from inside the `public`folder
Comment: @Bonatoc - have tried that as well... I added a log message in the index() but it never reached there ..
Comment: is controller in modules folder modules/folder/file in routes may need also to add $route['controllername'] "folder/controllername/index"; and to get default controller or route to work in sub folder just add the index on the end. Must be in modules folder in application.
Comment: @acoderslife : tried it.. but same error. I am beginning to think this does not have anything to do with my CI code but rather my vhosts .. following is my vhosts config( added to question )
Comment: Ok Sorry not sure on vhost I use xammp when developing and then when use cpanel when on main server
Answer: I finally managed to get my code working. Wrote a small tutorial around it on setting up. You can refer it here


Is $1-2+3-4+…$ $2$-Cesàro summable to $1/4$?

Question: According to the video https://www.youtube.com/watch?v=jcKRGpMiVTw, the series $s_n=\sum_{k=1}^n (-1)^{k+1} k$ is $2$-Cesàro summable. Because of the not-quite rigorous identity
$$ s_\infty = \frac{1}{(1+1)^2},$$
I expected that $s_n$ would then be $2$-Cesàro summable to $1/4$. However, computing the partial averages of the partial averages of $s_{n\rightarrow \infty}$  with the following Python code yields a sequence that quickly decays past 1/4 and seems to be tending towards 0.
<code>def secondNeg(n):
    if n % 2:
        yield n
    else:
        yield -n
    yield from secondNeg(n+1)

def Cesaro(mean, pos, s):
    result = (mean*pos+next(s))/(pos+1)
    yield result
    yield from Cesaro(result, pos+1, s)

for i in Cesaro(0, 1, Cesaro(0, 1, secondNeg(1))):
    print(i)
</code>
As a matter of fact, I obtained that the 985th average of averages is approximately $0.0015618150237966225$.
How do I prove that $s_n$ is (or isn't) $2$-Cesàro summable, and how do I rigorously compute the value of this sum? And why does the code above not give a sequence converging to $1/4$?
Comment: Can't speak to the code, but showing the regularized sum converges to $1/4$ isn't bad.
Answer: If the limit exists, the Cesaro sum of order $\alpha>0$ of $\sum_{n}a_n$ is equivalent to
$$
C(n,\alpha)  = \lim_{n\to\infty} \sum_{j=0}^{n} \frac{\binom{n}{j}}{\binom{n+\alpha}{j}} a_j
$$We have $a_j = j (-1)^{j+1}$, so
$$
C(n,2) = \lim_{n\to\infty} \sum_{j=0}^n \frac{(-1)^{j+1} j (j-n-2) (j-n-1)}{(n+1) (n+2)}
$$We can factor out the denominator and then the numerator cleans up using the closed-form expressions for sums of powers:
$$
\lim_{n\to\infty} \frac{2 n^2-2 (-1)^n n+6 n-3 (-1)^n+3}{8 (n+1) (n+2)} = \frac{1}{4}
$$If you are willing to take it on faith that the original sum is Cesaro-2 summable, you could also compute its value using Abel summation (as Cesaro implies Abel, see here):
$$
\lim_{r\to 1^-} \sum_{n=0}^{\infty} n(-1)^{n+1} r^n = \lim_{r\to 1^-} \frac{r}{(r+1)^2}= \frac{1}{4}
$$
Comment: I see in Shawyer & Watson (the reference cited in Wikipedia) that $A_n^\alpha = \sum_{k=0}^nE_{n-k}^\alpha a_k$ and $E_n^\alpha=\binom{n+\alpha}{\alpha}$. But how does that lead to the first equation in your answer?
Comment: It's just the binomial theorem.
Answer: To perform 2-Cesaro summation, sum the partial sums, then sum those sums, and divide by the result obtained by performing the same operation on the partial sums of $1+0+0+0+...$, that is, by the triangular numbers.  Here we transform the partial sums
$1,-1,2,-2,3,-3,4,-4,5,-5,...\to$
$1,0,2,0,3,0,4,0,5,0,...\to$
$\color{blue}{1,1,3,3,6,6,10,10,15,15,...}$
and divide by
$1,1,1,1,1,1,1,1,1,1,...\to$
$1,2,3,4,5,6,7,8,9,10,...\to$
$\color{blue}{1,3,6,10,15,21,28,36,45,55,...}$
The resulting quotient equals the $m$-th triangular number divided by the $n$-th triangular number where $n\in\{2m-1,2m\}$; as $n$ increases without bound this has the limit $1/4$.
Comment: Fixed the code and showed a solution exists; nice work.


Wix CMS - Dynamic Title for Store Collections

Question: I am using WIX store and have the below question:
I need to add a text content [BigTitle 1] available only when i choose Collection/Category

Dryvenner

.
When i choose another Category/Collection [ex: oppfinnelser], Big Title 1 should change to Big Title 2; so what i need is to create dynamic text content linked to each category, any advise?
Answer: Your question is a bit light on the details, but I'll try to point you in some directions, and hopefully it will help.
Looks like you are on a Stores product page and you want to know what collections the current item belongs to. To do so, you can use the getProduct() function to get the ID of the current product. Then, you can query the Stores/Products database collection to get the stores collections that the item belongs to.
From there, you can use the $w() API to hide/show or change the text of headings you want to show.


Continuous mean ergodic theorem

Question: I would like to show that the discrete mean ergodic theorem implies a continuous version. The discrete mean ergodic theorem I am working with is as follows:
Let $U$ be a unitary operator on a Hilbert space $\mathcal H$ and let $P$ be the orthogonal projection onto the set of $\psi \in \mathcal H$ satisfying $U\psi = \psi$. Then, for any $f \in \mathcal H$,
$$\lim_{N \rightarrow \infty} \frac{1}{N} \sum_{n=0}^\infty U^nf = Pf.$$
In the continuous case, we have that $T_t$ is a one-parameter group of measure-preserving transformations and $Uf(w) = f(T_1w)$. We would like to show a mean ergodic theorem for
$$\lim_{T \rightarrow \infty} \frac{1}{T}\int_0^T f(T_tw)dt.$$
I have the following approach: Let $(Uf)(w) = f(T_1w)$ and let $\tilde{f}(w) = \int_0^1 f(T_tw)dt$. Note that
$$\frac{1}{T} \int_0^T f(T_tw)dt = \frac{1}{T}\sum_{n=0}^{T-1} U^n\int_0^1 f(T_tw)dt = \frac{1}{T} \sum_{n=0}^{T-1} U^n\tilde{f}.$$
By the discrete mean ergodic theorem, this converges to $P\tilde{f}$, the projection of $\tilde{f}$ onto the space $\{g : Ug = g\}$. So, it remains to show that $P\tilde{f} = Pf$.
How can we show this final step? I see that we can understand $\tilde{f}$ as averages of $f$, but I'm not sure what I can do with that.
Answer: There are some assumptions missing in question (e.g. where f lives?, it is impossible to integrate a vector in an arbitrary Hilbert space), but this proof should work with these assumptions (if not please comment):
Write $f= f_1 + f_2$ where $f_1$ is $T$-invariant (i.e. $T_t f_1 = f_1$ for all $t$), and $f_2$ is orthogonal to the space of $T$-invariant functions
Then $\tilde{f} = \int_0^1 f_1(T_tw) dt + \int_0^1 T_t f_2(T_tw)dt = f_1 + \int_0^1 f_2(T_tw)dt$.
It is left to show that $\tilde{f}_2 :=\int_0^1 f_2(T_tw)dt$ is orthogonal to the invariant functions.
Let $g$ be an invariant function, then $\left<\tilde{f}_2,g\right>=\int \tilde{f}_2(w) g(w) dw =  \int \int_0^1 f_2(T_tw)dt g(w) dw $
By Fubini (and you need some assumptions to justify Fubini here, your question lack these assumptions)
$$\left<\tilde{f}_2,g\right> = \int_0^1 \int f_2(T_tw) g(w) dw dt$$
Since $T_t$ is measure-preserving this equals to $$\int_0^1 \int f_2(w) g(T_{-t} w) dw dt$$ and finally, since $g$ is invariant this equals to $\left<f_2 ,g\right>=0$, as required.

Continuous mean ergodic theorem


Installing TexLive 2013 with starlinq instructions

Question: I'm following this guide on how to install TeX Live on Ubuntu 12.04 (and I'm trying to install TeX Live 2013, not 2012.). I want to install all the packages (except for the language support, I just need English (UK)).
In this section it starts getting vague:
Setting environment variables

Add new paths to your environment variables. In ~/.profile add finally the lines:

PATH=/usr/local/texlive/2012/bin/i386-linux:$PATH; export PATH
MANPATH=/usr/local/texlive/2012/texmf/doc/man:$MANPATH; export MANPATH
INFOPATH=/usr/local/texlive/2012/texmf/doc/info:$INFOPATH; export INFOPATH

Finally do the MANPATH mapping, open the terminal and type

$ sudo gedit /etc/manpath.config

Find the section with # set up PATH to MANPATH mapping. At the end of this section add the following line.

MANPATH_MAP     /usr/local/texlive/2012/bin/i386-linux    /usr/local/texlive/2012/texmf/doc/man

Now we can close the gedit window.

Where exactly do I add the PATH,MANPATH,INFOPATH lines in the profile file? Right at the bottom?
The MANPATH_MAP line doesn't exactly fit neatly in the predefined columns in this section, so does the amount of spacing in
MANPATH_MAP     /usr/local/texlive/2012/bin/i386-linux    /usr/local/texlive/2012/texmf/doc/man

actually matter?
Answer: Append that lines to ~/.profile - that means to add them at the end of the file.
There is nothing wrong if MANPATH_MAP doesn't fit in the predefined columns.
If you are afraid of messing things up make a backup of the files you're modifying.
Comment: Thanks. Is it necessary to do an update immediately after installation (as in the instructions)? My internet connection is a little dodgy.
Comment: @MedullaOblongata Generally speaking software updates are recommended because they may fix bugs, add new features. But if everything work as expected there is no rush to do an update.


Is healing blade nerfed too like all other life steal?

Question: I am thinking of trying this build:
http://eu.battle.net/d3/en/forum/topic/4551608970
However, I've heard that life steal is nerfed by 80% in inferno.
Does that affect healing blades?
Comment: All life steal is nerfed in Inferno.  http://us.battle.net/d3/en/game/guide/gameplay/game-difficulty#life-steal
Answer: Yes, all skills which provide life steal are subject to the same effectiveness reduction based on difficulty that is applied to life steal provided by items.
Comment: any references?
Answer: The effectiveness of the Life Steal affix – which restores your Life by a percentage of the damage you deal – is reduced in advanced difficulties, as shown:
Normal: 100%
Nightmare: 70%
Hell: 40%
Inferno: 20%
Keep in mind, however, that Life on Hit items are still perfectly viable in any difficulty. It's very common for the monk and barbarian to have high LoH (1500+) just to survive Act 3/4 inferno.
Diablo 3 Life Steal Entry
Comment: Both answers are correct. This one is more detailed.


Fixed thead in jQuery Mobile table

Question: I have tried to solve this problem for a few hours now. There a lot of plugins for fixed theads, but non of them seem to work with jQuery Mobile.
for example:
http://mkoryak.github.io/floatThead/
I also tried to solve this with CSS, and this works more or less. But the width of th columns is not the same as the td's.
HTML:

test

        Rank
        Movie Title
        Year
        Rating
        Reviews

        1
        Citizen Kane
        1941
        100%
        74

        2
        Casablanca
        1942
        97%
        64

        3
        The Godfather
        1972
        97%
        87

        4
        Gone with the Wind
        1939
        96%
        87

        5
        Lawrence of Arabia
        1962
        94%
        87

        6
        Dr. Strangelove Or How I Learned to Stop Worrying and Love the Bomb
        1964
        92%
        74

        7
        The Graduate
        1967
        91%
        122

        8
        The Wizard of Oz
        1939
        90%
        72

        9
        Singin' in the Rain
        1952
        89%
        85

        10
        Inception
        2010
        84%
        78

        10
        Inception
        2010
        84%
        78

        10
        Inception
        2010
        84%
        78

        10
        Inception
        2010
        84%
        78

        8
        The Wizard of Oz
        1939
        90%
        72

        9
        Singin' in the Rain
        1952
        89%
        85

        10
        Inception
        2010
        84%
        78

        10
        Inception
        2010
        84%
        78

        10
        Inception
        2010
        84%
        78

        10
        Inception
        2010
        84%
        78

        8
        The Wizard of Oz
        1939
        90%
        72

        9
        Singin' in the Rain
        1952
        89%
        85

        10
        Inception
        2010
        84%
        78

        10
        Inception
        2010
        84%
        78

        10
        Inception
        2010
        84%
        78

        10
        Inception
        2010
        84%
        78

test

CSS:
* {
    padding: 0;
    margin: 0;
}
thead {
    position: fixed;
    top: 44px;
    left: 15px;
    background-color: white;
}
table {
    margin-top: 25px;
}
.ui-table-columntoggle-btn {
    display: none !important;
}

jsfiddle
There are much more, but I don't have enough rep to post more.
Does anyone have any experience with jQM and fixed theads?
Comment: i am the author of floatThead - I am curious as to why you think it does not work with jquery mobile? I think it does, but you just need to understand the nuances of how jquery mobile loads pages and what that means for how you init plugins
Comment: What jQuery have you used to try and do what you're wanting to do? You link to a jsfiddle and you've tagged the post with two jQuery related tags, but I see absolutely no jQuery.
Comment: @mkoryak i tried your plugin with my jQueryMobile app, plugin created a div outsite of my table container. position given to that div was absolute. when i scroll my page my thead doesn't get fixed. when i see in your page div's top is updated dynamically..but for my page it doesn't. I have initialized plugin with below code..              $("#tableItems").floatThead({
                scrollContainer: function ($table) {
                    return $table.closest('#tableContainer');
                }
            });
Comment: please use github to report issues. they can turn into a long back and forth, and stackoverflow is not a suitable place for that.
Answer: As mkoryak stated in his reply, floatThead works with jQuery Mobile.  I just ran in to the same need for my website.  I used jQuery 2.1.1 and jQM 1.4.4.
Here's the code:

    ...

...

                                COL 1
                                COL 2
                                COL 3

                                FIELD 1A
                                FIELD 2A
                                FIELD 3A

                                FIELD 1B
                                FIELD 2B
                                FIELD 3B

                                FIELD 1C
                                FIELD 2C
                                FIELD 3C

...

        ...

Comment: I did exactly what you suggested but no luck ..it does n't work !! what happens is my thead flows on the page header and then goes up..can you please suggest if any thing extra has to be done in the configuration..

Fixed thead in jQuery Mobile table